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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | pagure/lib/notify.py | python | _fullname_to_url | (fullname) | return fullname | For forked projects, fullname is 'forks/user/...' but URL is
'fork/user/...'. This is why we can't have nice things. | For forked projects, fullname is 'forks/user/...' but URL is
'fork/user/...'. This is why we can't have nice things. | [
"For",
"forked",
"projects",
"fullname",
"is",
"forks",
"/",
"user",
"/",
"...",
"but",
"URL",
"is",
"fork",
"/",
"user",
"/",
"...",
".",
"This",
"is",
"why",
"we",
"can",
"t",
"have",
"nice",
"things",
"."
] | def _fullname_to_url(fullname):
"""For forked projects, fullname is 'forks/user/...' but URL is
'fork/user/...'. This is why we can't have nice things.
"""
if fullname.startswith("forks/"):
fullname = fullname.replace("forks", "fork", 1)
return fullname | [
"def",
"_fullname_to_url",
"(",
"fullname",
")",
":",
"if",
"fullname",
".",
"startswith",
"(",
"\"forks/\"",
")",
":",
"fullname",
"=",
"fullname",
".",
"replace",
"(",
"\"forks\"",
",",
"\"fork\"",
",",
"1",
")",
"return",
"fullname"
] | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/lib/notify.py#L393-L399 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py | python | rec_drop_fields | (rec, names) | return newrec | Return a new numpy record array with fields in *names* dropped. | Return a new numpy record array with fields in *names* dropped. | [
"Return",
"a",
"new",
"numpy",
"record",
"array",
"with",
"fields",
"in",
"*",
"names",
"*",
"dropped",
"."
] | def rec_drop_fields(rec, names):
"""
Return a new numpy record array with fields in *names* dropped.
"""
names = set(names)
newdtype = np.dtype([(name, rec.dtype[name]) for name in rec.dtype.names
if name not in names])
newrec = np.recarray(rec.shape, dtype=newdtype)
... | [
"def",
"rec_drop_fields",
"(",
"rec",
",",
"names",
")",
":",
"names",
"=",
"set",
"(",
"names",
")",
"newdtype",
"=",
"np",
".",
"dtype",
"(",
"[",
"(",
"name",
",",
"rec",
".",
"dtype",
"[",
"name",
"]",
")",
"for",
"name",
"in",
"rec",
".",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/mlab.py#L2360-L2374 | |
JBakamovic/cxxd | 142c19649b036bd6f6bdcd4684de735ea11a6c94 | services/source_code_model/indexer/symbol_database.py | python | SymbolDatabase.__del__ | (self) | [] | def __del__(self):
if self.db_connection:
try:
self.db_connection.close()
except:
logging.error(sys.exc_info()) | [
"def",
"__del__",
"(",
"self",
")",
":",
"if",
"self",
".",
"db_connection",
":",
"try",
":",
"self",
".",
"db_connection",
".",
"close",
"(",
")",
"except",
":",
"logging",
".",
"error",
"(",
"sys",
".",
"exc_info",
"(",
")",
")"
] | https://github.com/JBakamovic/cxxd/blob/142c19649b036bd6f6bdcd4684de735ea11a6c94/services/source_code_model/indexer/symbol_database.py#L25-L30 | ||||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/xlsxwriter/chart.py | python | Chart.__init__ | (self, options=None) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self, options=None):
"""
Constructor.
"""
super(Chart, self).__init__()
self.subtype = None
self.sheet_type = 0x0200
self.orientation = 0x0
self.series = []
self.embedded = 0
self.id = -1
self.series_index = 0
... | [
"def",
"__init__",
"(",
"self",
",",
"options",
"=",
"None",
")",
":",
"super",
"(",
"Chart",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"subtype",
"=",
"None",
"self",
".",
"sheet_type",
"=",
"0x0200",
"self",
".",
"orientation",
"=",... | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/xlsxwriter/chart.py#L34-L105 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_5.9/paramiko/auth_handler.py | python | AuthHandler._disconnect_service_not_available | (self) | [] | def _disconnect_service_not_available(self):
m = Message()
m.add_byte(chr(MSG_DISCONNECT))
m.add_int(DISCONNECT_SERVICE_NOT_AVAILABLE)
m.add_string('Service not available')
m.add_string('en')
self.transport._send_message(m)
self.transport.close() | [
"def",
"_disconnect_service_not_available",
"(",
"self",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"chr",
"(",
"MSG_DISCONNECT",
")",
")",
"m",
".",
"add_int",
"(",
"DISCONNECT_SERVICE_NOT_AVAILABLE",
")",
"m",
".",
"add_string",
"(... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/paramiko/auth_handler.py#L126-L133 | ||||
CenterForOpenScience/osf.io | cc02691be017e61e2cd64f19b848b2f4c18dcc84 | framework/utils.py | python | iso8601format | (dt) | return dt.strftime('%Y-%m-%dT%H:%M:%SZ') if dt else '' | Given a datetime object, return an associated ISO-8601 string | Given a datetime object, return an associated ISO-8601 string | [
"Given",
"a",
"datetime",
"object",
"return",
"an",
"associated",
"ISO",
"-",
"8601",
"string"
] | def iso8601format(dt):
"""Given a datetime object, return an associated ISO-8601 string"""
return dt.strftime('%Y-%m-%dT%H:%M:%SZ') if dt else '' | [
"def",
"iso8601format",
"(",
"dt",
")",
":",
"return",
"dt",
".",
"strftime",
"(",
"'%Y-%m-%dT%H:%M:%SZ'",
")",
"if",
"dt",
"else",
"''"
] | https://github.com/CenterForOpenScience/osf.io/blob/cc02691be017e61e2cd64f19b848b2f4c18dcc84/framework/utils.py#L10-L12 | |
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/actions/check.py | python | CobblerCheck.check_yum | (self, status) | Check if the yum-stack is available. On Debian based distros this will always return without checking.
:param status: The status list with possible problems. | Check if the yum-stack is available. On Debian based distros this will always return without checking. | [
"Check",
"if",
"the",
"yum",
"-",
"stack",
"is",
"available",
".",
"On",
"Debian",
"based",
"distros",
"this",
"will",
"always",
"return",
"without",
"checking",
"."
] | def check_yum(self, status):
"""
Check if the yum-stack is available. On Debian based distros this will always return without checking.
:param status: The status list with possible problems.
"""
# FIXME: Replace this with calls which check for the path of these tools.
if... | [
"def",
"check_yum",
"(",
"self",
",",
"status",
")",
":",
"# FIXME: Replace this with calls which check for the path of these tools.",
"if",
"self",
".",
"checked_family",
"==",
"\"debian\"",
":",
"return",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"\"/usr... | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/actions/check.py#L185-L209 | ||
marinho/geraldo | 868ebdce67176d9b6205cddc92476f642c783fff | site/newsite/site-geraldo/django/contrib/auth/models.py | python | UserManager.make_random_password | (self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') | return ''.join([choice(allowed_chars) for i in range(length)]) | Generates a random password with the given length and given allowed_chars | Generates a random password with the given length and given allowed_chars | [
"Generates",
"a",
"random",
"password",
"with",
"the",
"given",
"length",
"and",
"given",
"allowed_chars"
] | def make_random_password(self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
"Generates a random password with the given length and given allowed_chars"
# Note that default value of allowed_chars does not have "I" or letters
# that look like it -- just to a... | [
"def",
"make_random_password",
"(",
"self",
",",
"length",
"=",
"10",
",",
"allowed_chars",
"=",
"'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'",
")",
":",
"# Note that default value of allowed_chars does not have \"I\" or letters",
"# that look like it -- just to avoid con... | https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/contrib/auth/models.py#L124-L129 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/boto_apigateway.py | python | delete_api | (name, description=None, region=None, key=None, keyid=None, profile=None) | Delete all REST API Service with the given name and an optional API description
Returns {deleted: True, count: deleted_count} if apis were deleted, and
returns {deleted: False} if error or not found.
CLI Example:
.. code-block:: bash
salt myminion boto_apigateway.delete_api myapi_name
... | Delete all REST API Service with the given name and an optional API description | [
"Delete",
"all",
"REST",
"API",
"Service",
"with",
"the",
"given",
"name",
"and",
"an",
"optional",
"API",
"description"
] | def delete_api(name, description=None, region=None, key=None, keyid=None, profile=None):
"""
Delete all REST API Service with the given name and an optional API description
Returns {deleted: True, count: deleted_count} if apis were deleted, and
returns {deleted: False} if error or not found.
CLI E... | [
"def",
"delete_api",
"(",
"name",
",",
"description",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn_params",
"=",
"dict",
"(",
"region",
"=",
"r... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/boto_apigateway.py#L280-L308 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/lib2to3/fixes/fix_operator.py | python | FixOperator._repeat | (self, node, results) | return self._handle_rename(node, results, "mul") | [] | def _repeat(self, node, results):
return self._handle_rename(node, results, "mul") | [
"def",
"_repeat",
"(",
"self",
",",
"node",
",",
"results",
")",
":",
"return",
"self",
".",
"_handle_rename",
"(",
"node",
",",
"results",
",",
"\"mul\"",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/lib2to3/fixes/fix_operator.py#L58-L59 | |||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/plugins/dbms/postgresql/connector.py | python | Connector.__init__ | (self) | [] | def __init__(self):
GenericConnector.__init__(self) | [
"def",
"__init__",
"(",
"self",
")",
":",
"GenericConnector",
".",
"__init__",
"(",
"self",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/plugins/dbms/postgresql/connector.py#L31-L32 | ||||
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/Crypto/Util/number.py | python | bytes_to_long | (s) | return acc | bytes_to_long(string) : long
Convert a byte string to a long integer.
This is (essentially) the inverse of long_to_bytes(). | bytes_to_long(string) : long
Convert a byte string to a long integer. | [
"bytes_to_long",
"(",
"string",
")",
":",
"long",
"Convert",
"a",
"byte",
"string",
"to",
"a",
"long",
"integer",
"."
] | def bytes_to_long(s):
"""bytes_to_long(string) : long
Convert a byte string to a long integer.
This is (essentially) the inverse of long_to_bytes().
"""
acc = 0L
unpack = struct.unpack
length = len(s)
if length % 4:
extra = (4 - length % 4)
s = b('\000') * extra + s
... | [
"def",
"bytes_to_long",
"(",
"s",
")",
":",
"acc",
"=",
"0L",
"unpack",
"=",
"struct",
".",
"unpack",
"length",
"=",
"len",
"(",
"s",
")",
"if",
"length",
"%",
"4",
":",
"extra",
"=",
"(",
"4",
"-",
"length",
"%",
"4",
")",
"s",
"=",
"b",
"("... | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/Crypto/Util/number.py#L417-L432 | |
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/plugins/shortcuts/plugin.py | python | Shortcuts.reset_shortcuts | (self) | Reset shrotcuts. | Reset shrotcuts. | [
"Reset",
"shrotcuts",
"."
] | def reset_shortcuts(self):
"""Reset shrotcuts."""
if self._conf:
self._conf.reset_shortcuts() | [
"def",
"reset_shortcuts",
"(",
"self",
")",
":",
"if",
"self",
".",
"_conf",
":",
"self",
".",
"_conf",
".",
"reset_shortcuts",
"(",
")"
] | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/shortcuts/plugin.py#L127-L130 | ||
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/TimeVar.py | python | TimeVar.__eq__ | (self, other) | return other == self.now() | [] | def __eq__(self, other):
return other == self.now() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"other",
"==",
"self",
".",
"now",
"(",
")"
] | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/TimeVar.py#L447-L448 | |||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/gpsd/sensor.py | python | GpsdSensor.native_value | (self) | return None | Return the state of GPSD. | Return the state of GPSD. | [
"Return",
"the",
"state",
"of",
"GPSD",
"."
] | def native_value(self):
"""Return the state of GPSD."""
if self.agps_thread.data_stream.mode == 3:
return "3D Fix"
if self.agps_thread.data_stream.mode == 2:
return "2D Fix"
return None | [
"def",
"native_value",
"(",
"self",
")",
":",
"if",
"self",
".",
"agps_thread",
".",
"data_stream",
".",
"mode",
"==",
"3",
":",
"return",
"\"3D Fix\"",
"if",
"self",
".",
"agps_thread",
".",
"data_stream",
".",
"mode",
"==",
"2",
":",
"return",
"\"2D Fi... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/gpsd/sensor.py#L97-L103 | |
zatosource/zato | 2a9d273f06f9d776fbfeb53e73855af6e40fa208 | code/zato-server/src/zato/server/pubsub/__init__.py | python | PubSub.get_non_gd_topic_depth | (self, topic_name:'str') | Returns of non-GD messages for a given topic by its name. | Returns of non-GD messages for a given topic by its name. | [
"Returns",
"of",
"non",
"-",
"GD",
"messages",
"for",
"a",
"given",
"topic",
"by",
"its",
"name",
"."
] | def get_non_gd_topic_depth(self, topic_name:'str') -> 'int':
""" Returns of non-GD messages for a given topic by its name.
"""
with self.lock:
return self.sync_backlog.get_topic_depth(self._get_topic_id_by_name(topic_name)) | [
"def",
"get_non_gd_topic_depth",
"(",
"self",
",",
"topic_name",
":",
"'str'",
")",
"->",
"'int'",
":",
"with",
"self",
".",
"lock",
":",
"return",
"self",
".",
"sync_backlog",
".",
"get_topic_depth",
"(",
"self",
".",
"_get_topic_id_by_name",
"(",
"topic_name... | https://github.com/zatosource/zato/blob/2a9d273f06f9d776fbfeb53e73855af6e40fa208/code/zato-server/src/zato/server/pubsub/__init__.py#L496-L500 | ||
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | parl/algorithms/fluid/ddpg.py | python | DDPG.predict | (self, obs) | return self.model.policy(obs) | use actor model of self.model to predict the action | use actor model of self.model to predict the action | [
"use",
"actor",
"model",
"of",
"self",
".",
"model",
"to",
"predict",
"the",
"action"
] | def predict(self, obs):
""" use actor model of self.model to predict the action
"""
return self.model.policy(obs) | [
"def",
"predict",
"(",
"self",
",",
"obs",
")",
":",
"return",
"self",
".",
"model",
".",
"policy",
"(",
"obs",
")"
] | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/parl/algorithms/fluid/ddpg.py#L55-L58 | |
dropbox/securitybot | 8cc4846602011db396df621d2e84e5808a6f3441 | securitybot/bot.py | python | SecurityBot.valid_user | (self, username) | Validates a username to be valid. | Validates a username to be valid. | [
"Validates",
"a",
"username",
"to",
"be",
"valid",
"."
] | def valid_user(self, username):
# type: (str) -> bool
'''
Validates a username to be valid.
'''
if len(username.split()) != 1:
return False
try:
self.user_lookup_by_name(username)
return True
except SecurityBotException as e:
... | [
"def",
"valid_user",
"(",
"self",
",",
"username",
")",
":",
"# type: (str) -> bool",
"if",
"len",
"(",
"username",
".",
"split",
"(",
")",
")",
"!=",
"1",
":",
"return",
"False",
"try",
":",
"self",
".",
"user_lookup_by_name",
"(",
"username",
")",
"ret... | https://github.com/dropbox/securitybot/blob/8cc4846602011db396df621d2e84e5808a6f3441/securitybot/bot.py#L218-L230 | ||
eliben/pycparser | 7999dde25706e8a2b4bc63634b058d79bdb6417f | pycparser/c_generator.py | python | CGenerator._is_simple_node | (self, n) | return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
c_ast.StructRef, c_ast.FuncCall)) | Returns True for nodes that are "simple" - i.e. nodes that always
have higher precedence than operators. | Returns True for nodes that are "simple" - i.e. nodes that always
have higher precedence than operators. | [
"Returns",
"True",
"for",
"nodes",
"that",
"are",
"simple",
"-",
"i",
".",
"e",
".",
"nodes",
"that",
"always",
"have",
"higher",
"precedence",
"than",
"operators",
"."
] | def _is_simple_node(self, n):
""" Returns True for nodes that are "simple" - i.e. nodes that always
have higher precedence than operators.
"""
return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
c_ast.StructRef, c_ast.FuncCall)) | [
"def",
"_is_simple_node",
"(",
"self",
",",
"n",
")",
":",
"return",
"isinstance",
"(",
"n",
",",
"(",
"c_ast",
".",
"Constant",
",",
"c_ast",
".",
"ID",
",",
"c_ast",
".",
"ArrayRef",
",",
"c_ast",
".",
"StructRef",
",",
"c_ast",
".",
"FuncCall",
")... | https://github.com/eliben/pycparser/blob/7999dde25706e8a2b4bc63634b058d79bdb6417f/pycparser/c_generator.py#L497-L502 | |
nerdvegas/rez | d392c65bf63b4bca8106f938cec49144ba54e770 | src/rez/vendor/pika/adapters/utils/selector_ioloop_adapter.py | python | AbstractSelectorIOLoop.READ | (self) | The value of the I/O loop's READ flag; READ/WRITE/ERROR may be used
with bitwise operators as expected.
Implementation note: the implementations can simply replace these
READ/WRITE/ERROR properties with class-level attributes | The value of the I/O loop's READ flag; READ/WRITE/ERROR may be used
with bitwise operators as expected. | [
"The",
"value",
"of",
"the",
"I",
"/",
"O",
"loop",
"s",
"READ",
"flag",
";",
"READ",
"/",
"WRITE",
"/",
"ERROR",
"may",
"be",
"used",
"with",
"bitwise",
"operators",
"as",
"expected",
"."
] | def READ(self): # pylint: disable=C0103
"""The value of the I/O loop's READ flag; READ/WRITE/ERROR may be used
with bitwise operators as expected.
Implementation note: the implementations can simply replace these
READ/WRITE/ERROR properties with class-level attributes
""" | [
"def",
"READ",
"(",
"self",
")",
":",
"# pylint: disable=C0103"
] | https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pika/adapters/utils/selector_ioloop_adapter.py#L30-L37 | ||
lepture/authlib | 2284f751a47474da7d127303e0d8f34d9046c310 | authlib/integrations/base_client/sync_app.py | python | OAuth1Mixin.create_authorization_url | (self, redirect_uri=None, **kwargs) | return {'url': url, 'request_token': request_token, 'state': state} | Generate the authorization url and state for HTTP redirect.
:param redirect_uri: Callback or redirect URI for authorization.
:param kwargs: Extra parameters to include.
:return: dict | Generate the authorization url and state for HTTP redirect. | [
"Generate",
"the",
"authorization",
"url",
"and",
"state",
"for",
"HTTP",
"redirect",
"."
] | def create_authorization_url(self, redirect_uri=None, **kwargs):
"""Generate the authorization url and state for HTTP redirect.
:param redirect_uri: Callback or redirect URI for authorization.
:param kwargs: Extra parameters to include.
:return: dict
"""
if not self.auth... | [
"def",
"create_authorization_url",
"(",
"self",
",",
"redirect_uri",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"authorize_url",
":",
"raise",
"RuntimeError",
"(",
"'Missing \"authorize_url\" value'",
")",
"if",
"self",
".",
"aut... | https://github.com/lepture/authlib/blob/2284f751a47474da7d127303e0d8f34d9046c310/authlib/integrations/base_client/sync_app.py#L130-L150 | |
geopy/geopy | af0eedcfeb4e3eec88f19e2f822e7f14ac3468eb | geopy/geocoders/here.py | python | HereV7.reverse | (
self,
query,
*,
language=None,
limit=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL
) | return self._call_geocoder(url, callback, timeout=timeout) | Return an address by location point.
:param query: The coordinates for which you wish to obtain the
closest human-readable addresses.
:type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.
:pa... | Return an address by location point. | [
"Return",
"an",
"address",
"by",
"location",
"point",
"."
] | def reverse(
self,
query,
*,
language=None,
limit=None,
exactly_one=True,
timeout=DEFAULT_SENTINEL
):
"""
Return an address by location point.
:param query: The coordinates for which you wish to obtain the
... | [
"def",
"reverse",
"(",
"self",
",",
"query",
",",
"*",
",",
"language",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"exactly_one",
"=",
"True",
",",
"timeout",
"=",
"DEFAULT_SENTINEL",
")",
":",
"params",
"=",
"{",
"'at'",
":",
"self",
".",
"_coerce... | https://github.com/geopy/geopy/blob/af0eedcfeb4e3eec88f19e2f822e7f14ac3468eb/geopy/geocoders/here.py#L561-L612 | |
fkie/multimaster_fkie | 3d23df29d25d71a75c66bbd3cc6e9cbb255724d8 | fkie_node_manager/src/fkie_node_manager/launch_list_model.py | python | PathItem.data | (self, role) | The view asks us for all sorts of information about our data...
:param role: the art of the data
:type role: :class:`QtCore.Qt.DisplayRole` <https://srinikom.github.io/pyside-docs/PySide/QtCore/Qt.html>
:see: http://www.pyside.org/docs/pyside-1.0.1/PySide/QtCore/Qt.html | The view asks us for all sorts of information about our data... | [
"The",
"view",
"asks",
"us",
"for",
"all",
"sorts",
"of",
"information",
"about",
"our",
"data",
"..."
] | def data(self, role):
'''
The view asks us for all sorts of information about our data...
:param role: the art of the data
:type role: :class:`QtCore.Qt.DisplayRole` <https://srinikom.github.io/pyside-docs/PySide/QtCore/Qt.html>
:see: http://www.pyside.org/docs/pyside-1.0.1/PySi... | [
"def",
"data",
"(",
"self",
",",
"role",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
":",
"# return the displayed item name",
"if",
"self",
".",
"id",
"==",
"PathItem",
".",
"RECENT_FILE",
"or",
"self",
".",
"id",
"==",
"PathItem",
".",
"RECE... | https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_node_manager/src/fkie_node_manager/launch_list_model.py#L191-L217 | ||
algorhythms/LintCode | 2520762a1cfbd486081583136396a2b2cac6e4fb | Maximal Square.py | python | Solution.maxSquare_error | (self, matrix) | return ret | stack
:param matrix: a matrix of 0 and 1
:return: an integer | stack
:param matrix: a matrix of 0 and 1
:return: an integer | [
"stack",
":",
"param",
"matrix",
":",
"a",
"matrix",
"of",
"0",
"and",
"1",
":",
"return",
":",
"an",
"integer"
] | def maxSquare_error(self, matrix):
"""
stack
:param matrix: a matrix of 0 and 1
:return: an integer
"""
M = len(matrix)
N = len(matrix[0])
h = [[0 for _ in xrange(N+1)] for _ in xrange(M+1)]
for i in xrange(1, M+1):
for j in xrange(1, N... | [
"def",
"maxSquare_error",
"(",
"self",
",",
"matrix",
")",
":",
"M",
"=",
"len",
"(",
"matrix",
")",
"N",
"=",
"len",
"(",
"matrix",
"[",
"0",
"]",
")",
"h",
"=",
"[",
"[",
"0",
"for",
"_",
"in",
"xrange",
"(",
"N",
"+",
"1",
")",
"]",
"for... | https://github.com/algorhythms/LintCode/blob/2520762a1cfbd486081583136396a2b2cac6e4fb/Maximal Square.py#L44-L73 | |
freqtrade/freqtrade | 13651fd3be8d5ce8dcd7c94b920bda4e00b75aca | freqtrade/optimize/hyperopt_loss_calmar.py | python | CalmarHyperOptLoss.hyperopt_loss_function | (
results: DataFrame,
trade_count: int,
min_date: datetime,
max_date: datetime,
config: Dict,
processed: Dict[str, DataFrame],
backtest_stats: Dict[str, Any],
*args,
**kwargs
) | return -calmar_ratio | Objective function, returns smaller number for more optimal results.
Uses Calmar Ratio calculation. | Objective function, returns smaller number for more optimal results. | [
"Objective",
"function",
"returns",
"smaller",
"number",
"for",
"more",
"optimal",
"results",
"."
] | def hyperopt_loss_function(
results: DataFrame,
trade_count: int,
min_date: datetime,
max_date: datetime,
config: Dict,
processed: Dict[str, DataFrame],
backtest_stats: Dict[str, Any],
*args,
**kwargs
) -> float:
"""
Objective f... | [
"def",
"hyperopt_loss_function",
"(",
"results",
":",
"DataFrame",
",",
"trade_count",
":",
"int",
",",
"min_date",
":",
"datetime",
",",
"max_date",
":",
"datetime",
",",
"config",
":",
"Dict",
",",
"processed",
":",
"Dict",
"[",
"str",
",",
"DataFrame",
... | https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/optimize/hyperopt_loss_calmar.py#L25-L63 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/google-api-python-client/apiclient/errors.py | python | UnexpectedBodyError.__init__ | (self, expected, provided) | Constructor for an UnexpectedMethodError. | Constructor for an UnexpectedMethodError. | [
"Constructor",
"for",
"an",
"UnexpectedMethodError",
"."
] | def __init__(self, expected, provided):
"""Constructor for an UnexpectedMethodError."""
super(UnexpectedBodyError, self).__init__(
'Expected: [%s] - Provided: [%s]' % (expected, provided)) | [
"def",
"__init__",
"(",
"self",
",",
"expected",
",",
"provided",
")",
":",
"super",
"(",
"UnexpectedBodyError",
",",
"self",
")",
".",
"__init__",
"(",
"'Expected: [%s] - Provided: [%s]'",
"%",
"(",
"expected",
",",
"provided",
")",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/google-api-python-client/apiclient/errors.py#L120-L123 | ||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/linkers/linkers.py | python | DynamicLinker.build_rpath_args | (self, env: 'Environment', build_dir: str, from_dir: str,
rpath_paths: T.Tuple[str, ...], build_rpath: str,
install_rpath: str) | return ([], set()) | [] | def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
rpath_paths: T.Tuple[str, ...], build_rpath: str,
install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
return ([], set()) | [
"def",
"build_rpath_args",
"(",
"self",
",",
"env",
":",
"'Environment'",
",",
"build_dir",
":",
"str",
",",
"from_dir",
":",
"str",
",",
"rpath_paths",
":",
"T",
".",
"Tuple",
"[",
"str",
",",
"...",
"]",
",",
"build_rpath",
":",
"str",
",",
"install_... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/linkers/linkers.py#L520-L523 | |||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/sns/connection.py | python | SNSConnection.delete_endpoint | (self, endpoint_arn=None) | return self._make_request(action='DeleteEndpoint', params=params) | The `DeleteEndpoint` action, which is idempotent, deletes the
endpoint from SNS. For more information, see `Using Amazon SNS
Mobile Push Notifications`_.
:type endpoint_arn: string
:param endpoint_arn: EndpointArn of endpoint to delete. | The `DeleteEndpoint` action, which is idempotent, deletes the
endpoint from SNS. For more information, see `Using Amazon SNS
Mobile Push Notifications`_. | [
"The",
"DeleteEndpoint",
"action",
"which",
"is",
"idempotent",
"deletes",
"the",
"endpoint",
"from",
"SNS",
".",
"For",
"more",
"information",
"see",
"Using",
"Amazon",
"SNS",
"Mobile",
"Push",
"Notifications",
"_",
"."
] | def delete_endpoint(self, endpoint_arn=None):
"""
The `DeleteEndpoint` action, which is idempotent, deletes the
endpoint from SNS. For more information, see `Using Amazon SNS
Mobile Push Notifications`_.
:type endpoint_arn: string
:param endpoint_arn: EndpointArn of endp... | [
"def",
"delete_endpoint",
"(",
"self",
",",
"endpoint_arn",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"endpoint_arn",
"is",
"not",
"None",
":",
"params",
"[",
"'EndpointArn'",
"]",
"=",
"endpoint_arn",
"return",
"self",
".",
"_make_request",
"(... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/sns/connection.py#L684-L697 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/geopy/point.py | python | Point.from_sequence | (cls, seq) | return cls(*args) | Create and return a new Point instance from any iterable with 0 to
3 elements. The elements, if present, must be latitude, longitude,
and altitude, respectively. | Create and return a new Point instance from any iterable with 0 to
3 elements. The elements, if present, must be latitude, longitude,
and altitude, respectively. | [
"Create",
"and",
"return",
"a",
"new",
"Point",
"instance",
"from",
"any",
"iterable",
"with",
"0",
"to",
"3",
"elements",
".",
"The",
"elements",
"if",
"present",
"must",
"be",
"latitude",
"longitude",
"and",
"altitude",
"respectively",
"."
] | def from_sequence(cls, seq):
"""
Create and return a new Point instance from any iterable with 0 to
3 elements. The elements, if present, must be latitude, longitude,
and altitude, respectively.
"""
args = tuple(islice(seq, 4))
return cls(*args) | [
"def",
"from_sequence",
"(",
"cls",
",",
"seq",
")",
":",
"args",
"=",
"tuple",
"(",
"islice",
"(",
"seq",
",",
"4",
")",
")",
"return",
"cls",
"(",
"*",
"args",
")"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/geopy/point.py#L284-L292 | |
pyvisa/pyvisa | ae8c8b1180851ee4d120bc3527923c944b9623d6 | pyvisa/events.py | python | Event.context | (self) | return c | Access the VISA context used to retrieve attributes.
This is equivalent to the session on a resource. | Access the VISA context used to retrieve attributes. | [
"Access",
"the",
"VISA",
"context",
"used",
"to",
"retrieve",
"attributes",
"."
] | def context(self) -> VISAEventContext:
"""Access the VISA context used to retrieve attributes.
This is equivalent to the session on a resource.
"""
c = self._context
if c is None:
raise errors.InvalidSession()
return c | [
"def",
"context",
"(",
"self",
")",
"->",
"VISAEventContext",
":",
"c",
"=",
"self",
".",
"_context",
"if",
"c",
"is",
"None",
":",
"raise",
"errors",
".",
"InvalidSession",
"(",
")",
"return",
"c"
] | https://github.com/pyvisa/pyvisa/blob/ae8c8b1180851ee4d120bc3527923c944b9623d6/pyvisa/events.py#L97-L106 | |
minerllabs/minerl | 0123527c334c96ebb3f0cf313df1552fa4302691 | minerl/herobraine/hero/handlers/agent/observations/lifestats.py | python | _SaturationObservation.__init__ | (self) | [] | def __init__(self):
super().__init__(hero_keys=['saturation'], univ_keys=['saturation'],
space=spaces.Box(low=0, high=mc.MAX_FOOD_SATURATION, shape=(),
dtype=np.float), default_if_missing=5.0) | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hero_keys",
"=",
"[",
"'saturation'",
"]",
",",
"univ_keys",
"=",
"[",
"'saturation'",
"]",
",",
"space",
"=",
"spaces",
".",
"Box",
"(",
"low",
"=",
"0",
",",
"hig... | https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/hero/handlers/agent/observations/lifestats.py#L105-L108 | ||||
nadineproject/nadine | c41c8ef7ffe18f1853029c97eecc329039b4af6c | doors/hid_control.py | python | HIDDoorController.lock_door | (self) | [] | def lock_door(self):
xml = door_command("lockDoor")
self.__send_xml(xml) | [
"def",
"lock_door",
"(",
"self",
")",
":",
"xml",
"=",
"door_command",
"(",
"\"lockDoor\"",
")",
"self",
".",
"__send_xml",
"(",
"xml",
")"
] | https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/doors/hid_control.py#L190-L192 | ||||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/decompiler/optimization_passes/multi_simplifier.py | python | MultiSimplifierAILEngine._ail_handle_Sub | (self, expr) | return expr | [] | def _ail_handle_Sub(self, expr):
operand_0 = self._expr(expr.operands[0])
operand_1 = self._expr(expr.operands[1])
# x + x = 2*x
if type(operand_0) in [Expr.Convert, Expr.Register]:
if isinstance(operand_1, (Expr.Convert, Expr.Register)):
if operand_0 == ope... | [
"def",
"_ail_handle_Sub",
"(",
"self",
",",
"expr",
")",
":",
"operand_0",
"=",
"self",
".",
"_expr",
"(",
"expr",
".",
"operands",
"[",
"0",
"]",
")",
"operand_1",
"=",
"self",
".",
"_expr",
"(",
"expr",
".",
"operands",
"[",
"1",
"]",
")",
"# x +... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/decompiler/optimization_passes/multi_simplifier.py#L72-L130 | |||
rhiever/TwitterFollowBot | 601a01ea2a745695566af704e215d85a24cb4a28 | TwitterFollowBot/__init__.py | python | TwitterBot.bot_setup | (self, config_file="config.txt") | Reads in the bot configuration file and sets up the bot.
Defaults to config.txt if no configuration file is specified.
If you want to modify the bot configuration, edit your config.txt. | Reads in the bot configuration file and sets up the bot. | [
"Reads",
"in",
"the",
"bot",
"configuration",
"file",
"and",
"sets",
"up",
"the",
"bot",
"."
] | def bot_setup(self, config_file="config.txt"):
"""
Reads in the bot configuration file and sets up the bot.
Defaults to config.txt if no configuration file is specified.
If you want to modify the bot configuration, edit your config.txt.
"""
with open(config... | [
"def",
"bot_setup",
"(",
"self",
",",
"config_file",
"=",
"\"config.txt\"",
")",
":",
"with",
"open",
"(",
"config_file",
",",
"\"r\"",
")",
"as",
"in_file",
":",
"for",
"line",
"in",
"in_file",
":",
"line",
"=",
"line",
".",
"split",
"(",
"\":\"",
")"... | https://github.com/rhiever/TwitterFollowBot/blob/601a01ea2a745695566af704e215d85a24cb4a28/TwitterFollowBot/__init__.py#L69-L133 | ||
TensorVision/TensorVision | d971ed2b7d8fe1c0caf407eb7bdaebc0838e5801 | tensorvision/utils.py | python | load_segmentation_mask | (hypes, gt_image_path) | return gt | Load a segmentation mask from an image.
The mask is an integer array with shape (height, width). The integer values
range from 0 to N-1, where N is the total number of classes.
This requires hypes to have an entry 'classes'. This entry has to be a list
of dictionaries with key `colors`. This key is a ... | Load a segmentation mask from an image. | [
"Load",
"a",
"segmentation",
"mask",
"from",
"an",
"image",
"."
] | def load_segmentation_mask(hypes, gt_image_path):
"""
Load a segmentation mask from an image.
The mask is an integer array with shape (height, width). The integer values
range from 0 to N-1, where N is the total number of classes.
This requires hypes to have an entry 'classes'. This entry has to b... | [
"def",
"load_segmentation_mask",
"(",
"hypes",
",",
"gt_image_path",
")",
":",
"img",
"=",
"scipy",
".",
"misc",
".",
"imread",
"(",
"gt_image_path",
",",
"mode",
"=",
"'RGB'",
")",
"# map colors to classes",
"color2class_dict",
",",
"default_class",
"=",
"get_c... | https://github.com/TensorVision/TensorVision/blob/d971ed2b7d8fe1c0caf407eb7bdaebc0838e5801/tensorvision/utils.py#L578-L653 | |
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/zabbix_api_lib.py | python | ZabbixAPISubClass.universal | (self, **opts) | return opts | [] | def universal(self, **opts):
return opts | [
"def",
"universal",
"(",
"self",
",",
"*",
"*",
"opts",
")",
":",
"return",
"opts"
] | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/zabbix_api_lib.py#L347-L348 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/utils/timezone.py | python | override.__init__ | (self, timezone) | [] | def __init__(self, timezone):
self.timezone = timezone | [
"def",
"__init__",
"(",
"self",
",",
"timezone",
")",
":",
"self",
".",
"timezone",
"=",
"timezone"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/utils/timezone.py#L263-L264 | ||||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/criterion.py | python | XgboostCriterion.node_weight | (self, sum_grad, sum_hess) | return self.truncate(-(self._g_alpha_cmp(sum_grad, self.reg_alpha)) / (sum_hess + self.reg_lambda)) | [] | def node_weight(self, sum_grad, sum_hess):
return self.truncate(-(self._g_alpha_cmp(sum_grad, self.reg_alpha)) / (sum_hess + self.reg_lambda)) | [
"def",
"node_weight",
"(",
"self",
",",
"sum_grad",
",",
"sum_hess",
")",
":",
"return",
"self",
".",
"truncate",
"(",
"-",
"(",
"self",
".",
"_g_alpha_cmp",
"(",
"sum_grad",
",",
"self",
".",
"reg_alpha",
")",
")",
"/",
"(",
"sum_hess",
"+",
"self",
... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/criterion.py#L76-L77 | |||
KunpengLi1994/VSRN | 777ae74326fdb6abe69dbd3911d0e545322520d1 | coco-caption/pycocoevalcap/bleu/bleu_scorer.py | python | cook_refs | (refs, eff=None, n=4) | return (reflen, maxcounts) | Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them. | Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them. | [
"Takes",
"a",
"list",
"of",
"reference",
"sentences",
"for",
"a",
"single",
"segment",
"and",
"returns",
"an",
"object",
"that",
"encapsulates",
"everything",
"that",
"BLEU",
"needs",
"to",
"know",
"about",
"them",
"."
] | def cook_refs(refs, eff=None, n=4): ## lhuang: oracle will call with "average"
'''Takes a list of reference sentences for a single segment
and returns an object that encapsulates everything that BLEU
needs to know about them.'''
reflen = []
maxcounts = {}
for ref in refs:
rl, counts = p... | [
"def",
"cook_refs",
"(",
"refs",
",",
"eff",
"=",
"None",
",",
"n",
"=",
"4",
")",
":",
"## lhuang: oracle will call with \"average\"",
"reflen",
"=",
"[",
"]",
"maxcounts",
"=",
"{",
"}",
"for",
"ref",
"in",
"refs",
":",
"rl",
",",
"counts",
"=",
"pre... | https://github.com/KunpengLi1994/VSRN/blob/777ae74326fdb6abe69dbd3911d0e545322520d1/coco-caption/pycocoevalcap/bleu/bleu_scorer.py#L35-L58 | |
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/interpreter.py | python | Interpreter._add_common_vars | (self, common_scalars, common_arrays) | COMMON: define variables to be preserved on CHAIN. | COMMON: define variables to be preserved on CHAIN. | [
"COMMON",
":",
"define",
"variables",
"to",
"be",
"preserved",
"on",
"CHAIN",
"."
] | def _add_common_vars(self, common_scalars, common_arrays):
"""COMMON: define variables to be preserved on CHAIN."""
common_vars = list(self._parse_common_args(self._program_code))
common_scalars.update(
self._memory.complete_name(name)
for name, brackets in common_vars if... | [
"def",
"_add_common_vars",
"(",
"self",
",",
"common_scalars",
",",
"common_arrays",
")",
":",
"common_vars",
"=",
"list",
"(",
"self",
".",
"_parse_common_args",
"(",
"self",
".",
"_program_code",
")",
")",
"common_scalars",
".",
"update",
"(",
"self",
".",
... | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/interpreter.py#L605-L615 | ||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos.py | python | GCEOS.dbeta_dP_g | (self) | return V_inv*(self.d2V_dTdP_g - dV_dT*dV_dP*V_inv) | r'''Derivative of isobaric expansion coefficient with respect to
pressure for the gas phase, [1/(Pa*K)].
.. math::
\frac{\partial \beta_g}{\partial P} = \frac{\frac{\partial^{2}}
{\partial T\partial P} V{\left (T,P \right )_g}}{V{\left (T,
P \right )_g}} - \frac{\fra... | r'''Derivative of isobaric expansion coefficient with respect to
pressure for the gas phase, [1/(Pa*K)]. | [
"r",
"Derivative",
"of",
"isobaric",
"expansion",
"coefficient",
"with",
"respect",
"to",
"pressure",
"for",
"the",
"gas",
"phase",
"[",
"1",
"/",
"(",
"Pa",
"*",
"K",
")",
"]",
"."
] | def dbeta_dP_g(self):
r'''Derivative of isobaric expansion coefficient with respect to
pressure for the gas phase, [1/(Pa*K)].
.. math::
\frac{\partial \beta_g}{\partial P} = \frac{\frac{\partial^{2}}
{\partial T\partial P} V{\left (T,P \right )_g}}{V{\left (T,
... | [
"def",
"dbeta_dP_g",
"(",
"self",
")",
":",
"V_inv",
"=",
"1.0",
"/",
"self",
".",
"V_g",
"dV_dT",
"=",
"self",
".",
"dV_dT_g",
"dV_dP",
"=",
"self",
".",
"dV_dP_g",
"return",
"V_inv",
"*",
"(",
"self",
".",
"d2V_dTdP_g",
"-",
"dV_dT",
"*",
"dV_dP",
... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos.py#L6739-L6753 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/xml/dom/minidom.py | python | parse | (file, parser=None, bufsize=None) | Parse a file into a DOM by filename or file object. | Parse a file into a DOM by filename or file object. | [
"Parse",
"a",
"file",
"into",
"a",
"DOM",
"by",
"filename",
"or",
"file",
"object",
"."
] | def parse(file, parser=None, bufsize=None):
"""Parse a file into a DOM by filename or file object."""
if parser is None and not bufsize:
from xml.dom import expatbuilder
return expatbuilder.parse(file)
else:
from xml.dom import pulldom
return _do_pulldom_parse(pulldom.parse, ... | [
"def",
"parse",
"(",
"file",
",",
"parser",
"=",
"None",
",",
"bufsize",
"=",
"None",
")",
":",
"if",
"parser",
"is",
"None",
"and",
"not",
"bufsize",
":",
"from",
"xml",
".",
"dom",
"import",
"expatbuilder",
"return",
"expatbuilder",
".",
"parse",
"("... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/xml/dom/minidom.py#L1984-L1992 | ||
cuemacro/findatapy | 8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10 | findatapy/market/ioengine.py | python | IOEngine.read_time_series_cache_from_disk | (self, fname, engine='hdf5', start_date=None, finish_date=None,
db_server=constants.db_server,
db_port=constants.db_port, username=constants.db_username, password=constants.db_password) | return data_frame_list | Reads time series cache from disk in either HDF5 or bcolz
Parameters
----------
fname : str (or list)
file to be read from
engine : str (optional)
'hd5' - reads HDF5 files (default)
'arctic' - reads from Arctic/MongoDB database
'bcolz' - r... | Reads time series cache from disk in either HDF5 or bcolz | [
"Reads",
"time",
"series",
"cache",
"from",
"disk",
"in",
"either",
"HDF5",
"or",
"bcolz"
] | def read_time_series_cache_from_disk(self, fname, engine='hdf5', start_date=None, finish_date=None,
db_server=constants.db_server,
db_port=constants.db_port, username=constants.db_username, password=constants.db_password):
"""Read... | [
"def",
"read_time_series_cache_from_disk",
"(",
"self",
",",
"fname",
",",
"engine",
"=",
"'hdf5'",
",",
"start_date",
"=",
"None",
",",
"finish_date",
"=",
"None",
",",
"db_server",
"=",
"constants",
".",
"db_server",
",",
"db_port",
"=",
"constants",
".",
... | https://github.com/cuemacro/findatapy/blob/8ce72b17cc4dd3e3f53f0ab8adf58b6eeae29c10/findatapy/market/ioengine.py#L563-L720 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/core/compute_management_client.py | python | ComputeManagementClient.softreset_instance_pool | (self, instance_pool_id, **kwargs) | Performs the softreset (ACPI shutdown and power on) action on the specified instance pool,
which performs the action on all the instances in the pool.
Softreset gracefully reboots the instances by sending a shutdown command to the operating systems.
After waiting 15 minutes for the OS to shut d... | Performs the softreset (ACPI shutdown and power on) action on the specified instance pool,
which performs the action on all the instances in the pool. | [
"Performs",
"the",
"softreset",
"(",
"ACPI",
"shutdown",
"and",
"power",
"on",
")",
"action",
"on",
"the",
"specified",
"instance",
"pool",
"which",
"performs",
"the",
"action",
"on",
"all",
"the",
"instances",
"in",
"the",
"pool",
"."
] | def softreset_instance_pool(self, instance_pool_id, **kwargs):
"""
Performs the softreset (ACPI shutdown and power on) action on the specified instance pool,
which performs the action on all the instances in the pool.
Softreset gracefully reboots the instances by sending a shutdown comm... | [
"def",
"softreset_instance_pool",
"(",
"self",
",",
"instance_pool_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/instancePools/{instancePoolId}/actions/softreset\"",
"method",
"=",
"\"POST\"",
"# Don't accept unknown kwargs",
"expected_kwargs",
"=",
"[",... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/compute_management_client.py#L2396-L2491 | ||
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/astroprint/plugin/services/account.py | python | AccountService._onFleetStateChange | (self,event,value) | [] | def _onFleetStateChange(self,event,value):
data = {
'orgId' : value['orgId'],
'groupId' : value['groupId']
}
self.publishEvent('fleet_state_change',data) | [
"def",
"_onFleetStateChange",
"(",
"self",
",",
"event",
",",
"value",
")",
":",
"data",
"=",
"{",
"'orgId'",
":",
"value",
"[",
"'orgId'",
"]",
",",
"'groupId'",
":",
"value",
"[",
"'groupId'",
"]",
"}",
"self",
".",
"publishEvent",
"(",
"'fleet_state_c... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/plugin/services/account.py#L240-L245 | ||||
Project-MONAI/MONAI | 83f8b06372a3803ebe9281300cb794a1f3395018 | versioneer.py | python | write_to_version_file | (filename, versions) | Write the given version number to the given _version.py file. | Write the given version number to the given _version.py file. | [
"Write",
"the",
"given",
"version",
"number",
"to",
"the",
"given",
"_version",
".",
"py",
"file",
"."
] | def write_to_version_file(filename, versions):
"""Write the given version number to the given _version.py file."""
os.unlink(filename)
contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": "))
with open(filename, "w") as f:
f.write(SHORT_VERSION_PY % contents)
print(... | [
"def",
"write_to_version_file",
"(",
"filename",
",",
"versions",
")",
":",
"os",
".",
"unlink",
"(",
"filename",
")",
"contents",
"=",
"json",
".",
"dumps",
"(",
"versions",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"1",
",",
"separators",
"=",... | https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/versioneer.py#L1226-L1233 | ||
obspy/obspy | 0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f | obspy/signal/tf_misfit.py | python | tem | (st1, st2, dt=0.01, fmin=1., fmax=10., nf=100, w0=6, norm='global',
st2_isref=True) | Time-dependent Envelope Misfit
.. seealso:: [Kristekova2009]_, Table 1. and 2.
:param st1: signal 1 of two signals to compare, type numpy.ndarray with
shape (number of components, number of time samples) or (number of
timesamples, ) for single component data
:param st2: signal 2 of two sig... | Time-dependent Envelope Misfit | [
"Time",
"-",
"dependent",
"Envelope",
"Misfit"
] | def tem(st1, st2, dt=0.01, fmin=1., fmax=10., nf=100, w0=6, norm='global',
st2_isref=True):
"""
Time-dependent Envelope Misfit
.. seealso:: [Kristekova2009]_, Table 1. and 2.
:param st1: signal 1 of two signals to compare, type numpy.ndarray with
shape (number of components, number of ... | [
"def",
"tem",
"(",
"st1",
",",
"st2",
",",
"dt",
"=",
"0.01",
",",
"fmin",
"=",
"1.",
",",
"fmax",
"=",
"10.",
",",
"nf",
"=",
"100",
",",
"w0",
"=",
"6",
",",
"norm",
"=",
"'global'",
",",
"st2_isref",
"=",
"True",
")",
":",
"if",
"len",
"... | https://github.com/obspy/obspy/blob/0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f/obspy/signal/tf_misfit.py#L218-L279 | ||
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/third_party/boto/boto/ec2/instance.py | python | Instance.create_image | (self, name, description=None, no_reboot=False,
dry_run=False) | return self.connection.create_image(
self.id,
name,
description,
no_reboot,
dry_run=dry_run
) | Will create an AMI from the instance in the running or stopped
state.
:type name: string
:param name: The name of the new image
:type description: string
:param description: An optional human-readable string describing
the contents and purpose of the... | Will create an AMI from the instance in the running or stopped
state. | [
"Will",
"create",
"an",
"AMI",
"from",
"the",
"instance",
"in",
"the",
"running",
"or",
"stopped",
"state",
"."
] | def create_image(self, name, description=None, no_reboot=False,
dry_run=False):
"""
Will create an AMI from the instance in the running or stopped
state.
:type name: string
:param name: The name of the new image
:type description: string
:pa... | [
"def",
"create_image",
"(",
"self",
",",
"name",
",",
"description",
"=",
"None",
",",
"no_reboot",
"=",
"False",
",",
"dry_run",
"=",
"False",
")",
":",
"return",
"self",
".",
"connection",
".",
"create_image",
"(",
"self",
".",
"id",
",",
"name",
","... | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/ec2/instance.py#L577-L606 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/3rdparty/tvm/python/tvm/contrib/util.py | python | TempDirectory.relpath | (self, name) | return os.path.join(self.temp_dir, name) | Relative path in temp dir
Parameters
----------
name : str
The name of the file.
Returns
-------
path : str
The concatenated path. | Relative path in temp dir | [
"Relative",
"path",
"in",
"temp",
"dir"
] | def relpath(self, name):
"""Relative path in temp dir
Parameters
----------
name : str
The name of the file.
Returns
-------
path : str
The concatenated path.
"""
return os.path.join(self.temp_dir, name) | [
"def",
"relpath",
"(",
"self",
",",
"name",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"temp_dir",
",",
"name",
")"
] | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/3rdparty/tvm/python/tvm/contrib/util.py#L30-L43 | |
BaselAbujamous/clust | 3d3fbd27bf1536798cb347b5f67410c002608630 | clust/scripts/preprocess_data.py | python | autoNormalise | (X) | Automatically normalise dataset X and filter it if needed
:param X: Dataset matrix (numpy array)
:return: array of normalisation codes | Automatically normalise dataset X and filter it if needed | [
"Automatically",
"normalise",
"dataset",
"X",
"and",
"filter",
"it",
"if",
"needed"
] | def autoNormalise(X):
"""
Automatically normalise dataset X and filter it if needed
:param X: Dataset matrix (numpy array)
:return: array of normalisation codes
"""
Xloc = np.array(X)
twosided = np.sum(Xloc < 0) > 0.2 * np.sum(Xloc > 0) # negative values are at least 20% of positive value... | [
"def",
"autoNormalise",
"(",
"X",
")",
":",
"Xloc",
"=",
"np",
".",
"array",
"(",
"X",
")",
"twosided",
"=",
"np",
".",
"sum",
"(",
"Xloc",
"<",
"0",
")",
">",
"0.2",
"*",
"np",
".",
"sum",
"(",
"Xloc",
">",
"0",
")",
"# negative values are at le... | https://github.com/BaselAbujamous/clust/blob/3d3fbd27bf1536798cb347b5f67410c002608630/clust/scripts/preprocess_data.py#L187-L235 | ||
qiime2/qiime2 | 3906f67c70a1321e99e7fc59e79550c2432a8cee | qiime2/metadata/metadata.py | python | Metadata.__eq__ | (self, other) | return (
super().__eq__(other) and
self._columns == other._columns and
self._dataframe.equals(other._dataframe)
) | Determine if this metadata is equal to another.
``Metadata`` objects are equal if their IDs, columns (including column
names, types, and ordering), ID headers, source artifacts, and metadata
values are equal.
Parameters
----------
other : Metadata
Metadata t... | Determine if this metadata is equal to another. | [
"Determine",
"if",
"this",
"metadata",
"is",
"equal",
"to",
"another",
"."
] | def __eq__(self, other):
"""Determine if this metadata is equal to another.
``Metadata`` objects are equal if their IDs, columns (including column
names, types, and ordering), ID headers, source artifacts, and metadata
values are equal.
Parameters
----------
oth... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"(",
"super",
"(",
")",
".",
"__eq__",
"(",
"other",
")",
"and",
"self",
".",
"_columns",
"==",
"other",
".",
"_columns",
"and",
"self",
".",
"_dataframe",
".",
"equals",
"(",
"other",
... | https://github.com/qiime2/qiime2/blob/3906f67c70a1321e99e7fc59e79550c2432a8cee/qiime2/metadata/metadata.py#L472-L498 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/pydoc.py | python | doc | (thing, title='Python Library Documentation: %s', forceload=0,
output=None) | Display text documentation, given an object or a path to an object. | Display text documentation, given an object or a path to an object. | [
"Display",
"text",
"documentation",
"given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"."
] | def doc(thing, title='Python Library Documentation: %s', forceload=0,
output=None):
"""Display text documentation, given an object or a path to an object."""
try:
if output is None:
pager(render_doc(thing, title, forceload))
else:
output.write(render_doc(thing, ti... | [
"def",
"doc",
"(",
"thing",
",",
"title",
"=",
"'Python Library Documentation: %s'",
",",
"forceload",
"=",
"0",
",",
"output",
"=",
"None",
")",
":",
"try",
":",
"if",
"output",
"is",
"None",
":",
"pager",
"(",
"render_doc",
"(",
"thing",
",",
"title",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/pydoc.py#L1669-L1678 | ||
yzhao062/combo | 229d578de498b47ae03cf2580472aceebf8c2766 | combo/models/sklearn_base.py | python | _partition_estimators | (n_estimators, n_jobs) | return n_jobs, n_estimators_per_job.tolist(), [0] + starts.tolist() | Private function used to partition estimators between jobs.
See sklearn/ensemble/base.py for more information. | Private function used to partition estimators between jobs.
See sklearn/ensemble/base.py for more information. | [
"Private",
"function",
"used",
"to",
"partition",
"estimators",
"between",
"jobs",
".",
"See",
"sklearn",
"/",
"ensemble",
"/",
"base",
".",
"py",
"for",
"more",
"information",
"."
] | def _partition_estimators(n_estimators, n_jobs):
"""Private function used to partition estimators between jobs.
See sklearn/ensemble/base.py for more information.
"""
# Compute the number of jobs
n_jobs = min(_get_n_jobs(n_jobs), n_estimators)
# Partition estimators between jobs
n_estimator... | [
"def",
"_partition_estimators",
"(",
"n_estimators",
",",
"n_jobs",
")",
":",
"# Compute the number of jobs",
"n_jobs",
"=",
"min",
"(",
"_get_n_jobs",
"(",
"n_jobs",
")",
",",
"n_estimators",
")",
"# Partition estimators between jobs",
"n_estimators_per_job",
"=",
"(",... | https://github.com/yzhao062/combo/blob/229d578de498b47ae03cf2580472aceebf8c2766/combo/models/sklearn_base.py#L39-L52 | |
elfi-dev/elfi | 07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c | elfi/methods/results.py | python | Sample.__init__ | (self,
method_name,
outputs,
parameter_names,
discrepancy_name=None,
weights=None,
**kwargs) | Initialize result.
Parameters
----------
method_name : string
Name of inference method.
outputs : dict
Dictionary with outputs from the nodes, e.g. samples.
parameter_names : list
Names of the parameter nodes
discrepancy_name : string,... | Initialize result. | [
"Initialize",
"result",
"."
] | def __init__(self,
method_name,
outputs,
parameter_names,
discrepancy_name=None,
weights=None,
**kwargs):
"""Initialize result.
Parameters
----------
method_name : string
Na... | [
"def",
"__init__",
"(",
"self",
",",
"method_name",
",",
"outputs",
",",
"parameter_names",
",",
"discrepancy_name",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Sample",
",",
"self",
")",
".",
"__init__",
... | https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/methods/results.py#L73-L105 | ||
skelsec/pypykatz | dd129ff36e00593d1340776b517f7e749ad8d314 | pypykatz/commons/readers/local/common/kernel32.py | python | MemoryBasicInformation.is_executable | (self) | return self.has_content() and bool(self.Protect & self.EXECUTABLE) | @rtype: bool
@return: C{True} if all pages in this region are executable.
@note: Executable pages are always readable. | [] | def is_executable(self):
"""
@rtype: bool
@return: C{True} if all pages in this region are executable.
@note: Executable pages are always readable.
"""
return self.has_content() and bool(self.Protect & self.EXECUTABLE) | [
"def",
"is_executable",
"(",
"self",
")",
":",
"return",
"self",
".",
"has_content",
"(",
")",
"and",
"bool",
"(",
"self",
".",
"Protect",
"&",
"self",
".",
"EXECUTABLE",
")"
] | https://github.com/skelsec/pypykatz/blob/dd129ff36e00593d1340776b517f7e749ad8d314/pypykatz/commons/readers/local/common/kernel32.py#L283-L289 | ||
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/python/filepath.py | python | IFilePath.isfile | () | @return: C{True} if the file at this file path is a regular file,
C{False} otherwise. | [] | def isfile():
"""
@return: C{True} if the file at this file path is a regular file,
C{False} otherwise.
""" | [
"def",
"isfile",
"(",
")",
":"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/python/filepath.py#L180-L184 | |||
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/io.py | python | IOSample.has_analog_value | (self, io_line) | return io_line in self.__analog_values_map.keys() | Returns whether the given IOLine has an analog value or not.
Returns:
Boolean: `True` if the given IOLine has an analog value, `False`
otherwise. | Returns whether the given IOLine has an analog value or not. | [
"Returns",
"whether",
"the",
"given",
"IOLine",
"has",
"an",
"analog",
"value",
"or",
"not",
"."
] | def has_analog_value(self, io_line):
"""
Returns whether the given IOLine has an analog value or not.
Returns:
Boolean: `True` if the given IOLine has an analog value, `False`
otherwise.
"""
return io_line in self.__analog_values_map.keys() | [
"def",
"has_analog_value",
"(",
"self",
",",
"io_line",
")",
":",
"return",
"io_line",
"in",
"self",
".",
"__analog_values_map",
".",
"keys",
"(",
")"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/io.py#L541-L549 | |
redis/redis-py | 0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7 | redis/commands/search/commands.py | python | SearchCommands.suglen | (self, key) | return self.execute_command(SUGLEN_COMMAND, key) | Return the number of entries in the AutoCompleter index.
For more information https://oss.redis.com/redisearch/master/Commands/#ftsuglen | Return the number of entries in the AutoCompleter index. | [
"Return",
"the",
"number",
"of",
"entries",
"in",
"the",
"AutoCompleter",
"index",
"."
] | def suglen(self, key):
"""
Return the number of entries in the AutoCompleter index.
For more information https://oss.redis.com/redisearch/master/Commands/#ftsuglen
""" # noqa
return self.execute_command(SUGLEN_COMMAND, key) | [
"def",
"suglen",
"(",
"self",
",",
"key",
")",
":",
"# noqa",
"return",
"self",
".",
"execute_command",
"(",
"SUGLEN_COMMAND",
",",
"key",
")"
] | https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/search/commands.py#L721-L727 | |
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Worksheet.py | python | Worksheet.row | (self, indx) | return self.__rows[indx] | [] | def row(self, indx):
if indx not in self.__rows:
if indx in self.__flushed_rows:
raise Exception("Attempt to reuse row index %d of sheet %r after flushing" % (indx, self.__name))
self.__rows[indx] = self.Row(indx, self)
if indx > self.last_used_row:
... | [
"def",
"row",
"(",
"self",
",",
"indx",
")",
":",
"if",
"indx",
"not",
"in",
"self",
".",
"__rows",
":",
"if",
"indx",
"in",
"self",
".",
"__flushed_rows",
":",
"raise",
"Exception",
"(",
"\"Attempt to reuse row index %d of sheet %r after flushing\"",
"%",
"("... | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Worksheet.py#L1132-L1141 | |||
IFGHou/wapiti | 91242a8ad293a8ee54ab6e62732ff4b9d770772c | wapitiCore/attack/mod_sql.py | python | mod_sql.attackPOST | (self, form) | This method performs the SQL Injection attack with method POST | This method performs the SQL Injection attack with method POST | [
"This",
"method",
"performs",
"the",
"SQL",
"Injection",
"attack",
"with",
"method",
"POST"
] | def attackPOST(self, form):
"""This method performs the SQL Injection attack with method POST"""
payload = "\xbf'\"("
filename_payload = "'\"("
err = ""
# copies
get_params = form.get_params
post_params = form.post_params
file_params = form.file_params
... | [
"def",
"attackPOST",
"(",
"self",
",",
"form",
")",
":",
"payload",
"=",
"\"\\xbf'\\\"(\"",
"filename_payload",
"=",
"\"'\\\"(\"",
"err",
"=",
"\"\"",
"# copies",
"get_params",
"=",
"form",
".",
"get_params",
"post_params",
"=",
"form",
".",
"post_params",
"fi... | https://github.com/IFGHou/wapiti/blob/91242a8ad293a8ee54ab6e62732ff4b9d770772c/wapitiCore/attack/mod_sql.py#L189-L270 | ||
omaha-consulting/omaha-server | 1aa507b51e3656b490f72a3c9d60ee9d085e389e | omaha_server/omaha/utils.py | python | get_id | (uuid) | return int(id) | >>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1
>>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1 | >>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1
>>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1 | [
">>>",
"get_id",
"(",
"{",
"8C65E04C",
"-",
"0383",
"-",
"4AE2",
"-",
"893F",
"-",
"4EC7C58F70DC",
"}",
")",
"1",
">>>",
"get_id",
"(",
"{",
"8C65E04C",
"-",
"0383",
"-",
"4AE2",
"-",
"893F",
"-",
"4EC7C58F70DC",
"}",
")",
"1"
] | def get_id(uuid):
"""
>>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1
>>> get_id('{8C65E04C-0383-4AE2-893F-4EC7C58F70DC}')
1
"""
id = redis.get('{}:{}'.format(KEY_PREFIX, uuid))
if id is None:
id = create_id(uuid)
return int(id) | [
"def",
"get_id",
"(",
"uuid",
")",
":",
"id",
"=",
"redis",
".",
"get",
"(",
"'{}:{}'",
".",
"format",
"(",
"KEY_PREFIX",
",",
"uuid",
")",
")",
"if",
"id",
"is",
"None",
":",
"id",
"=",
"create_id",
"(",
"uuid",
")",
"return",
"int",
"(",
"id",
... | https://github.com/omaha-consulting/omaha-server/blob/1aa507b51e3656b490f72a3c9d60ee9d085e389e/omaha_server/omaha/utils.py#L66-L76 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/KindleBookstore/PyAl/Request/bs4/builder/__init__.py | python | register_treebuilders_from | (module) | Copy TreeBuilders from the given module into this module. | Copy TreeBuilders from the given module into this module. | [
"Copy",
"TreeBuilders",
"from",
"the",
"given",
"module",
"into",
"this",
"module",
"."
] | def register_treebuilders_from(module):
"""Copy TreeBuilders from the given module into this module."""
# I'm fairly sure this is not the best way to do this.
this_module = sys.modules['PyAl.Request.bs4.builder']
for name in module.__all__:
obj = getattr(module, name)
if issubclass(obj,... | [
"def",
"register_treebuilders_from",
"(",
"module",
")",
":",
"# I'm fairly sure this is not the best way to do this.",
"this_module",
"=",
"sys",
".",
"modules",
"[",
"'PyAl.Request.bs4.builder'",
"]",
"for",
"name",
"in",
"module",
".",
"__all__",
":",
"obj",
"=",
"... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/KindleBookstore/PyAl/Request/bs4/builder/__init__.py#L286-L297 | ||
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/convert/yaml2po.py | python | yaml2po.convert_unit | (self, unit) | return target_unit | Convert a source format unit to a target format unit. | Convert a source format unit to a target format unit. | [
"Convert",
"a",
"source",
"format",
"unit",
"to",
"a",
"target",
"format",
"unit",
"."
] | def convert_unit(self, unit):
"""Convert a source format unit to a target format unit."""
target_unit = self.TargetUnitClass(encoding="UTF-8")
target_unit.setid(unit.getid())
target_unit.addlocation(unit.getid())
target_unit.addnote(unit.getnotes(), "developer")
target_un... | [
"def",
"convert_unit",
"(",
"self",
",",
"unit",
")",
":",
"target_unit",
"=",
"self",
".",
"TargetUnitClass",
"(",
"encoding",
"=",
"\"UTF-8\"",
")",
"target_unit",
".",
"setid",
"(",
"unit",
".",
"getid",
"(",
")",
")",
"target_unit",
".",
"addlocation",... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/convert/yaml2po.py#L57-L64 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-linux2/IN.py | python | IN6_IS_ADDR_MC_SITELOCAL | (a) | return | [] | def IN6_IS_ADDR_MC_SITELOCAL(a): return | [
"def",
"IN6_IS_ADDR_MC_SITELOCAL",
"(",
"a",
")",
":",
"return"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-linux2/IN.py#L611-L611 | |||
feeluown/FeelUOwn | ec104689add09c351e6ca4133a5d0632294b3784 | feeluown/player/base_player.py | python | AbstractPlayer.state | (self) | return self._state | Player state
:rtype: State | Player state | [
"Player",
"state"
] | def state(self):
"""Player state
:rtype: State
"""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | https://github.com/feeluown/FeelUOwn/blob/ec104689add09c351e6ca4133a5d0632294b3784/feeluown/player/base_player.py#L69-L74 | |
CellProfiler/CellProfiler | a90e17e4d258c6f3900238be0f828e0b4bd1b293 | cellprofiler/gui/artist.py | python | ColorMixin._set_colormap | (self, colormap) | Override to set the colormap | Override to set the colormap | [
"Override",
"to",
"set",
"the",
"colormap"
] | def _set_colormap(self, colormap):
"""Override to set the colormap"""
self._colormap = colormap
self._on_colormap_changed() | [
"def",
"_set_colormap",
"(",
"self",
",",
"colormap",
")",
":",
"self",
".",
"_colormap",
"=",
"colormap",
"self",
".",
"_on_colormap_changed",
"(",
")"
] | https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/artist.py#L110-L113 | ||
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/core/pythonapi.py | python | PythonAPI.number_positive | (self, obj) | return self.builder.call(fn, (obj,)) | [] | def number_positive(self, obj):
fnty = Type.function(self.pyobj, [self.pyobj])
fn = self._get_function(fnty, name="PyNumber_Positive")
return self.builder.call(fn, (obj,)) | [
"def",
"number_positive",
"(",
"self",
",",
"obj",
")",
":",
"fnty",
"=",
"Type",
".",
"function",
"(",
"self",
".",
"pyobj",
",",
"[",
"self",
".",
"pyobj",
"]",
")",
"fn",
"=",
"self",
".",
"_get_function",
"(",
"fnty",
",",
"name",
"=",
"\"PyNum... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/pythonapi.py#L616-L619 | |||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pymysql/charset.py | python | Charset.__init__ | (self, id, name, collation, is_default) | [] | def __init__(self, id, name, collation, is_default):
self.id, self.name, self.collation = id, name, collation
self.is_default = is_default == 'Yes' | [
"def",
"__init__",
"(",
"self",
",",
"id",
",",
"name",
",",
"collation",
",",
"is_default",
")",
":",
"self",
".",
"id",
",",
"self",
".",
"name",
",",
"self",
".",
"collation",
"=",
"id",
",",
"name",
",",
"collation",
"self",
".",
"is_default",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pymysql/charset.py#L10-L12 | ||||
internetarchive/openlibrary | 33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8 | openlibrary/plugins/upstream/addbook.py | python | addbook.work_match | (self, saveutil, work, i) | Action for when a work, but not edition, is matched.
Saves a new edition of work, created form the formdata i.
Redirects the user to the newly created edition page in edit
mode to add more details.
:param DocSaveHelper saveutil:
:param Work work: the matched work for this book
... | Action for when a work, but not edition, is matched.
Saves a new edition of work, created form the formdata i.
Redirects the user to the newly created edition page in edit
mode to add more details. | [
"Action",
"for",
"when",
"a",
"work",
"but",
"not",
"edition",
"is",
"matched",
".",
"Saves",
"a",
"new",
"edition",
"of",
"work",
"created",
"form",
"the",
"formdata",
"i",
".",
"Redirects",
"the",
"user",
"to",
"the",
"newly",
"created",
"edition",
"pa... | def work_match(self, saveutil, work, i):
"""
Action for when a work, but not edition, is matched.
Saves a new edition of work, created form the formdata i.
Redirects the user to the newly created edition page in edit
mode to add more details.
:param DocSaveHelper saveuti... | [
"def",
"work_match",
"(",
"self",
",",
"saveutil",
",",
"work",
",",
"i",
")",
":",
"edition",
"=",
"self",
".",
"_make_edition",
"(",
"work",
",",
"i",
")",
"saveutil",
".",
"save",
"(",
"edition",
")",
"comment",
"=",
"utils",
".",
"get_message",
"... | https://github.com/internetarchive/openlibrary/blob/33b9b005ecb0adeda690c67952f5ae5f1fe3a8d8/openlibrary/plugins/upstream/addbook.py#L390-L408 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/gen.py | python | YieldPoint.start | (self, runner) | Called by the runner after the generator has yielded.
No other methods will be called on this object before ``start``. | Called by the runner after the generator has yielded. | [
"Called",
"by",
"the",
"runner",
"after",
"the",
"generator",
"has",
"yielded",
"."
] | def start(self, runner):
"""Called by the runner after the generator has yielded.
No other methods will be called on this object before ``start``.
"""
raise NotImplementedError() | [
"def",
"start",
"(",
"self",
",",
"runner",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/gen.py#L464-L469 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/ex-submodules/casexml/apps/case/mock/mock.py | python | CaseFactory.post_case_blocks | (self, caseblocks, form_extras=None, user_id=None, device_id=None) | return post_case_blocks(
caseblocks,
form_extras=submit_form_extras,
domain=self.domain,
user_id=user_id,
device_id=device_id,
) | [] | def post_case_blocks(self, caseblocks, form_extras=None, user_id=None, device_id=None):
submit_form_extras = copy.copy(self.form_extras)
if form_extras is not None:
submit_form_extras.update(form_extras)
return post_case_blocks(
caseblocks,
form_extras=submit_... | [
"def",
"post_case_blocks",
"(",
"self",
",",
"caseblocks",
",",
"form_extras",
"=",
"None",
",",
"user_id",
"=",
"None",
",",
"device_id",
"=",
"None",
")",
":",
"submit_form_extras",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"form_extras",
")",
"if",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/ex-submodules/casexml/apps/case/mock/mock.py#L97-L107 | |||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/base.py | python | DropboxBase.files_tags_get | (self,
paths) | return r | Get list of tags assigned to items.
:param List[str] paths: Path to the items.
:rtype: :class:`dropbox.files.GetTagsResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.files.BaseTagError` | Get list of tags assigned to items. | [
"Get",
"list",
"of",
"tags",
"assigned",
"to",
"items",
"."
] | def files_tags_get(self,
paths):
"""
Get list of tags assigned to items.
:param List[str] paths: Path to the items.
:rtype: :class:`dropbox.files.GetTagsResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
... | [
"def",
"files_tags_get",
"(",
"self",
",",
"paths",
")",
":",
"arg",
"=",
"files",
".",
"GetTagsArg",
"(",
"paths",
")",
"r",
"=",
"self",
".",
"request",
"(",
"files",
".",
"tags_get",
",",
"'files'",
",",
"arg",
",",
"None",
",",
")",
"return",
"... | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/base.py#L2803-L2822 | |
openstack/ironic | b392dc19bcd29cef5a69ec00d2f18a7a19a679e5 | ironic/common/driver_factory.py | python | BaseDriverFactory.items | (self) | return ((ext.name, ext.obj) for ext in self._extension_manager) | Iterator over pairs (name, instance). | Iterator over pairs (name, instance). | [
"Iterator",
"over",
"pairs",
"(",
"name",
"instance",
")",
"."
] | def items(self):
"""Iterator over pairs (name, instance)."""
return ((ext.name, ext.obj) for ext in self._extension_manager) | [
"def",
"items",
"(",
"self",
")",
":",
"return",
"(",
"(",
"ext",
".",
"name",
",",
"ext",
".",
"obj",
")",
"for",
"ext",
"in",
"self",
".",
"_extension_manager",
")"
] | https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/common/driver_factory.py#L427-L429 | |
poodarchu/Det3D | 01258d8cb26656c5b950f8d41f9dcc1dd62a391e | det3d/datasets/utils/kitti_object_eval_python/evaluate.py | python | _read_imageset_file | (path) | return [int(line) for line in lines] | [] | def _read_imageset_file(path):
with open(path, "r") as f:
lines = f.readlines()
return [int(line) for line in lines] | [
"def",
"_read_imageset_file",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"\"r\"",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"return",
"[",
"int",
"(",
"line",
")",
"for",
"line",
"in",
"lines",
"]"
] | https://github.com/poodarchu/Det3D/blob/01258d8cb26656c5b950f8d41f9dcc1dd62a391e/det3d/datasets/utils/kitti_object_eval_python/evaluate.py#L8-L11 | |||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/lib-tk/tkSimpleDialog.py | python | Dialog.body | (self, master) | create dialog body.
return widget that should have initial focus.
This method should be overridden, and is called
by the __init__ method. | create dialog body. | [
"create",
"dialog",
"body",
"."
] | def body(self, master):
'''create dialog body.
return widget that should have initial focus.
This method should be overridden, and is called
by the __init__ method.
'''
pass | [
"def",
"body",
"(",
"self",
",",
"master",
")",
":",
"pass"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/lib-tk/tkSimpleDialog.py#L96-L103 | ||
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/backends/sync_engine.py | python | SyncEngine.record_relationship | (self, local_id, remote_id, meme) | Records that an object from the local set is related with one a remote
set.
@param local_id: the id of the local task
@param remote_id: the id of the remote task
@param meme: the SyncMeme that keeps track of the relationship | Records that an object from the local set is related with one a remote
set. | [
"Records",
"that",
"an",
"object",
"from",
"the",
"local",
"set",
"is",
"related",
"with",
"one",
"a",
"remote",
"set",
"."
] | def record_relationship(self, local_id, remote_id, meme):
"""
Records that an object from the local set is related with one a remote
set.
@param local_id: the id of the local task
@param remote_id: the id of the remote task
@param meme: the SyncMeme that keeps track of t... | [
"def",
"record_relationship",
"(",
"self",
",",
"local_id",
",",
"remote_id",
",",
"meme",
")",
":",
"triplet",
"=",
"(",
"local_id",
",",
"remote_id",
",",
"meme",
")",
"self",
".",
"sync_memes",
".",
"add",
"(",
"triplet",
")"
] | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/backends/sync_engine.py#L240-L250 | ||
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/models/gated_autoencoder.py | python | FactoredGatedAutoencoder._factorsX | (self, inputs) | return tensor.dot(inputs[0], self.wxf) | Applies the filters wxf to the first input and returns
the corresponding factors | Applies the filters wxf to the first input and returns
the corresponding factors | [
"Applies",
"the",
"filters",
"wxf",
"to",
"the",
"first",
"input",
"and",
"returns",
"the",
"corresponding",
"factors"
] | def _factorsX(self, inputs):
"""
Applies the filters wxf to the first input and returns
the corresponding factors
"""
return tensor.dot(inputs[0], self.wxf) | [
"def",
"_factorsX",
"(",
"self",
",",
"inputs",
")",
":",
"return",
"tensor",
".",
"dot",
"(",
"inputs",
"[",
"0",
"]",
",",
"self",
".",
"wxf",
")"
] | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/gated_autoencoder.py#L296-L301 | |
VLSIDA/OpenRAM | f66aac3264598eeae31225c62b6a4af52412d407 | compiler/router/router.py | python | router.clear_pins | (self) | Convert the routed path to blockages.
Keep the other blockages unchanged. | Convert the routed path to blockages.
Keep the other blockages unchanged. | [
"Convert",
"the",
"routed",
"path",
"to",
"blockages",
".",
"Keep",
"the",
"other",
"blockages",
"unchanged",
"."
] | def clear_pins(self):
"""
Convert the routed path to blockages.
Keep the other blockages unchanged.
"""
self.pins = {}
self.all_pins = set()
self.pin_groups = {}
# DO NOT clear the blockages as these don't change
self.rg.reinit() | [
"def",
"clear_pins",
"(",
"self",
")",
":",
"self",
".",
"pins",
"=",
"{",
"}",
"self",
".",
"all_pins",
"=",
"set",
"(",
")",
"self",
".",
"pin_groups",
"=",
"{",
"}",
"# DO NOT clear the blockages as these don't change",
"self",
".",
"rg",
".",
"reinit",... | https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/router/router.py#L102-L111 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/ssm/v20190923/ssm_client.py | python | SsmClient.UpdateSecret | (self, request) | 该接口用于更新指定凭据名称和版本号的内容,调用该接口会对新的凭据内容加密后覆盖旧的内容。仅允许更新Enabled 和 Disabled 状态的凭据。
本接口仅适用于用户自定义凭据,不能对云产品凭据操作。
:param request: Request instance for UpdateSecret.
:type request: :class:`tencentcloud.ssm.v20190923.models.UpdateSecretRequest`
:rtype: :class:`tencentcloud.ssm.v20190923.models.Update... | 该接口用于更新指定凭据名称和版本号的内容,调用该接口会对新的凭据内容加密后覆盖旧的内容。仅允许更新Enabled 和 Disabled 状态的凭据。
本接口仅适用于用户自定义凭据,不能对云产品凭据操作。 | [
"该接口用于更新指定凭据名称和版本号的内容,调用该接口会对新的凭据内容加密后覆盖旧的内容。仅允许更新Enabled",
"和",
"Disabled",
"状态的凭据。",
"本接口仅适用于用户自定义凭据,不能对云产品凭据操作。"
] | def UpdateSecret(self, request):
"""该接口用于更新指定凭据名称和版本号的内容,调用该接口会对新的凭据内容加密后覆盖旧的内容。仅允许更新Enabled 和 Disabled 状态的凭据。
本接口仅适用于用户自定义凭据,不能对云产品凭据操作。
:param request: Request instance for UpdateSecret.
:type request: :class:`tencentcloud.ssm.v20190923.models.UpdateSecretRequest`
:rtype: :cla... | [
"def",
"UpdateSecret",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"UpdateSecret\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads",
"(",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ssm/v20190923/ssm_client.py#L681-L707 | ||
iGio90/Dwarf | bb3011cdffd209c7e3f5febe558053bf649ca69c | dwarf_debugger/lib/core.py | python | Dwarf.current_context | (self) | return None | [] | def current_context(self):
key = str(self.context_tid)
if key in self.contexts:
return self.contexts[key]
return None | [
"def",
"current_context",
"(",
"self",
")",
":",
"key",
"=",
"str",
"(",
"self",
".",
"context_tid",
")",
"if",
"key",
"in",
"self",
".",
"contexts",
":",
"return",
"self",
".",
"contexts",
"[",
"key",
"]",
"return",
"None"
] | https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/lib/core.py#L241-L245 | |||
grow/grow | 97fc21730b6a674d5d33948d94968e79447ce433 | grow/pods/ui.py | python | create_jinja_env | () | return env | [] | def create_jinja_env():
root = os.path.join(utils.get_grow_dir(), 'ui', 'admin')
loader = storage.FileStorage.JinjaLoader(root)
env = jinja2.Environment(
loader=loader,
autoescape=True,
trim_blocks=True,
extensions=[
'jinja2.ext.autoescape',
'jinja2.ex... | [
"def",
"create_jinja_env",
"(",
")",
":",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"utils",
".",
"get_grow_dir",
"(",
")",
",",
"'ui'",
",",
"'admin'",
")",
"loader",
"=",
"storage",
".",
"FileStorage",
".",
"JinjaLoader",
"(",
"root",
")",
... | https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/pods/ui.py#L11-L26 | |||
arthurdejong/python-stdnum | 02dec52602ae0709b940b781fc1fcebfde7340b7 | stdnum/it/aic.py | python | compact | (number) | return clean(number, ' ').upper().strip() | Convert the number to the minimal representation. | Convert the number to the minimal representation. | [
"Convert",
"the",
"number",
"to",
"the",
"minimal",
"representation",
"."
] | def compact(number):
"""Convert the number to the minimal representation."""
return clean(number, ' ').upper().strip() | [
"def",
"compact",
"(",
"number",
")",
":",
"return",
"clean",
"(",
"number",
",",
"' '",
")",
".",
"upper",
"(",
")",
".",
"strip",
"(",
")"
] | https://github.com/arthurdejong/python-stdnum/blob/02dec52602ae0709b940b781fc1fcebfde7340b7/stdnum/it/aic.py#L58-L60 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idc.py | python | SetBmaskName | (enum_id, bmask, name) | return idaapi.set_bmask_name(enum_id, bmask, name) | Set bitmask name (only for bitfields)
@param enum_id: id of enum
@param bmask: bitmask of the constant
@param name: name of bitmask
@return: 1-ok, 0-failed | Set bitmask name (only for bitfields) | [
"Set",
"bitmask",
"name",
"(",
"only",
"for",
"bitfields",
")"
] | def SetBmaskName(enum_id, bmask, name):
"""
Set bitmask name (only for bitfields)
@param enum_id: id of enum
@param bmask: bitmask of the constant
@param name: name of bitmask
@return: 1-ok, 0-failed
"""
if bmask < 0:
bmask &= BADADDR
return idaapi.set_bmask_name(enum_id, b... | [
"def",
"SetBmaskName",
"(",
"enum_id",
",",
"bmask",
",",
"name",
")",
":",
"if",
"bmask",
"<",
"0",
":",
"bmask",
"&=",
"BADADDR",
"return",
"idaapi",
".",
"set_bmask_name",
"(",
"enum_id",
",",
"bmask",
",",
"name",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idc.py#L5990-L6002 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/fastboot_utils.py | python | FastbootUtils.WaitForFastbootMode | (self, timeout=None, retries=None) | Wait for device to boot into fastboot mode.
This waits for the device serial to show up in fastboot devices output. | Wait for device to boot into fastboot mode. | [
"Wait",
"for",
"device",
"to",
"boot",
"into",
"fastboot",
"mode",
"."
] | def WaitForFastbootMode(self, timeout=None, retries=None):
"""Wait for device to boot into fastboot mode.
This waits for the device serial to show up in fastboot devices output.
"""
def fastboot_mode():
return self._serial in self.fastboot.Devices()
timeout_retry.WaitFor(fastboot_mode, wait_... | [
"def",
"WaitForFastbootMode",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"retries",
"=",
"None",
")",
":",
"def",
"fastboot_mode",
"(",
")",
":",
"return",
"self",
".",
"_serial",
"in",
"self",
".",
"fastboot",
".",
"Devices",
"(",
")",
"timeout_retr... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/devil/devil/android/fastboot_utils.py#L105-L113 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/decimal.py | python | Decimal.__abs__ | (self, round=True, context=None) | return ans | Returns the absolute value of self.
If the keyword argument 'round' is false, do not round. The
expression self.__abs__(round=False) is equivalent to
self.copy_abs(). | Returns the absolute value of self. | [
"Returns",
"the",
"absolute",
"value",
"of",
"self",
"."
] | def __abs__(self, round=True, context=None):
"""Returns the absolute value of self.
If the keyword argument 'round' is false, do not round. The
expression self.__abs__(round=False) is equivalent to
self.copy_abs().
"""
if not round:
return self.copy_abs()
... | [
"def",
"__abs__",
"(",
"self",
",",
"round",
"=",
"True",
",",
"context",
"=",
"None",
")",
":",
"if",
"not",
"round",
":",
"return",
"self",
".",
"copy_abs",
"(",
")",
"if",
"self",
".",
"_is_special",
":",
"ans",
"=",
"self",
".",
"_check_nans",
... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/decimal.py#L1128-L1148 | |
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/modules/common/structures/user.py | python | UserData.get_uid | (self) | Return a UID value which can be a number or None.
Prefer using this method instead of directly reading uid and uid_mode.
:return: UID or None if not set
:rtype: int or None | Return a UID value which can be a number or None. | [
"Return",
"a",
"UID",
"value",
"which",
"can",
"be",
"a",
"number",
"or",
"None",
"."
] | def get_uid(self):
"""Return a UID value which can be a number or None.
Prefer using this method instead of directly reading uid and uid_mode.
:return: UID or None if not set
:rtype: int or None
"""
if self._uid_mode == ID_MODE_USE_DEFAULT:
return None
... | [
"def",
"get_uid",
"(",
"self",
")",
":",
"if",
"self",
".",
"_uid_mode",
"==",
"ID_MODE_USE_DEFAULT",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
"_uid"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/common/structures/user.py#L99-L110 | ||
csujedihy/lc-all-solutions | b9fd938a7b3c164f28096361993600e338c399c3 | 157.read-n-characters-given-read4/read-n-characters-given-read4.py | python | Solution.read | (self, buf, n) | return cnt | :type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int) | :type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int) | [
":",
"type",
"buf",
":",
"Destination",
"buffer",
"(",
"List",
"[",
"str",
"]",
")",
":",
"type",
"n",
":",
"Maximum",
"number",
"of",
"characters",
"to",
"read",
"(",
"int",
")",
":",
"rtype",
":",
"The",
"number",
"of",
"characters",
"read",
"(",
... | def read(self, buf, n):
"""
:type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int)
"""
cnt = 0
tmp = [""] * 4
while cnt < n:
r = read4(tmp)
if r == 0:
break
for i in range(min(r, ... | [
"def",
"read",
"(",
"self",
",",
"buf",
",",
"n",
")",
":",
"cnt",
"=",
"0",
"tmp",
"=",
"[",
"\"\"",
"]",
"*",
"4",
"while",
"cnt",
"<",
"n",
":",
"r",
"=",
"read4",
"(",
"tmp",
")",
"if",
"r",
"==",
"0",
":",
"break",
"for",
"i",
"in",
... | https://github.com/csujedihy/lc-all-solutions/blob/b9fd938a7b3c164f28096361993600e338c399c3/157.read-n-characters-given-read4/read-n-characters-given-read4.py#L7-L22 | |
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/androiddriver/androiddriver.py | python | AndroidDriver._wait_for_event | (self, thread_id, timeout) | return ret | 等待事件 | 等待事件 | [
"等待事件"
] | def _wait_for_event(self, thread_id, timeout):
"""等待事件
"""
if self._get_lock(thread_id).is_set():
return
time0 = time.time()
ret = self._get_lock(thread_id).wait(timeout)
if ret:
cost_time = time.time() - time0
logger.debug("thread %s w... | [
"def",
"_wait_for_event",
"(",
"self",
",",
"thread_id",
",",
"timeout",
")",
":",
"if",
"self",
".",
"_get_lock",
"(",
"thread_id",
")",
".",
"is_set",
"(",
")",
":",
"return",
"time0",
"=",
"time",
".",
"time",
"(",
")",
"ret",
"=",
"self",
".",
... | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androiddriver/androiddriver.py#L562-L576 | |
zaxlct/imooc-django | daf1ced745d3d21989e8191b658c293a511b37fd | extra_apps/xadmin/plugins/xversion.py | python | RecoverView.post_response | (self) | return HttpResponseRedirect(self.model_admin_url('change', self.new_obj.pk)) | [] | def post_response(self):
self.message_user(_('The %(model)s "%(name)s" was recovered successfully. You may edit it again below.') %
{"model": force_text(self.opts.verbose_name), "name": smart_text(self.new_obj)}, 'success')
return HttpResponseRedirect(self.model_admin_url('chan... | [
"def",
"post_response",
"(",
"self",
")",
":",
"self",
".",
"message_user",
"(",
"_",
"(",
"'The %(model)s \"%(name)s\" was recovered successfully. You may edit it again below.'",
")",
"%",
"{",
"\"model\"",
":",
"force_text",
"(",
"self",
".",
"opts",
".",
"verbose_n... | https://github.com/zaxlct/imooc-django/blob/daf1ced745d3d21989e8191b658c293a511b37fd/extra_apps/xadmin/plugins/xversion.py#L477-L480 | |||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/plat-mac/gensuitemodule.py | python | identify | (str) | return rv | Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword | Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword | [
"Turn",
"any",
"string",
"into",
"an",
"identifier",
":",
"-",
"replace",
"space",
"by",
"_",
"-",
"replace",
"other",
"illegal",
"chars",
"by",
"_xx_",
"(",
"hex",
"code",
")",
"-",
"append",
"_",
"if",
"the",
"result",
"is",
"a",
"python",
"keyword"
... | def identify(str):
"""Turn any string into an identifier:
- replace space by _
- replace other illegal chars by _xx_ (hex code)
- append _ if the result is a python keyword
"""
if not str:
return "empty_ae_name_"
rv = ''
ok = string.ascii_letters + '_'
ok2 = ok + string.digit... | [
"def",
"identify",
"(",
"str",
")",
":",
"if",
"not",
"str",
":",
"return",
"\"empty_ae_name_\"",
"rv",
"=",
"''",
"ok",
"=",
"string",
".",
"ascii_letters",
"+",
"'_'",
"ok2",
"=",
"ok",
"+",
"string",
".",
"digits",
"for",
"c",
"in",
"str",
":",
... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/plat-mac/gensuitemodule.py#L1189-L1210 | |
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 15-more-types/protocol/mymax/mymax_demo.py | python | demo_different_key_none | () | [] | def demo_different_key_none() -> None:
args = iter('banana kiwi mango apple'.split())
key = None
expected = 'mango'
result = my.max(args, key=key)
print(args, key, expected, result, sep='\n')
assert result == expected
if TYPE_CHECKING:
reveal_type(args)
reveal_type(key)
... | [
"def",
"demo_different_key_none",
"(",
")",
"->",
"None",
":",
"args",
"=",
"iter",
"(",
"'banana kiwi mango apple'",
".",
"split",
"(",
")",
")",
"key",
"=",
"None",
"expected",
"=",
"'mango'",
"result",
"=",
"my",
".",
"max",
"(",
"args",
",",
"key",
... | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/15-more-types/protocol/mymax/mymax_demo.py#L82-L93 | ||||
WangYueFt/rfs | f8c837ba93c62dd0ac68a2f4019c619aa86b8421 | models/resnet_new.py | python | conv3x3 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stride",
"=",
"stride",
",",
"padding",
"=",
"1",
",",
"... | https://github.com/WangYueFt/rfs/blob/f8c837ba93c62dd0ac68a2f4019c619aa86b8421/models/resnet_new.py#L17-L20 | |
jansel/opentuner | 070c5cef6d933eb760a2f9cd5cd08c95f27aee75 | opentuner/search/technique.py | python | SearchTechnique.default_generated_name | (self) | return self.base_name() | The default generated name for this technique | The default generated name for this technique | [
"The",
"default",
"generated",
"name",
"for",
"this",
"technique"
] | def default_generated_name(self):
""" The default generated name for this technique """
return self.base_name() | [
"def",
"default_generated_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"base_name",
"(",
")"
] | https://github.com/jansel/opentuner/blob/070c5cef6d933eb760a2f9cd5cd08c95f27aee75/opentuner/search/technique.py#L129-L131 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/databases/cremona.py | python | MiniCremonaDatabase.elliptic_curve_from_ainvs | (self, ainvs) | return elliptic.EllipticCurve(ainvs, **data) | Return the elliptic curve in the database of with minimal
``ainvs``, if it exists, or raises a ``RuntimeError`` exception
otherwise.
INPUT:
- ``ainvs`` - list (5-tuple of int's); the minimal
Weierstrass model for an elliptic curve
OUTPUT: EllipticCurve
EXA... | Return the elliptic curve in the database of with minimal
``ainvs``, if it exists, or raises a ``RuntimeError`` exception
otherwise. | [
"Return",
"the",
"elliptic",
"curve",
"in",
"the",
"database",
"of",
"with",
"minimal",
"ainvs",
"if",
"it",
"exists",
"or",
"raises",
"a",
"RuntimeError",
"exception",
"otherwise",
"."
] | def elliptic_curve_from_ainvs(self, ainvs):
"""
Return the elliptic curve in the database of with minimal
``ainvs``, if it exists, or raises a ``RuntimeError`` exception
otherwise.
INPUT:
- ``ainvs`` - list (5-tuple of int's); the minimal
Weierstrass model f... | [
"def",
"elliptic_curve_from_ainvs",
"(",
"self",
",",
"ainvs",
")",
":",
"data",
"=",
"self",
".",
"data_from_coefficients",
"(",
"ainvs",
")",
"return",
"elliptic",
".",
"EllipticCurve",
"(",
"ainvs",
",",
"*",
"*",
"data",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/databases/cremona.py#L953-L987 | |
adulau/Forban | 4b06c8a2e2f18ff872ca20a534587a5f15a692fa | lib/ext/cherrypy/lib/httpauth.py | python | parseAuthorization | (credentials) | return params | parseAuthorization will convert the value of the 'Authorization' key in
the HTTP header to a map itself. If the parsing fails 'None' is returned. | parseAuthorization will convert the value of the 'Authorization' key in
the HTTP header to a map itself. If the parsing fails 'None' is returned. | [
"parseAuthorization",
"will",
"convert",
"the",
"value",
"of",
"the",
"Authorization",
"key",
"in",
"the",
"HTTP",
"header",
"to",
"a",
"map",
"itself",
".",
"If",
"the",
"parsing",
"fails",
"None",
"is",
"returned",
"."
] | def parseAuthorization (credentials):
"""parseAuthorization will convert the value of the 'Authorization' key in
the HTTP header to a map itself. If the parsing fails 'None' is returned.
"""
global AUTH_SCHEMES
auth_scheme, auth_params = credentials.split(" ", 1)
auth_scheme = auth_scheme.low... | [
"def",
"parseAuthorization",
"(",
"credentials",
")",
":",
"global",
"AUTH_SCHEMES",
"auth_scheme",
",",
"auth_params",
"=",
"credentials",
".",
"split",
"(",
"\" \"",
",",
"1",
")",
"auth_scheme",
"=",
"auth_scheme",
".",
"lower",
"(",
")",
"parser",
"=",
"... | https://github.com/adulau/Forban/blob/4b06c8a2e2f18ff872ca20a534587a5f15a692fa/lib/ext/cherrypy/lib/httpauth.py#L164-L182 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg/werkzeug/contrib/sessions.py | python | SessionStore.new | (self) | return self.session_class({}, self.generate_key(), True) | Generate a new session. | Generate a new session. | [
"Generate",
"a",
"new",
"session",
"."
] | def new(self):
"""Generate a new session."""
return self.session_class({}, self.generate_key(), True) | [
"def",
"new",
"(",
"self",
")",
":",
"return",
"self",
".",
"session_class",
"(",
"{",
"}",
",",
"self",
".",
"generate_key",
"(",
")",
",",
"True",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/Werkzeug-0.8.3-py2.7.egg/werkzeug/contrib/sessions.py#L162-L164 | |
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/docker/docker_container_instance.py | python | DockerContainer._GetContainerInfo | (self) | return info, return_code | Returns information about a container.
Gets Container information from Docker Inspect. Returns the information,
if there is any and a return code. 0 | Returns information about a container. | [
"Returns",
"information",
"about",
"a",
"container",
"."
] | def _GetContainerInfo(self):
"""Returns information about a container.
Gets Container information from Docker Inspect. Returns the information,
if there is any and a return code. 0
"""
logging.info('Checking Container Information')
inspect_cmd = ['docker', 'inspect', self.name]
info, _, ret... | [
"def",
"_GetContainerInfo",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Checking Container Information'",
")",
"inspect_cmd",
"=",
"[",
"'docker'",
",",
"'inspect'",
",",
"self",
".",
"name",
"]",
"info",
",",
"_",
",",
"return_code",
"=",
"vm_util... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/docker/docker_container_instance.py#L204-L216 | |
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/manageorg/_parameters.py | python | GenerateParameter.enforceOutputJsonSizeLimit | (self, value) | gets/sets the enforceOutputJsonSizeLimit | gets/sets the enforceOutputJsonSizeLimit | [
"gets",
"/",
"sets",
"the",
"enforceOutputJsonSizeLimit"
] | def enforceOutputJsonSizeLimit(self, value):
"""gets/sets the enforceOutputJsonSizeLimit"""
if self._enforceOutputJsonSizeLimit != value:
self._enforceOutputJsonSizeLimit = value | [
"def",
"enforceOutputJsonSizeLimit",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_enforceOutputJsonSizeLimit",
"!=",
"value",
":",
"self",
".",
"_enforceOutputJsonSizeLimit",
"=",
"value"
] | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_parameters.py#L2241-L2244 | ||
oanda/v20-python | f28192f4a31bce038cf6dfa302f5878bec192fe5 | src/v20/transaction.py | python | DelayedTradeClosureTransaction.from_dict | (data, ctx) | return DelayedTradeClosureTransaction(**data) | Instantiate a new DelayedTradeClosureTransaction from a dict (generally
from loading a JSON response). The data used to instantiate the
DelayedTradeClosureTransaction is a shallow copy of the dict passed in,
with any complex child types instantiated appropriately. | Instantiate a new DelayedTradeClosureTransaction from a dict (generally
from loading a JSON response). The data used to instantiate the
DelayedTradeClosureTransaction is a shallow copy of the dict passed in,
with any complex child types instantiated appropriately. | [
"Instantiate",
"a",
"new",
"DelayedTradeClosureTransaction",
"from",
"a",
"dict",
"(",
"generally",
"from",
"loading",
"a",
"JSON",
"response",
")",
".",
"The",
"data",
"used",
"to",
"instantiate",
"the",
"DelayedTradeClosureTransaction",
"is",
"a",
"shallow",
"co... | def from_dict(data, ctx):
"""
Instantiate a new DelayedTradeClosureTransaction from a dict (generally
from loading a JSON response). The data used to instantiate the
DelayedTradeClosureTransaction is a shallow copy of the dict passed in,
with any complex child types instantiated ... | [
"def",
"from_dict",
"(",
"data",
",",
"ctx",
")",
":",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"return",
"DelayedTradeClosureTransaction",
"(",
"*",
"*",
"data",
")"
] | https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/transaction.py#L5212-L5222 | |
intel/virtual-storage-manager | 00706ab9701acbd0d5e04b19cc80c6b66a2973b8 | source/vsm/vsm/db/sqlalchemy/utils.py | python | check_shadow_table | (migrate_engine, table_name) | return True | This method checks that table with ``table_name`` and corresponding shadow
table have same columns. | This method checks that table with ``table_name`` and corresponding shadow
table have same columns. | [
"This",
"method",
"checks",
"that",
"table",
"with",
"table_name",
"and",
"corresponding",
"shadow",
"table",
"have",
"same",
"columns",
"."
] | def check_shadow_table(migrate_engine, table_name):
"""
This method checks that table with ``table_name`` and corresponding shadow
table have same columns.
"""
meta = MetaData()
meta.bind = migrate_engine
table = Table(table_name, meta, autoload=True)
shadow_table = Table(db._SHADOW_TAB... | [
"def",
"check_shadow_table",
"(",
"migrate_engine",
",",
"table_name",
")",
":",
"meta",
"=",
"MetaData",
"(",
")",
"meta",
".",
"bind",
"=",
"migrate_engine",
"table",
"=",
"Table",
"(",
"table_name",
",",
"meta",
",",
"autoload",
"=",
"True",
")",
"shado... | https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/vsm/vsm/db/sqlalchemy/utils.py#L233-L268 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.