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
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventType.file_unlike_comment
(cls, val)
return cls('file_unlike_comment', val)
Create an instance of this class set to the ``file_unlike_comment`` tag with value ``val``. :param FileUnlikeCommentType val: :rtype: EventType
Create an instance of this class set to the ``file_unlike_comment`` tag with value ``val``.
[ "Create", "an", "instance", "of", "this", "class", "set", "to", "the", "file_unlike_comment", "tag", "with", "value", "val", "." ]
def file_unlike_comment(cls, val): """ Create an instance of this class set to the ``file_unlike_comment`` tag with value ``val``. :param FileUnlikeCommentType val: :rtype: EventType """ return cls('file_unlike_comment', val)
[ "def", "file_unlike_comment", "(", "cls", ",", "val", ")", ":", "return", "cls", "(", "'file_unlike_comment'", ",", "val", ")" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L23324-L23332
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/visualization/pulse/matplotlib.py
python
EventsOutputChannels._trim
(self, events: Dict[int, Any])
return events_in_time_range
Return events during given `time_range`. Args: events: time and operation of events. Returns: Events within the specified time range.
Return events during given `time_range`.
[ "Return", "events", "during", "given", "time_range", "." ]
def _trim(self, events: Dict[int, Any]) -> Dict[int, Any]: """Return events during given `time_range`. Args: events: time and operation of events. Returns: Events within the specified time range. """ events_in_time_range = {} for k, v in events....
[ "def", "_trim", "(", "self", ",", "events", ":", "Dict", "[", "int", ",", "Any", "]", ")", "->", "Dict", "[", "int", ",", "Any", "]", ":", "events_in_time_range", "=", "{", "}", "for", "k", ",", "v", "in", "events", ".", "items", "(", ")", ":",...
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/visualization/pulse/matplotlib.py#L261-L276
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/bmp280/sensor.py
python
Bmp280TemperatureSensor.update
(self)
Fetch new state data for the sensor.
Fetch new state data for the sensor.
[ "Fetch", "new", "state", "data", "for", "the", "sensor", "." ]
def update(self): """Fetch new state data for the sensor.""" try: self._attr_native_value = round(self._bmp280.temperature, 1) if not self.available: _LOGGER.warning("Communication restored with temperature sensor") self._attr_available = True ...
[ "def", "update", "(", "self", ")", ":", "try", ":", "self", ".", "_attr_native_value", "=", "round", "(", "self", ".", "_bmp280", ".", "temperature", ",", "1", ")", "if", "not", "self", ".", "available", ":", "_LOGGER", ".", "warning", "(", "\"Communic...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/bmp280/sensor.py#L111-L123
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/kernel/blocking/channels.py
python
BlockingChannelMixin.get_msgs
(self)
return msgs
Get all messages that are currently ready.
Get all messages that are currently ready.
[ "Get", "all", "messages", "that", "are", "currently", "ready", "." ]
def get_msgs(self): """ Get all messages that are currently ready. """ msgs = [] while True: try: msgs.append(self.get_msg(block=False)) except Empty: break return msgs
[ "def", "get_msgs", "(", "self", ")", ":", "msgs", "=", "[", "]", "while", "True", ":", "try", ":", "msgs", ".", "append", "(", "self", ".", "get_msg", "(", "block", "=", "False", ")", ")", "except", "Empty", ":", "break", "return", "msgs" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/kernel/blocking/channels.py#L46-L54
getsentry/sentry
83b1f25aac3e08075e0e2495bc29efaf35aca18a
src/sentry/integrations/jira_server/client.py
python
JiraServer.user_id_field
(self)
return "name"
Jira-Server doesn't require GDPR compliant API usage so we can use `name`
Jira-Server doesn't require GDPR compliant API usage so we can use `name`
[ "Jira", "-", "Server", "doesn", "t", "require", "GDPR", "compliant", "API", "usage", "so", "we", "can", "use", "name" ]
def user_id_field(self): """ Jira-Server doesn't require GDPR compliant API usage so we can use `name` """ return "name"
[ "def", "user_id_field", "(", "self", ")", ":", "return", "\"name\"" ]
https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/integrations/jira_server/client.py#L143-L147
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
src/zvt/contract/factor.py
python
Factor.drawer_sub_df_list
(self)
return None
[]
def drawer_sub_df_list(self) -> Optional[List[pd.DataFrame]]: if (self.transformer is not None or self.accumulator is not None) and pd_is_not_null(self.result_df): return [self.result_df] return None
[ "def", "drawer_sub_df_list", "(", "self", ")", "->", "Optional", "[", "List", "[", "pd", ".", "DataFrame", "]", "]", ":", "if", "(", "self", ".", "transformer", "is", "not", "None", "or", "self", ".", "accumulator", "is", "not", "None", ")", "and", "...
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/contract/factor.py#L456-L459
picrust/picrust2
610ffbcd28f8bf0f9fa93c88873498a39a77c57f
picrust2/util.py
python
write_phylip
(seq, outfile)
Will write a dictionary containing id, sequence pairs in Phylip format. Originally written to run PaPaRa.
Will write a dictionary containing id, sequence pairs in Phylip format. Originally written to run PaPaRa.
[ "Will", "write", "a", "dictionary", "containing", "id", "sequence", "pairs", "in", "Phylip", "format", ".", "Originally", "written", "to", "run", "PaPaRa", "." ]
def write_phylip(seq, outfile): '''Will write a dictionary containing id, sequence pairs in Phylip format. Originally written to run PaPaRa.''' out_phylip = open(outfile, "w") seq_count = 0 for s in seq: # Write header if this is first line. if seq_count == 0: seq_le...
[ "def", "write_phylip", "(", "seq", ",", "outfile", ")", ":", "out_phylip", "=", "open", "(", "outfile", ",", "\"w\"", ")", "seq_count", "=", "0", "for", "s", "in", "seq", ":", "# Write header if this is first line.", "if", "seq_count", "==", "0", ":", "seq...
https://github.com/picrust/picrust2/blob/610ffbcd28f8bf0f9fa93c88873498a39a77c57f/picrust2/util.py#L134-L162
hubblestack/hubble
763142474edcecdec5fd25591dc29c3536e8f969
hubblestack/modules/nebula_osquery.py
python
version
()
return __version__
Report version of this module
Report version of this module
[ "Report", "version", "of", "this", "module" ]
def version(): """ Report version of this module """ return __version__
[ "def", "version", "(", ")", ":", "return", "__version__" ]
https://github.com/hubblestack/hubble/blob/763142474edcecdec5fd25591dc29c3536e8f969/hubblestack/modules/nebula_osquery.py#L588-L592
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/data/request/fuzzable_request.py
python
FuzzableRequest.get_force_fuzzing_url_parts
(self)
return list(self._force_fuzzing_url_parts)
Returns a list of url parts which should be fuzzed. :return: A tuple of (path part, is variable) tuples.`
Returns a list of url parts which should be fuzzed. :return: A tuple of (path part, is variable) tuples.`
[ "Returns", "a", "list", "of", "url", "parts", "which", "should", "be", "fuzzed", ".", ":", "return", ":", "A", "tuple", "of", "(", "path", "part", "is", "variable", ")", "tuples", "." ]
def get_force_fuzzing_url_parts(self): """ Returns a list of url parts which should be fuzzed. :return: A tuple of (path part, is variable) tuples.` """ return list(self._force_fuzzing_url_parts)
[ "def", "get_force_fuzzing_url_parts", "(", "self", ")", ":", "return", "list", "(", "self", ".", "_force_fuzzing_url_parts", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/data/request/fuzzable_request.py#L487-L492
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbDingDing.dingtalk_oapi_attendance_getusergroup
( self, userid )
return self._top_request( "dingtalk.oapi.attendance.getusergroup", { "userid": userid } )
获取用户考勤组 在钉钉考勤微应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,一个企业中的一个人只能属于一个考勤组。如果您的企业使用了钉钉考勤并希望获取员工的考勤组信息,可选择使用此接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36987 :param userid: 员工在企业内的UserID,企业用来唯一标识用户的字段。
获取用户考勤组 在钉钉考勤微应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,一个企业中的一个人只能属于一个考勤组。如果您的企业使用了钉钉考勤并希望获取员工的考勤组信息,可选择使用此接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36987
[ "获取用户考勤组", "在钉钉考勤微应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,一个企业中的一个人只能属于一个考勤组。如果您的企业使用了钉钉考勤并希望获取员工的考勤组信息,可选择使用此接口", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "36987" ]
def dingtalk_oapi_attendance_getusergroup( self, userid ): """ 获取用户考勤组 在钉钉考勤微应用中,考勤组是一类具有相同的班次、考勤位置等考勤规则的人或部门的组合,一个企业中的一个人只能属于一个考勤组。如果您的企业使用了钉钉考勤并希望获取员工的考勤组信息,可选择使用此接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36987 :param userid: 员工在企业内的U...
[ "def", "dingtalk_oapi_attendance_getusergroup", "(", "self", ",", "userid", ")", ":", "return", "self", ".", "_top_request", "(", "\"dingtalk.oapi.attendance.getusergroup\"", ",", "{", "\"userid\"", ":", "userid", "}", ")" ]
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L2109-L2125
PyCQA/astroid
a815443f62faae05249621a396dcf0afd884a619
astroid/nodes/scoped_nodes/scoped_nodes.py
python
ClassDef.local_attr
(self, name, context=None)
Get the list of assign nodes associated to the given name. Assignments are looked for in both this class and in parents. :returns: The list of assignments to the given name. :rtype: list(NodeNG) :raises AttributeInferenceError: If no attribute with this name can be found i...
Get the list of assign nodes associated to the given name.
[ "Get", "the", "list", "of", "assign", "nodes", "associated", "to", "the", "given", "name", "." ]
def local_attr(self, name, context=None): """Get the list of assign nodes associated to the given name. Assignments are looked for in both this class and in parents. :returns: The list of assignments to the given name. :rtype: list(NodeNG) :raises AttributeInferenceError: If n...
[ "def", "local_attr", "(", "self", ",", "name", ",", "context", "=", "None", ")", ":", "result", "=", "[", "]", "if", "name", "in", "self", ".", "locals", ":", "result", "=", "self", ".", "locals", "[", "name", "]", "else", ":", "class_node", "=", ...
https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/nodes/scoped_nodes/scoped_nodes.py#L2629-L2650
ESCOMP/CESM
4e21488773baa1bd9fb06fb8750db9f9bd12b705
manage_externals/manic/externals_description.py
python
LstripReader.__iter__
(self)
return self
Begin an iteration
Begin an iteration
[ "Begin", "an", "iteration" ]
def __iter__(self): """Begin an iteration""" self._index = 0 return self
[ "def", "__iter__", "(", "self", ")", ":", "self", ".", "_index", "=", "0", "return", "self" ]
https://github.com/ESCOMP/CESM/blob/4e21488773baa1bd9fb06fb8750db9f9bd12b705/manage_externals/manic/externals_description.py#L133-L136
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/attr/_make.py
python
_make_attr_tuple_class
(cls_name, attr_names)
return globs[attr_class_name]
Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0))
Create a tuple subclass to hold `Attribute`s for an `attrs` class.
[ "Create", "a", "tuple", "subclass", "to", "hold", "Attribute", "s", "for", "an", "attrs", "class", "." ]
def _make_attr_tuple_class(cls_name, attr_names): """ Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) """ attr_class_name = "{}A...
[ "def", "_make_attr_tuple_class", "(", "cls_name", ",", "attr_names", ")", ":", "attr_class_name", "=", "\"{}Attributes\"", ".", "format", "(", "cls_name", ")", "attr_class_template", "=", "[", "\"class {}(tuple):\"", ".", "format", "(", "attr_class_name", ")", ",", ...
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/attr/_make.py#L222-L247
facebookresearch/SpanBERT
0670d8b6a38f6714b85ea7a033f16bd8cc162676
pretraining/fairseq/utils.py
python
_upgrade_state_dict
(state)
return state
Helper for upgrading old model checkpoints.
Helper for upgrading old model checkpoints.
[ "Helper", "for", "upgrading", "old", "model", "checkpoints", "." ]
def _upgrade_state_dict(state): """Helper for upgrading old model checkpoints.""" # add optimizer_history if 'optimizer_history' not in state: state['optimizer_history'] = [ { 'criterion_name': 'CrossEntropyCriterion', 'best_loss': state['best_loss'], ...
[ "def", "_upgrade_state_dict", "(", "state", ")", ":", "# add optimizer_history", "if", "'optimizer_history'", "not", "in", "state", ":", "state", "[", "'optimizer_history'", "]", "=", "[", "{", "'criterion_name'", ":", "'CrossEntropyCriterion'", ",", "'best_loss'", ...
https://github.com/facebookresearch/SpanBERT/blob/0670d8b6a38f6714b85ea7a033f16bd8cc162676/pretraining/fairseq/utils.py#L81-L131
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.3/django/contrib/gis/db/backends/postgis/operations.py
python
PostGISOperations.convert_extent3d
(self, box3d)
return (xmin, ymin, zmin, xmax, ymax, zmax)
Returns a 6-tuple extent for the `Extent3D` aggregate by converting the 3d bounding-box text returnded by PostGIS (`box3d` argument), for example: "BOX3D(-90.0 30.0 1, -85.0 40.0 2)".
Returns a 6-tuple extent for the `Extent3D` aggregate by converting the 3d bounding-box text returnded by PostGIS (`box3d` argument), for example: "BOX3D(-90.0 30.0 1, -85.0 40.0 2)".
[ "Returns", "a", "6", "-", "tuple", "extent", "for", "the", "Extent3D", "aggregate", "by", "converting", "the", "3d", "bounding", "-", "box", "text", "returnded", "by", "PostGIS", "(", "box3d", "argument", ")", "for", "example", ":", "BOX3D", "(", "-", "9...
def convert_extent3d(self, box3d): """ Returns a 6-tuple extent for the `Extent3D` aggregate by converting the 3d bounding-box text returnded by PostGIS (`box3d` argument), for example: "BOX3D(-90.0 30.0 1, -85.0 40.0 2)". """ ll, ur = box3d[6:-1].split(',') xmin,...
[ "def", "convert_extent3d", "(", "self", ",", "box3d", ")", ":", "ll", ",", "ur", "=", "box3d", "[", "6", ":", "-", "1", "]", ".", "split", "(", "','", ")", "xmin", ",", "ymin", ",", "zmin", "=", "map", "(", "float", ",", "ll", ".", "split", "...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/contrib/gis/db/backends/postgis/operations.py#L301-L310
dbsr/vimfox
4a0145937226843b4b8b5681136ab9a45fb5d066
vimfox/server/server.py
python
VimFoxNamespace.initialize
(self)
return True
[]
def initialize(self): self.logger = app.logger self.log('socket initialized') self.sockets[id(self)] = self return True
[ "def", "initialize", "(", "self", ")", ":", "self", ".", "logger", "=", "app", ".", "logger", "self", ".", "log", "(", "'socket initialized'", ")", "self", ".", "sockets", "[", "id", "(", "self", ")", "]", "=", "self", "return", "True" ]
https://github.com/dbsr/vimfox/blob/4a0145937226843b4b8b5681136ab9a45fb5d066/vimfox/server/server.py#L29-L34
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py
python
NumberCounter.getsequence
(self, sequence)
return sequence[(self.value - 1) % len(sequence)]
Get the next value from elyxer.a sequence.
Get the next value from elyxer.a sequence.
[ "Get", "the", "next", "value", "from", "elyxer", ".", "a", "sequence", "." ]
def getsequence(self, sequence): "Get the next value from elyxer.a sequence." return sequence[(self.value - 1) % len(sequence)]
[ "def", "getsequence", "(", "self", ",", "sequence", ")", ":", "return", "sequence", "[", "(", "self", ".", "value", "-", "1", ")", "%", "len", "(", "sequence", ")", "]" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L3215-L3217
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/mappings/maps.py
python
MapCollection._reload_collection
(self, maps_store_engine, map_name)
[]
def _reload_collection(self, maps_store_engine, map_name): maps_store = maps_store_engine.maps_store() maps_store.reload(self, map_name)
[ "def", "_reload_collection", "(", "self", ",", "maps_store_engine", ",", "map_name", ")", ":", "maps_store", "=", "maps_store_engine", ".", "maps_store", "(", ")", "maps_store", ".", "reload", "(", "self", ",", "map_name", ")" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/mappings/maps.py#L77-L79
EmilyAlsentzer/clinicalBERT
a9d91698929b7189311bba364ccdd0360e847276
downstream_tasks/run_classifier.py
python
MedNLIProcessor.get_dev_examples
(self, data_dir)
return self._create_examples(file_path)
Gets a collection of `InputExample`s for the dev set.
Gets a collection of `InputExample`s for the dev set.
[ "Gets", "a", "collection", "of", "InputExample", "s", "for", "the", "dev", "set", "." ]
def get_dev_examples(self, data_dir): """Gets a collection of `InputExample`s for the dev set.""" file_path = os.path.join(data_dir, "mli_dev_v1.jsonl") return self._create_examples(file_path)
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"mli_dev_v1.jsonl\"", ")", "return", "self", ".", "_create_examples", "(", "file_path", ")" ]
https://github.com/EmilyAlsentzer/clinicalBERT/blob/a9d91698929b7189311bba364ccdd0360e847276/downstream_tasks/run_classifier.py#L225-L228
tobi-wan-kenobi/bumblebee-status
08b5386140fb14ecbccdf9eb7520f597967dee4d
bumblebee_status/util/location.py
python
coordinates
()
return __get("latitude"), __get("longitude")
Returns a latitude, longitude pair :return: current latitude and longitude :rtype: pair of strings
Returns a latitude, longitude pair
[ "Returns", "a", "latitude", "longitude", "pair" ]
def coordinates(): """Returns a latitude, longitude pair :return: current latitude and longitude :rtype: pair of strings """ return __get("latitude"), __get("longitude")
[ "def", "coordinates", "(", ")", ":", "return", "__get", "(", "\"latitude\"", ")", ",", "__get", "(", "\"longitude\"", ")" ]
https://github.com/tobi-wan-kenobi/bumblebee-status/blob/08b5386140fb14ecbccdf9eb7520f597967dee4d/bumblebee_status/util/location.py#L76-L82
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/venv/lib/python2.7/site-packages/setuptools/command/egg_info.py
python
manifest_maker.write_manifest
(self)
Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'.
Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'.
[ "Write", "the", "file", "list", "in", "self", ".", "filelist", "to", "the", "manifest", "file", "named", "by", "self", ".", "manifest", "." ]
def write_manifest(self): """ Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. """ self.filelist._repair() # Now _repairs should encodability, but not unicode files = [self._manifest_normalize(f) for f in self.filelist.files] ...
[ "def", "write_manifest", "(", "self", ")", ":", "self", ".", "filelist", ".", "_repair", "(", ")", "# Now _repairs should encodability, but not unicode", "files", "=", "[", "self", ".", "_manifest_normalize", "(", "f", ")", "for", "f", "in", "self", ".", "file...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/setuptools/command/egg_info.py#L303-L313
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/theano/layers/output.py
python
OutputLayer.__init__
(self, loss, y, dtype=None, reshape_target=False, copy_input=None, copy_output=None, time_limit=0, use_source_index=False, auto_fix_target_length=False, sigmoid_outputs=False, exp_outputs=False, gauss_outputs=False, activation=None, prior_scale=0.0, log_prior=...
:param theano.Variable index: index for batches :param str loss: e.g. 'ce'
:param theano.Variable index: index for batches :param str loss: e.g. 'ce'
[ ":", "param", "theano", ".", "Variable", "index", ":", "index", "for", "batches", ":", "param", "str", "loss", ":", "e", ".", "g", ".", "ce" ]
def __init__(self, loss, y, dtype=None, reshape_target=False, copy_input=None, copy_output=None, time_limit=0, use_source_index=False, auto_fix_target_length=False, sigmoid_outputs=False, exp_outputs=False, gauss_outputs=False, activation=None, prior_scale=0.0...
[ "def", "__init__", "(", "self", ",", "loss", ",", "y", ",", "dtype", "=", "None", ",", "reshape_target", "=", "False", ",", "copy_input", "=", "None", ",", "copy_output", "=", "None", ",", "time_limit", "=", "0", ",", "use_source_index", "=", "False", ...
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/theano/layers/output.py#L26-L356
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/metadataserver/user_data/templates/snippets/maas_run_scripts.py
python
oauth_token
(string)
Helper to use as type for OAuth token commandline args.
Helper to use as type for OAuth token commandline args.
[ "Helper", "to", "use", "as", "type", "for", "OAuth", "token", "commandline", "args", "." ]
def oauth_token(string): """Helper to use as type for OAuth token commandline args.""" try: return Credentials.from_string(string) except InvalidCredentialsFormat as e: raise argparse.ArgumentTypeError(str(e))
[ "def", "oauth_token", "(", "string", ")", ":", "try", ":", "return", "Credentials", ".", "from_string", "(", "string", ")", "except", "InvalidCredentialsFormat", "as", "e", ":", "raise", "argparse", ".", "ArgumentTypeError", "(", "str", "(", "e", ")", ")" ]
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/metadataserver/user_data/templates/snippets/maas_run_scripts.py#L189-L194
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/wilight/cover.py
python
WiLightCover.is_closed
(self)
return ( self._status["motor_state"] == WL_STOPPED and wilight_to_hass_position(self._status["position_current"]) == 0 )
Return if the cover is closed or not.
Return if the cover is closed or not.
[ "Return", "if", "the", "cover", "is", "closed", "or", "not", "." ]
def is_closed(self): """Return if the cover is closed or not.""" if "motor_state" not in self._status or "position_current" not in self._status: return None return ( self._status["motor_state"] == WL_STOPPED and wilight_to_hass_position(self._status["position_...
[ "def", "is_closed", "(", "self", ")", ":", "if", "\"motor_state\"", "not", "in", "self", ".", "_status", "or", "\"position_current\"", "not", "in", "self", ".", "_status", ":", "return", "None", "return", "(", "self", ".", "_status", "[", "\"motor_state\"", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/wilight/cover.py#L80-L87
joxeankoret/pyew
8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8
envi/archs/i386/emu.py
python
IntelEmulator._emu_setGpReg
(self, reg, val, tsize)
Automagically map all general purpose register accesses to their tsize equiv. Helps clean up a lot of code (and makes a nice place for AMD64 to hook ;) )
Automagically map all general purpose register accesses to their tsize equiv. Helps clean up a lot of code (and makes a nice place for AMD64 to hook ;) )
[ "Automagically", "map", "all", "general", "purpose", "register", "accesses", "to", "their", "tsize", "equiv", ".", "Helps", "clean", "up", "a", "lot", "of", "code", "(", "and", "makes", "a", "nice", "place", "for", "AMD64", "to", "hook", ";", ")", ")" ]
def _emu_setGpReg(self, reg, val, tsize): """ Automagically map all general purpose register accesses to their tsize equiv. Helps clean up a lot of code (and makes a nice place for AMD64 to hook ;) ) """ if tsize == 1: reg += 0x00080000 elif tsize == ...
[ "def", "_emu_setGpReg", "(", "self", ",", "reg", ",", "val", ",", "tsize", ")", ":", "if", "tsize", "==", "1", ":", "reg", "+=", "0x00080000", "elif", "tsize", "==", "2", ":", "reg", "+=", "0x00100000", "self", ".", "setRegister", "(", "reg", ",", ...
https://github.com/joxeankoret/pyew/blob/8eb3e49a9bf57c0787fa79ecae0671129ef3f2e8/envi/archs/i386/emu.py#L985-L995
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/grammar.py
python
PCFG.__init__
(self, start, productions, calculate_leftcorners=True)
Create a new context-free grammar, from the given start state and set of ``ProbabilisticProductions``. :param start: The start symbol :type start: Nonterminal :param productions: The list of productions that defines the grammar :type productions: list(Production) :raise ...
Create a new context-free grammar, from the given start state and set of ``ProbabilisticProductions``.
[ "Create", "a", "new", "context", "-", "free", "grammar", "from", "the", "given", "start", "state", "and", "set", "of", "ProbabilisticProductions", "." ]
def __init__(self, start, productions, calculate_leftcorners=True): """ Create a new context-free grammar, from the given start state and set of ``ProbabilisticProductions``. :param start: The start symbol :type start: Nonterminal :param productions: The list of producti...
[ "def", "__init__", "(", "self", ",", "start", ",", "productions", ",", "calculate_leftcorners", "=", "True", ")", ":", "CFG", ".", "__init__", "(", "self", ",", "start", ",", "productions", ",", "calculate_leftcorners", ")", "# Make sure that the probabilities sum...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/grammar.py#L1211-L1235
dronekit/dronekit-python
1d89e82807ce543bae5e36426641b717e187c589
dronekit/__init__.py
python
Vehicle.on_message
(self, name)
return decorator
Decorator for message listener callback functions. .. tip:: This is the most elegant way to define message listener callback functions. Use :py:func:`add_message_listener` only if you need to be able to :py:func:`remove the listener <remove_message_listener>` later. ...
Decorator for message listener callback functions.
[ "Decorator", "for", "message", "listener", "callback", "functions", "." ]
def on_message(self, name): """ Decorator for message listener callback functions. .. tip:: This is the most elegant way to define message listener callback functions. Use :py:func:`add_message_listener` only if you need to be able to :py:func:`remove the li...
[ "def", "on_message", "(", "self", ",", "name", ")", ":", "def", "decorator", "(", "fn", ")", ":", "if", "isinstance", "(", "name", ",", "list", ")", ":", "for", "n", "in", "name", ":", "self", ".", "add_message_listener", "(", "n", ",", "fn", ")", ...
https://github.com/dronekit/dronekit-python/blob/1d89e82807ce543bae5e36426641b717e187c589/dronekit/__init__.py#L1469-L1507
crits/crits_services
c7abf91f1865d913cffad4b966599da204f8ae43
pdfinfo_service/pdfparser.py
python
cPDFParseDictionary.Retrieve
(self)
return self.parsed
[]
def Retrieve(self): return self.parsed
[ "def", "Retrieve", "(", "self", ")", ":", "return", "self", ".", "parsed" ]
https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/pdfinfo_service/pdfparser.py#L655-L656
IlyaGusev/rupo
83a5fac0dddd480a401181e5465f0e3c94ad2dcc
rupo/generate/generator.py
python
Generator.generate_poem
(self, metre_schema: str="+-", rhyme_pattern: str="aabb", n_syllables: int=8, letters_to_rhymes: dict=None, beam_width: int=None, sampling_k: int=None, rhyme_score_bo...
return poem
[]
def generate_poem(self, metre_schema: str="+-", rhyme_pattern: str="aabb", n_syllables: int=8, letters_to_rhymes: dict=None, beam_width: int=None, sampling_k: int=None, ...
[ "def", "generate_poem", "(", "self", ",", "metre_schema", ":", "str", "=", "\"+-\"", ",", "rhyme_pattern", ":", "str", "=", "\"aabb\"", ",", "n_syllables", ":", "int", "=", "8", ",", "letters_to_rhymes", ":", "dict", "=", "None", ",", "beam_width", ":", ...
https://github.com/IlyaGusev/rupo/blob/83a5fac0dddd480a401181e5465f0e3c94ad2dcc/rupo/generate/generator.py#L28-L97
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/noarch/sortedcontainers/sortedlistwithkey.py
python
SortedListWithKey._expand
(self, pos)
Splits sublists that are more than double the load level. Updates the index when the sublist length is less than double the load level. This requires incrementing the nodes in a traversal from the leaf node to the root. For an example traversal see self._loc.
Splits sublists that are more than double the load level.
[ "Splits", "sublists", "that", "are", "more", "than", "double", "the", "load", "level", "." ]
def _expand(self, pos): """ Splits sublists that are more than double the load level. Updates the index when the sublist length is less than double the load level. This requires incrementing the nodes in a traversal from the leaf node to the root. For an example traversal see se...
[ "def", "_expand", "(", "self", ",", "pos", ")", ":", "_lists", ",", "_keys", ",", "_index", "=", "self", ".", "_lists", ",", "self", ".", "_keys", ",", "self", ".", "_index", "if", "len", "(", "_keys", "[", "pos", "]", ")", ">", "self", ".", "_...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/sortedcontainers/sortedlistwithkey.py#L88-L118
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/Entrez/__init__.py
python
read
(handle, validate=True, escape=False)
return record
Parse an XML file from the NCBI Entrez Utilities into python objects. This function parses an XML file created by NCBI's Entrez Utilities, returning a multilevel data structure of Python lists and dictionaries. Most XML files returned by NCBI's Entrez Utilities can be parsed by this function, provided ...
Parse an XML file from the NCBI Entrez Utilities into python objects.
[ "Parse", "an", "XML", "file", "from", "the", "NCBI", "Entrez", "Utilities", "into", "python", "objects", "." ]
def read(handle, validate=True, escape=False): """Parse an XML file from the NCBI Entrez Utilities into python objects. This function parses an XML file created by NCBI's Entrez Utilities, returning a multilevel data structure of Python lists and dictionaries. Most XML files returned by NCBI's Entrez U...
[ "def", "read", "(", "handle", ",", "validate", "=", "True", ",", "escape", "=", "False", ")", ":", "from", ".", "Parser", "import", "DataHandler", "handler", "=", "DataHandler", "(", "validate", ",", "escape", ")", "record", "=", "handler", ".", "read", ...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Entrez/__init__.py#L462-L504
EmuKit/emukit
cdcb0d070d7f1c5585260266160722b636786859
emukit/core/initial_designs/random_design.py
python
RandomDesign.__init__
(self, parameter_space: ParameterSpace)
:param parameter_space: The parameter space to generate design for.
:param parameter_space: The parameter space to generate design for.
[ ":", "param", "parameter_space", ":", "The", "parameter", "space", "to", "generate", "design", "for", "." ]
def __init__(self, parameter_space: ParameterSpace) -> None: """ :param parameter_space: The parameter space to generate design for. """ super(RandomDesign, self).__init__(parameter_space)
[ "def", "__init__", "(", "self", ",", "parameter_space", ":", "ParameterSpace", ")", "->", "None", ":", "super", "(", "RandomDesign", ",", "self", ")", ".", "__init__", "(", "parameter_space", ")" ]
https://github.com/EmuKit/emukit/blob/cdcb0d070d7f1c5585260266160722b636786859/emukit/core/initial_designs/random_design.py#L15-L19
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/requests/models.py
python
Response.iter_content
(self, chunk_size=1, decode_unicode=False)
return chunks
Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can ...
Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can ...
[ "Iterates", "over", "the", "response", "data", ".", "When", "stream", "=", "True", "is", "set", "on", "the", "request", "this", "avoids", "reading", "the", "content", "at", "once", "into", "memory", "for", "large", "responses", ".", "The", "chunk", "size",...
def iter_content(self, chunk_size=1, decode_unicode=False): """Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is no...
[ "def", "iter_content", "(", "self", ",", "chunk_size", "=", "1", ",", "decode_unicode", "=", "False", ")", ":", "def", "generate", "(", ")", ":", "# Special case for urllib3.", "if", "hasattr", "(", "self", ".", "raw", ",", "'stream'", ")", ":", "try", "...
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/requests/models.py#L732-L785
agronholm/pythonfutures
acba785c8a5c331edce05dfa760540b8ea8a81f1
concurrent/futures/_base.py
python
Executor.shutdown
(self, wait=True)
Clean-up the resources associated with the Executor. It is safe to call this method several times. Otherwise, no other methods can be called after this one. Args: wait: If True then shutdown will not return until all running futures have finished executing and the r...
Clean-up the resources associated with the Executor.
[ "Clean", "-", "up", "the", "resources", "associated", "with", "the", "Executor", "." ]
def shutdown(self, wait=True): """Clean-up the resources associated with the Executor. It is safe to call this method several times. Otherwise, no other methods can be called after this one. Args: wait: If True then shutdown will not return until all running ...
[ "def", "shutdown", "(", "self", ",", "wait", "=", "True", ")", ":", "pass" ]
https://github.com/agronholm/pythonfutures/blob/acba785c8a5c331edce05dfa760540b8ea8a81f1/concurrent/futures/_base.py#L649-L660
blampe/IbPy
cba912d2ecc669b0bf2980357ea7942e49c0825e
ib/ext/EWrapperMsgGenerator.py
python
EWrapperMsgGenerator.updateMktDepth
(cls, tickerId, position, operation, side, price, size)
return "updateMktDepth: " + str(tickerId) + " " + str(position) + " " + str(operation) + " " + str(side) + " " + str(price) + " " + str(size)
generated source for method updateMktDepth
generated source for method updateMktDepth
[ "generated", "source", "for", "method", "updateMktDepth" ]
def updateMktDepth(cls, tickerId, position, operation, side, price, size): """ generated source for method updateMktDepth """ return "updateMktDepth: " + str(tickerId) + " " + str(position) + " " + str(operation) + " " + str(side) + " " + str(price) + " " + str(size)
[ "def", "updateMktDepth", "(", "cls", ",", "tickerId", ",", "position", ",", "operation", ",", "side", ",", "price", ",", "size", ")", ":", "return", "\"updateMktDepth: \"", "+", "str", "(", "tickerId", ")", "+", "\" \"", "+", "str", "(", "position", ")",...
https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/EWrapperMsgGenerator.py#L404-L406
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/forms_builder/forms/utils.py
python
generate_email_subject
(form, form_entry)
return subject
Generates email subject from subject template
Generates email subject from subject template
[ "Generates", "email", "subject", "from", "subject", "template" ]
def generate_email_subject(form, form_entry): """ Generates email subject from subject template """ if form.subject_template: subject = form.subject_template field_entries = form_entry.entry_fields() for field_entry in field_entries: label = field_entry.field.labe...
[ "def", "generate_email_subject", "(", "form", ",", "form_entry", ")", ":", "if", "form", ".", "subject_template", ":", "subject", "=", "form", ".", "subject_template", "field_entries", "=", "form_entry", ".", "entry_fields", "(", ")", "for", "field_entry", "in",...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/forms_builder/forms/utils.py#L53-L93
usb-tools/ViewSB
0318dc7b3d7da290a841b1681e62a0654c8c82e6
viewsb/decoders/filters.py
python
USBPacketFilter.consume_packet
(self, packet)
Trivial implementation of consume_packet that silently discards all packets consumed.
Trivial implementation of consume_packet that silently discards all packets consumed.
[ "Trivial", "implementation", "of", "consume_packet", "that", "silently", "discards", "all", "packets", "consumed", "." ]
def consume_packet(self, packet): """ Trivial implementation of consume_packet that silently discards all packets consumed. """ pass
[ "def", "consume_packet", "(", "self", ",", "packet", ")", ":", "pass" ]
https://github.com/usb-tools/ViewSB/blob/0318dc7b3d7da290a841b1681e62a0654c8c82e6/viewsb/decoders/filters.py#L32-L34
merenlab/anvio
9b792e2cedc49ecb7c0bed768261595a0d87c012
anvio/dbops.py
python
ContigsDatabase.compress_nt_position_info
(self, contig_length, genes_in_contig, genes_in_contigs_dict)
return nt_position_info_list
Compress info regarding each nucleotide position in a given contig into a small int Every nucleotide position is represented by four bits depending on whether they occur in a coding open reading frame, and which base they correspond to in a codon. 0000 |||| ||| \...
Compress info regarding each nucleotide position in a given contig into a small int
[ "Compress", "info", "regarding", "each", "nucleotide", "position", "in", "a", "given", "contig", "into", "a", "small", "int" ]
def compress_nt_position_info(self, contig_length, genes_in_contig, genes_in_contigs_dict): """Compress info regarding each nucleotide position in a given contig into a small int Every nucleotide position is represented by four bits depending on whether they occur in a coding open reading frame...
[ "def", "compress_nt_position_info", "(", "self", ",", "contig_length", ",", "genes_in_contig", ",", "genes_in_contigs_dict", ")", ":", "# first we create a list of zeros for each position of the contig", "nt_position_info_list", "=", "[", "0", "]", "*", "contig_length", "codi...
https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/dbops.py#L4457-L4518
JordyZomer/autoSubTakeover
3825a35a34043d71843cd1ced8fa468198ae7587
versioneer.py
python
git_versions_from_keywords
(keywords, tag_prefix, verbose)
return { "version": "0+unknown", "full-revisionid": keywords["full"].strip(), "dirty": False, "error": "no suitable tags", "date": None, }
Get version information from git keywords.
Get version information from git keywords.
[ "Get", "version", "information", "from", "git", "keywords", "." ]
def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: raise NotThisMethod("no keywords at all, weird") date = keywords.get("date") if date is not None: # git-2.2.0 added "%cI", which expands to an ISO-8601 -compli...
[ "def", "git_versions_from_keywords", "(", "keywords", ",", "tag_prefix", ",", "verbose", ")", ":", "if", "not", "keywords", ":", "raise", "NotThisMethod", "(", "\"no keywords at all, weird\"", ")", "date", "=", "keywords", ".", "get", "(", "\"date\"", ")", "if",...
https://github.com/JordyZomer/autoSubTakeover/blob/3825a35a34043d71843cd1ced8fa468198ae7587/versioneer.py#L989-L1047
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/imaplib.py
python
IMAP4.setacl
(self, mailbox, who, what)
return self._simple_command('SETACL', mailbox, who, what)
Set a mailbox acl. (typ, [data]) = <instance>.setacl(mailbox, who, what)
Set a mailbox acl.
[ "Set", "a", "mailbox", "acl", "." ]
def setacl(self, mailbox, who, what): """Set a mailbox acl. (typ, [data]) = <instance>.setacl(mailbox, who, what) """ return self._simple_command('SETACL', mailbox, who, what)
[ "def", "setacl", "(", "self", ",", "mailbox", ",", "who", ",", "what", ")", ":", "return", "self", ".", "_simple_command", "(", "'SETACL'", ",", "mailbox", ",", "who", ",", "what", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/imaplib.py#L663-L668
JetBrains/colorSchemeTool
5536207cf92f66509318e8fc51dacc2b5a80cac7
colorSchemeTool.py
python
find_by_scope
(settings, scope)
return ss_less_specific if (ss_less_specific is not None) else less_specific
[]
def find_by_scope(settings, scope): # compound scope less_specific = None less_specific_weight = 0 less_specific_selector_size = 0 # simple scope (without whitespaces and '-') ss_less_specific = None ss_less_specific_weight = 0 for setting in settings: scope_of_setting = setting....
[ "def", "find_by_scope", "(", "settings", ",", "scope", ")", ":", "# compound scope", "less_specific", "=", "None", "less_specific_weight", "=", "0", "less_specific_selector_size", "=", "0", "# simple scope (without whitespaces and '-')", "ss_less_specific", "=", "None", "...
https://github.com/JetBrains/colorSchemeTool/blob/5536207cf92f66509318e8fc51dacc2b5a80cac7/colorSchemeTool.py#L701-L770
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/tcl/tkinter/__init__.py
python
Wm.wm_aspect
(self, minNumer=None, minDenom=None, maxNumer=None, maxDenom=None)
return self._getints( self.tk.call('wm', 'aspect', self._w, minNumer, minDenom, maxNumer, maxDenom))
Instruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argument is given.
Instruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argument is given.
[ "Instruct", "the", "window", "manager", "to", "set", "the", "aspect", "ratio", "(", "width", "/", "height", ")", "of", "this", "widget", "to", "be", "between", "MINNUMER", "/", "MINDENOM", "and", "MAXNUMER", "/", "MAXDENOM", ".", "Return", "a", "tuple", ...
def wm_aspect(self, minNumer=None, minDenom=None, maxNumer=None, maxDenom=None): """Instruct the window manager to set the aspect ratio (width/height) of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple of the actual values if no argum...
[ "def", "wm_aspect", "(", "self", ",", "minNumer", "=", "None", ",", "minDenom", "=", "None", ",", "maxNumer", "=", "None", ",", "maxDenom", "=", "None", ")", ":", "return", "self", ".", "_getints", "(", "self", ".", "tk", ".", "call", "(", "'wm'", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/tcl/tkinter/__init__.py#L1973-L1982
seppius-xbmc-repo/ru
d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2
plugin.video.online.anidub.com/resources/lib/BeautifulSoup.py
python
PageElement.extract
(self)
return self
Destructively rips this element out of the tree.
Destructively rips this element out of the tree.
[ "Destructively", "rips", "this", "element", "out", "of", "the", "tree", "." ]
def extract(self): """Destructively rips this element out of the tree.""" if self.parent: try: del self.parent.contents[self.parent.index(self)] except ValueError: pass #Find the two elements that would be next to each other if #th...
[ "def", "extract", "(", "self", ")", ":", "if", "self", ".", "parent", ":", "try", ":", "del", "self", ".", "parent", ".", "contents", "[", "self", ".", "parent", ".", "index", "(", "self", ")", "]", "except", "ValueError", ":", "pass", "#Find the two...
https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.online.anidub.com/resources/lib/BeautifulSoup.py#L153-L180
JJBOY/BMN-Boundary-Matching-Network
a92c1d79c19d88b1d57b5abfae5a0be33f3002eb
post_processing.py
python
BMN_post_processing
(opt)
[]
def BMN_post_processing(opt): video_dict = getDatasetDict(opt) video_list = list(video_dict.keys()) # [:100] global result_dict result_dict = mp.Manager().dict() num_videos = len(video_list) num_videos_per_thread = num_videos // opt["post_process_thread"] processes = [] for tid in rang...
[ "def", "BMN_post_processing", "(", "opt", ")", ":", "video_dict", "=", "getDatasetDict", "(", "opt", ")", "video_list", "=", "list", "(", "video_dict", ".", "keys", "(", ")", ")", "# [:100]", "global", "result_dict", "result_dict", "=", "mp", ".", "Manager",...
https://github.com/JJBOY/BMN-Boundary-Matching-Network/blob/a92c1d79c19d88b1d57b5abfae5a0be33f3002eb/post_processing.py#L102-L127
happinesslz/TANet
2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f
second.pytorch_with_TANet/second/core/box_np_ops.py
python
limit_period
(val, offset=0.5, period=np.pi)
return val - np.floor(val / period + offset) * period
[]
def limit_period(val, offset=0.5, period=np.pi): return val - np.floor(val / period + offset) * period
[ "def", "limit_period", "(", "val", ",", "offset", "=", "0.5", ",", "period", "=", "np", ".", "pi", ")", ":", "return", "val", "-", "np", ".", "floor", "(", "val", "/", "period", "+", "offset", ")", "*", "period" ]
https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/second.pytorch_with_TANet/second/core/box_np_ops.py#L503-L504
annoviko/pyclustering
bf4f51a472622292627ec8c294eb205585e50f52
pyclustering/nnet/examples/sync_examples.py
python
negative_connection_9_grid_struct
()
Comment: Right coloring
Comment: Right coloring
[ "Comment", ":", "Right", "coloring" ]
def negative_connection_9_grid_struct(): "Comment: Right coloring" _ = template_dynamic_sync(9, -2, conn = conn_type.GRID_FOUR)
[ "def", "negative_connection_9_grid_struct", "(", ")", ":", "_", "=", "template_dynamic_sync", "(", "9", ",", "-", "2", ",", "conn", "=", "conn_type", ".", "GRID_FOUR", ")" ]
https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/nnet/examples/sync_examples.py#L65-L67
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/manageorg/_parameters.py
python
PublishCSVParameters.columnNames
(self)
return self._columnNames
gets/sets the columnNames
gets/sets the columnNames
[ "gets", "/", "sets", "the", "columnNames" ]
def columnNames(self): """gets/sets the columnNames""" return self._columnNames
[ "def", "columnNames", "(", "self", ")", ":", "return", "self", ".", "_columnNames" ]
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_parameters.py#L1906-L1908
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/cherrypy/_cptree.py
python
Application.get_serving
(self, local, remote, scheme, sproto)
return req, resp
Create and return a Request and Response object.
Create and return a Request and Response object.
[ "Create", "and", "return", "a", "Request", "and", "Response", "object", "." ]
def get_serving(self, local, remote, scheme, sproto): """Create and return a Request and Response object.""" req = self.request_class(local, remote, scheme, sproto) req.app = self for name, toolbox in self.toolboxes.items(): req.namespaces[name] = toolbox resp = sel...
[ "def", "get_serving", "(", "self", ",", "local", ",", "remote", ",", "scheme", ",", "sproto", ")", ":", "req", "=", "self", ".", "request_class", "(", "local", ",", "remote", ",", "scheme", ",", "sproto", ")", "req", ".", "app", "=", "self", "for", ...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cherrypy/_cptree.py#L122-L135
flennerhag/mlens
6cbc11354b5f9500a33d9cefb700a1bba9d3199a
mlens/config.py
python
set_dtype
(dtype)
Set the dtype to use during estimation. Parameters ---------- dtype : object numpy dtype
Set the dtype to use during estimation.
[ "Set", "the", "dtype", "to", "use", "during", "estimation", "." ]
def set_dtype(dtype): """Set the dtype to use during estimation. Parameters ---------- dtype : object numpy dtype """ global _DTYPE _DTYPE = dtype
[ "def", "set_dtype", "(", "dtype", ")", ":", "global", "_DTYPE", "_DTYPE", "=", "dtype" ]
https://github.com/flennerhag/mlens/blob/6cbc11354b5f9500a33d9cefb700a1bba9d3199a/mlens/config.py#L133-L142
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_lease.py
python
V1Lease.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_lease.py#L186-L188
saltstack/halite
1eacc7e3f51b670573aecb8980661e0c5dbfa0f4
halite/bottle.py
python
BaseResponse.iter_headers
(self)
return self.headerlist
Yield (header, value) tuples, skipping headers that are not allowed with the current response status code.
Yield (header, value) tuples, skipping headers that are not allowed with the current response status code.
[ "Yield", "(", "header", "value", ")", "tuples", "skipping", "headers", "that", "are", "not", "allowed", "with", "the", "current", "response", "status", "code", "." ]
def iter_headers(self): ''' Yield (header, value) tuples, skipping headers that are not allowed with the current response status code. ''' return self.headerlist
[ "def", "iter_headers", "(", "self", ")", ":", "return", "self", ".", "headerlist" ]
https://github.com/saltstack/halite/blob/1eacc7e3f51b670573aecb8980661e0c5dbfa0f4/halite/bottle.py#L1510-L1513
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_configmap.py
python
Utils._write
(filename, contents)
Actually write the file contents to disk. This helps with mocking.
Actually write the file contents to disk. This helps with mocking.
[ "Actually", "write", "the", "file", "contents", "to", "disk", ".", "This", "helps", "with", "mocking", "." ]
def _write(filename, contents): ''' Actually write the file contents to disk. This helps with mocking. ''' with open(filename, 'w') as sfd: sfd.write(str(contents))
[ "def", "_write", "(", "filename", ",", "contents", ")", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "sfd", ":", "sfd", ".", "write", "(", "str", "(", "contents", ")", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_configmap.py#L1163-L1167
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/topi/arm_cpu/mprofile/dsp/micro_kernel/max_pool.py
python
intrin_max
(shape, in_dtype, out_dtype)
return intrin_decl, uniq_id
Defines a v7e-m DSP-accelerated max pool.
Defines a v7e-m DSP-accelerated max pool.
[ "Defines", "a", "v7e", "-", "m", "DSP", "-", "accelerated", "max", "pool", "." ]
def intrin_max(shape, in_dtype, out_dtype): """Defines a v7e-m DSP-accelerated max pool.""" UNIQ_ID_LEN = 8 uniq_id = "".join(random.choices(string.ascii_uppercase, k=UNIQ_ID_LEN)) func_prefix = "max8" assert in_dtype == "int8" assert out_dtype == "int8" x = te.placeholder(shape, name="x",...
[ "def", "intrin_max", "(", "shape", ",", "in_dtype", ",", "out_dtype", ")", ":", "UNIQ_ID_LEN", "=", "8", "uniq_id", "=", "\"\"", ".", "join", "(", "random", ".", "choices", "(", "string", ".", "ascii_uppercase", ",", "k", "=", "UNIQ_ID_LEN", ")", ")", ...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/topi/arm_cpu/mprofile/dsp/micro_kernel/max_pool.py#L28-L84
guillermooo/Vintageous
f958207009902052aed5fcac09745f1742648604
vi/inputs.py
python
vi_at
(state)
return p
[]
def vi_at(state): p = parser_def(command=one_char, interactive_command=None, input_param=None, on_done=None, type=input_types.INMEDIATE) return p
[ "def", "vi_at", "(", "state", ")", ":", "p", "=", "parser_def", "(", "command", "=", "one_char", ",", "interactive_command", "=", "None", ",", "input_param", "=", "None", ",", "on_done", "=", "None", ",", "type", "=", "input_types", ".", "INMEDIATE", ")"...
https://github.com/guillermooo/Vintageous/blob/f958207009902052aed5fcac09745f1742648604/vi/inputs.py#L98-L104
IBM/pytorchpipe
9cb17271666061cb19fe24197ecd5e4c8d32c5da
ptp/components/tasks/image_text_to_class/vqa_med_2019.py
python
VQAMED2019.filter_sources
(self, source_files, source_image_folders, source_categories)
return source_files, source_image_folders, source_categories
Loads the dataset from one or more files. :param source_files: List of source files. :param source_image_folders: List of folders containing image files. :param source_categories: List of categories associated with each of those files. (<UNK> unknown) :return: Tuple consisting of: fi...
Loads the dataset from one or more files.
[ "Loads", "the", "dataset", "from", "one", "or", "more", "files", "." ]
def filter_sources(self, source_files, source_image_folders, source_categories): """ Loads the dataset from one or more files. :param source_files: List of source files. :param source_image_folders: List of folders containing image files. :param source_categories: List of cate...
[ "def", "filter_sources", "(", "self", ",", "source_files", ",", "source_image_folders", ",", "source_categories", ")", ":", "# Check categories that user want to use.", "use_files", "=", "[", "False", "]", "*", "4", "categs", "=", "{", "'C1'", ":", "0", ",", "'C...
https://github.com/IBM/pytorchpipe/blob/9cb17271666061cb19fe24197ecd5e4c8d32c5da/ptp/components/tasks/image_text_to_class/vqa_med_2019.py#L346-L373
cagbal/ros_people_object_detection_tensorflow
982ffd4a54b8059638f5cd4aa167299c7fc9e61f
src/object_detection/trainer.py
python
train
(create_tensor_dict_fn, create_model_fn, train_config, master, task, num_clones, worker_replicas, clone_on_cpu, ps_tasks, worker_job_name, is_chief, train_dir, graph_hook_fn=None)
Training function for detection models. Args: create_tensor_dict_fn: a function to create a tensor input dictionary. create_model_fn: a function that creates a DetectionModel and generates losses. train_config: a train_pb2.TrainConfig protobuf. master: BNS name of the TensorFlow ...
Training function for detection models.
[ "Training", "function", "for", "detection", "models", "." ]
def train(create_tensor_dict_fn, create_model_fn, train_config, master, task, num_clones, worker_replicas, clone_on_cpu, ps_tasks, worker_job_name, is_chief, train_dir, graph_hook_fn=None): """Training function for detection models. Args: create_tensor_dict_fn: a function to create a tensor...
[ "def", "train", "(", "create_tensor_dict_fn", ",", "create_model_fn", ",", "train_config", ",", "master", ",", "task", ",", "num_clones", ",", "worker_replicas", ",", "clone_on_cpu", ",", "ps_tasks", ",", "worker_job_name", ",", "is_chief", ",", "train_dir", ",", ...
https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/trainer.py#L186-L370
voila-dashboards/voila
495bcfea54a5af8b65708c5289e4594067524f2f
voila/execute.py
python
VoilaExecutor.should_strip_error
(self)
return not self.show_tracebacks
Return True if errors should be stripped from the Notebook, False otherwise, depending on the current config.
Return True if errors should be stripped from the Notebook, False otherwise, depending on the current config.
[ "Return", "True", "if", "errors", "should", "be", "stripped", "from", "the", "Notebook", "False", "otherwise", "depending", "on", "the", "current", "config", "." ]
def should_strip_error(self): """Return True if errors should be stripped from the Notebook, False otherwise, depending on the current config.""" return not self.show_tracebacks
[ "def", "should_strip_error", "(", "self", ")", ":", "return", "not", "self", ".", "show_tracebacks" ]
https://github.com/voila-dashboards/voila/blob/495bcfea54a5af8b65708c5289e4594067524f2f/voila/execute.py#L82-L84
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/datastructures.py
python
ImmutableTypeConversionDict.copy
(self)
return TypeConversionDict(self)
Return a shallow mutable copy of this object. Keep in mind that the standard library's :func:`copy` function is a no-op for this class like for any other python immutable type (eg: :class:`tuple`).
Return a shallow mutable copy of this object. Keep in mind that the standard library's :func:`copy` function is a no-op for this class like for any other python immutable type (eg: :class:`tuple`).
[ "Return", "a", "shallow", "mutable", "copy", "of", "this", "object", ".", "Keep", "in", "mind", "that", "the", "standard", "library", "s", ":", "func", ":", "copy", "function", "is", "a", "no", "-", "op", "for", "this", "class", "like", "for", "any", ...
def copy(self): """Return a shallow mutable copy of this object. Keep in mind that the standard library's :func:`copy` function is a no-op for this class like for any other python immutable type (eg: :class:`tuple`). """ return TypeConversionDict(self)
[ "def", "copy", "(", "self", ")", ":", "return", "TypeConversionDict", "(", "self", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/werkzeug/datastructures.py#L304-L309
opendatacube/datacube-core
b062184be61c140a168de94510bc3661748f112e
datacube/index/_datasets.py
python
DatasetResource.archive_location
(self, id_, uri)
Archive a location of the dataset if it exists. :param typing.Union[UUID, str] id_: dataset id :param str uri: fully qualified uri :return bool: location was able to be archived
Archive a location of the dataset if it exists.
[ "Archive", "a", "location", "of", "the", "dataset", "if", "it", "exists", "." ]
def archive_location(self, id_, uri): """ Archive a location of the dataset if it exists. :param typing.Union[UUID, str] id_: dataset id :param str uri: fully qualified uri :return bool: location was able to be archived """ with self._db.connect() as connection: ...
[ "def", "archive_location", "(", "self", ",", "id_", ",", "uri", ")", ":", "with", "self", ".", "_db", ".", "connect", "(", ")", "as", "connection", ":", "was_archived", "=", "connection", ".", "archive_location", "(", "id_", ",", "uri", ")", "return", ...
https://github.com/opendatacube/datacube-core/blob/b062184be61c140a168de94510bc3661748f112e/datacube/index/_datasets.py#L464-L474
OpenMDAO/OpenMDAO-Framework
f2e37b7de3edeaaeb2d251b375917adec059db9b
openmdao.main/src/openmdao/main/systems.py
python
System.set_complex_step
(self, complex_step=False)
Toggles complex_step plumbing for this system and all local subsystems.
Toggles complex_step plumbing for this system and all local subsystems.
[ "Toggles", "complex_step", "plumbing", "for", "this", "system", "and", "all", "local", "subsystems", "." ]
def set_complex_step(self, complex_step=False): """ Toggles complex_step plumbing for this system and all local subsystems. """ self.complex_step = complex_step for subsystem in self.local_subsystems(): subsystem.set_complex_step(complex_step)
[ "def", "set_complex_step", "(", "self", ",", "complex_step", "=", "False", ")", ":", "self", ".", "complex_step", "=", "complex_step", "for", "subsystem", "in", "self", ".", "local_subsystems", "(", ")", ":", "subsystem", ".", "set_complex_step", "(", "complex...
https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.main/src/openmdao/main/systems.py#L810-L817
armancohan/long-summarization
1328d4f37b3a3a460f455e93e84ed4ddcd10dab1
batch_reader.py
python
_section_to_ids
(section, vocab, max_len, pad_id)
Converts words in a section (list of strings) to ids and pad if necessary
Converts words in a section (list of strings) to ids and pad if necessary
[ "Converts", "words", "in", "a", "section", "(", "list", "of", "strings", ")", "to", "ids", "and", "pad", "if", "necessary" ]
def _section_to_ids(section, vocab, max_len, pad_id): """ Converts words in a section (list of strings) to ids and pad if necessary """ section_text = ' '.join(section) section_words = section_text.split() sec_len = len(section_words) if sec_len > max_len: section_words = section_words[:max_len] word_id...
[ "def", "_section_to_ids", "(", "section", ",", "vocab", ",", "max_len", ",", "pad_id", ")", ":", "section_text", "=", "' '", ".", "join", "(", "section", ")", "section_words", "=", "section_text", ".", "split", "(", ")", "sec_len", "=", "len", "(", "sect...
https://github.com/armancohan/long-summarization/blob/1328d4f37b3a3a460f455e93e84ed4ddcd10dab1/batch_reader.py#L61-L68
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/pyasn1/type/univ.py
python
SequenceAndSetBase.reset
(self)
return self
Remove all components and become a |ASN.1| schema object. See :meth:`isValue` property for more information on the distinction between value and schema objects.
Remove all components and become a |ASN.1| schema object.
[ "Remove", "all", "components", "and", "become", "a", "|ASN", ".", "1|", "schema", "object", "." ]
def reset(self): """Remove all components and become a |ASN.1| schema object. See :meth:`isValue` property for more information on the distinction between value and schema objects. """ self._componentValues = noValue self._dynamicNames = self.DynamicNames() retur...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_componentValues", "=", "noValue", "self", ".", "_dynamicNames", "=", "self", ".", "DynamicNames", "(", ")", "return", "self" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/pyasn1/type/univ.py#L2304-L2312
alcarithemad/zfsp
37a25b83103aa67a269b31cd4413d3baaffcde56
zfs/readcontext.py
python
ReadContext.checksum
(self, data: bytes, valid, checksum)
return util.checksum(data, valid, checksum, self.default_checksum)
[]
def checksum(self, data: bytes, valid, checksum) -> bool: return util.checksum(data, valid, checksum, self.default_checksum)
[ "def", "checksum", "(", "self", ",", "data", ":", "bytes", ",", "valid", ",", "checksum", ")", "->", "bool", ":", "return", "util", ".", "checksum", "(", "data", ",", "valid", ",", "checksum", ",", "self", ".", "default_checksum", ")" ]
https://github.com/alcarithemad/zfsp/blob/37a25b83103aa67a269b31cd4413d3baaffcde56/zfs/readcontext.py#L22-L23
beeware/voc
dd9f15a7d56d00d8c9e501a57194694e601ea401
tools/compile_stdlib.py
python
native_modules
(target)
return set(modules)
Find stdlib modules already implemented in java.
Find stdlib modules already implemented in java.
[ "Find", "stdlib", "modules", "already", "implemented", "in", "java", "." ]
def native_modules(target): """Find stdlib modules already implemented in java.""" modules = [] for folder in ['common', target]: basedir = os.path.join(REPO_ROOT, 'python', folder, 'python') for name in os.listdir(basedir): module_name, ext = os.path.splitext(name) i...
[ "def", "native_modules", "(", "target", ")", ":", "modules", "=", "[", "]", "for", "folder", "in", "[", "'common'", ",", "target", "]", ":", "basedir", "=", "os", ".", "path", ".", "join", "(", "REPO_ROOT", ",", "'python'", ",", "folder", ",", "'pyth...
https://github.com/beeware/voc/blob/dd9f15a7d56d00d8c9e501a57194694e601ea401/tools/compile_stdlib.py#L157-L168
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/appdirs.py
python
user_log_dir
(appname=None, appauthor=None, version=None, opinion=True)
return path
r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific log dir for this application.
[ "r", "Return", "full", "path", "to", "the", "user", "-", "specific", "log", "dir", "for", "this", "application", "." ]
def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the...
[ "def", "user_log_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "opinion", "=", "True", ")", ":", "if", "system", "==", "\"darwin\"", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/appdirs.py#L356-L404
Allen7D/mini-shop-server
5f3ddd5a4e5e99a1e005f11abc620cefff2493fc
app/dao/group.py
python
GroupDao.delete_group
(id)
:param id: 权限组id :return:
:param id: 权限组id :return:
[ ":", "param", "id", ":", "权限组id", ":", "return", ":" ]
def delete_group(id): ''' :param id: 权限组id :return: ''' group = Group.get_or_404(id=id, msg='分组不存在,删除失败') if User.get(group_id=id): raise Forbidden(msg='分组下存在用户,不可删除') # 删除group拥有的权限 with db.auto_commit(): db.session.query(Auth).fi...
[ "def", "delete_group", "(", "id", ")", ":", "group", "=", "Group", ".", "get_or_404", "(", "id", "=", "id", ",", "msg", "=", "'分组不存在,删除失败')", "", "if", "User", ".", "get", "(", "group_id", "=", "id", ")", ":", "raise", "Forbidden", "(", "msg", "=",...
https://github.com/Allen7D/mini-shop-server/blob/5f3ddd5a4e5e99a1e005f11abc620cefff2493fc/app/dao/group.py#L46-L60
zzzeek/sqlalchemy
fc5c54fcd4d868c2a4c7ac19668d72f506fe821e
lib/sqlalchemy/orm/collections.py
python
column_mapped_collection
(mapping_spec)
return lambda: MappedCollection(keyfunc)
A dictionary-based collection type with column-based keying. Returns a :class:`.MappedCollection` factory with a keying function generated from mapping_spec, which may be a Column or a sequence of Columns. The key value must be immutable for the lifetime of the object. You can not, for example, m...
A dictionary-based collection type with column-based keying.
[ "A", "dictionary", "-", "based", "collection", "type", "with", "column", "-", "based", "keying", "." ]
def column_mapped_collection(mapping_spec): """A dictionary-based collection type with column-based keying. Returns a :class:`.MappedCollection` factory with a keying function generated from mapping_spec, which may be a Column or a sequence of Columns. The key value must be immutable for the lifet...
[ "def", "column_mapped_collection", "(", "mapping_spec", ")", ":", "cols", "=", "[", "coercions", ".", "expect", "(", "roles", ".", "ColumnArgumentRole", ",", "q", ",", "argname", "=", "\"mapping_spec\"", ")", "for", "q", "in", "util", ".", "to_list", "(", ...
https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/orm/collections.py#L233-L251
rspivak/lsbasi
07e1a14516156a21ebe2d82e0bae4bba5ad73dd6
part19/spi.py
python
Parser.term
(self)
return node
term : factor ((MUL | INTEGER_DIV | FLOAT_DIV) factor)*
term : factor ((MUL | INTEGER_DIV | FLOAT_DIV) factor)*
[ "term", ":", "factor", "((", "MUL", "|", "INTEGER_DIV", "|", "FLOAT_DIV", ")", "factor", ")", "*" ]
def term(self): """term : factor ((MUL | INTEGER_DIV | FLOAT_DIV) factor)*""" node = self.factor() while self.current_token.type in ( TokenType.MUL, TokenType.INTEGER_DIV, TokenType.FLOAT_DIV, ): token = self.current_token ...
[ "def", "term", "(", "self", ")", ":", "node", "=", "self", ".", "factor", "(", ")", "while", "self", ".", "current_token", ".", "type", "in", "(", "TokenType", ".", "MUL", ",", "TokenType", ".", "INTEGER_DIV", ",", "TokenType", ".", "FLOAT_DIV", ",", ...
https://github.com/rspivak/lsbasi/blob/07e1a14516156a21ebe2d82e0bae4bba5ad73dd6/part19/spi.py#L649-L668
chengzhengxin/groupsoftmax-simpledet
3f63a00998c57fee25241cf43a2e8600893ea462
models/tridentnet/resnet_v1.py
python
TridentResNetV1Builder.resnet_c4_factory
(cls, depth, use_3x3_conv0, use_bn_preprocess, num_trident_block, num_branch, branch_dilates, branch_ids, branch_bn_shared, branch_conv_shared, branch_deform, norm_type="local", norm_mom=0.9, ndev=None, fp16=False)
return c4
[]
def resnet_c4_factory(cls, depth, use_3x3_conv0, use_bn_preprocess, num_trident_block, num_branch, branch_dilates, branch_ids, branch_bn_shared, branch_conv_shared, branch_deform, norm_type="local", norm_mom=0.9, ndev=None, fp16=False): c1, c2, c3, c4, c5 = cl...
[ "def", "resnet_c4_factory", "(", "cls", ",", "depth", ",", "use_3x3_conv0", ",", "use_bn_preprocess", ",", "num_trident_block", ",", "num_branch", ",", "branch_dilates", ",", "branch_ids", ",", "branch_bn_shared", ",", "branch_conv_shared", ",", "branch_deform", ",", ...
https://github.com/chengzhengxin/groupsoftmax-simpledet/blob/3f63a00998c57fee25241cf43a2e8600893ea462/models/tridentnet/resnet_v1.py#L249-L256
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
opy/gold/class_vs_closure.py
python
Adder2
(amount)
return anon
[]
def Adder2(amount): def anon(x): return x + amount return anon
[ "def", "Adder2", "(", "amount", ")", ":", "def", "anon", "(", "x", ")", ":", "return", "x", "+", "amount", "return", "anon" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/gold/class_vs_closure.py#L57-L60
ladybug-tools/honeybee-legacy
bd62af4862fe022801fb87dbc8794fdf1dff73a9
src/Honeybee_ Run Energy Simulation.py
python
WriteIDF.EPZone
(self, zone)
return zoneStr
[]
def EPZone(self, zone): if zone.isPlenum: zone.partOfArea = False zoneStr = '\nZone,\n' + \ '\t' + zone.name + ',\n' + \ '\t' + `zone.north` + ',\t!-Direction of Relative North {deg}\n' + \ '\t' + `zone.origin.X` + ',\t!- X Origin {m}\...
[ "def", "EPZone", "(", "self", ",", "zone", ")", ":", "if", "zone", ".", "isPlenum", ":", "zone", ".", "partOfArea", "=", "False", "zoneStr", "=", "'\\nZone,\\n'", "+", "'\\t'", "+", "zone", ".", "name", "+", "',\\n'", "+", "'\\t'", "+", "`zone.north`",...
https://github.com/ladybug-tools/honeybee-legacy/blob/bd62af4862fe022801fb87dbc8794fdf1dff73a9/src/Honeybee_ Run Energy Simulation.py#L117-L136
cocos2d/cocos2d-console
0b55cf8a5ebafffc7977fe5c64a4dea9b2d58c34
plugins/plugin_new/project_new.py
python
TPCreator.project_replace_mac_bundleid
(self, v)
will modify the content of the file
will modify the content of the file
[ "will", "modify", "the", "content", "of", "the", "file" ]
def project_replace_mac_bundleid(self, v): """ will modify the content of the file """ if self.mac_bundleid is None: return dst_project_dir = self.project_dir dst_project_name = self.project_name src_bundleid = v['src_bundle_id'] dst_bundleid = self.m...
[ "def", "project_replace_mac_bundleid", "(", "self", ",", "v", ")", ":", "if", "self", ".", "mac_bundleid", "is", "None", ":", "return", "dst_project_dir", "=", "self", ".", "project_dir", "dst_project_name", "=", "self", ".", "project_name", "src_bundleid", "=",...
https://github.com/cocos2d/cocos2d-console/blob/0b55cf8a5ebafffc7977fe5c64a4dea9b2d58c34/plugins/plugin_new/project_new.py#L689-L712
getavalon/core
31e8cb4760e00e3db64443f6f932b7fd8e96d41d
avalon/vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py
python
_temporary_keychain
()
return keychain, tempdirectory
This function creates a temporary Mac keychain that we can use to work with credentials. This keychain uses a one-time password and a temporary file to store the data. We expect to have one keychain per socket. The returned SecKeychainRef must be freed by the caller, including calling SecKeychainDelete....
This function creates a temporary Mac keychain that we can use to work with credentials. This keychain uses a one-time password and a temporary file to store the data. We expect to have one keychain per socket. The returned SecKeychainRef must be freed by the caller, including calling SecKeychainDelete.
[ "This", "function", "creates", "a", "temporary", "Mac", "keychain", "that", "we", "can", "use", "to", "work", "with", "credentials", ".", "This", "keychain", "uses", "a", "one", "-", "time", "password", "and", "a", "temporary", "file", "to", "store", "the"...
def _temporary_keychain(): """ This function creates a temporary Mac keychain that we can use to work with credentials. This keychain uses a one-time password and a temporary file to store the data. We expect to have one keychain per socket. The returned SecKeychainRef must be freed by the caller, i...
[ "def", "_temporary_keychain", "(", ")", ":", "# Unfortunately, SecKeychainCreate requires a path to a keychain. This", "# means we cannot use mkstemp to use a generic temporary file. Instead,", "# we're going to create a temporary directory and a filename to use there.", "# This filename will be 8 r...
https://github.com/getavalon/core/blob/31e8cb4760e00e3db64443f6f932b7fd8e96d41d/avalon/vendor/requests/packages/urllib3/contrib/_securetransport/low_level.py#L168-L205
thiagopena/djangoSIGE
e32186b27bfd8acf21b0fa400e699cb5c73e5433
djangosige/apps/login/context_user.py
python
foto_usuario
(request)
return context_dict
[]
def foto_usuario(request): context_dict = {} # Foto do usuario try: user_foto = Usuario.objects.get(user=request.user).user_foto context_dict['user_foto_sidebar'] = user_foto except: pass # Empresa do usuario try: user_empresa = MinhaEmpresa.objects.get( ...
[ "def", "foto_usuario", "(", "request", ")", ":", "context_dict", "=", "{", "}", "# Foto do usuario", "try", ":", "user_foto", "=", "Usuario", ".", "objects", ".", "get", "(", "user", "=", "request", ".", "user", ")", ".", "user_foto", "context_dict", "[", ...
https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/login/context_user.py#L9-L27
cisco-sas/kitty
cb0760989dcdfe079e43ac574d872d0b18953a32
kitty/model/low_level/mutated_field.py
python
BitFlip.__init__
(self, value, num_bits=1, fuzzable=True, name=None)
:param value: value to mutate (str or bytes) :param num_bits: number of consequtive bits to flip (invert) :param fuzzable: is field fuzzable (default: True) :param name: name of the object (default: None) :raises: ``KittyException`` if num_bits is bigger than the value length in bits ...
:param value: value to mutate (str or bytes) :param num_bits: number of consequtive bits to flip (invert) :param fuzzable: is field fuzzable (default: True) :param name: name of the object (default: None)
[ ":", "param", "value", ":", "value", "to", "mutate", "(", "str", "or", "bytes", ")", ":", "param", "num_bits", ":", "number", "of", "consequtive", "bits", "to", "flip", "(", "invert", ")", ":", "param", "fuzzable", ":", "is", "field", "fuzzable", "(", ...
def __init__(self, value, num_bits=1, fuzzable=True, name=None): ''' :param value: value to mutate (str or bytes) :param num_bits: number of consequtive bits to flip (invert) :param fuzzable: is field fuzzable (default: True) :param name: name of the object (default: None) ...
[ "def", "__init__", "(", "self", ",", "value", ",", "num_bits", "=", "1", ",", "fuzzable", "=", "True", ",", "name", "=", "None", ")", ":", "kassert", ".", "is_of_types", "(", "value", ",", "(", "bytes", ",", "bytearray", ",", "str", ")", ")", "valu...
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/mutated_field.py#L54-L73
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/distutils/dist.py
python
Distribution.find_config_files
(self)
return files
Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are three possible config files: distutils.cfg in ...
Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions).
[ "Find", "as", "many", "configuration", "files", "as", "should", "be", "processed", "for", "this", "platform", "and", "return", "a", "list", "of", "filenames", "in", "the", "order", "in", "which", "they", "should", "be", "parsed", ".", "The", "filenames", "...
def find_config_files(self): """Find as many configuration files as should be processed for this platform, and return a list of filenames in the order in which they should be parsed. The filenames returned are guaranteed to exist (modulo nasty race conditions). There are three ...
[ "def", "find_config_files", "(", "self", ")", ":", "files", "=", "[", "]", "check_environ", "(", ")", "# Where to look for the system-wide Distutils config file", "sys_dir", "=", "os", ".", "path", ".", "dirname", "(", "sys", ".", "modules", "[", "'distutils'", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/distutils/dist.py#L330-L376
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_env.py
python
Yedit.put
(self, path, value)
return (True, self.yaml_dict)
put path, value into a dict
put path, value into a dict
[ "put", "path", "value", "into", "a", "dict" ]
def put(self, path, value): ''' put path, value into a dict ''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if entry == value: return (False, self.yaml_dict) # deepcopy didn't work ...
[ "def", "put", "(", "self", ",", "path", ",", "value", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except", "KeyError", ":", "entry", "=", "None", "i...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_env.py#L597-L638
annoviko/pyclustering
bf4f51a472622292627ec8c294eb205585e50f52
pyclustering/cluster/syncnet.py
python
syncnet._create_connections
(self, radius)
! @brief Create connections between oscillators in line with input radius of connectivity. @param[in] radius (double): Connectivity radius between oscillators.
!
[ "!" ]
def _create_connections(self, radius): """! @brief Create connections between oscillators in line with input radius of connectivity. @param[in] radius (double): Connectivity radius between oscillators. """ if self._ena_conn_weight is True: s...
[ "def", "_create_connections", "(", "self", ",", "radius", ")", ":", "if", "self", ".", "_ena_conn_weight", "is", "True", ":", "self", ".", "_conn_weight", "=", "[", "[", "0", "]", "*", "self", ".", "_num_osc", "for", "_", "in", "range", "(", "0", ","...
https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/cluster/syncnet.py#L243-L285
mahmoud/boltons
270e974975984f662f998c8f6eb0ebebd964de82
boltons/setutils.py
python
_ComplementSet.intersection
(self, other)
[]
def intersection(self, other): try: return self & other except NotImplementedError: raise TypeError('argument must be another set or complement(set)')
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "try", ":", "return", "self", "&", "other", "except", "NotImplementedError", ":", "raise", "TypeError", "(", "'argument must be another set or complement(set)'", ")" ]
https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/setutils.py#L641-L645
elfi-dev/elfi
07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c
elfi/methods/results.py
python
SmcSample.n_populations
(self)
return len(self.populations)
Return the number of populations.
Return the number of populations.
[ "Return", "the", "number", "of", "populations", "." ]
def n_populations(self): """Return the number of populations.""" return len(self.populations)
[ "def", "n_populations", "(", "self", ")", ":", "return", "len", "(", "self", ".", "populations", ")" ]
https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/methods/results.py#L358-L360
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/TCLIService/ttypes.py
python
TCloseOperationResp.__repr__
(self)
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
[]
def __repr__(self): L = ['%s=%r' % (key, value) for key, value in self.__dict__.items()] return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
[ "def", "__repr__", "(", "self", ")", ":", "L", "=", "[", "'%s=%r'", "%", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "self", ".", "__dict__", ".", "items", "(", ")", "]", "return", "'%s(%s)'", "%", "(", "self", ".", "__class_...
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/TCLIService/ttypes.py#L5275-L5278
chartbeat-labs/textacy
40cd12fe953ef8be5958cff93ad8762262f3b757
src/textacy/extract/matches.py
python
regex_matches
( doclike: types.DocLike, pattern: str | Pattern, *, alignment_mode: str = "strict", # Literal["strict", "contract", "expand"] )
Extract ``Span`` s from a document or sentence whose full texts match against a regular expression ``pattern``. Args: doclike pattern: Valid regular expression against which to match document text, either as a string or compiled pattern object. alignment_mode: How character ...
Extract ``Span`` s from a document or sentence whose full texts match against a regular expression ``pattern``.
[ "Extract", "Span", "s", "from", "a", "document", "or", "sentence", "whose", "full", "texts", "match", "against", "a", "regular", "expression", "pattern", "." ]
def regex_matches( doclike: types.DocLike, pattern: str | Pattern, *, alignment_mode: str = "strict", # Literal["strict", "contract", "expand"] ) -> Iterable[Span]: """ Extract ``Span`` s from a document or sentence whose full texts match against a regular expression ``pattern``. Args:...
[ "def", "regex_matches", "(", "doclike", ":", "types", ".", "DocLike", ",", "pattern", ":", "str", "|", "Pattern", ",", "*", ",", "alignment_mode", ":", "str", "=", "\"strict\"", ",", "# Literal[\"strict\", \"contract\", \"expand\"]", ")", "->", "Iterable", "[", ...
https://github.com/chartbeat-labs/textacy/blob/40cd12fe953ef8be5958cff93ad8762262f3b757/src/textacy/extract/matches.py#L150-L180
tBuLi/symfit
3bcb66fbbe518f65a1339d6c62be715da4d77398
symfit/core/models.py
python
BaseModel.__eq__
(self, other)
``Model``'s are considered equal when they have the same dependent variables, and the same expressions for those dependent variables. The same is defined here as passing sympy == for the vars themselves, and as expr1 - expr2 == 0 for the expressions. For more info check the `sympy docs <https://...
``Model``'s are considered equal when they have the same dependent variables, and the same expressions for those dependent variables. The same is defined here as passing sympy == for the vars themselves, and as expr1 - expr2 == 0 for the expressions. For more info check the `sympy docs <https://...
[ "Model", "s", "are", "considered", "equal", "when", "they", "have", "the", "same", "dependent", "variables", "and", "the", "same", "expressions", "for", "those", "dependent", "variables", ".", "The", "same", "is", "defined", "here", "as", "passing", "sympy", ...
def __eq__(self, other): """ ``Model``'s are considered equal when they have the same dependent variables, and the same expressions for those dependent variables. The same is defined here as passing sympy == for the vars themselves, and as expr1 - expr2 == 0 for the expressions. ...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "len", "(", "self", ")", "is", "not", "len", "(", "other", ")", ":", "return", "False", "else", ":", "for", "var_1", ",", "var_2", "in", "zip", "(", "self", ",", "other", ")", ":", "if...
https://github.com/tBuLi/symfit/blob/3bcb66fbbe518f65a1339d6c62be715da4d77398/symfit/core/models.py#L280-L300
abcminiuser/python-elgato-streamdeck
681c7e9c084981e9286a41abb05d85713cd16317
src/StreamDeck/Devices/StreamDeck.py
python
StreamDeck.key_count
(self)
return self.KEY_COUNT
Retrieves number of physical buttons on the attached StreamDeck device. :rtype: int :return: Number of physical buttons.
Retrieves number of physical buttons on the attached StreamDeck device.
[ "Retrieves", "number", "of", "physical", "buttons", "on", "the", "attached", "StreamDeck", "device", "." ]
def key_count(self): """ Retrieves number of physical buttons on the attached StreamDeck device. :rtype: int :return: Number of physical buttons. """ return self.KEY_COUNT
[ "def", "key_count", "(", "self", ")", ":", "return", "self", ".", "KEY_COUNT" ]
https://github.com/abcminiuser/python-elgato-streamdeck/blob/681c7e9c084981e9286a41abb05d85713cd16317/src/StreamDeck/Devices/StreamDeck.py#L195-L202
daler/pybedtools
ffe0d4bd2f32a0a5fc0cea049ee73773c4d57573
pybedtools/contrib/venn_maker.py
python
_dict_to_R_named_list
(d)
return "list(%s)" % ", ".join(items)
Calls _list_to_R_syntax for each item. Returns one big string.
Calls _list_to_R_syntax for each item. Returns one big string.
[ "Calls", "_list_to_R_syntax", "for", "each", "item", ".", "Returns", "one", "big", "string", "." ]
def _dict_to_R_named_list(d): """ Calls _list_to_R_syntax for each item. Returns one big string. """ items = [] for key, val in list(d.items()): items.append('"%s" = %s' % (key, _list_to_R_syntax(val))) return "list(%s)" % ", ".join(items)
[ "def", "_dict_to_R_named_list", "(", "d", ")", ":", "items", "=", "[", "]", "for", "key", ",", "val", "in", "list", "(", "d", ".", "items", "(", ")", ")", ":", "items", ".", "append", "(", "'\"%s\" = %s'", "%", "(", "key", ",", "_list_to_R_syntax", ...
https://github.com/daler/pybedtools/blob/ffe0d4bd2f32a0a5fc0cea049ee73773c4d57573/pybedtools/contrib/venn_maker.py#L45-L52
lesscpy/lesscpy
1172a1693df2f4bc929a88b1bebb920e666c0c9f
lesscpy/lessc/parser.py
python
LessParser.p_string_part_list
(self, p)
string_part_list : string_part
string_part_list : string_part
[ "string_part_list", ":", "string_part" ]
def p_string_part_list(self, p): """ string_part_list : string_part """ p[0] = [p[1]]
[ "def", "p_string_part_list", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "[", "p", "[", "1", "]", "]" ]
https://github.com/lesscpy/lesscpy/blob/1172a1693df2f4bc929a88b1bebb920e666c0c9f/lesscpy/lessc/parser.py#L844-L847
IndicoDataSolutions/Passage
af6e100804dfe332c88bd2cd192e93a807377887
passage/utils.py
python
iter_data
(*data, **kwargs)
[]
def iter_data(*data, **kwargs): size = kwargs.get('size', 128) batches = math.ceil(len(data[0]) / size) for b in range(batches): start = b * size end = (b + 1) * size if len(data) == 1: yield data[0][start:end] else: yield tuple([d[start:end] for d in...
[ "def", "iter_data", "(", "*", "data", ",", "*", "*", "kwargs", ")", ":", "size", "=", "kwargs", ".", "get", "(", "'size'", ",", "128", ")", "batches", "=", "math", ".", "ceil", "(", "len", "(", "data", "[", "0", "]", ")", "/", "size", ")", "f...
https://github.com/IndicoDataSolutions/Passage/blob/af6e100804dfe332c88bd2cd192e93a807377887/passage/utils.py#L8-L18
sideeffects/SideFXLabs
956bc1eef6710882ae8d3a31b4a33dd631a56d5f
scripts/python/labsopui/wedge_tools.py
python
ParmContainer.getWedgeAttribType
(self)
return self.wedgeattribtype
[]
def getWedgeAttribType(self): return self.wedgeattribtype
[ "def", "getWedgeAttribType", "(", "self", ")", ":", "return", "self", ".", "wedgeattribtype" ]
https://github.com/sideeffects/SideFXLabs/blob/956bc1eef6710882ae8d3a31b4a33dd631a56d5f/scripts/python/labsopui/wedge_tools.py#L19-L20
home-assistant/supervisor
69c2517d5211b483fdfe968b0a2b36b672ee7ab2
supervisor/misc/tasks.py
python
Tasks._update_multicast
(self)
Check and run update of multicast.
Check and run update of multicast.
[ "Check", "and", "run", "update", "of", "multicast", "." ]
async def _update_multicast(self): """Check and run update of multicast.""" if not self.sys_plugins.multicast.need_update: return _LOGGER.info( "Found new Multicast version %s, updating", self.sys_plugins.multicast.latest_version, ) await self...
[ "async", "def", "_update_multicast", "(", "self", ")", ":", "if", "not", "self", ".", "sys_plugins", ".", "multicast", ".", "need_update", ":", "return", "_LOGGER", ".", "info", "(", "\"Found new Multicast version %s, updating\"", ",", "self", ".", "sys_plugins", ...
https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/misc/tasks.py#L290-L299
BEEmod/BEE2.4
02767f3cf476581789425ab308ca1bea978f6a74
src/editoritems_props.py
python
ItemProp.__eq__
(self, other: object)
return NotImplemented
Subclasses do not compare equal.
Subclasses do not compare equal.
[ "Subclasses", "do", "not", "compare", "equal", "." ]
def __eq__(self, other: object) -> bool: """Subclasses do not compare equal.""" if type(self) is type(other): return self.default == cast(ItemProp, other).default return NotImplemented
[ "def", "__eq__", "(", "self", ",", "other", ":", "object", ")", "->", "bool", ":", "if", "type", "(", "self", ")", "is", "type", "(", "other", ")", ":", "return", "self", ".", "default", "==", "cast", "(", "ItemProp", ",", "other", ")", ".", "def...
https://github.com/BEEmod/BEE2.4/blob/02767f3cf476581789425ab308ca1bea978f6a74/src/editoritems_props.py#L31-L35
apple/coremltools
141a83af482fcbdd5179807c9eaff9a7999c2c49
deps/protobuf/python/mox.py
python
MockAnything._Reset
(self)
Reset the state of this mock to record mode with an empty queue.
Reset the state of this mock to record mode with an empty queue.
[ "Reset", "the", "state", "of", "this", "mock", "to", "record", "mode", "with", "an", "empty", "queue", "." ]
def _Reset(self): """Reset the state of this mock to record mode with an empty queue.""" # Maintain a list of method calls we are expecting self._expected_calls_queue = deque() # Make sure we are in setup mode, not replay mode self._replay_mode = False
[ "def", "_Reset", "(", "self", ")", ":", "# Maintain a list of method calls we are expecting", "self", ".", "_expected_calls_queue", "=", "deque", "(", ")", "# Make sure we are in setup mode, not replay mode", "self", ".", "_replay_mode", "=", "False" ]
https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/deps/protobuf/python/mox.py#L349-L356
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/replication/tcp/protocol.py
python
ClientReplicationStreamProtocol.replicate
(self)
Send the subscription request to the server
Send the subscription request to the server
[ "Send", "the", "subscription", "request", "to", "the", "server" ]
def replicate(self): """Send the subscription request to the server""" logger.info("[%s] Subscribing to replication streams", self.id()) self.send_command(ReplicateCommand())
[ "def", "replicate", "(", "self", ")", ":", "logger", ".", "info", "(", "\"[%s] Subscribing to replication streams\"", ",", "self", ".", "id", "(", ")", ")", "self", ".", "send_command", "(", "ReplicateCommand", "(", ")", ")" ]
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/replication/tcp/protocol.py#L515-L519
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/celery/result.py
python
allow_join_result
()
[]
def allow_join_result(): reset_value = task_join_will_block() _set_task_join_will_block(False) try: yield finally: _set_task_join_will_block(reset_value)
[ "def", "allow_join_result", "(", ")", ":", "reset_value", "=", "task_join_will_block", "(", ")", "_set_task_join_will_block", "(", "False", ")", "try", ":", "yield", "finally", ":", "_set_task_join_will_block", "(", "reset_value", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/result.py#L48-L54
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/dist.py
python
Distribution.has_contents_for
(self, package)
Return true if 'exclude_package(package)' would do something
Return true if 'exclude_package(package)' would do something
[ "Return", "true", "if", "exclude_package", "(", "package", ")", "would", "do", "something" ]
def has_contents_for(self, package): """Return true if 'exclude_package(package)' would do something""" pfx = package + '.' for p in self.iter_distribution_names(): if p == package or p.startswith(pfx): return True
[ "def", "has_contents_for", "(", "self", ",", "package", ")", ":", "pfx", "=", "package", "+", "'.'", "for", "p", "in", "self", ".", "iter_distribution_names", "(", ")", ":", "if", "p", "==", "package", "or", "p", ".", "startswith", "(", "pfx", ")", "...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/dist.py#L719-L726
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/commands/parse.py
python
Command.prepare_request
(self, spider, request, opts)
return request
[]
def prepare_request(self, spider, request, opts): def callback(response, **cb_kwargs): # memorize first request if not self.first_response: self.first_response = response # determine real callback cb = response.meta['_callback'] if not...
[ "def", "prepare_request", "(", "self", ",", "spider", ",", "request", ",", "opts", ")", ":", "def", "callback", "(", "response", ",", "*", "*", "cb_kwargs", ")", ":", "# memorize first request", "if", "not", "self", ".", "first_response", ":", "self", ".",...
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/commands/parse.py#L160-L222
Xinkai/XwareDesktop
408a451b1548864ff5073e60c52e62082d2219cf
src/shared/thirdparty/aiohttp/multidict.py
python
MultiDict.copy
(self)
return cls(self.items(getall=True))
Returns a copy itself.
Returns a copy itself.
[ "Returns", "a", "copy", "itself", "." ]
def copy(self): """Returns a copy itself.""" cls = self.__class__ return cls(self.items(getall=True))
[ "def", "copy", "(", "self", ")", ":", "cls", "=", "self", ".", "__class__", "return", "cls", "(", "self", ".", "items", "(", "getall", "=", "True", ")", ")" ]
https://github.com/Xinkai/XwareDesktop/blob/408a451b1548864ff5073e60c52e62082d2219cf/src/shared/thirdparty/aiohttp/multidict.py#L56-L59
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/biplist/__init__.py
python
FloatWrapper.__repr__
(self)
return "<FloatWrapper: %s>" % self.value
[]
def __repr__(self): return "<FloatWrapper: %s>" % self.value
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"<FloatWrapper: %s>\"", "%", "self", ".", "value" ]
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/biplist/__init__.py#L456-L457
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet/nets/pytorch_backend/e2e_tts_transformer.py
python
Transformer._integrate_with_spk_embed
(self, hs, spembs)
return hs
Integrate speaker embedding with hidden states. Args: hs (Tensor): Batch of hidden state sequences (B, Tmax, adim). spembs (Tensor): Batch of speaker embeddings (B, spk_embed_dim). Returns: Tensor: Batch of integrated hidden state sequences (B, Tmax, adim)
Integrate speaker embedding with hidden states.
[ "Integrate", "speaker", "embedding", "with", "hidden", "states", "." ]
def _integrate_with_spk_embed(self, hs, spembs): """Integrate speaker embedding with hidden states. Args: hs (Tensor): Batch of hidden state sequences (B, Tmax, adim). spembs (Tensor): Batch of speaker embeddings (B, spk_embed_dim). Returns: Tensor: Batch of...
[ "def", "_integrate_with_spk_embed", "(", "self", ",", "hs", ",", "spembs", ")", ":", "if", "self", ".", "spk_embed_integration_type", "==", "\"add\"", ":", "# apply projection and then add to hidden states", "spembs", "=", "self", ".", "projection", "(", "F", ".", ...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet/nets/pytorch_backend/e2e_tts_transformer.py#L1058-L1080
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/hamcrest/library/number/ordering_comparison.py
python
greater_than
(value)
return OrderingComparison(value, operator.gt, 'greater than')
Matches if object is greater than a given value. :param value: The value to compare against.
Matches if object is greater than a given value.
[ "Matches", "if", "object", "is", "greater", "than", "a", "given", "value", "." ]
def greater_than(value): """Matches if object is greater than a given value. :param value: The value to compare against. """ return OrderingComparison(value, operator.gt, 'greater than')
[ "def", "greater_than", "(", "value", ")", ":", "return", "OrderingComparison", "(", "value", ",", "operator", ".", "gt", ",", "'greater than'", ")" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/hamcrest/library/number/ordering_comparison.py#L26-L32
PacktPublishing/Mastering-OpenCV-4-with-Python
ea5372c6d8758ebc56ef5c775f9785d4427f81e6
Chapter08/01-chapter-content/contours_introduction.py
python
draw_contour_points
(img, cnts, color)
return img
Draw all points from a list of contours
Draw all points from a list of contours
[ "Draw", "all", "points", "from", "a", "list", "of", "contours" ]
def draw_contour_points(img, cnts, color): """Draw all points from a list of contours""" for cnt in cnts: # print(cnt.shape) # print(cnt) squeeze = np.squeeze(cnt) # print(squeeze.shape) # print(squeeze) for p in squeeze: # print(p) p = a...
[ "def", "draw_contour_points", "(", "img", ",", "cnts", ",", "color", ")", ":", "for", "cnt", "in", "cnts", ":", "# print(cnt.shape)", "# print(cnt)", "squeeze", "=", "np", ".", "squeeze", "(", "cnt", ")", "# print(squeeze.shape)", "# print(squeeze)", "for", "p...
https://github.com/PacktPublishing/Mastering-OpenCV-4-with-Python/blob/ea5372c6d8758ebc56ef5c775f9785d4427f81e6/Chapter08/01-chapter-content/contours_introduction.py#L26-L42