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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CellProfiler/CellProfiler | a90e17e4d258c6f3900238be0f828e0b4bd1b293 | cellprofiler/gui/pipelinelistview.py | python | PipelineListView.iter_list_items | (self) | Iterate over the list items in all list controls
yields a tuple of control, index for each item in
the input and main list controls. | Iterate over the list items in all list controls | [
"Iterate",
"over",
"the",
"list",
"items",
"in",
"all",
"list",
"controls"
] | def iter_list_items(self):
"""Iterate over the list items in all list controls
yields a tuple of control, index for each item in
the input and main list controls.
"""
for ctrl in (self.input_list_ctrl, self.list_ctrl):
for i in range(ctrl.GetItemCount()):
... | [
"def",
"iter_list_items",
"(",
"self",
")",
":",
"for",
"ctrl",
"in",
"(",
"self",
".",
"input_list_ctrl",
",",
"self",
".",
"list_ctrl",
")",
":",
"for",
"i",
"in",
"range",
"(",
"ctrl",
".",
"GetItemCount",
"(",
")",
")",
":",
"yield",
"ctrl",
",",... | https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/pipelinelistview.py#L499-L507 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_vendor/distlib/version.py | python | _match_prefix | (x, y) | return x[n] == '.' | [] | def _match_prefix(x, y):
x = str(x)
y = str(y)
if x == y:
return True
if not x.startswith(y):
return False
n = len(y)
return x[n] == '.' | [
"def",
"_match_prefix",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"str",
"(",
"x",
")",
"y",
"=",
"str",
"(",
"y",
")",
"if",
"x",
"==",
"y",
":",
"return",
"True",
"if",
"not",
"x",
".",
"startswith",
"(",
"y",
")",
":",
"return",
"False",
"... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/distlib/version.py#L284-L292 | |||
tristandeleu/pytorch-meta | d55d89ebd47f340180267106bde3e4b723f23762 | torchmeta/datasets/one_hundred_plants_texture.py | python | create_asset | (root='data', fractions=None, seed=42) | This methods creates the assets of the PlantsTexture dataset. These are the meta-dataset splits from the
original data. Only run this method in case you want to create new assets. Once created, copy the assets to
this directory: torchmeta.datasets.assets.one_hundred_plants_texture. You can also manually change ... | This methods creates the assets of the PlantsTexture dataset. These are the meta-dataset splits from the
original data. Only run this method in case you want to create new assets. Once created, copy the assets to
this directory: torchmeta.datasets.assets.one_hundred_plants_texture. You can also manually change ... | [
"This",
"methods",
"creates",
"the",
"assets",
"of",
"the",
"PlantsTexture",
"dataset",
".",
"These",
"are",
"the",
"meta",
"-",
"dataset",
"splits",
"from",
"the",
"original",
"data",
".",
"Only",
"run",
"this",
"method",
"in",
"case",
"you",
"want",
"to"... | def create_asset(root='data', fractions=None, seed=42):
"""This methods creates the assets of the PlantsTexture dataset. These are the meta-dataset splits from the
original data. Only run this method in case you want to create new assets. Once created, copy the assets to
this directory: torchmeta.datasets.a... | [
"def",
"create_asset",
"(",
"root",
"=",
"'data'",
",",
"fractions",
"=",
"None",
",",
"seed",
"=",
"42",
")",
":",
"# split fractions: train, valid, test",
"if",
"fractions",
"is",
"None",
":",
"fractions",
"=",
"[",
"0.7",
",",
"0.15",
",",
"0.15",
"]",
... | https://github.com/tristandeleu/pytorch-meta/blob/d55d89ebd47f340180267106bde3e4b723f23762/torchmeta/datasets/one_hundred_plants_texture.py#L287-L319 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/werkzeug/middleware/proxy_fix.py | python | ProxyFix.__call__ | (self, environ, start_response) | return self.app(environ, start_response) | Modify the WSGI environ based on the various ``Forwarded``
headers before calling the wrapped application. Store the
original environ values in ``werkzeug.proxy_fix.orig_{key}``. | Modify the WSGI environ based on the various ``Forwarded``
headers before calling the wrapped application. Store the
original environ values in ``werkzeug.proxy_fix.orig_{key}``. | [
"Modify",
"the",
"WSGI",
"environ",
"based",
"on",
"the",
"various",
"Forwarded",
"headers",
"before",
"calling",
"the",
"wrapped",
"application",
".",
"Store",
"the",
"original",
"environ",
"values",
"in",
"werkzeug",
".",
"proxy_fix",
".",
"orig_",
"{",
"key... | def __call__(self, environ, start_response):
"""Modify the WSGI environ based on the various ``Forwarded``
headers before calling the wrapped application. Store the
original environ values in ``werkzeug.proxy_fix.orig_{key}``.
"""
environ_get = environ.get
orig_remote_add... | [
"def",
"__call__",
"(",
"self",
",",
"environ",
",",
"start_response",
")",
":",
"environ_get",
"=",
"environ",
".",
"get",
"orig_remote_addr",
"=",
"environ_get",
"(",
"\"REMOTE_ADDR\"",
")",
"orig_wsgi_url_scheme",
"=",
"environ_get",
"(",
"\"wsgi.url_scheme\"",
... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/werkzeug/middleware/proxy_fix.py#L169-L232 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/stats/_ksstats.py | python | kolmogni | (n, q, cdf=True) | return result | Computes the PPF(or ISF) for the two-sided Kolmogorov-Smirnov distribution.
Parameters
----------
n : integer, array_like
the number of samples
q : float, array_like
Probabilities, float between 0 and 1
cdf : bool, optional
whether to compute the PPF(default=true) or the ISF... | Computes the PPF(or ISF) for the two-sided Kolmogorov-Smirnov distribution. | [
"Computes",
"the",
"PPF",
"(",
"or",
"ISF",
")",
"for",
"the",
"two",
"-",
"sided",
"Kolmogorov",
"-",
"Smirnov",
"distribution",
"."
] | def kolmogni(n, q, cdf=True):
"""Computes the PPF(or ISF) for the two-sided Kolmogorov-Smirnov distribution.
Parameters
----------
n : integer, array_like
the number of samples
q : float, array_like
Probabilities, float between 0 and 1
cdf : bool, optional
whether to com... | [
"def",
"kolmogni",
"(",
"n",
",",
"q",
",",
"cdf",
"=",
"True",
")",
":",
"it",
"=",
"np",
".",
"nditer",
"(",
"[",
"n",
",",
"q",
",",
"cdf",
",",
"None",
"]",
")",
"for",
"_n",
",",
"_q",
",",
"_cdf",
",",
"z",
"in",
"it",
":",
"if",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_ksstats.py#L567-L596 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py | python | _get_tz | (tz) | return zone | for a tz-aware type, return an encoded zone | for a tz-aware type, return an encoded zone | [
"for",
"a",
"tz",
"-",
"aware",
"type",
"return",
"an",
"encoded",
"zone"
] | def _get_tz(tz):
""" for a tz-aware type, return an encoded zone """
zone = tslib.get_timezone(tz)
if zone is None:
zone = tslib.tot_seconds(tz.utcoffset())
return zone | [
"def",
"_get_tz",
"(",
"tz",
")",
":",
"zone",
"=",
"tslib",
".",
"get_timezone",
"(",
"tz",
")",
"if",
"zone",
"is",
"None",
":",
"zone",
"=",
"tslib",
".",
"tot_seconds",
"(",
"tz",
".",
"utcoffset",
"(",
")",
")",
"return",
"zone"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py#L4352-L4357 | |
braincorp/PVM | 3de2683634f372d2ac5aaa8b19e8ff23420d94d1 | PVM_models/demo04_unit.py | python | ExecutionUnit.execute0 | (self) | In this demo a future/predictive encoder is being instantiated to predict a camera image
based on two previous frames. The encoder predicts the signal and its own error on that signal, that is
additional set of units are trying to predict the magnitude of error between the prediction and the signal.
... | In this demo a future/predictive encoder is being instantiated to predict a camera image
based on two previous frames. The encoder predicts the signal and its own error on that signal, that is
additional set of units are trying to predict the magnitude of error between the prediction and the signal.
... | [
"In",
"this",
"demo",
"a",
"future",
"/",
"predictive",
"encoder",
"is",
"being",
"instantiated",
"to",
"predict",
"a",
"camera",
"image",
"based",
"on",
"two",
"previous",
"frames",
".",
"The",
"encoder",
"predicts",
"the",
"signal",
"and",
"its",
"own",
... | def execute0(self):
"""
In this demo a future/predictive encoder is being instantiated to predict a camera image
based on two previous frames. The encoder predicts the signal and its own error on that signal, that is
additional set of units are trying to predict the magnitude of error be... | [
"def",
"execute0",
"(",
"self",
")",
":",
"input00",
"=",
"self",
".",
"yet_previous_array1",
"[",
"self",
".",
"block",
"[",
"0",
"]",
":",
"self",
".",
"block",
"[",
"0",
"]",
"+",
"self",
".",
"block",
"[",
"2",
"]",
",",
"self",
".",
"block",... | https://github.com/braincorp/PVM/blob/3de2683634f372d2ac5aaa8b19e8ff23420d94d1/PVM_models/demo04_unit.py#L92-L123 | ||
ipython/traitlets | 34f596dd03b98434900a7d31c912fc168342bb80 | traitlets/traitlets.py | python | Dict.item_from_string | (self, s) | return {key: value} | Cast a single-key dict from a string.
Evaluated when parsing CLI configuration from a string.
Dicts expect strings of the form key=value.
Returns a one-key dictionary,
which will be merged in :meth:`.from_string_list`. | Cast a single-key dict from a string. | [
"Cast",
"a",
"single",
"-",
"key",
"dict",
"from",
"a",
"string",
"."
] | def item_from_string(self, s):
"""Cast a single-key dict from a string.
Evaluated when parsing CLI configuration from a string.
Dicts expect strings of the form key=value.
Returns a one-key dictionary,
which will be merged in :meth:`.from_string_list`.
"""
if ... | [
"def",
"item_from_string",
"(",
"self",
",",
"s",
")",
":",
"if",
"'='",
"not",
"in",
"s",
":",
"raise",
"TraitError",
"(",
"\"'%s' options must have the form 'key=value', got %s\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"repr",
"(",
"s",
... | https://github.com/ipython/traitlets/blob/34f596dd03b98434900a7d31c912fc168342bb80/traitlets/traitlets.py#L3060-L3086 | |
facebookresearch/votenet | 2f6d6d36ff98d96901182e935afe48ccee82d566 | train.py | python | my_worker_init_fn | (worker_id) | [] | def my_worker_init_fn(worker_id):
np.random.seed(np.random.get_state()[1][0] + worker_id) | [
"def",
"my_worker_init_fn",
"(",
"worker_id",
")",
":",
"np",
".",
"random",
".",
"seed",
"(",
"np",
".",
"random",
".",
"get_state",
"(",
")",
"[",
"1",
"]",
"[",
"0",
"]",
"+",
"worker_id",
")"
] | https://github.com/facebookresearch/votenet/blob/2f6d6d36ff98d96901182e935afe48ccee82d566/train.py#L109-L110 | ||||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/mpl_toolkits/axisartist/axis_artist.py | python | AxisArtist.set_axis_direction | (self, axis_direction) | Adjust the direction, text angle, text alignment of
ticklabels, labels following the matplotlib convention for
the rectangle axes.
The *axis_direction* must be one of [left, right, bottom, top].
===================== ========== ========= ========== ==========
property ... | Adjust the direction, text angle, text alignment of
ticklabels, labels following the matplotlib convention for
the rectangle axes. | [
"Adjust",
"the",
"direction",
"text",
"angle",
"text",
"alignment",
"of",
"ticklabels",
"labels",
"following",
"the",
"matplotlib",
"convention",
"for",
"the",
"rectangle",
"axes",
"."
] | def set_axis_direction(self, axis_direction):
"""
Adjust the direction, text angle, text alignment of
ticklabels, labels following the matplotlib convention for
the rectangle axes.
The *axis_direction* must be one of [left, right, bottom, top].
===================== ... | [
"def",
"set_axis_direction",
"(",
"self",
",",
"axis_direction",
")",
":",
"self",
".",
"major_ticklabels",
".",
"set_axis_direction",
"(",
"axis_direction",
")",
"self",
".",
"label",
".",
"set_axis_direction",
"(",
"axis_direction",
")",
"self",
".",
"_axis_dire... | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/mpl_toolkits/axisartist/axis_artist.py#L678-L712 | ||
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | df/df.py | python | DF.__init__ | (self, other = None) | Initialises as a blank model, ready to be setup and run. Can also act as a copy constructor if you provide an instance of DF as a single parameter. | Initialises as a blank model, ready to be setup and run. Can also act as a copy constructor if you provide an instance of DF as a single parameter. | [
"Initialises",
"as",
"a",
"blank",
"model",
"ready",
"to",
"be",
"setup",
"and",
"run",
".",
"Can",
"also",
"act",
"as",
"a",
"copy",
"constructor",
"if",
"you",
"provide",
"an",
"instance",
"of",
"DF",
"as",
"a",
"single",
"parameter",
"."
] | def __init__(self, other = None):
"""Initialises as a blank model, ready to be setup and run. Can also act as a copy constructor if you provide an instance of DF as a single parameter."""
if isinstance(other, DF):
self.goal = other.goal.clone() if other.goal!=None else None
self.pruner = other.prune... | [
"def",
"__init__",
"(",
"self",
",",
"other",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"DF",
")",
":",
"self",
".",
"goal",
"=",
"other",
".",
"goal",
".",
"clone",
"(",
")",
"if",
"other",
".",
"goal",
"!=",
"None",
"else",
... | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/df/df.py#L36-L67 | ||
Yukinoshita47/Yuki-Chan-The-Auto-Pentest | bea1af4e1d544eadc166f728be2f543ea10af191 | Module/metagoofil/hachoir_parser/parser.py | python | HachoirParser.createMimeType | (self) | return None | Create MIME type (string), eg. "image/png"
If it returns None, "application/octet-stream" is used. | Create MIME type (string), eg. "image/png" | [
"Create",
"MIME",
"type",
"(",
"string",
")",
"eg",
".",
"image",
"/",
"png"
] | def createMimeType(self):
"""
Create MIME type (string), eg. "image/png"
If it returns None, "application/octet-stream" is used.
"""
if "mime" in self.PARSER_TAGS:
return self.PARSER_TAGS["mime"][0]
return None | [
"def",
"createMimeType",
"(",
"self",
")",
":",
"if",
"\"mime\"",
"in",
"self",
".",
"PARSER_TAGS",
":",
"return",
"self",
".",
"PARSER_TAGS",
"[",
"\"mime\"",
"]",
"[",
"0",
"]",
"return",
"None"
] | https://github.com/Yukinoshita47/Yuki-Chan-The-Auto-Pentest/blob/bea1af4e1d544eadc166f728be2f543ea10af191/Module/metagoofil/hachoir_parser/parser.py#L53-L61 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/protocols/present_proof/v2_0/messages/pres_request.py | python | V20PresRequest.attachment | (self, fmt: V20PresFormat.Format = None) | return (
target_format.get_attachment_data(
self.formats,
self.request_presentations_attach,
)
if target_format
else None
) | Return attached presentation request item.
Args:
fmt: format of attachment in list to decode and return | Return attached presentation request item. | [
"Return",
"attached",
"presentation",
"request",
"item",
"."
] | def attachment(self, fmt: V20PresFormat.Format = None) -> dict:
"""
Return attached presentation request item.
Args:
fmt: format of attachment in list to decode and return
"""
target_format = (
fmt
if fmt
else next(
... | [
"def",
"attachment",
"(",
"self",
",",
"fmt",
":",
"V20PresFormat",
".",
"Format",
"=",
"None",
")",
"->",
"dict",
":",
"target_format",
"=",
"(",
"fmt",
"if",
"fmt",
"else",
"next",
"(",
"filter",
"(",
"lambda",
"ff",
":",
"ff",
",",
"[",
"V20PresFo... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/present_proof/v2_0/messages/pres_request.py#L57-L83 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Doc/docutils/parsers/rst/states.py | python | Body.field_marker | (self, match, context, next_state) | return [], next_state, [] | Field list item. | Field list item. | [
"Field",
"list",
"item",
"."
] | def field_marker(self, match, context, next_state):
"""Field list item."""
field_list = nodes.field_list()
self.parent += field_list
field, blank_finish = self.field(match)
field_list += field
offset = self.state_machine.line_offset + 1 # next line
newline_offse... | [
"def",
"field_marker",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"field_list",
"=",
"nodes",
".",
"field_list",
"(",
")",
"self",
".",
"parent",
"+=",
"field_list",
"field",
",",
"blank_finish",
"=",
"self",
".",
"field",
"(... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/docutils/parsers/rst/states.py#L1362-L1377 | |
pyserial/pyserial | 31fa4807d73ed4eb9891a88a15817b439c4eea2d | serial/serialwin32.py | python | Serial.ri | (self) | return win32.MS_RING_ON & self._GetCommModemStatus() != 0 | Read terminal status line: Ring Indicator | Read terminal status line: Ring Indicator | [
"Read",
"terminal",
"status",
"line",
":",
"Ring",
"Indicator"
] | def ri(self):
"""Read terminal status line: Ring Indicator"""
return win32.MS_RING_ON & self._GetCommModemStatus() != 0 | [
"def",
"ri",
"(",
"self",
")",
":",
"return",
"win32",
".",
"MS_RING_ON",
"&",
"self",
".",
"_GetCommModemStatus",
"(",
")",
"!=",
"0"
] | https://github.com/pyserial/pyserial/blob/31fa4807d73ed4eb9891a88a15817b439c4eea2d/serial/serialwin32.py#L407-L409 | |
pychess/pychess | e3f9b12947e429993edcc2b9288f79bc181e6500 | lib/pychess/Players/Player.py | python | Player.offerWithdrawn | (self, offer) | An offer earlier offered to the player has been withdrawn | An offer earlier offered to the player has been withdrawn | [
"An",
"offer",
"earlier",
"offered",
"to",
"the",
"player",
"has",
"been",
"withdrawn"
] | def offerWithdrawn(self, offer):
""" An offer earlier offered to the player has been withdrawn """ | [
"def",
"offerWithdrawn",
"(",
"self",
",",
"offer",
")",
":"
] | https://github.com/pychess/pychess/blob/e3f9b12947e429993edcc2b9288f79bc181e6500/lib/pychess/Players/Player.py#L152-L153 | ||
rdiff-backup/rdiff-backup | 321e0cd6e5e47d4c158a0172e47ab38240a8b653 | src/rdiffbackup/actions/__init__.py | python | BaseAction.__exit__ | (self, exc_type, exc_val, exc_tb) | return False | Context manager interface to exit with-as context.
Returns False to propagate potential exception, else True. | Context manager interface to exit with-as context. | [
"Context",
"manager",
"interface",
"to",
"exit",
"with",
"-",
"as",
"context",
"."
] | def __exit__(self, exc_type, exc_val, exc_tb):
"""
Context manager interface to exit with-as context.
Returns False to propagate potential exception, else True.
"""
log.Log("Cleaning up", log.INFO)
if self.security != "server":
log.ErrorLog.close()
... | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_val",
",",
"exc_tb",
")",
":",
"log",
".",
"Log",
"(",
"\"Cleaning up\"",
",",
"log",
".",
"INFO",
")",
"if",
"self",
".",
"security",
"!=",
"\"server\"",
":",
"log",
".",
"ErrorLog",
".",
"c... | https://github.com/rdiff-backup/rdiff-backup/blob/321e0cd6e5e47d4c158a0172e47ab38240a8b653/src/rdiffbackup/actions/__init__.py#L383-L395 | |
cookiecutter/cookiecutter | 0b406256d2c0aa728f860692d57f49c0d2beb39d | cookiecutter/utils.py | python | prompt_and_delete | (path, no_input=False) | Ask user if it's okay to delete the previously-downloaded file/directory.
If yes, delete it. If no, checks to see if the old version should be
reused. If yes, it's reused; otherwise, Cookiecutter exits.
:param path: Previously downloaded zipfile.
:param no_input: Suppress prompt to delete repo and jus... | Ask user if it's okay to delete the previously-downloaded file/directory. | [
"Ask",
"user",
"if",
"it",
"s",
"okay",
"to",
"delete",
"the",
"previously",
"-",
"downloaded",
"file",
"/",
"directory",
"."
] | def prompt_and_delete(path, no_input=False):
"""
Ask user if it's okay to delete the previously-downloaded file/directory.
If yes, delete it. If no, checks to see if the old version should be
reused. If yes, it's reused; otherwise, Cookiecutter exits.
:param path: Previously downloaded zipfile.
... | [
"def",
"prompt_and_delete",
"(",
"path",
",",
"no_input",
"=",
"False",
")",
":",
"# Suppress prompt if called via API",
"if",
"no_input",
":",
"ok_to_delete",
"=",
"True",
"else",
":",
"question",
"=",
"(",
"\"You've downloaded {} before. Is it okay to delete and re-down... | https://github.com/cookiecutter/cookiecutter/blob/0b406256d2c0aa728f860692d57f49c0d2beb39d/cookiecutter/utils.py#L72-L107 | ||
yadayada/acd_cli | cd4a9eea52f1740aa8de10d8c75ab2f6c17de52b | acdcli/api/content.py | python | ContentMixin.download_file | (self, node_id: str, basename: str, dirname: str = None, **kwargs) | Deals with download preparation, download with :func:`chunked_download` and finish.
Calls callbacks while fast forwarding through incomplete file (if existent).
Will not check for existing file prior to download and overwrite existing file on finish.
:param dirname: a valid local directory name... | Deals with download preparation, download with :func:`chunked_download` and finish.
Calls callbacks while fast forwarding through incomplete file (if existent).
Will not check for existing file prior to download and overwrite existing file on finish. | [
"Deals",
"with",
"download",
"preparation",
"download",
"with",
":",
"func",
":",
"chunked_download",
"and",
"finish",
".",
"Calls",
"callbacks",
"while",
"fast",
"forwarding",
"through",
"incomplete",
"file",
"(",
"if",
"existent",
")",
".",
"Will",
"not",
"c... | def download_file(self, node_id: str, basename: str, dirname: str = None, **kwargs):
"""Deals with download preparation, download with :func:`chunked_download` and finish.
Calls callbacks while fast forwarding through incomplete file (if existent).
Will not check for existing file prior to downl... | [
"def",
"download_file",
"(",
"self",
",",
"node_id",
":",
"str",
",",
"basename",
":",
"str",
",",
"dirname",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"chunk_sz",
"=",
"self",
".",
"_conf",
".",
"getint",
"(",
"'transfer'",
",",
... | https://github.com/yadayada/acd_cli/blob/cd4a9eea52f1740aa8de10d8c75ab2f6c17de52b/acdcli/api/content.py#L233-L288 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/lib/request/inject.py | python | _goUnion | (expression, unpack=True, dump=False) | return output | Retrieve the output of a SQL query taking advantage of an union SQL
injection vulnerability on the affected parameter. | Retrieve the output of a SQL query taking advantage of an union SQL
injection vulnerability on the affected parameter. | [
"Retrieve",
"the",
"output",
"of",
"a",
"SQL",
"query",
"taking",
"advantage",
"of",
"an",
"union",
"SQL",
"injection",
"vulnerability",
"on",
"the",
"affected",
"parameter",
"."
] | def _goUnion(expression, unpack=True, dump=False):
"""
Retrieve the output of a SQL query taking advantage of an union SQL
injection vulnerability on the affected parameter.
"""
output = unionUse(expression, unpack=unpack, dump=dump)
if isinstance(output, basestring):
output = parseUni... | [
"def",
"_goUnion",
"(",
"expression",
",",
"unpack",
"=",
"True",
",",
"dump",
"=",
"False",
")",
":",
"output",
"=",
"unionUse",
"(",
"expression",
",",
"unpack",
"=",
"unpack",
",",
"dump",
"=",
"dump",
")",
"if",
"isinstance",
"(",
"output",
",",
... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/lib/request/inject.py#L323-L334 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/apis/rbac_authorization_v1beta1_api.py | python | RbacAuthorizationV1beta1Api.list_role_for_all_namespaces_with_http_info | (self, **kwargs) | return self.api_client.call_api(resource_path, 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_p... | list or watch objects of kind Role
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>... | list or watch objects of kind Role
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>... | [
"list",
"or",
"watch",
"objects",
"of",
"kind",
"Role",
"This",
"method",
"makes",
"a",
"synchronous",
"HTTP",
"request",
"by",
"default",
".",
"To",
"make",
"an",
"asynchronous",
"HTTP",
"request",
"please",
"define",
"a",
"callback",
"function",
"to",
"be"... | def list_role_for_all_namespaces_with_http_info(self, **kwargs):
"""
list or watch objects of kind Role
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
... | [
"def",
"list_role_for_all_namespaces_with_http_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"all_params",
"=",
"[",
"'field_selector'",
",",
"'include_uninitialized'",
",",
"'label_selector'",
",",
"'pretty'",
",",
"'resource_version'",
",",
"'timeout_seconds'... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/rbac_authorization_v1beta1_api.py#L2309-L2402 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/paddleseg/models/dnlnet.py | python | DisentangledNonLocal2D.__init__ | (self, temperature, *arg, **kwargs) | [] | def __init__(self, temperature, *arg, **kwargs):
super().__init__(*arg, **kwargs)
self.temperature = temperature
self.conv_mask = nn.Conv2D(self.in_channels, 1, kernel_size=1) | [
"def",
"__init__",
"(",
"self",
",",
"temperature",
",",
"*",
"arg",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"arg",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"temperature",
"=",
"temperature",
"self",
".",
... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/paddleseg/models/dnlnet.py#L180-L183 | ||||
ansible/ansible | 4676c08f188fb5dca98df61630c76dba1f0d2d77 | lib/ansible/module_utils/six/__init__.py | python | add_metaclass | (metaclass) | return wrapper | Class decorator for creating a class with a metaclass. | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slo... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
"(",
"'__slots__'",
")",
"if",
"slots",
"is",
"not",
"... | https://github.com/ansible/ansible/blob/4676c08f188fb5dca98df61630c76dba1f0d2d77/lib/ansible/module_utils/six/__init__.py#L891-L906 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/common/datastore/file.py | python | NotificationObject.uid | (self) | return self._uid | [] | def uid(self):
return self._uid | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
".",
"_uid"
] | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/common/datastore/file.py#L1558-L1559 | |||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/MacOSX/i386/ucs2/cryptography/x509/base.py | python | CertificateRevocationListBuilder.add_revoked_certificate | (self, revoked_certificate) | return CertificateRevocationListBuilder(
self._issuer_name, self._last_update,
self._next_update, self._extensions,
self._revoked_certificates + [revoked_certificate]
) | Adds a revoked certificate to the CRL. | Adds a revoked certificate to the CRL. | [
"Adds",
"a",
"revoked",
"certificate",
"to",
"the",
"CRL",
"."
] | def add_revoked_certificate(self, revoked_certificate):
"""
Adds a revoked certificate to the CRL.
"""
if not isinstance(revoked_certificate, RevokedCertificate):
raise TypeError("Must be an instance of RevokedCertificate")
return CertificateRevocationListBuilder(
... | [
"def",
"add_revoked_certificate",
"(",
"self",
",",
"revoked_certificate",
")",
":",
"if",
"not",
"isinstance",
"(",
"revoked_certificate",
",",
"RevokedCertificate",
")",
":",
"raise",
"TypeError",
"(",
"\"Must be an instance of RevokedCertificate\"",
")",
"return",
"C... | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/MacOSX/i386/ucs2/cryptography/x509/base.py#L621-L632 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/email/_encoded_words.py | python | decode | (ew) | return string, charset, lang, defects | Decode encoded word and return (string, charset, lang, defects) tuple.
An RFC 2047/2243 encoded word has the form:
=?charset*lang?cte?encoded_string?=
where '*lang' may be omitted but the other parts may not be.
This function expects exactly such a string (that is, it does not check the
synt... | Decode encoded word and return (string, charset, lang, defects) tuple. | [
"Decode",
"encoded",
"word",
"and",
"return",
"(",
"string",
"charset",
"lang",
"defects",
")",
"tuple",
"."
] | def decode(ew):
"""Decode encoded word and return (string, charset, lang, defects) tuple.
An RFC 2047/2243 encoded word has the form:
=?charset*lang?cte?encoded_string?=
where '*lang' may be omitted but the other parts may not be.
This function expects exactly such a string (that is, it does... | [
"def",
"decode",
"(",
"ew",
")",
":",
"_",
",",
"charset",
",",
"cte",
",",
"cte_string",
",",
"_",
"=",
"ew",
".",
"split",
"(",
"'?'",
")",
"charset",
",",
"_",
",",
"lang",
"=",
"charset",
".",
"partition",
"(",
"'*'",
")",
"cte",
"=",
"cte"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/email/_encoded_words.py#L140-L179 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | code/default/lib/noarch/hyper/packages/hpack/hpack.py | python | Encoder._encode_indexed | (self, index) | return bytes(field) | Encodes a header using the indexed representation. | Encodes a header using the indexed representation. | [
"Encodes",
"a",
"header",
"using",
"the",
"indexed",
"representation",
"."
] | def _encode_indexed(self, index):
"""
Encodes a header using the indexed representation.
"""
field = encode_integer(index, 7)
field[0] |= 0x80 # we set the top bit
return bytes(field) | [
"def",
"_encode_indexed",
"(",
"self",
",",
"index",
")",
":",
"field",
"=",
"encode_integer",
"(",
"index",
",",
"7",
")",
"field",
"[",
"0",
"]",
"|=",
"0x80",
"# we set the top bit",
"return",
"bytes",
"(",
"field",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/code/default/lib/noarch/hyper/packages/hpack/hpack.py#L311-L317 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | cinsnptrvec_t.pop_back | (self, *args) | return _idaapi.cinsnptrvec_t_pop_back(self, *args) | pop_back(self) | pop_back(self) | [
"pop_back",
"(",
"self",
")"
] | def pop_back(self, *args):
"""
pop_back(self)
"""
return _idaapi.cinsnptrvec_t_pop_back(self, *args) | [
"def",
"pop_back",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"cinsnptrvec_t_pop_back",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L33797-L33801 | |
elastic/elasticsearch-py | 6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb | elasticsearch/_async/client/security.py | python | SecurityClient.create_service_token | (
self,
*,
namespace: Any,
service: Any,
name: Any,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
) | return await self._perform_request(__method, __target, headers=__headers) | Creates a service account token for access without requiring basic authentication.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html>`_
:param namespace: An identifier for the namespace
:param service: An identifier for the service name
... | Creates a service account token for access without requiring basic authentication. | [
"Creates",
"a",
"service",
"account",
"token",
"for",
"access",
"without",
"requiring",
"basic",
"authentication",
"."
] | async def create_service_token(
self,
*,
namespace: Any,
service: Any,
name: Any,
error_trace: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
human: Optional[bool] = None,
pretty: Optional[bool] = None,
) -> ObjectA... | [
"async",
"def",
"create_service_token",
"(",
"self",
",",
"*",
",",
"namespace",
":",
"Any",
",",
"service",
":",
"Any",
",",
"name",
":",
"Any",
",",
"error_trace",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"filter_path",
":",
"Optional",
"... | https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_async/client/security.py#L379-L431 | |
ghtmtt/DataPlotly | 6c4b6d55335a007eeb6a01ce5d1211b32098c7ec | DataPlotly/gui/layout_item_gui.py | python | PlotLayoutItemWidget.duplicate_plot | (self) | Duplicates an existing plot and updates the plot list and the plot item | Duplicates an existing plot and updates the plot list and the plot item | [
"Duplicates",
"an",
"existing",
"plot",
"and",
"updates",
"the",
"plot",
"list",
"and",
"the",
"plot",
"item"
] | def duplicate_plot(self):
"""
Duplicates an existing plot and updates the plot list and the plot item
"""
selected_plot_index = self.plot_list.currentRow()
if selected_plot_index < 0:
return
self.plot_item.duplicate_plot(selected_plot_index)
self.po... | [
"def",
"duplicate_plot",
"(",
"self",
")",
":",
"selected_plot_index",
"=",
"self",
".",
"plot_list",
".",
"currentRow",
"(",
")",
"if",
"selected_plot_index",
"<",
"0",
":",
"return",
"self",
".",
"plot_item",
".",
"duplicate_plot",
"(",
"selected_plot_index",
... | https://github.com/ghtmtt/DataPlotly/blob/6c4b6d55335a007eeb6a01ce5d1211b32098c7ec/DataPlotly/gui/layout_item_gui.py#L118-L129 | ||
veusz/veusz | 5a1e2af5f24df0eb2a2842be51f2997c4999c7fb | veusz/windows/simplewindow.py | python | SimpleWindow.setZoom | (self, zoom) | Zoom(zoom)
Set the plot zoom level:
This is a number to for the zoom from 1:1 or
'page': zoom to page
'width': zoom to fit width
'height': zoom to fit height | Zoom(zoom) | [
"Zoom",
"(",
"zoom",
")"
] | def setZoom(self, zoom):
"""Zoom(zoom)
Set the plot zoom level:
This is a number to for the zoom from 1:1 or
'page': zoom to page
'width': zoom to fit width
'height': zoom to fit height
"""
if zoom == 'page':
self.plot.slotViewZoomPage()
... | [
"def",
"setZoom",
"(",
"self",
",",
"zoom",
")",
":",
"if",
"zoom",
"==",
"'page'",
":",
"self",
".",
"plot",
".",
"slotViewZoomPage",
"(",
")",
"elif",
"zoom",
"==",
"'width'",
":",
"self",
".",
"plot",
".",
"slotViewZoomWidth",
"(",
")",
"elif",
"z... | https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/windows/simplewindow.py#L57-L73 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/html5lib/inputstream.py | python | HTMLBinaryInputStream.openStream | (self, source) | return stream | Produces a file object from source.
source can be either a file object, local filename or a string. | Produces a file object from source. | [
"Produces",
"a",
"file",
"object",
"from",
"source",
"."
] | def openStream(self, source):
"""Produces a file object from source.
source can be either a file object, local filename or a string.
"""
# Already a file object
if hasattr(source, 'read'):
stream = source
else:
stream = BytesIO(source)
t... | [
"def",
"openStream",
"(",
"self",
",",
"source",
")",
":",
"# Already a file object",
"if",
"hasattr",
"(",
"source",
",",
"'read'",
")",
":",
"stream",
"=",
"source",
"else",
":",
"stream",
"=",
"BytesIO",
"(",
"source",
")",
"try",
":",
"stream",
".",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/html5lib/inputstream.py#L443-L460 | |
jazzband/django-ddp | 1e1954b06fe140346acea43582515991685e4e01 | dddp/__init__.py | python | MeteorError.__init__ | (self, error, reason=None, details=None, **kwargs) | MeteorError constructor. | MeteorError constructor. | [
"MeteorError",
"constructor",
"."
] | def __init__(self, error, reason=None, details=None, **kwargs):
"""MeteorError constructor."""
super(MeteorError, self).__init__(error, reason, details, kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"error",
",",
"reason",
"=",
"None",
",",
"details",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"MeteorError",
",",
"self",
")",
".",
"__init__",
"(",
"error",
",",
"reason",
",",
"details",
"... | https://github.com/jazzband/django-ddp/blob/1e1954b06fe140346acea43582515991685e4e01/dddp/__init__.py#L65-L67 | ||
carla-simulator/ros-bridge | dac9e729b70a3db9da665c1fdb843e96e7e25d04 | carla_waypoint_publisher/src/carla_waypoint_publisher/carla_waypoint_publisher.py | python | main | (args=None) | main function | main function | [
"main",
"function"
] | def main(args=None):
"""
main function
"""
roscomp.init('carla_waypoint_publisher', args)
waypoint_converter = None
try:
waypoint_converter = CarlaToRosWaypointConverter()
waypoint_converter.spin()
except (RuntimeError, ROSException):
pass
except KeyboardInterrup... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"roscomp",
".",
"init",
"(",
"'carla_waypoint_publisher'",
",",
"args",
")",
"waypoint_converter",
"=",
"None",
"try",
":",
"waypoint_converter",
"=",
"CarlaToRosWaypointConverter",
"(",
")",
"waypoint_converter",... | https://github.com/carla-simulator/ros-bridge/blob/dac9e729b70a3db9da665c1fdb843e96e7e25d04/carla_waypoint_publisher/src/carla_waypoint_publisher/carla_waypoint_publisher.py#L261-L279 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_endpoints_list.py | python | V1EndpointsList.__eq__ | (self, other) | return self.__dict__ == other.__dict__ | Returns true if both objects are equal | Returns true if both objects are equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"equal"
] | def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, V1EndpointsList):
return False
return self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1EndpointsList",
")",
":",
"return",
"False",
"return",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_endpoints_list.py#L184-L191 | |
researchmm/TracKit | 510e240faf71b4a225d6f18bcf49b3eebf8b436e | lib/online/operation.py | python | conv2d | (input: torch.Tensor, weight: torch.Tensor, bias: torch.Tensor = None, stride=1, padding=0, dilation=1, groups=1, mode=None) | return out[:,:,ind[0],ind[1]] | Standard conv2d. Returns the input if weight=None. | Standard conv2d. Returns the input if weight=None. | [
"Standard",
"conv2d",
".",
"Returns",
"the",
"input",
"if",
"weight",
"=",
"None",
"."
] | def conv2d(input: torch.Tensor, weight: torch.Tensor, bias: torch.Tensor = None, stride=1, padding=0, dilation=1, groups=1, mode=None):
"""Standard conv2d. Returns the input if weight=None."""
if weight is None:
return input
ind = None
if mode is not None:
if padding != 0:
... | [
"def",
"conv2d",
"(",
"input",
":",
"torch",
".",
"Tensor",
",",
"weight",
":",
"torch",
".",
"Tensor",
",",
"bias",
":",
"torch",
".",
"Tensor",
"=",
"None",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"0",
",",
"dilation",
"=",
"1",
",",
"gro... | https://github.com/researchmm/TracKit/blob/510e240faf71b4a225d6f18bcf49b3eebf8b436e/lib/online/operation.py#L7-L32 | |
dmroeder/pylogix | bb7649236ff1dd411ef02a098a5f773f7d709c8e | pylogix/lgx_comm.py | python | Connection.close | (self) | Close the connection | Close the connection | [
"Close",
"the",
"connection"
] | def close(self):
"""
Close the connection
"""
self._closeConnection() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_closeConnection",
"(",
")"
] | https://github.com/dmroeder/pylogix/blob/bb7649236ff1dd411ef02a098a5f773f7d709c8e/pylogix/lgx_comm.py#L67-L71 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/idlelib/configDialog.py | python | ConfigDialog.VarChanged_keysAreBuiltin | (self, *params) | [] | def VarChanged_keysAreBuiltin(self, *params):
value = self.keysAreBuiltin.get()
self.AddChangedItem('main', 'Keys', 'default', value)
if value:
self.VarChanged_builtinKeys()
else:
self.VarChanged_customKeys() | [
"def",
"VarChanged_keysAreBuiltin",
"(",
"self",
",",
"*",
"params",
")",
":",
"value",
"=",
"self",
".",
"keysAreBuiltin",
".",
"get",
"(",
")",
"self",
".",
"AddChangedItem",
"(",
"'main'",
",",
"'Keys'",
",",
"'default'",
",",
"value",
")",
"if",
"val... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/configDialog.py#L586-L592 | ||||
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | mmf/utils/m4c_evaluators.py | python | TextVQAAccuracyEvaluator.__init__ | (self) | [] | def __init__(self):
self.answer_processor = EvalAIAnswerProcessor() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"answer_processor",
"=",
"EvalAIAnswerProcessor",
"(",
")"
] | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/utils/m4c_evaluators.py#L220-L221 | ||||
rcorcs/NatI | fdf014f4292afdc95250add7b6658468043228e1 | en/parser/nltk_lite/parse/tree.py | python | Tree.pp | (self, margin=70, indent=0, nodesep=':', parens='()', quotes=True) | return s+parens[1] | @return: A pretty-printed string representation of this tree.
@rtype: C{string}
@param margin: The right margin at which to do line-wrapping.
@type margin: C{int}
@param indent: The indentation level at which printing
begins. This number is used to decide how far to indent
... | [] | def pp(self, margin=70, indent=0, nodesep=':', parens='()', quotes=True):
"""
@return: A pretty-printed string representation of this tree.
@rtype: C{string}
@param margin: The right margin at which to do line-wrapping.
@type margin: C{int}
@param indent: The indentation ... | [
"def",
"pp",
"(",
"self",
",",
"margin",
"=",
"70",
",",
"indent",
"=",
"0",
",",
"nodesep",
"=",
"':'",
",",
"parens",
"=",
"'()'",
",",
"quotes",
"=",
"True",
")",
":",
"# Try writing it on one line.",
"s",
"=",
"self",
".",
"_ppflat",
"(",
"nodese... | https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/parser/nltk_lite/parse/tree.py#L297-L325 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/legacy/detection/evaluation/coco_utils.py | python | generate_annotation_file | (groundtruth_generator,
annotation_file) | Generates COCO-style annotation JSON file given a groundtruth generator. | Generates COCO-style annotation JSON file given a groundtruth generator. | [
"Generates",
"COCO",
"-",
"style",
"annotation",
"JSON",
"file",
"given",
"a",
"groundtruth",
"generator",
"."
] | def generate_annotation_file(groundtruth_generator,
annotation_file):
"""Generates COCO-style annotation JSON file given a groundtruth generator."""
groundtruths = {}
logging.info('Loading groundtruth annotations from dataset to memory...')
for groundtruth in groundtruth_generator()... | [
"def",
"generate_annotation_file",
"(",
"groundtruth_generator",
",",
"annotation_file",
")",
":",
"groundtruths",
"=",
"{",
"}",
"logging",
".",
"info",
"(",
"'Loading groundtruth annotations from dataset to memory...'",
")",
"for",
"groundtruth",
"in",
"groundtruth_genera... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/legacy/detection/evaluation/coco_utils.py#L358-L374 | ||
wakatime/komodo-wakatime | 8923c04ded9fa64d7374fadd8cde3a6fadfe053d | components/wakatime/packages/requests/sessions.py | python | Session.mount | (self, prefix, adapter) | Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length. | Registers a connection adapter to a prefix. | [
"Registers",
"a",
"connection",
"adapter",
"to",
"a",
"prefix",
"."
] | def mount(self, prefix, adapter):
"""Registers a connection adapter to a prefix.
Adapters are sorted in descending order by prefix length.
"""
self.adapters[prefix] = adapter
keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
for key in keys_to_move:
... | [
"def",
"mount",
"(",
"self",
",",
"prefix",
",",
"adapter",
")",
":",
"self",
".",
"adapters",
"[",
"prefix",
"]",
"=",
"adapter",
"keys_to_move",
"=",
"[",
"k",
"for",
"k",
"in",
"self",
".",
"adapters",
"if",
"len",
"(",
"k",
")",
"<",
"len",
"... | https://github.com/wakatime/komodo-wakatime/blob/8923c04ded9fa64d7374fadd8cde3a6fadfe053d/components/wakatime/packages/requests/sessions.py#L710-L719 | ||
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/tools/datagrid/__init__.py | python | initialize_datagrid | (trans_id, cmd_type, obj_type, sgid, sid, did, obj_id) | return make_json_response(
data={
'conn_id': conn_id
}
) | This method is responsible for creating an asynchronous connection.
After creating the connection it will instantiate and initialize
the object as per the object type. It will also create a unique
transaction id and store the information into session variable.
Args:
cmd_type: Contains value for... | This method is responsible for creating an asynchronous connection.
After creating the connection it will instantiate and initialize
the object as per the object type. It will also create a unique
transaction id and store the information into session variable. | [
"This",
"method",
"is",
"responsible",
"for",
"creating",
"an",
"asynchronous",
"connection",
".",
"After",
"creating",
"the",
"connection",
"it",
"will",
"instantiate",
"and",
"initialize",
"the",
"object",
"as",
"per",
"the",
"object",
"type",
".",
"It",
"wi... | def initialize_datagrid(trans_id, cmd_type, obj_type, sgid, sid, did, obj_id):
"""
This method is responsible for creating an asynchronous connection.
After creating the connection it will instantiate and initialize
the object as per the object type. It will also create a unique
transaction id and s... | [
"def",
"initialize_datagrid",
"(",
"trans_id",
",",
"cmd_type",
",",
"obj_type",
",",
"sgid",
",",
"sid",
",",
"did",
",",
"obj_id",
")",
":",
"if",
"request",
".",
"data",
":",
"filter_sql",
"=",
"json",
".",
"loads",
"(",
"request",
".",
"data",
",",... | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/tools/datagrid/__init__.py#L129-L213 | |
openstack/trove | be86b79119d16ee77f596172f43b0c97cb2617bd | trove/backup/models.py | python | Backup.create | (cls, context, instance, name, description=None,
parent_id=None, incremental=False, swift_container=None,
restore_from=None) | return run_with_quotas(context.project_id, {'backups': 1},
_create_resources) | create db record for Backup
:param cls:
:param context: tenant_id included
:param instance:
:param name:
:param description:
:param parent_id:
:param incremental: flag to indicate incremental backup
based on previous backup
:par... | create db record for Backup
:param cls:
:param context: tenant_id included
:param instance:
:param name:
:param description:
:param parent_id:
:param incremental: flag to indicate incremental backup
based on previous backup
:par... | [
"create",
"db",
"record",
"for",
"Backup",
":",
"param",
"cls",
":",
":",
"param",
"context",
":",
"tenant_id",
"included",
":",
"param",
"instance",
":",
":",
"param",
"name",
":",
":",
"param",
"description",
":",
":",
"param",
"parent_id",
":",
":",
... | def create(cls, context, instance, name, description=None,
parent_id=None, incremental=False, swift_container=None,
restore_from=None):
"""
create db record for Backup
:param cls:
:param context: tenant_id included
:param instance:
:param nam... | [
"def",
"create",
"(",
"cls",
",",
"context",
",",
"instance",
",",
"name",
",",
"description",
"=",
"None",
",",
"parent_id",
"=",
"None",
",",
"incremental",
"=",
"False",
",",
"swift_container",
"=",
"None",
",",
"restore_from",
"=",
"None",
")",
":",
... | https://github.com/openstack/trove/blob/be86b79119d16ee77f596172f43b0c97cb2617bd/trove/backup/models.py#L53-L183 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/tkinter/tix.py | python | Tk.destroy | (self) | [] | def destroy(self):
# For safety, remove an delete_window binding before destroy
self.protocol("WM_DELETE_WINDOW", "")
tkinter.Tk.destroy(self) | [
"def",
"destroy",
"(",
"self",
")",
":",
"# For safety, remove an delete_window binding before destroy",
"self",
".",
"protocol",
"(",
"\"WM_DELETE_WINDOW\"",
",",
"\"\"",
")",
"tkinter",
".",
"Tk",
".",
"destroy",
"(",
"self",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/tix.py#L227-L230 | ||||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/apis/core_v1_api.py | python | CoreV1Api.connect_delete_namespaced_pod_proxy_with_path_with_http_info | (self, name, namespace, path, **kwargs) | return self.api_client.call_api(resource_path, 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
pos... | connect DELETE requests to proxy of Pod
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
... | connect DELETE requests to proxy of Pod
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
... | [
"connect",
"DELETE",
"requests",
"to",
"proxy",
"of",
"Pod",
"This",
"method",
"makes",
"a",
"synchronous",
"HTTP",
"request",
"by",
"default",
".",
"To",
"make",
"an",
"asynchronous",
"HTTP",
"request",
"please",
"define",
"a",
"callback",
"function",
"to",
... | def connect_delete_namespaced_pod_proxy_with_path_with_http_info(self, name, namespace, path, **kwargs):
"""
connect DELETE requests to proxy of Pod
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
... | [
"def",
"connect_delete_namespaced_pod_proxy_with_path_with_http_info",
"(",
"self",
",",
"name",
",",
"namespace",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"all_params",
"=",
"[",
"'name'",
",",
"'namespace'",
",",
"'path'",
",",
"'path2'",
"]",
"all_para... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/core_v1_api.py#L187-L280 | |
traveller59/second.pytorch | 3aba19c9688274f75ebb5e576f65cfe54773c021 | second/core/preprocess.py | python | filter_gt_box_outside_range | (gt_boxes, limit_range) | return np.any(ret.reshape(-1, 4), axis=1) | remove gtbox outside training range.
this function should be applied after other prep functions
Args:
gt_boxes ([type]): [description]
limit_range ([type]): [description] | remove gtbox outside training range.
this function should be applied after other prep functions
Args:
gt_boxes ([type]): [description]
limit_range ([type]): [description] | [
"remove",
"gtbox",
"outside",
"training",
"range",
".",
"this",
"function",
"should",
"be",
"applied",
"after",
"other",
"prep",
"functions",
"Args",
":",
"gt_boxes",
"(",
"[",
"type",
"]",
")",
":",
"[",
"description",
"]",
"limit_range",
"(",
"[",
"type"... | def filter_gt_box_outside_range(gt_boxes, limit_range):
"""remove gtbox outside training range.
this function should be applied after other prep functions
Args:
gt_boxes ([type]): [description]
limit_range ([type]): [description]
"""
gt_boxes_bv = box_np_ops.center_to_corner_box2d(
... | [
"def",
"filter_gt_box_outside_range",
"(",
"gt_boxes",
",",
"limit_range",
")",
":",
"gt_boxes_bv",
"=",
"box_np_ops",
".",
"center_to_corner_box2d",
"(",
"gt_boxes",
"[",
":",
",",
"[",
"0",
",",
"1",
"]",
"]",
",",
"gt_boxes",
"[",
":",
",",
"[",
"3",
... | https://github.com/traveller59/second.pytorch/blob/3aba19c9688274f75ebb5e576f65cfe54773c021/second/core/preprocess.py#L137-L150 | |
twitterdev/twitter-for-bigquery | 8dcbcd28f813587e8f53e4436ad3e7e61f1c0a37 | libs/requests/api.py | python | patch | (url, data=None, **kwargs) | return request('patch', url, data=data, **kwargs) | Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a PATCH request. Returns :class:`Response` object. | [
"Sends",
"a",
"PATCH",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def patch(url, data=None, **kwargs):
"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments that ``... | [
"def",
"patch",
"(",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'patch'",
",",
"url",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/twitterdev/twitter-for-bigquery/blob/8dcbcd28f813587e8f53e4436ad3e7e61f1c0a37/libs/requests/api.py#L102-L110 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/scripts/generate_lower_listing.py | python | gen_lower_listing | (path=None) | Generate lowering listing to ``path`` or (if None) to stdout. | Generate lowering listing to ``path`` or (if None) to stdout. | [
"Generate",
"lowering",
"listing",
"to",
"path",
"or",
"(",
"if",
"None",
")",
"to",
"stdout",
"."
] | def gen_lower_listing(path=None):
"""
Generate lowering listing to ``path`` or (if None) to stdout.
"""
cpu_backend = cpu_target.target_context
cpu_backend.refresh()
fninfos = gather_function_info(cpu_backend)
out = format_function_infos(fninfos)
if path is None:
print(out)
... | [
"def",
"gen_lower_listing",
"(",
"path",
"=",
"None",
")",
":",
"cpu_backend",
"=",
"cpu_target",
".",
"target_context",
"cpu_backend",
".",
"refresh",
"(",
")",
"fninfos",
"=",
"gather_function_info",
"(",
"cpu_backend",
")",
"out",
"=",
"format_function_infos",
... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/scripts/generate_lower_listing.py#L151-L165 | ||
ondyari/FaceForensics | b952e41cba017eb37593c39e12bd884a934791e1 | dataset/DeepFakes/faceswap-master/tools/sort.py | python | Sort.sort_face_yaw | (self) | return img_list | Sort by yaw of face | Sort by yaw of face | [
"Sort",
"by",
"yaw",
"of",
"face"
] | def sort_face_yaw(self):
""" Sort by yaw of face """
input_dir = self.args.input_dir
img_list = []
for img in tqdm(self.find_images(input_dir),
desc="Loading",
file=sys.stdout):
landmarks = face_alignment.Extract(
... | [
"def",
"sort_face_yaw",
"(",
"self",
")",
":",
"input_dir",
"=",
"self",
".",
"args",
".",
"input_dir",
"img_list",
"=",
"[",
"]",
"for",
"img",
"in",
"tqdm",
"(",
"self",
".",
"find_images",
"(",
"input_dir",
")",
",",
"desc",
"=",
"\"Loading\"",
",",... | https://github.com/ondyari/FaceForensics/blob/b952e41cba017eb37593c39e12bd884a934791e1/dataset/DeepFakes/faceswap-master/tools/sort.py#L258-L277 | |
benoitc/tproxy | a4aeb19fc3012d286d3b4e2f2be693813ba8d0d1 | examples/httpproxy.py | python | get_host | (addr, is_ssl=False) | return host | return a correct Host header | return a correct Host header | [
"return",
"a",
"correct",
"Host",
"header"
] | def get_host(addr, is_ssl=False):
""" return a correct Host header """
host = addr[0]
if addr[1] != (is_ssl and 443 or 80):
host = "%s:%s" % (host, addr[1])
return host | [
"def",
"get_host",
"(",
"addr",
",",
"is_ssl",
"=",
"False",
")",
":",
"host",
"=",
"addr",
"[",
"0",
"]",
"if",
"addr",
"[",
"1",
"]",
"!=",
"(",
"is_ssl",
"and",
"443",
"or",
"80",
")",
":",
"host",
"=",
"\"%s:%s\"",
"%",
"(",
"host",
",",
... | https://github.com/benoitc/tproxy/blob/a4aeb19fc3012d286d3b4e2f2be693813ba8d0d1/examples/httpproxy.py#L22-L27 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/funnelarea/_textfont.py | python | Textfont.sizesrc | (self) | return self["sizesrc"] | Sets the source reference on Chart Studio Cloud for `size`.
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for `size`.
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"size",
".",
"The",
"sizesrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def sizesrc(self):
"""
Sets the source reference on Chart Studio Cloud for `size`.
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["sizesrc"] | [
"def",
"sizesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizesrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/funnelarea/_textfont.py#L165-L176 | |
sentinel-hub/eo-learn | cf964eaf173668d6a374675dbd7c1d244264c11d | core/eolearn/core/core_tasks.py | python | SaveTask.execute | (self, eopatch, *, eopatch_folder='') | return eopatch | Saves the EOPatch to disk: `folder/eopatch_folder`.
:param eopatch: EOPatch which will be saved
:type eopatch: EOPatch
:param eopatch_folder: name of EOPatch folder containing data
:type eopatch_folder: str
:return: The same EOPatch
:rtype: EOPatch | Saves the EOPatch to disk: `folder/eopatch_folder`. | [
"Saves",
"the",
"EOPatch",
"to",
"disk",
":",
"folder",
"/",
"eopatch_folder",
"."
] | def execute(self, eopatch, *, eopatch_folder=''):
"""Saves the EOPatch to disk: `folder/eopatch_folder`.
:param eopatch: EOPatch which will be saved
:type eopatch: EOPatch
:param eopatch_folder: name of EOPatch folder containing data
:type eopatch_folder: str
:return: Th... | [
"def",
"execute",
"(",
"self",
",",
"eopatch",
",",
"*",
",",
"eopatch_folder",
"=",
"''",
")",
":",
"path",
"=",
"fs",
".",
"path",
".",
"combine",
"(",
"self",
".",
"filesystem_path",
",",
"eopatch_folder",
")",
"eopatch",
".",
"save",
"(",
"path",
... | https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/core/eolearn/core/core_tasks.py#L115-L128 | |
Dash-Industry-Forum/dash-live-source-simulator | 23cb15c35656a731d9f6d78a30f2713eff2ec20d | dashlivesim/dashlib/mp4.py | python | stss_box.has_index | (self, index) | return index in self.entries | [] | def has_index(self, index):
return index in self.entries | [
"def",
"has_index",
"(",
"self",
",",
"index",
")",
":",
"return",
"index",
"in",
"self",
".",
"entries"
] | https://github.com/Dash-Industry-Forum/dash-live-source-simulator/blob/23cb15c35656a731d9f6d78a30f2713eff2ec20d/dashlivesim/dashlib/mp4.py#L1657-L1658 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modules/fg_pid/fgp_element.py | python | FGP_Element._vector_ | (self, base_ring=None) | Support for conversion to vectors.
INPUT:
- ``base_ring`` -- the desired base ring of the vector.
OUTPUT:
A vector over the base ring.
EXAMPLES::
sage: V = span([[1/2,0,0],[3/2,2,1],[0,0,1]],ZZ); W = V.span([2*V.0+4*V.1, 9*V.0+12*V.1, 4*V.2])
... | Support for conversion to vectors. | [
"Support",
"for",
"conversion",
"to",
"vectors",
"."
] | def _vector_(self, base_ring=None):
"""
Support for conversion to vectors.
INPUT:
- ``base_ring`` -- the desired base ring of the vector.
OUTPUT:
A vector over the base ring.
EXAMPLES::
sage: V = span([[1/2,0,0],[3/2,2,1],[0,0,1]],ZZ); W ... | [
"def",
"_vector_",
"(",
"self",
",",
"base_ring",
"=",
"None",
")",
":",
"v",
"=",
"self",
".",
"vector",
"(",
")",
"if",
"base_ring",
"is",
"None",
"or",
"v",
".",
"base_ring",
"(",
")",
"is",
"base_ring",
":",
"return",
"v",
".",
"__copy__",
"(",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modules/fg_pid/fgp_element.py#L360-L398 | ||
nanotube/supybot-bitcoin-marketmonitor | 8cdcd6055b716fa9dbdba8f2311c44f836ba55ef | BitcoinData/plugin.py | python | BitcoinData.tblb | (self, irc, msg, args, interval) | <interval>
Calculate the expected time between blocks which take at least
<interval> seconds to create.
To provide the <interval> argument, a nested 'seconds' command may be helpful. | <interval>
Calculate the expected time between blocks which take at least
<interval> seconds to create.
To provide the <interval> argument, a nested 'seconds' command may be helpful. | [
"<interval",
">",
"Calculate",
"the",
"expected",
"time",
"between",
"blocks",
"which",
"take",
"at",
"least",
"<interval",
">",
"seconds",
"to",
"create",
".",
"To",
"provide",
"the",
"<interval",
">",
"argument",
"a",
"nested",
"seconds",
"command",
"may",
... | def tblb(self, irc, msg, args, interval):
"""<interval>
Calculate the expected time between blocks which take at least
<interval> seconds to create.
To provide the <interval> argument, a nested 'seconds' command may be helpful.
"""
try:
difficulty = f... | [
"def",
"tblb",
"(",
"self",
",",
"irc",
",",
"msg",
",",
"args",
",",
"interval",
")",
":",
"try",
":",
"difficulty",
"=",
"float",
"(",
"self",
".",
"_diff",
"(",
")",
")",
"nh",
"=",
"float",
"(",
"self",
".",
"_netinfo",
"(",
")",
"[",
"'has... | https://github.com/nanotube/supybot-bitcoin-marketmonitor/blob/8cdcd6055b716fa9dbdba8f2311c44f836ba55ef/BitcoinData/plugin.py#L461-L477 | ||
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/utils/scheduled_sampling.py | python | _update_timestep | (x, timestep, values) | return x | Set x[:, timestep] = values.
This operation is **NOT** differentiable.
Args:
x: Tensor of shape [batch_size, seq_len, ...]
timestep: int or scalar Tensor. Index to update in x.
values: Tensor of shape [batch_size, ...]. New values for x[:, i].
Returns:
Copy of 'x' after setting x[:, timestep] =... | Set x[:, timestep] = values. | [
"Set",
"x",
"[",
":",
"timestep",
"]",
"=",
"values",
"."
] | def _update_timestep(x, timestep, values):
"""Set x[:, timestep] = values.
This operation is **NOT** differentiable.
Args:
x: Tensor of shape [batch_size, seq_len, ...]
timestep: int or scalar Tensor. Index to update in x.
values: Tensor of shape [batch_size, ...]. New values for x[:, i].
Returns... | [
"def",
"_update_timestep",
"(",
"x",
",",
"timestep",
",",
"values",
")",
":",
"perm",
"=",
"range",
"(",
"x",
".",
"shape",
".",
"ndims",
")",
"perm",
"[",
"0",
"]",
",",
"perm",
"[",
"1",
"]",
"=",
"perm",
"[",
"1",
"]",
",",
"perm",
"[",
"... | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/utils/scheduled_sampling.py#L174-L192 | |
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/cgi.py | python | FieldStorage.has_key | (self, key) | return any(item.name == key for item in self.list) | Dictionary style has_key() method. | Dictionary style has_key() method. | [
"Dictionary",
"style",
"has_key",
"()",
"method",
"."
] | def has_key(self, key):
"""Dictionary style has_key() method."""
if self.list is None:
raise TypeError, "not indexable"
return any(item.name == key for item in self.list) | [
"def",
"has_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"self",
".",
"list",
"is",
"None",
":",
"raise",
"TypeError",
",",
"\"not indexable\"",
"return",
"any",
"(",
"item",
".",
"name",
"==",
"key",
"for",
"item",
"in",
"self",
".",
"list",
")"
] | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/cgi.py#L585-L589 | |
appknox/AFE | bc9c909ea306506985b00f27ca17b1df5d1a92cc | internals/lib/cmd2.py | python | Cmd.do_load | (self, arg=None) | return stop and (stop != self._STOP_SCRIPT_NO_EXIT) | Runs script of command(s) from a file or URL. | Runs script of command(s) from a file or URL. | [
"Runs",
"script",
"of",
"command",
"(",
"s",
")",
"from",
"a",
"file",
"or",
"URL",
"."
] | def do_load(self, arg=None):
"""Runs script of command(s) from a file or URL."""
if arg is None:
targetname = self.default_file_name
else:
arg = arg.split(None, 1)
targetname, args = arg[0], (arg[1:] or [''])[0].strip()
try:
targ... | [
"def",
"do_load",
"(",
"self",
",",
"arg",
"=",
"None",
")",
":",
"if",
"arg",
"is",
"None",
":",
"targetname",
"=",
"self",
".",
"default_file_name",
"else",
":",
"arg",
"=",
"arg",
".",
"split",
"(",
"None",
",",
"1",
")",
"targetname",
",",
"arg... | https://github.com/appknox/AFE/blob/bc9c909ea306506985b00f27ca17b1df5d1a92cc/internals/lib/cmd2.py#L1194-L1216 | |
networkx/networkx | 1620568e36702b1cfeaf1c0277b167b6cb93e48d | networkx/algorithms/tournament.py | python | is_strongly_connected | (G) | return all(is_reachable(G, u, v) for u in G for v in G) | Decides whether the given tournament is strongly connected.
This function is more theoretically efficient than the
:func:`~networkx.algorithms.components.is_strongly_connected`
function.
The given graph **must** be a tournament, otherwise this function's
behavior is undefined.
Parameters
... | Decides whether the given tournament is strongly connected. | [
"Decides",
"whether",
"the",
"given",
"tournament",
"is",
"strongly",
"connected",
"."
] | def is_strongly_connected(G):
"""Decides whether the given tournament is strongly connected.
This function is more theoretically efficient than the
:func:`~networkx.algorithms.components.is_strongly_connected`
function.
The given graph **must** be a tournament, otherwise this function's
behavi... | [
"def",
"is_strongly_connected",
"(",
"G",
")",
":",
"# TODO This is trivially parallelizable.",
"return",
"all",
"(",
"is_reachable",
"(",
"G",
",",
"u",
",",
"v",
")",
"for",
"u",
"in",
"G",
"for",
"v",
"in",
"G",
")"
] | https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/algorithms/tournament.py#L314-L353 | |
MushroomRL/mushroom-rl | a0eaa2cf8001e433419234a9fc48b64170e3f61c | mushroom_rl/environments/habitat_env.py | python | HabitatNavigationWrapper.get_shortest_path | (self) | Returns observations and actions corresponding to the shortest path to the goal.
If the goal cannot be reached within the episode steps limit, the best
path (closest to the goal) will be returned. | Returns observations and actions corresponding to the shortest path to the goal.
If the goal cannot be reached within the episode steps limit, the best
path (closest to the goal) will be returned. | [
"Returns",
"observations",
"and",
"actions",
"corresponding",
"to",
"the",
"shortest",
"path",
"to",
"the",
"goal",
".",
"If",
"the",
"goal",
"cannot",
"be",
"reached",
"within",
"the",
"episode",
"steps",
"limit",
"the",
"best",
"path",
"(",
"closest",
"to"... | def get_shortest_path(self):
'''
Returns observations and actions corresponding to the shortest path to the goal.
If the goal cannot be reached within the episode steps limit, the best
path (closest to the goal) will be returned.
'''
max_steps = self.unwrapped._env._max_e... | [
"def",
"get_shortest_path",
"(",
"self",
")",
":",
"max_steps",
"=",
"self",
".",
"unwrapped",
".",
"_env",
".",
"_max_episode_steps",
"-",
"1",
"try",
":",
"shortest_path",
"=",
"[",
"get_action_shortest_path",
"(",
"self",
".",
"unwrapped",
".",
"_env",
".... | https://github.com/MushroomRL/mushroom-rl/blob/a0eaa2cf8001e433419234a9fc48b64170e3f61c/mushroom_rl/environments/habitat_env.py#L63-L93 | ||
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/algo/conformance/tokenreplay/diagnostics/duration_diagnostics.py | python | get_case_duration | (case, timestamp_key=xes.DEFAULT_TIMESTAMP_KEY) | return (case[-1][timestamp_key] - case[0][timestamp_key]).total_seconds() | Gets the duration of a case
Parameters
-------------
case
Case
timestamp_key
Attribute of the event to use as timestamp
Returns
-------------
case_duration
Case duration | Gets the duration of a case | [
"Gets",
"the",
"duration",
"of",
"a",
"case"
] | def get_case_duration(case, timestamp_key=xes.DEFAULT_TIMESTAMP_KEY):
"""
Gets the duration of a case
Parameters
-------------
case
Case
timestamp_key
Attribute of the event to use as timestamp
Returns
-------------
case_duration
Case duration
"""
re... | [
"def",
"get_case_duration",
"(",
"case",
",",
"timestamp_key",
"=",
"xes",
".",
"DEFAULT_TIMESTAMP_KEY",
")",
":",
"return",
"(",
"case",
"[",
"-",
"1",
"]",
"[",
"timestamp_key",
"]",
"-",
"case",
"[",
"0",
"]",
"[",
"timestamp_key",
"]",
")",
".",
"t... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/algo/conformance/tokenreplay/diagnostics/duration_diagnostics.py#L32-L48 | |
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/plotting/displays/_slicers.py | python | BaseStackedSlicer._locator | (self, axes, renderer) | return Bbox([[left_dict[axes], y0],
[left_dict[axes] + width_dict[axes], y1]]) | The locator function used by matplotlib to position axes.
Here we put the logic used to adjust the size of the axes. | The locator function used by matplotlib to position axes.
Here we put the logic used to adjust the size of the axes. | [
"The",
"locator",
"function",
"used",
"by",
"matplotlib",
"to",
"position",
"axes",
".",
"Here",
"we",
"put",
"the",
"logic",
"used",
"to",
"adjust",
"the",
"size",
"of",
"the",
"axes",
"."
] | def _locator(self, axes, renderer):
"""The locator function used by matplotlib to position axes.
Here we put the logic used to adjust the size of the axes.
"""
x0, y0, x1, y1 = self.rect
width_dict = dict()
display_ax_dict = self.axes
if self._colorbar:
... | [
"def",
"_locator",
"(",
"self",
",",
"axes",
",",
"renderer",
")",
":",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
"=",
"self",
".",
"rect",
"width_dict",
"=",
"dict",
"(",
")",
"display_ax_dict",
"=",
"self",
".",
"axes",
"if",
"self",
".",
"_colorbar... | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/plotting/displays/_slicers.py#L1323-L1357 | |
svip-lab/impersonator | b041dd415157c1e7f5b46e579a1ad4dffabb2e66 | networks/batch_smpl.py | python | batch_orth_proj_idrot | (X, camera, device="cpu") | return camera[:, None, 0:1] * X_trans | X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N | X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N | [
"X",
"is",
"N",
"x",
"num_points",
"x",
"3",
"camera",
"is",
"N",
"x",
"3",
"same",
"as",
"applying",
"orth_proj_idrot",
"to",
"each",
"N"
] | def batch_orth_proj_idrot(X, camera, device="cpu"):
"""
X is N x num_points x 3
camera is N x 3
same as applying orth_proj_idrot to each N
"""
# TODO check X dim size.
# X_trans is (N, num_points, 2)
X_trans = X[:, :, :2] + camera[:, None, 1:]
return camera[:, None, 0:1] * X_trans | [
"def",
"batch_orth_proj_idrot",
"(",
"X",
",",
"camera",
",",
"device",
"=",
"\"cpu\"",
")",
":",
"# TODO check X dim size.",
"# X_trans is (N, num_points, 2)",
"X_trans",
"=",
"X",
"[",
":",
",",
":",
",",
":",
"2",
"]",
"+",
"camera",
"[",
":",
",",
"Non... | https://github.com/svip-lab/impersonator/blob/b041dd415157c1e7f5b46e579a1ad4dffabb2e66/networks/batch_smpl.py#L221-L232 | |
merenlab/anvio | 9b792e2cedc49ecb7c0bed768261595a0d87c012 | anvio/structureops.py | python | DSSPClass.set_executable | (self) | Determine which DSSP executables exist and should be used. Set to self.executable | Determine which DSSP executables exist and should be used. Set to self.executable | [
"Determine",
"which",
"DSSP",
"executables",
"exist",
"and",
"should",
"be",
"used",
".",
"Set",
"to",
"self",
".",
"executable"
] | def set_executable(self):
"""Determine which DSSP executables exist and should be used. Set to self.executable"""
if self.executable:
utils.is_program_exists(self.executable, dont_raise=True)
return
# Determine what DSSP program should be used. Tries mkdssp and then dss... | [
"def",
"set_executable",
"(",
"self",
")",
":",
"if",
"self",
".",
"executable",
":",
"utils",
".",
"is_program_exists",
"(",
"self",
".",
"executable",
",",
"dont_raise",
"=",
"True",
")",
"return",
"# Determine what DSSP program should be used. Tries mkdssp and then... | https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/structureops.py#L1134-L1154 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventTypeArg.is_showcase_request_access | (self) | return self._tag == 'showcase_request_access' | Check if the union tag is ``showcase_request_access``.
:rtype: bool | Check if the union tag is ``showcase_request_access``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"showcase_request_access",
"."
] | def is_showcase_request_access(self):
"""
Check if the union tag is ``showcase_request_access``.
:rtype: bool
"""
return self._tag == 'showcase_request_access' | [
"def",
"is_showcase_request_access",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'showcase_request_access'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L42567-L42573 | |
CenterForOpenScience/osf.io | cc02691be017e61e2cd64f19b848b2f4c18dcc84 | website/profile/views.py | python | sync_data_from_mailchimp | (**kwargs) | Endpoint that the mailchimp webhook sends its data to | Endpoint that the mailchimp webhook sends its data to | [
"Endpoint",
"that",
"the",
"mailchimp",
"webhook",
"sends",
"its",
"data",
"to"
] | def sync_data_from_mailchimp(**kwargs):
"""Endpoint that the mailchimp webhook sends its data to"""
key = request.args.get('key')
if key == settings.MAILCHIMP_WEBHOOK_SECRET_KEY:
r = request
action = r.values['type']
list_name = mailchimp_utils.get_list_name_from_id(list_id=r.values... | [
"def",
"sync_data_from_mailchimp",
"(",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"request",
".",
"args",
".",
"get",
"(",
"'key'",
")",
"if",
"key",
"==",
"settings",
".",
"MAILCHIMP_WEBHOOK_SECRET_KEY",
":",
"r",
"=",
"request",
"action",
"=",
"r",
"."... | https://github.com/CenterForOpenScience/osf.io/blob/cc02691be017e61e2cd64f19b848b2f4c18dcc84/website/profile/views.py#L537-L566 | ||
nccgroup/ScoutSuite | b9b8e201a45bd63835f611eec67fe3bb7c892a0a | ScoutSuite/providers/aliyun/facade/ram.py | python | RAMFacade.get_roles | (self) | Get all roles
:return: a list of all roles | Get all roles | [
"Get",
"all",
"roles"
] | async def get_roles(self):
"""
Get all roles
:return: a list of all roles
"""
response = await get_response(client=self._client,
request=ListRolesRequest.ListRolesRequest())
if response:
return response['Roles']['Role']
... | [
"async",
"def",
"get_roles",
"(",
"self",
")",
":",
"response",
"=",
"await",
"get_response",
"(",
"client",
"=",
"self",
".",
"_client",
",",
"request",
"=",
"ListRolesRequest",
".",
"ListRolesRequest",
"(",
")",
")",
"if",
"response",
":",
"return",
"res... | https://github.com/nccgroup/ScoutSuite/blob/b9b8e201a45bd63835f611eec67fe3bb7c892a0a/ScoutSuite/providers/aliyun/facade/ram.py#L165-L176 | ||
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/opsworks/layer1.py | python | OpsWorksConnection.register_rds_db_instance | (self, stack_id, rds_db_instance_arn,
db_user, db_password) | return self.make_request(action='RegisterRdsDbInstance',
body=json.dumps(params)) | Registers an Amazon RDS instance with a stack.
**Required Permissions**: To use this action, an IAM user must
have a Manage permissions level for the stack, or an attached
policy that explicitly grants permissions. For more
information on user permissions, see `Managing User
Per... | Registers an Amazon RDS instance with a stack. | [
"Registers",
"an",
"Amazon",
"RDS",
"instance",
"with",
"a",
"stack",
"."
] | def register_rds_db_instance(self, stack_id, rds_db_instance_arn,
db_user, db_password):
"""
Registers an Amazon RDS instance with a stack.
**Required Permissions**: To use this action, an IAM user must
have a Manage permissions level for the stack, or a... | [
"def",
"register_rds_db_instance",
"(",
"self",
",",
"stack_id",
",",
"rds_db_instance_arn",
",",
"db_user",
",",
"db_password",
")",
":",
"params",
"=",
"{",
"'StackId'",
":",
"stack_id",
",",
"'RdsDbInstanceArn'",
":",
"rds_db_instance_arn",
",",
"'DbUser'",
":"... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/opsworks/layer1.py#L2109-L2140 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/sponge_slice.py | python | SpongeCircle.__init__ | (self, center, radius=0.0) | Initialize. | Initialize. | [
"Initialize",
"."
] | def __init__(self, center, radius=0.0):
'Initialize.'
self.center = center
self.radius = radius | [
"def",
"__init__",
"(",
"self",
",",
"center",
",",
"radius",
"=",
"0.0",
")",
":",
"self",
".",
"center",
"=",
"center",
"self",
".",
"radius",
"=",
"radius"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/geometry/creation/sponge_slice.py#L84-L87 | ||
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/pyqode/core/widgets/encodings.py | python | EncodingsComboBox._refresh_items | (self) | [] | def _refresh_items(self):
self._lock = True
self.clear()
for i, encoding in enumerate(sorted(Cache().preferred_encodings)):
encoding = convert_to_codec_key(encoding)
try:
alias, lang = ENCODINGS_MAP[encoding]
except KeyError:
_l... | [
"def",
"_refresh_items",
"(",
"self",
")",
":",
"self",
".",
"_lock",
"=",
"True",
"self",
".",
"clear",
"(",
")",
"for",
"i",
",",
"encoding",
"in",
"enumerate",
"(",
"sorted",
"(",
"Cache",
"(",
")",
".",
"preferred_encodings",
")",
")",
":",
"enco... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/widgets/encodings.py#L54-L71 | ||||
cournape/Bento | 37de23d784407a7c98a4a15770ffc570d5f32d70 | bento/commands/command_contexts.py | python | BuildContext.tweak_extension | (self, extension_name, **kw) | return self.builder_registry.register_callback("extensions", full_name, _builder) | [] | def tweak_extension(self, extension_name, **kw):
def _builder(extension):
return self.default_builder(extension, **kw)
full_name = self._compute_extension_name(extension_name)
return self.builder_registry.register_callback("extensions", full_name, _builder) | [
"def",
"tweak_extension",
"(",
"self",
",",
"extension_name",
",",
"*",
"*",
"kw",
")",
":",
"def",
"_builder",
"(",
"extension",
")",
":",
"return",
"self",
".",
"default_builder",
"(",
"extension",
",",
"*",
"*",
"kw",
")",
"full_name",
"=",
"self",
... | https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/commands/command_contexts.py#L322-L326 | |||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.stepashka.com/resources/lib/keyboardint.py | python | GUI.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
self.text=''
self.lns=lines_ru
pass | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"text",
"=",
"''",
"self",
".",
"lns",
"=",
"lines_ru",
"pass"
] | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.stepashka.com/resources/lib/keyboardint.py#L37-L40 | ||||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/bin/pex.py | python | transform_legacy_arg | (arg) | return arg | [] | def transform_legacy_arg(arg):
# type: (str) -> str
# inherit-path used to be a boolean arg (so either was absent, or --inherit-path)
# Now it takes a string argument, so --inherit-path is invalid.
# Fix up the args we're about to parse to preserve backwards compatibility.
if arg == "--inherit-path"... | [
"def",
"transform_legacy_arg",
"(",
"arg",
")",
":",
"# type: (str) -> str",
"# inherit-path used to be a boolean arg (so either was absent, or --inherit-path)",
"# Now it takes a string argument, so --inherit-path is invalid.",
"# Fix up the args we're about to parse to preserve backwards compati... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/bin/pex.py#L637-L644 | |||
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/readers/fci_l1c_nc.py | python | FCIL1cNCFileHandler._get_dataset_index_map | (self, dsname) | return data | Load the index map for an FCI channel. | Load the index map for an FCI channel. | [
"Load",
"the",
"index",
"map",
"for",
"an",
"FCI",
"channel",
"."
] | def _get_dataset_index_map(self, dsname):
"""Load the index map for an FCI channel."""
grp_path = self.get_channel_measured_group_path(_get_channel_name_from_dsname(dsname))
dv_path = grp_path + "/index_map"
data = self[dv_path]
data = data.where(data != data.attrs.get('_FillVal... | [
"def",
"_get_dataset_index_map",
"(",
"self",
",",
"dsname",
")",
":",
"grp_path",
"=",
"self",
".",
"get_channel_measured_group_path",
"(",
"_get_channel_name_from_dsname",
"(",
"dsname",
")",
")",
"dv_path",
"=",
"grp_path",
"+",
"\"/index_map\"",
"data",
"=",
"... | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/fci_l1c_nc.py#L284-L291 | |
ClementPinard/SfmLearner-Pytorch | c2374d50f816e976c6889eb5e07198749d953bc6 | kitti_eval/depth_evaluation_utils.py | python | get_displacements_from_GPS | (root, date, scene, indices, tgt_index, precision_warning_threshold=2) | return displacements | gets displacement magntidues between middle frame and other frames, this is, to a scaling factor
the mean output PoseNet should have for translation. Since the scaling is the same factor for depth maps and
for translations, it will be used to determine how much predicted depth should be multiplied to. | gets displacement magntidues between middle frame and other frames, this is, to a scaling factor
the mean output PoseNet should have for translation. Since the scaling is the same factor for depth maps and
for translations, it will be used to determine how much predicted depth should be multiplied to. | [
"gets",
"displacement",
"magntidues",
"between",
"middle",
"frame",
"and",
"other",
"frames",
"this",
"is",
"to",
"a",
"scaling",
"factor",
"the",
"mean",
"output",
"PoseNet",
"should",
"have",
"for",
"translation",
".",
"Since",
"the",
"scaling",
"is",
"the",... | def get_displacements_from_GPS(root, date, scene, indices, tgt_index, precision_warning_threshold=2):
"""gets displacement magntidues between middle frame and other frames, this is, to a scaling factor
the mean output PoseNet should have for translation. Since the scaling is the same factor for depth maps and
... | [
"def",
"get_displacements_from_GPS",
"(",
"root",
",",
"date",
",",
"scene",
",",
"indices",
",",
"tgt_index",
",",
"precision_warning_threshold",
"=",
"2",
")",
":",
"first_pose",
"=",
"None",
"displacements",
"=",
"[",
"]",
"oxts_root",
"=",
"root",
"/",
"... | https://github.com/ClementPinard/SfmLearner-Pytorch/blob/c2374d50f816e976c6889eb5e07198749d953bc6/kitti_eval/depth_evaluation_utils.py#L58-L86 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.UnselectAll | (self) | Unselect all the items. | Unselect all the items. | [
"Unselect",
"all",
"the",
"items",
"."
] | def UnselectAll(self):
""" Unselect all the items. """
rootItem = self.GetRootItem()
# the tree might not have the root item at all
if rootItem:
self.UnselectAllChildren(rootItem)
self.Unselect() | [
"def",
"UnselectAll",
"(",
"self",
")",
":",
"rootItem",
"=",
"self",
".",
"GetRootItem",
"(",
")",
"# the tree might not have the root item at all",
"if",
"rootItem",
":",
"self",
".",
"UnselectAllChildren",
"(",
"rootItem",
")",
"self",
".",
"Unselect",
"(",
"... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/customtreectrl.py#L5786-L5795 | ||
OWASP/ZSC | 5bb9fed69efdc17996be4856b54af632aaed87b0 | module/readline_windows/pyreadline/modes/notemacs.py | python | NotEmacsMode.ipython_paste | (self, e) | Paste windows clipboard. If enable_ipython_paste_list_of_lists is
True then try to convert tabseparated data to repr of list of lists or
repr of array | Paste windows clipboard. If enable_ipython_paste_list_of_lists is
True then try to convert tabseparated data to repr of list of lists or
repr of array | [
"Paste",
"windows",
"clipboard",
".",
"If",
"enable_ipython_paste_list_of_lists",
"is",
"True",
"then",
"try",
"to",
"convert",
"tabseparated",
"data",
"to",
"repr",
"of",
"list",
"of",
"lists",
"or",
"repr",
"of",
"array"
] | def ipython_paste(self, e):
'''Paste windows clipboard. If enable_ipython_paste_list_of_lists is
True then try to convert tabseparated data to repr of list of lists or
repr of array'''
if self.enable_win32_clipboard:
txt = clipboard.get_clipboard_text_and_convert(
... | [
"def",
"ipython_paste",
"(",
"self",
",",
"e",
")",
":",
"if",
"self",
".",
"enable_win32_clipboard",
":",
"txt",
"=",
"clipboard",
".",
"get_clipboard_text_and_convert",
"(",
"self",
".",
"enable_ipython_paste_list_of_lists",
")",
"if",
"self",
".",
"enable_ipyth... | https://github.com/OWASP/ZSC/blob/5bb9fed69efdc17996be4856b54af632aaed87b0/module/readline_windows/pyreadline/modes/notemacs.py#L422-L432 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/contrib/gis/geos/mutable_list.py | python | ListMixin.__add__ | (self, other) | return self.__class__(list(self) + list(other)) | add another list-like object | add another list-like object | [
"add",
"another",
"list",
"-",
"like",
"object"
] | def __add__(self, other):
'add another list-like object'
return self.__class__(list(self) + list(other)) | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"list",
"(",
"self",
")",
"+",
"list",
"(",
"other",
")",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/geos/mutable_list.py#L115-L117 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | java/java2py/antlr-3.1.3/runtime/Python/antlr3/tree.py | python | TreeParser.getErrorMessage | (self, e, tokenNames) | return BaseRecognizer.getErrorMessage(self, e, tokenNames) | Tree parsers parse nodes they usually have a token object as
payload. Set the exception token and do the default behavior. | Tree parsers parse nodes they usually have a token object as
payload. Set the exception token and do the default behavior. | [
"Tree",
"parsers",
"parse",
"nodes",
"they",
"usually",
"have",
"a",
"token",
"object",
"as",
"payload",
".",
"Set",
"the",
"exception",
"token",
"and",
"do",
"the",
"default",
"behavior",
"."
] | def getErrorMessage(self, e, tokenNames):
"""
Tree parsers parse nodes they usually have a token object as
payload. Set the exception token and do the default behavior.
"""
if isinstance(self, TreeParser):
adaptor = e.input.getTreeAdaptor()
e.token = adap... | [
"def",
"getErrorMessage",
"(",
"self",
",",
"e",
",",
"tokenNames",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"TreeParser",
")",
":",
"adaptor",
"=",
"e",
".",
"input",
".",
"getTreeAdaptor",
"(",
")",
"e",
".",
"token",
"=",
"adaptor",
".",
"g... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/java/java2py/antlr-3.1.3/runtime/Python/antlr3/tree.py#L2345-L2360 | |
Lasagne/Lasagne | 5d3c63cb315c50b1cbd27a6bc8664b406f34dd99 | lasagne/nonlinearities.py | python | softmax | (x) | return theano.tensor.nnet.softmax(x) | Softmax activation function
:math:`\\varphi(\\mathbf{x})_j =
\\frac{e^{\mathbf{x}_j}}{\sum_{k=1}^K e^{\mathbf{x}_k}}`
where :math:`K` is the total number of neurons in the layer. This
activation function gets applied row-wise.
Parameters
----------
x : float32
The activation (the su... | Softmax activation function
:math:`\\varphi(\\mathbf{x})_j =
\\frac{e^{\mathbf{x}_j}}{\sum_{k=1}^K e^{\mathbf{x}_k}}`
where :math:`K` is the total number of neurons in the layer. This
activation function gets applied row-wise. | [
"Softmax",
"activation",
"function",
":",
"math",
":",
"\\\\",
"varphi",
"(",
"\\\\",
"mathbf",
"{",
"x",
"}",
")",
"_j",
"=",
"\\\\",
"frac",
"{",
"e^",
"{",
"\\",
"mathbf",
"{",
"x",
"}",
"_j",
"}}",
"{",
"\\",
"sum_",
"{",
"k",
"=",
"1",
"}"... | def softmax(x):
"""Softmax activation function
:math:`\\varphi(\\mathbf{x})_j =
\\frac{e^{\mathbf{x}_j}}{\sum_{k=1}^K e^{\mathbf{x}_k}}`
where :math:`K` is the total number of neurons in the layer. This
activation function gets applied row-wise.
Parameters
----------
x : float32
... | [
"def",
"softmax",
"(",
"x",
")",
":",
"return",
"theano",
".",
"tensor",
".",
"nnet",
".",
"softmax",
"(",
"x",
")"
] | https://github.com/Lasagne/Lasagne/blob/5d3c63cb315c50b1cbd27a6bc8664b406f34dd99/lasagne/nonlinearities.py#L27-L44 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py | python | OptionEngine._get_has_events | (self) | return self._proxied._has_events or \
self.__dict__.get('_has_events', False) | [] | def _get_has_events(self):
return self._proxied._has_events or \
self.__dict__.get('_has_events', False) | [
"def",
"_get_has_events",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxied",
".",
"_has_events",
"or",
"self",
".",
"__dict__",
".",
"get",
"(",
"'_has_events'",
",",
"False",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/engine/base.py#L2227-L2229 | |||
danielfrg/copper | 956e9ae607aec461d4fe4f6e7b0ccd9ed556fc79 | dev/ml/gdbn/gdbn/gnumpy.py | python | log_1_plus_exp | (x) | return _elementwise__base(x, garray.log_1_plus_exp, lambda x: log(1.+exp(x))) | This works on garrays, numpy arrays, and numbers, preserving type (though all numbers become floats). | This works on garrays, numpy arrays, and numbers, preserving type (though all numbers become floats). | [
"This",
"works",
"on",
"garrays",
"numpy",
"arrays",
"and",
"numbers",
"preserving",
"type",
"(",
"though",
"all",
"numbers",
"become",
"floats",
")",
"."
] | def log_1_plus_exp(x):
""" This works on garrays, numpy arrays, and numbers, preserving type (though all numbers become floats). """
return _elementwise__base(x, garray.log_1_plus_exp, lambda x: log(1.+exp(x))) | [
"def",
"log_1_plus_exp",
"(",
"x",
")",
":",
"return",
"_elementwise__base",
"(",
"x",
",",
"garray",
".",
"log_1_plus_exp",
",",
"lambda",
"x",
":",
"log",
"(",
"1.",
"+",
"exp",
"(",
"x",
")",
")",
")"
] | https://github.com/danielfrg/copper/blob/956e9ae607aec461d4fe4f6e7b0ccd9ed556fc79/dev/ml/gdbn/gdbn/gnumpy.py#L522-L524 | |
aws-quickstart/quickstart-redhat-openshift | 2b87dd38b72e7e4c439a606c5a9ea458d72da612 | functions/source/KeyGen/asn1crypto/ocsp.py | python | OCSPResponse._set_extensions | (self) | Sets common named extensions to private attributes and creates a list
of critical extensions | Sets common named extensions to private attributes and creates a list
of critical extensions | [
"Sets",
"common",
"named",
"extensions",
"to",
"private",
"attributes",
"and",
"creates",
"a",
"list",
"of",
"critical",
"extensions"
] | def _set_extensions(self):
"""
Sets common named extensions to private attributes and creates a list
of critical extensions
"""
self._critical_extensions = set()
for extension in self['response_bytes']['response'].parsed['tbs_response_data']['response_extensions']:
... | [
"def",
"_set_extensions",
"(",
"self",
")",
":",
"self",
".",
"_critical_extensions",
"=",
"set",
"(",
")",
"for",
"extension",
"in",
"self",
"[",
"'response_bytes'",
"]",
"[",
"'response'",
"]",
".",
"parsed",
"[",
"'tbs_response_data'",
"]",
"[",
"'respons... | https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/KeyGen/asn1crypto/ocsp.py#L572-L588 | ||
YosaiProject/yosai | 7f96aa6b837ceae9bf3d7387cd7e35f5ab032575 | yosai/core/subject/subject.py | python | SubjectContext.resolve_security_manager | (self) | return security_manager | [] | def resolve_security_manager(self):
security_manager = self.security_manager
if (security_manager is None):
msg = ("No SecurityManager available in subject context. " +
"Falling back to Yosai.security_manager for" +
" lookup.")
logger.debug(... | [
"def",
"resolve_security_manager",
"(",
"self",
")",
":",
"security_manager",
"=",
"self",
".",
"security_manager",
"if",
"(",
"security_manager",
"is",
"None",
")",
":",
"msg",
"=",
"(",
"\"No SecurityManager available in subject context. \"",
"+",
"\"Falling back to ... | https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/subject/subject.py#L61-L77 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/argparse.py | python | FileType.__init__ | (self, mode='r', bufsize=-1, encoding=None, errors=None) | [] | def __init__(self, mode='r', bufsize=-1, encoding=None, errors=None):
self._mode = mode
self._bufsize = bufsize
self._encoding = encoding
self._errors = errors | [
"def",
"__init__",
"(",
"self",
",",
"mode",
"=",
"'r'",
",",
"bufsize",
"=",
"-",
"1",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"None",
")",
":",
"self",
".",
"_mode",
"=",
"mode",
"self",
".",
"_bufsize",
"=",
"bufsize",
"self",
".",
"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/argparse.py#L1246-L1250 | ||||
perrygeo/simanneal | 951e7d89a8b7f19aeb05b64e7cc8b844a734af89 | examples/watershed/shapefile.py | python | Writer.__shxRecords | (self) | Writes the shx records. | Writes the shx records. | [
"Writes",
"the",
"shx",
"records",
"."
] | def __shxRecords(self):
"""Writes the shx records."""
f = self.__getFileObj(self.shx)
f.seek(100)
for i in range(len(self._shapes)):
f.write(pack(">i", self._offsets[i] // 2))
f.write(pack(">i", self._lengths[i])) | [
"def",
"__shxRecords",
"(",
"self",
")",
":",
"f",
"=",
"self",
".",
"__getFileObj",
"(",
"self",
".",
"shx",
")",
"f",
".",
"seek",
"(",
"100",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_shapes",
")",
")",
":",
"f",
".",
... | https://github.com/perrygeo/simanneal/blob/951e7d89a8b7f19aeb05b64e7cc8b844a734af89/examples/watershed/shapefile.py#L720-L726 | ||
MenglinLu/Chinese-clinical-NER | 9614593ee2e1ba38d0985c44e957d316e178b93c | bert_sklearn/bert_sklearn/model/pytorch_pretrained/tokenization.py | python | BasicTokenizer._tokenize_chinese_chars | (self, text) | return "".join(output) | Adds whitespace around any CJK character. | Adds whitespace around any CJK character. | [
"Adds",
"whitespace",
"around",
"any",
"CJK",
"character",
"."
] | def _tokenize_chinese_chars(self, text):
"""Adds whitespace around any CJK character."""
output = []
for char in text:
cp = ord(char)
if self._is_chinese_char(cp):
output.append(" ")
output.append(char)
output.append(" ")
... | [
"def",
"_tokenize_chinese_chars",
"(",
"self",
",",
"text",
")",
":",
"output",
"=",
"[",
"]",
"for",
"char",
"in",
"text",
":",
"cp",
"=",
"ord",
"(",
"char",
")",
"if",
"self",
".",
"_is_chinese_char",
"(",
"cp",
")",
":",
"output",
".",
"append",
... | https://github.com/MenglinLu/Chinese-clinical-NER/blob/9614593ee2e1ba38d0985c44e957d316e178b93c/bert_sklearn/bert_sklearn/model/pytorch_pretrained/tokenization.py#L254-L265 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/work/work_client.py | python | WorkClient.update_board_columns | (self, board_columns, team_context, board) | return self._deserialize('[BoardColumn]', self._unwrap_collection(response)) | UpdateBoardColumns.
Update columns on a board
:param [BoardColumn] board_columns: List of board columns to update
:param :class:`<TeamContext> <azure.devops.v5_1.work.models.TeamContext>` team_context: The team context for the operation
:param str board: Name or ID of the specific board
... | UpdateBoardColumns.
Update columns on a board
:param [BoardColumn] board_columns: List of board columns to update
:param :class:`<TeamContext> <azure.devops.v5_1.work.models.TeamContext>` team_context: The team context for the operation
:param str board: Name or ID of the specific board
... | [
"UpdateBoardColumns",
".",
"Update",
"columns",
"on",
"a",
"board",
":",
"param",
"[",
"BoardColumn",
"]",
"board_columns",
":",
"List",
"of",
"board",
"columns",
"to",
"update",
":",
"param",
":",
"class",
":",
"<TeamContext",
">",
"<azure",
".",
"devops",
... | def update_board_columns(self, board_columns, team_context, board):
"""UpdateBoardColumns.
Update columns on a board
:param [BoardColumn] board_columns: List of board columns to update
:param :class:`<TeamContext> <azure.devops.v5_1.work.models.TeamContext>` team_context: The team contex... | [
"def",
"update_board_columns",
"(",
"self",
",",
"board_columns",
",",
"team_context",
",",
"board",
")",
":",
"project",
"=",
"None",
"team",
"=",
"None",
"if",
"team_context",
"is",
"not",
"None",
":",
"if",
"team_context",
".",
"project_id",
":",
"project... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/work/work_client.py#L852-L885 | |
clovaai/overhaul-distillation | 76344a84a7ce23c894f41a2e05b866c9b73fd85a | Segmentation/modeling/sync_batchnorm/comm.py | python | SyncMaster.__init__ | (self, master_callback) | Args:
master_callback: a callback to be invoked after having collected messages from slave devices. | Args:
master_callback: a callback to be invoked after having collected messages from slave devices. | [
"Args",
":",
"master_callback",
":",
"a",
"callback",
"to",
"be",
"invoked",
"after",
"having",
"collected",
"messages",
"from",
"slave",
"devices",
"."
] | def __init__(self, master_callback):
"""
Args:
master_callback: a callback to be invoked after having collected messages from slave devices.
"""
self._master_callback = master_callback
self._queue = queue.Queue()
self._registry = collections.OrderedDict()
... | [
"def",
"__init__",
"(",
"self",
",",
"master_callback",
")",
":",
"self",
".",
"_master_callback",
"=",
"master_callback",
"self",
".",
"_queue",
"=",
"queue",
".",
"Queue",
"(",
")",
"self",
".",
"_registry",
"=",
"collections",
".",
"OrderedDict",
"(",
"... | https://github.com/clovaai/overhaul-distillation/blob/76344a84a7ce23c894f41a2e05b866c9b73fd85a/Segmentation/modeling/sync_batchnorm/comm.py#L66-L74 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/types/newbytes.py | python | newbytes.maketrans | (cls, frm, to) | return newbytes(string.maketrans(frm, to)) | B.maketrans(frm, to) -> translation table
Return a translation table (a bytes object of length 256) suitable
for use in the bytes or bytearray translate method where each byte
in frm is mapped to the byte at the same position in to.
The bytes objects frm and to must be of the same lengt... | B.maketrans(frm, to) -> translation table | [
"B",
".",
"maketrans",
"(",
"frm",
"to",
")",
"-",
">",
"translation",
"table"
] | def maketrans(cls, frm, to):
"""
B.maketrans(frm, to) -> translation table
Return a translation table (a bytes object of length 256) suitable
for use in the bytes or bytearray translate method where each byte
in frm is mapped to the byte at the same position in to.
The b... | [
"def",
"maketrans",
"(",
"cls",
",",
"frm",
",",
"to",
")",
":",
"return",
"newbytes",
"(",
"string",
".",
"maketrans",
"(",
"frm",
",",
"to",
")",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/types/newbytes.py#L448-L457 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_vendor/requests/utils.py | python | requote_uri | (uri) | Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str | Re-quote the given URI. | [
"Re",
"-",
"quote",
"the",
"given",
"URI",
"."
] | def requote_uri(uri):
"""Re-quote the given URI.
This function passes the given URI through an unquote/quote cycle to
ensure that it is fully and consistently quoted.
:rtype: str
"""
safe_with_percent = "!#$%&'()*+,/:;=?@[]~"
safe_without_percent = "!#$&'()*+,/:;=?@[]~"
try:
# ... | [
"def",
"requote_uri",
"(",
"uri",
")",
":",
"safe_with_percent",
"=",
"\"!#$%&'()*+,/:;=?@[]~\"",
"safe_without_percent",
"=",
"\"!#$&'()*+,/:;=?@[]~\"",
"try",
":",
"# Unquote only the unreserved characters",
"# Then quote only illegal characters (do not quote reserved,",
"# unreser... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/requests/utils.py#L589-L608 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/resolution/resolvelib/candidates.py | python | AlreadyInstalledCandidate.version | (self) | return parse_version(self.dist.version) | [] | def version(self) -> CandidateVersion:
return parse_version(self.dist.version) | [
"def",
"version",
"(",
"self",
")",
"->",
"CandidateVersion",
":",
"return",
"parse_version",
"(",
"self",
".",
"dist",
".",
"version",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/resolution/resolvelib/candidates.py#L384-L385 | |||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sphinx/apidoc.py | python | main | (argv=sys.argv) | Parse and check the command line arguments. | Parse and check the command line arguments. | [
"Parse",
"and",
"check",
"the",
"command",
"line",
"arguments",
"."
] | def main(argv=sys.argv):
"""Parse and check the command line arguments."""
parser = optparse.OptionParser(
usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_path, ...]
Look recursively in <module_path> for Python modules and packages and create
one reST file with automodule dire... | [
"def",
"main",
"(",
"argv",
"=",
"sys",
".",
"argv",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"\"\"\"\\\nusage: %prog [options] -o <output_path> <module_path> [exclude_path, ...]\n\nLook recursively in <module_path> for Python modules and packa... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sphinx/apidoc.py#L257-L385 | ||
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python2/genshi/filters/transform.py | python | StreamBuffer.__init__ | (self) | Create the buffer. | Create the buffer. | [
"Create",
"the",
"buffer",
"."
] | def __init__(self):
"""Create the buffer."""
Stream.__init__(self, []) | [
"def",
"__init__",
"(",
"self",
")",
":",
"Stream",
".",
"__init__",
"(",
"self",
",",
"[",
"]",
")"
] | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/genshi/filters/transform.py#L1213-L1215 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/mailbox.py | python | Maildir.__setitem__ | (self, key, message) | Replace the keyed message; raise KeyError if it doesn't exist. | Replace the keyed message; raise KeyError if it doesn't exist. | [
"Replace",
"the",
"keyed",
"message",
";",
"raise",
"KeyError",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""
old_subpath = self._lookup(key)
temp_key = self.add(message)
temp_subpath = self._lookup(temp_key)
if isinstance(message, MaildirMessage):
# temp's subdir and suf... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"message",
")",
":",
"old_subpath",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"temp_key",
"=",
"self",
".",
"add",
"(",
"message",
")",
"temp_subpath",
"=",
"self",
".",
"_lookup",
"(",
"temp_key"... | 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/mailbox.py#L308-L329 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/colorsys.py | python | _v | (m1, m2, hue) | return m1 | [] | def _v(m1, m2, hue):
hue = hue % 1.0
if hue < ONE_SIXTH:
return m1 + (m2-m1)*hue*6.0
if hue < 0.5:
return m2
if hue < TWO_THIRD:
return m1 + (m2-m1)*(TWO_THIRD-hue)*6.0
return m1 | [
"def",
"_v",
"(",
"m1",
",",
"m2",
",",
"hue",
")",
":",
"hue",
"=",
"hue",
"%",
"1.0",
"if",
"hue",
"<",
"ONE_SIXTH",
":",
"return",
"m1",
"+",
"(",
"m2",
"-",
"m1",
")",
"*",
"hue",
"*",
"6.0",
"if",
"hue",
"<",
"0.5",
":",
"return",
"m2"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/colorsys.py#L109-L117 | |||
palewire/django-postgres-copy | a521aad0e6b054f755c4e2fb502ea48386a63b27 | postgres_copy/copy_from.py | python | CopyMapping.prep_copy | (self) | return sql % options | Creates a COPY statement that loads the CSV into a temporary table.
Returns SQL that can be run. | Creates a COPY statement that loads the CSV into a temporary table. | [
"Creates",
"a",
"COPY",
"statement",
"that",
"loads",
"the",
"CSV",
"into",
"a",
"temporary",
"table",
"."
] | def prep_copy(self):
"""
Creates a COPY statement that loads the CSV into a temporary table.
Returns SQL that can be run.
"""
sql = """
COPY "%(db_table)s" (%(header_list)s)
FROM STDIN
WITH CSV HEADER %(extra_options)s;
"""
opt... | [
"def",
"prep_copy",
"(",
"self",
")",
":",
"sql",
"=",
"\"\"\"\n COPY \"%(db_table)s\" (%(header_list)s)\n FROM STDIN\n WITH CSV HEADER %(extra_options)s;\n \"\"\"",
"options",
"=",
"{",
"'db_table'",
":",
"self",
".",
"temp_table_name",
",",... | https://github.com/palewire/django-postgres-copy/blob/a521aad0e6b054f755c4e2fb502ea48386a63b27/postgres_copy/copy_from.py#L247-L279 | |
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/pitch.py | python | Pitch.pitchClass | (self) | return round(self.ps) % 12 | Returns or sets the integer value for the pitch, 0-11, where C=0,
C#=1, D=2...B=11. Can be set using integers (0-11) or 'A' or 'B'
for 10 or 11.
>>> a = pitch.Pitch('a3')
>>> a.pitchClass
9
>>> dis = pitch.Pitch('d3')
>>> dis.pitchClass
2
>>> dis.... | Returns or sets the integer value for the pitch, 0-11, where C=0,
C#=1, D=2...B=11. Can be set using integers (0-11) or 'A' or 'B'
for 10 or 11. | [
"Returns",
"or",
"sets",
"the",
"integer",
"value",
"for",
"the",
"pitch",
"0",
"-",
"11",
"where",
"C",
"=",
"0",
"C#",
"=",
"1",
"D",
"=",
"2",
"...",
"B",
"=",
"11",
".",
"Can",
"be",
"set",
"using",
"integers",
"(",
"0",
"-",
"11",
")",
"... | def pitchClass(self) -> int:
'''
Returns or sets the integer value for the pitch, 0-11, where C=0,
C#=1, D=2...B=11. Can be set using integers (0-11) or 'A' or 'B'
for 10 or 11.
>>> a = pitch.Pitch('a3')
>>> a.pitchClass
9
>>> dis = pitch.Pitch('d3')
... | [
"def",
"pitchClass",
"(",
"self",
")",
"->",
"int",
":",
"return",
"round",
"(",
"self",
".",
"ps",
")",
"%",
"12"
] | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/pitch.py#L2826-L2925 | |
justinmeister/The-Stolen-Crown-RPG | 91a9949cc8ed9a2054c3b1ab8efe46678be0fcf4 | data/states/levels.py | python | LevelState.slow_fade_out | (self, surface, *args) | Transition level to new scene. | Transition level to new scene. | [
"Transition",
"level",
"to",
"new",
"scene",
"."
] | def slow_fade_out(self, surface, *args):
"""
Transition level to new scene.
"""
transition_image = pg.Surface(self.transition_rect.size)
transition_image.fill(c.TRANSITION_COLOR)
transition_image.set_alpha(self.transition_alpha)
self.draw_level(surface)
su... | [
"def",
"slow_fade_out",
"(",
"self",
",",
"surface",
",",
"*",
"args",
")",
":",
"transition_image",
"=",
"pg",
".",
"Surface",
"(",
"self",
".",
"transition_rect",
".",
"size",
")",
"transition_image",
".",
"fill",
"(",
"c",
".",
"TRANSITION_COLOR",
")",
... | https://github.com/justinmeister/The-Stolen-Crown-RPG/blob/91a9949cc8ed9a2054c3b1ab8efe46678be0fcf4/data/states/levels.py#L457-L469 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.