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
HCIILAB/DeRPN
21e6738ee1f7d3f159ee48d435c543e773f8ce99
caffe/examples/pycaffe/layers/pascal_multilabel_datalayers.py
python
BatchLoader.load_next_image
(self)
return self.transformer.preprocess(im), multilabel
Load the next image in a batch.
Load the next image in a batch.
[ "Load", "the", "next", "image", "in", "a", "batch", "." ]
def load_next_image(self): """ Load the next image in a batch. """ # Did we finish an epoch? if self._cur == len(self.indexlist): self._cur = 0 shuffle(self.indexlist) # Load an image index = self.indexlist[self._cur] # Get the image inde...
[ "def", "load_next_image", "(", "self", ")", ":", "# Did we finish an epoch?", "if", "self", ".", "_cur", "==", "len", "(", "self", ".", "indexlist", ")", ":", "self", ".", "_cur", "=", "0", "shuffle", "(", "self", ".", "indexlist", ")", "# Load an image", ...
https://github.com/HCIILAB/DeRPN/blob/21e6738ee1f7d3f159ee48d435c543e773f8ce99/caffe/examples/pycaffe/layers/pascal_multilabel_datalayers.py#L106-L137
orbingol/NURBS-Python
8ae8b127eb0b130a25a6c81e98e90f319733bca0
geomdl/visualization/VisVTK.py
python
VisConfig.__init__
(self, **kwargs)
[]
def __init__(self, **kwargs): super(VisConfig, self).__init__(**kwargs) self._bg = ( # background colors (0.5, 0.5, 0.5), (0.2, 0.2, 0.2), (0.25, 0.5, 0.75), (1.0, 1.0, 0.0), (1.0, 0.5, 0.0), (0.5, 0.0, 1.0), (0.0, 0.0, 0.0), (1.0, 1.0, 1.0) ) self._bg_id = 0 # ...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "super", "(", "VisConfig", ",", "self", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "self", ".", "_bg", "=", "(", "# background colors", "(", "0.5", ",", "0.5", ",", "0.5", ...
https://github.com/orbingol/NURBS-Python/blob/8ae8b127eb0b130a25a6c81e98e90f319733bca0/geomdl/visualization/VisVTK.py#L32-L46
dingmyu/D4LCN
9258bfb31376b97ab16abee31bd0fec131236c7a
models/resnet.py
python
resnet101
(pretrained=False, **kwargs)
return model
Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
[ "Constructs", "a", "ResNet", "-", "101", "model", ".", "Args", ":", "pretrained", "(", "bool", ")", ":", "If", "True", "returns", "a", "model", "pre", "-", "trained", "on", "ImageNet" ]
def resnet101(pretrained=False, **kwargs): """Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs) if pretrained: model.load_state_dict(model_zoo.load_url(model_urls['resnet101...
[ "def", "resnet101", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "ResNet", "(", "Bottleneck", ",", "[", "3", ",", "4", ",", "23", ",", "3", "]", ",", "*", "*", "kwargs", ")", "if", "pretrained", ":", "model", ...
https://github.com/dingmyu/D4LCN/blob/9258bfb31376b97ab16abee31bd0fec131236c7a/models/resnet.py#L254-L262
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/base.py
python
Index._assert_can_do_op
(self, value)
Check value is valid for scalar op
Check value is valid for scalar op
[ "Check", "value", "is", "valid", "for", "scalar", "op" ]
def _assert_can_do_op(self, value): """ Check value is valid for scalar op """ if not lib.isscalar(value): msg = "'value' must be a scalar, passed: {0}" raise TypeError(msg.format(type(value).__name__))
[ "def", "_assert_can_do_op", "(", "self", ",", "value", ")", ":", "if", "not", "lib", ".", "isscalar", "(", "value", ")", ":", "msg", "=", "\"'value' must be a scalar, passed: {0}\"", "raise", "TypeError", "(", "msg", ".", "format", "(", "type", "(", "value",...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/base.py#L1045-L1049
crdoconnor/strictyaml
b456066a763285532fd75cd274d4a275d8499d6c
hitch/key.py
python
reformat
()
Reformat using black and then relint.
Reformat using black and then relint.
[ "Reformat", "using", "black", "and", "then", "relint", "." ]
def reformat(): """ Reformat using black and then relint. """ toolkit.reformat()
[ "def", "reformat", "(", ")", ":", "toolkit", ".", "reformat", "(", ")" ]
https://github.com/crdoconnor/strictyaml/blob/b456066a763285532fd75cd274d4a275d8499d6c/hitch/key.py#L145-L149
pyfa-org/Pyfa
feaa52c36beeda21ab380fc74d8f871b81d49729
gui/setEditor.py
python
ImplantSetEditor.exportPatterns
(self, event)
Event fired when export to clipboard button is clicked
Event fired when export to clipboard button is clicked
[ "Event", "fired", "when", "export", "to", "clipboard", "button", "is", "clicked" ]
def exportPatterns(self, event): """Event fired when export to clipboard button is clicked""" sIS = ImplantSets.getInstance() toClipboard(sIS.exportSets()) self.stNotice.SetLabel(_t("Sets exported to clipboard"))
[ "def", "exportPatterns", "(", "self", ",", "event", ")", ":", "sIS", "=", "ImplantSets", ".", "getInstance", "(", ")", "toClipboard", "(", "sIS", ".", "exportSets", "(", ")", ")", "self", ".", "stNotice", ".", "SetLabel", "(", "_t", "(", "\"Sets exported...
https://github.com/pyfa-org/Pyfa/blob/feaa52c36beeda21ab380fc74d8f871b81d49729/gui/setEditor.py#L224-L229
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py
python
lineno
(loc,strg)
return strg.count("\n",0,loc) + 1
Returns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseString>} for more information o...
Returns current line number within a string, counting newlines as line separators. The first line is number 1.
[ "Returns", "current", "line", "number", "within", "a", "string", "counting", "newlines", "as", "line", "separators", ".", "The", "first", "line", "is", "number", "1", "." ]
def lineno(loc,strg): """Returns current line number within a string, counting newlines as line separators. The first line is number 1. Note: the default parsing behavior is to expand tabs in the input string before starting the parsing process. See L{I{ParserElement.parseString}<ParserElement.parseStrin...
[ "def", "lineno", "(", "loc", ",", "strg", ")", ":", "return", "strg", ".", "count", "(", "\"\\n\"", ",", "0", ",", "loc", ")", "+", "1" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py#L958-L968
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/utils/dummy_pytorch_quantization_and_torch_objects.py
python
QDQBertForTokenClassification.from_pretrained
(cls, *args, **kwargs)
[]
def from_pretrained(cls, *args, **kwargs): requires_backends(cls, ["pytorch_quantization", "torch"])
[ "def", "from_pretrained", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "requires_backends", "(", "cls", ",", "[", "\"pytorch_quantization\"", ",", "\"torch\"", "]", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pytorch_quantization_and_torch_objects.py#L73-L74
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/attr/_make.py
python
_CountingAttr.__init__
(self, default, validator, repr, cmp, hash, init, converter, metadata, type)
[]
def __init__(self, default, validator, repr, cmp, hash, init, converter, metadata, type): _CountingAttr.cls_counter += 1 self.counter = _CountingAttr.cls_counter self._default = default # If validator is a list/tuple, wrap it using helper validator. if validator ...
[ "def", "__init__", "(", "self", ",", "default", ",", "validator", ",", "repr", ",", "cmp", ",", "hash", ",", "init", ",", "converter", ",", "metadata", ",", "type", ")", ":", "_CountingAttr", ".", "cls_counter", "+=", "1", "self", ".", "counter", "=", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/attr/_make.py#L1350-L1366
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventDetails.is_shared_link_remove_expiry_details
(self)
return self._tag == 'shared_link_remove_expiry_details'
Check if the union tag is ``shared_link_remove_expiry_details``. :rtype: bool
Check if the union tag is ``shared_link_remove_expiry_details``.
[ "Check", "if", "the", "union", "tag", "is", "shared_link_remove_expiry_details", "." ]
def is_shared_link_remove_expiry_details(self): """ Check if the union tag is ``shared_link_remove_expiry_details``. :rtype: bool """ return self._tag == 'shared_link_remove_expiry_details'
[ "def", "is_shared_link_remove_expiry_details", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'shared_link_remove_expiry_details'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L15727-L15733
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/ext/mapreduce/base_handler.py
python
TaskQueueHandler.task_retry_count
(self)
return int(self.request.headers.get("X-AppEngine-TaskExecutionCount", 0))
Number of times this task has been retried.
Number of times this task has been retried.
[ "Number", "of", "times", "this", "task", "has", "been", "retried", "." ]
def task_retry_count(self): """Number of times this task has been retried.""" return int(self.request.headers.get("X-AppEngine-TaskExecutionCount", 0))
[ "def", "task_retry_count", "(", "self", ")", ":", "return", "int", "(", "self", ".", "request", ".", "headers", ".", "get", "(", "\"X-AppEngine-TaskExecutionCount\"", ",", "0", ")", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/mapreduce/base_handler.py#L165-L167
crossbario/autobahn-python
fa9f2da0c5005574e63456a3a04f00e405744014
autobahn/wamp/auth.py
python
derive_scram_credential
(email: str, password: str, salt: Optional[bytes] = None)
return credential
Derive WAMP-SCRAM credentials from user email and password. The SCRAM parameters used are the following (these are also contained in the returned credentials): * kdf ``argon2id-13`` * time cost ``4096`` * memory cost ``512`` * parallelism ``1`` See `draft-irtf-cfrg-argon2 <https://datatracker....
Derive WAMP-SCRAM credentials from user email and password. The SCRAM parameters used are the following (these are also contained in the returned credentials):
[ "Derive", "WAMP", "-", "SCRAM", "credentials", "from", "user", "email", "and", "password", ".", "The", "SCRAM", "parameters", "used", "are", "the", "following", "(", "these", "are", "also", "contained", "in", "the", "returned", "credentials", ")", ":" ]
def derive_scram_credential(email: str, password: str, salt: Optional[bytes] = None) -> Dict: """ Derive WAMP-SCRAM credentials from user email and password. The SCRAM parameters used are the following (these are also contained in the returned credentials): * kdf ``argon2id-13`` * time cost ``4096`...
[ "def", "derive_scram_credential", "(", "email", ":", "str", ",", "password", ":", "str", ",", "salt", ":", "Optional", "[", "bytes", "]", "=", "None", ")", "->", "Dict", ":", "assert", "HAS_ARGON", ",", "'missing dependency argon2'", "from", "argon2", ".", ...
https://github.com/crossbario/autobahn-python/blob/fa9f2da0c5005574e63456a3a04f00e405744014/autobahn/wamp/auth.py#L610-L673
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
modules/sfp_dns_for_family.py
python
sfp_dns_for_family.setup
(self, sfc, userOpts=dict())
[]
def setup(self, sfc, userOpts=dict()): self.sf = sfc self.results = self.tempStorage() for opt in list(userOpts.keys()): self.opts[opt] = userOpts[opt]
[ "def", "setup", "(", "self", ",", "sfc", ",", "userOpts", "=", "dict", "(", ")", ")", ":", "self", ".", "sf", "=", "sfc", "self", ".", "results", "=", "self", ".", "tempStorage", "(", ")", "for", "opt", "in", "list", "(", "userOpts", ".", "keys",...
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_dns_for_family.py#L48-L53
aaPanel/BaoTa
9bb1336f31ae2893ab513af7a3efed633338c64b
class/ssh_terminal.py
python
ssh_terminal.history_send
(self,send_data)
@name 从发送实体保存命令 @author hwliang<2020-08-12> @param send_data<string> 数据实体 @return void
[]
def history_send(self,send_data): ''' @name 从发送实体保存命令 @author hwliang<2020-08-12> @param send_data<string> 数据实体 @return void ''' if not send_data: return his_path = self._save_path + self._host if not os.path.exists(his_path): retur...
[ "def", "history_send", "(", "self", ",", "send_data", ")", ":", "if", "not", "send_data", ":", "return", "his_path", "=", "self", ".", "_save_path", "+", "self", ".", "_host", "if", "not", "os", ".", "path", ".", "exists", "(", "his_path", ")", ":", ...
https://github.com/aaPanel/BaoTa/blob/9bb1336f31ae2893ab513af7a3efed633338c64b/class/ssh_terminal.py#L593-L652
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
medusa/databases/main_db.py
python
AddManualSearched.test
(self)
return self.connection.version >= (44, 3)
Test if the version is < 44.3
Test if the version is < 44.3
[ "Test", "if", "the", "version", "is", "<", "44", ".", "3" ]
def test(self): """ Test if the version is < 44.3 """ return self.connection.version >= (44, 3)
[ "def", "test", "(", "self", ")", ":", "return", "self", ".", "connection", ".", "version", ">=", "(", "44", ",", "3", ")" ]
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/databases/main_db.py#L421-L425
custom-components/ble_monitor
64f9cb064781c6ddc5089657d3710b31d10fe1ba
custom_components/ble_monitor/__init__.py
python
BLEmonitor.__init__
(self, config)
Init.
Init.
[ "Init", "." ]
def __init__(self, config): """Init.""" self.dataqueue = { "binary": janus.Queue(), "measuring": janus.Queue(), "tracker": janus.Queue(), } self.config = config self.dumpthread = None
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "self", ".", "dataqueue", "=", "{", "\"binary\"", ":", "janus", ".", "Queue", "(", ")", ",", "\"measuring\"", ":", "janus", ".", "Queue", "(", ")", ",", "\"tracker\"", ":", "janus", ".", "Queue...
https://github.com/custom-components/ble_monitor/blob/64f9cb064781c6ddc5089657d3710b31d10fe1ba/custom_components/ble_monitor/__init__.py#L427-L435
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
pypy/module/imp/__init__.py
python
Module.__init__
(self, space, *args)
NOT_RPYTHON
NOT_RPYTHON
[ "NOT_RPYTHON" ]
def __init__(self, space, *args): "NOT_RPYTHON" MixedModule.__init__(self, space, *args) from pypy.module.posix.interp_posix import add_fork_hook from pypy.module.imp import interp_imp add_fork_hook('before', interp_imp.acquire_lock) add_fork_hook('parent', interp_imp.rel...
[ "def", "__init__", "(", "self", ",", "space", ",", "*", "args", ")", ":", "MixedModule", ".", "__init__", "(", "self", ",", "space", ",", "*", "args", ")", "from", "pypy", ".", "module", ".", "posix", ".", "interp_posix", "import", "add_fork_hook", "fr...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/imp/__init__.py#L44-L51
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/engines/pcode/behavior.py
python
OpBehaviorIntOr.__init__
(self)
[]
def __init__(self): super().__init__(OpCode.INT_OR, False)
[ "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__init__", "(", "OpCode", ".", "INT_OR", ",", "False", ")" ]
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/engines/pcode/behavior.py#L281-L282
jcartledge/sublime-worksheet
44b2ba96d02759b485adbf85c1a2c9d45cc39599
repl/ftfy/__init__.py
python
fix_text_segment
(text, normalization='NFKC', entities=True)
return text
Apply fixes to text in a single chunk. This could be a line of text within a larger run of `fix_text`, or it could be a larger amount of text that you are certain is all in the same encoding.
Apply fixes to text in a single chunk. This could be a line of text within a larger run of `fix_text`, or it could be a larger amount of text that you are certain is all in the same encoding.
[ "Apply", "fixes", "to", "text", "in", "a", "single", "chunk", ".", "This", "could", "be", "a", "line", "of", "text", "within", "a", "larger", "run", "of", "fix_text", "or", "it", "could", "be", "a", "larger", "amount", "of", "text", "that", "you", "a...
def fix_text_segment(text, normalization='NFKC', entities=True): """ Apply fixes to text in a single chunk. This could be a line of text within a larger run of `fix_text`, or it could be a larger amount of text that you are certain is all in the same encoding. """ if isinstance(text, bytes): ...
[ "def", "fix_text_segment", "(", "text", ",", "normalization", "=", "'NFKC'", ",", "entities", "=", "True", ")", ":", "if", "isinstance", "(", "text", ",", "bytes", ")", ":", "raise", "UnicodeError", "(", "BYTES_ERROR_TEXT", ")", "text", "=", "remove_terminal...
https://github.com/jcartledge/sublime-worksheet/blob/44b2ba96d02759b485adbf85c1a2c9d45cc39599/repl/ftfy/__init__.py#L156-L173
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/wave.py
python
Wave_write.__del__
(self)
[]
def __del__(self): self.close()
[ "def", "__del__", "(", "self", ")", ":", "self", ".", "close", "(", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/wave.py#L328-L329
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/imaplib.py
python
IMAP4.partial
(self, message_num, message_part, start, length)
return self._untagged_response(typ, dat, 'FETCH')
Fetch truncated part of a message. (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data.
Fetch truncated part of a message.
[ "Fetch", "truncated", "part", "of", "a", "message", "." ]
def partial(self, message_num, message_part, start, length): """Fetch truncated part of a message. (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data. """ name = 'PARTIAL' typ, dat = self._...
[ "def", "partial", "(", "self", ",", "message_num", ",", "message_part", ",", "start", ",", "length", ")", ":", "name", "=", "'PARTIAL'", "typ", ",", "dat", "=", "self", ".", "_simple_command", "(", "name", ",", "message_num", ",", "message_part", ",", "s...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/imaplib.py#L660-L669
autonomousvision/occupancy_networks
406f79468fb8b57b3e76816aaa73b1915c53ad22
im2mesh/common.py
python
get_camera_args
(data, loc_field=None, scale_field=None, device=None)
return kwargs
Returns dictionary of camera arguments. Args: data (dict): data dictionary loc_field (str): name of location field scale_field (str): name of scale field device (device): pytorch device
Returns dictionary of camera arguments.
[ "Returns", "dictionary", "of", "camera", "arguments", "." ]
def get_camera_args(data, loc_field=None, scale_field=None, device=None): ''' Returns dictionary of camera arguments. Args: data (dict): data dictionary loc_field (str): name of location field scale_field (str): name of scale field device (device): pytorch device ''' Rt ...
[ "def", "get_camera_args", "(", "data", ",", "loc_field", "=", "None", ",", "scale_field", "=", "None", ",", "device", "=", "None", ")", ":", "Rt", "=", "data", "[", "'inputs.world_mat'", "]", ".", "to", "(", "device", ")", "K", "=", "data", "[", "'in...
https://github.com/autonomousvision/occupancy_networks/blob/406f79468fb8b57b3e76816aaa73b1915c53ad22/im2mesh/common.py#L248-L273
PythonOT/POT
be0ed1dcd0b65ec804e454f1a2d3c0d227c0ddbe
ot/backend.py
python
Backend.repeat
(self, a, repeats, axis=None)
r""" Repeats elements of a tensor. This function follows the api from :any:`numpy.repeat` See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html
r""" Repeats elements of a tensor.
[ "r", "Repeats", "elements", "of", "a", "tensor", "." ]
def repeat(self, a, repeats, axis=None): r""" Repeats elements of a tensor. This function follows the api from :any:`numpy.repeat` See: https://numpy.org/doc/stable/reference/generated/numpy.repeat.html """ raise NotImplementedError()
[ "def", "repeat", "(", "self", ",", "a", ",", "repeats", ",", "axis", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/PythonOT/POT/blob/be0ed1dcd0b65ec804e454f1a2d3c0d227c0ddbe/ot/backend.py#L489-L497
pyga/parsley
c89b3f0e09a9501f285a14ae446a77a56ee99942
ometa/interp.py
python
TrampolinedGrammarInterpreter.parse_Exactly
(self, spec)
Accept a one or more characters that equal the given spec.
Accept a one or more characters that equal the given spec.
[ "Accept", "a", "one", "or", "more", "characters", "that", "equal", "the", "given", "spec", "." ]
def parse_Exactly(self, spec): """ Accept a one or more characters that equal the given spec. """ wanted = spec.data result = [] for c in wanted: try: val, p = self.input.head() except EOFError: yield _feed_me ...
[ "def", "parse_Exactly", "(", "self", ",", "spec", ")", ":", "wanted", "=", "spec", ".", "data", "result", "=", "[", "]", "for", "c", "in", "wanted", ":", "try", ":", "val", ",", "p", "=", "self", ".", "input", ".", "head", "(", ")", "except", "...
https://github.com/pyga/parsley/blob/c89b3f0e09a9501f285a14ae446a77a56ee99942/ometa/interp.py#L184-L201
tav/pylibs
3c16b843681f54130ee6a022275289cadb2f2a69
paramiko/transport.py
python
Transport.getpeername
(self)
return gp()
Return the address of the remote side of this Transport, if possible. This is effectively a wrapper around C{'getpeername'} on the underlying socket. If the socket-like object has no C{'getpeername'} method, then C{("unknown", 0)} is returned. @return: the address if the remote...
Return the address of the remote side of this Transport, if possible. This is effectively a wrapper around C{'getpeername'} on the underlying socket. If the socket-like object has no C{'getpeername'} method, then C{("unknown", 0)} is returned.
[ "Return", "the", "address", "of", "the", "remote", "side", "of", "this", "Transport", "if", "possible", ".", "This", "is", "effectively", "a", "wrapper", "around", "C", "{", "getpeername", "}", "on", "the", "underlying", "socket", ".", "If", "the", "socket...
def getpeername(self): """ Return the address of the remote side of this Transport, if possible. This is effectively a wrapper around C{'getpeername'} on the underlying socket. If the socket-like object has no C{'getpeername'} method, then C{("unknown", 0)} is returned. ...
[ "def", "getpeername", "(", "self", ")", ":", "gp", "=", "getattr", "(", "self", ".", "sock", ",", "'getpeername'", ",", "None", ")", "if", "gp", "is", "None", ":", "return", "(", "'unknown'", ",", "0", ")", "return", "gp", "(", ")" ]
https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/paramiko/transport.py#L1340-L1353
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/win/six.py
python
add_metaclass
(metaclass)
return wrapper
Class decorator for creating a class with a metaclass.
Class decorator for creating a class with a metaclass.
[ "Class", "decorator", "for", "creating", "a", "class", "with", "a", "metaclass", "." ]
def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() slots = orig_vars.get('__slots__') if slots is not None: if isinstance(slots, str): slots = [slots] for slo...
[ "def", "add_metaclass", "(", "metaclass", ")", ":", "def", "wrapper", "(", "cls", ")", ":", "orig_vars", "=", "cls", ".", "__dict__", ".", "copy", "(", ")", "slots", "=", "orig_vars", ".", "get", "(", "'__slots__'", ")", "if", "slots", "is", "not", "...
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/win/six.py#L835-L850
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/declarations.py
python
classImplements
(cls, *interfaces)
Declare additional interfaces implemented for instances of a class The arguments after the class are one or more interfaces or interface specifications (``IDeclaration`` objects). The interfaces given (including the interfaces in the specifications) are added to any interfaces previously decla...
Declare additional interfaces implemented for instances of a class
[ "Declare", "additional", "interfaces", "implemented", "for", "instances", "of", "a", "class" ]
def classImplements(cls, *interfaces): """Declare additional interfaces implemented for instances of a class The arguments after the class are one or more interfaces or interface specifications (``IDeclaration`` objects). The interfaces given (including the interfaces in the specifications) ...
[ "def", "classImplements", "(", "cls", ",", "*", "interfaces", ")", ":", "spec", "=", "implementedBy", "(", "cls", ")", "spec", ".", "declared", "+=", "tuple", "(", "_normalizeargs", "(", "interfaces", ")", ")", "# compute the bases", "bases", "=", "[", "]"...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/declarations.py#L315-L343
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
sonarqube/datadog_checks/sonarqube/config_models/defaults.py
python
instance_timeout
(field, value)
return 10
[]
def instance_timeout(field, value): return 10
[ "def", "instance_timeout", "(", "field", ",", "value", ")", ":", "return", "10" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/sonarqube/datadog_checks/sonarqube/config_models/defaults.py#L237-L238
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
SqlmapCelery/sqlmap/lib/request/basic.py
python
checkCharEncoding
(encoding, warn=True)
return encoding
Checks encoding name, repairs common misspellings and adjusts to proper namings used in codecs module >>> checkCharEncoding('iso-8858', False) 'iso8859-1' >>> checkCharEncoding('en_us', False) 'utf8'
Checks encoding name, repairs common misspellings and adjusts to proper namings used in codecs module
[ "Checks", "encoding", "name", "repairs", "common", "misspellings", "and", "adjusts", "to", "proper", "namings", "used", "in", "codecs", "module" ]
def checkCharEncoding(encoding, warn=True): """ Checks encoding name, repairs common misspellings and adjusts to proper namings used in codecs module >>> checkCharEncoding('iso-8858', False) 'iso8859-1' >>> checkCharEncoding('en_us', False) 'utf8' """ if encoding: encoding ...
[ "def", "checkCharEncoding", "(", "encoding", ",", "warn", "=", "True", ")", ":", "if", "encoding", ":", "encoding", "=", "encoding", ".", "lower", "(", ")", "else", ":", "return", "encoding", "# Reference: http://www.destructor.de/charsets/index.htm", "translate", ...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/SqlmapCelery/sqlmap/lib/request/basic.py#L141-L230
beeware/colosseum
cbf974be54fd7f6fddbe7285704cfaf7a866c5c5
src/colosseum/dimensions.py
python
Size.ratio
(self)
return self._ratio
[]
def ratio(self): return self._ratio
[ "def", "ratio", "(", "self", ")", ":", "return", "self", ".", "_ratio" ]
https://github.com/beeware/colosseum/blob/cbf974be54fd7f6fddbe7285704cfaf7a866c5c5/src/colosseum/dimensions.py#L75-L76
pascalw/Airplayer
cb6f6a393710a31f934e3c09de4f689158d23b50
airplayer/lib/jsonrpclib/jsonrpc.py
python
Payload.request
(self, method, params=[])
return request
[]
def request(self, method, params=[]): if type(method) not in types.StringTypes: raise ValueError('Method name must be a string.') if not self.id: self.id = random_id() request = { 'id':self.id, 'method':method } if params: request['params'] = params ...
[ "def", "request", "(", "self", ",", "method", ",", "params", "=", "[", "]", ")", ":", "if", "type", "(", "method", ")", "not", "in", "types", ".", "StringTypes", ":", "raise", "ValueError", "(", "'Method name must be a string.'", ")", "if", "not", "self"...
https://github.com/pascalw/Airplayer/blob/cb6f6a393710a31f934e3c09de4f689158d23b50/airplayer/lib/jsonrpclib/jsonrpc.py#L389-L399
PlasmaPy/PlasmaPy
78d63e341216475ce3318e1409296480407c9019
plasmapy/diagnostics/langmuir.py
python
_fit_func_lin
(x, x0, y0, c0)
return y0 + c0 * (x - x0)
r"""Linear fitting function.
r"""Linear fitting function.
[ "r", "Linear", "fitting", "function", "." ]
def _fit_func_lin(x, x0, y0, c0): r"""Linear fitting function.""" return y0 + c0 * (x - x0)
[ "def", "_fit_func_lin", "(", "x", ",", "x0", ",", "y0", ",", "c0", ")", ":", "return", "y0", "+", "c0", "*", "(", "x", "-", "x0", ")" ]
https://github.com/PlasmaPy/PlasmaPy/blob/78d63e341216475ce3318e1409296480407c9019/plasmapy/diagnostics/langmuir.py#L43-L46
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/webpage/webpage/libs/email/_header_value_parser.py
python
get_dot_atom
(value)
return dot_atom, value
dot-atom = [CFWS] dot-atom-text [CFWS] Any place we can have a dot atom, we could instead have an rfc2047 encoded word.
dot-atom = [CFWS] dot-atom-text [CFWS]
[ "dot", "-", "atom", "=", "[", "CFWS", "]", "dot", "-", "atom", "-", "text", "[", "CFWS", "]" ]
def get_dot_atom(value): """ dot-atom = [CFWS] dot-atom-text [CFWS] Any place we can have a dot atom, we could instead have an rfc2047 encoded word. """ dot_atom = DotAtom() if value[0] in CFWS_LEADER: token, value = get_cfws(value) dot_atom.append(token) if value.startswith...
[ "def", "get_dot_atom", "(", "value", ")", ":", "dot_atom", "=", "DotAtom", "(", ")", "if", "value", "[", "0", "]", "in", "CFWS_LEADER", ":", "token", ",", "value", "=", "get_cfws", "(", "value", ")", "dot_atom", ".", "append", "(", "token", ")", "if"...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/email/_header_value_parser.py#L1698-L1721
dpgaspar/Flask-AppBuilder
557249f33b66d02a48c1322ef21324b815abe18e
flask_appbuilder/validators.py
python
default_password_complexity
(password: str)
FAB's default password complexity validator, set FAB_PASSWORD_COMPLEXITY_ENABLED to True to enable it
FAB's default password complexity validator, set FAB_PASSWORD_COMPLEXITY_ENABLED to True to enable it
[ "FAB", "s", "default", "password", "complexity", "validator", "set", "FAB_PASSWORD_COMPLEXITY_ENABLED", "to", "True", "to", "enable", "it" ]
def default_password_complexity(password: str) -> None: """ FAB's default password complexity validator, set FAB_PASSWORD_COMPLEXITY_ENABLED to True to enable it """ match = re.search(password_complexity_regex, password) if not match: raise PasswordComplexityValidationError( ...
[ "def", "default_password_complexity", "(", "password", ":", "str", ")", "->", "None", ":", "match", "=", "re", ".", "search", "(", "password_complexity_regex", ",", "password", ")", "if", "not", "match", ":", "raise", "PasswordComplexityValidationError", "(", "g...
https://github.com/dpgaspar/Flask-AppBuilder/blob/557249f33b66d02a48c1322ef21324b815abe18e/flask_appbuilder/validators.py#L79-L92
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/plat-mac/PixMapWrapper.py
python
PixMapWrapper._unstuff
(self, element)
return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0]
[]
def _unstuff(self, element): offset = _pmElemOffset[element] fmt = _pmElemFormat[element] return struct.unpack(fmt, self._header[offset:offset+struct.calcsize(fmt)])[0]
[ "def", "_unstuff", "(", "self", ",", "element", ")", ":", "offset", "=", "_pmElemOffset", "[", "element", "]", "fmt", "=", "_pmElemFormat", "[", "element", "]", "return", "struct", ".", "unpack", "(", "fmt", ",", "self", ".", "_header", "[", "offset", ...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-mac/PixMapWrapper.py#L93-L96
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/asyncio/tasks.py
python
Task.current_task
(cls, loop=None)
return cls._current_tasks.get(loop)
Return the currently running task in an event loop or None. By default the current task for the current event loop is returned. None is returned when called not in the context of a Task.
Return the currently running task in an event loop or None.
[ "Return", "the", "currently", "running", "task", "in", "an", "event", "loop", "or", "None", "." ]
def current_task(cls, loop=None): """Return the currently running task in an event loop or None. By default the current task for the current event loop is returned. None is returned when called not in the context of a Task. """ if loop is None: loop = events.get_eve...
[ "def", "current_task", "(", "cls", ",", "loop", "=", "None", ")", ":", "if", "loop", "is", "None", ":", "loop", "=", "events", ".", "get_event_loop", "(", ")", "return", "cls", ".", "_current_tasks", ".", "get", "(", "loop", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/asyncio/tasks.py#L49-L58
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/contrib/admin/options.py
python
ModelAdmin.response_delete
(self, request, obj_display, obj_id)
return HttpResponseRedirect(post_url)
Determine the HttpResponse for the delete_view stage.
Determine the HttpResponse for the delete_view stage.
[ "Determine", "the", "HttpResponse", "for", "the", "delete_view", "stage", "." ]
def response_delete(self, request, obj_display, obj_id): """ Determine the HttpResponse for the delete_view stage. """ opts = self.model._meta if IS_POPUP_VAR in request.POST: popup_response_data = json.dumps({ 'action': 'delete', 'val...
[ "def", "response_delete", "(", "self", ",", "request", ",", "obj_display", ",", "obj_id", ")", ":", "opts", "=", "self", ".", "model", ".", "_meta", "if", "IS_POPUP_VAR", "in", "request", ".", "POST", ":", "popup_response_data", "=", "json", ".", "dumps", ...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/admin/options.py#L1411-L1450
zzzeek/sqlalchemy
fc5c54fcd4d868c2a4c7ac19668d72f506fe821e
lib/sqlalchemy/engine/interfaces.py
python
Connectable.execute
(self, object_, *multiparams, **params)
Executes the given construct and returns a :class:`_result.Result`.
Executes the given construct and returns a :class:`_result.Result`.
[ "Executes", "the", "given", "construct", "and", "returns", "a", ":", "class", ":", "_result", ".", "Result", "." ]
def execute(self, object_, *multiparams, **params): """Executes the given construct and returns a :class:`_result.Result`. """ raise NotImplementedError()
[ "def", "execute", "(", "self", ",", "object_", ",", "*", "multiparams", ",", "*", "*", "params", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/engine/interfaces.py#L1567-L1572
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/visualization/volume_rendering/scene.py
python
Scene.__init__
(self)
r"""Create a new Scene instance
r"""Create a new Scene instance
[ "r", "Create", "a", "new", "Scene", "instance" ]
def __init__(self): r"""Create a new Scene instance""" super().__init__() self.sources = OrderedDict() self._last_render = None # A non-public attribute used to get around the fact that we can't # pass kwargs into _repr_png_() self._sigma_clip = None
[ "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "sources", "=", "OrderedDict", "(", ")", "self", ".", "_last_render", "=", "None", "# A non-public attribute used to get around the fact that we can't", "# pass kw...
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/visualization/volume_rendering/scene.py#L76-L83
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/filters.py
python
do_int
(value, default=0)
Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter.
Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter.
[ "Convert", "the", "value", "into", "an", "integer", ".", "If", "the", "conversion", "doesn", "t", "work", "it", "will", "return", "0", ".", "You", "can", "override", "this", "default", "using", "the", "first", "parameter", "." ]
def do_int(value, default=0): """Convert the value into an integer. If the conversion doesn't work it will return ``0``. You can override this default using the first parameter. """ try: return int(value) except (TypeError, ValueError): # this quirk is necessary so that "42.23"|i...
[ "def", "do_int", "(", "value", ",", "default", "=", "0", ")", ":", "try", ":", "return", "int", "(", "value", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "# this quirk is necessary so that \"42.23\"|int gives 42.", "try", ":", "return", "int"...
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/filters.py#L405-L417
paulvangentcom/python_corona_simulation
a5dddd3e13d2bb768a9294d85ab27329be9a21dd
old/simple_simulation.py
python
infect
(population, infection_range, infection_chance, frame)
return population
finds new infections Keyword arguments -----------------
finds new infections Keyword arguments -----------------
[ "finds", "new", "infections", "Keyword", "arguments", "-----------------" ]
def infect(population, infection_range, infection_chance, frame): '''finds new infections Keyword arguments ----------------- ''' #find new infections infected_previous_step = population[population[:,6] == 1] new_infections = [] #if less than half are infected, slice based...
[ "def", "infect", "(", "population", ",", "infection_range", ",", "infection_chance", ",", "frame", ")", ":", "#find new infections", "infected_previous_step", "=", "population", "[", "population", "[", ":", ",", "6", "]", "==", "1", "]", "new_infections", "=", ...
https://github.com/paulvangentcom/python_corona_simulation/blob/a5dddd3e13d2bb768a9294d85ab27329be9a21dd/old/simple_simulation.py#L172-L234
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/flask/helpers.py
python
find_package
(import_name)
return None, package_path
Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to import the module. The prefix is ...
Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to import the module. The prefix is ...
[ "Finds", "a", "package", "and", "returns", "the", "prefix", "(", "or", "None", "if", "the", "package", "is", "not", "installed", ")", "as", "well", "as", "the", "folder", "that", "contains", "the", "package", "or", "module", "as", "a", "tuple", ".", "T...
def find_package(import_name): """Finds a package and returns the prefix (or None if the package is not installed) as well as the folder that contains the package or module as a tuple. The package path returned is the module that would have to be added to the pythonpath in order to make it possible to ...
[ "def", "find_package", "(", "import_name", ")", ":", "root_mod_name", "=", "import_name", ".", "split", "(", "'.'", ")", "[", "0", "]", "loader", "=", "pkgutil", ".", "get_loader", "(", "root_mod_name", ")", "if", "loader", "is", "None", "or", "import_name...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/flask/helpers.py#L652-L700
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/runpy.py
python
_run_module_code
(code, init_globals=None, mod_name=None, mod_fname=None, mod_loader=None, pkg_name=None)
return mod_globals.copy()
Helper to run code in new namespace with sys modified
Helper to run code in new namespace with sys modified
[ "Helper", "to", "run", "code", "in", "new", "namespace", "with", "sys", "modified" ]
def _run_module_code(code, init_globals=None, mod_name=None, mod_fname=None, mod_loader=None, pkg_name=None): """Helper to run code in new namespace with sys modified""" with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname): mod_globals = temp_modul...
[ "def", "_run_module_code", "(", "code", ",", "init_globals", "=", "None", ",", "mod_name", "=", "None", ",", "mod_fname", "=", "None", ",", "mod_loader", "=", "None", ",", "pkg_name", "=", "None", ")", ":", "with", "_TempModule", "(", "mod_name", ")", "a...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/runpy.py#L75-L85
mithril-global/GoAgentX
788fbd5e1c824c75cf98a9aef8a6d4ec8df25e95
GoAgentX.app/Contents/PlugIns/shadowsocks.gxbundle/Contents/Resources/bin/python/M2Crypto/ftpslib.py
python
FTP_TLS.auth_tls
(self)
Secure the control connection per AUTH TLS, aka AUTH TLS-C.
Secure the control connection per AUTH TLS, aka AUTH TLS-C.
[ "Secure", "the", "control", "connection", "per", "AUTH", "TLS", "aka", "AUTH", "TLS", "-", "C", "." ]
def auth_tls(self): """Secure the control connection per AUTH TLS, aka AUTH TLS-C.""" self.voidcmd('AUTH TLS') s = SSL.Connection(self.ssl_ctx, self.sock) s.setup_ssl() s.set_connect_state() s.connect_ssl() self.sock = s self.file = self.sock.makefile()
[ "def", "auth_tls", "(", "self", ")", ":", "self", ".", "voidcmd", "(", "'AUTH TLS'", ")", "s", "=", "SSL", ".", "Connection", "(", "self", ".", "ssl_ctx", ",", "self", ".", "sock", ")", "s", ".", "setup_ssl", "(", ")", "s", ".", "set_connect_state", ...
https://github.com/mithril-global/GoAgentX/blob/788fbd5e1c824c75cf98a9aef8a6d4ec8df25e95/GoAgentX.app/Contents/PlugIns/shadowsocks.gxbundle/Contents/Resources/bin/python/M2Crypto/ftpslib.py#L58-L66
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py
python
ClusterSeed.mutation_class
(self, depth=infinity, show_depth=False, return_paths=False, up_to_equivalence=True, only_sink_source=False)
return list( S for S in self.mutation_class_iter( depth=depth, show_depth=show_depth, return_paths=return_paths, up_to_equivalence=up_to_equivalence, only_sink_source=only_sink_source ) )
r""" Return the mutation class of ``self`` with respect to certain constraints. .. NOTE:: Vertex labels are not tracked in this method. .. SEEALSO:: :meth:`mutation_class_iter` INPUT: - ``depth`` -- (default: ``infinity`) integer, only seeds ...
r""" Return the mutation class of ``self`` with respect to certain constraints.
[ "r", "Return", "the", "mutation", "class", "of", "self", "with", "respect", "to", "certain", "constraints", "." ]
def mutation_class(self, depth=infinity, show_depth=False, return_paths=False, up_to_equivalence=True, only_sink_source=False): r""" Return the mutation class of ``self`` with respect to certain constraints. .. NOTE:: Vertex labels are not tracked in ...
[ "def", "mutation_class", "(", "self", ",", "depth", "=", "infinity", ",", "show_depth", "=", "False", ",", "return_paths", "=", "False", ",", "up_to_equivalence", "=", "True", ",", "only_sink_source", "=", "False", ")", ":", "if", "depth", "is", "infinity", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/cluster_algebra_quiver/cluster_seed.py#L3519-L3557
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/net/proto2/python/public/service.py
python
RpcController.NotifyOnCancel
(self, callback)
Sets a callback to invoke on cancel. Asks that the given callback be called when the RPC is canceled. The callback will always be called exactly once. If the RPC completes without being canceled, the callback will be called after completion. If the RPC has already been canceled when NotifyOnCancel()...
Sets a callback to invoke on cancel.
[ "Sets", "a", "callback", "to", "invoke", "on", "cancel", "." ]
def NotifyOnCancel(self, callback): """Sets a callback to invoke on cancel. Asks that the given callback be called when the RPC is canceled. The callback will always be called exactly once. If the RPC completes without being canceled, the callback will be called after completion. If the RPC has ...
[ "def", "NotifyOnCancel", "(", "self", ",", "callback", ")", ":", "raise", "NotImplementedError" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/net/proto2/python/public/service.py#L176-L187
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
libnamebench/geoip.py
python
GetInfoForCountry
(country_name_or_code)
Get code, name, lat and lon for a given country name or code.
Get code, name, lat and lon for a given country name or code.
[ "Get", "code", "name", "lat", "and", "lon", "for", "a", "given", "country", "name", "or", "code", "." ]
def GetInfoForCountry(country_name_or_code): """Get code, name, lat and lon for a given country name or code.""" match = False partial_match = False if not country_name_or_code: return None if len(country_name_or_code) == 2: country_code = country_name_or_code.upper() country_name = False els...
[ "def", "GetInfoForCountry", "(", "country_name_or_code", ")", ":", "match", "=", "False", "partial_match", "=", "False", "if", "not", "country_name_or_code", ":", "return", "None", "if", "len", "(", "country_name_or_code", ")", "==", "2", ":", "country_code", "=...
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/libnamebench/geoip.py#L75-L114
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/sem/drt.py
python
DrsDrawer._get_centered_top
(self, top, full_height, item_height)
return top + (full_height - item_height) / 2
Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.
Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.
[ "Get", "the", "y", "-", "coordinate", "of", "the", "point", "that", "a", "figure", "should", "start", "at", "if", "its", "height", "is", "item_height", "and", "it", "needs", "to", "be", "centered", "in", "an", "area", "that", "starts", "at", "top", "an...
def _get_centered_top(self, top, full_height, item_height): """Get the y-coordinate of the point that a figure should start at if its height is 'item_height' and it needs to be centered in an area that starts at 'top' and is 'full_height' tall.""" return top + (full_height - item_height)...
[ "def", "_get_centered_top", "(", "self", ",", "top", ",", "full_height", ",", "item_height", ")", ":", "return", "top", "+", "(", "full_height", "-", "item_height", ")", "/", "2" ]
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/sem/drt.py#L1038-L1042
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/contrib/admin/templatetags/log.py
python
get_admin_log
(parser, token)
return AdminLogNode(limit=tokens[1], varname=tokens[3], user=(len(tokens) > 5 and tokens[5] or None))
Populates a template variable with the admin log for the given criteria. Usage:: {% get_admin_log [limit] as [varname] for_user [context_var_containing_user_obj] %} Examples:: {% get_admin_log 10 as admin_log for_user 23 %} {% get_admin_log 10 as admin_log for_user user %} {%...
Populates a template variable with the admin log for the given criteria.
[ "Populates", "a", "template", "variable", "with", "the", "admin", "log", "for", "the", "given", "criteria", "." ]
def get_admin_log(parser, token): """ Populates a template variable with the admin log for the given criteria. Usage:: {% get_admin_log [limit] as [varname] for_user [context_var_containing_user_obj] %} Examples:: {% get_admin_log 10 as admin_log for_user 23 %} {% get_admin_l...
[ "def", "get_admin_log", "(", "parser", ",", "token", ")", ":", "tokens", "=", "token", ".", "contents", ".", "split", "(", ")", "if", "len", "(", "tokens", ")", "<", "4", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'get_admin_log' stateme...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/admin/templatetags/log.py#L24-L56
LeGoffLoic/Nodz
0ee255c62883f7a374a9de6cbcf555e3352e5dec
nodz_main.py
python
Nodz.mouseReleaseEvent
(self, event)
Apply tablet zoom, dragging and selection.
Apply tablet zoom, dragging and selection.
[ "Apply", "tablet", "zoom", "dragging", "and", "selection", "." ]
def mouseReleaseEvent(self, event): """ Apply tablet zoom, dragging and selection. """ # Zoom the View. if self.currentState == '.ZOOM_VIEW': self.offset = 0 self.zoomDirection = 0 self.zoomIncr = 0 self.setInteractive(True) ...
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "# Zoom the View.", "if", "self", ".", "currentState", "==", "'.ZOOM_VIEW'", ":", "self", ".", "offset", "=", "0", "self", ".", "zoomDirection", "=", "0", "self", ".", "zoomIncr", "=", "0", ...
https://github.com/LeGoffLoic/Nodz/blob/0ee255c62883f7a374a9de6cbcf555e3352e5dec/nodz_main.py#L219-L281
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/space/npy_tensors.py
python
NumpyTensorSpace.is_weighted
(self)
return not ( isinstance(self.weighting, NumpyTensorSpaceConstWeighting) and self.weighting.const == 1.0)
Return ``True`` if the space is not weighted by constant 1.0.
Return ``True`` if the space is not weighted by constant 1.0.
[ "Return", "True", "if", "the", "space", "is", "not", "weighted", "by", "constant", "1", ".", "0", "." ]
def is_weighted(self): """Return ``True`` if the space is not weighted by constant 1.0.""" return not ( isinstance(self.weighting, NumpyTensorSpaceConstWeighting) and self.weighting.const == 1.0)
[ "def", "is_weighted", "(", "self", ")", ":", "return", "not", "(", "isinstance", "(", "self", ".", "weighting", ",", "NumpyTensorSpaceConstWeighting", ")", "and", "self", ".", "weighting", ".", "const", "==", "1.0", ")" ]
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/space/npy_tensors.py#L308-L312
timkpaine/pyEX
254acd2b0cf7cb7183100106f4ecc11d1860c46a
pyEX/stats/stats.py
python
dailyDF
(*args, **kwargs)
return _toDatetime(pd.DataFrame(daily(*args, **kwargs)))
[]
def dailyDF(*args, **kwargs): return _toDatetime(pd.DataFrame(daily(*args, **kwargs)))
[ "def", "dailyDF", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_toDatetime", "(", "pd", ".", "DataFrame", "(", "daily", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", ")" ]
https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stats/stats.py#L174-L175
aws/sagemaker-containers
526dda90d636c7fb0c25791e6c57d077bd972000
src/sagemaker_containers/_env.py
python
TrainingEnv.input_config_dir
(self)
return self._input_config_dir
The directory where standard SageMaker configuration files are located, e.g. /opt/ml/input/config/. SageMaker training creates the following files in this folder when training starts: - `hyperparameters.json`: Amazon SageMaker makes the hyperparameters in a ...
The directory where standard SageMaker configuration files are located, e.g. /opt/ml/input/config/. SageMaker training creates the following files in this folder when training starts: - `hyperparameters.json`: Amazon SageMaker makes the hyperparameters in a ...
[ "The", "directory", "where", "standard", "SageMaker", "configuration", "files", "are", "located", "e", ".", "g", ".", "/", "opt", "/", "ml", "/", "input", "/", "config", "/", ".", "SageMaker", "training", "creates", "the", "following", "files", "in", "this...
def input_config_dir(self): # type: () -> str """The directory where standard SageMaker configuration files are located, e.g. /opt/ml/input/config/. SageMaker training creates the following files in this folder when training starts: - `hyperparameters.json`: Amazon SageMaker makes t...
[ "def", "input_config_dir", "(", "self", ")", ":", "# type: () -> str", "return", "self", ".", "_input_config_dir" ]
https://github.com/aws/sagemaker-containers/blob/526dda90d636c7fb0c25791e6c57d077bd972000/src/sagemaker_containers/_env.py#L751-L767
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
examples/nestedconversationbot.py
python
show_data
(update: Update, context: CallbackContext)
return SHOWING
Pretty print gathered data.
Pretty print gathered data.
[ "Pretty", "print", "gathered", "data", "." ]
def show_data(update: Update, context: CallbackContext) -> str: """Pretty print gathered data.""" def prettyprint(user_data: Dict[str, Any], level: str) -> str: people = user_data.get(level) if not people: return '\nNo information yet.' text = '' if level == SELF: ...
[ "def", "show_data", "(", "update", ":", "Update", ",", "context", ":", "CallbackContext", ")", "->", "str", ":", "def", "prettyprint", "(", "user_data", ":", "Dict", "[", "str", ",", "Any", "]", ",", "level", ":", "str", ")", "->", "str", ":", "peopl...
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/examples/nestedconversationbot.py#L120-L152
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/email/message.py
python
Message.get_param
(self, param, failobj=None, header='content-type', unquote=True)
return failobj
Return the parameter value if found in the Content-Type header. Optional failobj is the object to return if there is no Content-Type header, or the Content-Type header has no such parameter. Optional header is the header to search instead of Content-Type. Parameter keys are always com...
Return the parameter value if found in the Content-Type header.
[ "Return", "the", "parameter", "value", "if", "found", "in", "the", "Content", "-", "Type", "header", "." ]
def get_param(self, param, failobj=None, header='content-type', unquote=True): """Return the parameter value if found in the Content-Type header. Optional failobj is the object to return if there is no Content-Type header, or the Content-Type header has no such parameter. Opt...
[ "def", "get_param", "(", "self", ",", "param", ",", "failobj", "=", "None", ",", "header", "=", "'content-type'", ",", "unquote", "=", "True", ")", ":", "if", "header", "not", "in", "self", ":", "return", "failobj", "for", "k", ",", "v", "in", "self"...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/email/message.py#L535-L569
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/temperature.py
python
TemperatureRepository.__init__
(self)
Set the default settings, execute title & settings fileName.
Set the default settings, execute title & settings fileName.
[ "Set", "the", "default", "settings", "execute", "title", "&", "settings", "fileName", "." ]
def __init__(self): "Set the default settings, execute title & settings fileName." skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.temperature.html', self ) self.fileNameInput = settings.FileNameInput().getFromFileName( fabmetheus_interpret.getGNUTranslato...
[ "def", "__init__", "(", "self", ")", ":", "skeinforge_profile", ".", "addListsToCraftTypeRepository", "(", "'skeinforge_application.skeinforge_plugins.craft_plugins.temperature.html'", ",", "self", ")", "self", ".", "fileNameInput", "=", "settings", ".", "FileNameInput", "(...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/temperature.py#L142-L160
FriedAppleTeam/FRAPL
89c14d57e0cc77b915fe1e95f60e9e1847699103
Framework/FridaLink/FridaLink/Core/HookEngine.py
python
HookEngineProtocol.handleHookInstBreakOnce
(self, screenEA = None)
[]
def handleHookInstBreakOnce(self, screenEA = None): if screenEA is not None: address = screenEA else: address = ScreenEA() self.handleQuickInstHook(address, True, True)
[ "def", "handleHookInstBreakOnce", "(", "self", ",", "screenEA", "=", "None", ")", ":", "if", "screenEA", "is", "not", "None", ":", "address", "=", "screenEA", "else", ":", "address", "=", "ScreenEA", "(", ")", "self", ".", "handleQuickInstHook", "(", "addr...
https://github.com/FriedAppleTeam/FRAPL/blob/89c14d57e0cc77b915fe1e95f60e9e1847699103/Framework/FridaLink/FridaLink/Core/HookEngine.py#L175-L181
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
nginx_ingress_controller/datadog_checks/nginx_ingress_controller/config_models/defaults.py
python
instance_empty_default_hostname
(field, value)
return False
[]
def instance_empty_default_hostname(field, value): return False
[ "def", "instance_empty_default_hostname", "(", "field", ",", "value", ")", ":", "return", "False" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/nginx_ingress_controller/datadog_checks/nginx_ingress_controller/config_models/defaults.py#L73-L74
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/monitor/monitor/openstack/common/setup.py
python
_get_revno
(git_dir)
return len(revlist.splitlines())
Return the number of commits since the most recent tag. We use git-describe to find this out, but if there are no tags then we fall back to counting commits since the beginning of time.
Return the number of commits since the most recent tag.
[ "Return", "the", "number", "of", "commits", "since", "the", "most", "recent", "tag", "." ]
def _get_revno(git_dir): """Return the number of commits since the most recent tag. We use git-describe to find this out, but if there are no tags then we fall back to counting commits since the beginning of time. """ describe = _run_shell_command( "git --git-dir=%s describe --always" %...
[ "def", "_get_revno", "(", "git_dir", ")", ":", "describe", "=", "_run_shell_command", "(", "\"git --git-dir=%s describe --always\"", "%", "git_dir", ")", "if", "\"-\"", "in", "describe", ":", "return", "describe", ".", "rsplit", "(", "\"-\"", ",", "2", ")", "[...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/openstack/common/setup.py#L280-L295
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/scapy/arch/linux.py
python
VEthPair.up
(self)
set veth pair links up :raises subprocess.CalledProcessError if operation fails
set veth pair links up :raises subprocess.CalledProcessError if operation fails
[ "set", "veth", "pair", "links", "up", ":", "raises", "subprocess", ".", "CalledProcessError", "if", "operation", "fails" ]
def up(self): # type: () -> None """ set veth pair links up :raises subprocess.CalledProcessError if operation fails """ for idx in [0, 1]: subprocess.check_call(["ip", "link", "set", self.ifaces[idx], "up"])
[ "def", "up", "(", "self", ")", ":", "# type: () -> None", "for", "idx", "in", "[", "0", ",", "1", "]", ":", "subprocess", ".", "check_call", "(", "[", "\"ip\"", ",", "\"link\"", ",", "\"set\"", ",", "self", ".", "ifaces", "[", "idx", "]", ",", "\"u...
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/scapy/arch/linux.py#L674-L681
nschloe/quadpy
c4c076d8ddfa968486a2443a95e2fb3780dcde0f
src/quadpy/t2/_albrecht_collatz.py
python
albrecht_collatz
()
return T2Scheme("Albrecht-Collatz", d, 3, source, tol=2.776e-16)
[]
def albrecht_collatz(): d = {"d3_aa": [[frac(1, 30), frac(9, 30)], [frac(1, 2), frac(1, 6)]]} return T2Scheme("Albrecht-Collatz", d, 3, source, tol=2.776e-16)
[ "def", "albrecht_collatz", "(", ")", ":", "d", "=", "{", "\"d3_aa\"", ":", "[", "[", "frac", "(", "1", ",", "30", ")", ",", "frac", "(", "9", ",", "30", ")", "]", ",", "[", "frac", "(", "1", ",", "2", ")", ",", "frac", "(", "1", ",", "6",...
https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/t2/_albrecht_collatz.py#L18-L20
PyCQA/astroid
a815443f62faae05249621a396dcf0afd884a619
astroid/nodes/node_classes.py
python
If.block_range
(self, lineno)
return self._elsed_block_range(lineno, self.orelse, self.body[0].fromlineno - 1)
Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. :rtype: tuple(int, int)
Get a range from the given line number to where this node ends.
[ "Get", "a", "range", "from", "the", "given", "line", "number", "to", "where", "this", "node", "ends", "." ]
def block_range(self, lineno): """Get a range from the given line number to where this node ends. :param lineno: The line number to start the range at. :type lineno: int :returns: The range of line numbers that this node belongs to, starting at the given line number. ...
[ "def", "block_range", "(", "self", ",", "lineno", ")", ":", "if", "lineno", "==", "self", ".", "body", "[", "0", "]", ".", "fromlineno", ":", "return", "lineno", ",", "lineno", "if", "lineno", "<=", "self", ".", "body", "[", "-", "1", "]", ".", "...
https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/nodes/node_classes.py#L3094-L3108
beeware/toga
090370a943bdeefcdbe035b1621fbc7caeebdf1a
src/cocoa/toga_cocoa/widgets/canvas.py
python
Canvas.set_on_resize
(self, handler)
No special handling required.
No special handling required.
[ "No", "special", "handling", "required", "." ]
def set_on_resize(self, handler): """No special handling required.""" pass
[ "def", "set_on_resize", "(", "self", ",", "handler", ")", ":", "pass" ]
https://github.com/beeware/toga/blob/090370a943bdeefcdbe035b1621fbc7caeebdf1a/src/cocoa/toga_cocoa/widgets/canvas.py#L271-L273
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/openshift_facts/library/openshift_facts.py
python
set_url_facts_if_unset
(facts)
return facts
Set url facts if not already present in facts dict Args: facts (dict): existing facts Returns: dict: the facts dict updated with the generated url facts if they were not already present
Set url facts if not already present in facts dict
[ "Set", "url", "facts", "if", "not", "already", "present", "in", "facts", "dict" ]
def set_url_facts_if_unset(facts): """ Set url facts if not already present in facts dict Args: facts (dict): existing facts Returns: dict: the facts dict updated with the generated url facts if they were not already present """ if 'master' in facts...
[ "def", "set_url_facts_if_unset", "(", "facts", ")", ":", "if", "'master'", "in", "facts", ":", "hostname", "=", "facts", "[", "'common'", "]", "[", "'hostname'", "]", "cluster_hostname", "=", "facts", "[", "'master'", "]", ".", "get", "(", "'cluster_hostname...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/openshift_facts/library/openshift_facts.py#L406-L477
zapier/email-reply-parser
f67a872de3c7bebe3bd836afec60ab3f1201e8a6
email_reply_parser/__init__.py
python
EmailMessage.reply
(self)
return '\n'.join(reply)
Captures reply message within email
Captures reply message within email
[ "Captures", "reply", "message", "within", "email" ]
def reply(self): """ Captures reply message within email """ reply = [] for f in self.fragments: if not (f.hidden or f.quoted): reply.append(f.content) return '\n'.join(reply)
[ "def", "reply", "(", "self", ")", ":", "reply", "=", "[", "]", "for", "f", "in", "self", ".", "fragments", ":", "if", "not", "(", "f", ".", "hidden", "or", "f", ".", "quoted", ")", ":", "reply", ".", "append", "(", "f", ".", "content", ")", "...
https://github.com/zapier/email-reply-parser/blob/f67a872de3c7bebe3bd836afec60ab3f1201e8a6/email_reply_parser/__init__.py#L83-L90
Chia-Network/chia-blockchain
34d44c1324ae634a0896f7b02eaa2802af9526cd
chia/farmer/farmer_api.py
python
FarmerAPI.new_proof_of_space
( self, new_proof_of_space: harvester_protocol.NewProofOfSpace, peer: ws.WSChiaConnection )
This is a response from the harvester, for a NewChallenge. Here we check if the proof of space is sufficiently good, and if so, we ask for the whole proof.
This is a response from the harvester, for a NewChallenge. Here we check if the proof of space is sufficiently good, and if so, we ask for the whole proof.
[ "This", "is", "a", "response", "from", "the", "harvester", "for", "a", "NewChallenge", ".", "Here", "we", "check", "if", "the", "proof", "of", "space", "is", "sufficiently", "good", "and", "if", "so", "we", "ask", "for", "the", "whole", "proof", "." ]
async def new_proof_of_space( self, new_proof_of_space: harvester_protocol.NewProofOfSpace, peer: ws.WSChiaConnection ): """ This is a response from the harvester, for a NewChallenge. Here we check if the proof of space is sufficiently good, and if so, we ask for the whole proof. ...
[ "async", "def", "new_proof_of_space", "(", "self", ",", "new_proof_of_space", ":", "harvester_protocol", ".", "NewProofOfSpace", ",", "peer", ":", "ws", ".", "WSChiaConnection", ")", ":", "if", "new_proof_of_space", ".", "sp_hash", "not", "in", "self", ".", "far...
https://github.com/Chia-Network/chia-blockchain/blob/34d44c1324ae634a0896f7b02eaa2802af9526cd/chia/farmer/farmer_api.py#L52-L266
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py
python
TreeBuilder.generateImpliedEndTags
(self, exclude=None)
[]
def generateImpliedEndTags(self, exclude=None): name = self.openElements[-1].name # XXX td, th and tr are not actually needed if (name in frozenset(("dd", "dt", "li", "option", "optgroup", "p", "rp", "rt")) and name != exclude): self.openElements.pop() # X...
[ "def", "generateImpliedEndTags", "(", "self", ",", "exclude", "=", "None", ")", ":", "name", "=", "self", ".", "openElements", "[", "-", "1", "]", ".", "name", "# XXX td, th and tr are not actually needed", "if", "(", "name", "in", "frozenset", "(", "(", "\"...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py#L359-L367
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/helpers/entity.py
python
Entity.icon
(self)
return None
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
[ "Return", "the", "icon", "to", "use", "in", "the", "frontend", "if", "any", "." ]
def icon(self) -> str | None: """Return the icon to use in the frontend, if any.""" if hasattr(self, "_attr_icon"): return self._attr_icon if hasattr(self, "entity_description"): return self.entity_description.icon return None
[ "def", "icon", "(", "self", ")", "->", "str", "|", "None", ":", "if", "hasattr", "(", "self", ",", "\"_attr_icon\"", ")", ":", "return", "self", ".", "_attr_icon", "if", "hasattr", "(", "self", ",", "\"entity_description\"", ")", ":", "return", "self", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/entity.py#L382-L388
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
examples/series/series_groupby.py
python
series_groupby
()
return S.groupby(by).mean()
[]
def series_groupby(): S = pd.Series([390., 350., 30., 20.]) by = np.asarray([0, 1, 0, 1]) # Expect Series of pd.Series([210.0, 185.0], index=[0, 1]) return S.groupby(by).mean()
[ "def", "series_groupby", "(", ")", ":", "S", "=", "pd", ".", "Series", "(", "[", "390.", ",", "350.", ",", "30.", ",", "20.", "]", ")", "by", "=", "np", ".", "asarray", "(", "[", "0", ",", "1", ",", "0", ",", "1", "]", ")", "# Expect Series o...
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/examples/series/series_groupby.py#L39-L44
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
pcbasic/basic/converter/lister.py
python
Lister.token_to_line_number
(self, trail)
return struct.unpack_from('<H', trail, 2)[0]
Unpack a line number token trail, -1 if end of program.
Unpack a line number token trail, -1 if end of program.
[ "Unpack", "a", "line", "number", "token", "trail", "-", "1", "if", "end", "of", "program", "." ]
def token_to_line_number(self, trail): """Unpack a line number token trail, -1 if end of program.""" if len(trail) < 4 or trail[:2] == b'\0\0': return -1 return struct.unpack_from('<H', trail, 2)[0]
[ "def", "token_to_line_number", "(", "self", ",", "trail", ")", ":", "if", "len", "(", "trail", ")", "<", "4", "or", "trail", "[", ":", "2", "]", "==", "b'\\0\\0'", ":", "return", "-", "1", "return", "struct", ".", "unpack_from", "(", "'<H'", ",", "...
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/converter/lister.py#L53-L57
google/capirca
679e3885e3a5e5e129dc2dfab204ec44d63b26a4
capirca/lib/aclgenerator.py
python
ACLGenerator._GetSupportedTokens
(self)
return supported_tokens, supported_sub_tokens
Build our supported tokens and sub tokens. Returns: tuple containing the supported tokens and sub tokens. Raises: UnsupportedFilterError: Raised when token is not supported.
Build our supported tokens and sub tokens.
[ "Build", "our", "supported", "tokens", "and", "sub", "tokens", "." ]
def _GetSupportedTokens(self): """Build our supported tokens and sub tokens. Returns: tuple containing the supported tokens and sub tokens. Raises: UnsupportedFilterError: Raised when token is not supported. """ supported_tokens, supported_sub_tokens = self._BuildTokens() # make sur...
[ "def", "_GetSupportedTokens", "(", "self", ")", ":", "supported_tokens", ",", "supported_sub_tokens", "=", "self", ".", "_BuildTokens", "(", ")", "# make sure we don't have subtokens that are not listed. This should not", "# occur unless a platform's tokens/subtokens are changed.", ...
https://github.com/google/capirca/blob/679e3885e3a5e5e129dc2dfab204ec44d63b26a4/capirca/lib/aclgenerator.py#L382-L399
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/blenderbot/modeling_blenderbot.py
python
BlenderbotPreTrainedModel._set_gradient_checkpointing
(self, module, value=False)
[]
def _set_gradient_checkpointing(self, module, value=False): if isinstance(module, (BlenderbotDecoder, BlenderbotEncoder)): module.gradient_checkpointing = value
[ "def", "_set_gradient_checkpointing", "(", "self", ",", "module", ",", "value", "=", "False", ")", ":", "if", "isinstance", "(", "module", ",", "(", "BlenderbotDecoder", ",", "BlenderbotEncoder", ")", ")", ":", "module", ".", "gradient_checkpointing", "=", "va...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/blenderbot/modeling_blenderbot.py#L476-L478
minerllabs/minerl
0123527c334c96ebb3f0cf313df1552fa4302691
minerl/herobraine/hero/handlers/translation.py
python
KeymapTranslationHandler.to_hero
(self, x)
What does it mean to do a keymap translation here? Since hero sends things as commands perhaps we could generalize this beyond observations.
What does it mean to do a keymap translation here? Since hero sends things as commands perhaps we could generalize this beyond observations.
[ "What", "does", "it", "mean", "to", "do", "a", "keymap", "translation", "here?", "Since", "hero", "sends", "things", "as", "commands", "perhaps", "we", "could", "generalize", "this", "beyond", "observations", "." ]
def to_hero(self, x) -> str: """What does it mean to do a keymap translation here? Since hero sends things as commands perhaps we could generalize this beyond observations. """ raise NotImplementedError()
[ "def", "to_hero", "(", "self", ",", "x", ")", "->", "str", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/hero/handlers/translation.py#L92-L97
pventuzelo/octopus
e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983
octopus/engine/disassembler.py
python
Disassembler.disassemble
(self, bytecode=None, offset=0, r_format='list')
Generic method to disassemble bytecode :param bytecode: bytecode sequence :param offset: start offset :param r_format: output format ('list'/'text'/'reverse') :type bytecode: bytes, str :type offset: int :type r_format: list, str, dict :return: dissassembly resul...
Generic method to disassemble bytecode
[ "Generic", "method", "to", "disassemble", "bytecode" ]
def disassemble(self, bytecode=None, offset=0, r_format='list'): """Generic method to disassemble bytecode :param bytecode: bytecode sequence :param offset: start offset :param r_format: output format ('list'/'text'/'reverse') :type bytecode: bytes, str :type offset: int...
[ "def", "disassemble", "(", "self", ",", "bytecode", "=", "None", ",", "offset", "=", "0", ",", "r_format", "=", "'list'", ")", ":", "# reinitialize class variable", "self", ".", "attributes_reset", "(", ")", "self", ".", "bytecode", "=", "bytecode", "if", ...
https://github.com/pventuzelo/octopus/blob/e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983/octopus/engine/disassembler.py#L27-L63
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/benchmark_spec.py
python
BenchmarkSpec.ConstructNfsService
(self)
Construct the NFS service object. Creates an NFS Service only if an NFS disk is found in the disk_specs.
Construct the NFS service object.
[ "Construct", "the", "NFS", "service", "object", "." ]
def ConstructNfsService(self): """Construct the NFS service object. Creates an NFS Service only if an NFS disk is found in the disk_specs. """ if self.nfs_service: logging.info('NFS service already created: %s', self.nfs_service) return for group_spec in self.vms_to_boot.values(): ...
[ "def", "ConstructNfsService", "(", "self", ")", ":", "if", "self", ".", "nfs_service", ":", "logging", ".", "info", "(", "'NFS service already created: %s'", ",", "self", ".", "nfs_service", ")", "return", "for", "group_spec", "in", "self", ".", "vms_to_boot", ...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/benchmark_spec.py#L371-L397
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/contrib/pynumero/sparse/block_matrix.py
python
BlockMatrix.copy_structure
(self)
return result
Makes a copy of the structure of this BlockMatrix. This proivides a light-weighted copy of each block in this BlockMatrix. The blocks in the resulting matrix have the same shape as in the original matrices but not the same number of nonzeros. Returns ------- BlockMatrix
Makes a copy of the structure of this BlockMatrix. This proivides a light-weighted copy of each block in this BlockMatrix. The blocks in the resulting matrix have the same shape as in the original matrices but not the same number of nonzeros.
[ "Makes", "a", "copy", "of", "the", "structure", "of", "this", "BlockMatrix", ".", "This", "proivides", "a", "light", "-", "weighted", "copy", "of", "each", "block", "in", "this", "BlockMatrix", ".", "The", "blocks", "in", "the", "resulting", "matrix", "hav...
def copy_structure(self): """ Makes a copy of the structure of this BlockMatrix. This proivides a light-weighted copy of each block in this BlockMatrix. The blocks in the resulting matrix have the same shape as in the original matrices but not the same number of nonzeros. ...
[ "def", "copy_structure", "(", "self", ")", ":", "m", ",", "n", "=", "self", ".", "bshape", "result", "=", "BlockMatrix", "(", "m", ",", "n", ")", "for", "row", "in", "range", "(", "m", ")", ":", "if", "self", ".", "is_row_size_defined", "(", "row",...
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/pynumero/sparse/block_matrix.py#L734-L761
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/ogl/basic.py
python
Shape.HitTest
(self, x, y)
return False
Given a point on a canvas, returns `True` if the point was on the shape, and returns the nearest attachment point and distance from the given point and target. :param `x`: the x position :param `y`: the y position
Given a point on a canvas, returns `True` if the point was on the shape, and returns the nearest attachment point and distance from the given point and target.
[ "Given", "a", "point", "on", "a", "canvas", "returns", "True", "if", "the", "point", "was", "on", "the", "shape", "and", "returns", "the", "nearest", "attachment", "point", "and", "distance", "from", "the", "given", "point", "and", "target", "." ]
def HitTest(self, x, y): """ Given a point on a canvas, returns `True` if the point was on the shape, and returns the nearest attachment point and distance from the given point and target. :param `x`: the x position :param `y`: the y position """ width, ...
[ "def", "HitTest", "(", "self", ",", "x", ",", "y", ")", ":", "width", ",", "height", "=", "self", ".", "GetBoundingBoxMax", "(", ")", "if", "abs", "(", "width", ")", "<", "4", ":", "width", "=", "4.0", "if", "abs", "(", "height", ")", "<", "4",...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/ogl/basic.py#L624-L669
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py
python
OpsWorksConnection.stop_stack
(self, stack_id)
return self.make_request(action='StopStack', body=json.dumps(params))
Stops a specified stack. **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see `Managing User Permissions`_. :...
Stops a specified stack.
[ "Stops", "a", "specified", "stack", "." ]
def stop_stack(self, stack_id): """ Stops a specified stack. **Required Permissions**: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, ...
[ "def", "stop_stack", "(", "self", ",", "stack_id", ")", ":", "params", "=", "{", "'StackId'", ":", "stack_id", ",", "}", "return", "self", ".", "make_request", "(", "action", "=", "'StopStack'", ",", "body", "=", "json", ".", "dumps", "(", "params", ")...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py#L2356-L2372
feliam/pysymemu
ad02e52122099d537372eb4d11fd5024b8a3857f
cpu.py
python
Cpu.DEC
(cpu, dest)
Decrements by 1. Subtracts 1 from the destination operand, while preserving the state of the CF flag. The destination operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF flag. (To perform a decrement operation th...
Decrements by 1. Subtracts 1 from the destination operand, while preserving the state of the CF flag. The destination operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF flag. (To perform a decrement operation th...
[ "Decrements", "by", "1", ".", "Subtracts", "1", "from", "the", "destination", "operand", "while", "preserving", "the", "state", "of", "the", "CF", "flag", ".", "The", "destination", "operand", "can", "be", "a", "register", "or", "a", "memory", "location", ...
def DEC(cpu, dest): ''' Decrements by 1. Subtracts 1 from the destination operand, while preserving the state of the CF flag. The destination operand can be a register or a memory location. This instruction allows a loop counter to be updated without disturbing the CF f...
[ "def", "DEC", "(", "cpu", ",", "dest", ")", ":", "arg0", "=", "dest", ".", "read", "(", ")", "res", "=", "dest", ".", "write", "(", "arg0", "-", "1", ")", "#Affected Flags o..szapc", "cpu", ".", "calculateFlags", "(", "'DEC'", ",", "dest", ".", "si...
https://github.com/feliam/pysymemu/blob/ad02e52122099d537372eb4d11fd5024b8a3857f/cpu.py#L1687-L1707
interpretml/interpret-text
d74efc985270aaa2b3ab779408597d9505e9ea1d
python/interpret_text/experimental/introspective_rationale/explainer.py
python
IntrospectiveRationaleExplainer.train
(self, *args, **kwargs)
return self.fit(*args, **kwargs)
Optionally pretrain the generator's introspective classifier, then train the explainer's model on the training data, with testing at the end of every epoch.
Optionally pretrain the generator's introspective classifier, then train the explainer's model on the training data, with testing at the end of every epoch.
[ "Optionally", "pretrain", "the", "generator", "s", "introspective", "classifier", "then", "train", "the", "explainer", "s", "model", "on", "the", "training", "data", "with", "testing", "at", "the", "end", "of", "every", "epoch", "." ]
def train(self, *args, **kwargs): """ Optionally pretrain the generator's introspective classifier, then train the explainer's model on the training data, with testing at the end of every epoch. """ return self.fit(*args, **kwargs)
[ "def", "train", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "fit", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/interpretml/interpret-text/blob/d74efc985270aaa2b3ab779408597d9505e9ea1d/python/interpret_text/experimental/introspective_rationale/explainer.py#L282-L287
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/node_link_conversion.py
python
ConvertNormalToEuler.insert
(self, nodeTree, origin, target, dataOrigin)
[]
def insert(self, nodeTree, origin, target, dataOrigin): insertLinkedNode(nodeTree, "an_DirectionToRotationNode", origin, target)
[ "def", "insert", "(", "self", ",", "nodeTree", ",", "origin", ",", "target", ",", "dataOrigin", ")", ":", "insertLinkedNode", "(", "nodeTree", ",", "\"an_DirectionToRotationNode\"", ",", "origin", ",", "target", ")" ]
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/node_link_conversion.py#L116-L117
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/web.py
python
RequestHandler.xsrf_form_html
(self)
return ( '<input type="hidden" name="_xsrf" value="' + escape.xhtml_escape(self.xsrf_token) + '"/>' )
An HTML ``<input/>`` element to be included with all POST forms. It defines the ``_xsrf`` input value, which we check on all POST requests to prevent cross-site request forgery. If you have set the ``xsrf_cookies`` application setting, you must include this HTML within all of your HTML ...
An HTML ``<input/>`` element to be included with all POST forms.
[ "An", "HTML", "<input", "/", ">", "element", "to", "be", "included", "with", "all", "POST", "forms", "." ]
def xsrf_form_html(self) -> str: """An HTML ``<input/>`` element to be included with all POST forms. It defines the ``_xsrf`` input value, which we check on all POST requests to prevent cross-site request forgery. If you have set the ``xsrf_cookies`` application setting, you must includ...
[ "def", "xsrf_form_html", "(", "self", ")", "->", "str", ":", "return", "(", "'<input type=\"hidden\" name=\"_xsrf\" value=\"'", "+", "escape", ".", "xhtml_escape", "(", "self", ".", "xsrf_token", ")", "+", "'\"/>'", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/web.py#L1524-L1541
Ridter/MyJSRat
1be0b812eff4898618fb4cb4f678efdb360d7368
MyJSRat.py
python
myHandler.log_message
(self, format, *args)
return
Custom Log Handler to Spit out on to stderr
Custom Log Handler to Spit out on to stderr
[ "Custom", "Log", "Handler", "to", "Spit", "out", "on", "to", "stderr" ]
def log_message(self, format, *args): """ Custom Log Handler to Spit out on to stderr """ return
[ "def", "log_message", "(", "self", ",", "format", ",", "*", "args", ")", ":", "return" ]
https://github.com/Ridter/MyJSRat/blob/1be0b812eff4898618fb4cb4f678efdb360d7368/MyJSRat.py#L241-L243
Anorov/PySocks
c2fa43cbe1091e799e248e8e4433978916791a8b
socks.py
python
socksocket.get_proxy_sockname
(self)
return self.proxy_sockname
Returns the bound IP address and port number at the proxy.
Returns the bound IP address and port number at the proxy.
[ "Returns", "the", "bound", "IP", "address", "and", "port", "number", "at", "the", "proxy", "." ]
def get_proxy_sockname(self): """Returns the bound IP address and port number at the proxy.""" return self.proxy_sockname
[ "def", "get_proxy_sockname", "(", "self", ")", ":", "return", "self", ".", "proxy_sockname" ]
https://github.com/Anorov/PySocks/blob/c2fa43cbe1091e799e248e8e4433978916791a8b/socks.py#L418-L420
quantmind/pulsar
fee44e871954aa6ca36d00bb5a3739abfdb89b26
pulsar/apps/wsgi/wrappers.py
python
WsgiRequest.absolute_uri
(self, location=None, scheme=None, **query)
Builds an absolute URI from ``location`` and variables available in this request. If no ``location`` is specified, the relative URI is built from :meth:`full_path`.
Builds an absolute URI from ``location`` and variables available in this request.
[ "Builds", "an", "absolute", "URI", "from", "location", "and", "variables", "available", "in", "this", "request", "." ]
def absolute_uri(self, location=None, scheme=None, **query): """Builds an absolute URI from ``location`` and variables available in this request. If no ``location`` is specified, the relative URI is built from :meth:`full_path`. """ if not is_absolute_uri(location): ...
[ "def", "absolute_uri", "(", "self", ",", "location", "=", "None", ",", "scheme", "=", "None", ",", "*", "*", "query", ")", ":", "if", "not", "is_absolute_uri", "(", "location", ")", ":", "if", "location", "or", "location", "is", "None", ":", "location"...
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/wsgi/wrappers.py#L367-L384
StanfordVL/taskonomy
9f814867b5fe4165860862211e8e99b0f200144d
taskbank/lib/data/load_ops.py
python
rescale_image
(im, new_scale=[-1.,1.], current_scale=None, no_clip=False)
return im
Rescales an image pixel values to target_scale Args: img: A np.float_32 array, assumed between [0,1] new_scale: [min,max] current_scale: If not supplied, it is assumed to be in: [0, 1]: if dtype=float [0, 2^16]: if dtype=uint [0, 255]: if dtype=ubyte...
Rescales an image pixel values to target_scale Args: img: A np.float_32 array, assumed between [0,1] new_scale: [min,max] current_scale: If not supplied, it is assumed to be in: [0, 1]: if dtype=float [0, 2^16]: if dtype=uint [0, 255]: if dtype=ubyte...
[ "Rescales", "an", "image", "pixel", "values", "to", "target_scale", "Args", ":", "img", ":", "A", "np", ".", "float_32", "array", "assumed", "between", "[", "0", "1", "]", "new_scale", ":", "[", "min", "max", "]", "current_scale", ":", "If", "not", "su...
def rescale_image(im, new_scale=[-1.,1.], current_scale=None, no_clip=False): """ Rescales an image pixel values to target_scale Args: img: A np.float_32 array, assumed between [0,1] new_scale: [min,max] current_scale: If not supplied, it is assumed to be in: [0, 1]...
[ "def", "rescale_image", "(", "im", ",", "new_scale", "=", "[", "-", "1.", ",", "1.", "]", ",", "current_scale", "=", "None", ",", "no_clip", "=", "False", ")", ":", "im", "=", "skimage", ".", "img_as_float", "(", "im", ")", ".", "astype", "(", "np"...
https://github.com/StanfordVL/taskonomy/blob/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/load_ops.py#L246-L271
QUANTAXIS/QUANTAXIS
d6eccb97c8385854aa596d6ba8d70ec0655519ff
QUANTAXIS/QAFetch/QAbinance.py
python
QA_fetch_binance_kline_min
( symbol, start_time, end_time, frequency, callback_func=None )
Get the latest symbol‘s candlestick data with time slices 时间倒序切片获取算法,是各大交易所获取1min数据的神器,因为大部分交易所直接请求跨月跨年的1min分钟数据 会直接返回空值,只有将 start_epoch,end_epoch 切片细分到 200/300 bar 以内,才能正确返回 kline, 火币和binance,OKEx 均为如此,用上面那个函数的方式去直接请求上万bar 的分钟 kline 数据是不会有结果的。
Get the latest symbol‘s candlestick data with time slices 时间倒序切片获取算法,是各大交易所获取1min数据的神器,因为大部分交易所直接请求跨月跨年的1min分钟数据 会直接返回空值,只有将 start_epoch,end_epoch 切片细分到 200/300 bar 以内,才能正确返回 kline, 火币和binance,OKEx 均为如此,用上面那个函数的方式去直接请求上万bar 的分钟 kline 数据是不会有结果的。
[ "Get", "the", "latest", "symbol‘s", "candlestick", "data", "with", "time", "slices", "时间倒序切片获取算法,是各大交易所获取1min数据的神器,因为大部分交易所直接请求跨月跨年的1min分钟数据", "会直接返回空值,只有将", "start_epoch,end_epoch", "切片细分到", "200", "/", "300", "bar", "以内,才能正确返回", "kline,", "火币和binance,OKEx", "均为如此,用上面那个函数的方式...
def QA_fetch_binance_kline_min( symbol, start_time, end_time, frequency, callback_func=None ): """ Get the latest symbol‘s candlestick data with time slices 时间倒序切片获取算法,是各大交易所获取1min数据的神器,因为大部分交易所直接请求跨月跨年的1min分钟数据 会直接返回空值,只有将 start_epoch,end_epoch 切片细分到 200/300 bar 以内,才能正确返回 kline, ...
[ "def", "QA_fetch_binance_kline_min", "(", "symbol", ",", "start_time", ",", "end_time", ",", "frequency", ",", "callback_func", "=", "None", ")", ":", "reqParams", "=", "{", "}", "reqParams", "[", "'from'", "]", "=", "end_time", "-", "FREQUENCY_SHIFTING", "[",...
https://github.com/QUANTAXIS/QUANTAXIS/blob/d6eccb97c8385854aa596d6ba8d70ec0655519ff/QUANTAXIS/QAFetch/QAbinance.py#L307-L366
NervanaSystems/neon
8c3fb8a93b4a89303467b25817c60536542d08bd
neon/data/ticker.py
python
Task.fill_buffers
(self, time_steps, inputs, outputs, in_tensor, out_tensor, mask)
Prepare data for delivery to device. Arguments: time_steps (int): Number of time steps in this minibatch. inputs (numpy array): Inputs numpy array outputs (numpy array): Outputs numpy array in_tensor (Tensor): Device buffer holding inputs out_tensor (...
Prepare data for delivery to device.
[ "Prepare", "data", "for", "delivery", "to", "device", "." ]
def fill_buffers(self, time_steps, inputs, outputs, in_tensor, out_tensor, mask): """ Prepare data for delivery to device. Arguments: time_steps (int): Number of time steps in this minibatch. inputs (numpy array): Inputs numpy array outputs (numpy array): Out...
[ "def", "fill_buffers", "(", "self", ",", "time_steps", ",", "inputs", ",", "outputs", ",", "in_tensor", ",", "out_tensor", ",", "mask", ")", ":", "# Put inputs and outputs, which are too small, into properly shaped arrays", "columns", "=", "time_steps", "*", "self", "...
https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/data/ticker.py#L45-L70
anyoptimization/pymoo
c6426a721d95c932ae6dbb610e09b6c1b0e13594
pymoo/algorithms/soo/nonconvex/cmaes.py
python
CMAES.__init__
(self, x0=None, sigma=0.1, normalize=True, parallelize=True, maxfevals=np.inf, tolfun=1e-11, tolx=1e-11, restarts=0, restart_from_best='False', incpop...
Parameters ---------- x0 : list or `numpy.ndarray` initial guess of minimum solution before the application of the geno-phenotype transformation according to the ``transformation`` option. It can also be a string holding a Python expression that ...
[]
def __init__(self, x0=None, sigma=0.1, normalize=True, parallelize=True, maxfevals=np.inf, tolfun=1e-11, tolx=1e-11, restarts=0, restart_from_best='False', ...
[ "def", "__init__", "(", "self", ",", "x0", "=", "None", ",", "sigma", "=", "0.1", ",", "normalize", "=", "True", ",", "parallelize", "=", "True", ",", "maxfevals", "=", "np", ".", "inf", ",", "tolfun", "=", "1e-11", ",", "tolx", "=", "1e-11", ",", ...
https://github.com/anyoptimization/pymoo/blob/c6426a721d95c932ae6dbb610e09b6c1b0e13594/pymoo/algorithms/soo/nonconvex/cmaes.py#L50-L366
tanjiti/packet_analysis
457008a3e37a67b18be99dbf178ee78d5b0820c4
protocol_parse/mysqlauth.py
python
MySQLAuth.__parse_client_data
(self, sep='\x00')
return auth_detail
:return:
[]
def __parse_client_data(self, sep='\x00'): """ :return: """ auth_detail = [] data_c2s_data_list = self.__split_mysql_data(self.data_c2s) for item in data_c2s_data_list: # 1. find Login Request len_of_data_c2s = len(item) if len_of_d...
[ "def", "__parse_client_data", "(", "self", ",", "sep", "=", "'\\x00'", ")", ":", "auth_detail", "=", "[", "]", "data_c2s_data_list", "=", "self", ".", "__split_mysql_data", "(", "self", ".", "data_c2s", ")", "for", "item", "in", "data_c2s_data_list", ":", "#...
https://github.com/tanjiti/packet_analysis/blob/457008a3e37a67b18be99dbf178ee78d5b0820c4/protocol_parse/mysqlauth.py#L101-L182
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/tool/verify.py
python
Disconnected.broken
(self)
return (len(self.obj.get_parent_family_handle_list()) + len(self.obj.get_family_handle_list()) == 0)
return boolean indicating whether this rule is violated
return boolean indicating whether this rule is violated
[ "return", "boolean", "indicating", "whether", "this", "rule", "is", "violated" ]
def broken(self): """ return boolean indicating whether this rule is violated """ return (len(self.obj.get_parent_family_handle_list()) + len(self.obj.get_family_handle_list()) == 0)
[ "def", "broken", "(", "self", ")", ":", "return", "(", "len", "(", "self", ".", "obj", ".", "get_parent_family_handle_list", "(", ")", ")", "+", "len", "(", "self", ".", "obj", ".", "get_family_handle_list", "(", ")", ")", "==", "0", ")" ]
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/tool/verify.py#L1681-L1684
peering-manager/peering-manager
62c870fb9caa6dfc056feb77c595d45bc3c4988a
peeringdb/filters.py
python
NetworkIXLanFilterSet.search
(self, queryset, name, value)
return queryset.filter(qs_filter)
[]
def search(self, queryset, name, value): if not value.strip(): return queryset qs_filter = Q(net__name__icontains=value) try: qs_filter |= Q(asn=int(value.strip())) except ValueError: pass return queryset.filter(qs_filter)
[ "def", "search", "(", "self", ",", "queryset", ",", "name", ",", "value", ")", ":", "if", "not", "value", ".", "strip", "(", ")", ":", "return", "queryset", "qs_filter", "=", "Q", "(", "net__name__icontains", "=", "value", ")", "try", ":", "qs_filter",...
https://github.com/peering-manager/peering-manager/blob/62c870fb9caa6dfc056feb77c595d45bc3c4988a/peeringdb/filters.py#L28-L37
ericflo/django-pagination
d1a8f0f9fb21c5aa14c76e2f872d8eca13e5244d
pagination/paginator.py
python
FinitePage.has_next
(self)
return True
Checks for one more item than last on this page.
Checks for one more item than last on this page.
[ "Checks", "for", "one", "more", "item", "than", "last", "on", "this", "page", "." ]
def has_next(self): """ Checks for one more item than last on this page. """ try: next_item = self.paginator.object_list[self.paginator.per_page] except IndexError: return False return True
[ "def", "has_next", "(", "self", ")", ":", "try", ":", "next_item", "=", "self", ".", "paginator", ".", "object_list", "[", "self", ".", "paginator", ".", "per_page", "]", "except", "IndexError", ":", "return", "False", "return", "True" ]
https://github.com/ericflo/django-pagination/blob/d1a8f0f9fb21c5aa14c76e2f872d8eca13e5244d/pagination/paginator.py#L155-L163
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py
python
_AxesBase.set_axis_on
(self)
Turn the x- and y-axis on. This affects the axis lines, ticks, ticklabels, grid and axis labels.
Turn the x- and y-axis on.
[ "Turn", "the", "x", "-", "and", "y", "-", "axis", "on", "." ]
def set_axis_on(self): """ Turn the x- and y-axis on. This affects the axis lines, ticks, ticklabels, grid and axis labels. """ self.axison = True self.stale = True
[ "def", "set_axis_on", "(", "self", ")", ":", "self", ".", "axison", "=", "True", "self", ".", "stale", "=", "True" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/axes/_base.py#L3007-L3014
project-alice-assistant/ProjectAlice
9e0ba019643bdae0a5535c9fa4180739231dc361
core/webApi/model/SkillsApi.py
python
SkillsApi.checkUpdate
(self, skillName: str)
return jsonify(success=True)
check for updates for the specified skill :param skillName: :return:
check for updates for the specified skill :param skillName: :return:
[ "check", "for", "updates", "for", "the", "specified", "skill", ":", "param", "skillName", ":", ":", "return", ":" ]
def checkUpdate(self, skillName: str) -> Response: """ check for updates for the specified skill :param skillName: :return: """ if skillName not in self.SkillManager.allSkills: return self.skillNotFound() update = self.SkillManager.checkForSkillUpdates(skillToCheck=skillName) if update: self.Skil...
[ "def", "checkUpdate", "(", "self", ",", "skillName", ":", "str", ")", "->", "Response", ":", "if", "skillName", "not", "in", "self", ".", "SkillManager", ".", "allSkills", ":", "return", "self", ".", "skillNotFound", "(", ")", "update", "=", "self", ".",...
https://github.com/project-alice-assistant/ProjectAlice/blob/9e0ba019643bdae0a5535c9fa4180739231dc361/core/webApi/model/SkillsApi.py#L236-L249
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/html5lib/treewalkers/base.py
python
TreeWalker.unknown
(self, nodeType)
return self.error("Unknown node type: " + nodeType)
Handles unknown node types
Handles unknown node types
[ "Handles", "unknown", "node", "types" ]
def unknown(self, nodeType): """Handles unknown node types""" return self.error("Unknown node type: " + nodeType)
[ "def", "unknown", "(", "self", ",", "nodeType", ")", ":", "return", "self", ".", "error", "(", "\"Unknown node type: \"", "+", "nodeType", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/html5lib/treewalkers/base.py#L175-L177
nccgroup/BLESuite
0e2e534f7d9beaa8e9d76223959a60b064f61e22
blesuite/gatt_procedures.py
python
gatt_procedure_discover_primary_services
(connection_manager, connection, device)
return device
Scans device associated with BLEConnection for all primary services and stores them in the provided BLEDevice. :param connection_manager: BLEConnectionManager that can send request to the peer device associated with the supplied connection. :type connection_manager: BLEConnectionManager :param connecti...
Scans device associated with BLEConnection for all primary services and stores them in the provided BLEDevice.
[ "Scans", "device", "associated", "with", "BLEConnection", "for", "all", "primary", "services", "and", "stores", "them", "in", "the", "provided", "BLEDevice", "." ]
def gatt_procedure_discover_primary_services(connection_manager, connection, device): """ Scans device associated with BLEConnection for all primary services and stores them in the provided BLEDevice. :param connection_manager: BLEConnectionManager that can send request to the peer device associated wi...
[ "def", "gatt_procedure_discover_primary_services", "(", "connection_manager", ",", "connection", ",", "device", ")", ":", "from", "blesuite", ".", "pybt", ".", "gatt", "import", "UUID", "import", "struct", "bluetooth_base_addr", "=", "\"00000000-0000-1000-8000-00805F9B34F...
https://github.com/nccgroup/BLESuite/blob/0e2e534f7d9beaa8e9d76223959a60b064f61e22/blesuite/gatt_procedures.py#L423-L509
RexYing/diffpool
8dfb97cf60c2376ac804761837b9966f1d302acb
gen/feat.py
python
GaussianFeatureGen.__init__
(self, mu, sigma)
[]
def __init__(self, mu, sigma): self.mu = mu self.sigma = sigma
[ "def", "__init__", "(", "self", ",", "mu", ",", "sigma", ")", ":", "self", ".", "mu", "=", "mu", "self", ".", "sigma", "=", "sigma" ]
https://github.com/RexYing/diffpool/blob/8dfb97cf60c2376ac804761837b9966f1d302acb/gen/feat.py#L20-L22
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_tools_resource/app_launch_helper.py
python
get_app_dict
(user, resource, default_resource_term_dict)
return [default_resource_term_dict, hs_term_dict_user, hs_term_dict_file]
[]
def get_app_dict(user, resource, default_resource_term_dict): hs_term_dict_user = {} hs_term_dict_user["HS_USR_NAME"] = user.username if user.is_authenticated() else "anonymous" hs_term_dict_file = {} # HS_JS_AGG_KEY and HS_JS_FILE_KEY are overwritten by jquery to launch the url specific to each # f...
[ "def", "get_app_dict", "(", "user", ",", "resource", ",", "default_resource_term_dict", ")", ":", "hs_term_dict_user", "=", "{", "}", "hs_term_dict_user", "[", "\"HS_USR_NAME\"", "]", "=", "user", ".", "username", "if", "user", ".", "is_authenticated", "(", ")",...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tools_resource/app_launch_helper.py#L113-L123
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/iam/connection.py
python
IAMConnection.list_instance_profiles_for_role
(self, role_name, marker=None, max_items=None)
return self.get_response('ListInstanceProfilesForRole', params, list_marker='InstanceProfiles')
Lists the instance profiles that have the specified associated role. If there are none, the action returns an empty list. :type role_name: string :param role_name: The name of the role to list instance profiles for. :type marker: string :param marker: Use this parameter only wh...
Lists the instance profiles that have the specified associated role. If there are none, the action returns an empty list.
[ "Lists", "the", "instance", "profiles", "that", "have", "the", "specified", "associated", "role", ".", "If", "there", "are", "none", "the", "action", "returns", "an", "empty", "list", "." ]
def list_instance_profiles_for_role(self, role_name, marker=None, max_items=None): """ Lists the instance profiles that have the specified associated role. If there are none, the action returns an empty list. :type role_name: string :param...
[ "def", "list_instance_profiles_for_role", "(", "self", ",", "role_name", ",", "marker", "=", "None", ",", "max_items", "=", "None", ")", ":", "params", "=", "{", "'RoleName'", ":", "role_name", "}", "if", "marker", "is", "not", "None", ":", "params", "[", ...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/iam/connection.py#L1263-L1288