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
yanzhou/CnkiSpider
348d7114f3ffee7b0a134cf6c5d01150433f3fde
src/bs4/element.py
python
_alias
(attr)
return alias
Alias one attribute name to another for backward compatibility
Alias one attribute name to another for backward compatibility
[ "Alias", "one", "attribute", "name", "to", "another", "for", "backward", "compatibility" ]
def _alias(attr): """Alias one attribute name to another for backward compatibility""" @property def alias(self): return getattr(self, attr) @alias.setter def alias(self): return setattr(self, attr) return alias
[ "def", "_alias", "(", "attr", ")", ":", "@", "property", "def", "alias", "(", "self", ")", ":", "return", "getattr", "(", "self", ",", "attr", ")", "@", "alias", ".", "setter", "def", "alias", "(", "self", ")", ":", "return", "setattr", "(", "self"...
https://github.com/yanzhou/CnkiSpider/blob/348d7114f3ffee7b0a134cf6c5d01150433f3fde/src/bs4/element.py#L12-L21
ConvLab/ConvLab
a04582a77537c1a706fbf64715baa9ad0be1301a
convlab/lib/util.py
python
write_as_df
(data, data_path)
return data_path
Submethod to write data as DataFrame
Submethod to write data as DataFrame
[ "Submethod", "to", "write", "data", "as", "DataFrame" ]
def write_as_df(data, data_path): '''Submethod to write data as DataFrame''' df = cast_df(data) ext = get_file_ext(data_path) df.to_csv(data_path, index=False) return data_path
[ "def", "write_as_df", "(", "data", ",", "data_path", ")", ":", "df", "=", "cast_df", "(", "data", ")", "ext", "=", "get_file_ext", "(", "data_path", ")", "df", ".", "to_csv", "(", "data_path", ",", "index", "=", "False", ")", "return", "data_path" ]
https://github.com/ConvLab/ConvLab/blob/a04582a77537c1a706fbf64715baa9ad0be1301a/convlab/lib/util.py#L652-L657
sidewalklabs/s2sphere
d1d067e8c06e5fbaf0cc0158bade947b4a03a438
s2sphere/sphere.py
python
LatLngRect.is_empty
(self)
return self.lat().is_empty()
[]
def is_empty(self): return self.lat().is_empty()
[ "def", "is_empty", "(", "self", ")", ":", "return", "self", ".", "lat", "(", ")", ".", "is_empty", "(", ")" ]
https://github.com/sidewalklabs/s2sphere/blob/d1d067e8c06e5fbaf0cc0158bade947b4a03a438/s2sphere/sphere.py#L631-L632
conan7882/CNN-Visualization
e08650cc126a3a489f7d633dc18bf3f0009792b1
lib/models/cam.py
python
BaseCAM._get_optimizer
(self)
return tf.train.AdamOptimizer( beta1=0.5, learning_rate=self._learning_rate)
[]
def _get_optimizer(self): return tf.train.AdamOptimizer( beta1=0.5, learning_rate=self._learning_rate)
[ "def", "_get_optimizer", "(", "self", ")", ":", "return", "tf", ".", "train", ".", "AdamOptimizer", "(", "beta1", "=", "0.5", ",", "learning_rate", "=", "self", ".", "_learning_rate", ")" ]
https://github.com/conan7882/CNN-Visualization/blob/e08650cc126a3a489f7d633dc18bf3f0009792b1/lib/models/cam.py#L51-L53
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/kombu/transport/virtual/base.py
python
Transport.on_message_ready
(self, channel, message, queue)
[]
def on_message_ready(self, channel, message, queue): if not queue or queue not in self._callbacks: raise KeyError( 'Message for queue {0!r} without consumers: {1}'.format( queue, message)) self._callbacks[queue](message)
[ "def", "on_message_ready", "(", "self", ",", "channel", ",", "message", ",", "queue", ")", ":", "if", "not", "queue", "or", "queue", "not", "in", "self", ".", "_callbacks", ":", "raise", "KeyError", "(", "'Message for queue {0!r} without consumers: {1}'", ".", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/kombu/transport/virtual/base.py#L991-L996
grow/grow
97fc21730b6a674d5d33948d94968e79447ce433
grow/server/manager.py
python
print_server_ready_message
(pod, host, port)
return (url_root, extra_urls)
[]
def print_server_ready_message(pod, host, port): try: home_doc = pod.get_home_doc() root_path = home_doc.url.path if home_doc and home_doc.exists else '/' except: # Allow the user to fix the problem without restarting the server manually. root_path = '/' pod.logger.except...
[ "def", "print_server_ready_message", "(", "pod", ",", "host", ",", "port", ")", ":", "try", ":", "home_doc", "=", "pod", ".", "get_home_doc", "(", ")", "root_path", "=", "home_doc", ".", "url", ".", "path", "if", "home_doc", "and", "home_doc", ".", "exis...
https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/server/manager.py#L66-L90
alicevision/meshroom
92004286fd0bc8ab36bd3575b4c0166090e665e1
meshroom/core/node.py
python
nodeFactory
(nodeDict, name=None)
return node
Create a node instance by deserializing the given node data. If the serialized data matches the corresponding node type description, a Node instance is created. If any compatibility issue occurs, a NodeCompatibility instance is created instead. Args: nodeDict (dict): the serialization of the node ...
Create a node instance by deserializing the given node data. If the serialized data matches the corresponding node type description, a Node instance is created. If any compatibility issue occurs, a NodeCompatibility instance is created instead.
[ "Create", "a", "node", "instance", "by", "deserializing", "the", "given", "node", "data", ".", "If", "the", "serialized", "data", "matches", "the", "corresponding", "node", "type", "description", "a", "Node", "instance", "is", "created", ".", "If", "any", "c...
def nodeFactory(nodeDict, name=None): """ Create a node instance by deserializing the given node data. If the serialized data matches the corresponding node type description, a Node instance is created. If any compatibility issue occurs, a NodeCompatibility instance is created instead. Args: ...
[ "def", "nodeFactory", "(", "nodeDict", ",", "name", "=", "None", ")", ":", "nodeType", "=", "nodeDict", "[", "\"nodeType\"", "]", "# retro-compatibility: inputs were previously saved as \"attributes\"", "if", "\"inputs\"", "not", "in", "nodeDict", "and", "\"attributes\"...
https://github.com/alicevision/meshroom/blob/92004286fd0bc8ab36bd3575b4c0166090e665e1/meshroom/core/node.py#L1396-L1467
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/rdfvalues/objects.py
python
SHA256HashID.FromData
(cls, data)
return SHA256HashID(h)
[]
def FromData(cls, data): h = hashlib.sha256(data).digest() return SHA256HashID(h)
[ "def", "FromData", "(", "cls", ",", "data", ")", ":", "h", "=", "hashlib", ".", "sha256", "(", "data", ")", ".", "digest", "(", ")", "return", "SHA256HashID", "(", "h", ")" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/rdfvalues/objects.py#L645-L647
niosus/EasyClangComplete
3b16eb17735aaa3f56bb295fc5481b269ee9f2ef
plugin/clang/cindex35.py
python
Type.element_count
(self)
return result
Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises.
Retrieve the number of elements in this type.
[ "Retrieve", "the", "number", "of", "elements", "in", "this", "type", "." ]
def element_count(self): """Retrieve the number of elements in this type. Returns an int. If the Type is not an array or vector, this raises. """ result = conf.lib.clang_getNumElements(self) if result < 0: raise Exception('Type does not have elements.') ...
[ "def", "element_count", "(", "self", ")", ":", "result", "=", "conf", ".", "lib", ".", "clang_getNumElements", "(", "self", ")", "if", "result", "<", "0", ":", "raise", "Exception", "(", "'Type does not have elements.'", ")", "return", "result" ]
https://github.com/niosus/EasyClangComplete/blob/3b16eb17735aaa3f56bb295fc5481b269ee9f2ef/plugin/clang/cindex35.py#L1707-L1718
yiyiliao/deep_marching_cubes
afcad99742435eb0d57d32770befed74faaad2ab
marching_cube/model/table.py
python
get_full_table
()
return [ [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [1, 2, 10, -1, -1, -1, -1, -1, -1, -1, ...
Return the look-up-table of the Marching Cubes algorithm
Return the look-up-table of the Marching Cubes algorithm
[ "Return", "the", "look", "-", "up", "-", "table", "of", "the", "Marching", "Cubes", "algorithm" ]
def get_full_table(): """Return the look-up-table of the Marching Cubes algorithm""" return [ [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [1, 8, 3, ...
[ "def", "get_full_table", "(", ")", ":", "return", "[", "[", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1", ",", "-", "1...
https://github.com/yiyiliao/deep_marching_cubes/blob/afcad99742435eb0d57d32770befed74faaad2ab/marching_cube/model/table.py#L24-L283
Dozed12/df-style-worldgen
937455d54f4b02df9c4b10ae6418f4c932fd97bf
libtcodpy.py
python
image_hflip
(image)
[]
def image_hflip(image) : _lib.TCOD_image_hflip(image)
[ "def", "image_hflip", "(", "image", ")", ":", "_lib", ".", "TCOD_image_hflip", "(", "image", ")" ]
https://github.com/Dozed12/df-style-worldgen/blob/937455d54f4b02df9c4b10ae6418f4c932fd97bf/libtcodpy.py#L1098-L1099
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/initializers.py
python
InitializerFromFile
(path)
return Initializer
Loads parameters from .npy file.
Loads parameters from .npy file.
[ "Loads", "parameters", "from", ".", "npy", "file", "." ]
def InitializerFromFile(path): """Loads parameters from .npy file.""" def Initializer(shape, rng): del rng logging.info('Loading pretrained embeddings from %s', path) with tf.io.gfile.GFile(path, 'rb') as f: parameters = jnp.load(f) assert jnp.shape(parameters) == shape, ( 'Expected s...
[ "def", "InitializerFromFile", "(", "path", ")", ":", "def", "Initializer", "(", "shape", ",", "rng", ")", ":", "del", "rng", "logging", ".", "info", "(", "'Loading pretrained embeddings from %s'", ",", "path", ")", "with", "tf", ".", "io", ".", "gfile", "....
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/initializers.py#L55-L67
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/envs/env.py
python
Env.reward_range
(self)
return self._rewards.range
Return the range of the reward function; a tuple corresponding to the min and max possible rewards
Return the range of the reward function; a tuple corresponding to the min and max possible rewards
[ "Return", "the", "range", "of", "the", "reward", "function", ";", "a", "tuple", "corresponding", "to", "the", "min", "and", "max", "possible", "rewards" ]
def reward_range(self): """Return the range of the reward function; a tuple corresponding to the min and max possible rewards""" return self._rewards.range
[ "def", "reward_range", "(", "self", ")", ":", "return", "self", ".", "_rewards", ".", "range" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/envs/env.py#L255-L257
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail_bak/api/v2/endpoints.py
python
BaseAPIEndpoint.get_meta_fields
(cls, model)
return cls._convert_api_fields(cls.meta_fields + list(getattr(model, 'api_meta_fields', ())))
[]
def get_meta_fields(cls, model): return cls._convert_api_fields(cls.meta_fields + list(getattr(model, 'api_meta_fields', ())))
[ "def", "get_meta_fields", "(", "cls", ",", "model", ")", ":", "return", "cls", ".", "_convert_api_fields", "(", "cls", ".", "meta_fields", "+", "list", "(", "getattr", "(", "model", ",", "'api_meta_fields'", ",", "(", ")", ")", ")", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/api/v2/endpoints.py#L111-L112
serge-sans-paille/pythran
f9f73aa5a965adc4ebcb91a439784dbe9ef911fa
pythran/analyses/range_values.py
python
RangeValuesBase.visit_Name
(self, node)
return self.add(node, self.result[node.id])
Get range for parameters for examples or false branching.
Get range for parameters for examples or false branching.
[ "Get", "range", "for", "parameters", "for", "examples", "or", "false", "branching", "." ]
def visit_Name(self, node): """ Get range for parameters for examples or false branching. """ return self.add(node, self.result[node.id])
[ "def", "visit_Name", "(", "self", ",", "node", ")", ":", "return", "self", ".", "add", "(", "node", ",", "self", ".", "result", "[", "node", ".", "id", "]", ")" ]
https://github.com/serge-sans-paille/pythran/blob/f9f73aa5a965adc4ebcb91a439784dbe9ef911fa/pythran/analyses/range_values.py#L428-L430
maurosoria/dirsearch
b83e68c8fdf360ab06be670d7b92b263262ee5b1
thirdparty/requests/cookies.py
python
cookiejar_from_dict
(cookie_dict, cookiejar=None, overwrite=True)
return cookiejar
Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not replace cookies already in the jar with new ones. :rtype: CookieJar
Returns a CookieJar from a key/value dictionary.
[ "Returns", "a", "CookieJar", "from", "a", "key", "/", "value", "dictionary", "." ]
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): """Returns a CookieJar from a key/value dictionary. :param cookie_dict: Dict of key/values to insert into CookieJar. :param cookiejar: (optional) A cookiejar to add the cookies to. :param overwrite: (optional) If False, will not repl...
[ "def", "cookiejar_from_dict", "(", "cookie_dict", ",", "cookiejar", "=", "None", ",", "overwrite", "=", "True", ")", ":", "if", "cookiejar", "is", "None", ":", "cookiejar", "=", "RequestsCookieJar", "(", ")", "if", "cookie_dict", "is", "not", "None", ":", ...
https://github.com/maurosoria/dirsearch/blob/b83e68c8fdf360ab06be670d7b92b263262ee5b1/thirdparty/requests/cookies.py#L508-L526
jantman/misc-scripts
dba5680bafbc5c5d2d9d4abcc305c57df373cd26
lastpass2vault.py
python
LastpassToVault._connect_lp
(self, lp_user)
return lp
Connect to LastPass; return the connection. :param lp_user: LastPass username :type lp_user: str :returns: connected LastPass Vault object :rtype: lastpass.vault.Vault
Connect to LastPass; return the connection.
[ "Connect", "to", "LastPass", ";", "return", "the", "connection", "." ]
def _connect_lp(self, lp_user): """ Connect to LastPass; return the connection. :param lp_user: LastPass username :type lp_user: str :returns: connected LastPass Vault object :rtype: lastpass.vault.Vault """ logger.debug('Authenticating to LastPass with u...
[ "def", "_connect_lp", "(", "self", ",", "lp_user", ")", ":", "logger", ".", "debug", "(", "'Authenticating to LastPass with username: %s'", ",", "lp_user", ")", "passwd", "=", "getpass", "(", "'LastPass Password: '", ")", ".", "strip", "(", ")", "mfa", "=", "i...
https://github.com/jantman/misc-scripts/blob/dba5680bafbc5c5d2d9d4abcc305c57df373cd26/lastpass2vault.py#L123-L144
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
apps/social/models.py
python
MSocialServices.set_photo
(self, service)
return profile
[]
def set_photo(self, service): profile = MSocialProfile.get_user(self.user_id) if service == 'nothing': service = None profile.photo_service = service if not service: profile.photo_url = None elif service == 'twitter': profile.photo_url = self....
[ "def", "set_photo", "(", "self", ",", "service", ")", ":", "profile", "=", "MSocialProfile", ".", "get_user", "(", "self", ".", "user_id", ")", "if", "service", "==", "'nothing'", ":", "service", "=", "None", "profile", ".", "photo_service", "=", "service"...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/social/models.py#L2693-L2712
feincms/feincms
be35576fa86083a969ae56aaf848173d1a5a3c5d
feincms/utils/managers.py
python
ActiveAwareContentManagerMixin.active
(self)
return self.apply_active_filters(self)
Return only currently active objects.
Return only currently active objects.
[ "Return", "only", "currently", "active", "objects", "." ]
def active(self): """ Return only currently active objects. """ return self.apply_active_filters(self)
[ "def", "active", "(", "self", ")", ":", "return", "self", ".", "apply_active_filters", "(", "self", ")" ]
https://github.com/feincms/feincms/blob/be35576fa86083a969ae56aaf848173d1a5a3c5d/feincms/utils/managers.py#L49-L53
visinf/n3net
5d5883a374aab343ca4091d8a072e83629d53516
src_correspondences/network.py
python
MyNetwork.comp
(self, data)
Goodie for competitors
Goodie for competitors
[ "Goodie", "for", "competitors" ]
def comp(self, data): """Goodie for competitors""" # Run competitors on dataset for test_mode in ["test", "valid"]: comp_process( test_mode, data[test_mode], getattr(self, "res_dir_" + test_mode[:2]), self.config)
[ "def", "comp", "(", "self", ",", "data", ")", ":", "# Run competitors on dataset", "for", "test_mode", "in", "[", "\"test\"", ",", "\"valid\"", "]", ":", "comp_process", "(", "test_mode", ",", "data", "[", "test_mode", "]", ",", "getattr", "(", "self", ","...
https://github.com/visinf/n3net/blob/5d5883a374aab343ca4091d8a072e83629d53516/src_correspondences/network.py#L495-L503
freqtrade/freqtrade
13651fd3be8d5ce8dcd7c94b920bda4e00b75aca
freqtrade/exchange/exchange.py
python
Exchange.validate_stakecurrency
(self, stake_currency: str)
Checks stake-currency against available currencies on the exchange. Only runs on startup. If markets have not been loaded, there's been a problem with the connection to the exchange. :param stake_currency: Stake-currency to validate :raise: OperationalException if stake-currency is not a...
Checks stake-currency against available currencies on the exchange. Only runs on startup. If markets have not been loaded, there's been a problem with the connection to the exchange. :param stake_currency: Stake-currency to validate :raise: OperationalException if stake-currency is not a...
[ "Checks", "stake", "-", "currency", "against", "available", "currencies", "on", "the", "exchange", ".", "Only", "runs", "on", "startup", ".", "If", "markets", "have", "not", "been", "loaded", "there", "s", "been", "a", "problem", "with", "the", "connection",...
def validate_stakecurrency(self, stake_currency: str) -> None: """ Checks stake-currency against available currencies on the exchange. Only runs on startup. If markets have not been loaded, there's been a problem with the connection to the exchange. :param stake_currency: Stake-c...
[ "def", "validate_stakecurrency", "(", "self", ",", "stake_currency", ":", "str", ")", "->", "None", ":", "if", "not", "self", ".", "_markets", ":", "raise", "OperationalException", "(", "'Could not load markets, therefore cannot start. '", "'Please investigate the above e...
https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/exchange/exchange.py#L367-L384
mathics/Mathics
318e06dea8f1c70758a50cb2f95c9900150e3a68
mathics/builtin/numbers/algebra.py
python
CoefficientList.apply_noform
(self, expr, evaluation)
return evaluation.message("CoefficientList", "argtu")
CoefficientList[expr_]
CoefficientList[expr_]
[ "CoefficientList", "[", "expr_", "]" ]
def apply_noform(self, expr, evaluation): "CoefficientList[expr_]" return evaluation.message("CoefficientList", "argtu")
[ "def", "apply_noform", "(", "self", ",", "expr", ",", "evaluation", ")", ":", "return", "evaluation", ".", "message", "(", "\"CoefficientList\"", ",", "\"argtu\"", ")" ]
https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/numbers/algebra.py#L1317-L1319
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/editors/displaytabs/citationembedlist.py
python
CitationEmbedList._handle_drag
(self, row, handle)
A CITATION_LINK has been dragged
A CITATION_LINK has been dragged
[ "A", "CITATION_LINK", "has", "been", "dragged" ]
def _handle_drag(self, row, handle): """ A CITATION_LINK has been dragged """ if handle: objct = self.dbstate.db.get_citation_from_handle(handle) if isinstance(objct, Citation): try: from .. import EditCitation ...
[ "def", "_handle_drag", "(", "self", ",", "row", ",", "handle", ")", ":", "if", "handle", ":", "objct", "=", "self", ".", "dbstate", ".", "db", ".", "get_citation_from_handle", "(", "handle", ")", "if", "isinstance", "(", "objct", ",", "Citation", ")", ...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/editors/displaytabs/citationembedlist.py#L246-L264
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/operator.py
python
truth
(a)
return True if a else False
Return True if a is true, False otherwise.
Return True if a is true, False otherwise.
[ "Return", "True", "if", "a", "is", "true", "False", "otherwise", "." ]
def truth(a): "Return True if a is true, False otherwise." return True if a else False
[ "def", "truth", "(", "a", ")", ":", "return", "True", "if", "a", "else", "False" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/operator.py#L57-L59
allegroai/clearml
5953dc6eefadcdfcc2bdbb6a0da32be58823a5af
examples/frameworks/scikit-learn/sklearn_matplotlib_example.py
python
plot_learning_curve
(estimator, title, X, y, axes=None, ylim=None, cv=None, n_jobs=None, train_sizes=np.linspace(.1, 1.0, 5))
return plt
Generate 3 plots: the test and training learning curve, the training samples vs fit times curve, the fit times vs score curve. Parameters ---------- estimator : object type that implements the "fit" and "predict" methods An object of that type which is cloned for each validation. title : s...
Generate 3 plots: the test and training learning curve, the training samples vs fit times curve, the fit times vs score curve.
[ "Generate", "3", "plots", ":", "the", "test", "and", "training", "learning", "curve", "the", "training", "samples", "vs", "fit", "times", "curve", "the", "fit", "times", "vs", "score", "curve", "." ]
def plot_learning_curve(estimator, title, X, y, axes=None, ylim=None, cv=None, n_jobs=None, train_sizes=np.linspace(.1, 1.0, 5)): """ Generate 3 plots: the test and training learning curve, the training samples vs fit times curve, the fit times vs score curve. Parameters ---...
[ "def", "plot_learning_curve", "(", "estimator", ",", "title", ",", "X", ",", "y", ",", "axes", "=", "None", ",", "ylim", "=", "None", ",", "cv", "=", "None", ",", "n_jobs", "=", "None", ",", "train_sizes", "=", "np", ".", "linspace", "(", ".1", ","...
https://github.com/allegroai/clearml/blob/5953dc6eefadcdfcc2bdbb6a0da32be58823a5af/examples/frameworks/scikit-learn/sklearn_matplotlib_example.py#L12-L124
nextml/NEXT
4c8f4d5a66376a18c047f4c9409f73c75925bf07
apps/PoolBasedTripletMDS/algs/UncertaintySampling/utilsMDS.py
python
computeEmbedding
(n,d,S,num_random_restarts=0,max_num_passes=0,max_iter_GD=0,max_norm=0,epsilon=0.01,verbose=False)
return X_old,emp_loss_old
Computes an embedding of n objects in d dimensions usin the triplets of S. S is a list of triplets such that for each q in S, q = [i,j,k] means that object k should be closer to i than j. Inputs: (int) n : number of objects in embedding (int) d : desired dimension (list [(int) i, (i...
Computes an embedding of n objects in d dimensions usin the triplets of S. S is a list of triplets such that for each q in S, q = [i,j,k] means that object k should be closer to i than j.
[ "Computes", "an", "embedding", "of", "n", "objects", "in", "d", "dimensions", "usin", "the", "triplets", "of", "S", ".", "S", "is", "a", "list", "of", "triplets", "such", "that", "for", "each", "q", "in", "S", "q", "=", "[", "i", "j", "k", "]", "...
def computeEmbedding(n,d,S,num_random_restarts=0,max_num_passes=0,max_iter_GD=0,max_norm=0,epsilon=0.01,verbose=False): """ Computes an embedding of n objects in d dimensions usin the triplets of S. S is a list of triplets such that for each q in S, q = [i,j,k] means that object k should be closer to i ...
[ "def", "computeEmbedding", "(", "n", ",", "d", ",", "S", ",", "num_random_restarts", "=", "0", ",", "max_num_passes", "=", "0", ",", "max_iter_GD", "=", "0", ",", "max_norm", "=", "0", ",", "epsilon", "=", "0.01", ",", "verbose", "=", "False", ")", "...
https://github.com/nextml/NEXT/blob/4c8f4d5a66376a18c047f4c9409f73c75925bf07/apps/PoolBasedTripletMDS/algs/UncertaintySampling/utilsMDS.py#L196-L252
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/dev/pipelines/pipeline_run.py
python
pipeline_run_add_tag
(run_id, tags, organization=None, project=None, detect=None)
return tags
Add tag(s) for a pipeline run. :param run_id: ID of the pipeline run. :type run_id: int :param tags: Tag(s) to be added to the pipeline run. [Comma seperated values] :type tags: str :rtype: list of str
Add tag(s) for a pipeline run. :param run_id: ID of the pipeline run. :type run_id: int :param tags: Tag(s) to be added to the pipeline run. [Comma seperated values] :type tags: str :rtype: list of str
[ "Add", "tag", "(", "s", ")", "for", "a", "pipeline", "run", ".", ":", "param", "run_id", ":", "ID", "of", "the", "pipeline", "run", ".", ":", "type", "run_id", ":", "int", ":", "param", "tags", ":", "Tag", "(", "s", ")", "to", "be", "added", "t...
def pipeline_run_add_tag(run_id, tags, organization=None, project=None, detect=None): """ Add tag(s) for a pipeline run. :param run_id: ID of the pipeline run. :type run_id: int :param tags: Tag(s) to be added to the pipeline run. [Comma seperated values] :type tags: str :rtype: list of str ...
[ "def", "pipeline_run_add_tag", "(", "run_id", ",", "tags", ",", "organization", "=", "None", ",", "project", "=", "None", ",", "detect", "=", "None", ")", ":", "organization", ",", "project", "=", "resolve_instance_and_project", "(", "detect", "=", "detect", ...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/dev/pipelines/pipeline_run.py#L90-L109
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/deployed_devices/fleet/deployment.py
python
DeploymentList.stream
(self, limit=None, page_size=None)
return self._version.stream(page, limits['limit'])
Streams DeploymentInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param int limit: Upper limit for the number ...
Streams DeploymentInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient.
[ "Streams", "DeploymentInstance", "records", "from", "the", "API", "as", "a", "generator", "stream", ".", "This", "operation", "lazily", "loads", "records", "as", "efficiently", "as", "possible", "until", "the", "limit", "is", "reached", ".", "The", "results", ...
def stream(self, limit=None, page_size=None): """ Streams DeploymentInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory...
[ "def", "stream", "(", "self", ",", "limit", "=", "None", ",", "page_size", "=", "None", ")", ":", "limits", "=", "self", ".", "_version", ".", "read_limits", "(", "limit", ",", "page_size", ")", "page", "=", "self", ".", "page", "(", "page_size", "="...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/deployed_devices/fleet/deployment.py#L54-L75
PanJinquan/tensorflow_models_learning
e7a2773d526e01c76fc8366868099ca3d7a819b4
slim/datasets/download_and_convert_mnist.py
python
_extract_labels
(filename, num_labels)
return labels
Extract the labels into a vector of int64 label IDs. Args: filename: The path to an MNIST labels file. num_labels: The number of labels in the file. Returns: A numpy array of shape [number_of_labels]
Extract the labels into a vector of int64 label IDs.
[ "Extract", "the", "labels", "into", "a", "vector", "of", "int64", "label", "IDs", "." ]
def _extract_labels(filename, num_labels): """Extract the labels into a vector of int64 label IDs. Args: filename: The path to an MNIST labels file. num_labels: The number of labels in the file. Returns: A numpy array of shape [number_of_labels] """ print('Extracting labels from: ', filename) ...
[ "def", "_extract_labels", "(", "filename", ",", "num_labels", ")", ":", "print", "(", "'Extracting labels from: '", ",", "filename", ")", "with", "gzip", ".", "open", "(", "filename", ")", "as", "bytestream", ":", "bytestream", ".", "read", "(", "8", ")", ...
https://github.com/PanJinquan/tensorflow_models_learning/blob/e7a2773d526e01c76fc8366868099ca3d7a819b4/slim/datasets/download_and_convert_mnist.py#L84-L99
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/yaml/__init__.py
python
safe_dump_all
(documents, stream=None, **kwds)
return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
[ "Serialize", "a", "sequence", "of", "Python", "objects", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
def safe_dump_all(documents, stream=None, **kwds): """ Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
[ "def", "safe_dump_all", "(", "documents", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "documents", ",", "stream", ",", "Dumper", "=", "SafeDumper", ",", "*", "*", "kwds", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/yaml/__init__.py#L292-L298
baidu/DuReader
43577e29435f5abcb7b02ce6a0019b3f42b1221d
DuReader-2.0/paddle/vocab.py
python
Vocab.get_token
(self, idx)
gets the token corresponding to idx, returns unk token if idx is not in vocab Args: idx: an integer returns: a token string
gets the token corresponding to idx, returns unk token if idx is not in vocab Args: idx: an integer returns: a token string
[ "gets", "the", "token", "corresponding", "to", "idx", "returns", "unk", "token", "if", "idx", "is", "not", "in", "vocab", "Args", ":", "idx", ":", "an", "integer", "returns", ":", "a", "token", "string" ]
def get_token(self, idx): """ gets the token corresponding to idx, returns unk token if idx is not in vocab Args: idx: an integer returns: a token string """ try: return self.id2token[idx] except KeyError: return sel...
[ "def", "get_token", "(", "self", ",", "idx", ")", ":", "try", ":", "return", "self", ".", "id2token", "[", "idx", "]", "except", "KeyError", ":", "return", "self", ".", "unk_token" ]
https://github.com/baidu/DuReader/blob/43577e29435f5abcb7b02ce6a0019b3f42b1221d/DuReader-2.0/paddle/vocab.py#L82-L93
benedekrozemberczki/GAM
cd66582215d6f06441ce93981e76af0214b292f3
src/utils.py
python
tab_printer
(args)
Function to print the logs in a nice tabular format. :param args: Parameters used for the model.
Function to print the logs in a nice tabular format. :param args: Parameters used for the model.
[ "Function", "to", "print", "the", "logs", "in", "a", "nice", "tabular", "format", ".", ":", "param", "args", ":", "Parameters", "used", "for", "the", "model", "." ]
def tab_printer(args): """ Function to print the logs in a nice tabular format. :param args: Parameters used for the model. """ args = vars(args) keys = sorted(args.keys()) t = Texttable() t.add_rows([["Parameter", "Value"]]) t.add_rows([[k.replace("_", " ").capitalize(), args[k]] fo...
[ "def", "tab_printer", "(", "args", ")", ":", "args", "=", "vars", "(", "args", ")", "keys", "=", "sorted", "(", "args", ".", "keys", "(", ")", ")", "t", "=", "Texttable", "(", ")", "t", ".", "add_rows", "(", "[", "[", "\"Parameter\"", ",", "\"Val...
https://github.com/benedekrozemberczki/GAM/blob/cd66582215d6f06441ce93981e76af0214b292f3/src/utils.py#L11-L21
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/sysconfig.py
python
get_config_vars
(*args)
With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up...
With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up...
[ "With", "no", "arguments", "return", "a", "dictionary", "of", "all", "configuration", "variables", "relevant", "for", "the", "current", "platform", ".", "On", "Unix", "this", "means", "every", "variable", "defined", "in", "Python", "s", "installed", "Makefile", ...
def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. On Unix, this means every variable defined in Python's installed Makefile; On Windows and Mac OS it's a much smaller set. With arguments, return a list of...
[ "def", "get_config_vars", "(", "*", "args", ")", ":", "global", "_CONFIG_VARS", "import", "re", "if", "_CONFIG_VARS", "is", "None", ":", "_CONFIG_VARS", "=", "{", "}", "_CONFIG_VARS", "[", "'prefix'", "]", "=", "_PREFIX", "_CONFIG_VARS", "[", "'exec_prefix'", ...
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/sysconfig.py#L375-L452
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
fabmetheus_utilities/geometry/geometry_utilities/matrix.py
python
getTransformedVector3
(tetragrid, vector3)
return getTransformedVector3Blindly(tetragrid, vector3)
Get the vector3 multiplied by a matrix.
Get the vector3 multiplied by a matrix.
[ "Get", "the", "vector3", "multiplied", "by", "a", "matrix", "." ]
def getTransformedVector3(tetragrid, vector3): 'Get the vector3 multiplied by a matrix.' if getIsIdentityTetragridOrNone(tetragrid): return vector3.copy() return getTransformedVector3Blindly(tetragrid, vector3)
[ "def", "getTransformedVector3", "(", "tetragrid", ",", "vector3", ")", ":", "if", "getIsIdentityTetragridOrNone", "(", "tetragrid", ")", ":", "return", "vector3", ".", "copy", "(", ")", "return", "getTransformedVector3Blindly", "(", "tetragrid", ",", "vector3", ")...
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/geometry/geometry_utilities/matrix.py#L351-L355
akshaybahadur21/Digit-Recognizer
703fa8728d4a053af37fe07a97169b776520e01b
Digit-Recognizer/Digit_Recognizer_DL.py
python
softmax
(z)
return sm, cache
[]
def softmax(z): cache = z z -= np.max(z) sm = (np.exp(z).T / np.sum(np.exp(z), axis=1)) return sm, cache
[ "def", "softmax", "(", "z", ")", ":", "cache", "=", "z", "z", "-=", "np", ".", "max", "(", "z", ")", "sm", "=", "(", "np", ".", "exp", "(", "z", ")", ".", "T", "/", "np", ".", "sum", "(", "np", ".", "exp", "(", "z", ")", ",", "axis", ...
https://github.com/akshaybahadur21/Digit-Recognizer/blob/703fa8728d4a053af37fe07a97169b776520e01b/Digit-Recognizer/Digit_Recognizer_DL.py#L5-L9
vertexproject/synapse
8173f43cb5fba5ca2648d12a659afb432139b0a7
synapse/lib/hive.py
python
Hive.open
(self, full)
return await self._getHiveNode(full)
Open and return a hive Node(). Args: full (tuple): A full path tuple. Returns: Node: A Hive node.
Open and return a hive Node().
[ "Open", "and", "return", "a", "hive", "Node", "()", "." ]
async def open(self, full): ''' Open and return a hive Node(). Args: full (tuple): A full path tuple. Returns: Node: A Hive node. ''' return await self._getHiveNode(full)
[ "async", "def", "open", "(", "self", ",", "full", ")", ":", "return", "await", "self", ".", "_getHiveNode", "(", "full", ")" ]
https://github.com/vertexproject/synapse/blob/8173f43cb5fba5ca2648d12a659afb432139b0a7/synapse/lib/hive.py#L299-L309
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/tamper/versionedmorekeywords.py
python
tamper
(payload, **kwargs)
return retVal
Encloses each keyword with versioned MySQL comment Requirement: * MySQL >= 5.1.13 Tested against: * MySQL 5.1.56, 5.5.11 Notes: * Useful to bypass several web application firewalls when the back-end database management system is MySQL >>> tamper('1 UNION ALL SELECT ...
Encloses each keyword with versioned MySQL comment
[ "Encloses", "each", "keyword", "with", "versioned", "MySQL", "comment" ]
def tamper(payload, **kwargs): """ Encloses each keyword with versioned MySQL comment Requirement: * MySQL >= 5.1.13 Tested against: * MySQL 5.1.56, 5.5.11 Notes: * Useful to bypass several web application firewalls when the back-end database management system is...
[ "def", "tamper", "(", "payload", ",", "*", "*", "kwargs", ")", ":", "def", "process", "(", "match", ")", ":", "word", "=", "match", ".", "group", "(", "'word'", ")", "if", "word", ".", "upper", "(", ")", "in", "kb", ".", "keywords", "and", "word"...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/tamper/versionedmorekeywords.py#L22-L53
Yuliang-Liu/Box_Discretization_Network
5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6
maskrcnn_benchmark/utils/c2_model_loading.py
python
load_resnet_c2_format
(cfg, f)
return dict(model=state_dict)
[]
def load_resnet_c2_format(cfg, f): state_dict = _load_c2_pickled_weights(f) conv_body = cfg.MODEL.BACKBONE.CONV_BODY arch = conv_body.replace("-C4", "").replace("-C5", "").replace("-FPN", "") arch = arch.replace("-RETINANET", "").replace("-PAN", "") stages = _C2_STAGE_NAMES[arch] state_dict = _r...
[ "def", "load_resnet_c2_format", "(", "cfg", ",", "f", ")", ":", "state_dict", "=", "_load_c2_pickled_weights", "(", "f", ")", "conv_body", "=", "cfg", ".", "MODEL", ".", "BACKBONE", ".", "CONV_BODY", "arch", "=", "conv_body", ".", "replace", "(", "\"-C4\"", ...
https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/utils/c2_model_loading.py#L166-L173
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/method/report_common.py
python
responseForHref
(request, responses, href, resource, propertiesForResource, propertyreq, isowner=True, calendar=None, timezone=None, vcard=None)
return d
Create an appropriate property status response for the given resource. @param request: the L{IRequest} for the current request. @param responses: the list of responses to append the result of this method to. @param href: the L{HRef} element of the resource being targeted. @param resource: the L{CalDAVR...
Create an appropriate property status response for the given resource.
[ "Create", "an", "appropriate", "property", "status", "response", "for", "the", "given", "resource", "." ]
def responseForHref(request, responses, href, resource, propertiesForResource, propertyreq, isowner=True, calendar=None, timezone=None, vcard=None): """ Create an appropriate property status response for the given resource. @param request: the L{IRequest} for the current request. @param responses: the ...
[ "def", "responseForHref", "(", "request", ",", "responses", ",", "href", ",", "resource", ",", "propertiesForResource", ",", "propertyreq", ",", "isowner", "=", "True", ",", "calendar", "=", "None", ",", "timezone", "=", "None", ",", "vcard", "=", "None", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/method/report_common.py#L133-L181
pyfa-org/Pyfa
feaa52c36beeda21ab380fc74d8f871b81d49729
eos/gamedata.py
python
Effect.activeByDefault
(self, value)
Just assign the input values to the activeByDefault attribute. You *could* do something more interesting here if you wanted.
Just assign the input values to the activeByDefault attribute. You *could* do something more interesting here if you wanted.
[ "Just", "assign", "the", "input", "values", "to", "the", "activeByDefault", "attribute", ".", "You", "*", "could", "*", "do", "something", "more", "interesting", "here", "if", "you", "wanted", "." ]
def activeByDefault(self, value): """ Just assign the input values to the activeByDefault attribute. You *could* do something more interesting here if you wanted. """ self.__activeByDefault = value
[ "def", "activeByDefault", "(", "self", ",", "value", ")", ":", "self", ".", "__activeByDefault", "=", "value" ]
https://github.com/pyfa-org/Pyfa/blob/feaa52c36beeda21ab380fc74d8f871b81d49729/eos/gamedata.py#L117-L122
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pip/vcs/git.py
python
Git.get_short_refs
(self, location)
return rv
Return map of named refs (branches or tags) to commit hashes.
Return map of named refs (branches or tags) to commit hashes.
[ "Return", "map", "of", "named", "refs", "(", "branches", "or", "tags", ")", "to", "commit", "hashes", "." ]
def get_short_refs(self, location): """Return map of named refs (branches or tags) to commit hashes.""" rv = {} for commit, ref in self.get_full_refs(location): ref_name = None if self.is_ref_remote(ref): ref_name = ref[len('refs/remotes/'):] e...
[ "def", "get_short_refs", "(", "self", ",", "location", ")", ":", "rv", "=", "{", "}", "for", "commit", ",", "ref", "in", "self", ".", "get_full_refs", "(", "location", ")", ":", "ref_name", "=", "None", "if", "self", ".", "is_ref_remote", "(", "ref", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/vcs/git.py#L203-L216
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/logging/__init__.py
python
PlaceHolder.__init__
(self, alogger)
Initialize with the specified logger being a child of this placeholder.
Initialize with the specified logger being a child of this placeholder.
[ "Initialize", "with", "the", "specified", "logger", "being", "a", "child", "of", "this", "placeholder", "." ]
def __init__(self, alogger): """ Initialize with the specified logger being a child of this placeholder. """ #self.loggers = [alogger] self.loggerMap = { alogger : None }
[ "def", "__init__", "(", "self", ",", "alogger", ")", ":", "#self.loggers = [alogger]", "self", ".", "loggerMap", "=", "{", "alogger", ":", "None", "}" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/logging/__init__.py#L938-L943
amymcgovern/pyparrot
bf4775ec1199b282e4edde1e4a8e018dcc8725e0
pyparrot/utils/vlc.py
python
libvlc_log_unset
(p_instance)
return f(p_instance)
Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. This is rarely needed as the callback is implicitly unset when the instance is destroyed. @note: This function will wait for any pending callbacks invocation to complete (causing a deadlock if called f...
Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. This is rarely needed as the callback is implicitly unset when the instance is destroyed.
[ "Unsets", "the", "logging", "callback", ".", "This", "function", "deregisters", "the", "logging", "callback", "for", "a", "LibVLC", "instance", ".", "This", "is", "rarely", "needed", "as", "the", "callback", "is", "implicitly", "unset", "when", "the", "instanc...
def libvlc_log_unset(p_instance): '''Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. This is rarely needed as the callback is implicitly unset when the instance is destroyed. @note: This function will wait for any pending callbacks invocation to ...
[ "def", "libvlc_log_unset", "(", "p_instance", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_log_unset'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_log_unset'", ",", "(", "(", "1", ",", ")", ",", ")", ",", "None", ",", "None", "...
https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L4580-L4593
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/escprober.py
python
EscCharSetProber.__init__
(self)
[]
def __init__(self): CharSetProber.__init__(self) self._mCodingSM = [ CodingStateMachine(HZSMModel), CodingStateMachine(ISO2022CNSMModel), CodingStateMachine(ISO2022JPSMModel), CodingStateMachine(ISO2022KRSMModel) ] self.reset()
[ "def", "__init__", "(", "self", ")", ":", "CharSetProber", ".", "__init__", "(", "self", ")", "self", ".", "_mCodingSM", "=", "[", "CodingStateMachine", "(", "HZSMModel", ")", ",", "CodingStateMachine", "(", "ISO2022CNSMModel", ")", ",", "CodingStateMachine", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/escprober.py#L37-L45
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/cells/messaging.py
python
MessageRunner.instance_destroy_at_top
(self, ctxt, instance)
Destroy an instance at the top level cell.
Destroy an instance at the top level cell.
[ "Destroy", "an", "instance", "at", "the", "top", "level", "cell", "." ]
def instance_destroy_at_top(self, ctxt, instance): """Destroy an instance at the top level cell.""" message = _BroadcastMessage(self, ctxt, 'instance_destroy_at_top', dict(instance=instance), 'up', run_locally=False) message...
[ "def", "instance_destroy_at_top", "(", "self", ",", "ctxt", ",", "instance", ")", ":", "message", "=", "_BroadcastMessage", "(", "self", ",", "ctxt", ",", "'instance_destroy_at_top'", ",", "dict", "(", "instance", "=", "instance", ")", ",", "'up'", ",", "run...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/cells/messaging.py#L1110-L1115
jimmysong/programmingbitcoin
3fba6b992ece443e4256df057595cfbe91edda75
code-ch08/tx.py
python
Tx.hash
(self)
return hash256(self.serialize())[::-1]
Binary hash of the legacy serialization
Binary hash of the legacy serialization
[ "Binary", "hash", "of", "the", "legacy", "serialization" ]
def hash(self): '''Binary hash of the legacy serialization''' return hash256(self.serialize())[::-1]
[ "def", "hash", "(", "self", ")", ":", "return", "hash256", "(", "self", ".", "serialize", "(", ")", ")", "[", ":", ":", "-", "1", "]" ]
https://github.com/jimmysong/programmingbitcoin/blob/3fba6b992ece443e4256df057595cfbe91edda75/code-ch08/tx.py#L100-L102
bloomberg/phabricator-tools
09bd1587fe8945d93a891162fd4c89640c6fada7
py/abd/abdt_branchmock.py
python
BranchMock.verify_review_branch_base
(self)
Raise exception if review branch has invalid base.
Raise exception if review branch has invalid base.
[ "Raise", "exception", "if", "review", "branch", "has", "invalid", "base", "." ]
def verify_review_branch_base(self): """Raise exception if review branch has invalid base.""" if not self._data.is_base_ok: raise abdt_exception.MissingBaseException( self._data.review_branch, 'description', self._data.base_branch)
[ "def", "verify_review_branch_base", "(", "self", ")", ":", "if", "not", "self", ".", "_data", ".", "is_base_ok", ":", "raise", "abdt_exception", ".", "MissingBaseException", "(", "self", ".", "_data", ".", "review_branch", ",", "'description'", ",", "self", "....
https://github.com/bloomberg/phabricator-tools/blob/09bd1587fe8945d93a891162fd4c89640c6fada7/py/abd/abdt_branchmock.py#L318-L324
johntruckenbrodt/pyroSAR
efac51134ba42d20120b259f968afe5a4ddcc46a
pyroSAR/gamma/parser_demo.py
python
ph_slope_base
(int_in, SLC_par, OFF_par, base, int_out, int_type='-', inverse='-', logpath=None, outdir=None, shellscript=None)
| Subtract/add interferogram flat-Earth phase trend as estimated from initial baseline | Copyright 2006, Gamma Remote Sensing, v4.4 3-Nov-2006 clw Parameters ---------- int_in: (input) interferogram (FCOMPLEX) or unwrapped phase (FLOAT) (unflattened) SLC_par: (input) ISP parameter f...
| Subtract/add interferogram flat-Earth phase trend as estimated from initial baseline | Copyright 2006, Gamma Remote Sensing, v4.4 3-Nov-2006 clw
[ "|", "Subtract", "/", "add", "interferogram", "flat", "-", "Earth", "phase", "trend", "as", "estimated", "from", "initial", "baseline", "|", "Copyright", "2006", "Gamma", "Remote", "Sensing", "v4", ".", "4", "3", "-", "Nov", "-", "2006", "clw" ]
def ph_slope_base(int_in, SLC_par, OFF_par, base, int_out, int_type='-', inverse='-', logpath=None, outdir=None, shellscript=None): """ | Subtract/add interferogram flat-Earth phase trend as estimated from initial baseline | Copyright 2006, Gamma Remote Sensing, v4.4 3-Nov-2006 clw Pa...
[ "def", "ph_slope_base", "(", "int_in", ",", "SLC_par", ",", "OFF_par", ",", "base", ",", "int_out", ",", "int_type", "=", "'-'", ",", "inverse", "=", "'-'", ",", "logpath", "=", "None", ",", "outdir", "=", "None", ",", "shellscript", "=", "None", ")", ...
https://github.com/johntruckenbrodt/pyroSAR/blob/efac51134ba42d20120b259f968afe5a4ddcc46a/pyroSAR/gamma/parser_demo.py#L3590-L3621
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
src/plugins/android/graph_helper_worker.py
python
GraphHelperWorker.fn_get_class_method_desc_from_string
(self, input_string)
return [class_part, method_part, desc_part]
Gets class/method/descriptor parts from a string. A method call in smali is of the format classname->methodname descriptor (without the space) For example: Landroid/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object; In the above example: The cl...
Gets class/method/descriptor parts from a string. A method call in smali is of the format classname->methodname descriptor (without the space) For example: Landroid/util/ArrayMap;->get(Ljava/lang/Object;)Ljava/lang/Object; In the above example: The cl...
[ "Gets", "class", "/", "method", "/", "descriptor", "parts", "from", "a", "string", ".", "A", "method", "call", "in", "smali", "is", "of", "the", "format", "classname", "-", ">", "methodname", "descriptor", "(", "without", "the", "space", ")", "For", "exa...
def fn_get_class_method_desc_from_string(self, input_string): """Gets class/method/descriptor parts from a string. A method call in smali is of the format classname->methodname descriptor (without the space) For example: Landroid/util/ArrayMap;->get(Ljava/lang/Ob...
[ "def", "fn_get_class_method_desc_from_string", "(", "self", ",", "input_string", ")", ":", "# Assign default values of \"don't care\" to method and descriptor.", "method_part", "=", "'.*'", "desc_part", "=", "'.*'", "# In a smali method specification, the class and method must be", "...
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/src/plugins/android/graph_helper_worker.py#L511-L580
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py
python
masked_invalid
(a, copy=True)
return result
Mask an array where invalid values occur (NaNs or infs). This function is a shortcut to ``masked_where``, with `condition` = ~(np.isfinite(a)). Any pre-existing mask is conserved. Only applies to arrays with a dtype where NaNs or infs make sense (i.e. floating point types), but accepts any array_like o...
Mask an array where invalid values occur (NaNs or infs).
[ "Mask", "an", "array", "where", "invalid", "values", "occur", "(", "NaNs", "or", "infs", ")", "." ]
def masked_invalid(a, copy=True): """ Mask an array where invalid values occur (NaNs or infs). This function is a shortcut to ``masked_where``, with `condition` = ~(np.isfinite(a)). Any pre-existing mask is conserved. Only applies to arrays with a dtype where NaNs or infs make sense (i.e. float...
[ "def", "masked_invalid", "(", "a", ",", "copy", "=", "True", ")", ":", "a", "=", "np", ".", "array", "(", "a", ",", "copy", "=", "copy", ",", "subok", "=", "True", ")", "mask", "=", "getattr", "(", "a", ",", "'_mask'", ",", "None", ")", "if", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/core.py#L2331-L2370
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/versioned_controller_service.py
python
VersionedControllerService.component_type
(self)
return self._component_type
Gets the component_type of this VersionedControllerService. :return: The component_type of this VersionedControllerService. :rtype: str
Gets the component_type of this VersionedControllerService.
[ "Gets", "the", "component_type", "of", "this", "VersionedControllerService", "." ]
def component_type(self): """ Gets the component_type of this VersionedControllerService. :return: The component_type of this VersionedControllerService. :rtype: str """ return self._component_type
[ "def", "component_type", "(", "self", ")", ":", "return", "self", ".", "_component_type" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/versioned_controller_service.py#L337-L344
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/cmath.py
python
cos
(x)
return cosh(complex(-x.imag, x.real))
Return the cosine of x.
Return the cosine of x.
[ "Return", "the", "cosine", "of", "x", "." ]
def cos(x): """Return the cosine of x.""" return cosh(complex(-x.imag, x.real))
[ "def", "cos", "(", "x", ")", ":", "return", "cosh", "(", "complex", "(", "-", "x", ".", "imag", ",", "x", ".", "real", ")", ")" ]
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/cmath.py#L369-L371
DxCx/plugin.video.9anime
34358c2f701e5ddf19d3276926374a16f63f7b6a
resources/lib/ui/js2py/es6/babel.py
python
PyJs_anonymous_3559_
(require, module, exports, this, arguments, var=var)
[]
def PyJs_anonymous_3559_(require, module, exports, this, arguments, var=var): var = Scope({u'this':this, u'require':require, u'exports':exports, u'module':module, u'arguments':arguments}, var) var.registers([u'baseIndexOf', u'exports', u'basePullAll', u'baseIndexOfWith', u'arrayProto', u'require', u'arrayMap', ...
[ "def", "PyJs_anonymous_3559_", "(", "require", ",", "module", ",", "exports", ",", "this", ",", "arguments", ",", "var", "=", "var", ")", ":", "var", "=", "Scope", "(", "{", "u'this'", ":", "this", ",", "u'require'", ":", "require", ",", "u'exports'", ...
https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/es6/babel.py#L40299-L40333
fastnlp/fitlog
ba9547a56f4855a2d9cf26ae709d01922befa077
fitlog/fastserver/line_app.py
python
line_index
()
return render_template('line.html', data=data, column_order=column_order, column_dict=column_dict, hidden_columns=hidden_columns)
[]
def line_index(): ids = request.values['ids'] # 取出所有的logs flat_logs = [all_data['data'][id].copy() for id in ids.split(',')] hidden_columns = all_data['hidden_columns'].copy() # 删除不是共有的部分 value_dict_count = defaultdict(list) # 每个key有多少个 for log in flat_logs: for key in log.keys():...
[ "def", "line_index", "(", ")", ":", "ids", "=", "request", ".", "values", "[", "'ids'", "]", "# 取出所有的logs", "flat_logs", "=", "[", "all_data", "[", "'data'", "]", "[", "id", "]", ".", "copy", "(", ")", "for", "id", "in", "ids", ".", "split", "(", ...
https://github.com/fastnlp/fitlog/blob/ba9547a56f4855a2d9cf26ae709d01922befa077/fitlog/fastserver/line_app.py#L14-L55
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/mail/mail.py
python
DomainWithDefaultDict.__len__
(self)
return len(self.domains)
Return the number of domains in this dictionary. @rtype: L{int} @return: The number of domains in this dictionary.
Return the number of domains in this dictionary.
[ "Return", "the", "number", "of", "domains", "in", "this", "dictionary", "." ]
def __len__(self): """ Return the number of domains in this dictionary. @rtype: L{int} @return: The number of domains in this dictionary. """ return len(self.domains)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "domains", ")" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/mail/mail.py#L158-L165
rcorcs/NatI
fdf014f4292afdc95250add7b6658468043228e1
en/wordnet/wordnet.py
python
Word.__str__
(self)
return self.form + "(" + abbrs[self.pos] + ")"
Return a human-readable representation. >>> str(N['dog']) 'dog(n.)'
Return a human-readable representation. >>> str(N['dog']) 'dog(n.)'
[ "Return", "a", "human", "-", "readable", "representation", ".", ">>>", "str", "(", "N", "[", "dog", "]", ")", "dog", "(", "n", ".", ")" ]
def __str__(self): """Return a human-readable representation. >>> str(N['dog']) 'dog(n.)' """ abbrs = {NOUN: 'n.', VERB: 'v.', ADJECTIVE: 'adj.', ADVERB: 'adv.'} return self.form + "(" + abbrs[self.pos] + ")"
[ "def", "__str__", "(", "self", ")", ":", "abbrs", "=", "{", "NOUN", ":", "'n.'", ",", "VERB", ":", "'v.'", ",", "ADJECTIVE", ":", "'adj.'", ",", "ADVERB", ":", "'adv.'", "}", "return", "self", ".", "form", "+", "\"(\"", "+", "abbrs", "[", "self", ...
https://github.com/rcorcs/NatI/blob/fdf014f4292afdc95250add7b6658468043228e1/en/wordnet/wordnet.py#L286-L293
markovmodel/PyEMMA
e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3
pyemma/coordinates/data/_base/datasource.py
python
DataSourceIterator.return_traj_index
(self, value)
Setter for return_traj_index, determining if the trajectory index gets returned in the iteration loop. Parameters ---------- value : bool True if it should be returned, otherwise False
Setter for return_traj_index, determining if the trajectory index gets returned in the iteration loop. Parameters ---------- value : bool True if it should be returned, otherwise False
[ "Setter", "for", "return_traj_index", "determining", "if", "the", "trajectory", "index", "gets", "returned", "in", "the", "iteration", "loop", ".", "Parameters", "----------", "value", ":", "bool", "True", "if", "it", "should", "be", "returned", "otherwise", "Fa...
def return_traj_index(self, value): """ Setter for return_traj_index, determining if the trajectory index gets returned in the iteration loop. Parameters ---------- value : bool True if it should be returned, otherwise False """ self.state.return_traji...
[ "def", "return_traj_index", "(", "self", ",", "value", ")", ":", "self", ".", "state", ".", "return_trajindex", "=", "value" ]
https://github.com/markovmodel/PyEMMA/blob/e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3/pyemma/coordinates/data/_base/datasource.py#L986-L994
Xonshiz/anime-dl
d40f0ca11b894dbbf17edbb9d0f069e741be902f
anime_dl/external/utils.py
python
get_elements_by_attribute
(attribute, value, html, escape_value=True)
return retlist
Return the content of the tag with the specified attribute in the passed HTML document
Return the content of the tag with the specified attribute in the passed HTML document
[ "Return", "the", "content", "of", "the", "tag", "with", "the", "specified", "attribute", "in", "the", "passed", "HTML", "document" ]
def get_elements_by_attribute(attribute, value, html, escape_value=True): """Return the content of the tag with the specified attribute in the passed HTML document""" value = re.escape(value) if escape_value else value retlist = [] for m in re.finditer(r'''(?xs) <([a-zA-Z0-9:._-]+) (?...
[ "def", "get_elements_by_attribute", "(", "attribute", ",", "value", ",", "html", ",", "escape_value", "=", "True", ")", ":", "value", "=", "re", ".", "escape", "(", "value", ")", "if", "escape_value", "else", "value", "retlist", "=", "[", "]", "for", "m"...
https://github.com/Xonshiz/anime-dl/blob/d40f0ca11b894dbbf17edbb9d0f069e741be902f/anime_dl/external/utils.py#L358-L380
pyeve/eve
30a7cc80e9a1b40665cd7e7ef93a470ae692da02
eve/flaskapp.py
python
Eve.validate_methods
(self, allowed, proposed, item)
Compares allowed and proposed methods, raising a `ConfigException` when they don't match. :param allowed: a list of supported (allowed) methods. :param proposed: a list of proposed methods. :param item: name of the item to which the methods would be applied. Used wh...
Compares allowed and proposed methods, raising a `ConfigException` when they don't match.
[ "Compares", "allowed", "and", "proposed", "methods", "raising", "a", "ConfigException", "when", "they", "don", "t", "match", "." ]
def validate_methods(self, allowed, proposed, item): """Compares allowed and proposed methods, raising a `ConfigException` when they don't match. :param allowed: a list of supported (allowed) methods. :param proposed: a list of proposed methods. :param item: name of the item to ...
[ "def", "validate_methods", "(", "self", ",", "allowed", ",", "proposed", ",", "item", ")", ":", "diff", "=", "set", "(", "proposed", ")", "-", "set", "(", "allowed", ")", "if", "diff", ":", "raise", "ConfigException", "(", "\"Unallowed %s method(s): %s. \"",...
https://github.com/pyeve/eve/blob/30a7cc80e9a1b40665cd7e7ef93a470ae692da02/eve/flaskapp.py#L426-L440
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/pwiki/customtreectrl.py
python
CustomTreeCtrl.GetNextVisible
(self, item)
return None
Returns the next visible item.
Returns the next visible item.
[ "Returns", "the", "next", "visible", "item", "." ]
def GetNextVisible(self, item): """Returns the next visible item.""" if not item: raise Exception("\nERROR: Invalid Tree Item. ") id = item while id: id = self.GetNext(id) if id and self.IsVisible(id): return id ...
[ "def", "GetNextVisible", "(", "self", ",", "item", ")", ":", "if", "not", "item", ":", "raise", "Exception", "(", "\"\\nERROR: Invalid Tree Item. \"", ")", "id", "=", "item", "while", "id", ":", "id", "=", "self", ".", "GetNext", "(", "id", ")", "if", ...
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/customtreectrl.py#L3147-L3160
tensorflow/mesh
57ed4018e6a173952501b074daabad32b6449f3d
mesh_tensorflow/transformer/transformer_layers.py
python
relative_position_spans
(context, num_sentinels=gin.REQUIRED)
return dec_to_enc_pos - encoder_pos
Compute relative positions between inputs and targets. Used by enc_dec_attention_bias. Assumes that inputs and targets were generated by a span-filling objective: The inputs consist of the original text with some spans removed and replaced by single sentinels. The targets consist of the dropped spans, each ...
Compute relative positions between inputs and targets.
[ "Compute", "relative", "positions", "between", "inputs", "and", "targets", "." ]
def relative_position_spans(context, num_sentinels=gin.REQUIRED): """Compute relative positions between inputs and targets. Used by enc_dec_attention_bias. Assumes that inputs and targets were generated by a span-filling objective: The inputs consist of the original text with some spans removed and replaced ...
[ "def", "relative_position_spans", "(", "context", ",", "num_sentinels", "=", "gin", ".", "REQUIRED", ")", ":", "decoder_id", "=", "context", ".", "inputs", "encoder_id", "=", "context", ".", "encoder_inputs", "decoder_length", "=", "context", ".", "length_dim", ...
https://github.com/tensorflow/mesh/blob/57ed4018e6a173952501b074daabad32b6449f3d/mesh_tensorflow/transformer/transformer_layers.py#L617-L680
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/simulators/middlewares/ros.py
python
ROS.load_config_file
(filename, namespace=None)
Load a control configuration YAML file. Args: filename (str): path to the YAML file. namespace (str): default namespace. Returns: list[dict[str,dict[str:dict[str:dict]]], str]: [{robot_name: {param_name: value}}, namespace]
Load a control configuration YAML file.
[ "Load", "a", "control", "configuration", "YAML", "file", "." ]
def load_config_file(filename, namespace=None): """ Load a control configuration YAML file. Args: filename (str): path to the YAML file. namespace (str): default namespace. Returns: list[dict[str,dict[str:dict[str:dict]]], str]: [{robot_name: {param_...
[ "def", "load_config_file", "(", "filename", ",", "namespace", "=", "None", ")", ":", "params", "=", "rosparam", ".", "load_file", "(", "filename", ",", "default_namespace", "=", "namespace", ")", "params", "=", "params", "[", "0", "]", "namespace", "=", "p...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/middlewares/ros.py#L949-L965
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/IO/zip_interface.py
python
get_frames_from_zip
(file_name_zip, text_func=None, progress_func=None, logger=Logger())
return data
Open the csv files from a zip file :param file_name_zip: name of the zip file :param text_func: pointer to function that prints the names :param progress_func: pointer to function that prints the progress 0~100 :param logger: :return: list of DataFrames
Open the csv files from a zip file :param file_name_zip: name of the zip file :param text_func: pointer to function that prints the names :param progress_func: pointer to function that prints the progress 0~100 :param logger: :return: list of DataFrames
[ "Open", "the", "csv", "files", "from", "a", "zip", "file", ":", "param", "file_name_zip", ":", "name", "of", "the", "zip", "file", ":", "param", "text_func", ":", "pointer", "to", "function", "that", "prints", "the", "names", ":", "param", "progress_func",...
def get_frames_from_zip(file_name_zip, text_func=None, progress_func=None, logger=Logger()): """ Open the csv files from a zip file :param file_name_zip: name of the zip file :param text_func: pointer to function that prints the names :param progress_func: pointer to function that prints the progres...
[ "def", "get_frames_from_zip", "(", "file_name_zip", ",", "text_func", "=", "None", ",", "progress_func", "=", "None", ",", "logger", "=", "Logger", "(", ")", ")", ":", "# open the zip file", "try", ":", "zip_file_pointer", "=", "zipfile", ".", "ZipFile", "(", ...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/IO/zip_interface.py#L148-L195
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/pickle.py
python
_Pickler.__init__
(self, file, protocol=None, *, fix_imports=True, buffer_callback=None)
This takes a binary file for writing a pickle data stream. The optional *protocol* argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2, 3, 4 and 5. The default protocol is 4. It was introduced in Python 3.4, and is incompatible with previous versions. ...
This takes a binary file for writing a pickle data stream.
[ "This", "takes", "a", "binary", "file", "for", "writing", "a", "pickle", "data", "stream", "." ]
def __init__(self, file, protocol=None, *, fix_imports=True, buffer_callback=None): """This takes a binary file for writing a pickle data stream. The optional *protocol* argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2, 3, 4 and 5. T...
[ "def", "__init__", "(", "self", ",", "file", ",", "protocol", "=", "None", ",", "*", ",", "fix_imports", "=", "True", ",", "buffer_callback", "=", "None", ")", ":", "if", "protocol", "is", "None", ":", "protocol", "=", "DEFAULT_PROTOCOL", "if", "protocol...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/pickle.py#L409-L464
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/GL/INTEL/performance_query.py
python
glInitPerformanceQueryINTEL
()
return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
Return boolean indicating whether this extension is available
[ "Return", "boolean", "indicating", "whether", "this", "extension", "is", "available" ]
def glInitPerformanceQueryINTEL(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME )
[ "def", "glInitPerformanceQueryINTEL", "(", ")", ":", "from", "OpenGL", "import", "extensions", "return", "extensions", ".", "hasGLExtension", "(", "_EXTENSION_NAME", ")" ]
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/INTEL/performance_query.py#L58-L61
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/tools/hacking.py
python
cinder_import_module_only
(logical_line)
Check for import module only. cinder HACKING guide recommends importing only modules: Do not import objects, only modules N302 import only modules N303 Invalid Import N304 Relative Import
Check for import module only.
[ "Check", "for", "import", "module", "only", "." ]
def cinder_import_module_only(logical_line): """Check for import module only. cinder HACKING guide recommends importing only modules: Do not import objects, only modules N302 import only modules N303 Invalid Import N304 Relative Import """ def importModuleCheck(mod, parent=None, added=F...
[ "def", "cinder_import_module_only", "(", "logical_line", ")", ":", "def", "importModuleCheck", "(", "mod", ",", "parent", "=", "None", ",", "added", "=", "False", ")", ":", "\"\"\"\n If can't find module on first try, recursively check for relative\n imports\n ...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/tools/hacking.py#L125-L202
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/_mode_gcm.py
python
GcmMode.decrypt
(self, ciphertext, output=None)
return self._cipher.decrypt(ciphertext, output=output)
Decrypt data with the key and the parameters set at initialization. A cipher object is stateful: once you have decrypted a message you cannot decrypt (or encrypt) another message with the same object. The data to decrypt can be broken up in two or more pieces and `decrypt` can ...
Decrypt data with the key and the parameters set at initialization.
[ "Decrypt", "data", "with", "the", "key", "and", "the", "parameters", "set", "at", "initialization", "." ]
def decrypt(self, ciphertext, output=None): """Decrypt data with the key and the parameters set at initialization. A cipher object is stateful: once you have decrypted a message you cannot decrypt (or encrypt) another message with the same object. The data to decrypt can be bro...
[ "def", "decrypt", "(", "self", ",", "ciphertext", ",", "output", "=", "None", ")", ":", "if", "self", ".", "decrypt", "not", "in", "self", ".", "_next", ":", "raise", "TypeError", "(", "\"decrypt() can only be called\"", "\" after initialization or an update()\"",...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Cipher/_mode_gcm.py#L387-L432
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/stream/makeNotation.py
python
moveNotesToVoices
(source: 'music21.stream.Stream', classFilterList=('GeneralNote',))
Move notes into voices. Happens inplace always. Returns None
Move notes into voices. Happens inplace always. Returns None
[ "Move", "notes", "into", "voices", ".", "Happens", "inplace", "always", ".", "Returns", "None" ]
def moveNotesToVoices(source: 'music21.stream.Stream', classFilterList=('GeneralNote',)): ''' Move notes into voices. Happens inplace always. Returns None ''' from music21.stream import Voice dst = Voice() # cast to list so source can be edited. affectedElements = list(source.getElementsB...
[ "def", "moveNotesToVoices", "(", "source", ":", "'music21.stream.Stream'", ",", "classFilterList", "=", "(", "'GeneralNote'", ",", ")", ")", ":", "from", "music21", ".", "stream", "import", "Voice", "dst", "=", "Voice", "(", ")", "# cast to list so source can be e...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/stream/makeNotation.py#L1551-L1564
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/plugins/parseword.py
python
open_wordfile
(app, filename)
return app.Documents.Open(filename, ReadOnly=True, AddToRecentFiles=False, Visible=False, NoEncodingDialog=True)
Open given Word file with application object.
Open given Word file with application object.
[ "Open", "given", "Word", "file", "with", "application", "object", "." ]
def open_wordfile (app, filename): """Open given Word file with application object.""" return app.Documents.Open(filename, ReadOnly=True, AddToRecentFiles=False, Visible=False, NoEncodingDialog=True)
[ "def", "open_wordfile", "(", "app", ",", "filename", ")", ":", "return", "app", ".", "Documents", ".", "Open", "(", "filename", ",", "ReadOnly", "=", "True", ",", "AddToRecentFiles", "=", "False", ",", "Visible", "=", "False", ",", "NoEncodingDialog", "=",...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/plugins/parseword.py#L93-L96
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
exercises/1901010064/d12/mymodule/stats_word.py
python
stats_text_cn
(text,count)
统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组
统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组
[ "统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组" ]
def stats_text_cn(text,count): """统计参数中每个中文汉字出现的次数,最后返回一个按字频降序排列的数组""" if isinstance(text,str): string=text text_0=re.sub('[a-zA-Z0-9’!"#$%&\'()*+,-.:/:;<=>?@,。?★、…【】《》?“”‘’![\\]^_`{|}~\s]+', "", string) seg_list_0 = list(jieba.cut(text_0,cut_all=False)) seg_list_1=[] for...
[ "def", "stats_text_cn", "(", "text", ",", "count", ")", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "string", "=", "text", "text_0", "=", "re", ".", "sub", "(", "'[a-zA-Z0-9’!\"#$%&\\'()*+,-.:/:;<=>?@,。?★、…【】《》?“”‘’![\\\\]^_`{|}~\\s]+', \"\", string)...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901010064/d12/mymodule/stats_word.py#L9-L23
douban/pymesos
047c7bac8ca98772f63192aed063148fdf399b55
pymesos/interface.py
python
OperatorMaster.agentAdded
(self, agent_info)
Sent whenever an agent becomes known to it. This can happen when an agent registered for the first time, or reregistered after a master failover.
Sent whenever an agent becomes known to it. This can happen when an agent registered for the first time, or reregistered after a master failover.
[ "Sent", "whenever", "an", "agent", "becomes", "known", "to", "it", ".", "This", "can", "happen", "when", "an", "agent", "registered", "for", "the", "first", "time", "or", "reregistered", "after", "a", "master", "failover", "." ]
def agentAdded(self, agent_info): """ Sent whenever an agent becomes known to it. This can happen when an agent registered for the first time, or reregistered after a master failover. """
[ "def", "agentAdded", "(", "self", ",", "agent_info", ")", ":" ]
https://github.com/douban/pymesos/blob/047c7bac8ca98772f63192aed063148fdf399b55/pymesos/interface.py#L727-L731
CoinAlpha/hummingbot
36f6149c1644c07cd36795b915f38b8f49b798e7
hummingbot/connector/exchange/hitbtc/hitbtc_exchange.py
python
HitbtcExchange.__init__
(self, hitbtc_api_key: str, hitbtc_secret_key: str, trading_pairs: Optional[List[str]] = None, trading_required: bool = True )
:param hitbtc_api_key: The API key to connect to private HitBTC APIs. :param hitbtc_secret_key: The API secret. :param trading_pairs: The market trading pairs which to track order book data. :param trading_required: Whether actual trading is needed.
:param hitbtc_api_key: The API key to connect to private HitBTC APIs. :param hitbtc_secret_key: The API secret. :param trading_pairs: The market trading pairs which to track order book data. :param trading_required: Whether actual trading is needed.
[ ":", "param", "hitbtc_api_key", ":", "The", "API", "key", "to", "connect", "to", "private", "HitBTC", "APIs", ".", ":", "param", "hitbtc_secret_key", ":", "The", "API", "secret", ".", ":", "param", "trading_pairs", ":", "The", "market", "trading", "pairs", ...
def __init__(self, hitbtc_api_key: str, hitbtc_secret_key: str, trading_pairs: Optional[List[str]] = None, trading_required: bool = True ): """ :param hitbtc_api_key: The API key to connect to private HitBTC APIs. ...
[ "def", "__init__", "(", "self", ",", "hitbtc_api_key", ":", "str", ",", "hitbtc_secret_key", ":", "str", ",", "trading_pairs", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "trading_required", ":", "bool", "=", "True", ")", ":", ...
https://github.com/CoinAlpha/hummingbot/blob/36f6149c1644c07cd36795b915f38b8f49b798e7/hummingbot/connector/exchange/hitbtc/hitbtc_exchange.py#L75-L103
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/filters/histogram_filter.py
python
HistogramFilter.measurement_update
(self, h, z)
return self.p
Predict (a posteriori) the next state by incorporating the measurement :math:`z_t`. Args: h (callable class/function): probabilistic (nonlinear) measurement function to see measurement from region k. This function should return an array of the same shape as the one provided in argum...
Predict (a posteriori) the next state by incorporating the measurement :math:`z_t`.
[ "Predict", "(", "a", "posteriori", ")", "the", "next", "state", "by", "incorporating", "the", "measurement", ":", "math", ":", "z_t", "." ]
def measurement_update(self, h, z): """ Predict (a posteriori) the next state by incorporating the measurement :math:`z_t`. Args: h (callable class/function): probabilistic (nonlinear) measurement function to see measurement from region k. This function should return...
[ "def", "measurement_update", "(", "self", ",", "h", ",", "z", ")", ":", "# probability to see measurement z from region k (multiplication operation)", "self", ".", "p", "=", "h", "(", "z", ",", "self", ".", "p", ".", "shape", ")", "*", "self", ".", "p", "# n...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/filters/histogram_filter.py#L66-L83
andrewgodwin/channels-examples
5fa86dff822f411e1e6f01765c71eaf8d4f19977
news_collector/collector/views.py
python
index
(request)
return render(request, "index.html", {})
Main page is just a template
Main page is just a template
[ "Main", "page", "is", "just", "a", "template" ]
def index(request): """ Main page is just a template """ return render(request, "index.html", {})
[ "def", "index", "(", "request", ")", ":", "return", "render", "(", "request", ",", "\"index.html\"", ",", "{", "}", ")" ]
https://github.com/andrewgodwin/channels-examples/blob/5fa86dff822f411e1e6f01765c71eaf8d4f19977/news_collector/collector/views.py#L8-L12
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/auth/management/__init__.py
python
get_system_username
()
return result
Try to determine the current system user's username. :returns: The username as a unicode string, or an empty string if the username could not be determined.
Try to determine the current system user's username.
[ "Try", "to", "determine", "the", "current", "system", "user", "s", "username", "." ]
def get_system_username(): """ Try to determine the current system user's username. :returns: The username as a unicode string, or an empty string if the username could not be determined. """ try: result = getpass.getuser() except (ImportError, KeyError): # KeyError will...
[ "def", "get_system_username", "(", ")", ":", "try", ":", "result", "=", "getpass", ".", "getuser", "(", ")", "except", "(", "ImportError", ",", "KeyError", ")", ":", "# KeyError will be raised by os.getpwuid() (called by getuser())", "# if there is no corresponding entry ...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/auth/management/__init__.py#L89-L109
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/api/openstack/wsgi.py
python
deserializers
(**deserializers)
return decorator
Attaches deserializers to a method. This decorator associates a dictionary of deserializers with a method. Note that the function attributes are directly manipulated; the method is not wrapped.
Attaches deserializers to a method.
[ "Attaches", "deserializers", "to", "a", "method", "." ]
def deserializers(**deserializers): """Attaches deserializers to a method. This decorator associates a dictionary of deserializers with a method. Note that the function attributes are directly manipulated; the method is not wrapped. """ def decorator(func): if not hasattr(func, 'wsgi_...
[ "def", "deserializers", "(", "*", "*", "deserializers", ")", ":", "def", "decorator", "(", "func", ")", ":", "if", "not", "hasattr", "(", "func", ",", "'wsgi_deserializers'", ")", ":", "func", ".", "wsgi_deserializers", "=", "{", "}", "func", ".", "wsgi_...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/api/openstack/wsgi.py#L447-L460
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/OSC.py
python
OSCRequestHandler.finish
(self)
Finish handling OSCMessage. Send any reply returned by the callback(s) back to the originating client as an OSCMessage or OSCBundle
Finish handling OSCMessage. Send any reply returned by the callback(s) back to the originating client as an OSCMessage or OSCBundle
[ "Finish", "handling", "OSCMessage", ".", "Send", "any", "reply", "returned", "by", "the", "callback", "(", "s", ")", "back", "to", "the", "originating", "client", "as", "an", "OSCMessage", "or", "OSCBundle" ]
def finish(self): """Finish handling OSCMessage. Send any reply returned by the callback(s) back to the originating client as an OSCMessage or OSCBundle """ if self.server.return_port: self.client_address = (self.client_address[0], self.server.return_port) if len(self.replies) > 1: msg = OSCBundle(...
[ "def", "finish", "(", "self", ")", ":", "if", "self", ".", "server", ".", "return_port", ":", "self", ".", "client_address", "=", "(", "self", ".", "client_address", "[", "0", "]", ",", "self", ".", "server", ".", "return_port", ")", "if", "len", "("...
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/OSC.py#L1796-L1813
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/cmdline/utils/echo.py
python
echo
(message: str, fg: str = None, bold: bool = False, nl: bool = True, err: bool = False)
Log a message to the cmdline logger. .. note:: The message will be logged at the ``REPORT`` level but always without the log level prefix. :param message: the message to log. :param fg: if provided this will become the foreground color. :param bold: whether to print the messaformat bold. :param nl...
Log a message to the cmdline logger.
[ "Log", "a", "message", "to", "the", "cmdline", "logger", "." ]
def echo(message: str, fg: str = None, bold: bool = False, nl: bool = True, err: bool = False) -> None: """Log a message to the cmdline logger. .. note:: The message will be logged at the ``REPORT`` level but always without the log level prefix. :param message: the message to log. :param fg: if provid...
[ "def", "echo", "(", "message", ":", "str", ",", "fg", ":", "str", "=", "None", ",", "bold", ":", "bool", "=", "False", ",", "nl", ":", "bool", "=", "True", ",", "err", ":", "bool", "=", "False", ")", "->", "None", ":", "message", "=", "click", ...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/cmdline/utils/echo.py#L46-L58
pulp/pulp
a0a28d804f997b6f81c391378aff2e4c90183df9
nodes/common/pulp_node/manifest.py
python
RemoteManifest.fetch
(self)
Fetch the manifest file using the specified URL. :raise ManifestDownloadError: on downloading errors. :raise HTTPError: on URL errors. :raise ValueError: on json decoding errors
Fetch the manifest file using the specified URL. :raise ManifestDownloadError: on downloading errors. :raise HTTPError: on URL errors. :raise ValueError: on json decoding errors
[ "Fetch", "the", "manifest", "file", "using", "the", "specified", "URL", ".", ":", "raise", "ManifestDownloadError", ":", "on", "downloading", "errors", ".", ":", "raise", "HTTPError", ":", "on", "URL", "errors", ".", ":", "raise", "ValueError", ":", "on", ...
def fetch(self): """ Fetch the manifest file using the specified URL. :raise ManifestDownloadError: on downloading errors. :raise HTTPError: on URL errors. :raise ValueError: on json decoding errors """ listener = AggregatingEventListener() destination = o...
[ "def", "fetch", "(", "self", ")", ":", "listener", "=", "AggregatingEventListener", "(", ")", "destination", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "path", ")", ",", "'.'", "+", "MANIFEST_FILE_NAM...
https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/nodes/common/pulp_node/manifest.py#L260-L275
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/system_diagnostics_snapshot_dto.py
python
SystemDiagnosticsSnapshotDTO.content_repository_storage_usage
(self, content_repository_storage_usage)
Sets the content_repository_storage_usage of this SystemDiagnosticsSnapshotDTO. The content repository storage usage. :param content_repository_storage_usage: The content_repository_storage_usage of this SystemDiagnosticsSnapshotDTO. :type: list[StorageUsageDTO]
Sets the content_repository_storage_usage of this SystemDiagnosticsSnapshotDTO. The content repository storage usage.
[ "Sets", "the", "content_repository_storage_usage", "of", "this", "SystemDiagnosticsSnapshotDTO", ".", "The", "content", "repository", "storage", "usage", "." ]
def content_repository_storage_usage(self, content_repository_storage_usage): """ Sets the content_repository_storage_usage of this SystemDiagnosticsSnapshotDTO. The content repository storage usage. :param content_repository_storage_usage: The content_repository_storage_usage of this S...
[ "def", "content_repository_storage_usage", "(", "self", ",", "content_repository_storage_usage", ")", ":", "self", ".", "_content_repository_storage_usage", "=", "content_repository_storage_usage" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/system_diagnostics_snapshot_dto.py#L755-L764
open-telemetry/opentelemetry-python
f5d872050204685b5ef831d02ec593956820ebe6
exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py
python
_get_double_key_value
(key: str, value: float)
return model_pb2.KeyValue( key=key, v_float64=value, v_type=model_pb2.ValueType.FLOAT64 )
Returns jaeger double KeyValue.
Returns jaeger double KeyValue.
[ "Returns", "jaeger", "double", "KeyValue", "." ]
def _get_double_key_value(key: str, value: float) -> model_pb2.KeyValue: """Returns jaeger double KeyValue.""" return model_pb2.KeyValue( key=key, v_float64=value, v_type=model_pb2.ValueType.FLOAT64 )
[ "def", "_get_double_key_value", "(", "key", ":", "str", ",", "value", ":", "float", ")", "->", "model_pb2", ".", "KeyValue", ":", "return", "model_pb2", ".", "KeyValue", "(", "key", "=", "key", ",", "v_float64", "=", "value", ",", "v_type", "=", "model_p...
https://github.com/open-telemetry/opentelemetry-python/blob/f5d872050204685b5ef831d02ec593956820ebe6/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py#L136-L140
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
opy/compiler2/transformer.py
python
Transformer.if_stmt
(self, nodelist)
return If(tests, elseNode, lineno=nodelist[0][2])
[]
def if_stmt(self, nodelist): # if: test ':' suite ('elif' test ':' suite)* ['else' ':' suite] tests = [] for i in range(0, len(nodelist) - 3, 4): testNode = self.com_node(nodelist[i + 1]) suiteNode = self.com_node(nodelist[i + 3]) tests.append((testNode, suite...
[ "def", "if_stmt", "(", "self", ",", "nodelist", ")", ":", "# if: test ':' suite ('elif' test ':' suite)* ['else' ':' suite]", "tests", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "nodelist", ")", "-", "3", ",", "4", ")", ":", "test...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/opy/compiler2/transformer.py#L590-L603
pydanny/django-uni-form
159f539e2fb98752b7964d75e955fc62881c28fb
uni_form/layout.py
python
BaseInput.render
(self, form, form_style, context)
return render_to_string(self.template, Context({'input': self}))
Renders an `<input />` if container is used as a Layout object
Renders an `<input />` if container is used as a Layout object
[ "Renders", "an", "<input", "/", ">", "if", "container", "is", "used", "as", "a", "Layout", "object" ]
def render(self, form, form_style, context): """ Renders an `<input />` if container is used as a Layout object """ return render_to_string(self.template, Context({'input': self}))
[ "def", "render", "(", "self", ",", "form", ",", "form_style", ",", "context", ")", ":", "return", "render_to_string", "(", "self", ".", "template", ",", "Context", "(", "{", "'input'", ":", "self", "}", ")", ")" ]
https://github.com/pydanny/django-uni-form/blob/159f539e2fb98752b7964d75e955fc62881c28fb/uni_form/layout.py#L95-L99
deanishe/alfred-convert
97407f4ec8dbca5abbc6952b2b56cf3918624177
src/pint/registry.py
python
BaseRegistry._convert
(self, value, src, dst, inplace=False, check_dimensionality=True)
return value
Convert value from some source to destination units. :param value: value :param src: source units. :type src: UnitsContainer :param dst: destination units. :type dst: UnitsContainer :return: converted value
Convert value from some source to destination units.
[ "Convert", "value", "from", "some", "source", "to", "destination", "units", "." ]
def _convert(self, value, src, dst, inplace=False, check_dimensionality=True): """Convert value from some source to destination units. :param value: value :param src: source units. :type src: UnitsContainer :param dst: destination units. :type dst: UnitsContainer ...
[ "def", "_convert", "(", "self", ",", "value", ",", "src", ",", "dst", ",", "inplace", "=", "False", ",", "check_dimensionality", "=", "True", ")", ":", "if", "check_dimensionality", ":", "src_dim", "=", "self", ".", "_get_dimensionality", "(", "src", ")", ...
https://github.com/deanishe/alfred-convert/blob/97407f4ec8dbca5abbc6952b2b56cf3918624177/src/pint/registry.py#L713-L751
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/sqli/plugins/dbms/maxdb/fingerprint.py
python
Fingerprint.__init__
(self)
[]
def __init__(self): GenericFingerprint.__init__(self, DBMS.MAXDB)
[ "def", "__init__", "(", "self", ")", ":", "GenericFingerprint", ".", "__init__", "(", "self", ",", "DBMS", ".", "MAXDB", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/sqli/plugins/dbms/maxdb/fingerprint.py#L22-L23
easyw/kicadStepUpMod
9d78e59b97cedc4915ee3a290126a88dcdf11277
fcad_parser/sexp_parser/sexp_parser.py
python
Sexp._exportValue
(self,out,value,prefix,indent)
Called by `_export()` to export each individual value It tries ``value._export()`` before fallback to str(value) Subclass can override this method to customize the behavior
Called by `_export()` to export each individual value
[ "Called", "by", "_export", "()", "to", "export", "each", "individual", "value" ]
def _exportValue(self,out,value,prefix,indent): '''Called by `_export()` to export each individual value It tries ``value._export()`` before fallback to str(value) Subclass can override this method to customize the behavior ''' p = getattr(value,'_export',None) i...
[ "def", "_exportValue", "(", "self", ",", "out", ",", "value", ",", "prefix", ",", "indent", ")", ":", "p", "=", "getattr", "(", "value", ",", "'_export'", ",", "None", ")", "if", "p", "is", "not", "None", ":", "p", "(", "out", ",", "prefix", ",",...
https://github.com/easyw/kicadStepUpMod/blob/9d78e59b97cedc4915ee3a290126a88dcdf11277/fcad_parser/sexp_parser/sexp_parser.py#L241-L251
isnowfy/pydown
71ecc891868cd2a34b7e5fe662c99474f2d0fd7f
markdown/odict.py
python
OrderedDict.items
(self)
return zip(self.keyOrder, self.values())
[]
def items(self): return zip(self.keyOrder, self.values())
[ "def", "items", "(", "self", ")", ":", "return", "zip", "(", "self", ".", "keyOrder", ",", "self", ".", "values", "(", ")", ")" ]
https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/markdown/odict.py#L57-L58
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/devops_sdk/v6_0/identity/identity_client.py
python
IdentityClient.add_member
(self, container_id, member_id)
return self._deserialize('bool', response)
AddMember. [Preview API] :param str container_id: :param str member_id: :rtype: bool
AddMember. [Preview API] :param str container_id: :param str member_id: :rtype: bool
[ "AddMember", ".", "[", "Preview", "API", "]", ":", "param", "str", "container_id", ":", ":", "param", "str", "member_id", ":", ":", "rtype", ":", "bool" ]
def add_member(self, container_id, member_id): """AddMember. [Preview API] :param str container_id: :param str member_id: :rtype: bool """ route_values = {} if container_id is not None: route_values['containerId'] = self._serialize.url('contain...
[ "def", "add_member", "(", "self", ",", "container_id", ",", "member_id", ")", ":", "route_values", "=", "{", "}", "if", "container_id", "is", "not", "None", ":", "route_values", "[", "'containerId'", "]", "=", "self", ".", "_serialize", ".", "url", "(", ...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/identity/identity_client.py#L334-L350
randy3k/SendCode
6775b40613bb4911ba0499ff8a600c41f48a62c2
code_getter/getter.py
python
CodeGetter.get_code
(self)
return cmd
[]
def get_code(self): view = self.view cmd = '' moved = False sels = [s for s in view.sel()] for s in sels: if s.empty(): original_s = s s = self.expand_cursor(s) if self.auto_advance: view.sel().subtra...
[ "def", "get_code", "(", "self", ")", ":", "view", "=", "self", ".", "view", "cmd", "=", "''", "moved", "=", "False", "sels", "=", "[", "s", "for", "s", "in", "view", ".", "sel", "(", ")", "]", "for", "s", "in", "sels", ":", "if", "s", ".", ...
https://github.com/randy3k/SendCode/blob/6775b40613bb4911ba0499ff8a600c41f48a62c2/code_getter/getter.py#L80-L99
aws-quickstart/quickstart-redhat-openshift
2b87dd38b72e7e4c439a606c5a9ea458d72da612
functions/source/KeyGen/asn1crypto/core.py
python
Concat.__copy__
(self)
return new_obj
Implements the copy.copy() interface :return: A new shallow copy of the Concat object
Implements the copy.copy() interface
[ "Implements", "the", "copy", ".", "copy", "()", "interface" ]
def __copy__(self): """ Implements the copy.copy() interface :return: A new shallow copy of the Concat object """ new_obj = self.__class__() new_obj._copy(self, copy.copy) return new_obj
[ "def", "__copy__", "(", "self", ")", ":", "new_obj", "=", "self", ".", "__class__", "(", ")", "new_obj", ".", "_copy", "(", "self", ",", "copy", ".", "copy", ")", "return", "new_obj" ]
https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/KeyGen/asn1crypto/core.py#L1396-L1406
django-nonrel/django-nonrel
4fbfe7344481a5eab8698f79207f09124310131b
django/contrib/gis/geos/geometry.py
python
GEOSGeometry.simple
(self)
return capi.geos_issimple(self.ptr)
Returns false if the Geometry not simple.
Returns false if the Geometry not simple.
[ "Returns", "false", "if", "the", "Geometry", "not", "simple", "." ]
def simple(self): "Returns false if the Geometry not simple." return capi.geos_issimple(self.ptr)
[ "def", "simple", "(", "self", ")", ":", "return", "capi", ".", "geos_issimple", "(", "self", ".", "ptr", ")" ]
https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/gis/geos/geometry.py#L270-L272
fniephaus/alfred-pocket
c8ff8b23d708a746cce2888398cc566bef687a14
src/workflow/workflow.py
python
Workflow.clear_data
(self, filter_func=lambda f: True)
Delete all files in workflow's :attr:`datadir`. :param filter_func: Callable to determine whether a file should be deleted or not. ``filter_func`` is called with the filename of each file in the data directory. If it returns ``True``, the file will be deleted. By...
Delete all files in workflow's :attr:`datadir`.
[ "Delete", "all", "files", "in", "workflow", "s", ":", "attr", ":", "datadir", "." ]
def clear_data(self, filter_func=lambda f: True): """Delete all files in workflow's :attr:`datadir`. :param filter_func: Callable to determine whether a file should be deleted or not. ``filter_func`` is called with the filename of each file in the data directory. If it returns `...
[ "def", "clear_data", "(", "self", ",", "filter_func", "=", "lambda", "f", ":", "True", ")", ":", "self", ".", "_delete_directory_contents", "(", "self", ".", "datadir", ",", "filter_func", ")" ]
https://github.com/fniephaus/alfred-pocket/blob/c8ff8b23d708a746cce2888398cc566bef687a14/src/workflow/workflow.py#L2611-L2621
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
extras/xml_tools.py
python
dom2object
(node)
return X
Convert DOM representation to XML_object hierarchy.
Convert DOM representation to XML_object hierarchy.
[ "Convert", "DOM", "representation", "to", "XML_object", "hierarchy", "." ]
def dom2object(node): """Convert DOM representation to XML_object hierarchy. """ value = [] textnode_encountered = None for n in node.childNodes: if n.nodeType == 3: # Child is a text element - omit the dom tag #text and # go straight to the text value. ...
[ "def", "dom2object", "(", "node", ")", ":", "value", "=", "[", "]", "textnode_encountered", "=", "None", "for", "n", "in", "node", ".", "childNodes", ":", "if", "n", ".", "nodeType", "==", "3", ":", "# Child is a text element - omit the dom tag #text and", "# ...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/extras/xml_tools.py#L260-L313
KristianOellegaard/django-hvad
b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10
hvad/admin.py
python
TranslatableInlineModelAdmin.response_change
(self, request, obj)
return redirect
[]
def response_change(self, request, obj): redirect = super(TranslatableAdmin, self).response_change(request, obj) uri = iri_to_uri(request.path) if redirect['Location'] in (uri, "../add/"): if self.query_language_key in request.GET: redirect['Location'] = '%s?%s=%s' % ...
[ "def", "response_change", "(", "self", ",", "request", ",", "obj", ")", ":", "redirect", "=", "super", "(", "TranslatableAdmin", ",", "self", ")", ".", "response_change", "(", "request", ",", "obj", ")", "uri", "=", "iri_to_uri", "(", "request", ".", "pa...
https://github.com/KristianOellegaard/django-hvad/blob/b4fb1ff3674bd8309530ed5dcb95e9c3afd53a10/hvad/admin.py#L430-L437
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
py_clinked_object_t.__del__
(self)
Delete the link upon object destruction (only if not static)
Delete the link upon object destruction (only if not static)
[ "Delete", "the", "link", "upon", "object", "destruction", "(", "only", "if", "not", "static", ")" ]
def __del__(self): """ Delete the link upon object destruction (only if not static) """ self._free()
[ "def", "__del__", "(", "self", ")", ":", "self", ".", "_free", "(", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L200-L204
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/werkzeug/http.py
python
http_date
(timestamp=None)
return _dump_date(timestamp, ' ')
Formats the time to match the RFC1123 date format. Accepts a floating point number expressed in seconds since the epoch in, a datetime object or a timetuple. All times in UTC. The :func:`parse_date` function can be used to parse such a date. Outputs a string in the format ``Wdy, DD Mon YYYY HH:MM:SS...
Formats the time to match the RFC1123 date format.
[ "Formats", "the", "time", "to", "match", "the", "RFC1123", "date", "format", "." ]
def http_date(timestamp=None): """Formats the time to match the RFC1123 date format. Accepts a floating point number expressed in seconds since the epoch in, a datetime object or a timetuple. All times in UTC. The :func:`parse_date` function can be used to parse such a date. Outputs a string in ...
[ "def", "http_date", "(", "timestamp", "=", "None", ")", ":", "return", "_dump_date", "(", "timestamp", ",", "' '", ")" ]
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/werkzeug/http.py#L612-L623
scanny/python-pptx
71d1ca0b2b3b9178d64cdab565e8503a25a54e0b
pptx/oxml/dml/fill.py
python
CT_GradientFillProperties._new_gsLst
(self)
return CT_GradientStopList.new_gsLst()
Override default to add minimum subtree.
Override default to add minimum subtree.
[ "Override", "default", "to", "add", "minimum", "subtree", "." ]
def _new_gsLst(self): """Override default to add minimum subtree.""" return CT_GradientStopList.new_gsLst()
[ "def", "_new_gsLst", "(", "self", ")", ":", "return", "CT_GradientStopList", ".", "new_gsLst", "(", ")" ]
https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/oxml/dml/fill.py#L89-L91
jeetsukumaran/DendroPy
29fd294bf05d890ebf6a8d576c501e471db27ca1
src/dendropy/calculate/statistics.py
python
rank
(value_to_be_ranked, value_providing_rank)
return len(num_lesser)
Returns the rank of ``value_to_be_ranked`` in set of values, ``values``. Works even if ``values`` is a non-orderable collection (e.g., a set). A binary search would be an optimized way of doing this if we can constrain ``values`` to be an ordered collection.
Returns the rank of ``value_to_be_ranked`` in set of values, ``values``. Works even if ``values`` is a non-orderable collection (e.g., a set). A binary search would be an optimized way of doing this if we can constrain ``values`` to be an ordered collection.
[ "Returns", "the", "rank", "of", "value_to_be_ranked", "in", "set", "of", "values", "values", ".", "Works", "even", "if", "values", "is", "a", "non", "-", "orderable", "collection", "(", "e", ".", "g", ".", "a", "set", ")", ".", "A", "binary", "search",...
def rank(value_to_be_ranked, value_providing_rank): """ Returns the rank of ``value_to_be_ranked`` in set of values, ``values``. Works even if ``values`` is a non-orderable collection (e.g., a set). A binary search would be an optimized way of doing this if we can constrain ``values`` to be an order...
[ "def", "rank", "(", "value_to_be_ranked", ",", "value_providing_rank", ")", ":", "num_lesser", "=", "[", "v", "for", "v", "in", "value_providing_rank", "if", "v", "<", "value_to_be_ranked", "]", "return", "len", "(", "num_lesser", ")" ]
https://github.com/jeetsukumaran/DendroPy/blob/29fd294bf05d890ebf6a8d576c501e471db27ca1/src/dendropy/calculate/statistics.py#L250-L258
nipy/heudiconv
80a65385ef867124611d037fceac27d27e30f480
heudiconv/due.py
python
InactiveDueCreditCollector._donothing
(self, *args, **kwargs)
Perform no good and no bad
Perform no good and no bad
[ "Perform", "no", "good", "and", "no", "bad" ]
def _donothing(self, *args, **kwargs): """Perform no good and no bad""" pass
[ "def", "_donothing", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pass" ]
https://github.com/nipy/heudiconv/blob/80a65385ef867124611d037fceac27d27e30f480/heudiconv/due.py#L32-L34
ydkhatri/mac_apt
729630c8bbe7a73cce3ca330305d3301a919cb07
plugins/helpers/macinfo.py
python
MountedMacInfo._GetDarwinFoldersInfo
(self)
Gets DARWIN_*_DIR paths
Gets DARWIN_*_DIR paths
[ "Gets", "DARWIN_", "*", "_DIR", "paths" ]
def _GetDarwinFoldersInfo(self): '''Gets DARWIN_*_DIR paths ''' if not self.is_windows: # Unix/Linux or Mac mounted disks should preserve UID/GID, so we can read it normally from the files. super()._GetDarwinFoldersInfo() return for user in self.users...
[ "def", "_GetDarwinFoldersInfo", "(", "self", ")", ":", "if", "not", "self", ".", "is_windows", ":", "# Unix/Linux or Mac mounted disks should preserve UID/GID, so we can read it normally from the files.", "super", "(", ")", ".", "_GetDarwinFoldersInfo", "(", ")", "return", ...
https://github.com/ydkhatri/mac_apt/blob/729630c8bbe7a73cce3ca330305d3301a919cb07/plugins/helpers/macinfo.py#L1485-L1505