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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/setuptools/pkg_resources/_vendor/pyparsing.py | python | pyparsing_common.convertToDatetime | (fmt="%Y-%m-%dT%H:%M:%S.%f") | return cvt_fn | Helper to create a parse action for converting parsed datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"})
Example::
dt_expr = pyparsing_common.iso8601_datetime.copy()
dt_expr.setParse... | Helper to create a parse action for converting parsed datetime string to Python datetime.datetime | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"datetime",
"string",
"to",
"Python",
"datetime",
".",
"datetime"
] | def convertToDatetime(fmt="%Y-%m-%dT%H:%M:%S.%f"):
"""
Helper to create a parse action for converting parsed datetime string to Python datetime.datetime
Params -
- fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%dT%H:%M:%S.%f"})
Example::
dt_expr ... | [
"def",
"convertToDatetime",
"(",
"fmt",
"=",
"\"%Y-%m-%dT%H:%M:%S.%f\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
"except",
"ValueE... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/setuptools/pkg_resources/_vendor/pyparsing.py#L5550-L5569 | |
jbjorne/TEES | caf19a4a1352ac59f5dc13a8684cc42ce4342d9d | Utils/Download.py | python | extractPackage | (path, destPath, subPath=None) | return names | [] | def extractPackage(path, destPath, subPath=None):
global pbar
if path.endswith('.zip'):
opener, mode = zipfile.ZipFile, 'r'
namelister = zipfile.ZipFile.namelist
elif path.endswith('.tar.gz') or path.endswith('.tgz'):
opener, mode = tarfile.open, 'r:gz'
namelister = tarf... | [
"def",
"extractPackage",
"(",
"path",
",",
"destPath",
",",
"subPath",
"=",
"None",
")",
":",
"global",
"pbar",
"if",
"path",
".",
"endswith",
"(",
"'.zip'",
")",
":",
"opener",
",",
"mode",
"=",
"zipfile",
".",
"ZipFile",
",",
"'r'",
"namelister",
"="... | https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/Utils/Download.py#L61-L97 | |||
online-judge-tools/oj | 70f8a29ae6a1f551fee50b35b61354ccbc81505f | onlinejudge_command/pretty_printers.py | python | _tokens_from_line_diff_ops | (ops: List[_MergedDiffOp], *, char_in_line: int) | return tokens | [] | def _tokens_from_line_diff_ops(ops: List[_MergedDiffOp], *, char_in_line: int) -> List[_PrettyToken]:
if not ops:
return [_PrettyToken(_PrettyTokenType.HINT, '(no diff)')]
left_width = char_in_line // 2
# calculate the widths of lineno
max_left_linno = 0
max_right_linno = 0
for op in o... | [
"def",
"_tokens_from_line_diff_ops",
"(",
"ops",
":",
"List",
"[",
"_MergedDiffOp",
"]",
",",
"*",
",",
"char_in_line",
":",
"int",
")",
"->",
"List",
"[",
"_PrettyToken",
"]",
":",
"if",
"not",
"ops",
":",
"return",
"[",
"_PrettyToken",
"(",
"_PrettyToken... | https://github.com/online-judge-tools/oj/blob/70f8a29ae6a1f551fee50b35b61354ccbc81505f/onlinejudge_command/pretty_printers.py#L582-L629 | |||
graphql-python/gql | 5440c6c14b74f0414551e0ebebeed187bdf4ae5a | gql/transport/phoenix_channel_websockets.py | python | PhoenixChannelWebsocketsTransport._find_existing_subscription | (self, query_id: int) | return subscription_id | Perform a reverse lookup to find the subscription id matching
a listener's query_id. | Perform a reverse lookup to find the subscription id matching
a listener's query_id. | [
"Perform",
"a",
"reverse",
"lookup",
"to",
"find",
"the",
"subscription",
"id",
"matching",
"a",
"listener",
"s",
"query_id",
"."
] | def _find_existing_subscription(self, query_id: int) -> str:
"""Perform a reverse lookup to find the subscription id matching
a listener's query_id.
"""
subscription_id, _listener_id = self._find_subscription(query_id)
if subscription_id is None:
raise TransportProto... | [
"def",
"_find_existing_subscription",
"(",
"self",
",",
"query_id",
":",
"int",
")",
"->",
"str",
":",
"subscription_id",
",",
"_listener_id",
"=",
"self",
".",
"_find_subscription",
"(",
"query_id",
")",
"if",
"subscription_id",
"is",
"None",
":",
"raise",
"T... | https://github.com/graphql-python/gql/blob/5440c6c14b74f0414551e0ebebeed187bdf4ae5a/gql/transport/phoenix_channel_websockets.py#L398-L408 | |
mynameisfiber/high_performance_python | 615341ff066772dc45125fce1866349d555524fe | 01_profiling/dowser/julia1_dowser.py | python | calc_pure_python | (draw_output, desired_width, max_iterations) | Create a list of complex co-ordinates (zs) and complex parameters (cs), build Julia set and display | Create a list of complex co-ordinates (zs) and complex parameters (cs), build Julia set and display | [
"Create",
"a",
"list",
"of",
"complex",
"co",
"-",
"ordinates",
"(",
"zs",
")",
"and",
"complex",
"parameters",
"(",
"cs",
")",
"build",
"Julia",
"set",
"and",
"display"
] | def calc_pure_python(draw_output, desired_width, max_iterations):
"""Create a list of complex co-ordinates (zs) and complex parameters (cs), build Julia set and display"""
x_step = (float(x2 - x1) / float(desired_width))
y_step = (float(y1 - y2) / float(desired_width))
x = []
y = []
ycoord = y2... | [
"def",
"calc_pure_python",
"(",
"draw_output",
",",
"desired_width",
",",
"max_iterations",
")",
":",
"x_step",
"=",
"(",
"float",
"(",
"x2",
"-",
"x1",
")",
"/",
"float",
"(",
"desired_width",
")",
")",
"y_step",
"=",
"(",
"float",
"(",
"y1",
"-",
"y2... | https://github.com/mynameisfiber/high_performance_python/blob/615341ff066772dc45125fce1866349d555524fe/01_profiling/dowser/julia1_dowser.py#L36-L80 | ||
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/company/models.py | python | SupplierPart.api_instance_filters | (self) | return {
'manufacturer_part': {
'part': self.part.pk
}
} | [] | def api_instance_filters(self):
return {
'manufacturer_part': {
'part': self.part.pk
}
} | [
"def",
"api_instance_filters",
"(",
"self",
")",
":",
"return",
"{",
"'manufacturer_part'",
":",
"{",
"'part'",
":",
"self",
".",
"part",
".",
"pk",
"}",
"}"
] | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/company/models.py#L479-L485 | |||
bcbio/bcbio-nextgen | c80f9b6b1be3267d1f981b7035e3b72441d258f2 | bcbio/broad/picardrun.py | python | picard_fastq_to_bam | (picard, fastq_one, fastq_two, out_dir, names, order="queryname") | return out_bam | Convert fastq file(s) to BAM, adding sample, run group and platform information. | Convert fastq file(s) to BAM, adding sample, run group and platform information. | [
"Convert",
"fastq",
"file",
"(",
"s",
")",
"to",
"BAM",
"adding",
"sample",
"run",
"group",
"and",
"platform",
"information",
"."
] | def picard_fastq_to_bam(picard, fastq_one, fastq_two, out_dir, names, order="queryname"):
"""Convert fastq file(s) to BAM, adding sample, run group and platform information.
"""
out_bam = os.path.join(out_dir, "%s-fastq.bam" %
os.path.splitext(os.path.basename(fastq_one))[0])
... | [
"def",
"picard_fastq_to_bam",
"(",
"picard",
",",
"fastq_one",
",",
"fastq_two",
",",
"out_dir",
",",
"names",
",",
"order",
"=",
"\"queryname\"",
")",
":",
"out_bam",
"=",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"\"%s-fastq.bam\"",
"%",
"os",... | https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/broad/picardrun.py#L154-L173 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_shapes/flip.py | python | getNewDerivation | (elementNode, prefix, sideLength) | return FlipDerivation(elementNode, prefix) | Get new derivation. | Get new derivation. | [
"Get",
"new",
"derivation",
"."
] | def getNewDerivation(elementNode, prefix, sideLength):
'Get new derivation.'
return FlipDerivation(elementNode, prefix) | [
"def",
"getNewDerivation",
"(",
"elementNode",
",",
"prefix",
",",
"sideLength",
")",
":",
"return",
"FlipDerivation",
"(",
"elementNode",
",",
"prefix",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/manipulation_shapes/flip.py#L74-L76 | |
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbWangWang.taobao_wangwang_eservice_abs_word_add | (
self,
word
) | return self._top_request(
"taobao.wangwang.eservice.abs.word.add",
{
"word": word
}
) | 添加关键词
为聊天记录查询接口添加关键词。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28017
:param word: 关键词 | 添加关键词
为聊天记录查询接口添加关键词。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28017 | [
"添加关键词",
"为聊天记录查询接口添加关键词。",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"28017"
] | def taobao_wangwang_eservice_abs_word_add(
self,
word
):
"""
添加关键词
为聊天记录查询接口添加关键词。
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=28017
:param word: 关键词
"""
return self._top_request(
"taobao.wangwang.eservice.abs.wor... | [
"def",
"taobao_wangwang_eservice_abs_word_add",
"(",
"self",
",",
"word",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"taobao.wangwang.eservice.abs.word.add\"",
",",
"{",
"\"word\"",
":",
"word",
"}",
")"
] | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L19325-L19341 | |
aparo/pyes | 96965174760cb5aa5c92eac7ccff346fb5d53cf1 | pyes/managers.py | python | Indices.get_alias | (self, alias) | return status['indices'].keys() | Get the index or indices pointed to by a given alias.
(See :ref:`es-guide-reference-api-admin-indices-aliases`)
:param alias: the name of an alias
:return returns a list of index names.
:raise IndexMissingException if the alias does not exist. | Get the index or indices pointed to by a given alias.
(See :ref:`es-guide-reference-api-admin-indices-aliases`) | [
"Get",
"the",
"index",
"or",
"indices",
"pointed",
"to",
"by",
"a",
"given",
"alias",
".",
"(",
"See",
":",
"ref",
":",
"es",
"-",
"guide",
"-",
"reference",
"-",
"api",
"-",
"admin",
"-",
"indices",
"-",
"aliases",
")"
] | def get_alias(self, alias):
"""
Get the index or indices pointed to by a given alias.
(See :ref:`es-guide-reference-api-admin-indices-aliases`)
:param alias: the name of an alias
:return returns a list of index names.
:raise IndexMissingException if the alias does not e... | [
"def",
"get_alias",
"(",
"self",
",",
"alias",
")",
":",
"status",
"=",
"self",
".",
"status",
"(",
"[",
"alias",
"]",
")",
"return",
"status",
"[",
"'indices'",
"]",
".",
"keys",
"(",
")"
] | https://github.com/aparo/pyes/blob/96965174760cb5aa5c92eac7ccff346fb5d53cf1/pyes/managers.py#L30-L42 | |
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | ingest_feed_lambda/dateutil/tz/tz.py | python | tzutc.is_ambiguous | (self, dt) | return False | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | Whether or not the "wall time" of a given datetime is ambiguous in this
zone. | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"return",
"False"
] | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/dateutil/tz/tz.py#L46-L60 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/zigbee.py | python | RegisterDeviceStatusPacket._get_api_packet_spec_data_dict | (self) | return {DictKeys.STATUS: "%s (%s)" % (self.__status.code,
self.__status.description)} | Override method.
.. seealso::
| :meth:`.XBeeAPIPacket._get_api_packet_spec_data_dict` | Override method. | [
"Override",
"method",
"."
] | def _get_api_packet_spec_data_dict(self):
"""
Override method.
.. seealso::
| :meth:`.XBeeAPIPacket._get_api_packet_spec_data_dict`
"""
return {DictKeys.STATUS: "%s (%s)" % (self.__status.code,
self.__status.description)} | [
"def",
"_get_api_packet_spec_data_dict",
"(",
"self",
")",
":",
"return",
"{",
"DictKeys",
".",
"STATUS",
":",
"\"%s (%s)\"",
"%",
"(",
"self",
".",
"__status",
".",
"code",
",",
"self",
".",
"__status",
".",
"description",
")",
"}"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/zigbee.py#L351-L359 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/ipma/config_flow.py | python | IpmaFlowHandler.async_step_user | (self, user_input=None) | return await self._show_config_form(
name=HOME_LOCATION_NAME,
latitude=self.hass.config.latitude,
longitude=self.hass.config.longitude,
) | Handle a flow initialized by the user. | Handle a flow initialized by the user. | [
"Handle",
"a",
"flow",
"initialized",
"by",
"the",
"user",
"."
] | async def async_step_user(self, user_input=None):
"""Handle a flow initialized by the user."""
self._errors = {}
if user_input is not None:
if user_input[CONF_NAME] not in self.hass.config_entries.async_entries(
DOMAIN
):
return self.async... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"self",
".",
"_errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"if",
"user_input",
"[",
"CONF_NAME",
"]",
"not",
"in",
"self",
".",
"hass",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ipma/config_flow.py#L21-L40 | |
bloomberg/phabricator-tools | 09bd1587fe8945d93a891162fd4c89640c6fada7 | py/abd/abdt_fs.py | python | Accessor.repo_config_path_list | (self) | return [os.path.join(p, r) for r in os.listdir(p) if r != 'README'] | Return a list of string paths to repo configs.
:returns: list of string | Return a list of string paths to repo configs. | [
"Return",
"a",
"list",
"of",
"string",
"paths",
"to",
"repo",
"configs",
"."
] | def repo_config_path_list(self):
"""Return a list of string paths to repo configs.
:returns: list of string
"""
p = self.layout.repository_config_dir
return [os.path.join(p, r) for r in os.listdir(p) if r != 'README'] | [
"def",
"repo_config_path_list",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"layout",
".",
"repository_config_dir",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"p",
",",
"r",
")",
"for",
"r",
"in",
"os",
".",
"listdir",
"(",
"p",
")",
"if... | https://github.com/bloomberg/phabricator-tools/blob/09bd1587fe8945d93a891162fd4c89640c6fada7/py/abd/abdt_fs.py#L391-L398 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/cluster/vq.py | python | py_vq | (obs, code_book, check_finite=True) | return code, min_dist | Python version of vq algorithm.
The algorithm computes the euclidian distance between each
observation and every frame in the code_book.
Parameters
----------
obs : ndarray
Expects a rank 2 array. Each row is one observation.
code_book : ndarray
Code book to use. Same format th... | Python version of vq algorithm. | [
"Python",
"version",
"of",
"vq",
"algorithm",
"."
] | def py_vq(obs, code_book, check_finite=True):
""" Python version of vq algorithm.
The algorithm computes the euclidian distance between each
observation and every frame in the code_book.
Parameters
----------
obs : ndarray
Expects a rank 2 array. Each row is one observation.
code_b... | [
"def",
"py_vq",
"(",
"obs",
",",
"code_book",
",",
"check_finite",
"=",
"True",
")",
":",
"obs",
"=",
"_asarray_validated",
"(",
"obs",
",",
"check_finite",
"=",
"check_finite",
")",
"code_book",
"=",
"_asarray_validated",
"(",
"code_book",
",",
"check_finite"... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/cluster/vq.py#L213-L263 | |
datawire/forge | d501be4571dcef5691804c7db7008ee877933c8d | forge/kubernetes.py | python | Kubernetes.resources | (self, yaml_dir) | return sh(*cmd).output.split() | [] | def resources(self, yaml_dir):
if is_yaml_empty(yaml_dir):
return []
cmd = "kubectl", "apply", "--dry-run", "-R", "-f", yaml_dir, "-o", "name"
if self.namespace:
cmd += "--namespace", self.namespace
return sh(*cmd).output.split() | [
"def",
"resources",
"(",
"self",
",",
"yaml_dir",
")",
":",
"if",
"is_yaml_empty",
"(",
"yaml_dir",
")",
":",
"return",
"[",
"]",
"cmd",
"=",
"\"kubectl\"",
",",
"\"apply\"",
",",
"\"--dry-run\"",
",",
"\"-R\"",
",",
"\"-f\"",
",",
"yaml_dir",
",",
"\"-o... | https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/kubernetes.py#L129-L135 | |||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/idlelib/ClassBrowser.py | python | ClassBrowserTreeItem.__init__ | (self, name, classes, file) | [] | def __init__(self, name, classes, file):
self.name = name
self.classes = classes
self.file = file
try:
self.cl = self.classes[self.name]
except (IndexError, KeyError):
self.cl = None
self.isfunction = isinstance(self.cl, pyclbr.Function) | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"classes",
",",
"file",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"classes",
"=",
"classes",
"self",
".",
"file",
"=",
"file",
"try",
":",
"self",
".",
"cl",
"=",
"self",
".",
"clas... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/ClassBrowser.py#L138-L146 | ||||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/polys/galoistools.py | python | gf_add_ground | (f, a, p, K) | Compute ``f + a`` where ``f`` in ``GF(p)[x]`` and ``a`` in ``GF(p)``.
Examples
========
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.galoistools import gf_add_ground
>>> gf_add_ground([3, 2, 4], 2, 5, ZZ)
[3, 2, 1] | Compute ``f + a`` where ``f`` in ``GF(p)[x]`` and ``a`` in ``GF(p)``. | [
"Compute",
"f",
"+",
"a",
"where",
"f",
"in",
"GF",
"(",
"p",
")",
"[",
"x",
"]",
"and",
"a",
"in",
"GF",
"(",
"p",
")",
"."
] | def gf_add_ground(f, a, p, K):
"""
Compute ``f + a`` where ``f`` in ``GF(p)[x]`` and ``a`` in ``GF(p)``.
Examples
========
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.galoistools import gf_add_ground
>>> gf_add_ground([3, 2, 4], 2, 5, ZZ)
[3, 2, 1]
"""
if not ... | [
"def",
"gf_add_ground",
"(",
"f",
",",
"a",
",",
"p",
",",
"K",
")",
":",
"if",
"not",
"f",
":",
"a",
"=",
"a",
"%",
"p",
"else",
":",
"a",
"=",
"(",
"f",
"[",
"-",
"1",
"]",
"+",
"a",
")",
"%",
"p",
"if",
"len",
"(",
"f",
")",
">",
... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/polys/galoistools.py#L364-L389 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/categories/baseclasses.py | python | Diagram.__new__ | (cls, *args) | return Basic.__new__(cls, Dict(premises), Dict(conclusions), objects) | Construct a new instance of Diagram.
If no arguments are supplied, an empty diagram is created.
If at least an argument is supplied, ``args[0]`` is
interpreted as the premises of the diagram. If ``args[0]`` is
a list, it is interpreted as a list of :class:`Morphism`'s, in
whic... | Construct a new instance of Diagram. | [
"Construct",
"a",
"new",
"instance",
"of",
"Diagram",
"."
] | def __new__(cls, *args):
"""
Construct a new instance of Diagram.
If no arguments are supplied, an empty diagram is created.
If at least an argument is supplied, ``args[0]`` is
interpreted as the premises of the diagram. If ``args[0]`` is
a list, it is interpreted as a... | [
"def",
"__new__",
"(",
"cls",
",",
"*",
"args",
")",
":",
"premises",
"=",
"{",
"}",
"conclusions",
"=",
"{",
"}",
"# Here we will keep track of the objects which appear in the",
"# premises.",
"objects",
"=",
"EmptySet",
"if",
"len",
"(",
"args",
")",
">=",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/categories/baseclasses.py#L643-L742 | |
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/apps/gbsubmit.py | python | t384 | (args) | %prog t384
Print out a table converting between 96 well to 384 well | %prog t384 | [
"%prog",
"t384"
] | def t384(args):
"""
%prog t384
Print out a table converting between 96 well to 384 well
"""
p = OptionParser(t384.__doc__)
p.parse_args(args)
plate, splate = get_plate()
fw = sys.stdout
for i in plate:
for j, p in enumerate(i):
if j != 0:
fw.wri... | [
"def",
"t384",
"(",
"args",
")",
":",
"p",
"=",
"OptionParser",
"(",
"t384",
".",
"__doc__",
")",
"p",
".",
"parse_args",
"(",
"args",
")",
"plate",
",",
"splate",
"=",
"get_plate",
"(",
")",
"fw",
"=",
"sys",
".",
"stdout",
"for",
"i",
"in",
"pl... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/apps/gbsubmit.py#L527-L544 | ||
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/scmtools/clearcase.py | python | ClearCaseDynamicViewClient.__init__ | (self, path) | Initialize the client.
Args:
path (unicode):
The path of the view. | Initialize the client. | [
"Initialize",
"the",
"client",
"."
] | def __init__(self, path):
"""Initialize the client.
Args:
path (unicode):
The path of the view.
"""
self.path = path | [
"def",
"__init__",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"path",
"=",
"path"
] | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/scmtools/clearcase.py#L649-L656 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/cffi/model.py | python | BaseType.__eq__ | (self, other) | return (self.__class__ == other.__class__ and
self._get_items() == other._get_items()) | [] | def __eq__(self, other):
return (self.__class__ == other.__class__ and
self._get_items() == other._get_items()) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"(",
"self",
".",
"__class__",
"==",
"other",
".",
"__class__",
"and",
"self",
".",
"_get_items",
"(",
")",
"==",
"other",
".",
"_get_items",
"(",
")",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cffi/model.py#L74-L76 | |||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/conversion_custom_variable_service/client.py | python | ConversionCustomVariableServiceClient.conversion_custom_variable_path | (
customer_id: str, conversion_custom_variable_id: str,
) | return "customers/{customer_id}/conversionCustomVariables/{conversion_custom_variable_id}".format(
customer_id=customer_id,
conversion_custom_variable_id=conversion_custom_variable_id,
) | Return a fully-qualified conversion_custom_variable string. | Return a fully-qualified conversion_custom_variable string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"conversion_custom_variable",
"string",
"."
] | def conversion_custom_variable_path(
customer_id: str, conversion_custom_variable_id: str,
) -> str:
"""Return a fully-qualified conversion_custom_variable string."""
return "customers/{customer_id}/conversionCustomVariables/{conversion_custom_variable_id}".format(
customer_id=cu... | [
"def",
"conversion_custom_variable_path",
"(",
"customer_id",
":",
"str",
",",
"conversion_custom_variable_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/conversionCustomVariables/{conversion_custom_variable_id}\"",
".",
"format",
"(",
"cust... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/conversion_custom_variable_service/client.py#L183-L190 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/draw/tree.py | python | TreeSegmentWidget.replace_child | (self, oldchild, newchild) | Replace the child ``oldchild`` with ``newchild``. | Replace the child ``oldchild`` with ``newchild``. | [
"Replace",
"the",
"child",
"oldchild",
"with",
"newchild",
"."
] | def replace_child(self, oldchild, newchild):
"""
Replace the child ``oldchild`` with ``newchild``.
"""
index = self._subtrees.index(oldchild)
self._subtrees[index] = newchild
self._remove_child_widget(oldchild)
self._add_child_widget(newchild)
self.update(... | [
"def",
"replace_child",
"(",
"self",
",",
"oldchild",
",",
"newchild",
")",
":",
"index",
"=",
"self",
".",
"_subtrees",
".",
"index",
"(",
"oldchild",
")",
"self",
".",
"_subtrees",
"[",
"index",
"]",
"=",
"newchild",
"self",
".",
"_remove_child_widget",
... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/draw/tree.py#L178-L186 | ||
myquant/strategy | 17595e6bf4a118e1fa87c90bfb0fd78afa69a60b | AR_MA_STOCK/python/ar_ma_stock.py | python | AR_MA_STOCK.fixation_stop_profit_loss | (self, bar) | 功能:固定止盈、止损,盈利或亏损超过了设置的比率则执行止盈、止损 | 功能:固定止盈、止损,盈利或亏损超过了设置的比率则执行止盈、止损 | [
"功能:固定止盈、止损",
"盈利或亏损超过了设置的比率则执行止盈、止损"
] | def fixation_stop_profit_loss(self, bar):
"""
功能:固定止盈、止损,盈利或亏损超过了设置的比率则执行止盈、止损
"""
if self.is_fixation_stop == 0:
return
symbol = bar.exchange + '.' + bar.sec_id
pos = self.get_position(bar.exchange, bar.sec_id, OrderSide_Bid)
if pos is not None:
... | [
"def",
"fixation_stop_profit_loss",
"(",
"self",
",",
"bar",
")",
":",
"if",
"self",
".",
"is_fixation_stop",
"==",
"0",
":",
"return",
"symbol",
"=",
"bar",
".",
"exchange",
"+",
"'.'",
"+",
"bar",
".",
"sec_id",
"pos",
"=",
"self",
".",
"get_position",... | https://github.com/myquant/strategy/blob/17595e6bf4a118e1fa87c90bfb0fd78afa69a60b/AR_MA_STOCK/python/ar_ma_stock.py#L429-L456 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/feed_service/client.py | python | FeedServiceClient.common_project_path | (project: str,) | return "projects/{project}".format(project=project,) | Return a fully-qualified project string. | Return a fully-qualified project string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"project",
"string",
"."
] | def common_project_path(project: str,) -> str:
"""Return a fully-qualified project string."""
return "projects/{project}".format(project=project,) | [
"def",
"common_project_path",
"(",
"project",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"projects/{project}\"",
".",
"format",
"(",
"project",
"=",
"project",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/feed_service/client.py#L210-L212 | |
cortex-lab/phy | 9a330b9437a3d0b40a37a201d147224e6e7fb462 | phy/plot/gloo/globject.py | python | GLObject.need_update | (self) | return self._need_update | Whether object needs to be updated | Whether object needs to be updated | [
"Whether",
"object",
"needs",
"to",
"be",
"updated"
] | def need_update(self):
""" Whether object needs to be updated """
return self._need_update | [
"def",
"need_update",
"(",
"self",
")",
":",
"return",
"self",
".",
"_need_update"
] | https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/plot/gloo/globject.py#L51-L53 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft.py | python | addToCraftMenu | ( menu ) | Add a craft plugin menu. | Add a craft plugin menu. | [
"Add",
"a",
"craft",
"plugin",
"menu",
"."
] | def addToCraftMenu( menu ):
"Add a craft plugin menu."
settings.ToolDialog().addPluginToMenu( menu, archive.getUntilDot( os.path.abspath( __file__ ) ) )
menu.add_separator()
directoryPath = skeinforge_craft.getPluginsDirectoryPath()
directoryFolders = settings.getFolders(directoryPath)
pluginFileNames = skeinforg... | [
"def",
"addToCraftMenu",
"(",
"menu",
")",
":",
"settings",
".",
"ToolDialog",
"(",
")",
".",
"addPluginToMenu",
"(",
"menu",
",",
"archive",
".",
"getUntilDot",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
")",
"menu",
".",
"add_... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft.py#L38-L51 | ||
LexPredict/lexpredict-contraxsuite | 1d5a2540d31f8f3f1adc442cfa13a7c007319899 | sdk/python/sdk/openapi_client/model/task.py | python | Task.openapi_types | () | return {
'pk': (str,), # noqa: E501
'name': (str, none_type,), # noqa: E501
'date_start': (datetime,), # noqa: E501
'date_work_start': (datetime, none_type,), # noqa: E501
'user__username': (str,), # noqa: E501
'date_done': (datetime, none_typ... | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute 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"
] | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
retu... | [
"def",
"openapi_types",
"(",
")",
":",
"return",
"{",
"'pk'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"'name'",
":",
"(",
"str",
",",
"none_type",
",",
")",
",",
"# noqa: E501",
"'date_start'",
":",
"(",
"datetime",
",",
")",
",",
"# noqa: E501... | https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/task.py#L94-L115 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/dates.py | python | RRuleLocator._get_unit | (self) | return self.get_unit_generic(freq) | Return how many days a unit of the locator is; used for
intelligent autoscaling. | Return how many days a unit of the locator is; used for
intelligent autoscaling. | [
"Return",
"how",
"many",
"days",
"a",
"unit",
"of",
"the",
"locator",
"is",
";",
"used",
"for",
"intelligent",
"autoscaling",
"."
] | def _get_unit(self):
"""
Return how many days a unit of the locator is; used for
intelligent autoscaling.
"""
freq = self.rule._rrule._freq
return self.get_unit_generic(freq) | [
"def",
"_get_unit",
"(",
"self",
")",
":",
"freq",
"=",
"self",
".",
"rule",
".",
"_rrule",
".",
"_freq",
"return",
"self",
".",
"get_unit_generic",
"(",
"freq",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/dates.py#L1068-L1074 | |
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/packages/windows/all/reg.py | python | Key.__getitem__ | (self, attr) | [] | def __getitem__(self, attr):
handle = self._open_key(KEY_QUERY_VALUE)
try:
return self._query_value(handle, attr)
finally:
CloseKey(handle) | [
"def",
"__getitem__",
"(",
"self",
",",
"attr",
")",
":",
"handle",
"=",
"self",
".",
"_open_key",
"(",
"KEY_QUERY_VALUE",
")",
"try",
":",
"return",
"self",
".",
"_query_value",
"(",
"handle",
",",
"attr",
")",
"finally",
":",
"CloseKey",
"(",
"handle",... | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/windows/all/reg.py#L714-L719 | ||||
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | packages/h2/connection.py | python | H2Connection.inbound_flow_control_window | (self) | return self._inbound_flow_control_window_manager.current_window_size | The size of the inbound flow control window for the connection. This is
rarely publicly useful: instead, use :meth:`remote_flow_control_window
<h2.connection.H2Connection.remote_flow_control_window>`. This
shortcut is largely present to provide a shortcut to this data. | The size of the inbound flow control window for the connection. This is
rarely publicly useful: instead, use :meth:`remote_flow_control_window
<h2.connection.H2Connection.remote_flow_control_window>`. This
shortcut is largely present to provide a shortcut to this data. | [
"The",
"size",
"of",
"the",
"inbound",
"flow",
"control",
"window",
"for",
"the",
"connection",
".",
"This",
"is",
"rarely",
"publicly",
"useful",
":",
"instead",
"use",
":",
"meth",
":",
"remote_flow_control_window",
"<h2",
".",
"connection",
".",
"H2Connecti... | def inbound_flow_control_window(self):
"""
The size of the inbound flow control window for the connection. This is
rarely publicly useful: instead, use :meth:`remote_flow_control_window
<h2.connection.H2Connection.remote_flow_control_window>`. This
shortcut is largely present to ... | [
"def",
"inbound_flow_control_window",
"(",
"self",
")",
":",
"return",
"self",
".",
"_inbound_flow_control_window_manager",
".",
"current_window_size"
] | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/packages/h2/connection.py#L430-L437 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/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/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L1330-L1349 | |
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0030/disco.py | python | XEP_0030.add_feature | (self, feature, node=None, jid=None) | Add a feature to a JID/node combination.
Arguments:
feature -- The namespace of the supported feature.
node -- The node to modify.
jid -- The JID to modify. | Add a feature to a JID/node combination. | [
"Add",
"a",
"feature",
"to",
"a",
"JID",
"/",
"node",
"combination",
"."
] | def add_feature(self, feature, node=None, jid=None):
"""
Add a feature to a JID/node combination.
Arguments:
feature -- The namespace of the supported feature.
node -- The node to modify.
jid -- The JID to modify.
"""
kwargs = {'feature... | [
"def",
"add_feature",
"(",
"self",
",",
"feature",
",",
"node",
"=",
"None",
",",
"jid",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"'feature'",
":",
"feature",
"}",
"self",
".",
"api",
"[",
"'add_feature'",
"]",
"(",
"jid",
",",
"node",
",",
"None... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0030/disco.py#L512-L522 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/logging/__init__.py | python | Logger.info | (self, msg, *args, **kwargs) | Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1) | Log 'msg % args' with severity 'INFO'. | [
"Log",
"msg",
"%",
"args",
"with",
"severity",
"INFO",
"."
] | def info(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
"""
if self.isEnable... | [
"def",
"info",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"isEnabledFor",
"(",
"INFO",
")",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"msg",
",",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/logging/__init__.py#L1296-L1306 | ||
derek-zhang123/MxShop | 22001da19b3d85424f48d78a844b8f424ae1e0e6 | extra_apps/rest_framework/request.py | python | Request._parse | (self) | Parse the request content, returning a two-tuple of (data, files)
May raise an `UnsupportedMediaType`, or `ParseError` exception. | Parse the request content, returning a two-tuple of (data, files) | [
"Parse",
"the",
"request",
"content",
"returning",
"a",
"two",
"-",
"tuple",
"of",
"(",
"data",
"files",
")"
] | def _parse(self):
"""
Parse the request content, returning a two-tuple of (data, files)
May raise an `UnsupportedMediaType`, or `ParseError` exception.
"""
media_type = self.content_type
try:
stream = self.stream
except RawPostDataException:
... | [
"def",
"_parse",
"(",
"self",
")",
":",
"media_type",
"=",
"self",
".",
"content_type",
"try",
":",
"stream",
"=",
"self",
".",
"stream",
"except",
"RawPostDataException",
":",
"if",
"not",
"hasattr",
"(",
"self",
".",
"_request",
",",
"'_post'",
")",
":... | https://github.com/derek-zhang123/MxShop/blob/22001da19b3d85424f48d78a844b8f424ae1e0e6/extra_apps/rest_framework/request.py#L315-L365 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/core/_internal.py | python | _ctypes.shape | (self) | return self.shape_as(_getintp_ctype()) | (c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the C-integer corresponding to ``dtype('p')`` on this
platform. This base-type could be `ctypes.c_int`, `ctypes.c_long`, or
`ctypes.c_longlong` depending on the platform.
The c_intp type is defined accordingly i... | (c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the C-integer corresponding to ``dtype('p')`` on this
platform. This base-type could be `ctypes.c_int`, `ctypes.c_long`, or
`ctypes.c_longlong` depending on the platform.
The c_intp type is defined accordingly i... | [
"(",
"c_intp",
"*",
"self",
".",
"ndim",
")",
":",
"A",
"ctypes",
"array",
"of",
"length",
"self",
".",
"ndim",
"where",
"the",
"basetype",
"is",
"the",
"C",
"-",
"integer",
"corresponding",
"to",
"dtype",
"(",
"p",
")",
"on",
"this",
"platform",
"."... | def shape(self):
"""
(c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the C-integer corresponding to ``dtype('p')`` on this
platform. This base-type could be `ctypes.c_int`, `ctypes.c_long`, or
`ctypes.c_longlong` depending on the platform.
The... | [
"def",
"shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"shape_as",
"(",
"_getintp_ctype",
"(",
")",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/core/_internal.py#L357-L366 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/matching/wrappers.py | python | WrappingMatcher.next | (self) | [] | def next(self):
self.child.next() | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"child",
".",
"next",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/matching/wrappers.py#L97-L98 | ||||
dmlc/gluon-nlp | 5d4bc9eba7226ea9f9aabbbd39e3b1e886547e48 | src/gluonnlp/utils/parameter.py | python | deduplicate_param_dict | (param_dict) | return dedup_param_dict | Get a parameter dict that has been deduplicated
Parameters
----------
param_dict
The parameter dict returned by `model.collect_params()`
Returns
-------
dedup_param_dict | Get a parameter dict that has been deduplicated | [
"Get",
"a",
"parameter",
"dict",
"that",
"has",
"been",
"deduplicated"
] | def deduplicate_param_dict(param_dict):
"""Get a parameter dict that has been deduplicated
Parameters
----------
param_dict
The parameter dict returned by `model.collect_params()`
Returns
-------
dedup_param_dict
"""
dedup_param_dict = dict()
param_uuid_set = set()
... | [
"def",
"deduplicate_param_dict",
"(",
"param_dict",
")",
":",
"dedup_param_dict",
"=",
"dict",
"(",
")",
"param_uuid_set",
"=",
"set",
"(",
")",
"for",
"k",
"in",
"sorted",
"(",
"param_dict",
".",
"keys",
"(",
")",
")",
":",
"v",
"=",
"param_dict",
"[",
... | https://github.com/dmlc/gluon-nlp/blob/5d4bc9eba7226ea9f9aabbbd39e3b1e886547e48/src/gluonnlp/utils/parameter.py#L282-L302 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | core/state.py | python | Mem.Shift | (self, n) | [] | def Shift(self, n):
# type: (int) -> int
frame = self.argv_stack[-1]
num_args = len(frame.argv)
if (frame.num_shifted + n) <= num_args:
frame.num_shifted += n
return 0 # success
else:
return 1 | [
"def",
"Shift",
"(",
"self",
",",
"n",
")",
":",
"# type: (int) -> int",
"frame",
"=",
"self",
".",
"argv_stack",
"[",
"-",
"1",
"]",
"num_args",
"=",
"len",
"(",
"frame",
".",
"argv",
")",
"if",
"(",
"frame",
".",
"num_shifted",
"+",
"n",
")",
"<=... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/core/state.py#L1220-L1229 | ||||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pip/utils/__init__.py | python | untar_file | (filename, location) | Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied after being
written. Note tha... | Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied after being
written. Note tha... | [
"Untar",
"the",
"file",
"(",
"with",
"path",
"filename",
")",
"to",
"the",
"destination",
"location",
".",
"All",
"files",
"are",
"written",
"based",
"on",
"system",
"defaults",
"and",
"umask",
"(",
"i",
".",
"e",
".",
"permissions",
"are",
"not",
"prese... | def untar_file(filename, location):
"""
Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmo... | [
"def",
"untar_file",
"(",
"filename",
",",
"location",
")",
":",
"ensure_dir",
"(",
"location",
")",
"if",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.gz'",
")",
"or",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.tgz'",... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/utils/__init__.py#L515-L588 | ||
broadinstitute/viral-ngs | e144969e4c57060d53f38a4c3a270e8227feace1 | util/vcf.py | python | VcfReader.get_snp_genos | (self, c, p, as_strings=True) | return len(snps) == 1 and dict(snps[0][3]) or {} | Read a single position from a VCF file and return the genotypes
as a sample -> allele map. If there is not exactly one matching
row in the VCF file at this position (if there are none or multiple)
then we return an empty map: {}. | Read a single position from a VCF file and return the genotypes
as a sample -> allele map. If there is not exactly one matching
row in the VCF file at this position (if there are none or multiple)
then we return an empty map: {}. | [
"Read",
"a",
"single",
"position",
"from",
"a",
"VCF",
"file",
"and",
"return",
"the",
"genotypes",
"as",
"a",
"sample",
"-",
">",
"allele",
"map",
".",
"If",
"there",
"is",
"not",
"exactly",
"one",
"matching",
"row",
"in",
"the",
"VCF",
"file",
"at",
... | def get_snp_genos(self, c, p, as_strings=True):
''' Read a single position from a VCF file and return the genotypes
as a sample -> allele map. If there is not exactly one matching
row in the VCF file at this position (if there are none or multiple)
then we return an empty ma... | [
"def",
"get_snp_genos",
"(",
"self",
",",
"c",
",",
"p",
",",
"as_strings",
"=",
"True",
")",
":",
"snps",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"get_range",
"(",
"c",
",",
"p",
",",
"p",
",",
"as_strings",
"=",
"as_strings",
")",
"]",
... | https://github.com/broadinstitute/viral-ngs/blob/e144969e4c57060d53f38a4c3a270e8227feace1/util/vcf.py#L315-L322 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cls/v20201016/models.py | python | RuleInfo.__init__ | (self) | r"""
:param FullText: 全文索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type FullText: :class:`tencentcloud.cls.v20201016.models.FullTextInfo`
:param KeyValue: 键值索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type KeyValue: :class:`tencentcloud.cls.v20201016.models.RuleKeyValueInfo`
:param Tag: 元字段索引配置
注意:此字段可... | r"""
:param FullText: 全文索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type FullText: :class:`tencentcloud.cls.v20201016.models.FullTextInfo`
:param KeyValue: 键值索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type KeyValue: :class:`tencentcloud.cls.v20201016.models.RuleKeyValueInfo`
:param Tag: 元字段索引配置
注意:此字段可... | [
"r",
":",
"param",
"FullText",
":",
"全文索引配置",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"FullText",
":",
":",
"class",
":",
"tencentcloud",
".",
"cls",
".",
"v20201016",
".",
"models",
".",
"FullTextInfo",
":",
"param",
"KeyValue",
":",
"键值索引配置",
"注意:此字段可... | def __init__(self):
r"""
:param FullText: 全文索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type FullText: :class:`tencentcloud.cls.v20201016.models.FullTextInfo`
:param KeyValue: 键值索引配置
注意:此字段可能返回 null,表示取不到有效值。
:type KeyValue: :class:`tencentcloud.cls.v20201016.models.RuleKeyValueInfo`
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"FullText",
"=",
"None",
"self",
".",
"KeyValue",
"=",
"None",
"self",
".",
"Tag",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cls/v20201016/models.py#L4719-L4733 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/rest/binary_sensor.py | python | RestBinarySensor.is_on | (self) | return self._is_on | Return true if the binary sensor is on. | Return true if the binary sensor is on. | [
"Return",
"true",
"if",
"the",
"binary",
"sensor",
"is",
"on",
"."
] | def is_on(self):
"""Return true if the binary sensor is on."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_on"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/rest/binary_sensor.py#L107-L109 | |
open-mmlab/mmdetection | ff9bc39913cb3ff5dde79d3933add7dc2561bab7 | mmdet/core/evaluation/class_names.py | python | get_classes | (dataset) | return labels | Get class names of a dataset. | Get class names of a dataset. | [
"Get",
"class",
"names",
"of",
"a",
"dataset",
"."
] | def get_classes(dataset):
"""Get class names of a dataset."""
alias2name = {}
for name, aliases in dataset_aliases.items():
for alias in aliases:
alias2name[alias] = name
if mmcv.is_str(dataset):
if dataset in alias2name:
labels = eval(alias2name[dataset] + '_cla... | [
"def",
"get_classes",
"(",
"dataset",
")",
":",
"alias2name",
"=",
"{",
"}",
"for",
"name",
",",
"aliases",
"in",
"dataset_aliases",
".",
"items",
"(",
")",
":",
"for",
"alias",
"in",
"aliases",
":",
"alias2name",
"[",
"alias",
"]",
"=",
"name",
"if",
... | https://github.com/open-mmlab/mmdetection/blob/ff9bc39913cb3ff5dde79d3933add7dc2561bab7/mmdet/core/evaluation/class_names.py#L103-L117 | |
nabeel-oz/qlik-py-tools | 09d0cd232fadcaa926bb11cebb37d5ae3051bc86 | core/__main__.py | python | ExtensionService.__init__ | (self, funcdef_file) | Class initializer.
:param funcdef_file: a function definition JSON file | Class initializer.
:param funcdef_file: a function definition JSON file | [
"Class",
"initializer",
".",
":",
"param",
"funcdef_file",
":",
"a",
"function",
"definition",
"JSON",
"file"
] | def __init__(self, funcdef_file):
"""
Class initializer.
:param funcdef_file: a function definition JSON file
"""
self._function_definitions = funcdef_file
os.makedirs('logs', exist_ok=True)
log_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logg... | [
"def",
"__init__",
"(",
"self",
",",
"funcdef_file",
")",
":",
"self",
".",
"_function_definitions",
"=",
"funcdef_file",
"os",
".",
"makedirs",
"(",
"'logs'",
",",
"exist_ok",
"=",
"True",
")",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",... | https://github.com/nabeel-oz/qlik-py-tools/blob/09d0cd232fadcaa926bb11cebb37d5ae3051bc86/core/__main__.py#L53-L62 | ||
pycontribs/pyrax | a0c022981f76a4cba96a22ecc19bb52843ac4fbe | pyrax/object_storage.py | python | Container.move_object | (self, obj, new_container, new_obj_name=None,
new_reference=False, content_type=None, extra_info=None) | return self.manager.move_object(self, obj, new_container,
new_obj_name=new_obj_name, new_reference=new_reference,
content_type=content_type) | Works just like copy_object, except that the source object is deleted
after a successful copy.
You can optionally change the content_type of the object by supplying
that in the 'content_type' parameter.
NOTE: any references to the original object will no longer be valid;
you wi... | Works just like copy_object, except that the source object is deleted
after a successful copy. | [
"Works",
"just",
"like",
"copy_object",
"except",
"that",
"the",
"source",
"object",
"is",
"deleted",
"after",
"a",
"successful",
"copy",
"."
] | def move_object(self, obj, new_container, new_obj_name=None,
new_reference=False, content_type=None, extra_info=None):
"""
Works just like copy_object, except that the source object is deleted
after a successful copy.
You can optionally change the content_type of the object ... | [
"def",
"move_object",
"(",
"self",
",",
"obj",
",",
"new_container",
",",
"new_obj_name",
"=",
"None",
",",
"new_reference",
"=",
"False",
",",
"content_type",
"=",
"None",
",",
"extra_info",
"=",
"None",
")",
":",
"return",
"self",
".",
"manager",
".",
... | https://github.com/pycontribs/pyrax/blob/a0c022981f76a4cba96a22ecc19bb52843ac4fbe/pyrax/object_storage.py#L609-L630 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/encodings/cp720.py | python | getregentry | () | return codecs.CodecInfo(
name='cp720',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
) | [] | def getregentry():
return codecs.CodecInfo(
name='cp720',
encode=Codec().encode,
decode=Codec().decode,
incrementalencoder=IncrementalEncoder,
incrementaldecoder=IncrementalDecoder,
streamreader=StreamReader,
streamwriter=StreamWriter,
) | [
"def",
"getregentry",
"(",
")",
":",
"return",
"codecs",
".",
"CodecInfo",
"(",
"name",
"=",
"'cp720'",
",",
"encode",
"=",
"Codec",
"(",
")",
".",
"encode",
",",
"decode",
"=",
"Codec",
"(",
")",
".",
"decode",
",",
"incrementalencoder",
"=",
"Increme... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/cp720.py#L35-L44 | |||
phimpme/phimpme-generator | ba6d11190b9016238f27672e1ad55e6a875b74a0 | Phimpme/site-packages/nose/plugins/base.py | python | IPluginInterface.loadTestsFromTestClass | (self, cls) | Return tests in this test class. Class will *not* be a
unittest.TestCase subclass. Return None if you are not able to
load any tests, an iterable if you are. May be a generator.
:param cls: The test case class. Must be **not** be subclass of
:class:`unittest.TestCase`. | Return tests in this test class. Class will *not* be a
unittest.TestCase subclass. Return None if you are not able to
load any tests, an iterable if you are. May be a generator. | [
"Return",
"tests",
"in",
"this",
"test",
"class",
".",
"Class",
"will",
"*",
"not",
"*",
"be",
"a",
"unittest",
".",
"TestCase",
"subclass",
".",
"Return",
"None",
"if",
"you",
"are",
"not",
"able",
"to",
"load",
"any",
"tests",
"an",
"iterable",
"if",... | def loadTestsFromTestClass(self, cls):
"""Return tests in this test class. Class will *not* be a
unittest.TestCase subclass. Return None if you are not able to
load any tests, an iterable if you are. May be a generator.
:param cls: The test case class. Must be **not** be subclass of
... | [
"def",
"loadTestsFromTestClass",
"(",
"self",
",",
"cls",
")",
":",
"pass"
] | https://github.com/phimpme/phimpme-generator/blob/ba6d11190b9016238f27672e1ad55e6a875b74a0/Phimpme/site-packages/nose/plugins/base.py#L478-L486 | ||
Jack-Cherish/Deep-Learning | 5fd254b61ad45367fbae28c49976e82b14ff7110 | Tutorial/lesson-5/activators.py | python | TanhActivator.backward | (self, output) | return 1 - output * output | [] | def backward(self, output):
return 1 - output * output | [
"def",
"backward",
"(",
"self",
",",
"output",
")",
":",
"return",
"1",
"-",
"output",
"*",
"output"
] | https://github.com/Jack-Cherish/Deep-Learning/blob/5fd254b61ad45367fbae28c49976e82b14ff7110/Tutorial/lesson-5/activators.py#L36-L37 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/rabbitmq.py | python | set_user_tags | (name, tags, runas=None) | return _format_response(res, msg) | Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator | Add user tags via rabbitmqctl set_user_tags | [
"Add",
"user",
"tags",
"via",
"rabbitmqctl",
"set_user_tags"
] | def set_user_tags(name, tags, runas=None):
"""Add user tags via rabbitmqctl set_user_tags
CLI Example:
.. code-block:: bash
salt '*' rabbitmq.set_user_tags myadmin administrator
"""
if runas is None and not salt.utils.platform.is_windows():
runas = salt.utils.user.get_user()
... | [
"def",
"set_user_tags",
"(",
"name",
",",
"tags",
",",
"runas",
"=",
"None",
")",
":",
"if",
"runas",
"is",
"None",
"and",
"not",
"salt",
".",
"utils",
".",
"platform",
".",
"is_windows",
"(",
")",
":",
"runas",
"=",
"salt",
".",
"utils",
".",
"use... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/rabbitmq.py#L707-L729 | |
NVIDIA/object-detection-tensorrt-example | feb3632ed289fb71acb84e28a4f51931fc8c7e13 | SSD_Model/utils/boxes.py | python | draw_bounding_box_on_image | (image,
ymin,
xmin,
ymax,
xmax,
color=(255, 0, 0),
thickness=4,
display_str='',
... | Adds a bounding box to an image.
Bounding box coordinates can be specified in either absolute (pixel) or
normalized coordinates by setting the use_normalized_coordinates argument.
The string passed in display_str is displayed above the
bounding box in black text on a rectangle filled with the input 'c... | Adds a bounding box to an image. | [
"Adds",
"a",
"bounding",
"box",
"to",
"an",
"image",
"."
] | def draw_bounding_box_on_image(image,
ymin,
xmin,
ymax,
xmax,
color=(255, 0, 0),
thickness=4,
display_s... | [
"def",
"draw_bounding_box_on_image",
"(",
"image",
",",
"ymin",
",",
"xmin",
",",
"ymax",
",",
"xmax",
",",
"color",
"=",
"(",
"255",
",",
"0",
",",
"0",
")",
",",
"thickness",
"=",
"4",
",",
"display_str",
"=",
"''",
",",
"use_normalized_coordinates",
... | https://github.com/NVIDIA/object-detection-tensorrt-example/blob/feb3632ed289fb71acb84e28a4f51931fc8c7e13/SSD_Model/utils/boxes.py#L35-L104 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_custom_resource_definition.py | python | V1CustomResourceDefinition.__init__ | (self, api_version=None, kind=None, metadata=None, spec=None, status=None, local_vars_configuration=None) | V1CustomResourceDefinition - a model defined in OpenAPI | V1CustomResourceDefinition - a model defined in OpenAPI | [
"V1CustomResourceDefinition",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, api_version=None, kind=None, metadata=None, spec=None, status=None, local_vars_configuration=None): # noqa: E501
"""V1CustomResourceDefinition - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
... | [
"def",
"__init__",
"(",
"self",
",",
"api_version",
"=",
"None",
",",
"kind",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"status",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_custom_resource_definition.py#L51-L72 | ||
PINTO0309/PINTO_model_zoo | 2924acda7a7d541d8712efd7cc4fd1c61ef5bddd | 082_MediaPipe_Meet_Segmentation/02_segm_full_v679_tflite_to_pb_saved_model.py | python | make_graph | (ops, op_types, interpreter) | [] | def make_graph(ops, op_types, interpreter):
height = 144
width = 256
tensors = {}
input_details = interpreter.get_input_details()
# output_details = interpreter.get_output_details()
print(input_details)
for input_detail in input_details:
tensors[input_detail['index']] = tf.placeho... | [
"def",
"make_graph",
"(",
"ops",
",",
"op_types",
",",
"interpreter",
")",
":",
"height",
"=",
"144",
"width",
"=",
"256",
"tensors",
"=",
"{",
"}",
"input_details",
"=",
"interpreter",
".",
"get_input_details",
"(",
")",
"# output_details = interpreter.get_outp... | https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/082_MediaPipe_Meet_Segmentation/02_segm_full_v679_tflite_to_pb_saved_model.py#L54-L288 | ||||
facebookresearch/mmf | fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f | tools/sweeps/lib/slurm.py | python | has_started | (save_dir) | return True | [] | def has_started(save_dir):
train_log = os.path.join(save_dir, "train.log")
if not os.path.exists(train_log):
return False
return True | [
"def",
"has_started",
"(",
"save_dir",
")",
":",
"train_log",
"=",
"os",
".",
"path",
".",
"join",
"(",
"save_dir",
",",
"\"train.log\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"train_log",
")",
":",
"return",
"False",
"return",
"True... | https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/tools/sweeps/lib/slurm.py#L359-L363 | |||
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/scapy/build/lib.linux-i686-2.7/scapy/utils6.py | python | in6_iseui64 | (x) | return x == eui64 | Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format. | Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format. | [
"Return",
"True",
"if",
"provided",
"address",
"has",
"an",
"interface",
"identifier",
"part",
"created",
"in",
"modified",
"EUI",
"-",
"64",
"format",
"(",
"meaning",
"it",
"matches",
"*",
"::",
"*",
":",
"*",
"ff",
":",
"fe",
"*",
":",
"*",
")",
".... | def in6_iseui64(x):
"""
Return True if provided address has an interface identifier part
created in modified EUI-64 format (meaning it matches *::*:*ff:fe*:*).
Otherwise, False is returned. Address must be passed in printable
format.
"""
eui64 = inet_pton(socket.AF_INET6, '::ff:fe00:0')
... | [
"def",
"in6_iseui64",
"(",
"x",
")",
":",
"eui64",
"=",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"'::ff:fe00:0'",
")",
"x",
"=",
"in6_and",
"(",
"inet_pton",
"(",
"socket",
".",
"AF_INET6",
",",
"x",
")",
",",
"eui64",
")",
"return",
"x",
"=... | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/scapy/build/lib.linux-i686-2.7/scapy/utils6.py#L524-L533 | |
dieseldev/diesel | 8d48371fce0b79d6631053594bce06e4b9628499 | diesel/protocols/riak.py | python | RiakClient.get | (self, bucket, key) | Get the value of key from named bucket.
Returns a dictionary with a list of the content for the key
and the vector clock (vclock) for the key. | Get the value of key from named bucket. | [
"Get",
"the",
"value",
"of",
"key",
"from",
"named",
"bucket",
"."
] | def get(self, bucket, key):
"""Get the value of key from named bucket.
Returns a dictionary with a list of the content for the key
and the vector clock (vclock) for the key.
"""
request = riak_palm.RpbGetReq(bucket=bucket, key=key)
self._send(request)
response =... | [
"def",
"get",
"(",
"self",
",",
"bucket",
",",
"key",
")",
":",
"request",
"=",
"riak_palm",
".",
"RpbGetReq",
"(",
"bucket",
"=",
"bucket",
",",
"key",
"=",
"key",
")",
"self",
".",
"_send",
"(",
"request",
")",
"response",
"=",
"self",
".",
"_rec... | https://github.com/dieseldev/diesel/blob/8d48371fce0b79d6631053594bce06e4b9628499/diesel/protocols/riak.py#L314-L325 | ||
BerkeleyAutomation/meshrender | 25b6fb711ef7a7871a5908459e6be5c76a04b631 | meshrender/trackball.py | python | Trackball.__init__ | (self, T_camera_world, size, scale,
target=np.array([0.0, 0.0, 0.0])) | Initialize a trackball with an initial camera-to-world pose
and the given parameters.
Parameters
----------
T_camera_world : autolab_core.RigidTransform
An initial camera-to-world pose for the trackball.
size : (float, float)
The width and height of the ... | Initialize a trackball with an initial camera-to-world pose
and the given parameters. | [
"Initialize",
"a",
"trackball",
"with",
"an",
"initial",
"camera",
"-",
"to",
"-",
"world",
"pose",
"and",
"the",
"given",
"parameters",
"."
] | def __init__(self, T_camera_world, size, scale,
target=np.array([0.0, 0.0, 0.0])):
"""Initialize a trackball with an initial camera-to-world pose
and the given parameters.
Parameters
----------
T_camera_world : autolab_core.RigidTransform
An initial ... | [
"def",
"__init__",
"(",
"self",
",",
"T_camera_world",
",",
"size",
",",
"scale",
",",
"target",
"=",
"np",
".",
"array",
"(",
"[",
"0.0",
",",
"0.0",
",",
"0.0",
"]",
")",
")",
":",
"self",
".",
"_size",
"=",
"np",
".",
"array",
"(",
"size",
"... | https://github.com/BerkeleyAutomation/meshrender/blob/25b6fb711ef7a7871a5908459e6be5c76a04b631/meshrender/trackball.py#L15-L46 | ||
explosion/srsly | 8617ecc099d1f34a60117b5287bef5424ea2c837 | srsly/ruamel_yaml/comments.py | python | CommentedMap._unmerged_contains | (self, key) | return None | [] | def _unmerged_contains(self, key):
# type: (Any) -> Any
if key in self._ok:
return True
return None | [
"def",
"_unmerged_contains",
"(",
"self",
",",
"key",
")",
":",
"# type: (Any) -> Any",
"if",
"key",
"in",
"self",
".",
"_ok",
":",
"return",
"True",
"return",
"None"
] | https://github.com/explosion/srsly/blob/8617ecc099d1f34a60117b5287bef5424ea2c837/srsly/ruamel_yaml/comments.py#L775-L779 | |||
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | conversions/pressure_conversions.py | python | pressure_conversion | (value: float, from_type: str, to_type: str) | return (
value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
) | Conversion between pressure units.
>>> pressure_conversion(4, "atm", "pascal")
405300
>>> pressure_conversion(1, "pascal", "psi")
0.00014401981999999998
>>> pressure_conversion(1, "bar", "atm")
0.986923
>>> pressure_conversion(3, "kilopascal", "bar")
0.029999991892499998
>>> pressure... | Conversion between pressure units.
>>> pressure_conversion(4, "atm", "pascal")
405300
>>> pressure_conversion(1, "pascal", "psi")
0.00014401981999999998
>>> pressure_conversion(1, "bar", "atm")
0.986923
>>> pressure_conversion(3, "kilopascal", "bar")
0.029999991892499998
>>> pressure... | [
"Conversion",
"between",
"pressure",
"units",
".",
">>>",
"pressure_conversion",
"(",
"4",
"atm",
"pascal",
")",
"405300",
">>>",
"pressure_conversion",
"(",
"1",
"pascal",
"psi",
")",
"0",
".",
"00014401981999999998",
">>>",
"pressure_conversion",
"(",
"1",
"ba... | def pressure_conversion(value: float, from_type: str, to_type: str) -> float:
"""
Conversion between pressure units.
>>> pressure_conversion(4, "atm", "pascal")
405300
>>> pressure_conversion(1, "pascal", "psi")
0.00014401981999999998
>>> pressure_conversion(1, "bar", "atm")
0.986923
... | [
"def",
"pressure_conversion",
"(",
"value",
":",
"float",
",",
"from_type",
":",
"str",
",",
"to_type",
":",
"str",
")",
"->",
"float",
":",
"if",
"from_type",
"not",
"in",
"PRESSURE_CONVERSION",
":",
"raise",
"ValueError",
"(",
"f\"Invalid 'from_type' value: {f... | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/conversions/pressure_conversions.py#L38-L79 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/news/database.py | python | INewsStorage.articleRequest | (group, index, id = None) | Returns a deferred whose callback will be passed a file-like object
containing the full article text (headers and body) for the article
of the specified index in the specified group, and whose errback
will be invoked if the article or group does not exist. If id is
not None, index is ig... | Returns a deferred whose callback will be passed a file-like object
containing the full article text (headers and body) for the article
of the specified index in the specified group, and whose errback
will be invoked if the article or group does not exist. If id is
not None, index is ig... | [
"Returns",
"a",
"deferred",
"whose",
"callback",
"will",
"be",
"passed",
"a",
"file",
"-",
"like",
"object",
"containing",
"the",
"full",
"article",
"text",
"(",
"headers",
"and",
"body",
")",
"for",
"the",
"article",
"of",
"the",
"specified",
"index",
"in... | def articleRequest(group, index, id = None):
"""
Returns a deferred whose callback will be passed a file-like object
containing the full article text (headers and body) for the article
of the specified index in the specified group, and whose errback
will be invoked if the article... | [
"def",
"articleRequest",
"(",
"group",
",",
"index",
",",
"id",
"=",
"None",
")",
":"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/news/database.py#L167-L176 | ||
kevinw/pyflakes | b08949f6cc123eb96f05051a1e29abc8457a6799 | pyflakes/checker.py | python | Checker.isDocstring | (self, node) | return isinstance(node, _ast.Str) or \
(isinstance(node, _ast.Expr) and
isinstance(node.value, _ast.Str)) | Determine if the given node is a docstring, as long as it is at the
correct place in the node tree. | Determine if the given node is a docstring, as long as it is at the
correct place in the node tree. | [
"Determine",
"if",
"the",
"given",
"node",
"is",
"a",
"docstring",
"as",
"long",
"as",
"it",
"is",
"at",
"the",
"correct",
"place",
"in",
"the",
"node",
"tree",
"."
] | def isDocstring(self, node):
"""
Determine if the given node is a docstring, as long as it is at the
correct place in the node tree.
"""
return isinstance(node, _ast.Str) or \
(isinstance(node, _ast.Expr) and
isinstance(node.value, _ast.Str)) | [
"def",
"isDocstring",
"(",
"self",
",",
"node",
")",
":",
"return",
"isinstance",
"(",
"node",
",",
"_ast",
".",
"Str",
")",
"or",
"(",
"isinstance",
"(",
"node",
",",
"_ast",
".",
"Expr",
")",
"and",
"isinstance",
"(",
"node",
".",
"value",
",",
"... | https://github.com/kevinw/pyflakes/blob/b08949f6cc123eb96f05051a1e29abc8457a6799/pyflakes/checker.py#L340-L347 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/numbers.py | python | Integral.__rxor__ | (self, other) | other ^ self | other ^ self | [
"other",
"^",
"self"
] | def __rxor__(self, other):
"""other ^ self"""
raise NotImplementedError | [
"def",
"__rxor__",
"(",
"self",
",",
"other",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/numbers.py#L355-L357 | ||
jhpyle/docassemble | b90c84e57af59aa88b3404d44d0b125c70f832cc | docassemble_base/docassemble/base/util.py | python | DAFile.uses_acroform | (self) | return self.file_info.get('acroform', False) | Returns True if the file uses AcroForm, otherwise returns False. | Returns True if the file uses AcroForm, otherwise returns False. | [
"Returns",
"True",
"if",
"the",
"file",
"uses",
"AcroForm",
"otherwise",
"returns",
"False",
"."
] | def uses_acroform(self):
"""Returns True if the file uses AcroForm, otherwise returns False."""
if not hasattr(self, 'file_info'):
self.retrieve()
return self.file_info.get('acroform', False) | [
"def",
"uses_acroform",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'file_info'",
")",
":",
"self",
".",
"retrieve",
"(",
")",
"return",
"self",
".",
"file_info",
".",
"get",
"(",
"'acroform'",
",",
"False",
")"
] | https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/util.py#L3883-L3887 | |
junsukchoe/ADL | dab2e78163bd96970ec9ae41de62835332dbf4fe | tensorpack/dataflow/imgaug/imgproc.py | python | Hue.__init__ | (self, range=(0, 180), rgb=True) | Args:
range(list or tuple): range from which the applied hue offset is selected (maximum [-90,90] or [0,180])
rgb (bool): whether input is RGB or BGR. | Args:
range(list or tuple): range from which the applied hue offset is selected (maximum [-90,90] or [0,180])
rgb (bool): whether input is RGB or BGR. | [
"Args",
":",
"range",
"(",
"list",
"or",
"tuple",
")",
":",
"range",
"from",
"which",
"the",
"applied",
"hue",
"offset",
"is",
"selected",
"(",
"maximum",
"[",
"-",
"90",
"90",
"]",
"or",
"[",
"0",
"180",
"]",
")",
"rgb",
"(",
"bool",
")",
":",
... | def __init__(self, range=(0, 180), rgb=True):
"""
Args:
range(list or tuple): range from which the applied hue offset is selected (maximum [-90,90] or [0,180])
rgb (bool): whether input is RGB or BGR.
"""
super(Hue, self).__init__()
rgb = bool(rgb)
... | [
"def",
"__init__",
"(",
"self",
",",
"range",
"=",
"(",
"0",
",",
"180",
")",
",",
"rgb",
"=",
"True",
")",
":",
"super",
"(",
"Hue",
",",
"self",
")",
".",
"__init__",
"(",
")",
"rgb",
"=",
"bool",
"(",
"rgb",
")",
"self",
".",
"_init",
"(",... | https://github.com/junsukchoe/ADL/blob/dab2e78163bd96970ec9ae41de62835332dbf4fe/tensorpack/dataflow/imgaug/imgproc.py#L18-L26 | ||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/provenance_event_dto.py | python | ProvenanceEventDTO.output_content_claim_container | (self, output_content_claim_container) | Sets the output_content_claim_container of this ProvenanceEventDTO.
The container in which the output content claim lives.
:param output_content_claim_container: The output_content_claim_container of this ProvenanceEventDTO.
:type: str | Sets the output_content_claim_container of this ProvenanceEventDTO.
The container in which the output content claim lives. | [
"Sets",
"the",
"output_content_claim_container",
"of",
"this",
"ProvenanceEventDTO",
".",
"The",
"container",
"in",
"which",
"the",
"output",
"content",
"claim",
"lives",
"."
] | def output_content_claim_container(self, output_content_claim_container):
"""
Sets the output_content_claim_container of this ProvenanceEventDTO.
The container in which the output content claim lives.
:param output_content_claim_container: The output_content_claim_container of this Prov... | [
"def",
"output_content_claim_container",
"(",
"self",
",",
"output_content_claim_container",
")",
":",
"self",
".",
"_output_content_claim_container",
"=",
"output_content_claim_container"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/provenance_event_dto.py#L1022-L1031 | ||
mitogen-hq/mitogen | 5b505f524a7ae170fe68613841ab92b299613d3f | ansible_mitogen/connection.py | python | optional_int | (value) | Convert `value` to an integer if it is not :data:`None`, otherwise return
:data:`None`. | Convert `value` to an integer if it is not :data:`None`, otherwise return
:data:`None`. | [
"Convert",
"value",
"to",
"an",
"integer",
"if",
"it",
"is",
"not",
":",
"data",
":",
"None",
"otherwise",
"return",
":",
"data",
":",
"None",
"."
] | def optional_int(value):
"""
Convert `value` to an integer if it is not :data:`None`, otherwise return
:data:`None`.
"""
try:
return int(value)
except (TypeError, ValueError):
return None | [
"def",
"optional_int",
"(",
"value",
")",
":",
"try",
":",
"return",
"int",
"(",
"value",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"return",
"None"
] | https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/ansible_mitogen/connection.py#L75-L83 | ||
almarklein/visvis | 766ed97767b44a55a6ff72c742d7385e074d3d55 | wobjects/sliceTextures.py | python | SliceTexture._GetData | (self) | return self._dataRef3D | _GetData()
Get a reference to the raw data. For internal use. | _GetData()
Get a reference to the raw data. For internal use. | [
"_GetData",
"()",
"Get",
"a",
"reference",
"to",
"the",
"raw",
"data",
".",
"For",
"internal",
"use",
"."
] | def _GetData(self):
""" _GetData()
Get a reference to the raw data. For internal use.
"""
return self._dataRef3D | [
"def",
"_GetData",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dataRef3D"
] | https://github.com/almarklein/visvis/blob/766ed97767b44a55a6ff72c742d7385e074d3d55/wobjects/sliceTextures.py#L127-L133 | |
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/cgitb.py | python | reset | () | return '''<!--: spam
Content-Type: text/html
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquote> </pre>
</table> </table> </table> </table> </table> </font> </font> </font>''' | Return a string that resets the CGI and browser to a known state. | Return a string that resets the CGI and browser to a known state. | [
"Return",
"a",
"string",
"that",
"resets",
"the",
"CGI",
"and",
"browser",
"to",
"a",
"known",
"state",
"."
] | def reset():
"""Return a string that resets the CGI and browser to a known state."""
return '''<!--: spam
Content-Type: text/html
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> -->
<body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> -->
</font> </font> </font> </script> </object> </blockquot... | [
"def",
"reset",
"(",
")",
":",
"return",
"'''<!--: spam\nContent-Type: text/html\n\n<body bgcolor=\"#f0f0f8\"><font color=\"#f0f0f8\" size=\"-5\"> -->\n<body bgcolor=\"#f0f0f8\"><font color=\"#f0f0f8\" size=\"-5\"> --> -->\n</font> </font> </font> </script> </object> </blockquote> </pre>\n</table> </tab... | https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/cgitb.py#L30-L38 | |
BichenWuUCB/SqueezeSeg | 6dc53c8849eed91a4463ca22371474caeaab5827 | src/nn_skeleton.py | python | ModelSkeleton._bilateral_filter_layer | (
self, layer_name, inputs, thetas=[0.9, 0.01], sizes=[3, 5], stride=1,
padding='SAME') | return out | Computing pairwise energy with a bilateral filter for CRF.
Args:
layer_name: layer name
inputs: input tensor with shape [batch_size, zenith, azimuth, 2] where the
last 2 elements are intensity and range of a lidar point.
thetas: theta parameter for bilateral filter.
sizes: filter ... | Computing pairwise energy with a bilateral filter for CRF. | [
"Computing",
"pairwise",
"energy",
"with",
"a",
"bilateral",
"filter",
"for",
"CRF",
"."
] | def _bilateral_filter_layer(
self, layer_name, inputs, thetas=[0.9, 0.01], sizes=[3, 5], stride=1,
padding='SAME'):
"""Computing pairwise energy with a bilateral filter for CRF.
Args:
layer_name: layer name
inputs: input tensor with shape [batch_size, zenith, azimuth, 2] where the
... | [
"def",
"_bilateral_filter_layer",
"(",
"self",
",",
"layer_name",
",",
"inputs",
",",
"thetas",
"=",
"[",
"0.9",
",",
"0.01",
"]",
",",
"sizes",
"=",
"[",
"3",
",",
"5",
"]",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"'SAME'",
")",
":",
"assert... | https://github.com/BichenWuUCB/SqueezeSeg/blob/6dc53c8849eed91a4463ca22371474caeaab5827/src/nn_skeleton.py#L831-L903 | |
benedekrozemberczki/GEMSEC | c023122bdafe88278cdbd24b7fcf9dafe8e95b34 | src/calculation_helper.py | python | unit | (g, node_1, node_2) | return 1 | Function to calculate the "unit" weight.
:param g: NX graph.
:param node_1: Node 1. of a pair.
:param node_2: Node 2. of a pair. | Function to calculate the "unit" weight.
:param g: NX graph.
:param node_1: Node 1. of a pair.
:param node_2: Node 2. of a pair. | [
"Function",
"to",
"calculate",
"the",
"unit",
"weight",
".",
":",
"param",
"g",
":",
"NX",
"graph",
".",
":",
"param",
"node_1",
":",
"Node",
"1",
".",
"of",
"a",
"pair",
".",
":",
"param",
"node_2",
":",
"Node",
"2",
".",
"of",
"a",
"pair",
"."
... | def unit(g, node_1, node_2):
"""
Function to calculate the "unit" weight.
:param g: NX graph.
:param node_1: Node 1. of a pair.
:param node_2: Node 2. of a pair.
"""
return 1 | [
"def",
"unit",
"(",
"g",
",",
"node_1",
",",
"node_2",
")",
":",
"return",
"1"
] | https://github.com/benedekrozemberczki/GEMSEC/blob/c023122bdafe88278cdbd24b7fcf9dafe8e95b34/src/calculation_helper.py#L35-L42 | |
huawei-noah/CV-Backbones | 03e8cdfe92494a55ddfb11cc875ff2e1c33f91da | tnt_pytorch/pyramid_tnt.py | python | Attention.__init__ | (self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0., sr_ratio=1) | [] | def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0., sr_ratio=1):
super().__init__()
assert dim % num_heads == 0, f"dim {dim} should be divided by num_heads {num_heads}."
self.dim = dim
self.num_heads = num_heads
head_dim = dim // num_h... | [
"def",
"__init__",
"(",
"self",
",",
"dim",
",",
"num_heads",
"=",
"8",
",",
"qkv_bias",
"=",
"False",
",",
"qk_scale",
"=",
"None",
",",
"attn_drop",
"=",
"0.",
",",
"proj_drop",
"=",
"0.",
",",
"sr_ratio",
"=",
"1",
")",
":",
"super",
"(",
")",
... | https://github.com/huawei-noah/CV-Backbones/blob/03e8cdfe92494a55ddfb11cc875ff2e1c33f91da/tnt_pytorch/pyramid_tnt.py#L115-L134 | ||||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/utils/data_structures/orderedset.py | python | OrderedSet._check_index | (self, idx) | return idx | Check the given index; if it is in the range of the ordered set, and if it is negative return the
corresponding positive index. | Check the given index; if it is in the range of the ordered set, and if it is negative return the
corresponding positive index. | [
"Check",
"the",
"given",
"index",
";",
"if",
"it",
"is",
"in",
"the",
"range",
"of",
"the",
"ordered",
"set",
"and",
"if",
"it",
"is",
"negative",
"return",
"the",
"corresponding",
"positive",
"index",
"."
] | def _check_index(self, idx):
"""
Check the given index; if it is in the range of the ordered set, and if it is negative return the
corresponding positive index.
"""
if not isinstance(idx, int):
raise TypeError("idx should be an integer.")
if idx > len(self._li... | [
"def",
"_check_index",
"(",
"self",
",",
"idx",
")",
":",
"if",
"not",
"isinstance",
"(",
"idx",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"\"idx should be an integer.\"",
")",
"if",
"idx",
">",
"len",
"(",
"self",
".",
"_list",
")",
"or",
"idx"... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/data_structures/orderedset.py#L165-L176 | |
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/config/models.py | python | validate_tag_key | (tag_key, exception_param="tags.X.member.key") | Validates the tag key.
:param tag_key: The tag key to check against.
:param exception_param: The exception parameter to send over to help
format the message. This is to reflect
the difference between the tag and untag APIs.
:return: | Validates the tag key. | [
"Validates",
"the",
"tag",
"key",
"."
] | def validate_tag_key(tag_key, exception_param="tags.X.member.key"):
"""Validates the tag key.
:param tag_key: The tag key to check against.
:param exception_param: The exception parameter to send over to help
format the message. This is to reflect
the... | [
"def",
"validate_tag_key",
"(",
"tag_key",
",",
"exception_param",
"=",
"\"tags.X.member.key\"",
")",
":",
"# Validate that the key length is correct:",
"if",
"len",
"(",
"tag_key",
")",
">",
"128",
":",
"raise",
"TagKeyTooBig",
"(",
"tag_key",
",",
"param",
"=",
... | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/config/models.py#L117-L136 | ||
princewen/leetcode_python | 79e6e760e4d81824c96903e6c996630c24d01932 | sort_by_leetcode/math/easy/7. Reverse Integer.py | python | Solution.reverse | (self, x) | return res if x > 0 else -res | :type x: int
:rtype: int | :type x: int
:rtype: int | [
":",
"type",
"x",
":",
"int",
":",
"rtype",
":",
"int"
] | def reverse(self, x):
"""
:type x: int
:rtype: int
"""
n = x if x > 0 else -x
res = 0
while n:
res = res * 10 + n % 10
n = n / 10
if res > 0x7fffffff:
return 0
return res if x > 0 else -res | [
"def",
"reverse",
"(",
"self",
",",
"x",
")",
":",
"n",
"=",
"x",
"if",
"x",
">",
"0",
"else",
"-",
"x",
"res",
"=",
"0",
"while",
"n",
":",
"res",
"=",
"res",
"*",
"10",
"+",
"n",
"%",
"10",
"n",
"=",
"n",
"/",
"10",
"if",
"res",
">",
... | https://github.com/princewen/leetcode_python/blob/79e6e760e4d81824c96903e6c996630c24d01932/sort_by_leetcode/math/easy/7. Reverse Integer.py#L23-L35 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/experimental/splitbrain.py | python | RemoteModule.__delattr__ | (self, name, val) | return setattr(self.__currmod__, name, val) | [] | def __delattr__(self, name, val):
return setattr(self.__currmod__, name, val) | [
"def",
"__delattr__",
"(",
"self",
",",
"name",
",",
"val",
")",
":",
"return",
"setattr",
"(",
"self",
".",
"__currmod__",
",",
"name",
",",
"val",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/rpyc/experimental/splitbrain.py#L109-L110 | |||
ipython/ipython | c0abea7a6dfe52c1f74c9d0387d4accadba7cc14 | IPython/terminal/debugger.py | python | TerminalPdb.cmdloop | (self, intro=None) | Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
override the same methods from cmd.Cmd to provide prompt toolkit replacement. | Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument. | [
"Repeatedly",
"issue",
"a",
"prompt",
"accept",
"input",
"parse",
"an",
"initial",
"prefix",
"off",
"the",
"received",
"input",
"and",
"dispatch",
"to",
"action",
"methods",
"passing",
"them",
"the",
"remainder",
"of",
"the",
"line",
"as",
"argument",
"."
] | def cmdloop(self, intro=None):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
override the same methods from cmd.Cmd to provide prompt toolkit replacement.
... | [
"def",
"cmdloop",
"(",
"self",
",",
"intro",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"use_rawinput",
":",
"raise",
"ValueError",
"(",
"'Sorry ipdb does not support use_rawinput=False'",
")",
"# In order to make sure that prompt, which uses asyncio doesn't",
"# in... | https://github.com/ipython/ipython/blob/c0abea7a6dfe52c1f74c9d0387d4accadba7cc14/IPython/terminal/debugger.py#L91-L132 | ||
vmware/pyvcloud | d72c615fa41b8ea5ab049a929e18d8ba6460fc59 | pyvcloud/vcd/client.py | python | find_link | (resource, rel, media_type, fail_if_absent=True, name=None) | Returns the link of the specified rel and type in the resource.
:param lxml.objectify.ObjectifiedElement resource: the resource with the
link.
:param RelationType rel: the rel of the desired link.
:param str media_type: media type of content.
:param bool fail_if_absent: if True raise an excepti... | Returns the link of the specified rel and type in the resource. | [
"Returns",
"the",
"link",
"of",
"the",
"specified",
"rel",
"and",
"type",
"in",
"the",
"resource",
"."
] | def find_link(resource, rel, media_type, fail_if_absent=True, name=None):
"""Returns the link of the specified rel and type in the resource.
:param lxml.objectify.ObjectifiedElement resource: the resource with the
link.
:param RelationType rel: the rel of the desired link.
:param str media_type... | [
"def",
"find_link",
"(",
"resource",
",",
"rel",
",",
"media_type",
",",
"fail_if_absent",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"links",
"=",
"get_links",
"(",
"resource",
",",
"rel",
",",
"media_type",
",",
"name",
")",
"num_links",
"=",
"... | https://github.com/vmware/pyvcloud/blob/d72c615fa41b8ea5ab049a929e18d8ba6460fc59/pyvcloud/vcd/client.py#L1809-L1839 | ||
jupyter/nbgrader | 1ae2886e4e734554d8667c6e86861e83cc161451 | nbgrader/api.py | python | Gradebook.find_submission | (self, assignment: str, student: str) | return submission | Find a student's submission for a given assignment.
Parameters
----------
assignment : string
the name of an assignment
student : string
the unique id of a student
Returns
-------
submission : :class:`~nbgrader.api.SubmittedAssignment` | Find a student's submission for a given assignment. | [
"Find",
"a",
"student",
"s",
"submission",
"for",
"a",
"given",
"assignment",
"."
] | def find_submission(self, assignment: str, student: str) -> SubmittedAssignment:
"""Find a student's submission for a given assignment.
Parameters
----------
assignment : string
the name of an assignment
student : string
the unique id of a student
... | [
"def",
"find_submission",
"(",
"self",
",",
"assignment",
":",
"str",
",",
"student",
":",
"str",
")",
"->",
"SubmittedAssignment",
":",
"try",
":",
"submission",
"=",
"self",
".",
"db",
".",
"query",
"(",
"SubmittedAssignment",
")",
".",
"join",
"(",
"A... | https://github.com/jupyter/nbgrader/blob/1ae2886e4e734554d8667c6e86861e83cc161451/nbgrader/api.py#L2283-L2309 | |
ray-project/ray | 703c1610348615dcb8c2d141a0c46675084660f5 | rllib/examples/models/rnn_spy_model.py | python | SpyLayer.spy | (inputs, seq_lens, h_in, c_in, h_out, c_out) | return SpyLayer.output | The actual spy operation: Store inputs in internal_kv. | The actual spy operation: Store inputs in internal_kv. | [
"The",
"actual",
"spy",
"operation",
":",
"Store",
"inputs",
"in",
"internal_kv",
"."
] | def spy(inputs, seq_lens, h_in, c_in, h_out, c_out):
"""The actual spy operation: Store inputs in internal_kv."""
if len(inputs) == 1:
# don't capture inference inputs
return SpyLayer.output
# TF runs this function in an isolated context, so we have to use
# redi... | [
"def",
"spy",
"(",
"inputs",
",",
"seq_lens",
",",
"h_in",
",",
"c_in",
",",
"h_out",
",",
"c_out",
")",
":",
"if",
"len",
"(",
"inputs",
")",
"==",
"1",
":",
"# don't capture inference inputs",
"return",
"SpyLayer",
".",
"output",
"# TF runs this function i... | https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/rllib/examples/models/rnn_spy_model.py#L49-L67 | |
vstinner/hachoir | 8fb142ed4ab8e3603e5b613a75714f79b372b3fe | hachoir/parser/archive/rar.py | python | formatRARVersion | (field) | return "%u.%u" % divmod(field.value, 10) | Decodes the RAR version stored on 1 byte | Decodes the RAR version stored on 1 byte | [
"Decodes",
"the",
"RAR",
"version",
"stored",
"on",
"1",
"byte"
] | def formatRARVersion(field):
"""
Decodes the RAR version stored on 1 byte
"""
return "%u.%u" % divmod(field.value, 10) | [
"def",
"formatRARVersion",
"(",
"field",
")",
":",
"return",
"\"%u.%u\"",
"%",
"divmod",
"(",
"field",
".",
"value",
",",
"10",
")"
] | https://github.com/vstinner/hachoir/blob/8fb142ed4ab8e3603e5b613a75714f79b372b3fe/hachoir/parser/archive/rar.py#L61-L65 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/path.py | python | Path.circle | (cls, center=(0., 0.), radius=1., readonly=False) | return Path(vertices * radius + center, codes, readonly=readonly) | Return a Path representing a circle of a given radius and center.
Parameters
----------
center : pair of floats
The center of the circle. Default ``(0, 0)``.
radius : float
The radius of the circle. Default is 1.
readonly : bool
Whether the cr... | Return a Path representing a circle of a given radius and center. | [
"Return",
"a",
"Path",
"representing",
"a",
"circle",
"of",
"a",
"given",
"radius",
"and",
"center",
"."
] | def circle(cls, center=(0., 0.), radius=1., readonly=False):
"""
Return a Path representing a circle of a given radius and center.
Parameters
----------
center : pair of floats
The center of the circle. Default ``(0, 0)``.
radius : float
The radiu... | [
"def",
"circle",
"(",
"cls",
",",
"center",
"=",
"(",
"0.",
",",
"0.",
")",
",",
"radius",
"=",
"1.",
",",
"readonly",
"=",
"False",
")",
":",
"MAGIC",
"=",
"0.2652031",
"SQRTHALF",
"=",
"np",
".",
"sqrt",
"(",
"0.5",
")",
"MAGIC45",
"=",
"SQRTHA... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/path.py#L717-L785 | |
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/pip/utils/outdated.py | python | pip_version_check | (session) | Check for an update for pip.
Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path. | Check for an update for pip. | [
"Check",
"for",
"an",
"update",
"for",
"pip",
"."
] | def pip_version_check(session):
"""Check for an update for pip.
Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path.
"""
installed_version = get_installed_version("pip")
i... | [
"def",
"pip_version_check",
"(",
"session",
")",
":",
"installed_version",
"=",
"get_installed_version",
"(",
"\"pip\"",
")",
"if",
"installed_version",
"is",
"None",
":",
"return",
"pip_version",
"=",
"packaging_version",
".",
"parse",
"(",
"installed_version",
")"... | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/utils/outdated.py#L95-L162 | ||
getpatchwork/patchwork | 60a7b11d12f9e1a6bd08d787d37066c8d89a52ae | patchwork/management/commands/cron.py | python | Command.handle | (self, *args, **kwargs) | [] | def handle(self, *args, **kwargs):
errors = send_notifications()
for (recipient, error) in errors:
self.stderr.write("Failed sending to %s: %s" %
(recipient.email, error))
expire_notifications() | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"errors",
"=",
"send_notifications",
"(",
")",
"for",
"(",
"recipient",
",",
"error",
")",
"in",
"errors",
":",
"self",
".",
"stderr",
".",
"write",
"(",
"\"Failed sen... | https://github.com/getpatchwork/patchwork/blob/60a7b11d12f9e1a6bd08d787d37066c8d89a52ae/patchwork/management/commands/cron.py#L16-L22 | ||||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/urllib/parse.py | python | splitattr | (url) | return words[0], words[1:] | splitattr('/path;attr1=value1;attr2=value2;...') ->
'/path', ['attr1=value1', 'attr2=value2', ...]. | splitattr('/path;attr1=value1;attr2=value2;...') ->
'/path', ['attr1=value1', 'attr2=value2', ...]. | [
"splitattr",
"(",
"/",
"path",
";",
"attr1",
"=",
"value1",
";",
"attr2",
"=",
"value2",
";",
"...",
")",
"-",
">",
"/",
"path",
"[",
"attr1",
"=",
"value1",
"attr2",
"=",
"value2",
"...",
"]",
"."
] | def splitattr(url):
"""splitattr('/path;attr1=value1;attr2=value2;...') ->
'/path', ['attr1=value1', 'attr2=value2', ...]."""
words = url.split(';')
return words[0], words[1:] | [
"def",
"splitattr",
"(",
"url",
")",
":",
"words",
"=",
"url",
".",
"split",
"(",
"';'",
")",
"return",
"words",
"[",
"0",
"]",
",",
"words",
"[",
"1",
":",
"]"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/urllib/parse.py#L1059-L1063 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_node_system_info.py | python | V1NodeSystemInfo.os_image | (self, os_image) | Sets the os_image of this V1NodeSystemInfo.
OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). # noqa: E501
:param os_image: The os_image of this V1NodeSystemInfo. # noqa: E501
:type: str | Sets the os_image of this V1NodeSystemInfo. | [
"Sets",
"the",
"os_image",
"of",
"this",
"V1NodeSystemInfo",
"."
] | def os_image(self, os_image):
"""Sets the os_image of this V1NodeSystemInfo.
OS Image reported by the node from /etc/os-release (e.g. Debian GNU/Linux 7 (wheezy)). # noqa: E501
:param os_image: The os_image of this V1NodeSystemInfo. # noqa: E501
:type: str
"""
if self... | [
"def",
"os_image",
"(",
"self",
",",
"os_image",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"os_image",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid value for `os_image`, must not be `None`... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_node_system_info.py#L302-L313 | ||
tensorflow/estimator | edb6e18703a0fa00182bcc72a056da6f5ce45e70 | tensorflow_estimator/python/estimator/tpu/util.py | python | parse_iterations_per_loop | (iterations_per_loop) | return IterationsPerLoopCounter(value, unit_value) | Parses the `iterations_per_loop` value.
The parser expects the value of the `iterations_per_loop` value to be a
positive integer value with unit:`count` or time-based value `<N><s|m|h>`
where <N> is any positive integer and `s`, `m`, `h` are unit of time in
seconds, minutes, hours respectively. Examples of val... | Parses the `iterations_per_loop` value. | [
"Parses",
"the",
"iterations_per_loop",
"value",
"."
] | def parse_iterations_per_loop(iterations_per_loop):
"""Parses the `iterations_per_loop` value.
The parser expects the value of the `iterations_per_loop` value to be a
positive integer value with unit:`count` or time-based value `<N><s|m|h>`
where <N> is any positive integer and `s`, `m`, `h` are unit of time i... | [
"def",
"parse_iterations_per_loop",
"(",
"iterations_per_loop",
")",
":",
"m",
"=",
"_ITERATIONS_PER_LOOP_VALUE_REGEX",
".",
"match",
"(",
"str",
"(",
"iterations_per_loop",
")",
")",
"if",
"m",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Invalid TPUConfig `ite... | https://github.com/tensorflow/estimator/blob/edb6e18703a0fa00182bcc72a056da6f5ce45e70/tensorflow_estimator/python/estimator/tpu/util.py#L44-L79 | |
polyaxon/polyaxon | e28d82051c2b61a84d06ce4d2388a40fc8565469 | src/core/polyaxon/cli/artifacts.py | python | delete | (ctx, project, version) | Delete a artifact version.
\b
$ polyaxon artifacts delete // delete `latest` in current project
\b
$ polyaxon artifacts delete --project=my-project --version=test-version
\b
$ polyaxon artifacts get -p owner/my-project -ver rc12 | Delete a artifact version.
\b
$ polyaxon artifacts delete // delete `latest` in current project | [
"Delete",
"a",
"artifact",
"version",
".",
"\\",
"b",
"$",
"polyaxon",
"artifacts",
"delete",
"//",
"delete",
"latest",
"in",
"current",
"project"
] | def delete(ctx, project, version):
"""Delete a artifact version.
\b
$ polyaxon artifacts delete // delete `latest` in current project
\b
$ polyaxon artifacts delete --project=my-project --version=test-version
\b
$ polyaxon artifacts get -p owner/my-project -ver rc12
"""
version = ... | [
"def",
"delete",
"(",
"ctx",
",",
"project",
",",
"version",
")",
":",
"version",
"=",
"version",
"or",
"ctx",
".",
"obj",
".",
"get",
"(",
"\"version\"",
")",
"or",
"\"latest\"",
"owner",
",",
"project_name",
"=",
"get_project_or_local",
"(",
"project",
... | https://github.com/polyaxon/polyaxon/blob/e28d82051c2b61a84d06ce4d2388a40fc8565469/src/core/polyaxon/cli/artifacts.py#L207-L227 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/importlib/_bootstrap_external.py | python | cache_from_source | (path, debug_override=None, *, optimization=None) | return _path_join(head, _PYCACHE, filename) | Given the path to a .py file, return the path to its .pyc file.
The .py file does not need to exist; this simply returns the path to the
.pyc file calculated as if the .py file were imported.
The 'optimization' parameter controls the presumed optimization level of
the bytecode file. If 'optimization' ... | Given the path to a .py file, return the path to its .pyc file. | [
"Given",
"the",
"path",
"to",
"a",
".",
"py",
"file",
"return",
"the",
"path",
"to",
"its",
".",
"pyc",
"file",
"."
] | def cache_from_source(path, debug_override=None, *, optimization=None):
"""Given the path to a .py file, return the path to its .pyc file.
The .py file does not need to exist; this simply returns the path to the
.pyc file calculated as if the .py file were imported.
The 'optimization' parameter contro... | [
"def",
"cache_from_source",
"(",
"path",
",",
"debug_override",
"=",
"None",
",",
"*",
",",
"optimization",
"=",
"None",
")",
":",
"if",
"debug_override",
"is",
"not",
"None",
":",
"_warnings",
".",
"warn",
"(",
"'the debug_override parameter is deprecated; use '"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/importlib/_bootstrap_external.py#L412-L480 | |
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | weather/WeatherAnywhereScene-coomlata.py | python | SceneViewer.format_plot_weather | (self, forecast) | return twf, icon_y, y1_y2 | If this is Pythonista 2, and an iPhone 6+ or better there is more screen to work with, as Pythonista recognizes the native screen eesolutions of the iOS device being used. | If this is Pythonista 2, and an iPhone 6+ or better there is more screen to work with, as Pythonista recognizes the native screen eesolutions of the iOS device being used. | [
"If",
"this",
"is",
"Pythonista",
"2",
"and",
"an",
"iPhone",
"6",
"+",
"or",
"better",
"there",
"is",
"more",
"screen",
"to",
"work",
"with",
"as",
"Pythonista",
"recognizes",
"the",
"native",
"screen",
"eesolutions",
"of",
"the",
"iOS",
"device",
"being"... | def format_plot_weather(self, forecast):
'''
If this is Pythonista 2, and an iPhone 6+ or better there is more screen to work with, as Pythonista recognizes the native screen eesolutions of the iOS device being used.
'''
if py_ver == '2' and is_P6:
# Variables to aid in plotting coordinates for te... | [
"def",
"format_plot_weather",
"(",
"self",
",",
"forecast",
")",
":",
"if",
"py_ver",
"==",
"'2'",
"and",
"is_P6",
":",
"# Variables to aid in plotting coordinates for text & icons",
"wrap_len",
"=",
"75",
"icon_y",
"=",
"[",
"-",
"245",
"]",
"y1_y2",
"=",
"[",
... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/weather/WeatherAnywhereScene-coomlata.py#L526-L619 | |
pyparsing/pyparsing | 1ccf846394a055924b810faaf9628dac53633848 | examples/pymicko.py | python | SymbolTable.insert_constant | (self, cname, ctype) | return index | Inserts a constant (or returns index if the constant already exists)
Additionally, checks for range. | Inserts a constant (or returns index if the constant already exists)
Additionally, checks for range. | [
"Inserts",
"a",
"constant",
"(",
"or",
"returns",
"index",
"if",
"the",
"constant",
"already",
"exists",
")",
"Additionally",
"checks",
"for",
"range",
"."
] | def insert_constant(self, cname, ctype):
"""
Inserts a constant (or returns index if the constant already exists)
Additionally, checks for range.
"""
index = self.lookup_symbol(cname, stype=ctype)
if index == None:
num = int(cname)
if ctype == Shar... | [
"def",
"insert_constant",
"(",
"self",
",",
"cname",
",",
"ctype",
")",
":",
"index",
"=",
"self",
".",
"lookup_symbol",
"(",
"cname",
",",
"stype",
"=",
"ctype",
")",
"if",
"index",
"==",
"None",
":",
"num",
"=",
"int",
"(",
"cname",
")",
"if",
"c... | https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/examples/pymicko.py#L534-L553 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | retopoflow/rf/rf_target.py | python | RetopoFlow_Target.select_edge_loop | (self, edge, only=True, **kwargs) | [] | def select_edge_loop(self, edge, only=True, **kwargs):
eloop,connected = self.get_edge_loop(edge)
self.rftarget.select(eloop, only=only, **kwargs) | [
"def",
"select_edge_loop",
"(",
"self",
",",
"edge",
",",
"only",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"eloop",
",",
"connected",
"=",
"self",
".",
"get_edge_loop",
"(",
"edge",
")",
"self",
".",
"rftarget",
".",
"select",
"(",
"eloop",
",... | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rf/rf_target.py#L741-L743 | ||||
uber-research/UPSNet | aa8434e5a721ed217849607815304f68dfd7720a | lib/nn/optimizer.py | python | SGD.step | (self, lr, closure=None) | return loss | Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss. | Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss. | [
"Performs",
"a",
"single",
"optimization",
"step",
".",
"Arguments",
":",
"closure",
"(",
"callable",
"optional",
")",
":",
"A",
"closure",
"that",
"reevaluates",
"the",
"model",
"and",
"returns",
"the",
"loss",
"."
] | def step(self, lr, closure=None):
"""Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
loss = None
if closure is not None:
loss = closure()
... | [
"def",
"step",
"(",
"self",
",",
"lr",
",",
"closure",
"=",
"None",
")",
":",
"loss",
"=",
"None",
"if",
"closure",
"is",
"not",
"None",
":",
"loss",
"=",
"closure",
"(",
")",
"for",
"group",
"in",
"self",
".",
"param_groups",
":",
"weight_decay",
... | https://github.com/uber-research/UPSNet/blob/aa8434e5a721ed217849607815304f68dfd7720a/lib/nn/optimizer.py#L70-L106 | |
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | addon_common/common/utils.py | python | kwargopts | (kwargs, defvals=None, **mykwargs) | return factory() | [] | def kwargopts(kwargs, defvals=None, **mykwargs):
opts = defvals.copy() if defvals else {}
opts.update(mykwargs)
opts.update(kwargs)
if 'opts' in kwargs: opts.update(opts['opts'])
def factory():
class Opts():
''' pretend to be a dictionary, but also add . access fns '''
... | [
"def",
"kwargopts",
"(",
"kwargs",
",",
"defvals",
"=",
"None",
",",
"*",
"*",
"mykwargs",
")",
":",
"opts",
"=",
"defvals",
".",
"copy",
"(",
")",
"if",
"defvals",
"else",
"{",
"}",
"opts",
".",
"update",
"(",
"mykwargs",
")",
"opts",
".",
"update... | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/addon_common/common/utils.py#L220-L248 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-0.96/django/core/servers/basehttp.py | python | ServerHandler.start_response | (self, status, headers,exc_info=None) | return self.write | start_response()' callable as specified by PEP 333 | start_response()' callable as specified by PEP 333 | [
"start_response",
"()",
"callable",
"as",
"specified",
"by",
"PEP",
"333"
] | def start_response(self, status, headers,exc_info=None):
"""'start_response()' callable as specified by PEP 333"""
if exc_info:
try:
if self.headers_sent:
# Re-raise original exception if headers sent
raise exc_info[0], exc_info[1], ex... | [
"def",
"start_response",
"(",
"self",
",",
"status",
",",
"headers",
",",
"exc_info",
"=",
"None",
")",
":",
"if",
"exc_info",
":",
"try",
":",
"if",
"self",
".",
"headers_sent",
":",
"# Re-raise original exception if headers sent",
"raise",
"exc_info",
"[",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-0.96/django/core/servers/basehttp.py#L342-L366 | |
snare/binjatron | 4bbff5c4fa489a6718037126e2ea46816875e268 | __init__.py | python | _get_function | (view, address) | return func | [] | def _get_function(view, address):
func = view.get_function_at(address)
if func is None:
return view.get_function_at(view.get_previous_function_start_before(address))
return func | [
"def",
"_get_function",
"(",
"view",
",",
"address",
")",
":",
"func",
"=",
"view",
".",
"get_function_at",
"(",
"address",
")",
"if",
"func",
"is",
"None",
":",
"return",
"view",
".",
"get_function_at",
"(",
"view",
".",
"get_previous_function_start_before",
... | https://github.com/snare/binjatron/blob/4bbff5c4fa489a6718037126e2ea46816875e268/__init__.py#L42-L46 | |||
9miao/Firefly | fd2795b8c26de6ab63bbec23d11f18c3dfb39a50 | firefly/dbentrust/util.py | python | DeleteFromDB | (tablename,props) | return bool(count) | 从数据库中删除 | 从数据库中删除 | [
"从数据库中删除"
] | def DeleteFromDB(tablename,props):
'''从数据库中删除
'''
prers = FormatCondition(props)
sql = """DELETE FROM %s WHERE %s ;"""%(tablename,prers)
conn = dbpool.connection()
cursor = conn.cursor()
count = 0
try:
count = cursor.execute(sql)
conn.commit()
except Exception,e:
... | [
"def",
"DeleteFromDB",
"(",
"tablename",
",",
"props",
")",
":",
"prers",
"=",
"FormatCondition",
"(",
"props",
")",
"sql",
"=",
"\"\"\"DELETE FROM %s WHERE %s ;\"\"\"",
"%",
"(",
"tablename",
",",
"prers",
")",
"conn",
"=",
"dbpool",
".",
"connection",
"(",
... | https://github.com/9miao/Firefly/blob/fd2795b8c26de6ab63bbec23d11f18c3dfb39a50/firefly/dbentrust/util.py#L119-L135 | |
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/fb/roster.py | python | SquadPlayer.penalty_kicks_saved | (self) | return self._penalty_kicks_saved | Returns an ``int`` of the number of penalty kicks a keeper has saved
during regular play. | Returns an ``int`` of the number of penalty kicks a keeper has saved
during regular play. | [
"Returns",
"an",
"int",
"of",
"the",
"number",
"of",
"penalty",
"kicks",
"a",
"keeper",
"has",
"saved",
"during",
"regular",
"play",
"."
] | def penalty_kicks_saved(self):
"""
Returns an ``int`` of the number of penalty kicks a keeper has saved
during regular play.
"""
return self._penalty_kicks_saved | [
"def",
"penalty_kicks_saved",
"(",
"self",
")",
":",
"return",
"self",
".",
"_penalty_kicks_saved"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/fb/roster.py#L726-L731 | |
chb/indivo_server | 9826c67ab17d7fc0df935db327344fb0c7d237e5 | indivo/migrations/0021_old_problems_to_smart_problems.py | python | Migration.forwards | (self, orm) | Write your forwards methods here. | Write your forwards methods here. | [
"Write",
"your",
"forwards",
"methods",
"here",
"."
] | def forwards(self, orm):
"Write your forwards methods here."
for p in orm.Problem.objects.all():
p.startDate = p.date_onset
p.endDate = p.date_resolution
p.name_identifier = p.name_value
p.name_system = p.name_type
p.name_title = p.name
... | [
"def",
"forwards",
"(",
"self",
",",
"orm",
")",
":",
"for",
"p",
"in",
"orm",
".",
"Problem",
".",
"objects",
".",
"all",
"(",
")",
":",
"p",
".",
"startDate",
"=",
"p",
".",
"date_onset",
"p",
".",
"endDate",
"=",
"p",
".",
"date_resolution",
"... | https://github.com/chb/indivo_server/blob/9826c67ab17d7fc0df935db327344fb0c7d237e5/indivo/migrations/0021_old_problems_to_smart_problems.py#L9-L18 | ||
FuYanzhe2/Name-Entity-Recognition | 598b264262d667257c9e26646c49df45f7d76547 | BERT-BiLSTM-CRF-NER/bert/run_squad.py | python | get_final_text | (pred_text, orig_text, do_lower_case) | return output_text | Project the tokenized prediction back to the original text. | Project the tokenized prediction back to the original text. | [
"Project",
"the",
"tokenized",
"prediction",
"back",
"to",
"the",
"original",
"text",
"."
] | def get_final_text(pred_text, orig_text, do_lower_case):
"""Project the tokenized prediction back to the original text."""
# When we created the data, we kept track of the alignment between original
# (whitespace tokenized) tokens and our WordPiece tokenized tokens. So
# now `orig_text` contains the span of ou... | [
"def",
"get_final_text",
"(",
"pred_text",
",",
"orig_text",
",",
"do_lower_case",
")",
":",
"# When we created the data, we kept track of the alignment between original",
"# (whitespace tokenized) tokens and our WordPiece tokenized tokens. So",
"# now `orig_text` contains the span of our or... | https://github.com/FuYanzhe2/Name-Entity-Recognition/blob/598b264262d667257c9e26646c49df45f7d76547/BERT-BiLSTM-CRF-NER/bert/run_squad.py#L926-L1019 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.