body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
7a7074ad8dd9cd7f9bf1c8907db648b7f7c5bff6a8f3bec832b520d5e1202d1f | def add_tokentype_embeddings(self, num_tokentypes):
'Add token-type embedding. This function is provided so we can add\n token-type embeddings in case the pretrained model does not have it.\n This allows us to load the model normally and then add this embedding.\n '
if (self.tokentype_embed... | Add token-type embedding. This function is provided so we can add
token-type embeddings in case the pretrained model does not have it.
This allows us to load the model normally and then add this embedding. | megatron/model/transformer.py | add_tokentype_embeddings | fplk/gpt-neox | 1 | python | def add_tokentype_embeddings(self, num_tokentypes):
'Add token-type embedding. This function is provided so we can add\n token-type embeddings in case the pretrained model does not have it.\n This allows us to load the model normally and then add this embedding.\n '
if (self.tokentype_embed... | def add_tokentype_embeddings(self, num_tokentypes):
'Add token-type embedding. This function is provided so we can add\n token-type embeddings in case the pretrained model does not have it.\n This allows us to load the model normally and then add this embedding.\n '
if (self.tokentype_embed... |
59268cbcb89fbf12f7437079b53e2be36bd96db76c09bb11b8f37cd2606c34a0 | def state_dict_for_save_checkpoint(self, destination=None, prefix='', keep_vars=False):
'For easy load.'
state_dict_ = {}
state_dict_[self._word_embeddings_key] = self.word_embeddings.state_dict(destination, prefix, keep_vars)
if (self.embedding_type == 'learned'):
state_dict_[self._position_emb... | For easy load. | megatron/model/transformer.py | state_dict_for_save_checkpoint | fplk/gpt-neox | 1 | python | def state_dict_for_save_checkpoint(self, destination=None, prefix=, keep_vars=False):
state_dict_ = {}
state_dict_[self._word_embeddings_key] = self.word_embeddings.state_dict(destination, prefix, keep_vars)
if (self.embedding_type == 'learned'):
state_dict_[self._position_embeddings_key] = sel... | def state_dict_for_save_checkpoint(self, destination=None, prefix=, keep_vars=False):
state_dict_ = {}
state_dict_[self._word_embeddings_key] = self.word_embeddings.state_dict(destination, prefix, keep_vars)
if (self.embedding_type == 'learned'):
state_dict_[self._position_embeddings_key] = sel... |
9bbb4b49ce5c73ff04126f05caf0f791688b52b892f38137823475b40246d755 | def load_state_dict(self, state_dict, strict=True):
'Customized load.'
if (self._word_embeddings_key in state_dict):
state_dict_ = state_dict[self._word_embeddings_key]
else:
state_dict_ = {}
for key in state_dict.keys():
if ('word_embeddings' in key):
sta... | Customized load. | megatron/model/transformer.py | load_state_dict | fplk/gpt-neox | 1 | python | def load_state_dict(self, state_dict, strict=True):
if (self._word_embeddings_key in state_dict):
state_dict_ = state_dict[self._word_embeddings_key]
else:
state_dict_ = {}
for key in state_dict.keys():
if ('word_embeddings' in key):
state_dict_[key.split... | def load_state_dict(self, state_dict, strict=True):
if (self._word_embeddings_key in state_dict):
state_dict_ = state_dict[self._word_embeddings_key]
else:
state_dict_ = {}
for key in state_dict.keys():
if ('word_embeddings' in key):
state_dict_[key.split... |
b39c827e5b20ec0502ec56b04263620981e62cd5e9f7e4047e11115ce831ace0 | @property
def word_embeddings_weight(self):
'Easy accessory for the pipeline engine to tie embeddings across stages.'
return self.word_embeddings.weight | Easy accessory for the pipeline engine to tie embeddings across stages. | megatron/model/transformer.py | word_embeddings_weight | fplk/gpt-neox | 1 | python | @property
def word_embeddings_weight(self):
return self.word_embeddings.weight | @property
def word_embeddings_weight(self):
return self.word_embeddings.weight<|docstring|>Easy accessory for the pipeline engine to tie embeddings across stages.<|endoftext|> |
0e097fa6612f1cd330bb32b5953187225cb5e820ef40427240208cde5a1b4898 | def create_workbook_from_dataframe(df):
'\n 1. Create workbook from specified pandas.DataFrame\n 2. Adjust columns width to fit the text inside\n 3. Make the index column and the header row bold\n 4. Fill background color for the header row\n\n Other beautification MUST be done by usage side.\n '
... | 1. Create workbook from specified pandas.DataFrame
2. Adjust columns width to fit the text inside
3. Make the index column and the header row bold
4. Fill background color for the header row
Other beautification MUST be done by usage side. | dataviper/report/utils.py | create_workbook_from_dataframe | otiai10/dataviper | 19 | python | def create_workbook_from_dataframe(df):
'\n 1. Create workbook from specified pandas.DataFrame\n 2. Adjust columns width to fit the text inside\n 3. Make the index column and the header row bold\n 4. Fill background color for the header row\n\n Other beautification MUST be done by usage side.\n '
... | def create_workbook_from_dataframe(df):
'\n 1. Create workbook from specified pandas.DataFrame\n 2. Adjust columns width to fit the text inside\n 3. Make the index column and the header row bold\n 4. Fill background color for the header row\n\n Other beautification MUST be done by usage side.\n '
... |
dd8f5b873f8869c2f2a02a03bb4c3e39d881660f5502025a53dec0315b365722 | @property
def TIMERWRAP(self):
'IGNORED: Only available in Epiphany-IV.'
return self._get_nth_bit_of_register('CONFIG', 26) | IGNORED: Only available in Epiphany-IV. | revelation/machine.py | TIMERWRAP | futurecore/revelation | 4 | python | @property
def TIMERWRAP(self):
return self._get_nth_bit_of_register('CONFIG', 26) | @property
def TIMERWRAP(self):
return self._get_nth_bit_of_register('CONFIG', 26)<|docstring|>IGNORED: Only available in Epiphany-IV.<|endoftext|> |
95eb6a75218aca2e33f7844d1f7033af5cfa048fb59ea674b0f3ddac7a6f700d | @TIMERWRAP.setter
def TIMERWRAP(self, value):
'IGNORED: Only available in Epiphany-IV.'
self._set_nth_bit_of_register('CONFIG', 26, value) | IGNORED: Only available in Epiphany-IV. | revelation/machine.py | TIMERWRAP | futurecore/revelation | 4 | python | @TIMERWRAP.setter
def TIMERWRAP(self, value):
self._set_nth_bit_of_register('CONFIG', 26, value) | @TIMERWRAP.setter
def TIMERWRAP(self, value):
self._set_nth_bit_of_register('CONFIG', 26, value)<|docstring|>IGNORED: Only available in Epiphany-IV.<|endoftext|> |
f19ec6c7c1fc5e69de38b8d0462fbd623da5bd94e50dd5a66c46d6096a222fc7 | def Run(args):
'Run the casectrl function as SPSS syntax'
args = args[list(args.keys())[0]]
oobj = Syntax([Template('DEMANDERDS', subc='', var='demanderds', ktype='varname'), Template('SUPPLIERDS', subc='', var='supplierds', ktype='varname'), Template('DS3', subc='', var='ds3', ktype='varname'), Template('B... | Run the casectrl function as SPSS syntax | src/FUZZY.py | Run | IBMPredictiveAnalytics/FUZZY | 1 | python | def Run(args):
args = args[list(args.keys())[0]]
oobj = Syntax([Template('DEMANDERDS', subc=, var='demanderds', ktype='varname'), Template('SUPPLIERDS', subc=, var='supplierds', ktype='varname'), Template('DS3', subc=, var='ds3', ktype='varname'), Template('BY', subc=, var='by', ktype='varname', islist=Tru... | def Run(args):
args = args[list(args.keys())[0]]
oobj = Syntax([Template('DEMANDERDS', subc=, var='demanderds', ktype='varname'), Template('SUPPLIERDS', subc=, var='supplierds', ktype='varname'), Template('DS3', subc=, var='ds3', ktype='varname'), Template('BY', subc=, var='by', ktype='varname', islist=Tru... |
7f5daba8857719f2f158c76d02c684f30333529bcf0ed6a915a07580d86887fd | def casecontrol(by, supplierid, matchslots, demanderds=None, supplierds=None, group=None, copytodemander=[], ds3=None, demanderid=None, samplewithreplacement=False, hashvar='matchgroup', seed=None, shuffle=False, minimizememory=True, fuzz=None, exactpriority=True, drawpool=None, customfuzz=None, logfile=None, logaccess... | Find match for demanderds cases in supplierds and add identifiers to demanderds. Return unmatched count.
demanderds is the dataset name of cases needing a match (demanders)
supplierds is the dataset name of cases supplying matches (suppliers)
ds3 is optional and will contain the supplierds cases used for matches.
de... | src/FUZZY.py | casecontrol | IBMPredictiveAnalytics/FUZZY | 1 | python | def casecontrol(by, supplierid, matchslots, demanderds=None, supplierds=None, group=None, copytodemander=[], ds3=None, demanderid=None, samplewithreplacement=False, hashvar='matchgroup', seed=None, shuffle=False, minimizememory=True, fuzz=None, exactpriority=True, drawpool=None, customfuzz=None, logfile=None, logaccess... | def casecontrol(by, supplierid, matchslots, demanderds=None, supplierds=None, group=None, copytodemander=[], ds3=None, demanderid=None, samplewithreplacement=False, hashvar='matchgroup', seed=None, shuffle=False, minimizememory=True, fuzz=None, exactpriority=True, drawpool=None, customfuzz=None, logfile=None, logaccess... |
645446602808a1c266328c3ac028d40e8c408d4a3c68665b9328e2823f280aca | def createds3(dsin, dsout, hashvar, demanderds, demanderid, supplierid, myenc, group, drawpool):
'Create a new dataset by copying the variables in dsin to dsout. No cases are created.\n Return number of variables in dsout.\n \n dsin is the intput dataset; dsout is the output dataset.\n hashvar is the n... | Create a new dataset by copying the variables in dsin to dsout. No cases are created.
Return number of variables in dsout.
dsin is the intput dataset; dsout is the output dataset.
hashvar is the name of the hash variable.
if demanderid is not None, its definition from demanderds is appended to dsout.
If using group, ... | src/FUZZY.py | createds3 | IBMPredictiveAnalytics/FUZZY | 1 | python | def createds3(dsin, dsout, hashvar, demanderds, demanderid, supplierid, myenc, group, drawpool):
'Create a new dataset by copying the variables in dsin to dsout. No cases are created.\n Return number of variables in dsout.\n \n dsin is the intput dataset; dsout is the output dataset.\n hashvar is the n... | def createds3(dsin, dsout, hashvar, demanderds, demanderid, supplierid, myenc, group, drawpool):
'Create a new dataset by copying the variables in dsin to dsout. No cases are created.\n Return number of variables in dsout.\n \n dsin is the intput dataset; dsout is the output dataset.\n hashvar is the n... |
c8246cf9e2cf7d6454db7dc67cd63700da1b65daae7111ed59ddf7e7a39435eb | def diff(x, y):
'Return absolute difference between x and y, assumed to be of the same basic type\n \n if numeric and neither is missing (None), return ordinary absolute value\n if not numeric, return 0 if identical and not blank.\n Otherwise return BIG.'
BIG = 1e+100
try:
return abs((x ... | Return absolute difference between x and y, assumed to be of the same basic type
if numeric and neither is missing (None), return ordinary absolute value
if not numeric, return 0 if identical and not blank.
Otherwise return BIG. | src/FUZZY.py | diff | IBMPredictiveAnalytics/FUZZY | 1 | python | def diff(x, y):
'Return absolute difference between x and y, assumed to be of the same basic type\n \n if numeric and neither is missing (None), return ordinary absolute value\n if not numeric, return 0 if identical and not blank.\n Otherwise return BIG.'
BIG = 1e+100
try:
return abs((x ... | def diff(x, y):
'Return absolute difference between x and y, assumed to be of the same basic type\n \n if numeric and neither is missing (None), return ordinary absolute value\n if not numeric, return 0 if identical and not blank.\n Otherwise return BIG.'
BIG = 1e+100
try:
return abs((x ... |
21a0da29e50fd964e100d73ba5c30c42c6c07e1cb023c7b96a3c0d5bdbb5bf78 | def attributesFromDict(d):
'build self attributes from a dictionary d.'
self = d.pop('self')
for (name, value) in d.items():
setattr(self, name, value) | build self attributes from a dictionary d. | src/FUZZY.py | attributesFromDict | IBMPredictiveAnalytics/FUZZY | 1 | python | def attributesFromDict(d):
self = d.pop('self')
for (name, value) in d.items():
setattr(self, name, value) | def attributesFromDict(d):
self = d.pop('self')
for (name, value) in d.items():
setattr(self, name, value)<|docstring|>build self attributes from a dictionary d.<|endoftext|> |
cfce7fb824370a81757fbb9443228f34562548deedd67b3432ef3449bd79fedc | def StartProcedure(procname, omsid):
'Start a procedure\n \n procname is the name that will appear in the Viewer outline. It may be translated\n omsid is the OMS procedure identifier and should not be translated.\n \n Statistics versions prior to 19 support only a single term used for both purposes.... | Start a procedure
procname is the name that will appear in the Viewer outline. It may be translated
omsid is the OMS procedure identifier and should not be translated.
Statistics versions prior to 19 support only a single term used for both purposes.
For those versions, the omsid will be use for the procedure name.
... | src/FUZZY.py | StartProcedure | IBMPredictiveAnalytics/FUZZY | 1 | python | def StartProcedure(procname, omsid):
'Start a procedure\n \n procname is the name that will appear in the Viewer outline. It may be translated\n omsid is the OMS procedure identifier and should not be translated.\n \n Statistics versions prior to 19 support only a single term used for both purposes.... | def StartProcedure(procname, omsid):
'Start a procedure\n \n procname is the name that will appear in the Viewer outline. It may be translated\n omsid is the OMS procedure identifier and should not be translated.\n \n Statistics versions prior to 19 support only a single term used for both purposes.... |
f692197808a41bb09ca0bfa49145b2b51b5b8b1db17d99778f1a2aa3d4138069 | def helper():
'open html help in default browser window\n \n The location is computed from the current module name'
import webbrowser, os.path
path = os.path.splitext(__file__)[0]
helpspec = ((('file://' + path) + os.path.sep) + 'markdown.html')
browser = webbrowser.get()
if (not browser.o... | open html help in default browser window
The location is computed from the current module name | src/FUZZY.py | helper | IBMPredictiveAnalytics/FUZZY | 1 | python | def helper():
'open html help in default browser window\n \n The location is computed from the current module name'
import webbrowser, os.path
path = os.path.splitext(__file__)[0]
helpspec = ((('file://' + path) + os.path.sep) + 'markdown.html')
browser = webbrowser.get()
if (not browser.o... | def helper():
'open html help in default browser window\n \n The location is computed from the current module name'
import webbrowser, os.path
path = os.path.splitext(__file__)[0]
helpspec = ((('file://' + path) + os.path.sep) + 'markdown.html')
browser = webbrowser.get()
if (not browser.o... |
e46de300c27015b6c9d2a40563ee5260bf62c4cf71b66ebcb97e62626334a2d9 | def __enter__(self):
'initialization for with statement'
try:
spss.StartDataStep()
except:
spss.Submit('EXECUTE')
spss.StartDataStep()
return self | initialization for with statement | src/FUZZY.py | __enter__ | IBMPredictiveAnalytics/FUZZY | 1 | python | def __enter__(self):
try:
spss.StartDataStep()
except:
spss.Submit('EXECUTE')
spss.StartDataStep()
return self | def __enter__(self):
try:
spss.StartDataStep()
except:
spss.Submit('EXECUTE')
spss.StartDataStep()
return self<|docstring|>initialization for with statement<|endoftext|> |
1c1139895d08ee34d976001bce35d6243e67ac8aa44288b64a31249d24089dbf | def __init__(self, demanderdscases, matcher, hashvarindex, supplierdscases, ds3cases, demandercopyindexes, suppliercopyindexes, demanderidindex, drawpoolindex, supplieridindex, group):
'demanderdscases is the demander case to match.\n matcher is the Matcher object to use.\n hashvarindex is the variabl... | demanderdscases is the demander case to match.
matcher is the Matcher object to use.
hashvarindex is the variable index for the hash value variable. The matches are written to following contiguous variables.
demandercopyindexes and suppliercopyindexes are case indexes for copying values from supplierds to demanderds
O... | src/FUZZY.py | __init__ | IBMPredictiveAnalytics/FUZZY | 1 | python | def __init__(self, demanderdscases, matcher, hashvarindex, supplierdscases, ds3cases, demandercopyindexes, suppliercopyindexes, demanderidindex, drawpoolindex, supplieridindex, group):
'demanderdscases is the demander case to match.\n matcher is the Matcher object to use.\n hashvarindex is the variabl... | def __init__(self, demanderdscases, matcher, hashvarindex, supplierdscases, ds3cases, demandercopyindexes, suppliercopyindexes, demanderidindex, drawpoolindex, supplieridindex, group):
'demanderdscases is the demander case to match.\n matcher is the Matcher object to use.\n hashvarindex is the variabl... |
a0197faa8a821a57da8780af1ca8417d1058a47715970d5bd2189a04fc47d5c2 | def do(self, casenumber):
'draw match(es) for case casenumber and propagate values as required'
if ((self.matcher.groupindex != None) and (self.demanderdscases[casenumber][self.matcher.groupindex] != 1)):
return 0
(hash, matches, drawpoolsize) = self.matcher.draw(self.demanderdscases[casenumber], se... | draw match(es) for case casenumber and propagate values as required | src/FUZZY.py | do | IBMPredictiveAnalytics/FUZZY | 1 | python | def do(self, casenumber):
if ((self.matcher.groupindex != None) and (self.demanderdscases[casenumber][self.matcher.groupindex] != 1)):
return 0
(hash, matches, drawpoolsize) = self.matcher.draw(self.demanderdscases[casenumber], self.supplierdscases)
self.demanderdscases[(casenumber, self.hashva... | def do(self, casenumber):
if ((self.matcher.groupindex != None) and (self.demanderdscases[casenumber][self.matcher.groupindex] != 1)):
return 0
(hash, matches, drawpoolsize) = self.matcher.draw(self.demanderdscases[casenumber], self.supplierdscases)
self.demanderdscases[(casenumber, self.hashva... |
5db057297f89f6aaae827f8a0e52b23d2d18f0c2ff8a33e99d9ae9e7b8187433 | def __init__(self, by, supplierid, demanderds, supplierds, nmatches, samplewithreplacement, minimizememory, fuzz, exactpriority, groupindex, customfuzz):
'by is a variable or list of variables to match on.\n supplierid is the id variable name in the supplier dataset.\n demanderds and supplierds are th... | by is a variable or list of variables to match on.
supplierid is the id variable name in the supplier dataset.
demanderds and supplierds are the demander and supplier datasets.
nmatches is the number of matches requested for each demander.
samplewithreplacement indicates sampling with or without replacement.
If minimiz... | src/FUZZY.py | __init__ | IBMPredictiveAnalytics/FUZZY | 1 | python | def __init__(self, by, supplierid, demanderds, supplierds, nmatches, samplewithreplacement, minimizememory, fuzz, exactpriority, groupindex, customfuzz):
'by is a variable or list of variables to match on.\n supplierid is the id variable name in the supplier dataset.\n demanderds and supplierds are th... | def __init__(self, by, supplierid, demanderds, supplierds, nmatches, samplewithreplacement, minimizememory, fuzz, exactpriority, groupindex, customfuzz):
'by is a variable or list of variables to match on.\n supplierid is the id variable name in the supplier dataset.\n demanderds and supplierds are th... |
67ec6fd8f38d13e18d1e30b7e31256b5dc0238f268c9d066f12867d6344ba605 | def adddemander(self, case):
'Add a demander. Return 0 or 1 for whether added or not'
if ((self.groupindex != None) and (case[self.groupindex] != 1)):
return 0
(h, keyvalues) = self.hash(self.demandervars, case)
if ((h is not None) and (not (h in self.demanders))):
self.demanders[h] = [... | Add a demander. Return 0 or 1 for whether added or not | src/FUZZY.py | adddemander | IBMPredictiveAnalytics/FUZZY | 1 | python | def adddemander(self, case):
if ((self.groupindex != None) and (case[self.groupindex] != 1)):
return 0
(h, keyvalues) = self.hash(self.demandervars, case)
if ((h is not None) and (not (h in self.demanders))):
self.demanders[h] = []
if (self.fuzz or self.customfuzz):
... | def adddemander(self, case):
if ((self.groupindex != None) and (case[self.groupindex] != 1)):
return 0
(h, keyvalues) = self.hash(self.demandervars, case)
if ((h is not None) and (not (h in self.demanders))):
self.demanders[h] = []
if (self.fuzz or self.customfuzz):
... |
2d4697138eeacee339af26deb96ba9a336923c68ce0882120ff453893a5a82c8 | def addsupplier(self, case, casenum):
'Add a supplier. If no demander for this case, do nothing.\n \n case is the current supplier case, casenum is its case number saved for later use.\n'
if ((self.groupindex != None) and (case[self.groupindex] != 0)):
return 0
takecount = 0
hlist... | Add a supplier. If no demander for this case, do nothing.
case is the current supplier case, casenum is its case number saved for later use. | src/FUZZY.py | addsupplier | IBMPredictiveAnalytics/FUZZY | 1 | python | def addsupplier(self, case, casenum):
'Add a supplier. If no demander for this case, do nothing.\n \n case is the current supplier case, casenum is its case number saved for later use.\n'
if ((self.groupindex != None) and (case[self.groupindex] != 0)):
return 0
takecount = 0
hlist... | def addsupplier(self, case, casenum):
'Add a supplier. If no demander for this case, do nothing.\n \n case is the current supplier case, casenum is its case number saved for later use.\n'
if ((self.groupindex != None) and (case[self.groupindex] != 0)):
return 0
takecount = 0
hlist... |
48c25307399e6d0dc2ced5071eb15a3299ea1932a7b6a36a19a9bb57b33cd659 | def rehash(self, h, case):
'Test supplier case against demander case allowing for fuzzy matching.\n \n h is the current demander case hash\n case is the current supplier case\n return is \n - 0 if no match\n - 1 if fuzzy match\n - 2 if exact match\n '
(... | Test supplier case against demander case allowing for fuzzy matching.
h is the current demander case hash
case is the current supplier case
return is
- 0 if no match
- 1 if fuzzy match
- 2 if exact match | src/FUZZY.py | rehash | IBMPredictiveAnalytics/FUZZY | 1 | python | def rehash(self, h, case):
'Test supplier case against demander case allowing for fuzzy matching.\n \n h is the current demander case hash\n case is the current supplier case\n return is \n - 0 if no match\n - 1 if fuzzy match\n - 2 if exact match\n '
(... | def rehash(self, h, case):
'Test supplier case against demander case allowing for fuzzy matching.\n \n h is the current demander case hash\n case is the current supplier case\n return is \n - 0 if no match\n - 1 if fuzzy match\n - 2 if exact match\n '
(... |
df5c772dbb813246c5582f91fb4d9766fb3ea8803b5083fde856deefa92ab3bb | def filteredlist(self, h):
'Return the list of potential suppliers\n \n h is the demander hash\n If samplewithreplacement is False, any suppliers already used are removed and the exactcount\n field is adjusted'
thelist = self.demanders.get(h, ())
if self.samplewithreplacement:
... | Return the list of potential suppliers
h is the demander hash
If samplewithreplacement is False, any suppliers already used are removed and the exactcount
field is adjusted | src/FUZZY.py | filteredlist | IBMPredictiveAnalytics/FUZZY | 1 | python | def filteredlist(self, h):
'Return the list of potential suppliers\n \n h is the demander hash\n If samplewithreplacement is False, any suppliers already used are removed and the exactcount\n field is adjusted'
thelist = self.demanders.get(h, ())
if self.samplewithreplacement:
... | def filteredlist(self, h):
'Return the list of potential suppliers\n \n h is the demander hash\n If samplewithreplacement is False, any suppliers already used are removed and the exactcount\n field is adjusted'
thelist = self.demanders.get(h, ())
if self.samplewithreplacement:
... |
d31cd87e68f248917a8964c60c7ccdae40035dc7b78cfe0fe831671485540ad6 | def draw(self, case, supplierdscases):
'Try to draw matches for demander case case.\n \n Return a list of nmatches match ids preceded by the hash value. If no match is possible, None is returned for each.\n If the case is missing any match variable, no matches will be drawn.\n If using ... | Try to draw matches for demander case case.
Return a list of nmatches match ids preceded by the hash value. If no match is possible, None is returned for each.
If the case is missing any match variable, no matches will be drawn.
If using fuzzy matching and exact matches get priority, an exact match is first attempted... | src/FUZZY.py | draw | IBMPredictiveAnalytics/FUZZY | 1 | python | def draw(self, case, supplierdscases):
'Try to draw matches for demander case case.\n \n Return a list of nmatches match ids preceded by the hash value. If no match is possible, None is returned for each.\n If the case is missing any match variable, no matches will be drawn.\n If using ... | def draw(self, case, supplierdscases):
'Try to draw matches for demander case case.\n \n Return a list of nmatches match ids preceded by the hash value. If no match is possible, None is returned for each.\n If the case is missing any match variable, no matches will be drawn.\n If using ... |
05703a26a7ac8d38dd7cf48e0a8da355f6a00b790ffd87100771ff9cf375f344 | def hash(self, indexes, case):
'Return a hash of the case according to the indexes in the indexes tuple and the key values.\n \n If any value in the index is None or, for strings, blank, the result is None, None\n indexes is the list of indexes into the case vector'
keys = tuple([case[v] fo... | Return a hash of the case according to the indexes in the indexes tuple and the key values.
If any value in the index is None or, for strings, blank, the result is None, None
indexes is the list of indexes into the case vector | src/FUZZY.py | hash | IBMPredictiveAnalytics/FUZZY | 1 | python | def hash(self, indexes, case):
'Return a hash of the case according to the indexes in the indexes tuple and the key values.\n \n If any value in the index is None or, for strings, blank, the result is None, None\n indexes is the list of indexes into the case vector'
keys = tuple([case[v] fo... | def hash(self, indexes, case):
'Return a hash of the case according to the indexes in the indexes tuple and the key values.\n \n If any value in the index is None or, for strings, blank, the result is None, None\n indexes is the list of indexes into the case vector'
keys = tuple([case[v] fo... |
96cf94ab33ddb12bff013b5ce2a4a1570f9c1e6f8da385af2253e28b618d8fd4 | def buildvars(self, ds, by):
'return a tuple of variable indexes for by.\n \n ds is the dataset.\n by is a sequence of variables for matching'
try:
return tuple([ds.varlist[v].index for v in by])
except:
raise ValueError((_('Undefined variable in BY list: %s') % v)) | return a tuple of variable indexes for by.
ds is the dataset.
by is a sequence of variables for matching | src/FUZZY.py | buildvars | IBMPredictiveAnalytics/FUZZY | 1 | python | def buildvars(self, ds, by):
'return a tuple of variable indexes for by.\n \n ds is the dataset.\n by is a sequence of variables for matching'
try:
return tuple([ds.varlist[v].index for v in by])
except:
raise ValueError((_('Undefined variable in BY list: %s') % v)) | def buildvars(self, ds, by):
'return a tuple of variable indexes for by.\n \n ds is the dataset.\n by is a sequence of variables for matching'
try:
return tuple([ds.varlist[v].index for v in by])
except:
raise ValueError((_('Undefined variable in BY list: %s') % v))<|doc... |
618542bdb451665104b2baca717509c1d65cf97b8b2aaa7b2ba0c30cababe8a9 | def __init__(self, logfile, accessmode):
'Enable logging\n \n logfile is the path and name for the log file or None\n accessmode is "overwrite" or "append" '
self.logfile = logfile
if (logfile is not None):
filemode = (((accessmode == 'overwrite') and 'w') or 'a')
loggin... | Enable logging
logfile is the path and name for the log file or None
accessmode is "overwrite" or "append" | src/FUZZY.py | __init__ | IBMPredictiveAnalytics/FUZZY | 1 | python | def __init__(self, logfile, accessmode):
'Enable logging\n \n logfile is the path and name for the log file or None\n accessmode is "overwrite" or "append" '
self.logfile = logfile
if (logfile is not None):
filemode = (((accessmode == 'overwrite') and 'w') or 'a')
loggin... | def __init__(self, logfile, accessmode):
'Enable logging\n \n logfile is the path and name for the log file or None\n accessmode is "overwrite" or "append" '
self.logfile = logfile
if (logfile is not None):
filemode = (((accessmode == 'overwrite') and 'w') or 'a')
loggin... |
cabd5b7566773f94bb99ee8efebc9ef09faddb5ef8f516f6dde41dacc846b403 | def info(self, message):
'Add message to the log if logging'
if self.logfile:
logging.info(message) | Add message to the log if logging | src/FUZZY.py | info | IBMPredictiveAnalytics/FUZZY | 1 | python | def info(self, message):
if self.logfile:
logging.info(message) | def info(self, message):
if self.logfile:
logging.info(message)<|docstring|>Add message to the log if logging<|endoftext|> |
06687d5b393256a7440690732cba09f1ce401b6fd9479156b9efd3e815486c55 | def setup_package():
'\n Runs package setup\n '
setup(**INFO) | Runs package setup | setup.py | setup_package | vishalbelsare/uravu | 19 | python | def setup_package():
'\n \n '
setup(**INFO) | def setup_package():
'\n \n '
setup(**INFO)<|docstring|>Runs package setup<|endoftext|> |
1e6623e8e5472d2976c876185406f141809b22725b817ff2aec479a7a51a2d76 | def formula_str_to_dict(sumform: Union[(str, bytes)]) -> Dict[(str, str)]:
'\n converts an atom name like C12 to the element symbol C\n Use this code to find the atoms while going through the character astream of a sumformula\n e.g. C12H6O3Mn7\n Find two-char atoms, them one-char, and see if numbers are... | converts an atom name like C12 to the element symbol C
Use this code to find the atoms while going through the character astream of a sumformula
e.g. C12H6O3Mn7
Find two-char atoms, them one-char, and see if numbers are in between. | tools/sumformula.py | formula_str_to_dict | dkratzert/FinalCif | 13 | python | def formula_str_to_dict(sumform: Union[(str, bytes)]) -> Dict[(str, str)]:
'\n converts an atom name like C12 to the element symbol C\n Use this code to find the atoms while going through the character astream of a sumformula\n e.g. C12H6O3Mn7\n Find two-char atoms, them one-char, and see if numbers are... | def formula_str_to_dict(sumform: Union[(str, bytes)]) -> Dict[(str, str)]:
'\n converts an atom name like C12 to the element symbol C\n Use this code to find the atoms while going through the character astream of a sumformula\n e.g. C12H6O3Mn7\n Find two-char atoms, them one-char, and see if numbers are... |
c3b4cacfd6f1dcf0ecaeed101dcfb0f67d631af2f1c39418c597b62348dacd00 | def sum_formula_to_html(sumform: Dict[(str, str)], break_after: int=99) -> str:
'\n Makes html formatted sum formula from dictionary.\n '
if (not sumform):
return ''
l = ['<html><body>']
num = 0
for el in sumform:
if ((sumform[el] == 0) or (sumform[el] == None)):
co... | Makes html formatted sum formula from dictionary. | tools/sumformula.py | sum_formula_to_html | dkratzert/FinalCif | 13 | python | def sum_formula_to_html(sumform: Dict[(str, str)], break_after: int=99) -> str:
'\n \n '
if (not sumform):
return
l = ['<html><body>']
num = 0
for el in sumform:
if ((sumform[el] == 0) or (sumform[el] == None)):
continue
try:
times = round(float... | def sum_formula_to_html(sumform: Dict[(str, str)], break_after: int=99) -> str:
'\n \n '
if (not sumform):
return
l = ['<html><body>']
num = 0
for el in sumform:
if ((sumform[el] == 0) or (sumform[el] == None)):
continue
try:
times = round(float... |
fcad6fa5cd38035a4ccad94f5b68e4af3dcc828553ae0131859df4dd62cc8a19 | def reset_NGLsettings():
'\n Reset NGL settings to their default values as specified in the phil definition string\n '
NGLparams = NGLmaster_phil.fetch(source=libtbx.phil.parse(ngl_philstr)).extract() | Reset NGL settings to their default values as specified in the phil definition string | crys3d/hklview/jsview_3d.py | reset_NGLsettings | indu-in/cctbx_project1 | 2 | python | def reset_NGLsettings():
'\n \n '
NGLparams = NGLmaster_phil.fetch(source=libtbx.phil.parse(ngl_philstr)).extract() | def reset_NGLsettings():
'\n \n '
NGLparams = NGLmaster_phil.fetch(source=libtbx.phil.parse(ngl_philstr)).extract()<|docstring|>Reset NGL settings to their default values as specified in the phil definition string<|endoftext|> |
b87f14a301b171c15d607a7f40aceac53ab23ec49260d798cd13d7e9dec780f3 | def NGLsettings():
'\n Get a global phil parameters object containing some NGL settings\n '
return NGLparams | Get a global phil parameters object containing some NGL settings | crys3d/hklview/jsview_3d.py | NGLsettings | indu-in/cctbx_project1 | 2 | python | def NGLsettings():
'\n \n '
return NGLparams | def NGLsettings():
'\n \n '
return NGLparams<|docstring|>Get a global phil parameters object containing some NGL settings<|endoftext|> |
08c5198a9c4085abf3c8b55b26611b18fc1d8d24a5f7b97d106997c52aee6a52 | def AddVector(self, s1, s2, s3, t1, t2, t3, isreciprocal=True, label='', r=0, g=0, b=0, name=''):
'\n Place vector from {s1, s2, s3] to [t1, t2, t3] with colour r,g,b and label\n If name=="" creation is deferred until AddVector is eventually called with name != ""\n These vectors are then joined in the sam... | Place vector from {s1, s2, s3] to [t1, t2, t3] with colour r,g,b and label
If name=="" creation is deferred until AddVector is eventually called with name != ""
These vectors are then joined in the same NGL representation | crys3d/hklview/jsview_3d.py | AddVector | indu-in/cctbx_project1 | 2 | python | def AddVector(self, s1, s2, s3, t1, t2, t3, isreciprocal=True, label=, r=0, g=0, b=0, name=):
'\n Place vector from {s1, s2, s3] to [t1, t2, t3] with colour r,g,b and label\n If name== creation is deferred until AddVector is eventually called with name != \n These vectors are then joined in the same NGL re... | def AddVector(self, s1, s2, s3, t1, t2, t3, isreciprocal=True, label=, r=0, g=0, b=0, name=):
'\n Place vector from {s1, s2, s3] to [t1, t2, t3] with colour r,g,b and label\n If name== creation is deferred until AddVector is eventually called with name != \n These vectors are then joined in the same NGL re... |
9eae436ac6a0e16e5868816f20144ac114521d76289d64d116ed8dff8c690024 | def getParser(self):
'\n setup my argument parser\n \n sets self.parser as a side effect\n \n Returns:\n ArgumentParser: the argument parser\n '
parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter)
parser.add_argument('-l', '--login', dest... | setup my argument parser
sets self.parser as a side effect
Returns:
ArgumentParser: the argument parser | wikifile/cmdline.py | getParser | tholzheim/wikirender | 0 | python | def getParser(self):
'\n setup my argument parser\n \n sets self.parser as a side effect\n \n Returns:\n ArgumentParser: the argument parser\n '
parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter)
parser.add_argument('-l', '--login', dest... | def getParser(self):
'\n setup my argument parser\n \n sets self.parser as a side effect\n \n Returns:\n ArgumentParser: the argument parser\n '
parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter)
parser.add_argument('-l', '--login', dest... |
a2256bf427f8952e5269f4b40bbec10d8aa5dbd99659597e54a989e0b8860155 | def initLogging(self, args):
'\n initialize the logging\n '
if args.debug:
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
else:
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | initialize the logging | wikifile/cmdline.py | initLogging | tholzheim/wikirender | 0 | python | def initLogging(self, args):
'\n \n '
if args.debug:
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
else:
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | def initLogging(self, args):
'\n \n '
if args.debug:
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
else:
logging.basicConfig(stream=sys.stdout, level=logging.INFO)<|docstring|>initialize the logging<|endoftext|> |
44feb95bc9d34370b43f0ee9724a4ca59be0a8b5e059901a740065c1788fde36 | def getPageTitlesForArgs(self, args):
'\n see also wikirestore in wikipush of py-3rdparty-mediawiki\n \n Args:\n args(): parsed arguments\n \n Returns:\n List of pageTitles as specified\n '
page_titles = args.pages
stdIn = args.stdin
fi... | see also wikirestore in wikipush of py-3rdparty-mediawiki
Args:
args(): parsed arguments
Returns:
List of pageTitles as specified | wikifile/cmdline.py | getPageTitlesForArgs | tholzheim/wikirender | 0 | python | def getPageTitlesForArgs(self, args):
'\n see also wikirestore in wikipush of py-3rdparty-mediawiki\n \n Args:\n args(): parsed arguments\n \n Returns:\n List of pageTitles as specified\n '
page_titles = args.pages
stdIn = args.stdin
fi... | def getPageTitlesForArgs(self, args):
'\n see also wikirestore in wikipush of py-3rdparty-mediawiki\n \n Args:\n args(): parsed arguments\n \n Returns:\n List of pageTitles as specified\n '
page_titles = args.pages
stdIn = args.stdin
fi... |
575db3f0253b2e3287c313d533ba34b0087c70729e2ccef88b1d52c18e1bf91e | @staticmethod
def getPageTitlesForWikiTextPath(backup_path: str) -> list:
'\n get the page titles for the given backupPath\n \n Args: \n backup_path(str): the path to the WikiText Files (e.g. created by wikibackup)\n \n Returns:\n list: a list of PageTitl... | get the page titles for the given backupPath
Args:
backup_path(str): the path to the WikiText Files (e.g. created by wikibackup)
Returns:
list: a list of PageTitles | wikifile/cmdline.py | getPageTitlesForWikiTextPath | tholzheim/wikirender | 0 | python | @staticmethod
def getPageTitlesForWikiTextPath(backup_path: str) -> list:
'\n get the page titles for the given backupPath\n \n Args: \n backup_path(str): the path to the WikiText Files (e.g. created by wikibackup)\n \n Returns:\n list: a list of PageTitl... | @staticmethod
def getPageTitlesForWikiTextPath(backup_path: str) -> list:
'\n get the page titles for the given backupPath\n \n Args: \n backup_path(str): the path to the WikiText Files (e.g. created by wikibackup)\n \n Returns:\n list: a list of PageTitl... |
2555f609189c9c07eabb45c4a275bb9fb8e88543638a086d579f19849504d18e | @classmethod
def _parse_list(cls, data, sub_item=False):
'Parse a list of JSON objects into a result set of model instances.'
results = ResultSet()
data = (data or [])
for obj in data:
if obj:
results.append(cls._parse(obj, sub_item=sub_item))
return results | Parse a list of JSON objects into a result set of model instances. | musixmatch/models.py | _parse_list | yakupadakli/python-musixmatch | 3 | python | @classmethod
def _parse_list(cls, data, sub_item=False):
results = ResultSet()
data = (data or [])
for obj in data:
if obj:
results.append(cls._parse(obj, sub_item=sub_item))
return results | @classmethod
def _parse_list(cls, data, sub_item=False):
results = ResultSet()
data = (data or [])
for obj in data:
if obj:
results.append(cls._parse(obj, sub_item=sub_item))
return results<|docstring|>Parse a list of JSON objects into a result set of model instances.<|endoftext... |
847970a9ef0781a994754c5c28d08c5cd0c32917af55dabe071b52490bdab1b1 | def circles(self, x, y, s, c='b', vmin=None, vmax=None, **kwargs):
"\n See https://gist.github.com/syrte/592a062c562cd2a98a83 \n\n Make a scatter plot of circles. \n Similar to plt.scatter, but the size of circles are in data scale.\n Parameters\n ----------\n x, y : scalar... | See https://gist.github.com/syrte/592a062c562cd2a98a83
Make a scatter plot of circles.
Similar to plt.scatter, but the size of circles are in data scale.
Parameters
----------
x, y : scalar or array_like, shape (n, )
Input data
s : scalar or array_like, shape (n, )
Radius of circles.
c : color or sequence o... | bin/svg.py | circles | rheiland/pc4training | 6 | python | def circles(self, x, y, s, c='b', vmin=None, vmax=None, **kwargs):
"\n See https://gist.github.com/syrte/592a062c562cd2a98a83 \n\n Make a scatter plot of circles. \n Similar to plt.scatter, but the size of circles are in data scale.\n Parameters\n ----------\n x, y : scalar... | def circles(self, x, y, s, c='b', vmin=None, vmax=None, **kwargs):
"\n See https://gist.github.com/syrte/592a062c562cd2a98a83 \n\n Make a scatter plot of circles. \n Similar to plt.scatter, but the size of circles are in data scale.\n Parameters\n ----------\n x, y : scalar... |
92a4f0b6175ae722d0ea34b16cb9a5728a21ea91ba59135afbeba7d401d2dd6c | def compare_json(json1, json2):
'Compares two JSON values for equality'
return JsonType.eq(json1, json2) | Compares two JSON values for equality | nmostesting/TestHelper.py | compare_json | AMWA-TV/nmos-testing | 25 | python | def compare_json(json1, json2):
return JsonType.eq(json1, json2) | def compare_json(json1, json2):
return JsonType.eq(json1, json2)<|docstring|>Compares two JSON values for equality<|endoftext|> |
d69a9ee31ce6766fc36ad730e2077b3663980169ec14bfeadfdcd1124acce389 | def get_default_ip():
"Get this machine's preferred IPv4 address"
if (CONFIG.BIND_INTERFACE is None):
default_gw = netifaces.gateways()['default']
if (netifaces.AF_INET in default_gw):
preferred_interface = default_gw[netifaces.AF_INET][1]
else:
interfaces = netif... | Get this machine's preferred IPv4 address | nmostesting/TestHelper.py | get_default_ip | AMWA-TV/nmos-testing | 25 | python | def get_default_ip():
if (CONFIG.BIND_INTERFACE is None):
default_gw = netifaces.gateways()['default']
if (netifaces.AF_INET in default_gw):
preferred_interface = default_gw[netifaces.AF_INET][1]
else:
interfaces = netifaces.interfaces()
preferred_int... | def get_default_ip():
if (CONFIG.BIND_INTERFACE is None):
default_gw = netifaces.gateways()['default']
if (netifaces.AF_INET in default_gw):
preferred_interface = default_gw[netifaces.AF_INET][1]
else:
interfaces = netifaces.interfaces()
preferred_int... |
cfe4c762c237c54d02d8bb218e7dba31679aecb40215c4f5ba2945e758748ea7 | def do_request(method, url, **kwargs):
'Perform a basic HTTP request with appropriate error handling'
try:
s = requests.Session()
if (('headers' in kwargs) and (kwargs['headers'] is None)):
del kwargs['headers']
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('headers' not ... | Perform a basic HTTP request with appropriate error handling | nmostesting/TestHelper.py | do_request | AMWA-TV/nmos-testing | 25 | python | def do_request(method, url, **kwargs):
try:
s = requests.Session()
if (('headers' in kwargs) and (kwargs['headers'] is None)):
del kwargs['headers']
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('headers' not in kwargs)):
req = requests.Request(method, url, h... | def do_request(method, url, **kwargs):
try:
s = requests.Session()
if (('headers' in kwargs) and (kwargs['headers'] is None)):
del kwargs['headers']
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('headers' not in kwargs)):
req = requests.Request(method, url, h... |
d3929844aae9e7b2f96300d9644c6df89ff00ad376684e0aebb976b9becc983c | def load_resolved_schema(spec_path, file_name=None, schema_obj=None, path_prefix=True):
'\n Parses JSON as well as resolves any `$ref`s, including references to\n local files and remote (HTTP/S) files.\n '
assert (bool(file_name) != bool(schema_obj))
if path_prefix:
spec_path = os.path.join... | Parses JSON as well as resolves any `$ref`s, including references to
local files and remote (HTTP/S) files. | nmostesting/TestHelper.py | load_resolved_schema | AMWA-TV/nmos-testing | 25 | python | def load_resolved_schema(spec_path, file_name=None, schema_obj=None, path_prefix=True):
'\n Parses JSON as well as resolves any `$ref`s, including references to\n local files and remote (HTTP/S) files.\n '
assert (bool(file_name) != bool(schema_obj))
if path_prefix:
spec_path = os.path.join... | def load_resolved_schema(spec_path, file_name=None, schema_obj=None, path_prefix=True):
'\n Parses JSON as well as resolves any `$ref`s, including references to\n local files and remote (HTTP/S) files.\n '
assert (bool(file_name) != bool(schema_obj))
if path_prefix:
spec_path = os.path.join... |
491333cee8ee5c1bdfe69a37e5f0242ad74f7ea0b55cbd1b3497fa21e0e85909 | def __init__(self, ws_href):
'\n Initializer\n :param ws_href: websocket url (string)\n '
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('access_token' not in ws_href)):
if ('?' in ws_href):
ws_href += '&access_token={}'.format(CONFIG.AUTH_TOKEN)
else:
... | Initializer
:param ws_href: websocket url (string) | nmostesting/TestHelper.py | __init__ | AMWA-TV/nmos-testing | 25 | python | def __init__(self, ws_href):
'\n Initializer\n :param ws_href: websocket url (string)\n '
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('access_token' not in ws_href)):
if ('?' in ws_href):
ws_href += '&access_token={}'.format(CONFIG.AUTH_TOKEN)
else:
... | def __init__(self, ws_href):
'\n Initializer\n :param ws_href: websocket url (string)\n '
if (CONFIG.ENABLE_AUTH and CONFIG.AUTH_TOKEN and ('access_token' not in ws_href)):
if ('?' in ws_href):
ws_href += '&access_token={}'.format(CONFIG.AUTH_TOKEN)
else:
... |
edbc5e2219d2f788fd1a342585187ea39157023c4f067f411ef027e63e1b104a | def __init__(self, host, port, secure=False, username=None, password=None, topics=[]):
'\n Initializer\n :param host: broker hostname (string)\n :param port: broker port (int)\n :param secure: use TLS (bool)\n :param username: broker username (string)\n :param password: bro... | Initializer
:param host: broker hostname (string)
:param port: broker port (int)
:param secure: use TLS (bool)
:param username: broker username (string)
:param password: broker password (string)
:param topics: list of topics to subscribe to (list of string) | nmostesting/TestHelper.py | __init__ | AMWA-TV/nmos-testing | 25 | python | def __init__(self, host, port, secure=False, username=None, password=None, topics=[]):
'\n Initializer\n :param host: broker hostname (string)\n :param port: broker port (int)\n :param secure: use TLS (bool)\n :param username: broker username (string)\n :param password: bro... | def __init__(self, host, port, secure=False, username=None, password=None, topics=[]):
'\n Initializer\n :param host: broker hostname (string)\n :param port: broker port (int)\n :param secure: use TLS (bool)\n :param username: broker username (string)\n :param password: bro... |
f288167bbcd1096bc3c33168c88d43e35f66c4fc52c8341387977abd9fd5856f | def solve_board(board, timeout=2):
'\n Returns result[0]=True/False(Solved/Unsolved)\n Returns result[1]=solved board/{"error", "invalid", "unsolved"}\n '
result = []
stop_it = Event()
start = time.time()
stuff_doing_thread = Thread(target=solve_board_1, args=(board, stop_it, result... | Returns result[0]=True/False(Solved/Unsolved)
Returns result[1]=solved board/{"error", "invalid", "unsolved"} | server/utility/masterSolver.py | solve_board | snehsagarajput/sudoku-solver-app | 0 | python | def solve_board(board, timeout=2):
'\n Returns result[0]=True/False(Solved/Unsolved)\n Returns result[1]=solved board/{"error", "invalid", "unsolved"}\n '
result = []
stop_it = Event()
start = time.time()
stuff_doing_thread = Thread(target=solve_board_1, args=(board, stop_it, result... | def solve_board(board, timeout=2):
'\n Returns result[0]=True/False(Solved/Unsolved)\n Returns result[1]=solved board/{"error", "invalid", "unsolved"}\n '
result = []
stop_it = Event()
start = time.time()
stuff_doing_thread = Thread(target=solve_board_1, args=(board, stop_it, result... |
84f397c78e4444f458e0464323a4484430f53977e9973e2d725f08af8f5ef282 | def model_proto_to_bytes_and_metadata(model_proto):
'Convert the model protobuf to bytes and metadata.\n\n Args:\n model_proto: Protobuf of the model\n\n Returns:\n bytes_dict: Dictionary of the bytes contained in the model protobuf\n metadata_dict: Dictionary of the meta data in the mode... | Convert the model protobuf to bytes and metadata.
Args:
model_proto: Protobuf of the model
Returns:
bytes_dict: Dictionary of the bytes contained in the model protobuf
metadata_dict: Dictionary of the meta data in the model protobuf | openfl/protocols/utils.py | model_proto_to_bytes_and_metadata | psfoley/openfl | 297 | python | def model_proto_to_bytes_and_metadata(model_proto):
'Convert the model protobuf to bytes and metadata.\n\n Args:\n model_proto: Protobuf of the model\n\n Returns:\n bytes_dict: Dictionary of the bytes contained in the model protobuf\n metadata_dict: Dictionary of the meta data in the mode... | def model_proto_to_bytes_and_metadata(model_proto):
'Convert the model protobuf to bytes and metadata.\n\n Args:\n model_proto: Protobuf of the model\n\n Returns:\n bytes_dict: Dictionary of the bytes contained in the model protobuf\n metadata_dict: Dictionary of the meta data in the mode... |
a43c36648434ec029c7bf552540259dd96f7a74d7da2ff5d78364586aef00cca | def bytes_and_metadata_to_model_proto(bytes_dict, model_id, model_version, is_delta, metadata_dict):
'Convert bytes and metadata to model protobuf.'
model_header = ModelHeader(id=model_id, version=model_version, is_delta=is_delta)
tensor_protos = []
for (key, data_bytes) in bytes_dict.items():
t... | Convert bytes and metadata to model protobuf. | openfl/protocols/utils.py | bytes_and_metadata_to_model_proto | psfoley/openfl | 297 | python | def bytes_and_metadata_to_model_proto(bytes_dict, model_id, model_version, is_delta, metadata_dict):
model_header = ModelHeader(id=model_id, version=model_version, is_delta=is_delta)
tensor_protos = []
for (key, data_bytes) in bytes_dict.items():
transformer_metadata = metadata_dict[key]
... | def bytes_and_metadata_to_model_proto(bytes_dict, model_id, model_version, is_delta, metadata_dict):
model_header = ModelHeader(id=model_id, version=model_version, is_delta=is_delta)
tensor_protos = []
for (key, data_bytes) in bytes_dict.items():
transformer_metadata = metadata_dict[key]
... |
ef30306781d5f7291c9641db0758e1013bea901df087e404b0a9b483171c11cd | def construct_named_tensor(tensor_key, nparray, transformer_metadata, lossless):
'Construct named tensor.'
metadata_protos = []
for metadata in transformer_metadata:
if (metadata.get('int_to_float') is not None):
int_to_float = metadata.get('int_to_float')
else:
int_t... | Construct named tensor. | openfl/protocols/utils.py | construct_named_tensor | psfoley/openfl | 297 | python | def construct_named_tensor(tensor_key, nparray, transformer_metadata, lossless):
metadata_protos = []
for metadata in transformer_metadata:
if (metadata.get('int_to_float') is not None):
int_to_float = metadata.get('int_to_float')
else:
int_to_float = {}
if (... | def construct_named_tensor(tensor_key, nparray, transformer_metadata, lossless):
metadata_protos = []
for metadata in transformer_metadata:
if (metadata.get('int_to_float') is not None):
int_to_float = metadata.get('int_to_float')
else:
int_to_float = {}
if (... |
85228e1575061c1f89de5f25d34aae76ace2a025f51e631f76359dcc8f787af8 | def construct_proto(tensor_dict, model_id, model_version, is_delta, compression_pipeline):
'Construct proto.'
bytes_dict = {}
metadata_dict = {}
for (key, array) in tensor_dict.items():
(bytes_dict[key], metadata_dict[key]) = compression_pipeline.forward(data=array)
model_proto = bytes_and_m... | Construct proto. | openfl/protocols/utils.py | construct_proto | psfoley/openfl | 297 | python | def construct_proto(tensor_dict, model_id, model_version, is_delta, compression_pipeline):
bytes_dict = {}
metadata_dict = {}
for (key, array) in tensor_dict.items():
(bytes_dict[key], metadata_dict[key]) = compression_pipeline.forward(data=array)
model_proto = bytes_and_metadata_to_model_p... | def construct_proto(tensor_dict, model_id, model_version, is_delta, compression_pipeline):
bytes_dict = {}
metadata_dict = {}
for (key, array) in tensor_dict.items():
(bytes_dict[key], metadata_dict[key]) = compression_pipeline.forward(data=array)
model_proto = bytes_and_metadata_to_model_p... |
0b4477f9d73bf9fc2148ae5fda7bd0607a31129c29ba24e7224823ca2fd24391 | def construct_model_proto(tensor_dict, round_number, tensor_pipe):
'Construct model proto from tensor dict.'
named_tensors = []
for (key, nparray) in tensor_dict.items():
(bytes_data, transformer_metadata) = tensor_pipe.forward(data=nparray)
tensor_key = TensorKey(key, 'agg', round_number, F... | Construct model proto from tensor dict. | openfl/protocols/utils.py | construct_model_proto | psfoley/openfl | 297 | python | def construct_model_proto(tensor_dict, round_number, tensor_pipe):
named_tensors = []
for (key, nparray) in tensor_dict.items():
(bytes_data, transformer_metadata) = tensor_pipe.forward(data=nparray)
tensor_key = TensorKey(key, 'agg', round_number, False, ('model',))
named_tensors.a... | def construct_model_proto(tensor_dict, round_number, tensor_pipe):
named_tensors = []
for (key, nparray) in tensor_dict.items():
(bytes_data, transformer_metadata) = tensor_pipe.forward(data=nparray)
tensor_key = TensorKey(key, 'agg', round_number, False, ('model',))
named_tensors.a... |
8323f1bbdc28649a61e1bdf49e437b5af47821f5db1e3f0584780ec81a2f7f2c | def deconstruct_model_proto(model_proto, compression_pipeline):
'Deconstruct model proto.'
(bytes_dict, metadata_dict, round_number) = model_proto_to_bytes_and_metadata(model_proto)
tensor_dict = {}
for key in bytes_dict:
tensor_dict[key] = compression_pipeline.backward(data=bytes_dict[key], tra... | Deconstruct model proto. | openfl/protocols/utils.py | deconstruct_model_proto | psfoley/openfl | 297 | python | def deconstruct_model_proto(model_proto, compression_pipeline):
(bytes_dict, metadata_dict, round_number) = model_proto_to_bytes_and_metadata(model_proto)
tensor_dict = {}
for key in bytes_dict:
tensor_dict[key] = compression_pipeline.backward(data=bytes_dict[key], transformer_metadata=metadata... | def deconstruct_model_proto(model_proto, compression_pipeline):
(bytes_dict, metadata_dict, round_number) = model_proto_to_bytes_and_metadata(model_proto)
tensor_dict = {}
for key in bytes_dict:
tensor_dict[key] = compression_pipeline.backward(data=bytes_dict[key], transformer_metadata=metadata... |
89e1e41addf46d16f5722706f113c9a1dacd42180b7832e01a73adba39913bea | def deconstruct_proto(model_proto, compression_pipeline):
'Deconstruct the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n compression_pipeline: The compression pipeline object\n\n Returns:\n protobuf: A protobuf of the model\n '
(bytes_dict, metadata_dict) = model_p... | Deconstruct the protobuf.
Args:
model_proto: The protobuf of the model
compression_pipeline: The compression pipeline object
Returns:
protobuf: A protobuf of the model | openfl/protocols/utils.py | deconstruct_proto | psfoley/openfl | 297 | python | def deconstruct_proto(model_proto, compression_pipeline):
'Deconstruct the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n compression_pipeline: The compression pipeline object\n\n Returns:\n protobuf: A protobuf of the model\n '
(bytes_dict, metadata_dict) = model_p... | def deconstruct_proto(model_proto, compression_pipeline):
'Deconstruct the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n compression_pipeline: The compression pipeline object\n\n Returns:\n protobuf: A protobuf of the model\n '
(bytes_dict, metadata_dict) = model_p... |
ea782010d2da7acf04d06cabb0687f00a8d2e3717f0329d79f4f2ee92615fbe9 | def load_proto(fpath):
'Load the protobuf.\n\n Args:\n fpath: The filepath for the protobuf\n\n Returns:\n protobuf: A protobuf of the model\n '
with open(fpath, 'rb') as f:
loaded = f.read()
model = ModelProto().FromString(loaded)
return model | Load the protobuf.
Args:
fpath: The filepath for the protobuf
Returns:
protobuf: A protobuf of the model | openfl/protocols/utils.py | load_proto | psfoley/openfl | 297 | python | def load_proto(fpath):
'Load the protobuf.\n\n Args:\n fpath: The filepath for the protobuf\n\n Returns:\n protobuf: A protobuf of the model\n '
with open(fpath, 'rb') as f:
loaded = f.read()
model = ModelProto().FromString(loaded)
return model | def load_proto(fpath):
'Load the protobuf.\n\n Args:\n fpath: The filepath for the protobuf\n\n Returns:\n protobuf: A protobuf of the model\n '
with open(fpath, 'rb') as f:
loaded = f.read()
model = ModelProto().FromString(loaded)
return model<|docstring|>Load the... |
53a418df8cfa50e29fe4d065bed40a7c77ff0670fad699212c103463daa64dd9 | def dump_proto(model_proto, fpath):
'Dump the protobuf to a file.\n\n Args:\n model_proto: The protobuf of the model\n fpath: The filename to save the model protobuf\n\n '
s = model_proto.SerializeToString()
with open(fpath, 'wb') as f:
f.write(s) | Dump the protobuf to a file.
Args:
model_proto: The protobuf of the model
fpath: The filename to save the model protobuf | openfl/protocols/utils.py | dump_proto | psfoley/openfl | 297 | python | def dump_proto(model_proto, fpath):
'Dump the protobuf to a file.\n\n Args:\n model_proto: The protobuf of the model\n fpath: The filename to save the model protobuf\n\n '
s = model_proto.SerializeToString()
with open(fpath, 'wb') as f:
f.write(s) | def dump_proto(model_proto, fpath):
'Dump the protobuf to a file.\n\n Args:\n model_proto: The protobuf of the model\n fpath: The filename to save the model protobuf\n\n '
s = model_proto.SerializeToString()
with open(fpath, 'wb') as f:
f.write(s)<|docstring|>Dump the protobuf to... |
e676dc30eada408139ab34756fce692fe2045cb8f2ffad3a3b57d472d351e5ea | def datastream_to_proto(proto, stream, logger=None):
'Convert the datastream to the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n stream: The data stream from the remote connection\n logger: (Optional) The log object\n\n Returns:\n protobuf: A protobuf of the model... | Convert the datastream to the protobuf.
Args:
model_proto: The protobuf of the model
stream: The data stream from the remote connection
logger: (Optional) The log object
Returns:
protobuf: A protobuf of the model | openfl/protocols/utils.py | datastream_to_proto | psfoley/openfl | 297 | python | def datastream_to_proto(proto, stream, logger=None):
'Convert the datastream to the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n stream: The data stream from the remote connection\n logger: (Optional) The log object\n\n Returns:\n protobuf: A protobuf of the model... | def datastream_to_proto(proto, stream, logger=None):
'Convert the datastream to the protobuf.\n\n Args:\n model_proto: The protobuf of the model\n stream: The data stream from the remote connection\n logger: (Optional) The log object\n\n Returns:\n protobuf: A protobuf of the model... |
c9fc645a4fd77d546ab7351e7c205ba361951e7d0305241fe9f78ace48b131ed | def proto_to_datastream(proto, logger, max_buffer_size=((2 * 1024) * 1024)):
'Convert the protobuf to the datastream for the remote connection.\n\n Args:\n model_proto: The protobuf of the model\n logger: The log object\n max_buffer_size: The buffer size (Default= 2*1024*1024)\n Returns:\... | Convert the protobuf to the datastream for the remote connection.
Args:
model_proto: The protobuf of the model
logger: The log object
max_buffer_size: The buffer size (Default= 2*1024*1024)
Returns:
reply: The message for the remote connection. | openfl/protocols/utils.py | proto_to_datastream | psfoley/openfl | 297 | python | def proto_to_datastream(proto, logger, max_buffer_size=((2 * 1024) * 1024)):
'Convert the protobuf to the datastream for the remote connection.\n\n Args:\n model_proto: The protobuf of the model\n logger: The log object\n max_buffer_size: The buffer size (Default= 2*1024*1024)\n Returns:\... | def proto_to_datastream(proto, logger, max_buffer_size=((2 * 1024) * 1024)):
'Convert the protobuf to the datastream for the remote connection.\n\n Args:\n model_proto: The protobuf of the model\n logger: The log object\n max_buffer_size: The buffer size (Default= 2*1024*1024)\n Returns:\... |
636b484bbb36cd2f514bce0d0b1c7b7e568321448347cfd9710bf96027ed63b9 | def get_headers(context) -> dict:
'Get headers from context.'
return {header[0]: header[1] for header in context.invocation_metadata()} | Get headers from context. | openfl/protocols/utils.py | get_headers | psfoley/openfl | 297 | python | def get_headers(context) -> dict:
return {header[0]: header[1] for header in context.invocation_metadata()} | def get_headers(context) -> dict:
return {header[0]: header[1] for header in context.invocation_metadata()}<|docstring|>Get headers from context.<|endoftext|> |
ffaee16312bf89d6e1b908678a638f451cb8ac9bac27d107527dd278b158b59f | def _check_layout_validity(self):
'\n Check the current layout is a valid one.\n '
self._visible_areas = []
if (self.ID is None):
raise SpyderAPIError('A Layout must define an `ID` class attribute!')
self.get_name()
if (not self._areas):
raise SpyderAPIError('A Layout m... | Check the current layout is a valid one. | spyder/plugins/layout/api.py | _check_layout_validity | mrclary/spyder | 7,956 | python | def _check_layout_validity(self):
'\n \n '
self._visible_areas = []
if (self.ID is None):
raise SpyderAPIError('A Layout must define an `ID` class attribute!')
self.get_name()
if (not self._areas):
raise SpyderAPIError('A Layout must define add least one area!')
def... | def _check_layout_validity(self):
'\n \n '
self._visible_areas = []
if (self.ID is None):
raise SpyderAPIError('A Layout must define an `ID` class attribute!')
self.get_name()
if (not self._areas):
raise SpyderAPIError('A Layout must define add least one area!')
def... |
615338e2fbc162e31925e7630f4f07ef09db269439524c30c6648bc3f578444b | def _check_area(self):
'\n Check if the current layout added areas cover the entire rectangle.\n\n Rectangle given by the extreme points for the added areas.\n '
self._area_rects = []
height = (self._rows + 1)
area_float_rects = []
delta = 0.0001
for (index, area) in enumera... | Check if the current layout added areas cover the entire rectangle.
Rectangle given by the extreme points for the added areas. | spyder/plugins/layout/api.py | _check_area | mrclary/spyder | 7,956 | python | def _check_area(self):
'\n Check if the current layout added areas cover the entire rectangle.\n\n Rectangle given by the extreme points for the added areas.\n '
self._area_rects = []
height = (self._rows + 1)
area_float_rects = []
delta = 0.0001
for (index, area) in enumera... | def _check_area(self):
'\n Check if the current layout added areas cover the entire rectangle.\n\n Rectangle given by the extreme points for the added areas.\n '
self._area_rects = []
height = (self._rows + 1)
area_float_rects = []
delta = 0.0001
for (index, area) in enumera... |
8fa71deb194f4ac338a2f97b9cd5f9bde7ae2ea0903b488c49d65b5f818be7a1 | def get_name(self):
'\n Return the layout localized name.\n\n Returns\n -------\n str\n Localized name of the layout.\n\n Notes\n -----\n This is a method to be able to update localization without a restart.\n '
raise NotImplementedError('A layo... | Return the layout localized name.
Returns
-------
str
Localized name of the layout.
Notes
-----
This is a method to be able to update localization without a restart. | spyder/plugins/layout/api.py | get_name | mrclary/spyder | 7,956 | python | def get_name(self):
'\n Return the layout localized name.\n\n Returns\n -------\n str\n Localized name of the layout.\n\n Notes\n -----\n This is a method to be able to update localization without a restart.\n '
raise NotImplementedError('A layo... | def get_name(self):
'\n Return the layout localized name.\n\n Returns\n -------\n str\n Localized name of the layout.\n\n Notes\n -----\n This is a method to be able to update localization without a restart.\n '
raise NotImplementedError('A layo... |
03d656d6aac34e82ec5ddb38110a577cdab77ff5fe1718283a82ea1bc0339c2a | def add_area(self, plugin_ids, row, column, row_span=1, col_span=1, default=False, visible=True, hidden_plugin_ids=[]):
'\n Add a new area and `plugin_ids` that will populate it to the layout.\n\n The area will start at row, column spanning row_pan rows and\n column_span columns.\n\n Par... | Add a new area and `plugin_ids` that will populate it to the layout.
The area will start at row, column spanning row_pan rows and
column_span columns.
Parameters
----------
plugin_ids: list
List of plugin ids that will be in the area
row: int
Initial row where the area starts
column: int
Initial column wh... | spyder/plugins/layout/api.py | add_area | mrclary/spyder | 7,956 | python | def add_area(self, plugin_ids, row, column, row_span=1, col_span=1, default=False, visible=True, hidden_plugin_ids=[]):
'\n Add a new area and `plugin_ids` that will populate it to the layout.\n\n The area will start at row, column spanning row_pan rows and\n column_span columns.\n\n Par... | def add_area(self, plugin_ids, row, column, row_span=1, col_span=1, default=False, visible=True, hidden_plugin_ids=[]):
'\n Add a new area and `plugin_ids` that will populate it to the layout.\n\n The area will start at row, column spanning row_pan rows and\n column_span columns.\n\n Par... |
3fe18845f471aa9e94d776be69444d939e5ec7c49762dabcb647bbaac42e10a3 | def set_column_stretch(self, column, stretch):
'\n Set the factor of column to stretch.\n\n The stretch factor is relative to the other columns in this grid.\n Columns with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n column: int\n... | Set the factor of column to stretch.
The stretch factor is relative to the other columns in this grid.
Columns with a higher stretch factor take more of the available space.
Parameters
----------
column: int
The column number. The first column is number 0.
stretch: int
Column stretch factor.
Notes
-----
See:... | spyder/plugins/layout/api.py | set_column_stretch | mrclary/spyder | 7,956 | python | def set_column_stretch(self, column, stretch):
'\n Set the factor of column to stretch.\n\n The stretch factor is relative to the other columns in this grid.\n Columns with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n column: int\n... | def set_column_stretch(self, column, stretch):
'\n Set the factor of column to stretch.\n\n The stretch factor is relative to the other columns in this grid.\n Columns with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n column: int\n... |
8f3906457f1caa10f7699b6c7d27324a1c0508ca083ef7fdc77f37d40867bb29 | def set_row_stretch(self, row, stretch):
'\n Set the factor of row to stretch.\n\n The stretch factor is relative to the other rows in this grid.\n Rows with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n row: int\n The ro... | Set the factor of row to stretch.
The stretch factor is relative to the other rows in this grid.
Rows with a higher stretch factor take more of the available space.
Parameters
----------
row: int
The row number. The first row is number 0.
stretch: int
Row stretch factor.
Notes
-----
See: https://doc.qt.io/qt... | spyder/plugins/layout/api.py | set_row_stretch | mrclary/spyder | 7,956 | python | def set_row_stretch(self, row, stretch):
'\n Set the factor of row to stretch.\n\n The stretch factor is relative to the other rows in this grid.\n Rows with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n row: int\n The ro... | def set_row_stretch(self, row, stretch):
'\n Set the factor of row to stretch.\n\n The stretch factor is relative to the other rows in this grid.\n Rows with a higher stretch factor take more of the available space.\n\n Parameters\n ----------\n row: int\n The ro... |
d2ebb9a0e5f41a0b574a74f824a7a536be56a3850cbb696708e32c74d434e06f | def preview_layout(self, show_hidden_areas=False):
'\n Show the layout with placeholder texts using a QWidget.\n '
from spyder.utils.qthelpers import qapplication
app = qapplication()
widget = QWidget()
layout = QGridLayout()
for area in self._areas:
label = QPlainTextEdit(... | Show the layout with placeholder texts using a QWidget. | spyder/plugins/layout/api.py | preview_layout | mrclary/spyder | 7,956 | python | def preview_layout(self, show_hidden_areas=False):
'\n \n '
from spyder.utils.qthelpers import qapplication
app = qapplication()
widget = QWidget()
layout = QGridLayout()
for area in self._areas:
label = QPlainTextEdit()
label.setReadOnly(True)
label.setPlai... | def preview_layout(self, show_hidden_areas=False):
'\n \n '
from spyder.utils.qthelpers import qapplication
app = qapplication()
widget = QWidget()
layout = QGridLayout()
for area in self._areas:
label = QPlainTextEdit()
label.setReadOnly(True)
label.setPlai... |
cae21d7ac17fa34d4b45a59f17b47a9fe3c1a31d4c57a5d02c2d1e4bd702fc3d | def set_main_window_layout(self, main_window, dockable_plugins):
'\n Set the given mainwindow layout.\n\n First validate the current layout definition, then clear the mainwindow\n current layout and finally calculate and set the new layout.\n '
all_plugin_ids = []
for plugin in d... | Set the given mainwindow layout.
First validate the current layout definition, then clear the mainwindow
current layout and finally calculate and set the new layout. | spyder/plugins/layout/api.py | set_main_window_layout | mrclary/spyder | 7,956 | python | def set_main_window_layout(self, main_window, dockable_plugins):
'\n Set the given mainwindow layout.\n\n First validate the current layout definition, then clear the mainwindow\n current layout and finally calculate and set the new layout.\n '
all_plugin_ids = []
for plugin in d... | def set_main_window_layout(self, main_window, dockable_plugins):
'\n Set the given mainwindow layout.\n\n First validate the current layout definition, then clear the mainwindow\n current layout and finally calculate and set the new layout.\n '
all_plugin_ids = []
for plugin in d... |
270362003de44c4a2c9a0fb76bdbc5b5e2e2358ed101bbf70f2cd9fc053182b7 | def load_vgg(sess, vgg_path):
'\n Load Pretrained VGG Model into TensorFlow.\n :param sess: TensorFlow Session\n :param vgg_path: Path to vgg folder, containing "variables/" and "saved_model.pb"\n :return: Tuple of Tensors from VGG model (image_input, keep_prob, layer3_out, layer4_out, layer7_out)\n ... | Load Pretrained VGG Model into TensorFlow.
:param sess: TensorFlow Session
:param vgg_path: Path to vgg folder, containing "variables/" and "saved_model.pb"
:return: Tuple of Tensors from VGG model (image_input, keep_prob, layer3_out, layer4_out, layer7_out) | main.py | load_vgg | shjzhao/CarND-Semantic-Segmentation | 0 | python | def load_vgg(sess, vgg_path):
'\n Load Pretrained VGG Model into TensorFlow.\n :param sess: TensorFlow Session\n :param vgg_path: Path to vgg folder, containing "variables/" and "saved_model.pb"\n :return: Tuple of Tensors from VGG model (image_input, keep_prob, layer3_out, layer4_out, layer7_out)\n ... | def load_vgg(sess, vgg_path):
'\n Load Pretrained VGG Model into TensorFlow.\n :param sess: TensorFlow Session\n :param vgg_path: Path to vgg folder, containing "variables/" and "saved_model.pb"\n :return: Tuple of Tensors from VGG model (image_input, keep_prob, layer3_out, layer4_out, layer7_out)\n ... |
26d87776437348743cd8553866b79740b4df912e99e3f45be1883e8948523895 | def layers(vgg_layer3_out, vgg_layer4_out, vgg_layer7_out, num_classes):
'\n Create the layers for a fully convolutional network. Build skip-layers using the vgg layers.\n :param vgg_layer3_out: TF Tensor for VGG Layer 3 output\n :param vgg_layer4_out: TF Tensor for VGG Layer 4 output\n :param vgg_laye... | Create the layers for a fully convolutional network. Build skip-layers using the vgg layers.
:param vgg_layer3_out: TF Tensor for VGG Layer 3 output
:param vgg_layer4_out: TF Tensor for VGG Layer 4 output
:param vgg_layer7_out: TF Tensor for VGG Layer 7 output
:param num_classes: Number of classes to classify
:return:... | main.py | layers | shjzhao/CarND-Semantic-Segmentation | 0 | python | def layers(vgg_layer3_out, vgg_layer4_out, vgg_layer7_out, num_classes):
'\n Create the layers for a fully convolutional network. Build skip-layers using the vgg layers.\n :param vgg_layer3_out: TF Tensor for VGG Layer 3 output\n :param vgg_layer4_out: TF Tensor for VGG Layer 4 output\n :param vgg_laye... | def layers(vgg_layer3_out, vgg_layer4_out, vgg_layer7_out, num_classes):
'\n Create the layers for a fully convolutional network. Build skip-layers using the vgg layers.\n :param vgg_layer3_out: TF Tensor for VGG Layer 3 output\n :param vgg_layer4_out: TF Tensor for VGG Layer 4 output\n :param vgg_laye... |
d3a03ff600f4c40c0ab5aa87d6147004db40e073bb2926d3d7fc4018bd7f3e36 | def optimize(nn_last_layer, correct_label, learning_rate, num_classes):
'\n Build the TensorFLow loss and optimizer operations.\n :param nn_last_layer: TF Tensor of the last layer in the neural network\n :param correct_label: TF Placeholder for the correct label image\n :param learning_rate: TF Placehol... | Build the TensorFLow loss and optimizer operations.
:param nn_last_layer: TF Tensor of the last layer in the neural network
:param correct_label: TF Placeholder for the correct label image
:param learning_rate: TF Placeholder for the learning rate
:param num_classes: Number of classes to classify
:return: Tuple of (log... | main.py | optimize | shjzhao/CarND-Semantic-Segmentation | 0 | python | def optimize(nn_last_layer, correct_label, learning_rate, num_classes):
'\n Build the TensorFLow loss and optimizer operations.\n :param nn_last_layer: TF Tensor of the last layer in the neural network\n :param correct_label: TF Placeholder for the correct label image\n :param learning_rate: TF Placehol... | def optimize(nn_last_layer, correct_label, learning_rate, num_classes):
'\n Build the TensorFLow loss and optimizer operations.\n :param nn_last_layer: TF Tensor of the last layer in the neural network\n :param correct_label: TF Placeholder for the correct label image\n :param learning_rate: TF Placehol... |
b2fc68ff07b9e01714b8b6fd5807532c8947d4f7e5b85b00d0035f6aa6b600d7 | def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, input_image, correct_label, keep_prob, learning_rate):
'\n Train neural network and print out the loss during training.\n :param sess: TF Session\n :param epochs: Number of epochs\n :param batch_size: Batch size\n :p... | Train neural network and print out the loss during training.
:param sess: TF Session
:param epochs: Number of epochs
:param batch_size: Batch size
:param get_batches_fn: Function to get batches of training data. Call using get_batches_fn(batch_size)
:param train_op: TF Operation to train the neural network
:param cros... | main.py | train_nn | shjzhao/CarND-Semantic-Segmentation | 0 | python | def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, input_image, correct_label, keep_prob, learning_rate):
'\n Train neural network and print out the loss during training.\n :param sess: TF Session\n :param epochs: Number of epochs\n :param batch_size: Batch size\n :p... | def train_nn(sess, epochs, batch_size, get_batches_fn, train_op, cross_entropy_loss, input_image, correct_label, keep_prob, learning_rate):
'\n Train neural network and print out the loss during training.\n :param sess: TF Session\n :param epochs: Number of epochs\n :param batch_size: Batch size\n :p... |
e2929b4a8e23faee04357a1951bf0d8311cf6f0eefaaa7d686e12436bab8fbd8 | def batch_callfunction_decode(endpoint, datalist, outtypes, height=None, needidx=False):
'\n datalist: [contract_address, funcname(arg_type_list), encoded_arguments]\n outtypes: list of [return values\' type list]\n Example:\n data = batch_callfunction_decode(H, [[addr, "symbol()", ""] for addr in a... | datalist: [contract_address, funcname(arg_type_list), encoded_arguments]
outtypes: list of [return values' type list]
Example:
data = batch_callfunction_decode(H, [[addr, "symbol()", ""] for addr in addrs], [["string"]])
Depends on eth_abi package | base.py | batch_callfunction_decode | zjuchenyuan/whalerank | 8 | python | def batch_callfunction_decode(endpoint, datalist, outtypes, height=None, needidx=False):
'\n datalist: [contract_address, funcname(arg_type_list), encoded_arguments]\n outtypes: list of [return values\' type list]\n Example:\n data = batch_callfunction_decode(H, [[addr, "symbol()", ] for addr in add... | def batch_callfunction_decode(endpoint, datalist, outtypes, height=None, needidx=False):
'\n datalist: [contract_address, funcname(arg_type_list), encoded_arguments]\n outtypes: list of [return values\' type list]\n Example:\n data = batch_callfunction_decode(H, [[addr, "symbol()", ] for addr in add... |
576aa94f48b79a8abc854078ec16f2a571285fb4b06e82745cf3cbe3b03d22f8 | def create_evaluate_ops(task_prefix: str, data_format: str, input_paths: List[str], prediction_path: str, metric_fn_and_keys: Tuple[(T, Iterable[str])], validate_fn: T, batch_prediction_job_id: Optional[str]=None, region: Optional[str]=None, project_id: Optional[str]=None, dataflow_options: Optional[Dict]=None, model_u... | Creates Operators needed for model evaluation and returns.
It gets prediction over inputs via Cloud ML Engine BatchPrediction API by
calling MLEngineBatchPredictionOperator, then summarize and validate
the result via Cloud Dataflow using DataFlowPythonOperator.
For details and pricing about Batch prediction, please r... | airflow/providers/google/cloud/utils/mlengine_operator_utils.py | create_evaluate_ops | jiantao01/airflow | 15,947 | python | def create_evaluate_ops(task_prefix: str, data_format: str, input_paths: List[str], prediction_path: str, metric_fn_and_keys: Tuple[(T, Iterable[str])], validate_fn: T, batch_prediction_job_id: Optional[str]=None, region: Optional[str]=None, project_id: Optional[str]=None, dataflow_options: Optional[Dict]=None, model_u... | def create_evaluate_ops(task_prefix: str, data_format: str, input_paths: List[str], prediction_path: str, metric_fn_and_keys: Tuple[(T, Iterable[str])], validate_fn: T, batch_prediction_job_id: Optional[str]=None, region: Optional[str]=None, project_id: Optional[str]=None, dataflow_options: Optional[Dict]=None, model_u... |
15bcfc2cc3821aea0e935d2e7e02de83dc20dbbe00680e988b03d026bf45e0b8 | def u_net(shape, nb_filters=64, conv_size=3, initialization='glorot_uniform', depth=4, inc_rate=2.0, activation='relu', dropout=0, output_channels=5, batchnorm=False, maxpool=True, upconv=True, pretrain=0, sigma_noise=0):
'U-Net model.\n\n Standard U-Net model, plus optional gaussian noise.\n Note that the di... | U-Net model.
Standard U-Net model, plus optional gaussian noise.
Note that the dimensions of the input images should be
multiples of 16.
Arguments:
shape: image shape, in the format (nb_channels, x_size, y_size).
nb_filters : initial number of filters in the convolutional layer.
depth : The depth of the U-net, i.e. t... | src/mmciad/utils/.ipynb_checkpoints/u_net-checkpoint.py | u_net | bjtho08/mmciad | 0 | python | def u_net(shape, nb_filters=64, conv_size=3, initialization='glorot_uniform', depth=4, inc_rate=2.0, activation='relu', dropout=0, output_channels=5, batchnorm=False, maxpool=True, upconv=True, pretrain=0, sigma_noise=0):
'U-Net model.\n\n Standard U-Net model, plus optional gaussian noise.\n Note that the di... | def u_net(shape, nb_filters=64, conv_size=3, initialization='glorot_uniform', depth=4, inc_rate=2.0, activation='relu', dropout=0, output_channels=5, batchnorm=False, maxpool=True, upconv=True, pretrain=0, sigma_noise=0):
'U-Net model.\n\n Standard U-Net model, plus optional gaussian noise.\n Note that the di... |
6692f569c3dd07567059d4a1ab16f4cfad49898169ba646861c1620dbe38569c | def test_extra_tokens():
'Extra tokens should persist between multiple calls of the same renderer,\n but be reset if initiating a new renderer.\n '
output_nomath = {'type': 'Document', 'front_matter': None, 'link_definitions': {}, 'footnotes': {}, 'footref_order': [], 'children': [{'type': 'Paragraph', 'c... | Extra tokens should persist between multiple calls of the same renderer,
but be reset if initiating a new renderer. | test/test_renderers/test_json_renderer.py | test_extra_tokens | executablebooks/mistletoe-ebp | 2 | python | def test_extra_tokens():
'Extra tokens should persist between multiple calls of the same renderer,\n but be reset if initiating a new renderer.\n '
output_nomath = {'type': 'Document', 'front_matter': None, 'link_definitions': {}, 'footnotes': {}, 'footref_order': [], 'children': [{'type': 'Paragraph', 'c... | def test_extra_tokens():
'Extra tokens should persist between multiple calls of the same renderer,\n but be reset if initiating a new renderer.\n '
output_nomath = {'type': 'Document', 'front_matter': None, 'link_definitions': {}, 'footnotes': {}, 'footref_order': [], 'children': [{'type': 'Paragraph', 'c... |
0a37bde166b5c31d2bd497149b373fb702fb03fb0b8c88c33aaafb15b6ff39e9 | def __init__(self):
'\n Normalizer constructor. Initializes constants that will be used for\n data transformation.\n '
self.train_min = 0
self.train_max = 0
self.centering_shift_constant = 0
self.zero_shift_constant = (10 ** (- 6)) | Normalizer constructor. Initializes constants that will be used for
data transformation. | emulator/normalization.py | __init__ | hutchresearch/deep_climate_emulator | 7 | python | def __init__(self):
'\n Normalizer constructor. Initializes constants that will be used for\n data transformation.\n '
self.train_min = 0
self.train_max = 0
self.centering_shift_constant = 0
self.zero_shift_constant = (10 ** (- 6)) | def __init__(self):
'\n Normalizer constructor. Initializes constants that will be used for\n data transformation.\n '
self.train_min = 0
self.train_max = 0
self.centering_shift_constant = 0
self.zero_shift_constant = (10 ** (- 6))<|docstring|>Normalizer constructor. Initializes... |
c38ea8adce9e5ba9e12696e8c3f142c353dcb3fb79f59f659fec76b6469fd60f | def transform(self, data, train_len, copy=True):
'\n Applies log transformation and scales values b/t -1 and 1.\n\n Args:\n data (ndarray): Collection of data points\n train_len (int): Length of the training set\n copy (bool): If true, creates a copy of th data array\n... | Applies log transformation and scales values b/t -1 and 1.
Args:
data (ndarray): Collection of data points
train_len (int): Length of the training set
copy (bool): If true, creates a copy of th data array
Returns:
(ndarray): Array of normalized data points | emulator/normalization.py | transform | hutchresearch/deep_climate_emulator | 7 | python | def transform(self, data, train_len, copy=True):
'\n Applies log transformation and scales values b/t -1 and 1.\n\n Args:\n data (ndarray): Collection of data points\n train_len (int): Length of the training set\n copy (bool): If true, creates a copy of th data array\n... | def transform(self, data, train_len, copy=True):
'\n Applies log transformation and scales values b/t -1 and 1.\n\n Args:\n data (ndarray): Collection of data points\n train_len (int): Length of the training set\n copy (bool): If true, creates a copy of th data array\n... |
c267337f56db49551d1c654b320b83eff71e8577a44f5d39bf4575ef77716ca0 | def inverse_transform(self, data):
'\n Applies the inverse transformation.\n\n Args:\n data (ndarray): Collection of data points\n\n Returns:\n (ndarray): Array of denormalized data points\n '
data += self.centering_shift_constant
data /= 2
data *= self.... | Applies the inverse transformation.
Args:
data (ndarray): Collection of data points
Returns:
(ndarray): Array of denormalized data points | emulator/normalization.py | inverse_transform | hutchresearch/deep_climate_emulator | 7 | python | def inverse_transform(self, data):
'\n Applies the inverse transformation.\n\n Args:\n data (ndarray): Collection of data points\n\n Returns:\n (ndarray): Array of denormalized data points\n '
data += self.centering_shift_constant
data /= 2
data *= self.... | def inverse_transform(self, data):
'\n Applies the inverse transformation.\n\n Args:\n data (ndarray): Collection of data points\n\n Returns:\n (ndarray): Array of denormalized data points\n '
data += self.centering_shift_constant
data /= 2
data *= self.... |
0052d0133402a3ea96564147cfcd63164f192e47880cb1379cfdde03f1f36491 | @build_hypothesis.command('glycopeptide-fa', short_help='Build glycopeptide search spaces with a FASTA file of proteins')
@click.pass_context
@glycopeptide_hypothesis_common_options
@click.argument('fasta-file', type=click.Path(exists=True), doc_help='A file containing protein sequences in FASTA format')
@database_conn... | Constructs a glycopeptide hypothesis from a FASTA file of proteins and a
collection of glycans. | glycan_profiling/cli/build_db.py | glycopeptide_fa | mobiusklein/glycresoft | 4 | python | @build_hypothesis.command('glycopeptide-fa', short_help='Build glycopeptide search spaces with a FASTA file of proteins')
@click.pass_context
@glycopeptide_hypothesis_common_options
@click.argument('fasta-file', type=click.Path(exists=True), doc_help='A file containing protein sequences in FASTA format')
@database_conn... | @build_hypothesis.command('glycopeptide-fa', short_help='Build glycopeptide search spaces with a FASTA file of proteins')
@click.pass_context
@glycopeptide_hypothesis_common_options
@click.argument('fasta-file', type=click.Path(exists=True), doc_help='A file containing protein sequences in FASTA format')
@database_conn... |
2b032f1394a2cc9b437b1028149203064c499d99f6f3beb5091ae68c01b0294d | @build_hypothesis.command('glycopeptide-mzid', short_help='Build a glycopeptide search space with an mzIdentML file')
@click.pass_context
@click.argument('mzid-file', type=click.Path(exists=True))
@database_connection
@glycopeptide_hypothesis_common_options
@click.option('-t', '--target-protein', multiple=True, help='S... | Constructs a glycopeptide hypothesis from a MzIdentML file of proteins and a
collection of glycans. | glycan_profiling/cli/build_db.py | glycopeptide_mzid | mobiusklein/glycresoft | 4 | python | @build_hypothesis.command('glycopeptide-mzid', short_help='Build a glycopeptide search space with an mzIdentML file')
@click.pass_context
@click.argument('mzid-file', type=click.Path(exists=True))
@database_connection
@glycopeptide_hypothesis_common_options
@click.option('-t', '--target-protein', multiple=True, help='S... | @build_hypothesis.command('glycopeptide-mzid', short_help='Build a glycopeptide search space with an mzIdentML file')
@click.pass_context
@click.argument('mzid-file', type=click.Path(exists=True))
@database_connection
@glycopeptide_hypothesis_common_options
@click.option('-t', '--target-protein', multiple=True, help='S... |
b179783fc55d718ed19c7eb5291e200dd1c6d96441f237dc4b1a5c71a0b5bf3e | def __init__(self, module: str, count: Union[(int, str)]='25000', verbose: bool=True, lazy: bool=True, python: bool=True, jupyter: bool=True) -> None:
'Create a Module instance that can be used to find\n which sections of a Python module are most frequently used.\n\n This class exposes the following m... | Create a Module instance that can be used to find
which sections of a Python module are most frequently used.
This class exposes the following methods::
usage()
nested_usage()
repositories()
plot()
n_uses()
n_files()
n_repositories()
..
TODO: Alert users of `alert`, output `limitHit`
... | module_dependencies/module/module.py | __init__ | tomaarsen/module_dependencies | 1 | python | def __init__(self, module: str, count: Union[(int, str)]='25000', verbose: bool=True, lazy: bool=True, python: bool=True, jupyter: bool=True) -> None:
'Create a Module instance that can be used to find\n which sections of a Python module are most frequently used.\n\n This class exposes the following m... | def __init__(self, module: str, count: Union[(int, str)]='25000', verbose: bool=True, lazy: bool=True, python: bool=True, jupyter: bool=True) -> None:
'Create a Module instance that can be used to find\n which sections of a Python module are most frequently used.\n\n This class exposes the following m... |
95bc5b04e19937393e0c42106a56ba9ab30dff4d9d372ef4c943fad3ee0baac7 | @cached_property
def data(self) -> Dict:
'Cached property of a Module, containing the parsed data from\n the SourceGraph API. This property lazily loads the data once upon request,\n and then parses it using `Source(...).dependencies()`.\n\n Example usage::\n\n >>> from module_depend... | Cached property of a Module, containing the parsed data from
the SourceGraph API. This property lazily loads the data once upon request,
and then parses it using `Source(...).dependencies()`.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count=3)
>>> pprint(module.... | module_dependencies/module/module.py | data | tomaarsen/module_dependencies | 1 | python | @cached_property
def data(self) -> Dict:
'Cached property of a Module, containing the parsed data from\n the SourceGraph API. This property lazily loads the data once upon request,\n and then parses it using `Source(...).dependencies()`.\n\n Example usage::\n\n >>> from module_depend... | @cached_property
def data(self) -> Dict:
'Cached property of a Module, containing the parsed data from\n the SourceGraph API. This property lazily loads the data once upon request,\n and then parses it using `Source(...).dependencies()`.\n\n Example usage::\n\n >>> from module_depend... |
557f3a71e5cd63f92ff75773117e182706d60f8e04f85119a7c097d9b63fa50f | @staticmethod
def is_subsection_of(var_one: Tuple[str], var_two: Tuple[str]) -> bool:
"Check whether `var_one` is a subsection of `var_two`. This means\n that `var_two` can be created by inserting strings into the tuple of\n `var_one`. For example, `var_two` as `('nltk', 'tokenize', 'word_tokenize')`\... | Check whether `var_one` is a subsection of `var_two`. This means
that `var_two` can be created by inserting strings into the tuple of
`var_one`. For example, `var_two` as `('nltk', 'tokenize', 'word_tokenize')`
can be created by inserting `'tokenize'` into a `var_one` as
`('nltk', 'word_tokenize')`, so this function re... | module_dependencies/module/module.py | is_subsection_of | tomaarsen/module_dependencies | 1 | python | @staticmethod
def is_subsection_of(var_one: Tuple[str], var_two: Tuple[str]) -> bool:
"Check whether `var_one` is a subsection of `var_two`. This means\n that `var_two` can be created by inserting strings into the tuple of\n `var_one`. For example, `var_two` as `('nltk', 'tokenize', 'word_tokenize')`\... | @staticmethod
def is_subsection_of(var_one: Tuple[str], var_two: Tuple[str]) -> bool:
"Check whether `var_one` is a subsection of `var_two`. This means\n that `var_two` can be created by inserting strings into the tuple of\n `var_one`. For example, `var_two` as `('nltk', 'tokenize', 'word_tokenize')`\... |
cc9e6d2ef6404de0ed28d692b5c88962b7102e082eeb48eddf92795a8c45feaf | @lru_cache(maxsize=1)
def usage(self, merge: bool=True, cumulative: bool=False) -> List[Tuple[(str, int)]]:
'Get a list of object-occurrence tuples, sorted by most to least frequent.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="... | Get a list of object-occurrence tuples, sorted by most to least frequent.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count="3")
>>> module.usage()
[('nltk.metrics.distance.edit_distance', 2),
('nltk.tokenize.sent_tokenize', 1),
('nltk.tokenize.treeba... | module_dependencies/module/module.py | usage | tomaarsen/module_dependencies | 1 | python | @lru_cache(maxsize=1)
def usage(self, merge: bool=True, cumulative: bool=False) -> List[Tuple[(str, int)]]:
'Get a list of object-occurrence tuples, sorted by most to least frequent.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="... | @lru_cache(maxsize=1)
def usage(self, merge: bool=True, cumulative: bool=False) -> List[Tuple[(str, int)]]:
'Get a list of object-occurrence tuples, sorted by most to least frequent.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="... |
69e3e7c46fe1df772ddbd0b6615e962a289b29e8ed65beff796dce6f3582c119 | @lru_cache(maxsize=1)
def nested_usage(self, full_name: bool=False, merge: bool=True, cumulative: bool=True) -> Dict[(str, Union[(Dict, int)])]:
'Get a (recursive) dictionary of objects mapped to occurrence of that object,\n and the object\'s children.\n\n Example usage::\n\n >>> from modul... | Get a (recursive) dictionary of objects mapped to occurrence of that object,
and the object's children.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count="3")
>>> module.nested_usage()
{
"nltk": {
"occurrences": 4,
"corpus": {
... | module_dependencies/module/module.py | nested_usage | tomaarsen/module_dependencies | 1 | python | @lru_cache(maxsize=1)
def nested_usage(self, full_name: bool=False, merge: bool=True, cumulative: bool=True) -> Dict[(str, Union[(Dict, int)])]:
'Get a (recursive) dictionary of objects mapped to occurrence of that object,\n and the object\'s children.\n\n Example usage::\n\n >>> from modul... | @lru_cache(maxsize=1)
def nested_usage(self, full_name: bool=False, merge: bool=True, cumulative: bool=True) -> Dict[(str, Union[(Dict, int)])]:
'Get a (recursive) dictionary of objects mapped to occurrence of that object,\n and the object\'s children.\n\n Example usage::\n\n >>> from modul... |
db056e542814a6f1172378cbf40fd1912bc1d57d0e89a8d1f1ea506001bab1d5 | @lru_cache(maxsize=1)
def repositories(self, obj: str='') -> Dict[(str, Dict[(str, Any)])]:
'Return a mapping of repository names to repository information\n that were fetched and parsed. Contains "description", "stars", "isFork" keys,\n plus a list of "files" with "name", "path", "url", "dependencies... | Return a mapping of repository names to repository information
that were fetched and parsed. Contains "description", "stars", "isFork" keys,
plus a list of "files" with "name", "path", "url", "dependencies" and
"parse_error" fields. The "parse_error" field lists the error that was
encountered when attempting to parse t... | module_dependencies/module/module.py | repositories | tomaarsen/module_dependencies | 1 | python | @lru_cache(maxsize=1)
def repositories(self, obj: str=) -> Dict[(str, Dict[(str, Any)])]:
'Return a mapping of repository names to repository information\n that were fetched and parsed. Contains "description", "stars", "isFork" keys,\n plus a list of "files" with "name", "path", "url", "dependencies" ... | @lru_cache(maxsize=1)
def repositories(self, obj: str=) -> Dict[(str, Dict[(str, Any)])]:
'Return a mapping of repository names to repository information\n that were fetched and parsed. Contains "description", "stars", "isFork" keys,\n plus a list of "files" with "name", "path", "url", "dependencies" ... |
0e55608a60109cd5488d9df978a7ef158a828deebfdcc494e877929a84ce9d82 | def plot(self, merge: bool=True, threshold: int=0, limit: int=(- 1), max_depth: int=4, transparant: bool=False, show: bool=True) -> None:
'Display a plotly Sunburst plot showing the frequency of use\n of different sections of this module.\n\n :param merge: Whether to attempt to merge e.g. `"nltk.word_... | Display a plotly Sunburst plot showing the frequency of use
of different sections of this module.
:param merge: Whether to attempt to merge e.g. `"nltk.word_tokenize"`
into `"nltk.tokenize.word_tokenize"`. May give incorrect results
for projects with "compat" folders, as the merging tends to prefer
longer ... | module_dependencies/module/module.py | plot | tomaarsen/module_dependencies | 1 | python | def plot(self, merge: bool=True, threshold: int=0, limit: int=(- 1), max_depth: int=4, transparant: bool=False, show: bool=True) -> None:
'Display a plotly Sunburst plot showing the frequency of use\n of different sections of this module.\n\n :param merge: Whether to attempt to merge e.g. `"nltk.word_... | def plot(self, merge: bool=True, threshold: int=0, limit: int=(- 1), max_depth: int=4, transparant: bool=False, show: bool=True) -> None:
'Display a plotly Sunburst plot showing the frequency of use\n of different sections of this module.\n\n :param merge: Whether to attempt to merge e.g. `"nltk.word_... |
a48510399b575dcd5f622909af873a5e6bdbcc1109f8512c66572067202a3786 | def n_uses(self, obj: str='') -> int:
'Return the number of uses of the module.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_uses()\n 137\n\n :return: The number of uses, i.e. th... | Return the number of uses of the module.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count="100")
>>> module.n_uses()
137
:return: The number of uses, i.e. the number of times
`self.module` was used in the fetched files.
:rtype: int | module_dependencies/module/module.py | n_uses | tomaarsen/module_dependencies | 1 | python | def n_uses(self, obj: str=) -> int:
'Return the number of uses of the module.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_uses()\n 137\n\n :return: The number of uses, i.e. the ... | def n_uses(self, obj: str=) -> int:
'Return the number of uses of the module.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_uses()\n 137\n\n :return: The number of uses, i.e. the ... |
dfbc89bdb9602e97f0d427b7a63ece89132d5a4210a1c029afee6cb1d0d25cf6 | def n_files(self) -> int:
'Return the number of files fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_files()\n 100\n\n :return: The number of fetched files in which `self.... | Return the number of files fetched.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count="100")
>>> module.n_files()
100
:return: The number of fetched files in which `self.module` was
imported. Generally equivalent or similar to `count` if it
was provi... | module_dependencies/module/module.py | n_files | tomaarsen/module_dependencies | 1 | python | def n_files(self) -> int:
'Return the number of files fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_files()\n 100\n\n :return: The number of fetched files in which `self.... | def n_files(self) -> int:
'Return the number of files fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_files()\n 100\n\n :return: The number of fetched files in which `self.... |
bc241538afb8265833c153c9a0127d7a4196482719cfedc7d99b5c23f5906d6c | def n_repositories(self) -> int:
'Return the number of repositories fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_repositories()\n 52\n\n TODO: Exclude errorred code\n\n ... | Return the number of repositories fetched.
Example usage::
>>> from module_dependencies import Module
>>> module = Module("nltk", count="100")
>>> module.n_repositories()
52
TODO: Exclude errorred code
:return: The number of fetched repositories in which `self.module`
was imported.
:rtype: int | module_dependencies/module/module.py | n_repositories | tomaarsen/module_dependencies | 1 | python | def n_repositories(self) -> int:
'Return the number of repositories fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_repositories()\n 52\n\n TODO: Exclude errorred code\n\n ... | def n_repositories(self) -> int:
'Return the number of repositories fetched.\n\n Example usage::\n\n >>> from module_dependencies import Module\n >>> module = Module("nltk", count="100")\n >>> module.n_repositories()\n 52\n\n TODO: Exclude errorred code\n\n ... |
54be0f20c0f26950da46f1be257835128adcd4ec3be5f15352e1e2e6aa28e8d9 | def merge_one(usage: List[Tuple[(Tuple[str], int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of similar tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`. `usage` is a list of potentially\n combin... | Merge a list of similar tuples, combining on "paths" that likely
refer to the same object, e.g. `"nltk.word_tokenize"` and
`"nltk.tokenize.word_tokenize"`. `usage` is a list of potentially
combinable objects.
:param usage: A list of tuples, where the first element is a tuple
of strings that represent a path to a P... | module_dependencies/module/module.py | merge_one | tomaarsen/module_dependencies | 1 | python | def merge_one(usage: List[Tuple[(Tuple[str], int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of similar tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`. `usage` is a list of potentially\n combin... | def merge_one(usage: List[Tuple[(Tuple[str], int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of similar tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`. `usage` is a list of potentially\n combin... |
d041e8bb052a2c85d51cf5eb2bc0c8e0348fac0dc37ed88ba88708f039857959 | def merge_all(usage: List[Tuple[(str, int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`.\n\n :param usage: A list of tuples, where the first elem... | Merge a list of tuples, combining on "paths" that likely
refer to the same object, e.g. `"nltk.word_tokenize"` and
`"nltk.tokenize.word_tokenize"`.
:param usage: A list of tuples, where the first element of
each tuple is a string representing a path to a Python object,
e.g. `"nltk.word_tokenize"`, and the seco... | module_dependencies/module/module.py | merge_all | tomaarsen/module_dependencies | 1 | python | def merge_all(usage: List[Tuple[(str, int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`.\n\n :param usage: A list of tuples, where the first elem... | def merge_all(usage: List[Tuple[(str, int)]]) -> List[Tuple[(str, int)]]:
'Merge a list of tuples, combining on "paths" that likely\n refer to the same object, e.g. `"nltk.word_tokenize"` and\n `"nltk.tokenize.word_tokenize"`.\n\n :param usage: A list of tuples, where the first elem... |
0131b89d52a9f99db3c305f28ec94b05fea9841c218ff6d737d83c896b16471c | def get_value(nested_dict: Dict, tok_obj: Tuple[str]) -> int:
'Recursively apply elements from `tok_obj` as keys in `nested_dict`,\n and then gather the `occurrences`.\n\n :param nested_dict: A dictionary with nested usages, generally taken\n from the `nested_usage` method.\n ... | Recursively apply elements from `tok_obj` as keys in `nested_dict`,
and then gather the `occurrences`.
:param nested_dict: A dictionary with nested usages, generally taken
from the `nested_usage` method.
:type nested_dict: Dict
:param tok_obj: A tuple of strings representing a path to a Python path.
:type tok_obj:... | module_dependencies/module/module.py | get_value | tomaarsen/module_dependencies | 1 | python | def get_value(nested_dict: Dict, tok_obj: Tuple[str]) -> int:
'Recursively apply elements from `tok_obj` as keys in `nested_dict`,\n and then gather the `occurrences`.\n\n :param nested_dict: A dictionary with nested usages, generally taken\n from the `nested_usage` method.\n ... | def get_value(nested_dict: Dict, tok_obj: Tuple[str]) -> int:
'Recursively apply elements from `tok_obj` as keys in `nested_dict`,\n and then gather the `occurrences`.\n\n :param nested_dict: A dictionary with nested usages, generally taken\n from the `nested_usage` method.\n ... |
d7fb2cb6eec4c7540dd8af04b6f5c445f86e765a64973fe9be3d5b449e5d33e4 | def test_tddft_iter_lda(self):
' Compute polarization with LDA TDDFT '
from timeit import default_timer as timer
dname = os.path.dirname(os.path.abspath(__file__))
td = tddft_iter(label='water', cd=dname, jcutoff=7, iter_broadening=0.01, xc_code='LDA,PZ', level=0)
omegas = (np.linspace(0.0, 2.0, 15... | Compute polarization with LDA TDDFT | pyscf/nao/test/test_0034_tddft_iter_lda_nao.py | test_tddft_iter_lda | mfkasim1/pyscf | 3 | python | def test_tddft_iter_lda(self):
' '
from timeit import default_timer as timer
dname = os.path.dirname(os.path.abspath(__file__))
td = tddft_iter(label='water', cd=dname, jcutoff=7, iter_broadening=0.01, xc_code='LDA,PZ', level=0)
omegas = (np.linspace(0.0, 2.0, 150) + (1j * td.eps))
pxx = (- td... | def test_tddft_iter_lda(self):
' '
from timeit import default_timer as timer
dname = os.path.dirname(os.path.abspath(__file__))
td = tddft_iter(label='water', cd=dname, jcutoff=7, iter_broadening=0.01, xc_code='LDA,PZ', level=0)
omegas = (np.linspace(0.0, 2.0, 150) + (1j * td.eps))
pxx = (- td... |
f7ba3fc467b684fb2e3be9d235e7c369344f541761096e7c24f519f53baaafda | @staticmethod
def random_agent(observation, configuration):
'Agent for taking a random action.'
del observation
return random.randrange(configuration.banditCount) | Agent for taking a random action. | idea01/bots.py | random_agent | RobRomijnders/santa20 | 0 | python | @staticmethod
def random_agent(observation, configuration):
del observation
return random.randrange(configuration.banditCount) | @staticmethod
def random_agent(observation, configuration):
del observation
return random.randrange(configuration.banditCount)<|docstring|>Agent for taking a random action.<|endoftext|> |
202474d18428954253c129c202689a53f423387176694943bbedf5d7f2274f47 | def random_agent_limit(self, observation, configuration):
'Agent for taking a random action within a limit.'
del observation
return random.randrange(int((configuration.banditCount * self.limit))) | Agent for taking a random action within a limit. | idea01/bots.py | random_agent_limit | RobRomijnders/santa20 | 0 | python | def random_agent_limit(self, observation, configuration):
del observation
return random.randrange(int((configuration.banditCount * self.limit))) | def random_agent_limit(self, observation, configuration):
del observation
return random.randrange(int((configuration.banditCount * self.limit)))<|docstring|>Agent for taking a random action within a limit.<|endoftext|> |
6c9af06b89fb54720528298a5d5e2f639b6cd7fa9cf7d0e87b51f794450234b0 | def random_agent_constant(self, observation, configuration):
'Just returns the same value over and over again.'
del observation
return int((configuration.banditCount * self.limit)) | Just returns the same value over and over again. | idea01/bots.py | random_agent_constant | RobRomijnders/santa20 | 0 | python | def random_agent_constant(self, observation, configuration):
del observation
return int((configuration.banditCount * self.limit)) | def random_agent_constant(self, observation, configuration):
del observation
return int((configuration.banditCount * self.limit))<|docstring|>Just returns the same value over and over again.<|endoftext|> |
9452a3deabbb5cfcd2c6ec682856c7144429f5f545bab06a0817c23853984c10 | def thompson_sampling_agent(self, observation, configuration):
'Agent that uses Thompson sampling.'
if (len(self.counts) == 0):
for i in range(configuration.banditCount):
self.counts[i] = self.prior
if (len(observation.lastActions) > 0):
self.rewards.append(observation.reward)
... | Agent that uses Thompson sampling. | idea01/bots.py | thompson_sampling_agent | RobRomijnders/santa20 | 0 | python | def thompson_sampling_agent(self, observation, configuration):
if (len(self.counts) == 0):
for i in range(configuration.banditCount):
self.counts[i] = self.prior
if (len(observation.lastActions) > 0):
self.rewards.append(observation.reward)
self.opponent_picks.append(opp... | def thompson_sampling_agent(self, observation, configuration):
if (len(self.counts) == 0):
for i in range(configuration.banditCount):
self.counts[i] = self.prior
if (len(observation.lastActions) > 0):
self.rewards.append(observation.reward)
self.opponent_picks.append(opp... |
3af7e3729f51a7e8dead6fe31ad236229c6e779ebd4abe688410ca7929b3c014 | def init_markets(self, markets):
'Initialize markets by importing public market classes.'
self.market_names = markets
for market_name in markets:
exec(('import public_markets.' + market_name.lower()))
market = eval((((('public_markets.' + market_name.lower()) + '.') + market_name) + '()'))
... | Initialize markets by importing public market classes. | arbitrage/arbitrer.py | init_markets | acontry/altcoin-arbitrage | 7 | python | def init_markets(self, markets):
self.market_names = markets
for market_name in markets:
exec(('import public_markets.' + market_name.lower()))
market = eval((((('public_markets.' + market_name.lower()) + '.') + market_name) + '()'))
self.markets[market_name] = market | def init_markets(self, markets):
self.market_names = markets
for market_name in markets:
exec(('import public_markets.' + market_name.lower()))
market = eval((((('public_markets.' + market_name.lower()) + '.') + market_name) + '()'))
self.markets[market_name] = market<|docstring|>In... |
12c3461c077e117f361afd5a518db468bea6367895a86d87be6fa2e7a5365478 | def init_observers(self, _observers):
'Initialize observers by importing observer classes.'
self.observer_names = _observers
for observer_name in _observers:
exec(('import observers.' + observer_name.lower()))
observer = eval((((('observers.' + observer_name.lower()) + '.') + observer_name) ... | Initialize observers by importing observer classes. | arbitrage/arbitrer.py | init_observers | acontry/altcoin-arbitrage | 7 | python | def init_observers(self, _observers):
self.observer_names = _observers
for observer_name in _observers:
exec(('import observers.' + observer_name.lower()))
observer = eval((((('observers.' + observer_name.lower()) + '.') + observer_name) + '()'))
self.observers.append(observer) | def init_observers(self, _observers):
self.observer_names = _observers
for observer_name in _observers:
exec(('import observers.' + observer_name.lower()))
observer = eval((((('observers.' + observer_name.lower()) + '.') + observer_name) + '()'))
self.observers.append(observer)<|doc... |
c5d5ced5b3aa13ba2eb79bdc5fa8a692730d15c2a5a33055f770bd33296b0bfd | def check_opportunity(self, kask, kbid):
'Replacement for arbitrage_depth_opportunity machinery. Returns the\n profit, volume, buy price, sell price, weighted buy/sell prices for a\n potential arbitrage opportunity. Only considers the best bid/ask prices\n and does not go into the depth like th... | Replacement for arbitrage_depth_opportunity machinery. Returns the
profit, volume, buy price, sell price, weighted buy/sell prices for a
potential arbitrage opportunity. Only considers the best bid/ask prices
and does not go into the depth like the more complicated method. | arbitrage/arbitrer.py | check_opportunity | acontry/altcoin-arbitrage | 7 | python | def check_opportunity(self, kask, kbid):
'Replacement for arbitrage_depth_opportunity machinery. Returns the\n profit, volume, buy price, sell price, weighted buy/sell prices for a\n potential arbitrage opportunity. Only considers the best bid/ask prices\n and does not go into the depth like th... | def check_opportunity(self, kask, kbid):
'Replacement for arbitrage_depth_opportunity machinery. Returns the\n profit, volume, buy price, sell price, weighted buy/sell prices for a\n potential arbitrage opportunity. Only considers the best bid/ask prices\n and does not go into the depth like th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.