function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def test_binary_diff(self): """Testing SVN (<backend>) parsing SVN diff with binary file""" diff = ( b'Index: binfile\n' b'============================================================' b'=======\n' b'Cannot display: file marked as a binary type.\n' ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_keyword_diff(self): """Testing SVN (<backend>) parsing diff with keywords""" # 'svn cat' will expand special variables in svn:keywords, # but 'svn diff' doesn't expand anything. This causes the # patch to fail if those variables appear in the patch context. diff = (b'In...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_svn16_property_diff(self): """Testing SVN (<backend>) parsing SVN 1.6 diff with property changes """ diff = ( b'Index:\n' b'======================================================' b'=============\n' b'--- (revision 123)\n' b'++...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_unicode_diff(self): """Testing SVN (<backend>) parsing diff with unicode characters""" diff = ( 'Index: Filé\n' '===========================================================' '========\n' '--- Filé (revision 4)\n' '+++ Filé (worki...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_diff_with_added_empty_file(self): """Testing parsing SVN diff with added empty file""" diff = ( b'Index: empty-file\t(added)\n' b'===========================================================' b'========\n' b'--- empty-file\t(revision 0)\n' ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_diff_with_nonexistent_revision_for_dest_file(self): """Testing parsing SVN diff with deleted file using "nonexistent" destination revision """ diff = ( b'Index: deleted-file\n' b'===========================================================' b'=...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_get_branches(self): """Testing SVN (<backend>) get_branches""" branches = self.tool.get_branches() self.assertEqual(len(branches), 3) self.assertEqual(branches[0], Branch(id='trunk', name='trunk', commit='12', default=True)) ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_get_commits_with_branch(self): """Testing SVN (<backend>) get_commits with branch""" commits = self.tool.get_commits(branch='/branches/branch1', start='5') self.assertEqual(len(commits), 5) self.assertEqual( commits[0], Commit('chipx86', ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def _get_log(*args, **kwargs): return [ { 'author': 'chipx86', 'revision': '5', 'message': 'Commit 1', }, ]
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_get_commits_with_exception(self): """Testing SVN (<backend>) get_commits with exception""" def _get_log(*args, **kwargs): raise Exception('Bad things happened') self.spy_on(self.tool.client.get_log, _get_log) with self.assertRaisesMessage(SCMError, 'Bad things happ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_utf8_keywords(self): """Testing SVN (<backend>) with UTF-8 files with keywords""" self.repository.get_file('trunk/utf8-file.txt', '9')
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_normalize_patch_with_svn_and_no_expanded_keywords(self): """Testing SVN (<backend>) normalize_patch with no expanded keywords""" diff = ( b'Index: Makefile\n' b'===========================================================' b'========\n' b'--- Makef...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_collapse_svn_keywords(self): """Testing collapse_svn_keywords""" keyword_test_data = [ (b'Id', b'/* $Id: test2.c 3 2014-08-04 22:55:09Z david $ */', b'/* $Id$ */'), (b'id', b'/* $Id: test2.c 3 2014-08-04 22:55:09Z david $ */', ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_fields(self): """Testing SVNTool authentication form fields""" form = SVNTool.create_auth_form() self.assertEqual(list(form.fields), ['username', 'password']) self.assertEqual(form['username'].help_text, '') self.assertEqual(form['username'].label, 'Username') s...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_load(self): """Tetting SVNTool authentication form load""" repository = self.create_repository( tool_name='Subversion', username='test-user', password='test-pass') form = SVNTool.create_auth_form(repository=repository) form.load() se...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_save(self): """Tetting SVNTool authentication form save""" repository = self.create_repository(tool_name='Subversion') form = SVNTool.create_auth_form( repository=repository, data={ 'username': 'test-user', 'password': 'test-pass'...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_fields(self): """Testing SVNTool repository form fields""" form = SVNTool.create_repository_form() self.assertEqual(list(form.fields), ['path', 'mirror_path']) self.assertEqual(form['path'].help_text, 'The path to the repository. This will generally be ...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def test_load(self): """Tetting SVNTool repository form load""" repository = self.create_repository( tool_name='Subversion', path='https://svn.example.com/', mirror_path='https://svn.mirror.example.com') form = SVNTool.create_repository_form(repository=reposi...
reviewboard/reviewboard
[ 1464, 419, 1464, 1, 1250977189 ]
def _main(): parser = argparse.ArgumentParser() parser.add_argument('config', help='JSON configuration file') parser.add_argument('--only-download', action='store_true', help='Only download GTFS file') parser.add_argument('--use-no-q-dirs', action='store_true', help='Do not use Q dirs') args = parse...
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _progress(text): print(text) logging.debug(text)
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _load_config(config_path): with open(config_path) as config_file: return json.load(config_file)
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _execute_command(command): if os.system(command) != 0: raise SystemExit('failed to execute: {}'.format(command))
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _get_modify_times(zip_filename): modify_times = set() with zipfile.ZipFile(zip_filename) as zip_file: for info in zip_file.infolist(): modify_times.add(datetime.datetime(*info.date_time).strftime('%Y%m%d')) return modify_times
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _rename_gtfs_zip(gtfs_dir, old_filename, gtfs_name, modify_date): _create_dir(gtfs_dir) new_filename = os.path.join(gtfs_dir, '{}_{}.zip'.format(gtfs_name, modify_date)) if os.path.isfile(new_filename): if _compare_files(old_filename, new_filename): _progress('downloaded gtfs file is...
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _compare_files(filename_a, filename_b): return _get_hash(filename_a) == _get_hash(filename_b)
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _generate_json(gtfs_name, modify_date, gtfs_zip, json_dir, log_dir): _create_dir(json_dir) date_output_file = os.path.join(json_dir, '{}_{}.json'.format(gtfs_name, modify_date)) _rename_existing_file(date_output_file) _create_dir(log_dir) log_path = os.path.join(log_dir, 'gtfs2json_{}_{}_{}.log'...
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def _rename_existing_file(filename): if os.path.isfile(filename): suffix = filename.split('.')[-1] new_filename = filename.replace('.{}'.format(suffix), '_{}.{}'.format(_get_now_timestamp(), suffix)) os.rename(filename, new_filename) _progress_...
panur/kartalla
[ 2, 3, 2, 8, 1450813898 ]
def __init__(self, input_size, splice, num_stack, parameter_init, name='cnn_student_xe_encoder'): assert input_size % 3 == 0 self.num_channels = (input_size // 3) // num_stack // splice self.splice = splice ...
hirofumi0810/tensorflow_end2end_speech_recognition
[ 311, 126, 311, 11, 1495618521 ]
def is_number(string): return bool(float_match(string))
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def __init__(self, database_name, username, password, host='localhost'): """ Here we'll try to connect to the database using the variables that we passed through and if the connection fails we'll print out the error """ try: self.db = _mysql.c...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def __del__(self): """ Here we'll do a check to see if `self.db` is present. This will only be the case if the connection was successfully made in the initialiser. Inside that condition we'll close the connection """ if hasattr(self, 'db'): self.db.clo...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def convert_to_named_tuples(self, cursor): results = None names = " ".join(d[0] for d in cursor.description) klass = namedtuple('Results', names) try: results = map(klass._make, cursor.fetchall()) except _mysql.ProgrammingError, e: print e return...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def select(self, table, columns=None, named_tuples=False, **kwargs): """ We'll create our `select` method in order to make it simpler for extracting data from the database. select(table_name, [list_of_column_names]) """ sql_str = "SELECT " # add columns o...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def delete(self, table, **wheres): """ This function will allow us to delete data from a given tables based on wether or not a WHERE clause is present or not """ sql_str = "DELETE FROM `%s`.`%s`" % (self.database_name, table) if wheres is not None: first_whe...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def is_number(string): return bool(float_match(string))
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def update(self, table, where=None, **column_values): sql_str = "UPDATE `%s`.`%s` SET " % (self.database_name, table) if column_values is not None: for column_name, value in column_names.iteritems(): sql_str += "`%s`=" % column_name # check how we should add...
GunnerJnr/_CodeInstitute
[ 7, 6, 7, 104, 1501600555 ]
def set_host_url_arg(): parser.add_argument('--host', required=True, help='the url for the Materials Commons server')
materials-commons/materialscommons.org
[ 10, 1, 10, 110, 1365603676 ]
def set_apikey_arg(): parser.add_argument('--apikey', required=True, help='rapikey for the user building the demo project')
materials-commons/materialscommons.org
[ 10, 1, 10, 110, 1365603676 ]
def user(): return User.objects.create_user( "fred", first_name="Fred", last_name="Flinstone", email="fred@example.com" )
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def applicant(user): data = copy.deepcopy(TEST_APPLICANT) return Applicant.objects.create_applicant(user=user, raw=data)
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def check(applicant): data = copy.deepcopy(TEST_CHECK) return Check.objects.create_check(applicant, raw=data)
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def identity_report(check): data = copy.deepcopy(TEST_REPORT_IDENTITY_ENHANCED) return Report.objects.create_report(check, raw=data)
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def document_report(check): data = copy.deepcopy(TEST_REPORT_DOCUMENT) return Report.objects.create_report(check, raw=data)
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def report(identity_report): return identity_report
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def event(check): data = copy.deepcopy(TEST_EVENT) return Event().parse(data)
yunojuno/django-onfido
[ 3, 6, 3, 1, 1476047324 ]
def parse_times(setting): """ read out the date and times of a recording """ def timestr2timeobj(time_str): """ convert a time string with milliseconds to a datetime object """ time, milli = time_str.split('.') time = datetime.datetime.strptime(time, '%H:%M:%S') ...
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def __init__(self): self.num2name = None self.name2num = None self.lrefs = None self.grefs = None self.crefs = None self.start_rec = None self.stop_rec = None self.start_timestamp = None self.stop_timestamp = None self.folder = None
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def board_num_to_chan(board, num): return (board - 1) * 16 + num
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def parser(fname): """ transform logfile into header, log, and ignored lines """ with open(fname, 'r') as fid: lines = fid.readlines() fid.close() in_header = True is_notice = False ignored_lines = [] protocol = [] header = {} for line in lines: if line[:13]...
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def print_refs(lrefs, grefs): """ overview of local and global refrences """ sorted_keys = sorted(lrefs.keys()) for board, ref in sorted_keys: lref = lrefs[(board, ref)] if lref in grefs: gboard = grefs[lref] stri = 'global, board {}'.format(gboard) el...
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def create_rep(num2name, name2num, crefs, lrefs, grefs): """ create a human readable representation of the referencing """ all_defined_check(num2name, crefs) if DEBUG: print_refs(lrefs, grefs) chnames = [] for num in sorted(num2name.keys()): chnames += num2name[num] out_...
jniediek/combinato
[ 36, 12, 36, 23, 1441963704 ]
def set_test_params(self): self.num_nodes = 2 self.setup_clean_chain = True
Bitcoin-ABC/bitcoin-abc
[ 1114, 682, 1114, 71, 1493632695 ]
def setup_network(self, split=False): self.setup_nodes()
Bitcoin-ABC/bitcoin-abc
[ 1114, 682, 1114, 71, 1493632695 ]
def run_test(self): self.log.info("Mining blocks...") self.nodes[0].generate(1) self.nodes[1].generate(1) timestamp = self.nodes[1].getblock( self.nodes[1].getbestblockhash())['mediantime'] # Sync the timestamp to the wallet, so that importmulti works self.nod...
Bitcoin-ABC/bitcoin-abc
[ 1114, 682, 1114, 71, 1493632695 ]
def make_data(cuda=False): train_x = torch.linspace(0, 1, 100) train_y = torch.sin(train_x * (2 * pi)) train_y.add_(torch.randn_like(train_y), alpha=1e-2) test_x = torch.rand(51) test_y = torch.sin(test_x * (2 * pi)) if cuda: train_x = train_x.cuda() train_y = train_y.cuda() ...
jrg365/gpytorch
[ 3035, 485, 3035, 323, 1497019700 ]
def __init__(self, train_x, train_y, likelihood): super(GPRegressionModel, self).__init__(train_x, train_y, likelihood) self.mean_module = ConstantMean(prior=SmoothedBoxPrior(-1e-5, 1e-5)) self.base_covar_module = ScaleKernel(RBFKernel(lengthscale_prior=SmoothedBoxPrior(exp(-5), exp(6), sigma=0....
jrg365/gpytorch
[ 3035, 485, 3035, 323, 1497019700 ]
def setUp(self): if os.getenv("UNLOCK_SEED") is None or os.getenv("UNLOCK_SEED").lower() == "false": self.rng_state = torch.get_rng_state() torch.manual_seed(0) if torch.cuda.is_available(): torch.cuda.manual_seed_all(0) random.seed(0)
jrg365/gpytorch
[ 3035, 485, 3035, 323, 1497019700 ]
def test_sgpr_mean_abs_error(self): # Suppress numerical warnings warnings.simplefilter("ignore", NumericalWarning) train_x, train_y, test_x, test_y = make_data() likelihood = GaussianLikelihood() gp_model = GPRegressionModel(train_x, train_y, likelihood) mll = gpytorch....
jrg365/gpytorch
[ 3035, 485, 3035, 323, 1497019700 ]
def test_sgpr_mean_abs_error_cuda(self): # Suppress numerical warnings warnings.simplefilter("ignore", NumericalWarning) if not torch.cuda.is_available(): return with least_used_cuda_device(): train_x, train_y, test_x, test_y = make_data(cuda=True) li...
jrg365/gpytorch
[ 3035, 485, 3035, 323, 1497019700 ]
def fill_initial_data(self, *args, **kwargs): # Pass initial data for start and stop to their SplitDateTimeField clones if 'start' in kwargs['initial']: kwargs['initial']['start_datetime'] = kwargs['initial']['start'] if 'stop' in kwargs['initial']: kwargs['initial']['sto...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def init_fields(self, *args, **kwargs): self.fields['start_datetime'] = forms.SplitDateTimeField(label=_('start'), **DATETIME_FORMATS) self.fields['stop_datetime'] = forms.SplitDateTimeField(label=_('stop'), **DATETIME_FORMATS)
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def clean_content(self): """ Text content validation """ content = self.cleaned_data.get("content") validation_helper = safe_import_module(settings.DATEBOOK_TEXT_VALIDATOR_HELPER_PATH) if validation_helper is not None: return validation_helper(self, content) ...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def clean_start_datetime(self): start = self.cleaned_data['start_datetime'] # Day entry can't start before the targeted day date if start and start.date() < self.daydate: raise forms.ValidationError(_("You can't start a day before itself")) # Day entry can't start after the t...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def clean_stop_datetime(self): start = self.cleaned_data.get('start_datetime') stop = self.cleaned_data['stop_datetime'] # Day entry can't stop before the start if start and stop and stop <= start: raise forms.ValidationError(_("Stop time can't be less or equal to start time"...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def __init__(self, datebook, day, *args, **kwargs): self.datebook = datebook self.daydate = datebook.period.replace(day=day)
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def clean(self): cleaned_data = super(DayBaseFormMixin, self).clean() content = cleaned_data.get("content") vacation = cleaned_data.get("vacation") # Content text is only required when vacation is not checked if not vacation and not content: raise forms.ValidationErro...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def save(self, *args, **kwargs): instance = super(DayEntryForm, self).save(commit=False, *args, **kwargs) instance.start = self.cleaned_data['start_datetime'] instance.stop = self.cleaned_data['stop_datetime'] instance.datebook = self.datebook instance.activity_date = self.daydat...
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def clean(self): cleaned_data = super(DayEntryCreateForm, self).clean()
sveetch/django-datebook
[ 2, 1, 2, 6, 1363741906 ]
def remote_convolution(image, kernel, host_id): """ This function ... :param image: :param kernel: :param host_id: """ # Check whether we are already connected to the specified remote host if host_id in connected_remotes and connected_remotes[host_id] is not None: remote = conn...
Stargrazer82301/CAAPR
[ 8, 2, 8, 1, 1453231962 ]
def remote_convolution_frame(frame, kernel_path, host_id): """ This function ... :param frame: :param kernel_path: :param host_id: :return: """ # Check whether the frame is constant. If it is, we don't have to convolve! if frame.is_constant(): return frame.copy() # Check wheth...
Stargrazer82301/CAAPR
[ 8, 2, 8, 1, 1453231962 ]
def remote_filter_convolution_no_pts(host_id, datacube_path, wavelengths, filters): """ This function ... :param host_id: :param datacube_path: :param wavelengths: :param filters: :return: """ # Check whether we are already connected to the specified remote host if host_id in c...
Stargrazer82301/CAAPR
[ 8, 2, 8, 1, 1453231962 ]
def remote_filter_convolution(host_id, datacube_path, wavelengths, filters, keep_output=False): """ This function ... :param host_id: :param datacube_path: :param wavelengths: :param filters: :param keep_output: :return: """ # Check whether we are already connected to the speci...
Stargrazer82301/CAAPR
[ 8, 2, 8, 1, 1453231962 ]
def __init__(self): if _debug: ReadWritePropertyServices._debug("__init__") Capability.__init__(self)
JoelBender/bacpypes
[ 243, 121, 243, 107, 1436992431 ]
def do_WritePropertyRequest(self, apdu): """Change the value of some property of one of our objects.""" if _debug: ReadWritePropertyServices._debug("do_WritePropertyRequest %r", apdu) # get the object obj = self.get_object_id(apdu.objectIdentifier) if _debug: ReadWritePropertySe...
JoelBender/bacpypes
[ 243, 121, 243, 107, 1436992431 ]
def read_property_to_any(obj, propertyIdentifier, propertyArrayIndex=None): """Read the specified property of the object, with the optional array index, and cast the result into an Any object.""" if _debug: read_property_to_any._debug("read_property_to_any %s %r %r", obj, propertyIdentifier, propertyArrayIn...
JoelBender/bacpypes
[ 243, 121, 243, 107, 1436992431 ]
def read_property_to_result_element(obj, propertyIdentifier, propertyArrayIndex=None): """Read the specified property of the object, with the optional array index, and cast the result into an Any object.""" if _debug: read_property_to_result_element._debug("read_property_to_result_element %s %r %r", obj, pr...
JoelBender/bacpypes
[ 243, 121, 243, 107, 1436992431 ]
def __init__(self): if _debug: ReadWritePropertyMultipleServices._debug("__init__") Capability.__init__(self)
JoelBender/bacpypes
[ 243, 121, 243, 107, 1436992431 ]
def get_html_tag(markup): """Return the HTML tag associated with the given wiki-markup.""" return MARKUP_TO_HTML[markup]
earwig/mwparserfromhell
[ 593, 69, 593, 76, 1337539554 ]
def is_visible(tag): """Return whether or not the given *tag* contains visible text.""" return tag.lower() not in INVISIBLE_TAGS
earwig/mwparserfromhell
[ 593, 69, 593, 76, 1337539554 ]
def is_single_only(tag): """Return whether or not the given *tag* must exist without a close tag.""" return tag.lower() in SINGLE_ONLY
earwig/mwparserfromhell
[ 593, 69, 593, 76, 1337539554 ]
def matchtask( self, task: Dict[str, Any], file: 'Optional[Lintable]' = None
ansible/ansible-lint
[ 3021, 542, 3021, 56, 1376478480 ]
def __init__(self, stamp_size_arcsec = 20.0, mag_dict = {"lo":20.0, "hi":25.0 }, hlr_dict = {"lo":0.35, "hi":0.75 }, fbulge_dict = {"lo":0.5 , "hi":0.9 }, q_dict = {"lo":0.4 , "hi":1.0 }, ...
inonchiu/ComEst
[ 5, 3, 5, 1, 1448042190 ]
def main(): config = configparser.ConfigParser() config.optionxform = str config.read_file(open(os.path.join(os.path.dirname(__file__), "../config.ini"), encoding="utf8")) env_conf = dict(config.items('environment')) parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-v'...
syscoin/syscoin2
[ 164, 70, 164, 5, 1456717652 ]
def bctest(testDir, testObj, buildenv): """Runs a single test, comparing output and RC to expected output and RC. Raises an error if input can't be read, executable fails, or output/RC are not as expected. Error is caught by bctester() and reported. """ # Get the exec names and arguments execpr...
syscoin/syscoin2
[ 164, 70, 164, 5, 1456717652 ]
def clog(*args, condition=True, log_func=print, **kwargs): if condition: return log_func(*args, **kwargs)
thorwhalen/ut
[ 4, 3, 4, 24, 1426246351 ]
def __init__( self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, filenames_to_try=[]): # FUN FACT: In Python 3.2, they spontaneously changed the behaviour of # RawConfigParser so that it no longer considers ';' a comment delimiter # for inline comments. # # Compare: # "Configuration files may include comments, pr...
jboy/nim-pymod
[ 213, 11, 213, 10, 1447319234 ]
def sections(self): return self._cp.sections()
jboy/nim-pymod
[ 213, 11, 213, 10, 1447319234 ]
def get(self, section_name, option_name, do_optionxform=True): if do_optionxform: # https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.optionxform option_name = self._cp.optionxform(option_name) if section_name is None: return self._get_...
jboy/nim-pymod
[ 213, 11, 213, 10, 1447319234 ]
def getboolean(self, section_name, option_name, do_optionxform=True): # https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.getboolean return [self._coerce_to_boolean(optval) for optval in self.get(section_name, option_name, do_optionxform)]
jboy/nim-pymod
[ 213, 11, 213, 10, 1447319234 ]
def setUp(self): # Making a HealthProfessional self.view = ListAllMedicines # Making medicati self.medicine = Medicine() self.medicine.name = "Medicamento Teste" self.medicine.active_ingredient = "Teste Lab" self.medicine.save() self.listing = Medicine...
fga-gpp-mds/2017.2-Receituario-Medico
[ 17, 8, 17, 18, 1502385214 ]
def __init__( self, plotly_name="bgcolor", parent_name="sankey.node.hoverlabel", **kwargs
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, *args, **kwargs): self._yaqd_port = kwargs.pop("yaqd_port") super().__init__(*args, **kwargs) self.grating_index = pc.Combo( name="Grating", allowed_values=[1, 2], section=self.name, option="grating_index", display=Tr...
wright-group/PyCMDS
[ 6, 3, 6, 13, 1428602124 ]
def initialize(self, *args, **kwargs): # open control self.ctrl = yaqc.Client(self._yaqd_port) # import some information from control id_dict = self.ctrl.id() self.serial_number = id_dict["serial"] self.position.write(self.ctrl.get_position()) # recorded s...
wright-group/PyCMDS
[ 6, 3, 6, 13, 1428602124 ]
def set_position(self, destination): self.ctrl.set_position(float(destination)) self.wait_until_still()
wright-group/PyCMDS
[ 6, 3, 6, 13, 1428602124 ]
def __init__(self, *args, **kwargs): self.kind = "spectrometer" hw.Hardware.__init__(self, *args, **kwargs)
wright-group/PyCMDS
[ 6, 3, 6, 13, 1428602124 ]
def gen_params(raw_params): u""" Generator that yields tuples of (name, default_value) for each parameter in the list If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None')) """ assert raw_params[0].type == token.STAR and len(raw_params) > 2 curr_idx = 2 # the fi...
thonkify/thonkify
[ 17, 1, 17, 3, 1501859450 ]
def needs_fixing(raw_params, kwargs_default=_kwargs_default_name): u""" Returns string with the name of the kwargs dict if the params after the first star need fixing Otherwise returns empty string """ found_kwargs = False needs_fix = False for t in raw_params[2:]: if t.type == toke...
thonkify/thonkify
[ 17, 1, 17, 3, 1501859450 ]
def check_if_device_is_connected(f): """ Decorator. Checks if device is connected before invoking function. """ @functools.wraps(f) def wrapper(*args, **kwargs): if args[0].device is not None: return f(*args, **kwargs) else: print '[!] Device disconnected.' ...
rsc-dev/loophole
[ 146, 16, 146, 4, 1453282427 ]
def __init__(self): """Constructor. """ cmd.Cmd.__init__(self) self.prompt = LoopholeCli.__PROMPT.format('no device') self.device = None
rsc-dev/loophole
[ 146, 16, 146, 4, 1453282427 ]