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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/ssl.py | python | SSLSocket.do_handshake | (self, block=False) | Perform a TLS/SSL handshake. | Perform a TLS/SSL handshake. | [
"Perform",
"a",
"TLS",
"/",
"SSL",
"handshake",
"."
] | def do_handshake(self, block=False):
"""Perform a TLS/SSL handshake."""
self._check_connected()
timeout = self.gettimeout()
try:
if timeout == 0.0 and block:
self.settimeout(None)
self._sslobj.do_handshake()
finally:
self.settim... | [
"def",
"do_handshake",
"(",
"self",
",",
"block",
"=",
"False",
")",
":",
"self",
".",
"_check_connected",
"(",
")",
"timeout",
"=",
"self",
".",
"gettimeout",
"(",
")",
"try",
":",
"if",
"timeout",
"==",
"0.0",
"and",
"block",
":",
"self",
".",
"set... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/ssl.py#L806-L821 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/lib/core/option.py | python | _urllib2Opener | () | This function creates the urllib2 OpenerDirector. | This function creates the urllib2 OpenerDirector. | [
"This",
"function",
"creates",
"the",
"urllib2",
"OpenerDirector",
"."
] | def _urllib2Opener():
"""
This function creates the urllib2 OpenerDirector.
"""
debugMsg = "creating HTTP requests opener object"
logger.debug(debugMsg)
handlers = [proxyHandler, authHandler, redirectHandler, rangeHandler, httpsHandler]
if not conf.dropSetCookie:
if not conf.loadC... | [
"def",
"_urllib2Opener",
"(",
")",
":",
"debugMsg",
"=",
"\"creating HTTP requests opener object\"",
"logger",
".",
"debug",
"(",
"debugMsg",
")",
"handlers",
"=",
"[",
"proxyHandler",
",",
"authHandler",
",",
"redirectHandler",
",",
"rangeHandler",
",",
"httpsHandl... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/lib/core/option.py#L161-L195 | ||
WangYueFt/rfs | f8c837ba93c62dd0ac68a2f4019c619aa86b8421 | models/util.py | python | create_model | (name, n_cls, dataset='miniImageNet') | return model | create model by name | create model by name | [
"create",
"model",
"by",
"name"
] | def create_model(name, n_cls, dataset='miniImageNet'):
"""create model by name"""
if dataset == 'miniImageNet' or dataset == 'tieredImageNet':
if name.endswith('v2') or name.endswith('v3'):
model = model_dict[name](num_classes=n_cls)
elif name.startswith('resnet50'):
prin... | [
"def",
"create_model",
"(",
"name",
",",
"n_cls",
",",
"dataset",
"=",
"'miniImageNet'",
")",
":",
"if",
"dataset",
"==",
"'miniImageNet'",
"or",
"dataset",
"==",
"'tieredImageNet'",
":",
"if",
"name",
".",
"endswith",
"(",
"'v2'",
")",
"or",
"name",
".",
... | https://github.com/WangYueFt/rfs/blob/f8c837ba93c62dd0ac68a2f4019c619aa86b8421/models/util.py#L7-L33 | |
scivision/PyLivestream | 6c8243dd8ef76e2d441489198a346f5ed5bc262b | src/pylivestream/utils.py | python | run | (cmd: list[str]) | FIXME: shell=True for Windows seems necessary to specify devices enclosed by "" quotes | FIXME: shell=True for Windows seems necessary to specify devices enclosed by "" quotes | [
"FIXME",
":",
"shell",
"=",
"True",
"for",
"Windows",
"seems",
"necessary",
"to",
"specify",
"devices",
"enclosed",
"by",
"quotes"
] | def run(cmd: list[str]):
"""
FIXME: shell=True for Windows seems necessary to specify devices enclosed by "" quotes
"""
print("\n", " ".join(cmd), "\n")
if sys.platform == "win32":
subprocess.run(" ".join(cmd), shell=True)
else:
subprocess.run(cmd) | [
"def",
"run",
"(",
"cmd",
":",
"list",
"[",
"str",
"]",
")",
":",
"print",
"(",
"\"\\n\"",
",",
"\" \"",
".",
"join",
"(",
"cmd",
")",
",",
"\"\\n\"",
")",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"subprocess",
".",
"run",
"(",
"\" \... | https://github.com/scivision/PyLivestream/blob/6c8243dd8ef76e2d441489198a346f5ed5bc262b/src/pylivestream/utils.py#L12-L22 | ||
Epistimio/orion | 732e739d99561020dbe620760acf062ade746006 | src/orion/algo/base.py | python | BaseAlgorithm.format_trial | (self, trial) | return trial | Format trial based on space transformations
This will apply the reverse transformation on the trial and then
transform it again.
Some transformations are lossy and thus the trials suggested by the algorithm could
be different when returned to `observe`. Using `format_trial` makes it po... | Format trial based on space transformations | [
"Format",
"trial",
"based",
"on",
"space",
"transformations"
] | def format_trial(self, trial):
"""Format trial based on space transformations
This will apply the reverse transformation on the trial and then
transform it again.
Some transformations are lossy and thus the trials suggested by the algorithm could
be different when returned to `... | [
"def",
"format_trial",
"(",
"self",
",",
"trial",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"space",
",",
"\"transform\"",
")",
":",
"trial",
"=",
"self",
".",
"space",
".",
"transform",
"(",
"self",
".",
"space",
".",
"reverse",
"(",
"trial",
")"... | https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/algo/base.py#L141-L162 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/internet/epollreactor.py | python | EPollReactor._add | (self, xer, primary, other, selectables, event, antievent) | Private method for adding a descriptor from the event loop.
It takes care of adding it if new or modifying it if already added
for another state (read -> read/write for example). | Private method for adding a descriptor from the event loop. | [
"Private",
"method",
"for",
"adding",
"a",
"descriptor",
"from",
"the",
"event",
"loop",
"."
] | def _add(self, xer, primary, other, selectables, event, antievent):
"""
Private method for adding a descriptor from the event loop.
It takes care of adding it if new or modifying it if already added
for another state (read -> read/write for example).
"""
fd = xer.fileno... | [
"def",
"_add",
"(",
"self",
",",
"xer",
",",
"primary",
",",
"other",
",",
"selectables",
",",
"event",
",",
"antievent",
")",
":",
"fd",
"=",
"xer",
".",
"fileno",
"(",
")",
"if",
"fd",
"not",
"in",
"primary",
":",
"cmd",
"=",
"_epoll",
".",
"CT... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/epollreactor.py#L69-L93 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/tcl/tkinter/__init__.py | python | PanedWindow.remove | (self, child) | Remove the pane containing child from the panedwindow
All geometry management options for child will be forgotten. | Remove the pane containing child from the panedwindow | [
"Remove",
"the",
"pane",
"containing",
"child",
"from",
"the",
"panedwindow"
] | def remove(self, child):
"""Remove the pane containing child from the panedwindow
All geometry management options for child will be forgotten.
"""
self.tk.call(self._w, 'forget', child) | [
"def",
"remove",
"(",
"self",
",",
"child",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'forget'",
",",
"child",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/tcl/tkinter/__init__.py#L4420-L4425 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/distillation/train.py | python | sanity_checks | (args) | A bunch of args sanity checks to perform even starting... | A bunch of args sanity checks to perform even starting... | [
"A",
"bunch",
"of",
"args",
"sanity",
"checks",
"to",
"perform",
"even",
"starting",
"..."
] | def sanity_checks(args):
"""
A bunch of args sanity checks to perform even starting...
"""
assert (args.mlm and args.alpha_mlm > 0.0) or (not args.mlm and args.alpha_mlm == 0.0)
assert (args.alpha_mlm > 0.0 and args.alpha_clm == 0.0) or (args.alpha_mlm == 0.0 and args.alpha_clm > 0.0)
if args.ml... | [
"def",
"sanity_checks",
"(",
"args",
")",
":",
"assert",
"(",
"args",
".",
"mlm",
"and",
"args",
".",
"alpha_mlm",
">",
"0.0",
")",
"or",
"(",
"not",
"args",
".",
"mlm",
"and",
"args",
".",
"alpha_mlm",
"==",
"0.0",
")",
"assert",
"(",
"args",
".",... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/distillation/train.py#L55-L82 | ||
Freeseer/freeseer | 73c53ab6f1f22dfc89a782728f3b3070ee71b690 | src/freeseer/frontend/record/record.py | python | RecordApp.load_backend | (self) | Prepares the backend for recording | Prepares the backend for recording | [
"Prepares",
"the",
"backend",
"for",
"recording"
] | def load_backend(self):
"""Prepares the backend for recording"""
if self.current_presentation():
presentation = self.current_presentation()
# If current presentation is no existant (empty talk database)
# use a default recording name.
else:
presentation =... | [
"def",
"load_backend",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_presentation",
"(",
")",
":",
"presentation",
"=",
"self",
".",
"current_presentation",
"(",
")",
"# If current presentation is no existant (empty talk database)",
"# use a default recording name.",
... | https://github.com/Freeseer/freeseer/blob/73c53ab6f1f22dfc89a782728f3b3070ee71b690/src/freeseer/frontend/record/record.py#L556-L570 | ||
facebookresearch/detectron2 | cb92ae1763cd7d3777c243f07749574cdaec6cb8 | detectron2/modeling/meta_arch/dense_detector.py | python | DenseDetector.visualize_training | (self, batched_inputs, results) | A function used to visualize ground truth images and final network predictions.
It shows ground truth bounding boxes on the original image and up to 20
predicted object bounding boxes on the original image.
Args:
batched_inputs (list): a list that contains input to the model.
... | A function used to visualize ground truth images and final network predictions.
It shows ground truth bounding boxes on the original image and up to 20
predicted object bounding boxes on the original image. | [
"A",
"function",
"used",
"to",
"visualize",
"ground",
"truth",
"images",
"and",
"final",
"network",
"predictions",
".",
"It",
"shows",
"ground",
"truth",
"bounding",
"boxes",
"on",
"the",
"original",
"image",
"and",
"up",
"to",
"20",
"predicted",
"object",
"... | def visualize_training(self, batched_inputs, results):
"""
A function used to visualize ground truth images and final network predictions.
It shows ground truth bounding boxes on the original image and up to 20
predicted object bounding boxes on the original image.
Args:
... | [
"def",
"visualize_training",
"(",
"self",
",",
"batched_inputs",
",",
"results",
")",
":",
"from",
"detectron2",
".",
"utils",
".",
"visualizer",
"import",
"Visualizer",
"assert",
"len",
"(",
"batched_inputs",
")",
"==",
"len",
"(",
"results",
")",
",",
"\"C... | https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/detectron2/modeling/meta_arch/dense_detector.py#L249-L282 | ||
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/contrib/gis/db/models/fields.py | python | GeometryField.get_distance | (self, value, lookup_type, connection) | return connection.ops.get_distance(self, value, lookup_type) | Returns a distance number in units of the field. For example, if
`D(km=1)` was passed in and the units of the field were in meters,
then 1000 would be returned. | Returns a distance number in units of the field. For example, if
`D(km=1)` was passed in and the units of the field were in meters,
then 1000 would be returned. | [
"Returns",
"a",
"distance",
"number",
"in",
"units",
"of",
"the",
"field",
".",
"For",
"example",
"if",
"D",
"(",
"km",
"=",
"1",
")",
"was",
"passed",
"in",
"and",
"the",
"units",
"of",
"the",
"field",
"were",
"in",
"meters",
"then",
"1000",
"would"... | def get_distance(self, value, lookup_type, connection):
"""
Returns a distance number in units of the field. For example, if
`D(km=1)` was passed in and the units of the field were in meters,
then 1000 would be returned.
"""
return connection.ops.get_distance(self, value... | [
"def",
"get_distance",
"(",
"self",
",",
"value",
",",
"lookup_type",
",",
"connection",
")",
":",
"return",
"connection",
".",
"ops",
".",
"get_distance",
"(",
"self",
",",
"value",
",",
"lookup_type",
")"
] | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/gis/db/models/fields.py#L134-L140 | |
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/kern/src/add.py | python | Add.__init__ | (self, subkerns, name='sum') | [] | def __init__(self, subkerns, name='sum'):
_newkerns = []
for kern in subkerns:
if isinstance(kern, Add):
for part in kern.parts:
#kern.unlink_parameter(part)
_newkerns.append(part.copy())
else:
_newkerns.appe... | [
"def",
"__init__",
"(",
"self",
",",
"subkerns",
",",
"name",
"=",
"'sum'",
")",
":",
"_newkerns",
"=",
"[",
"]",
"for",
"kern",
"in",
"subkerns",
":",
"if",
"isinstance",
"(",
"kern",
",",
"Add",
")",
":",
"for",
"part",
"in",
"kern",
".",
"parts"... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/kern/src/add.py#L20-L31 | ||||
translate/virtaal | 8b0a6fbf764ed92cc44a189499dec399c6423761 | virtaal/controllers/checkscontroller.py | python | ChecksController.get_check_name | (self, check) | return name | Return the human readable form of the given check name. | Return the human readable form of the given check name. | [
"Return",
"the",
"human",
"readable",
"form",
"of",
"the",
"given",
"check",
"name",
"."
] | def get_check_name(self, check):
"""Return the human readable form of the given check name."""
name = check_names.get(check, None)
if not name and check.startswith('check-'):
check = check[len('check-'):]
name = check_names.get(check, None)
if not name:
... | [
"def",
"get_check_name",
"(",
"self",
",",
"check",
")",
":",
"name",
"=",
"check_names",
".",
"get",
"(",
"check",
",",
"None",
")",
"if",
"not",
"name",
"and",
"check",
".",
"startswith",
"(",
"'check-'",
")",
":",
"check",
"=",
"check",
"[",
"len"... | https://github.com/translate/virtaal/blob/8b0a6fbf764ed92cc44a189499dec399c6423761/virtaal/controllers/checkscontroller.py#L214-L222 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/wsgi.py | python | Gateway_u0._decode_value | (item) | return k, v.decode('ISO-8859-1') | [] | def _decode_value(item):
k, v = item
skip_keys = 'REQUEST_URI', 'wsgi.input'
if not six.PY2 or not isinstance(v, bytes) or k in skip_keys:
return k, v
return k, v.decode('ISO-8859-1') | [
"def",
"_decode_value",
"(",
"item",
")",
":",
"k",
",",
"v",
"=",
"item",
"skip_keys",
"=",
"'REQUEST_URI'",
",",
"'wsgi.input'",
"if",
"not",
"six",
".",
"PY2",
"or",
"not",
"isinstance",
"(",
"v",
",",
"bytes",
")",
"or",
"k",
"in",
"skip_keys",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/wsgi.py#L360-L365 | |||
micropython/micropython-lib | cdd260f0792d04a1ded99171b4c7a2582b7856b4 | python-stdlib/heapq/heapq.py | python | merge | (*iterables) | Merge multiple sorted inputs into a single sorted output.
Similar to sorted(itertools.chain(*iterables)) but returns a generator,
does not pull the data into memory all at once, and assumes that each of
the input streams is already sorted (smallest to largest).
>>> list(merge([1,3,5,7], [0,2,4,8], [5,... | Merge multiple sorted inputs into a single sorted output. | [
"Merge",
"multiple",
"sorted",
"inputs",
"into",
"a",
"single",
"sorted",
"output",
"."
] | def merge(*iterables):
"""Merge multiple sorted inputs into a single sorted output.
Similar to sorted(itertools.chain(*iterables)) but returns a generator,
does not pull the data into memory all at once, and assumes that each of
the input streams is already sorted (smallest to largest).
>>> list(m... | [
"def",
"merge",
"(",
"*",
"iterables",
")",
":",
"_heappop",
",",
"_heapreplace",
",",
"_StopIteration",
"=",
"heappop",
",",
"heapreplace",
",",
"StopIteration",
"_len",
"=",
"len",
"h",
"=",
"[",
"]",
"h_append",
"=",
"h",
".",
"append",
"for",
"itnum"... | https://github.com/micropython/micropython-lib/blob/cdd260f0792d04a1ded99171b4c7a2582b7856b4/python-stdlib/heapq/heapq.py#L377-L414 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/zipfile.py | python | ZipFile.close | (self) | Close the file, and for mode "w" and "a" write the ending
records. | Close the file, and for mode "w" and "a" write the ending
records. | [
"Close",
"the",
"file",
"and",
"for",
"mode",
"w",
"and",
"a",
"write",
"the",
"ending",
"records",
"."
] | def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mode in ("w", "a") and self._didModify: # write ending records
count = 0
pos1 = self.fp.tell()
for zinfo in self.f... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
"is",
"None",
":",
"return",
"if",
"self",
".",
"mode",
"in",
"(",
"\"w\"",
",",
"\"a\"",
")",
"and",
"self",
".",
"_didModify",
":",
"# write ending records",
"count",
"=",
"0",
"pos1",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/zipfile.py#L1152-L1260 | ||
Xavier-Lam/wechat-django | 258e193e9ec9558709e889fd105c9bf474b013e6 | wechat_django/admin/views/user.py | python | WeChatUserAdmin.has_add_permission | (self, request) | return False | [] | def has_add_permission(self, request):
return False | [
"def",
"has_add_permission",
"(",
"self",
",",
"request",
")",
":",
"return",
"False"
] | https://github.com/Xavier-Lam/wechat-django/blob/258e193e9ec9558709e889fd105c9bf474b013e6/wechat_django/admin/views/user.py#L130-L131 | |||
pyserial/pyserial-asyncio | 44d470181af989fb35fbe5062f47f8eaf5b7939a | serial_asyncio/__init__.py | python | SerialTransport.set_write_buffer_limits | (self, high=None, low=None) | Set the high- and low-water limits for write flow control.
These two values control when the protocol’s
pause_writing()and resume_writing() methods are called. If
specified, the low-water limit must be less than or equal to
the high-water limit. Neither high nor low can be negative. | Set the high- and low-water limits for write flow control. | [
"Set",
"the",
"high",
"-",
"and",
"low",
"-",
"water",
"limits",
"for",
"write",
"flow",
"control",
"."
] | def set_write_buffer_limits(self, high=None, low=None):
"""Set the high- and low-water limits for write flow control.
These two values control when the protocol’s
pause_writing()and resume_writing() methods are called. If
specified, the low-water limit must be less than or equal to
... | [
"def",
"set_write_buffer_limits",
"(",
"self",
",",
"high",
"=",
"None",
",",
"low",
"=",
"None",
")",
":",
"self",
".",
"_set_write_buffer_limits",
"(",
"high",
"=",
"high",
",",
"low",
"=",
"low",
")",
"self",
".",
"_maybe_pause_protocol",
"(",
")"
] | https://github.com/pyserial/pyserial-asyncio/blob/44d470181af989fb35fbe5062f47f8eaf5b7939a/serial_asyncio/__init__.py#L162-L171 | ||
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | pydevd_attach_to_process/winappdbg/system.py | python | System.adjust_privileges | (state, privileges) | Requests or drops privileges.
@type state: bool
@param state: C{True} to request, C{False} to drop.
@type privileges: list(int)
@param privileges: Privileges to request or drop.
@raise WindowsError: Raises an exception on error. | Requests or drops privileges. | [
"Requests",
"or",
"drops",
"privileges",
"."
] | def adjust_privileges(state, privileges):
"""
Requests or drops privileges.
@type state: bool
@param state: C{True} to request, C{False} to drop.
@type privileges: list(int)
@param privileges: Privileges to request or drop.
@raise WindowsError: Raises an exce... | [
"def",
"adjust_privileges",
"(",
"state",
",",
"privileges",
")",
":",
"with",
"win32",
".",
"OpenProcessToken",
"(",
"win32",
".",
"GetCurrentProcess",
"(",
")",
",",
"win32",
".",
"TOKEN_ADJUST_PRIVILEGES",
")",
"as",
"hToken",
":",
"NewState",
"=",
"(",
"... | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/pydevd_attach_to_process/winappdbg/system.py#L291-L306 | ||
hippich/Bitcoin-Poker-Room | b89e8c2df7a57d19d1aa6deff3f6a92ebe8134fa | lib/ppn/pokerengine/pokergame.py | python | PokerGame.canCheck | (self, serial) | return self.highestBetNotFold() <= self.getPlayer(serial).bet | Can check if all bets are equal | Can check if all bets are equal | [
"Can",
"check",
"if",
"all",
"bets",
"are",
"equal"
] | def canCheck(self, serial):
"""
Can check if all bets are equal
"""
if self.isBlindAnteRound():
return False
return self.highestBetNotFold() <= self.getPlayer(serial).bet | [
"def",
"canCheck",
"(",
"self",
",",
"serial",
")",
":",
"if",
"self",
".",
"isBlindAnteRound",
"(",
")",
":",
"return",
"False",
"return",
"self",
".",
"highestBetNotFold",
"(",
")",
"<=",
"self",
".",
"getPlayer",
"(",
"serial",
")",
".",
"bet"
] | https://github.com/hippich/Bitcoin-Poker-Room/blob/b89e8c2df7a57d19d1aa6deff3f6a92ebe8134fa/lib/ppn/pokerengine/pokergame.py#L1895-L1901 | |
Kkevsterrr/geneva | 36d3585545d4cb3450ea0b166d8d5f20a64ed8d8 | plugins/http/plugin.py | python | HTTPPluginRunner.__init__ | (self, args) | Marks this plugin as enabled | Marks this plugin as enabled | [
"Marks",
"this",
"plugin",
"as",
"enabled"
] | def __init__(self, args):
"""
Marks this plugin as enabled
"""
self.enabled = True | [
"def",
"__init__",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"enabled",
"=",
"True"
] | https://github.com/Kkevsterrr/geneva/blob/36d3585545d4cb3450ea0b166d8d5f20a64ed8d8/plugins/http/plugin.py#L50-L54 | ||
google/tf-quant-finance | 8fd723689ebf27ff4bb2bd2acb5f6091c5e07309 | tf_quant_finance/datetime/holiday_calendar_factory.py | python | _tensor_is_not_empty | (t) | return bool(t) | Returns whether t is definitely not empty. | Returns whether t is definitely not empty. | [
"Returns",
"whether",
"t",
"is",
"definitely",
"not",
"empty",
"."
] | def _tensor_is_not_empty(t):
"""Returns whether t is definitely not empty."""
# False means either empty or unknown.
if t is None:
return False
if isinstance(t, np.ndarray):
return t.size > 0
if isinstance(t, tf.Tensor):
num_elem = t.shape.num_elements
return num_elem is not None and num_elem ... | [
"def",
"_tensor_is_not_empty",
"(",
"t",
")",
":",
"# False means either empty or unknown.",
"if",
"t",
"is",
"None",
":",
"return",
"False",
"if",
"isinstance",
"(",
"t",
",",
"np",
".",
"ndarray",
")",
":",
"return",
"t",
".",
"size",
">",
"0",
"if",
"... | https://github.com/google/tf-quant-finance/blob/8fd723689ebf27ff4bb2bd2acb5f6091c5e07309/tf_quant_finance/datetime/holiday_calendar_factory.py#L96-L106 | |
hkociemba/RubiksCube-TwophaseSolver | e5deb0a9c89bdc1f2db015da7c6c4b4293c9509c | package_src/twophase/cubie.py | python | CubieCube.__eq__ | (self, other) | Define equality of two cubie cubes. | Define equality of two cubie cubes. | [
"Define",
"equality",
"of",
"two",
"cubie",
"cubes",
"."
] | def __eq__(self, other):
"""Define equality of two cubie cubes."""
if self.cp == other.cp and self.co == other.co and self.ep == other.ep and self.eo == other.eo:
return True
else:
return False | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"cp",
"==",
"other",
".",
"cp",
"and",
"self",
".",
"co",
"==",
"other",
".",
"co",
"and",
"self",
".",
"ep",
"==",
"other",
".",
"ep",
"and",
"self",
".",
"eo",
"==",
"... | https://github.com/hkociemba/RubiksCube-TwophaseSolver/blob/e5deb0a9c89bdc1f2db015da7c6c4b4293c9509c/package_src/twophase/cubie.py#L94-L99 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/codecs.py | python | getincrementaldecoder | (encoding) | return decoder | Lookup up the codec for the given encoding and return
its IncrementalDecoder class or factory function.
Raises a LookupError in case the encoding cannot be found
or the codecs doesn't provide an incremental decoder. | Lookup up the codec for the given encoding and return
its IncrementalDecoder class or factory function. | [
"Lookup",
"up",
"the",
"codec",
"for",
"the",
"given",
"encoding",
"and",
"return",
"its",
"IncrementalDecoder",
"class",
"or",
"factory",
"function",
"."
] | def getincrementaldecoder(encoding):
""" Lookup up the codec for the given encoding and return
its IncrementalDecoder class or factory function.
Raises a LookupError in case the encoding cannot be found
or the codecs doesn't provide an incremental decoder.
"""
decoder = lookup(enc... | [
"def",
"getincrementaldecoder",
"(",
"encoding",
")",
":",
"decoder",
"=",
"lookup",
"(",
"encoding",
")",
".",
"incrementaldecoder",
"if",
"decoder",
"is",
"None",
":",
"raise",
"LookupError",
"(",
"encoding",
")",
"return",
"decoder"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/codecs.py#L962-L974 | |
EasyIME/PIME | 0f1eee10169c1cb2eaa0b59a77fa6f931ecb33b3 | python/python3/tornado/options.py | python | OptionParser.items | (self) | return [(opt.name, opt.value()) for name, opt in self._options.items()] | An iterable of (name, value) pairs.
.. versionadded:: 3.1 | An iterable of (name, value) pairs. | [
"An",
"iterable",
"of",
"(",
"name",
"value",
")",
"pairs",
"."
] | def items(self) -> Iterable[Tuple[str, Any]]:
"""An iterable of (name, value) pairs.
.. versionadded:: 3.1
"""
return [(opt.name, opt.value()) for name, opt in self._options.items()] | [
"def",
"items",
"(",
"self",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"[",
"(",
"opt",
".",
"name",
",",
"opt",
".",
"value",
"(",
")",
")",
"for",
"name",
",",
"opt",
"in",
"self",
".",
"_options",
... | https://github.com/EasyIME/PIME/blob/0f1eee10169c1cb2eaa0b59a77fa6f931ecb33b3/python/python3/tornado/options.py#L173-L178 | |
roytseng-tw/Detectron.pytorch | 1b1c4ba58428b7277a45b0dce6cc1bce3744b86a | lib/utils/net.py | python | affine_grid_gen | (rois, input_size, grid_size) | return grid | [] | def affine_grid_gen(rois, input_size, grid_size):
rois = rois.detach()
x1 = rois[:, 1::4] / 16.0
y1 = rois[:, 2::4] / 16.0
x2 = rois[:, 3::4] / 16.0
y2 = rois[:, 4::4] / 16.0
height = input_size[0]
width = input_size[1]
zero = Variable(rois.data.new(rois.size(0), 1).zero_())
theta... | [
"def",
"affine_grid_gen",
"(",
"rois",
",",
"input_size",
",",
"grid_size",
")",
":",
"rois",
"=",
"rois",
".",
"detach",
"(",
")",
"x1",
"=",
"rois",
"[",
":",
",",
"1",
":",
":",
"4",
"]",
"/",
"16.0",
"y1",
"=",
"rois",
"[",
":",
",",
"2",
... | https://github.com/roytseng-tw/Detectron.pytorch/blob/1b1c4ba58428b7277a45b0dce6cc1bce3744b86a/lib/utils/net.py#L110-L132 | |||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_file_types/nc_functions/nc_utils.py | python | get_nc_auxiliary_coordinate_variables | (nc_dataset) | return nc_auxiliary_coordinate_variables | (object) -> dict
Return: the netCDF auxiliary coordinate variables
Format: {'var_name': var_obj} | (object) -> dict | [
"(",
"object",
")",
"-",
">",
"dict"
] | def get_nc_auxiliary_coordinate_variables(nc_dataset):
"""
(object) -> dict
Return: the netCDF auxiliary coordinate variables
Format: {'var_name': var_obj}
"""
nc_auxiliary_coordinate_variable_namelist = \
get_nc_auxiliary_coordinate_variable_namelist(nc_dataset)
nc_auxiliary_coord... | [
"def",
"get_nc_auxiliary_coordinate_variables",
"(",
"nc_dataset",
")",
":",
"nc_auxiliary_coordinate_variable_namelist",
"=",
"get_nc_auxiliary_coordinate_variable_namelist",
"(",
"nc_dataset",
")",
"nc_auxiliary_coordinate_variables",
"=",
"{",
"}",
"for",
"name",
"in",
"nc_a... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_file_types/nc_functions/nc_utils.py#L256-L271 | |
atlassian-api/atlassian-python-api | 6d8545a790c3aae10b75bdc225fb5c3a0aee44db | atlassian/bitbucket/cloud/repositories/pullRequests.py | python | Build.stopped | (self) | return self.get_data("state") == self.STATE_STOPPED | True if the build was stopped | True if the build was stopped | [
"True",
"if",
"the",
"build",
"was",
"stopped"
] | def stopped(self):
"""True if the build was stopped"""
return self.get_data("state") == self.STATE_STOPPED | [
"def",
"stopped",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_data",
"(",
"\"state\"",
")",
"==",
"self",
".",
"STATE_STOPPED"
] | https://github.com/atlassian-api/atlassian-python-api/blob/6d8545a790c3aae10b75bdc225fb5c3a0aee44db/atlassian/bitbucket/cloud/repositories/pullRequests.py#L530-L532 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/wifitap/scapy.py | python | SndRcvList.__init__ | (self, res, name="Results", stats=None) | [] | def __init__(self, res, name="Results", stats=None):
PacketList.__init__(self, res, name, stats) | [
"def",
"__init__",
"(",
"self",
",",
"res",
",",
"name",
"=",
"\"Results\"",
",",
"stats",
"=",
"None",
")",
":",
"PacketList",
".",
"__init__",
"(",
"self",
",",
"res",
",",
"name",
",",
"stats",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifitap/scapy.py#L3189-L3190 | ||||
vadmium/python-altium | 9e3cf5a16150e74ba2b7e6d1f2895e0ce16b9a05 | vector/svg.py | python | Renderer.polygon | (self, points, *,
offset=None, rotate=None, outline=None, fill=None, width=None) | [] | def polygon(self, points, *,
offset=None, rotate=None, outline=None, fill=None, width=None):
s = list()
for (x, y) in points:
s.append("{},{}".format(x, y * self.flip[1]))
attrs = {"points": " ".join(s)}
style = list()
transform = self._offset(offset)
if r... | [
"def",
"polygon",
"(",
"self",
",",
"points",
",",
"*",
",",
"offset",
"=",
"None",
",",
"rotate",
"=",
"None",
",",
"outline",
"=",
"None",
",",
"fill",
"=",
"None",
",",
"width",
"=",
"None",
")",
":",
"s",
"=",
"list",
"(",
")",
"for",
"(",
... | https://github.com/vadmium/python-altium/blob/9e3cf5a16150e74ba2b7e6d1f2895e0ce16b9a05/vector/svg.py#L156-L167 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/urllib/request.py | python | Request._parse | (self) | [] | def _parse(self):
self.type, rest = splittype(self.full_url)
if self.type is None:
raise ValueError("unknown url type: %s" % self.full_url)
self.host, self.selector = splithost(rest)
if self.host:
self.host = unquote(self.host) | [
"def",
"_parse",
"(",
"self",
")",
":",
"self",
".",
"type",
",",
"rest",
"=",
"splittype",
"(",
"self",
".",
"full_url",
")",
"if",
"self",
".",
"type",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"unknown url type: %s\"",
"%",
"self",
".",
"full... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/urllib/request.py#L196-L202 | ||||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/xml/sax/saxutils.py | python | quoteattr | (data, entities={}) | return data | Escape and quote an attribute value.
Escape &, <, and > in a string of data, then quote it for use as
an attribute value. The \" character will be escaped as well, if
necessary.
You can escape other strings of data by passing a dictionary as
the optional entities parameter. The keys and values m... | Escape and quote an attribute value. | [
"Escape",
"and",
"quote",
"an",
"attribute",
"value",
"."
] | def quoteattr(data, entities={}):
"""Escape and quote an attribute value.
Escape &, <, and > in a string of data, then quote it for use as
an attribute value. The \" character will be escaped as well, if
necessary.
You can escape other strings of data by passing a dictionary as
the optional e... | [
"def",
"quoteattr",
"(",
"data",
",",
"entities",
"=",
"{",
"}",
")",
":",
"entities",
"=",
"entities",
".",
"copy",
"(",
")",
"entities",
".",
"update",
"(",
"{",
"'\\n'",
":",
"' '",
",",
"'\\r'",
":",
"' '",
",",
"'\\t'",
":",
"'	'",
... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/xml/sax/saxutils.py#L53-L74 | |
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/core/py_utils.py | python | ReadFileLines | (file_path) | return lines | Read a text file and return the lines.
If the file cannot be found at the given path, attempt to load it from the
Lingvo package (useful for data dependencies in par files).
Args:
file_path: path to file, either absolute or relative to the bazel workspace.
Returns:
A list of lines from the file. | Read a text file and return the lines. | [
"Read",
"a",
"text",
"file",
"and",
"return",
"the",
"lines",
"."
] | def ReadFileLines(file_path):
"""Read a text file and return the lines.
If the file cannot be found at the given path, attempt to load it from the
Lingvo package (useful for data dependencies in par files).
Args:
file_path: path to file, either absolute or relative to the bazel workspace.
Returns:
... | [
"def",
"ReadFileLines",
"(",
"file_path",
")",
":",
"if",
"not",
"tf",
".",
"io",
".",
"gfile",
".",
"exists",
"(",
"file_path",
")",
":",
"try",
":",
"lines",
"=",
"pkgutil",
".",
"get_data",
"(",
"'lingvo'",
",",
"file_path",
".",
"replace",
"(",
"... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/py_utils.py#L4950-L4978 | |
binaryage/drydrop | 2f27e15befd247255d89f9120eeee44851b82c4a | dryapp/jinja2/filters.py | python | do_last | (environment, seq) | Return the last item of a sequence. | Return the last item of a sequence. | [
"Return",
"the",
"last",
"item",
"of",
"a",
"sequence",
"."
] | def do_last(environment, seq):
"""Return the last item of a sequence."""
try:
return iter(reversed(seq)).next()
except StopIteration:
return environment.undefined('No last item, sequence was empty.') | [
"def",
"do_last",
"(",
"environment",
",",
"seq",
")",
":",
"try",
":",
"return",
"iter",
"(",
"reversed",
"(",
"seq",
")",
")",
".",
"next",
"(",
")",
"except",
"StopIteration",
":",
"return",
"environment",
".",
"undefined",
"(",
"'No last item, sequence... | https://github.com/binaryage/drydrop/blob/2f27e15befd247255d89f9120eeee44851b82c4a/dryapp/jinja2/filters.py#L268-L273 | ||
viewflow/viewflow | 2389bd379a2ab22cc277585df7c09514e273541d | viewflow/nodes/view.py | python | View.__init__ | (self, *args, **kwargs) | Instantiate a View node.
:keyword assign_view: Overides default AssignView for the node
:keyword unassign_view: Overides default UnassignView for the node | Instantiate a View node. | [
"Instantiate",
"a",
"View",
"node",
"."
] | def __init__(self, *args, **kwargs):
"""
Instantiate a View node.
:keyword assign_view: Overides default AssignView for the node
:keyword unassign_view: Overides default UnassignView for the node
"""
self._assign_view = kwargs.pop('assign_view', None)
self._unass... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_assign_view",
"=",
"kwargs",
".",
"pop",
"(",
"'assign_view'",
",",
"None",
")",
"self",
".",
"_unassign_view",
"=",
"kwargs",
".",
"pop",
"(",
"'unas... | https://github.com/viewflow/viewflow/blob/2389bd379a2ab22cc277585df7c09514e273541d/viewflow/nodes/view.py#L183-L193 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/experiment/loops.py | python | StairHandler.__init__ | (self, exp, name, nReps='50', startVal='', nReversals='',
nUp=1, nDown=3, minVal=0, maxVal=1,
stepSizes='[4,4,2,2,1]', stepType='db', endPoints=(0, 1),
isTrials=True) | @param name: name of the loop e.g. trials
@type name: string
@param nReps: number of reps (for all conditions)
@type nReps:int | [] | def __init__(self, exp, name, nReps='50', startVal='', nReversals='',
nUp=1, nDown=3, minVal=0, maxVal=1,
stepSizes='[4,4,2,2,1]', stepType='db', endPoints=(0, 1),
isTrials=True):
"""
@param name: name of the loop e.g. trials
@type name: string
... | [
"def",
"__init__",
"(",
"self",
",",
"exp",
",",
"name",
",",
"nReps",
"=",
"'50'",
",",
"startVal",
"=",
"''",
",",
"nReversals",
"=",
"''",
",",
"nUp",
"=",
"1",
",",
"nDown",
"=",
"3",
",",
"minVal",
"=",
"0",
",",
"maxVal",
"=",
"1",
",",
... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/experiment/loops.py#L340-L421 | |||
pympler/pympler | 8019a883eec547d91ecda6ba12669d4f4504c625 | run.py | python | run_unittests | (project_path, dirs=[], coverage=False) | Run unittests for all given test directories.
If no tests are given, all unittests will be executed. | Run unittests for all given test directories. | [
"Run",
"unittests",
"for",
"all",
"given",
"test",
"directories",
"."
] | def run_unittests(project_path, dirs=[], coverage=False):
'''Run unittests for all given test directories.
If no tests are given, all unittests will be executed.
'''
# run unittests using test/runtest.py *dirs
if not coverage:
run_command(_Python_path, # use this Python binary
... | [
"def",
"run_unittests",
"(",
"project_path",
",",
"dirs",
"=",
"[",
"]",
",",
"coverage",
"=",
"False",
")",
":",
"# run unittests using test/runtest.py *dirs",
"if",
"not",
"coverage",
":",
"run_command",
"(",
"_Python_path",
",",
"# use this Python binary",
"os",... | https://github.com/pympler/pympler/blob/8019a883eec547d91ecda6ba12669d4f4504c625/run.py#L146-L171 | ||
laramies/theHarvester | bee3174d427c3cc4048200190baca6efef38ce15 | theHarvester/discovery/constants.py | python | google_workaround | (visit_url: str) | return correct_html | Function that makes a request on our behalf, if Google starts to block us
:param visit_url: Url to scrape
:return: Correct html that can be parsed by BS4 | Function that makes a request on our behalf, if Google starts to block us
:param visit_url: Url to scrape
:return: Correct html that can be parsed by BS4 | [
"Function",
"that",
"makes",
"a",
"request",
"on",
"our",
"behalf",
"if",
"Google",
"starts",
"to",
"block",
"us",
":",
"param",
"visit_url",
":",
"Url",
"to",
"scrape",
":",
"return",
":",
"Correct",
"html",
"that",
"can",
"be",
"parsed",
"by",
"BS4"
] | async def google_workaround(visit_url: str) -> Union[bool, str]:
"""
Function that makes a request on our behalf, if Google starts to block us
:param visit_url: Url to scrape
:return: Correct html that can be parsed by BS4
"""
url = 'https://websniffer.cc/'
data = {
'Cookie': '',
... | [
"async",
"def",
"google_workaround",
"(",
"visit_url",
":",
"str",
")",
"->",
"Union",
"[",
"bool",
",",
"str",
"]",
":",
"url",
"=",
"'https://websniffer.cc/'",
"data",
"=",
"{",
"'Cookie'",
":",
"''",
",",
"'url'",
":",
"visit_url",
",",
"'submit'",
":... | https://github.com/laramies/theHarvester/blob/bee3174d427c3cc4048200190baca6efef38ce15/theHarvester/discovery/constants.py#L71-L105 | |
TUDelft-CNS-ATM/bluesky | 55a538a3cd936f33cff9df650c38924aa97557b1 | bluesky/tools/misc.py | python | txt2lon | (lontxt) | return lon | txt2lat: input txt: N52'14'13.5 or N52 | txt2lat: input txt: N52'14'13.5 or N52 | [
"txt2lat",
":",
"input",
"txt",
":",
"N52",
"14",
"13",
".",
"5",
"or",
"N52"
] | def txt2lon(lontxt):
"""txt2lat: input txt: N52'14'13.5 or N52"""
# It should first be checked if lontxt is a regular float, to avoid removing
# the 'e' in a scientific-notation number.
try:
lon = float(lontxt)
# Leading E will trigger error ansd means simply East,just as W = West = Negati... | [
"def",
"txt2lon",
"(",
"lontxt",
")",
":",
"# It should first be checked if lontxt is a regular float, to avoid removing",
"# the 'e' in a scientific-notation number.",
"try",
":",
"lon",
"=",
"float",
"(",
"lontxt",
")",
"# Leading E will trigger error ansd means simply East,just as... | https://github.com/TUDelft-CNS-ATM/bluesky/blob/55a538a3cd936f33cff9df650c38924aa97557b1/bluesky/tools/misc.py#L240-L286 | |
sabnzbd/sabnzbd | 52d21e94d3cc6e30764a833fe2a256783d1a8931 | sabnzbd/assembler.py | python | is_cloaked | (nzo: NzbObject, path: str, names: List[str]) | return False | Return True if this is likely to be a cloaked encrypted post | Return True if this is likely to be a cloaked encrypted post | [
"Return",
"True",
"if",
"this",
"is",
"likely",
"to",
"be",
"a",
"cloaked",
"encrypted",
"post"
] | def is_cloaked(nzo: NzbObject, path: str, names: List[str]) -> bool:
"""Return True if this is likely to be a cloaked encrypted post"""
fname = os.path.splitext(get_filename(path.lower()))[0]
for name in names:
name = get_filename(name.lower())
name, ext = os.path.splitext(name)
if (... | [
"def",
"is_cloaked",
"(",
"nzo",
":",
"NzbObject",
",",
"path",
":",
"str",
",",
"names",
":",
"List",
"[",
"str",
"]",
")",
"->",
"bool",
":",
"fname",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"get_filename",
"(",
"path",
".",
"lower",
"(",
... | https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/assembler.py#L256-L282 | |
lyl8213/Plate_Recognition-LPRnet | 80e38c060e2b5c934f2ed6ec2ad254df1c0e398f | LPRtf3.py | python | sparse_tuple_from | (sequences, dtype=np.int32) | return indices, values, shape | Create a sparse representention of x.
Args:
sequences: a list of lists of type dtype where each element is a sequence
Returns:
A tuple with (indices, values, shape) | Create a sparse representention of x.
Args:
sequences: a list of lists of type dtype where each element is a sequence
Returns:
A tuple with (indices, values, shape) | [
"Create",
"a",
"sparse",
"representention",
"of",
"x",
".",
"Args",
":",
"sequences",
":",
"a",
"list",
"of",
"lists",
"of",
"type",
"dtype",
"where",
"each",
"element",
"is",
"a",
"sequence",
"Returns",
":",
"A",
"tuple",
"with",
"(",
"indices",
"values... | def sparse_tuple_from(sequences, dtype=np.int32):
"""
Create a sparse representention of x.
Args:
sequences: a list of lists of type dtype where each element is a sequence
Returns:
A tuple with (indices, values, shape)
"""
indices = []
values = []
for n, seq in enumerate... | [
"def",
"sparse_tuple_from",
"(",
"sequences",
",",
"dtype",
"=",
"np",
".",
"int32",
")",
":",
"indices",
"=",
"[",
"]",
"values",
"=",
"[",
"]",
"for",
"n",
",",
"seq",
"in",
"enumerate",
"(",
"sequences",
")",
":",
"indices",
".",
"extend",
"(",
... | https://github.com/lyl8213/Plate_Recognition-LPRnet/blob/80e38c060e2b5c934f2ed6ec2ad254df1c0e398f/LPRtf3.py#L130-L149 | |
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/utils/extmath.py | python | squared_norm | (x) | return np.dot(x, x) | Squared Euclidean or Frobenius norm of x.
Faster than norm(x) ** 2.
Parameters
----------
x : array-like
Returns
-------
float
The Euclidean norm when x is a vector, the Frobenius norm when x
is a matrix (2-d array). | Squared Euclidean or Frobenius norm of x. | [
"Squared",
"Euclidean",
"or",
"Frobenius",
"norm",
"of",
"x",
"."
] | def squared_norm(x):
"""Squared Euclidean or Frobenius norm of x.
Faster than norm(x) ** 2.
Parameters
----------
x : array-like
Returns
-------
float
The Euclidean norm when x is a vector, the Frobenius norm when x
is a matrix (2-d array).
"""
x = np.ravel(x, ... | [
"def",
"squared_norm",
"(",
"x",
")",
":",
"x",
"=",
"np",
".",
"ravel",
"(",
"x",
",",
"order",
"=",
"\"K\"",
")",
"if",
"np",
".",
"issubdtype",
"(",
"x",
".",
"dtype",
",",
"np",
".",
"integer",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Arr... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/utils/extmath.py#L26-L48 | |
whipper-team/whipper | 18a41b6c2880e577f9f1d7b1b6e7df0be7371378 | whipper/extern/task/task.py | python | Task.start | (self, runner) | Start the task.
Subclasses should chain up to me at the beginning.
Subclass implementations should raise exceptions immediately in
case of failure (using set(AndRaise)Exception) first, or do it later
using those methods.
If start doesn't raise an exception, the task should run... | Start the task. | [
"Start",
"the",
"task",
"."
] | def start(self, runner):
"""
Start the task.
Subclasses should chain up to me at the beginning.
Subclass implementations should raise exceptions immediately in
case of failure (using set(AndRaise)Exception) first, or do it later
using those methods.
If start do... | [
"def",
"start",
"(",
"self",
",",
"runner",
")",
":",
"self",
".",
"debug",
"(",
"'starting'",
")",
"self",
".",
"setProgress",
"(",
"self",
".",
"progress",
")",
"self",
".",
"running",
"=",
"True",
"self",
".",
"runner",
"=",
"runner",
"self",
".",... | https://github.com/whipper-team/whipper/blob/18a41b6c2880e577f9f1d7b1b6e7df0be7371378/whipper/extern/task/task.py#L117-L134 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/source-python/weapons/restrictions.py | python | WeaponRestrictionHandler._unload_instance | (self) | Remove the instance from the manager. | Remove the instance from the manager. | [
"Remove",
"the",
"instance",
"from",
"the",
"manager",
"."
] | def _unload_instance(self):
"""Remove the instance from the manager."""
weapon_restriction_manager.remove_handler(self) | [
"def",
"_unload_instance",
"(",
"self",
")",
":",
"weapon_restriction_manager",
".",
"remove_handler",
"(",
"self",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/source-python/weapons/restrictions.py#L372-L374 | ||
vlachoudis/bCNC | 67126b4894dabf6579baf47af8d0f9b7de35e6e3 | bCNC/ControlPage.py | python | abcDROFrame.setC0 | (self, event=None) | [] | def setC0(self, event=None):
self.app.mcontrol._wcsSet(None,None,None,None,None,"0") | [
"def",
"setC0",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"self",
".",
"app",
".",
"mcontrol",
".",
"_wcsSet",
"(",
"None",
",",
"None",
",",
"None",
",",
"None",
",",
"None",
",",
"\"0\"",
")"
] | https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/ControlPage.py#L629-L630 | ||||
PaddlePaddle/PGL | e48545f2814523c777b8a9a9188bf5a7f00d6e52 | legacy/pgl/graph.py | python | Graph.outdegree | (self, nodes=None) | Return the outdegree of the given nodes.
This function will return outdegree of given nodes.
Args:
nodes: Return the outdegree of given nodes,
if nodes is None, return outdegree for all nodes
Return:
A numpy.array as the given nodes' outdegree. | Return the outdegree of the given nodes. | [
"Return",
"the",
"outdegree",
"of",
"the",
"given",
"nodes",
"."
] | def outdegree(self, nodes=None):
"""Return the outdegree of the given nodes.
This function will return outdegree of given nodes.
Args:
nodes: Return the outdegree of given nodes,
if nodes is None, return outdegree for all nodes
Return:
A nump... | [
"def",
"outdegree",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"nodes",
"is",
"None",
":",
"return",
"self",
".",
"adj_src_index",
".",
"degree",
"else",
":",
"return",
"self",
".",
"adj_src_index",
".",
"degree",
"[",
"nodes",
"]"
] | https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/legacy/pgl/graph.py#L283-L298 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/ncutil.py | python | multilinear_product | (expr, fct) | If a sympy 'Expr' is of the form:
expr = expr_i1i2...irj*a_i1*a_i2*...*a_ir or expr_0
where all the a_i are noncommuting symbols in basis and the expr's
are commuting expressions then
multilinear_product(expr) = expr_i1i2...ir*fct(a_i1, a_i2, ..., a_ir)
bilinear_product(expr_0) = expr_0
wh... | If a sympy 'Expr' is of the form: | [
"If",
"a",
"sympy",
"Expr",
"is",
"of",
"the",
"form",
":"
] | def multilinear_product(expr, fct):
"""
If a sympy 'Expr' is of the form:
expr = expr_i1i2...irj*a_i1*a_i2*...*a_ir or expr_0
where all the a_i are noncommuting symbols in basis and the expr's
are commuting expressions then
multilinear_product(expr) = expr_i1i2...ir*fct(a_i1, a_i2, ..., a_ir... | [
"def",
"multilinear_product",
"(",
"expr",
",",
"fct",
")",
":",
"if",
"expr",
".",
"is_commutative",
":",
"# no bases in expr",
"return",
"expr",
"if",
"isinstance",
"(",
"expr",
",",
"Mul",
")",
":",
"# bases in expr",
"(",
"coefs",
",",
"bases",
")",
"=... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/galgebra/ncutil.py#L282-L312 | ||
tensorflow/tfx | b4a6b83269815ed12ba9df9e9154c7376fef2ea0 | tfx/components/trainer/rewriting/rewriter.py | python | BaseRewriter._post_rewrite_validate | (self, rewritten_model: ModelDescription) | Perform post-rewrite validation.
Args:
rewritten_model: A `ModelDescription` object describing the location and
type of the rewritten output.
Raises:
ValueError: If the rewritten model is not valid. | Perform post-rewrite validation. | [
"Perform",
"post",
"-",
"rewrite",
"validation",
"."
] | def _post_rewrite_validate(self, rewritten_model: ModelDescription):
"""Perform post-rewrite validation.
Args:
rewritten_model: A `ModelDescription` object describing the location and
type of the rewritten output.
Raises:
ValueError: If the rewritten model is not valid.
"""
pas... | [
"def",
"_post_rewrite_validate",
"(",
"self",
",",
"rewritten_model",
":",
"ModelDescription",
")",
":",
"pass"
] | https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/components/trainer/rewriting/rewriter.py#L72-L82 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/plat-freebsd8/IN.py | python | in_nullhost | (x) | return ((x).s_addr == INADDR_ANY) | [] | def in_nullhost(x): return ((x).s_addr == INADDR_ANY) | [
"def",
"in_nullhost",
"(",
"x",
")",
":",
"return",
"(",
"(",
"x",
")",
".",
"s_addr",
"==",
"INADDR_ANY",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-freebsd8/IN.py#L386-L386 | |||
open-io/oio-sds | 16041950b6056a55d5ce7ca77795defe6dfa6c61 | oio/common/tool.py | python | Tool.tasks_res_from_res_event | (res_event) | Convert the result event into a list (generator) of tasks result. | Convert the result event into a list (generator) of tasks result. | [
"Convert",
"the",
"result",
"event",
"into",
"a",
"list",
"(",
"generator",
")",
"of",
"tasks",
"result",
"."
] | def tasks_res_from_res_event(res_event):
"""
Convert the result event into a list (generator) of tasks result.
"""
raise NotImplementedError() | [
"def",
"tasks_res_from_res_event",
"(",
"res_event",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/common/tool.py#L110-L114 | ||
intrig-unicamp/mininet-wifi | 3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba | mn_wifi/sumo/traci/_lane.py | python | LaneDomain.getMaxSpeed | (self, laneID) | return self._getUniversal(tc.VAR_MAXSPEED, laneID) | getMaxSpeed(string) -> double
Returns the maximum allowed speed on the lane in m/s. | getMaxSpeed(string) -> double
Returns the maximum allowed speed on the lane in m/s. | [
"getMaxSpeed",
"(",
"string",
")",
"-",
">",
"double",
"Returns",
"the",
"maximum",
"allowed",
"speed",
"on",
"the",
"lane",
"in",
"m",
"/",
"s",
"."
] | def getMaxSpeed(self, laneID):
"""getMaxSpeed(string) -> double
Returns the maximum allowed speed on the lane in m/s.
"""
return self._getUniversal(tc.VAR_MAXSPEED, laneID) | [
"def",
"getMaxSpeed",
"(",
"self",
",",
"laneID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"VAR_MAXSPEED",
",",
"laneID",
")"
] | https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/mn_wifi/sumo/traci/_lane.py#L91-L95 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/cubecolourdialog.py | python | CustomPanel.OnSize | (self, event) | Handles the ``wx.EVT_SIZE`` for :class:`CustomPanel`.
:param `event`: a :class:`wx.SizeEvent` event to be processed. | Handles the ``wx.EVT_SIZE`` for :class:`CustomPanel`. | [
"Handles",
"the",
"wx",
".",
"EVT_SIZE",
"for",
":",
"class",
":",
"CustomPanel",
"."
] | def OnSize(self, event):
"""
Handles the ``wx.EVT_SIZE`` for :class:`CustomPanel`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
"""
self.Refresh() | [
"def",
"OnSize",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"Refresh",
"(",
")"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/cubecolourdialog.py#L2718-L2725 | ||
pykalman/pykalman | 8d3f8e498b64d902016a0216bf2bcc8b262d917b | pykalman/sqrt/unscented.py | python | _unscented_transform | (points, f=None, points_noise=None, sigma2_noise=None) | return (points_pred, moments_pred) | Apply the Unscented Transform.
Parameters
==========
points : [n_points, n_dim_1] array
points representing state to pass through `f`
f : [n_dim_1, n_dim_3] -> [n_dim_2] function
function to apply pass all points through
points_noise : [n_points, n_dim_3] array
points repres... | Apply the Unscented Transform. | [
"Apply",
"the",
"Unscented",
"Transform",
"."
] | def _unscented_transform(points, f=None, points_noise=None, sigma2_noise=None):
'''Apply the Unscented Transform.
Parameters
==========
points : [n_points, n_dim_1] array
points representing state to pass through `f`
f : [n_dim_1, n_dim_3] -> [n_dim_2] function
function to apply pas... | [
"def",
"_unscented_transform",
"(",
"points",
",",
"f",
"=",
"None",
",",
"points_noise",
"=",
"None",
",",
"sigma2_noise",
"=",
"None",
")",
":",
"n_points",
",",
"n_dim_state",
"=",
"points",
".",
"points",
".",
"shape",
"(",
"points",
",",
"weights_mean... | https://github.com/pykalman/pykalman/blob/8d3f8e498b64d902016a0216bf2bcc8b262d917b/pykalman/sqrt/unscented.py#L207-L251 | |
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/ensemble/_gb.py | python | BaseGradientBoosting._check_params | (self) | Check validity of parameters and raise ValueError if not valid. | Check validity of parameters and raise ValueError if not valid. | [
"Check",
"validity",
"of",
"parameters",
"and",
"raise",
"ValueError",
"if",
"not",
"valid",
"."
] | def _check_params(self):
"""Check validity of parameters and raise ValueError if not valid."""
if self.n_estimators <= 0:
raise ValueError(
"n_estimators must be greater than 0 but was %r" % self.n_estimators
)
if self.learning_rate <= 0.0:
ra... | [
"def",
"_check_params",
"(",
"self",
")",
":",
"if",
"self",
".",
"n_estimators",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"n_estimators must be greater than 0 but was %r\"",
"%",
"self",
".",
"n_estimators",
")",
"if",
"self",
".",
"learning_rate",
"<=",
"... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/ensemble/_gb.py#L266-L365 | ||
eBay/accelerator | 218d9a5e4451ac72b9e65df6c5b32e37d25136c8 | accelerator/extras.py | python | _ListTypePreserver.__radd__ | (self, other) | return self.__class__(list.__add__(other, self)) | [] | def __radd__(self, other):
if not isinstance(other, list):
return NotImplemented
return self.__class__(list.__add__(other, self)) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"list",
")",
":",
"return",
"NotImplemented",
"return",
"self",
".",
"__class__",
"(",
"list",
".",
"__add__",
"(",
"other",
",",
"self",
")",
")"
] | https://github.com/eBay/accelerator/blob/218d9a5e4451ac72b9e65df6c5b32e37d25136c8/accelerator/extras.py#L379-L382 | |||
sherlock-project/sherlock | a3e2f7c214509046c6f92ca4b3a755ef1763afa1 | sherlock/sherlock.py | python | sherlock | (username, site_data, query_notify,
tor=False, unique_tor=False,
proxy=None, timeout=None) | return results_total | Run Sherlock Analysis.
Checks for existence of username on various social media sites.
Keyword Arguments:
username -- String indicating username that report
should be created against.
site_data -- Dictionary containing all of the site data.
... | Run Sherlock Analysis. | [
"Run",
"Sherlock",
"Analysis",
"."
] | def sherlock(username, site_data, query_notify,
tor=False, unique_tor=False,
proxy=None, timeout=None):
"""Run Sherlock Analysis.
Checks for existence of username on various social media sites.
Keyword Arguments:
username -- String indicating username that repor... | [
"def",
"sherlock",
"(",
"username",
",",
"site_data",
",",
"query_notify",
",",
"tor",
"=",
"False",
",",
"unique_tor",
"=",
"False",
",",
"proxy",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"# Notify caller that we are starting the query.",
"query_noti... | https://github.com/sherlock-project/sherlock/blob/a3e2f7c214509046c6f92ca4b3a755ef1763afa1/sherlock/sherlock.py#L143-L451 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/ZSI-2.0-py2.7.egg/ZSI/TCtimes.py | python | _localtimezone.dst | (self, dt) | return _zero | datetime -> DST offset in minutes east of UTC. | datetime -> DST offset in minutes east of UTC. | [
"datetime",
"-",
">",
"DST",
"offset",
"in",
"minutes",
"east",
"of",
"UTC",
"."
] | def dst(self, dt):
"""datetime -> DST offset in minutes east of UTC."""
tt = _localtime(_mktime((dt.year, dt.month, dt.day,
dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
if tt.tm_isdst > 0: return _dstdiff
return _zero | [
"def",
"dst",
"(",
"self",
",",
"dt",
")",
":",
"tt",
"=",
"_localtime",
"(",
"_mktime",
"(",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
",",
"dt",
".",
"hour",
",",
"dt",
".",
"minute",
",",
"dt",
".",
"second",
... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/ZSI-2.0-py2.7.egg/ZSI/TCtimes.py#L30-L35 | |
vladris/tinkerer | e6459e501ec14094e0448c5b0f628ef8666a3ac9 | tinkerer/ext/author.py | python | AuthorDirective.run | (self) | return [] | Called when parsing the document. | Called when parsing the document. | [
"Called",
"when",
"parsing",
"the",
"document",
"."
] | def run(self):
'''
Called when parsing the document.
'''
env = self.state.document.settings.env
# store author in metadata
author = " ".join(self.arguments)
if author == "default":
author = env.config.author
env.blog_metadata[env.docname].auth... | [
"def",
"run",
"(",
"self",
")",
":",
"env",
"=",
"self",
".",
"state",
".",
"document",
".",
"settings",
".",
"env",
"# store author in metadata",
"author",
"=",
"\" \"",
".",
"join",
"(",
"self",
".",
"arguments",
")",
"if",
"author",
"==",
"\"default\"... | https://github.com/vladris/tinkerer/blob/e6459e501ec14094e0448c5b0f628ef8666a3ac9/tinkerer/ext/author.py#L23-L35 | |
ddbourgin/numpy-ml | b0359af5285fbf9699d64fd5ec059493228af03e | numpy_ml/neural_nets/modules/modules.py | python | SkipConnectionConvModule.parameters | (self) | return {
"components": {
"add3": self.add3.parameters,
"conv1": self.conv1.parameters,
"conv2": self.conv2.parameters,
"conv_skip": self.conv_skip.parameters
if hasattr(self, "conv_skip")
else None,
... | A dictionary of the module parameters. | A dictionary of the module parameters. | [
"A",
"dictionary",
"of",
"the",
"module",
"parameters",
"."
] | def parameters(self):
"""A dictionary of the module parameters."""
return {
"components": {
"add3": self.add3.parameters,
"conv1": self.conv1.parameters,
"conv2": self.conv2.parameters,
"conv_skip": self.conv_skip.parameters
... | [
"def",
"parameters",
"(",
"self",
")",
":",
"return",
"{",
"\"components\"",
":",
"{",
"\"add3\"",
":",
"self",
".",
"add3",
".",
"parameters",
",",
"\"conv1\"",
":",
"self",
".",
"conv1",
".",
"parameters",
",",
"\"conv2\"",
":",
"self",
".",
"conv2",
... | https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/neural_nets/modules/modules.py#L803-L817 | |
artefactual/archivematica | 4f4605453d5a8796f6a739fa9664921bdb3418f2 | src/dashboard/src/contrib/mcp/client.py | python | MCPClient._rpc_sync_call | (self, ability, data=None, timeout=INFLIGHT_POLL_TIMEOUT) | return payload | Invoke remote method synchronously and with a deadline.
When successful, it returns the payload of the response. Otherwise, it
raises an exception. ``TimeoutError`` when the deadline was exceeded,
``RPCError`` when the worker failed abruptly, ``RPCServerError`` when
the worker returned ... | Invoke remote method synchronously and with a deadline. | [
"Invoke",
"remote",
"method",
"synchronously",
"and",
"with",
"a",
"deadline",
"."
] | def _rpc_sync_call(self, ability, data=None, timeout=INFLIGHT_POLL_TIMEOUT):
"""Invoke remote method synchronously and with a deadline.
When successful, it returns the payload of the response. Otherwise, it
raises an exception. ``TimeoutError`` when the deadline was exceeded,
``RPCError... | [
"def",
"_rpc_sync_call",
"(",
"self",
",",
"ability",
",",
"data",
"=",
"None",
",",
"timeout",
"=",
"INFLIGHT_POLL_TIMEOUT",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"b\"\"",
"elif",
"\"user_id\"",
"not",
"in",
"data",
":",
"data",
"[",
... | https://github.com/artefactual/archivematica/blob/4f4605453d5a8796f6a739fa9664921bdb3418f2/src/dashboard/src/contrib/mcp/client.py#L102-L130 | |
imflyn/decoration-design-crawler | bfcbe1b7f1528a63e4d5189d645366fb3ec5bdc6 | msic/core/service/bloom_filter_service.py | python | RedisBloomFilter.__init__ | (self, redis_client: StrictRedis) | [] | def __init__(self, redis_client: StrictRedis):
self.bit_size = 1 << 25
self.seeds = [5, 7, 11, 13, 31, 37, 61]
self.redis = redis_client
self.hash_dict = []
for i in range(self.seeds.__len__()):
self.hash_dict.append(SimpleHash(self.bit_size, self.seeds[i])) | [
"def",
"__init__",
"(",
"self",
",",
"redis_client",
":",
"StrictRedis",
")",
":",
"self",
".",
"bit_size",
"=",
"1",
"<<",
"25",
"self",
".",
"seeds",
"=",
"[",
"5",
",",
"7",
",",
"11",
",",
"13",
",",
"31",
",",
"37",
",",
"61",
"]",
"self",... | https://github.com/imflyn/decoration-design-crawler/blob/bfcbe1b7f1528a63e4d5189d645366fb3ec5bdc6/msic/core/service/bloom_filter_service.py#L17-L23 | ||||
ym2011/POC-EXP | 206b22d3a6b2a172359678df33bbc5b2ad04b6c3 | K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py | python | BaseRequest.script_name | (self) | return '/' + script_name + '/' if script_name else '/' | The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. | The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. | [
"The",
"initial",
"portion",
"of",
"the",
"URL",
"s",
"path",
"that",
"was",
"removed",
"by",
"a",
"higher",
"level",
"(",
"server",
"or",
"routing",
"middleware",
")",
"before",
"the",
"application",
"was",
"called",
".",
"This",
"script",
"path",
"is",
... | def script_name(self):
""" The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. """
script_name = self.environ.get('S... | [
"def",
"script_name",
"(",
"self",
")",
":",
"script_name",
"=",
"self",
".",
"environ",
".",
"get",
"(",
"'SCRIPT_NAME'",
",",
"''",
")",
".",
"strip",
"(",
"'/'",
")",
"return",
"'/'",
"+",
"script_name",
"+",
"'/'",
"if",
"script_name",
"else",
"'/'... | https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py#L1386-L1392 | |
nextstrain/augur | a004d3f8f0b661fb0fb88cf07a43acc01d74de6a | augur/distance.py | python | get_distances_to_all_pairs | (tree, sequences_by_node_and_gene, distance_map, earliest_date=None, latest_date=None) | return distances_by_node | Calculate distances between each sample in the given sequences and all other
samples in previous seasons using the given distance map.
Parameters
----------
tree : Bio.Phylo
a rooted tree whose node names match the given dictionary of sequences
by node and gene
sequences_by_node_an... | Calculate distances between each sample in the given sequences and all other
samples in previous seasons using the given distance map. | [
"Calculate",
"distances",
"between",
"each",
"sample",
"in",
"the",
"given",
"sequences",
"and",
"all",
"other",
"samples",
"in",
"previous",
"seasons",
"using",
"the",
"given",
"distance",
"map",
"."
] | def get_distances_to_all_pairs(tree, sequences_by_node_and_gene, distance_map, earliest_date=None, latest_date=None):
"""Calculate distances between each sample in the given sequences and all other
samples in previous seasons using the given distance map.
Parameters
----------
tree : Bio.Phylo
... | [
"def",
"get_distances_to_all_pairs",
"(",
"tree",
",",
"sequences_by_node_and_gene",
",",
"distance_map",
",",
"earliest_date",
"=",
"None",
",",
"latest_date",
"=",
"None",
")",
":",
"if",
"earliest_date",
"is",
"not",
"None",
":",
"earliest_date",
"=",
"timestam... | https://github.com/nextstrain/augur/blob/a004d3f8f0b661fb0fb88cf07a43acc01d74de6a/augur/distance.py#L560-L624 | |
ManyFace/ExtractDexFromOat | cec0a4230ecdab41188c1ea99fbda8bb6bbc84b2 | oatParser/elf64.py | python | Elf64Sym.__init__ | (self, buf) | [] | def __init__(self, buf):
self.unpack(buf)
self.name = "" | [
"def",
"__init__",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"unpack",
"(",
"buf",
")",
"self",
".",
"name",
"=",
"\"\""
] | https://github.com/ManyFace/ExtractDexFromOat/blob/cec0a4230ecdab41188c1ea99fbda8bb6bbc84b2/oatParser/elf64.py#L186-L188 | ||||
ysymyth/3D-SDN | d7a4519bfd57d4c5d99dbdb6a53a82ba5b66ec9e | geometric/maskrcnn/utils.py | python | Dataset.load_mask | (self, image_id) | return mask, class_ids | Load instance masks for the given image.
Different datasets use different ways to store masks. Override this
method to load instance masks and return them in the form of am
array of binary masks of shape [height, width, instances].
Returns:
masks: A bool array of shape [hei... | Load instance masks for the given image. | [
"Load",
"instance",
"masks",
"for",
"the",
"given",
"image",
"."
] | def load_mask(self, image_id):
"""Load instance masks for the given image.
Different datasets use different ways to store masks. Override this
method to load instance masks and return them in the form of am
array of binary masks of shape [height, width, instances].
Returns:
... | [
"def",
"load_mask",
"(",
"self",
",",
"image_id",
")",
":",
"# Override this function to load a mask from your dataset.",
"# Otherwise, it returns an empty mask.",
"mask",
"=",
"np",
".",
"empty",
"(",
"[",
"0",
",",
"0",
",",
"0",
"]",
")",
"class_ids",
"=",
"np"... | https://github.com/ysymyth/3D-SDN/blob/d7a4519bfd57d4c5d99dbdb6a53a82ba5b66ec9e/geometric/maskrcnn/utils.py#L253-L269 | |
shlomif/PySolFC | 780c399e6f68a95916d84e7e88a067e8fcbec1cc | pysollib/kivy/menubar.py | python | OptionsMenuDialog.buildTree | (self, tv, node) | menu.add_command(label=n_("&Fonts..."), command=self.mOptFonts)
menu.add_command(label=n_("&Colors..."), command=self.mOptColors)
menu.add_command(label=n_("Time&outs..."), command=self.mOptTimeouts)
menu.add_separator() | menu.add_command(label=n_("&Fonts..."), command=self.mOptFonts)
menu.add_command(label=n_("&Colors..."), command=self.mOptColors)
menu.add_command(label=n_("Time&outs..."), command=self.mOptTimeouts)
menu.add_separator() | [
"menu",
".",
"add_command",
"(",
"label",
"=",
"n_",
"(",
"&Fonts",
"...",
")",
"command",
"=",
"self",
".",
"mOptFonts",
")",
"menu",
".",
"add_command",
"(",
"label",
"=",
"n_",
"(",
"&Colors",
"...",
")",
"command",
"=",
"self",
".",
"mOptColors",
... | def buildTree(self, tv, node):
# -------------------------------------------
# Automatic play settings
rg = tv.add_node(
LTreeNode(text=_('Automatic play')))
if rg:
self.addCheckNode(tv, rg,
_('Auto face up'),
... | [
"def",
"buildTree",
"(",
"self",
",",
"tv",
",",
"node",
")",
":",
"# -------------------------------------------",
"# Automatic play settings",
"rg",
"=",
"tv",
".",
"add_node",
"(",
"LTreeNode",
"(",
"text",
"=",
"_",
"(",
"'Automatic play'",
")",
")",
")",
... | https://github.com/shlomif/PySolFC/blob/780c399e6f68a95916d84e7e88a067e8fcbec1cc/pysollib/kivy/menubar.py#L504-L1094 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | lighttpd/datadog_checks/lighttpd/config_models/__init__.py | python | ConfigMixin.config | (self) | return self._config_model_instance | [] | def config(self) -> InstanceConfig:
return self._config_model_instance | [
"def",
"config",
"(",
"self",
")",
"->",
"InstanceConfig",
":",
"return",
"self",
".",
"_config_model_instance"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/lighttpd/datadog_checks/lighttpd/config_models/__init__.py#L19-L20 | |||
soft-matter/trackpy | a316c658ffd03d4b6fe705b9bedd63c1ab8276c0 | trackpy/linking/legacy.py | python | TreeFinder.__init__ | (self, points, search_range) | Takes a list of particles. | Takes a list of particles. | [
"Takes",
"a",
"list",
"of",
"particles",
"."
] | def __init__(self, points, search_range):
"""Takes a list of particles."""
self.ndim = len(search_range)
self.search_range = np.atleast_2d(search_range)
if not isinstance(points, list):
points = list(points)
self.points = points
self.rebuild() | [
"def",
"__init__",
"(",
"self",
",",
"points",
",",
"search_range",
")",
":",
"self",
".",
"ndim",
"=",
"len",
"(",
"search_range",
")",
"self",
".",
"search_range",
"=",
"np",
".",
"atleast_2d",
"(",
"search_range",
")",
"if",
"not",
"isinstance",
"(",
... | https://github.com/soft-matter/trackpy/blob/a316c658ffd03d4b6fe705b9bedd63c1ab8276c0/trackpy/linking/legacy.py#L207-L214 | ||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/SearchKippt/alp/request/requests/cookies.py | python | RequestsCookieJar.__getstate__ | (self) | return state | Unlike a normal CookieJar, this class is pickleable. | Unlike a normal CookieJar, this class is pickleable. | [
"Unlike",
"a",
"normal",
"CookieJar",
"this",
"class",
"is",
"pickleable",
"."
] | def __getstate__(self):
"""Unlike a normal CookieJar, this class is pickleable."""
state = self.__dict__.copy()
# remove the unpickleable RLock object
state.pop('_cookies_lock')
return state | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"# remove the unpickleable RLock object",
"state",
".",
"pop",
"(",
"'_cookies_lock'",
")",
"return",
"state"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/requests/cookies.py#L296-L301 | |
openatx/adbutils | ecddefa4a1888b71b0e379675245a05b8a2c8637 | adbutils/__init__.py | python | AdbClient.wait_for | (self, serial: str = None, transport: str = 'any', state: str = "device", timeout: float=60) | Same as wait-for-TRANSPORT-STATE
Args:
serial (str): device serial [default None]
transport (str): {any,usb,local} [default any]
state (str): {device,recovery,rescue,sideload,bootloader,disconnect} [default device]
timeout (float): max wait time [default 60]
... | Same as wait-for-TRANSPORT-STATE
Args:
serial (str): device serial [default None]
transport (str): {any,usb,local} [default any]
state (str): {device,recovery,rescue,sideload,bootloader,disconnect} [default device]
timeout (float): max wait time [default 60]
... | [
"Same",
"as",
"wait",
"-",
"for",
"-",
"TRANSPORT",
"-",
"STATE",
"Args",
":",
"serial",
"(",
"str",
")",
":",
"device",
"serial",
"[",
"default",
"None",
"]",
"transport",
"(",
"str",
")",
":",
"{",
"any",
"usb",
"local",
"}",
"[",
"default",
"any... | def wait_for(self, serial: str = None, transport: str = 'any', state: str = "device", timeout: float=60):
""" Same as wait-for-TRANSPORT-STATE
Args:
serial (str): device serial [default None]
transport (str): {any,usb,local} [default any]
state (str): {device,recovery... | [
"def",
"wait_for",
"(",
"self",
",",
"serial",
":",
"str",
"=",
"None",
",",
"transport",
":",
"str",
"=",
"'any'",
",",
"state",
":",
"str",
"=",
"\"device\"",
",",
"timeout",
":",
"float",
"=",
"60",
")",
":",
"with",
"self",
".",
"_connect",
"("... | https://github.com/openatx/adbutils/blob/ecddefa4a1888b71b0e379675245a05b8a2c8637/adbutils/__init__.py#L225-L245 | ||
fregu856/2D_detection | 1f22a6d604d39f8f79fe916fcdbf40b5b668a39a | train.py | python | train_data_iterator | () | [] | def train_data_iterator():
random.shuffle(train_data)
train_img_paths, train_bboxes_per_img = zip(*train_data)
batch_pointer = 0
for step in range(no_of_batches):
batch_imgs = np.zeros((batch_size, img_height, img_width, 3), dtype=np.float32)
# (list of length batch_size, each element ... | [
"def",
"train_data_iterator",
"(",
")",
":",
"random",
".",
"shuffle",
"(",
"train_data",
")",
"train_img_paths",
",",
"train_bboxes_per_img",
"=",
"zip",
"(",
"*",
"train_data",
")",
"batch_pointer",
"=",
"0",
"for",
"step",
"in",
"range",
"(",
"no_of_batches... | https://github.com/fregu856/2D_detection/blob/1f22a6d604d39f8f79fe916fcdbf40b5b668a39a/train.py#L269-L411 | ||||
rwightman/gen-efficientnet-pytorch | 2d6623e956fbc9ac9c2f86ace2619e22ce7e2960 | geffnet/gen_efficientnet.py | python | tf_efficientnet_b8_ap | (pretrained=False, **kwargs) | return model | EfficientNet-B8 AdvProp. Tensorflow compatible variant
Paper: Adversarial Examples Improve Image Recognition (https://arxiv.org/abs/1911.09665) | EfficientNet-B8 AdvProp. Tensorflow compatible variant
Paper: Adversarial Examples Improve Image Recognition (https://arxiv.org/abs/1911.09665) | [
"EfficientNet",
"-",
"B8",
"AdvProp",
".",
"Tensorflow",
"compatible",
"variant",
"Paper",
":",
"Adversarial",
"Examples",
"Improve",
"Image",
"Recognition",
"(",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1911",
".",
"09665",
")"
] | def tf_efficientnet_b8_ap(pretrained=False, **kwargs):
""" EfficientNet-B8 AdvProp. Tensorflow compatible variant
Paper: Adversarial Examples Improve Image Recognition (https://arxiv.org/abs/1911.09665)
"""
# NOTE for train, drop_rate should be 0.5
kwargs['bn_eps'] = BN_EPS_TF_DEFAULT
kwargs['pa... | [
"def",
"tf_efficientnet_b8_ap",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# NOTE for train, drop_rate should be 0.5",
"kwargs",
"[",
"'bn_eps'",
"]",
"=",
"BN_EPS_TF_DEFAULT",
"kwargs",
"[",
"'pad_type'",
"]",
"=",
"'same'",
"model",
"="... | https://github.com/rwightman/gen-efficientnet-pytorch/blob/2d6623e956fbc9ac9c2f86ace2619e22ce7e2960/geffnet/gen_efficientnet.py#L1149-L1158 | |
CoinAlpha/hummingbot | 36f6149c1644c07cd36795b915f38b8f49b798e7 | hummingbot/connector/exchange/hitbtc/hitbtc_api_order_book_data_source.py | python | HitbtcAPIOrderBookDataSource.listen_for_trades | (self, ev_loop: asyncio.BaseEventLoop, output: asyncio.Queue) | Listen for trades using websocket trade channel | Listen for trades using websocket trade channel | [
"Listen",
"for",
"trades",
"using",
"websocket",
"trade",
"channel"
] | async def listen_for_trades(self, ev_loop: asyncio.BaseEventLoop, output: asyncio.Queue):
"""
Listen for trades using websocket trade channel
"""
while True:
try:
ws = HitbtcWebsocket()
await ws.connect()
for pair in self._trad... | [
"async",
"def",
"listen_for_trades",
"(",
"self",
",",
"ev_loop",
":",
"asyncio",
".",
"BaseEventLoop",
",",
"output",
":",
"asyncio",
".",
"Queue",
")",
":",
"while",
"True",
":",
"try",
":",
"ws",
"=",
"HitbtcWebsocket",
"(",
")",
"await",
"ws",
".",
... | https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/connector/exchange/hitbtc/hitbtc_api_order_book_data_source.py#L129-L166 | ||
whoosh-community/whoosh | 5421f1ab3bb802114105b3181b7ce4f44ad7d0bb | src/whoosh/columns.py | python | CompressedBlockColumn.__init__ | (self, level=3, blocksize=32, module="zlib") | :param level: the compression level to use.
:param blocksize: the size (in KB) of each compressed block.
:param module: a string containing the name of the compression module
to use. The default is "zlib". The module should export "compress"
and "decompress" functions. | :param level: the compression level to use.
:param blocksize: the size (in KB) of each compressed block.
:param module: a string containing the name of the compression module
to use. The default is "zlib". The module should export "compress"
and "decompress" functions. | [
":",
"param",
"level",
":",
"the",
"compression",
"level",
"to",
"use",
".",
":",
"param",
"blocksize",
":",
"the",
"size",
"(",
"in",
"KB",
")",
"of",
"each",
"compressed",
"block",
".",
":",
"param",
"module",
":",
"a",
"string",
"containing",
"the",... | def __init__(self, level=3, blocksize=32, module="zlib"):
"""
:param level: the compression level to use.
:param blocksize: the size (in KB) of each compressed block.
:param module: a string containing the name of the compression module
to use. The default is "zlib". The modu... | [
"def",
"__init__",
"(",
"self",
",",
"level",
"=",
"3",
",",
"blocksize",
"=",
"32",
",",
"module",
"=",
"\"zlib\"",
")",
":",
"self",
".",
"_level",
"=",
"level",
"self",
".",
"_blocksize",
"=",
"blocksize",
"self",
".",
"_module",
"=",
"module"
] | https://github.com/whoosh-community/whoosh/blob/5421f1ab3bb802114105b3181b7ce4f44ad7d0bb/src/whoosh/columns.py#L831-L842 | ||
toddlerya/NebulaSolarDash | 286ff86f0ad3550c1c92323d45e24f01c5c6fcd5 | lib/common_lib.py | python | LoadConf.__init__ | (self) | 初始化cfg | 初始化cfg | [
"初始化cfg"
] | def __init__(self):
"""
初始化cfg
"""
self.cfg = ConfigParser() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"cfg",
"=",
"ConfigParser",
"(",
")"
] | https://github.com/toddlerya/NebulaSolarDash/blob/286ff86f0ad3550c1c92323d45e24f01c5c6fcd5/lib/common_lib.py#L53-L57 | ||
bisohns/search-engine-parser | ede1355a1f63398d9217b8e502fbd6c52b53bf09 | search_engine_parser/core/engines/baidu.py | python | Search.parse_soup | (self, soup) | return soup.find_all('div', {'id': re.compile(r"^\d{1,2}")}, class_="c-container") | Parses Baidu for a search query | Parses Baidu for a search query | [
"Parses",
"Baidu",
"for",
"a",
"search",
"query"
] | def parse_soup(self, soup):
"""
Parses Baidu for a search query
"""
# Baidu search can be made deterministic via an id
# Hence, a regex is used to match all eligible ids
return soup.find_all('div', {'id': re.compile(r"^\d{1,2}")}, class_="c-container") | [
"def",
"parse_soup",
"(",
"self",
",",
"soup",
")",
":",
"# Baidu search can be made deterministic via an id",
"# Hence, a regex is used to match all eligible ids",
"return",
"soup",
".",
"find_all",
"(",
"'div'",
",",
"{",
"'id'",
":",
"re",
".",
"compile",
"(",
"r\"... | https://github.com/bisohns/search-engine-parser/blob/ede1355a1f63398d9217b8e502fbd6c52b53bf09/search_engine_parser/core/engines/baidu.py#L31-L39 | |
nschloe/quadpy | c4c076d8ddfa968486a2443a95e2fb3780dcde0f | src/quadpy/helpers/symmetries.py | python | expand_symmetries_points_only | (data, dim) | return points, counts | [] | def expand_symmetries_points_only(data, dim):
points = []
counts = []
for key, points_raw in data.items():
fun = {
"zero2": _zero,
"zero3": _zero,
"0": _zero,
#
"a": _a,
"a0": _a0,
#
"d4_aa": _d4_aa,
... | [
"def",
"expand_symmetries_points_only",
"(",
"data",
",",
"dim",
")",
":",
"points",
"=",
"[",
"]",
"counts",
"=",
"[",
"]",
"for",
"key",
",",
"points_raw",
"in",
"data",
".",
"items",
"(",
")",
":",
"fun",
"=",
"{",
"\"zero2\"",
":",
"_zero",
",",
... | https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/helpers/symmetries.py#L286-L343 | |||
hackingmaterials/atomate | bdca913591d22a6f71d4914c69f3ee191e2d96db | atomate/vasp/workflows/base/hubbard_hund_linresp.py | python | HubbardHundLinRespSet.poscar | (self) | return poscar | Custom Poscar for HubbardHundLinRespSet | Custom Poscar for HubbardHundLinRespSet | [
"Custom",
"Poscar",
"for",
"HubbardHundLinRespSet"
] | def poscar(self):
"""
Custom Poscar for HubbardHundLinRespSet
"""
poscar = PoscarPerturb(
structure=super().structure, num_perturb=self.num_perturb
)
return poscar | [
"def",
"poscar",
"(",
"self",
")",
":",
"poscar",
"=",
"PoscarPerturb",
"(",
"structure",
"=",
"super",
"(",
")",
".",
"structure",
",",
"num_perturb",
"=",
"self",
".",
"num_perturb",
")",
"return",
"poscar"
] | https://github.com/hackingmaterials/atomate/blob/bdca913591d22a6f71d4914c69f3ee191e2d96db/atomate/vasp/workflows/base/hubbard_hund_linresp.py#L694-L701 | |
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | pytorch/pytorchcv/models/preresnet_cifar.py | python | preresnet272bn_svhn | (num_classes=10, **kwargs) | return get_preresnet_cifar(num_classes=num_classes, blocks=272, bottleneck=True,
model_name="preresnet272bn_svhn", **kwargs) | PreResNet-272(BN) model for SVHN from 'Identity Mappings in Deep Residual Networks,'
https://arxiv.org/abs/1603.05027.
Parameters:
----------
num_classes : int, default 10
Number of classification classes.
pretrained : bool, default False
Whether to load the pretrained weights for m... | PreResNet-272(BN) model for SVHN from 'Identity Mappings in Deep Residual Networks,'
https://arxiv.org/abs/1603.05027. | [
"PreResNet",
"-",
"272",
"(",
"BN",
")",
"model",
"for",
"SVHN",
"from",
"Identity",
"Mappings",
"in",
"Deep",
"Residual",
"Networks",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1603",
".",
"05027",
"."
] | def preresnet272bn_svhn(num_classes=10, **kwargs):
"""
PreResNet-272(BN) model for SVHN from 'Identity Mappings in Deep Residual Networks,'
https://arxiv.org/abs/1603.05027.
Parameters:
----------
num_classes : int, default 10
Number of classification classes.
pretrained : bool, def... | [
"def",
"preresnet272bn_svhn",
"(",
"num_classes",
"=",
"10",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_preresnet_cifar",
"(",
"num_classes",
"=",
"num_classes",
",",
"blocks",
"=",
"272",
",",
"bottleneck",
"=",
"True",
",",
"model_name",
"=",
"\"pre... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/preresnet_cifar.py#L407-L422 | |
initstring/evil-ssdp | ee76fb091c9befa4dd77a87f381c0de5fefdd78c | evil_ssdp.py | python | print_details | (args, local_ip, smb_server) | Prints a banner at runtime, informing the user of relevant details. | Prints a banner at runtime, informing the user of relevant details. | [
"Prints",
"a",
"banner",
"at",
"runtime",
"informing",
"the",
"user",
"of",
"relevant",
"details",
"."
] | def print_details(args, local_ip, smb_server):
"""
Prints a banner at runtime, informing the user of relevant details.
"""
dev_url = 'http://{}:{}/ssdp/device-desc.xml'.format(
local_ip, args.local_port)
srv_url = 'http://{}:{}/ssdp/service-desc.xml'.format(
local_ip, args.local_port... | [
"def",
"print_details",
"(",
"args",
",",
"local_ip",
",",
"smb_server",
")",
":",
"dev_url",
"=",
"'http://{}:{}/ssdp/device-desc.xml'",
".",
"format",
"(",
"local_ip",
",",
"args",
".",
"local_port",
")",
"srv_url",
"=",
"'http://{}:{}/ssdp/service-desc.xml'",
"."... | https://github.com/initstring/evil-ssdp/blob/ee76fb091c9befa4dd77a87f381c0de5fefdd78c/evil_ssdp.py#L569-L600 | ||
frenetic-lang/pyretic | 30462692f3e9675158862755955b44f3a37ea21c | pyretic/vendor/hsa/headerspace/hs.py | python | headerspace.__init__ | (self, length) | Constructor
length is the length of packet headers in bytes. | Constructor
length is the length of packet headers in bytes. | [
"Constructor",
"length",
"is",
"the",
"length",
"of",
"packet",
"headers",
"in",
"bytes",
"."
] | def __init__(self, length):
'''
Constructor
length is the length of packet headers in bytes.
'''
# hs_list: list of all wildcards included.
# hs_diff: for each wildcard in hs diff, a list of wildcard not
# included in the headerspace. hs_diff elements should all be a subset
# of corresp... | [
"def",
"__init__",
"(",
"self",
",",
"length",
")",
":",
"# hs_list: list of all wildcards included.",
"# hs_diff: for each wildcard in hs diff, a list of wildcard not",
"# included in the headerspace. hs_diff elements should all be a subset ",
"# of corresponding element in hs_list.",
"self... | https://github.com/frenetic-lang/pyretic/blob/30462692f3e9675158862755955b44f3a37ea21c/pyretic/vendor/hsa/headerspace/hs.py#L26-L41 | ||
selinon/selinon | 3613153566d454022a138639f0375c63f490c4cb | selinon/edge.py | python | Edge.__init__ | (self, nodes_from, nodes_to, predicate, flow, foreach, selective) | Initialize edge definition.
:param nodes_from: nodes from where edge starts
:type nodes_from: List[Node]
:param nodes_to: nodes where edge ends
:type nodes_to: List[Node]
:param predicate: predicate condition
:type predicate: Predicate
:param flow: flow to which ... | Initialize edge definition. | [
"Initialize",
"edge",
"definition",
"."
] | def __init__(self, nodes_from, nodes_to, predicate, flow, foreach, selective):
"""Initialize edge definition.
:param nodes_from: nodes from where edge starts
:type nodes_from: List[Node]
:param nodes_to: nodes where edge ends
:type nodes_to: List[Node]
:param predicate: ... | [
"def",
"__init__",
"(",
"self",
",",
"nodes_from",
",",
"nodes_to",
",",
"predicate",
",",
"flow",
",",
"foreach",
",",
"selective",
")",
":",
"self",
".",
"nodes_from",
"=",
"nodes_from",
"self",
".",
"nodes_to",
"=",
"nodes_to",
"self",
".",
"predicate",... | https://github.com/selinon/selinon/blob/3613153566d454022a138639f0375c63f490c4cb/selinon/edge.py#L20-L41 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/distributed/server_state.py | python | ServerState.kv_store | (self) | return self._kv_store | Get data store. | Get data store. | [
"Get",
"data",
"store",
"."
] | def kv_store(self):
"""Get data store."""
return self._kv_store | [
"def",
"kv_store",
"(",
"self",
")",
":",
"return",
"self",
".",
"_kv_store"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/distributed/server_state.py#L55-L57 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | txdav/caldav/datastore/scheduling/ischedule/scheduler.py | python | IScheduleScheduler.doSchedulingViaPOST | (self, remoteAddr, headers, body, calendar, originator, recipients) | Carry out iSchedule specific processing. | Carry out iSchedule specific processing. | [
"Carry",
"out",
"iSchedule",
"specific",
"processing",
"."
] | def doSchedulingViaPOST(self, remoteAddr, headers, body, calendar, originator, recipients):
"""
Carry out iSchedule specific processing.
"""
self.remoteAddr = remoteAddr
self.headers = headers
self.verified = False
if not self._podding and config.Scheduling.iSch... | [
"def",
"doSchedulingViaPOST",
"(",
"self",
",",
"remoteAddr",
",",
"headers",
",",
"body",
",",
"calendar",
",",
"originator",
",",
"recipients",
")",
":",
"self",
".",
"remoteAddr",
"=",
"remoteAddr",
"self",
".",
"headers",
"=",
"headers",
"self",
".",
"... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/caldav/datastore/scheduling/ischedule/scheduler.py#L147-L192 | ||
coala/coala-bears | 7d21a59891b6ad048bbe28de097cbb5693c648c7 | bears/python/VultureBear.py | python | _find_unused_code | (filenames) | :param filenames: List of filenames to check.
:return: Generator of Result objects. | :param filenames: List of filenames to check.
:return: Generator of Result objects. | [
":",
"param",
"filenames",
":",
"List",
"of",
"filenames",
"to",
"check",
".",
":",
"return",
":",
"Generator",
"of",
"Result",
"objects",
"."
] | def _find_unused_code(filenames):
"""
:param filenames: List of filenames to check.
:return: Generator of Result objects.
"""
vulture = Vulture()
vulture.scavenge(filenames)
for item in vulture.get_unused_code():
yield Result.from_values(origin='VultureBear',
... | [
"def",
"_find_unused_code",
"(",
"filenames",
")",
":",
"vulture",
"=",
"Vulture",
"(",
")",
"vulture",
".",
"scavenge",
"(",
"filenames",
")",
"for",
"item",
"in",
"vulture",
".",
"get_unused_code",
"(",
")",
":",
"yield",
"Result",
".",
"from_values",
"(... | https://github.com/coala/coala-bears/blob/7d21a59891b6ad048bbe28de097cbb5693c648c7/bears/python/VultureBear.py#L7-L20 | ||
mysql/mysql-connector-python | c5460bcbb0dff8e4e48bf4af7a971c89bf486d85 | lib/mysqlx/result.py | python | Result.get_generated_insert_id | (self) | return self._generated_id | Returns the generated insert id.
.. deprecated:: 8.0.12 | Returns the generated insert id. | [
"Returns",
"the",
"generated",
"insert",
"id",
"."
] | def get_generated_insert_id(self):
"""Returns the generated insert id.
.. deprecated:: 8.0.12
"""
return self._generated_id | [
"def",
"get_generated_insert_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_generated_id"
] | https://github.com/mysql/mysql-connector-python/blob/c5460bcbb0dff8e4e48bf4af7a971c89bf486d85/lib/mysqlx/result.py#L911-L916 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/iostream.py | python | SSLIOStream.reading | (self) | return self._handshake_reading or super(SSLIOStream, self).reading() | [] | def reading(self):
return self._handshake_reading or super(SSLIOStream, self).reading() | [
"def",
"reading",
"(",
"self",
")",
":",
"return",
"self",
".",
"_handshake_reading",
"or",
"super",
"(",
"SSLIOStream",
",",
"self",
")",
".",
"reading",
"(",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/iostream.py#L1490-L1491 | |||
googleapis/python-ndb | e780c81cde1016651afbfcad8180d9912722cf1b | google/cloud/ndb/model.py | python | ModelKey._get_value | (entity) | return entity._entity_key | Get the entity key from an entity.
Args:
entity (Model): An entity to get the entity key from.
Returns:
.Key: The entity key stored on ``entity``. | Get the entity key from an entity. | [
"Get",
"the",
"entity",
"key",
"from",
"an",
"entity",
"."
] | def _get_value(entity):
"""Get the entity key from an entity.
Args:
entity (Model): An entity to get the entity key from.
Returns:
.Key: The entity key stored on ``entity``.
"""
return entity._entity_key | [
"def",
"_get_value",
"(",
"entity",
")",
":",
"return",
"entity",
".",
"_entity_key"
] | https://github.com/googleapis/python-ndb/blob/e780c81cde1016651afbfcad8180d9912722cf1b/google/cloud/ndb/model.py#L2328-L2337 | |
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 | mbox._generate_toc | (self) | Generate key-to-(start, stop) table of contents. | Generate key-to-(start, stop) table of contents. | [
"Generate",
"key",
"-",
"to",
"-",
"(",
"start",
"stop",
")",
"table",
"of",
"contents",
"."
] | def _generate_toc(self):
"""Generate key-to-(start, stop) table of contents."""
starts, stops = [], []
self._file.seek(0)
while True:
line_pos = self._file.tell()
line = self._file.readline()
if line.startswith('From '):
if len(stops) <... | [
"def",
"_generate_toc",
"(",
"self",
")",
":",
"starts",
",",
"stops",
"=",
"[",
"]",
",",
"[",
"]",
"self",
".",
"_file",
".",
"seek",
"(",
"0",
")",
"while",
"True",
":",
"line_pos",
"=",
"self",
".",
"_file",
".",
"tell",
"(",
")",
"line",
"... | 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#L793-L809 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_csr.py | python | Yedit.get_entry | (data, key, sep='.') | return data | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | [
"Get",
"an",
"item",
"from",
"a",
"dictionary",
"with",
"key",
"notation",
"a",
".",
"b",
".",
"c",
"d",
"=",
"{",
"a",
":",
"{",
"b",
":",
"c",
"}}}",
"key",
"=",
"a",
".",
"b",
"return",
"c"
] | def get_entry(data, key, sep='.'):
''' Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c
'''
if key == '':
pass
elif (not (key and Yedit.valid_key(key, sep)) and
isinstance(data, (... | [
"def",
"get_entry",
"(",
"data",
",",
"key",
",",
"sep",
"=",
"'.'",
")",
":",
"if",
"key",
"==",
"''",
":",
"pass",
"elif",
"(",
"not",
"(",
"key",
"and",
"Yedit",
".",
"valid_key",
"(",
"key",
",",
"sep",
")",
")",
"and",
"isinstance",
"(",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_adm_csr.py#L322-L344 | |
grantjenks/python-sortedcontainers | dff7ef79a21b3f3ceb6a19868f302f0a680aa243 | sortedcontainers/sorteddict.py | python | SortedDict.items | (self) | return SortedItemsView(self) | Return new sorted items view of the sorted dict's items.
See :class:`SortedItemsView` for details.
:return: new sorted items view | Return new sorted items view of the sorted dict's items. | [
"Return",
"new",
"sorted",
"items",
"view",
"of",
"the",
"sorted",
"dict",
"s",
"items",
"."
] | def items(self):
"""Return new sorted items view of the sorted dict's items.
See :class:`SortedItemsView` for details.
:return: new sorted items view
"""
return SortedItemsView(self) | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"SortedItemsView",
"(",
"self",
")"
] | https://github.com/grantjenks/python-sortedcontainers/blob/dff7ef79a21b3f3ceb6a19868f302f0a680aa243/sortedcontainers/sorteddict.py#L363-L371 | |
bbc/brave | 88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5 | brave/connections/connection.py | python | Connection.has_video | (self) | return self.source.has_video() and self.dest.has_video() | True iff both the src and dest have video | True iff both the src and dest have video | [
"True",
"iff",
"both",
"the",
"src",
"and",
"dest",
"have",
"video"
] | def has_video(self):
'''
True iff both the src and dest have video
'''
return self.source.has_video() and self.dest.has_video() | [
"def",
"has_video",
"(",
"self",
")",
":",
"return",
"self",
".",
"source",
".",
"has_video",
"(",
")",
"and",
"self",
".",
"dest",
".",
"has_video",
"(",
")"
] | https://github.com/bbc/brave/blob/88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5/brave/connections/connection.py#L67-L71 | |
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas/geometry/_core/distance.py | python | distance_point_plane_signed | (point, plane) | return dot_vectors(vector, normal) | r"""Compute the signed distance from a point to a plane defined by origin point and normal.
Parameters
----------
point : [float, float, float] or :class:`compas.geometry.Point`
Point coordinates.
plane : [point, vector] or :class:`compas.geometry.Plane`
A point and a vector defining a ... | r"""Compute the signed distance from a point to a plane defined by origin point and normal. | [
"r",
"Compute",
"the",
"signed",
"distance",
"from",
"a",
"point",
"to",
"a",
"plane",
"defined",
"by",
"origin",
"point",
"and",
"normal",
"."
] | def distance_point_plane_signed(point, plane):
r"""Compute the signed distance from a point to a plane defined by origin point and normal.
Parameters
----------
point : [float, float, float] or :class:`compas.geometry.Point`
Point coordinates.
plane : [point, vector] or :class:`compas.geome... | [
"def",
"distance_point_plane_signed",
"(",
"point",
",",
"plane",
")",
":",
"base",
",",
"normal",
"=",
"plane",
"vector",
"=",
"subtract_vectors",
"(",
"point",
",",
"base",
")",
"return",
"dot_vectors",
"(",
"vector",
",",
"normal",
")"
] | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/geometry/_core/distance.py#L374-L428 | |
riptideio/pymodbus | c5772b35ae3f29d1947f3ab453d8d00df846459f | examples/contrib/sunspec_client.py | python | SunspecClient.__init__ | (self, client) | Initialize a new instance of the client
:param client: The modbus client to use | Initialize a new instance of the client | [
"Initialize",
"a",
"new",
"instance",
"of",
"the",
"client"
] | def __init__(self, client):
""" Initialize a new instance of the client
:param client: The modbus client to use
"""
self.client = client
self.offset = SunspecOffsets.CommonBlock | [
"def",
"__init__",
"(",
"self",
",",
"client",
")",
":",
"self",
".",
"client",
"=",
"client",
"self",
".",
"offset",
"=",
"SunspecOffsets",
".",
"CommonBlock"
] | https://github.com/riptideio/pymodbus/blob/c5772b35ae3f29d1947f3ab453d8d00df846459f/examples/contrib/sunspec_client.py#L209-L215 | ||
OfflineIMAP/offlineimap | e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2 | offlineimap/folder/LocalStatusSQLite.py | python | LocalStatusSQLiteFolder.purge | (self) | Remove any pre-existing database. Do not call in dry-run mode. | Remove any pre-existing database. Do not call in dry-run mode. | [
"Remove",
"any",
"pre",
"-",
"existing",
"database",
".",
"Do",
"not",
"call",
"in",
"dry",
"-",
"run",
"mode",
"."
] | def purge(self):
"""Remove any pre-existing database. Do not call in dry-run mode."""
try:
os.unlink(self.filename)
except OSError as e:
self.ui.debug('', "could not remove file %s: %s"%
(self.filename, e)) | [
"def",
"purge",
"(",
"self",
")",
":",
"try",
":",
"os",
".",
"unlink",
"(",
"self",
".",
"filename",
")",
"except",
"OSError",
"as",
"e",
":",
"self",
".",
"ui",
".",
"debug",
"(",
"''",
",",
"\"could not remove file %s: %s\"",
"%",
"(",
"self",
"."... | https://github.com/OfflineIMAP/offlineimap/blob/e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2/offlineimap/folder/LocalStatusSQLite.py#L141-L148 | ||
tengxing/tensorflow-learn | 4d41f2a27af346e4d2adb206ebbc25aafbe52be6 | mnist/input_data.py | python | maybe_download | (filename, work_directory) | return filepath | Download the data from Yann's website, unless it's already here. | Download the data from Yann's website, unless it's already here. | [
"Download",
"the",
"data",
"from",
"Yann",
"s",
"website",
"unless",
"it",
"s",
"already",
"here",
"."
] | def maybe_download(filename, work_directory):
"""Download the data from Yann's website, unless it's already here."""
if not os.path.exists(work_directory):
os.mkdir(work_directory)
filepath = os.path.join(work_directory, filename)
if not os.path.exists(filepath):
filepath, _ = urllib.request.urlretrieve... | [
"def",
"maybe_download",
"(",
"filename",
",",
"work_directory",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"work_directory",
")",
":",
"os",
".",
"mkdir",
"(",
"work_directory",
")",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
... | https://github.com/tengxing/tensorflow-learn/blob/4d41f2a27af346e4d2adb206ebbc25aafbe52be6/mnist/input_data.py#L34-L43 | |
parkouss/webmacs | 35f174303af8c9147825c45ad41ff35706fa8bfa | webmacs/commands/global.py | python | send_right | (ctx) | Send a key right event. | Send a key right event. | [
"Send",
"a",
"key",
"right",
"event",
"."
] | def send_right(ctx):
"""Send a key right event."""
send_key_event(KeyPress.from_str("Right")) | [
"def",
"send_right",
"(",
"ctx",
")",
":",
"send_key_event",
"(",
"KeyPress",
".",
"from_str",
"(",
"\"Right\"",
")",
")"
] | https://github.com/parkouss/webmacs/blob/35f174303af8c9147825c45ad41ff35706fa8bfa/webmacs/commands/global.py#L400-L402 | ||
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/manageags/_data.py | python | Data.validateAllDataItems | (self) | return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | validates all the items in the datastore | validates all the items in the datastore | [
"validates",
"all",
"the",
"items",
"in",
"the",
"datastore"
] | def validateAllDataItems(self):
""" validates all the items in the datastore """
params = {
"f" : "json"}
url = self._url + "/validateAllDataItems"
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
... | [
"def",
"validateAllDataItems",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/validateAllDataItems\"",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"p... | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_data.py#L165-L173 | |
geduldig/TwitterAPI | 1cb89e8fc50b051707fb99d6c2bb235ada5faf1a | TwitterAPI/TwitterAPI.py | python | TwitterAPI.request | (self, resource, params=None, files=None, method_override=None, hydrate_type=HydrateType.NONE) | Request a Twitter REST API or Streaming API resource.
:param resource: A Twitter endpoint (ex. "search/tweets")
:param params: Dictionary with endpoint parameters or None (default)
:param files: Dictionary with multipart-encoded file or None (default)
:param method_override: Request met... | Request a Twitter REST API or Streaming API resource. | [
"Request",
"a",
"Twitter",
"REST",
"API",
"or",
"Streaming",
"API",
"resource",
"."
] | def request(self, resource, params=None, files=None, method_override=None, hydrate_type=HydrateType.NONE):
"""Request a Twitter REST API or Streaming API resource.
:param resource: A Twitter endpoint (ex. "search/tweets")
:param params: Dictionary with endpoint parameters or None (default)
... | [
"def",
"request",
"(",
"self",
",",
"resource",
",",
"params",
"=",
"None",
",",
"files",
"=",
"None",
",",
"method_override",
"=",
"None",
",",
"hydrate_type",
"=",
"HydrateType",
".",
"NONE",
")",
":",
"# check that the endpoint is valid",
"resource",
",",
... | https://github.com/geduldig/TwitterAPI/blob/1cb89e8fc50b051707fb99d6c2bb235ada5faf1a/TwitterAPI/TwitterAPI.py#L145-L230 | ||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/messaging/credential_definitions/routes.py | python | credential_definitions_send_credential_definition | (request: web.BaseRequest) | Request handler for sending a credential definition to the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition identifier | Request handler for sending a credential definition to the ledger. | [
"Request",
"handler",
"for",
"sending",
"a",
"credential",
"definition",
"to",
"the",
"ledger",
"."
] | async def credential_definitions_send_credential_definition(request: web.BaseRequest):
"""
Request handler for sending a credential definition to the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition identifier
"""
context: AdminRequestContext = ... | [
"async",
"def",
"credential_definitions_send_credential_definition",
"(",
"request",
":",
"web",
".",
"BaseRequest",
")",
":",
"context",
":",
"AdminRequestContext",
"=",
"request",
"[",
"\"context\"",
"]",
"profile",
"=",
"context",
".",
"profile",
"outbound_handler"... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/credential_definitions/routes.py#L159-L304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.