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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openid/python-openid | afa6adacbe1a41d8f614c8bce2264dfbe9e76489 | openid/extensions/pape.py | python | Request.parseExtensionArgs | (self, args, is_openid1, strict=False) | Set the state of this request to be that expressed in these
PAPE arguments
@param args: The PAPE arguments without a namespace
@param strict: Whether to raise an exception if the input is
out of spec or otherwise malformed. If strict is false,
malformed input will be ig... | Set the state of this request to be that expressed in these
PAPE arguments | [
"Set",
"the",
"state",
"of",
"this",
"request",
"to",
"be",
"that",
"expressed",
"in",
"these",
"PAPE",
"arguments"
] | def parseExtensionArgs(self, args, is_openid1, strict=False):
"""Set the state of this request to be that expressed in these
PAPE arguments
@param args: The PAPE arguments without a namespace
@param strict: Whether to raise an exception if the input is
out of spec or otherw... | [
"def",
"parseExtensionArgs",
"(",
"self",
",",
"args",
",",
"is_openid1",
",",
"strict",
"=",
"False",
")",
":",
"# preferred_auth_policies is a space-separated list of policy URIs",
"self",
".",
"preferred_auth_policies",
"=",
"[",
"]",
"policies_str",
"=",
"args",
"... | https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/extensions/pape.py#L194-L253 | ||
readthedocs/commonmark.py | d031003aa23cfce1787cfb29c1eb109b369ca5b7 | commonmark/inlines.py | python | InlineParser.handleDelim | (self, cc, block) | return True | Handle a delimiter marker for emphasis or a quote. | Handle a delimiter marker for emphasis or a quote. | [
"Handle",
"a",
"delimiter",
"marker",
"for",
"emphasis",
"or",
"a",
"quote",
"."
] | def handleDelim(self, cc, block):
"""Handle a delimiter marker for emphasis or a quote."""
res = self.scanDelims(cc)
if not res:
return False
numdelims = res.get('numdelims')
startpos = self.pos
self.pos += numdelims
if cc == "'":
contents... | [
"def",
"handleDelim",
"(",
"self",
",",
"cc",
",",
"block",
")",
":",
"res",
"=",
"self",
".",
"scanDelims",
"(",
"cc",
")",
"if",
"not",
"res",
":",
"return",
"False",
"numdelims",
"=",
"res",
".",
"get",
"(",
"'numdelims'",
")",
"startpos",
"=",
... | https://github.com/readthedocs/commonmark.py/blob/d031003aa23cfce1787cfb29c1eb109b369ca5b7/commonmark/inlines.py#L311-L342 | |
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/sandbox/predict_functional.py | python | _make_exog_from_formula | (result, focus_var, summaries, values, num_points) | return dexog, fexog, fvals | Create dataframes for exploring a fitted model as a function of one variable.
This works for models fit with a formula.
Returns
-------
dexog : data frame
A data frame in which the focus variable varies and the other variables
are fixed at specified or computed values.
fexog : data... | Create dataframes for exploring a fitted model as a function of one variable. | [
"Create",
"dataframes",
"for",
"exploring",
"a",
"fitted",
"model",
"as",
"a",
"function",
"of",
"one",
"variable",
"."
] | def _make_exog_from_formula(result, focus_var, summaries, values, num_points):
"""
Create dataframes for exploring a fitted model as a function of one variable.
This works for models fit with a formula.
Returns
-------
dexog : data frame
A data frame in which the focus variable varies ... | [
"def",
"_make_exog_from_formula",
"(",
"result",
",",
"focus_var",
",",
"summaries",
",",
"values",
",",
"num_points",
")",
":",
"model",
"=",
"result",
".",
"model",
"exog",
"=",
"model",
".",
"data",
".",
"frame",
"if",
"summaries",
"is",
"None",
":",
... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/sandbox/predict_functional.py#L131-L195 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/states/salt_proxy.py | python | configure_proxy | (name, proxyname="p8000", start=True) | return ret | Create the salt proxy file and start the proxy process
if required
Parameters:
name:
The name of this state
proxyname:
Name to be used for this proxy (should match entries in pillar)
start:
Boolean indicating if the process should be started
Exam... | Create the salt proxy file and start the proxy process
if required | [
"Create",
"the",
"salt",
"proxy",
"file",
"and",
"start",
"the",
"proxy",
"process",
"if",
"required"
] | def configure_proxy(name, proxyname="p8000", start=True):
"""
Create the salt proxy file and start the proxy process
if required
Parameters:
name:
The name of this state
proxyname:
Name to be used for this proxy (should match entries in pillar)
start:
... | [
"def",
"configure_proxy",
"(",
"name",
",",
"proxyname",
"=",
"\"p8000\"",
",",
"start",
"=",
"True",
")",
":",
"ret",
"=",
"__salt__",
"[",
"\"salt_proxy.configure_proxy\"",
"]",
"(",
"proxyname",
",",
"start",
"=",
"start",
")",
"ret",
".",
"update",
"("... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/salt_proxy.py#L31-L56 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/visualization/bloch.py | python | Bloch.add_vectors | (self, vectors) | Add a list of vectors to Bloch sphere.
Args:
vectors (array_like):
Array with vectors of unit length or smaller. | Add a list of vectors to Bloch sphere. | [
"Add",
"a",
"list",
"of",
"vectors",
"to",
"Bloch",
"sphere",
"."
] | def add_vectors(self, vectors):
"""Add a list of vectors to Bloch sphere.
Args:
vectors (array_like):
Array with vectors of unit length or smaller.
"""
if isinstance(vectors[0], (list, np.ndarray)):
for vec in vectors:
self.vectors... | [
"def",
"add_vectors",
"(",
"self",
",",
"vectors",
")",
":",
"if",
"isinstance",
"(",
"vectors",
"[",
"0",
"]",
",",
"(",
"list",
",",
"np",
".",
"ndarray",
")",
")",
":",
"for",
"vec",
"in",
"vectors",
":",
"self",
".",
"vectors",
".",
"append",
... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/visualization/bloch.py#L358-L369 | ||
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/gto/mole.py | python | Mole.intor | (self, intor, comp=None, hermi=0, aosym='s1', out=None,
shls_slice=None, grids=None) | return moleintor.getints(intor, self._atm, bas, env,
shls_slice, comp, hermi, aosym, out=out) | Integral generator.
Args:
intor : str
Name of the 1e or 2e AO integrals. Ref to :func:`getints` for the
complete list of available 1-electron integral names
Kwargs:
comp : int
Components of the integrals, e.g. int1e_ipovlp_sph ha... | Integral generator. | [
"Integral",
"generator",
"."
] | def intor(self, intor, comp=None, hermi=0, aosym='s1', out=None,
shls_slice=None, grids=None):
'''Integral generator.
Args:
intor : str
Name of the 1e or 2e AO integrals. Ref to :func:`getints` for the
complete list of available 1-electron inte... | [
"def",
"intor",
"(",
"self",
",",
"intor",
",",
"comp",
"=",
"None",
",",
"hermi",
"=",
"0",
",",
"aosym",
"=",
"'s1'",
",",
"out",
"=",
"None",
",",
"shls_slice",
"=",
"None",
",",
"grids",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_bu... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/gto/mole.py#L3233-L3295 | |
c0rv4x/project-black | 2d3df00ba1b1453c99ec5a247793a74e11adba2a | black/workers/patator/patator_task.py | python | PatatorTask.client_connected_cb | (self, reader, writer) | Callback which is called, after unix socket (the socket which is responsible
for transporting socket data) receives a new connection | Callback which is called, after unix socket (the socket which is responsible
for transporting socket data) receives a new connection | [
"Callback",
"which",
"is",
"called",
"after",
"unix",
"socket",
"(",
"the",
"socket",
"which",
"is",
"responsible",
"for",
"transporting",
"socket",
"data",
")",
"receives",
"a",
"new",
"connection"
] | def client_connected_cb(self, reader, writer):
""" Callback which is called, after unix socket (the socket which is responsible
for transporting socket data) receives a new connection """
self.loop.create_task(self.poll_status(reader)) | [
"def",
"client_connected_cb",
"(",
"self",
",",
"reader",
",",
"writer",
")",
":",
"self",
".",
"loop",
".",
"create_task",
"(",
"self",
".",
"poll_status",
"(",
"reader",
")",
")"
] | https://github.com/c0rv4x/project-black/blob/2d3df00ba1b1453c99ec5a247793a74e11adba2a/black/workers/patator/patator_task.py#L63-L66 | ||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response | Sends a GET request. Returns :class:`Response` object. | [
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', ... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/sessions.py#L479-L488 | |
cassieeric/python_crawler | b50b5b55404e32164dc82ff0c23cdae0c4b168ae | weixin_crawler/project/Application/gzh_crawler/__init__.py | python | GZHCrawler.gzh_report | (self,gzh) | :param gzh:
:return:生成公众号历史文章数据报告 | :param gzh:
:return:生成公众号历史文章数据报告 | [
":",
"param",
"gzh",
":",
":",
"return",
":",
"生成公众号历史文章数据报告"
] | def gzh_report(self,gzh):
"""
:param gzh:
:return:生成公众号历史文章数据报告
"""
pass | [
"def",
"gzh_report",
"(",
"self",
",",
"gzh",
")",
":",
"pass"
] | https://github.com/cassieeric/python_crawler/blob/b50b5b55404e32164dc82ff0c23cdae0c4b168ae/weixin_crawler/project/Application/gzh_crawler/__init__.py#L137-L142 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1beta1_flow_schema_status.py | python | V1beta1FlowSchemaStatus.conditions | (self) | return self._conditions | Gets the conditions of this V1beta1FlowSchemaStatus. # noqa: E501
`conditions` is a list of the current states of FlowSchema. # noqa: E501
:return: The conditions of this V1beta1FlowSchemaStatus. # noqa: E501
:rtype: list[V1beta1FlowSchemaCondition] | Gets the conditions of this V1beta1FlowSchemaStatus. # noqa: E501 | [
"Gets",
"the",
"conditions",
"of",
"this",
"V1beta1FlowSchemaStatus",
".",
"#",
"noqa",
":",
"E501"
] | def conditions(self):
"""Gets the conditions of this V1beta1FlowSchemaStatus. # noqa: E501
`conditions` is a list of the current states of FlowSchema. # noqa: E501
:return: The conditions of this V1beta1FlowSchemaStatus. # noqa: E501
:rtype: list[V1beta1FlowSchemaCondition]
... | [
"def",
"conditions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_conditions"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_flow_schema_status.py#L56-L64 | |
akirafukui/vqa-mcb | 172775b2ec927456eecbe1aa5878b673482f2a54 | train/v4/train_v4.py | python | make_vocab_files | () | return question_vocab, answer_vocab | Produce the question and answer vocabulary files. | Produce the question and answer vocabulary files. | [
"Produce",
"the",
"question",
"and",
"answer",
"vocabulary",
"files",
"."
] | def make_vocab_files():
"""
Produce the question and answer vocabulary files.
"""
print 'making question vocab...', config.QUESTION_VOCAB_SPACE
qdic, _ = VQADataProvider.load_data(config.QUESTION_VOCAB_SPACE)
question_vocab = make_question_vocab(qdic)
print 'making answer vocab...', config.A... | [
"def",
"make_vocab_files",
"(",
")",
":",
"print",
"'making question vocab...'",
",",
"config",
".",
"QUESTION_VOCAB_SPACE",
"qdic",
",",
"_",
"=",
"VQADataProvider",
".",
"load_data",
"(",
"config",
".",
"QUESTION_VOCAB_SPACE",
")",
"question_vocab",
"=",
"make_que... | https://github.com/akirafukui/vqa-mcb/blob/172775b2ec927456eecbe1aa5878b673482f2a54/train/v4/train_v4.py#L135-L145 | |
holland-backup/holland | 77dcfe9f23d4254e4c351cdc18f29a8d34945812 | holland/core/config/config.py | python | BaseConfig.lookup | (self, key, safe=True) | return result | Lookup a configuration item based on the
dot-separated path. | Lookup a configuration item based on the
dot-separated path. | [
"Lookup",
"a",
"configuration",
"item",
"based",
"on",
"the",
"dot",
"-",
"separated",
"path",
"."
] | def lookup(self, key, safe=True):
"""
Lookup a configuration item based on the
dot-separated path.
"""
parts = key.split(".")
# lookup key as a . separated hierarchy path
section = self
result = None
count = 0
for count, name in enumerate(p... | [
"def",
"lookup",
"(",
"self",
",",
"key",
",",
"safe",
"=",
"True",
")",
":",
"parts",
"=",
"key",
".",
"split",
"(",
"\".\"",
")",
"# lookup key as a . separated hierarchy path",
"section",
"=",
"self",
"result",
"=",
"None",
"count",
"=",
"0",
"for",
"... | https://github.com/holland-backup/holland/blob/77dcfe9f23d4254e4c351cdc18f29a8d34945812/holland/core/config/config.py#L105-L125 | |
MediaBrowser/plugin.video.emby | 71162fc7704656833d8b228dc9014f88742215b1 | resources/lib/library.py | python | Library.startup | (self) | return False | Run at startup.
Check databases.
Check for the server plugin. | Run at startup.
Check databases.
Check for the server plugin. | [
"Run",
"at",
"startup",
".",
"Check",
"databases",
".",
"Check",
"for",
"the",
"server",
"plugin",
"."
] | def startup(self):
''' Run at startup.
Check databases.
Check for the server plugin.
'''
self.started = True
Views().get_views()
Views().get_nodes()
try:
if get_sync()['Libraries']:
self.sync_libraries()
... | [
"def",
"startup",
"(",
"self",
")",
":",
"self",
".",
"started",
"=",
"True",
"Views",
"(",
")",
".",
"get_views",
"(",
")",
"Views",
"(",
")",
".",
"get_nodes",
"(",
")",
"try",
":",
"if",
"get_sync",
"(",
")",
"[",
"'Libraries'",
"]",
":",
"sel... | https://github.com/MediaBrowser/plugin.video.emby/blob/71162fc7704656833d8b228dc9014f88742215b1/resources/lib/library.py#L485-L540 | |
projecthamster/hamster | 19d160090de30e756bdc3122ff935bdaa86e2843 | src/hamster/lib/fact.py | python | Fact.end_time | (self) | return self.range.end | Fact range end.
Deprecated, use self.range.end instead. | Fact range end. | [
"Fact",
"range",
"end",
"."
] | def end_time(self):
"""Fact range end.
Deprecated, use self.range.end instead.
"""
return self.range.end | [
"def",
"end_time",
"(",
"self",
")",
":",
"return",
"self",
".",
"range",
".",
"end"
] | https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/src/hamster/lib/fact.py#L151-L156 | |
sigmavirus24/github3.py | f642a27833d6bef93daf5bb27b35e5ddbcfbb773 | src/github3/users.py | python | _User.followers | (self, number=-1, etag=None) | return self._iter(int(number), url, ShortUser, etag=etag) | r"""Iterate over the followers of this user.
:param int number: (optional), number of followers to return. Default:
-1 returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`User <User>`\ s | r"""Iterate over the followers of this user. | [
"r",
"Iterate",
"over",
"the",
"followers",
"of",
"this",
"user",
"."
] | def followers(self, number=-1, etag=None):
r"""Iterate over the followers of this user.
:param int number: (optional), number of followers to return. Default:
-1 returns all available
:param str etag: (optional), ETag from a previous request to the same
endpoint
... | [
"def",
"followers",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"followers\"",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"in... | https://github.com/sigmavirus24/github3.py/blob/f642a27833d6bef93daf5bb27b35e5ddbcfbb773/src/github3/users.py#L380-L390 | |
astroML/astroML | f66558232f6d33cb34ecd1bed8a80b9db7ae1c30 | astroML/plotting/tools.py | python | devectorize_axes | (ax=None, dpi=None, transparent=True) | return ax | Convert axes contents to a png.
This is useful when plotting many points, as the size of the saved file
can become very large otherwise.
Parameters
----------
ax : Axes instance (optional)
Axes to de-vectorize. If None, this uses the current active axes
(plt.gca())
dpi: int (o... | Convert axes contents to a png. | [
"Convert",
"axes",
"contents",
"to",
"a",
"png",
"."
] | def devectorize_axes(ax=None, dpi=None, transparent=True):
"""Convert axes contents to a png.
This is useful when plotting many points, as the size of the saved file
can become very large otherwise.
Parameters
----------
ax : Axes instance (optional)
Axes to de-vectorize. If None, thi... | [
"def",
"devectorize_axes",
"(",
"ax",
"=",
"None",
",",
"dpi",
"=",
"None",
",",
"transparent",
"=",
"True",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"fig",
"=",
"ax",
".",
"figure",
"axlim",
"=",
"ax",
"... | https://github.com/astroML/astroML/blob/f66558232f6d33cb34ecd1bed8a80b9db7ae1c30/astroML/plotting/tools.py#L12-L103 | |
standardebooks/tools | f57af3c5938a9aeed9e97e82b2c130424f6033e5 | se/vendor/kindleunpack/mobi_html.py | python | XHTMLK8Processor.buildXHTML | (self) | return self.used | [] | def buildXHTML(self):
# first need to update all links that are internal which
# are based on positions within the xhtml files **BEFORE**
# cutting and pasting any pieces into the xhtml text files
# kindle:pos:fid:XXXX:off:YYYYYYYYYY (used for internal link within xhtml)
# ... | [
"def",
"buildXHTML",
"(",
"self",
")",
":",
"# first need to update all links that are internal which",
"# are based on positions within the xhtml files **BEFORE**",
"# cutting and pasting any pieces into the xhtml text files",
"# kindle:pos:fid:XXXX:off:YYYYYYYYYY (used for internal link withi... | https://github.com/standardebooks/tools/blob/f57af3c5938a9aeed9e97e82b2c130424f6033e5/se/vendor/kindleunpack/mobi_html.py#L117-L430 | |||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/modeling_tf_bert.py | python | TFBertMainLayer._prune_heads | (self, heads_to_prune) | Prunes heads of the model.
heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
See base class PreTrainedModel | Prunes heads of the model.
heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
See base class PreTrainedModel | [
"Prunes",
"heads",
"of",
"the",
"model",
".",
"heads_to_prune",
":",
"dict",
"of",
"{",
"layer_num",
":",
"list",
"of",
"heads",
"to",
"prune",
"in",
"this",
"layer",
"}",
"See",
"base",
"class",
"PreTrainedModel"
] | def _prune_heads(self, heads_to_prune):
""" Prunes heads of the model.
heads_to_prune: dict of {layer_num: list of heads to prune in this layer}
See base class PreTrainedModel
"""
raise NotImplementedError | [
"def",
"_prune_heads",
"(",
"self",
",",
"heads_to_prune",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/modeling_tf_bert.py#L489-L494 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py | python | EvaluationInstance.date_created | (self) | return self._properties['date_created'] | :returns: The date_created
:rtype: datetime | :returns: The date_created
:rtype: datetime | [
":",
"returns",
":",
"The",
"date_created",
":",
"rtype",
":",
"datetime"
] | def date_created(self):
"""
:returns: The date_created
:rtype: datetime
"""
return self._properties['date_created'] | [
"def",
"date_created",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'date_created'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py#L337-L342 | |
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/draw/chart.py | python | ChartView._analyze_edge | (self, edge) | Given a new edge, recalculate:
- _text_height
- _unitsize (if the edge text is too big for the current
_unitsize, then increase _unitsize) | Given a new edge, recalculate: | [
"Given",
"a",
"new",
"edge",
"recalculate",
":"
] | def _analyze_edge(self, edge):
"""
Given a new edge, recalculate:
- _text_height
- _unitsize (if the edge text is too big for the current
_unitsize, then increase _unitsize)
"""
c = self._chart_canvas
if isinstance(edge, TreeEdge):
... | [
"def",
"_analyze_edge",
"(",
"self",
",",
"edge",
")",
":",
"c",
"=",
"self",
".",
"_chart_canvas",
"if",
"isinstance",
"(",
"edge",
",",
"TreeEdge",
")",
":",
"lhs",
"=",
"edge",
".",
"lhs",
"(",
")",
"rhselts",
"=",
"[",
"]",
"for",
"elt",
"in",
... | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/draw/chart.py#L1098-L1130 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/plat-sunos5/IN.py | python | ntohl | (x) | return (x) | [] | def ntohl(x): return (x) | [
"def",
"ntohl",
"(",
"x",
")",
":",
"return",
"(",
"x",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-sunos5/IN.py#L1239-L1239 | |||
yaqwsx/KiKit | 14de7f60b64e6d03ce638e78d279915d09bb9ac7 | kikit/panelize_ui_impl.py | python | obtainPreset | (presetPaths, validate=True, **kwargs) | return preset | Given a preset paths from the user and the overrides in the form of named
arguments, construt the preset.
Ensures a valid preset is always found | Given a preset paths from the user and the overrides in the form of named
arguments, construt the preset. | [
"Given",
"a",
"preset",
"paths",
"from",
"the",
"user",
"and",
"the",
"overrides",
"in",
"the",
"form",
"of",
"named",
"arguments",
"construt",
"the",
"preset",
"."
] | def obtainPreset(presetPaths, validate=True, **kwargs):
"""
Given a preset paths from the user and the overrides in the form of named
arguments, construt the preset.
Ensures a valid preset is always found
"""
presetChain = [":default"] + list(presetPaths)
preset = loadPresetChain(presetChai... | [
"def",
"obtainPreset",
"(",
"presetPaths",
",",
"validate",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"presetChain",
"=",
"[",
"\":default\"",
"]",
"+",
"list",
"(",
"presetPaths",
")",
"preset",
"=",
"loadPresetChain",
"(",
"presetChain",
")",
"for"... | https://github.com/yaqwsx/KiKit/blob/14de7f60b64e6d03ce638e78d279915d09bb9ac7/kikit/panelize_ui_impl.py#L199-L214 | |
google/TensorNetwork | e12580f1749493dbe05f474d2fecdec4eaba73c5 | tensornetwork/backends/abstract_backend.py | python | AbstractBackend.item | (self, tensor) | Return the item of a 1-element tensor.
Args:
tensor: A 1-element tensor
Returns:
The value in tensor. | Return the item of a 1-element tensor. | [
"Return",
"the",
"item",
"of",
"a",
"1",
"-",
"element",
"tensor",
"."
] | def item(self, tensor) -> Union[float, int, complex]:
"""
Return the item of a 1-element tensor.
Args:
tensor: A 1-element tensor
Returns:
The value in tensor.
"""
raise NotImplementedError("Backend {self.name} has not implemented item") | [
"def",
"item",
"(",
"self",
",",
"tensor",
")",
"->",
"Union",
"[",
"float",
",",
"int",
",",
"complex",
"]",
":",
"raise",
"NotImplementedError",
"(",
"\"Backend {self.name} has not implemented item\"",
")"
] | https://github.com/google/TensorNetwork/blob/e12580f1749493dbe05f474d2fecdec4eaba73c5/tensornetwork/backends/abstract_backend.py#L1014-L1024 | ||
encode/django-rest-framework | c5be86a6dbf3d21b00a296af5994fa075826bf0b | rest_framework/schemas/coreapi.py | python | SchemaGenerator.get_links | (self, request=None) | return links | Return a dictionary containing all the links that should be
included in the API schema. | Return a dictionary containing all the links that should be
included in the API schema. | [
"Return",
"a",
"dictionary",
"containing",
"all",
"the",
"links",
"that",
"should",
"be",
"included",
"in",
"the",
"API",
"schema",
"."
] | def get_links(self, request=None):
"""
Return a dictionary containing all the links that should be
included in the API schema.
"""
links = LinkNode()
paths, view_endpoints = self._get_paths_and_endpoints(request)
# Only generate the path prefix for paths that wi... | [
"def",
"get_links",
"(",
"self",
",",
"request",
"=",
"None",
")",
":",
"links",
"=",
"LinkNode",
"(",
")",
"paths",
",",
"view_endpoints",
"=",
"self",
".",
"_get_paths_and_endpoints",
"(",
"request",
")",
"# Only generate the path prefix for paths that will be inc... | https://github.com/encode/django-rest-framework/blob/c5be86a6dbf3d21b00a296af5994fa075826bf0b/rest_framework/schemas/coreapi.py#L126-L148 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/asn1crypto/util.py | python | extended_datetime.utcoffset | (self) | return self.tzinfo.utcoffset(self.replace(year=2000)) | :return:
None or a datetime.timedelta() of the offset from UTC | :return:
None or a datetime.timedelta() of the offset from UTC | [
":",
"return",
":",
"None",
"or",
"a",
"datetime",
".",
"timedelta",
"()",
"of",
"the",
"offset",
"from",
"UTC"
] | def utcoffset(self):
"""
:return:
None or a datetime.timedelta() of the offset from UTC
"""
if self.tzinfo is None:
return None
return self.tzinfo.utcoffset(self.replace(year=2000)) | [
"def",
"utcoffset",
"(",
"self",
")",
":",
"if",
"self",
".",
"tzinfo",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"tzinfo",
".",
"utcoffset",
"(",
"self",
".",
"replace",
"(",
"year",
"=",
"2000",
")",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/asn1crypto/util.py#L473-L481 | |
yihui-he/KL-Loss | 66c0ed9e886a2218f4cf88c0efd4f40199bff54a | detectron/roi_data/fast_rcnn.py | python | add_fast_rcnn_blobs | (blobs, im_scales, roidb) | return valid | Add blobs needed for training Fast R-CNN style models. | Add blobs needed for training Fast R-CNN style models. | [
"Add",
"blobs",
"needed",
"for",
"training",
"Fast",
"R",
"-",
"CNN",
"style",
"models",
"."
] | def add_fast_rcnn_blobs(blobs, im_scales, roidb):
"""Add blobs needed for training Fast R-CNN style models."""
# Sample training RoIs from each image and append them to the blob lists
for im_i, entry in enumerate(roidb):
frcn_blobs = _sample_rois(entry, im_scales[im_i], im_i)
for k, v in frc... | [
"def",
"add_fast_rcnn_blobs",
"(",
"blobs",
",",
"im_scales",
",",
"roidb",
")",
":",
"# Sample training RoIs from each image and append them to the blob lists",
"for",
"im_i",
",",
"entry",
"in",
"enumerate",
"(",
"roidb",
")",
":",
"frcn_blobs",
"=",
"_sample_rois",
... | https://github.com/yihui-he/KL-Loss/blob/66c0ed9e886a2218f4cf88c0efd4f40199bff54a/detectron/roi_data/fast_rcnn.py#L108-L129 | |
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/response.py | python | LogoutResponse.__init__ | (self, sec_context, return_addrs=None, timeslack=0,
asynchop=True, conv_info=None) | [] | def __init__(self, sec_context, return_addrs=None, timeslack=0,
asynchop=True, conv_info=None):
StatusResponse.__init__(self, sec_context, return_addrs, timeslack,
asynchop=asynchop, conv_info=conv_info)
self.signature_check = self.sec.correctly_signed_logout_... | [
"def",
"__init__",
"(",
"self",
",",
"sec_context",
",",
"return_addrs",
"=",
"None",
",",
"timeslack",
"=",
"0",
",",
"asynchop",
"=",
"True",
",",
"conv_info",
"=",
"None",
")",
":",
"StatusResponse",
".",
"__init__",
"(",
"self",
",",
"sec_context",
"... | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/response.py#L449-L453 | ||||
JulianEberius/SublimePythonIDE | d70e40abc0c9f347af3204c7b910e0d6bfd6e459 | server/lib/python2/rope/base/codeanalyze.py | python | CachingLogicalLineFinder._init_logicals | (self) | Should initialize _starts and _ends attributes | Should initialize _starts and _ends attributes | [
"Should",
"initialize",
"_starts",
"and",
"_ends",
"attributes"
] | def _init_logicals(self):
"""Should initialize _starts and _ends attributes"""
size = self.lines.length() + 1
self._starts = [None] * size
self._ends = [None] * size
for start, end in self._generate(self.lines):
self._starts[start] = True
self._ends[end] =... | [
"def",
"_init_logicals",
"(",
"self",
")",
":",
"size",
"=",
"self",
".",
"lines",
".",
"length",
"(",
")",
"+",
"1",
"self",
".",
"_starts",
"=",
"[",
"None",
"]",
"*",
"size",
"self",
".",
"_ends",
"=",
"[",
"None",
"]",
"*",
"size",
"for",
"... | https://github.com/JulianEberius/SublimePythonIDE/blob/d70e40abc0c9f347af3204c7b910e0d6bfd6e459/server/lib/python2/rope/base/codeanalyze.py#L270-L277 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/itsdangerous.py | python | Signer.get_signature | (self, value) | return base64_encode(sig) | Returns the signature for the given value | Returns the signature for the given value | [
"Returns",
"the",
"signature",
"for",
"the",
"given",
"value"
] | def get_signature(self, value):
"""Returns the signature for the given value"""
value = want_bytes(value)
key = self.derive_key()
sig = self.algorithm.get_signature(key, value)
return base64_encode(sig) | [
"def",
"get_signature",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"want_bytes",
"(",
"value",
")",
"key",
"=",
"self",
".",
"derive_key",
"(",
")",
"sig",
"=",
"self",
".",
"algorithm",
".",
"get_signature",
"(",
"key",
",",
"value",
")",
"r... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/itsdangerous.py#L344-L349 | |
JasonKessler/scattertext | ef33f06d4c31f9d64b551a7ab86bf157aca82644 | scattertext/PValGetter.py | python | get_p_vals | (df, positive_category, term_significance) | return term_significance.get_p_vals(X) | Parameters
----------
df : A data frame from, e.g., get_term_freq_df : pd.DataFrame
positive_category : str
The positive category name.
term_significance : TermSignificance
A TermSignificance instance from which to extract p-values. | Parameters
----------
df : A data frame from, e.g., get_term_freq_df : pd.DataFrame
positive_category : str
The positive category name.
term_significance : TermSignificance
A TermSignificance instance from which to extract p-values. | [
"Parameters",
"----------",
"df",
":",
"A",
"data",
"frame",
"from",
"e",
".",
"g",
".",
"get_term_freq_df",
":",
"pd",
".",
"DataFrame",
"positive_category",
":",
"str",
"The",
"positive",
"category",
"name",
".",
"term_significance",
":",
"TermSignificance",
... | def get_p_vals(df, positive_category, term_significance):
'''
Parameters
----------
df : A data frame from, e.g., get_term_freq_df : pd.DataFrame
positive_category : str
The positive category name.
term_significance : TermSignificance
A TermSignificance instance from which to extract p-values.
'''
df_pos = ... | [
"def",
"get_p_vals",
"(",
"df",
",",
"positive_category",
",",
"term_significance",
")",
":",
"df_pos",
"=",
"df",
"[",
"[",
"positive_category",
"]",
"]",
"df_pos",
".",
"columns",
"=",
"[",
"'pos'",
"]",
"df_neg",
"=",
"pd",
".",
"DataFrame",
"(",
"df"... | https://github.com/JasonKessler/scattertext/blob/ef33f06d4c31f9d64b551a7ab86bf157aca82644/scattertext/PValGetter.py#L4-L21 | |
boto/boto | b2a6f08122b2f1b89888d2848e730893595cd001 | boto/cloudsearch2/search.py | python | SearchResults.next_page | (self) | Call Cloudsearch to get the next page of search results
:rtype: :class:`boto.cloudsearch2.search.SearchResults`
:return: the following page of search results | Call Cloudsearch to get the next page of search results | [
"Call",
"Cloudsearch",
"to",
"get",
"the",
"next",
"page",
"of",
"search",
"results"
] | def next_page(self):
"""Call Cloudsearch to get the next page of search results
:rtype: :class:`boto.cloudsearch2.search.SearchResults`
:return: the following page of search results
"""
if self.query.page <= self.num_pages_needed:
self.query.start += self.query.real_... | [
"def",
"next_page",
"(",
"self",
")",
":",
"if",
"self",
".",
"query",
".",
"page",
"<=",
"self",
".",
"num_pages_needed",
":",
"self",
".",
"query",
".",
"start",
"+=",
"self",
".",
"query",
".",
"real_size",
"self",
".",
"query",
".",
"page",
"+=",... | https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/cloudsearch2/search.py#L62-L73 | ||
Jorl17/open-elevation | 677f9de1b6c1a10b48028f36e072bf8b6ba19b9e | gdal_interfaces.py | python | GDALTileInterface.read_summary_json | (self) | [] | def read_summary_json(self):
with open(self.summary_file) as f:
self.all_coords = json.load(f)
self._build_index() | [
"def",
"read_summary_json",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"summary_file",
")",
"as",
"f",
":",
"self",
".",
"all_coords",
"=",
"json",
".",
"load",
"(",
"f",
")",
"self",
".",
"_build_index",
"(",
")"
] | https://github.com/Jorl17/open-elevation/blob/677f9de1b6c1a10b48028f36e072bf8b6ba19b9e/gdal_interfaces.py#L157-L161 | ||||
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/autogroup.py | python | Autogroup.set_exclude | (self, exclude) | Set the list of classes to exclude in the autogrouping.
:param exclude: a list of valid entry point strings (might contain '%' to be used as
string to be matched using SQL's ``LIKE`` pattern-making logic), or ``None``
to specify no include list. | Set the list of classes to exclude in the autogrouping. | [
"Set",
"the",
"list",
"of",
"classes",
"to",
"exclude",
"in",
"the",
"autogrouping",
"."
] | def set_exclude(self, exclude):
"""Set the list of classes to exclude in the autogrouping.
:param exclude: a list of valid entry point strings (might contain '%' to be used as
string to be matched using SQL's ``LIKE`` pattern-making logic), or ``None``
to specify no include list.
... | [
"def",
"set_exclude",
"(",
"self",
",",
"exclude",
")",
":",
"if",
"isinstance",
"(",
"exclude",
",",
"str",
")",
":",
"exclude",
"=",
"[",
"exclude",
"]",
"self",
".",
"validate",
"(",
"exclude",
")",
"if",
"exclude",
"is",
"not",
"None",
"and",
"se... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/autogroup.py#L86-L99 | ||
miguelgrinberg/Flask-Migrate | c051a000c1518a71e0a5d045c1f8065b9add5122 | src/flask_migrate/__init__.py | python | stamp | (directory=None, revision='head', sql=False, tag=None) | stamp' the revision table with the given revision; don't run any
migrations | stamp' the revision table with the given revision; don't run any
migrations | [
"stamp",
"the",
"revision",
"table",
"with",
"the",
"given",
"revision",
";",
"don",
"t",
"run",
"any",
"migrations"
] | def stamp(directory=None, revision='head', sql=False, tag=None):
"""'stamp' the revision table with the given revision; don't run any
migrations"""
config = current_app.extensions['migrate'].migrate.get_config(directory)
command.stamp(config, revision, sql=sql, tag=tag) | [
"def",
"stamp",
"(",
"directory",
"=",
"None",
",",
"revision",
"=",
"'head'",
",",
"sql",
"=",
"False",
",",
"tag",
"=",
"None",
")",
":",
"config",
"=",
"current_app",
".",
"extensions",
"[",
"'migrate'",
"]",
".",
"migrate",
".",
"get_config",
"(",
... | https://github.com/miguelgrinberg/Flask-Migrate/blob/c051a000c1518a71e0a5d045c1f8065b9add5122/src/flask_migrate/__init__.py#L240-L244 | ||
mars-project/mars | 6afd7ed86db77f29cc9470485698ef192ecc6d33 | mars/tensor/base/atleast_3d.py | python | atleast_3d | (*tensors) | return ExecutableTuple(new_tensors) | View inputs as tensors with at least three dimensions.
Parameters
----------
tensors1, tensors2, ... : array_like
One or more tensor-like sequences. Non-tensor inputs are converted to
tensors. Tensors that already have three or more dimensions are
preserved.
Returns
-----... | View inputs as tensors with at least three dimensions. | [
"View",
"inputs",
"as",
"tensors",
"with",
"at",
"least",
"three",
"dimensions",
"."
] | def atleast_3d(*tensors):
"""
View inputs as tensors with at least three dimensions.
Parameters
----------
tensors1, tensors2, ... : array_like
One or more tensor-like sequences. Non-tensor inputs are converted to
tensors. Tensors that already have three or more dimensions are
... | [
"def",
"atleast_3d",
"(",
"*",
"tensors",
")",
":",
"new_tensors",
"=",
"[",
"]",
"for",
"x",
"in",
"tensors",
":",
"x",
"=",
"astensor",
"(",
"x",
")",
"if",
"x",
".",
"ndim",
"==",
"0",
":",
"x",
"=",
"x",
"[",
"np",
".",
"newaxis",
",",
"n... | https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/tensor/base/atleast_3d.py#L23-L86 | |
cloudmarker/cloudmarker | 0dd2daadfa0203b3d1062e5067b14e4e0f189697 | cloudmarker/events/azwebappclientcertevent.py | python | AzWebAppClientCertEvent.eval | (self, record) | Evaluate Azure web app to check if client cert is disabled.
Arguments:
record (dict): A web app record.
Yields:
dict: An event record representing a web app with client
certificate (mTLS) disabled. | Evaluate Azure web app to check if client cert is disabled. | [
"Evaluate",
"Azure",
"web",
"app",
"to",
"check",
"if",
"client",
"cert",
"is",
"disabled",
"."
] | def eval(self, record):
"""Evaluate Azure web app to check if client cert is disabled.
Arguments:
record (dict): A web app record.
Yields:
dict: An event record representing a web app with client
certificate (mTLS) disabled.
"""
com = record... | [
"def",
"eval",
"(",
"self",
",",
"record",
")",
":",
"com",
"=",
"record",
".",
"get",
"(",
"'com'",
",",
"{",
"}",
")",
"if",
"com",
"is",
"None",
":",
"return",
"if",
"com",
".",
"get",
"(",
"'cloud_type'",
")",
"!=",
"'azure'",
":",
"return",
... | https://github.com/cloudmarker/cloudmarker/blob/0dd2daadfa0203b3d1062e5067b14e4e0f189697/cloudmarker/events/azwebappclientcertevent.py#L23-L51 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/backends/backend_cairo.py | python | _cairo_font_args_from_font_prop | (prop) | return name, slant, weight | Convert a `.FontProperties` or a `.FontEntry` to arguments that can be
passed to `.Context.select_font_face`. | Convert a `.FontProperties` or a `.FontEntry` to arguments that can be
passed to `.Context.select_font_face`. | [
"Convert",
"a",
".",
"FontProperties",
"or",
"a",
".",
"FontEntry",
"to",
"arguments",
"that",
"can",
"be",
"passed",
"to",
".",
"Context",
".",
"select_font_face",
"."
] | def _cairo_font_args_from_font_prop(prop):
"""
Convert a `.FontProperties` or a `.FontEntry` to arguments that can be
passed to `.Context.select_font_face`.
"""
def attr(field):
try:
return getattr(prop, f"get_{field}")()
except AttributeError:
return getattr(... | [
"def",
"_cairo_font_args_from_font_prop",
"(",
"prop",
")",
":",
"def",
"attr",
"(",
"field",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"prop",
",",
"f\"get_{field}\"",
")",
"(",
")",
"except",
"AttributeError",
":",
"return",
"getattr",
"(",
"prop",
... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/backends/backend_cairo.py#L75-L92 | |
mozilla/addons-server | cbfb29e5be99539c30248d70b93bb15e1c1bc9d7 | src/olympia/scanners/tasks.py | python | _run_scanner_for_url | (scanner_result, url, scanner, api_url, api_key) | Inner function to run a scanner on a particular URL via RPC and add results
to the given scanner_result. The caller is responsible for saving the
scanner_result to the database. | Inner function to run a scanner on a particular URL via RPC and add results
to the given scanner_result. The caller is responsible for saving the
scanner_result to the database. | [
"Inner",
"function",
"to",
"run",
"a",
"scanner",
"on",
"a",
"particular",
"URL",
"via",
"RPC",
"and",
"add",
"results",
"to",
"the",
"given",
"scanner_result",
".",
"The",
"caller",
"is",
"responsible",
"for",
"saving",
"the",
"scanner_result",
"to",
"the",... | def _run_scanner_for_url(scanner_result, url, scanner, api_url, api_key):
"""
Inner function to run a scanner on a particular URL via RPC and add results
to the given scanner_result. The caller is responsible for saving the
scanner_result to the database.
"""
with requests.Session() as http:
... | [
"def",
"_run_scanner_for_url",
"(",
"scanner_result",
",",
"url",
",",
"scanner",
",",
"api_url",
",",
"api_key",
")",
":",
"with",
"requests",
".",
"Session",
"(",
")",
"as",
"http",
":",
"adapter",
"=",
"make_adapter_with_retry",
"(",
")",
"http",
".",
"... | https://github.com/mozilla/addons-server/blob/cbfb29e5be99539c30248d70b93bb15e1c1bc9d7/src/olympia/scanners/tasks.py#L107-L135 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/owviolinplot.py | python | ViolinPlot.order_items | (self) | [] | def order_items(self):
assert self.__group_var is not None
indices = self._sorted_group_indices
for i, index in enumerate(indices):
violin: ViolinItem = self.__violin_items[index]
box: BoxItem = self.__box_items[index]
median: MedianItem = self.__median_item... | [
"def",
"order_items",
"(",
"self",
")",
":",
"assert",
"self",
".",
"__group_var",
"is",
"not",
"None",
"indices",
"=",
"self",
".",
"_sorted_group_indices",
"for",
"i",
",",
"index",
"in",
"enumerate",
"(",
"indices",
")",
":",
"violin",
":",
"ViolinItem"... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owviolinplot.py#L495-L527 | ||||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/gettext.py | python | NullTranslations.add_fallback | (self, fallback) | [] | def add_fallback(self, fallback):
if self._fallback:
self._fallback.add_fallback(fallback)
else:
self._fallback = fallback | [
"def",
"add_fallback",
"(",
"self",
",",
"fallback",
")",
":",
"if",
"self",
".",
"_fallback",
":",
"self",
".",
"_fallback",
".",
"add_fallback",
"(",
"fallback",
")",
"else",
":",
"self",
".",
"_fallback",
"=",
"fallback"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/gettext.py#L260-L264 | ||||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/series.py | python | Series.to_frame | (self, name=None) | return df | Convert Series to DataFrame.
Parameters
----------
name : object, default None
The passed name should substitute for the series name (if it has
one).
Returns
-------
data_frame : DataFrame | Convert Series to DataFrame. | [
"Convert",
"Series",
"to",
"DataFrame",
"."
] | def to_frame(self, name=None):
"""
Convert Series to DataFrame.
Parameters
----------
name : object, default None
The passed name should substitute for the series name (if it has
one).
Returns
-------
data_frame : DataFrame
... | [
"def",
"to_frame",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"df",
"=",
"self",
".",
"_constructor_expanddim",
"(",
"self",
")",
"else",
":",
"df",
"=",
"self",
".",
"_constructor_expanddim",
"(",
"{",
"name",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/series.py#L1497-L1516 | |
matsui528/nanopq | 4c1d724494a71f9736b15928a8c03b0ba13ffd19 | nanopq/pq.py | python | PQ.decode | (self, codes) | return vecs | Given PQ-codes, reconstruct original D-dimensional vectors
approximately by fetching the codewords.
Args:
codes (np.ndarray): PQ-cdoes with shape=(N, M) and dtype=self.code_dtype.
Each row is a PQ-code
Returns:
np.ndarray: Reconstructed vectors with shap... | Given PQ-codes, reconstruct original D-dimensional vectors
approximately by fetching the codewords. | [
"Given",
"PQ",
"-",
"codes",
"reconstruct",
"original",
"D",
"-",
"dimensional",
"vectors",
"approximately",
"by",
"fetching",
"the",
"codewords",
"."
] | def decode(self, codes):
"""Given PQ-codes, reconstruct original D-dimensional vectors
approximately by fetching the codewords.
Args:
codes (np.ndarray): PQ-cdoes with shape=(N, M) and dtype=self.code_dtype.
Each row is a PQ-code
Returns:
np.ndar... | [
"def",
"decode",
"(",
"self",
",",
"codes",
")",
":",
"assert",
"codes",
".",
"ndim",
"==",
"2",
"N",
",",
"M",
"=",
"codes",
".",
"shape",
"assert",
"M",
"==",
"self",
".",
"M",
"assert",
"codes",
".",
"dtype",
"==",
"self",
".",
"code_dtype",
"... | https://github.com/matsui528/nanopq/blob/4c1d724494a71f9736b15928a8c03b0ba13ffd19/nanopq/pq.py#L121-L142 | |
salesforce/cloudsplaining | c932ea61de7b0f12d77bb4144fee343245d68d3f | cloudsplaining/scan/user_details.py | python | UserDetailList.get_all_iam_statements_for_user | (
self, name: str
) | return None | Returns a list of all StatementDetail objects across all the policies assigned to the user | Returns a list of all StatementDetail objects across all the policies assigned to the user | [
"Returns",
"a",
"list",
"of",
"all",
"StatementDetail",
"objects",
"across",
"all",
"the",
"policies",
"assigned",
"to",
"the",
"user"
] | def get_all_iam_statements_for_user(
self, name: str
) -> Optional[List[StatementDetail]]:
"""Returns a list of all StatementDetail objects across all the policies assigned to the user"""
for user_detail in self.users:
if user_detail.user_name == name:
return user... | [
"def",
"get_all_iam_statements_for_user",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"Optional",
"[",
"List",
"[",
"StatementDetail",
"]",
"]",
":",
"for",
"user_detail",
"in",
"self",
".",
"users",
":",
"if",
"user_detail",
".",
"user_name",
"==",
"... | https://github.com/salesforce/cloudsplaining/blob/c932ea61de7b0f12d77bb4144fee343245d68d3f/cloudsplaining/scan/user_details.py#L47-L54 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/mhlib.py | python | Folder.parsesequence | (self, seq) | Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages. | Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages. | [
"Parse",
"an",
"MH",
"sequence",
"specification",
"into",
"a",
"message",
"list",
".",
"Attempt",
"to",
"mimic",
"mh",
"-",
"sequence",
"(",
"5",
")",
"as",
"close",
"as",
"possible",
".",
"Also",
"attempt",
"to",
"mimic",
"observed",
"behavior",
"regardin... | def parsesequence(self, seq):
"""Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages."""
# XXX Still not complete (see mh-format... | [
"def",
"parsesequence",
"(",
"self",
",",
"seq",
")",
":",
"# XXX Still not complete (see mh-format(5)).",
"# Missing are:",
"# - 'prev', 'next' as count",
"# - Sequence-Negation option",
"all",
"=",
"self",
".",
"listmessages",
"(",
")",
"# Observed behavior: test for empty fo... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/mhlib.py#L346-L428 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_registry.py | python | DeploymentConfig.exists_volume_mount | (self, volume_mount) | return volume_mount_found | return whether a volume mount exists | return whether a volume mount exists | [
"return",
"whether",
"a",
"volume",
"mount",
"exists"
] | def exists_volume_mount(self, volume_mount):
''' return whether a volume mount exists '''
exist_volume_mounts = self.get_volume_mounts()
if not exist_volume_mounts:
return False
volume_mount_found = False
for exist_volume_mount in exist_volume_mounts:
if... | [
"def",
"exists_volume_mount",
"(",
"self",
",",
"volume_mount",
")",
":",
"exist_volume_mounts",
"=",
"self",
".",
"get_volume_mounts",
"(",
")",
"if",
"not",
"exist_volume_mounts",
":",
"return",
"False",
"volume_mount_found",
"=",
"False",
"for",
"exist_volume_mou... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_registry.py#L1749-L1762 | |
fofix/fofix | 7730d1503c66562b901f62b33a5bd46c3d5e5c34 | fofix/core/Image.py | python | drawImage | (image, scale=(1.0, -1.0), coord=(0, 0), rot=0, color=(1, 1, 1, 1),
rect=(0, 1, 0, 1), stretched=0, fit=CENTER, alignment=CENTER,
valignment=CENTER) | return True | Draws the image/surface to screen
:param image: The OpenGL surface
:param scale: Scale factor (between 0.0 and 1.0, second value must be negative due to texture flipping)
:param coord: Where the image will be translated to on the screen
:param rot: How many degrees it will be rotated
:param color: ... | Draws the image/surface to screen | [
"Draws",
"the",
"image",
"/",
"surface",
"to",
"screen"
] | def drawImage(image, scale=(1.0, -1.0), coord=(0, 0), rot=0, color=(1, 1, 1, 1),
rect=(0, 1, 0, 1), stretched=0, fit=CENTER, alignment=CENTER,
valignment=CENTER):
"""
Draws the image/surface to screen
:param image: The OpenGL surface
:param scale: Scale factor (between 0.0 and 1.0, seco... | [
"def",
"drawImage",
"(",
"image",
",",
"scale",
"=",
"(",
"1.0",
",",
"-",
"1.0",
")",
",",
"coord",
"=",
"(",
"0",
",",
"0",
")",
",",
"rot",
"=",
"0",
",",
"color",
"=",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
",",
"rect",
"=",
"... | https://github.com/fofix/fofix/blob/7730d1503c66562b901f62b33a5bd46c3d5e5c34/fofix/core/Image.py#L65-L98 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/ndb/context.py | python | Context._use_memcache | (self, key, options=None) | return flag | Return whether to use memcache for this key.
Args:
key: Key instance.
options: ContextOptions instance, or None.
Returns:
True if the key should be cached in memcache, False otherwise. | Return whether to use memcache for this key. | [
"Return",
"whether",
"to",
"use",
"memcache",
"for",
"this",
"key",
"."
] | def _use_memcache(self, key, options=None):
"""Return whether to use memcache for this key.
Args:
key: Key instance.
options: ContextOptions instance, or None.
Returns:
True if the key should be cached in memcache, False otherwise.
"""
flag = ContextOptions.use_memcache(options)
... | [
"def",
"_use_memcache",
"(",
"self",
",",
"key",
",",
"options",
"=",
"None",
")",
":",
"flag",
"=",
"ContextOptions",
".",
"use_memcache",
"(",
"options",
")",
"if",
"flag",
"is",
"None",
":",
"flag",
"=",
"self",
".",
"_memcache_policy",
"(",
"key",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/ndb/context.py#L494-L511 | |
elimintz/justpy | 42275e9c6e00373f09affd7d781a278383171807 | justpy/chartcomponents.py | python | HighCharts.select_point | (self, point_list, websocket) | return True | point_list is list of of dictionaries whose keys are:
'id': the chart id
'series': the series index
'point': the point index
Values are all integers
Example:
{'id': chart_id, 'series': msg.series_index, 'point': msg.point_index} | point_list is list of of dictionaries whose keys are:
'id': the chart id
'series': the series index
'point': the point index
Values are all integers
Example:
{'id': chart_id, 'series': msg.series_index, 'point': msg.point_index} | [
"point_list",
"is",
"list",
"of",
"of",
"dictionaries",
"whose",
"keys",
"are",
":",
"id",
":",
"the",
"chart",
"id",
"series",
":",
"the",
"series",
"index",
"point",
":",
"the",
"point",
"index",
"Values",
"are",
"all",
"integers",
"Example",
":",
"{",... | async def select_point(self, point_list, websocket):
"""
point_list is list of of dictionaries whose keys are:
'id': the chart id
'series': the series index
'point': the point index
Values are all integers
Example:
{'id': chart_id, 'series': msg.series_... | [
"async",
"def",
"select_point",
"(",
"self",
",",
"point_list",
",",
"websocket",
")",
":",
"await",
"websocket",
".",
"send_json",
"(",
"{",
"'type'",
":",
"'select_point'",
",",
"'data'",
":",
"point_list",
"}",
")",
"# Return True not None so that the page does... | https://github.com/elimintz/justpy/blob/42275e9c6e00373f09affd7d781a278383171807/justpy/chartcomponents.py#L114-L126 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/video/v1/room/__init__.py | python | RoomPage.get_instance | (self, payload) | return RoomInstance(self._version, payload, ) | Build an instance of RoomInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.video.v1.room.RoomInstance
:rtype: twilio.rest.video.v1.room.RoomInstance | Build an instance of RoomInstance | [
"Build",
"an",
"instance",
"of",
"RoomInstance"
] | def get_instance(self, payload):
"""
Build an instance of RoomInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.video.v1.room.RoomInstance
:rtype: twilio.rest.video.v1.room.RoomInstance
"""
return RoomInstance(self._version, paylo... | [
"def",
"get_instance",
"(",
"self",
",",
"payload",
")",
":",
"return",
"RoomInstance",
"(",
"self",
".",
"_version",
",",
"payload",
",",
")"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/video/v1/room/__init__.py#L253-L262 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/backends/sqlalchemy/migrations/versions/b8b23ddefad4_dbgroup_name_to_label_type_to_type_string.py | python | upgrade | () | The upgrade migration actions. | The upgrade migration actions. | [
"The",
"upgrade",
"migration",
"actions",
"."
] | def upgrade():
"""The upgrade migration actions."""
# dropping
op.drop_constraint('db_dbgroup_name_type_key', 'db_dbgroup')
op.drop_index('ix_db_dbgroup_name', 'db_dbgroup')
op.drop_index('ix_db_dbgroup_type', 'db_dbgroup')
# renaming
op.alter_column('db_dbgroup', 'name', new_column_name='l... | [
"def",
"upgrade",
"(",
")",
":",
"# dropping",
"op",
".",
"drop_constraint",
"(",
"'db_dbgroup_name_type_key'",
",",
"'db_dbgroup'",
")",
"op",
".",
"drop_index",
"(",
"'ix_db_dbgroup_name'",
",",
"'db_dbgroup'",
")",
"op",
".",
"drop_index",
"(",
"'ix_db_dbgroup_... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/backends/sqlalchemy/migrations/versions/b8b23ddefad4_dbgroup_name_to_label_type_to_type_string.py#L28-L42 | ||
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/utils/perf/_config.py | python | _patch_perf_timer | (parent, callable: str, label: str) | Patches the callable to run it inside a perf_timer.
Parameters
----------
parent
The module or class that contains the callable.
callable : str
The name of the callable (function or method).
label : str
The <function> or <class>.<method> we are patching. | Patches the callable to run it inside a perf_timer. | [
"Patches",
"the",
"callable",
"to",
"run",
"it",
"inside",
"a",
"perf_timer",
"."
] | def _patch_perf_timer(parent, callable: str, label: str) -> None:
"""Patches the callable to run it inside a perf_timer.
Parameters
----------
parent
The module or class that contains the callable.
callable : str
The name of the callable (function or method).
label : str
... | [
"def",
"_patch_perf_timer",
"(",
"parent",
",",
"callable",
":",
"str",
",",
"label",
":",
"str",
")",
"->",
"None",
":",
"@",
"wrapt",
".",
"patch_function_wrapper",
"(",
"parent",
",",
"callable",
")",
"def",
"perf_time_callable",
"(",
"wrapped",
",",
"i... | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/perf/_config.py#L24-L40 | ||
deanishe/zothero | 5b057ef080ee730d82d5dd15e064d2a4730c2b11 | src/lib/workflow/workflow.py | python | Workflow.data_serializer | (self, serializer_name) | Set the default cache serialization format.
.. versionadded:: 1.8
This serializer is used by :meth:`store_data()` and
:meth:`stored_data()`
The specified serializer must already by registered with the
:class:`SerializerManager` at `~workflow.workflow.manager`,
otherwis... | Set the default cache serialization format. | [
"Set",
"the",
"default",
"cache",
"serialization",
"format",
"."
] | def data_serializer(self, serializer_name):
"""Set the default cache serialization format.
.. versionadded:: 1.8
This serializer is used by :meth:`store_data()` and
:meth:`stored_data()`
The specified serializer must already by registered with the
:class:`SerializerMan... | [
"def",
"data_serializer",
"(",
"self",
",",
"serializer_name",
")",
":",
"if",
"manager",
".",
"serializer",
"(",
"serializer_name",
")",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Unknown serializer : `{0}`. Register your serializer '",
"'with `manager` first.'",
... | https://github.com/deanishe/zothero/blob/5b057ef080ee730d82d5dd15e064d2a4730c2b11/src/lib/workflow/workflow.py#L1534-L1556 | ||
wummel/linkchecker | c2ce810c3fb00b895a841a7be6b2e78c64e7b042 | linkcheck/HtmlParser/htmllib.py | python | HtmlPrettyPrinter.comment | (self, data) | Print HTML comment.
@param data: the comment
@type data: string
@return: None | Print HTML comment. | [
"Print",
"HTML",
"comment",
"."
] | def comment (self, data):
"""
Print HTML comment.
@param data: the comment
@type data: string
@return: None
"""
data = data.encode(self.encoding, "ignore")
self.fd.write("<!--%s-->" % data) | [
"def",
"comment",
"(",
"self",
",",
"data",
")",
":",
"data",
"=",
"data",
".",
"encode",
"(",
"self",
".",
"encoding",
",",
"\"ignore\"",
")",
"self",
".",
"fd",
".",
"write",
"(",
"\"<!--%s-->\"",
"%",
"data",
")"
] | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/HtmlParser/htmllib.py#L79-L88 | ||
thenetcircle/dino | 1047c3458e91a1b4189e9f48f1393b3a68a935b3 | dino/storage/cassandra_interface.py | python | IDriver.msgs_select | (self, to_user_id: str) | find all messages sent to a user id/room id
:param to_user_id: either a user id or room uuid
:return: all messages to this user/room | find all messages sent to a user id/room id | [
"find",
"all",
"messages",
"sent",
"to",
"a",
"user",
"id",
"/",
"room",
"id"
] | def msgs_select(self, to_user_id: str):
"""
find all messages sent to a user id/room id
:param to_user_id: either a user id or room uuid
:return: all messages to this user/room
""" | [
"def",
"msgs_select",
"(",
"self",
",",
"to_user_id",
":",
"str",
")",
":"
] | https://github.com/thenetcircle/dino/blob/1047c3458e91a1b4189e9f48f1393b3a68a935b3/dino/storage/cassandra_interface.py#L60-L66 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/Queue.py | python | Queue.put | (self, item, block=True, timeout=None) | Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a positive number, it blocks at most 'timeout' seconds and raises
the Full exception if no free slot was available within ... | Put an item into the queue. | [
"Put",
"an",
"item",
"into",
"the",
"queue",
"."
] | def put(self, item, block=True, timeout=None):
"""Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a positive number, it blocks at most 'timeout' seconds and raises
... | [
"def",
"put",
"(",
"self",
",",
"item",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"not_full",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"maxsize",
">",
"0",
":",
"if",
"not",
"block",
":",
"if... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/Queue.py#L107-L140 | ||
quantopian/pgcontents | 51f8febcf6ece4e88b047768b9ce18553162d63c | pgcontents/pgmanager.py | python | PostgresContentsManager._directory_model_from_db | (self, record, content) | return model | Build a directory model from database directory record. | Build a directory model from database directory record. | [
"Build",
"a",
"directory",
"model",
"from",
"database",
"directory",
"record",
"."
] | def _directory_model_from_db(self, record, content):
"""
Build a directory model from database directory record.
"""
model = base_directory_model(to_api_path(record['name']))
if content:
model['format'] = 'json'
model['content'] = list(
cha... | [
"def",
"_directory_model_from_db",
"(",
"self",
",",
"record",
",",
"content",
")",
":",
"model",
"=",
"base_directory_model",
"(",
"to_api_path",
"(",
"record",
"[",
"'name'",
"]",
")",
")",
"if",
"content",
":",
"model",
"[",
"'format'",
"]",
"=",
"'json... | https://github.com/quantopian/pgcontents/blob/51f8febcf6ece4e88b047768b9ce18553162d63c/pgcontents/pgmanager.py#L246-L262 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/tomlkit/items.py | python | Float.__init__ | (self, _, trivia, raw) | [] | def __init__(self, _, trivia, raw): # type: (float, Trivia, str) -> None
super(Float, self).__init__(trivia)
self._raw = raw
self._sign = False
if re.match(r"^[+\-].+$", raw):
self._sign = True | [
"def",
"__init__",
"(",
"self",
",",
"_",
",",
"trivia",
",",
"raw",
")",
":",
"# type: (float, Trivia, str) -> None",
"super",
"(",
"Float",
",",
"self",
")",
".",
"__init__",
"(",
"trivia",
")",
"self",
".",
"_raw",
"=",
"raw",
"self",
".",
"_sign",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/tomlkit/items.py#L453-L460 | ||||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/cuda/simulator/cudadrv/nvvm.py | python | get_supported_ccs | () | return () | [] | def get_supported_ccs():
return () | [
"def",
"get_supported_ccs",
"(",
")",
":",
"return",
"(",
")"
] | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/simulator/cudadrv/nvvm.py#L29-L30 | |||
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/fake.py | python | FakeClient.__init__ | (self, console, **kwargs) | Object constructor.
:param console: The console implementation | Object constructor.
:param console: The console implementation | [
"Object",
"constructor",
".",
":",
"param",
"console",
":",
"The",
"console",
"implementation"
] | def __init__(self, console, **kwargs):
"""
Object constructor.
:param console: The console implementation
"""
self.console = console
self.message_history = [] # this allows unittests to check if a message was sent to the client
b3.clients.Client.__init__(self, **k... | [
"def",
"__init__",
"(",
"self",
",",
"console",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"console",
"=",
"console",
"self",
".",
"message_history",
"=",
"[",
"]",
"# this allows unittests to check if a message was sent to the client",
"b3",
".",
"clients",
... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/fake.py#L265-L272 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/news/nntp.py | python | NNTPClient.gotXHeader | (self, headers) | Override for notification when getXHeader() action is successful | Override for notification when getXHeader() action is successful | [
"Override",
"for",
"notification",
"when",
"getXHeader",
"()",
"action",
"is",
"successful"
] | def gotXHeader(self, headers):
"Override for notification when getXHeader() action is successful" | [
"def",
"gotXHeader",
"(",
"self",
",",
"headers",
")",
":"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/news/nntp.py#L166-L167 | ||
zhreshold/mxnet-ssd | 821a1c5049679f798976c8bf58b460ffaa098458 | evaluate/evaluate_net.py | python | evaluate_net | (net, path_imgrec, num_classes, mean_pixels, data_shape,
model_prefix, epoch, ctx=mx.cpu(), batch_size=1,
path_imglist="", nms_thresh=0.45, force_nms=False,
ovp_thresh=0.5, use_difficult=False, class_names=None,
voc07_metric=False, frequent=20) | evalute network given validation record file
Parameters:
----------
net : str or None
Network name or use None to load from json without modifying
path_imgrec : str
path to the record validation file
path_imglist : str
path to the list file to replace labels in record file, ... | evalute network given validation record file | [
"evalute",
"network",
"given",
"validation",
"record",
"file"
] | def evaluate_net(net, path_imgrec, num_classes, mean_pixels, data_shape,
model_prefix, epoch, ctx=mx.cpu(), batch_size=1,
path_imglist="", nms_thresh=0.45, force_nms=False,
ovp_thresh=0.5, use_difficult=False, class_names=None,
voc07_metric=False, freq... | [
"def",
"evaluate_net",
"(",
"net",
",",
"path_imgrec",
",",
"num_classes",
",",
"mean_pixels",
",",
"data_shape",
",",
"model_prefix",
",",
"epoch",
",",
"ctx",
"=",
"mx",
".",
"cpu",
"(",
")",
",",
"batch_size",
"=",
"1",
",",
"path_imglist",
"=",
"\"\"... | https://github.com/zhreshold/mxnet-ssd/blob/821a1c5049679f798976c8bf58b460ffaa098458/evaluate/evaluate_net.py#L12-L101 | ||
reddit-archive/reddit | 753b17407e9a9dca09558526805922de24133d53 | r2/r2/models/ip.py | python | set_account_ip | (account_id, ip, date=None) | Set an IP address as having accessed an account.
Updates all underlying datastores. | Set an IP address as having accessed an account. | [
"Set",
"an",
"IP",
"address",
"as",
"having",
"accessed",
"an",
"account",
"."
] | def set_account_ip(account_id, ip, date=None):
"""Set an IP address as having accessed an account.
Updates all underlying datastores.
"""
# don't store private IPs, send event + string so we can investigate this
if ip_address(ip).is_private:
g.stats.simple_event('ip.private_ip_storage_preve... | [
"def",
"set_account_ip",
"(",
"account_id",
",",
"ip",
",",
"date",
"=",
"None",
")",
":",
"# don't store private IPs, send event + string so we can investigate this",
"if",
"ip_address",
"(",
"ip",
")",
".",
"is_private",
":",
"g",
".",
"stats",
".",
"simple_event"... | https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/models/ip.py#L135-L151 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/rlib/rposix_stat.py | python | make_stat_result | (tup) | return os.stat_result(positional, kwds) | Turn a tuple into an os.stat_result object. | Turn a tuple into an os.stat_result object. | [
"Turn",
"a",
"tuple",
"into",
"an",
"os",
".",
"stat_result",
"object",
"."
] | def make_stat_result(tup):
"""Turn a tuple into an os.stat_result object."""
assert len(tup) == len(STAT_FIELDS)
assert float not in [type(x) for x in tup]
positional = []
for i in range(N_INDEXABLE_FIELDS):
name, TYPE = STAT_FIELDS[i]
value = lltype.cast_primitive(TYPE, tup[i])
... | [
"def",
"make_stat_result",
"(",
"tup",
")",
":",
"assert",
"len",
"(",
"tup",
")",
"==",
"len",
"(",
"STAT_FIELDS",
")",
"assert",
"float",
"not",
"in",
"[",
"type",
"(",
"x",
")",
"for",
"x",
"in",
"tup",
"]",
"positional",
"=",
"[",
"]",
"for",
... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/rlib/rposix_stat.py#L278-L302 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_internal/index.py | python | PackageFinder.__init__ | (
self,
find_links, # type: List[str]
index_urls, # type: List[str]
allow_all_prereleases=False, # type: bool
trusted_hosts=None, # type: Optional[Iterable[str]]
session=None, # type: Optional[PipSession]
format_control=None, # type: Optional[FormatControl]
... | Create a PackageFinder.
:param format_control: A FormatControl object or None. Used to control
the selection of source packages / binary packages when consulting
the index and links.
:param platform: A string or None. If None, searches for packages
that are supported... | Create a PackageFinder. | [
"Create",
"a",
"PackageFinder",
"."
] | def __init__(
self,
find_links, # type: List[str]
index_urls, # type: List[str]
allow_all_prereleases=False, # type: bool
trusted_hosts=None, # type: Optional[Iterable[str]]
session=None, # type: Optional[PipSession]
format_control=None, # type: Optional[For... | [
"def",
"__init__",
"(",
"self",
",",
"find_links",
",",
"# type: List[str]",
"index_urls",
",",
"# type: List[str]",
"allow_all_prereleases",
"=",
"False",
",",
"# type: bool",
"trusted_hosts",
"=",
"None",
",",
"# type: Optional[Iterable[str]]",
"session",
"=",
"None",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_internal/index.py#L405-L499 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/utils/appdirs.py | python | _get_win_folder_from_registry | (csidl_name) | return directory | This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names. | This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names. | [
"This",
"is",
"a",
"fallback",
"technique",
"at",
"best",
".",
"I",
"m",
"not",
"sure",
"if",
"using",
"the",
"registry",
"for",
"this",
"guarantees",
"us",
"the",
"correct",
"answer",
"for",
"all",
"CSIDL_",
"*",
"names",
"."
] | def _get_win_folder_from_registry(csidl_name):
"""
This is a fallback technique at best. I'm not sure if using the
registry for this guarantees us the correct answer for all CSIDL_*
names.
"""
import _winreg
shell_folder_name = {
"CSIDL_APPDATA": "AppData",
"CSIDL_COMMON_APP... | [
"def",
"_get_win_folder_from_registry",
"(",
"csidl_name",
")",
":",
"import",
"_winreg",
"shell_folder_name",
"=",
"{",
"\"CSIDL_APPDATA\"",
":",
"\"AppData\"",
",",
"\"CSIDL_COMMON_APPDATA\"",
":",
"\"Common AppData\"",
",",
"\"CSIDL_LOCAL_APPDATA\"",
":",
"\"Local AppDat... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/utils/appdirs.py#L205-L224 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Parser/asdl.py | python | ASDLParser.p_field_3 | (self, (type, _, name)) | return Field(type, name, opt=True) | field ::= Id ? Id | field ::= Id ? Id | [
"field",
"::",
"=",
"Id",
"?",
"Id"
] | def p_field_3(self, (type, _, name)):
" field ::= Id ? Id "
return Field(type, name, opt=True) | [
"def",
"p_field_3",
"(",
"self",
",",
"(",
"type",
",",
"_",
",",
"name",
")",
")",
":",
"return",
"Field",
"(",
"type",
",",
"name",
",",
"opt",
"=",
"True",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Parser/asdl.py#L209-L211 | |
thingsboard/thingsboard-gateway | 1d1b1fc2450852dbd56ff137c6bfd49143dc758d | thingsboard_gateway/connectors/snmp/snmp_uplink_converter.py | python | SNMPUplinkConverter.convert | (self, config, data) | return result | [] | def convert(self, config, data):
result = {
"deviceName": self.__config["deviceName"],
"deviceType": self.__config["deviceType"],
"attributes": [],
"telemetry": []
}
try:
if isinstance(data, dict):
result[config[0]].... | [
"def",
"convert",
"(",
"self",
",",
"config",
",",
"data",
")",
":",
"result",
"=",
"{",
"\"deviceName\"",
":",
"self",
".",
"__config",
"[",
"\"deviceName\"",
"]",
",",
"\"deviceType\"",
":",
"self",
".",
"__config",
"[",
"\"deviceType\"",
"]",
",",
"\"... | https://github.com/thingsboard/thingsboard-gateway/blob/1d1b1fc2450852dbd56ff137c6bfd49143dc758d/thingsboard_gateway/connectors/snmp/snmp_uplink_converter.py#L22-L49 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/set/src/core/scapy.py | python | PcapReader.fileno | (self) | return self.f.fileno() | [] | def fileno(self):
return self.f.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"f",
".",
"fileno",
"(",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L10397-L10398 | |||
wechatpy/wechatpy | 5f693a7e90156786c2540ad3c941d12cdf6d88ef | wechatpy/client/api/invoice.py | python | WeChatInvoice.scan_title | (self, scan_text) | return self._post(
"scantitle",
data={
"scan_text": scan_text,
},
) | 根据扫描码,获取用户发票抬头
商户扫用户“我的—个人信息—我的发票抬头”里面的抬头二维码后,通过调用本接口,可以获取用户抬头信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param scan_text: 扫码后获取的文本
:return: 用户的发票抬头数据
:rtype: dict | 根据扫描码,获取用户发票抬头
商户扫用户“我的—个人信息—我的发票抬头”里面的抬头二维码后,通过调用本接口,可以获取用户抬头信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0 | [
"根据扫描码,获取用户发票抬头",
"商户扫用户“我的—个人信息—我的发票抬头”里面的抬头二维码后,通过调用本接口,可以获取用户抬头信息",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496554912_vfWU0"
] | def scan_title(self, scan_text):
"""
根据扫描码,获取用户发票抬头
商户扫用户“我的—个人信息—我的发票抬头”里面的抬头二维码后,通过调用本接口,可以获取用户抬头信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param scan_text: 扫码后获取的文本
:return: 用户的发票抬头数据
:rtype: dict
"""
return self._pos... | [
"def",
"scan_title",
"(",
"self",
",",
"scan_text",
")",
":",
"return",
"self",
".",
"_post",
"(",
"\"scantitle\"",
",",
"data",
"=",
"{",
"\"scan_text\"",
":",
"scan_text",
",",
"}",
",",
")"
] | https://github.com/wechatpy/wechatpy/blob/5f693a7e90156786c2540ad3c941d12cdf6d88ef/wechatpy/client/api/invoice.py#L458-L474 | |
travisgoodspeed/goodfet | 1750cc1e8588af5470385e52fa098ca7364c2863 | client/ATMEL_USART.py | python | USART.crStartBreak | (self) | [] | def crStartBreak(self):
self.setControlReg(CR_STTBRK) | [
"def",
"crStartBreak",
"(",
"self",
")",
":",
"self",
".",
"setControlReg",
"(",
"CR_STTBRK",
")"
] | https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/client/ATMEL_USART.py#L162-L163 | ||||
openstack/cloudkitty | 78da8eac53c56566191aad548f035158877ccfe5 | cloudkitty/utils/__init__.py | python | iso2dt | (iso_date) | return trans_dt | iso8601 format to datetime. | iso8601 format to datetime. | [
"iso8601",
"format",
"to",
"datetime",
"."
] | def iso2dt(iso_date):
"""iso8601 format to datetime."""
iso_dt = timeutils.parse_isotime(iso_date)
trans_dt = timeutils.normalize_time(iso_dt)
return trans_dt | [
"def",
"iso2dt",
"(",
"iso_date",
")",
":",
"iso_dt",
"=",
"timeutils",
".",
"parse_isotime",
"(",
"iso_date",
")",
"trans_dt",
"=",
"timeutils",
".",
"normalize_time",
"(",
"iso_dt",
")",
"return",
"trans_dt"
] | https://github.com/openstack/cloudkitty/blob/78da8eac53c56566191aad548f035158877ccfe5/cloudkitty/utils/__init__.py#L92-L96 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/ipaddress.py | python | _split_optional_netmask | (address) | return addr | Helper to split the netmask and raise AddressValueError if needed | Helper to split the netmask and raise AddressValueError if needed | [
"Helper",
"to",
"split",
"the",
"netmask",
"and",
"raise",
"AddressValueError",
"if",
"needed"
] | def _split_optional_netmask(address):
"""Helper to split the netmask and raise AddressValueError if needed"""
addr = _compat_str(address).split('/')
if len(addr) > 2:
raise AddressValueError("Only one '/' permitted in %r" % address)
return addr | [
"def",
"_split_optional_netmask",
"(",
"address",
")",
":",
"addr",
"=",
"_compat_str",
"(",
"address",
")",
".",
"split",
"(",
"'/'",
")",
"if",
"len",
"(",
"addr",
")",
">",
"2",
":",
"raise",
"AddressValueError",
"(",
"\"Only one '/' permitted in %r\"",
"... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/ipaddress.py#L278-L283 | |
kivy/kivy | fbf561f73ddba9941b1b7e771f86264c6e6eef36 | kivy/core/window/__init__.py | python | WindowBase.on_keyboard | (self, key, scancode=None, codepoint=None,
modifier=None, **kwargs) | Event called when keyboard is used.
.. warning::
Some providers may omit `scancode`, `codepoint` and/or `modifier`. | Event called when keyboard is used. | [
"Event",
"called",
"when",
"keyboard",
"is",
"used",
"."
] | def on_keyboard(self, key, scancode=None, codepoint=None,
modifier=None, **kwargs):
'''Event called when keyboard is used.
.. warning::
Some providers may omit `scancode`, `codepoint` and/or `modifier`.
'''
if 'unicode' in kwargs:
Logger.warni... | [
"def",
"on_keyboard",
"(",
"self",
",",
"key",
",",
"scancode",
"=",
"None",
",",
"codepoint",
"=",
"None",
",",
"modifier",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'unicode'",
"in",
"kwargs",
":",
"Logger",
".",
"warning",
"(",
"\"The... | https://github.com/kivy/kivy/blob/fbf561f73ddba9941b1b7e771f86264c6e6eef36/kivy/core/window/__init__.py#L1853-L1874 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/recurr.py | python | rsolve_poly | (coeffs, f, n, **hints) | Given linear recurrence operator `\operatorname{L}` of order
`k` with polynomial coefficients and inhomogeneous equation
`\operatorname{L} y = f`, where `f` is a polynomial, we seek for
all polynomial solutions over field `K` of characteristic zero.
The algorithm performs two basic steps:
(1) ... | Given linear recurrence operator `\operatorname{L}` of order
`k` with polynomial coefficients and inhomogeneous equation
`\operatorname{L} y = f`, where `f` is a polynomial, we seek for
all polynomial solutions over field `K` of characteristic zero. | [
"Given",
"linear",
"recurrence",
"operator",
"\\",
"operatorname",
"{",
"L",
"}",
"of",
"order",
"k",
"with",
"polynomial",
"coefficients",
"and",
"inhomogeneous",
"equation",
"\\",
"operatorname",
"{",
"L",
"}",
"y",
"=",
"f",
"where",
"f",
"is",
"a",
"po... | def rsolve_poly(coeffs, f, n, **hints):
"""
Given linear recurrence operator `\operatorname{L}` of order
`k` with polynomial coefficients and inhomogeneous equation
`\operatorname{L} y = f`, where `f` is a polynomial, we seek for
all polynomial solutions over field `K` of characteristic zero.
T... | [
"def",
"rsolve_poly",
"(",
"coeffs",
",",
"f",
",",
"n",
",",
"*",
"*",
"hints",
")",
":",
"f",
"=",
"sympify",
"(",
"f",
")",
"if",
"not",
"f",
".",
"is_polynomial",
"(",
"n",
")",
":",
"return",
"None",
"homogeneous",
"=",
"f",
".",
"is_zero",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/recurr.py#L71-L346 | ||
pgq/skytools-legacy | 8b7e6c118572a605d28b7a3403c96aeecfd0d272 | python/londiste/setup.py | python | LondisteSetup.build_tgargs | (self) | return tgargs | Build trigger args | Build trigger args | [
"Build",
"trigger",
"args"
] | def build_tgargs(self):
"""Build trigger args"""
tgargs = []
if self.options.trigger_arg:
tgargs = self.options.trigger_arg
tgflags = self.options.trigger_flags
if tgflags:
tgargs.append('tgflags='+tgflags)
if self.options.no_triggers:
... | [
"def",
"build_tgargs",
"(",
"self",
")",
":",
"tgargs",
"=",
"[",
"]",
"if",
"self",
".",
"options",
".",
"trigger_arg",
":",
"tgargs",
"=",
"self",
".",
"options",
".",
"trigger_arg",
"tgflags",
"=",
"self",
".",
"options",
".",
"trigger_flags",
"if",
... | https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/londiste/setup.py#L271-L287 | |
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/object_detection/core/losses.py | python | WeightedSmoothL1LocalizationLoss._compute_loss | (self, prediction_tensor, target_tensor, weights) | return tf.reduce_sum(anchorwise_smooth_l1norm) | Compute loss function.
Args:
prediction_tensor: A float tensor of shape [batch_size, num_anchors,
code_size] representing the (encoded) predicted locations of objects.
target_tensor: A float tensor of shape [batch_size, num_anchors,
code_size] representing the regression targets
w... | Compute loss function. | [
"Compute",
"loss",
"function",
"."
] | def _compute_loss(self, prediction_tensor, target_tensor, weights):
"""Compute loss function.
Args:
prediction_tensor: A float tensor of shape [batch_size, num_anchors,
code_size] representing the (encoded) predicted locations of objects.
target_tensor: A float tensor of shape [batch_size, ... | [
"def",
"_compute_loss",
"(",
"self",
",",
"prediction_tensor",
",",
"target_tensor",
",",
"weights",
")",
":",
"diff",
"=",
"prediction_tensor",
"-",
"target_tensor",
"abs_diff",
"=",
"tf",
".",
"abs",
"(",
"diff",
")",
"abs_diff_lt_1",
"=",
"tf",
".",
"less... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/object_detection/core/losses.py#L144-L165 | |
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/scripts/shared.py | python | _sum_aggregate | (df, name, include=None, exclude=None) | return df | [] | def _sum_aggregate(df, name, include=None, exclude=None):
df = df.copy()
if include:
df = df[df["location"].isin(include)]
if exclude:
df = df[~df["location"].isin(exclude)]
df = df.groupby("date").sum().reset_index()
df["location"] = name
return df | [
"def",
"_sum_aggregate",
"(",
"df",
",",
"name",
",",
"include",
"=",
"None",
",",
"exclude",
"=",
"None",
")",
":",
"df",
"=",
"df",
".",
"copy",
"(",
")",
"if",
"include",
":",
"df",
"=",
"df",
"[",
"df",
"[",
"\"location\"",
"]",
".",
"isin",
... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/scripts/shared.py#L133-L141 | |||
windelbouwman/ppci | 915c069e0667042c085ec42c78e9e3c9a5295324 | ppci/wasm/binary/writer.py | python | BinaryFileWriter.write_type_definition | (self, type_definition) | Write out a `type` definition entry. | Write out a `type` definition entry. | [
"Write",
"out",
"a",
"type",
"definition",
"entry",
"."
] | def write_type_definition(self, type_definition):
""" Write out a `type` definition entry. """
self.write(b"\x60") # form
self.write_vu32(len(type_definition.params)) # params
for _, paramtype in type_definition.params:
self.write_type(paramtype)
self.write_vu1(len(... | [
"def",
"write_type_definition",
"(",
"self",
",",
"type_definition",
")",
":",
"self",
".",
"write",
"(",
"b\"\\x60\"",
")",
"# form",
"self",
".",
"write_vu32",
"(",
"len",
"(",
"type_definition",
".",
"params",
")",
")",
"# params",
"for",
"_",
",",
"par... | https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/wasm/binary/writer.py#L228-L236 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/contrib/gis/gdal/geomtype.py | python | OGRGeomType.__ne__ | (self, other) | return not (self == other) | [] | def __ne__(self, other):
return not (self == other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
"==",
"other",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/gis/gdal/geomtype.py#L71-L72 | |||
HypothesisWorks/hypothesis | d1bfc4acc86899caa7a40f892322e1a69fbf36f4 | hypothesis-python/src/hypothesis/core.py | python | seed | (seed: Hashable) | return accept | seed: Start the test execution from a specific seed.
May be any hashable object. No exact meaning for seed is provided
other than that for a fixed seed value Hypothesis will try the same
actions (insofar as it can given external sources of non-
determinism. e.g. timing and hash randomization).
Ove... | seed: Start the test execution from a specific seed. | [
"seed",
":",
"Start",
"the",
"test",
"execution",
"from",
"a",
"specific",
"seed",
"."
] | def seed(seed: Hashable) -> Callable[[TestFunc], TestFunc]:
"""seed: Start the test execution from a specific seed.
May be any hashable object. No exact meaning for seed is provided
other than that for a fixed seed value Hypothesis will try the same
actions (insofar as it can given external sources of ... | [
"def",
"seed",
"(",
"seed",
":",
"Hashable",
")",
"->",
"Callable",
"[",
"[",
"TestFunc",
"]",
",",
"TestFunc",
"]",
":",
"def",
"accept",
"(",
"test",
")",
":",
"test",
".",
"_hypothesis_internal_use_seed",
"=",
"seed",
"current_settings",
"=",
"getattr",... | https://github.com/HypothesisWorks/hypothesis/blob/d1bfc4acc86899caa7a40f892322e1a69fbf36f4/hypothesis-python/src/hypothesis/core.py#L144-L165 | |
postlund/pyatv | 4ed1f5539f37d86d80272663d1f2ea34a6c41ec4 | pyatv/protocols/dmap/__init__.py | python | DmapAudio.volume_up | (self) | Increase volume by one step. | Increase volume by one step. | [
"Increase",
"volume",
"by",
"one",
"step",
"."
] | async def volume_up(self) -> None:
"""Increase volume by one step."""
await self.apple_tv.ctrl_int_cmd("volumeup") | [
"async",
"def",
"volume_up",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"apple_tv",
".",
"ctrl_int_cmd",
"(",
"\"volumeup\"",
")"
] | https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/protocols/dmap/__init__.py#L562-L564 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/bs4/builder/_html5lib.py | python | Element.getNameTuple | (self) | [] | def getNameTuple(self):
if self.namespace == None:
return namespaces["html"], self.name
else:
return self.namespace, self.name | [
"def",
"getNameTuple",
"(",
"self",
")",
":",
"if",
"self",
".",
"namespace",
"==",
"None",
":",
"return",
"namespaces",
"[",
"\"html\"",
"]",
",",
"self",
".",
"name",
"else",
":",
"return",
"self",
".",
"namespace",
",",
"self",
".",
"name"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/bs4/builder/_html5lib.py#L411-L415 | ||||
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/http_models.py | python | Request.prepare | (self) | return p | Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. | Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. | [
"Constructs",
"a",
":",
"class",
":",
"PreparedRequest",
"<PreparedRequest",
">",
"for",
"transmission",
"and",
"returns",
"it",
"."
] | def prepare(self):
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it."""
p = PreparedRequest()
p.prepare(
method=self.method,
url=self.url,
headers=self.headers,
files=self.files,
data=self.data,... | [
"def",
"prepare",
"(",
"self",
")",
":",
"p",
"=",
"PreparedRequest",
"(",
")",
"p",
".",
"prepare",
"(",
"method",
"=",
"self",
".",
"method",
",",
"url",
"=",
"self",
".",
"url",
",",
"headers",
"=",
"self",
".",
"headers",
",",
"files",
"=",
"... | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/http_models.py#L309-L324 | |
broadinstitute/viral-ngs | e144969e4c57060d53f38a4c3a270e8227feace1 | assembly.py | python | vcf_to_seqs | (vcfIter, chrlens, samples, min_dp=0, major_cutoff=0.5, min_dp_ratio=0.0) | Take a VCF iterator and produce an iterator of chromosome x sample full sequences. | Take a VCF iterator and produce an iterator of chromosome x sample full sequences. | [
"Take",
"a",
"VCF",
"iterator",
"and",
"produce",
"an",
"iterator",
"of",
"chromosome",
"x",
"sample",
"full",
"sequences",
"."
] | def vcf_to_seqs(vcfIter, chrlens, samples, min_dp=0, major_cutoff=0.5, min_dp_ratio=0.0):
''' Take a VCF iterator and produce an iterator of chromosome x sample full sequences.'''
seqs = {}
cur_c = None
for vcfrow in vcfIter:
try:
for c, start, stop, s, alleles in vcfrow_parse_and_ca... | [
"def",
"vcf_to_seqs",
"(",
"vcfIter",
",",
"chrlens",
",",
"samples",
",",
"min_dp",
"=",
"0",
",",
"major_cutoff",
"=",
"0.5",
",",
"min_dp_ratio",
"=",
"0.0",
")",
":",
"seqs",
"=",
"{",
"}",
"cur_c",
"=",
"None",
"for",
"vcfrow",
"in",
"vcfIter",
... | https://github.com/broadinstitute/viral-ngs/blob/e144969e4c57060d53f38a4c3a270e8227feace1/assembly.py#L1437-L1480 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/encodings/utf_8_sig.py | python | StreamReader.decode | (self, input, errors='strict') | return codecs.utf_8_decode(input, errors) | [] | def decode(self, input, errors='strict'):
if len(input) < 3:
if codecs.BOM_UTF8.startswith(input):
# not enough data to decide if this is a BOM
# => try again on the next call
return ("", 0)
elif input[:3] == codecs.BOM_UTF8:
self.d... | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"if",
"len",
"(",
"input",
")",
"<",
"3",
":",
"if",
"codecs",
".",
"BOM_UTF8",
".",
"startswith",
"(",
"input",
")",
":",
"# not enough data to decide if this is a BOM",... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/utf_8_sig.py#L105-L117 | |||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | XLMWithLMHeadModel.forward | (self, *args, **kwargs) | [] | def forward(self, *args, **kwargs):
requires_backends(self, ["torch"]) | [
"def",
"forward",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L5338-L5339 | ||||
ray-project/ray | 703c1610348615dcb8c2d141a0c46675084660f5 | python/ray/cluster_utils.py | python | Cluster.list_all_nodes | (self) | return nodes | Lists all nodes.
TODO(rliaw): What is the desired behavior if a head node
dies before worker nodes die?
Returns:
List of all nodes, including the head node. | Lists all nodes. | [
"Lists",
"all",
"nodes",
"."
] | def list_all_nodes(self):
"""Lists all nodes.
TODO(rliaw): What is the desired behavior if a head node
dies before worker nodes die?
Returns:
List of all nodes, including the head node.
"""
nodes = list(self.worker_nodes)
if self.head_node:
... | [
"def",
"list_all_nodes",
"(",
"self",
")",
":",
"nodes",
"=",
"list",
"(",
"self",
".",
"worker_nodes",
")",
"if",
"self",
".",
"head_node",
":",
"nodes",
"=",
"[",
"self",
".",
"head_node",
"]",
"+",
"nodes",
"return",
"nodes"
] | https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/cluster_utils.py#L312-L324 | |
pyqtgraph/pyqtgraph | ac3887abfca4e529aac44f022f8e40556a2587b0 | pyqtgraph/parametertree/parameterTypes/file.py | python | _set_filepicker_kwargs | (fileDlg, **kwargs) | Applies a dict of enum/flag kwarg opts to a file dialog | Applies a dict of enum/flag kwarg opts to a file dialog | [
"Applies",
"a",
"dict",
"of",
"enum",
"/",
"flag",
"kwarg",
"opts",
"to",
"a",
"file",
"dialog"
] | def _set_filepicker_kwargs(fileDlg, **kwargs):
"""Applies a dict of enum/flag kwarg opts to a file dialog"""
NO_MATCH = object()
for kk, vv in kwargs.items():
# Convert string or list representations into true flags
# 'fileMode' -> 'FileMode'
formattedName = kk[0].upper() + kk[1:]
# Edge case: "O... | [
"def",
"_set_filepicker_kwargs",
"(",
"fileDlg",
",",
"*",
"*",
"kwargs",
")",
":",
"NO_MATCH",
"=",
"object",
"(",
")",
"for",
"kk",
",",
"vv",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"# Convert string or list representations into true flags",
"# 'fileMode... | https://github.com/pyqtgraph/pyqtgraph/blob/ac3887abfca4e529aac44f022f8e40556a2587b0/pyqtgraph/parametertree/parameterTypes/file.py#L9-L36 | ||
apache/tvm | 6eb4ed813ebcdcd9558f0906a1870db8302ff1e0 | python/tvm/topi/broadcast.py | python | greater | (lhs, rhs) | return _cpp.greater(lhs, rhs) | Compute (lhs>rhs) with auto-broadcasting
Parameters
----------
lhs : tvm.te.Tensor or Expr
The left operand
rhs : tvm.te.Tensor or Expr
The right operand
Returns
-------
ret : tvm.te.Tensor or Expr
Returns Expr if both operands are Expr.
Otherwise returns Te... | Compute (lhs>rhs) with auto-broadcasting | [
"Compute",
"(",
"lhs",
">",
"rhs",
")",
"with",
"auto",
"-",
"broadcasting"
] | def greater(lhs, rhs):
"""Compute (lhs>rhs) with auto-broadcasting
Parameters
----------
lhs : tvm.te.Tensor or Expr
The left operand
rhs : tvm.te.Tensor or Expr
The right operand
Returns
-------
ret : tvm.te.Tensor or Expr
Returns Expr if both operands are Expr... | [
"def",
"greater",
"(",
"lhs",
",",
"rhs",
")",
":",
"return",
"_cpp",
".",
"greater",
"(",
"lhs",
",",
"rhs",
")"
] | https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/topi/broadcast.py#L271-L287 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/computation/engines.py | python | AbstractEngine._evaluate | (self) | Return an evaluated expression.
Parameters
----------
env : Scope
The local and global environment in which to evaluate an
expression.
Notes
-----
Must be implemented by subclasses. | Return an evaluated expression. | [
"Return",
"an",
"evaluated",
"expression",
"."
] | def _evaluate(self):
"""
Return an evaluated expression.
Parameters
----------
env : Scope
The local and global environment in which to evaluate an
expression.
Notes
-----
Must be implemented by subclasses.
"""
pas... | [
"def",
"_evaluate",
"(",
"self",
")",
":",
"pass"
] | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/computation/engines.py#L90-L104 | ||
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/ebooks/rtf2xml/paragraph_def.py | python | ParagraphDef.__write_para_def_beg | (self) | Requires:
nothing
Returns:
nothing
Logic:
Print out the beginning of the pargraph definition tag, and the markers
that let me know when I have reached this tag. (These markers are
used for later parsing.) | Requires:
nothing
Returns:
nothing
Logic:
Print out the beginning of the pargraph definition tag, and the markers
that let me know when I have reached this tag. (These markers are
used for later parsing.) | [
"Requires",
":",
"nothing",
"Returns",
":",
"nothing",
"Logic",
":",
"Print",
"out",
"the",
"beginning",
"of",
"the",
"pargraph",
"definition",
"tag",
"and",
"the",
"markers",
"that",
"let",
"me",
"know",
"when",
"I",
"have",
"reached",
"this",
"tag",
".",... | def __write_para_def_beg(self):
"""
Requires:
nothing
Returns:
nothing
Logic:
Print out the beginning of the pargraph definition tag, and the markers
that let me know when I have reached this tag. (These markers are
used for lat... | [
"def",
"__write_para_def_beg",
"(",
"self",
")",
":",
"self",
".",
"__get_num_of_style",
"(",
")",
"table",
"=",
"self",
".",
"__att_val_dict",
".",
"get",
"(",
"'in-table'",
")",
"if",
"table",
":",
"# del self.__att_val_dict['in-table']",
"self",
".",
"__write... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/rtf2xml/paragraph_def.py#L647-L703 | ||
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/core/enaml_ast.py | python | ASTVisitor.default_visit | (self, node, *args, **kwargs) | The default node visitor method.
This method is invoked when no named visitor method is found
for a given node. This default behavior raises an exception for
the missing handler. Subclasses may reimplement this method for
custom default behavior. | The default node visitor method. | [
"The",
"default",
"node",
"visitor",
"method",
"."
] | def default_visit(self, node, *args, **kwargs):
""" The default node visitor method.
This method is invoked when no named visitor method is found
for a given node. This default behavior raises an exception for
the missing handler. Subclasses may reimplement this method for
custo... | [
"def",
"default_visit",
"(",
"self",
",",
"node",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"\"no visitor found for node of type `%s`\"",
"raise",
"TypeError",
"(",
"msg",
"%",
"type",
"(",
"node",
")",
".",
"__name__",
")"
] | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/enaml_ast.py#L364-L374 | ||
LinkedInAttic/indextank-service | 880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e | storefront/boto/ec2/connection.py | python | EC2Connection.get_all_reserved_instances | (self, reserved_instances_id=None) | return self.get_list('DescribeReservedInstances',
params, [('item', ReservedInstance)]) | Describes Reserved Instance offerings that are available for purchase.
:type reserved_instance_ids: list
:param reserved_instance_ids: A list of the reserved instance ids that will be returned.
If not provided, all reserved instances will be returned.
:rty... | Describes Reserved Instance offerings that are available for purchase. | [
"Describes",
"Reserved",
"Instance",
"offerings",
"that",
"are",
"available",
"for",
"purchase",
"."
] | def get_all_reserved_instances(self, reserved_instances_id=None):
"""
Describes Reserved Instance offerings that are available for purchase.
:type reserved_instance_ids: list
:param reserved_instance_ids: A list of the reserved instance ids that will be returned.
... | [
"def",
"get_all_reserved_instances",
"(",
"self",
",",
"reserved_instances_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"reserved_instances_id",
":",
"self",
".",
"build_list_params",
"(",
"params",
",",
"reserved_instances_id",
",",
"'ReservedInstance... | https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/storefront/boto/ec2/connection.py#L1451-L1466 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/urllib/request.py | python | HTTPPasswordMgrWithDefaultRealm.find_user_password | (self, realm, authuri) | return HTTPPasswordMgr.find_user_password(self, None, authuri) | [] | def find_user_password(self, realm, authuri):
user, password = HTTPPasswordMgr.find_user_password(self, realm,
authuri)
if user is not None:
return user, password
return HTTPPasswordMgr.find_user_password(self, None, authuri... | [
"def",
"find_user_password",
"(",
"self",
",",
"realm",
",",
"authuri",
")",
":",
"user",
",",
"password",
"=",
"HTTPPasswordMgr",
".",
"find_user_password",
"(",
"self",
",",
"realm",
",",
"authuri",
")",
"if",
"user",
"is",
"not",
"None",
":",
"return",
... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/urllib/request.py#L831-L836 | |||
openstack/octavia | 27e5b27d31c695ba72fb6750de2bdafd76e0d7d9 | octavia/api/v2/controllers/quotas.py | python | QuotasController.put | (self, project_id, quotas) | return self._convert_db_to_type(db_quotas, quota_types.QuotaResponse) | Update any or all quotas for a project. | Update any or all quotas for a project. | [
"Update",
"any",
"or",
"all",
"quotas",
"for",
"a",
"project",
"."
] | def put(self, project_id, quotas):
"""Update any or all quotas for a project."""
context = pecan_request.context.get('octavia_context')
if not project_id:
raise exceptions.MissingAPIProjectID()
self._auth_validate_action(context, project_id, constants.RBAC_PUT)
quo... | [
"def",
"put",
"(",
"self",
",",
"project_id",
",",
"quotas",
")",
":",
"context",
"=",
"pecan_request",
".",
"context",
".",
"get",
"(",
"'octavia_context'",
")",
"if",
"not",
"project_id",
":",
"raise",
"exceptions",
".",
"MissingAPIProjectID",
"(",
")",
... | https://github.com/openstack/octavia/blob/27e5b27d31c695ba72fb6750de2bdafd76e0d7d9/octavia/api/v2/controllers/quotas.py#L65-L78 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | docs/developer/.scripts/33_render_status.py | python | render_latest_version_progress | () | return lines | [] | def render_latest_version_progress():
valid_checks = sorted(get_testable_checks())
total_checks = len(valid_checks)
supported_checks = 0
lines = ['## New version support', '', None, '', '??? check "Completed"']
for check in valid_checks:
skip_check = False
with open(get_tox_file(c... | [
"def",
"render_latest_version_progress",
"(",
")",
":",
"valid_checks",
"=",
"sorted",
"(",
"get_testable_checks",
"(",
")",
")",
"total_checks",
"=",
"len",
"(",
"valid_checks",
")",
"supported_checks",
"=",
"0",
"lines",
"=",
"[",
"'## New version support'",
","... | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/docs/developer/.scripts/33_render_status.py#L193-L225 | |||
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/azure_arm.py | python | AzureNodeDriver.ex_get_volume | (self, id) | return self._to_volume(r.object) | Fetch information about a volume.
:param id: The complete resource path to the volume resource.
:type id: ``str``
:return: The StorageVolume object
:rtype: :class:`.StorageVolume` | Fetch information about a volume. | [
"Fetch",
"information",
"about",
"a",
"volume",
"."
] | def ex_get_volume(self, id):
"""
Fetch information about a volume.
:param id: The complete resource path to the volume resource.
:type id: ``str``
:return: The StorageVolume object
:rtype: :class:`.StorageVolume`
"""
r = self.connection.request(id, para... | [
"def",
"ex_get_volume",
"(",
"self",
",",
"id",
")",
":",
"r",
"=",
"self",
".",
"connection",
".",
"request",
"(",
"id",
",",
"params",
"=",
"{",
"\"api-version\"",
":",
"RESOURCE_API_VERSION",
"}",
")",
"return",
"self",
".",
"_to_volume",
"(",
"r",
... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/azure_arm.py#L1779-L1791 | |
traveller59/second.pytorch | 3aba19c9688274f75ebb5e576f65cfe54773c021 | torchplus/train/fastai_optim.py | python | split_bn_bias | (layer_groups) | return split_groups | Split the layers in `layer_groups` into batchnorm (`bn_types`) and non-batchnorm groups. | Split the layers in `layer_groups` into batchnorm (`bn_types`) and non-batchnorm groups. | [
"Split",
"the",
"layers",
"in",
"layer_groups",
"into",
"batchnorm",
"(",
"bn_types",
")",
"and",
"non",
"-",
"batchnorm",
"groups",
"."
] | def split_bn_bias(layer_groups):
"Split the layers in `layer_groups` into batchnorm (`bn_types`) and non-batchnorm groups."
split_groups = []
for l in layer_groups:
l1, l2 = [], []
for c in l.children():
if isinstance(c, bn_types): l2.append(c)
else: l1.append(c)
... | [
"def",
"split_bn_bias",
"(",
"layer_groups",
")",
":",
"split_groups",
"=",
"[",
"]",
"for",
"l",
"in",
"layer_groups",
":",
"l1",
",",
"l2",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"c",
"in",
"l",
".",
"children",
"(",
")",
":",
"if",
"isinstance",
... | https://github.com/traveller59/second.pytorch/blob/3aba19c9688274f75ebb5e576f65cfe54773c021/torchplus/train/fastai_optim.py#L14-L23 | |
modflowpy/flopy | eecd1ad193c5972093c9712e5c4b7a83284f0688 | flopy/mfusg/mfusgwel.py | python | MfUsgWel._get_kper_data | (kper, first, stress_period_data) | return itmp, kper_data | Gets boundary condition stress period data for a given stress period.
Parameters:
----------
kper: int
stress period (base 0)
first : int
First stress period for which stress period data is defined
stress_period_data : Numpy recarray o... | Gets boundary condition stress period data for a given stress period. | [
"Gets",
"boundary",
"condition",
"stress",
"period",
"data",
"for",
"a",
"given",
"stress",
"period",
"."
] | def _get_kper_data(kper, first, stress_period_data):
"""
Gets boundary condition stress period data for a given stress period.
Parameters:
----------
kper: int
stress period (base 0)
first : int
First stress period for which stress... | [
"def",
"_get_kper_data",
"(",
"kper",
",",
"first",
",",
"stress_period_data",
")",
":",
"kpers",
"=",
"list",
"(",
"stress_period_data",
".",
"data",
".",
"keys",
"(",
")",
")",
"# Fill missing early kpers with 0",
"kper_data",
"=",
"None",
"if",
"kper",
"<",... | https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/mfusg/mfusgwel.py#L319-L359 | |
facebookresearch/hgnn | 2a22fdb479996c2318f85ad36d2750a383011773 | gnn/RiemannianGNN.py | python | RiemannianGNN.forward | (self, node_repr, adj_list, weight, mask) | return node_repr | Args:
node_repr: [node_num, embed_size]
node_repr is in Euclidean space.
If node_repr is in hyperbolic space, invoke log_map_zero first.
adj_list: [node_num, max_neighbor] adjacency list
weight: [node_num, max_neighbor] weights of the adjacency list
mask: [node_num, 1] 1 denote real nod... | Args:
node_repr: [node_num, embed_size]
node_repr is in Euclidean space.
If node_repr is in hyperbolic space, invoke log_map_zero first.
adj_list: [node_num, max_neighbor] adjacency list
weight: [node_num, max_neighbor] weights of the adjacency list
mask: [node_num, 1] 1 denote real nod... | [
"Args",
":",
"node_repr",
":",
"[",
"node_num",
"embed_size",
"]",
"node_repr",
"is",
"in",
"Euclidean",
"space",
".",
"If",
"node_repr",
"is",
"in",
"hyperbolic",
"space",
"invoke",
"log_map_zero",
"first",
".",
"adj_list",
":",
"[",
"node_num",
"max_neighbor... | def forward(self, node_repr, adj_list, weight, mask):
"""
Args:
node_repr: [node_num, embed_size]
node_repr is in Euclidean space.
If node_repr is in hyperbolic space, invoke log_map_zero first.
adj_list: [node_num, max_neighbor] adjacency list
weight: [node_num, max_neighbor] weights of ... | [
"def",
"forward",
"(",
"self",
",",
"node_repr",
",",
"adj_list",
",",
"weight",
",",
"mask",
")",
":",
"# split the adjacency list and weights based on edge types",
"adj_list",
",",
"weight",
"=",
"self",
".",
"split_input",
"(",
"adj_list",
",",
"weight",
")",
... | https://github.com/facebookresearch/hgnn/blob/2a22fdb479996c2318f85ad36d2750a383011773/gnn/RiemannianGNN.py#L156-L177 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.