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
ulif/diceware
5d909b5e2f8efdd8dfe53a4f68c50f7710961dc0
diceware/config.py
python
string_to_wlist_list
(text)
return [name for name in re.split(RE_WLIST_NAME, text) if name != ""]
Split string into list of valid wordlist names.
Split string into list of valid wordlist names.
[ "Split", "string", "into", "list", "of", "valid", "wordlist", "names", "." ]
def string_to_wlist_list(text): """Split string into list of valid wordlist names. """ return [name for name in re.split(RE_WLIST_NAME, text) if name != ""]
[ "def", "string_to_wlist_list", "(", "text", ")", ":", "return", "[", "name", "for", "name", "in", "re", ".", "split", "(", "RE_WLIST_NAME", ",", "text", ")", "if", "name", "!=", "\"\"", "]" ]
https://github.com/ulif/diceware/blob/5d909b5e2f8efdd8dfe53a4f68c50f7710961dc0/diceware/config.py#L70-L73
appliedsec/pygeoip
2a725df0b727e8b08f217ab84f7b8243c42554f5
pygeoip/__init__.py
python
GeoIP.region_by_addr
(self, addr)
return self._get_region(ipnum)
Returns dictionary containing `country_code` and `region_code`. :arg addr: IP address (e.g. 203.0.113.30)
Returns dictionary containing `country_code` and `region_code`.
[ "Returns", "dictionary", "containing", "country_code", "and", "region_code", "." ]
def region_by_addr(self, addr): """ Returns dictionary containing `country_code` and `region_code`. :arg addr: IP address (e.g. 203.0.113.30) """ if self._databaseType not in const.REGION_CITY_EDITIONS: message = 'Invalid database type, expected Region or City' ...
[ "def", "region_by_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "_databaseType", "not", "in", "const", ".", "REGION_CITY_EDITIONS", ":", "message", "=", "'Invalid database type, expected Region or City'", "raise", "GeoIPError", "(", "message", ")", ...
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L564-L575
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/mailbox.py
python
MaildirMessage.get_flags
(self)
Return as a string the flags that are set.
Return as a string the flags that are set.
[ "Return", "as", "a", "string", "the", "flags", "that", "are", "set", "." ]
def get_flags(self): """Return as a string the flags that are set.""" if self._info.startswith('2,'): return self._info[2:] else: return ''
[ "def", "get_flags", "(", "self", ")", ":", "if", "self", ".", "_info", ".", "startswith", "(", "'2,'", ")", ":", "return", "self", ".", "_info", "[", "2", ":", "]", "else", ":", "return", "''" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/mailbox.py#L1501-L1506
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/utils/graphicstextlist.py
python
TextListWidget.__setup
(self)
[]
def __setup(self) -> None: self.__clear() font = self.__effectiveFont if self.__autoScale else self.font() assert self.__group is None group = QGraphicsItemGroup() for text in self.__items: t = QGraphicsSimpleTextItem(group) t.setFont(font) t.s...
[ "def", "__setup", "(", "self", ")", "->", "None", ":", "self", ".", "__clear", "(", ")", "font", "=", "self", ".", "__effectiveFont", "if", "self", ".", "__autoScale", "else", "self", ".", "font", "(", ")", "assert", "self", ".", "__group", "is", "No...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/utils/graphicstextlist.py#L248-L260
peering-manager/peering-manager
62c870fb9caa6dfc056feb77c595d45bc3c4988a
peering/views.py
python
CommunityDetails.get_context
(self, request, **kwargs)
return { "instance": get_object_or_404(self.queryset, **kwargs), "active_tab": "main", }
[]
def get_context(self, request, **kwargs): return { "instance": get_object_or_404(self.queryset, **kwargs), "active_tab": "main", }
[ "def", "get_context", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "return", "{", "\"instance\"", ":", "get_object_or_404", "(", "self", ".", "queryset", ",", "*", "*", "kwargs", ")", ",", "\"active_tab\"", ":", "\"main\"", ",", "}" ]
https://github.com/peering-manager/peering-manager/blob/62c870fb9caa6dfc056feb77c595d45bc3c4988a/peering/views.py#L448-L452
rikdz/GraphWriter
f228420aa48697dfb7a1ced3a62f955031664ed3
vectorize.py
python
dataset.bszFn
(self,e,l,c)
return c+len(e.out)
[]
def bszFn(self,e,l,c): return c+len(e.out)
[ "def", "bszFn", "(", "self", ",", "e", ",", "l", ",", "c", ")", ":", "return", "c", "+", "len", "(", "e", ".", "out", ")" ]
https://github.com/rikdz/GraphWriter/blob/f228420aa48697dfb7a1ced3a62f955031664ed3/vectorize.py#L160-L161
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
scripts_9.0/setup-seafile-mysql.py
python
main
()
[]
def main(): if len(sys.argv) > 2 and sys.argv[1] == 'auto': sys.argv.remove('auto') parser = argparse.ArgumentParser() parser.add_argument('-n', '--server-name', help='server name') parser.add_argument('-i', '--server-ip', help='server ip or domain') parser.add_argument('-p',...
[ "def", "main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">", "2", "and", "sys", ".", "argv", "[", "1", "]", "==", "'auto'", ":", "sys", ".", "argv", ".", "remove", "(", "'auto'", ")", "parser", "=", "argparse", ".", "ArgumentPa...
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/scripts_9.0/setup-seafile-mysql.py#L1412-L1482
MycroftAI/mycroft-precise
e1a635e9675047eb86f64ca489a1b941321c489a
precise/model.py
python
load_precise_model
(model_name: str)
return load_keras().models.load_model(model_name)
Loads a Keras model from file, handling custom loss function
Loads a Keras model from file, handling custom loss function
[ "Loads", "a", "Keras", "model", "from", "file", "handling", "custom", "loss", "function" ]
def load_precise_model(model_name: str) -> Any: """Loads a Keras model from file, handling custom loss function""" if not model_name.endswith('.net'): print('Warning: Unknown model type, ', model_name) inject_params(model_name) return load_keras().models.load_model(model_name)
[ "def", "load_precise_model", "(", "model_name", ":", "str", ")", "->", "Any", ":", "if", "not", "model_name", ".", "endswith", "(", "'.net'", ")", ":", "print", "(", "'Warning: Unknown model type, '", ",", "model_name", ")", "inject_params", "(", "model_name", ...
https://github.com/MycroftAI/mycroft-precise/blob/e1a635e9675047eb86f64ca489a1b941321c489a/precise/model.py#L48-L54
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/xmlrpc/client.py
python
Binary.decode
(self, data)
[]
def decode(self, data): self.data = base64.decodebytes(data)
[ "def", "decode", "(", "self", ",", "data", ")", ":", "self", ".", "data", "=", "base64", ".", "decodebytes", "(", "data", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xmlrpc/client.py#L414-L415
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/op_union.py
python
CascadedUnion.reduceToGeometries
(self, geomTree)
return geoms
* Reduces a tree of geometries to a list of geometries * by recursively unioning the subtrees in the list. * * @param geomTree a tree-structured list of geometries * @return a list of Geometrys
* Reduces a tree of geometries to a list of geometries * by recursively unioning the subtrees in the list. * *
[ "*", "Reduces", "a", "tree", "of", "geometries", "to", "a", "list", "of", "geometries", "*", "by", "recursively", "unioning", "the", "subtrees", "in", "the", "list", ".", "*", "*" ]
def reduceToGeometries(self, geomTree): """ * Reduces a tree of geometries to a list of geometries * by recursively unioning the subtrees in the list. * * @param geomTree a tree-structured list of geometries * @return a list of Geometrys """ # logger....
[ "def", "reduceToGeometries", "(", "self", ",", "geomTree", ")", ":", "# logger.debug(\"%s.reduceToGeometries:\\n%s\", type(self).__name__, geomTree)", "geoms", "=", "[", "]", "for", "item", "in", "geomTree", ":", "if", "item", ".", "t", "==", "ItemsListItem", ".", "...
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/op_union.py#L150-L170
chainer/chainerui
91c5c26d9154a008079dbb0bcbf69b5590d105f7
chainerui/views/result.py
python
ResultAPI.get
(self, id=None, project_id=None)
get.
get.
[ "get", "." ]
def get(self, id=None, project_id=None): """get.""" logs_limit = request.args.get('logs_limit', default=-1, type=int) is_unregistered = request.args.get( 'is_unregistered', default=False, type=bool) project = db.session.query(Project).filter_by( id=project_id).fi...
[ "def", "get", "(", "self", ",", "id", "=", "None", ",", "project_id", "=", "None", ")", ":", "logs_limit", "=", "request", ".", "args", ".", "get", "(", "'logs_limit'", ",", "default", "=", "-", "1", ",", "type", "=", "int", ")", "is_unregistered", ...
https://github.com/chainer/chainerui/blob/91c5c26d9154a008079dbb0bcbf69b5590d105f7/chainerui/views/result.py#L17-L78
dbt-labs/dbt-core
e943b9fc842535e958ef4fd0b8703adc91556bc6
core/dbt/task/runnable.py
python
GraphRunnableTask.run
(self)
return result
Run dbt for the query, based on the graph.
Run dbt for the query, based on the graph.
[ "Run", "dbt", "for", "the", "query", "based", "on", "the", "graph", "." ]
def run(self): """ Run dbt for the query, based on the graph. """ self._runtime_initialize() if self._flattened_nodes is None: raise InternalException( 'after _runtime_initialize, _flattened_nodes was still None' ) if len(self._fl...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_runtime_initialize", "(", ")", "if", "self", ".", "_flattened_nodes", "is", "None", ":", "raise", "InternalException", "(", "'after _runtime_initialize, _flattened_nodes was still None'", ")", "if", "len", "(", "...
https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/task/runnable.py#L450-L483
readbeyond/aeneas
4d200a050690903b30b3d885b44714fecb23f18a
bin/aeneas_check_setup.py
python
print_info
(msg)
Print an info message
Print an info message
[ "Print", "an", "info", "message" ]
def print_info(msg): """ Print an info message """ print(u"[INFO] %s" % (msg))
[ "def", "print_info", "(", "msg", ")", ":", "print", "(", "u\"[INFO] %s\"", "%", "(", "msg", ")", ")" ]
https://github.com/readbeyond/aeneas/blob/4d200a050690903b30b3d885b44714fecb23f18a/bin/aeneas_check_setup.py#L65-L67
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/db/utils.py
python
ConnectionHandler.ensure_defaults
(self, alias)
Puts the defaults into the settings dictionary for a given connection where no settings is provided.
Puts the defaults into the settings dictionary for a given connection where no settings is provided.
[ "Puts", "the", "defaults", "into", "the", "settings", "dictionary", "for", "a", "given", "connection", "where", "no", "settings", "is", "provided", "." ]
def ensure_defaults(self, alias): """ Puts the defaults into the settings dictionary for a given connection where no settings is provided. """ try: conn = self.databases[alias] except KeyError: raise ConnectionDoesNotExist("The connection %s doesn'...
[ "def", "ensure_defaults", "(", "self", ",", "alias", ")", ":", "try", ":", "conn", "=", "self", ".", "databases", "[", "alias", "]", "except", "KeyError", ":", "raise", "ConnectionDoesNotExist", "(", "\"The connection %s doesn't exist\"", "%", "alias", ")", "c...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/db/utils.py#L67-L85
GeorgeSeif/Semantic-Segmentation-Suite
f04c94c2077a957bca0e8509b8ed2861769c4ba6
frontends/se_resnext.py
python
constant_xavier_initializer
(shape, group, dtype=tf.float32, uniform=True)
Initializer function.
Initializer function.
[ "Initializer", "function", "." ]
def constant_xavier_initializer(shape, group, dtype=tf.float32, uniform=True): """Initializer function.""" if not dtype.is_floating: raise TypeError('Cannot create initializer for non-floating point type.') # Estimating fan_in and fan_out is not possible to do perfectly, but we try. # This is the ...
[ "def", "constant_xavier_initializer", "(", "shape", ",", "group", ",", "dtype", "=", "tf", ".", "float32", ",", "uniform", "=", "True", ")", ":", "if", "not", "dtype", ".", "is_floating", ":", "raise", "TypeError", "(", "'Cannot create initializer for non-floati...
https://github.com/GeorgeSeif/Semantic-Segmentation-Suite/blob/f04c94c2077a957bca0e8509b8ed2861769c4ba6/frontends/se_resnext.py#L14-L39
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/idlelib/EditorWindow.py
python
EditorWindow.RemoveKeybindings
(self)
Remove the keybindings before they are changed.
Remove the keybindings before they are changed.
[ "Remove", "the", "keybindings", "before", "they", "are", "changed", "." ]
def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extens...
[ "def", "RemoveKeybindings", "(", "self", ")", ":", "# Called from configDialog.py", "self", ".", "Bindings", ".", "default_keydefs", "=", "keydefs", "=", "idleConf", ".", "GetCurrentKeySet", "(", ")", "for", "event", ",", "keylist", "in", "keydefs", ".", "items"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/EditorWindow.py#L814-L824
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/cloudsigma.py
python
CloudSigma_1_0_NodeDriver.ex_set_node_configuration
(self, node, **kwargs)
return response.status == 200 and response.body != ""
Update a node configuration. Changing most of the parameters requires node to be stopped. :param node: Node which should be used :type node: :class:`libcloud.compute.base.Node` :param kwargs: keyword arguments :type kwargs: ``dict`` :rtype: ``bool...
Update a node configuration. Changing most of the parameters requires node to be stopped.
[ "Update", "a", "node", "configuration", ".", "Changing", "most", "of", "the", "parameters", "requires", "node", "to", "be", "stopped", "." ]
def ex_set_node_configuration(self, node, **kwargs): """ Update a node configuration. Changing most of the parameters requires node to be stopped. :param node: Node which should be used :type node: :class:`libcloud.compute.base.Node` :param kwargs: keywo...
[ "def", "ex_set_node_configuration", "(", "self", ",", "node", ",", "*", "*", "kwargs", ")", ":", "valid_keys", "=", "(", "\"^name$\"", ",", "\"^parent$\"", ",", "\"^cpu$\"", ",", "\"^smp$\"", ",", "\"^mem$\"", ",", "\"^boot$\"", ",", "\"^nic:0:model$\"", ",", ...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/cloudsigma.py#L516-L569
fniephaus/alfred-pocket
c8ff8b23d708a746cce2888398cc566bef687a14
src/workflow/workflow.py
python
Workflow.decode
(self, text, encoding=None, normalization=None)
return unicodedata.normalize(normalization, text)
Return ``text`` as normalised unicode. If ``encoding`` and/or ``normalization`` is ``None``, the ``input_encoding``and ``normalization`` parameters passed to :class:`Workflow` are used. :param text: string :type text: encoded or Unicode string. If ``text`` is already a ...
Return ``text`` as normalised unicode.
[ "Return", "text", "as", "normalised", "unicode", "." ]
def decode(self, text, encoding=None, normalization=None): """Return ``text`` as normalised unicode. If ``encoding`` and/or ``normalization`` is ``None``, the ``input_encoding``and ``normalization`` parameters passed to :class:`Workflow` are used. :param text: string :t...
[ "def", "decode", "(", "self", ",", "text", ",", "encoding", "=", "None", ",", "normalization", "=", "None", ")", ":", "encoding", "=", "encoding", "or", "self", ".", "_input_encoding", "normalization", "=", "normalization", "or", "self", ".", "_normalizsatio...
https://github.com/fniephaus/alfred-pocket/blob/c8ff8b23d708a746cce2888398cc566bef687a14/src/workflow/workflow.py#L2671-L2703
NoGameNoLife00/mybolg
afe17ea5bfe405e33766e5682c43a4262232ee12
libs/sqlalchemy/orm/interfaces.py
python
MapperProperty.post_instrument_class
(self, mapper)
Perform instrumentation adjustments that need to occur after init() has completed.
Perform instrumentation adjustments that need to occur after init() has completed.
[ "Perform", "instrumentation", "adjustments", "that", "need", "to", "occur", "after", "init", "()", "has", "completed", "." ]
def post_instrument_class(self, mapper): """Perform instrumentation adjustments that need to occur after init() has completed. """ pass
[ "def", "post_instrument_class", "(", "self", ",", "mapper", ")", ":", "pass" ]
https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/sqlalchemy/orm/interfaces.py#L184-L189
pytroll/satpy
09e51f932048f98cce7919a4ff8bd2ec01e1ae98
satpy/writers/__init__.py
python
DecisionTree._find_match
(self, curr_level, remaining_match_keys, query_dict)
return match
Find a match.
Find a match.
[ "Find", "a", "match", "." ]
def _find_match(self, curr_level, remaining_match_keys, query_dict): """Find a match.""" if len(remaining_match_keys) == 0: # we're at the bottom level, we must have found something return curr_level match = self._find_match_if_known( curr_level, remaining_ma...
[ "def", "_find_match", "(", "self", ",", "curr_level", ",", "remaining_match_keys", ",", "query_dict", ")", ":", "if", "len", "(", "remaining_match_keys", ")", "==", "0", ":", "# we're at the bottom level, we must have found something", "return", "curr_level", "match", ...
https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/writers/__init__.py#L993-L1009
byt3bl33d3r/pth-toolkit
3641cdc76c0f52275315c9b18bf08b22521bd4d7
lib/python2.7/site-packages/samba/samba3/__init__.py
python
IdmapDatabase.get_user_hwm
(self)
return fetch_uint32(self.tdb, IDMAP_HWM_USER)
Obtain the user high-water mark.
Obtain the user high-water mark.
[ "Obtain", "the", "user", "high", "-", "water", "mark", "." ]
def get_user_hwm(self): """Obtain the user high-water mark.""" return fetch_uint32(self.tdb, IDMAP_HWM_USER)
[ "def", "get_user_hwm", "(", "self", ")", ":", "return", "fetch_uint32", "(", "self", ".", "tdb", ",", "IDMAP_HWM_USER", ")" ]
https://github.com/byt3bl33d3r/pth-toolkit/blob/3641cdc76c0f52275315c9b18bf08b22521bd4d7/lib/python2.7/site-packages/samba/samba3/__init__.py#L192-L194
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py
python
copyfile
(src, dst)
Copy data from src to dst
Copy data from src to dst
[ "Copy", "data", "from", "src", "to", "dst" ]
def copyfile(src, dst): """Copy data from src to dst""" if _samefile(src, dst): raise Error("`%s` and `%s` are the same file" % (src, dst)) for fn in [src, dst]: try: st = os.stat(fn) except OSError: # File most likely does not exist pass ...
[ "def", "copyfile", "(", "src", ",", "dst", ")", ":", "if", "_samefile", "(", "src", ",", "dst", ")", ":", "raise", "Error", "(", "\"`%s` and `%s` are the same file\"", "%", "(", "src", ",", "dst", ")", ")", "for", "fn", "in", "[", "src", ",", "dst", ...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py#L87-L105
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/utilities/sdf.py
python
SDFIndex.get_key_ijk
(self, i1, i2, i3, level=None)
return self.get_key(np.array([i1, i2, i3]), level=level)
[]
def get_key_ijk(self, i1, i2, i3, level=None): return self.get_key(np.array([i1, i2, i3]), level=level)
[ "def", "get_key_ijk", "(", "self", ",", "i1", ",", "i2", ",", "i3", ",", "level", "=", "None", ")", ":", "return", "self", ".", "get_key", "(", "np", ".", "array", "(", "[", "i1", ",", "i2", ",", "i3", "]", ")", ",", "level", "=", "level", ")...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/utilities/sdf.py#L755-L756
dask/dask
c2b962fec1ba45440fe928869dc64cfe9cc36506
dask/array/overlap.py
python
ensure_minimum_chunksize
(size, chunks)
return tuple(output)
Determine new chunks to ensure that every chunk >= size Parameters ---------- size: int The maximum size of any chunk. chunks: tuple Chunks along one axis, e.g. ``(3, 3, 2)`` Examples -------- >>> ensure_minimum_chunksize(10, (20, 20, 1)) (20, 11, 10) >>> ensure_min...
Determine new chunks to ensure that every chunk >= size
[ "Determine", "new", "chunks", "to", "ensure", "that", "every", "chunk", ">", "=", "size" ]
def ensure_minimum_chunksize(size, chunks): """Determine new chunks to ensure that every chunk >= size Parameters ---------- size: int The maximum size of any chunk. chunks: tuple Chunks along one axis, e.g. ``(3, 3, 2)`` Examples -------- >>> ensure_minimum_chunksize(1...
[ "def", "ensure_minimum_chunksize", "(", "size", ",", "chunks", ")", ":", "if", "size", "<=", "min", "(", "chunks", ")", ":", "return", "chunks", "# add too-small chunks to chunks before them", "output", "=", "[", "]", "new", "=", "0", "for", "c", "in", "chun...
https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/array/overlap.py#L310-L358
obspy/obspy
0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f
obspy/io/stationxml/core.py
python
_write_network
(parent, network, level)
Helper function converting a Network instance to an etree.Element.
Helper function converting a Network instance to an etree.Element.
[ "Helper", "function", "converting", "a", "Network", "instance", "to", "an", "etree", ".", "Element", "." ]
def _write_network(parent, network, level): """ Helper function converting a Network instance to an etree.Element. """ attribs = _get_base_node_attributes(network) network_elem = etree.SubElement(parent, "Network", attribs) _write_base_node(network_elem, network) for operator in network.ope...
[ "def", "_write_network", "(", "parent", ",", "network", ",", "level", ")", ":", "attribs", "=", "_get_base_node_attributes", "(", "network", ")", "network_elem", "=", "etree", ".", "SubElement", "(", "parent", ",", "\"Network\"", ",", "attribs", ")", "_write_b...
https://github.com/obspy/obspy/blob/0ee5a0d2db293c8d5d4c3b1f148a6c5a85fea55f/obspy/io/stationxml/core.py#L992-L1020
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/wtforms/fields/core.py
python
FieldList.__iter__
(self)
return iter(self.entries)
[]
def __iter__(self): return iter(self.entries)
[ "def", "__iter__", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "entries", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/wtforms/fields/core.py#L976-L977
ambujraj/hacktoberfest2018
53df2cac8b3404261131a873352ec4f2ffa3544d
MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/poolmanager.py
python
PoolManager.connection_from_url
(self, url, pool_kwargs=None)
return self.connection_from_host(u.host, port=u.port, scheme=u.scheme, pool_kwargs=pool_kwargs)
Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` is provided, it is used inst...
Similar to :func:`urllib3.connectionpool.connection_from_url`.
[ "Similar", "to", ":", "func", ":", "urllib3", ".", "connectionpool", ".", "connection_from_url", "." ]
def connection_from_url(self, url, pool_kwargs=None): """ Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpoo...
[ "def", "connection_from_url", "(", "self", ",", "url", ",", "pool_kwargs", "=", "None", ")", ":", "u", "=", "parse_url", "(", "url", ")", "return", "self", ".", "connection_from_host", "(", "u", ".", "host", ",", "port", "=", "u", ".", "port", ",", "...
https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/poolmanager.py#L266-L279
SHI-Labs/Decoupled-Classification-Refinement
16202b48eb9cbf79a9b130a98e8c209d4f24693e
fpn_dcr/core/module.py
python
Module.update_metric
(self, eval_metric, labels)
Evaluate and accumulate evaluation metric on outputs of the last forward computation. Parameters ---------- eval_metric : EvalMetric labels : list of NDArray Typically `data_batch.label`.
Evaluate and accumulate evaluation metric on outputs of the last forward computation.
[ "Evaluate", "and", "accumulate", "evaluation", "metric", "on", "outputs", "of", "the", "last", "forward", "computation", "." ]
def update_metric(self, eval_metric, labels): """Evaluate and accumulate evaluation metric on outputs of the last forward computation. Parameters ---------- eval_metric : EvalMetric labels : list of NDArray Typically `data_batch.label`. """ self._exec...
[ "def", "update_metric", "(", "self", ",", "eval_metric", ",", "labels", ")", ":", "self", ".", "_exec_group", ".", "update_metric", "(", "eval_metric", ",", "labels", ")" ]
https://github.com/SHI-Labs/Decoupled-Classification-Refinement/blob/16202b48eb9cbf79a9b130a98e8c209d4f24693e/fpn_dcr/core/module.py#L664-L673
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/core/program.py
python
BaseProgram.BuildTpuSubgraph
(self)
Sub classes should construct a model/graph to be executed by Run. Specific to TPU execution, this may involve a @tpu_function.on_device_training_loop etc.
Sub classes should construct a model/graph to be executed by Run.
[ "Sub", "classes", "should", "construct", "a", "model", "/", "graph", "to", "be", "executed", "by", "Run", "." ]
def BuildTpuSubgraph(self): """Sub classes should construct a model/graph to be executed by Run. Specific to TPU execution, this may involve a @tpu_function.on_device_training_loop etc. """ raise NotImplementedError()
[ "def", "BuildTpuSubgraph", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/program.py#L301-L307
mlrun/mlrun
4c120719d64327a34b7ee1ab08fb5e01b258b00a
mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py
python
_PyTorchTensorboardLogger._write_scalar_to_tensorboard
(self, name: str, value: float, step: int)
Write the scalar's value into its plot. :param name: The plot's name. :param value: The value to add to the plot. :param step: The iteration / epoch the value belongs to.
Write the scalar's value into its plot.
[ "Write", "the", "scalar", "s", "value", "into", "its", "plot", "." ]
def _write_scalar_to_tensorboard(self, name: str, value: float, step: int): """ Write the scalar's value into its plot. :param name: The plot's name. :param value: The value to add to the plot. :param step: The iteration / epoch the value belongs to. """ self._...
[ "def", "_write_scalar_to_tensorboard", "(", "self", ",", "name", ":", "str", ",", "value", ":", "float", ",", "step", ":", "int", ")", ":", "self", ".", "_summary_writer", ".", "add_scalar", "(", "tag", "=", "name", ",", "scalar_value", "=", "value", ","...
https://github.com/mlrun/mlrun/blob/4c120719d64327a34b7ee1ab08fb5e01b258b00a/mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py#L164-L174
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/db/api.py
python
agent_build_create
(context, values)
return IMPL.agent_build_create(context, values)
Create a new agent build entry.
Create a new agent build entry.
[ "Create", "a", "new", "agent", "build", "entry", "." ]
def agent_build_create(context, values): """Create a new agent build entry.""" return IMPL.agent_build_create(context, values)
[ "def", "agent_build_create", "(", "context", ",", "values", ")", ":", "return", "IMPL", ".", "agent_build_create", "(", "context", ",", "values", ")" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/db/api.py#L1384-L1386
python-pillow/Pillow
fd2b07c454b20e1e9af0cea64923b21250f8f8d6
src/PIL/Image.py
python
Image.close
(self)
Closes the file pointer, if possible. This operation will destroy the image core and release its memory. The image data will be unusable afterward. This function is required to close images that have multiple frames or have not had their file read and closed by the :py:meth:`~P...
Closes the file pointer, if possible.
[ "Closes", "the", "file", "pointer", "if", "possible", "." ]
def close(self): """ Closes the file pointer, if possible. This operation will destroy the image core and release its memory. The image data will be unusable afterward. This function is required to close images that have multiple frames or have not had their file read a...
[ "def", "close", "(", "self", ")", ":", "try", ":", "if", "hasattr", "(", "self", ",", "\"_close__fp\"", ")", ":", "self", ".", "_close__fp", "(", ")", "if", "self", ".", "fp", ":", "self", ".", "fp", ".", "close", "(", ")", "self", ".", "fp", "...
https://github.com/python-pillow/Pillow/blob/fd2b07c454b20e1e9af0cea64923b21250f8f8d6/src/PIL/Image.py#L560-L587
fluentpython/example-code-2e
80f7f84274a47579e59c29a4657691525152c9d5
11-pythonic-obj/vector2d_v1.py
python
Vector2d.__iter__
(self)
return (i for i in (self.x, self.y))
[]
def __iter__(self): return (i for i in (self.x, self.y))
[ "def", "__iter__", "(", "self", ")", ":", "return", "(", "i", "for", "i", "in", "(", "self", ".", "x", ",", "self", ".", "y", ")", ")" ]
https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/11-pythonic-obj/vector2d_v1.py#L47-L48
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol74238.py
python
decode_replay_attributes_events
(contents)
return attributes
Decodes and yields each attribute from the contents byte string.
Decodes and yields each attribute from the contents byte string.
[ "Decodes", "and", "yields", "each", "attribute", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_attributes_events(contents): """Decodes and yields each attribute from the contents byte string.""" buffer = BitPackedBuffer(contents, 'little') attributes = {} if not buffer.done(): attributes['source'] = buffer.read_bits(8) attributes['mapNamespace'] = buffer.read_bit...
[ "def", "decode_replay_attributes_events", "(", "contents", ")", ":", "buffer", "=", "BitPackedBuffer", "(", "contents", ",", "'little'", ")", "attributes", "=", "{", "}", "if", "not", "buffer", ".", "done", "(", ")", ":", "attributes", "[", "'source'", "]", ...
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol74238.py#L452-L472
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/RFCN/RFCN-tensorflow/Utils/MultiGather.py
python
gatherTopK
(t, k, others=[], sorted=False)
return res
[]
def gatherTopK(t, k, others=[], sorted=False): res=[] with tf.name_scope("gather_top_k"): isMoreThanK = tf.shape(t)[-1]>k values, indices = tf.cond(isMoreThanK, lambda: tuple(tf.nn.top_k(t, k=k, sorted=sorted)), lambda: (t, tf.zeros((0,1), tf.int32))) indices = tf.reshape(indices, [-1,1]...
[ "def", "gatherTopK", "(", "t", ",", "k", ",", "others", "=", "[", "]", ",", "sorted", "=", "False", ")", ":", "res", "=", "[", "]", "with", "tf", ".", "name_scope", "(", "\"gather_top_k\"", ")", ":", "isMoreThanK", "=", "tf", ".", "shape", "(", "...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/RFCN/RFCN-tensorflow/Utils/MultiGather.py#L26-L37
TDAmeritrade/stumpy
7c97df98cb4095afae775ab71870d4d5a14776c7
stumpy/core.py
python
_get_array_ranges
(a, n_chunks, truncate)
return array_ranges
Given an input array, split it into `n_chunks`. Parameters ---------- a : numpy.ndarray An array to be split n_chunks : int Number of chunks to split the array into truncate : bool If `truncate=True`, truncate the rows of `array_ranges` if there are not enough elem...
Given an input array, split it into `n_chunks`.
[ "Given", "an", "input", "array", "split", "it", "into", "n_chunks", "." ]
def _get_array_ranges(a, n_chunks, truncate): """ Given an input array, split it into `n_chunks`. Parameters ---------- a : numpy.ndarray An array to be split n_chunks : int Number of chunks to split the array into truncate : bool If `truncate=True`, truncate the r...
[ "def", "_get_array_ranges", "(", "a", ",", "n_chunks", ",", "truncate", ")", ":", "array_ranges", "=", "np", ".", "zeros", "(", "(", "n_chunks", ",", "2", ")", ",", "dtype", "=", "np", ".", "int64", ")", "if", "a", ".", "shape", "[", "0", "]", ">...
https://github.com/TDAmeritrade/stumpy/blob/7c97df98cb4095afae775ab71870d4d5a14776c7/stumpy/core.py#L1709-L1751
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/gui/qt_files/gui_qt_common.py
python
GuiQtCommon.on_disp
(self, icase, apply_fringe=False, update_legend_window=True, show_msg=True, stop_on_failure=False)
Sets the icase data to the active displacement
Sets the icase data to the active displacement
[ "Sets", "the", "icase", "data", "to", "the", "active", "displacement" ]
def on_disp(self, icase, apply_fringe=False, update_legend_window=True, show_msg=True, stop_on_failure=False): """Sets the icase data to the active displacement""" is_disp = True self._on_disp_vector(icase, is_disp, apply_fringe, update_legend_window, show_msg=show_msg, ...
[ "def", "on_disp", "(", "self", ",", "icase", ",", "apply_fringe", "=", "False", ",", "update_legend_window", "=", "True", ",", "show_msg", "=", "True", ",", "stop_on_failure", "=", "False", ")", ":", "is_disp", "=", "True", "self", ".", "_on_disp_vector", ...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/gui/qt_files/gui_qt_common.py#L647-L653
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/beets/util/__init__.py
python
sorted_walk
(path, ignore=(), ignore_hidden=False, logger=None)
Like `os.walk`, but yields things in case-insensitive sorted, breadth-first order. Directory and file names matching any glob pattern in `ignore` are skipped. If `logger` is provided, then warning messages are logged there when a directory cannot be listed.
Like `os.walk`, but yields things in case-insensitive sorted, breadth-first order. Directory and file names matching any glob pattern in `ignore` are skipped. If `logger` is provided, then warning messages are logged there when a directory cannot be listed.
[ "Like", "os", ".", "walk", "but", "yields", "things", "in", "case", "-", "insensitive", "sorted", "breadth", "-", "first", "order", ".", "Directory", "and", "file", "names", "matching", "any", "glob", "pattern", "in", "ignore", "are", "skipped", ".", "If",...
def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None): """Like `os.walk`, but yields things in case-insensitive sorted, breadth-first order. Directory and file names matching any glob pattern in `ignore` are skipped. If `logger` is provided, then warning messages are logged there when a di...
[ "def", "sorted_walk", "(", "path", ",", "ignore", "=", "(", ")", ",", "ignore_hidden", "=", "False", ",", "logger", "=", "None", ")", ":", "# Make sure the pathes aren't Unicode strings.", "path", "=", "bytestring_path", "(", "path", ")", "ignore", "=", "[", ...
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/beets/util/__init__.py#L170-L221
tensorflow/transform
bc5c3da6aebe9c8780da806e7e8103959c242863
tensorflow_transform/graph_tools.py
python
get_dependent_inputs
(graph, input_tensors, output_tensors)
return { name: tensor for name, tensor in input_tensors.items() if name in dependent_inputs }
Returns tensors in input_tensors that (transitively) produce output_tensors. Args: graph: A `tf.Graph`. It could be the (intermediate) output tf graph in any transform phase (including phase 0 where no tensor replacement has yet happened). input_tensors: A dict of logical name to `tf.Tensor`, `tf...
Returns tensors in input_tensors that (transitively) produce output_tensors.
[ "Returns", "tensors", "in", "input_tensors", "that", "(", "transitively", ")", "produce", "output_tensors", "." ]
def get_dependent_inputs(graph, input_tensors, output_tensors): """Returns tensors in input_tensors that (transitively) produce output_tensors. Args: graph: A `tf.Graph`. It could be the (intermediate) output tf graph in any transform phase (including phase 0 where no tensor replacement has yet hap...
[ "def", "get_dependent_inputs", "(", "graph", ",", "input_tensors", ",", "output_tensors", ")", ":", "if", "isinstance", "(", "output_tensors", ",", "list", ")", ":", "output_container", "=", "output_tensors", "else", ":", "output_container", "=", "output_tensors", ...
https://github.com/tensorflow/transform/blob/bc5c3da6aebe9c8780da806e7e8103959c242863/tensorflow_transform/graph_tools.py#L772-L812
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/assumptions/handlers/ntheory.py
python
AskEvenHandler.NumberSymbol
(expr, assumptions)
return AskEvenHandler._number(expr, assumptions)
[]
def NumberSymbol(expr, assumptions): return AskEvenHandler._number(expr, assumptions)
[ "def", "NumberSymbol", "(", "expr", ",", "assumptions", ")", ":", "return", "AskEvenHandler", ".", "_number", "(", "expr", ",", "assumptions", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/assumptions/handlers/ntheory.py#L197-L198
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
included_dependencies/requests/sessions.py
python
SessionRedirectMixin.get_redirect_target
(self, resp)
return None
Receives a Response. Returns a redirect URI or ``None``
Receives a Response. Returns a redirect URI or ``None``
[ "Receives", "a", "Response", ".", "Returns", "a", "redirect", "URI", "or", "None" ]
def get_redirect_target(self, resp): """Receives a Response. Returns a redirect URI or ``None``""" # Due to the nature of how requests processes redirects this method will # be called at least once upon the original response and at least twice # on each subsequent redirect response (if a...
[ "def", "get_redirect_target", "(", "self", ",", "resp", ")", ":", "# Due to the nature of how requests processes redirects this method will", "# be called at least once upon the original response and at least twice", "# on each subsequent redirect response (if any).", "# If a custom mixin is u...
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/requests/sessions.py#L98-L117
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/parser/factory.py
python
NodeFactory.nodes
(self)
return self._nodes_config
[]
def nodes(self): return self._nodes_config
[ "def", "nodes", "(", "self", ")", ":", "return", "self", ".", "_nodes_config" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/factory.py#L32-L33
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/email/message.py
python
Message.add_header
(self, _name, _value, **_params)
Extended header setting. name is the header field to add. keyword arguments can be used to set additional parameters for the header field, with underscores converted to dashes. Normally the parameter will be added as key="value" unless value is None, in which case only the key will be...
Extended header setting.
[ "Extended", "header", "setting", "." ]
def add_header(self, _name, _value, **_params): """Extended header setting. name is the header field to add. keyword arguments can be used to set additional parameters for the header field, with underscores converted to dashes. Normally the parameter will be added as key="value" unles...
[ "def", "add_header", "(", "self", ",", "_name", ",", "_value", ",", "*", "*", "_params", ")", ":", "parts", "=", "[", "]", "for", "k", ",", "v", "in", "_params", ".", "items", "(", ")", ":", "if", "v", "is", "None", ":", "parts", ".", "append",...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/email/message.py#L388-L411
python-quantities/python-quantities
ffd231e4859fb9e05aea5bf537311404183f51ad
quantities/umath.py
python
arctanh
(x, out=None)
return Quantity( np.arctanh(x.rescale(dimensionless).magnitude, out), dimensionless, copy=False )
Raises a ValueError if input cannot be rescaled to a dimensionless quantity.
Raises a ValueError if input cannot be rescaled to a dimensionless quantity.
[ "Raises", "a", "ValueError", "if", "input", "cannot", "be", "rescaled", "to", "a", "dimensionless", "quantity", "." ]
def arctanh(x, out=None): """ Raises a ValueError if input cannot be rescaled to a dimensionless quantity. """ if not isinstance(x, Quantity): return np.arctanh(x, out) return Quantity( np.arctanh(x.rescale(dimensionless).magnitude, out), dimensionless, copy=Fals...
[ "def", "arctanh", "(", "x", ",", "out", "=", "None", ")", ":", "if", "not", "isinstance", "(", "x", ",", "Quantity", ")", ":", "return", "np", ".", "arctanh", "(", "x", ",", "out", ")", "return", "Quantity", "(", "np", ".", "arctanh", "(", "x", ...
https://github.com/python-quantities/python-quantities/blob/ffd231e4859fb9e05aea5bf537311404183f51ad/quantities/umath.py#L355-L367
frescobaldi/frescobaldi
301cc977fc4ba7caa3df9e4bf905212ad5d06912
frescobaldi_app/view.py
python
View.dropEvent
(self, ev)
Called when something is dropped. Calls dropEvent() of MainWindow if URLs are dropped.
Called when something is dropped.
[ "Called", "when", "something", "is", "dropped", "." ]
def dropEvent(self, ev): """Called when something is dropped. Calls dropEvent() of MainWindow if URLs are dropped. """ if ev.mimeData().hasUrls(): self.window().dropEvent(ev) else: super(View, self).dropEvent(ev)
[ "def", "dropEvent", "(", "self", ",", "ev", ")", ":", "if", "ev", ".", "mimeData", "(", ")", ".", "hasUrls", "(", ")", ":", "self", ".", "window", "(", ")", ".", "dropEvent", "(", "ev", ")", "else", ":", "super", "(", "View", ",", "self", ")", ...
https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/view.py#L182-L191
HuberTRoy/MusicBox
82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3
MusicPlayer/widgets/base.py
python
ScrollArea.maximumValue
(self)
return self.verticalScrollBar().maximum()
[]
def maximumValue(self): return self.verticalScrollBar().maximum()
[ "def", "maximumValue", "(", "self", ")", ":", "return", "self", ".", "verticalScrollBar", "(", ")", ".", "maximum", "(", ")" ]
https://github.com/HuberTRoy/MusicBox/blob/82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3/MusicPlayer/widgets/base.py#L150-L151
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/numbers.py
python
Real.__rfloordiv__
(self, other)
other // self: The floor() of other/self.
other // self: The floor() of other/self.
[ "other", "//", "self", ":", "The", "floor", "()", "of", "other", "/", "self", "." ]
def __rfloordiv__(self, other): """other // self: The floor() of other/self.""" raise NotImplementedError
[ "def", "__rfloordiv__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/numbers.py#L219-L221
CacheBrowser/cachebrowser
4bf1d58e5c82a0dbaa878f7725c830d472f5326e
cachebrowser/ipc.py
python
IPCRouter.rpc_request
(self, client_id, request_id, method, params)
[]
def rpc_request(self, client_id, request_id, method, params): if method not in self.rpc_clients: logger.error("RPC request received for '{}', but route does not exist".format(method)) # TODO Give error pass self.rpc_pending_requests[request_id] = client_id ta...
[ "def", "rpc_request", "(", "self", ",", "client_id", ",", "request_id", ",", "method", ",", "params", ")", ":", "if", "method", "not", "in", "self", ".", "rpc_clients", ":", "logger", ".", "error", "(", "\"RPC request received for '{}', but route does not exist\""...
https://github.com/CacheBrowser/cachebrowser/blob/4bf1d58e5c82a0dbaa878f7725c830d472f5326e/cachebrowser/ipc.py#L54-L65
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/urllib/request.py
python
urlopen
(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *, cafile=None, capath=None, cadefault=False, context=None)
return opener.open(url, data, timeout)
Open the URL url, which can be either a string or a Request object. *data* must be an object specifying additional data to be sent to the server, or None if no such data is needed. See Request for details. urllib.request module uses HTTP/1.1 and includes a "Connection:close" header in its HTTP re...
Open the URL url, which can be either a string or a Request object.
[ "Open", "the", "URL", "url", "which", "can", "be", "either", "a", "string", "or", "a", "Request", "object", "." ]
def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *, cafile=None, capath=None, cadefault=False, context=None): '''Open the URL url, which can be either a string or a Request object. *data* must be an object specifying additional data to be sent to the server, or None if no suc...
[ "def", "urlopen", "(", "url", ",", "data", "=", "None", ",", "timeout", "=", "socket", ".", "_GLOBAL_DEFAULT_TIMEOUT", ",", "*", ",", "cafile", "=", "None", ",", "capath", "=", "None", ",", "cadefault", "=", "False", ",", "context", "=", "None", ")", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/urllib/request.py#L139-L222
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/antlr3/antlr3/tree.py
python
BaseTree.addChildren
(self, children)
Add all elements of kids list as children of this node
Add all elements of kids list as children of this node
[ "Add", "all", "elements", "of", "kids", "list", "as", "children", "of", "this", "node" ]
def addChildren(self, children): """Add all elements of kids list as children of this node""" self.children += children
[ "def", "addChildren", "(", "self", ",", "children", ")", ":", "self", ".", "children", "+=", "children" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/antlr3/antlr3/tree.py#L741-L744
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/visualization/plot_modifications.py
python
MarkerAnnotateCallback.__init__
(self, pos, marker="x", coord_system="data", plot_args=None)
[]
def __init__(self, pos, marker="x", coord_system="data", plot_args=None): def_plot_args = {"color": "w", "s": 50} self.pos = pos self.marker = marker if plot_args is None: plot_args = def_plot_args self.plot_args = plot_args self.coord_system = coord_system ...
[ "def", "__init__", "(", "self", ",", "pos", ",", "marker", "=", "\"x\"", ",", "coord_system", "=", "\"data\"", ",", "plot_args", "=", "None", ")", ":", "def_plot_args", "=", "{", "\"color\"", ":", "\"w\"", ",", "\"s\"", ":", "50", "}", "self", ".", "...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/plot_modifications.py#L1536-L1544
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/rewards/geometric_rewards.py
python
SphericalReward.__init__
(self, bodies, link_ids=-1, attached_body=None, attached_link_id=-1, position=None, orientation=None, radius=1, theta=(0, 2*np.pi), phi=(0, np.pi), radius_reward_range=None, theta_reward_ranges=None, height_reward_range=None, interpolation='linear', simulator=None)
Initialize the spherical reward. Args: bodies (int, Body, list[int], list[Body]): the bodies or body unique ids that we should check if they are inside the sphere. link_ids (int, list[int]): the link id associated to each body. By default, it is -1 for the base. ...
Initialize the spherical reward.
[ "Initialize", "the", "spherical", "reward", "." ]
def __init__(self, bodies, link_ids=-1, attached_body=None, attached_link_id=-1, position=None, orientation=None, radius=1, theta=(0, 2*np.pi), phi=(0, np.pi), radius_reward_range=None, theta_reward_ranges=None, height_reward_range=None, interpolation='linear', simulator=None): ...
[ "def", "__init__", "(", "self", ",", "bodies", ",", "link_ids", "=", "-", "1", ",", "attached_body", "=", "None", ",", "attached_link_id", "=", "-", "1", ",", "position", "=", "None", ",", "orientation", "=", "None", ",", "radius", "=", "1", ",", "th...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/rewards/geometric_rewards.py#L49-L88
makehumancommunity/makehuman
8006cf2cc851624619485658bb933a4244bbfd7c
makehuman/core/transformations.py
python
affine_matrix_from_points
(v0, v1, shear=True, scale=True, usesvd=True)
return M
Return affine transform matrix to register two point sets. v0 and v1 are shape (ndims, \*) arrays of at least ndims non-homogeneous coordinates, where ndims is the dimensionality of the coordinate space. If shear is False, a similarity transformation matrix is returned. If also scale is False, a rigid...
Return affine transform matrix to register two point sets.
[ "Return", "affine", "transform", "matrix", "to", "register", "two", "point", "sets", "." ]
def affine_matrix_from_points(v0, v1, shear=True, scale=True, usesvd=True): """Return affine transform matrix to register two point sets. v0 and v1 are shape (ndims, \*) arrays of at least ndims non-homogeneous coordinates, where ndims is the dimensionality of the coordinate space. If shear is False, ...
[ "def", "affine_matrix_from_points", "(", "v0", ",", "v1", ",", "shear", "=", "True", ",", "scale", "=", "True", ",", "usesvd", "=", "True", ")", ":", "v0", "=", "numpy", ".", "array", "(", "v0", ",", "dtype", "=", "numpy", ".", "float64", ",", "cop...
https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/core/transformations.py#L904-L1010
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/fabmetheus_utilities/svg_reader.py
python
getMatrixSVG
(elementNode)
return matrixSVG
Get matrixSVG by svgElement.
Get matrixSVG by svgElement.
[ "Get", "matrixSVG", "by", "svgElement", "." ]
def getMatrixSVG(elementNode): "Get matrixSVG by svgElement." matrixSVG = MatrixSVG() if 'transform' not in elementNode.attributes: return matrixSVG transformWords = [] for transformWord in elementNode.attributes['transform'].replace(')', '(').split('('): transformWordStrip = transformWord.strip() if transfo...
[ "def", "getMatrixSVG", "(", "elementNode", ")", ":", "matrixSVG", "=", "MatrixSVG", "(", ")", "if", "'transform'", "not", "in", "elementNode", ".", "attributes", ":", "return", "matrixSVG", "transformWords", "=", "[", "]", "for", "transformWord", "in", "elemen...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/svg_reader.py#L181-L197
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/config/area_registry.py
python
_entry_dict
(entry)
return {"area_id": entry.id, "name": entry.name, "picture": entry.picture}
Convert entry to API format.
Convert entry to API format.
[ "Convert", "entry", "to", "API", "format", "." ]
def _entry_dict(entry): """Convert entry to API format.""" return {"area_id": entry.id, "name": entry.name, "picture": entry.picture}
[ "def", "_entry_dict", "(", "entry", ")", ":", "return", "{", "\"area_id\"", ":", "entry", ".", "id", ",", "\"name\"", ":", "entry", ".", "name", ",", "\"picture\"", ":", "entry", ".", "picture", "}" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/config/area_registry.py#L101-L103
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
sqlalchemy/orm/loading.py
python
merge_result
(querylib, query, iterator, load=True)
Merge a result into this :class:`.Query` object's Session.
Merge a result into this :class:`.Query` object's Session.
[ "Merge", "a", "result", "into", "this", ":", "class", ":", ".", "Query", "object", "s", "Session", "." ]
def merge_result(querylib, query, iterator, load=True): """Merge a result into this :class:`.Query` object's Session.""" session = query.session if load: # flush current contents if we expect to load data session._autoflush() autoflush = session.autoflush try: session.autof...
[ "def", "merge_result", "(", "querylib", ",", "query", ",", "iterator", ",", "load", "=", "True", ")", ":", "session", "=", "query", ".", "session", "if", "load", ":", "# flush current contents if we expect to load data", "session", ".", "_autoflush", "(", ")", ...
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/orm/loading.py#L103-L141
vlachoudis/bCNC
67126b4894dabf6579baf47af8d0f9b7de35e6e3
bCNC/lib/svg_elements.py
python
Circle._name
(self)
return self.__class__.__name__
[]
def _name(self): return self.__class__.__name__
[ "def", "_name", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "__name__" ]
https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/lib/svg_elements.py#L6188-L6189
pylessard/python-udsoncan
79b20e5d91eed78c9a3137a4c1511ce5d832ae9c
udsoncan/client.py
python
Client.request_seed
(self, level, data=bytes())
return response
Requests a seed to unlock a security level with the :ref:`SecurityAccess<SecurityAccess>` service :Effective configuration: ``exception_on_<type>_response`` :param level: The security level to unlock. If value is even, it will be converted to the corresponding odd value :type level: int ...
Requests a seed to unlock a security level with the :ref:`SecurityAccess<SecurityAccess>` service
[ "Requests", "a", "seed", "to", "unlock", "a", "security", "level", "with", "the", ":", "ref", ":", "SecurityAccess<SecurityAccess", ">", "service" ]
def request_seed(self, level, data=bytes()): """ Requests a seed to unlock a security level with the :ref:`SecurityAccess<SecurityAccess>` service :Effective configuration: ``exception_on_<type>_response`` :param level: The security level to unlock. If value is even, it will be conve...
[ "def", "request_seed", "(", "self", ",", "level", ",", "data", "=", "bytes", "(", ")", ")", ":", "req", "=", "services", ".", "SecurityAccess", ".", "make_request", "(", "level", ",", "mode", "=", "services", ".", "SecurityAccess", ".", "Mode", ".", "R...
https://github.com/pylessard/python-udsoncan/blob/79b20e5d91eed78c9a3137a4c1511ce5d832ae9c/udsoncan/client.py#L207-L238
awslabs/aws-lambda-powertools-python
0c6ac0fe183476140ee1df55fe9fa1cc20925577
aws_lambda_powertools/utilities/data_classes/appsync_authorizer_event.py
python
AppSyncAuthorizerResponse.asdict
(self)
return response
Return the response as a dict
Return the response as a dict
[ "Return", "the", "response", "as", "a", "dict" ]
def asdict(self) -> dict: """Return the response as a dict""" response: Dict = {"isAuthorized": self.authorize} if self.max_age is not None: response["ttlOverride"] = self.max_age if self.deny_fields: response["deniedFields"] = self.deny_fields if self....
[ "def", "asdict", "(", "self", ")", "->", "dict", ":", "response", ":", "Dict", "=", "{", "\"isAuthorized\"", ":", "self", ".", "authorize", "}", "if", "self", ".", "max_age", "is", "not", "None", ":", "response", "[", "\"ttlOverride\"", "]", "=", "self...
https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/utilities/data_classes/appsync_authorizer_event.py#L103-L116
dcsync/pycobalt
d3a630bfadaeeb6c99aad28f226abe48f6b4acca
pycobalt/aggressor.py
python
bspunnel_local
(*args, fork=None, sync=True)
return engine.call('bspunnel_local', args, fork=fork, sync=sync)
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Spawn and tunnel an agent through this Beacon (via a target localhost-only reverse port forward). Note: this reverse port forward tunnel traverses through the Beacon chain to the team server and, via the team server, out ...
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
[ "r", "Documentation", "from", "https", ":", "//", "www", ".", "cobaltstrike", ".", "com", "/", "aggressor", "-", "script", "/", "functions", ".", "html", ":" ]
def bspunnel_local(*args, fork=None, sync=True): r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Spawn and tunnel an agent through this Beacon (via a target localhost-only reverse port forward). Note: this reverse port forward tunnel traverses through the Beacon ch...
[ "def", "bspunnel_local", "(", "*", "args", ",", "fork", "=", "None", ",", "sync", "=", "True", ")", ":", "return", "engine", ".", "call", "(", "'bspunnel_local'", ",", "args", ",", "fork", "=", "fork", ",", "sync", "=", "sync", ")" ]
https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L3372-L3387
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/db/backends/base/operations.py
python
BaseDatabaseOperations.last_insert_id
(self, cursor, table_name, pk_name)
return cursor.lastrowid
Given a cursor object that has just performed an INSERT statement into a table that has an auto-incrementing ID, returns the newly created ID. This method also receives the table name and the name of the primary-key column.
Given a cursor object that has just performed an INSERT statement into a table that has an auto-incrementing ID, returns the newly created ID.
[ "Given", "a", "cursor", "object", "that", "has", "just", "performed", "an", "INSERT", "statement", "into", "a", "table", "that", "has", "an", "auto", "-", "incrementing", "ID", "returns", "the", "newly", "created", "ID", "." ]
def last_insert_id(self, cursor, table_name, pk_name): """ Given a cursor object that has just performed an INSERT statement into a table that has an auto-incrementing ID, returns the newly created ID. This method also receives the table name and the name of the primary-key colu...
[ "def", "last_insert_id", "(", "self", ",", "cursor", ",", "table_name", ",", "pk_name", ")", ":", "return", "cursor", ".", "lastrowid" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/db/backends/base/operations.py#L227-L235
bbc/brave
88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5
brave/connections/connection.py
python
Connection._get_pad_to_connect_tee_to
(self, audio_or_video)
return queue.get_static_pad('sink')
Returns the pad of the queue that should be connected to from the source's 'tee' element.
Returns the pad of the queue that should be connected to from the source's 'tee' element.
[ "Returns", "the", "pad", "of", "the", "queue", "that", "should", "be", "connected", "to", "from", "the", "source", "s", "tee", "element", "." ]
def _get_pad_to_connect_tee_to(self, audio_or_video): ''' Returns the pad of the queue that should be connected to from the source's 'tee' element. ''' queue = self._queue_into_intersink[audio_or_video] if not queue: self.logger.error('Failed to connect tee to queue: ...
[ "def", "_get_pad_to_connect_tee_to", "(", "self", ",", "audio_or_video", ")", ":", "queue", "=", "self", ".", "_queue_into_intersink", "[", "audio_or_video", "]", "if", "not", "queue", ":", "self", ".", "logger", ".", "error", "(", "'Failed to connect tee to queue...
https://github.com/bbc/brave/blob/88d4454412ee5acfa5ecf2ac5bc8cf75766c7be5/brave/connections/connection.py#L168-L177
Carlos-Zen/blockchain-python
e28a4886cce03a790fe0a57fcd9896fa7b4b239f
rpc.py
python
RpcServer.get_blockchain
(self)
return bcdb.find_all()
[]
def get_blockchain(self): bcdb = BlockChainDB() return bcdb.find_all()
[ "def", "get_blockchain", "(", "self", ")", ":", "bcdb", "=", "BlockChainDB", "(", ")", "return", "bcdb", ".", "find_all", "(", ")" ]
https://github.com/Carlos-Zen/blockchain-python/blob/e28a4886cce03a790fe0a57fcd9896fa7b4b239f/rpc.py#L19-L21
translate/translate
72816df696b5263abfe80ab59129b299b85ae749
translate/storage/dtd.py
python
dtdunit.source
(self, source)
Sets the definition to the quoted value of source
Sets the definition to the quoted value of source
[ "Sets", "the", "definition", "to", "the", "quoted", "value", "of", "source" ]
def source(self, source): """Sets the definition to the quoted value of source""" if self.android: self.definition = quoteforandroid(source) else: self.definition = quotefordtd(source) self._rich_source = None
[ "def", "source", "(", "self", ",", "source", ")", ":", "if", "self", ".", "android", ":", "self", ".", "definition", "=", "quoteforandroid", "(", "source", ")", "else", ":", "self", ".", "definition", "=", "quotefordtd", "(", "source", ")", "self", "."...
https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/storage/dtd.py#L250-L256
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/graphics/widgets/GLPane_drawingset_methods.py
python
GLPane_drawingset_methods._call_func_that_draws_model
(self, func, prefunc = None, postfunc = None, bare_primitives = None, drawing_phase = None, whole_model ...
return res
If whole_model is False (*not* the default): Call func() between calls of self._before_drawing_csdls(**kws) and self._after_drawing_csdls(). Return whatever func() returns (or raise whatever exception it raises, but call _after_drawing_csdls even when raising an exception). fu...
If whole_model is False (*not* the default):
[ "If", "whole_model", "is", "False", "(", "*", "not", "*", "the", "default", ")", ":" ]
def _call_func_that_draws_model(self, func, prefunc = None, postfunc = None, bare_primitives = None, drawing_phase = None, ...
[ "def", "_call_func_that_draws_model", "(", "self", ",", "func", ",", "prefunc", "=", "None", ",", "postfunc", "=", "None", ",", "bare_primitives", "=", "None", ",", "drawing_phase", "=", "None", ",", "whole_model", "=", "True", ")", ":", "# as of 090317, defin...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/graphics/widgets/GLPane_drawingset_methods.py#L383-L519
modflowpy/flopy
eecd1ad193c5972093c9712e5c4b7a83284f0688
flopy/export/metadata.py
python
acdd.geospatial_bounds_vertical_crs
(self)
return epsg.get(self.vertical_datum)
The vertical coordinate reference system (CRS) for the Z axis of the point coordinates in the geospatial_bounds attribute.
The vertical coordinate reference system (CRS) for the Z axis of the point coordinates in the geospatial_bounds attribute.
[ "The", "vertical", "coordinate", "reference", "system", "(", "CRS", ")", "for", "the", "Z", "axis", "of", "the", "point", "coordinates", "in", "the", "geospatial_bounds", "attribute", "." ]
def geospatial_bounds_vertical_crs(self): """ The vertical coordinate reference system (CRS) for the Z axis of the point coordinates in the geospatial_bounds attribute. """ epsg = {"NGVD29": "EPSG:5702", "NAVD88": "EPSG:5703"} return epsg.get(self.vertical_datum)
[ "def", "geospatial_bounds_vertical_crs", "(", "self", ")", ":", "epsg", "=", "{", "\"NGVD29\"", ":", "\"EPSG:5702\"", ",", "\"NAVD88\"", ":", "\"EPSG:5703\"", "}", "return", "epsg", ".", "get", "(", "self", ".", "vertical_datum", ")" ]
https://github.com/modflowpy/flopy/blob/eecd1ad193c5972093c9712e5c4b7a83284f0688/flopy/export/metadata.py#L162-L168
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/scipy/spatial/distance.py
python
chebyshev
(u, v)
return max(abs(u - v))
Computes the Chebyshev distance. Computes the Chebyshev distance between two 1-D arrays `u` and `v`, which is defined as .. math:: \\max_i {|u_i-v_i|}. Parameters ---------- u : (N,) array_like Input vector. v : (N,) array_like Input vector. Returns ------...
Computes the Chebyshev distance.
[ "Computes", "the", "Chebyshev", "distance", "." ]
def chebyshev(u, v): """ Computes the Chebyshev distance. Computes the Chebyshev distance between two 1-D arrays `u` and `v`, which is defined as .. math:: \\max_i {|u_i-v_i|}. Parameters ---------- u : (N,) array_like Input vector. v : (N,) array_like Inpu...
[ "def", "chebyshev", "(", "u", ",", "v", ")", ":", "u", "=", "_validate_vector", "(", "u", ")", "v", "=", "_validate_vector", "(", "v", ")", "return", "max", "(", "abs", "(", "u", "-", "v", ")", ")" ]
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/spatial/distance.py#L753-L779
inventree/InvenTree
4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b
InvenTree/label/models.py
python
PartLabel.get_context_data
(self, request)
return { 'part': part, 'category': part.category, 'name': part.name, 'description': part.description, 'IPN': part.IPN, 'revision': part.revision, 'qr_data': part.format_barcode(brief=True), 'qr_url': part.format_barcode(url=...
Generate context data for each provided Part object
Generate context data for each provided Part object
[ "Generate", "context", "data", "for", "each", "provided", "Part", "object" ]
def get_context_data(self, request): """ Generate context data for each provided Part object """ part = self.object_to_print return { 'part': part, 'category': part.category, 'name': part.name, 'description': part.description, ...
[ "def", "get_context_data", "(", "self", ",", "request", ")", ":", "part", "=", "self", ".", "object_to_print", "return", "{", "'part'", ":", "part", ",", "'category'", ":", "part", ".", "category", ",", "'name'", ":", "part", ".", "name", ",", "'descript...
https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/label/models.py#L387-L404
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/sem/logic.py
python
NegatedExpression.visit
(self, function, combinator)
return combinator([function(self.term)])
:see: Expression.visit()
:see: Expression.visit()
[ ":", "see", ":", "Expression", ".", "visit", "()" ]
def visit(self, function, combinator): """:see: Expression.visit()""" return combinator([function(self.term)])
[ "def", "visit", "(", "self", ",", "function", ",", "combinator", ")", ":", "return", "combinator", "(", "[", "function", "(", "self", ".", "term", ")", "]", ")" ]
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/sem/logic.py#L1781-L1783
ynvb/DIE
453fbdf137bfe0510e760df73441d41d35ea74d6
DIE/UI/ParserView.py
python
ParserView._add_parser_data
(self)
Add parser data to the parser widget model @return:
Add parser data to the parser widget model
[ "Add", "parser", "data", "to", "the", "parser", "widget", "model" ]
def _add_parser_data(self): """ Add parser data to the parser widget model @return: """ row = 0 parser_list = self.data_parser.get_parser_list() if not "headers" in parser_list: return header_list = parser_list["headers"] header_list.i...
[ "def", "_add_parser_data", "(", "self", ")", ":", "row", "=", "0", "parser_list", "=", "self", ".", "data_parser", ".", "get_parser_list", "(", ")", "if", "not", "\"headers\"", "in", "parser_list", ":", "return", "header_list", "=", "parser_list", "[", "\"he...
https://github.com/ynvb/DIE/blob/453fbdf137bfe0510e760df73441d41d35ea74d6/DIE/UI/ParserView.py#L38-L74
google/sre_yield
3af063a0054c4646608b43b941fbfcbe4e01214a
sre_yield/fastdivmod.py
python
divmod_iter_basic
(x, by, chunk=None)
Generate successive (x % by); x /= by, the obvious way. Chunk is ignored.
Generate successive (x % by); x /= by, the obvious way.
[ "Generate", "successive", "(", "x", "%", "by", ")", ";", "x", "/", "=", "by", "the", "obvious", "way", "." ]
def divmod_iter_basic(x, by, chunk=None): """Generate successive (x % by); x /= by, the obvious way. Chunk is ignored. """ while x: x, m = divmod(x, by) yield m
[ "def", "divmod_iter_basic", "(", "x", ",", "by", ",", "chunk", "=", "None", ")", ":", "while", "x", ":", "x", ",", "m", "=", "divmod", "(", "x", ",", "by", ")", "yield", "m" ]
https://github.com/google/sre_yield/blob/3af063a0054c4646608b43b941fbfcbe4e01214a/sre_yield/fastdivmod.py#L98-L105
nate-parrott/Flashlight
c3a7c7278a1cccf8918e7543faffc68e863ff5ab
PluginDirectories/1/NightFoxAmbient.bundle/requests/models.py
python
RequestEncodingMixin._encode_params
(data)
Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict.
Encode parameters in a piece of data.
[ "Encode", "parameters", "in", "a", "piece", "of", "data", "." ]
def _encode_params(data): """Encode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. """ if isinstance(data...
[ "def", "_encode_params", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "(", "str", ",", "bytes", ")", ")", ":", "return", "data", "elif", "hasattr", "(", "data", ",", "'read'", ")", ":", "return", "data", "elif", "hasattr", "(", "data"...
https://github.com/nate-parrott/Flashlight/blob/c3a7c7278a1cccf8918e7543faffc68e863ff5ab/PluginDirectories/1/NightFoxAmbient.bundle/requests/models.py#L75-L99
sendgrid/sendgrid-python
df13b78b0cdcb410b4516f6761c4d3138edd4b2d
sendgrid/helpers/mail/mail.py
python
Mail.add_personalization
(self, personalization, index=0)
Add a Personalization object :param personalization: Add a Personalization object :type personalization: Personalization :param index: The index where to add the Personalization :type index: int
Add a Personalization object
[ "Add", "a", "Personalization", "object" ]
def add_personalization(self, personalization, index=0): """Add a Personalization object :param personalization: Add a Personalization object :type personalization: Personalization :param index: The index where to add the Personalization :type index: int """ self...
[ "def", "add_personalization", "(", "self", ",", "personalization", ",", "index", "=", "0", ")", ":", "self", ".", "_personalizations", "=", "self", ".", "_ensure_append", "(", "personalization", ",", "self", ".", "_personalizations", ",", "index", ")" ]
https://github.com/sendgrid/sendgrid-python/blob/df13b78b0cdcb410b4516f6761c4d3138edd4b2d/sendgrid/helpers/mail/mail.py#L200-L209
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/api/management/commands/reset_rest_services.py
python
Command.handle
(self, *args, **options)
[]
def handle(self, *args, **options): self.stdout.write("Task started ...") # Delete old bamboo rest service RestService.objects.filter(name='bamboo').delete() # Get all the rest services for rest in queryset_iterator(RestService.objects.all()): rest.save() s...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "stdout", ".", "write", "(", "\"Task started ...\"", ")", "# Delete old bamboo rest service", "RestService", ".", "objects", ".", "filter", "(", "name", "=", "...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/api/management/commands/reset_rest_services.py#L19-L29
KhronosGroup/OpenXR-SDK-Source
76756e2e7849b15466d29bee7d80cada92865550
external/python/jinja2/filters.py
python
make_attrgetter
(environment, attribute, postprocess=None)
return attrgetter
Returns a callable that looks up the given attribute from a passed object with the rules of the environment. Dots are allowed to access attributes of attributes. Integer parts in paths are looked up as integers.
Returns a callable that looks up the given attribute from a passed object with the rules of the environment. Dots are allowed to access attributes of attributes. Integer parts in paths are looked up as integers.
[ "Returns", "a", "callable", "that", "looks", "up", "the", "given", "attribute", "from", "a", "passed", "object", "with", "the", "rules", "of", "the", "environment", ".", "Dots", "are", "allowed", "to", "access", "attributes", "of", "attributes", ".", "Intege...
def make_attrgetter(environment, attribute, postprocess=None): """Returns a callable that looks up the given attribute from a passed object with the rules of the environment. Dots are allowed to access attributes of attributes. Integer parts in paths are looked up as integers. """ if attribute...
[ "def", "make_attrgetter", "(", "environment", ",", "attribute", ",", "postprocess", "=", "None", ")", ":", "if", "attribute", "is", "None", ":", "attribute", "=", "[", "]", "elif", "isinstance", "(", "attribute", ",", "string_types", ")", ":", "attribute", ...
https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/external/python/jinja2/filters.py#L62-L84
CJWorkbench/cjworkbench
e0b878d8ff819817fa049a4126efcbfcec0b50e6
cjwstate/models/stored_object.py
python
_delete_from_s3_pre_delete
(sender, instance, **kwargs)
Delete file from S3, pre-delete. Why pre-delete and not post-delete? Because our user expects the file to be _gone_, completely, forever -- that's what "delete" means to the user. If deletion fails, we need the link to remain in our database -- that's how the user will know it isn't deleted.
Delete file from S3, pre-delete.
[ "Delete", "file", "from", "S3", "pre", "-", "delete", "." ]
def _delete_from_s3_pre_delete(sender, instance, **kwargs): """Delete file from S3, pre-delete. Why pre-delete and not post-delete? Because our user expects the file to be _gone_, completely, forever -- that's what "delete" means to the user. If deletion fails, we need the link to remain in our databas...
[ "def", "_delete_from_s3_pre_delete", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "instance", ".", "key", ":", "s3", ".", "remove", "(", "s3", ".", "StoredObjectsBucket", ",", "instance", ".", "key", ")" ]
https://github.com/CJWorkbench/cjworkbench/blob/e0b878d8ff819817fa049a4126efcbfcec0b50e6/cjwstate/models/stored_object.py#L50-L59
happinesslz/TANet
2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f
pointpillars_with_TANet/second/pytorch/train.py
python
flat_nested_json_dict
(json_dict, sep=".")
return flatted
flat a nested json-like dict. this function make shadow copy.
flat a nested json-like dict. this function make shadow copy.
[ "flat", "a", "nested", "json", "-", "like", "dict", ".", "this", "function", "make", "shadow", "copy", "." ]
def flat_nested_json_dict(json_dict, sep=".") -> dict: """flat a nested json-like dict. this function make shadow copy. """ flatted = {} for k, v in json_dict.items(): if isinstance(v, dict): _flat_nested_json_dict(v, flatted, sep, k) else: flatted[k] = v retu...
[ "def", "flat_nested_json_dict", "(", "json_dict", ",", "sep", "=", "\".\"", ")", "->", "dict", ":", "flatted", "=", "{", "}", "for", "k", ",", "v", "in", "json_dict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":",...
https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/pointpillars_with_TANet/second/pytorch/train.py#L51-L60
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/geometries.py
python
OGRGeometry.convex_hull
(self)
return self._geomgen(capi.geom_convex_hull)
Returns the smallest convex Polygon that contains all the points in this Geometry.
Returns the smallest convex Polygon that contains all the points in this Geometry.
[ "Returns", "the", "smallest", "convex", "Polygon", "that", "contains", "all", "the", "points", "in", "this", "Geometry", "." ]
def convex_hull(self): """ Returns the smallest convex Polygon that contains all the points in this Geometry. """ return self._geomgen(capi.geom_convex_hull)
[ "def", "convex_hull", "(", "self", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_convex_hull", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/geometries.py#L459-L464
hyperledger/fabric-sdk-py
8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3
hfc/fabric/client.py
python
Client.peers
(self)
return self._peers
Get the peers instance in the network. :return: peers as dict
Get the peers instance in the network.
[ "Get", "the", "peers", "instance", "in", "the", "network", "." ]
def peers(self): """ Get the peers instance in the network. :return: peers as dict """ return self._peers
[ "def", "peers", "(", "self", ")", ":", "return", "self", ".", "_peers" ]
https://github.com/hyperledger/fabric-sdk-py/blob/8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3/hfc/fabric/client.py#L397-L403
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/rds/__init__.py
python
connect_to_region
(region_name, **kw_params)
return connect('rds', region_name, region_cls=RDSRegionInfo, connection_cls=RDSConnection, **kw_params)
Given a valid region name, return a :class:`boto.rds.RDSConnection`. Any additional parameters after the region_name are passed on to the connect method of the region object. :type: str :param region_name: The name of the region to connect to. :rtype: :class:`boto.rds.RDSConnection` or ``None`...
Given a valid region name, return a :class:`boto.rds.RDSConnection`. Any additional parameters after the region_name are passed on to the connect method of the region object.
[ "Given", "a", "valid", "region", "name", "return", "a", ":", "class", ":", "boto", ".", "rds", ".", "RDSConnection", ".", "Any", "additional", "parameters", "after", "the", "region_name", "are", "passed", "on", "to", "the", "connect", "method", "of", "the"...
def connect_to_region(region_name, **kw_params): """ Given a valid region name, return a :class:`boto.rds.RDSConnection`. Any additional parameters after the region_name are passed on to the connect method of the region object. :type: str :param region_name: The name of the region to connec...
[ "def", "connect_to_region", "(", "region_name", ",", "*", "*", "kw_params", ")", ":", "return", "connect", "(", "'rds'", ",", "region_name", ",", "region_cls", "=", "RDSRegionInfo", ",", "connection_cls", "=", "RDSConnection", ",", "*", "*", "kw_params", ")" ]
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/rds/__init__.py#L53-L68
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py
python
Decimal._rescale
(self, exp, rounding)
return _dec_from_triple(self._sign, coeff, exp)
Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the context. exp = exp to scale to (an...
Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode.
[ "Rescale", "self", "so", "that", "the", "exponent", "is", "exp", "either", "by", "padding", "with", "zeros", "or", "by", "truncating", "digits", "using", "the", "given", "rounding", "mode", "." ]
def _rescale(self, exp, rounding): """Rescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the ...
[ "def", "_rescale", "(", "self", ",", "exp", ",", "rounding", ")", ":", "if", "self", ".", "_is_special", ":", "return", "Decimal", "(", "self", ")", "if", "not", "self", ":", "return", "_dec_from_triple", "(", "self", ".", "_sign", ",", "'0'", ",", "...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py#L2480-L2512
taomujian/linbing
fe772a58f41e3b046b51a866bdb7e4655abaf51a
python/app/thirdparty/dirsearch/thirdparty/requests/cookies.py
python
merge_cookies
(cookiejar, cookies)
return cookiejar
Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar
Add cookies to cookiejar and returns a merged CookieJar.
[ "Add", "cookies", "to", "cookiejar", "and", "returns", "a", "merged", "CookieJar", "." ]
def merge_cookies(cookiejar, cookies): """Add cookies to cookiejar and returns a merged CookieJar. :param cookiejar: CookieJar object to add the cookies to. :param cookies: Dictionary or CookieJar object to be added. :rtype: CookieJar """ if not isinstance(cookiejar, cookielib.CookieJar): ...
[ "def", "merge_cookies", "(", "cookiejar", ",", "cookies", ")", ":", "if", "not", "isinstance", "(", "cookiejar", ",", "cookielib", ".", "CookieJar", ")", ":", "raise", "ValueError", "(", "'You can only merge into CookieJar'", ")", "if", "isinstance", "(", "cooki...
https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/dirsearch/thirdparty/requests/cookies.py#L529-L549
geomet/geomet
f7cfaa350cde44a16db21d2678ef5d245e7afda5
geomet/esri.py
python
_dump_geojson_polyline
(obj, srid=None)
return {"paths": coordinates, "spatialReference": {"wkid": srid}}
Loads GeoJSON to Esri JSON for Geometry type LineString and MultiLineString.
Loads GeoJSON to Esri JSON for Geometry type LineString and MultiLineString.
[ "Loads", "GeoJSON", "to", "Esri", "JSON", "for", "Geometry", "type", "LineString", "and", "MultiLineString", "." ]
def _dump_geojson_polyline(obj, srid=None): """ Loads GeoJSON to Esri JSON for Geometry type LineString and MultiLineString. """ coordkey = 'coordinates' if obj['type'].lower() == 'linestring': coordinates = [obj[coordkey]] else: coordinates = obj[coordkey] srid = _extra...
[ "def", "_dump_geojson_polyline", "(", "obj", ",", "srid", "=", "None", ")", ":", "coordkey", "=", "'coordinates'", "if", "obj", "[", "'type'", "]", ".", "lower", "(", ")", "==", "'linestring'", ":", "coordinates", "=", "[", "obj", "[", "coordkey", "]", ...
https://github.com/geomet/geomet/blob/f7cfaa350cde44a16db21d2678ef5d245e7afda5/geomet/esri.py#L127-L139
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/Simulations/OPF/opf_templates.py
python
Opf.get_shadow_prices
(self)
return val.transpose()
Extract values fro the 2D array of LP variables :return: 2D numpy array
Extract values fro the 2D array of LP variables :return: 2D numpy array
[ "Extract", "values", "fro", "the", "2D", "array", "of", "LP", "variables", ":", "return", ":", "2D", "numpy", "array" ]
def get_shadow_prices(self): """ Extract values fro the 2D array of LP variables :return: 2D numpy array """ val = np.zeros(self.nodal_restrictions.shape) for i in range(val.shape[0]): if self.nodal_restrictions[i].pi is not None: val[i] = - se...
[ "def", "get_shadow_prices", "(", "self", ")", ":", "val", "=", "np", ".", "zeros", "(", "self", ".", "nodal_restrictions", ".", "shape", ")", "for", "i", "in", "range", "(", "val", ".", "shape", "[", "0", "]", ")", ":", "if", "self", ".", "nodal_re...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Simulations/OPF/opf_templates.py#L250-L259
dcsync/pycobalt
d3a630bfadaeeb6c99aad28f226abe48f6b4acca
pycobalt/aggressor.py
python
bcancel
(*args, fork=None, sync=True)
return engine.call('bcancel', args, fork=fork, sync=sync)
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Cancel a file download Arguments $1 - the id for the beacon. This may be an array or a single ID. $2 - the file to cancel or a wildcard. Example item "&Cancel Downloads" { ...
r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html:
[ "r", "Documentation", "from", "https", ":", "//", "www", ".", "cobaltstrike", ".", "com", "/", "aggressor", "-", "script", "/", "functions", ".", "html", ":" ]
def bcancel(*args, fork=None, sync=True): r""" Documentation from https://www.cobaltstrike.com/aggressor-script/functions.html: Cancel a file download Arguments $1 - the id for the beacon. This may be an array or a single ID. $2 - the file to cancel or a wildcard. Exampl...
[ "def", "bcancel", "(", "*", "args", ",", "fork", "=", "None", ",", "sync", "=", "True", ")", ":", "return", "engine", ".", "call", "(", "'bcancel'", ",", "args", ",", "fork", "=", "fork", ",", "sync", "=", "sync", ")" ]
https://github.com/dcsync/pycobalt/blob/d3a630bfadaeeb6c99aad28f226abe48f6b4acca/pycobalt/aggressor.py#L763-L778
istresearch/scrapy-cluster
01861c2dca1563aab740417d315cc4ebf9b73f72
rest/rest_service.py
python
RestService._setup_redis
(self)
Returns a Redis Client
Returns a Redis Client
[ "Returns", "a", "Redis", "Client" ]
def _setup_redis(self): """Returns a Redis Client""" if not self.closed: try: self.logger.debug("Creating redis connection to host " + str(self.settings['REDIS_HOST'])) self.redis_conn = redis.StrictRedis(host=self.settings['R...
[ "def", "_setup_redis", "(", "self", ")", ":", "if", "not", "self", ".", "closed", ":", "try", ":", "self", ".", "logger", ".", "debug", "(", "\"Creating redis connection to host \"", "+", "str", "(", "self", ".", "settings", "[", "'REDIS_HOST'", "]", ")", ...
https://github.com/istresearch/scrapy-cluster/blob/01861c2dca1563aab740417d315cc4ebf9b73f72/rest/rest_service.py#L347-L369
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/nhl/teams.py
python
Team.save_percentage
(self)
return self._save_percentage
Returns a ``float`` denoting the percentage of shots the team has saved during the season. Percentage ranges from 0-1.
Returns a ``float`` denoting the percentage of shots the team has saved during the season. Percentage ranges from 0-1.
[ "Returns", "a", "float", "denoting", "the", "percentage", "of", "shots", "the", "team", "has", "saved", "during", "the", "season", ".", "Percentage", "ranges", "from", "0", "-", "1", "." ]
def save_percentage(self): """ Returns a ``float`` denoting the percentage of shots the team has saved during the season. Percentage ranges from 0-1. """ return self._save_percentage
[ "def", "save_percentage", "(", "self", ")", ":", "return", "self", ".", "_save_percentage" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nhl/teams.py#L421-L426
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/difflib.py
python
IS_LINE_JUNK
(line, pat=re.compile(r"\s*#?\s*$").match)
return pat(line) is not None
r""" Return 1 for ignorable line: iff `line` is blank or contains a single '#'. Examples: >>> IS_LINE_JUNK('\n') True >>> IS_LINE_JUNK(' # \n') True >>> IS_LINE_JUNK('hello\n') False
r""" Return 1 for ignorable line: iff `line` is blank or contains a single '#'.
[ "r", "Return", "1", "for", "ignorable", "line", ":", "iff", "line", "is", "blank", "or", "contains", "a", "single", "#", "." ]
def IS_LINE_JUNK(line, pat=re.compile(r"\s*#?\s*$").match): r""" Return 1 for ignorable line: iff `line` is blank or contains a single '#'. Examples: >>> IS_LINE_JUNK('\n') True >>> IS_LINE_JUNK(' # \n') True >>> IS_LINE_JUNK('hello\n') False """ return pat(line) is not...
[ "def", "IS_LINE_JUNK", "(", "line", ",", "pat", "=", "re", ".", "compile", "(", "r\"\\s*#?\\s*$\"", ")", ".", "match", ")", ":", "return", "pat", "(", "line", ")", "is", "not", "None" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/difflib.py#L1108-L1122
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/boto/boto/s3/bucket.py
python
Bucket.get_website_configuration_obj
(self, headers=None)
return config
Get the website configuration as a :class:`boto.s3.website.WebsiteConfiguration` object.
Get the website configuration as a :class:`boto.s3.website.WebsiteConfiguration` object.
[ "Get", "the", "website", "configuration", "as", "a", ":", "class", ":", "boto", ".", "s3", ".", "website", ".", "WebsiteConfiguration", "object", "." ]
def get_website_configuration_obj(self, headers=None): """Get the website configuration as a :class:`boto.s3.website.WebsiteConfiguration` object. """ config_xml = self.get_website_configuration_xml(headers=headers) config = website.WebsiteConfiguration() h = handler.XmlH...
[ "def", "get_website_configuration_obj", "(", "self", ",", "headers", "=", "None", ")", ":", "config_xml", "=", "self", ".", "get_website_configuration_xml", "(", "headers", "=", "headers", ")", "config", "=", "website", ".", "WebsiteConfiguration", "(", ")", "h"...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/s3/bucket.py#L1461-L1469
aim-uofa/AdelaiDet
fffb2ca1fbca88ec4d96e9ebc285bffe5027a947
adet/modeling/backbone/bifpn.py
python
SingleBiFPN.forward
(self, feats)
return output_feats
Args: input (dict[str->Tensor]): mapping feature map name (e.g., "p5") to feature map tensor for each feature level in high to low resolution order. Returns: dict[str->Tensor]: mapping from feature map name to FPN feature map tensor in hig...
Args: input (dict[str->Tensor]): mapping feature map name (e.g., "p5") to feature map tensor for each feature level in high to low resolution order.
[ "Args", ":", "input", "(", "dict", "[", "str", "-", ">", "Tensor", "]", ")", ":", "mapping", "feature", "map", "name", "(", "e", ".", "g", ".", "p5", ")", "to", "feature", "map", "tensor", "for", "each", "feature", "level", "in", "high", "to", "l...
def forward(self, feats): """ Args: input (dict[str->Tensor]): mapping feature map name (e.g., "p5") to feature map tensor for each feature level in high to low resolution order. Returns: dict[str->Tensor]: mapping from feature map name to...
[ "def", "forward", "(", "self", ",", "feats", ")", ":", "feats", "=", "[", "_", "for", "_", "in", "feats", "]", "num_levels", "=", "len", "(", "feats", ")", "num_output_connections", "=", "[", "0", "for", "_", "in", "feats", "]", "for", "fnode", "in...
https://github.com/aim-uofa/AdelaiDet/blob/fffb2ca1fbca88ec4d96e9ebc285bffe5027a947/adet/modeling/backbone/bifpn.py#L203-L277
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/maintenance_utils.py
python
InitGRRRootAPI
()
return api.GrrApi( connector=api_shell_raw_access_lib.RawConnector( context=api_call_context.ApiCallContext(username="GRRConfigUpdater"), page_size=_GRR_API_PAGE_SIZE)).root
[]
def InitGRRRootAPI(): return api.GrrApi( connector=api_shell_raw_access_lib.RawConnector( context=api_call_context.ApiCallContext(username="GRRConfigUpdater"), page_size=_GRR_API_PAGE_SIZE)).root
[ "def", "InitGRRRootAPI", "(", ")", ":", "return", "api", ".", "GrrApi", "(", "connector", "=", "api_shell_raw_access_lib", ".", "RawConnector", "(", "context", "=", "api_call_context", ".", "ApiCallContext", "(", "username", "=", "\"GRRConfigUpdater\"", ")", ",", ...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/maintenance_utils.py#L25-L30
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/_ihatexml.py
python
hexToInt
(hex_str)
return int(hex_str, 16)
[]
def hexToInt(hex_str): return int(hex_str, 16)
[ "def", "hexToInt", "(", "hex_str", ")", ":", "return", "int", "(", "hex_str", ",", "16", ")" ]
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/_ihatexml.py#L165-L166
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
examples/stabilizer_code.py
python
StabilizerCode.encode
( self, additional_qubits: List[cirq.Qid], unencoded_qubits: List[cirq.Qid] )
return circuit
Creates a circuit that encodes the qubits using the code words. Args: additional_qubits: The list of self.n - self.k qubits needed to encode the qubit. unencoded_qubits: The list of self.k qubits that contain the original message. Returns: A circuit where the self.n...
Creates a circuit that encodes the qubits using the code words.
[ "Creates", "a", "circuit", "that", "encodes", "the", "qubits", "using", "the", "code", "words", "." ]
def encode( self, additional_qubits: List[cirq.Qid], unencoded_qubits: List[cirq.Qid] ) -> cirq.Circuit: """Creates a circuit that encodes the qubits using the code words. Args: additional_qubits: The list of self.n - self.k qubits needed to encode the qubit. unencod...
[ "def", "encode", "(", "self", ",", "additional_qubits", ":", "List", "[", "cirq", ".", "Qid", "]", ",", "unencoded_qubits", ":", "List", "[", "cirq", ".", "Qid", "]", ")", "->", "cirq", ".", "Circuit", ":", "assert", "len", "(", "additional_qubits", ")...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/examples/stabilizer_code.py#L202-L265
poljar/weechat-matrix
b88614e557399e8b3b623a3d29b2694acc019a44
main.py
python
buffer_command_cb
(data, _, command)
return W.WEECHAT_RC_OK
Override the buffer command to allow switching buffers by short name.
Override the buffer command to allow switching buffers by short name.
[ "Override", "the", "buffer", "command", "to", "allow", "switching", "buffers", "by", "short", "name", "." ]
def buffer_command_cb(data, _, command): """Override the buffer command to allow switching buffers by short name.""" command = command[7:].strip() buffer_subcommands = ["list", "add", "clear", "move", "swap", "cycle", "merge", "unmerge", "hide", "unhide", "renumber", ...
[ "def", "buffer_command_cb", "(", "data", ",", "_", ",", "command", ")", ":", "command", "=", "command", "[", "7", ":", "]", ".", "strip", "(", ")", "buffer_subcommands", "=", "[", "\"list\"", ",", "\"add\"", ",", "\"clear\"", ",", "\"move\"", ",", "\"s...
https://github.com/poljar/weechat-matrix/blob/b88614e557399e8b3b623a3d29b2694acc019a44/main.py#L629-L677
n1nj4sec/pr0cks
c98188b205a06b5bdb5ec3eea99dde4d8bf1f577
socks.py
python
socksocket.getproxypeername
(self)
return _orgsocket.getpeername(self)
getproxypeername() -> address info Returns the IP and port number of the proxy.
getproxypeername() -> address info Returns the IP and port number of the proxy.
[ "getproxypeername", "()", "-", ">", "address", "info", "Returns", "the", "IP", "and", "port", "number", "of", "the", "proxy", "." ]
def getproxypeername(self): """getproxypeername() -> address info Returns the IP and port number of the proxy. """ return _orgsocket.getpeername(self)
[ "def", "getproxypeername", "(", "self", ")", ":", "return", "_orgsocket", ".", "getpeername", "(", "self", ")" ]
https://github.com/n1nj4sec/pr0cks/blob/c98188b205a06b5bdb5ec3eea99dde4d8bf1f577/socks.py#L256-L260
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/browser/server_groups/servers/pgagent/__init__.py
python
JobView.delete
(self, gid, sid, jid=None)
return make_json_response(success=1)
Delete the pgAgent Job.
Delete the pgAgent Job.
[ "Delete", "the", "pgAgent", "Job", "." ]
def delete(self, gid, sid, jid=None): """Delete the pgAgent Job.""" if jid is None: data = request.form if request.form else json.loads( request.data, encoding='utf-8' ) else: data = {'ids': [jid]} for jid in data['ids']: ...
[ "def", "delete", "(", "self", ",", "gid", ",", "sid", ",", "jid", "=", "None", ")", ":", "if", "jid", "is", "None", ":", "data", "=", "request", ".", "form", "if", "request", ".", "form", "else", "json", ".", "loads", "(", "request", ".", "data",...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/pgagent/__init__.py#L392-L412
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/airconditioningcompanion.py
python
AirConditioningCompanion.send_command
(self, command: str)
return self.send("send_cmd", [str(command)])
Send a command to the air conditioner. :param str command: Command to execute
Send a command to the air conditioner.
[ "Send", "a", "command", "to", "the", "air", "conditioner", "." ]
def send_command(self, command: str): """Send a command to the air conditioner. :param str command: Command to execute """ return self.send("send_cmd", [str(command)])
[ "def", "send_command", "(", "self", ",", "command", ":", "str", ")", ":", "return", "self", ".", "send", "(", "\"send_cmd\"", ",", "[", "str", "(", "command", ")", "]", ")" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/airconditioningcompanion.py#L352-L357
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/imaplib.py
python
IMAP4.status
(self, mailbox, names)
return self._untagged_response(typ, dat, name)
Request named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names)
Request named status conditions for mailbox.
[ "Request", "named", "status", "conditions", "for", "mailbox", "." ]
def status(self, mailbox, names): """Request named status conditions for mailbox. (typ, [data]) = <instance>.status(mailbox, names) """ name = 'STATUS' #if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide! # raise self.error('%s unimplemented in IMAP4 (obta...
[ "def", "status", "(", "self", ",", "mailbox", ",", "names", ")", ":", "name", "=", "'STATUS'", "#if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide!", "# raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name)", "typ", ",", "dat", ...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/imaplib.py#L823-L832
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/openshift_health_checker/openshift_checks/docker_storage.py
python
DockerStorage.get_vg_free
(self, pool)
return size
Determine which VG to examine according to the pool name. Return: size vgs reports. Pool name is the only indicator currently available from the Docker API driver info. We assume a name that looks like "vg--name-docker--pool"; vg and lv names with inner hyphens doubled, joined by a hyphen.
Determine which VG to examine according to the pool name. Return: size vgs reports. Pool name is the only indicator currently available from the Docker API driver info. We assume a name that looks like "vg--name-docker--pool"; vg and lv names with inner hyphens doubled, joined by a hyphen.
[ "Determine", "which", "VG", "to", "examine", "according", "to", "the", "pool", "name", ".", "Return", ":", "size", "vgs", "reports", ".", "Pool", "name", "is", "the", "only", "indicator", "currently", "available", "from", "the", "Docker", "API", "driver", ...
def get_vg_free(self, pool): """Determine which VG to examine according to the pool name. Return: size vgs reports. Pool name is the only indicator currently available from the Docker API driver info. We assume a name that looks like "vg--name-docker--pool"; vg and lv names with inner hy...
[ "def", "get_vg_free", "(", "self", ",", "pool", ")", ":", "match", "=", "re", ".", "match", "(", "r'((?:[^-]|--)+)-(?!-)'", ",", "pool", ")", "# matches up to the first single hyphen", "if", "not", "match", ":", "# unlikely, but... be clear if we assumed wrong", "rais...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/openshift_health_checker/openshift_checks/docker_storage.py#L157-L188
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ame/v20190916/models.py
python
OfflineMusicDetail.__init__
(self)
r""" :param ItemId: 歌曲Id :type ItemId: str :param MusicName: 歌曲名称 :type MusicName: str :param OffRemark: 不可用原因 :type OffRemark: str :param OffTime: 不可用时间 :type OffTime: str
r""" :param ItemId: 歌曲Id :type ItemId: str :param MusicName: 歌曲名称 :type MusicName: str :param OffRemark: 不可用原因 :type OffRemark: str :param OffTime: 不可用时间 :type OffTime: str
[ "r", ":", "param", "ItemId", ":", "歌曲Id", ":", "type", "ItemId", ":", "str", ":", "param", "MusicName", ":", "歌曲名称", ":", "type", "MusicName", ":", "str", ":", "param", "OffRemark", ":", "不可用原因", ":", "type", "OffRemark", ":", "str", ":", "param", "O...
def __init__(self): r""" :param ItemId: 歌曲Id :type ItemId: str :param MusicName: 歌曲名称 :type MusicName: str :param OffRemark: 不可用原因 :type OffRemark: str :param OffTime: 不可用时间 :type OffTime: str """ self.ItemId = None self.Mus...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ItemId", "=", "None", "self", ".", "MusicName", "=", "None", "self", ".", "OffRemark", "=", "None", "self", ".", "OffTime", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ame/v20190916/models.py#L1599-L1613