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
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/spike/spike.py
python
SpikeStepper.stop
(self)
Stop the stepper.
Stop the stepper.
[ "Stop", "the", "stepper", "." ]
def stop(self): """Stop the stepper.""" # reconfiguring seems to be used to stop the stepper self._configure()
[ "def", "stop", "(", "self", ")", ":", "# reconfiguring seems to be used to stop the stepper", "self", ".", "_configure", "(", ")" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/spike/spike.py#L436-L439
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/protocols/present_proof/v2_0/routes.py
python
V20PresRequestByFormatSchema.validate_fields
(self, data, **kwargs)
Validate schema fields: data must have at least one format. Args: data: The data to validate Raises: ValidationError: if data has no formats
Validate schema fields: data must have at least one format.
[ "Validate", "schema", "fields", ":", "data", "must", "have", "at", "least", "one", "format", "." ]
def validate_fields(self, data, **kwargs): """ Validate schema fields: data must have at least one format. Args: data: The data to validate Raises: ValidationError: if data has no formats """ if not any(f.api in data for f in V20PresFormat.Forma...
[ "def", "validate_fields", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "if", "not", "any", "(", "f", ".", "api", "in", "data", "for", "f", "in", "V20PresFormat", ".", "Format", ")", ":", "raise", "ValidationError", "(", "\"V20PresReques...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/present_proof/v2_0/routes.py#L189-L203
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pip/utils/__init__.py
python
dist_is_local
(dist)
return is_local(dist_location(dist))
Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv.
Return True if given Distribution object is installed locally (i.e. within current virtualenv).
[ "Return", "True", "if", "given", "Distribution", "object", "is", "installed", "locally", "(", "i", ".", "e", ".", "within", "current", "virtualenv", ")", "." ]
def dist_is_local(dist): """ Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv. """ return is_local(dist_location(dist))
[ "def", "dist_is_local", "(", "dist", ")", ":", "return", "is_local", "(", "dist_location", "(", "dist", ")", ")" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/utils/__init__.py#L289-L297
bbc/brave
88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5
brave/inputs/input.py
python
Input.dest_connections
(self)
return self.session().connections.get_all_for_source(self)
Returns an array of Connections, describing what this input is connected to. (An input can have any number of connections, each going to a Mixer or Output.)
Returns an array of Connections, describing what this input is connected to. (An input can have any number of connections, each going to a Mixer or Output.)
[ "Returns", "an", "array", "of", "Connections", "describing", "what", "this", "input", "is", "connected", "to", ".", "(", "An", "input", "can", "have", "any", "number", "of", "connections", "each", "going", "to", "a", "Mixer", "or", "Output", ".", ")" ]
def dest_connections(self): ''' Returns an array of Connections, describing what this input is connected to. (An input can have any number of connections, each going to a Mixer or Output.) ''' return self.session().connections.get_all_for_source(self)
[ "def", "dest_connections", "(", "self", ")", ":", "return", "self", ".", "session", "(", ")", ".", "connections", ".", "get_all_for_source", "(", "self", ")" ]
https://github.com/bbc/brave/blob/88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5/brave/inputs/input.py#L24-L29
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/input_datetime/reproduce_state.py
python
is_valid_date
(string: str)
return dt_util.parse_date(string) is not None
Test if string dt is a valid date.
Test if string dt is a valid date.
[ "Test", "if", "string", "dt", "is", "a", "valid", "date", "." ]
def is_valid_date(string: str) -> bool: """Test if string dt is a valid date.""" return dt_util.parse_date(string) is not None
[ "def", "is_valid_date", "(", "string", ":", "str", ")", "->", "bool", ":", "return", "dt_util", ".", "parse_date", "(", "string", ")", "is", "not", "None" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/input_datetime/reproduce_state.py#L26-L28
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/model/chunk.py
python
Chunk.copy_full_in_mapping
(self, mapping)
return numol
#doc; overrides Node method; only some atom copies get recorded in mapping (if we think it might need them)
#doc; overrides Node method; only some atom copies get recorded in mapping (if we think it might need them)
[ "#doc", ";", "overrides", "Node", "method", ";", "only", "some", "atom", "copies", "get", "recorded", "in", "mapping", "(", "if", "we", "think", "it", "might", "need", "them", ")" ]
def copy_full_in_mapping(self, mapping): # in class Chunk """ #doc; overrides Node method; only some atom copies get recorded in mapping (if we think it might need them) """ # bruce 050526; 060308 major rewrite numol = self._copy_empty_shell_in_mapping( mapping) ...
[ "def", "copy_full_in_mapping", "(", "self", ",", "mapping", ")", ":", "# in class Chunk", "# bruce 050526; 060308 major rewrite", "numol", "=", "self", ".", "_copy_empty_shell_in_mapping", "(", "mapping", ")", "# now copy the atoms, all at once (including all their existing", "...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/model/chunk.py#L2744-L2790
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/Django-1.11.29/django/db/backends/mysql/base.py
python
DatabaseWrapper.check_constraints
(self, table_names=None)
Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint chec...
Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows with invalid references were entered while constraint chec...
[ "Checks", "each", "table", "name", "in", "table_names", "for", "rows", "with", "invalid", "foreign", "key", "references", ".", "This", "method", "is", "intended", "to", "be", "used", "in", "conjunction", "with", "disable_constraint_checking", "()", "and", "enabl...
def check_constraints(self, table_names=None): """ Checks each table name in `table_names` for rows with invalid foreign key references. This method is intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to determine if rows...
[ "def", "check_constraints", "(", "self", ",", "table_names", "=", "None", ")", ":", "cursor", "=", "self", ".", "cursor", "(", ")", "if", "table_names", "is", "None", ":", "table_names", "=", "self", ".", "introspection", ".", "table_names", "(", "cursor",...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/db/backends/mysql/base.py#L329-L373
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/engine/reflection.py
python
Inspector.get_table_names
(self, schema=None, order_by=None)
return tnames
Return all table names in referred to within a particular schema. The names are expected to be real tables only, not views. Views are instead returned using the :meth:`.Inspector.get_view_names` method. :param schema: Schema name. If ``schema`` is left at ``None``, the databa...
Return all table names in referred to within a particular schema.
[ "Return", "all", "table", "names", "in", "referred", "to", "within", "a", "particular", "schema", "." ]
def get_table_names(self, schema=None, order_by=None): """Return all table names in referred to within a particular schema. The names are expected to be real tables only, not views. Views are instead returned using the :meth:`.Inspector.get_view_names` method. :param schema: S...
[ "def", "get_table_names", "(", "self", ",", "schema", "=", "None", ",", "order_by", "=", "None", ")", ":", "if", "hasattr", "(", "self", ".", "dialect", ",", "'get_table_names'", ")", ":", "tnames", "=", "self", ".", "dialect", ".", "get_table_names", "(...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/engine/reflection.py#L160-L201
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py
python
_recursive_fill_value
(dtype, f)
Recursively produce a fill value for `dtype`, calling f on scalar dtypes
Recursively produce a fill value for `dtype`, calling f on scalar dtypes
[ "Recursively", "produce", "a", "fill", "value", "for", "dtype", "calling", "f", "on", "scalar", "dtypes" ]
def _recursive_fill_value(dtype, f): """ Recursively produce a fill value for `dtype`, calling f on scalar dtypes """ if dtype.names is not None: vals = tuple(_recursive_fill_value(dtype[name], f) for name in dtype.names) return np.array(vals, dtype=dtype)[()] # decay to void scalar fro...
[ "def", "_recursive_fill_value", "(", "dtype", ",", "f", ")", ":", "if", "dtype", ".", "names", "is", "not", "None", ":", "vals", "=", "tuple", "(", "_recursive_fill_value", "(", "dtype", "[", "name", "]", ",", "f", ")", "for", "name", "in", "dtype", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py#L211-L223
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/ip_messaging/v2/__init__.py
python
V2.services
(self)
return self._services
:rtype: twilio.rest.ip_messaging.v2.service.ServiceList
:rtype: twilio.rest.ip_messaging.v2.service.ServiceList
[ ":", "rtype", ":", "twilio", ".", "rest", ".", "ip_messaging", ".", "v2", ".", "service", ".", "ServiceList" ]
def services(self): """ :rtype: twilio.rest.ip_messaging.v2.service.ServiceList """ if self._services is None: self._services = ServiceList(self) return self._services
[ "def", "services", "(", "self", ")", ":", "if", "self", ".", "_services", "is", "None", ":", "self", ".", "_services", "=", "ServiceList", "(", "self", ")", "return", "self", ".", "_services" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v2/__init__.py#L38-L44
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/templates/locations/FI/config.py
python
config
(settings)
Template settings for Finland - designed to be used in a Cascade with an application template
Template settings for Finland - designed to be used in a Cascade with an application template
[ "Template", "settings", "for", "Finland", "-", "designed", "to", "be", "used", "in", "a", "Cascade", "with", "an", "application", "template" ]
def config(settings): """ Template settings for Finland - designed to be used in a Cascade with an application template """ #T = current.T # Pre-Populate settings.base.prepopulate.append("locations/FI") # Uncomment to restrict to specific country/countries settings.gis.cou...
[ "def", "config", "(", "settings", ")", ":", "#T = current.T", "# Pre-Populate", "settings", ".", "base", ".", "prepopulate", ".", "append", "(", "\"locations/FI\"", ")", "# Uncomment to restrict to specific country/countries", "settings", ".", "gis", ".", "countries", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/locations/FI/config.py#L5-L32
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/SimpleHTTPServer.py
python
SimpleHTTPRequestHandler.guess_type
(self, path)
Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map, using application/octet-stream ...
Guess the type of a file.
[ "Guess", "the", "type", "of", "a", "file", "." ]
def guess_type(self, path): """Guess the type of a file. Argument is a PATH (a filename). Return value is a string of the form type/subtype, usable for a MIME Content-type header. The default implementation looks the file's extension up in the table self.extensions_map...
[ "def", "guess_type", "(", "self", ",", "path", ")", ":", "base", ",", "ext", "=", "posixpath", ".", "splitext", "(", "path", ")", "if", "ext", "in", "self", ".", "extensions_map", ":", "return", "self", ".", "extensions_map", "[", "ext", "]", "ext", ...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/SimpleHTTPServer.py#L179-L201
apachecn/AiLearning
228b62a905a2a9bf6066f65c16d53056b10ec610
src/py3.x/dl/bp.py
python
ConstNode.append_downstream_connection
(self, conn)
Desc: 添加一个到下游节点的连接 Args: conn --- 到下游节点的连接 Returns: None
Desc: 添加一个到下游节点的连接 Args: conn --- 到下游节点的连接 Returns: None
[ "Desc", ":", "添加一个到下游节点的连接", "Args", ":", "conn", "---", "到下游节点的连接", "Returns", ":", "None" ]
def append_downstream_connection(self, conn): ''' Desc: 添加一个到下游节点的连接 Args: conn --- 到下游节点的连接 Returns: None ''' # 使用 list 的 append 方法将包含下游节点的 conn 添加到 downstream 中 self.downstrea...
[ "def", "append_downstream_connection", "(", "self", ",", "conn", ")", ":", "# 使用 list 的 append 方法将包含下游节点的 conn 添加到 downstream 中 ", "self", ".", "downstream", ".", "append", "(", "conn", ")" ]
https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/dl/bp.py#L166-L176
adamchainz/django-mysql
389594dc078f73c9f204306014332344fe4b6d04
src/django_mysql/models/fields/dynamic.py
python
KeyTransform.as_sql
( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper )
return ( f"COLUMN_GET({lhs}, %s AS {self.data_type})", tuple(params) + (self.key_name,), )
[]
def as_sql( self, compiler: SQLCompiler, connection: BaseDatabaseWrapper ) -> Tuple[str, Iterable[Any]]: lhs, params = compiler.compile(self.lhs) return ( f"COLUMN_GET({lhs}, %s AS {self.data_type})", tuple(params) + (self.key_name,), )
[ "def", "as_sql", "(", "self", ",", "compiler", ":", "SQLCompiler", ",", "connection", ":", "BaseDatabaseWrapper", ")", "->", "Tuple", "[", "str", ",", "Iterable", "[", "Any", "]", "]", ":", "lhs", ",", "params", "=", "compiler", ".", "compile", "(", "s...
https://github.com/adamchainz/django-mysql/blob/389594dc078f73c9f204306014332344fe4b6d04/src/django_mysql/models/fields/dynamic.py#L355-L362
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventTypeArg.is_folder_overview_item_unpinned
(self)
return self._tag == 'folder_overview_item_unpinned'
Check if the union tag is ``folder_overview_item_unpinned``. :rtype: bool
Check if the union tag is ``folder_overview_item_unpinned``.
[ "Check", "if", "the", "union", "tag", "is", "folder_overview_item_unpinned", "." ]
def is_folder_overview_item_unpinned(self): """ Check if the union tag is ``folder_overview_item_unpinned``. :rtype: bool """ return self._tag == 'folder_overview_item_unpinned'
[ "def", "is_folder_overview_item_unpinned", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'folder_overview_item_unpinned'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L40679-L40685
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/networks/pytorch/customs/modnas/arch_space/torch/pyramidnet.py
python
BottleneckBlock.forward
(self, x)
return out
Compute network output.
Compute network output.
[ "Compute", "network", "output", "." ]
def forward(self, x): """Compute network output.""" out = self.bottle_in(x) out = self.cell(out) out = self.bottle_out(out) out = self.bn(out) if self.downsample is not None: shortcut = self.downsample(x) featuremap_size = shortcut.size()[2:4] ...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "out", "=", "self", ".", "bottle_in", "(", "x", ")", "out", "=", "self", ".", "cell", "(", "out", ")", "out", "=", "self", ".", "bottle_out", "(", "out", ")", "out", "=", "self", ".", "bn", "...
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/networks/pytorch/customs/modnas/arch_space/torch/pyramidnet.py#L54-L78
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/modules/utils.py
python
sync_customizations
(app=None)
Sync custom fields and property setters from custom folder in each app module
Sync custom fields and property setters from custom folder in each app module
[ "Sync", "custom", "fields", "and", "property", "setters", "from", "custom", "folder", "in", "each", "app", "module" ]
def sync_customizations(app=None): '''Sync custom fields and property setters from custom folder in each app module''' if app: apps = [app] else: apps = frappe.get_installed_apps() for app_name in apps: for module_name in frappe.local.app_modules.get(app_name) or []: folder = frappe.get_app_path(app_name...
[ "def", "sync_customizations", "(", "app", "=", "None", ")", ":", "if", "app", ":", "apps", "=", "[", "app", "]", "else", ":", "apps", "=", "frappe", ".", "get_installed_apps", "(", ")", "for", "app_name", "in", "apps", ":", "for", "module_name", "in", ...
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/modules/utils.py#L78-L95
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/zoneadm.py
python
clone
(zone, source, snapshot=None)
return ret
Install a zone by copying an existing installed zone. zone : string name of the zone source : string zone to clone from snapshot : string optional name of snapshot to use as source CLI Example: .. code-block:: bash salt '*' zoneadm.clone clementine dolores
Install a zone by copying an existing installed zone.
[ "Install", "a", "zone", "by", "copying", "an", "existing", "installed", "zone", "." ]
def clone(zone, source, snapshot=None): """ Install a zone by copying an existing installed zone. zone : string name of the zone source : string zone to clone from snapshot : string optional name of snapshot to use as source CLI Example: .. code-block:: bash ...
[ "def", "clone", "(", "zone", ",", "source", ",", "snapshot", "=", "None", ")", ":", "ret", "=", "{", "\"status\"", ":", "True", "}", "## install zone", "res", "=", "__salt__", "[", "\"cmd.run_all\"", "]", "(", "\"zoneadm -z {zone} clone {snapshot}{source}\"", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/zoneadm.py#L539-L572
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/labs/drkit/run_dualencoder_lsf.py
python
_copy_model
(in_path, out_path)
Copy model checkpoint for future use.
Copy model checkpoint for future use.
[ "Copy", "model", "checkpoint", "for", "future", "use", "." ]
def _copy_model(in_path, out_path): """Copy model checkpoint for future use.""" tf.logging.info("Copying checkpoint from %s to %s.", in_path, out_path) tf.gfile.Copy( in_path + ".data-00000-of-00001", out_path + ".data-00000-of-00001", overwrite=True) tf.gfile.Copy(in_path + ".index", out_path...
[ "def", "_copy_model", "(", "in_path", ",", "out_path", ")", ":", "tf", ".", "logging", ".", "info", "(", "\"Copying checkpoint from %s to %s.\"", ",", "in_path", ",", "out_path", ")", "tf", ".", "gfile", ".", "Copy", "(", "in_path", "+", "\".data-00000-of-0000...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/labs/drkit/run_dualencoder_lsf.py#L2135-L2143
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/cloud/clouds/profitbricks.py
python
stop
(name, call=None)
return True
stop a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful CLI Example: .. code-block:: bash salt-cloud -a stop vm_name
stop a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful
[ "stop", "a", "machine", "by", "name", ":", "param", "name", ":", "name", "given", "to", "the", "machine", ":", "param", "call", ":", "call", "value", "in", "this", "case", "is", "action", ":", "return", ":", "true", "if", "successful" ]
def stop(name, call=None): """ stop a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful CLI Example: .. code-block:: bash salt-cloud -a stop vm_name """ datacenter_id = get_datacenter_id() ...
[ "def", "stop", "(", "name", ",", "call", "=", "None", ")", ":", "datacenter_id", "=", "get_datacenter_id", "(", ")", "conn", "=", "get_conn", "(", ")", "node", "=", "get_node", "(", "conn", ",", "name", ")", "conn", ".", "stop_server", "(", "datacenter...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/clouds/profitbricks.py#L1011-L1030
TheAlgorithms/Python
9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c
project_euler/problem_206/sol1.py
python
solution
()
return num * 10
Returns the first integer whose square is of the form 1_2_3_4_5_6_7_8_9_0
Returns the first integer whose square is of the form 1_2_3_4_5_6_7_8_9_0
[ "Returns", "the", "first", "integer", "whose", "square", "is", "of", "the", "form", "1_2_3_4_5_6_7_8_9_0" ]
def solution() -> int: """ Returns the first integer whose square is of the form 1_2_3_4_5_6_7_8_9_0 """ num = 138902663 while not is_square_form(num * num): if num % 10 == 3: num -= 6 # (3 - 6) % 10 = 7 else: num -= 4 # (7 - 4) % 10 = 3 return num * 1...
[ "def", "solution", "(", ")", "->", "int", ":", "num", "=", "138902663", "while", "not", "is_square_form", "(", "num", "*", "num", ")", ":", "if", "num", "%", "10", "==", "3", ":", "num", "-=", "6", "# (3 - 6) % 10 = 7", "else", ":", "num", "-=", "4...
https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/project_euler/problem_206/sol1.py#L58-L70
evilhero/mylar
dbee01d7e48e8c717afa01b2de1946c5d0b956cb
lib/cherrypy/wsgiserver/wsgiserver2.py
python
read_headers
(rfile, hdict=None)
return hdict
Read headers from the given stream into the given header dict. If hdict is None, a new header dict is created. Returns the populated header dict. Headers which are repeated are folded together using a comma if their specification so dictates. This function raises ValueError when the read bytes vi...
Read headers from the given stream into the given header dict.
[ "Read", "headers", "from", "the", "given", "stream", "into", "the", "given", "header", "dict", "." ]
def read_headers(rfile, hdict=None): """Read headers from the given stream into the given header dict. If hdict is None, a new header dict is created. Returns the populated header dict. Headers which are repeated are folded together using a comma if their specification so dictates. This funct...
[ "def", "read_headers", "(", "rfile", ",", "hdict", "=", "None", ")", ":", "if", "hdict", "is", "None", ":", "hdict", "=", "{", "}", "while", "True", ":", "line", "=", "rfile", ".", "readline", "(", ")", "if", "not", "line", ":", "# No more data--ille...
https://github.com/evilhero/mylar/blob/dbee01d7e48e8c717afa01b2de1946c5d0b956cb/lib/cherrypy/wsgiserver/wsgiserver2.py#L218-L264
Kismuz/btgym
7fb3316e67f1d7a17c620630fb62fb29428b2cec
btgym/research/model_based/model/rec.py
python
OUEstimator.__init__
(self, alpha)
Args: alpha: float in [0, 1], decaying window factor. Notes: alpha ~ 1 / effective_window_length; parameters fitted are: Mu, Log_Theta, Log_Sigma, for process: dX = -Theta *(X - Mu) + Sigma * dW;
[]
def __init__(self, alpha): """ Args: alpha: float in [0, 1], decaying window factor. Notes: alpha ~ 1 / effective_window_length; parameters fitted are: Mu, Log_Theta, Log_Sigma, for process: dX = -Theta *(X - Mu) + Sigma * dW; """ self.alpha...
[ "def", "__init__", "(", "self", ",", "alpha", ")", ":", "self", ".", "alpha", "=", "alpha", "self", ".", "covariance_estimator", "=", "Covariance", "(", "2", ",", "alpha", ")", "self", ".", "residuals_stat", "=", "Zscore", "(", "1", ",", "alpha", ")", ...
https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/research/model_based/model/rec.py#L545-L564
p5py/p5
4ef1580b26179f1973c1669751da4522c5823f17
p5/sketch/Vispy2DRenderer/base.py
python
VispySketch._save_buffer
(self)
Save the renderer buffer to the given file.
Save the renderer buffer to the given file.
[ "Save", "the", "renderer", "buffer", "to", "the", "given", "file", "." ]
def _save_buffer(self): """Save the renderer buffer to the given file. """ img_data = p5.renderer.fbuffer.read(mode='color', alpha=False) img = Image.fromarray(img_data) img.save(self._save_fname) self._save_flag = False
[ "def", "_save_buffer", "(", "self", ")", ":", "img_data", "=", "p5", ".", "renderer", ".", "fbuffer", ".", "read", "(", "mode", "=", "'color'", ",", "alpha", "=", "False", ")", "img", "=", "Image", ".", "fromarray", "(", "img_data", ")", "img", ".", ...
https://github.com/p5py/p5/blob/4ef1580b26179f1973c1669751da4522c5823f17/p5/sketch/Vispy2DRenderer/base.py#L127-L133
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/imp.py
python
get_magic
()
return util.MAGIC_NUMBER
**DEPRECATED** Return the magic number for .pyc or .pyo files.
**DEPRECATED**
[ "**", "DEPRECATED", "**" ]
def get_magic(): """**DEPRECATED** Return the magic number for .pyc or .pyo files. """ return util.MAGIC_NUMBER
[ "def", "get_magic", "(", ")", ":", "return", "util", ".", "MAGIC_NUMBER" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/imp.py#L58-L63
elyra-ai/elyra
5bb2009a7c475bda63f1cc2767eb8c4dfba9a239
elyra/cli/pipeline_app.py
python
run
(json_option, pipeline_path)
Run a pipeline in your local environment
Run a pipeline in your local environment
[ "Run", "a", "pipeline", "in", "your", "local", "environment" ]
def run(json_option, pipeline_path): """ Run a pipeline in your local environment """ click.echo() print_banner("Elyra Pipeline Local Run") _validate_pipeline_file_extension(pipeline_path) pipeline_definition = \ _preprocess_pipeline(pipeline_path, runtime='local', runtime_config=...
[ "def", "run", "(", "json_option", ",", "pipeline_path", ")", ":", "click", ".", "echo", "(", ")", "print_banner", "(", "\"Elyra Pipeline Local Run\"", ")", "_validate_pipeline_file_extension", "(", "pipeline_path", ")", "pipeline_definition", "=", "_preprocess_pipeline"...
https://github.com/elyra-ai/elyra/blob/5bb2009a7c475bda63f1cc2767eb8c4dfba9a239/elyra/cli/pipeline_app.py#L317-L340
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
core/error.py
python
_ControlFlow.IsBreak
(self)
return self.token.id == Id.ControlFlow_Break
[]
def IsBreak(self): # type: () -> bool from _devbuild.gen.id_kind_asdl import Id # TODO: fix circular dep return self.token.id == Id.ControlFlow_Break
[ "def", "IsBreak", "(", "self", ")", ":", "# type: () -> bool", "from", "_devbuild", ".", "gen", ".", "id_kind_asdl", "import", "Id", "# TODO: fix circular dep", "return", "self", ".", "token", ".", "id", "==", "Id", ".", "ControlFlow_Break" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/core/error.py#L49-L53
BillBillBillBill/Tickeys-linux
2df31b8665004c58a5d4ab05277f245267d96364
tickeys/kivy_32/kivy/lang.py
python
BuilderBase.sync
(self)
Execute all the waiting operations, such as the execution of all the expressions related to the canvas. .. versionadded:: 1.7.0
Execute all the waiting operations, such as the execution of all the expressions related to the canvas.
[ "Execute", "all", "the", "waiting", "operations", "such", "as", "the", "execution", "of", "all", "the", "expressions", "related", "to", "the", "canvas", "." ]
def sync(self): '''Execute all the waiting operations, such as the execution of all the expressions related to the canvas. .. versionadded:: 1.7.0 ''' global _delayed_start next_args = _delayed_start if next_args is None: return while next_ar...
[ "def", "sync", "(", "self", ")", ":", "global", "_delayed_start", "next_args", "=", "_delayed_start", "if", "next_args", "is", "None", ":", "return", "while", "next_args", "is", "not", "StopIteration", ":", "# is this try/except still needed? yes, in case widget died in...
https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/lang.py#L2067-L2088
roglew/guppy-proxy
01df16be71dd9f23d7de415a315821659c29bc63
guppyproxy/hexteditor.py
python
PrettyPrintWidget.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.headers = Headers() self.data = b'' self.view = 0 self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.stack = QStackedLayout() self.stack.setCont...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "QWidget", ".", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "headers", "=", "Headers", "(", ")", "self", ".", "data", ...
https://github.com/roglew/guppy-proxy/blob/01df16be71dd9f23d7de415a315821659c29bc63/guppyproxy/hexteditor.py#L21-L51
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/document/events.py
python
ModelChangedEvent.__init__
(self, document, model, attr, old, new, serializable_new, hint=None, setter=None, callback_invoker=None)
Args: document (Document) : A Bokeh document that is to be updated. model (Model) : A Model to update attr (str) : The name of the attribute to update on the model. old (object) : The old value of the attr...
[]
def __init__(self, document, model, attr, old, new, serializable_new, hint=None, setter=None, callback_invoker=None): ''' Args: document (Document) : A Bokeh document that is to be updated. model (Model) : A Model to update attr (str...
[ "def", "__init__", "(", "self", ",", "document", ",", "model", ",", "attr", ",", "old", ",", "new", ",", "serializable_new", ",", "hint", "=", "None", ",", "setter", "=", "None", ",", "callback_invoker", "=", "None", ")", ":", "if", "setter", "is", "...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/document/events.py#L162-L213
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tcaplusdb/v20190823/models.py
python
VerifyIdlFilesResponse.__init__
(self)
r""" :param IdlFiles: 本次上传校验所有的IDL文件信息列表 :type IdlFiles: list of IdlFileInfo :param TotalCount: 读取IDL描述文件后解析出的合法表数量,不包含已经创建的表 :type TotalCount: int :param TableInfos: 读取IDL描述文件后解析出的合法表列表,不包含已经创建的表 :type TableInfos: list of ParsedTableInfoNew :param RequestId: 唯一请求...
r""" :param IdlFiles: 本次上传校验所有的IDL文件信息列表 :type IdlFiles: list of IdlFileInfo :param TotalCount: 读取IDL描述文件后解析出的合法表数量,不包含已经创建的表 :type TotalCount: int :param TableInfos: 读取IDL描述文件后解析出的合法表列表,不包含已经创建的表 :type TableInfos: list of ParsedTableInfoNew :param RequestId: 唯一请求...
[ "r", ":", "param", "IdlFiles", ":", "本次上传校验所有的IDL文件信息列表", ":", "type", "IdlFiles", ":", "list", "of", "IdlFileInfo", ":", "param", "TotalCount", ":", "读取IDL描述文件后解析出的合法表数量,不包含已经创建的表", ":", "type", "TotalCount", ":", "int", ":", "param", "TableInfos", ":", "读取IDL描...
def __init__(self): r""" :param IdlFiles: 本次上传校验所有的IDL文件信息列表 :type IdlFiles: list of IdlFileInfo :param TotalCount: 读取IDL描述文件后解析出的合法表数量,不包含已经创建的表 :type TotalCount: int :param TableInfos: 读取IDL描述文件后解析出的合法表列表,不包含已经创建的表 :type TableInfos: list of ParsedTableInfoNew ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "IdlFiles", "=", "None", "self", ".", "TotalCount", "=", "None", "self", ".", "TableInfos", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcaplusdb/v20190823/models.py#L5155-L5169
FabriceSalvaire/PySpice
1fb97dc21abcf04cfd78802671322eef5c0de00b
PySpice/Spice/NgSpice/Server.py
python
SpiceServer._parse_stdout
(self, stdout)
Parse stdout for errors.
Parse stdout for errors.
[ "Parse", "stdout", "for", "errors", "." ]
def _parse_stdout(self, stdout): """Parse stdout for errors.""" # self._logger.debug(os.linesep + stdout) error_found = False # UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 870: invalid start byte # lines = stdout.decode('utf-8').splitlines() li...
[ "def", "_parse_stdout", "(", "self", ",", "stdout", ")", ":", "# self._logger.debug(os.linesep + stdout)", "error_found", "=", "False", "# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 870: invalid start byte", "# lines = stdout.decode('utf-8').splitlines()", "line...
https://github.com/FabriceSalvaire/PySpice/blob/1fb97dc21abcf04cfd78802671322eef5c0de00b/PySpice/Spice/NgSpice/Server.py#L98-L113
limodou/uliweb
8bc827fa6bf7bf58aa8136b6c920fe2650c52422
uliweb/lib/colorama/ansitowin32.py
python
AnsiToWin32.should_wrap
(self)
return self.convert or self.strip or self.autoreset
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requeste...
True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionality like autoreset has been requeste...
[ "True", "if", "this", "class", "is", "actually", "needed", ".", "If", "false", "then", "the", "output", "stream", "will", "not", "be", "affected", "nor", "will", "win32", "calls", "be", "issued", "so", "wrapping", "stdout", "is", "not", "actually", "requir...
def should_wrap(self): ''' True if this class is actually needed. If false, then the output stream will not be affected, nor will win32 calls be issued, so wrapping stdout is not actually required. This will generally be False on non-Windows platforms, unless optional functionali...
[ "def", "should_wrap", "(", "self", ")", ":", "return", "self", ".", "convert", "or", "self", ".", "strip", "or", "self", ".", "autoreset" ]
https://github.com/limodou/uliweb/blob/8bc827fa6bf7bf58aa8136b6c920fe2650c52422/uliweb/lib/colorama/ansitowin32.py#L74-L82
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/simplejson/decoder.py
python
JSONDecoder.__init__
(self, encoding=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)
*encoding* determines the encoding used to interpret any :class:`str` objects decoded by this instance (``'utf-8'`` by default). It has no effect when decoding :class:`unicode` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings sho...
*encoding* determines the encoding used to interpret any :class:`str` objects decoded by this instance (``'utf-8'`` by default). It has no effect when decoding :class:`unicode` objects.
[ "*", "encoding", "*", "determines", "the", "encoding", "used", "to", "interpret", "any", ":", "class", ":", "str", "objects", "decoded", "by", "this", "instance", "(", "utf", "-", "8", "by", "default", ")", ".", "It", "has", "no", "effect", "when", "de...
def __init__(self, encoding=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None): """ *encoding* determines the encoding used to interpret any :class:`str` objects decoded by this instance (``'utf-8'`` by ...
[ "def", "__init__", "(", "self", ",", "encoding", "=", "None", ",", "object_hook", "=", "None", ",", "parse_float", "=", "None", ",", "parse_int", "=", "None", ",", "parse_constant", "=", "None", ",", "strict", "=", "True", ",", "object_pairs_hook", "=", ...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/simplejson/decoder.py#L302-L361
RenYurui/StructureFlow
1ac8f559475452e6b674699671c6b34f000d9ebd
src/network.py
python
Get_image.forward
(self, x)
return self.conv(x)
[]
def forward(self, x): return self.conv(x)
[ "def", "forward", "(", "self", ",", "x", ")", ":", "return", "self", ".", "conv", "(", "x", ")" ]
https://github.com/RenYurui/StructureFlow/blob/1ac8f559475452e6b674699671c6b34f000d9ebd/src/network.py#L234-L235
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/pi_hole/__init__.py
python
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
return unload_ok
Unload Pi-hole entry.
Unload Pi-hole entry.
[ "Unload", "Pi", "-", "hole", "entry", "." ]
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Pi-hole entry.""" unload_ok = await hass.config_entries.async_unload_platforms( entry, _async_platforms(entry) ) if unload_ok: hass.data[DOMAIN].pop(entry.entry_id) return unload_ok
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "entry", ",", "_async_platforms", "("...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/pi_hole/__init__.py#L143-L150
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/knobctrl.py
python
KnobCtrlEvent.SetValue
(self, value)
Sets the new :class:`KnobCtrl` value for this event. :param `value`: an integer representing the new value.
Sets the new :class:`KnobCtrl` value for this event.
[ "Sets", "the", "new", ":", "class", ":", "KnobCtrl", "value", "for", "this", "event", "." ]
def SetValue(self, value): """ Sets the new :class:`KnobCtrl` value for this event. :param `value`: an integer representing the new value. """ self._value = value
[ "def", "SetValue", "(", "self", ",", "value", ")", ":", "self", ".", "_value", "=", "value" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/knobctrl.py#L200-L207
nooperpudd/chinastock
bad839f1177bba21cacbf448ef20391702dbcf01
httpGet.py
python
httpGetContent
(url, headers=None, charset=None)
httplib2处理请求
httplib2处理请求
[ "httplib2处理请求" ]
def httpGetContent(url, headers=None, charset=None): "httplib2处理请求" try: http = httplib2.Http() request, content = http.request(uri=url, headers=headers) if request.status == 200 and content: if charset: return content.decode(charset).encode('utf8') ...
[ "def", "httpGetContent", "(", "url", ",", "headers", "=", "None", ",", "charset", "=", "None", ")", ":", "try", ":", "http", "=", "httplib2", ".", "Http", "(", ")", "request", ",", "content", "=", "http", ".", "request", "(", "uri", "=", "url", ","...
https://github.com/nooperpudd/chinastock/blob/bad839f1177bba21cacbf448ef20391702dbcf01/httpGet.py#L12-L23
geometalab/Vector-Tiles-Reader-QGIS-Plugin
a31ae86959c8f3b7d6f332f84191cd7ca4683e1d
ext-libs/shapely/geos.py
python
WKBWriter.__setattr__
(self, name, value)
Limit setting attributes
Limit setting attributes
[ "Limit", "setting", "attributes" ]
def __setattr__(self, name, value): """Limit setting attributes""" if hasattr(self, name): object.__setattr__(self, name, value) else: raise AttributeError('%r object has no attribute %r' % (self.__class__.__name__, name))
[ "def", "__setattr__", "(", "self", ",", "name", ",", "value", ")", ":", "if", "hasattr", "(", "self", ",", "name", ")", ":", "object", ".", "__setattr__", "(", "self", ",", "name", ",", "value", ")", "else", ":", "raise", "AttributeError", "(", "'%r ...
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/shapely/geos.py#L468-L474
vadmium/python-altium
9e3cf5a16150e74ba2b7e6d1f2895e0ce16b9a05
vector/svg.py
python
Renderer.hline
(self, a, b=None, *, width=None, offset=None, colour=None)
[]
def hline(self, a, b=None, *, width=None, offset=None, colour=None): a = format(a) if b is None: attrs = {"x2": a} else: attrs = {"x1": a, "x2": format(b)} self._line(attrs, width=width, offset=offset, colour=colour)
[ "def", "hline", "(", "self", ",", "a", ",", "b", "=", "None", ",", "*", ",", "width", "=", "None", ",", "offset", "=", "None", ",", "colour", "=", "None", ")", ":", "a", "=", "format", "(", "a", ")", "if", "b", "is", "None", ":", "attrs", "...
https://github.com/vadmium/python-altium/blob/9e3cf5a16150e74ba2b7e6d1f2895e0ce16b9a05/vector/svg.py#L101-L108
pavelliavonau/cmakeconverter
ef7afd3c7d8046a25754d679b5b7b97706b7eee4
cmake_converter/visual_studio/vcxproj/flags.py
python
CPPFlags.__set_calling_convention
(context, flag_name, node)
return flag_values
Set CallingConvention flag: /G**
Set CallingConvention flag: /G**
[ "Set", "CallingConvention", "flag", ":", "/", "G", "**" ]
def __set_calling_convention(context, flag_name, node): """ Set CallingConvention flag: /G** """ del context, flag_name, node flag_values = { 'Cdecl': {cl_flags: '/Gd'}, 'FastCall': {cl_flags: '/Gr'}, 'StdCall': {cl_flags: '/Gz'}, ...
[ "def", "__set_calling_convention", "(", "context", ",", "flag_name", ",", "node", ")", ":", "del", "context", ",", "flag_name", ",", "node", "flag_values", "=", "{", "'Cdecl'", ":", "{", "cl_flags", ":", "'/Gd'", "}", ",", "'FastCall'", ":", "{", "cl_flags...
https://github.com/pavelliavonau/cmakeconverter/blob/ef7afd3c7d8046a25754d679b5b7b97706b7eee4/cmake_converter/visual_studio/vcxproj/flags.py#L700-L714
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/http/cookies.py
python
BaseCookie.output
(self, attrs=None, header="Set-Cookie:", sep="\015\012")
return sep.join(result)
Return a string suitable for HTTP.
Return a string suitable for HTTP.
[ "Return", "a", "string", "suitable", "for", "HTTP", "." ]
def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): """Return a string suitable for HTTP.""" result = [] items = sorted(self.items()) for key, value in items: result.append(value.output(attrs, header)) return sep.join(result)
[ "def", "output", "(", "self", ",", "attrs", "=", "None", ",", "header", "=", "\"Set-Cookie:\"", ",", "sep", "=", "\"\\015\\012\"", ")", ":", "result", "=", "[", "]", "items", "=", "sorted", "(", "self", ".", "items", "(", ")", ")", "for", "key", ",...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/http/cookies.py#L497-L503
hak5/nano-tetra-modules
aa43cb5e2338b8dbd12a75314104a34ba608263b
PortalAuth/includes/scripts/libs/email/header.py
python
Header.encode
(self, splitchars=';, ')
return value
Encode a message header into an RFC-compliant format. There are many issues involved in converting a given string for use in an email header. Only certain character sets are readable in most email clients, and as header strings can only contain a subset of 7-bit ASCII, care must be tak...
Encode a message header into an RFC-compliant format.
[ "Encode", "a", "message", "header", "into", "an", "RFC", "-", "compliant", "format", "." ]
def encode(self, splitchars=';, '): """Encode a message header into an RFC-compliant format. There are many issues involved in converting a given string for use in an email header. Only certain character sets are readable in most email clients, and as header strings can only contain a ...
[ "def", "encode", "(", "self", ",", "splitchars", "=", "';, '", ")", ":", "newchunks", "=", "[", "]", "maxlinelen", "=", "self", ".", "_firstlinelen", "lastlen", "=", "0", "for", "s", ",", "charset", "in", "self", ".", "_chunks", ":", "# The first bit of ...
https://github.com/hak5/nano-tetra-modules/blob/aa43cb5e2338b8dbd12a75314104a34ba608263b/PortalAuth/includes/scripts/libs/email/header.py#L374-L414
LuxCoreRender/BlendLuxCore
bf31ca58501d54c02acd97001b6db7de81da7cbf
ui/lol/panel.py
python
VIEW3D_PT_LUXCORE_ONLINE_LIBRARY_SCAN_RESULT.draw_addlist
(self, layout, asset, idx)
[]
def draw_addlist(self, layout, asset, idx): col = layout.column(align=True) # Upper row (enable/disable, name, remove) box = col.box() row = box.row() col = row.column() col.prop(asset, "show_settings", icon=settings_toggle_icon(asset.show_settings), ...
[ "def", "draw_addlist", "(", "self", ",", "layout", ",", "asset", ",", "idx", ")", ":", "col", "=", "layout", ".", "column", "(", "align", "=", "True", ")", "# Upper row (enable/disable, name, remove)", "box", "=", "col", ".", "box", "(", ")", "row", "=",...
https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/ui/lol/panel.py#L352-L384
jayleicn/scipy-lecture-notes-zh-CN
cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6
packages/traits/reservoir_state_property_view.py
python
ReservoirState._get_spillage
(self)
return max(overflow, 0)
[]
def _get_spillage(self): new_storage = self._storage - self.release + self.inflows overflow = new_storage - self.max_storage return max(overflow, 0)
[ "def", "_get_spillage", "(", "self", ")", ":", "new_storage", "=", "self", ".", "_storage", "-", "self", ".", "release", "+", "self", ".", "inflows", "overflow", "=", "new_storage", "-", "self", ".", "max_storage", "return", "max", "(", "overflow", ",", ...
https://github.com/jayleicn/scipy-lecture-notes-zh-CN/blob/cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6/packages/traits/reservoir_state_property_view.py#L49-L52
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
telegram/user.py
python
User.copy_message
( self, chat_id: Union[int, str], message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, reply_...
return self.bot.copy_message( from_chat_id=self.id, chat_id=chat_id, message_id=message_id, caption=caption, parse_mode=parse_mode, caption_entities=caption_entities, disable_notification=disable_notification, reply_to_messa...
Shortcut for:: bot.copy_message(from_chat_id=update.effective_user.id, *args, **kwargs) For the documentation of the arguments, please see :meth:`telegram.Bot.copy_message`. Returns: :class:`telegram.Message`: On success, instance representing the message posted.
Shortcut for::
[ "Shortcut", "for", "::" ]
def copy_message( self, chat_id: Union[int, str], message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE...
[ "def", "copy_message", "(", "self", ",", "chat_id", ":", "Union", "[", "int", ",", "str", "]", ",", "message_id", ":", "int", ",", "caption", ":", "str", "=", "None", ",", "parse_mode", ":", "ODVInput", "[", "str", "]", "=", "DEFAULT_NONE", ",", "cap...
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/user.py#L1158-L1197
conansherry/detectron2
72c935d9aad8935406b1038af408aa06077d950a
detectron2/engine/hooks.py
python
PeriodicWriter.__init__
(self, writers, period=20)
Args: writers (list[EventWriter]): a list of EventWriter objects period (int):
Args: writers (list[EventWriter]): a list of EventWriter objects period (int):
[ "Args", ":", "writers", "(", "list", "[", "EventWriter", "]", ")", ":", "a", "list", "of", "EventWriter", "objects", "period", "(", "int", ")", ":" ]
def __init__(self, writers, period=20): """ Args: writers (list[EventWriter]): a list of EventWriter objects period (int): """ self._writers = writers for w in writers: assert isinstance(w, EventWriter), w self._period = period
[ "def", "__init__", "(", "self", ",", "writers", ",", "period", "=", "20", ")", ":", "self", ".", "_writers", "=", "writers", "for", "w", "in", "writers", ":", "assert", "isinstance", "(", "w", ",", "EventWriter", ")", ",", "w", "self", ".", "_period"...
https://github.com/conansherry/detectron2/blob/72c935d9aad8935406b1038af408aa06077d950a/detectron2/engine/hooks.py#L150-L159
datastax/python-driver
5fdb0061f56f53b9d8d8ad67b99110899653ad77
cassandra/cqlengine/management.py
python
_get_index_name_by_column
(table, column_name)
Find the index name for a given table and column.
Find the index name for a given table and column.
[ "Find", "the", "index", "name", "for", "a", "given", "table", "and", "column", "." ]
def _get_index_name_by_column(table, column_name): """ Find the index name for a given table and column. """ protected_name = metadata.protect_name(column_name) possible_index_values = [protected_name, "values(%s)" % protected_name] for index_metadata in table.indexes.values(): options =...
[ "def", "_get_index_name_by_column", "(", "table", ",", "column_name", ")", ":", "protected_name", "=", "metadata", ".", "protect_name", "(", "column_name", ")", "possible_index_values", "=", "[", "protected_name", ",", "\"values(%s)\"", "%", "protected_name", "]", "...
https://github.com/datastax/python-driver/blob/5fdb0061f56f53b9d8d8ad67b99110899653ad77/cassandra/cqlengine/management.py#L152-L161
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
tensorflow2/tf2cv/models/mobilenet_cub.py
python
fdmobilenet_w1_cub
(classes=200, **kwargs)
return get_fdmobilenet(classes=classes, width_scale=1.0, model_name="fdmobilenet_w1_cub", **kwargs)
FD-MobileNet 1.0x model for CUB-200-2011 from 'FD-MobileNet: Improved MobileNet with A Fast Downsampling Strategy,' https://arxiv.org/abs/1802.03750. Parameters: ---------- classes : int, default 200 Number of classification classes. pretrained : bool, default False Whether to load ...
FD-MobileNet 1.0x model for CUB-200-2011 from 'FD-MobileNet: Improved MobileNet with A Fast Downsampling Strategy,' https://arxiv.org/abs/1802.03750.
[ "FD", "-", "MobileNet", "1", ".", "0x", "model", "for", "CUB", "-", "200", "-", "2011", "from", "FD", "-", "MobileNet", ":", "Improved", "MobileNet", "with", "A", "Fast", "Downsampling", "Strategy", "https", ":", "//", "arxiv", ".", "org", "/", "abs", ...
def fdmobilenet_w1_cub(classes=200, **kwargs): """ FD-MobileNet 1.0x model for CUB-200-2011 from 'FD-MobileNet: Improved MobileNet with A Fast Downsampling Strategy,' https://arxiv.org/abs/1802.03750. Parameters: ---------- classes : int, default 200 Number of classification classes. ...
[ "def", "fdmobilenet_w1_cub", "(", "classes", "=", "200", ",", "*", "*", "kwargs", ")", ":", "return", "get_fdmobilenet", "(", "classes", "=", "classes", ",", "width_scale", "=", "1.0", ",", "model_name", "=", "\"fdmobilenet_w1_cub\"", ",", "*", "*", "kwargs"...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/mobilenet_cub.py#L85-L99
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/mailbox.py
python
Maildir.add
(self, message)
return uniq
Add message and return assigned key.
Add message and return assigned key.
[ "Add", "message", "and", "return", "assigned", "key", "." ]
def add(self, message): """Add message and return assigned key.""" tmp_file = self._create_tmp() try: self._dump_message(message, tmp_file) except BaseException: tmp_file.close() os.remove(tmp_file.name) raise _sync_close(tmp_file) ...
[ "def", "add", "(", "self", ",", "message", ")", ":", "tmp_file", "=", "self", ".", "_create_tmp", "(", ")", "try", ":", "self", ".", "_dump_message", "(", "message", ",", "tmp_file", ")", "except", "BaseException", ":", "tmp_file", ".", "close", "(", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/mailbox.py#L267-L306
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/scf/v20180416/scf_client.py
python
ScfClient.UpdateNamespace
(self, request)
更新命名空间 :param request: Request instance for UpdateNamespace. :type request: :class:`tencentcloud.scf.v20180416.models.UpdateNamespaceRequest` :rtype: :class:`tencentcloud.scf.v20180416.models.UpdateNamespaceResponse`
更新命名空间
[ "更新命名空间" ]
def UpdateNamespace(self, request): """更新命名空间 :param request: Request instance for UpdateNamespace. :type request: :class:`tencentcloud.scf.v20180416.models.UpdateNamespaceRequest` :rtype: :class:`tencentcloud.scf.v20180416.models.UpdateNamespaceResponse` """ try: ...
[ "def", "UpdateNamespace", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"UpdateNamespace\"", ",", "params", ")", "response", "=", "json", ".", "loads", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/scf/v20180416/scf_client.py#L1240-L1265
holoviz/datashader
25578abde75c7fa28c6633b33cb8d8a1e433da67
datashader/utils.py
python
compute_coords
(width, height, x_range, y_range, res)
return xs, ys
Computes DataArray coordinates at bin centers Parameters ---------- width : int Number of coordinates along the x-axis height : int Number of coordinates along the y-axis x_range : tuple Left and right edge of the coordinates y_range : tuple Bottom and top edges ...
Computes DataArray coordinates at bin centers
[ "Computes", "DataArray", "coordinates", "at", "bin", "centers" ]
def compute_coords(width, height, x_range, y_range, res): """ Computes DataArray coordinates at bin centers Parameters ---------- width : int Number of coordinates along the x-axis height : int Number of coordinates along the y-axis x_range : tuple Left and right edg...
[ "def", "compute_coords", "(", "width", ",", "height", ",", "x_range", ",", "y_range", ",", "res", ")", ":", "(", "x0", ",", "x1", ")", ",", "(", "y0", ",", "y1", ")", "=", "x_range", ",", "y_range", "xd", "=", "(", "x1", "-", "x0", ")", "/", ...
https://github.com/holoviz/datashader/blob/25578abde75c7fa28c6633b33cb8d8a1e433da67/datashader/utils.py#L289-L324
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/toiletlid.py
python
Toiletlid.get_all_user_info
(self)
return users
Get All bind user.
Get All bind user.
[ "Get", "All", "bind", "user", "." ]
def get_all_user_info(self) -> List[Dict]: """Get All bind user.""" users = self.send("get_all_user_info") return users
[ "def", "get_all_user_info", "(", "self", ")", "->", "List", "[", "Dict", "]", ":", "users", "=", "self", ".", "send", "(", "\"get_all_user_info\"", ")", "return", "users" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/toiletlid.py#L131-L134
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cuda/cudadrv/driver.py
python
_pin_finalizer
(memory_manager, ptr, alloc_key, mapped)
return core
Finalize temporary page-locking of host memory by `context.mempin`. This applies to memory not otherwise managed by CUDA. Page-locking can be requested multiple times on the same memory, and must therefore be lifted as soon as finalization is requested, otherwise subsequent calls to `mempin` may fail w...
Finalize temporary page-locking of host memory by `context.mempin`.
[ "Finalize", "temporary", "page", "-", "locking", "of", "host", "memory", "by", "context", ".", "mempin", "." ]
def _pin_finalizer(memory_manager, ptr, alloc_key, mapped): """ Finalize temporary page-locking of host memory by `context.mempin`. This applies to memory not otherwise managed by CUDA. Page-locking can be requested multiple times on the same memory, and must therefore be lifted as soon as finaliza...
[ "def", "_pin_finalizer", "(", "memory_manager", ",", "ptr", ",", "alloc_key", ",", "mapped", ")", ":", "allocations", "=", "memory_manager", ".", "allocations", "def", "core", "(", ")", ":", "if", "mapped", "and", "allocations", ":", "del", "allocations", "[...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/cudadrv/driver.py#L1625-L1645
airbnb/streamalert
26cf1d08432ca285fd4f7410511a6198ca104bbb
streamalert/classifier/payload/payload_base.py
python
PayloadRecord.__bool__
(self)
return self._parser is not None
Valid if there is a parser, and the parser itself is valid ParserBase implements __nonzero__ as well, so return the result of it
Valid if there is a parser, and the parser itself is valid
[ "Valid", "if", "there", "is", "a", "parser", "and", "the", "parser", "itself", "is", "valid" ]
def __bool__(self): """Valid if there is a parser, and the parser itself is valid ParserBase implements __nonzero__ as well, so return the result of it """ return self._parser is not None
[ "def", "__bool__", "(", "self", ")", ":", "return", "self", ".", "_parser", "is", "not", "None" ]
https://github.com/airbnb/streamalert/blob/26cf1d08432ca285fd4f7410511a6198ca104bbb/streamalert/classifier/payload/payload_base.py#L47-L52
bashtage/linearmodels
9256269f01ff8c5f85e65342d66149a5636661b6
linearmodels/iv/model.py
python
_IVModelBase.predict
( self, params: ArrayLike, *, exog: Optional[IVDataLike] = None, endog: Optional[IVDataLike] = None, data: DataFrame = None, eval_env: int = 4, )
return pred
Predict values for additional data Parameters ---------- params : array_like Model parameters (nvar by 1) exog : array_like Exogenous regressors (nobs by nexog) endog : array_like Endogenous regressors (nobs by nendog) data : DataFrame...
Predict values for additional data
[ "Predict", "values", "for", "additional", "data" ]
def predict( self, params: ArrayLike, *, exog: Optional[IVDataLike] = None, endog: Optional[IVDataLike] = None, data: DataFrame = None, eval_env: int = 4, ) -> DataFrame: """ Predict values for additional data Parameters ------...
[ "def", "predict", "(", "self", ",", "params", ":", "ArrayLike", ",", "*", ",", "exog", ":", "Optional", "[", "IVDataLike", "]", "=", "None", ",", "endog", ":", "Optional", "[", "IVDataLike", "]", "=", "None", ",", "data", ":", "DataFrame", "=", "None...
https://github.com/bashtage/linearmodels/blob/9256269f01ff8c5f85e65342d66149a5636661b6/linearmodels/iv/model.py#L237-L306
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/requests/utils.py
python
add_dict_to_cookiejar
(cj, cookie_dict)
return cookiejar_from_dict(cookie_dict, cj)
Returns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar
Returns a CookieJar from a key/value dictionary.
[ "Returns", "a", "CookieJar", "from", "a", "key", "/", "value", "dictionary", "." ]
def add_dict_to_cookiejar(cj, cookie_dict): """Returns a CookieJar from a key/value dictionary. :param cj: CookieJar to insert cookies into. :param cookie_dict: Dict of key/values to insert into CookieJar. :rtype: CookieJar """ return cookiejar_from_dict(cookie_dict, cj)
[ "def", "add_dict_to_cookiejar", "(", "cj", ",", "cookie_dict", ")", ":", "return", "cookiejar_from_dict", "(", "cookie_dict", ",", "cj", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/requests/utils.py#L430-L438
nilmtk/nilmtk
d183c8bde7a5d3465ba72b38b7964d57d84f53c2
nilmtk/elecmeter.py
python
ElecMeter.total_energy
(self, **loader_kwargs)
return self._get_stat_from_cache_or_compute( nodes, TotalEnergy.results_class(), loader_kwargs)
Parameters ---------- full_results : bool, default=False **loader_kwargs : key word arguments for DataStore.load() Returns ------- if `full_results` is True then return TotalEnergyResults object else returns a pd.Series with a row for each AC type.
Parameters ---------- full_results : bool, default=False **loader_kwargs : key word arguments for DataStore.load()
[ "Parameters", "----------", "full_results", ":", "bool", "default", "=", "False", "**", "loader_kwargs", ":", "key", "word", "arguments", "for", "DataStore", ".", "load", "()" ]
def total_energy(self, **loader_kwargs): """ Parameters ---------- full_results : bool, default=False **loader_kwargs : key word arguments for DataStore.load() Returns ------- if `full_results` is True then return TotalEnergyResults object else re...
[ "def", "total_energy", "(", "self", ",", "*", "*", "loader_kwargs", ")", ":", "nodes", "=", "[", "Clip", ",", "TotalEnergy", "]", "return", "self", ".", "_get_stat_from_cache_or_compute", "(", "nodes", ",", "TotalEnergy", ".", "results_class", "(", ")", ",",...
https://github.com/nilmtk/nilmtk/blob/d183c8bde7a5d3465ba72b38b7964d57d84f53c2/nilmtk/elecmeter.py#L581-L595
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/iso8859_13.py
python
IncrementalDecoder.decode
(self, input, final=False)
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
[]
def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0]
[ "def", "decode", "(", "self", ",", "input", ",", "final", "=", "False", ")", ":", "return", "codecs", ".", "charmap_decode", "(", "input", ",", "self", ".", "errors", ",", "decoding_table", ")", "[", "0", "]" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/iso8859_13.py#L22-L23
readthedocs/sphinx-autoapi
71c6ceebe0b02c34027fcd3d56c8641e9b94c7af
autoapi/mappers/python/objects.py
python
PythonClass.docstring
(self)
return docstring
[]
def docstring(self): docstring = super().docstring if not self._docstring_resolved and self._class_content in ("both", "init"): constructor_docstring = self.constructor_docstring if constructor_docstring: if self._class_content == "both": doc...
[ "def", "docstring", "(", "self", ")", ":", "docstring", "=", "super", "(", ")", ".", "docstring", "if", "not", "self", ".", "_docstring_resolved", "and", "self", ".", "_class_content", "in", "(", "\"both\"", ",", "\"init\"", ")", ":", "constructor_docstring"...
https://github.com/readthedocs/sphinx-autoapi/blob/71c6ceebe0b02c34027fcd3d56c8641e9b94c7af/autoapi/mappers/python/objects.py#L390-L402
openai/baselines
ea25b9e8b234e6ee1bca43083f8f3cf974143998
baselines/deepq/replay_buffer.py
python
ReplayBuffer.sample
(self, batch_size)
return self._encode_sample(idxes)
Sample a batch of experiences. Parameters ---------- batch_size: int How many transitions to sample. Returns ------- obs_batch: np.array batch of observations act_batch: np.array batch of actions executed given obs_batch ...
Sample a batch of experiences.
[ "Sample", "a", "batch", "of", "experiences", "." ]
def sample(self, batch_size): """Sample a batch of experiences. Parameters ---------- batch_size: int How many transitions to sample. Returns ------- obs_batch: np.array batch of observations act_batch: np.array batch ...
[ "def", "sample", "(", "self", ",", "batch_size", ")", ":", "idxes", "=", "[", "random", ".", "randint", "(", "0", ",", "len", "(", "self", ".", "_storage", ")", "-", "1", ")", "for", "_", "in", "range", "(", "batch_size", ")", "]", "return", "sel...
https://github.com/openai/baselines/blob/ea25b9e8b234e6ee1bca43083f8f3cf974143998/baselines/deepq/replay_buffer.py#L45-L68
quantOS-org/JAQS
959762a518c22592f96433c573d1f99ec0c89152
jaqs/trade/livetrade.py
python
EventLiveTradeInstance.run
(self)
Listen to certain events and run the EventEngine. Events include: 1. market_data are from DataService 2. trades & orders indications are from TradeApi. 3. etc.
Listen to certain events and run the EventEngine. Events include: 1. market_data are from DataService 2. trades & orders indications are from TradeApi. 3. etc.
[ "Listen", "to", "certain", "events", "and", "run", "the", "EventEngine", ".", "Events", "include", ":", "1", ".", "market_data", "are", "from", "DataService", "2", ".", "trades", "&", "orders", "indications", "are", "from", "TradeApi", ".", "3", ".", "etc"...
def run(self): """ Listen to certain events and run the EventEngine. Events include: 1. market_data are from DataService 2. trades & orders indications are from TradeApi. 3. etc. """ self.register(EVENT_TYPE.MARKET_DATA, self.on_bar) ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "register", "(", "EVENT_TYPE", ".", "MARKET_DATA", ",", "self", ".", "on_bar", ")", "self", ".", "register", "(", "EVENT_TYPE", ".", "TASK_STATUS_IND", ",", "self", ".", "on_task_status", ")", "self", "."...
https://github.com/quantOS-org/JAQS/blob/959762a518c22592f96433c573d1f99ec0c89152/jaqs/trade/livetrade.py#L288-L306
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/requests/help.py
python
info
()
return { 'platform': platform_info, 'implementation': implementation_info, 'system_ssl': system_ssl_info, 'using_pyopenssl': pyopenssl is not None, 'pyOpenSSL': pyopenssl_info, 'urllib3': urllib3_info, 'chardet': chardet_info, 'cryptography': cryptography_...
Generate information for a bug report.
Generate information for a bug report.
[ "Generate", "information", "for", "a", "bug", "report", "." ]
def info(): """Generate information for a bug report.""" try: platform_info = { 'system': platform.system(), 'release': platform.release(), } except IOError: platform_info = { 'system': 'Unknown', 'release': 'Unknown', } im...
[ "def", "info", "(", ")", ":", "try", ":", "platform_info", "=", "{", "'system'", ":", "platform", ".", "system", "(", ")", ",", "'release'", ":", "platform", ".", "release", "(", ")", ",", "}", "except", "IOError", ":", "platform_info", "=", "{", "'s...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/requests/help.py#L59-L110
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_node_system_info.py
python
V1NodeSystemInfo.kernel_version
(self, kernel_version)
Sets the kernel_version of this V1NodeSystemInfo. Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). :param kernel_version: The kernel_version of this V1NodeSystemInfo. :type: str
Sets the kernel_version of this V1NodeSystemInfo. Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64).
[ "Sets", "the", "kernel_version", "of", "this", "V1NodeSystemInfo", ".", "Kernel", "Version", "reported", "by", "the", "node", "from", "uname", "-", "r", "(", "e", ".", "g", ".", "3", ".", "16", ".", "0", "-", "0", ".", "bpo", ".", "4", "-", "amd64"...
def kernel_version(self, kernel_version): """ Sets the kernel_version of this V1NodeSystemInfo. Kernel Version reported by the node from 'uname -r' (e.g. 3.16.0-0.bpo.4-amd64). :param kernel_version: The kernel_version of this V1NodeSystemInfo. :type: str """ if ...
[ "def", "kernel_version", "(", "self", ",", "kernel_version", ")", ":", "if", "kernel_version", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid value for `kernel_version`, must not be `None`\"", ")", "self", ".", "_kernel_version", "=", "kernel_version" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_node_system_info.py#L157-L168
PINTO0309/PINTO_model_zoo
2924acda7a7d541d8712efd7cc4fd1c61ef5bddd
119_M-LSD/demo/demo_mlsd-lines_tflite.py
python
main
()
[]
def main(): args = get_args() cap_device = args.device filepath = args.file model = args.model input_shape = [int(i) for i in args.input_shape.split(',')] score_thr = args.score_thr dist_thr = args.dist_thr # Initialize video capture cap = None if filepath is None: cap ...
[ "def", "main", "(", ")", ":", "args", "=", "get_args", "(", ")", "cap_device", "=", "args", ".", "device", "filepath", "=", "args", ".", "file", "model", "=", "args", ".", "model", "input_shape", "=", "[", "int", "(", "i", ")", "for", "i", "in", ...
https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/119_M-LSD/demo/demo_mlsd-lines_tflite.py#L34-L93
apache/incubator-spot
2d60a2adae7608b43e90ce1b9ec0adf24f6cc8eb
spot-oa/api/resources/configurator.py
python
SecHead.__init__
(self, fp)
[]
def __init__(self, fp): self.fp = fp self.sechead = '[conf]\n'
[ "def", "__init__", "(", "self", ",", "fp", ")", ":", "self", ".", "fp", "=", "fp", "self", ".", "sechead", "=", "'[conf]\\n'" ]
https://github.com/apache/incubator-spot/blob/2d60a2adae7608b43e90ce1b9ec0adf24f6cc8eb/spot-oa/api/resources/configurator.py#L90-L92
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
cherrypy/lib/auth_digest.py
python
get_ha1_dict
(user_ha1_dict)
return get_ha1
Returns a get_ha1 function which obtains a HA1 password hash from a dictionary of the form: {username : HA1}. If you want a dictionary-based authentication scheme, but with pre-computed HA1 hashes instead of plain-text passwords, use get_ha1_dict(my_userha1_dict) as the value for the get_ha1 argume...
Returns a get_ha1 function which obtains a HA1 password hash from a dictionary of the form: {username : HA1}.
[ "Returns", "a", "get_ha1", "function", "which", "obtains", "a", "HA1", "password", "hash", "from", "a", "dictionary", "of", "the", "form", ":", "{", "username", ":", "HA1", "}", "." ]
def get_ha1_dict(user_ha1_dict): """Returns a get_ha1 function which obtains a HA1 password hash from a dictionary of the form: {username : HA1}. If you want a dictionary-based authentication scheme, but with pre-computed HA1 hashes instead of plain-text passwords, use get_ha1_dict(my_userha1_dict)...
[ "def", "get_ha1_dict", "(", "user_ha1_dict", ")", ":", "def", "get_ha1", "(", "realm", ",", "username", ")", ":", "return", "user_ha1_dict", ".", "get", "(", "username", ")", "return", "get_ha1" ]
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/cherrypy/lib/auth_digest.py#L63-L75
salesforce/hassh
7e7658819d9722875316ca591d1a09f9fd21ed8c
python/hassh.py
python
server_hassh
(packet)
return record
returns HASSHServer (i.e. SSH Server Fingerprint) HASSHServer = md5(KEX;EASTC;MASTC;CASTC)
returns HASSHServer (i.e. SSH Server Fingerprint) HASSHServer = md5(KEX;EASTC;MASTC;CASTC)
[ "returns", "HASSHServer", "(", "i", ".", "e", ".", "SSH", "Server", "Fingerprint", ")", "HASSHServer", "=", "md5", "(", "KEX", ";", "EASTC", ";", "MASTC", ";", "CASTC", ")" ]
def server_hassh(packet): """returns HASSHServer (i.e. SSH Server Fingerprint) HASSHServer = md5(KEX;EASTC;MASTC;CASTC) """ srcip = packet.ip.src dstip = packet.ip.dst sport = packet.tcp.srcport dport = packet.tcp.srcport protocol = None key = '{}:{}_{}:{}'.format(srcip, sport, dstip...
[ "def", "server_hassh", "(", "packet", ")", ":", "srcip", "=", "packet", ".", "ip", ".", "src", "dstip", "=", "packet", ".", "ip", ".", "dst", "sport", "=", "packet", ".", "tcp", ".", "srcport", "dport", "=", "packet", ".", "tcp", ".", "srcport", "p...
https://github.com/salesforce/hassh/blob/7e7658819d9722875316ca591d1a09f9fd21ed8c/python/hassh.py#L208-L266
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/index.py
python
Index.to_native_types
(self, slicer=None, **kwargs)
return values._format_native_types(**kwargs)
slice and dice then format
slice and dice then format
[ "slice", "and", "dice", "then", "format" ]
def to_native_types(self, slicer=None, **kwargs): """ slice and dice then format """ values = self if slicer is not None: values = values[slicer] return values._format_native_types(**kwargs)
[ "def", "to_native_types", "(", "self", ",", "slicer", "=", "None", ",", "*", "*", "kwargs", ")", ":", "values", "=", "self", "if", "slicer", "is", "not", "None", ":", "values", "=", "values", "[", "slicer", "]", "return", "values", ".", "_format_native...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/core/index.py#L1287-L1292
Mendeley/mrec
d299e3b9490703843b041e6585643b7e42e229f0
mrec/__init__.py
python
read_recommender_description
(filepath)
return BaseRecommender.read_recommender_description(filepath)
Read a recommender model description from file after it has been saved by save_recommender(), without loading all the associated data into memory. Parameters ---------- filepath : str The filepath to read from.
Read a recommender model description from file after it has been saved by save_recommender(), without loading all the associated data into memory.
[ "Read", "a", "recommender", "model", "description", "from", "file", "after", "it", "has", "been", "saved", "by", "save_recommender", "()", "without", "loading", "all", "the", "associated", "data", "into", "memory", "." ]
def read_recommender_description(filepath): """ Read a recommender model description from file after it has been saved by save_recommender(), without loading all the associated data into memory. Parameters ---------- filepath : str The filepath to read from. """ return BaseR...
[ "def", "read_recommender_description", "(", "filepath", ")", ":", "return", "BaseRecommender", ".", "read_recommender_description", "(", "filepath", ")" ]
https://github.com/Mendeley/mrec/blob/d299e3b9490703843b041e6585643b7e42e229f0/mrec/__init__.py#L133-L144
beville/ComicStreamer
62eb914652695ea41a5e1f0cfbd044cbc6854e84
libs/comictaggerlib/utils.py
python
getLanguageFromISO
( iso )
[]
def getLanguageFromISO( iso ): if iso == None: return None else: return lang_dict[ iso ]
[ "def", "getLanguageFromISO", "(", "iso", ")", ":", "if", "iso", "==", "None", ":", "return", "None", "else", ":", "return", "lang_dict", "[", "iso", "]" ]
https://github.com/beville/ComicStreamer/blob/62eb914652695ea41a5e1f0cfbd044cbc6854e84/libs/comictaggerlib/utils.py#L581-L585
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/utils/cache.py
python
get_cache_key
(request, key_prefix=None, method='GET', cache=None)
Return a cache key based on the request URL and query. It can be used in the request phase because it pulls the list of headers to take into account from the global URL registry and uses those to build a cache key to check against. If there isn't a headerlist stored, return None, indicating that the pa...
Return a cache key based on the request URL and query. It can be used in the request phase because it pulls the list of headers to take into account from the global URL registry and uses those to build a cache key to check against.
[ "Return", "a", "cache", "key", "based", "on", "the", "request", "URL", "and", "query", ".", "It", "can", "be", "used", "in", "the", "request", "phase", "because", "it", "pulls", "the", "list", "of", "headers", "to", "take", "into", "account", "from", "...
def get_cache_key(request, key_prefix=None, method='GET', cache=None): """ Return a cache key based on the request URL and query. It can be used in the request phase because it pulls the list of headers to take into account from the global URL registry and uses those to build a cache key to check ag...
[ "def", "get_cache_key", "(", "request", ",", "key_prefix", "=", "None", ",", "method", "=", "'GET'", ",", "cache", "=", "None", ")", ":", "if", "key_prefix", "is", "None", ":", "key_prefix", "=", "settings", ".", "CACHE_MIDDLEWARE_KEY_PREFIX", "cache_key", "...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/utils/cache.py#L349-L368
tav/pylibs
3c16b843681f54130ee6a022275289cadb2f2a69
pycrypto/lib/Crypto/Random/_UserFriendlyRNG.py
python
RNGFile.__exit__
(self)
PEP 343 support
PEP 343 support
[ "PEP", "343", "support" ]
def __exit__(self): """PEP 343 support""" self.close()
[ "def", "__exit__", "(", "self", ")", ":", "self", ".", "close", "(", ")" ]
https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/pycrypto/lib/Crypto/Random/_UserFriendlyRNG.py#L173-L175
omriher/CapTipper
3fb2836c0afe60eb6bd5902b4214f564268e9b4d
jsontemplate/jsontemplate.py
python
expand
(template_str, dictionary, **kwargs)
return t.expand(dictionary)
Free function to expands a template string with a data dictionary. This is useful for cases where you don't care about saving the result of compilation (similar to re.match('.*', s) vs DOT_STAR.match(s))
Free function to expands a template string with a data dictionary.
[ "Free", "function", "to", "expands", "a", "template", "string", "with", "a", "data", "dictionary", "." ]
def expand(template_str, dictionary, **kwargs): """Free function to expands a template string with a data dictionary. This is useful for cases where you don't care about saving the result of compilation (similar to re.match('.*', s) vs DOT_STAR.match(s)) """ t = Template(template_str, **kwargs) return t.ex...
[ "def", "expand", "(", "template_str", ",", "dictionary", ",", "*", "*", "kwargs", ")", ":", "t", "=", "Template", "(", "template_str", ",", "*", "*", "kwargs", ")", "return", "t", ".", "expand", "(", "dictionary", ")" ]
https://github.com/omriher/CapTipper/blob/3fb2836c0afe60eb6bd5902b4214f564268e9b4d/jsontemplate/jsontemplate.py#L1219-L1226
pypr/pysph
9cb9a859934939307c65a25cbf73e4ecc83fea4a
pysph/solver/controller.py
python
CommandManager.cont
(self)
continue after a pause command
continue after a pause command
[ "continue", "after", "a", "pause", "command" ]
def cont(self): ''' continue after a pause command ''' if self.comm.Get_size() > 1: logger.debug('pause/continue noy yet supported in parallel runs') return with self.plock: self.pause.remove(threading.current_thread().ident) self.plock.notify() ...
[ "def", "cont", "(", "self", ")", ":", "if", "self", ".", "comm", ".", "Get_size", "(", ")", ">", "1", ":", "logger", ".", "debug", "(", "'pause/continue noy yet supported in parallel runs'", ")", "return", "with", "self", ".", "plock", ":", "self", ".", ...
https://github.com/pypr/pysph/blob/9cb9a859934939307c65a25cbf73e4ecc83fea4a/pysph/solver/controller.py#L320-L329
eirannejad/pyRevit
49c0b7eb54eb343458ce1365425e6552d0c47d44
site-packages/sqlalchemy/sql/selectable.py
python
HasPrefixes.prefix_with
(self, *expr, **kw)
r"""Add one or more expressions following the statement keyword, i.e. SELECT, INSERT, UPDATE, or DELETE. Generative. This is used to support backend-specific prefix keywords such as those provided by MySQL. E.g.:: stmt = table.insert().prefix_with("LOW_PRIORITY", dialect="...
r"""Add one or more expressions following the statement keyword, i.e. SELECT, INSERT, UPDATE, or DELETE. Generative.
[ "r", "Add", "one", "or", "more", "expressions", "following", "the", "statement", "keyword", "i", ".", "e", ".", "SELECT", "INSERT", "UPDATE", "or", "DELETE", ".", "Generative", "." ]
def prefix_with(self, *expr, **kw): r"""Add one or more expressions following the statement keyword, i.e. SELECT, INSERT, UPDATE, or DELETE. Generative. This is used to support backend-specific prefix keywords such as those provided by MySQL. E.g.:: stmt = table.in...
[ "def", "prefix_with", "(", "self", ",", "*", "expr", ",", "*", "*", "kw", ")", ":", "dialect", "=", "kw", ".", "pop", "(", "'dialect'", ",", "None", ")", "if", "kw", ":", "raise", "exc", ".", "ArgumentError", "(", "\"Unsupported argument(s): %s\"", "%"...
https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/sql/selectable.py#L246-L272
liuyubobobo/Play-with-Linear-Algebra
e86175adb908b03756618fbeeeadb448a3551321
03-More-about-Vectors/05-Implementations-of-Dot-Product/playLA/Vector.py
python
Vector.norm
(self)
return math.sqrt(sum(e**2 for e in self))
返回向量的模
返回向量的模
[ "返回向量的模" ]
def norm(self): """返回向量的模""" return math.sqrt(sum(e**2 for e in self))
[ "def", "norm", "(", "self", ")", ":", "return", "math", ".", "sqrt", "(", "sum", "(", "e", "**", "2", "for", "e", "in", "self", ")", ")" ]
https://github.com/liuyubobobo/Play-with-Linear-Algebra/blob/e86175adb908b03756618fbeeeadb448a3551321/03-More-about-Vectors/05-Implementations-of-Dot-Product/playLA/Vector.py#L29-L31
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/tools/ete_build_lib/curses_gui.py
python
main
(scr)
return
[]
def main(scr): curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK) curses.init_pair(3, curses.COLOR_GREEN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK) curses.init_pair(5, curses.COLOR_RED, curs...
[ "def", "main", "(", "scr", ")", ":", "curses", ".", "init_pair", "(", "1", ",", "curses", ".", "COLOR_WHITE", ",", "curses", ".", "COLOR_BLACK", ")", "curses", ".", "init_pair", "(", "2", ",", "curses", ".", "COLOR_MAGENTA", ",", "curses", ".", "COLOR_...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/tools/ete_build_lib/curses_gui.py#L88-L150
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/serene/wiki_index.py
python
ShardedEmbPaths.files
(self, tmp = False)
return sharded_files
Return the files for the sharded embeddings. Args: tmp: Whether to return paths in /tmp or not Returns: Paths of all sharded files.
Return the files for the sharded embeddings.
[ "Return", "the", "files", "for", "the", "sharded", "embeddings", "." ]
def files(self, tmp = False): """Return the files for the sharded embeddings. Args: tmp: Whether to return paths in /tmp or not Returns: Paths of all sharded files. """ sharded_files = [] for shard in range(self._n_shards): sharded_files.extend(self.shard_files(shard, tmp=tmp...
[ "def", "files", "(", "self", ",", "tmp", "=", "False", ")", ":", "sharded_files", "=", "[", "]", "for", "shard", "in", "range", "(", "self", ".", "_n_shards", ")", ":", "sharded_files", ".", "extend", "(", "self", ".", "shard_files", "(", "shard", ",...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/serene/wiki_index.py#L79-L92
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/timeit.py
python
Timer.repeat
(self, repeat=default_repeat, number=default_number)
return r
Call timeit() a few times. This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument specifies how many times to call timeit(), defaulting to 3; the second argument specifies the timer argument, defaulting to one million....
Call timeit() a few times.
[ "Call", "timeit", "()", "a", "few", "times", "." ]
def repeat(self, repeat=default_repeat, number=default_number): """Call timeit() a few times. This is a convenience function that calls the timeit() repeatedly, returning a list of results. The first argument specifies how many times to call timeit(), defaulting to 3; the secon...
[ "def", "repeat", "(", "self", ",", "repeat", "=", "default_repeat", ",", "number", "=", "default_number", ")", ":", "r", "=", "[", "]", "for", "i", "in", "range", "(", "repeat", ")", ":", "t", "=", "self", ".", "timeit", "(", "number", ")", "r", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/timeit.py#L201-L225
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
Projects/Word2Word/make.py
python
normalize
(tokens, ignore_first_word)
return tokens
If ignore_firs_word is True, We drop the first word or token because its true case is unclear.
If ignore_firs_word is True, We drop the first word or token because its true case is unclear.
[ "If", "ignore_firs_word", "is", "True", "We", "drop", "the", "first", "word", "or", "token", "because", "its", "true", "case", "is", "unclear", "." ]
def normalize(tokens, ignore_first_word): '''If ignore_firs_word is True, We drop the first word or token because its true case is unclear.''' if ignore_first_word: tokens = tokens[1:] return tokens
[ "def", "normalize", "(", "tokens", ",", "ignore_first_word", ")", ":", "if", "ignore_first_word", ":", "tokens", "=", "tokens", "[", "1", ":", "]", "return", "tokens" ]
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/Projects/Word2Word/make.py#L30-L36
ivre/ivre
5728855b51c0ae2e59450a1c3a782febcad2128b
ivre/web/app.py
python
post_nmap
(subdb)
return {"count": count}
Add records to Nmap & View databases :param str subdb: database to query (must be "scans" or "view") :form categories: a coma-separated list of categories :form source: the source of the scan results (mandatory) :form result: scan results (as XML or JSON files) :status 200: no error :status 400...
Add records to Nmap & View databases
[ "Add", "records", "to", "Nmap", "&", "View", "databases" ]
def post_nmap(subdb): """Add records to Nmap & View databases :param str subdb: database to query (must be "scans" or "view") :form categories: a coma-separated list of categories :form source: the source of the scan results (mandatory) :form result: scan results (as XML or JSON files) :status ...
[ "def", "post_nmap", "(", "subdb", ")", ":", "referer", ",", "source", ",", "categories", ",", "files", "=", "parse_form", "(", ")", "count", "=", "import_files", "(", "subdb", ",", "source", ",", "categories", ",", "files", ")", "if", "request", ".", "...
https://github.com/ivre/ivre/blob/5728855b51c0ae2e59450a1c3a782febcad2128b/ivre/web/app.py#L763-L790
kalliope-project/kalliope
7b2bb4671c8fbfa0ea9f768c84994fe75da974eb
kalliope/core/ConfigurationManager/SettingLoader.py
python
SettingLoader._get_settings
(self)
return setting_object
Class Methods which loads default or the provided YAML file and return a Settings Object :return: The loaded Settings :rtype: Settings :Example: settings = SettingLoader.get_settings(file_path="/var/tmp/settings.yml") .. seealso:: Settings .. warnings:: Class Meth...
Class Methods which loads default or the provided YAML file and return a Settings Object
[ "Class", "Methods", "which", "loads", "default", "or", "the", "provided", "YAML", "file", "and", "return", "a", "Settings", "Object" ]
def _get_settings(self): """ Class Methods which loads default or the provided YAML file and return a Settings Object :return: The loaded Settings :rtype: Settings :Example: settings = SettingLoader.get_settings(file_path="/var/tmp/settings.yml") .. seeals...
[ "def", "_get_settings", "(", "self", ")", ":", "# create a new setting", "setting_object", "=", "Settings", "(", ")", "# Get the setting parameters", "settings", "=", "self", ".", "_get_yaml_config", "(", ")", "default_stt_name", "=", "self", ".", "_get_default_speech...
https://github.com/kalliope-project/kalliope/blob/7b2bb4671c8fbfa0ea9f768c84994fe75da974eb/kalliope/core/ConfigurationManager/SettingLoader.py#L84-L137
aws/aws-iot-device-sdk-python
90d7b05749e2da7a13193024c720e3c8d9bf1157
AWSIoTPythonSDK/core/protocol/paho/client.py
python
Client.reconnect
(self)
return self._send_connect(self._keepalive, self._clean_session)
Reconnect the client after a disconnect. Can only be called after connect()/connect_async().
Reconnect the client after a disconnect. Can only be called after connect()/connect_async().
[ "Reconnect", "the", "client", "after", "a", "disconnect", ".", "Can", "only", "be", "called", "after", "connect", "()", "/", "connect_async", "()", "." ]
def reconnect(self): """Reconnect the client after a disconnect. Can only be called after connect()/connect_async().""" if len(self._host) == 0: raise ValueError('Invalid host.') if self._port <= 0: raise ValueError('Invalid port number.') self._in_packet...
[ "def", "reconnect", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_host", ")", "==", "0", ":", "raise", "ValueError", "(", "'Invalid host.'", ")", "if", "self", ".", "_port", "<=", "0", ":", "raise", "ValueError", "(", "'Invalid port number.'", ...
https://github.com/aws/aws-iot-device-sdk-python/blob/90d7b05749e2da7a13193024c720e3c8d9bf1157/AWSIoTPythonSDK/core/protocol/paho/client.py#L737-L843
rspivak/lsbasi
07e1a14516156a21ebe2d82e0bae4bba5ad73dd6
part16/spi.py
python
Parser.parse
(self)
return node
program : PROGRAM variable SEMI block DOT block : declarations compound_statement declarations : (VAR (variable_declaration SEMI)+)? procedure_declaration* variable_declaration : ID (COMMA ID)* COLON type_spec procedure_declaration : PROCEDURE ID (LPAREN formal_parameter...
program : PROGRAM variable SEMI block DOT
[ "program", ":", "PROGRAM", "variable", "SEMI", "block", "DOT" ]
def parse(self): """ program : PROGRAM variable SEMI block DOT block : declarations compound_statement declarations : (VAR (variable_declaration SEMI)+)? procedure_declaration* variable_declaration : ID (COMMA ID)* COLON type_spec procedure_declaration : ...
[ "def", "parse", "(", "self", ")", ":", "node", "=", "self", ".", "program", "(", ")", "if", "self", ".", "current_token", ".", "type", "!=", "TokenType", ".", "EOF", ":", "self", ".", "error", "(", "error_code", "=", "ErrorCode", ".", "UNEXPECTED_TOKEN...
https://github.com/rspivak/lsbasi/blob/07e1a14516156a21ebe2d82e0bae4bba5ad73dd6/part16/spi.py#L699-L755
hankcs/HanLP
6c02812969c4827d74b404c3ad4207f71ca9165a
hanlp/common/torch_component.py
python
TorchComponent.save
(self, save_dir: str, **kwargs)
Save this component to a directory. Args: save_dir: The directory to save this component. **kwargs: Not used.
Save this component to a directory.
[ "Save", "this", "component", "to", "a", "directory", "." ]
def save(self, save_dir: str, **kwargs): """Save this component to a directory. Args: save_dir: The directory to save this component. **kwargs: Not used. """ self.save_config(save_dir) self.save_vocabs(save_dir) self.save_weights(save_dir)
[ "def", "save", "(", "self", ",", "save_dir", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "save_config", "(", "save_dir", ")", "self", ".", "save_vocabs", "(", "save_dir", ")", "self", ".", "save_weights", "(", "save_dir", ")" ]
https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/common/torch_component.py#L149-L158
geometalab/Vector-Tiles-Reader-QGIS-Plugin
a31ae86959c8f3b7d6f332f84191cd7ca4683e1d
ext-libs/google/protobuf/descriptor_pool.py
python
DescriptorPool.FindEnumTypeByName
(self, full_name)
return self._enum_descriptors[full_name]
Loads the named enum descriptor from the pool. Args: full_name: The full name of the enum descriptor to load. Returns: The enum descriptor for the named type.
Loads the named enum descriptor from the pool.
[ "Loads", "the", "named", "enum", "descriptor", "from", "the", "pool", "." ]
def FindEnumTypeByName(self, full_name): """Loads the named enum descriptor from the pool. Args: full_name: The full name of the enum descriptor to load. Returns: The enum descriptor for the named type. """ full_name = _NormalizeFullyQualifiedName(full_name) if full_name not in se...
[ "def", "FindEnumTypeByName", "(", "self", ",", "full_name", ")", ":", "full_name", "=", "_NormalizeFullyQualifiedName", "(", "full_name", ")", "if", "full_name", "not", "in", "self", ".", "_enum_descriptors", ":", "self", ".", "FindFileContainingSymbol", "(", "ful...
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/google/protobuf/descriptor_pool.py#L324-L337
PokemonGoF/PokemonGo-Bot-Desktop
4bfa94f0183406c6a86f93645eff7abd3ad4ced8
build/pywin/Lib/mutex.py
python
mutex.lock
(self, function, argument)
Lock a mutex, call the function with supplied argument when it is acquired. If the mutex is already locked, place function and argument in the queue.
Lock a mutex, call the function with supplied argument when it is acquired. If the mutex is already locked, place function and argument in the queue.
[ "Lock", "a", "mutex", "call", "the", "function", "with", "supplied", "argument", "when", "it", "is", "acquired", ".", "If", "the", "mutex", "is", "already", "locked", "place", "function", "and", "argument", "in", "the", "queue", "." ]
def lock(self, function, argument): """Lock a mutex, call the function with supplied argument when it is acquired. If the mutex is already locked, place function and argument in the queue.""" if self.testandset(): function(argument) else: self.queue.appen...
[ "def", "lock", "(", "self", ",", "function", ",", "argument", ")", ":", "if", "self", ".", "testandset", "(", ")", ":", "function", "(", "argument", ")", "else", ":", "self", ".", "queue", ".", "append", "(", "(", "function", ",", "argument", ")", ...
https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/mutex.py#L39-L46
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/scatterpolar/marker/colorbar/_title.py
python
Title.__init__
(self, arg=None, font=None, side=None, text=None, **kwargs)
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatterpolar.m arker.colorbar.Title` font Sets this color bar's title font. Note...
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatterpolar.m arker.colorbar.Title` font Sets this color bar's title font. Note...
[ "Construct", "a", "new", "Title", "object", "Parameters", "----------", "arg", "dict", "of", "properties", "compatible", "with", "this", "constructor", "or", "an", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "scatterpolar", ".", "m",...
def __init__(self, arg=None, font=None, side=None, text=None, **kwargs): """ Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatterpolar.m ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "font", "=", "None", ",", "side", "=", "None", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Title", ",", "self", ")", ".", "__init__", "(", "\"title\"", ...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatterpolar/marker/colorbar/_title.py#L131-L210
ChintanTrivedi/DeepGamingAI_FIFA
b79a5b670756056b7b6aedd2c5c84fd5f59d569e
utils/dataset_util.py
python
read_examples_list
(path)
return [line.strip().split(' ')[0] for line in lines]
Read list of training or validation examples. The file is assumed to contain a single example per line where the first token in the line is an identifier that allows us to find the image and annotation xml for that example. For example, the line: xyz 3 would allow us to find files xyz.jpg and xyz.xml (the...
Read list of training or validation examples.
[ "Read", "list", "of", "training", "or", "validation", "examples", "." ]
def read_examples_list(path): """Read list of training or validation examples. The file is assumed to contain a single example per line where the first token in the line is an identifier that allows us to find the image and annotation xml for that example. For example, the line: xyz 3 would allow us to ...
[ "def", "read_examples_list", "(", "path", ")", ":", "with", "tf", ".", "gfile", ".", "GFile", "(", "path", ")", "as", "fid", ":", "lines", "=", "fid", ".", "readlines", "(", ")", "return", "[", "line", ".", "strip", "(", ")", ".", "split", "(", "...
https://github.com/ChintanTrivedi/DeepGamingAI_FIFA/blob/b79a5b670756056b7b6aedd2c5c84fd5f59d569e/utils/dataset_util.py#L41-L60
FitMachineLearning/FitML
a60f49fce1799ca4b11b48307441325b6272719a
ParameterNoising/Tensorflow/BipedalWalker_v1.0.py
python
actor_experience_replay
(memSA,memR,memS,memA,memW,num_epoch=1)
train_B = train_B[tW.flatten()>0] #print("%8d were better results than pr"%np.alen(tX_train)) tX = tX[train_B,:] tY = tY[train_B,:] tW = tW[train_B,:] tR = tR[train_B,:] #print("tW",tW)
train_B = train_B[tW.flatten()>0]
[ "train_B", "=", "train_B", "[", "tW", ".", "flatten", "()", ">", "0", "]" ]
def actor_experience_replay(memSA,memR,memS,memA,memW,num_epoch=1): tSA = (memSA) tR = (memR) tX = (memS) tY = (memA) tW = (memW) target = tR.mean() #+ math.fabs( tR.mean() - tR.max() )/2 #+ math.fabs( tR.mean() - tR.max() )/4 train_C = np.arange(np.alen(tR)) train_C = train_C[tR.flat...
[ "def", "actor_experience_replay", "(", "memSA", ",", "memR", ",", "memS", ",", "memA", ",", "memW", ",", "num_epoch", "=", "1", ")", ":", "tSA", "=", "(", "memSA", ")", "tR", "=", "(", "memR", ")", "tX", "=", "(", "memS", ")", "tY", "=", "(", "...
https://github.com/FitMachineLearning/FitML/blob/a60f49fce1799ca4b11b48307441325b6272719a/ParameterNoising/Tensorflow/BipedalWalker_v1.0.py#L408-L485
OpenMDAO/OpenMDAO-Framework
f2e37b7de3edeaaeb2d251b375917adec059db9b
openmdao.main/src/openmdao/main/datatypes/array.py
python
Array.validate
(self, obj, name, value)
return new_val
Validates that a specified value is valid for this trait. Units are converted as needed.
Validates that a specified value is valid for this trait. Units are converted as needed.
[ "Validates", "that", "a", "specified", "value", "is", "valid", "for", "this", "trait", ".", "Units", "are", "converted", "as", "needed", "." ]
def validate(self, obj, name, value): """ Validates that a specified value is valid for this trait. Units are converted as needed. """ try: new_val = super(Array, self).validate(obj, name, value) except Exception: self.error(obj, name, value) ret...
[ "def", "validate", "(", "self", ",", "obj", ",", "name", ",", "value", ")", ":", "try", ":", "new_val", "=", "super", "(", "Array", ",", "self", ")", ".", "validate", "(", "obj", ",", "name", ",", "value", ")", "except", "Exception", ":", "self", ...
https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/datatypes/array.py#L109-L119
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/vcs/__init__.py
python
VersionControl.get_url
(self, location)
Return the url used at location Used in get_info or check_destination
Return the url used at location Used in get_info or check_destination
[ "Return", "the", "url", "used", "at", "location", "Used", "in", "get_info", "or", "check_destination" ]
def get_url(self, location): """ Return the url used at location Used in get_info or check_destination """ raise NotImplementedError
[ "def", "get_url", "(", "self", ",", "location", ")", ":", "raise", "NotImplementedError" ]
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/vcs/__init__.py#L287-L292
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v5_1/git/git_client_base.py
python
GitClientBase.create_annotated_tag
(self, tag_object, project, repository_id)
return self._deserialize('GitAnnotatedTag', response)
CreateAnnotatedTag. [Preview API] Create an annotated tag. :param :class:`<GitAnnotatedTag> <azure.devops.v5_1.git.models.GitAnnotatedTag>` tag_object: Object containing details of tag to be created. :param str project: Project ID or project name :param str repository_id: ID or name of t...
CreateAnnotatedTag. [Preview API] Create an annotated tag. :param :class:`<GitAnnotatedTag> <azure.devops.v5_1.git.models.GitAnnotatedTag>` tag_object: Object containing details of tag to be created. :param str project: Project ID or project name :param str repository_id: ID or name of t...
[ "CreateAnnotatedTag", ".", "[", "Preview", "API", "]", "Create", "an", "annotated", "tag", ".", ":", "param", ":", "class", ":", "<GitAnnotatedTag", ">", "<azure", ".", "devops", ".", "v5_1", ".", "git", ".", "models", ".", "GitAnnotatedTag", ">", "tag_obj...
def create_annotated_tag(self, tag_object, project, repository_id): """CreateAnnotatedTag. [Preview API] Create an annotated tag. :param :class:`<GitAnnotatedTag> <azure.devops.v5_1.git.models.GitAnnotatedTag>` tag_object: Object containing details of tag to be created. :param str projec...
[ "def", "create_annotated_tag", "(", "self", ",", "tag_object", ",", "project", ",", "repository_id", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'", "]", "=", "self", ".", "_serialize", ...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/git/git_client_base.py#L28-L47
meetbill/zabbix_manager
739e5b51facf19cc6bda2b50f29108f831cf833e
ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Cell.py
python
FormulaCell.__init__
(self, rowx, colx, xf_idx, frmla, calc_flags=0)
[]
def __init__(self, rowx, colx, xf_idx, frmla, calc_flags=0): self.rowx = rowx self.colx = colx self.xf_idx = xf_idx self.frmla = frmla self.calc_flags = calc_flags
[ "def", "__init__", "(", "self", ",", "rowx", ",", "colx", ",", "xf_idx", ",", "frmla", ",", "calc_flags", "=", "0", ")", ":", "self", ".", "rowx", "=", "rowx", "self", ".", "colx", "=", "colx", "self", ".", "xf_idx", "=", "xf_idx", "self", ".", "...
https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/Cell.py#L159-L164
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/oauthlib/oauth2/draft25/parameters.py
python
parse_authorization_code_response
(uri, state=None)
return params
Parse authorization grant response URI into a dict. If the resource owner grants the access request, the authorization server issues an authorization code and delivers it to the client by adding the following parameters to the query component of the redirection URI using the "application/x-www-form-url...
Parse authorization grant response URI into a dict.
[ "Parse", "authorization", "grant", "response", "URI", "into", "a", "dict", "." ]
def parse_authorization_code_response(uri, state=None): """Parse authorization grant response URI into a dict. If the resource owner grants the access request, the authorization server issues an authorization code and delivers it to the client by adding the following parameters to the query component o...
[ "def", "parse_authorization_code_response", "(", "uri", ",", "state", "=", "None", ")", ":", "query", "=", "urlparse", ".", "urlparse", "(", "uri", ")", ".", "query", "params", "=", "dict", "(", "urlparse", ".", "parse_qsl", "(", "query", ")", ")", "if",...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/oauthlib/oauth2/draft25/parameters.py#L95-L136
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/logging/__init__.py
python
exception
(msg, *args, **kwargs)
Log a message with severity 'ERROR' on the root logger, with exception information.
Log a message with severity 'ERROR' on the root logger, with exception information.
[ "Log", "a", "message", "with", "severity", "ERROR", "on", "the", "root", "logger", "with", "exception", "information", "." ]
def exception(msg, *args, **kwargs): """ Log a message with severity 'ERROR' on the root logger, with exception information. """ kwargs['exc_info'] = 1 error(msg, *args, **kwargs)
[ "def", "exception", "(", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'exc_info'", "]", "=", "1", "error", "(", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/logging/__init__.py#L1612-L1618
yuantiku/fairseq-gec
10aafebc482706346f768e4f18a9813153cb1ecc
fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py
python
FairseqLRScheduler.step_update
(self, num_updates)
return self.optimizer.get_lr()
Update the learning rate after each update.
Update the learning rate after each update.
[ "Update", "the", "learning", "rate", "after", "each", "update", "." ]
def step_update(self, num_updates): """Update the learning rate after each update.""" return self.optimizer.get_lr()
[ "def", "step_update", "(", "self", ",", "num_updates", ")", ":", "return", "self", ".", "optimizer", ".", "get_lr", "(", ")" ]
https://github.com/yuantiku/fairseq-gec/blob/10aafebc482706346f768e4f18a9813153cb1ecc/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py#L42-L44
timkpaine/tributary
90acb236d96a23c0c4794fd0f2da82c66060f737
tributary/lazy/node.py
python
Node.__call__
(self, node_tweaks=None, *positional_tweaks, **keyword_tweaks)
return self.value()
Lazily re-evaluate the node Args: node_tweaks (dict): A dict mapping node to tweaked value positional_tweaks (VAR_POSITIONAL): A tuple of positional tweaks to apply keyword_tweaks (VAR_KEYWORD): A dict of keyword tweaks to apply How it works: The "original ca...
Lazily re-evaluate the node
[ "Lazily", "re", "-", "evaluate", "the", "node" ]
def __call__(self, node_tweaks=None, *positional_tweaks, **keyword_tweaks): """Lazily re-evaluate the node Args: node_tweaks (dict): A dict mapping node to tweaked value positional_tweaks (VAR_POSITIONAL): A tuple of positional tweaks to apply keyword_tweaks (VAR_KEY...
[ "def", "__call__", "(", "self", ",", "node_tweaks", "=", "None", ",", "*", "positional_tweaks", ",", "*", "*", "keyword_tweaks", ")", ":", "node_tweaks", "=", "node_tweaks", "or", "{", "}", "if", "not", "isinstance", "(", "node_tweaks", ",", "dict", ")", ...
https://github.com/timkpaine/tributary/blob/90acb236d96a23c0c4794fd0f2da82c66060f737/tributary/lazy/node.py#L615-L671
OpenMDAO/OpenMDAO1
791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317
openmdao/components/exec_comp.py
python
ExecComp.solve_nonlinear
(self, params, unknowns, resids)
Executes this component's assignment statemens. Args ---- params : `VecWrapper`, optional `VecWrapper` containing parameters. (p) unknowns : `VecWrapper`, optional `VecWrapper` containing outputs and states. (u) resids : `VecWrapper`, optional ...
Executes this component's assignment statemens.
[ "Executes", "this", "component", "s", "assignment", "statemens", "." ]
def solve_nonlinear(self, params, unknowns, resids): """ Executes this component's assignment statemens. Args ---- params : `VecWrapper`, optional `VecWrapper` containing parameters. (p) unknowns : `VecWrapper`, optional `VecWrapper` containing o...
[ "def", "solve_nonlinear", "(", "self", ",", "params", ",", "unknowns", ",", "resids", ")", ":", "for", "expr", "in", "self", ".", "_codes", ":", "exec", "(", "expr", ",", "_expr_dict", ",", "_UPDict", "(", "unknowns", ",", "params", ",", "self", ".", ...
https://github.com/OpenMDAO/OpenMDAO1/blob/791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317/openmdao/components/exec_comp.py#L197-L213