repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
prefix
stringlengths
0
8.16k
middle
stringlengths
3
512
suffix
stringlengths
0
8.17k
sandino/python-markdown-video
mdx_video.py
Python
lgpl-3.0
15,167
0.004417
#!/usr/bin/env python """ Embeds web videos using URLs. For instance, if a URL to an youtube video is found in the text submitted to markdown and it isn't enclosed in parenthesis like a normal link in markdown, then the URL will be swapped with a embedded youtube video. All resulting HTML is XHTML Strict compatible....
//www.metacafe.com/watch/yt-tZMsrr
QCnx8/pycon_2008_django_sprint_room/">Metacafe link</a></p>' Test Markdown Escaping >>> s = "\\http://www.metacafe.com/watch/yt-tZMsrrQCnx8/pycon_2008_django_sprint_room/" >>> markdown.markdown(s, ['video']) u'<p>http://www.metacafe.com/watch/yt-tZMsrrQCnx8/pycon_2008_django_sprint_room/</p>' >>> s = "`http://www.me...
evoskuil/czmq
bindings/python_cffi/czmq_cffi/Zfile.py
Python
mpl-2.0
6,377
0.001568
################################################################################ # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY # # Read the zproject/README.md for information about making permanent changes. # #############################################################################...
t is not used. """ p = utils.lib.zfile_new(utils.to_bytes(path), utils.to_bytes(name)) if p == utils.ffi.NULL: raise MemoryError("Could not allocate person")
# ffi.gc returns a copy of the cdata object which will have the # destructor called when the Python object is GC'd: # https://cffi.readthedocs.org/en/latest/using.html#ffi-interface self._p = utils.ffi.gc(p, libczmq_destructors.zfile_destroy_py) def dup(self): """ Dup...
catapult-project/catapult
third_party/gsutil/third_party/apitools/samples/storage_sample/uploads_test.py
Python
bsd-3-clause
6,523
0.000153
# # Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
def testSimpleUpload(self): filename = 'fifteen_byte_file' self.__ResetUpload(15) response = self.__InsertFile(filename) self.assertEqual(15, response.size) def testMultipartUpload(self): filename = 'fifteen_byte_file' self.__ResetUpload(15)
request = self.__InsertRequest(filename) request.object = storage.Object(contentLanguage='en') response = self.__InsertFile(filename, request=request) self.assertEqual(15, response.size) self.assertEqual('en', response.contentLanguage) def testAutoUpload(self): filen...
kaffeel/oppia
extensions/rich_text_components/Image/Image.py
Python
apache-2.0
2,465
0
# coding: utf-8 # # Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
icon_data_url = ( 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAA' 'ABGdBTUEAAK/INwWK6QAAABl0RVh0%0AU29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZ'
'TwAAAHwSURBVDjLpZM9a1RBFIafM/fevfcmC7uQ%0AjWEjUZKAYBHEVEb/gIWFjVVSWEj' '6gI0/wt8gprPQykIsTP5BQLAIhBVBzRf52Gw22bk7c8YiZslu%0AgggZppuZ55z3nfdIC' 'IHrrBhg%2BePaa1WZPyk0s%2B6KWwM1khiyhDcvns4uxQAaZOHJo4nRLMtEJPpn%0AxY6' 'Cd10%2BfNl4DpwBTqymaZrJ8uoBHfZoyTqTYzvkSRMXlP2jnG8bFYbCXWJGePlsEq8iPQ' ...
dieseldev/diesel
examples/forker.py
Python
bsd-3-clause
255
0.007843
from diesel import Loop, fork, Application, sleep def sleep_and_print(num): sleep(1) print num sleep(1) a.halt() def forker(): for x in xrange(5): fork(sleep_and_print, x) a = Application() a.add_l
oop(Loop(forker)) a
.run()
jonfoster/pyxb1
pyxb/bundles/opengis/iso19139/20070417/gmx.py
Python
apache-2.0
61
0
from pyxb
.bundles.opengis.iso19139.20070417.raw.gmx imp
ort *
albiremo/aerotools-hm
geometry.py
Python
gpl-3.0
5,740
0.036411
#import #----------------------------------------------------- import numpy as np from scipy.linalg import solve,solve_banded import matplotlib as mp mp.use("Qt4Agg") import scipy as sp #import matplotlib.pyplot as plt from numpy import pi #------------------------------------...
t complained # xc = 0.5*(1-np.cos(np.arange(0,pi,pi/(nc-1)))) xc = np.linspace(0,1,num = nc-1,endpoint = True) nv = 2*nc-1 #number of panel vertices, must be double of number of nodes but #minus 1, because we have 1 more node on chord than number of vertices xv = np.zeros([nv],dtype=np.float64) y...
nn = len(code) if nn>5 or nn<4: print('error enter a NACA 4 or 5 digit code') return else: if nn==4: #4 digit case A=list(code) mc=np.int(A[0]) #maximum camber pos_mc=np.int(A[1]) #position of maximum camber SS=np.i...
BtpPrograms/MHacks8
Python/emg_test.py
Python
gpl-3.0
1,120
0.004464
# This file is from us, not the library developer from __future__ import print_function from collections import Counter import struct import sys import time import numpy as np try: from sklearn import neighbors, svm HAVE_SK = True except ImportError: HAVE_SK = False try: import pygame from pygam...
'__main__': m = myo.Myo(myo.NNClassifier(), sys.argv[1] if len(sys.argv) >= 2 else None) hnd = EMGHandler(m) m.add_emg_handler(hnd) m.connect() try: while
True: m.run() print(hnd.emg) except KeyboardInterrupt: pass finally: m.disconnect() print() if HAVE_PYGAME: pygame.quit()
dstansby/heliopy
heliopy/data/test/test_helios.py
Python
gpl-3.0
2,429
0
from datetime import datetime import pathlib import shutil import urllib import pytest from .util import check_data_output, website_working helios = pytest.importorskip('heliopy.data.helios') pytest.mark.skipif( not website_working('https://helios-data.ssl.berkeley.edu/data/')) pytestmark = pytest.mark.data pro...
s.ion_dists( '1', datetime(1974, 12, 1
2), datetime(1974, 12, 13)) def test_mag_4hz(): starttime = datetime(1976, 1, 16) endtime = datetime(1976, 1, 18) probe = '2' df = helios.mag_4hz(probe, starttime, endtime) check_data_output(df)
madcowfred/evething
thing/tasks/reftypes.py
Python
bsd-2-clause
2,946
0.004073
# ------------------------------------------------------------------------------ # Copyright (c) 2010-2013, EVEthing team # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # Redistributions of...
jects.in_bulk(bulk_data.keys()) new = [] for refTypeID, row in bulk_data.items(): reftype = rt_map.get(refTypeID) # RefType does not exist, make a new one if reftype is None: new.append(RefType( id=refTypeID, n...
rib['refTypeName']: reftype.name = row.attrib['refTypeName'] reftype.save() # Create any new stations if new: RefType.objects.bulk_create(new) return True # ---------------------------------------------------------------------------
HiSPARC/station-software
user/python/Lib/test/test_unicode_file.py
Python
gpl-3.0
8,417
0.001782
# Test some Unicode file name semantics # We dont test many operations on files other than # that their names can be used with Unicode characters. import os, glob, time, shutil import unicodedata import unittest from test.test_support import run_unittest, change_cwd, TESTFN_UNICODE from test.test_support import TESTFN...
os.lstat(filename2)) # Copy/rename etc tests using equivalent filename self._do_copyish(filename1, filename2) # Tests that copy, move, etc one file to another. def _do_copyish(self, filename1, fil
ename2): # Should be able to rename the file using either name. self.assertTrue(os.path.isfile(filename1)) # must exist. os.rename(filename1, filename2 + ".new") self.assertTrue(os.path.isfile(filename1+".new")) os.rename(filename1 + ".new", filename2) self.assertTrue(os....
t-umeno/dpkt_merge_pcap
dpkt_merge_pcap.py
Python
bsd-3-clause
1,539
0.014945
#!/usr/bin/python import getopt, sys import dpkt,socket def usage(): print "dpkt_merge_pcap [-l input_pcap_file_list] [-o output_pcap_file]" def main(): input_pcap_file_list="/dev/stdin" output_pcap_file="/dev/stdout" try: opts, args = getopt.getopt(sys.argv[1:], "hl:o:", ["help", "input_pca...
tput_pcap_file"): output_pcap_file = a else: assert False, "unhandled option" output
_pcap = open(output_pcap_file,'wb') pcw = dpkt.pcap.Writer(output_pcap) f = open(input_pcap_file_list) line = f.readline() line = line.rstrip() if len(line) > 0: input_pcap = open(line,'rb') pcr = dpkt.pcap.Reader(input_pcap) for ts,buf in pcr: pcw.writepkt(buf,t...
Mozpacers/Moz-Connect
moz_connect/wsgi.py
Python
mit
399
0
""" WSGI config for moz_connect project. It exposes the WSGI callable as a module-level var
iable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "moz_connect.settings") application = get_
wsgi_application()
gautamMalu/rootfs_xen_arndale
usr/lib/python3.4/pathlib.py
Python
gpl-2.0
41,820
0.000598
import fnmatch import functools import io import ntpath import os import posixpath import re import sys from collections import Sequence from contextlib import contextmanager from errno import EINVAL, ENOENT from operator import attrgetter from stat import S_ISDIR, S_ISLNK, S_ISREG, S_ISSOCK, S_ISBLK, S_ISCHR, S_ISFIFO...
two successive slashes may be # interpreted in an implementation-defined manner, although more # than two leading slashes shall be treated as a single slash".
if len(part) - len(stripped_part) == 2: return '', sep * 2, stripped_part else: return '', sep, stripped_part else: return '', '', part def case
jasonmccampbell/numpy-refactor-sprint
numpy/core/tests/test_unicode.py
Python
bsd-3-clause
11,858
0.002952
import sys from numpy.testing import * from numpy.core import * from numpy.compat import asbytes # Guess the UCS length for this python interpreter if sys.version_info[0] >= 3: import array as _array ucs4 = (_array.array('u').itemsize == 4) def buffer_length(arr): if isinstance(arr, unicode): ...
ss test_create_values_1009_ucs4(create_values, TestCase): """Check the creation of valued arrays (size 1009, UCS4 values)""" ulen = 1009 ucs_value = ucs4_value ############################################################ # Assignment tests ############################################################ c...
ytes): # Check the length of the unicode base type self.assert_(int(ua.dtype.str[2:]) == self.ulen) # Check the length of the data buffer self.assert_(buffer_length(ua) == nbytes) # Small check that data in array element is ok self.assert_(ua_scalar == self.ucs_value*sel...
Fat-Zer/FreeCAD_sf_master
src/Mod/Plot/plotSave/TaskPanel.py
Python
lgpl-2.1
8,708
0.002526
#*************************************************************************** #* * #* Copyright (c) 2011, 2012 * #* Jose Luis Cercos Pita <[email protected]> * #* ...
or detail see the LICENCE text file. * #* * #* This program is distributed in the hope that
it will be useful, * #* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* GNU Library General Public License for more details. * #* ...
niqdev/packtpub-crawler
script/utils.py
Python
mit
2,506
0.00399
import requests import ConfigParser from bs4 import BeautifulSoup from time import sleep from clint.textui import progress import os, sys, itertools from threading import Thread from logs import * def ip_address(): """ Gets current IP address """ response = requests.get('http://www.ip-addr.es') pr...
= response.headers.get('content-length') if test_length is not None: total_length = int(test_length) with open(path, 'wb') as f: for chunk in progress.bar(response.iter_content(chunk_size=1024), expected_size=(total_length/1024) + 1): if chunk: f.write(chunk) ...
a thread with loading bar """ thread = Thread(target=function) thread.start() spinner = itertools.cycle(['-', '/', '|', '\\']) while thread.is_alive(): sys.stdout.write(spinner.next()) sys.stdout.flush() # erase the last written char sys.stdout.write('\b')
nirs/vdsm
tests/storage/securable_test.py
Python
gpl-2.0
3,360
0
# # Copyright 2012-2016 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
urn True class TestSecurable(VdsmTestCase): def assertUnsecured(self, secureObject): self.assertRaises(SecureError, secureObject.securedMethod) secureObject.unsecuredMethod() def assertSecured(self, secureObject): secureObject.securedMethod() secureObject.unsecuredMethod() ...
ClassWithoutIsSecureMethod) self.assertRaises(NotImplementedError, secured, ClassIsSecureClassMethod) def testSecurable(self): secureObject = SecureClass() self.assertUnsecured(secureObject) secureObject.secured = True self.assertSecur...
NorthIsUp/sf-lindy
src/sflindy/manage.py
Python
bsd-3-clause
277
0.00361
#!/usr/bin/env python import os import sys def main(): os.environ.setdefault("DJANGO
_SETTINGS_MODULE", "sflindy.settings") from django.core.management import execute_from_command_line ex
ecute_from_command_line(sys.argv) if __name__ == "__main__": main()
mseclab/AHE17
YouCanHideButYouCannotRun/multithreads.py
Python
mit
2,670
0.004494
""" Allow to trace called methods and package """ import frida import re syms = [] def on_message(message, data): global syms global index, filename if message['type'] == 'send': if "SYM" in message["payload"]: c = message["payload"].split(":")[1] print c syms.a...
process = attach_to_process("hackchallenge.ahe17.teamsik.org.romanempire") script = get_script() try: script = process.create_script(script) except frida.InvalidArgumentError as e: message = e.args[0] line = re.compile('Script\(line (\d+)\)') line = int(line.findall(message...
mat(line, line, script[line]) exit(0) script.on('message', on_message) print('[*] Attached on process') print('[*] Press enter to exit...') script.load() try: raw_input() except KeyboardInterrupt: pass print "FLAG: " + "".join(syms)
karelvysinka/connector-woocommerce
woocommerceerpconnect/unit/binder.py
Python
agpl-3.0
6,183
0
# -*- coding: utf-8 -*- # # # Tech-Receptives Solutions Pvt. Ltd. # Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free ...
d = self.model.browse() if isinstance(record_id, openerp.models.BaseMod
el): record_id.ensure_one() record = record_id record_id = record_id.id if wrap: binding = self.model.with_context(active_test=False).search( [('openerp_id', '=', record_id), ('backend_id', '=', self.backend_record.id), ...
gnowgi/gnowsys-studio
objectapp/urls/add.py
Python
agpl-3.0
3,741
0.000802
# Copyright (c) 2011, 2012 Free Software Foundation # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later vers...
ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.or...
ews.add', url(r'^gbobject/$', 'addgbobject', name='objectapp_add_gbobject'), url(r'^process/$', 'addprocess', name='objectapp_add_gbobject'), url(r'^system/$', 'addsystem', ...
NekBox/nekpy
nekpy/dask/runner.py
Python
mit
1,462
0.004788
from dask.callbacks import Callback from os import getcwd, remove from os.path import join, exists from dask.diagnostics import ProgressBar from dask.multiprocessing import get as get_proc import toolz import json class NekCallback(Callback): def __init__(self, case): self.case = case self.cwd = g...
f.cwd, "HALT")): remove(join(self.cwd, "HALT")) def _posttask(self, key, result, dsk, state, id): self.cache.update(state['cache']) with open(join(self.cwd, "{}.cache".
format(self.case["prefix"])), "w") as f: json.dump(self.cache, f) if exists(join(self.cwd, "HALT")): for k in state['ready']: state['cache'][k] = None for k in state['waiting']: state['cache'][k] = None state['ready'] = [] ...
mdbartos/RIPS
temperature/elec_temp_join.py
Python
mit
2,831
0.011657
import datetime import os import numpy as np import pandas as pd from shapely import geometry import geopandas as gpd from geopandas import tools import sys sys.path.append('/home/kircheis/github/RIPS') from rect_grid import rect_grid #### DECLARE FILE PATHS utility = '/home/kircheis/data/shp/Electric_Retail_Service_...
TILITY SERVICE AREAS WITH TEMPERATURE FORCINGS ua_g = tools.sjoin(ua, g) ua_g['grid_geom'] = ua_g['index_right'].map(g['geometry']) ua_g['dist'] = ua_g.apply(lambda x: (x['geometry'].centroid).distance(x['grid_geom'].centroid), axis=1) ua_g_out = ua_g.reset_index().loc[ua_g.reset_index().groupby('index').idxmin('dist...
### MAP COORDINATE STRING TO ORIGINAL JOIN j['grid_cell'] = j['index_right'].map(ua_g_out['coordstr']) j['POP'] = j['UACE10'].map(uapop['POP']) eia_to_util = pd.read_csv('/home/kircheis/github/RIPS/crosswalk/util_eia_id.csv', index_col=0) j['eia_code'] = j['UNIQUE_ID'].map(eia_to_util['company_id']) #### WRITE TO ...
Irishsmurf/A-Dinosaur-Tale
gamelib/ezmenu.py
Python
gpl-3.0
1,510
0.045695
import pygame class EzMenu: def __init__(self, *options): self.options = options self.x = 0 self.y = 0 self.font = pygame.font.Font(None, 32) self.option = 0 self.width = 1 self.color = [0, 0, 0] self.hcolor = [255, 0, 0] self.height = len(self.options)*self.font.get_height() for o in self.options...
surface.blit(ren, ((self.x+self.width/2) - ren.get_widt
h()/2, self.y + i*(self.font.get_height()+4))) i+=1 def update(self, events): for e in events: if e.type == pygame.KEYDOWN: if e.key == pygame.K_DOWN: self.option += 1 if e.key == pygame.K_UP: self.option -= 1 if e.key == pygame.K_RETURN: self.options[self.option][1]() if self....
micolous/ledsign
cpower1200_rss.py
Python
lgpl-3.0
1,615
0.005573
#!/usr/bin/env python """ RSS Reader for C-Power 1200 Copyright 2010-2012 Michael Farrell <http://micolous.id.au/> This library is free software:
you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even...
AR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ from cpower1200 import * import feedparser from sys import argv FEED = 'http://news.google.com.au/news?p...
BSGOxford/BrowseVCF
web/scripts/script07_use_gene_list.py
Python
gpl-3.0
8,403
0.022373
#!/usr/bin/env python import os import sys import glob import argparse from datetime import datetime import platform if platform.system().lower() == 'darwin': os.environ['PYTHONPATH'] = '%s/osx_libs:$PYTHONPATH' % os.getcwd() import wormtable as wt ###########################################################...
ll row IDs which are not in "pos_ids" if negative_query == 'True': neg_ids = all_ids - pos_ids return neg_ids elif negative_query == 'False': return pos_ids def retrieve_variants_by_rowid(inp_folder, ids, out_file): """ Use the row IDs in ids to query the complete wormtable (containing all variant ...
l the information about the filtered variants. """ # open table and load indices table = wt.open_table(inp_folder + '/schema.wt', db_cache_size='4G') index = table.open_index('row_id') # retrieve the rows using the 'row_id' field and write the results in out_file col_names = [col.get_name() for col in tabl...
hehongliang/tensorflow
tensorflow/python/kernel_tests/signal/mfcc_ops_test.py
Python
apache-2.0
2,543
0.005505
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
f test_error(self): # num_mel_bins must be positive. with self.assertRaises(ValueError): signal = array_ops.zeros((2, 3, 0)) mfcc_ops.mfccs_from_log_mel_spectrograms(signal) # signal must be float32 with self.assertRaises(ValueError):
signal = array_ops.zeros((2, 3, 5), dtype=dtypes.float64) mfcc_ops.mfccs_from_log_mel_spectrograms(signal) def test_basic(self): """A basic test that the op runs on random input.""" with spectral_ops_test_util.fft_kernel_label_map(): with self.session(use_gpu=True): signal = random_ops...
wang-g/wang-g.github.io
support_data.py
Python
mit
4,150
0.006265
from __future__ import division from bs4 import BeautifulSoup import urllib2 import re def url_request(url): hdr = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36', 'Accept':'*/*'} request = urllib2.Request(url, headers=hd...
d('th').text.strip() mana_entry = row_entries[mana_mult_col].text.strip().strip('%') try: mana_mults.append((int(level_entry),int(mana_entry)/100)) except ValueError: continue return mana_mults else: return None def find_supports(b...
ngs('th') mcm_col = -1 for i in range(len(support_headers)): if support_headers[i].text == 'MCM': ## print "header_location: " + str(i + 1) mcm_col = i + 1 break table = header.find_parent('table') rows = table.find_all('tr') base_url = 'http://pathofexile....
jiajiax/crosswalk-test-suite
apptools/apptools-android-tests/apptools/comm.py
Python
bsd-3-clause
7,398
0.002298
#!/usr/bin/env python # # Copyright (c) 2015 Intel Corporation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of works must retain the original copyright notice, this # list of conditions and t...
N) HOWEVER CAUSED AND ON ANY THEORY # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Authors: # Hongjuan, Wang
<[email protected]> # Yun, Liu<[email protected]> import os import sys import commands import shutil import urllib2 SCRIPT_PATH = os.path.realpath(__file__) ConstPath = os.path.dirname(SCRIPT_PATH) def setUp(): global device, XwalkPath, crosswalkVersion, PackTools, ARCH, cachedir #device = ...
ianare/exif-py
exifread/tags/makernote/fujifilm.py
Python
bsd-3-clause
3,010
0
""" Makernote (proprietary) tag definitions for FujiFilm. http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/FujiFilm.html """ from ...utils import make_string TAGS = { 0x0000: ('NoteVersion', make_string), 0x0010: ('InternalSerialNumber', ), 0x1000: ('Quality', ), 0x1001: ('Sharpness', { ...
, 0x100: 'Daylight', 0x200: 'Cloudy', 0x300: 'Daylight Fluorescent', 0x301: 'Day White Fluorescent', 0x302: 'White Fluorescent', 0x303:
'Warm White Fluorescent', 0x304: 'Living Room Warm White Fluorescent', 0x400: 'Incandescent', 0x500: 'Flash', 0x600: 'Underwater', 0xf00: 'Custom', 0xf01: 'Custom2', 0xf02: 'Custom3', 0xf03: 'Custom4', 0xf04: 'Custom5', 0xff0: 'Kelvin' ...
Southpaw-TACTIC/Team
src/python/Lib/site-packages/PySide/examples/network/http.py
Python
epl-1.0
5,973
0.001842
#!/usr/bin/env python """PySide port of the network/http example from Qt v4.x""" import sys from PySide import QtCore, QtGui, QtNetwork class HttpWindow(QtGui.QDialog): def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.urlLineEdit = QtGui.QLineEdit("http://www.ietf.org/...
le = None self.httpGetId = 0 self.httpRequestAborted = False self.connect(self.urlLineEdit, QtCore.SI
GNAL("textChanged(QString &)"), self.enableDownloadButton) self.connect(self.http, QtCore.SIGNAL("requestFinished(int, bool)"), self.httpRequestFinished) self.connect(self.http, QtCore.SIGNAL("dataReadProgress(int, int)"), self.updateDataRea...
easytaxibr/mockrista
simpleserver.py
Python
mit
6,740
0.04273
#Modicado from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer from SocketServer import ThreadingMixIn from urlparse import urlparse import json import threading import argparse import re import cgi import random import sys import math positions = [ {"lat": -23.542887 , "lng": -46.73158}, {"lat": -23.542179...
{"taxis": self.randomTaxiPositionJson(lat, lng, 10), "agarage-eta": 5} self.send_response(200) self.send_header('Content-Type', 'application/json') self.end_headers() self.wfile.write(json.dumps(response)) else: self.send_response(403) self.send_
header('Content-Type', 'application/json') self.end_headers() except ValueError: print ValueError self.send_response(400) self.send_header('Content-Type', 'application/json') self.end_headers() return class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): allow_reuse_address = True def shutdow...
tmetsch/suricate
suricate/ui/api.py
Python
mit
13,237
0
# coding=utf-8 """ An API used by the UI and RESTful API. """ from bson import ObjectId __author__ = 'tmetsch' import collections import json import pika import pika.exceptions as pikaex import uuid from suricate.data import object_store from suricate.data import streaming TEMPLATE = ''' % if len(error.strip()) >...
:param token: The token of the user. """ self.stream.create(uid, token, uri, queue) def retrieve_stream(self, iden, uid, token): """ Retrieve a data stream. :param iden: Id of the stream. :param uid: Identifier for the user. :param token: The token of t...
uri, queue, msgs def delete_stream(self, iden, uid, token): """ Delete a data stream. :param iden: Id of the stream. :param uid: Identifier for the user. :param token: The token of the user. """ self.stream.delete(uid, token, iden) def set_meta(self, da...
psykzz/flask-rollbar
tests/test_flake8.py
Python
mit
1,281
0.003903
# -*- coding: utf8 -*- from __future__ import unicode_literals import unittest import os import sys from flake8.api import legacy as engine if sys.version_info[0] == 3: unicode = str if sys.version_info[:2] == (2, 6): # Monkeypatch to make tests work on 2.6 def assert_less(first, second, msg=None): ...
"Code fo
und to be too complex or failing PEP8") if __name__ == '__main__': unittest.main()
improlabs/Banglish-Sentiment-Analysis
python3/pyavrophonetic/config.py
Python
gpl-3.0
1,660
0
#!/usr/bin/env python """Provides configurations for pyAvroPhonetic ------------------------------------------------------------------------------- Copyright (C) 2013 Kaustav Das Modak <[email protected]. This file is part of pyAvroPhonetic. pyAvroPhonetic is free software: you can redistribut...
ejson as json import codecs # Constants # -- Path to current directory BASE_PATH = os.path.dirname
(__file__) # -- path to avrodict.json AVRO_DICT_FILE = os.path.abspath(os.path.join(BASE_PATH, "resources/avrodict.json")) # -- Loads json data from avrodict.json AVRO_DICT = json.load(codecs.open(AVRO_DICT_FILE, encoding='utf-8')) # -- Shortcut to vowels AVRO_VOWELS...
sandow-digital/django-seo
rollyourown/seo/default.py
Python
bsd-3-clause
1,038
0.010597
#!/usr/bin/env python # -*- coding: UTF-8 -*- from rollyourown import seo from django.conf import settings class DefaultMetadata(seo.Metadata): """ A very basic default class for those who do not wish to write their own. """ title = seo.Tag(head=True, max_length=68) keywords = seo.MetaTag() ...
h engines." description = "A short description, displayed in search results." head
ing = "This is the page heading, appearing in the &lt;h1&gt; tag."
isaacdixon274/httpy
server.py
Python
gpl-3.0
3,664
0.043122
#httpy server #A simple HTTP
server written in Python import socket #Import sockets import os #Import os import mimetypes #Import mimetypes import subprocess import datetime conf = { 'port': '80', 'max_request_size': '2048', 'server_dir': '/etc/httpy', 'www_dir': '/var/www', 'log_dir': '/var/log/httpy', 'main_log': 'main.log', 'error_log'...
= confFile.readlines() confFile.close() for line in lines: line = line.rstrip('\n') if line.replace(' ', '') != '': if line.lstrip(' ')[0] != '#': key, value = line.split('=') conf[key] = value def log(ip = '127.0.0.1', event = 'error', msg = ''): msg = str(datetime.datetime.now()) + '\t' + ip + '\t' + eve...
ghorn/casadi
test/python/vectortools.py
Python
lgpl-3.0
1,561
0.014734
# # This file is part of CasADi. # # CasADi -- A symbolic framework for dynamic optimization. # Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl, # K.U. Leuven. All rights reserved. # Copyright (C) 2011-2014 Greg Horn # # CasADi is free software; you can...
mplement(w,6) ) wc = list(complement(w,8)) self.checkarray
(DM(wc),DM([0,3,5,7]),"complement") if __name__ == '__main__': unittest.main()
t0mk/ansible
lib/ansible/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py
Python
gpl-3.0
11,833
0.001859
#!/usr/bin/python # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed...
lication_secret: required: true description: - The application secret to use consumer_key: required: true description: - The consumer key to use timeout: required: false default: 120 description: - The timeout in seconds...
ify the backend '212.1.1.1' to a # loadbalancing 'ip-1.1.1.1' - ovh_ip_loadbalancing: name: ip-1.1.1.1 backend: 212.1.1.1 state: present probe: none weight: 8 endpoint: ovh-eu application_key: yourkey application_secret: yoursecret consumer_key: yourconsumerkey # Removes a backend '...
newvem/pytz
pytz/zoneinfo/US/Eastern.py
Python
mit
9,981
0.213105
'''tzinfo timezone information for US/Eastern.''' from pytz.tzinfo import DstTzInfo from pytz.tzinfo import memorized_datetime as d from pytz.tzinfo import memorized_ttinfo as i class Eastern(DstTzInfo): '''US/Eastern timezone definition. See datetime.tzinfo for details''' zone = 'US/Eastern' _utc_transi...
1938,4,24,7,0,0), d(1938,9,25,6,0,0), d(1939,4,30,7,0,0), d(1939,9,24,6,0,0), d(1940,4,28,7,0,0), d(1940,9,29,6,0,0), d(1941,4,27,7,0,0), d(1941,9,28,6,0,0), d(1942,2,9,7,0,0), d(1945,8,14,23,0,0), d(1945,9,30,6,0,0), d(1946,4,28,7,0,0), d(1946,9,29,6,0,0), d(1947,4,27,7,0,0), d(1947,9,28,6,0
,0), d(1948,4,25,7,0,0), d(1948,9,26,6,0,0), d(1949,4,24,7,0,0), d(1949,9,25,6,0,0), d(1950,4,30,7,0,0), d(1950,9,24,6,0,0), d(1951,4,29,7,0,0), d(1951,9,30,6,0,0), d(1952,4,27,7,0,0), d(1952,9,28,6,0,0), d(1953,4,26,7,0,0), d(1953,9,27,6,0,0), d(1954,4,25,7,0,0), d(1954,9,26,6,0,0), d(1955,4,24,7,0,0), d(1955,10,30,6,...
obtitus/py-boinc-plotter
pyBoincPlotter/__init__.py
Python
gpl-3.0
914
0
#!/usr/bin/env python # This file is part of the py-boinc-plotter, # which provides parsing and plotting of boinc statistics and # badge information. # Copyright (C) 2013 [email protected] # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as ...
END LICENCE import boinc import changePrefs import boinccmd import browser impor
t plot
NendoTaka/CodeForReference
CodeWars/7kyu/divisibleBySeven.py
Python
mit
262
0.003817
def helper(m): if m < 10: return (m, 0) count = 1 k = m//10 k -= 2 * (m % 10) if k > 10
0: a = helper(k) count += a[1] k = a[0] return
(k, count) def seven(m): return helper(m) # your code
whyflyru/django-seo
djangoseo/utils.py
Python
bsd-3-clause
7,375
0.00122
# -*- coding: utf-8 -*- import logging import re import importlib import django import six from django.contrib.sites.shortcuts import get_current_site from django.utils.functional import lazy from django.utils.safestring import mark_safe from django.utils.module_loading import import_string from django.utils.html impo...
dule = importlib.import_module(settings.ROOT_URLCONF) if six.PY2: reload(module) else: importlib.reload(module) cle
ar_url_caches() def register_model_in_admin(model, admin_class=None): """ Register model in Django admin interface """ from django.contrib import admin admin.site.register(model, admin_class) _reload_urlconf() def create_dynamic_model(model_name, app_label='djangoseo', **attrs): """ ...
kiwix/gutenberg
gutenbergtozim/urls.py
Python
gpl-3.0
7,238
0.000829
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu from __future__ import (unicode_literals, absolute_import, division, print_function) import os import platform from collections import defaultdict from gutenbergtozim.database import Book, BookFormat, Url from gute...
return url def with_base(self, base): self.base = base def with_id(self, b_id): self.b_id = b_id def __unicode__(self): return self.
build_url() def get_urls(book): """ Get all possible urls that could point to the book on either of the two mirrors. param: book: The book you want the possible urls from returns: a list of all possible urls sorted by their probability """ filtered_book = [bf.format for bf in ...
CyberVines/Universal-Quantum-Cymatics
Record_RX.py
Python
mit
6,310
0.004279
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # SPDX-License-Identifier: GPL-3.0 # # GNU Radio Python Flow Graph # Title: Record_RX # Author: Justin Ried # GNU Radio version: 3.8.1.0 from distutils.version impor
t StrictVersion if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads()
except: print("Warning: failed to XInitThreads()") from PyQt5 import Qt from gnuradio import qtgui from gnuradio.filter import firdes import sip from gnuradio import blocks from gnuradio import gr import sys import signal from argparse import ArgumentParser from gnuradio.eng_arg import eng_float, intx fr...
davy39/eric
Preferences/Ui_ShortcutDialog.py
Python
gpl-3.0
4,515
0.003544
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file './Preferences/ShortcutDialog.ui' # # Created: Tue Nov 18 17:53:56 2014 # by: PyQt5 UI code generator 5.3.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_ShortcutDialog(obj...
) self.shortcutsGroup = QtWidgets.QGroupBox(ShortcutDialog) self.shortcutsGroup.setTitle("") self.shortcutsGroup.setObjectName("shortcutsGroup") self.gridLayout = QtWidgets.QGridLayout(self.shortcutsGroup) self.gridLayout.setObjectName("g
ridLayout") self.primaryButton = QtWidgets.QRadioButton(self.shortcutsGroup) self.primaryButton.setFocusPolicy(QtCore.Qt.NoFocus) self.primaryButton.setChecked(True) self.primaryButton.setObjectName("primaryButton") self.gridLayout.addWidget(self.primaryButton, 0, 0, 1, 1) ...
odoousers2014/LibrERP
base_address_contacts/res_partner_address.py
Python
agpl-3.0
10,827
0.00351
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2013 - TODAY Denero Team. (<http://www.deneroteam.com>) # All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affe...
elete='set null', select=True, help="Keep empty for a private address, not related to partner.", required=True), 'contact_ids': fields.one2many('res.partner.address.contact', 'address_id', 'Functions and Contacts'), 'mobile': fields.char('Mobile', size=64), 'pec': fields.char('PEC', size=64), ...
(get_full_name, m
google-research/tf-slim
tf_slim/ops/framework_ops.py
Python
apache-2.0
2,660
0.002256
# coding=utf-8 # Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
nferred from `op_input_list`, we attempt to use the default graph. Args: op_input_list: A list of inputs to an operation, which may include `Tensor`, `Operation`, and other objects that may be converted to a graph element. graph: (Optional) The explici
t graph to use. Raises: TypeError: If `op_input_list` is not a list or tuple, or if graph is not a Graph. ValueError: If a graph is explicitly passed and not all inputs are from it, or if the inputs are from multiple graphs, or we could not find a graph and there was no default graph. Re...
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/scipy/optimize/_basinhopping.py
Python
mit
27,548
0.000399
""" basinhopping: The basinhopping global optimization algorithm """ from __future__ import division, print_function, absolute_import import numpy as np from numpy import cos, sin import scipy.optimize import collections from scipy._lib._util import check_random_state __all__ = ['basinhopping'] class Storage(object...
ss: self.res.minimization_failures += 1 if self.disp: print("warning: basinhopping: local minimization failure") if ha
sattr(minres, "nfev"): self.res.nfev += minres.nfev if hasattr(minres, "njev"): self.res.njev += minres.njev if hasattr(minres, "nhev"): self.res.nhev += minres.nhev # accept the move based on self.accept_tests. If any test is False, # than reject the...
korovkin/WNNotifier
notifier/parcon/options.py
Python
apache-2.0
381
0.010499
class Options(object): def __init__(self, m, d={}, **defa
ults): self.values = {} self.values.update(defaults) self.values.update(d) self.values.update(m) def __getattr__(self, name): return self.values[name] __get
item__ = __getattr__ def __iter__(self): for k, v in self.values: yield k, v
elianerpereira/gtg
GTG/tests/test_backend_tomboy.py
Python
gpl-3.0
15,680
0.000319
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Getting Things GNOME! - a personal organizer for the GNOME desktop # Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau # # This program is free software: you can redistribute it and/or modify it under # t...
sk task = self.datastore.requester.new_task() task.set_title("title") self.backend.set_task(task) self.assertEqual(len(self.tom
boy.ListAllNotes()), 1) note = self.tomboy.ListAllNotes()[0] self.assertEqual(str(self.tomboy.GetNoteTitle(note)), task.get_title()) # re-adding that (should not change anything) self.backend.set_task(task) self.assertEqual(len(self.tomboy.ListAllNotes()), 1) self.assertE...
darkpeach/AlgorithmCoding
_206_ReverseLinkedList.py
Python
epl-1.0
297
0.003367
class Solution(object): def reverseList(self,
head): """ :type head: ListNode :rtype: ListNode """ pre = None while head: temp = head.next head.next = pre pre = head hea
d = temp return pre
jameswatt2008/jameswatt2008.github.io
python/Python核心编程/网络编程/截图和代码/概述、SOCKET/多进程copy文件/test/tarfile.py
Python
gpl-2.0
92,927
0.001614
#! /usr/bin/python3.5 #------------------------------------------------------------------- # tarfile.py #------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustaebel <[email protected]> # All rights reserved. # # Permission is hereby granted, free of charge, to any perso...
import grp, pwd except ImportError: grp = pwd = None # os.symlink on Windows prior to 6.0 raises NotImplementedError symlink_exception = (AttributeError, NotImplementedError) try: # OSError (winerror=1314) will be raised if the call
er does not hold the # SeCreateSymbolicLinkPrivilege privilege symlink_exception += (OSError,) except NameError: pass # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] #--------------------------------------------------------- # tar constants #-----------------------------...
mdaif/olympia
apps/api/middleware.py
Python
bsd-3-clause
3,064
0
from django.conf import settings from django.contrib.auth.models import AnonymousUser import commonware.log import waffle from users.models import UserProfile from .models import Access from .oauth import OAuthServer log = commonware.log.getLogger('z.api') class RestOAuthMiddleware(object): """ This is b...
r_id', flat=True)[
0] if not uid: log.error(u'Cannot find Access with that key: %s' % oauth_request.client_key) return request.user = UserProfile.objects.get(pk=uid) # But you cannot have one of these roles. denied_groups = set(['Admins']) roles = set...
hatwar/buyback-erpnext
erpnext/accounts/utils.py
Python
agpl-3.0
17,424
0.024908
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import nowdate, cstr, flt, now, getdate, add_months from frappe import throw, _ from frappe.utils import formatdate imp...
ppe.db.sql("""
SELECT {0} FROM `tabGL Entry` gle WHERE {1}""".format(select_field, " and ".join(cond)))[0][0] # if bal is None, return 0 return flt(bal) @frappe.whitelist() def add_ac(args=None): if not args: args = frappe.local.form_dict args.pop("cmd") ac = frappe.new_doc("Account") ac.update(args) ac.old_pare...
MuteSpirit/mute_expect
paramiko_process.py
Python
mit
4,439
0.008335
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################################ ## @todo Add delaybeforesend, delayafterclose, delayafterterminate ## # Most Linux machines don't like delaybeforesend to be below 0.03 (30 ms). ## # self.delaybeforesend = 0.05 # Sets sl...
(cmd_line) self._chan_fd = self._chan.fileno() self._closed = False self._terminated = False def __del__(self): """This makes sure that no system resources a
re left open. Python only garbage collects Python objects. OS file descriptors are not Python objects, so they must be handled explicitly. If the child file descriptor was opened outside of this class (passed to the constructor) then this does not close it. """ if not self._clos...
adiyengar/Spirit
example/project/settings/prod_local.py
Python
mit
781
0.002561
from __future__ import unicode_literals import os import sys from .prod import * DEBUG = True TEMPLATE_DEBUG = True # https://docs.djangoproject.com/en/dev/ref/settings/#admins ADMINS = (('Adi', '[email protected]'), ) # Secret key generator: https://djskgen.herokuapp.com/ # You should set your key as an envi...
4#q2*14ci4%zre") # htt
ps://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = ['localhost'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'sighht_deploy', 'USER': 'postgres', 'PASSWORD': 'Ad!020687shEsh', 'HOST': 'localhost', ...
PhloxAR/phloxar
PhloxAR/dc1394/frame.py
Python
apache-2.0
6,774
0.000443
# ----------------------------------------------------------------------------- # # -*- coding: utf-8 -*- # # phlox-libdc1394/dc1394/frame.py # # Copyright (C) 2016, by Matthias Yang Chen <[email protected]> # All rights reserved. # # phlox-libdc1394 is free software: you can redistribute it and/or modify it # un...
ame.contents.stride # save camera and frame for enqueue() img._frame = frame
img._cam = camera return img def __array_finalize__(self, img): """ Finalize the new Image class array. If called with an image object, inherit the properties of that image. """ if img is None: return # do not inherit _frame and _cam ...
mozilla/kitsune
kitsune/customercare/migrations/0002_auto_20210716_0556.py
Python
bsd-3-clause
640
0
# Generated by Django 2.2.23 on 2021-07-16 05:56 from django.db import migrations class Migration(mig
rations.Migration):
dependencies = [ ('customercare', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='reply', name='user', ), migrations.RemoveField( model_name='tweet', name='reply_to', ), migrations.Delete...
drewcsillag/skunkweb
pylibs/pargen/__init__.py
Python
gpl-2.0
951
0.011567
# # Copyright (C) 2001 Andrew T. Csillag <[email protected]> # # You may distribute under the terms of either the GNU General # Public License or the SkunkWeb License, as specified in the # README file. # """ This module implements a parser gener
ator, similar, but not identical to well-known tools such as Yacc or Bison. So unless you are writing a parser for some kind of computer language (that isn't HTML or XML), you probably can pass this module by. If you are writing a parser, pargen should be able to help. The input file to pargen is a file of the ...
d produce (hopefully) a parsing table for your grammar either in marshalled form, or a Python modular form (the default). The Parser module has the rest of the details. """
code4romania/czl-scrape
scrapy/czlscrape/utils.py
Python
mpl-2.0
2,713
0
import re from scrapy.selector import SelectorList DIACRITICS_RULES = [ (r'[șş]', 's'), (r'[ȘŞ]', 'S'), (r'[țţ]', 't'), (r'[ȚŢ]', 'T'), (r'[ăâ]', 'a'), (r'[ĂÂ]', 'A'), (r'[î]', 'i'), (r'[Î]', 'I'), ] ROMANIAN_MONTHS = { 'ianuarie': 1, 'februarie': 2, 'martie': 3, 'apri...
".docx", ".xlsx", ] def guess_initiative_type(text: str, rules: list) -> str: """ Try to identify the type of a law initiative from its description. Use a best guess approach. The rules are provided by the caller as a list of tuples. Each tuple is composed of a search string and the initiative...
rn: the type of initiative if a rule matches; "OTHER" if no rule matches """ text = strip_diacritics(text) for search_string, initiative_type in rules: if search_string in text: return initiative_type else: return "OTHER" def strip_diacritics(text: str) -> str: """...
adriaanvuik/solid_state_physics
lll.py
Python
bsd-2-clause
6,649
0.00015
# Copyright 2011-2013 Kwant authors. # # This file is part of Kwant. It is subject to the license terms in the file # LICENSE.rst found in the top-level directory of this distribution and at # http://kwant-project.org/license. A list of Kwant authors can be found in # the file AUTHORS.rst at the top-level directory o...
n an array of lattice vectors forming its voronoi cell. Parameters ---------- basis : 2d array-like of floats Basis vectors for which the Voronoi neighbors have to be found. Returns ------- voronoi_neighbors : numpy array of ints All the lattice vectors that may potentially nei...
safe than sorry. """ basis = np.asarray(basis) if basis.ndim != 2: raise ValueError('`basis` must be a 2d array-like object.') displacements = list(product(*(len(basis) * [[0, .5]])))[1:] vertices = np.array([cvp(np.dot(vec, basis), basis)[0] for vec in displacem...
davidedelvento/temperanotes
test_temperanotes.py
Python
apache-2.0
9,430
0.016331
import temperanotes import pytest, bisect @pytest.fixture def idiot_temp(): temp = [1, 1.05, 1.1, 1.15, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9] # not a temperament, just a set of numbers for testing assert len(temp) == 12 # need 12 notes for th...
* i for i in idiot_temp] expected_freq_hi = [440.0 * i for i in idiot_temp] expected_freq_hihi = [440.0 * 2 * i for i in idiot_temp] expected_freq = expected_freq_lolo[6:] + expected_freq_lo + expected_freq_hi + expected_freq_hihi[:6]
assert len(expected_freq) == 48 - 12 # obvious, but making sure no simply bugs in test itself actual_freq = temperanotes.frequencies(temperament = idiot_temp, notes_low = 18, notes_high = 18, key = 'A', base_freq = 440.0, key_freq = 'A') assert actual_freq == expe...
Staffjoy/client_python
staffjoy/resources/chomp_task.py
Python
mit
166
0
from staffjoy.resource import Resource class ChompT
ask(Resource): PATH = "internal/tasking/chomp/{sche
dule_id}" ENVELOPE = None ID_NAME = "schedule_id"
IDSIA/sacred
examples/log_example.py
Python
mit
999
0
#!/usr/bin/env python # coding=utf-8 """ An example showcasing the logging system of Sacred.""" import logging from sacred import Experiment ex = Experiment("log_example") # set up a custom logger logger = logging.g
etLogger("mylogger") logger.handlers = [] ch = logging.StreamHandler() formatter = logging.Formatter('[%(levelname).1s] %(name)s >> "%(message)s"') ch.setFormatter(formatter) logger.
addHandler(ch) logger.setLevel("INFO") # attach it to the experiment ex.logger = logger @ex.config def cfg(): number = 2 got_gizmo = False @ex.capture def transmogrify(got_gizmo, number, _log): if got_gizmo: _log.debug("Got gizmo. Performing transmogrification...") return number * 42 ...
Pal3love/otRebuilder
Package/otRebuilder/Dep/fontTools/ttLib/tables/TupleVariation.py
Python
mit
21,422
0.025955
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.misc.fixedTools import fixedToFloat, floatToFixed from fontTools.misc.textTools import safeEval import array import io import logging import struct import sys # https://www.microsoft.com/typography/otspec...
e=value) else: writer.simpletag("coord", axis=axis, value=value, min=minValue, max=maxValue) writer.newline() wrote_any_deltas = False for i, delta in enumerate(self.coordinates): if type(delta) == tuple and len(delta) == 2: writer.simpletag("delta", pt=i, x=delta[0], y=delta[1]) writer.newl...
er.simpletag("delta", cvt=i, value=delta) writer.newline() wrote_any_deltas = True elif delta is not None: log.error("bad delta format") writer.comment("bad delta #%d" % i) writer.newline() wrote_any_deltas = True if not wrote_any_deltas: writer.comment("no deltas") writer.newline() ...
rsignell-usgs/ocean_map
code/west_coast/surf_vel.py
Python
mit
2,525
0.047921
""" Created on Wed Apr 18 16:02:24 2012 @author: rsignell """ import netCDF4 import numpy as np import datetime import scipy.interpolate def surf_vel(x,y,url,date_mid=datetime.datetime.utcnow(),uvar='u',vvar='v',isurf_layer=0,lonvar='lon',latvar='lat', tvar='time',hours_ave=24,lon360=False,ugrid=False,lonlat_sub=...
][istart:istop:time_sub,isurf_layer,bj,bi],axis=0) print('reading v...') v1=np.mean(nc.variables[vvar][istart:istop:time_sub,isurf_layer,bj,bi],axis=0) xx2,yy2=np.meshgrid(x,y) ui=scipy.interpolate.griddata((lon2d.flatten(),lat2d.flatten()),u1.flatten(),(xx2,yy2),method='linear',fill_value=0.0)...
vi[np.isnan(vi)]=0.0 return ui,vi
yusuf-musleh/Expense-Tracker
expense_tracker/expense_tracker/settings.py
Python
mit
3,157
0.001267
""" Django settings for expense_tracker project. Generated by 'django-admin startproject' using Django 1.10.2. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ i...
ALLED_APPS = [ 'tracker.apps.TrackerConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.co...
CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'expense_tracker.urls' TEMPLATES = [ { ...
mattmilten/PySCIPOpt
tests/test_branch_probing_lp.py
Python
mit
2,957
0.005749
from pyscipopt import Model, Branchrule, SCIP_RESULT, quicksum class MyBranching(Branchrule): def __init__(self, model, cont): self.model = model self.cont = cont self.count = 0 self.was_called_val = False self.was_called_int = False def branchexeclp(self, allowaddcon...
.model.constructLP() self.model.solveProbingLP() self.model.getLPObjVal() self.model.endProbing() self.integral = self.model
.getLPBranchCands()[0][0] if self.count == 1: down, eq, up = self.model.branchVarVal(self.cont, 1.3) self.model.chgVarLbNode(down, self.cont, -1.5) self.model.chgVarUbNode(up, self.cont, 3.0) self.was_called_val = True down2, eq2, up2 = self.model.bra...
adamBrinek/tuned
tuned/tests/profiles/test_loader.py
Python
gpl-2.0
3,581
0.023736
import unittest import tempfile import shutil import os.path import tuned.profiles.exceptions from tuned.profiles.loader import Loader from flexmock import flexmock class MockProfile(object): def __init__(self, name, config): self.name = name self.options = {} self.units = {} self.test_config = config class ...
conf_name, "w") as conf_file:
conf_file.write(tuned_conf_content) def test_init(self): Loader([], None, None) Loader(["/tmp"], None, None) Loader(["/foo", "/bar"], None, None) def test_init_wrong_type(self): with self.assertRaises(TypeError): Loader(False, self.factory, self.merger) def test_load(self): profile = self.loader.load...
dirkmueller/kiwi
kiwi/filesystem/ext4.py
Python
gpl-3.0
1,355
0
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved. # # This file is part of kiwi. # # kiwi is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any la...
on. # # kiwi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with kiwi. If not, see <http://www.gnu.org/licenses/> # project...
wdv4758h/arandr
screenlayout/widget.py
Python
gpl-3.0
16,992
0.006062
# ARandR -- Another XRandR GUI # Copyright (C) 2008 -- 2011 chrysn <[email protected]> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any...
support ro
tation, but will always err at the side of caution. # have some buffer usable_size = int(max_gapless * 1.1) # don't request too large a window, but make sure very possible compination fits xdim = min(self._xrandr.state.virtual.max[0], usable_size) ydim = min(self._xrandr.state.vi...
Azure/azure-sdk-for-python
sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py
Python
mit
5,623
0.005869
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
e enum class' __dict__ in order to support `name` and `value` being both properties for enum members (which live in the class' __dict__) and enum members themselves. """
try: return cls._member_map_[name.upper()] except KeyError: raise AttributeError(name) class ACLAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Default action when no other rule matches """ ALLOW = "Allow" DENY = "Deny" class CreatedByType(wit...
davidcox/glumpy
glumpy/image.py
Python
bsd-3-clause
8,858
0.008806
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright (C) 2009-2010 Nicolas P. Rougier # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #---------------...
ted=lighted, gridsize=gridsize, elevation=elevation) elif interpolation == 'bilinear': self._shader = shader.Bilinear(False, lighted=lighted, gridsize=gridsize, elevation=elevation) else: self._shader = None # Source format is not RGB or RGBA else:...
=lighted, gridsize=gridsize, elevation=elevation) elif interpolation == 'bilinear': self._shader = shader.Bilinear(True, lighted=lighted, gridsize=gridsize, elevation=elevation) else: self._shader = shader.Nearest(True, lighted=lighted, gridsize=gr...
larsmans/cython
pyximport/pyxbuild.py
Python
apache-2.0
5,193
0.006162
"""Build a Pyrex file from .pyx source to .so loadable module using the installed distutils infrastructure. Call: out_fname = pyx_to_dll("foo.pyx") """ import os import sys from distutils.dist import Distribution from distutils.errors import DistutilsArgError, DistutilsError, CCompilerError from distutils.extension i...
if last_timestamp == timestamp: so_path = last_path else: basename = os.path.
basename(org_path) while count < 100: count += 1 r_path = os.path.join(obj_build_ext.build_lib, basename + '.reload%s'%count) try: import shutil # late import / reload_support is...
openego/oeplatform
modelview/migrations/0026_auto_20160315_1447.py
Python
agpl-3.0
479
0
# -*- coding: utf-8 -*- # Generated by
Django 1.9 on 2016-03-15 13:47 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("modelview", "0025_auto_20160315_1446")] operations = [ migrations.AlterField(
model_name="energymodel", name="mathematical_objective_other_text", field=models.CharField(blank=True, max_length=200), ) ]
nanshe-org/nanshe_workflow
nanshe_workflow/data.py
Python
apache-2.0
24,568
0.000122
__author__ = "John Kirkham <[email protected]>" __date__ = "$Nov 05, 2015 13:54$" import collections from contextlib import contextmanager import errno import itertools import glob import numbers import os import shutil import tempfile import uuid import zipfile import scandir import h5py import numpy impor...
ip(shape, chunks) ) def _read_chunk(fn, dn, idx): with h5py.File(fn) as fh: return fh[dn][idx] a = numpy.empty( num_blocks(shape, chunks), dtype=object ) for i, s in izip(*split_blocks(shape, chunks, index=True)[:2]): a[i] = dask.array.from_delay...
k(a) return a def dask_store_zarr(filename, datasetnames, datasets, executor): if len(datasetnames) != len(datasets): raise ValueError( "Need `datasetnames` and `datasets` to have the same length." ) with open_zarr(filename, "w") as fh: status = None dask_arr...
zmap/ztag
ztag/transforms/__init__.py
Python
apache-2.0
1,377
0.000726
from bacnet import BACNetTransform from cwmp import CWMPTransform from dns import DNSTransform from ftp import FTPTransform from http import HTTPTransform from http import HTTPWWWTransform from https import HTTPSTransform from https import HTTPSGetTransform from https import HTTPSWWWTransform from h
ttps import HeartbleedTransform from https import RSAExportTransform from https import DHETransform from https import DHEExportTransform from https import ECDHETransform from https im
port TLSv10Transform from https import TLSv11Transform from https import TLSv12Transform from https import TLSv13Transform from https import SSLv3Transform from imap import IMAPStartTLSTransform from imap import IMAPSTransform from modbus import ModbusTransform from ntp import NTPTransform from pop3 import POP3StartTL...
joelstanner/django-imager
imager/imager/tests.py
Python
mit
2,457
0.000814
from __future__ import print_function from django.test import TestCase from django.contrib.auth.models import User from imager_images.models import Photo, Album from django.test import Client import factory class UserFactory(factory.django.DjangoModelFactory): class Meta: model = User django_get_...
(factory.django.DjangoModelFactory): class Meta: model = Album profile = UserFactory.create(username='Freddy').ImagerProfile class TestHomepageViews(TestCase): STOCKPHOTO_URL = '/media/default_stock_photo_640_360.jpg' def setUp(self): self.bob = UserFactory.create() self.al...
(profile=self.bob.ImagerProfile, published='pb') def test_empty_url_finds_home_page(self): response = self.client.get('/') self.assertTemplateUsed(response, 'index.html') def test_home_page_photo_is_user_photo_or_default(self): response...
drepetto/chiplotle
chiplotle/geometry/shapes/line_displaced.py
Python
gpl-3.0
763
0.002621
from chiplotle.geometry.shapes.path import path from chiplotle.geometry.transforms.perpendicular_displace \ import perpendicular_displace def line_displaced(start_coord, end_coord, displacements): '''Returns a Path defined as a line spanning points `st
art_coord` and `end_coord`, displaced by scalars `displacements`. The number of points in the path is determined by the lenght of `displacements`. ''' p = path([start_coord, end_coord]) perpendi
cular_displace(p, displacements) return p if __name__ == '__main__': from chiplotle import * import math disp = [math.sin(i**0.7 / 3.14159 * 2) * 100 for i in range(200)] line = line_displaced(Coordinate(0, 0), Coordinate(1000, 1000), disp) io.view(line)
enthought/etsproxy
enthought/chaco/base.py
Python
bsd-3-clause
79
0
# proxy module from
__future__ import absolu
te_import from chaco.base import *
mlund/pyha
pyha/openmm.py
Python
mit
2,333
0.030004
from simtk.openmm import app import simtk.openmm as mm from simtk import unit def findForce(system, forcetype, add=True): """ Finds a specific force in the system force list - added if not found.""" for force in system.getForces(): if isinstance(force, forcetype): return force if add==True: system....
ey, value): for i in range(force.getNumGlobalParameters()): if force.getGlobalParameterName(i)==key: print('setting force parameter', key, '=', value) force.setGlobalParameterDefaultValue(i, value); def atomIndexInResidue(residue): """ list of atom index in residue """ index=[] for a in list(re...
idue) return np.array(positions)[ndx] def uniquePairs(index): """ list of unique, internal pairs """ return list(combinations( range(index[0],index[-1]+1),2 ) ) def addHarmonicConstraint(harmonicforce, pairlist, positions, threshold, k): """ add harmonic bonds between pairs if distance is smaller than thresho...
wbrefvem/openshift-ansible
roles/lib_openshift/library/oc_edit.py
Python
apache-2.0
55,673
0.001293
#!/usr/bin/env python # pylint: disable=missing-docstring # flake8: noqa: T001 # ___ ___ _ _ ___ ___ _ _____ ___ ___ # / __| __| \| | __| _ \ /_\_ _| __| \ # | (_ | _|| .` | _|| / / _ \| | | _|| |) | # \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____ # | \ / _ \ | \| |/ _ \_ _| | __| \_ ...
t): data = data.get(dict_key) elif (arr_ind and isinstance(data, list) and int(arr_ind) <= len(data) - 1): data = data[int(arr_ind)] else: return None # process last index for remove # expected list entry ...
return True # expected dict entry elif key_indexes[-1][1]: if isinstance(data, dict): del data[key_indexes[-
10se1ucgo/LoLTrivia
plugins/debug.py
Python
mit
4,487
0.003567
# Based on Rapptz's RoboDanny's repl cog import contextlib import inspect import logging import re import sys import textwrap import traceback from io import StringIO from typing import * from typing import Pattern import discord from discord.ext import commands # i took this from somewhere and i cant remember where ...
lly error[0] but i want it to stay as a list logger.exception("Error in exec code") error = traceback.format_exc().splitlines() error
= textwrap.indent('\n'.join(error[:1] + error[3:]), '- ', lambda x: True) await ctx.send("Traceback:") await self.send_split(ctx, error, prefix="```diff\n") async def send_split(self, ctx: commands.Context, text: str, *, prefix="```\n", postfix="\n```"): max_len = 2000 - (len(prefix) + len...
cdiener/rater
app.py
Python
mit
11,748
0.008257
# all the imports import sqlite3 from flask import Flask, request, session, g, redirect, url_for, \ abort, render_template, flash from queries import * from functools import wraps from contextlib import closing from wtforms import SelectField, PasswordField, validators from flask_wtf import Form from flask_wtf.file...
stract, (session['user'],)) session['a'] = cur.fetchone() form = AbstractForm(request.form) if request.method == 'POST' and form.validate() and session['a']: g.db.execute(insert_abstract_rating, (s
ession['a'][0], session['user'], form.abstract.data, form.english.data)) g.db.commit() session['rated'] += 1 return redirect(url_for('added', type='abstract')) return render_template('abstracts.html', form=form, a=session['a'], user=session['user'], role=session['role']) ...
jskinn/robot-vision-experiment-framework
trials/slam/tests/test_visual_slam.py
Python
bsd-2-clause
4,146
0.004342
# Copyright (c) 2017, John Skinner import unittest import numpy as np import pickle import database.tests.test_entity import util.dict_utils as du import util.transform as tf import core.sequence_type import trials.slam.visual_slam as vs import trials.slam.tracking_state as ts class TestSLAMTrialResult(database.tests...
ats2) def _assertTrajectoryEqual(self, traj1, traj2): self.assertEqual(list(traj1.keys()).sort(), list(traj2.keys()).sort()) for time in traj1.keys(): self.assertTrue(np.array_equal(traj1[time].location, traj2[time].location), "Locations are not equal") ...
rst=True)), "Rotations {0} and {1} are not equal".format(tuple(traj1[time].rotation_quat(w_first=True)), tuple(traj2[time].rotation_quat(w_first=True))))
openstack/tacker
tacker/tests/unit/vnflcm/test_utils.py
Python
apache-2.0
2,800
0
# Copyright (c) 2020 NTT DATA # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from tacker.tests.unit import base from tacker.tests.unit.vnflcm import fakes from tacker.tests import uuidsentinel from tacker.vnflcm import utils as vnflcm_utils @ddt.ddt class VnfLcmUtilsTestCase(base.TestCase): @d
dt.data( {'image_path': 'cirros-0.5.2-x86_64-disk.img', 'extracted_path': 'cirros-0.5.2-x86_64-disk.img'}, {'image_path': '../ImageFiles/image/cirros-0.5.2-x86_64-disk.img', 'extracted_path': 'ImageFiles/image/cirros-0.5.2-x86_64-disk.img'}, {'image_path': '../../Files/image/ci...
sprymix/importkit
importkit/yaml/validator/tests/test_types.py
Python
mit
5,672
0.000705
## # Copyright (c) 2008-2010 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import collections from importkit.yaml import validator from importkit.yaml.validator.tests.base import SchemaTest, raises, result class TestTypes(SchemaTest): def setUp(self): super().setUp() self....
nt_minmax_fail2(self): """ minmax: 20 """ @result(key='odict', value=collections.OrderedDict([('A', 1), ('B', 2), ('C', 3), ('D', 4)])) def test_validator_types
_ordered_map(self): """ odict: A: 1 B: 2 C: 3 D: 4 """
penzance/ab-testing-tool
ab_tool/tests/test_experiment_pages.py
Python
mit
28,898
0.005225
from ab_tool.tests.common import (SessionTestCase, TEST_COURSE_ID, TEST_OTHER_COURSE_ID, NONEXISTENT_TRACK_ID, NONEXISTENT_EXPERIMENT_ID, APIReturn, LIST_MODULES) from django.core.urlresolvers import reverse from ab_tool.models import (Experiment, InterventionPointUrl) from ab_tool.exceptions import (EXPERIMENT...
l") def test_edit_experiment_view_none
xistent(self): """Tests edit_experiment when experiment does not exist""" e_id = NONEXISTENT_EXPERIMENT_ID response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(e_id,))) self.assertTemplateNotUsed(response, "ab_tool/edit_experiment.html") self.assertEquals(r...
newvem/pytz
pytz/zoneinfo/Africa/Lagos.py
Python
mit
475
0.044211
'''tzinfo t
imezone information for Africa/Lagos.''' from pytz.tzinfo import DstTzInfo from pytz.tzinfo import memorized_datetime as d from pytz.tzinfo import memorized_ttinfo as i class Lagos(DstTzInfo): '''Africa/Lagos timezone definition. See datetime.tzinfo for details''' zone = 'Africa/Lagos' _utc_transition_ti...
), ] Lagos = Lagos()
SepehrMN/nest-simulator
pynest/examples/synapsecollection.py
Python
gpl-2.0
5,672
0.000705
# -*- coding: utf-8 -*- # # synapsecollection.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the Licen...
apseCollec
tion # We can get desired information of the SynapseCollection with simple get() call. g = conns.get(['source', 'target', 'weight']) srcs = g['source'] tgts = g['target'] weights = g['weight'] # Plot the matrix consisting of the weights between the sources and targets plt.figure(figsize=(12, 10)) plotMatrix(srcs, tgts...
nwjs/chromium.src
tools/polymer/html_to_js.py
Python
bsd-3-clause
1,414
0.009194
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Inlines an HTML file into a JS (or TS) file at a location specified by a # placeholder. This is useful for implementing Web Components using JS modules, # ...
import argparse import sys import io from os import path, getcwd from polymer import process_v3_ready _CWD = getcwd() def main(argv): parser = argp
arse.ArgumentParser() parser.add_argument('--in_folder', required=True) parser.add_argument('--out_folder', required=True) parser.add_argument('--js_files', required=True, nargs="*") args = parser.parse_args(argv) in_folder = path.normpath(path.join(_CWD, args.in_folder)) out_folder = path.normpath(path.jo...
google-research/fitvid
metrics.py
Python
apache-2.0
3,220
0.013665
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
odel module_spec = 'https://tfhub.dev/deepmind/i3d-kinetics-400/1' if not i3d_model: base_
model = hub.load(module_spec) input_tensor = base_model.graph.get_tensor_by_name('input_frames:0') i3d_model = base_model.prune(input_tensor, 'RGB/inception_i3d/Mean:0') output = i3d_model(videos) return output def calculate_fvd(real_activations, generated_activations): return tfgan.eval.frechet_classi...
ahmedaljazzar/edx-platform
openedx/core/djangoapps/programs/tasks/v1/tests/test_tasks.py
Python
agpl-3.0
21,370
0.002387
""" Tests for programs celery tasks. """ import json from datetime import datetime, timedelta import ddt import httpretty import mock import pytz from waffle.testutils import override_switch from celery.exceptions import MaxRetriesExceededError from django.conf import settings from django.test import override_settings,...
s tasks.award_program_certificates.delay(self.student.username).get() actual_program_uuids = [call[0][2] for call in mock_award_program_certificate.call_args_list] self.assertEqual(actual_program_uuids, expected_awarded_program_uuids) actual_visible_dates = [call[0][3] for call in moc...
elf.assertEqual(actual_visible_dates, expected_awarded_program_uuids) # program uuids are same as mock dates @ddt.data( ('credentials', 'enable_learner_issuance'), ) @ddt.unpack def test_retry_if_config_disabled( self, disabled_config_type, disabled_config_attribute, ...
Kobzol/debug-visualizer
debugger/lldbc/lldb_io_manager.py
Python
gpl-3.0
3,121
0.000641
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Jakub Beranek # # This file is part of Devi. # # Devi is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License, or # (at yo...
self, attribute).close() setattr(self, attribute, None) except: pass def handle_io(self): if len(self.file_threads) > 0: return
stdin, stdout, stderr = [LldbIOManager.create_pipe() for _ in xrange(3)] self.file_paths += (stdin, stdout, stderr) self.file_threads.append(threading.Thread(target=self._open_file, args=["stdin", ...
drongh/vnpy
vn.trader/gateway.py
Python
mit
14,192
0.007792
# encoding: UTF-8 from eventEngine import * # 默认空值 EMPTY_STRING = '' EMPTY_UNICODE = u'' E
MPTY_INT = 0 EMPTY_FLOAT = 0.0 # 方向常量 DIRECTION_NONE = u'无方向' DIRECTION_LONG = u'多' DIRECTION_SHORT = u'空' DIRECTION_UNK
NOWN = u'未知' DIRECTION_NET = u'净' # 开平常量 OFFSET_NONE = u'无开平' OFFSET_OPEN = u'开仓' OFFSET_CLOSE = u'平仓' OFFSET_UNKNOWN = u'未知' # 状态常量 STATUS_NOTTRADED = u'未成交' STATUS_PARTTRADED = u'部分成交' STATUS_ALLTRADED = u'全部成交' STATUS_CANCELLED = u'已撤销' STATUS_UNKNOWN = u'未知' # 合约类型常量 PRODUCT_EQUITY = u'股票' PRODUCT_FUTURES = u'期货...
ArcherSys/ArcherSys
skulpt/src/lib/posixfile.py
Python
mit
72
0
raise NotImp
lementedError("posixfile is no
t yet implemented in Skulpt")
XENON1T/cax
setup.py
Python
isc
2,712
0.001106
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages PROJECT = 'cax' VERSION = '5.2.1' with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'checksumdir', 'scp', '...
url='https://github.com/tunnell/cax', packages=find_packages(), include_package_data=True, install_requires=requirements, data_files=[ ('cax', ['cax/cax.json']), ('cax/host_config', ['cax/host_config/tegner_bash_p3.config', 'cax/host_config/tegner_bash_p2.config', 'cax/host_config/mi...
nfig', 'cax/host_config/xe1tdatamanager_bash_p3.config', 'cax/host_config/xe1tdatamanager_bash_p2.config']) ], license="ISCL", zip_safe=False, keywords='cax', classifiers=[ 'Intended Audience :: System Administrators', 'Development Status :: 5 - Production/Stable' ...
danielmt/vshard
vendor/github.com/youtube/vitess/py/vtproto/throttlerdata_pb2.py
Python
mit
7,327
0.006824
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: throttlerdata.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as ...
ull_name='throttlerdata.SetMaxRateRequest.rate', index=0, number=1, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], nested_typ...
es=[ ], options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=182, serialized_end=215, ) _SETMAXRATERESPONSE = _descriptor.Descriptor( name='SetMaxRateResponse', full_name='throttlerdata.SetMaxRateResponse', filename=None, file=DESCRIPTOR, co...