nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
conan-io/conan | 28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8 | conan/tools/apple/xcodedeps.py | python | XcodeDeps._conf_xconfig_file | (self, dep_name, vars_xconfig_name) | return content_multi | content for conan_poco_x86_release.xcconfig, containing the activation | content for conan_poco_x86_release.xcconfig, containing the activation | [
"content",
"for",
"conan_poco_x86_release",
".",
"xcconfig",
"containing",
"the",
"activation"
] | def _conf_xconfig_file(self, dep_name, vars_xconfig_name):
"""
content for conan_poco_x86_release.xcconfig, containing the activation
"""
# TODO: when it's more clear what to do with the sdk, add the condition for it and also
# we are not taking into account the version for the ... | [
"def",
"_conf_xconfig_file",
"(",
"self",
",",
"dep_name",
",",
"vars_xconfig_name",
")",
":",
"# TODO: when it's more clear what to do with the sdk, add the condition for it and also",
"# we are not taking into account the version for the sdk because we probably",
"# want to model also th... | https://github.com/conan-io/conan/blob/28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8/conan/tools/apple/xcodedeps.py#L127-L138 | |
phantomcyber/playbooks | 9e850ecc44cb98c5dde53784744213a1ed5799bd | excessive_account_lockouts_enrichment_and_response.py | python | endpoint_rights_mod | (action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs) | return | [] | def endpoint_rights_mod(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs):
phantom.debug('endpoint_rights_mod() called')
template = """| search index=wineventlog (EventCode=4718 OR EventCode=4717) dest={0} |... | [
"def",
"endpoint_rights_mod",
"(",
"action",
"=",
"None",
",",
"success",
"=",
"None",
",",
"container",
"=",
"None",
",",
"results",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"filtered_artifacts",
"=",
"None",
",",
"filtered_results",
"=",
"None",
","... | https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/excessive_account_lockouts_enrichment_and_response.py#L285-L299 | |||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py | python | DirectoryLocator.get_distribution_names | (self) | return result | Return all the distribution names known to this locator. | Return all the distribution names known to this locator. | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
for root, dirs, files in os.walk(self.base_dir):
for fn in files:
if self.should_include(fn, root):
fn = os.path.join(... | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"base_dir",
")",
":",
"for",
"fn",
"in",
"files",
":",
"if",
"self",
".",
... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L843-L860 | |
noio/peas | 4c2503388644cc5ca58c501e6c773d53a883538b | peas/methods/evolution.py | python | SimplePopulation._birth | (self) | return self.population | Creates a population if there is none, returns
current population otherwise. | Creates a population if there is none, returns
current population otherwise. | [
"Creates",
"a",
"population",
"if",
"there",
"is",
"none",
"returns",
"current",
"population",
"otherwise",
"."
] | def _birth(self):
""" Creates a population if there is none, returns
current population otherwise.
"""
while len(self.population) < self.popsize:
individual = self.geno_factory()
self.population.append(individual)
return self.population | [
"def",
"_birth",
"(",
"self",
")",
":",
"while",
"len",
"(",
"self",
".",
"population",
")",
"<",
"self",
".",
"popsize",
":",
"individual",
"=",
"self",
".",
"geno_factory",
"(",
")",
"self",
".",
"population",
".",
"append",
"(",
"individual",
")",
... | https://github.com/noio/peas/blob/4c2503388644cc5ca58c501e6c773d53a883538b/peas/methods/evolution.py#L116-L124 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/ex-submodules/casexml/apps/stock/consumption.py | python | span_days | (start, end) | return span.days + span.seconds / 86400. | [] | def span_days(start, end):
span = end - start
return span.days + span.seconds / 86400. | [
"def",
"span_days",
"(",
"start",
",",
"end",
")",
":",
"span",
"=",
"end",
"-",
"start",
"return",
"span",
".",
"days",
"+",
"span",
".",
"seconds",
"/",
"86400."
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/casexml/apps/stock/consumption.py#L135-L137 | |||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/application/internet.py | python | StreamServerEndpointService.startService | (self) | Start listening on the endpoint, unless L{privilegedStartService} got
around to it already. | Start listening on the endpoint, unless L{privilegedStartService} got
around to it already. | [
"Start",
"listening",
"on",
"the",
"endpoint",
"unless",
"L",
"{",
"privilegedStartService",
"}",
"got",
"around",
"to",
"it",
"already",
"."
] | def startService(self):
"""
Start listening on the endpoint, unless L{privilegedStartService} got
around to it already.
"""
service.Service.startService(self)
if self._waitingForPort is None:
self.privilegedStartService() | [
"def",
"startService",
"(",
"self",
")",
":",
"service",
".",
"Service",
".",
"startService",
"(",
"self",
")",
"if",
"self",
".",
"_waitingForPort",
"is",
"None",
":",
"self",
".",
"privilegedStartService",
"(",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/application/internet.py#L369-L376 | ||
flopp/GpxTrackPoster | d7ff0ba61f6396938efd075d841a7c4a226a6f5d | gpxtrackposter/track_loader.py | python | TrackLoader.load_strava_tracks | (self, strava_config: str) | return self._filter_and_merge_tracks(tracks) | [] | def load_strava_tracks(self, strava_config: str) -> typing.List[Track]:
tracks = []
tracks_names = []
if self.cache_dir:
self.strava_cache_file = os.path.join(self.cache_dir, strava_config)
if os.path.isfile(self.strava_cache_file):
with open(self.strava_c... | [
"def",
"load_strava_tracks",
"(",
"self",
",",
"strava_config",
":",
"str",
")",
"->",
"typing",
".",
"List",
"[",
"Track",
"]",
":",
"tracks",
"=",
"[",
"]",
"tracks_names",
"=",
"[",
"]",
"if",
"self",
".",
"cache_dir",
":",
"self",
".",
"strava_cach... | https://github.com/flopp/GpxTrackPoster/blob/d7ff0ba61f6396938efd075d841a7c4a226a6f5d/gpxtrackposter/track_loader.py#L122-L155 | |||
zhixinwang/frustum-convnet | 5b1508d3f2140c3c0dd6dd17b5606b532b7a5ec8 | kitti/kitti_util.py | python | inverse_rigid_trans | (Tr) | return inv_Tr | Inverse a rigid body transform matrix (3x4 as [R|t])
[R'|-R't; 0|1] | Inverse a rigid body transform matrix (3x4 as [R|t])
[R'|-R't; 0|1] | [
"Inverse",
"a",
"rigid",
"body",
"transform",
"matrix",
"(",
"3x4",
"as",
"[",
"R|t",
"]",
")",
"[",
"R",
"|",
"-",
"R",
"t",
";",
"0|1",
"]"
] | def inverse_rigid_trans(Tr):
''' Inverse a rigid body transform matrix (3x4 as [R|t])
[R'|-R't; 0|1]
'''
inv_Tr = np.zeros_like(Tr) # 3x4
inv_Tr[0:3, 0:3] = np.transpose(Tr[0:3, 0:3])
inv_Tr[0:3, 3] = np.dot(-np.transpose(Tr[0:3, 0:3]), Tr[0:3, 3])
return inv_Tr | [
"def",
"inverse_rigid_trans",
"(",
"Tr",
")",
":",
"inv_Tr",
"=",
"np",
".",
"zeros_like",
"(",
"Tr",
")",
"# 3x4",
"inv_Tr",
"[",
"0",
":",
"3",
",",
"0",
":",
"3",
"]",
"=",
"np",
".",
"transpose",
"(",
"Tr",
"[",
"0",
":",
"3",
",",
"0",
"... | https://github.com/zhixinwang/frustum-convnet/blob/5b1508d3f2140c3c0dd6dd17b5606b532b7a5ec8/kitti/kitti_util.py#L275-L282 | |
kovidgoyal/calibre | 2b41671370f2a9eb1109b9ae901ccf915f1bd0c8 | src/calibre/utils/fonts/utils.py | python | get_font_characteristics | (raw, raw_is_table=False, return_all=False) | return weight, is_italic, is_bold, is_regular, fs_type, panose, width, is_oblique, is_wws, version | Return (weight, is_italic, is_bold, is_regular, fs_type, panose, width,
is_oblique, is_wws). These
values are taken from the OS/2 table of the font. See
http://www.microsoft.com/typography/otspec/os2.htm for details | Return (weight, is_italic, is_bold, is_regular, fs_type, panose, width,
is_oblique, is_wws). These
values are taken from the OS/2 table of the font. See
http://www.microsoft.com/typography/otspec/os2.htm for details | [
"Return",
"(",
"weight",
"is_italic",
"is_bold",
"is_regular",
"fs_type",
"panose",
"width",
"is_oblique",
"is_wws",
")",
".",
"These",
"values",
"are",
"taken",
"from",
"the",
"OS",
"/",
"2",
"table",
"of",
"the",
"font",
".",
"See",
"http",
":",
"//",
... | def get_font_characteristics(raw, raw_is_table=False, return_all=False):
'''
Return (weight, is_italic, is_bold, is_regular, fs_type, panose, width,
is_oblique, is_wws). These
values are taken from the OS/2 table of the font. See
http://www.microsoft.com/typography/otspec/os2.htm for details
'''... | [
"def",
"get_font_characteristics",
"(",
"raw",
",",
"raw_is_table",
"=",
"False",
",",
"return_all",
"=",
"False",
")",
":",
"if",
"raw_is_table",
":",
"os2_table",
"=",
"raw",
"else",
":",
"os2_table",
"=",
"get_table",
"(",
"raw",
",",
"'os/2'",
")",
"["... | https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/utils/fonts/utils.py#L50-L92 | |
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | solutionbox/structured_data/mltoolbox/_structured_data/_package.py | python | local_train | (train_dataset,
eval_dataset,
analysis_dir,
output_dir,
features,
model_type,
max_steps,
num_epochs,
train_batch_size,
eval_batch_size,
min_eval_frequency,
... | [] | def local_train(train_dataset,
eval_dataset,
analysis_dir,
output_dir,
features,
model_type,
max_steps,
num_epochs,
train_batch_size,
eval_batch_size,
min_eval_... | [
"def",
"local_train",
"(",
"train_dataset",
",",
"eval_dataset",
",",
"analysis_dir",
",",
"output_dir",
",",
"features",
",",
"model_type",
",",
"max_steps",
",",
"num_epochs",
",",
"train_batch_size",
",",
"eval_batch_size",
",",
"min_eval_frequency",
",",
"top_n"... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/solutionbox/structured_data/mltoolbox/_structured_data/_package.py#L363-L453 | ||||
DSE-MSU/DeepRobust | 2bcde200a5969dae32cddece66206a52c87c43e8 | deeprobust/graph/defense/r_gcn.py | python | GaussianConvolution.reset_parameters | (self) | [] | def reset_parameters(self):
# TODO
torch.nn.init.xavier_uniform_(self.weight_miu)
torch.nn.init.xavier_uniform_(self.weight_sigma) | [
"def",
"reset_parameters",
"(",
"self",
")",
":",
"# TODO",
"torch",
".",
"nn",
".",
"init",
".",
"xavier_uniform_",
"(",
"self",
".",
"weight_miu",
")",
"torch",
".",
"nn",
".",
"init",
".",
"xavier_uniform_",
"(",
"self",
".",
"weight_sigma",
")"
] | https://github.com/DSE-MSU/DeepRobust/blob/2bcde200a5969dae32cddece66206a52c87c43e8/deeprobust/graph/defense/r_gcn.py#L89-L92 | ||||
hyperledger/sawtooth-core | 704cd5837c21f53642c06ffc97ba7978a77940b0 | cli/sawtooth_cli/network_command/compare.py | python | do_compare_chains | (args) | Calculates and outputs comparison between all nodes on the network. | Calculates and outputs comparison between all nodes on the network. | [
"Calculates",
"and",
"outputs",
"comparison",
"between",
"all",
"nodes",
"on",
"the",
"network",
"."
] | def do_compare_chains(args):
"""Calculates and outputs comparison between all nodes on the network."""
urls = split_comma_append_args(args.urls)
users = split_comma_append_args(args.users)
clients = make_rest_apis(urls, users)
broken = []
chains, errors = get_chain_generators(clients, args.lim... | [
"def",
"do_compare_chains",
"(",
"args",
")",
":",
"urls",
"=",
"split_comma_append_args",
"(",
"args",
".",
"urls",
")",
"users",
"=",
"split_comma_append_args",
"(",
"args",
".",
"users",
")",
"clients",
"=",
"make_rest_apis",
"(",
"urls",
",",
"users",
")... | https://github.com/hyperledger/sawtooth-core/blob/704cd5837c21f53642c06ffc97ba7978a77940b0/cli/sawtooth_cli/network_command/compare.py#L85-L139 | ||
kozec/sc-controller | ce92c773b8b26f6404882e9209aff212c4053170 | scc/device_monitor.py | python | DeviceMonitor.get_hidraw | (self, syspath) | return None | For given syspath, returns name of assotiated hidraw device.
Returns None if there is no such thing. | For given syspath, returns name of assotiated hidraw device.
Returns None if there is no such thing. | [
"For",
"given",
"syspath",
"returns",
"name",
"of",
"assotiated",
"hidraw",
"device",
".",
"Returns",
"None",
"if",
"there",
"is",
"no",
"such",
"thing",
"."
] | def get_hidraw(self, syspath):
"""
For given syspath, returns name of assotiated hidraw device.
Returns None if there is no such thing.
"""
node = self._dev_for_hci(syspath)
if node is None:
return None
hidrawsubdir = os.path.join(node, "hidraw")
for fname in os.listdir(hidrawsubdir):
if fname.sta... | [
"def",
"get_hidraw",
"(",
"self",
",",
"syspath",
")",
":",
"node",
"=",
"self",
".",
"_dev_for_hci",
"(",
"syspath",
")",
"if",
"node",
"is",
"None",
":",
"return",
"None",
"hidrawsubdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"node",
",",
"\"hi... | https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/device_monitor.py#L204-L216 | |
linuxscout/pyarabic | 010bddadb7c9b5c6bd24cc02d4aeddde0c4a10c4 | pyarabic/kalima.py | python | Kalima.__le__ | (self, other) | Compare two vocalized words,
the two words are equal if they have the same letters and marks
The two words are greater or equals if have the same letters and
similar full or partial vocalization | Compare two vocalized words,
the two words are equal if they have the same letters and marks
The two words are greater or equals if have the same letters and
similar full or partial vocalization | [
"Compare",
"two",
"vocalized",
"words",
"the",
"two",
"words",
"are",
"equal",
"if",
"they",
"have",
"the",
"same",
"letters",
"and",
"marks",
"The",
"two",
"words",
"are",
"greater",
"or",
"equals",
"if",
"have",
"the",
"same",
"letters",
"and",
"similar"... | def __le__(self, other):
"""
Compare two vocalized words,
the two words are equal if they have the same letters and marks
The two words are greater or equals if have the same letters and
similar full or partial vocalization
""" | [
"def",
"__le__",
"(",
"self",
",",
"other",
")",
":"
] | https://github.com/linuxscout/pyarabic/blob/010bddadb7c9b5c6bd24cc02d4aeddde0c4a10c4/pyarabic/kalima.py#L100-L106 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/pdb.py | python | Pdb.do_whatis | (self, arg) | whatis arg
Print the type of the argument. | whatis arg
Print the type of the argument. | [
"whatis",
"arg",
"Print",
"the",
"type",
"of",
"the",
"argument",
"."
] | def do_whatis(self, arg):
"""whatis arg
Print the type of the argument.
"""
try:
value = self._getval(arg)
except:
# _getval() already printed the error
return
code = None
# Is it a function?
try:
code = valu... | [
"def",
"do_whatis",
"(",
"self",
",",
"arg",
")",
":",
"try",
":",
"value",
"=",
"self",
".",
"_getval",
"(",
"arg",
")",
"except",
":",
"# _getval() already printed the error",
"return",
"code",
"=",
"None",
"# Is it a function?",
"try",
":",
"code",
"=",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/pdb.py#L1297-L1328 | ||
CTF-MissFeng/bayonet | 360ffeb87025a85b08b4fa56f951936d38f2c109 | web/route/user/html.py | python | html_user_add | () | return render_template('user/user-add.html', title=TITLE) | 新增用户 | 新增用户 | [
"新增用户"
] | def html_user_add():
'''新增用户'''
return render_template('user/user-add.html', title=TITLE) | [
"def",
"html_user_add",
"(",
")",
":",
"return",
"render_template",
"(",
"'user/user-add.html'",
",",
"title",
"=",
"TITLE",
")"
] | https://github.com/CTF-MissFeng/bayonet/blob/360ffeb87025a85b08b4fa56f951936d38f2c109/web/route/user/html.py#L63-L65 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/server/api/v2/providers.py | python | ProvidersHandler.post | (self, identifier, path_param=None) | return self._bad_request('Could not locate provider by id') | Add a new provider or run an operation on a specific provider type.
Without the identifier an arary of provider objects is expected to save the provider order list.
With a subType param, operations can be executed, like the newznab/getCategories. Which will return
a list of available newzna... | Add a new provider or run an operation on a specific provider type. | [
"Add",
"a",
"new",
"provider",
"or",
"run",
"an",
"operation",
"on",
"a",
"specific",
"provider",
"type",
"."
] | def post(self, identifier, path_param=None):
"""
Add a new provider or run an operation on a specific provider type.
Without the identifier an arary of provider objects is expected to save the provider order list.
With a subType param, operations can be executed, like the newznab/getCat... | [
"def",
"post",
"(",
"self",
",",
"identifier",
",",
"path_param",
"=",
"None",
")",
":",
"if",
"not",
"identifier",
":",
"data",
"=",
"json_decode",
"(",
"self",
".",
"request",
".",
"body",
")",
"sorted_providers",
"=",
"data",
".",
"get",
"(",
"'prov... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/server/api/v2/providers.py#L132-L189 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | debug_event_t.bpt_ea | (self, *args) | return _idaapi.debug_event_t_bpt_ea(self, *args) | bpt_ea(self) -> ea_t | bpt_ea(self) -> ea_t | [
"bpt_ea",
"(",
"self",
")",
"-",
">",
"ea_t"
] | def bpt_ea(self, *args):
"""
bpt_ea(self) -> ea_t
"""
return _idaapi.debug_event_t_bpt_ea(self, *args) | [
"def",
"bpt_ea",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"debug_event_t_bpt_ea",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L3166-L3170 | |
facebookresearch/votenet | 2f6d6d36ff98d96901182e935afe48ccee82d566 | models/loss_helper.py | python | compute_vote_loss | (end_points) | return vote_loss | Compute vote loss: Match predicted votes to GT votes.
Args:
end_points: dict (read-only)
Returns:
vote_loss: scalar Tensor
Overall idea:
If the seed point belongs to an object (votes_label_mask == 1),
then we require it to vote for the object center.
... | Compute vote loss: Match predicted votes to GT votes. | [
"Compute",
"vote",
"loss",
":",
"Match",
"predicted",
"votes",
"to",
"GT",
"votes",
"."
] | def compute_vote_loss(end_points):
""" Compute vote loss: Match predicted votes to GT votes.
Args:
end_points: dict (read-only)
Returns:
vote_loss: scalar Tensor
Overall idea:
If the seed point belongs to an object (votes_label_mask == 1),
then we requi... | [
"def",
"compute_vote_loss",
"(",
"end_points",
")",
":",
"# Load ground truth votes and assign them to seed points",
"batch_size",
"=",
"end_points",
"[",
"'seed_xyz'",
"]",
".",
"shape",
"[",
"0",
"]",
"num_seed",
"=",
"end_points",
"[",
"'seed_xyz'",
"]",
".",
"sh... | https://github.com/facebookresearch/votenet/blob/2f6d6d36ff98d96901182e935afe48ccee82d566/models/loss_helper.py#L21-L66 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txweb2/dav/resource.py | python | DAVPrincipalResource.expandedGroupMembers | (self) | return succeed(()) | This implementation returns a Deferred which fires with C{()},
which is appropriate for non-group principals. Subclasses
should override this method to provide expanded member URLs
for this resource if appropriate.
@see: L{IDAVPrincipalResource.expandedGroupMembers} | This implementation returns a Deferred which fires with C{()},
which is appropriate for non-group principals. Subclasses
should override this method to provide expanded member URLs
for this resource if appropriate. | [
"This",
"implementation",
"returns",
"a",
"Deferred",
"which",
"fires",
"with",
"C",
"{",
"()",
"}",
"which",
"is",
"appropriate",
"for",
"non",
"-",
"group",
"principals",
".",
"Subclasses",
"should",
"override",
"this",
"method",
"to",
"provide",
"expanded",... | def expandedGroupMembers(self):
"""
This implementation returns a Deferred which fires with C{()},
which is appropriate for non-group principals. Subclasses
should override this method to provide expanded member URLs
for this resource if appropriate.
@see: L{IDAVPrincip... | [
"def",
"expandedGroupMembers",
"(",
"self",
")",
":",
"return",
"succeed",
"(",
"(",
")",
")"
] | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txweb2/dav/resource.py#L2481-L2490 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/ex-submodules/couchexport/export.py | python | FormattedRow.formatted_id | (self) | return self.separator.join(map(str, self.id)) | [] | def formatted_id(self):
if isinstance(self.id, str):
return self.id
return self.separator.join(map(str, self.id)) | [
"def",
"formatted_id",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"id",
",",
"str",
")",
":",
"return",
"self",
".",
"id",
"return",
"self",
".",
"separator",
".",
"join",
"(",
"map",
"(",
"str",
",",
"self",
".",
"id",
")",
")"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/couchexport/export.py#L283-L286 | |||
IBM/EvolveGCN | 90869062bbc98d56935e3d92e1d9b1b4c25be593 | logger.py | python | Logger.eval_predicitions | (self, predictions, true_classes, num_classes) | return error, conf_mat_per_class | [] | def eval_predicitions(self, predictions, true_classes, num_classes):
predicted_classes = predictions.argmax(dim=1)
failures = (predicted_classes!=true_classes).sum(dtype=torch.float)
error = failures/predictions.size(0)
conf_mat_per_class = utils.Namespace({})
conf_mat_per_class... | [
"def",
"eval_predicitions",
"(",
"self",
",",
"predictions",
",",
"true_classes",
",",
"num_classes",
")",
":",
"predicted_classes",
"=",
"predictions",
".",
"argmax",
"(",
"dim",
"=",
"1",
")",
"failures",
"=",
"(",
"predicted_classes",
"!=",
"true_classes",
... | https://github.com/IBM/EvolveGCN/blob/90869062bbc98d56935e3d92e1d9b1b4c25be593/logger.py#L254-L277 | |||
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/hiframes/pd_series_type.py | python | SeriesType.ndim | (self) | return self.data.ndim | [] | def ndim(self):
return self.data.ndim | [
"def",
"ndim",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
".",
"ndim"
] | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/hiframes/pd_series_type.py#L78-L79 | |||
lazylibrarian/LazyLibrarian | ae3c14e9db9328ce81765e094ab2a14ed7155624 | cherrypy/wsgiserver/wsgiserver2.py | python | HTTPConnection.communicate | (self) | Read each request and respond appropriately. | Read each request and respond appropriately. | [
"Read",
"each",
"request",
"and",
"respond",
"appropriately",
"."
] | def communicate(self):
"""Read each request and respond appropriately."""
request_seen = False
try:
while True:
# (re)set req to None so that if something goes wrong in
# the RequestHandlerClass constructor, the error doesn't
# get writ... | [
"def",
"communicate",
"(",
"self",
")",
":",
"request_seen",
"=",
"False",
"try",
":",
"while",
"True",
":",
"# (re)set req to None so that if something goes wrong in",
"# the RequestHandlerClass constructor, the error doesn't",
"# get written to the previous request.",
"req",
"=... | https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/cherrypy/wsgiserver/wsgiserver2.py#L1331-L1410 | ||
perfectblue/ctf-writeups | 38c81bbce254885da6b485dd1dd76798120bc98c | 2019/ctfzone-quals-2019/ocb2/ocb/aes.py | python | AES._aes_invRound | (self, state, roundKey) | return state | Applies the 4 operations of the inverse round in sequence | Applies the 4 operations of the inverse round in sequence | [
"Applies",
"the",
"4",
"operations",
"of",
"the",
"inverse",
"round",
"in",
"sequence"
] | def _aes_invRound(self, state, roundKey):
""" Applies the 4 operations of the inverse round in sequence """
state = self._shiftRows(state, True)
state = self._subBytes(state, True)
state = self._addRoundKey(state, roundKey)
state = self._mixColumns(state, True)
return sta... | [
"def",
"_aes_invRound",
"(",
"self",
",",
"state",
",",
"roundKey",
")",
":",
"state",
"=",
"self",
".",
"_shiftRows",
"(",
"state",
",",
"True",
")",
"state",
"=",
"self",
".",
"_subBytes",
"(",
"state",
",",
"True",
")",
"state",
"=",
"self",
".",
... | https://github.com/perfectblue/ctf-writeups/blob/38c81bbce254885da6b485dd1dd76798120bc98c/2019/ctfzone-quals-2019/ocb2/ocb/aes.py#L327-L333 | |
trailofbits/manticore | b050fdf0939f6c63f503cdf87ec0ab159dd41159 | manticore/platforms/evm.py | python | EVMWorld.transaction | (self, address, price=0, data="", caller=None, value=0, gas=2300) | Initiates a CALL transaction on current state.
Do a world.run() after this to explore all _possible_ outputs | Initiates a CALL transaction on current state.
Do a world.run() after this to explore all _possible_ outputs | [
"Initiates",
"a",
"CALL",
"transaction",
"on",
"current",
"state",
".",
"Do",
"a",
"world",
".",
"run",
"()",
"after",
"this",
"to",
"explore",
"all",
"_possible_",
"outputs"
] | def transaction(self, address, price=0, data="", caller=None, value=0, gas=2300):
"""Initiates a CALL transaction on current state.
Do a world.run() after this to explore all _possible_ outputs
"""
self.start_transaction(
"CALL", address, price=price, data=data, caller=caller... | [
"def",
"transaction",
"(",
"self",
",",
"address",
",",
"price",
"=",
"0",
",",
"data",
"=",
"\"\"",
",",
"caller",
"=",
"None",
",",
"value",
"=",
"0",
",",
"gas",
"=",
"2300",
")",
":",
"self",
".",
"start_transaction",
"(",
"\"CALL\"",
",",
"add... | https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/platforms/evm.py#L3205-L3211 | ||
IntelLabs/coach | dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d | rl_coach/architectures/mxnet_components/utils.py | python | get_mxnet_activation_name | (activation_name: str) | return activation_functions[activation_name] | Convert coach activation name to mxnet specific activation name
:param activation_name: name of the activation inc coach
:return: name of the activation in mxnet | Convert coach activation name to mxnet specific activation name
:param activation_name: name of the activation inc coach
:return: name of the activation in mxnet | [
"Convert",
"coach",
"activation",
"name",
"to",
"mxnet",
"specific",
"activation",
"name",
":",
"param",
"activation_name",
":",
"name",
"of",
"the",
"activation",
"inc",
"coach",
":",
"return",
":",
"name",
"of",
"the",
"activation",
"in",
"mxnet"
] | def get_mxnet_activation_name(activation_name: str):
"""
Convert coach activation name to mxnet specific activation name
:param activation_name: name of the activation inc coach
:return: name of the activation in mxnet
"""
activation_functions = {
'relu': 'relu',
'tanh': 'tanh',
... | [
"def",
"get_mxnet_activation_name",
"(",
"activation_name",
":",
"str",
")",
":",
"activation_functions",
"=",
"{",
"'relu'",
":",
"'relu'",
",",
"'tanh'",
":",
"'tanh'",
",",
"'sigmoid'",
":",
"'sigmoid'",
",",
"# FIXME Add other activations",
"# 'elu': tf.nn.elu,",
... | https://github.com/IntelLabs/coach/blob/dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d/rl_coach/architectures/mxnet_components/utils.py#L290-L309 | |
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/plotting/notation.py | python | plot_multi_munsell_value_functions | (functions, **kwargs) | return plot_multi_functions(
functions, samples=np.linspace(0, 100, 1000), **settings) | Plots given *Munsell* value functions.
Parameters
----------
functions : str or object or array_like
*Munsell* value functions to plot. ``functions`` elements can be of any
type or form supported by the
:func:`colour.plotting.filter_passthrough` definition.
Other Parameters
... | Plots given *Munsell* value functions. | [
"Plots",
"given",
"*",
"Munsell",
"*",
"value",
"functions",
"."
] | def plot_multi_munsell_value_functions(functions, **kwargs):
"""
Plots given *Munsell* value functions.
Parameters
----------
functions : str or object or array_like
*Munsell* value functions to plot. ``functions`` elements can be of any
type or form supported by the
:func:`... | [
"def",
"plot_multi_munsell_value_functions",
"(",
"functions",
",",
"*",
"*",
"kwargs",
")",
":",
"functions",
"=",
"filter_passthrough",
"(",
"MUNSELL_VALUE_METHODS",
",",
"functions",
")",
"settings",
"=",
"{",
"'bounding_box'",
":",
"(",
"0",
",",
"100",
",",... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/plotting/notation.py#L76-L123 | |
ghoseb/planet.clojure | a2e10e9e6bbf6bc544fad40beed8d0da7ab9518d | planet/vendor/compat_logging/handlers.py | python | SMTPHandler.getSubject | (self, record) | return self.subject | Determine the subject for the email.
If you want to specify a subject line which is record-dependent,
override this method. | Determine the subject for the email. | [
"Determine",
"the",
"subject",
"for",
"the",
"email",
"."
] | def getSubject(self, record):
"""
Determine the subject for the email.
If you want to specify a subject line which is record-dependent,
override this method.
"""
return self.subject | [
"def",
"getSubject",
"(",
"self",
",",
"record",
")",
":",
"return",
"self",
".",
"subject"
] | https://github.com/ghoseb/planet.clojure/blob/a2e10e9e6bbf6bc544fad40beed8d0da7ab9518d/planet/vendor/compat_logging/handlers.py#L440-L447 | |
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/api/controllers/transportkeys.py | python | TransportKeyController.on_get | (self, external_project_id) | return transport_key | [] | def on_get(self, external_project_id):
LOG.debug("== Getting transport key for %s", external_project_id)
transport_key = self.repo.get(entity_id=self.transport_key_id)
if not transport_key:
_transport_key_not_found()
pecan.override_template('json', 'application/json')
... | [
"def",
"on_get",
"(",
"self",
",",
"external_project_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"== Getting transport key for %s\"",
",",
"external_project_id",
")",
"transport_key",
"=",
"self",
".",
"repo",
".",
"get",
"(",
"entity_id",
"=",
"self",
".",
"tr... | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/api/controllers/transportkeys.py#L56-L63 | |||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/notify/v1/service/binding.py | python | BindingContext.fetch | (self) | return BindingInstance(
self._version,
payload,
service_sid=self._solution['service_sid'],
sid=self._solution['sid'],
) | Fetch the BindingInstance
:returns: The fetched BindingInstance
:rtype: twilio.rest.notify.v1.service.binding.BindingInstance | Fetch the BindingInstance | [
"Fetch",
"the",
"BindingInstance"
] | def fetch(self):
"""
Fetch the BindingInstance
:returns: The fetched BindingInstance
:rtype: twilio.rest.notify.v1.service.binding.BindingInstance
"""
payload = self._version.fetch(method='GET', uri=self._uri, )
return BindingInstance(
self._version,... | [
"def",
"fetch",
"(",
"self",
")",
":",
"payload",
"=",
"self",
".",
"_version",
".",
"fetch",
"(",
"method",
"=",
"'GET'",
",",
"uri",
"=",
"self",
".",
"_uri",
",",
")",
"return",
"BindingInstance",
"(",
"self",
".",
"_version",
",",
"payload",
",",... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/notify/v1/service/binding.py#L276-L290 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/_pydecimal.py | python | Context.logical_or | (self, a, b) | return a.logical_or(b, context=self) | Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
Decimal('1')
>>> ExtendedConte... | Applies the logical operation 'or' between each operand's digits. | [
"Applies",
"the",
"logical",
"operation",
"or",
"between",
"each",
"operand",
"s",
"digits",
"."
] | def logical_or(self, a, b):
"""Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
... | [
"def",
"logical_or",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"logical_or",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/_pydecimal.py#L4822-L4847 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/enzo/io.py | python | IOHandlerPacked2D._read_fluid_selection | (self, chunks, selector, fields, size) | return rv | [] | def _read_fluid_selection(self, chunks, selector, fields, size):
rv = {}
# Now we have to do something unpleasant
chunks = list(chunks)
if isinstance(selector, GridSelector):
if not (len(chunks) == len(chunks[0].objs) == 1):
raise RuntimeError
g = ... | [
"def",
"_read_fluid_selection",
"(",
"self",
",",
"chunks",
",",
"selector",
",",
"fields",
",",
"size",
")",
":",
"rv",
"=",
"{",
"}",
"# Now we have to do something unpleasant",
"chunks",
"=",
"list",
"(",
"chunks",
")",
"if",
"isinstance",
"(",
"selector",
... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/enzo/io.py#L317-L360 | |||
petercorke/robotics-toolbox-python | 51aa8bbb3663a7c815f9880d538d61e7c85bc470 | roboticstoolbox/backends/VPython/common_functions.py | python | close_localhost_session | (canvas) | Terminate the local host session through JavaScript
:param canvas: The scene to append the JS to the caption
:type canvas:
class:`roboticstoolbox.backends.VPython.graphics_canvas.GraphicsCanvas3D`,
class:`roboticstoolbox.backends.VPython.graphics_canvas.GraphicsCanvas2D` | Terminate the local host session through JavaScript | [
"Terminate",
"the",
"local",
"host",
"session",
"through",
"JavaScript"
] | def close_localhost_session(canvas): # pragma nocover
"""
Terminate the local host session through JavaScript
:param canvas: The scene to append the JS to the caption
:type canvas:
class:`roboticstoolbox.backends.VPython.graphics_canvas.GraphicsCanvas3D`,
class:`roboticstoolbox.backend... | [
"def",
"close_localhost_session",
"(",
"canvas",
")",
":",
"# pragma nocover",
"canvas",
".",
"scene",
".",
"append_to_caption",
"(",
"'''\n <script type=\"text/javascript\">\n close();\n </script>\n '''",
")"
] | https://github.com/petercorke/robotics-toolbox-python/blob/51aa8bbb3663a7c815f9880d538d61e7c85bc470/roboticstoolbox/backends/VPython/common_functions.py#L128-L142 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/scheduler/filters/json.py | python | JsonFilter._equals | (self, args) | return self._op_compare(args, operator.eq) | First term is == all the other terms. | First term is == all the other terms. | [
"First",
"term",
"is",
"==",
"all",
"the",
"other",
"terms",
"."
] | def _equals(self, args):
"""First term is == all the other terms."""
return self._op_compare(args, operator.eq) | [
"def",
"_equals",
"(",
"self",
",",
"args",
")",
":",
"return",
"self",
".",
"_op_compare",
"(",
"args",
",",
"operator",
".",
"eq",
")"
] | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/scheduler/filters/json.py#L42-L44 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/server.py | python | HTTPServer.bind_addr | (self, value) | Set the interface on which to listen for connections. | Set the interface on which to listen for connections. | [
"Set",
"the",
"interface",
"on",
"which",
"to",
"listen",
"for",
"connections",
"."
] | def bind_addr(self, value):
"""Set the interface on which to listen for connections."""
if isinstance(value, tuple) and value[0] in ('', None):
# Despite the socket module docs, using '' does not
# allow AI_PASSIVE to work. Passing None instead
# returns '0.0.0.0' lik... | [
"def",
"bind_addr",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
"and",
"value",
"[",
"0",
"]",
"in",
"(",
"''",
",",
"None",
")",
":",
"# Despite the socket module docs, using '' does not",
"# allow AI_PASSIVE to w... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/server.py#L1713-L1731 | ||
kmpm/nodemcu-uploader | 6178f40fff2deadd56b5bc474f9b4475ef444b37 | nodemcu_uploader/uploader.py | python | Uploader.close | (self) | restores the nodemcu to default baudrate and then closes the port | restores the nodemcu to default baudrate and then closes the port | [
"restores",
"the",
"nodemcu",
"to",
"default",
"baudrate",
"and",
"then",
"closes",
"the",
"port"
] | def close(self):
"""restores the nodemcu to default baudrate and then closes the port"""
try:
if self.baud != self.start_baud:
self.__set_baudrate(self.start_baud)
self._port.flush()
self.__clear_buffers()
except serial.serialutil.SerialExcepti... | [
"def",
"close",
"(",
"self",
")",
":",
"try",
":",
"if",
"self",
".",
"baud",
"!=",
"self",
".",
"start_baud",
":",
"self",
".",
"__set_baudrate",
"(",
"self",
".",
"start_baud",
")",
"self",
".",
"_port",
".",
"flush",
"(",
")",
"self",
".",
"__cl... | https://github.com/kmpm/nodemcu-uploader/blob/6178f40fff2deadd56b5bc474f9b4475ef444b37/nodemcu_uploader/uploader.py#L182-L192 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_internal/req/constructors.py | python | install_req_from_req_string | (
req_string, # type: str
comes_from=None, # type: Optional[InstallRequirement]
isolated=False, # type: bool
wheel_cache=None, # type: Optional[WheelCache]
use_pep517=None # type: Optional[bool]
) | return InstallRequirement(
req, comes_from, isolated=isolated, wheel_cache=wheel_cache,
use_pep517=use_pep517
) | [] | def install_req_from_req_string(
req_string, # type: str
comes_from=None, # type: Optional[InstallRequirement]
isolated=False, # type: bool
wheel_cache=None, # type: Optional[WheelCache]
use_pep517=None # type: Optional[bool]
):
# type: (...) -> InstallRequirement
try:
req = Req... | [
"def",
"install_req_from_req_string",
"(",
"req_string",
",",
"# type: str",
"comes_from",
"=",
"None",
",",
"# type: Optional[InstallRequirement]",
"isolated",
"=",
"False",
",",
"# type: bool",
"wheel_cache",
"=",
"None",
",",
"# type: Optional[WheelCache]",
"use_pep517",... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/req/constructors.py#L320-L349 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/ext/associationproxy.py | python | AssociationProxy._inflate | (self, proxy) | [] | def _inflate(self, proxy):
creator = self.creator and self.creator or self.target_class
if self.getset_factory:
getter, setter = self.getset_factory(self.collection_class, self)
else:
getter, setter = self._default_getset(self.collection_class)
proxy.creator = c... | [
"def",
"_inflate",
"(",
"self",
",",
"proxy",
")",
":",
"creator",
"=",
"self",
".",
"creator",
"and",
"self",
".",
"creator",
"or",
"self",
".",
"target_class",
"if",
"self",
".",
"getset_factory",
":",
"getter",
",",
"setter",
"=",
"self",
".",
"gets... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/ext/associationproxy.py#L373-L383 | ||||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | docarray/memmap/__init__.py | python | DocumentArrayMemmap._load_header_body | (self, mode: str = 'a') | [] | def _load_header_body(self, mode: str = 'a'):
if hasattr(self, '_header'):
self._header.close()
if hasattr(self, '_body'):
self._body.close()
open(self._header_path, mode).close()
open(self._body_path, mode).close()
self._header = open(self._header_path,... | [
"def",
"_load_header_body",
"(",
"self",
",",
"mode",
":",
"str",
"=",
"'a'",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_header'",
")",
":",
"self",
".",
"_header",
".",
"close",
"(",
")",
"if",
"hasattr",
"(",
"self",
",",
"'_body'",
")",
":"... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/docarray/memmap/__init__.py#L113-L149 | ||||
cronyo/cronyo | cd5abab0871b68bf31b18aac934303928130a441 | cronyo/vendor/requests/cookies.py | python | cookiejar_from_dict | (cookie_dict, cookiejar=None, overwrite=True) | return cookiejar | Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not replace cookies
already in the jar with new ones.
:rtype: CookieJar | Returns a CookieJar from a key/value dictionary. | [
"Returns",
"a",
"CookieJar",
"from",
"a",
"key",
"/",
"value",
"dictionary",
"."
] | def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True):
"""Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
:param cookiejar: (optional) A cookiejar to add the cookies to.
:param overwrite: (optional) If False, will not repl... | [
"def",
"cookiejar_from_dict",
"(",
"cookie_dict",
",",
"cookiejar",
"=",
"None",
",",
"overwrite",
"=",
"True",
")",
":",
"if",
"cookiejar",
"is",
"None",
":",
"cookiejar",
"=",
"RequestsCookieJar",
"(",
")",
"if",
"cookie_dict",
"is",
"not",
"None",
":",
... | https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/requests/cookies.py#L508-L526 | |
ehmatthes/pcc | f555082df0f8268b8f269e59a99da8ed5013f749 | chapter_12/game_functions.py | python | update_bullets | (bullets) | Update position of bullets, and get rid of old bullets. | Update position of bullets, and get rid of old bullets. | [
"Update",
"position",
"of",
"bullets",
"and",
"get",
"rid",
"of",
"old",
"bullets",
"."
] | def update_bullets(bullets):
"""Update position of bullets, and get rid of old bullets."""
# Update bullet positions.
bullets.update()
# Get rid of bullets that have disappeared.
for bullet in bullets.copy():
if bullet.rect.bottom <= 0:
bullets.remove(bullet) | [
"def",
"update_bullets",
"(",
"bullets",
")",
":",
"# Update bullet positions.",
"bullets",
".",
"update",
"(",
")",
"# Get rid of bullets that have disappeared.",
"for",
"bullet",
"in",
"bullets",
".",
"copy",
"(",
")",
":",
"if",
"bullet",
".",
"rect",
".",
"b... | https://github.com/ehmatthes/pcc/blob/f555082df0f8268b8f269e59a99da8ed5013f749/chapter_12/game_functions.py#L53-L61 | ||
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/structure/tetrahedron_method.py | python | get_all_tetrahedra_relative_grid_address | () | return relative_grid_address | Return relative grid addresses dataset.
This exists only for the test. | Return relative grid addresses dataset. | [
"Return",
"relative",
"grid",
"addresses",
"dataset",
"."
] | def get_all_tetrahedra_relative_grid_address():
"""Return relative grid addresses dataset.
This exists only for the test.
"""
relative_grid_address = np.zeros((4, 24, 4, 3), dtype="int_")
phonoc.all_tetrahedra_relative_grid_address(relative_grid_address)
return relative_grid_address | [
"def",
"get_all_tetrahedra_relative_grid_address",
"(",
")",
":",
"relative_grid_address",
"=",
"np",
".",
"zeros",
"(",
"(",
"4",
",",
"24",
",",
"4",
",",
"3",
")",
",",
"dtype",
"=",
"\"int_\"",
")",
"phonoc",
".",
"all_tetrahedra_relative_grid_address",
"(... | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/structure/tetrahedron_method.py#L80-L89 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/polynomial/_polybase.py | python | ABCPolyBase.integ | (self, m=1, k=[], lbnd=None) | return self.__class__(coef, self.domain, self.window) | Integrate.
Return a series instance that is the definite integral of the
current series.
Parameters
----------
m : non-negative int
The number of integrations to perform.
k : array_like
Integration constants. The first constant is applied to the
... | Integrate. | [
"Integrate",
"."
] | def integ(self, m=1, k=[], lbnd=None):
"""Integrate.
Return a series instance that is the definite integral of the
current series.
Parameters
----------
m : non-negative int
The number of integrations to perform.
k : array_like
Integratio... | [
"def",
"integ",
"(",
"self",
",",
"m",
"=",
"1",
",",
"k",
"=",
"[",
"]",
",",
"lbnd",
"=",
"None",
")",
":",
"off",
",",
"scl",
"=",
"self",
".",
"mapparms",
"(",
")",
"if",
"lbnd",
"is",
"None",
":",
"lbnd",
"=",
"0",
"else",
":",
"lbnd",... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/polynomial/_polybase.py#L622-L653 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/change_status_service/transports/grpc.py | python | ChangeStatusServiceGrpcTransport.get_change_status | (
self,
) | return self._stubs["get_change_status"] | r"""Return a callable for the get change status method over gRPC.
Returns the requested change status in full detail.
List of thrown errors: `AuthenticationError <>`__
`AuthorizationError <>`__ `HeaderError <>`__
`InternalError <>`__ `QuotaError <>`__ `RequestError <>`__
Retur... | r"""Return a callable for the get change status method over gRPC. | [
"r",
"Return",
"a",
"callable",
"for",
"the",
"get",
"change",
"status",
"method",
"over",
"gRPC",
"."
] | def get_change_status(
self,
) -> Callable[
[change_status_service.GetChangeStatusRequest],
change_status.ChangeStatus,
]:
r"""Return a callable for the get change status method over gRPC.
Returns the requested change status in full detail.
List of thrown errors... | [
"def",
"get_change_status",
"(",
"self",
",",
")",
"->",
"Callable",
"[",
"[",
"change_status_service",
".",
"GetChangeStatusRequest",
"]",
",",
"change_status",
".",
"ChangeStatus",
",",
"]",
":",
"# Generate a \"stub function\" on-the-fly which will actually make",
"# t... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/change_status_service/transports/grpc.py#L213-L243 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/PIL/FliImagePlugin.py | python | FliImageFile.n_frames | (self) | return self.__framecount | [] | def n_frames(self):
return self.__framecount | [
"def",
"n_frames",
"(",
"self",
")",
":",
"return",
"self",
".",
"__framecount"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/FliImagePlugin.py#L113-L114 | |||
caktux/pytrader | b45b216dab3db78d6028d85e9a6f80419c22cea0 | exchanges/kraken.py | python | PollClient.request_lag | (self) | Request server time to calculate lag | Request server time to calculate lag | [
"Request",
"server",
"time",
"to",
"calculate",
"lag"
] | def request_lag(self):
"""Request server time to calculate lag"""
def lag_thread():
json_time = http_request("%s://%s/0/public/Time" % (
self.proto,
HTTP_HOST
))
if not self._terminating:
try:
answer ... | [
"def",
"request_lag",
"(",
"self",
")",
":",
"def",
"lag_thread",
"(",
")",
":",
"json_time",
"=",
"http_request",
"(",
"\"%s://%s/0/public/Time\"",
"%",
"(",
"self",
".",
"proto",
",",
"HTTP_HOST",
")",
")",
"if",
"not",
"self",
".",
"_terminating",
":",
... | https://github.com/caktux/pytrader/blob/b45b216dab3db78d6028d85e9a6f80419c22cea0/exchanges/kraken.py#L205-L230 | ||
zedshaw/lamson | 8a8ad546ea746b129fa5f069bf9278f87d01473a | lamson/mail.py | python | MailRequest.all_parts | (self) | return self.base.parts | Returns all multipart mime parts. This could be an empty list. | Returns all multipart mime parts. This could be an empty list. | [
"Returns",
"all",
"multipart",
"mime",
"parts",
".",
"This",
"could",
"be",
"an",
"empty",
"list",
"."
] | def all_parts(self):
"""Returns all multipart mime parts. This could be an empty list."""
return self.base.parts | [
"def",
"all_parts",
"(",
"self",
")",
":",
"return",
"self",
".",
"base",
".",
"parts"
] | https://github.com/zedshaw/lamson/blob/8a8ad546ea746b129fa5f069bf9278f87d01473a/lamson/mail.py#L81-L83 | |
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | packages/h2/utilities.py | python | _secure_headers | (headers, hdr_validation_flags) | Certain headers are at risk of being attacked during the header compression
phase, and so need to be kept out of header compression contexts. This
function automatically transforms certain specific headers into HPACK
never-indexed fields to ensure they don't get added to header compression
contexts.
... | Certain headers are at risk of being attacked during the header compression
phase, and so need to be kept out of header compression contexts. This
function automatically transforms certain specific headers into HPACK
never-indexed fields to ensure they don't get added to header compression
contexts. | [
"Certain",
"headers",
"are",
"at",
"risk",
"of",
"being",
"attacked",
"during",
"the",
"header",
"compression",
"phase",
"and",
"so",
"need",
"to",
"be",
"kept",
"out",
"of",
"header",
"compression",
"contexts",
".",
"This",
"function",
"automatically",
"trans... | def _secure_headers(headers, hdr_validation_flags):
"""
Certain headers are at risk of being attacked during the header compression
phase, and so need to be kept out of header compression contexts. This
function automatically transforms certain specific headers into HPACK
never-indexed fields to ens... | [
"def",
"_secure_headers",
"(",
"headers",
",",
"hdr_validation_flags",
")",
":",
"for",
"header",
"in",
"headers",
":",
"if",
"header",
"[",
"0",
"]",
"in",
"_SECURE_HEADERS",
":",
"yield",
"NeverIndexedHeaderTuple",
"(",
"*",
"header",
")",
"elif",
"header",
... | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/packages/h2/utilities.py#L66-L90 | ||
Ultimaker/Cura | a1622c77ea7259ecb956acd6de07b7d34b7ac52b | plugins/CuraEngineBackend/CuraEngineBackend.py | python | CuraEngineBackend._onBackendConnected | (self) | Called when the back-end connects to the front-end. | Called when the back-end connects to the front-end. | [
"Called",
"when",
"the",
"back",
"-",
"end",
"connects",
"to",
"the",
"front",
"-",
"end",
"."
] | def _onBackendConnected(self) -> None:
"""Called when the back-end connects to the front-end."""
if self._restart:
self._restart = False
self._onChanged() | [
"def",
"_onBackendConnected",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"_restart",
":",
"self",
".",
"_restart",
"=",
"False",
"self",
".",
"_onChanged",
"(",
")"
] | https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/plugins/CuraEngineBackend/CuraEngineBackend.py#L880-L885 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py | python | MkdirFileLock | (*args, **kwds) | return _fl_helper(mkdirlockfile.MkdirLockFile, "lockfile.mkdirlockfile",
*args, **kwds) | Factory function provided for backwards compatibility.
Do not use in new code. Instead, import MkdirLockFile from the
lockfile.mkdirlockfile module. | Factory function provided for backwards compatibility. | [
"Factory",
"function",
"provided",
"for",
"backwards",
"compatibility",
"."
] | def MkdirFileLock(*args, **kwds):
"""Factory function provided for backwards compatibility.
Do not use in new code. Instead, import MkdirLockFile from the
lockfile.mkdirlockfile module.
"""
from . import mkdirlockfile
return _fl_helper(mkdirlockfile.MkdirLockFile, "lockfile.mkdirlockfile",
... | [
"def",
"MkdirFileLock",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"from",
".",
"import",
"mkdirlockfile",
"return",
"_fl_helper",
"(",
"mkdirlockfile",
".",
"MkdirLockFile",
",",
"\"lockfile.mkdirlockfile\"",
",",
"*",
"args",
",",
"*",
"*",
"kwds",... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py#L293-L301 | |
google/capirca | 679e3885e3a5e5e129dc2dfab204ec44d63b26a4 | capirca/lib/policy.py | python | ParsePolicy | (data, definitions=None, optimize=True, base_dir='',
shade_check=False, filename='') | Parse the policy in 'data', optionally provide a naming object.
Parse a blob of policy text into a policy object.
Args:
data: a string blob of policy data to parse.
definitions: optional naming library definitions object.
optimize: bool - whether to summarize networks and services.
base_dir: base ... | Parse the policy in 'data', optionally provide a naming object. | [
"Parse",
"the",
"policy",
"in",
"data",
"optionally",
"provide",
"a",
"naming",
"object",
"."
] | def ParsePolicy(data, definitions=None, optimize=True, base_dir='',
shade_check=False, filename=''):
"""Parse the policy in 'data', optionally provide a naming object.
Parse a blob of policy text into a policy object.
Args:
data: a string blob of policy data to parse.
definitions: option... | [
"def",
"ParsePolicy",
"(",
"data",
",",
"definitions",
"=",
"None",
",",
"optimize",
"=",
"True",
",",
"base_dir",
"=",
"''",
",",
"shade_check",
"=",
"False",
",",
"filename",
"=",
"''",
")",
":",
"try",
":",
"if",
"definitions",
":",
"globals",
"(",
... | https://github.com/google/capirca/blob/679e3885e3a5e5e129dc2dfab204ec44d63b26a4/capirca/lib/policy.py#L2573-L2607 | ||
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/propertyedit.py | python | ColorProperty.get_value_rgba | (self) | return (float(raw_r)/255.0, float(raw_g)/255.0, float(raw_b)/255.0, 1.0) | [] | def get_value_rgba(self):
raw_r, raw_g, raw_b = utils.hex_to_rgb(self.value)
return (float(raw_r)/255.0, float(raw_g)/255.0, float(raw_b)/255.0, 1.0) | [
"def",
"get_value_rgba",
"(",
"self",
")",
":",
"raw_r",
",",
"raw_g",
",",
"raw_b",
"=",
"utils",
".",
"hex_to_rgb",
"(",
"self",
".",
"value",
")",
"return",
"(",
"float",
"(",
"raw_r",
")",
"/",
"255.0",
",",
"float",
"(",
"raw_g",
")",
"/",
"25... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/propertyedit.py#L807-L809 | |||
microsoft/nni | 31f11f51249660930824e888af0d4e022823285c | nni/compression/pytorch/utils/shape_dependency.py | python | GroupDependency._get_parent_convs | (self, node) | return parent_layers | Find the nearest father conv layers for the target node.
Parameters
---------
node : torch._C.Node
target node.
Returns
-------
parent_layers : list
nearest father conv layers for the target node. Due to the group
dependency only exists... | Find the nearest father conv layers for the target node.
Parameters
---------
node : torch._C.Node
target node.
Returns
-------
parent_layers : list
nearest father conv layers for the target node. Due to the group
dependency only exists... | [
"Find",
"the",
"nearest",
"father",
"conv",
"layers",
"for",
"the",
"target",
"node",
".",
"Parameters",
"---------",
"node",
":",
"torch",
".",
"_C",
".",
"Node",
"target",
"node",
".",
"Returns",
"-------",
"parent_layers",
":",
"list",
"nearest",
"father"... | def _get_parent_convs(self, node):
"""
Find the nearest father conv layers for the target node.
Parameters
---------
node : torch._C.Node
target node.
Returns
-------
parent_layers : list
nearest father conv layers for the target no... | [
"def",
"_get_parent_convs",
"(",
"self",
",",
"node",
")",
":",
"parent_layers",
"=",
"[",
"]",
"# the input node is a Conv node",
"predeessors",
"=",
"self",
".",
"graph",
".",
"find_predecessors",
"(",
"node",
".",
"unique_name",
")",
"predeessors",
"=",
"[",
... | https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/compression/pytorch/utils/shape_dependency.py#L349-L378 | |
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python3/creoleparser/core.py | python | Parser.preprocess | (self,text) | return text | This should generally be called before fragmentize().
:parameter text: text to be processsed. | This should generally be called before fragmentize(). | [
"This",
"should",
"generally",
"be",
"called",
"before",
"fragmentize",
"()",
"."
] | def preprocess(self,text):
"""This should generally be called before fragmentize().
:parameter text: text to be processsed.
"""
text = text.replace("\r\n", "\n")
text = text.replace("\r", "\n")
return text | [
"def",
"preprocess",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"text",
".",
"replace",
"(",
"\"\\r\\n\"",
",",
"\"\\n\"",
")",
"text",
"=",
"text",
".",
"replace",
"(",
"\"\\r\"",
",",
"\"\\n\"",
")",
"return",
"text"
] | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/creoleparser/core.py#L129-L138 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/pyparsing.py | python | Empty.__init__ | (self) | [] | def __init__(self):
super(Empty, self).__init__()
self.name = "Empty"
self.mayReturnEmpty = True
self.mayIndexError = False | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"Empty",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"name",
"=",
"\"Empty\"",
"self",
".",
"mayReturnEmpty",
"=",
"True",
"self",
".",
"mayIndexError",
"=",
"False"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/pyparsing.py#L2835-L2839 | ||||
wucng/TensorExpand | 4ea58f64f5c5082b278229b799c9f679536510b7 | TensorExpand/Object detection/Data_interface/Labelme/labelme_draw_json.py | python | main | () | [] | def main():
parser = argparse.ArgumentParser()
parser.add_argument('json_file')
args = parser.parse_args()
json_file = args.json_file
data = json.load(open(json_file)) # 加载json文件
img = utils.img_b64_to_array(data['imageData']) # 解析原图片数据
lbl, lbl_names = utils.labelme_shapes_to_label(img... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'json_file'",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"json_file",
"=",
"args",
".",
"json_file",
"data",
"=",... | https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Data_interface/Labelme/labelme_draw_json.py#L11-L34 | ||||
cltk/cltk | 1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1 | src/cltk/utils/file_operations.py | python | open_pickle | (path: str) | Open a pickle and return loaded pickle object.
:type path: str
:param : path: File path to pickle file to be opened.
:rtype : object | Open a pickle and return loaded pickle object.
:type path: str
:param : path: File path to pickle file to be opened.
:rtype : object | [
"Open",
"a",
"pickle",
"and",
"return",
"loaded",
"pickle",
"object",
".",
":",
"type",
"path",
":",
"str",
":",
"param",
":",
"path",
":",
"File",
"path",
"to",
"pickle",
"file",
"to",
"be",
"opened",
".",
":",
"rtype",
":",
"object"
] | def open_pickle(path: str) -> Any:
"""Open a pickle and return loaded pickle object.
:type path: str
:param : path: File path to pickle file to be opened.
:rtype : object
"""
try:
with open(path, "rb") as opened_pickle:
try:
return pickle.load(opened_pickle)
... | [
"def",
"open_pickle",
"(",
"path",
":",
"str",
")",
"->",
"Any",
":",
"try",
":",
"with",
"open",
"(",
"path",
",",
"\"rb\"",
")",
"as",
"opened_pickle",
":",
"try",
":",
"return",
"pickle",
".",
"load",
"(",
"opened_pickle",
")",
"except",
"Exception"... | https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/utils/file_operations.py#L38-L62 | ||
TropComplique/FaceBoxes-tensorflow | 0dde35eda1cb3dab6586b94c583029162ec37aa5 | src/input_pipeline/pipeline.py | python | Pipeline.__init__ | (self, filenames, batch_size, image_size,
repeat=False, shuffle=False, augmentation=False) | Note: when evaluating set batch_size to 1.
Arguments:
filenames: a list of strings, paths to tfrecords files.
batch_size: an integer.
image_size: a list with two integers [width, height] or None,
images of this size will be in a batch.
If valu... | Note: when evaluating set batch_size to 1. | [
"Note",
":",
"when",
"evaluating",
"set",
"batch_size",
"to",
"1",
"."
] | def __init__(self, filenames, batch_size, image_size,
repeat=False, shuffle=False, augmentation=False):
"""
Note: when evaluating set batch_size to 1.
Arguments:
filenames: a list of strings, paths to tfrecords files.
batch_size: an integer.
... | [
"def",
"__init__",
"(",
"self",
",",
"filenames",
",",
"batch_size",
",",
"image_size",
",",
"repeat",
"=",
"False",
",",
"shuffle",
"=",
"False",
",",
"augmentation",
"=",
"False",
")",
":",
"if",
"image_size",
"is",
"not",
"None",
":",
"self",
".",
"... | https://github.com/TropComplique/FaceBoxes-tensorflow/blob/0dde35eda1cb3dab6586b94c583029162ec37aa5/src/input_pipeline/pipeline.py#L12-L71 | ||
MillionIntegrals/vel | f3ce7da64362ad207f40f2c0d58d9300a25df3e8 | vel/rl/vecenv/shared_mem.py | python | SharedMemVecEnvWrapper.instantiate_single | (self, seed=0, preset='default') | return env | Create a new Env instance - single | Create a new Env instance - single | [
"Create",
"a",
"new",
"Env",
"instance",
"-",
"single"
] | def instantiate_single(self, seed=0, preset='default'):
""" Create a new Env instance - single """
env = self.env.instantiate(seed=seed, serial_id=0, preset=preset)
if self.frame_history is not None:
env = FrameStack(env, self.frame_history)
return env | [
"def",
"instantiate_single",
"(",
"self",
",",
"seed",
"=",
"0",
",",
"preset",
"=",
"'default'",
")",
":",
"env",
"=",
"self",
".",
"env",
".",
"instantiate",
"(",
"seed",
"=",
"seed",
",",
"serial_id",
"=",
"0",
",",
"preset",
"=",
"preset",
")",
... | https://github.com/MillionIntegrals/vel/blob/f3ce7da64362ad207f40f2c0d58d9300a25df3e8/vel/rl/vecenv/shared_mem.py#L27-L34 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/gis/admin/options.py | python | GeoModelAdmin.media | (self) | return media | Injects OpenLayers JavaScript into the admin. | Injects OpenLayers JavaScript into the admin. | [
"Injects",
"OpenLayers",
"JavaScript",
"into",
"the",
"admin",
"."
] | def media(self):
"Injects OpenLayers JavaScript into the admin."
media = super(GeoModelAdmin, self).media
media.add_js([self.openlayers_url])
media.add_js(self.extra_js)
return media | [
"def",
"media",
"(",
"self",
")",
":",
"media",
"=",
"super",
"(",
"GeoModelAdmin",
",",
"self",
")",
".",
"media",
"media",
".",
"add_js",
"(",
"[",
"self",
".",
"openlayers_url",
"]",
")",
"media",
".",
"add_js",
"(",
"self",
".",
"extra_js",
")",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/gis/admin/options.py#L43-L48 | |
devitocodes/devito | 6abd441e3f5f091775ad332be6b95e017b8cbd16 | devito/types/grid.py | python | AbstractSubDomain.intersection | (self, other) | Return the intersection of two subdomains as a new subdomain. | Return the intersection of two subdomains as a new subdomain. | [
"Return",
"the",
"intersection",
"of",
"two",
"subdomains",
"as",
"a",
"new",
"subdomain",
"."
] | def intersection(self, other):
"""
Return the intersection of two subdomains as a new subdomain.
"""
raise NotImplementedError | [
"def",
"intersection",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/devitocodes/devito/blob/6abd441e3f5f091775ad332be6b95e017b8cbd16/devito/types/grid.py#L417-L421 | ||
pyload/pyload | 4410827ca7711f1a3cf91a0b11e967b81bbbcaa2 | src/pyload/core/managers/file_manager.py | python | FileManager.update_file_info | (self, data, pid) | updates file info (name, size, status, url) | updates file info (name, size, status, url) | [
"updates",
"file",
"info",
"(",
"name",
"size",
"status",
"url",
")"
] | def update_file_info(self, data, pid):
"""
updates file info (name, size, status, url)
"""
self.pyload.db.update_link_info(data)
e = UpdateEvent(
"pack", pid, "collector" if not self.get_package(pid).queue else "queue"
)
self.pyload.event_manager.add_e... | [
"def",
"update_file_info",
"(",
"self",
",",
"data",
",",
"pid",
")",
":",
"self",
".",
"pyload",
".",
"db",
".",
"update_link_info",
"(",
"data",
")",
"e",
"=",
"UpdateEvent",
"(",
"\"pack\"",
",",
"pid",
",",
"\"collector\"",
"if",
"not",
"self",
"."... | https://github.com/pyload/pyload/blob/4410827ca7711f1a3cf91a0b11e967b81bbbcaa2/src/pyload/core/managers/file_manager.py#L583-L591 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | kubelet/datadog_checks/kubelet/prometheus.py | python | CadvisorPrometheusScraperMixin._get_container_label | (labels, l_name) | Iter on all labels to find the label.name equal to the l_name
:param labels: list of labels
:param l_name: str
:return: str or None | Iter on all labels to find the label.name equal to the l_name
:param labels: list of labels
:param l_name: str
:return: str or None | [
"Iter",
"on",
"all",
"labels",
"to",
"find",
"the",
"label",
".",
"name",
"equal",
"to",
"the",
"l_name",
":",
"param",
"labels",
":",
"list",
"of",
"labels",
":",
"param",
"l_name",
":",
"str",
":",
"return",
":",
"str",
"or",
"None"
] | def _get_container_label(labels, l_name):
"""
Iter on all labels to find the label.name equal to the l_name
:param labels: list of labels
:param l_name: str
:return: str or None
"""
if l_name in labels:
return labels[l_name] | [
"def",
"_get_container_label",
"(",
"labels",
",",
"l_name",
")",
":",
"if",
"l_name",
"in",
"labels",
":",
"return",
"labels",
"[",
"l_name",
"]"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/kubelet/datadog_checks/kubelet/prometheus.py#L150-L158 | ||
pytorch/translate | 564d011b10b4cef4e110c092c2912277ed64c713 | pytorch_translate/research/deliberation_networks/deliberation_networks.py | python | TransformerDecoderPhase2.upgrade_state_dict_named | (self, state_dict, name) | return state_dict | Upgrade a (possibly old) state dict for new versions of fairseq. | Upgrade a (possibly old) state dict for new versions of fairseq. | [
"Upgrade",
"a",
"(",
"possibly",
"old",
")",
"state",
"dict",
"for",
"new",
"versions",
"of",
"fairseq",
"."
] | def upgrade_state_dict_named(self, state_dict, name):
"""Upgrade a (possibly old) state dict for new versions of fairseq."""
if isinstance(self.embed_positions, SinusoidalPositionalEmbedding):
weights_key = "{}.embed_positions.weights".format(name)
if weights_key in state_dict:
... | [
"def",
"upgrade_state_dict_named",
"(",
"self",
",",
"state_dict",
",",
"name",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"embed_positions",
",",
"SinusoidalPositionalEmbedding",
")",
":",
"weights_key",
"=",
"\"{}.embed_positions.weights\"",
".",
"format",
"(... | https://github.com/pytorch/translate/blob/564d011b10b4cef4e110c092c2912277ed64c713/pytorch_translate/research/deliberation_networks/deliberation_networks.py#L443-L476 | |
sfzhang15/ATSS | 79dfb28bd18c931dd75a3ca2c63d32f5e4b1626a | atss_core/structures/bounding_box.py | python | BoxList.resize | (self, size, *args, **kwargs) | return bbox.convert(self.mode) | Returns a resized copy of this bounding box
:param size: The requested size in pixels, as a 2-tuple:
(width, height). | Returns a resized copy of this bounding box | [
"Returns",
"a",
"resized",
"copy",
"of",
"this",
"bounding",
"box"
] | def resize(self, size, *args, **kwargs):
"""
Returns a resized copy of this bounding box
:param size: The requested size in pixels, as a 2-tuple:
(width, height).
"""
ratios = tuple(float(s) / float(s_orig) for s, s_orig in zip(size, self.size))
if ratios[0]... | [
"def",
"resize",
"(",
"self",
",",
"size",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ratios",
"=",
"tuple",
"(",
"float",
"(",
"s",
")",
"/",
"float",
"(",
"s_orig",
")",
"for",
"s",
",",
"s_orig",
"in",
"zip",
"(",
"size",
",",
"... | https://github.com/sfzhang15/ATSS/blob/79dfb28bd18c931dd75a3ca2c63d32f5e4b1626a/atss_core/structures/bounding_box.py#L91-L127 | |
ecstatic-nobel/Analyst-Arsenal | 7f38854e2383e1b564f67fb9a197a045cb167230 | commons.py | python | download_site | (args, day, protocol, domain, ext_csv, url, resp) | [] | def download_site(args, day, protocol, domain, ext_csv, url, resp):
""" """
directory = "{}{}".format(args.cap_dir, day)
domain_dir = "{}/{}".format(directory, domain)
root_url = "{}//{}/".format(protocol, domain)
try:
if not os.path.exists(domain_dir):
os.makedirs(domain_dir... | [
"def",
"download_site",
"(",
"args",
",",
"day",
",",
"protocol",
",",
"domain",
",",
"ext_csv",
",",
"url",
",",
"resp",
")",
":",
"directory",
"=",
"\"{}{}\"",
".",
"format",
"(",
"args",
".",
"cap_dir",
",",
"day",
")",
"domain_dir",
"=",
"\"{}/{}\"... | https://github.com/ecstatic-nobel/Analyst-Arsenal/blob/7f38854e2383e1b564f67fb9a197a045cb167230/commons.py#L229-L268 | ||||
Mariewelt/OpenChem | e612d5cd471079c64e61ceda946c3dc7cf095bd8 | openchem/criterion/multitask_loss.py | python | MultitaskLoss.forward | (self, input, target) | return (loss.sum(dim=0) / n_samples).mean() | [] | def forward(self, input, target):
assert target.size()[1] == self.n_tasks
assert input.size()[1] == self.n_tasks
x = torch.zeros(target.size()).cuda()
y = torch.ones(target.size()).cuda()
mask = torch.where(target == self.ignore_index, x, y)
loss = F.binary_cross_entropy(... | [
"def",
"forward",
"(",
"self",
",",
"input",
",",
"target",
")",
":",
"assert",
"target",
".",
"size",
"(",
")",
"[",
"1",
"]",
"==",
"self",
".",
"n_tasks",
"assert",
"input",
".",
"size",
"(",
")",
"[",
"1",
"]",
"==",
"self",
".",
"n_tasks",
... | https://github.com/Mariewelt/OpenChem/blob/e612d5cd471079c64e61ceda946c3dc7cf095bd8/openchem/criterion/multitask_loss.py#L40-L49 | |||
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | softwarecenter/ui/gtk3/models/appstore2.py | python | AppListStore.set_from_matches | (self, matches) | set the content of the liststore based on a list of
xapian.MSetItems | set the content of the liststore based on a list of
xapian.MSetItems | [
"set",
"the",
"content",
"of",
"the",
"liststore",
"based",
"on",
"a",
"list",
"of",
"xapian",
".",
"MSetItems"
] | def set_from_matches(self, matches):
""" set the content of the liststore based on a list of
xapian.MSetItems
"""
LOG.debug("set_from_matches len(matches)='%s'" % len(matches))
self.current_matches = matches
n_matches = len(matches)
if n_matches == 0:
... | [
"def",
"set_from_matches",
"(",
"self",
",",
"matches",
")",
":",
"LOG",
".",
"debug",
"(",
"\"set_from_matches len(matches)='%s'\"",
"%",
"len",
"(",
"matches",
")",
")",
"self",
".",
"current_matches",
"=",
"matches",
"n_matches",
"=",
"len",
"(",
"matches",... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/softwarecenter/ui/gtk3/models/appstore2.py#L431-L456 | ||
stefanhoelzl/vue.py | f4256454256ddfe54a8be6dea493d3fc915ef1a2 | examples/element_ui/app.py | python | App.clicked | (self, item) | [] | def clicked(self, item):
print(item)
self.notify.info(
{"title": "Navigation", "message": item.get("title", "NO TITLE")}
) | [
"def",
"clicked",
"(",
"self",
",",
"item",
")",
":",
"print",
"(",
"item",
")",
"self",
".",
"notify",
".",
"info",
"(",
"{",
"\"title\"",
":",
"\"Navigation\"",
",",
"\"message\"",
":",
"item",
".",
"get",
"(",
"\"title\"",
",",
"\"NO TITLE\"",
")",
... | https://github.com/stefanhoelzl/vue.py/blob/f4256454256ddfe54a8be6dea493d3fc915ef1a2/examples/element_ui/app.py#L39-L43 | ||||
allenai/savn | 0ce930091e9213b52950143bb43195045ea33437 | datasets/environment.py | python | Environment.reachable_points | (self) | return self._reachable_points | Use the JSON file to get the reachable points. | Use the JSON file to get the reachable points. | [
"Use",
"the",
"JSON",
"file",
"to",
"get",
"the",
"reachable",
"points",
"."
] | def reachable_points(self):
""" Use the JSON file to get the reachable points. """
if self._reachable_points is not None:
return self._reachable_points
points_path = os.path.join(self.offline_data_dir, self.scene_name, "grid.json")
if not os.path.exists(points_path):
... | [
"def",
"reachable_points",
"(",
"self",
")",
":",
"if",
"self",
".",
"_reachable_points",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_reachable_points",
"points_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"offline_data_dir",
",",
"... | https://github.com/allenai/savn/blob/0ce930091e9213b52950143bb43195045ea33437/datasets/environment.py#L128-L137 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/urllib3/packages/backports/makefile.py | python | backport_makefile | (self, mode="r", buffering=None, encoding=None,
errors=None, newline=None) | return text | Backport of ``socket.makefile`` from Python 3.5. | Backport of ``socket.makefile`` from Python 3.5. | [
"Backport",
"of",
"socket",
".",
"makefile",
"from",
"Python",
"3",
".",
"5",
"."
] | def backport_makefile(self, mode="r", buffering=None, encoding=None,
errors=None, newline=None):
"""
Backport of ``socket.makefile`` from Python 3.5.
"""
if not set(mode) <= {"r", "w", "b"}:
raise ValueError(
"invalid mode %r (only r, w, b allowed)" % (mode,)
... | [
"def",
"backport_makefile",
"(",
"self",
",",
"mode",
"=",
"\"r\"",
",",
"buffering",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"None",
",",
"newline",
"=",
"None",
")",
":",
"if",
"not",
"set",
"(",
"mode",
")",
"<=",
"{",
"\"... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/urllib3/packages/backports/makefile.py#L14-L53 | |
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/DocXMLRPCServer.py | python | XMLRPCDocGenerator.generate_html_documentation | (self) | return documenter.page(self.server_title, documentation) | generate_html_documentation() => html documentation for the server
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances can choose to implement
the _get_method_a... | generate_html_documentation() => html documentation for the server
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances can choose to implement
the _get_method_a... | [
"generate_html_documentation",
"()",
"=",
">",
"html",
"documentation",
"for",
"the",
"server",
"Generates",
"HTML",
"documentation",
"for",
"the",
"server",
"using",
"introspection",
"for",
"installed",
"functions",
"and",
"instances",
"that",
"do",
"not",
"impleme... | def generate_html_documentation(self):
"""generate_html_documentation() => html documentation for the server
Generates HTML documentation for the server using introspection for
installed functions and instances that do not implement the
_dispatch method. Alternatively, instances... | [
"def",
"generate_html_documentation",
"(",
"self",
")",
":",
"methods",
"=",
"{",
"}",
"for",
"method_name",
"in",
"self",
".",
"system_listMethods",
"(",
")",
":",
"if",
"method_name",
"in",
"self",
".",
"funcs",
":",
"method",
"=",
"self",
".",
"funcs",
... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/DocXMLRPCServer.py#L130-L166 | |
Dman95/SASM | 7e3ae6da1c219a68e26d38939338567e5c27151a | Windows/MinGW64/opt/lib/python2.7/codecs.py | python | StreamReader.read | (self, size=-1, chars=-1, firstline=False) | return result | Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of characters to read from the
stream. read() will never return more than chars
characters, but it might return less, if there are not enough
characters avai... | Decodes data from the stream self.stream and returns the
resulting object. | [
"Decodes",
"data",
"from",
"the",
"stream",
"self",
".",
"stream",
"and",
"returns",
"the",
"resulting",
"object",
"."
] | def read(self, size=-1, chars=-1, firstline=False):
""" Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of characters to read from the
stream. read() will never return more than chars
characters, but it might... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
",",
"chars",
"=",
"-",
"1",
",",
"firstline",
"=",
"False",
")",
":",
"# If we have lines cached, first merge them back into characters",
"if",
"self",
".",
"linebuffer",
":",
"self",
".",
"charbuffer",
... | https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/opt/lib/python2.7/codecs.py#L424-L501 | |
Yelp/clusterman | 54beef89c01a2681aafd1fbb93b6ad5f6252d6cf | clusterman/interfaces/resource_group.py | python | ResourceGroup.fulfilled_capacity | (self) | The actual weighted capacity for this ResourceGroup | The actual weighted capacity for this ResourceGroup | [
"The",
"actual",
"weighted",
"capacity",
"for",
"this",
"ResourceGroup"
] | def fulfilled_capacity(self) -> float: # pragma: no cover
""" The actual weighted capacity for this ResourceGroup """
pass | [
"def",
"fulfilled_capacity",
"(",
"self",
")",
"->",
"float",
":",
"# pragma: no cover",
"pass"
] | https://github.com/Yelp/clusterman/blob/54beef89c01a2681aafd1fbb93b6ad5f6252d6cf/clusterman/interfaces/resource_group.py#L125-L127 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/Base/Scripts/CommonServerPython/CommonServerPython.py | python | is_ip_valid | (s, accept_v6_ips=False) | Checks if the given string represents a valid IP address.
By default, will only return 'True' for IPv4 addresses.
:type s: ``str``
:param s: The string to be checked (required)
:type accept_v6_ips: ``bool``
:param accept_v6_ips: A boolean determining whether the
function shoul... | Checks if the given string represents a valid IP address.
By default, will only return 'True' for IPv4 addresses. | [
"Checks",
"if",
"the",
"given",
"string",
"represents",
"a",
"valid",
"IP",
"address",
".",
"By",
"default",
"will",
"only",
"return",
"True",
"for",
"IPv4",
"addresses",
"."
] | def is_ip_valid(s, accept_v6_ips=False):
"""
Checks if the given string represents a valid IP address.
By default, will only return 'True' for IPv4 addresses.
:type s: ``str``
:param s: The string to be checked (required)
:type accept_v6_ips: ``bool``
:param accept_v6_ips:... | [
"def",
"is_ip_valid",
"(",
"s",
",",
"accept_v6_ips",
"=",
"False",
")",
":",
"a",
"=",
"s",
".",
"split",
"(",
"'.'",
")",
"if",
"accept_v6_ips",
"and",
"is_ipv6_valid",
"(",
"s",
")",
":",
"return",
"True",
"elif",
"len",
"(",
"a",
")",
"!=",
"4"... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Base/Scripts/CommonServerPython/CommonServerPython.py#L2605-L2631 | ||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListHeaderData.SetItem | (self, item) | Sets information about the header/footer item.
:param `info`: an instance of :class:`UltimateListHeaderData`. | Sets information about the header/footer item. | [
"Sets",
"information",
"about",
"the",
"header",
"/",
"footer",
"item",
"."
] | def SetItem(self, item):
"""
Sets information about the header/footer item.
:param `info`: an instance of :class:`UltimateListHeaderData`.
"""
self._mask = item._mask
if self._mask & ULC_MASK_TEXT:
self._text = item._text
if self._mask & ULC_MASK_T... | [
"def",
"SetItem",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"_mask",
"=",
"item",
".",
"_mask",
"if",
"self",
".",
"_mask",
"&",
"ULC_MASK_TEXT",
":",
"self",
".",
"_text",
"=",
"item",
".",
"_text",
"if",
"self",
".",
"_mask",
"&",
"ULC_MAS... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L3286-L3348 | ||
quay/quay | b7d325ed42827db9eda2d9f341cb5a6cdfd155a6 | buildman/manager/executor.py | python | LogPipe.run | (self) | Run the thread, logging everything. | Run the thread, logging everything. | [
"Run",
"the",
"thread",
"logging",
"everything",
"."
] | def run(self):
"""
Run the thread, logging everything.
"""
for line in iter(self.pipe_reader.readline, ""):
logging.log(self.level, line.strip("\n"))
self.pipe_reader.close() | [
"def",
"run",
"(",
"self",
")",
":",
"for",
"line",
"in",
"iter",
"(",
"self",
".",
"pipe_reader",
".",
"readline",
",",
"\"\"",
")",
":",
"logging",
".",
"log",
"(",
"self",
".",
"level",
",",
"line",
".",
"strip",
"(",
"\"\\n\"",
")",
")",
"sel... | https://github.com/quay/quay/blob/b7d325ed42827db9eda2d9f341cb5a6cdfd155a6/buildman/manager/executor.py#L696-L703 | ||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/data_catalog/data_catalog_client.py | python | DataCatalogClient.create_data_asset_tag | (self, catalog_id, data_asset_key, create_data_asset_tag_details, **kwargs) | Creates a new data asset tag.
:param str catalog_id: (required)
Unique catalog identifier.
:param str data_asset_key: (required)
Unique data asset key.
:param oci.data_catalog.models.CreateTagDetails create_data_asset_tag_details: (required)
The informatio... | Creates a new data asset tag. | [
"Creates",
"a",
"new",
"data",
"asset",
"tag",
"."
] | def create_data_asset_tag(self, catalog_id, data_asset_key, create_data_asset_tag_details, **kwargs):
"""
Creates a new data asset tag.
:param str catalog_id: (required)
Unique catalog identifier.
:param str data_asset_key: (required)
Unique data asset key.
... | [
"def",
"create_data_asset_tag",
"(",
"self",
",",
"catalog_id",
",",
"data_asset_key",
",",
"create_data_asset_tag_details",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/catalogs/{catalogId}/dataAssets/{dataAssetKey}/tags\"",
"method",
"=",
"\"POST\"",
"# ... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/data_catalog/data_catalog_client.py#L1343-L1439 | ||
shiyanhui/FileHeader | f347cc134021fb0b710694b71c57742476f5fd2b | jinja2/ext.py | python | Extension.bind | (self, environment) | return rv | Create a copy of this extension bound to another environment. | Create a copy of this extension bound to another environment. | [
"Create",
"a",
"copy",
"of",
"this",
"extension",
"bound",
"to",
"another",
"environment",
"."
] | def bind(self, environment):
"""Create a copy of this extension bound to another environment."""
rv = object.__new__(self.__class__)
rv.__dict__.update(self.__dict__)
rv.environment = environment
return rv | [
"def",
"bind",
"(",
"self",
",",
"environment",
")",
":",
"rv",
"=",
"object",
".",
"__new__",
"(",
"self",
".",
"__class__",
")",
"rv",
".",
"__dict__",
".",
"update",
"(",
"self",
".",
"__dict__",
")",
"rv",
".",
"environment",
"=",
"environment",
... | https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/ext.py#L73-L78 | |
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/models/basic.py | python | basic_fc_small | () | return hparams | Small fully connected model. | Small fully connected model. | [
"Small",
"fully",
"connected",
"model",
"."
] | def basic_fc_small():
"""Small fully connected model."""
hparams = common_hparams.basic_params1()
hparams.learning_rate = 0.1
hparams.batch_size = 128
hparams.hidden_size = 256
hparams.num_hidden_layers = 2
hparams.initializer = "uniform_unit_scaling"
hparams.initializer_gain = 1.0
hparams.weight_deca... | [
"def",
"basic_fc_small",
"(",
")",
":",
"hparams",
"=",
"common_hparams",
".",
"basic_params1",
"(",
")",
"hparams",
".",
"learning_rate",
"=",
"0.1",
"hparams",
".",
"batch_size",
"=",
"128",
"hparams",
".",
"hidden_size",
"=",
"256",
"hparams",
".",
"num_h... | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/models/basic.py#L47-L58 | |
YosefLab/scvi-tools | f0a3ba6e11053069fd1857d2381083e5492fa8b8 | scvi/model/base/_log_likelihood.py | python | compute_elbo | (vae, data_loader, feed_labels=True, **kwargs) | return elbo / n_samples | Computes the ELBO.
The ELBO is the reconstruction error + the KL divergences
between the variational distributions and the priors.
It differs from the marginal log likelihood.
Specifically, it is a lower bound on the marginal log likelihood
plus a term that is constant with respect to the variation... | Computes the ELBO. | [
"Computes",
"the",
"ELBO",
"."
] | def compute_elbo(vae, data_loader, feed_labels=True, **kwargs):
"""
Computes the ELBO.
The ELBO is the reconstruction error + the KL divergences
between the variational distributions and the priors.
It differs from the marginal log likelihood.
Specifically, it is a lower bound on the marginal l... | [
"def",
"compute_elbo",
"(",
"vae",
",",
"data_loader",
",",
"feed_labels",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Iterate once over the data and compute the elbo",
"elbo",
"=",
"0",
"for",
"tensors",
"in",
"data_loader",
":",
"_",
",",
"_",
",",
... | https://github.com/YosefLab/scvi-tools/blob/f0a3ba6e11053069fd1857d2381083e5492fa8b8/scvi/model/base/_log_likelihood.py#L5-L28 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/dev/pipelines/pipeline_folders.py | python | pipeline_folder_update | (path, new_path=None, new_description=None,
organization=None, project=None, detect=None) | return client.update_folder(path=path, folder=folder_to_update, project=project) | Update a folder name or description.
:param path: Full path of the folder.
:type path: str
:param new_path: New full path of the folder.
:type new_path: str
:param new_description: New description of the folder.
:type new_description: str
:param project: Name or ID of the team project.
:... | Update a folder name or description.
:param path: Full path of the folder.
:type path: str
:param new_path: New full path of the folder.
:type new_path: str
:param new_description: New description of the folder.
:type new_description: str
:param project: Name or ID of the team project.
:... | [
"Update",
"a",
"folder",
"name",
"or",
"description",
".",
":",
"param",
"path",
":",
"Full",
"path",
"of",
"the",
"folder",
".",
":",
"type",
"path",
":",
"str",
":",
"param",
"new_path",
":",
"New",
"full",
"path",
"of",
"the",
"folder",
".",
":",
... | def pipeline_folder_update(path, new_path=None, new_description=None,
organization=None, project=None, detect=None):
""" Update a folder name or description.
:param path: Full path of the folder.
:type path: str
:param new_path: New full path of the folder.
:type new_path:... | [
"def",
"pipeline_folder_update",
"(",
"path",
",",
"new_path",
"=",
"None",
",",
"new_description",
"=",
"None",
",",
"organization",
"=",
"None",
",",
"project",
"=",
"None",
",",
"detect",
"=",
"None",
")",
":",
"if",
"not",
"new_path",
"and",
"not",
"... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/dev/pipelines/pipeline_folders.py#L73-L105 | |
Quantika14/guasap-whatsapp-foresincs-tool | 68291f781a0483ac0f0fe6c90c7e4395a6d58cea | hashdeep.py | python | extract_mm | (pop_wait) | return md5_cloned, md5_original | Clone media data check | Clone media data check | [
"Clone",
"media",
"data",
"check"
] | def extract_mm(pop_wait):
md5_original=list()
md5_cloned=list()
files=list()
on_rute=False
on_file=False
subdirectoris=list()
modules.functions.create_dir_media()
directory = check_directory()
pull_media(directory)
# --- /helpers ---
# write("""\
# %%%% HASH_CHECK
# %%%% size,sha256,filename
# ##
# ## Clone... | [
"def",
"extract_mm",
"(",
"pop_wait",
")",
":",
"md5_original",
"=",
"list",
"(",
")",
"md5_cloned",
"=",
"list",
"(",
")",
"files",
"=",
"list",
"(",
")",
"on_rute",
"=",
"False",
"on_file",
"=",
"False",
"subdirectoris",
"=",
"list",
"(",
")",
"modul... | https://github.com/Quantika14/guasap-whatsapp-foresincs-tool/blob/68291f781a0483ac0f0fe6c90c7e4395a6d58cea/hashdeep.py#L63-L157 | |
vericast/spylon-kernel | 2d0ddf2aca1b91738f938b72a500c20293e3156c | versioneer.py | python | do_vcs_install | (manifest_in, versionfile_source, ipy) | Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution. | Git-specific installation logic for Versioneer. | [
"Git",
"-",
"specific",
"installation",
"logic",
"for",
"Versioneer",
"."
] | def do_vcs_install(manifest_in, versionfile_source, ipy):
"""Git-specific installation logic for Versioneer.
For Git, this means creating/changing .gitattributes to mark _version.py
for export-subst keyword substitution.
"""
GITS = ["git"]
if sys.platform == "win32":
GITS = ["git.cmd", ... | [
"def",
"do_vcs_install",
"(",
"manifest_in",
",",
"versionfile_source",
",",
"ipy",
")",
":",
"GITS",
"=",
"[",
"\"git\"",
"]",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"GITS",
"=",
"[",
"\"git.cmd\"",
",",
"\"git.exe\"",
"]",
"files",
"=",
... | https://github.com/vericast/spylon-kernel/blob/2d0ddf2aca1b91738f938b72a500c20293e3156c/versioneer.py#L1117-L1152 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/accounting/subscription_changes.py | python | _get_active_immediate_broadcasts | (domain, survey_only=False) | return result | [] | def _get_active_immediate_broadcasts(domain, survey_only=False):
result = list(ImmediateBroadcast.objects.filter(domain=domain.name, deleted=False, schedule__active=True))
if survey_only:
result = [broadcast for broadcast in result if broadcast.schedule.memoized_uses_sms_survey]
return result | [
"def",
"_get_active_immediate_broadcasts",
"(",
"domain",
",",
"survey_only",
"=",
"False",
")",
":",
"result",
"=",
"list",
"(",
"ImmediateBroadcast",
".",
"objects",
".",
"filter",
"(",
"domain",
"=",
"domain",
".",
"name",
",",
"deleted",
"=",
"False",
",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/accounting/subscription_changes.py#L90-L95 | |||
Pylons/pyramid | 0b24ac16cc04746b25cf460f1497c157f6d3d6f4 | src/pyramid/interfaces.py | python | IAuthenticationPolicy.unauthenticated_userid | (request) | Return the *unauthenticated* userid. This method
performs the same duty as ``authenticated_userid`` but is
permitted to return the userid based only on data present
in the request; it needn't (and shouldn't) check any
persistent store to ensure that the user record related to
th... | Return the *unauthenticated* userid. This method
performs the same duty as ``authenticated_userid`` but is
permitted to return the userid based only on data present
in the request; it needn't (and shouldn't) check any
persistent store to ensure that the user record related to
th... | [
"Return",
"the",
"*",
"unauthenticated",
"*",
"userid",
".",
"This",
"method",
"performs",
"the",
"same",
"duty",
"as",
"authenticated_userid",
"but",
"is",
"permitted",
"to",
"return",
"the",
"userid",
"based",
"only",
"on",
"data",
"present",
"in",
"the",
... | def unauthenticated_userid(request):
"""Return the *unauthenticated* userid. This method
performs the same duty as ``authenticated_userid`` but is
permitted to return the userid based only on data present
in the request; it needn't (and shouldn't) check any
persistent store to e... | [
"def",
"unauthenticated_userid",
"(",
"request",
")",
":"
] | https://github.com/Pylons/pyramid/blob/0b24ac16cc04746b25cf460f1497c157f6d3d6f4/src/pyramid/interfaces.py#L560-L573 | ||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/ui/gui/spokes/installation_source.py | python | SourceSpoke._reset_repo_store | (self) | Reset the list of repos.
Populate the list with all the addon repos from payload.addons.
If the list has no element, clear the repo entry fields. | Reset the list of repos. | [
"Reset",
"the",
"list",
"of",
"repos",
"."
] | def _reset_repo_store(self):
""" Reset the list of repos.
Populate the list with all the addon repos from payload.addons.
If the list has no element, clear the repo entry fields.
"""
log.debug("Clearing checks in source spoke")
# Remove the repo checks
... | [
"def",
"_reset_repo_store",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"\"Clearing checks in source spoke\"",
")",
"# Remove the repo checks",
"for",
"checks",
"in",
"self",
".",
"_repo_checks",
".",
"values",
"(",
")",
":",
"self",
".",
"remove_check",
"(... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/gui/spokes/installation_source.py#L1474-L1508 | ||
circus-tent/circus | 4b8aaca9470e3fd1ab115b14c8b1d1bf9b5b3c5e | circus/consumer.py | python | CircusConsumer.iter_messages | (self) | Yields tuples of (topic, message) | Yields tuples of (topic, message) | [
"Yields",
"tuples",
"of",
"(",
"topic",
"message",
")"
] | def iter_messages(self):
""" Yields tuples of (topic, message) """
with self:
while True:
try:
events = dict(self.poller.poll(self.timeout * 1000))
except zmq.ZMQError as e:
if e.errno == errno.EINTR:
... | [
"def",
"iter_messages",
"(",
"self",
")",
":",
"with",
"self",
":",
"while",
"True",
":",
"try",
":",
"events",
"=",
"dict",
"(",
"self",
".",
"poller",
".",
"poll",
"(",
"self",
".",
"timeout",
"*",
"1000",
")",
")",
"except",
"zmq",
".",
"ZMQErro... | https://github.com/circus-tent/circus/blob/4b8aaca9470e3fd1ab115b14c8b1d1bf9b5b3c5e/circus/consumer.py#L38-L53 | ||
joe42/CloudFusion | c4b94124e74a81e0634578c7754d62160081f7a1 | cloudfusion/util/lru_cache.py | python | LRUCache.delete | (self, key) | Remove current entry associated with key from the LRU queue. | Remove current entry associated with key from the LRU queue. | [
"Remove",
"current",
"entry",
"associated",
"with",
"key",
"from",
"the",
"LRU",
"queue",
"."
] | def delete(self, key):
"""Remove current entry associated with key from the LRU queue."""
if key in self.entries:
entry = self.entries[key]
self.entries[CACHESIZE] -= self._get_size_of_entry(entry)
self._unlink(key)
del self.entries[key] | [
"def",
"delete",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"entries",
":",
"entry",
"=",
"self",
".",
"entries",
"[",
"key",
"]",
"self",
".",
"entries",
"[",
"CACHESIZE",
"]",
"-=",
"self",
".",
"_get_size_of_entry",
"(",
... | https://github.com/joe42/CloudFusion/blob/c4b94124e74a81e0634578c7754d62160081f7a1/cloudfusion/util/lru_cache.py#L173-L179 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/uwsgidecorators.py | python | spoolforever | (f=None, pass_arguments=False) | return spool_decorate(f, pass_arguments, _spoolforever) | [] | def spoolforever(f=None, pass_arguments=False):
return spool_decorate(f, pass_arguments, _spoolforever) | [
"def",
"spoolforever",
"(",
"f",
"=",
"None",
",",
"pass_arguments",
"=",
"False",
")",
":",
"return",
"spool_decorate",
"(",
"f",
",",
"pass_arguments",
",",
"_spoolforever",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/uwsgidecorators.py#L159-L160 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/metagoofil/pdfminer/layout.py | python | LTItem.voverlap | (self, obj) | [] | def voverlap(self, obj):
assert isinstance(obj, LTItem)
if self.is_voverlap(obj):
return min(abs(self.y0-obj.y1), abs(self.y1-obj.y0))
else:
return 0 | [
"def",
"voverlap",
"(",
"self",
",",
"obj",
")",
":",
"assert",
"isinstance",
"(",
"obj",
",",
"LTItem",
")",
"if",
"self",
".",
"is_voverlap",
"(",
"obj",
")",
":",
"return",
"min",
"(",
"abs",
"(",
"self",
".",
"y0",
"-",
"obj",
".",
"y1",
")",... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/pdfminer/layout.py#L87-L92 | ||||
perrygeo/simanneal | 951e7d89a8b7f19aeb05b64e7cc8b844a734af89 | examples/watershed/shapefile.py | python | Writer.field | (self, name, fieldType="C", size="50", decimal=0) | Adds a dbf field descriptor to the shapefile. | Adds a dbf field descriptor to the shapefile. | [
"Adds",
"a",
"dbf",
"field",
"descriptor",
"to",
"the",
"shapefile",
"."
] | def field(self, name, fieldType="C", size="50", decimal=0):
"""Adds a dbf field descriptor to the shapefile."""
self.fields.append((name, fieldType, size, decimal)) | [
"def",
"field",
"(",
"self",
",",
"name",
",",
"fieldType",
"=",
"\"C\"",
",",
"size",
"=",
"\"50\"",
",",
"decimal",
"=",
"0",
")",
":",
"self",
".",
"fields",
".",
"append",
"(",
"(",
"name",
",",
"fieldType",
",",
"size",
",",
"decimal",
")",
... | https://github.com/perrygeo/simanneal/blob/951e7d89a8b7f19aeb05b64e7cc8b844a734af89/examples/watershed/shapefile.py#L789-L791 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_route.py | python | Utils.openshift_installed | () | return rpmquery.count() > 0 | check if openshift is installed | check if openshift is installed | [
"check",
"if",
"openshift",
"is",
"installed"
] | def openshift_installed():
''' check if openshift is installed '''
import rpm
transaction_set = rpm.TransactionSet()
rpmquery = transaction_set.dbMatch("name", "atomic-openshift")
return rpmquery.count() > 0 | [
"def",
"openshift_installed",
"(",
")",
":",
"import",
"rpm",
"transaction_set",
"=",
"rpm",
".",
"TransactionSet",
"(",
")",
"rpmquery",
"=",
"transaction_set",
".",
"dbMatch",
"(",
"\"name\"",
",",
"\"atomic-openshift\"",
")",
"return",
"rpmquery",
".",
"count... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_route.py#L1372-L1379 | |
SoCo/SoCo | e83fef84d2645d05265dbd574598518655a9c125 | soco/events_base.py | python | get_listen_ip | (ip_address) | Find the listen ip address. | Find the listen ip address. | [
"Find",
"the",
"listen",
"ip",
"address",
"."
] | def get_listen_ip(ip_address):
"""Find the listen ip address."""
if config.EVENT_LISTENER_IP:
return config.EVENT_LISTENER_IP
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
sock.connect((ip_address, config.EVENT_LISTENER_PORT))
return sock.getsockname()[0]
excep... | [
"def",
"get_listen_ip",
"(",
"ip_address",
")",
":",
"if",
"config",
".",
"EVENT_LISTENER_IP",
":",
"return",
"config",
".",
"EVENT_LISTENER_IP",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_DGRAM",
")",
"try... | https://github.com/SoCo/SoCo/blob/e83fef84d2645d05265dbd574598518655a9c125/soco/events_base.py#L773-L784 | ||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/slim/deployment/model_deploy.py | python | optimize_clones | (clones, optimizer,
regularization_losses=None,
**kwargs) | return total_loss, grads_and_vars | Compute clone losses and gradients for the given list of `Clones`.
Note: The regularization_losses are added to the first clone losses.
Args:
clones: List of `Clones` created by `create_clones()`.
optimizer: An `Optimizer` object.
regularization_losses: Optional list of regularization losses. If None it
... | Compute clone losses and gradients for the given list of `Clones`. | [
"Compute",
"clone",
"losses",
"and",
"gradients",
"for",
"the",
"given",
"list",
"of",
"Clones",
"."
] | def optimize_clones(clones, optimizer,
regularization_losses=None,
**kwargs):
"""Compute clone losses and gradients for the given list of `Clones`.
Note: The regularization_losses are added to the first clone losses.
Args:
clones: List of `Clones` created by `create_cl... | [
"def",
"optimize_clones",
"(",
"clones",
",",
"optimizer",
",",
"regularization_losses",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"grads_and_vars",
"=",
"[",
"]",
"clones_losses",
"=",
"[",
"]",
"num_clones",
"=",
"len",
"(",
"clones",
")",
"if",
... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/slim/deployment/model_deploy.py#L265-L307 | |
seantis/seantis-questionnaire | 698c77b3d707635f50bcd86e7f1c94e94061b0f5 | questionnaire/models.py | python | QuestionSet.questions | (self) | return self.__qcache | [] | def questions(self):
if not hasattr(self, "__qcache"):
def numeric_number(val):
matches = re.findall(r'^\d+', val)
return int(matches[0]) if matches else 0
self.__qcache = sorted(
Question.objects.filter(questionset=self.id),
... | [
"def",
"questions",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"__qcache\"",
")",
":",
"def",
"numeric_number",
"(",
"val",
")",
":",
"matches",
"=",
"re",
".",
"findall",
"(",
"r'^\\d+'",
",",
"val",
")",
"return",
"int",
"("... | https://github.com/seantis/seantis-questionnaire/blob/698c77b3d707635f50bcd86e7f1c94e94061b0f5/questionnaire/models.py#L174-L183 | |||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/_collections_abc.py | python | Callable.__call__ | (self, *args, **kwds) | return False | [] | def __call__(self, *args, **kwds):
return False | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"False"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/_collections_abc.py#L403-L404 | |||
mongodb/motor | 055f5e05abf1f15e64ae43fb8c680d2706f3c419 | motor/metaprogramming.py | python | AsyncRead.__init__ | (self, attr_name=None, doc=None) | A descriptor that wraps a PyMongo read method like find_one() that
returns a Future. | A descriptor that wraps a PyMongo read method like find_one() that
returns a Future. | [
"A",
"descriptor",
"that",
"wraps",
"a",
"PyMongo",
"read",
"method",
"like",
"find_one",
"()",
"that",
"returns",
"a",
"Future",
"."
] | def __init__(self, attr_name=None, doc=None):
"""A descriptor that wraps a PyMongo read method like find_one() that
returns a Future.
"""
Async.__init__(self, attr_name=attr_name, doc=doc) | [
"def",
"__init__",
"(",
"self",
",",
"attr_name",
"=",
"None",
",",
"doc",
"=",
"None",
")",
":",
"Async",
".",
"__init__",
"(",
"self",
",",
"attr_name",
"=",
"attr_name",
",",
"doc",
"=",
"doc",
")"
] | https://github.com/mongodb/motor/blob/055f5e05abf1f15e64ae43fb8c680d2706f3c419/motor/metaprogramming.py#L172-L176 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | PerceiverPreTrainedModel.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["torch"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L3866-L3867 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.