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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
boto/boto3 | 235a19b65af5c752eac47df6d90e327d31f26c73 | boto3/resources/factory.py | python | ResourceFactory._create_action | (factory_self, action_model, resource_name,
service_context, is_load=False) | return do_action | Creates a new method which makes a request to the underlying
AWS service. | Creates a new method which makes a request to the underlying
AWS service. | [
"Creates",
"a",
"new",
"method",
"which",
"makes",
"a",
"request",
"to",
"the",
"underlying",
"AWS",
"service",
"."
] | def _create_action(factory_self, action_model, resource_name,
service_context, is_load=False):
"""
Creates a new method which makes a request to the underlying
AWS service.
"""
# Create the action in in this closure but before the ``do_action``
# me... | [
"def",
"_create_action",
"(",
"factory_self",
",",
"action_model",
",",
"resource_name",
",",
"service_context",
",",
"is_load",
"=",
"False",
")",
":",
"# Create the action in in this closure but before the ``do_action``",
"# method below is invoked, which allows instances of the ... | https://github.com/boto/boto3/blob/235a19b65af5c752eac47df6d90e327d31f26c73/boto3/resources/factory.py#L485-L539 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/owviolinplot.py | python | ViolinItem.boundingRect | (self) | return self.__violin_path.boundingRect() | [] | def boundingRect(self) -> QRectF:
return self.__violin_path.boundingRect() | [
"def",
"boundingRect",
"(",
"self",
")",
"->",
"QRectF",
":",
"return",
"self",
".",
"__violin_path",
".",
"boundingRect",
"(",
")"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owviolinplot.py#L197-L198 | |||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/tkinter/__init__.py | python | Scrollbar.get | (self) | return self._getdoubles(self.tk.call(self._w, 'get')) | Return the current fractional values (upper and lower end)
of the slider position. | Return the current fractional values (upper and lower end)
of the slider position. | [
"Return",
"the",
"current",
"fractional",
"values",
"(",
"upper",
"and",
"lower",
"end",
")",
"of",
"the",
"slider",
"position",
"."
] | def get(self):
"""Return the current fractional values (upper and lower end)
of the slider position."""
return self._getdoubles(self.tk.call(self._w, 'get')) | [
"def",
"get",
"(",
"self",
")",
":",
"return",
"self",
".",
"_getdoubles",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'get'",
")",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L2910-L2913 | |
ricequant/rqalpha-mod-ctp | bfd40801f9a182226a911cac74660f62993eb6db | rqalpha_mod_ctp/ctp/pyctp/linux64_34/__init__.py | python | TraderApi.OnRspQryInvestorPositionDetail | (self, pInvestorPositionDetail, pRspInfo, nRequestID, bIsLast) | 请求查询投资者持仓明细响应 | 请求查询投资者持仓明细响应 | [
"请求查询投资者持仓明细响应"
] | def OnRspQryInvestorPositionDetail(self, pInvestorPositionDetail, pRspInfo, nRequestID, bIsLast):
"""请求查询投资者持仓明细响应""" | [
"def",
"OnRspQryInvestorPositionDetail",
"(",
"self",
",",
"pInvestorPositionDetail",
",",
"pRspInfo",
",",
"nRequestID",
",",
"bIsLast",
")",
":"
] | https://github.com/ricequant/rqalpha-mod-ctp/blob/bfd40801f9a182226a911cac74660f62993eb6db/rqalpha_mod_ctp/ctp/pyctp/linux64_34/__init__.py#L606-L607 | ||
datamllab/rlcard | c21ea82519c453a42e3bdc6848bd3356e9b6ac43 | rlcard/envs/env.py | python | Env.step | (self, action, raw_action=False) | return self._extract_state(next_state), player_id | Step forward
Args:
action (int): The action taken by the current player
raw_action (boolean): True if the action is a raw action
Returns:
(tuple): Tuple containing:
(dict): The next state
(int): The ID of the next player | Step forward | [
"Step",
"forward"
] | def step(self, action, raw_action=False):
''' Step forward
Args:
action (int): The action taken by the current player
raw_action (boolean): True if the action is a raw action
Returns:
(tuple): Tuple containing:
(dict): The next state
... | [
"def",
"step",
"(",
"self",
",",
"action",
",",
"raw_action",
"=",
"False",
")",
":",
"if",
"not",
"raw_action",
":",
"action",
"=",
"self",
".",
"_decode_action",
"(",
"action",
")",
"self",
".",
"timestep",
"+=",
"1",
"# Record the action for human interfa... | https://github.com/datamllab/rlcard/blob/c21ea82519c453a42e3bdc6848bd3356e9b6ac43/rlcard/envs/env.py#L65-L86 | |
pythonarcade/arcade | 1ee3eb1900683213e8e8df93943327c2ea784564 | doc/tutorials/views/04_views.py | python | GameOverView.__init__ | (self) | This is run once when we switch to this view | This is run once when we switch to this view | [
"This",
"is",
"run",
"once",
"when",
"we",
"switch",
"to",
"this",
"view"
] | def __init__(self):
""" This is run once when we switch to this view """
super().__init__()
self.texture = arcade.load_texture("game_over.png")
# Reset the viewport, necessary if we have a scrolling game and we need
# to reset the viewport back to the start so we can see what we... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"texture",
"=",
"arcade",
".",
"load_texture",
"(",
"\"game_over.png\"",
")",
"# Reset the viewport, necessary if we have a scrolling game and we need",
"# to reset th... | https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/doc/tutorials/views/04_views.py#L43-L50 | ||
openstack/octavia | 27e5b27d31c695ba72fb6750de2bdafd76e0d7d9 | octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py | python | JinjaTemplater._transform_l7policy | (self, l7policy, feature_compatibility,
pool_tls_certs=None) | return ret_value | Transforms an L7 policy into an object that will
be processed by the templating system | Transforms an L7 policy into an object that will | [
"Transforms",
"an",
"L7",
"policy",
"into",
"an",
"object",
"that",
"will"
] | def _transform_l7policy(self, l7policy, feature_compatibility,
pool_tls_certs=None):
"""Transforms an L7 policy into an object that will
be processed by the templating system
"""
ret_value = {
'id': l7policy.id,
'action': l7policy.... | [
"def",
"_transform_l7policy",
"(",
"self",
",",
"l7policy",
",",
"feature_compatibility",
",",
"pool_tls_certs",
"=",
"None",
")",
":",
"ret_value",
"=",
"{",
"'id'",
":",
"l7policy",
".",
"id",
",",
"'action'",
":",
"l7policy",
".",
"action",
",",
"'redirec... | https://github.com/openstack/octavia/blob/27e5b27d31c695ba72fb6750de2bdafd76e0d7d9/octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py#L402-L438 | |
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | ikalog/engine.py | python | IkaEngine._profile_dump | (self) | [] | def _profile_dump(self):
self._profile_dump_scenes() | [
"def",
"_profile_dump",
"(",
"self",
")",
":",
"self",
".",
"_profile_dump_scenes",
"(",
")"
] | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/engine.py#L45-L46 | ||||
ericgazoni/openpyxl | c55988e4904d4337ce4c35ab8b7dc305bca9de23 | openpyxl/cell/cell.py | python | Cell.check_error | (self, value) | Tries to convert Error" else N/A | Tries to convert Error" else N/A | [
"Tries",
"to",
"convert",
"Error",
"else",
"N",
"/",
"A"
] | def check_error(self, value):
"""Tries to convert Error" else N/A"""
try:
return unicode(value)
except:
return unicode('#N/A') | [
"def",
"check_error",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"return",
"unicode",
"(",
"value",
")",
"except",
":",
"return",
"unicode",
"(",
"'#N/A'",
")"
] | https://github.com/ericgazoni/openpyxl/blob/c55988e4904d4337ce4c35ab8b7dc305bca9de23/openpyxl/cell/cell.py#L232-L237 | ||
scrtlabs/catalyst | 2e8029780f2381da7a0729f7b52505e5db5f535b | catalyst/pipeline/classifiers/classifier.py | python | Classifier.to_workspace_value | (self, result, assets) | return LabelArray(
super(Classifier, self).to_workspace_value(
with_missing,
assets,
),
self.missing_value,
) | Called with the result of a pipeline. This needs to return an object
which can be put into the workspace to continue doing computations.
This is the inverse of
:func:`~catalyst.pipeline.term.Term.postprocess`. | Called with the result of a pipeline. This needs to return an object
which can be put into the workspace to continue doing computations. | [
"Called",
"with",
"the",
"result",
"of",
"a",
"pipeline",
".",
"This",
"needs",
"to",
"return",
"an",
"object",
"which",
"can",
"be",
"put",
"into",
"the",
"workspace",
"to",
"continue",
"doing",
"computations",
"."
] | def to_workspace_value(self, result, assets):
"""
Called with the result of a pipeline. This needs to return an object
which can be put into the workspace to continue doing computations.
This is the inverse of
:func:`~catalyst.pipeline.term.Term.postprocess`.
"""
... | [
"def",
"to_workspace_value",
"(",
"self",
",",
"result",
",",
"assets",
")",
":",
"if",
"self",
".",
"dtype",
"==",
"int64_dtype",
":",
"return",
"super",
"(",
"Classifier",
",",
"self",
")",
".",
"to_workspace_value",
"(",
"result",
",",
"assets",
")",
... | https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/pipeline/classifiers/classifier.py#L328-L355 | |
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | plugin.video.torrent.tv/resources/lib/torr2xbmc.py | python | play_url2 | (params) | [] | def play_url2(params):
torr_link=urllib.unquote(params["torr_url"])
img=urllib.unquote_plus(params["img"])
title=urllib.unquote_plus(params["title"])
TSplayer=TSengine()
out=TSplayer.load_torrent(torr_link,'TORRENT')
if out=='Ok':
lnk=TSplayer.get_link(int(params['ind']),title, img, img)... | [
"def",
"play_url2",
"(",
"params",
")",
":",
"torr_link",
"=",
"urllib",
".",
"unquote",
"(",
"params",
"[",
"\"torr_url\"",
"]",
")",
"img",
"=",
"urllib",
".",
"unquote_plus",
"(",
"params",
"[",
"\"img\"",
"]",
")",
"title",
"=",
"urllib",
".",
"unq... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.torrent.tv/resources/lib/torr2xbmc.py#L1660-L1692 | ||||
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/grouper/grprobj_init.py | python | GrouperInit._init_usrgos | (self, goids) | return usrgos | Return user GO IDs which have GO Terms. | Return user GO IDs which have GO Terms. | [
"Return",
"user",
"GO",
"IDs",
"which",
"have",
"GO",
"Terms",
"."
] | def _init_usrgos(self, goids):
"""Return user GO IDs which have GO Terms."""
usrgos = set()
goids_missing = set()
_go2obj = self.gosubdag.go2obj
for goid in goids:
if goid in _go2obj:
usrgos.add(goid)
else:
goids_missing.add... | [
"def",
"_init_usrgos",
"(",
"self",
",",
"goids",
")",
":",
"usrgos",
"=",
"set",
"(",
")",
"goids_missing",
"=",
"set",
"(",
")",
"_go2obj",
"=",
"self",
".",
"gosubdag",
".",
"go2obj",
"for",
"goid",
"in",
"goids",
":",
"if",
"goid",
"in",
"_go2obj... | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/grouper/grprobj_init.py#L49-L62 | |
ambv/bitrot | 7f9a2e2efcb117ba46b8de9a2c406b92b566ecab | src/bitrot.py | python | get_path | (directory=b'.', ext=b'db') | return os.path.join(directory, b'.bitrot.' + ext) | Compose the path to the selected bitrot file. | Compose the path to the selected bitrot file. | [
"Compose",
"the",
"path",
"to",
"the",
"selected",
"bitrot",
"file",
"."
] | def get_path(directory=b'.', ext=b'db'):
"""Compose the path to the selected bitrot file."""
return os.path.join(directory, b'.bitrot.' + ext) | [
"def",
"get_path",
"(",
"directory",
"=",
"b'.'",
",",
"ext",
"=",
"b'db'",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"b'.bitrot.'",
"+",
"ext",
")"
] | https://github.com/ambv/bitrot/blob/7f9a2e2efcb117ba46b8de9a2c406b92b566ecab/src/bitrot.py#L438-L440 | |
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/guicomponents.py | python | TracksNumbersSelect.get_tracks | (self) | return (int(self.video_tracks.get_value()), int(self.audio_tracks.get_value())) | [] | def get_tracks(self):
return (int(self.video_tracks.get_value()), int(self.audio_tracks.get_value())) | [
"def",
"get_tracks",
"(",
"self",
")",
":",
"return",
"(",
"int",
"(",
"self",
".",
"video_tracks",
".",
"get_value",
"(",
")",
")",
",",
"int",
"(",
"self",
".",
"audio_tracks",
".",
"get_value",
"(",
")",
")",
")"
] | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/guicomponents.py#L3118-L3119 | |||
joxeankoret/multiav | 8a2bc4ae3ad043a73c7982116aa579f6e1dd5559 | multiav/web/net.py | python | httpdate | (date_obj) | return date_obj.strftime("%a, %d %b %Y %H:%M:%S GMT") | Formats a datetime object for use in HTTP headers.
>>> import datetime
>>> httpdate(datetime.datetime(1970, 1, 1, 1, 1, 1))
'Thu, 01 Jan 1970 01:01:01 GMT' | Formats a datetime object for use in HTTP headers.
>>> import datetime
>>> httpdate(datetime.datetime(1970, 1, 1, 1, 1, 1))
'Thu, 01 Jan 1970 01:01:01 GMT' | [
"Formats",
"a",
"datetime",
"object",
"for",
"use",
"in",
"HTTP",
"headers",
".",
">>>",
"import",
"datetime",
">>>",
"httpdate",
"(",
"datetime",
".",
"datetime",
"(",
"1970",
"1",
"1",
"1",
"1",
"1",
"))",
"Thu",
"01",
"Jan",
"1970",
"01",
":",
"01... | def httpdate(date_obj):
"""
Formats a datetime object for use in HTTP headers.
>>> import datetime
>>> httpdate(datetime.datetime(1970, 1, 1, 1, 1, 1))
'Thu, 01 Jan 1970 01:01:01 GMT'
"""
return date_obj.strftime("%a, %d %b %Y %H:%M:%S GMT") | [
"def",
"httpdate",
"(",
"date_obj",
")",
":",
"return",
"date_obj",
".",
"strftime",
"(",
"\"%a, %d %b %Y %H:%M:%S GMT\"",
")"
] | https://github.com/joxeankoret/multiav/blob/8a2bc4ae3ad043a73c7982116aa579f6e1dd5559/multiav/web/net.py#L119-L127 | |
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/pip/_vendor/ipaddress.py | python | _BaseV4._is_hostmask | (self, ip_str) | return False | Test if the IP string is a hostmask (rather than a netmask).
Args:
ip_str: A string, the potential hostmask.
Returns:
A boolean, True if the IP string is a hostmask. | Test if the IP string is a hostmask (rather than a netmask). | [
"Test",
"if",
"the",
"IP",
"string",
"is",
"a",
"hostmask",
"(",
"rather",
"than",
"a",
"netmask",
")",
"."
] | def _is_hostmask(self, ip_str):
"""Test if the IP string is a hostmask (rather than a netmask).
Args:
ip_str: A string, the potential hostmask.
Returns:
A boolean, True if the IP string is a hostmask.
"""
bits = ip_str.split('.')
try:
... | [
"def",
"_is_hostmask",
"(",
"self",
",",
"ip_str",
")",
":",
"bits",
"=",
"ip_str",
".",
"split",
"(",
"'.'",
")",
"try",
":",
"parts",
"=",
"[",
"x",
"for",
"x",
"in",
"map",
"(",
"int",
",",
"bits",
")",
"if",
"x",
"in",
"self",
".",
"_valid_... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L1330-L1349 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/core/grr_response_core/stats/default_stats_collector.py | python | _Metric.ListFieldsValues | (self) | return list(self._metric_values) if self._field_defs else [] | Returns a list of tuples of all field values used with the metric. | Returns a list of tuples of all field values used with the metric. | [
"Returns",
"a",
"list",
"of",
"tuples",
"of",
"all",
"field",
"values",
"used",
"with",
"the",
"metric",
"."
] | def ListFieldsValues(self):
"""Returns a list of tuples of all field values used with the metric."""
return list(self._metric_values) if self._field_defs else [] | [
"def",
"ListFieldsValues",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_metric_values",
")",
"if",
"self",
".",
"_field_defs",
"else",
"[",
"]"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/stats/default_stats_collector.py#L62-L64 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/utils/network.py | python | _get_iface_info | (iface) | If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error | If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error | [
"If",
"iface",
"is",
"available",
"return",
"interface",
"info",
"and",
"no",
"error",
"otherwise",
"return",
"no",
"info",
"and",
"log",
"and",
"return",
"an",
"error"
] | def _get_iface_info(iface):
"""
If `iface` is available, return interface info and no error, otherwise
return no info and log and return an error
"""
iface_info = interfaces()
if iface in iface_info.keys():
return iface_info, False
else:
error_msg = 'Interface "{}" not in av... | [
"def",
"_get_iface_info",
"(",
"iface",
")",
":",
"iface_info",
"=",
"interfaces",
"(",
")",
"if",
"iface",
"in",
"iface_info",
".",
"keys",
"(",
")",
":",
"return",
"iface_info",
",",
"False",
"else",
":",
"error_msg",
"=",
"'Interface \"{}\" not in available... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/network.py#L1212-L1226 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/graphgym/utils/tools.py | python | dummy_context.__enter__ | (self) | return None | [] | def __enter__(self):
return None | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/graphgym/utils/tools.py#L3-L4 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/core/handlers/base.py | python | BaseHandler.__init__ | (self) | [] | def __init__(self):
self._request_middleware = None
self._view_middleware = None
self._template_response_middleware = None
self._response_middleware = None
self._exception_middleware = None
self._middleware_chain = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_request_middleware",
"=",
"None",
"self",
".",
"_view_middleware",
"=",
"None",
"self",
".",
"_template_response_middleware",
"=",
"None",
"self",
".",
"_response_middleware",
"=",
"None",
"self",
".",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/core/handlers/base.py#L27-L33 | ||||
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/blbooksgenre/blbooksgenre.py | python | BlBooksGenre._generate_examples | (self, filepath, split) | Yields examples as (key, example) tuples. | Yields examples as (key, example) tuples. | [
"Yields",
"examples",
"as",
"(",
"key",
"example",
")",
"tuples",
"."
] | def _generate_examples(self, filepath, split):
"""Yields examples as (key, example) tuples."""
with open(filepath, encoding="utf-8") as f:
reader = csv.DictReader(f)
if self.config.name == "title_genre_classifiction":
unique = set()
id_ = 0
... | [
"def",
"_generate_examples",
"(",
"self",
",",
"filepath",
",",
"split",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"reader",
"=",
"csv",
".",
"DictReader",
"(",
"f",
")",
"if",
"self",
".",
"co... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/blbooksgenre/blbooksgenre.py#L210-L340 | ||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/imputils.py | python | Registry.lower_cast | (self, fromty, toty) | return decorate | Decorate the implementation of implicit conversion between
*fromty* and *toty*.
The decorated implementation will have the signature
(context, builder, fromty, toty, val). | Decorate the implementation of implicit conversion between
*fromty* and *toty*. | [
"Decorate",
"the",
"implementation",
"of",
"implicit",
"conversion",
"between",
"*",
"fromty",
"*",
"and",
"*",
"toty",
"*",
"."
] | def lower_cast(self, fromty, toty):
"""
Decorate the implementation of implicit conversion between
*fromty* and *toty*.
The decorated implementation will have the signature
(context, builder, fromty, toty, val).
"""
def decorate(impl):
self.casts.appe... | [
"def",
"lower_cast",
"(",
"self",
",",
"fromty",
",",
"toty",
")",
":",
"def",
"decorate",
"(",
"impl",
")",
":",
"self",
".",
"casts",
".",
"append",
"(",
"(",
"impl",
",",
"(",
"fromty",
",",
"toty",
")",
")",
")",
"return",
"impl",
"return",
"... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/imputils.py#L95-L106 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/common/files.py | python | md5_from_filelike | (filelike, block_size_factor=128) | return md5.hexdigest() | Create the hexdigested md5 checksum of the contents from a filelike object.
:param filelike: the filelike object for whose contents to generate the md5 checksum
:param block_size_factor: the file is read at chunks of size ``block_size_factor * md5.block_size``, where
``md5.block_size`` is the block_siz... | Create the hexdigested md5 checksum of the contents from a filelike object. | [
"Create",
"the",
"hexdigested",
"md5",
"checksum",
"of",
"the",
"contents",
"from",
"a",
"filelike",
"object",
"."
] | def md5_from_filelike(filelike, block_size_factor=128):
"""Create the hexdigested md5 checksum of the contents from a filelike object.
:param filelike: the filelike object for whose contents to generate the md5 checksum
:param block_size_factor: the file is read at chunks of size ``block_size_factor * md5.... | [
"def",
"md5_from_filelike",
"(",
"filelike",
",",
"block_size_factor",
"=",
"128",
")",
":",
"md5",
"=",
"hashlib",
".",
"md5",
"(",
")",
"# I read 128 bytes at a time until it returns the empty string b''",
"for",
"chunk",
"in",
"iter",
"(",
"lambda",
":",
"filelik... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/common/files.py#L14-L29 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/lib2to3/pytree.py | python | Base._eq | (self, other) | Compare two nodes for equality.
This is called by __eq__ and __ne__. It is only called if the two nodes
have the same type. This must be implemented by the concrete subclass.
Nodes should be considered equal if they have the same structure,
ignoring the prefix string and other context... | Compare two nodes for equality. | [
"Compare",
"two",
"nodes",
"for",
"equality",
"."
] | def _eq(self, other):
"""
Compare two nodes for equality.
This is called by __eq__ and __ne__. It is only called if the two nodes
have the same type. This must be implemented by the concrete subclass.
Nodes should be considered equal if they have the same structure,
ig... | [
"def",
"_eq",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/lib2to3/pytree.py#L67-L76 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/FeedUnit42/Integrations/FeedUnit42/FeedUnit42.py | python | parse_related_indicators | (report: Dict, related_ids: List, id_to_object: Dict, matched_relationships: Dict,
courses_of_action_products: Dict) | return indicators | Creates feed related indicators to Stix report object.
Args:
report (dict): Stix report object.
related_ids (List): Malware objects ids related to the report.
id_to_object (Dict): a dict in the form of `id: stix_object`.
matched_relationships (Dict): a dict of relationships in the f... | Creates feed related indicators to Stix report object. | [
"Creates",
"feed",
"related",
"indicators",
"to",
"Stix",
"report",
"object",
"."
] | def parse_related_indicators(report: Dict, related_ids: List, id_to_object: Dict, matched_relationships: Dict,
courses_of_action_products: Dict) -> List[Dict]:
""" Creates feed related indicators to Stix report object.
Args:
report (dict): Stix report object.
relate... | [
"def",
"parse_related_indicators",
"(",
"report",
":",
"Dict",
",",
"related_ids",
":",
"List",
",",
"id_to_object",
":",
"Dict",
",",
"matched_relationships",
":",
"Dict",
",",
"courses_of_action_products",
":",
"Dict",
")",
"->",
"List",
"[",
"Dict",
"]",
":... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FeedUnit42/Integrations/FeedUnit42/FeedUnit42.py#L296-L363 | |
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/ImpalaService/ImpalaService.py | python | GetRuntimeProfile_result.validate | (self) | return | [] | def validate(self):
return | [
"def",
"validate",
"(",
"self",
")",
":",
"return"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/ImpalaService/ImpalaService.py#L974-L975 | |||
pyenchant/pyenchant | fc2a4a3fca6a55d510d01455b814aa27cdfc961e | enchant/checker/__init__.py | python | SpellChecker.set_offset | (self, off: int, whence: int = 0) | Set the offset of the tokenization routine.
For more details on the purpose of the tokenization offset,
see the documentation of the module :py:mod:`enchant.tokenize`.
The optional argument `whence` indicates the method by
which to change the offset:
* 0 (the default) treat... | Set the offset of the tokenization routine. | [
"Set",
"the",
"offset",
"of",
"the",
"tokenization",
"routine",
"."
] | def set_offset(self, off: int, whence: int = 0) -> None:
"""Set the offset of the tokenization routine.
For more details on the purpose of the tokenization offset,
see the documentation of the module :py:mod:`enchant.tokenize`.
The optional argument `whence` indicates the method by
... | [
"def",
"set_offset",
"(",
"self",
",",
"off",
":",
"int",
",",
"whence",
":",
"int",
"=",
"0",
")",
"->",
"None",
":",
"if",
"whence",
"==",
"0",
":",
"self",
".",
"_tokens",
".",
"set_offset",
"(",
"self",
".",
"_tokens",
".",
"offset",
"+",
"of... | https://github.com/pyenchant/pyenchant/blob/fc2a4a3fca6a55d510d01455b814aa27cdfc961e/enchant/checker/__init__.py#L354-L375 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py | python | _report_nonhermitian | (M, a, b, name) | Report if `M` is not a hermitian matrix given the tolerances `a`, `b`. | Report if `M` is not a hermitian matrix given the tolerances `a`, `b`. | [
"Report",
"if",
"M",
"is",
"not",
"a",
"hermitian",
"matrix",
"given",
"the",
"tolerances",
"a",
"b",
"."
] | def _report_nonhermitian(M, a, b, name):
"""
Report if `M` is not a hermitian matrix given the tolerances `a`, `b`.
"""
from scipy.linalg import norm
md = M - M.T.conj()
nmd = norm(md, 1)
tol = np.spacing(max(10**a, (10**b)*norm(M, 1)))
if nmd > tol:
print('matrix %s is not suf... | [
"def",
"_report_nonhermitian",
"(",
"M",
",",
"a",
",",
"b",
",",
"name",
")",
":",
"from",
"scipy",
".",
"linalg",
"import",
"norm",
"md",
"=",
"M",
"-",
"M",
".",
"T",
".",
"conj",
"(",
")",
"nmd",
"=",
"norm",
"(",
"md",
",",
"1",
")",
"to... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/sparse/linalg/eigen/lobpcg/lobpcg.py#L35-L48 | ||
bookieio/Bookie | 78b15fc68ec7e7dc3ad0c4fa049ce670a304d419 | bookie/views/api.py | python | ping | (request) | Verify that you've setup your api correctly and verified | Verify that you've setup your api correctly and verified | [
"Verify",
"that",
"you",
"ve",
"setup",
"your",
"api",
"correctly",
"and",
"verified"
] | def ping(request):
"""Verify that you've setup your api correctly and verified
"""
rdict = request.matchdict
params = request.params
username = rdict.get('username', None)
api_key = params.get('api_key', None)
user = UserMgr.get(username=username)
# Check if user provided the correct ap... | [
"def",
"ping",
"(",
"request",
")",
":",
"rdict",
"=",
"request",
".",
"matchdict",
"params",
"=",
"request",
".",
"params",
"username",
"=",
"rdict",
".",
"get",
"(",
"'username'",
",",
"None",
")",
"api_key",
"=",
"params",
".",
"get",
"(",
"'api_key... | https://github.com/bookieio/Bookie/blob/78b15fc68ec7e7dc3ad0c4fa049ce670a304d419/bookie/views/api.py#L94-L113 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/urllib3/fields.py | python | RequestField.make_multipart | (self, content_disposition=None, content_type=None,
content_location=None) | Makes this request field into a multipart request field.
This method overrides "Content-Disposition", "Content-Type" and
"Content-Location" headers to the request parameter.
:param content_type:
The 'Content-Type' of the request body.
:param content_location:
Th... | Makes this request field into a multipart request field. | [
"Makes",
"this",
"request",
"field",
"into",
"a",
"multipart",
"request",
"field",
"."
] | def make_multipart(self, content_disposition=None, content_type=None,
content_location=None):
"""
Makes this request field into a multipart request field.
This method overrides "Content-Disposition", "Content-Type" and
"Content-Location" headers to the request par... | [
"def",
"make_multipart",
"(",
"self",
",",
"content_disposition",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"content_location",
"=",
"None",
")",
":",
"self",
".",
"headers",
"[",
"'Content-Disposition'",
"]",
"=",
"content_disposition",
"or",
"'form-d... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/urllib3/fields.py#L156-L177 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/solrcloud.py | python | alias_get_collections | (alias_name, **kwargs) | return aliases | Get collection list for an alias
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.alias_get my_alias | [] | def alias_get_collections(alias_name, **kwargs):
"""
Get collection list for an alias
Additional parameters (kwargs) may be passed, they will be proxied to http.query
CLI Example:
.. code-block:: bash
salt '*' solrcloud.alias_get my_alias
"""
if not isinstance(alias_name, str):... | [
"def",
"alias_get_collections",
"(",
"alias_name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"alias_name",
",",
"str",
")",
":",
"raise",
"ValueError",
"(",
"\"Alias name must be a string\"",
")",
"collection_aliases",
"=",
"[",
"(",
"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/solrcloud.py#L261-L287 | ||
craffel/mir_eval | 576aad4e0b5931e7c697c078a1153c99b885c64f | mir_eval/transcription.py | python | validate_intervals | (ref_intervals, est_intervals) | Checks that the input annotations to a metric look like time intervals,
and throws helpful errors if not.
Parameters
----------
ref_intervals : np.ndarray, shape=(n,2)
Array of reference notes time intervals (onset and offset times)
est_intervals : np.ndarray, shape=(m,2)
Array of e... | Checks that the input annotations to a metric look like time intervals,
and throws helpful errors if not. | [
"Checks",
"that",
"the",
"input",
"annotations",
"to",
"a",
"metric",
"look",
"like",
"time",
"intervals",
"and",
"throws",
"helpful",
"errors",
"if",
"not",
"."
] | def validate_intervals(ref_intervals, est_intervals):
"""Checks that the input annotations to a metric look like time intervals,
and throws helpful errors if not.
Parameters
----------
ref_intervals : np.ndarray, shape=(n,2)
Array of reference notes time intervals (onset and offset times)
... | [
"def",
"validate_intervals",
"(",
"ref_intervals",
",",
"est_intervals",
")",
":",
"# If reference or estimated notes are empty, warn",
"if",
"ref_intervals",
".",
"size",
"==",
"0",
":",
"warnings",
".",
"warn",
"(",
"\"Reference notes are empty.\"",
")",
"if",
"est_in... | https://github.com/craffel/mir_eval/blob/576aad4e0b5931e7c697c078a1153c99b885c64f/mir_eval/transcription.py#L152-L171 | ||
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/utils/misc.py | python | in_jupyter | () | return False | Return true if we're running in jupyter notebook/lab or qtconsole. | Return true if we're running in jupyter notebook/lab or qtconsole. | [
"Return",
"true",
"if",
"we",
"re",
"running",
"in",
"jupyter",
"notebook",
"/",
"lab",
"or",
"qtconsole",
"."
] | def in_jupyter() -> bool:
"""Return true if we're running in jupyter notebook/lab or qtconsole."""
try:
from IPython import get_ipython
return get_ipython().__class__.__name__ == 'ZMQInteractiveShell'
except Exception:
pass
return False | [
"def",
"in_jupyter",
"(",
")",
"->",
"bool",
":",
"try",
":",
"from",
"IPython",
"import",
"get_ipython",
"return",
"get_ipython",
"(",
")",
".",
"__class__",
".",
"__name__",
"==",
"'ZMQInteractiveShell'",
"except",
"Exception",
":",
"pass",
"return",
"False"... | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/misc.py#L79-L87 | |
idapython/src | 839d93ac969bc1a152982464907445bc0d18a1f8 | python/idc.py | python | get_name_ea_simple | (name) | return ida_name.get_name_ea(BADADDR, name) | Get linear address of a name
@param name: name of program byte
@return: address of the name
BADADDR - No such name | Get linear address of a name | [
"Get",
"linear",
"address",
"of",
"a",
"name"
] | def get_name_ea_simple(name):
"""
Get linear address of a name
@param name: name of program byte
@return: address of the name
BADADDR - No such name
"""
return ida_name.get_name_ea(BADADDR, name) | [
"def",
"get_name_ea_simple",
"(",
"name",
")",
":",
"return",
"ida_name",
".",
"get_name_ea",
"(",
"BADADDR",
",",
"name",
")"
] | https://github.com/idapython/src/blob/839d93ac969bc1a152982464907445bc0d18a1f8/python/idc.py#L1284-L1293 | |
urwid/urwid | e2423b5069f51d318ea1ac0f355a0efe5448f7eb | examples/dialog.py | python | do_checklist | (text, height, width, list_height, *items) | return d | [] | def do_checklist(text, height, width, list_height, *items):
def constr(tag, state):
return urwid.CheckBox(tag, state)
d = CheckListDialogDisplay( text, height, width, constr, items, True)
d.add_buttons([ ("OK", 0), ("Cancel", 1) ])
return d | [
"def",
"do_checklist",
"(",
"text",
",",
"height",
",",
"width",
",",
"list_height",
",",
"*",
"items",
")",
":",
"def",
"constr",
"(",
"tag",
",",
"state",
")",
":",
"return",
"urwid",
".",
"CheckBox",
"(",
"tag",
",",
"state",
")",
"d",
"=",
"Che... | https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/examples/dialog.py#L247-L252 | |||
peterbrittain/asciimatics | 9a490faddf484ee5b9b845316f921f5888b23b18 | samples/maps.py | python | Map.process_event | (self, event) | User input for the main map view. | User input for the main map view. | [
"User",
"input",
"for",
"the",
"main",
"map",
"view",
"."
] | def process_event(self, event):
"""User input for the main map view."""
if isinstance(event, KeyboardEvent):
if event.key_code in [Screen.ctrl("m"), Screen.ctrl("j")]:
self._scene.add_effect(
EnterLocation(
self._screen, self._longi... | [
"def",
"process_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"isinstance",
"(",
"event",
",",
"KeyboardEvent",
")",
":",
"if",
"event",
".",
"key_code",
"in",
"[",
"Screen",
".",
"ctrl",
"(",
"\"m\"",
")",
",",
"Screen",
".",
"ctrl",
"(",
"\"j\... | https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/samples/maps.py#L490-L528 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/words/finite_word.py | python | FiniteWord_class.charge | (self, check=True) | return res | r"""
Return the charge of ``self``. This is defined as follows.
If `w` is a permutation of length `n`, (in other words, the evaluation
of `w` is `(1, 1, \dots, 1)`), the statistic charge(`w`) is given by
`\sum_{i=1}^n c_i(w)` where `c_1(w) = 0` and `c_i(w)` is defined
recursive... | r"""
Return the charge of ``self``. This is defined as follows. | [
"r",
"Return",
"the",
"charge",
"of",
"self",
".",
"This",
"is",
"defined",
"as",
"follows",
"."
] | def charge(self, check=True):
r"""
Return the charge of ``self``. This is defined as follows.
If `w` is a permutation of length `n`, (in other words, the evaluation
of `w` is `(1, 1, \dots, 1)`), the statistic charge(`w`) is given by
`\sum_{i=1}^n c_i(w)` where `c_1(w) = 0` and... | [
"def",
"charge",
"(",
"self",
",",
"check",
"=",
"True",
")",
":",
"if",
"check",
":",
"ev_dict",
"=",
"self",
".",
"evaluation_dict",
"(",
")",
"ordered_alphabet",
"=",
"sorted",
"(",
"ev_dict",
",",
"key",
"=",
"self",
".",
"parent",
"(",
")",
".",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/words/finite_word.py#L5370-L5476 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/yunjing/v20180228/yunjing_client.py | python | YunjingClient.DescribeBruteAttacks | (self, request) | 本接口{DescribeBruteAttacks}用于获取暴力破解事件列表。
:param request: Request instance for DescribeBruteAttacks.
:type request: :class:`tencentcloud.yunjing.v20180228.models.DescribeBruteAttacksRequest`
:rtype: :class:`tencentcloud.yunjing.v20180228.models.DescribeBruteAttacksResponse` | 本接口{DescribeBruteAttacks}用于获取暴力破解事件列表。 | [
"本接口",
"{",
"DescribeBruteAttacks",
"}",
"用于获取暴力破解事件列表。"
] | def DescribeBruteAttacks(self, request):
"""本接口{DescribeBruteAttacks}用于获取暴力破解事件列表。
:param request: Request instance for DescribeBruteAttacks.
:type request: :class:`tencentcloud.yunjing.v20180228.models.DescribeBruteAttacksRequest`
:rtype: :class:`tencentcloud.yunjing.v20180228.models.D... | [
"def",
"DescribeBruteAttacks",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeBruteAttacks\"",
",",
"params",
")",
"response",
"=",
"json",
".",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/yunjing/v20180228/yunjing_client.py#L897-L922 | ||
Zulko/moviepy | 8eaf3f02c5cf812e89f03e925cb2fa5e05b8d29a | moviepy/video/io/ffmpeg_tools.py | python | ffmpeg_extract_subclip | (
inputfile, start_time, end_time, outputfile=None, logger="bar"
) | Makes a new video file playing video file between two times.
Parameters
----------
inputfile : str
Path to the file from which the subclip will be extracted.
start_time : float
Moment of the input clip that marks the start of the produced subclip.
end_time : float
Moment of the... | Makes a new video file playing video file between two times. | [
"Makes",
"a",
"new",
"video",
"file",
"playing",
"video",
"file",
"between",
"two",
"times",
"."
] | def ffmpeg_extract_subclip(
inputfile, start_time, end_time, outputfile=None, logger="bar"
):
"""Makes a new video file playing video file between two times.
Parameters
----------
inputfile : str
Path to the file from which the subclip will be extracted.
start_time : float
Moment ... | [
"def",
"ffmpeg_extract_subclip",
"(",
"inputfile",
",",
"start_time",
",",
"end_time",
",",
"outputfile",
"=",
"None",
",",
"logger",
"=",
"\"bar\"",
")",
":",
"if",
"not",
"outputfile",
":",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"... | https://github.com/Zulko/moviepy/blob/8eaf3f02c5cf812e89f03e925cb2fa5e05b8d29a/moviepy/video/io/ffmpeg_tools.py#L12-L56 | ||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.setName | ( self, name ) | return self | Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char... | Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char... | [
"Define",
"name",
"for",
"this",
"expression",
"makes",
"debugging",
"and",
"exception",
"messages",
"clearer",
".",
"Example",
"::",
"Word",
"(",
"nums",
")",
".",
"parseString",
"(",
"ABC",
")",
"#",
"-",
">",
"Exception",
":",
"Expected",
"W",
":",
"(... | def setName( self, name ):
"""
Define name for this expression, makes debugging and exception messages clearer.
Example::
Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
Word(nums).setName("integer").parseString("A... | [
"def",
"setName",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"errmsg",
"=",
"\"Expected \"",
"+",
"self",
".",
"name",
"if",
"hasattr",
"(",
"self",
",",
"\"exception\"",
")",
":",
"self",
".",
"exception",
"."... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L1167-L1179 | |
openwpm/OpenWPM | 771b6db4169374a7f7b6eb5ce6e59ea763f26df4 | openwpm/commands/browser_commands.py | python | FinalizeCommand.execute | (
self,
webdriver,
browser_params,
manager_params,
extension_socket,
) | Informs the extension that a visit is done | Informs the extension that a visit is done | [
"Informs",
"the",
"extension",
"that",
"a",
"visit",
"is",
"done"
] | def execute(
self,
webdriver,
browser_params,
manager_params,
extension_socket,
):
"""Informs the extension that a visit is done"""
tab_restart_browser(webdriver)
# This doesn't immediately stop data saving from the current
# visit so we sleep... | [
"def",
"execute",
"(",
"self",
",",
"webdriver",
",",
"browser_params",
",",
"manager_params",
",",
"extension_socket",
",",
")",
":",
"tab_restart_browser",
"(",
"webdriver",
")",
"# This doesn't immediately stop data saving from the current",
"# visit so we sleep briefly be... | https://github.com/openwpm/OpenWPM/blob/771b6db4169374a7f7b6eb5ce6e59ea763f26df4/openwpm/commands/browser_commands.py#L484-L498 | ||
projectatomic/atomicapp | fba5cbb0a42b79418ac85ab93036a4404b92a431 | atomicapp/utils.py | python | Utils.inContainer | () | Determine if we are running inside a container or not. This is done by
checking to see if /host has been passed.
Returns:
(bool): True == we are in a container | Determine if we are running inside a container or not. This is done by
checking to see if /host has been passed. | [
"Determine",
"if",
"we",
"are",
"running",
"inside",
"a",
"container",
"or",
"not",
".",
"This",
"is",
"done",
"by",
"checking",
"to",
"see",
"if",
"/",
"host",
"has",
"been",
"passed",
"."
] | def inContainer():
"""
Determine if we are running inside a container or not. This is done by
checking to see if /host has been passed.
Returns:
(bool): True == we are in a container
"""
if os.path.isdir(HOST_DIR):
return True
else:
... | [
"def",
"inContainer",
"(",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"HOST_DIR",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | https://github.com/projectatomic/atomicapp/blob/fba5cbb0a42b79418ac85ab93036a4404b92a431/atomicapp/utils.py#L321-L332 | ||
allenai/allennlp | a3d71254fcc0f3615910e9c3d48874515edf53e0 | allennlp/training/callbacks/log_writer.py | python | LogWriterCallback.close | (self) | Called at the end of training to remove any module hooks and close out any
other logging resources. | Called at the end of training to remove any module hooks and close out any
other logging resources. | [
"Called",
"at",
"the",
"end",
"of",
"training",
"to",
"remove",
"any",
"module",
"hooks",
"and",
"close",
"out",
"any",
"other",
"logging",
"resources",
"."
] | def close(self) -> None:
"""
Called at the end of training to remove any module hooks and close out any
other logging resources.
"""
for handle in self._module_hook_handles:
handle.remove() | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"for",
"handle",
"in",
"self",
".",
"_module_hook_handles",
":",
"handle",
".",
"remove",
"(",
")"
] | https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/training/callbacks/log_writer.py#L123-L129 | ||
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py | python | Bracket.innertext | (self, pos) | Parse some text inside the bracket, following textual rules. | Parse some text inside the bracket, following textual rules. | [
"Parse",
"some",
"text",
"inside",
"the",
"bracket",
"following",
"textual",
"rules",
"."
] | def innertext(self, pos):
"Parse some text inside the bracket, following textual rules."
specialchars = list(FormulaConfig.symbolfunctions.keys())
specialchars.append(FormulaConfig.starts['command'])
specialchars.append(FormulaConfig.starts['bracket'])
specialchars.append(Comment.start)
while no... | [
"def",
"innertext",
"(",
"self",
",",
"pos",
")",
":",
"specialchars",
"=",
"list",
"(",
"FormulaConfig",
".",
"symbolfunctions",
".",
"keys",
"(",
")",
")",
"specialchars",
".",
"append",
"(",
"FormulaConfig",
".",
"starts",
"[",
"'command'",
"]",
")",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py#L2697-L2709 | ||
BMW-InnovationLab/BMW-TensorFlow-Training-GUI | 4f10d1f00f9ac312ca833e5b28fd0f8952cfee17 | training_api/research/slim/deployment/model_deploy.py | python | deploy | (config,
model_fn,
args=None,
kwargs=None,
optimizer=None,
summarize_gradients=False) | return DeployedModel(train_op, summary_op, total_loss, clones) | Deploys a Slim-constructed model across multiple clones.
The deployment options are specified by the config object and support
deploying one or several clones on different GPUs and one or several replicas
of such clones.
The argument `model_fn` is called `config.num_clones` times to create the
model clones ... | Deploys a Slim-constructed model across multiple clones. | [
"Deploys",
"a",
"Slim",
"-",
"constructed",
"model",
"across",
"multiple",
"clones",
"."
] | def deploy(config,
model_fn,
args=None,
kwargs=None,
optimizer=None,
summarize_gradients=False):
"""Deploys a Slim-constructed model across multiple clones.
The deployment options are specified by the config object and support
deploying one or several clones... | [
"def",
"deploy",
"(",
"config",
",",
"model_fn",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"optimizer",
"=",
"None",
",",
"summarize_gradients",
"=",
"False",
")",
":",
"# Gather initial summaries.",
"summaries",
"=",
"set",
"(",
"tf",
"."... | https://github.com/BMW-InnovationLab/BMW-TensorFlow-Training-GUI/blob/4f10d1f00f9ac312ca833e5b28fd0f8952cfee17/training_api/research/slim/deployment/model_deploy.py#L312-L413 | |
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/delf/delf/python/feature_extractor.py | python | PostProcessDescriptors | (descriptors, use_pca, pca_parameters=None) | return final_descriptors | Post-process descriptors.
Args:
descriptors: [N, input_dim] float tensor.
use_pca: Whether to use PCA.
pca_parameters: Only used if `use_pca` is True. Dict containing PCA
parameter tensors, with keys 'mean', 'matrix', 'dim', 'use_whitening',
'variances'.
Returns:
final_descriptors: [N,... | Post-process descriptors. | [
"Post",
"-",
"process",
"descriptors",
"."
] | def PostProcessDescriptors(descriptors, use_pca, pca_parameters=None):
"""Post-process descriptors.
Args:
descriptors: [N, input_dim] float tensor.
use_pca: Whether to use PCA.
pca_parameters: Only used if `use_pca` is True. Dict containing PCA
parameter tensors, with keys 'mean', 'matrix', 'dim'... | [
"def",
"PostProcessDescriptors",
"(",
"descriptors",
",",
"use_pca",
",",
"pca_parameters",
"=",
"None",
")",
":",
"# L2-normalize, and if desired apply PCA (followed by L2-normalization).",
"final_descriptors",
"=",
"tf",
".",
"nn",
".",
"l2_normalize",
"(",
"descriptors",... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/delf/delf/python/feature_extractor.py#L116-L147 | |
openstack/glance | 502fa0ffc8970c087c5924742231812c0da6a114 | glance/common/client.py | python | BaseClient._authenticate | (self, force_reauth=False) | Use the authentication plugin to authenticate and set the auth token.
:param force_reauth: For re-authentication to bypass cache. | Use the authentication plugin to authenticate and set the auth token. | [
"Use",
"the",
"authentication",
"plugin",
"to",
"authenticate",
"and",
"set",
"the",
"auth",
"token",
"."
] | def _authenticate(self, force_reauth=False):
"""
Use the authentication plugin to authenticate and set the auth token.
:param force_reauth: For re-authentication to bypass cache.
"""
auth_plugin = self.auth_plugin
if not auth_plugin.is_authenticated or force_reauth:
... | [
"def",
"_authenticate",
"(",
"self",
",",
"force_reauth",
"=",
"False",
")",
":",
"auth_plugin",
"=",
"self",
".",
"auth_plugin",
"if",
"not",
"auth_plugin",
".",
"is_authenticated",
"or",
"force_reauth",
":",
"auth_plugin",
".",
"authenticate",
"(",
")",
"sel... | https://github.com/openstack/glance/blob/502fa0ffc8970c087c5924742231812c0da6a114/glance/common/client.py#L335-L350 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/codecs.py | python | StreamReader.__getattr__ | (self, name,
getattr=getattr) | return getattr(self.stream, name) | Inherit all other methods from the underlying stream. | Inherit all other methods from the underlying stream. | [
"Inherit",
"all",
"other",
"methods",
"from",
"the",
"underlying",
"stream",
"."
] | def __getattr__(self, name,
getattr=getattr):
""" Inherit all other methods from the underlying stream.
"""
return getattr(self.stream, name) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
",",
"getattr",
"=",
"getattr",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"stream",
",",
"name",
")"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/codecs.py#L646-L651 | |
topazproject/topaz | bf4a56adbe03ae9ab4984729c733fcbc64a164c4 | topaz/objects/exceptionobject.py | python | W_ExceptionObject.copy_instance_vars | (self, space, w_other) | Copies special instance vars after #copy or #dup | Copies special instance vars after #copy or #dup | [
"Copies",
"special",
"instance",
"vars",
"after",
"#copy",
"or",
"#dup"
] | def copy_instance_vars(self, space, w_other):
"""Copies special instance vars after #copy or #dup"""
assert isinstance(w_other, W_ExceptionObject)
W_Object.copy_instance_vars(self, space, w_other)
self.msg = w_other.msg
self.frame = w_other.frame
self.w_backtrace = w_othe... | [
"def",
"copy_instance_vars",
"(",
"self",
",",
"space",
",",
"w_other",
")",
":",
"assert",
"isinstance",
"(",
"w_other",
",",
"W_ExceptionObject",
")",
"W_Object",
".",
"copy_instance_vars",
"(",
"self",
",",
"space",
",",
"w_other",
")",
"self",
".",
"msg"... | https://github.com/topazproject/topaz/blob/bf4a56adbe03ae9ab4984729c733fcbc64a164c4/topaz/objects/exceptionobject.py#L27-L33 | ||
stevearc/dql | 9666cfba19773c20c7b4be29adc7d6179cf00d44 | dql/models.py | python | GlobalIndexMeta.status | (self) | return self._index.status | Getter for status | Getter for status | [
"Getter",
"for",
"status"
] | def status(self):
"""Getter for status"""
return self._index.status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_index",
".",
"status"
] | https://github.com/stevearc/dql/blob/9666cfba19773c20c7b4be29adc7d6179cf00d44/dql/models.py#L246-L248 | |
snowflakedb/snowflake-connector-python | 1659ec6b78930d1f947b4eff985c891af614d86c | src/snowflake/connector/telemetry_oob.py | python | TelemetryService.context | (self) | return self._context | Returns the context of the current connection. | Returns the context of the current connection. | [
"Returns",
"the",
"context",
"of",
"the",
"current",
"connection",
"."
] | def context(self):
"""Returns the context of the current connection."""
return self._context | [
"def",
"context",
"(",
"self",
")",
":",
"return",
"self",
".",
"_context"
] | https://github.com/snowflakedb/snowflake-connector-python/blob/1659ec6b78930d1f947b4eff985c891af614d86c/src/snowflake/connector/telemetry_oob.py#L199-L201 | |
pyserial/pyserial | 31fa4807d73ed4eb9891a88a15817b439c4eea2d | examples/at_protocol.py | python | ATProtocol.stop | (self) | Stop the event processing thread, abort pending commands, if any. | Stop the event processing thread, abort pending commands, if any. | [
"Stop",
"the",
"event",
"processing",
"thread",
"abort",
"pending",
"commands",
"if",
"any",
"."
] | def stop(self):
"""
Stop the event processing thread, abort pending commands, if any.
"""
self.alive = False
self.events.put(None)
self.responses.put('<exit>') | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"alive",
"=",
"False",
"self",
".",
"events",
".",
"put",
"(",
"None",
")",
"self",
".",
"responses",
".",
"put",
"(",
"'<exit>'",
")"
] | https://github.com/pyserial/pyserial/blob/31fa4807d73ed4eb9891a88a15817b439c4eea2d/examples/at_protocol.py#L44-L50 | ||
CoinCheung/BiSeNet | f9231b7c971413e6ebdfcd961fbea53417b18851 | old/fp16/train.py | python | parse_args | () | return parse.parse_args() | [] | def parse_args():
parse = argparse.ArgumentParser()
parse.add_argument(
'--local_rank',
dest = 'local_rank',
type = int,
default = -1,
)
return parse.parse_args() | [
"def",
"parse_args",
"(",
")",
":",
"parse",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parse",
".",
"add_argument",
"(",
"'--local_rank'",
",",
"dest",
"=",
"'local_rank'",
",",
"type",
"=",
"int",
",",
"default",
"=",
"-",
"1",
",",
")",
"ret... | https://github.com/CoinCheung/BiSeNet/blob/f9231b7c971413e6ebdfcd961fbea53417b18851/old/fp16/train.py#L33-L41 | |||
filerock/FileRock-Client | 37214f701666e76e723595f8f9ed238a42f6eb06 | filerockclient/serversession/states/replication_and_transfer.py | python | ReplicationAndTransferState._is_time_to_commit | (self) | return (need and (timeout or op_count or size)) | Tell whether it's time to commit the current transaction.
The values considered to make a decision are:
* now: current time
* t.size: number of operations in transaction
* op: time of the last seen operation.
It is time to commit when:
t.size > 0 and (
eit... | Tell whether it's time to commit the current transaction. | [
"Tell",
"whether",
"it",
"s",
"time",
"to",
"commit",
"the",
"current",
"transaction",
"."
] | def _is_time_to_commit(self):
"""
Tell whether it's time to commit the current transaction.
The values considered to make a decision are:
* now: current time
* t.size: number of operations in transaction
* op: time of the last seen operation.
It is time to com... | [
"def",
"_is_time_to_commit",
"(",
"self",
")",
":",
"self",
".",
"_update_last_operation_time",
"(",
")",
"need",
"=",
"self",
".",
"_context",
".",
"transaction",
".",
"size",
"(",
")",
">",
"0",
"op_count",
"=",
"self",
".",
"_context",
".",
"transaction... | https://github.com/filerock/FileRock-Client/blob/37214f701666e76e723595f8f9ed238a42f6eb06/filerockclient/serversession/states/replication_and_transfer.py#L380-L401 | |
yistLin/pytorch-dual-learning | a2a6ff78cd8643ed86fe56e315848dca6b982e4f | nmt/nmt.py | python | NMT.translate | (self, src_sents, beam_size=None, to_word=True) | return [hyp for hyp, score in ranked_hypotheses] | perform beam search
TODO: batched beam search | perform beam search
TODO: batched beam search | [
"perform",
"beam",
"search",
"TODO",
":",
"batched",
"beam",
"search"
] | def translate(self, src_sents, beam_size=None, to_word=True):
"""
perform beam search
TODO: batched beam search
"""
if not type(src_sents[0]) == list:
src_sents = [src_sents]
if not beam_size:
beam_size = args.beam_size
src_sents_var = to_... | [
"def",
"translate",
"(",
"self",
",",
"src_sents",
",",
"beam_size",
"=",
"None",
",",
"to_word",
"=",
"True",
")",
":",
"if",
"not",
"type",
"(",
"src_sents",
"[",
"0",
"]",
")",
"==",
"list",
":",
"src_sents",
"=",
"[",
"src_sents",
"]",
"if",
"n... | https://github.com/yistLin/pytorch-dual-learning/blob/a2a6ff78cd8643ed86fe56e315848dca6b982e4f/nmt/nmt.py#L218-L325 | |
maurosoria/dirsearch | b83e68c8fdf360ab06be670d7b92b263262ee5b1 | thirdparty/pyparsing/helpers.py | python | locatedExpr | (expr) | return Group(
locator("locn_start")
+ expr("value")
+ locator.copy().leaveWhitespace()("locn_end")
) | (DEPRECATED - future code should use the Located class)
Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- ``locn_start`` - location where matched expression begins
- ``locn_end`` - location where matche... | (DEPRECATED - future code should use the Located class)
Helper to decorate a returned token with its starting and ending
locations in the input string. | [
"(",
"DEPRECATED",
"-",
"future",
"code",
"should",
"use",
"the",
"Located",
"class",
")",
"Helper",
"to",
"decorate",
"a",
"returned",
"token",
"with",
"its",
"starting",
"and",
"ending",
"locations",
"in",
"the",
"input",
"string",
"."
] | def locatedExpr(expr):
"""
(DEPRECATED - future code should use the Located class)
Helper to decorate a returned token with its starting and ending
locations in the input string.
This helper adds the following results names:
- ``locn_start`` - location where matched expression begins
- `... | [
"def",
"locatedExpr",
"(",
"expr",
")",
":",
"locator",
"=",
"Empty",
"(",
")",
".",
"setParseAction",
"(",
"lambda",
"s",
",",
"l",
",",
"t",
":",
"l",
")",
"return",
"Group",
"(",
"locator",
"(",
"\"locn_start\"",
")",
"+",
"expr",
"(",
"\"value\""... | https://github.com/maurosoria/dirsearch/blob/b83e68c8fdf360ab06be670d7b92b263262ee5b1/thirdparty/pyparsing/helpers.py#L339-L371 | |
santatic/web2attack | 44b6e481a3d56cf0d98073ae0fb69833dda563d9 | w2a/lib/mysql/connector/conversion.py | python | ConverterBase.set_unicode | (self, value=True) | [] | def set_unicode(self, value=True):
self.use_unicode = value | [
"def",
"set_unicode",
"(",
"self",
",",
"value",
"=",
"True",
")",
":",
"self",
".",
"use_unicode",
"=",
"value"
] | https://github.com/santatic/web2attack/blob/44b6e481a3d56cf0d98073ae0fb69833dda563d9/w2a/lib/mysql/connector/conversion.py#L50-L51 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/distutils/misc_util.py | python | get_frame | (level=0) | Return frame object from call stack with given level. | Return frame object from call stack with given level. | [
"Return",
"frame",
"object",
"from",
"call",
"stack",
"with",
"given",
"level",
"."
] | def get_frame(level=0):
"""Return frame object from call stack with given level.
"""
try:
return sys._getframe(level+1)
except AttributeError:
frame = sys.exc_info()[2].tb_frame
for _ in range(level+1):
frame = frame.f_back
return frame | [
"def",
"get_frame",
"(",
"level",
"=",
"0",
")",
":",
"try",
":",
"return",
"sys",
".",
"_getframe",
"(",
"level",
"+",
"1",
")",
"except",
"AttributeError",
":",
"frame",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",
".",
"tb_frame",
"for"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/distutils/misc_util.py#L645-L654 | ||
duo-labs/isthislegit | 5d51fd2e0fe070cacd1ee169ca8a371a72e005ef | dashboard/services/memcache.py | python | delete | (key=None) | [] | def delete(key=None):
parts_count = memcache.get(key='%s_parts' % key)
if parts_count:
for i in xrange(parts_count):
memcache.delete(key='%s%d' % (key, i))
memcache.delete(key=key)
memcache.delete(key='%s_parts' % key) | [
"def",
"delete",
"(",
"key",
"=",
"None",
")",
":",
"parts_count",
"=",
"memcache",
".",
"get",
"(",
"key",
"=",
"'%s_parts'",
"%",
"key",
")",
"if",
"parts_count",
":",
"for",
"i",
"in",
"xrange",
"(",
"parts_count",
")",
":",
"memcache",
".",
"dele... | https://github.com/duo-labs/isthislegit/blob/5d51fd2e0fe070cacd1ee169ca8a371a72e005ef/dashboard/services/memcache.py#L33-L40 | ||||
jyhjinghwang/SegSort | 4e3278b2a7732d62f3784eb629a323acc0ca68f3 | pyscripts/inference/prototype_unsup.py | python | get_arguments | () | return parser.parse_args() | Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments. | Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments. | [
"Parse",
"all",
"the",
"arguments",
"provided",
"from",
"the",
"CLI",
".",
"Returns",
":",
"A",
"list",
"of",
"parsed",
"arguments",
"."
] | def get_arguments():
"""Parse all the arguments provided from the CLI.
Returns:
A list of parsed arguments.
"""
parser = argparse.ArgumentParser(
description='Extracting Prototypes for Semantic Segmentation')
parser.add_argument('--data-dir', type=str, default='',
help='/p... | [
"def",
"get_arguments",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Extracting Prototypes for Semantic Segmentation'",
")",
"parser",
".",
"add_argument",
"(",
"'--data-dir'",
",",
"type",
"=",
"str",
",",
"default",
... | https://github.com/jyhjinghwang/SegSort/blob/4e3278b2a7732d62f3784eb629a323acc0ca68f3/pyscripts/inference/prototype_unsup.py#L23-L58 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/polys/subresultants_qq_zz.py | python | find_degree | (M, deg_f) | Finds the degree of the poly corresponding (after triangularization)
to the _last_ row of the ``small'' matrix M, created by create_ma().
deg_f is the degree of the divident poly.
If _last_ row is all 0's returns None. | Finds the degree of the poly corresponding (after triangularization)
to the _last_ row of the ``small'' matrix M, created by create_ma(). | [
"Finds",
"the",
"degree",
"of",
"the",
"poly",
"corresponding",
"(",
"after",
"triangularization",
")",
"to",
"the",
"_last_",
"row",
"of",
"the",
"small",
"matrix",
"M",
"created",
"by",
"create_ma",
"()",
"."
] | def find_degree(M, deg_f):
'''
Finds the degree of the poly corresponding (after triangularization)
to the _last_ row of the ``small'' matrix M, created by create_ma().
deg_f is the degree of the divident poly.
If _last_ row is all 0's returns None.
'''
j = deg_f
for i in range(0, M.co... | [
"def",
"find_degree",
"(",
"M",
",",
"deg_f",
")",
":",
"j",
"=",
"deg_f",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"M",
".",
"cols",
")",
":",
"if",
"M",
"[",
"M",
".",
"rows",
"-",
"1",
",",
"i",
"]",
"==",
"0",
":",
"j",
"=",
"j",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/polys/subresultants_qq_zz.py#L2255-L2269 | ||
microsoft/icecaps | caba26258e2054f239f39545fae97c9e67da789f | icecaps/decoding/basic_decoder_custom.py | python | BasicDecoder.step | (self, time, inputs, state, name=None) | return (outputs, next_state, next_inputs, finished) | Perform a decoding step.
Args:
time: scalar `int32` tensor.
inputs: A (structure of) input tensors.
state: A (structure of) state tensors and TensorArrays.
name: Name scope for any created operations.
Returns:
`(outputs, next_state, next_inputs, finish... | Perform a decoding step. | [
"Perform",
"a",
"decoding",
"step",
"."
] | def step(self, time, inputs, state, name=None):
"""Perform a decoding step.
Args:
time: scalar `int32` tensor.
inputs: A (structure of) input tensors.
state: A (structure of) state tensors and TensorArrays.
name: Name scope for any created operations.
Re... | [
"def",
"step",
"(",
"self",
",",
"time",
",",
"inputs",
",",
"state",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"BasicCustomDecoderStep\"",
",",
"(",
"time",
",",
"inputs",
",",
"state",
")",
")",
":",
... | https://github.com/microsoft/icecaps/blob/caba26258e2054f239f39545fae97c9e67da789f/icecaps/decoding/basic_decoder_custom.py#L41-L69 | |
stephenhky/PyShortTextCategorization | 4fa46a148a3eeb923885a7d70c789e988554f758 | shorttext/utils/dtm.py | python | DocumentTermMatrix.get_doc_frequency | (self, token) | return len(self.dtm[:, self.dictionary.token2id[token]].values()) | Retrieve the document frequency of the given token.
Compute the document frequency of the given token, i.e., the number of documents
that this token can be found.
:param token: term or token
:return: document frequency of the given token
:type token: str
:rtype: int | Retrieve the document frequency of the given token. | [
"Retrieve",
"the",
"document",
"frequency",
"of",
"the",
"given",
"token",
"."
] | def get_doc_frequency(self, token):
""" Retrieve the document frequency of the given token.
Compute the document frequency of the given token, i.e., the number of documents
that this token can be found.
:param token: term or token
:return: document frequency of the given token
... | [
"def",
"get_doc_frequency",
"(",
"self",
",",
"token",
")",
":",
"return",
"len",
"(",
"self",
".",
"dtm",
"[",
":",
",",
"self",
".",
"dictionary",
".",
"token2id",
"[",
"token",
"]",
"]",
".",
"values",
"(",
")",
")"
] | https://github.com/stephenhky/PyShortTextCategorization/blob/4fa46a148a3eeb923885a7d70c789e988554f758/shorttext/utils/dtm.py#L107-L118 | |
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | applications/tensorflow/bert/ipu_optimizer.py | python | LAMBOptimizer.__init__ | (self,
learning_rate,
loss_scaling=1.0,
weight_decay_rate=0.0,
beta_1=0.9,
beta_2=0.999,
epsilon=1e-4,
exclude_from_weight_decay=None,
exclude_from_layer_adaptation=None,
... | Constructs a LAMBOptimizer. | Constructs a LAMBOptimizer. | [
"Constructs",
"a",
"LAMBOptimizer",
"."
] | def __init__(self,
learning_rate,
loss_scaling=1.0,
weight_decay_rate=0.0,
beta_1=0.9,
beta_2=0.999,
epsilon=1e-4,
exclude_from_weight_decay=None,
exclude_from_layer_adaptation=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
",",
"loss_scaling",
"=",
"1.0",
",",
"weight_decay_rate",
"=",
"0.0",
",",
"beta_1",
"=",
"0.9",
",",
"beta_2",
"=",
"0.999",
",",
"epsilon",
"=",
"1e-4",
",",
"exclude_from_weight_decay",
"=",
"None",
... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/tensorflow/bert/ipu_optimizer.py#L310-L377 | ||
indico/indico | 1579ea16235bbe5f22a308b79c5902c85374721f | indico/web/assets/blueprint.py | python | js_vars_global | () | return send_file('global.js', cache_file, mimetype='application/javascript', conditional=True) | Provide a JS file with global definitions (all users).
Useful for server-wide config options, URLs, etc... | Provide a JS file with global definitions (all users). | [
"Provide",
"a",
"JS",
"file",
"with",
"global",
"definitions",
"(",
"all",
"users",
")",
"."
] | def js_vars_global():
"""Provide a JS file with global definitions (all users).
Useful for server-wide config options, URLs, etc...
"""
cache_file = os.path.join(config.CACHE_DIR, f'assets_global_{indico.__version__}_{config.hash}.js')
if config.DEBUG or not os.path.exists(cache_file):
dat... | [
"def",
"js_vars_global",
"(",
")",
":",
"cache_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config",
".",
"CACHE_DIR",
",",
"f'assets_global_{indico.__version__}_{config.hash}.js'",
")",
"if",
"config",
".",
"DEBUG",
"or",
"not",
"os",
".",
"path",
".",
... | https://github.com/indico/indico/blob/1579ea16235bbe5f22a308b79c5902c85374721f/indico/web/assets/blueprint.py#L54-L66 | |
firedrakeproject/firedrake | 06ab4975c14c0d4dcb79be55821f8b9e41554125 | pylit/pylit.py | python | TextCodeConverter.__init__ | (self, data, **keyw) | data -- iterable data object
(list, file, generator, string, ...)
**keyw -- remaining keyword arguments are
stored as data-attributes | data -- iterable data object
(list, file, generator, string, ...)
**keyw -- remaining keyword arguments are
stored as data-attributes | [
"data",
"--",
"iterable",
"data",
"object",
"(",
"list",
"file",
"generator",
"string",
"...",
")",
"**",
"keyw",
"--",
"remaining",
"keyword",
"arguments",
"are",
"stored",
"as",
"data",
"-",
"attributes"
] | def __init__(self, data, **keyw):
"""data -- iterable data object
(list, file, generator, string, ...)
**keyw -- remaining keyword arguments are
stored as data-attributes
"""
self.data = data
self.__dict__.update(keyw)
# If empt... | [
"def",
"__init__",
"(",
"self",
",",
"data",
",",
"*",
"*",
"keyw",
")",
":",
"self",
".",
"data",
"=",
"data",
"self",
".",
"__dict__",
".",
"update",
"(",
"keyw",
")",
"# If empty, `code_block_marker` and `comment_string` are set according",
"# to the `language`... | https://github.com/firedrakeproject/firedrake/blob/06ab4975c14c0d4dcb79be55821f8b9e41554125/pylit/pylit.py#L440-L476 | ||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/webpage/webpage/libs/email/parser.py | python | Parser.parsestr | (self, text, headersonly=False) | return self.parse(StringIO(text), headersonly=headersonly) | Create a message structure from a string.
Returns the root of the message structure. Optional headersonly is a
flag specifying whether to stop parsing after reading the headers or
not. The default is False, meaning it parses the entire contents of
the file. | Create a message structure from a string. | [
"Create",
"a",
"message",
"structure",
"from",
"a",
"string",
"."
] | def parsestr(self, text, headersonly=False):
"""Create a message structure from a string.
Returns the root of the message structure. Optional headersonly is a
flag specifying whether to stop parsing after reading the headers or
not. The default is False, meaning it parses the entire c... | [
"def",
"parsestr",
"(",
"self",
",",
"text",
",",
"headersonly",
"=",
"False",
")",
":",
"return",
"self",
".",
"parse",
"(",
"StringIO",
"(",
"text",
")",
",",
"headersonly",
"=",
"headersonly",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/email/parser.py#L60-L68 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/type_backend.py | python | TypeBackend._do_xor | (self, *args) | return out | [] | def _do_xor(self, *args):
if len(args) != 2:
return reduce(self._do_xor, args)
a, b = args
good_a = type(a.ty) is Ptr
good_b = type(b.ty) is Ptr
val = a.value ^ b.value
out = TypedValue(Top(), val)
if good_a:
if not good_b:
... | [
"def",
"_do_xor",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"2",
":",
"return",
"reduce",
"(",
"self",
".",
"_do_xor",
",",
"args",
")",
"a",
",",
"b",
"=",
"args",
"good_a",
"=",
"type",
"(",
"a",
".",
"ty... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/type_backend.py#L93-L112 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/idlelib/configHelpSourceEdit.py | python | GetHelpSourceDialog.Ok | (self, event=None) | [] | def Ok(self, event=None):
if self.MenuOk() and self.PathOk():
self.result = (self.menu.get().strip(),
self.path.get().strip())
if sys.platform == 'darwin':
path = self.result[1]
if path.startswith(('www', 'file:', 'http:')):
... | [
"def",
"Ok",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"self",
".",
"MenuOk",
"(",
")",
"and",
"self",
".",
"PathOk",
"(",
")",
":",
"self",
".",
"result",
"=",
"(",
"self",
".",
"menu",
".",
"get",
"(",
")",
".",
"strip",
"(",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/configHelpSourceEdit.py#L146-L158 | ||||
determined-ai/determined | f637264493acc14f12e66550cb51c520b5d27f6c | examples/nas/gaea_pytorch/eval/randaugment/augmentation_transforms.py | python | _posterize_impl | (pil_img, level, _) | return ImageOps.posterize(pil_img, 4 - level) | Applies PIL Posterize to `pil_img`. | Applies PIL Posterize to `pil_img`. | [
"Applies",
"PIL",
"Posterize",
"to",
"pil_img",
"."
] | def _posterize_impl(pil_img, level, _):
"""Applies PIL Posterize to `pil_img`."""
level = int_parameter(level, 4)
return ImageOps.posterize(pil_img, 4 - level) | [
"def",
"_posterize_impl",
"(",
"pil_img",
",",
"level",
",",
"_",
")",
":",
"level",
"=",
"int_parameter",
"(",
"level",
",",
"4",
")",
"return",
"ImageOps",
".",
"posterize",
"(",
"pil_img",
",",
"4",
"-",
"level",
")"
] | https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/examples/nas/gaea_pytorch/eval/randaugment/augmentation_transforms.py#L193-L196 | |
modin-project/modin | 0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee | modin/core/dataframe/pandas/partitioning/partition_manager.py | python | PandasDataframePartitionManager.broadcast_apply_select_indices | (
cls,
axis,
apply_func,
left,
right,
left_indices,
right_indices,
keep_remaining=False,
) | return new_partitions | Broadcast the `right` partitions to `left` and apply `apply_func` to selected indices.
Parameters
----------
axis : {0, 1}
Axis to apply and broadcast over.
apply_func : callable
Function to apply.
left : NumPy 2D array
Left partitions.
... | Broadcast the `right` partitions to `left` and apply `apply_func` to selected indices. | [
"Broadcast",
"the",
"right",
"partitions",
"to",
"left",
"and",
"apply",
"apply_func",
"to",
"selected",
"indices",
"."
] | def broadcast_apply_select_indices(
cls,
axis,
apply_func,
left,
right,
left_indices,
right_indices,
keep_remaining=False,
):
"""
Broadcast the `right` partitions to `left` and apply `apply_func` to selected indices.
Parameters... | [
"def",
"broadcast_apply_select_indices",
"(",
"cls",
",",
"axis",
",",
"apply_func",
",",
"left",
",",
"right",
",",
"left_indices",
",",
"right_indices",
",",
"keep_remaining",
"=",
"False",
",",
")",
":",
"if",
"not",
"axis",
":",
"partitions_for_apply",
"="... | https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/core/dataframe/pandas/partitioning/partition_manager.py#L234-L310 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/configuration.py | python | _normalize_name | (name) | return name | Make a name consistent regardless of source (environment or file) | Make a name consistent regardless of source (environment or file) | [
"Make",
"a",
"name",
"consistent",
"regardless",
"of",
"source",
"(",
"environment",
"or",
"file",
")"
] | def _normalize_name(name):
# type: (str) -> str
"""Make a name consistent regardless of source (environment or file)
"""
name = name.lower().replace('_', '-')
if name.startswith('--'):
name = name[2:] # only prefer long opts
return name | [
"def",
"_normalize_name",
"(",
"name",
")",
":",
"# type: (str) -> str",
"name",
"=",
"name",
".",
"lower",
"(",
")",
".",
"replace",
"(",
"'_'",
",",
"'-'",
")",
"if",
"name",
".",
"startswith",
"(",
"'--'",
")",
":",
"name",
"=",
"name",
"[",
"2",
... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/configuration.py#L43-L50 | |
Amulet-Team/Amulet-Core | a57aeaa4216806401ff35a2dba38782a35abc42e | amulet/api/history/history_manager/meta.py | python | MetaHistoryManager.create_undo_point_iter | (
self, world=True, non_world=True
) | return self._register_snapshot(tuple(snapshot)) | Create an undo point.
:param world: Should the world based history managers be included
:param non_world: Should the non-world based history managers be included
:return: | Create an undo point. | [
"Create",
"an",
"undo",
"point",
"."
] | def create_undo_point_iter(
self, world=True, non_world=True
) -> Generator[float, None, bool]:
"""Create an undo point.
:param world: Should the world based history managers be included
:param non_world: Should the non-world based history managers be included
:return:
... | [
"def",
"create_undo_point_iter",
"(",
"self",
",",
"world",
"=",
"True",
",",
"non_world",
"=",
"True",
")",
"->",
"Generator",
"[",
"float",
",",
"None",
",",
"bool",
"]",
":",
"managers",
"=",
"self",
".",
"_managers",
"(",
"world",
",",
"non_world",
... | https://github.com/Amulet-Team/Amulet-Core/blob/a57aeaa4216806401ff35a2dba38782a35abc42e/amulet/api/history/history_manager/meta.py#L69-L84 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/sysconfig.py | python | get_platform | () | return "%s-%s-%s" % (osname, release, machine) | Return a string that identifies the current platform.
This is used mainly to distinguish platform-specific build directories and
platform-specific built distributions. Typically includes the OS name
and version and the architecture (as supplied by 'os.uname()'),
although the exact information included... | Return a string that identifies the current platform. | [
"Return",
"a",
"string",
"that",
"identifies",
"the",
"current",
"platform",
"."
] | def get_platform():
"""Return a string that identifies the current platform.
This is used mainly to distinguish platform-specific build directories and
platform-specific built distributions. Typically includes the OS name
and version and the architecture (as supplied by 'os.uname()'),
although the... | [
"def",
"get_platform",
"(",
")",
":",
"import",
"re",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# sniff sys.version for architecture.",
"prefix",
"=",
"\" bit (\"",
"i",
"=",
"sys",
".",
"version",
".",
"find",
"(",
"prefix",
")",
"if",
"i",
"==",
"-"... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/sysconfig.py#L524-L685 | |
cms-dev/cms | 0401c5336b34b1731736045da4877fef11889274 | cmscontrib/ImportTask.py | python | TaskImporter._task_to_db | (self, session, contest, new_task, task_has_changed) | return task | Add the task to the DB
Return the task, or raise in case of one of these errors:
- if the task is not in the DB and user did not ask to update it;
- if the task is already in the DB and attached to another contest. | Add the task to the DB | [
"Add",
"the",
"task",
"to",
"the",
"DB"
] | def _task_to_db(self, session, contest, new_task, task_has_changed):
"""Add the task to the DB
Return the task, or raise in case of one of these errors:
- if the task is not in the DB and user did not ask to update it;
- if the task is already in the DB and attached to another contest.
... | [
"def",
"_task_to_db",
"(",
"self",
",",
"session",
",",
"contest",
",",
"new_task",
",",
"task_has_changed",
")",
":",
"task",
"=",
"session",
".",
"query",
"(",
"Task",
")",
".",
"filter",
"(",
"Task",
".",
"name",
"==",
"new_task",
".",
"name",
")",
... | https://github.com/cms-dev/cms/blob/0401c5336b34b1731736045da4877fef11889274/cmscontrib/ImportTask.py#L121-L155 | |
nipy/nibabel | 4703f4d8e32be4cec30e829c2d93ebe54759bb62 | nibabel/dataobj_images.py | python | DataobjImage.from_file_map | (klass, file_map, *, mmap=True, keep_file_open=None) | Class method to create image from mapping in ``file_map``
Parameters
----------
file_map : dict
Mapping with (kay, value) pairs of (``file_type``, FileHolder
instance giving file-likes for each file needed for this image
type.
mmap : {True, False, 'c'... | Class method to create image from mapping in ``file_map`` | [
"Class",
"method",
"to",
"create",
"image",
"from",
"mapping",
"in",
"file_map"
] | def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
""" Class method to create image from mapping in ``file_map``
Parameters
----------
file_map : dict
Mapping with (kay, value) pairs of (``file_type``, FileHolder
instance giving file-likes for... | [
"def",
"from_file_map",
"(",
"klass",
",",
"file_map",
",",
"*",
",",
"mmap",
"=",
"True",
",",
"keep_file_open",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/dataobj_images.py#L408-L438 | ||
internetarchive/openlibrary | 33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8 | openlibrary/catalog/add_book/__init__.py | python | normalize_record_isbns | (rec) | return rec | Returns the Edition import record with all ISBN fields cleaned.
:param dict rec: Edition import record
:rtype: dict
:return: A record with cleaned ISBNs in the various possible ISBN locations. | Returns the Edition import record with all ISBN fields cleaned. | [
"Returns",
"the",
"Edition",
"import",
"record",
"with",
"all",
"ISBN",
"fields",
"cleaned",
"."
] | def normalize_record_isbns(rec):
"""
Returns the Edition import record with all ISBN fields cleaned.
:param dict rec: Edition import record
:rtype: dict
:return: A record with cleaned ISBNs in the various possible ISBN locations.
"""
for field in ('isbn_13', 'isbn_10', 'isbn'):
if r... | [
"def",
"normalize_record_isbns",
"(",
"rec",
")",
":",
"for",
"field",
"in",
"(",
"'isbn_13'",
",",
"'isbn_10'",
",",
"'isbn'",
")",
":",
"if",
"rec",
".",
"get",
"(",
"field",
")",
":",
"rec",
"[",
"field",
"]",
"=",
"[",
"normalize_isbn",
"(",
"isb... | https://github.com/internetarchive/openlibrary/blob/33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8/openlibrary/catalog/add_book/__init__.py#L376-L389 | |
santatic/web2attack | 44b6e481a3d56cf0d98073ae0fb69833dda563d9 | w2a/lib/net/socks.py | python | socksocket.__negotiatesocks4 | (self,destaddr,destport) | __negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server. | __negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server. | [
"__negotiatesocks4",
"(",
"self",
"destaddr",
"destport",
")",
"Negotiates",
"a",
"connection",
"through",
"a",
"SOCKS4",
"server",
"."
] | def __negotiatesocks4(self,destaddr,destport):
"""__negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server.
"""
# Check if the destination address provided is an IP address
rmtrslv = False
try:
ipaddr = socket.inet_aton(destadd... | [
"def",
"__negotiatesocks4",
"(",
"self",
",",
"destaddr",
",",
"destport",
")",
":",
"# Check if the destination address provided is an IP address",
"rmtrslv",
"=",
"False",
"try",
":",
"ipaddr",
"=",
"socket",
".",
"inet_aton",
"(",
"destaddr",
")",
"except",
"sock... | https://github.com/santatic/web2attack/blob/44b6e481a3d56cf0d98073ae0fb69833dda563d9/w2a/lib/net/socks.py#L269-L315 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/core/cache/backends/filebased.py | python | FileBasedCache._delete | (self, fname) | [] | def _delete(self, fname):
os.remove(fname)
try:
# Remove the 2 subdirs if they're empty
dirname = os.path.dirname(fname)
os.rmdir(dirname)
os.rmdir(os.path.dirname(dirname))
except (IOError, OSError):
pass | [
"def",
"_delete",
"(",
"self",
",",
"fname",
")",
":",
"os",
".",
"remove",
"(",
"fname",
")",
"try",
":",
"# Remove the 2 subdirs if they're empty",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fname",
")",
"os",
".",
"rmdir",
"(",
"dirname"... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/core/cache/backends/filebased.py#L77-L85 | ||||
LexPredict/lexpredict-contraxsuite | 1d5a2540d31f8f3f1adc442cfa13a7c007319899 | sdk/python/sdk/openapi_client/model/geo_alias_usage.py | python | GeoAliasUsage.additional_properties_type | () | return (bool, date, datetime, dict, float, int, list, str, none_type,) | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | [
"This",
"must",
"be",
"a",
"method",
"because",
"a",
"model",
"may",
"have",
"properties",
"that",
"are",
"of",
"type",
"self",
"this",
"must",
"run",
"after",
"the",
"class",
"is",
"loaded"
] | def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
return (bool, date, datetime, dict, float, int, list, str, none_type,) | [
"def",
"additional_properties_type",
"(",
")",
":",
"return",
"(",
"bool",
",",
"date",
",",
"datetime",
",",
"dict",
",",
"float",
",",
"int",
",",
"list",
",",
"str",
",",
"none_type",
",",
")"
] | https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/geo_alias_usage.py#L68-L73 | |
pystruct/pystruct | 957193a40f3933ae5709336d46289c8ad4a60b7a | pystruct/utils/logging.py | python | SaveLogger.__call__ | (self, learner, iteration=0) | Save learner if iterations is a multiple of save_every or "final".
Parameters
----------
learner : object
Learning object to be saved.
iteration : int or 'final' (default=0)
If 'final' or save_every % iteration == 0,
the model will be saved. | Save learner if iterations is a multiple of save_every or "final". | [
"Save",
"learner",
"if",
"iterations",
"is",
"a",
"multiple",
"of",
"save_every",
"or",
"final",
"."
] | def __call__(self, learner, iteration=0):
"""Save learner if iterations is a multiple of save_every or "final".
Parameters
----------
learner : object
Learning object to be saved.
iteration : int or 'final' (default=0)
If 'final' or save_every % iteratio... | [
"def",
"__call__",
"(",
"self",
",",
"learner",
",",
"iteration",
"=",
"0",
")",
":",
"if",
"iteration",
"==",
"'final'",
"or",
"not",
"iteration",
"%",
"self",
".",
"save_every",
":",
"file_name",
"=",
"self",
".",
"file_name",
"if",
"\"%d\"",
"in",
"... | https://github.com/pystruct/pystruct/blob/957193a40f3933ae5709336d46289c8ad4a60b7a/pystruct/utils/logging.py#L35-L53 | ||
maihde/quant | 593d23760833233874032b557c2e4ea1b5333092 | yahoo.py | python | plot | (symbol, start, end) | Prints the daily price for the stock on a given day. | Prints the daily price for the stock on a given day. | [
"Prints",
"the",
"daily",
"price",
"for",
"the",
"stock",
"on",
"a",
"given",
"day",
"."
] | def plot(symbol, start, end):
"""
Prints the daily price for the stock on a given day.
"""
quotes = fetch(symbol, start, end)
x_data = [QuoteDate(q.date).toDateTime() for q in quotes]
y_data = [q.adjclose for q in quotes]
fig = plt.figure()
fig.canvas.set_window_title("%s %s-%s" % (sym... | [
"def",
"plot",
"(",
"symbol",
",",
"start",
",",
"end",
")",
":",
"quotes",
"=",
"fetch",
"(",
"symbol",
",",
"start",
",",
"end",
")",
"x_data",
"=",
"[",
"QuoteDate",
"(",
"q",
".",
"date",
")",
".",
"toDateTime",
"(",
")",
"for",
"q",
"in",
... | https://github.com/maihde/quant/blob/593d23760833233874032b557c2e4ea1b5333092/yahoo.py#L98-L115 | ||
Yelp/mrjob | 091572e87bc24cc64be40278dd0f5c3617c98d4b | mrjob/runner.py | python | MRJobRunner._write_script | (self, lines, path, description) | Write text of a setup script, input manifest, etc. to the given
file.
By default, this writes binary data. Redefine :py:meth:`write_lines`
to use other line endings.
:param lines: a list of lines as ``str``
:param path: path of file to write to
:param description: what ... | Write text of a setup script, input manifest, etc. to the given
file. | [
"Write",
"text",
"of",
"a",
"setup",
"script",
"input",
"manifest",
"etc",
".",
"to",
"the",
"given",
"file",
"."
] | def _write_script(self, lines, path, description):
"""Write text of a setup script, input manifest, etc. to the given
file.
By default, this writes binary data. Redefine :py:meth:`write_lines`
to use other line endings.
:param lines: a list of lines as ``str``
:param pa... | [
"def",
"_write_script",
"(",
"self",
",",
"lines",
",",
"path",
",",
"description",
")",
":",
"log",
".",
"debug",
"(",
"'Writing %s to %s:'",
"%",
"(",
"description",
",",
"path",
")",
")",
"for",
"line",
"in",
"lines",
":",
"log",
".",
"debug",
"(",
... | https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/runner.py#L1472-L1487 | ||
cokelaer/bioservices | b491e8d71e285f9006e0af0a56f0cc5128cb86fa | src/bioservices/seqret.py | python | Seqret.get_parameter_details | (self, parameterId) | return res | Get details of a specific parameter.
:param str parameter: identifier/name of the parameter to fetch details of.
:return: a data structure describing the parameter and its values.
::
rs = ReadSeq()
print(rs.get_parameter_details("stype")) | Get details of a specific parameter. | [
"Get",
"details",
"of",
"a",
"specific",
"parameter",
"."
] | def get_parameter_details(self, parameterId):
"""Get details of a specific parameter.
:param str parameter: identifier/name of the parameter to fetch details of.
:return: a data structure describing the parameter and its values.
::
rs = ReadSeq()
print(rs.get_p... | [
"def",
"get_parameter_details",
"(",
"self",
",",
"parameterId",
")",
":",
"if",
"parameterId",
"not",
"in",
"self",
".",
"parameters",
":",
"raise",
"ValueError",
"(",
"\"Invalid parameterId provided(%s). See parameters attribute\"",
"%",
"parameterId",
")",
"request",... | https://github.com/cokelaer/bioservices/blob/b491e8d71e285f9006e0af0a56f0cc5128cb86fa/src/bioservices/seqret.py#L87-L107 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/airvisual/config_flow.py | python | AirVisualFlowHandler._async_set_unique_id | (self, unique_id: str) | Set the unique ID of the config flow and abort if it already exists. | Set the unique ID of the config flow and abort if it already exists. | [
"Set",
"the",
"unique",
"ID",
"of",
"the",
"config",
"flow",
"and",
"abort",
"if",
"it",
"already",
"exists",
"."
] | async def _async_set_unique_id(self, unique_id: str) -> None:
"""Set the unique ID of the config flow and abort if it already exists."""
await self.async_set_unique_id(unique_id)
self._abort_if_unique_id_configured() | [
"async",
"def",
"_async_set_unique_id",
"(",
"self",
",",
"unique_id",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"unique_id",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/airvisual/config_flow.py#L157-L160 | ||
greyli/flask-origin | 5621ba0562cafd0d6020f67f1172e02600186412 | flask.py | python | Flask.run | (self, host='localhost', port=5000, **options) | return run_simple(host, port, self, **options) | 在本地开发服务器上运行程序。如果debug标志被设置,这个服务器
会在代码更改时自动重载,并会在异常发生时显示一个调试器。
:param host: 监听的主机名。设为'0.0.0.0'可以让服务器外部可见。
:param port: 服务器的端口。
:param options: 这些选项将被转发给底层的Werkzeug服务器。更多信息
参见werkzeug.run_simple。 | 在本地开发服务器上运行程序。如果debug标志被设置,这个服务器
会在代码更改时自动重载,并会在异常发生时显示一个调试器。
:param host: 监听的主机名。设为'0.0.0.0'可以让服务器外部可见。
:param port: 服务器的端口。
:param options: 这些选项将被转发给底层的Werkzeug服务器。更多信息
参见werkzeug.run_simple。 | [
"在本地开发服务器上运行程序。如果debug标志被设置,这个服务器",
"会在代码更改时自动重载,并会在异常发生时显示一个调试器。",
":",
"param",
"host",
":",
"监听的主机名。设为",
"0",
".",
"0",
".",
"0",
".",
"0",
"可以让服务器外部可见。",
":",
"param",
"port",
":",
"服务器的端口。",
":",
"param",
"options",
":",
"这些选项将被转发给底层的Werkzeug服务器。更多信息",
"参见werkz... | def run(self, host='localhost', port=5000, **options):
"""在本地开发服务器上运行程序。如果debug标志被设置,这个服务器
会在代码更改时自动重载,并会在异常发生时显示一个调试器。
:param host: 监听的主机名。设为'0.0.0.0'可以让服务器外部可见。
:param port: 服务器的端口。
:param options: 这些选项将被转发给底层的Werkzeug服务器。更多信息
参见werkzeug.run_sim... | [
"def",
"run",
"(",
"self",
",",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"5000",
",",
"*",
"*",
"options",
")",
":",
"from",
"werkzeug",
"import",
"run_simple",
"if",
"'debug'",
"in",
"options",
":",
"self",
".",
"debug",
"=",
"options",
".",
"p... | https://github.com/greyli/flask-origin/blob/5621ba0562cafd0d6020f67f1172e02600186412/flask.py#L278-L292 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/emails/amazon_ses.py | python | AmazonAPIError.__init__ | (self, message) | [] | def __init__(self, message):
self.message = message | [
"def",
"__init__",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"message",
"=",
"message"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/emails/amazon_ses.py#L122-L123 | ||||
MicrosoftResearch/Azimuth | 84eb013b8dde7132357a9b69206e99a4c65e2b89 | azimuth/features/featurization.py | python | countGC | (s, length_audit=True) | return len(s[4:24].replace('A', '').replace('T', '')) | GC content for only the 20mer, as per the Doench paper/code | GC content for only the 20mer, as per the Doench paper/code | [
"GC",
"content",
"for",
"only",
"the",
"20mer",
"as",
"per",
"the",
"Doench",
"paper",
"/",
"code"
] | def countGC(s, length_audit=True):
'''
GC content for only the 20mer, as per the Doench paper/code
'''
if length_audit:
assert len(s) == 30, "seems to assume 30mer"
return len(s[4:24].replace('A', '').replace('T', '')) | [
"def",
"countGC",
"(",
"s",
",",
"length_audit",
"=",
"True",
")",
":",
"if",
"length_audit",
":",
"assert",
"len",
"(",
"s",
")",
"==",
"30",
",",
"\"seems to assume 30mer\"",
"return",
"len",
"(",
"s",
"[",
"4",
":",
"24",
"]",
".",
"replace",
"(",... | https://github.com/MicrosoftResearch/Azimuth/blob/84eb013b8dde7132357a9b69206e99a4c65e2b89/azimuth/features/featurization.py#L163-L169 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/logging/__init__.py | python | getLogger | (name=None) | return Logger.manager.getLogger(name) | Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger. | Return a logger with the specified name, creating it if necessary. | [
"Return",
"a",
"logger",
"with",
"the",
"specified",
"name",
"creating",
"it",
"if",
"necessary",
"."
] | def getLogger(name=None):
"""
Return a logger with the specified name, creating it if necessary.
If no name is specified, return the root logger.
"""
if not name or isinstance(name, str) and name == root.name:
return root
return Logger.manager.getLogger(name) | [
"def",
"getLogger",
"(",
"name",
"=",
"None",
")",
":",
"if",
"not",
"name",
"or",
"isinstance",
"(",
"name",
",",
"str",
")",
"and",
"name",
"==",
"root",
".",
"name",
":",
"return",
"root",
"return",
"Logger",
".",
"manager",
".",
"getLogger",
"(",... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/logging/__init__.py#L2075-L2083 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/dateutil/utils.py | python | today | (tzinfo=None) | return datetime.combine(dt.date(), time(0, tzinfo=tzinfo)) | Returns a :py:class:`datetime` representing the current day at midnight
:param tzinfo:
The time zone to attach (also used to determine the current day).
:return:
A :py:class:`datetime.datetime` object representing the current day
at midnight. | Returns a :py:class:`datetime` representing the current day at midnight | [
"Returns",
"a",
":",
"py",
":",
"class",
":",
"datetime",
"representing",
"the",
"current",
"day",
"at",
"midnight"
] | def today(tzinfo=None):
"""
Returns a :py:class:`datetime` representing the current day at midnight
:param tzinfo:
The time zone to attach (also used to determine the current day).
:return:
A :py:class:`datetime.datetime` object representing the current day
at midnight.
"""... | [
"def",
"today",
"(",
"tzinfo",
"=",
"None",
")",
":",
"dt",
"=",
"datetime",
".",
"now",
"(",
"tzinfo",
")",
"return",
"datetime",
".",
"combine",
"(",
"dt",
".",
"date",
"(",
")",
",",
"time",
"(",
"0",
",",
"tzinfo",
"=",
"tzinfo",
")",
")"
] | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/dateutil/utils.py#L13-L26 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py | python | OpenShiftCLIConfig.stringify | (self, ascommalist='') | return rval | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | [
"return",
"the",
"options",
"hash",
"as",
"cli",
"params",
"in",
"a",
"string",
"if",
"ascommalist",
"is",
"set",
"to",
"the",
"name",
"of",
"a",
"key",
"and",
"the",
"value",
"of",
"that",
"key",
"is",
"a",
"dict",
"format",
"the",
"dict",
"as",
"a"... | def stringify(self, ascommalist=''):
''' return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs '''
rval = []
for key in so... | [
"def",
"stringify",
"(",
"self",
",",
"ascommalist",
"=",
"''",
")",
":",
"rval",
"=",
"[",
"]",
"for",
"key",
"in",
"sorted",
"(",
"self",
".",
"config_options",
".",
"keys",
"(",
")",
")",
":",
"data",
"=",
"self",
".",
"config_options",
"[",
"ke... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py#L1500-L1516 | |
projecthamster/hamster | 19d160090de30e756bdc3122ff935bdaa86e2843 | waflib/extras/boost.py | python | boost_get_version | (self, d) | return self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[d], execute=True, define_ret=True).split(":") | silently retrieve the boost version number | silently retrieve the boost version number | [
"silently",
"retrieve",
"the",
"boost",
"version",
"number"
] | def boost_get_version(self, d):
"""silently retrieve the boost version number"""
node = self.__boost_get_version_file(d)
if node:
try:
txt = node.read()
except EnvironmentError:
Logs.error("Could not read the file %r", node.abspath())
else:
re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"... | [
"def",
"boost_get_version",
"(",
"self",
",",
"d",
")",
":",
"node",
"=",
"self",
".",
"__boost_get_version_file",
"(",
"d",
")",
"if",
"node",
":",
"try",
":",
"txt",
"=",
"node",
".",
"read",
"(",
")",
"except",
"EnvironmentError",
":",
"Logs",
".",
... | https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/waflib/extras/boost.py#L171-L186 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_daemon_set_status.py | python | V1DaemonSetStatus.number_misscheduled | (self, number_misscheduled) | Sets the number_misscheduled of this V1DaemonSetStatus.
The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ # noqa: E501
:param number_misscheduled: The number_misscheduled of ... | Sets the number_misscheduled of this V1DaemonSetStatus. | [
"Sets",
"the",
"number_misscheduled",
"of",
"this",
"V1DaemonSetStatus",
"."
] | def number_misscheduled(self, number_misscheduled):
"""Sets the number_misscheduled of this V1DaemonSetStatus.
The number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/ # noqa: E501
... | [
"def",
"number_misscheduled",
"(",
"self",
",",
"number_misscheduled",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"number_misscheduled",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid value f... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_daemon_set_status.py#L227-L238 | ||
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | src/nupic/encoders/pass_through.py | python | PassThroughEncoder.closenessScores | (self, expValues, actValues, **kwargs) | return numpy.array([r]) | Does a bitwise compare of the two bitmaps and returns a fractonal
value between 0 and 1 of how similar they are.
- ``1`` => identical
- ``0`` => no overlaping bits
``kwargs`` will have the keyword "fractional", which is assumed by this
encoder. | Does a bitwise compare of the two bitmaps and returns a fractonal
value between 0 and 1 of how similar they are. | [
"Does",
"a",
"bitwise",
"compare",
"of",
"the",
"two",
"bitmaps",
"and",
"returns",
"a",
"fractonal",
"value",
"between",
"0",
"and",
"1",
"of",
"how",
"similar",
"they",
"are",
"."
] | def closenessScores(self, expValues, actValues, **kwargs):
"""
Does a bitwise compare of the two bitmaps and returns a fractonal
value between 0 and 1 of how similar they are.
- ``1`` => identical
- ``0`` => no overlaping bits
``kwargs`` will have the keyword "fractional", which is assumed by ... | [
"def",
"closenessScores",
"(",
"self",
",",
"expValues",
",",
"actValues",
",",
"*",
"*",
"kwargs",
")",
":",
"ratio",
"=",
"1.0",
"esum",
"=",
"int",
"(",
"expValues",
".",
"sum",
"(",
")",
")",
"asum",
"=",
"int",
"(",
"actValues",
".",
"sum",
"(... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/encoders/pass_through.py#L122-L151 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/connection.py | python | AWSAuthConnection.close | (self) | (Optional) Close any open HTTP connections. This is non-destructive,
and making a new request will open a connection again. | (Optional) Close any open HTTP connections. This is non-destructive,
and making a new request will open a connection again. | [
"(",
"Optional",
")",
"Close",
"any",
"open",
"HTTP",
"connections",
".",
"This",
"is",
"non",
"-",
"destructive",
"and",
"making",
"a",
"new",
"request",
"will",
"open",
"a",
"connection",
"again",
"."
] | def close(self):
"""(Optional) Close any open HTTP connections. This is non-destructive,
and making a new request will open a connection again."""
boto.log.debug('closing all HTTP connections')
self._connection = None | [
"def",
"close",
"(",
"self",
")",
":",
"boto",
".",
"log",
".",
"debug",
"(",
"'closing all HTTP connections'",
")",
"self",
".",
"_connection",
"=",
"None"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/connection.py#L1074-L1079 | ||
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/masterd/iallocator.py | python | IARequestBase.ValidateResult | (self, ia, result) | Validates the result of an request.
@param ia: The IAllocator instance
@param result: The IAllocator run result
@raises ResultValidationError: If validation fails | Validates the result of an request. | [
"Validates",
"the",
"result",
"of",
"an",
"request",
"."
] | def ValidateResult(self, ia, result):
"""Validates the result of an request.
@param ia: The IAllocator instance
@param result: The IAllocator run result
@raises ResultValidationError: If validation fails
"""
if ia.success and not self.REQ_RESULT(result): # pylint: disable=E1102
raise err... | [
"def",
"ValidateResult",
"(",
"self",
",",
"ia",
",",
"result",
")",
":",
"if",
"ia",
".",
"success",
"and",
"not",
"self",
".",
"REQ_RESULT",
"(",
"result",
")",
":",
"# pylint: disable=E1102",
"raise",
"errors",
".",
"ResultValidationError",
"(",
"\"ialloc... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/masterd/iallocator.py#L150-L161 | ||
ansible-collections/community.general | 3faffe8f47968a2400ba3c896c8901c03001a194 | plugins/modules/remote_management/manageiq/manageiq_provider.py | python | ManageIQProvider.delete_provider | (self, provider) | return dict(changed=True, msg=result['message']) | Deletes a provider from manageiq.
Returns:
a short message describing the operation executed. | Deletes a provider from manageiq. | [
"Deletes",
"a",
"provider",
"from",
"manageiq",
"."
] | def delete_provider(self, provider):
""" Deletes a provider from manageiq.
Returns:
a short message describing the operation executed.
"""
try:
url = '%s/providers/%s' % (self.api_url, provider['id'])
result = self.client.post(url, action='delete')
... | [
"def",
"delete_provider",
"(",
"self",
",",
"provider",
")",
":",
"try",
":",
"url",
"=",
"'%s/providers/%s'",
"%",
"(",
"self",
".",
"api_url",
",",
"provider",
"[",
"'id'",
"]",
")",
"result",
"=",
"self",
".",
"client",
".",
"post",
"(",
"url",
",... | https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/remote_management/manageiq/manageiq_provider.py#L707-L719 | |
vmware-archive/vsphere-storage-for-docker | 96d2ce72457047af4ef05cb0a8794cf623803865 | esx_service/utils/auth_data.py | python | DockerVolumeTenant.remove_vms | (self, conn, vms) | return None | Remove vms from the vms table for this tenant. | Remove vms from the vms table for this tenant. | [
"Remove",
"vms",
"from",
"the",
"vms",
"table",
"for",
"this",
"tenant",
"."
] | def remove_vms(self, conn, vms):
""" Remove vms from the vms table for this tenant. """
tenant_id = self.id
vms = [(vm_id, tenant_id) for vm_id, _ in vms]
try:
conn.executemany(
"DELETE FROM vms WHERE vm_id = ? AND tenant_id = ?",
vms
... | [
"def",
"remove_vms",
"(",
"self",
",",
"conn",
",",
"vms",
")",
":",
"tenant_id",
"=",
"self",
".",
"id",
"vms",
"=",
"[",
"(",
"vm_id",
",",
"tenant_id",
")",
"for",
"vm_id",
",",
"_",
"in",
"vms",
"]",
"try",
":",
"conn",
".",
"executemany",
"(... | https://github.com/vmware-archive/vsphere-storage-for-docker/blob/96d2ce72457047af4ef05cb0a8794cf623803865/esx_service/utils/auth_data.py#L207-L222 | |
deepset-ai/haystack | 79fdda8a7cf393d774803608a4874f2a6e63cf6f | haystack/nodes/file_converter/azure.py | python | AzureConverter.convert | (self,
file_path: Path,
meta: Optional[Dict[str, str]] = None,
remove_numeric_tables: Optional[bool] = None,
valid_languages: Optional[List[str]] = None,
encoding: Optional[str] = "utf-8",
pages: Optional[str] = None,
... | return docs | Extract text and tables from a PDF, JPEG, PNG, BMP or TIFF file using Azure's Form Recognizer service.
:param file_path: Path to the file you want to convert.
:param meta: Optional dictionary with metadata that shall be attached to all resulting documents.
Can be any custom keys an... | Extract text and tables from a PDF, JPEG, PNG, BMP or TIFF file using Azure's Form Recognizer service. | [
"Extract",
"text",
"and",
"tables",
"from",
"a",
"PDF",
"JPEG",
"PNG",
"BMP",
"or",
"TIFF",
"file",
"using",
"Azure",
"s",
"Form",
"Recognizer",
"service",
"."
] | def convert(self,
file_path: Path,
meta: Optional[Dict[str, str]] = None,
remove_numeric_tables: Optional[bool] = None,
valid_languages: Optional[List[str]] = None,
encoding: Optional[str] = "utf-8",
pages: Optional[str] = N... | [
"def",
"convert",
"(",
"self",
",",
"file_path",
":",
"Path",
",",
"meta",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
"=",
"None",
",",
"remove_numeric_tables",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"valid_languages"... | https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/haystack/nodes/file_converter/azure.py#L76-L122 | |
openstack/magnum | fa298eeab19b1d87070d72c7c4fb26cd75b0781e | magnum/cmd/db_manage.py | python | add_command_parsers | (subparsers) | [] | def add_command_parsers(subparsers):
parser = subparsers.add_parser('version')
parser.set_defaults(func=do_version)
parser = subparsers.add_parser('upgrade')
parser.add_argument('revision', nargs='?')
parser.set_defaults(func=do_upgrade)
parser = subparsers.add_parser('stamp')
parser.add_a... | [
"def",
"add_command_parsers",
"(",
"subparsers",
")",
":",
"parser",
"=",
"subparsers",
".",
"add_parser",
"(",
"'version'",
")",
"parser",
".",
"set_defaults",
"(",
"func",
"=",
"do_version",
")",
"parser",
"=",
"subparsers",
".",
"add_parser",
"(",
"'upgrade... | https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/cmd/db_manage.py#L42-L57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.