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
NanYoMy/DHT-woodworm
e28bbff214bc3c41ea462854256dd499fb8a6eb0
btdht/node.py
python
Node.update_access
(self, unixtime=None)
Update last access/modify time of this node
Update last access/modify time of this node
[ "Update", "last", "access", "/", "modify", "time", "of", "this", "node" ]
def update_access(self, unixtime=None): """ Update last access/modify time of this node """ with self.lock: if unixtime: self.access_time = unixtime else: self.access_time = time.time()
[ "def", "update_access", "(", "self", ",", "unixtime", "=", "None", ")", ":", "with", "self", ".", "lock", ":", "if", "unixtime", ":", "self", ".", "access_time", "=", "unixtime", "else", ":", "self", ".", "access_time", "=", "time", ".", "time", "(", ...
https://github.com/NanYoMy/DHT-woodworm/blob/e28bbff214bc3c41ea462854256dd499fb8a6eb0/btdht/node.py#L56-L62
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/smtpd.py
python
SMTPChannel.__rcpttos
(self)
return self.rcpttos
[]
def __rcpttos(self): warn("Access to __rcpttos attribute on SMTPChannel is deprecated, " "use 'rcpttos' instead", PendingDeprecationWarning, 2) return self.rcpttos
[ "def", "__rcpttos", "(", "self", ")", ":", "warn", "(", "\"Access to __rcpttos attribute on SMTPChannel is deprecated, \"", "\"use 'rcpttos' instead\"", ",", "PendingDeprecationWarning", ",", "2", ")", "return", "self", ".", "rcpttos" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/smtpd.py#L198-L201
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/idlelib/configDialog.py
python
ConfigDialog.VarChanged_winHeight
(self, *params)
[]
def VarChanged_winHeight(self, *params): value = self.winHeight.get() self.AddChangedItem('main', 'EditorWindow', 'height', value)
[ "def", "VarChanged_winHeight", "(", "self", ",", "*", "params", ")", ":", "value", "=", "self", ".", "winHeight", ".", "get", "(", ")", "self", ".", "AddChangedItem", "(", "'main'", ",", "'EditorWindow'", ",", "'height'", ",", "value", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/configDialog.py#L571-L573
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/lib/core/common.py
python
pollProcess
(process, suppress_errors=False)
Checks for process status (prints . if still running)
Checks for process status (prints . if still running)
[ "Checks", "for", "process", "status", "(", "prints", ".", "if", "still", "running", ")" ]
def pollProcess(process, suppress_errors=False): """ Checks for process status (prints . if still running) """ while True: dataToStdout(".") time.sleep(1) returncode = process.poll() if returncode is not None: if not suppress_errors: if retu...
[ "def", "pollProcess", "(", "process", ",", "suppress_errors", "=", "False", ")", ":", "while", "True", ":", "dataToStdout", "(", "\".\"", ")", "time", ".", "sleep", "(", "1", ")", "returncode", "=", "process", ".", "poll", "(", ")", "if", "returncode", ...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/lib/core/common.py#L4397-L4417
urwid/urwid
e2423b5069f51d318ea1ac0f355a0efe5448f7eb
urwid/vterm.py
python
Terminal.__init__
(self, command, env=None, main_loop=None, escape_sequence=None, encoding='utf-8')
A terminal emulator within a widget. ``command`` is the command to execute inside the terminal, provided as a list of the command followed by its arguments. If 'command' is None, the command is the current user's shell. You can also provide a callable instead of a command, which will b...
A terminal emulator within a widget.
[ "A", "terminal", "emulator", "within", "a", "widget", "." ]
def __init__(self, command, env=None, main_loop=None, escape_sequence=None, encoding='utf-8'): """ A terminal emulator within a widget. ``command`` is the command to execute inside the terminal, provided as a list of the command followed by its arguments. If 'command' ...
[ "def", "__init__", "(", "self", ",", "command", ",", "env", "=", "None", ",", "main_loop", "=", "None", ",", "escape_sequence", "=", "None", ",", "encoding", "=", "'utf-8'", ")", ":", "Widget", ".", "__init__", "(", "self", ")", "self", ".", "escape_se...
https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/vterm.py#L1332-L1391
shervinea/enzynet
7367635ae73595822133577054743a4c4c327cf3
enzynet/pdb.py
python
PDBBackbone.get_coords
(self)
Gets coordinates of backbone.
Gets coordinates of backbone.
[ "Gets", "coordinates", "of", "backbone", "." ]
def get_coords(self) -> None: """Gets coordinates of backbone.""" # Initialization. backbone_coords = [] backbone_atoms = [] # Computations. for model in self.structure: for chain in model: for residue in chain: if Polypept...
[ "def", "get_coords", "(", "self", ")", "->", "None", ":", "# Initialization.", "backbone_coords", "=", "[", "]", "backbone_atoms", "=", "[", "]", "# Computations.", "for", "model", "in", "self", ".", "structure", ":", "for", "chain", "in", "model", ":", "f...
https://github.com/shervinea/enzynet/blob/7367635ae73595822133577054743a4c4c327cf3/enzynet/pdb.py#L49-L67
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/packaging/specifiers.py
python
_IndividualSpecifier.contains
(self, item, prereleases=None)
return self._get_operator(self.operator)(item, self.version)
[]
def contains(self, item, prereleases=None): # Determine if prereleases are to be allowed or not. if prereleases is None: prereleases = self.prereleases # Normalize item to a Version or LegacyVersion, this allows us to have # a shortcut for ``"2.0" in Specifier(">=2") ...
[ "def", "contains", "(", "self", ",", "item", ",", "prereleases", "=", "None", ")", ":", "# Determine if prereleases are to be allowed or not.", "if", "prereleases", "is", "None", ":", "prereleases", "=", "self", ".", "prereleases", "# Normalize item to a Version or Lega...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/packaging/specifiers.py#L163-L180
newfies-dialer/newfies-dialer
8168b3dd43e9f5ce73a2645b3229def1b2815d47
newfies/callcenter/backup_code.py
python
CallcenterCustomerView.test_tier_view_delete
(self)
Test Function to check delete tier
Test Function to check delete tier
[ "Test", "Function", "to", "check", "delete", "tier" ]
def test_tier_view_delete(self): """Test Function to check delete tier""" manager = User.objects.get(pk=2) request = self.factory.get('/module/tier/del/1/') request.user = manager request.session = {} response = tier_del(request, 1) self.assertEqual(response.statu...
[ "def", "test_tier_view_delete", "(", "self", ")", ":", "manager", "=", "User", ".", "objects", ".", "get", "(", "pk", "=", "2", ")", "request", "=", "self", ".", "factory", ".", "get", "(", "'/module/tier/del/1/'", ")", "request", ".", "user", "=", "ma...
https://github.com/newfies-dialer/newfies-dialer/blob/8168b3dd43e9f5ce73a2645b3229def1b2815d47/newfies/callcenter/backup_code.py#L174-L187
CGCookie/retopoflow
3d8b3a47d1d661f99ab0aeb21d31370bf15de35e
scripts/prep_help_for_online.py
python
write_file
(filename, contents)
[]
def write_file(filename, contents): codecs.open(filename, mode='w', encoding='utf-8').write(contents)
[ "def", "write_file", "(", "filename", ",", "contents", ")", ":", "codecs", ".", "open", "(", "filename", ",", "mode", "=", "'w'", ",", "encoding", "=", "'utf-8'", ")", ".", "write", "(", "contents", ")" ]
https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/scripts/prep_help_for_online.py#L29-L30
freewym/espresso
6671c507350295269e38add57dbe601dcb8e6ecf
fairseq/trainer.py
python
Trainer.get_model
(self)
return self._model
Get the (non-wrapped) model instance.
Get the (non-wrapped) model instance.
[ "Get", "the", "(", "non", "-", "wrapped", ")", "model", "instance", "." ]
def get_model(self): """Get the (non-wrapped) model instance.""" return self._model
[ "def", "get_model", "(", "self", ")", ":", "return", "self", ".", "_model" ]
https://github.com/freewym/espresso/blob/6671c507350295269e38add57dbe601dcb8e6ecf/fairseq/trainer.py#L1131-L1133
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_configmap.py
python
OpenShiftCLI._import_image
(self, url=None, name=None, tag=None)
return self.openshift_cmd(cmd)
perform image import
perform image import
[ "perform", "image", "import" ]
def _import_image(self, url=None, name=None, tag=None): ''' perform image import ''' cmd = ['import-image'] image = '{0}'.format(name) if tag: image += ':{0}'.format(tag) cmd.append(image) if url: cmd.append('--from={0}/{1}'.format(url, image)) ...
[ "def", "_import_image", "(", "self", ",", "url", "=", "None", ",", "name", "=", "None", ",", "tag", "=", "None", ")", ":", "cmd", "=", "[", "'import-image'", "]", "image", "=", "'{0}'", ".", "format", "(", "name", ")", "if", "tag", ":", "image", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_configmap.py#L1079-L1095
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/dispatcher.py
python
ReportDispatcher.pattern
(cls)
return r'^({renderings}/)?(?P<report_slug>[\w_]+)/$'.format(renderings=cls._rendering_pattern())
[]
def pattern(cls): return r'^({renderings}/)?(?P<report_slug>[\w_]+)/$'.format(renderings=cls._rendering_pattern())
[ "def", "pattern", "(", "cls", ")", ":", "return", "r'^({renderings}/)?(?P<report_slug>[\\w_]+)/$'", ".", "format", "(", "renderings", "=", "cls", ".", "_rendering_pattern", "(", ")", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/dispatcher.py#L186-L187
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/retrying.py
python
Retrying.call
(self, fn, *args, **kwargs)
[]
def call(self, fn, *args, **kwargs): start_time = int(round(time.time() * 1000)) attempt_number = 1 while True: try: attempt = Attempt(fn(*args, **kwargs), attempt_number, False) except: tb = sys.exc_info() attempt = Attempt...
[ "def", "call", "(", "self", ",", "fn", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start_time", "=", "int", "(", "round", "(", "time", ".", "time", "(", ")", "*", "1000", ")", ")", "attempt_number", "=", "1", "while", "True", ":", "tr...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/retrying.py#L195-L222
selfboot/LeetCode
473c0c5451651140d75cbd143309c51cd8fe1cf1
Others/332_ReconstructItinerary.py
python
Solution.findItinerary
(self, tickets)
return route[::-1]
Eulerian path. Hierholzer Algorithm, greedy DFS with backtracking. Refer to: Short Ruby / Python / Java / C++ https://discuss.leetcode.com/topic/36370/short-ruby-python-java-c
Eulerian path. Hierholzer Algorithm, greedy DFS with backtracking.
[ "Eulerian", "path", ".", "Hierholzer", "Algorithm", "greedy", "DFS", "with", "backtracking", "." ]
def findItinerary(self, tickets): """ Eulerian path. Hierholzer Algorithm, greedy DFS with backtracking. Refer to: Short Ruby / Python / Java / C++ https://discuss.leetcode.com/topic/36370/short-ruby-python-java-c """ import collections targets = collections.defaultdict(...
[ "def", "findItinerary", "(", "self", ",", "tickets", ")", ":", "import", "collections", "targets", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "a", ",", "b", "in", "sorted", "(", "tickets", ",", "reverse", "=", "True", ")", ":", "t...
https://github.com/selfboot/LeetCode/blob/473c0c5451651140d75cbd143309c51cd8fe1cf1/Others/332_ReconstructItinerary.py#L7-L25
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/jellyfin/media_source.py
python
async_get_media_source
(hass: HomeAssistant)
return JellyfinSource(hass, client)
Set up Jellyfin media source.
Set up Jellyfin media source.
[ "Set", "up", "Jellyfin", "media", "source", "." ]
async def async_get_media_source(hass: HomeAssistant) -> MediaSource: """Set up Jellyfin media source.""" # Currently only a single Jellyfin server is supported entry = hass.config_entries.async_entries(DOMAIN)[0] data = hass.data[DOMAIN][entry.entry_id] client: JellyfinClient = data[DATA_CLIENT] ...
[ "async", "def", "async_get_media_source", "(", "hass", ":", "HomeAssistant", ")", "->", "MediaSource", ":", "# Currently only a single Jellyfin server is supported", "entry", "=", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")", "[", "0", "]", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/jellyfin/media_source.py#L53-L61
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/identity/identity_client.py
python
IdentityClient.list_idp_group_mappings
(self, identity_provider_id, **kwargs)
**Deprecated.** For more information, see `Deprecated IAM Service APIs`__. Lists the group mappings for the specified identity provider. __ https://docs.cloud.oracle.com/Content/Identity/Reference/deprecatediamapis.htm :param str identity_provider_id: (required) The OCID of the i...
**Deprecated.** For more information, see `Deprecated IAM Service APIs`__.
[ "**", "Deprecated", ".", "**", "For", "more", "information", "see", "Deprecated", "IAM", "Service", "APIs", "__", "." ]
def list_idp_group_mappings(self, identity_provider_id, **kwargs): """ **Deprecated.** For more information, see `Deprecated IAM Service APIs`__. Lists the group mappings for the specified identity provider. __ https://docs.cloud.oracle.com/Content/Identity/Reference/deprecatediamapis....
[ "def", "list_idp_group_mappings", "(", "self", ",", "identity_provider_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/identityProviders/{identityProviderId}/groupMappings\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=",...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/identity/identity_client.py#L8982-L9073
DamnWidget/anaconda
a9998fb362320f907d5ccbc6fcf5b62baca677c0
anaconda_lib/linting/pycodestyle.py
python
whitespace_around_named_parameter_equals
(logical_line, tokens)
r"""Don't use spaces around the '=' sign in function arguments. Don't use spaces around the '=' sign when used to indicate a keyword argument or a default parameter value, except when using a type annotation. Okay: def complex(real, imag=0.0): Okay: return magic(r=real, i=imag) Okay: boolean(a...
r"""Don't use spaces around the '=' sign in function arguments.
[ "r", "Don", "t", "use", "spaces", "around", "the", "=", "sign", "in", "function", "arguments", "." ]
def whitespace_around_named_parameter_equals(logical_line, tokens): r"""Don't use spaces around the '=' sign in function arguments. Don't use spaces around the '=' sign when used to indicate a keyword argument or a default parameter value, except when using a type annotation. Okay: def complex(rea...
[ "def", "whitespace_around_named_parameter_equals", "(", "logical_line", ",", "tokens", ")", ":", "parens", "=", "0", "no_space", "=", "False", "require_space", "=", "False", "prev_end", "=", "None", "annotated_func_arg", "=", "False", "in_def", "=", "bool", "(", ...
https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/anaconda_lib/linting/pycodestyle.py#L941-L1003
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/command/egg_info.py
python
egg_info.find_sources
(self)
Generate SOURCES.txt manifest file
Generate SOURCES.txt manifest file
[ "Generate", "SOURCES", ".", "txt", "manifest", "file" ]
def find_sources(self): """Generate SOURCES.txt manifest file""" manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") mm = manifest_maker(self.distribution) mm.manifest = manifest_filename mm.run() self.filelist = mm.filelist
[ "def", "find_sources", "(", "self", ")", ":", "manifest_filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "egg_info", ",", "\"SOURCES.txt\"", ")", "mm", "=", "manifest_maker", "(", "self", ".", "distribution", ")", "mm", ".", "manifest", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/command/egg_info.py#L288-L294
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/tabnanny.py
python
format_witnesses
(w)
return prefix + " " + ', '.join(firsts)
[]
def format_witnesses(w): firsts = (str(tup[0]) for tup in w) prefix = "at tab size" if len(w) > 1: prefix = prefix + "s" return prefix + " " + ', '.join(firsts)
[ "def", "format_witnesses", "(", "w", ")", ":", "firsts", "=", "(", "str", "(", "tup", "[", "0", "]", ")", "for", "tup", "in", "w", ")", "prefix", "=", "\"at tab size\"", "if", "len", "(", "w", ")", ">", "1", ":", "prefix", "=", "prefix", "+", "...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tabnanny.py#L266-L271
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/gluon/rewrite.py
python
MapUrlOut.build_acf
(self)
return acf or '/'
Builds a/c/f from components
Builds a/c/f from components
[ "Builds", "a", "/", "c", "/", "f", "from", "components" ]
def build_acf(self): "Builds a/c/f from components" acf = '' if self.map_hyphen: self.controller = self.controller.replace('_', '-') if self.controller != 'static' and not self.controller.startswith('static/'): self.application = self.application.replace('...
[ "def", "build_acf", "(", "self", ")", ":", "acf", "=", "''", "if", "self", ".", "map_hyphen", ":", "self", ".", "controller", "=", "self", ".", "controller", ".", "replace", "(", "'_'", ",", "'-'", ")", "if", "self", ".", "controller", "!=", "'static...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/rewrite.py#L1262-L1286
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/functools.py
python
_gt_from_ge
(self, other, NotImplemented=NotImplemented)
return op_result and self != other
Return a > b. Computed by @total_ordering from (a >= b) and (a != b).
Return a > b. Computed by
[ "Return", "a", ">", "b", ".", "Computed", "by" ]
def _gt_from_ge(self, other, NotImplemented=NotImplemented): 'Return a > b. Computed by @total_ordering from (a >= b) and (a != b).' op_result = type(self).__ge__(self, other) if op_result is NotImplemented: return op_result return op_result and self != other
[ "def", "_gt_from_ge", "(", "self", ",", "other", ",", "NotImplemented", "=", "NotImplemented", ")", ":", "op_result", "=", "type", "(", "self", ")", ".", "__ge__", "(", "self", ",", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/functools.py#L159-L164
google/pytype
fa43edc95dd42ade6e3147d6580d63e778c9d506
pytype/tools/xref/indexer.py
python
Indexer._get_attribute_class
(self, obj)
Look up the class of an attribute target.
Look up the class of an attribute target.
[ "Look", "up", "the", "class", "of", "an", "attribute", "target", "." ]
def _get_attribute_class(self, obj): """Look up the class of an attribute target.""" if isinstance(obj, abstract.Module): return Module(obj.name) elif isinstance(obj, abstract.InterpreterClass): return self.classmap.get(obj) elif isinstance(obj, abstract.PyTDClass): if obj.module: ...
[ "def", "_get_attribute_class", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "abstract", ".", "Module", ")", ":", "return", "Module", "(", "obj", ".", "name", ")", "elif", "isinstance", "(", "obj", ",", "abstract", ".", "Inter...
https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/tools/xref/indexer.py#L1022-L1039
mozilla-services/socorro
8bff4a90e9e3320eabe7e067adbe0e89f6a39ba7
socorro/scripts/__init__.py
python
FallbackToPipeAction.__call__
(self, parser, namespace, values, option_string=None)
Call the FallbackToPipeAction. If the arguments were set on the command line, use them. Otherwise, try reading from stdin (the pipe). If a pipe was not provided or was empty, parser.error is called to print usage and exit early. :param parser: The argument parser :param namespa...
Call the FallbackToPipeAction.
[ "Call", "the", "FallbackToPipeAction", "." ]
def __call__(self, parser, namespace, values, option_string=None): """Call the FallbackToPipeAction. If the arguments were set on the command line, use them. Otherwise, try reading from stdin (the pipe). If a pipe was not provided or was empty, parser.error is called to print usage and ...
[ "def", "__call__", "(", "self", ",", "parser", ",", "namespace", ",", "values", ",", "option_string", "=", "None", ")", ":", "if", "not", "values", ":", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "# There is no data being piped to the script, b...
https://github.com/mozilla-services/socorro/blob/8bff4a90e9e3320eabe7e067adbe0e89f6a39ba7/socorro/scripts/__init__.py#L110-L141
Ekultek/Zeus-Scanner
21b87563062326cd480669f2922f650173a2a18e
lib/core/settings.py
python
replace_http
(url, queries=True, complete=False)
replace the http in the url so we can get the IP address
replace the http in the url so we can get the IP address
[ "replace", "the", "http", "in", "the", "url", "so", "we", "can", "get", "the", "IP", "address" ]
def replace_http(url, queries=True, complete=False): """ replace the http in the url so we can get the IP address """ def __remove_queries(data): """ delete the queries from the URL """ return data.split("/")[0] try: url_list = url.split("//") new_ur...
[ "def", "replace_http", "(", "url", ",", "queries", "=", "True", ",", "complete", "=", "False", ")", ":", "def", "__remove_queries", "(", "data", ")", ":", "\"\"\"\n delete the queries from the URL\n \"\"\"", "return", "data", ".", "split", "(", "\"/\...
https://github.com/Ekultek/Zeus-Scanner/blob/21b87563062326cd480669f2922f650173a2a18e/lib/core/settings.py#L477-L499
CenterForOpenScience/osf.io
cc02691be017e61e2cd64f19b848b2f4c18dcc84
website/notifications/utils.py
python
remove_contributor_from_subscriptions
(node, user)
Remove contributor from node subscriptions unless the user is an admin on any of node's parent projects.
Remove contributor from node subscriptions unless the user is an admin on any of node's parent projects.
[ "Remove", "contributor", "from", "node", "subscriptions", "unless", "the", "user", "is", "an", "admin", "on", "any", "of", "node", "s", "parent", "projects", "." ]
def remove_contributor_from_subscriptions(node, user): """ Remove contributor from node subscriptions unless the user is an admin on any of node's parent projects. """ Preprint = apps.get_model('osf.Preprint') DraftRegistration = apps.get_model('osf.DraftRegistration') # Preprints don't have...
[ "def", "remove_contributor_from_subscriptions", "(", "node", ",", "user", ")", ":", "Preprint", "=", "apps", ".", "get_model", "(", "'osf.Preprint'", ")", "DraftRegistration", "=", "apps", ".", "get_model", "(", "'osf.DraftRegistration'", ")", "# Preprints don't have ...
https://github.com/CenterForOpenScience/osf.io/blob/cc02691be017e61e2cd64f19b848b2f4c18dcc84/website/notifications/utils.py#L62-L79
ysig/GraKeL
33ffff18d99c13f8afc0438a5691cb1206b119fb
grakel/kernels/weisfeiler_lehman.py
python
WeisfeilerLehman.__init__
(self, n_jobs=None, verbose=False, normalize=False, n_iter=5, base_graph_kernel=VertexHistogram)
Initialise a `weisfeiler_lehman` kernel.
Initialise a `weisfeiler_lehman` kernel.
[ "Initialise", "a", "weisfeiler_lehman", "kernel", "." ]
def __init__(self, n_jobs=None, verbose=False, normalize=False, n_iter=5, base_graph_kernel=VertexHistogram): """Initialise a `weisfeiler_lehman` kernel.""" super(WeisfeilerLehman, self).__init__( n_jobs=n_jobs, verbose=verbose, normalize=normalize) self.n_iter = n_...
[ "def", "__init__", "(", "self", ",", "n_jobs", "=", "None", ",", "verbose", "=", "False", ",", "normalize", "=", "False", ",", "n_iter", "=", "5", ",", "base_graph_kernel", "=", "VertexHistogram", ")", ":", "super", "(", "WeisfeilerLehman", ",", "self", ...
https://github.com/ysig/GraKeL/blob/33ffff18d99c13f8afc0438a5691cb1206b119fb/grakel/kernels/weisfeiler_lehman.py#L60-L69
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/zipfile.py
python
ZipExtFile.read
(self, n=-1)
Read and return up to n bytes. If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
Read and return up to n bytes. If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
[ "Read", "and", "return", "up", "to", "n", "bytes", ".", "If", "the", "argument", "is", "omitted", "None", "or", "negative", "data", "is", "read", "and", "returned", "until", "EOF", "is", "reached", ".." ]
def read(self, n=-1): """Read and return up to n bytes. If the argument is omitted, None, or negative, data is read and returned until EOF is reached.. """ buf = '' if n is None: n = -1 while True: if n < 0: data = self.read1(n) ...
[ "def", "read", "(", "self", ",", "n", "=", "-", "1", ")", ":", "buf", "=", "''", "if", "n", "is", "None", ":", "n", "=", "-", "1", "while", "True", ":", "if", "n", "<", "0", ":", "data", "=", "self", ".", "read1", "(", "n", ")", "elif", ...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/zipfile.py#L617-L633
seppius-xbmc-repo/ru
d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2
plugin.video.ndr/simpleplugin.py
python
_format_vars
(variables)
return '\n'.join(lines)
Format variables dictionary :param variables: variables dict :type variables: dict :return: formatted string with sorted ``var = val`` pairs :rtype: str
Format variables dictionary
[ "Format", "variables", "dictionary" ]
def _format_vars(variables): """ Format variables dictionary :param variables: variables dict :type variables: dict :return: formatted string with sorted ``var = val`` pairs :rtype: str """ var_list = [(var, val) for var, val in variables.items()] lines = [] for var, val in sort...
[ "def", "_format_vars", "(", "variables", ")", ":", "var_list", "=", "[", "(", "var", ",", "val", ")", "for", "var", ",", "val", "in", "variables", ".", "items", "(", ")", "]", "lines", "=", "[", "]", "for", "var", ",", "val", "in", "sorted", "(",...
https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/plugin.video.ndr/simpleplugin.py#L58-L72
secdev/scapy
65089071da1acf54622df0b4fa7fc7673d47d3cd
scapy/layers/ipsec.py
python
CryptAlgo.__init__
(self, name, cipher, mode, block_size=None, iv_size=None, key_size=None, icv_size=None, salt_size=None, format_mode_iv=None)
:param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with the cipher module :param block_size: the length a block for this algo. Defaults to the `block_size` of the cipher. :param iv_size: the length of th...
:param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with the cipher module :param block_size: the length a block for this algo. Defaults to the `block_size` of the cipher. :param iv_size: the length of th...
[ ":", "param", "name", ":", "the", "name", "of", "this", "encryption", "algorithm", ":", "param", "cipher", ":", "a", "Cipher", "module", ":", "param", "mode", ":", "the", "mode", "used", "with", "the", "cipher", "module", ":", "param", "block_size", ":",...
def __init__(self, name, cipher, mode, block_size=None, iv_size=None, key_size=None, icv_size=None, salt_size=None, format_mode_iv=None): # noqa: E501 """ :param name: the name of this encryption algorithm :param cipher: a Cipher module :param mode: the mode used with t...
[ "def", "__init__", "(", "self", ",", "name", ",", "cipher", ",", "mode", ",", "block_size", "=", "None", ",", "iv_size", "=", "None", ",", "key_size", "=", "None", ",", "icv_size", "=", "None", ",", "salt_size", "=", "None", ",", "format_mode_iv", "=",...
https://github.com/secdev/scapy/blob/65089071da1acf54622df0b4fa7fc7673d47d3cd/scapy/layers/ipsec.py#L202-L261
django-oscar/django-oscar
ffcc530844d40283b6b1552778a140536b904f5f
src/oscar/apps/address/abstract_models.py
python
AbstractAddress.join_fields
(self, fields, separator=", ")
return separator.join(filter(bool, field_values))
Join a sequence of fields using the specified separator
Join a sequence of fields using the specified separator
[ "Join", "a", "sequence", "of", "fields", "using", "the", "specified", "separator" ]
def join_fields(self, fields, separator=", "): """ Join a sequence of fields using the specified separator """ field_values = self.get_field_values(fields) return separator.join(filter(bool, field_values))
[ "def", "join_fields", "(", "self", ",", "fields", ",", "separator", "=", "\", \"", ")", ":", "field_values", "=", "self", ".", "get_field_values", "(", "fields", ")", "return", "separator", ".", "join", "(", "filter", "(", "bool", ",", "field_values", ")",...
https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/apps/address/abstract_models.py#L370-L375
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/codecs.py
python
StreamRecoder.next
(self)
return data
Return the next decoded line from the input stream.
Return the next decoded line from the input stream.
[ "Return", "the", "next", "decoded", "line", "from", "the", "input", "stream", "." ]
def next(self): """ Return the next decoded line from the input stream.""" data = self.reader.next() data, bytesencoded = self.encode(data, self.errors) return data
[ "def", "next", "(", "self", ")", ":", "data", "=", "self", ".", "reader", ".", "next", "(", ")", "data", ",", "bytesencoded", "=", "self", ".", "encode", "(", "data", ",", "self", ".", "errors", ")", "return", "data" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/codecs.py#L817-L822
frappe/erpnext
9d36e30ef7043b391b5ed2523b8288bf46c45d18
erpnext/education/api.py
python
make_attendance_records
(student, student_name, status, course_schedule=None, student_group=None, date=None)
Creates/Update Attendance Record. :param student: Student. :param student_name: Student Name. :param course_schedule: Course Schedule. :param status: Status (Present/Absent)
Creates/Update Attendance Record.
[ "Creates", "/", "Update", "Attendance", "Record", "." ]
def make_attendance_records(student, student_name, status, course_schedule=None, student_group=None, date=None): """Creates/Update Attendance Record. :param student: Student. :param student_name: Student Name. :param course_schedule: Course Schedule. :param status: Status (Present/Absent) """ student_attendance...
[ "def", "make_attendance_records", "(", "student", ",", "student_name", ",", "status", ",", "course_schedule", "=", "None", ",", "student_group", "=", "None", ",", "date", "=", "None", ")", ":", "student_attendance", "=", "frappe", ".", "get_doc", "(", "{", "...
https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/education/api.py#L95-L119
pynag/pynag
e72cf7ce2395263e2b3080cae0ece2b03dbbfa27
pynag/Control/Command/autogenerated_commands.py
python
change_max_svc_check_attempts
( host_name, service_description, check_attempts, command_file=None, timestamp=0 )
return send_command("CHANGE_MAX_SVC_CHECK_ATTEMPTS", command_file, timestamp, host_name, service_description, check_attempts)
Changes the maximum number of check attempts (retries) for a particular service.
Changes the maximum number of check attempts (retries) for a particular service.
[ "Changes", "the", "maximum", "number", "of", "check", "attempts", "(", "retries", ")", "for", "a", "particular", "service", "." ]
def change_max_svc_check_attempts( host_name, service_description, check_attempts, command_file=None, timestamp=0 ): """ Changes the maximum number of check attempts (retries) for a particular service. """ return send_command("CHANGE_MAX_SVC_CHECK_ATTEMPTS", ...
[ "def", "change_max_svc_check_attempts", "(", "host_name", ",", "service_description", ",", "check_attempts", ",", "command_file", "=", "None", ",", "timestamp", "=", "0", ")", ":", "return", "send_command", "(", "\"CHANGE_MAX_SVC_CHECK_ATTEMPTS\"", ",", "command_file", ...
https://github.com/pynag/pynag/blob/e72cf7ce2395263e2b3080cae0ece2b03dbbfa27/pynag/Control/Command/autogenerated_commands.py#L299-L315
bcbio/bcbio-nextgen
c80f9b6b1be3267d1f981b7035e3b72441d258f2
bcbio/chipseq/peaks.py
python
_sync
(original, processed)
return original
Add output to data if run sucessfully. For now only macs2 is available, so no need to consider multiple callers.
Add output to data if run sucessfully. For now only macs2 is available, so no need to consider multiple callers.
[ "Add", "output", "to", "data", "if", "run", "sucessfully", ".", "For", "now", "only", "macs2", "is", "available", "so", "no", "need", "to", "consider", "multiple", "callers", "." ]
def _sync(original, processed): """ Add output to data if run sucessfully. For now only macs2 is available, so no need to consider multiple callers. """ for original_sample in original: original_sample[0]["peaks_files"] = {} for process_sample in processed: if dd.get_...
[ "def", "_sync", "(", "original", ",", "processed", ")", ":", "for", "original_sample", "in", "original", ":", "original_sample", "[", "0", "]", "[", "\"peaks_files\"", "]", "=", "{", "}", "for", "process_sample", "in", "processed", ":", "if", "dd", ".", ...
https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/chipseq/peaks.py#L82-L95
SweetyTian/efficientdet
f7c1051ba46a01b3c4aac97b15e238714e0e4055
backbones/geffnet/gen_efficientnet.py
python
tf_efficientnet_b6
(pretrained=False, **kwargs)
return model
EfficientNet-B6. Tensorflow compatible variant
EfficientNet-B6. Tensorflow compatible variant
[ "EfficientNet", "-", "B6", ".", "Tensorflow", "compatible", "variant" ]
def tf_efficientnet_b6(pretrained=False, **kwargs): """ EfficientNet-B6. Tensorflow compatible variant """ kwargs['bn_eps'] = BN_EPS_TF_DEFAULT kwargs['pad_type'] = 'same' model = _gen_efficientnet( 'tf_efficientnet_b6', channel_multiplier=1.8, depth_multiplier=2.6, pretrained=pretrained, **kwar...
[ "def", "tf_efficientnet_b6", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'bn_eps'", "]", "=", "BN_EPS_TF_DEFAULT", "kwargs", "[", "'pad_type'", "]", "=", "'same'", "model", "=", "_gen_efficientnet", "(", "'tf_efficientne...
https://github.com/SweetyTian/efficientdet/blob/f7c1051ba46a01b3c4aac97b15e238714e0e4055/backbones/geffnet/gen_efficientnet.py#L813-L819
tanghaibao/goatools
647e9dd833695f688cd16c2f9ea18f1692e5c6bc
goatools/grouper/grprobj_init.py
python
GrouperInit.__init_go2nt_dflt
(self, gos_all, prt_flds_all)
return self._init_go2nt_aug(go2nt)
Combine GO object fields and format_txt.
Combine GO object fields and format_txt.
[ "Combine", "GO", "object", "fields", "and", "format_txt", "." ]
def __init_go2nt_dflt(self, gos_all, prt_flds_all): """Combine GO object fields and format_txt.""" go2nts = [self.gosubdag.go2nt, self._get_go2nthdridx(gos_all)] go2nt = get_dict_w_id2nts(gos_all, go2nts, prt_flds_all) return self._init_go2nt_aug(go2nt)
[ "def", "__init_go2nt_dflt", "(", "self", ",", "gos_all", ",", "prt_flds_all", ")", ":", "go2nts", "=", "[", "self", ".", "gosubdag", ".", "go2nt", ",", "self", ".", "_get_go2nthdridx", "(", "gos_all", ")", "]", "go2nt", "=", "get_dict_w_id2nts", "(", "gos_...
https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/grouper/grprobj_init.py#L159-L163
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
rpython/rlib/buffer.py
python
Buffer.getlength
(self)
Return the size in bytes.
Return the size in bytes.
[ "Return", "the", "size", "in", "bytes", "." ]
def getlength(self): """Return the size in bytes.""" raise NotImplementedError
[ "def", "getlength", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/rlib/buffer.py#L56-L58
nfstream/nfstream
aa14fd1606ce4757f8b1589faeb032a0f5a93c5e
nfstream/meter.py
python
get_flow_key
(src_ip, src_port, dst_ip, dst_port, protocol, vlan_id, tunnel_id)
return key
Create a consistent direction agnostic flow key
Create a consistent direction agnostic flow key
[ "Create", "a", "consistent", "direction", "agnostic", "flow", "key" ]
def get_flow_key(src_ip, src_port, dst_ip, dst_port, protocol, vlan_id, tunnel_id): """ Create a consistent direction agnostic flow key """ if src_ip < dst_ip: key = FLOW_KEY.format(src_ip, src_port, dst_ip, dst_port, protocol, vlan_id, tunnel_id) else: if src_ip == dst_ip: if sr...
[ "def", "get_flow_key", "(", "src_ip", ",", "src_port", ",", "dst_ip", ",", "dst_port", ",", "protocol", ",", "vlan_id", ",", "tunnel_id", ")", ":", "if", "src_ip", "<", "dst_ip", ":", "key", "=", "FLOW_KEY", ".", "format", "(", "src_ip", ",", "src_port",...
https://github.com/nfstream/nfstream/blob/aa14fd1606ce4757f8b1589faeb032a0f5a93c5e/nfstream/meter.py#L86-L98
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/mentionmemory/modules/kmeans.py
python
compute_assignments
( centroids: Array, observations: Array, n_splits: int, )
return assignments, min_dist
Assigns observations to cluster centroids. Computes l2 distance between each pair of observation and centroids, and assigns observation to closest cluster. Because the array of pairwise distances is very large, the cluster assignment is performed chunk by chunk. Args: centroids: [n_clusters, dim] cluster ...
Assigns observations to cluster centroids.
[ "Assigns", "observations", "to", "cluster", "centroids", "." ]
def compute_assignments( centroids: Array, observations: Array, n_splits: int, ) -> Tuple[Array, Array]: """Assigns observations to cluster centroids. Computes l2 distance between each pair of observation and centroids, and assigns observation to closest cluster. Because the array of pairwise dista...
[ "def", "compute_assignments", "(", "centroids", ":", "Array", ",", "observations", ":", "Array", ",", "n_splits", ":", "int", ",", ")", "->", "Tuple", "[", "Array", ",", "Array", "]", ":", "reshaped_observations", "=", "observations", ".", "reshape", "(", ...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/mentionmemory/modules/kmeans.py#L39-L73
endernewton/tf-faster-rcnn
b4da911705925ec00e8359b76a2d7260f6d1d314
lib/datasets/voc_eval.py
python
voc_eval
(detpath, annopath, imagesetfile, classname, cachedir, ovthresh=0.5, use_07_metric=False, use_diff=False)
return rec, prec, ap
rec, prec, ap = voc_eval(detpath, annopath, imagesetfile, classname, [ovthresh], [use_07_metric]) Top level function that does the PASCAL VOC evaluation. detpath: P...
rec, prec, ap = voc_eval(detpath, annopath, imagesetfile, classname, [ovthresh], [use_07_metric])
[ "rec", "prec", "ap", "=", "voc_eval", "(", "detpath", "annopath", "imagesetfile", "classname", "[", "ovthresh", "]", "[", "use_07_metric", "]", ")" ]
def voc_eval(detpath, annopath, imagesetfile, classname, cachedir, ovthresh=0.5, use_07_metric=False, use_diff=False): """rec, prec, ap = voc_eval(detpath, annopath, i...
[ "def", "voc_eval", "(", "detpath", ",", "annopath", ",", "imagesetfile", ",", "classname", ",", "cachedir", ",", "ovthresh", "=", "0.5", ",", "use_07_metric", "=", "False", ",", "use_diff", "=", "False", ")", ":", "# assumes detections are in detpath.format(classn...
https://github.com/endernewton/tf-faster-rcnn/blob/b4da911705925ec00e8359b76a2d7260f6d1d314/lib/datasets/voc_eval.py#L69-L214
ljean/modbus-tk
1159c71794071ae67f73f86fa14dd71c989b4859
git_pylint.py
python
CommandWrapper._run_command
(self, command_line)
run a command
run a command
[ "run", "a", "command" ]
def _run_command(self, command_line): """run a command""" try: return subprocess.check_output(command_line.split(' ')), 0 except subprocess.CalledProcessError, ex: return ex.output, ex.returncode
[ "def", "_run_command", "(", "self", ",", "command_line", ")", ":", "try", ":", "return", "subprocess", ".", "check_output", "(", "command_line", ".", "split", "(", "' '", ")", ")", ",", "0", "except", "subprocess", ".", "CalledProcessError", ",", "ex", ":"...
https://github.com/ljean/modbus-tk/blob/1159c71794071ae67f73f86fa14dd71c989b4859/git_pylint.py#L18-L23
Andy10101/ApkDetecter
47b2c2db8f946d848fdd92ebbe75e3a21d60b204
androguard/core/bytecodes/jvm.py
python
JVMFormat.get_classes_names
(self)
return [self.__CM.get_this_class_name()]
Return the names of classes
Return the names of classes
[ "Return", "the", "names", "of", "classes" ]
def get_classes_names(self): """ Return the names of classes """ return [self.__CM.get_this_class_name()]
[ "def", "get_classes_names", "(", "self", ")", ":", "return", "[", "self", ".", "__CM", ".", "get_this_class_name", "(", ")", "]" ]
https://github.com/Andy10101/ApkDetecter/blob/47b2c2db8f946d848fdd92ebbe75e3a21d60b204/androguard/core/bytecodes/jvm.py#L3135-L3139
huggingface/datasets
249b4a38390bf1543f5b6e2f3dc208b5689c1c13
datasets/xtreme/xtreme.py
python
Xtreme._split_generators
(self, dl_manager)
Returns SplitGenerators.
Returns SplitGenerators.
[ "Returns", "SplitGenerators", "." ]
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" # TODO(xtreme): Downloads the data and defines the splits # dl_manager is a datasets.download.DownloadManager that can be used to # download and extract URLs if self.config.name == "tydiqa": trai...
[ "def", "_split_generators", "(", "self", ",", "dl_manager", ")", ":", "# TODO(xtreme): Downloads the data and defines the splits", "# dl_manager is a datasets.download.DownloadManager that can be used to", "# download and extract URLs", "if", "self", ".", "config", ".", "name", "==...
https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/xtreme/xtreme.py#L546-L811
catalyst-cooperative/pudl
40d176313e60dfa9d2481f63842ed23f08f1ad5f
src/pudl/output/ferc1.py
python
fuel_by_plant_ferc1
(pudl_engine, thresh=0.5)
return fbp_df
Summarize FERC fuel data by plant for output. This is mostly a wrapper around :func:`pudl.transform.ferc1.fuel_by_plant_ferc1` which calculates some summary values on a per-plant basis (as indicated by ``utility_id_ferc1`` and ``plant_name_ferc1``) related to fuel consumption. Args: pu...
Summarize FERC fuel data by plant for output.
[ "Summarize", "FERC", "fuel", "data", "by", "plant", "for", "output", "." ]
def fuel_by_plant_ferc1(pudl_engine, thresh=0.5): """Summarize FERC fuel data by plant for output. This is mostly a wrapper around :func:`pudl.transform.ferc1.fuel_by_plant_ferc1` which calculates some summary values on a per-plant basis (as indicated by ``utility_id_ferc1`` and ``plant_name_ferc1`...
[ "def", "fuel_by_plant_ferc1", "(", "pudl_engine", ",", "thresh", "=", "0.5", ")", ":", "fbp_df", "=", "(", "pd", ".", "read_sql_table", "(", "'fuel_ferc1'", ",", "pudl_engine", ")", ".", "pipe", "(", "pudl", ".", "transform", ".", "ferc1", ".", "fuel_by_pl...
https://github.com/catalyst-cooperative/pudl/blob/40d176313e60dfa9d2481f63842ed23f08f1ad5f/src/pudl/output/ferc1.py#L112-L144
sartography/SpiffWorkflow
764be6c276a278d372b96de470e39b29248a86d4
SpiffWorkflow/bpmn/PythonScriptEngine.py
python
PythonScriptEngine.execute
(self, task, script, data, external_methods=None)
Execute the script, within the context of the specified task
Execute the script, within the context of the specified task
[ "Execute", "the", "script", "within", "the", "context", "of", "the", "specified", "task" ]
def execute(self, task, script, data, external_methods=None): """ Execute the script, within the context of the specified task """ if external_methods is None: external_methods = {} globals = self.globals self.convertToBox(data) globals.update(data) ...
[ "def", "execute", "(", "self", ",", "task", ",", "script", ",", "data", ",", "external_methods", "=", "None", ")", ":", "if", "external_methods", "is", "None", ":", "external_methods", "=", "{", "}", "globals", "=", "self", ".", "globals", "self", ".", ...
https://github.com/sartography/SpiffWorkflow/blob/764be6c276a278d372b96de470e39b29248a86d4/SpiffWorkflow/bpmn/PythonScriptEngine.py#L244-L274
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/http/response/text.py
python
TextResponse.xpath
(self, query, **kwargs)
return self.selector.xpath(query, **kwargs)
[]
def xpath(self, query, **kwargs): return self.selector.xpath(query, **kwargs)
[ "def", "xpath", "(", "self", ",", "query", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "selector", ".", "xpath", "(", "query", ",", "*", "*", "kwargs", ")" ]
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/http/response/text.py#L136-L137
pmorissette/bt
abf3269d8152dc8f91141ed67026c51e58ae2bf9
bt/core.py
python
Node.prices
(self)
A TimeSeries of the Node's price.
A TimeSeries of the Node's price.
[ "A", "TimeSeries", "of", "the", "Node", "s", "price", "." ]
def prices(self): """ A TimeSeries of the Node's price. """ # can optimize depending on type - # securities don't need to check stale to # return latest prices, whereas strategies do... raise NotImplementedError()
[ "def", "prices", "(", "self", ")", ":", "# can optimize depending on type -", "# securities don't need to check stale to", "# return latest prices, whereas strategies do...", "raise", "NotImplementedError", "(", ")" ]
https://github.com/pmorissette/bt/blob/abf3269d8152dc8f91141ed67026c51e58ae2bf9/bt/core.py#L219-L226
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/cryptography/hazmat/backends/openssl/encode_asn1.py
python
_encode_issuing_dist_point
(backend, ext)
return idp
[]
def _encode_issuing_dist_point(backend, ext): idp = backend._lib.ISSUING_DIST_POINT_new() backend.openssl_assert(idp != backend._ffi.NULL) idp = backend._ffi.gc(idp, backend._lib.ISSUING_DIST_POINT_free) idp.onlyuser = 255 if ext.only_contains_user_certs else 0 idp.onlyCA = 255 if ext.only_contains_...
[ "def", "_encode_issuing_dist_point", "(", "backend", ",", "ext", ")", ":", "idp", "=", "backend", ".", "_lib", ".", "ISSUING_DIST_POINT_new", "(", ")", "backend", ".", "openssl_assert", "(", "idp", "!=", "backend", ".", "_ffi", ".", "NULL", ")", "idp", "="...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/cryptography/hazmat/backends/openssl/encode_asn1.py#L141-L160
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas_rhino/conversions/_surfaces.py
python
surface_to_compas_data
(surface)
return { 'points': [[point.data for point in row] for row in points], 'weights': weights, 'u_knots': u_knots, 'v_knots': v_knots, 'u_mults': u_mults, 'v_mults': v_mults, 'u_degree': u_degree, 'v_degree': v_degree, 'is_u_periodic': is_u_periodic, ...
Convert a Rhino surface to a COMPAS surface. Parameters ---------- surface: :class:`Rhino.Geometry.Surface` Returns ------- :obj:`dict`
Convert a Rhino surface to a COMPAS surface.
[ "Convert", "a", "Rhino", "surface", "to", "a", "COMPAS", "surface", "." ]
def surface_to_compas_data(surface): """Convert a Rhino surface to a COMPAS surface. Parameters ---------- surface: :class:`Rhino.Geometry.Surface` Returns ------- :obj:`dict` """ surface = surface.ToNurbsSurface() points = [] weights = [] for j in range(surface.Points...
[ "def", "surface_to_compas_data", "(", "surface", ")", ":", "surface", "=", "surface", ".", "ToNurbsSurface", "(", ")", "points", "=", "[", "]", "weights", "=", "[", "]", "for", "j", "in", "range", "(", "surface", ".", "Points", ".", "VCount", ")", ":",...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas_rhino/conversions/_surfaces.py#L13-L68
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/python/ops/data_flow_ops.py
python
ConditionalAccumulatorBase.__init__
(self, dtype, shape, accumulator_ref)
Creates a new ConditionalAccumulator. Args: dtype: Datatype of the accumulated gradients. shape: Shape of the accumulated gradients. accumulator_ref: A handle to the conditional accumulator, created by sub- classes
Creates a new ConditionalAccumulator.
[ "Creates", "a", "new", "ConditionalAccumulator", "." ]
def __init__(self, dtype, shape, accumulator_ref): """Creates a new ConditionalAccumulator. Args: dtype: Datatype of the accumulated gradients. shape: Shape of the accumulated gradients. accumulator_ref: A handle to the conditional accumulator, created by sub- classes """ self...
[ "def", "__init__", "(", "self", ",", "dtype", ",", "shape", ",", "accumulator_ref", ")", ":", "self", ".", "_dtype", "=", "dtype", "if", "shape", "is", "not", "None", ":", "self", ".", "_shape", "=", "tensor_shape", ".", "TensorShape", "(", "shape", ")...
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/ops/data_flow_ops.py#L1163-L1178
tensorflow/datasets
2e496976d7d45550508395fb2f35cf958c8a3414
tensorflow_datasets/video/moving_sequence.py
python
_bounce_to_bbox
(points)
return tf.math.minimum(2 - points, points)
Bounce potentially unbounded points to [0, 1]. Bouncing occurs by exact reflection, i.e. a pre-bound point at 1.1 is moved to 0.9, -0.2 -> 0.2. This theoretically can occur multiple times, e.g. 2.3 -> -0.7 -> 0.3 Implementation points <- points % 2 return min(2 - points, points) Args: points: float...
Bounce potentially unbounded points to [0, 1].
[ "Bounce", "potentially", "unbounded", "points", "to", "[", "0", "1", "]", "." ]
def _bounce_to_bbox(points): """Bounce potentially unbounded points to [0, 1]. Bouncing occurs by exact reflection, i.e. a pre-bound point at 1.1 is moved to 0.9, -0.2 -> 0.2. This theoretically can occur multiple times, e.g. 2.3 -> -0.7 -> 0.3 Implementation points <- points % 2 return min(2 - points, ...
[ "def", "_bounce_to_bbox", "(", "points", ")", ":", "points", "=", "points", "%", "2", "return", "tf", ".", "math", ".", "minimum", "(", "2", "-", "points", ",", "points", ")" ]
https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/video/moving_sequence.py#L85-L103
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pandas/tseries/period.py
python
PeriodIndex.join
(self, other, how='left', level=None, return_indexers=False)
return self._apply_meta(result)
See Index.join
See Index.join
[ "See", "Index", ".", "join" ]
def join(self, other, how='left', level=None, return_indexers=False): """ See Index.join """ self._assert_can_do_setop(other) result = Int64Index.join(self, other, how=how, level=level, return_indexers=return_indexers) if return_indexers...
[ "def", "join", "(", "self", ",", "other", ",", "how", "=", "'left'", ",", "level", "=", "None", ",", "return_indexers", "=", "False", ")", ":", "self", ".", "_assert_can_do_setop", "(", "other", ")", "result", "=", "Int64Index", ".", "join", "(", "self...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/tseries/period.py#L907-L919
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
weblogic/datadog_checks/weblogic/config_models/defaults.py
python
instance_is_jmx
(field, value)
return False
[]
def instance_is_jmx(field, value): return False
[ "def", "instance_is_jmx", "(", "field", ",", "value", ")", ":", "return", "False" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/weblogic/datadog_checks/weblogic/config_models/defaults.py#L45-L46
dgilland/pydash
24ad0e43b51b367d00447c45baa68c9c03ad1a52
src/pydash/objects.py
python
has
(obj, path)
return exists
Checks if `path` exists as a key of `obj`. Args: obj (mixed): Object to test. path (mixed): Path to test for. Can be a list of nested keys or a ``.`` delimited string of path describing the path. Returns: bool: Whether `obj` has `path`. Example: >>> has([1, 2,...
Checks if `path` exists as a key of `obj`.
[ "Checks", "if", "path", "exists", "as", "a", "key", "of", "obj", "." ]
def has(obj, path): """ Checks if `path` exists as a key of `obj`. Args: obj (mixed): Object to test. path (mixed): Path to test for. Can be a list of nested keys or a ``.`` delimited string of path describing the path. Returns: bool: Whether `obj` has `path`. ...
[ "def", "has", "(", "obj", ",", "path", ")", ":", "try", ":", "get", "(", "obj", ",", "path", ",", "default", "=", "UNSET", ")", "exists", "=", "True", "except", "(", "KeyError", ",", "IndexError", ",", "TypeError", ",", "ValueError", ")", ":", "exi...
https://github.com/dgilland/pydash/blob/24ad0e43b51b367d00447c45baa68c9c03ad1a52/src/pydash/objects.py#L538-L582
insarlab/MintPy
4357b8c726dec8a3f936770e3f3dda92882685b7
mintpy/asc_desc2horz_vert.py
python
write_to_one_file
(outfile, dH, dV, atr, dLOS_list, atr_list, ref_file=None)
return outfile
Write all datasets into one HDF5 file
Write all datasets into one HDF5 file
[ "Write", "all", "datasets", "into", "one", "HDF5", "file" ]
def write_to_one_file(outfile, dH, dV, atr, dLOS_list, atr_list, ref_file=None): """Write all datasets into one HDF5 file""" print('write all datasets into {}'.format(outfile)) dsDict = {} for i in range(len(atr_list)): # auto dataset name atr_i = atr_list[i] dsName = sensor.pro...
[ "def", "write_to_one_file", "(", "outfile", ",", "dH", ",", "dV", ",", "atr", ",", "dLOS_list", ",", "atr_list", ",", "ref_file", "=", "None", ")", ":", "print", "(", "'write all datasets into {}'", ".", "format", "(", "outfile", ")", ")", "dsDict", "=", ...
https://github.com/insarlab/MintPy/blob/4357b8c726dec8a3f936770e3f3dda92882685b7/mintpy/asc_desc2horz_vert.py#L291-L313
ryanmcgrath/twython
0c405604285364457f3c309969f11ba68163bd05
twython/endpoints.py
python
EndpointsMixin.get_user_suggestions_statuses_by_slug
(self, **params)
return self.get('users/suggestions/%s/members' % params.get('slug'), params=params)
Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user. Docs: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members
Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user.
[ "Access", "the", "users", "in", "a", "given", "category", "of", "the", "Twitter", "suggested", "user", "list", "and", "return", "their", "most", "recent", "status", "if", "they", "are", "not", "a", "protected", "user", "." ]
def get_user_suggestions_statuses_by_slug(self, **params): """Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user. Docs: https://developer.twitter.com/en/docs/accounts-and-users/follow-searc...
[ "def", "get_user_suggestions_statuses_by_slug", "(", "self", ",", "*", "*", "params", ")", ":", "return", "self", ".", "get", "(", "'users/suggestions/%s/members'", "%", "params", ".", "get", "(", "'slug'", ")", ",", "params", "=", "params", ")" ]
https://github.com/ryanmcgrath/twython/blob/0c405604285364457f3c309969f11ba68163bd05/twython/endpoints.py#L750-L760
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/sets.py
python
BaseSet.__deepcopy__
(self, memo)
return result
Return a deep copy of a set; used by copy module.
Return a deep copy of a set; used by copy module.
[ "Return", "a", "deep", "copy", "of", "a", "set", ";", "used", "by", "copy", "module", "." ]
def __deepcopy__(self, memo): """Return a deep copy of a set; used by copy module.""" # This pre-creates the result and inserts it in the memo # early, in case the deep copy recurses into another reference # to this same set. A set can't be an element of itself, but # it can cer...
[ "def", "__deepcopy__", "(", "self", ",", "memo", ")", ":", "# This pre-creates the result and inserts it in the memo", "# early, in case the deep copy recurses into another reference", "# to this same set. A set can't be an element of itself, but", "# it can certainly contain an object that h...
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/sets.py#L153-L167
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distro.py
python
LinuxDistribution.version_parts
(self, best=False)
return '', '', ''
Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`.
Return the version of the OS distribution, as a tuple of version numbers.
[ "Return", "the", "version", "of", "the", "OS", "distribution", "as", "a", "tuple", "of", "version", "numbers", "." ]
def version_parts(self, best=False): """ Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`. """ version_str = self.version(best=best) if version_str: version_regex = re.compile(r'(\...
[ "def", "version_parts", "(", "self", ",", "best", "=", "False", ")", ":", "version_str", "=", "self", ".", "version", "(", "best", "=", "best", ")", "if", "version_str", ":", "version_regex", "=", "re", ".", "compile", "(", "r'(\\d+)\\.?(\\d+)?\\.?(\\d+)?'",...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distro.py#L763-L777
epsy/clize
84fef2080d7748dd36e465bc2048b48ed578d73f
examples/argdeco.py
python
main
(*args:capitalize)
return ' '.join(args)
:param args: Words to print
:param args: Words to print
[ ":", "param", "args", ":", "Words", "to", "print" ]
def main(*args:capitalize): """ :param args: Words to print """ return ' '.join(args)
[ "def", "main", "(", "*", "args", ":", "capitalize", ")", ":", "return", "' '", ".", "join", "(", "args", ")" ]
https://github.com/epsy/clize/blob/84fef2080d7748dd36e465bc2048b48ed578d73f/examples/argdeco.py#L20-L24
10XGenomics/cellranger
a83c753ce641db6409a59ad817328354fbe7187e
lib/python/cellranger/matrix.py
python
CountMatrix.select_axes_above_threshold
(self, threshold=0)
return new_mat, nonzero_bcs, nonzero_features
Select axes with sums greater than the threshold value. Returns: (CountMatrix, np.array of int, np.array of int): New count matrix, non-zero bc indices, feat indices
Select axes with sums greater than the threshold value.
[ "Select", "axes", "with", "sums", "greater", "than", "the", "threshold", "value", "." ]
def select_axes_above_threshold(self, threshold=0): '''Select axes with sums greater than the threshold value. Returns: (CountMatrix, np.array of int, np.array of int): New count matrix, non-zero bc indices, feat indices ''' new_mat = copy.deepcopy(self) ...
[ "def", "select_axes_above_threshold", "(", "self", ",", "threshold", "=", "0", ")", ":", "new_mat", "=", "copy", ".", "deepcopy", "(", "self", ")", "nonzero_bcs", "=", "np", ".", "flatnonzero", "(", "new_mat", ".", "get_counts_per_bc", "(", ")", ">", "thre...
https://github.com/10XGenomics/cellranger/blob/a83c753ce641db6409a59ad817328354fbe7187e/lib/python/cellranger/matrix.py#L602-L623
doorstop-dev/doorstop
03aa287e5069e29da6979274e1cb6714ee450d3a
doorstop/core/tree.py
python
Tree.from_list
(documents, root=None)
return tree
Initialize a new tree from a list of documents. :param documents: list of :class:`~doorstop.core.document.Document` :param root: path to root of the project :raises: :class:`~doorstop.common.DoorstopError` when the tree cannot be built :return: new :class:`~doorstop.core.t...
Initialize a new tree from a list of documents.
[ "Initialize", "a", "new", "tree", "from", "a", "list", "of", "documents", "." ]
def from_list(documents, root=None): """Initialize a new tree from a list of documents. :param documents: list of :class:`~doorstop.core.document.Document` :param root: path to root of the project :raises: :class:`~doorstop.common.DoorstopError` when the tree cannot be buil...
[ "def", "from_list", "(", "documents", ",", "root", "=", "None", ")", ":", "if", "not", "documents", ":", "return", "Tree", "(", "document", "=", "None", ",", "root", "=", "root", ")", "unplaced", "=", "list", "(", "documents", ")", "for", "document", ...
https://github.com/doorstop-dev/doorstop/blob/03aa287e5069e29da6979274e1cb6714ee450d3a/doorstop/core/tree.py#L43-L94
Tencent/PocketFlow
53b82cba5a34834400619e7c335a23995d45c2a6
utils/external/ssd_tensorflow/preprocessing/ssd_preprocessing.py
python
preprocess_image
(image, labels, bboxes, out_shape, is_training=False, data_format='channels_first', output_rgb=True)
Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. labels: A `Tensor` containing all labels for all bboxes of this image. bboxes: A `Tensor` containing all bboxes of this image, in range [0., 1.] with shape [num_bboxes, 4]. out_shape: The height and width o...
Preprocesses the given image.
[ "Preprocesses", "the", "given", "image", "." ]
def preprocess_image(image, labels, bboxes, out_shape, is_training=False, data_format='channels_first', output_rgb=True): """Preprocesses the given image. Args: image: A `Tensor` representing an image of arbitrary size. labels: A `Tensor` containing all labels for all bboxes of this image. bboxes: A `T...
[ "def", "preprocess_image", "(", "image", ",", "labels", ",", "bboxes", ",", "out_shape", ",", "is_training", "=", "False", ",", "data_format", "=", "'channels_first'", ",", "output_rgb", "=", "True", ")", ":", "if", "is_training", ":", "return", "preprocess_fo...
https://github.com/Tencent/PocketFlow/blob/53b82cba5a34834400619e7c335a23995d45c2a6/utils/external/ssd_tensorflow/preprocessing/ssd_preprocessing.py#L504-L521
ethz-asl/hfnet
01577845583373470a0cf156a2acd972e9223bc7
hfnet/models/lfnet_utils/det_tools.py
python
pixel2cam
(depths, pixel_coords, inv_intrinsics, is_homogeneous=True)
return cam_coords
Transforms coordinates in the pixel frame to the camera frame. Args: depths: [batch, height, width] pixel_coords: homogeneous pixel coordinates [batch, 3, height, width] intrinsics: camera intrinsics [batch, 3, 3] is_homogeneous: return in homogeneous coordinates Returns: ...
Transforms coordinates in the pixel frame to the camera frame.
[ "Transforms", "coordinates", "in", "the", "pixel", "frame", "to", "the", "camera", "frame", "." ]
def pixel2cam(depths, pixel_coords, inv_intrinsics, is_homogeneous=True): """Transforms coordinates in the pixel frame to the camera frame. Args: depths: [batch, height, width] pixel_coords: homogeneous pixel coordinates [batch, 3, height, width] intrinsics: camera intrinsics [batch, 3,...
[ "def", "pixel2cam", "(", "depths", ",", "pixel_coords", ",", "inv_intrinsics", ",", "is_homogeneous", "=", "True", ")", ":", "batch", "=", "tf", ".", "shape", "(", "depths", ")", "[", "0", "]", "height", "=", "tf", ".", "shape", "(", "depths", ")", "...
https://github.com/ethz-asl/hfnet/blob/01577845583373470a0cf156a2acd972e9223bc7/hfnet/models/lfnet_utils/det_tools.py#L1010-L1036
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/ast.py
python
get_docstring
(node, clean=True)
Return the docstring for the given node or None if no docstring can be found. If the node provided does not have docstrings a TypeError will be raised.
Return the docstring for the given node or None if no docstring can be found. If the node provided does not have docstrings a TypeError will be raised.
[ "Return", "the", "docstring", "for", "the", "given", "node", "or", "None", "if", "no", "docstring", "can", "be", "found", ".", "If", "the", "node", "provided", "does", "not", "have", "docstrings", "a", "TypeError", "will", "be", "raised", "." ]
def get_docstring(node, clean=True): """ Return the docstring for the given node or None if no docstring can be found. If the node provided does not have docstrings a TypeError will be raised. """ if not isinstance(node, (FunctionDef, ClassDef, Module)): raise TypeError("%r can't have d...
[ "def", "get_docstring", "(", "node", ",", "clean", "=", "True", ")", ":", "if", "not", "isinstance", "(", "node", ",", "(", "FunctionDef", ",", "ClassDef", ",", "Module", ")", ")", ":", "raise", "TypeError", "(", "\"%r can't have docstrings\"", "%", "node"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/ast.py#L187-L200
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-amd64/pyquery/cssselectpatch.py
python
JQueryTranslator.xpath_gt_function
(self, xpath, function)
return xpath
Matches all elements with an index over the given one:: >>> from pyquery import PyQuery >>> d = PyQuery('<div><h1 class="first"/><h1 class="last"/></div>') >>> d('h1:gt(0)') [<h1.last>] ..
Matches all elements with an index over the given one::
[ "Matches", "all", "elements", "with", "an", "index", "over", "the", "given", "one", "::" ]
def xpath_gt_function(self, xpath, function): """Matches all elements with an index over the given one:: >>> from pyquery import PyQuery >>> d = PyQuery('<div><h1 class="first"/><h1 class="last"/></div>') >>> d('h1:gt(0)') [<h1.last>] .. """ ...
[ "def", "xpath_gt_function", "(", "self", ",", "xpath", ",", "function", ")", ":", "if", "function", ".", "argument_types", "(", ")", "!=", "[", "'NUMBER'", "]", ":", "raise", "ExpressionError", "(", "\"Expected a single integer for :gt(), got %r\"", "%", "(", "f...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/pyquery/cssselectpatch.py#L367-L383
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/controllers/plugins/bruteforce_plugin.py
python
BruteforcePlugin._create_pass_generator
(self, url)
return p_bf.generator()
[]
def _create_pass_generator(self, url): p_bf = PasswordBruteforcer(url) p_bf.use_profiling = self._use_profiling p_bf.profiling_number = self._profiling_number p_bf.l337_p4sswd = self._l337_p4sswd p_bf.passwd_file = self._passwd_file return p_bf.generator()
[ "def", "_create_pass_generator", "(", "self", ",", "url", ")", ":", "p_bf", "=", "PasswordBruteforcer", "(", "url", ")", "p_bf", ".", "use_profiling", "=", "self", ".", "_use_profiling", "p_bf", ".", "profiling_number", "=", "self", ".", "_profiling_number", "...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/plugins/bruteforce_plugin.py#L86-L92
appinho/SARosPerceptionKitti
148683b23bef294762ced937e4386501e56c8d64
benchmark/python/evaluate_tracking.py
python
trackingEvaluation.boxoverlap
(self,a,b,criterion="union")
return o
boxoverlap computes intersection over union for bbox a and b in KITTI format. If the criterion is 'union', overlap = (a inter b) / a union b). If the criterion is 'a', overlap = (a inter b) / a, where b should be a dontcare area.
boxoverlap computes intersection over union for bbox a and b in KITTI format. If the criterion is 'union', overlap = (a inter b) / a union b). If the criterion is 'a', overlap = (a inter b) / a, where b should be a dontcare area.
[ "boxoverlap", "computes", "intersection", "over", "union", "for", "bbox", "a", "and", "b", "in", "KITTI", "format", ".", "If", "the", "criterion", "is", "union", "overlap", "=", "(", "a", "inter", "b", ")", "/", "a", "union", "b", ")", ".", "If", "th...
def boxoverlap(self,a,b,criterion="union"): """ boxoverlap computes intersection over union for bbox a and b in KITTI format. If the criterion is 'union', overlap = (a inter b) / a union b). If the criterion is 'a', overlap = (a inter b) / a, where b should be a dontcare area...
[ "def", "boxoverlap", "(", "self", ",", "a", ",", "b", ",", "criterion", "=", "\"union\"", ")", ":", "#print(\"GT %d %d, %d %d\" % (a.x1, a.x2, a.y1, a.y2))", "#print(\"TR %d %d, %d %d\" % (b.x1, b.x2, b.y1, b.y2))", "x1", "=", "max", "(", "a", ".", "x1", ",", "b", "...
https://github.com/appinho/SARosPerceptionKitti/blob/148683b23bef294762ced937e4386501e56c8d64/benchmark/python/evaluate_tracking.py#L344-L372
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/inspect.py
python
isdatadescriptor
(object)
return (hasattr(object, "__set__") and hasattr(object, "__get__"))
Return true if the object is a data descriptor. Data descriptors have both a __get__ and a __set__ attribute. Examples are properties (defined in Python) and getsets and members (defined in C). Typically, data descriptors will also have __name__ and __doc__ attributes (properties, getsets, and members...
Return true if the object is a data descriptor.
[ "Return", "true", "if", "the", "object", "is", "a", "data", "descriptor", "." ]
def isdatadescriptor(object): """Return true if the object is a data descriptor. Data descriptors have both a __get__ and a __set__ attribute. Examples are properties (defined in Python) and getsets and members (defined in C). Typically, data descriptors will also have __name__ and __doc__ attributes ...
[ "def", "isdatadescriptor", "(", "object", ")", ":", "return", "(", "hasattr", "(", "object", ",", "\"__set__\"", ")", "and", "hasattr", "(", "object", ",", "\"__get__\"", ")", ")" ]
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/inspect.py#L105-L113
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/pip/utils/__init__.py
python
dist_is_local
(dist)
return is_local(dist_location(dist))
Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv.
Return True if given Distribution object is installed locally (i.e. within current virtualenv).
[ "Return", "True", "if", "given", "Distribution", "object", "is", "installed", "locally", "(", "i", ".", "e", ".", "within", "current", "virtualenv", ")", "." ]
def dist_is_local(dist): """ Return True if given Distribution object is installed locally (i.e. within current virtualenv). Always True if we're not in a virtualenv. """ return is_local(dist_location(dist))
[ "def", "dist_is_local", "(", "dist", ")", ":", "return", "is_local", "(", "dist_location", "(", "dist", ")", ")" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/utils/__init__.py#L289-L297
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/psutil/_psposix.py
python
pid_exists
(pid)
Check whether pid exists in the current process table.
Check whether pid exists in the current process table.
[ "Check", "whether", "pid", "exists", "in", "the", "current", "process", "table", "." ]
def pid_exists(pid): """Check whether pid exists in the current process table.""" if pid == 0: # According to "man 2 kill" PID 0 has a special meaning: # it refers to <<every process in the process group of the # calling process>> so we don't want to go any further. # If we get h...
[ "def", "pid_exists", "(", "pid", ")", ":", "if", "pid", "==", "0", ":", "# According to \"man 2 kill\" PID 0 has a special meaning:", "# it refers to <<every process in the process group of the", "# calling process>> so we don't want to go any further.", "# If we get here it means this U...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/psutil/_psposix.py#L28-L47
aliyun/aliyun-oss-python-sdk
5f2afa0928a58c7c1cc6317ac147f3637481f6fd
oss2/resumable.py
python
_ResumableOperation._put_record
(self, record)
[]
def _put_record(self, record): self.__store.put(self.__record_key, record)
[ "def", "_put_record", "(", "self", ",", "record", ")", ":", "self", ".", "__store", ".", "put", "(", "self", ".", "__record_key", ",", "record", ")" ]
https://github.com/aliyun/aliyun-oss-python-sdk/blob/5f2afa0928a58c7c1cc6317ac147f3637481f6fd/oss2/resumable.py#L316-L317
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/gc100/__init__.py
python
GC100Device.read_sensor
(self, port_addr, callback)
Read a value from a digital input.
Read a value from a digital input.
[ "Read", "a", "value", "from", "a", "digital", "input", "." ]
def read_sensor(self, port_addr, callback): """Read a value from a digital input.""" self.gc_device.read_sensor(port_addr, callback)
[ "def", "read_sensor", "(", "self", ",", "port_addr", ",", "callback", ")", ":", "self", ".", "gc_device", ".", "read_sensor", "(", "port_addr", ",", "callback", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/gc100/__init__.py#L57-L59
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_Uno_Card_Game.py
python
Match.begin
(self)
[]
def begin(self): self.elements['Console'] = 'Beginning Game, Click Draw to Deal.' self.drawScreen() self.enterBreak() self.eventDealCards() self.turn = random.choice(self.turnList) self.elements['Console'] = 'First turn will be {}. Click Draw'.format(self.players[self.tur...
[ "def", "begin", "(", "self", ")", ":", "self", ".", "elements", "[", "'Console'", "]", "=", "'Beginning Game, Click Draw to Deal.'", "self", ".", "drawScreen", "(", ")", "self", ".", "enterBreak", "(", ")", "self", ".", "eventDealCards", "(", ")", "self", ...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Uno_Card_Game.py#L2362-L2376
vlajnaya-mol/message-analyser
cd2803ef3bc8367c35ffab8626f639125b039c77
message_analyser/analyser.py
python
_get_all_messages
(dialog, vkopt_file, your_name, target_name, loop)
return msgs
[]
async def _get_all_messages(dialog, vkopt_file, your_name, target_name, loop): msgs = [] if dialog != -1: msgs.extend(await tlg.get_telegram_messages(your_name, target_name, loop=loop, target_id=dialog)) await asyncio.sleep(delay) if vkopt_file: msgs.extend(vkOpt.get_mymessages_from_fil...
[ "async", "def", "_get_all_messages", "(", "dialog", ",", "vkopt_file", ",", "your_name", ",", "target_name", ",", "loop", ")", ":", "msgs", "=", "[", "]", "if", "dialog", "!=", "-", "1", ":", "msgs", ".", "extend", "(", "await", "tlg", ".", "get_telegr...
https://github.com/vlajnaya-mol/message-analyser/blob/cd2803ef3bc8367c35ffab8626f639125b039c77/message_analyser/analyser.py#L157-L167
hellojialee/Improved-Body-Parts
0fa17dff1ea829c2951c18185d5f1ce7fe0072fc
models/layers_transposed.py
python
SELayer.forward
(self, x)
return x * y
[]
def forward(self, x): b, c, _, _ = x.size() y = self.avg_pool(x).view(b, c) y = self.fc(y).view(b, c, 1, 1) return x * y
[ "def", "forward", "(", "self", ",", "x", ")", ":", "b", ",", "c", ",", "_", ",", "_", "=", "x", ".", "size", "(", ")", "y", "=", "self", ".", "avg_pool", "(", "x", ")", ".", "view", "(", "b", ",", "c", ")", "y", "=", "self", ".", "fc", ...
https://github.com/hellojialee/Improved-Body-Parts/blob/0fa17dff1ea829c2951c18185d5f1ce7fe0072fc/models/layers_transposed.py#L302-L306
vcheckzen/FODI
3bb23644938a33c3fdfb9611a622e35ed4ce6532
back-end-py/main/3rd/Crypto/Math/_IntegerGMP.py
python
IntegerGMP.size_in_bytes
(self)
return (self.size_in_bits() - 1) // 8 + 1
Return the minimum number of bytes that can encode the number.
Return the minimum number of bytes that can encode the number.
[ "Return", "the", "minimum", "number", "of", "bytes", "that", "can", "encode", "the", "number", "." ]
def size_in_bytes(self): """Return the minimum number of bytes that can encode the number.""" return (self.size_in_bits() - 1) // 8 + 1
[ "def", "size_in_bytes", "(", "self", ")", ":", "return", "(", "self", ".", "size_in_bits", "(", ")", "-", "1", ")", "//", "8", "+", "1" ]
https://github.com/vcheckzen/FODI/blob/3bb23644938a33c3fdfb9611a622e35ed4ce6532/back-end-py/main/3rd/Crypto/Math/_IntegerGMP.py#L580-L582
isnowfy/pydown
71ecc891868cd2a34b7e5fe662c99474f2d0fd7f
markdown/extensions/attr_list.py
python
_handle_key_value
(s, t)
return t.split('=')
[]
def _handle_key_value(s, t): return t.split('=')
[ "def", "_handle_key_value", "(", "s", ",", "t", ")", ":", "return", "t", ".", "split", "(", "'='", ")" ]
https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/markdown/extensions/attr_list.py#L39-L40
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/gis/gdal/geometries.py
python
OGRGeometry.geom_type
(self)
return OGRGeomType(capi.get_geom_type(self.ptr))
Returns the Type for this Geometry.
Returns the Type for this Geometry.
[ "Returns", "the", "Type", "for", "this", "Geometry", "." ]
def geom_type(self): "Returns the Type for this Geometry." return OGRGeomType(capi.get_geom_type(self.ptr))
[ "def", "geom_type", "(", "self", ")", ":", "return", "OGRGeomType", "(", "capi", ".", "get_geom_type", "(", "self", ".", "ptr", ")", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/gdal/geometries.py#L243-L245
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/icicle/marker/colorbar/title/_font.py
python
Font.color
(self)
return self["color"]
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblu...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblu...
[ "The", "color", "property", "is", "a", "color", "and", "may", "be", "specified", "as", ":", "-", "A", "hex", "string", "(", "e", ".", "g", ".", "#ff0000", ")", "-", "An", "rgb", "/", "rgba", "string", "(", "e", ".", "g", ".", "rgb", "(", "255",...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/icicle/marker/colorbar/title/_font.py#L16-L64
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/docx/image/jpeg.py
python
Exif.from_stream
(cls, stream)
return cls(px_width, px_height, horz_dpi, vert_dpi)
Return |Exif| instance having header properties parsed from Exif image in *stream*.
Return |Exif| instance having header properties parsed from Exif image in *stream*.
[ "Return", "|Exif|", "instance", "having", "header", "properties", "parsed", "from", "Exif", "image", "in", "*", "stream", "*", "." ]
def from_stream(cls, stream): """ Return |Exif| instance having header properties parsed from Exif image in *stream*. """ markers = _JfifMarkers.from_stream(stream) # print('\n%s' % markers) px_width = markers.sof.px_width px_height = markers.sof.px_heigh...
[ "def", "from_stream", "(", "cls", ",", "stream", ")", ":", "markers", "=", "_JfifMarkers", ".", "from_stream", "(", "stream", ")", "# print('\\n%s' % markers)", "px_width", "=", "markers", ".", "sof", ".", "px_width", "px_height", "=", "markers", ".", "sof", ...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/docx/image/jpeg.py#L42-L55
wikimedia/pywikibot
81a01ffaec7271bf5b4b170f85a80388420a4e78
pywikibot/comms/eventstreams.py
python
site_rc_listener
(site, total: Optional[int] = None)
return stream
Yield changes received from EventStream. :param site: the Pywikibot.Site object to yield live recent changes for :type site: Pywikibot.BaseSite :param total: the maximum number of changes to return :return: pywikibot.comms.eventstream.rc_listener configured for given site :raises ImportError: ssec...
Yield changes received from EventStream.
[ "Yield", "changes", "received", "from", "EventStream", "." ]
def site_rc_listener(site, total: Optional[int] = None): """Yield changes received from EventStream. :param site: the Pywikibot.Site object to yield live recent changes for :type site: Pywikibot.BaseSite :param total: the maximum number of changes to return :return: pywikibot.comms.eventstream.rc_...
[ "def", "site_rc_listener", "(", "site", ",", "total", ":", "Optional", "[", "int", "]", "=", "None", ")", ":", "if", "isinstance", "(", "EventSource", ",", "Exception", ")", ":", "raise", "ImportError", "(", "'sseclient is required for EventStreams;\\n'", "'inst...
https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/comms/eventstreams.py#L330-L347
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/interfaces.py
python
ConnectionProxy.prepare_twophase
(self, conn, prepare_twophase, xid)
return prepare_twophase(xid)
Intercept prepare_twophase() events.
Intercept prepare_twophase() events.
[ "Intercept", "prepare_twophase", "()", "events", "." ]
def prepare_twophase(self, conn, prepare_twophase, xid): """Intercept prepare_twophase() events.""" return prepare_twophase(xid)
[ "def", "prepare_twophase", "(", "self", ",", "conn", ",", "prepare_twophase", ",", "xid", ")", ":", "return", "prepare_twophase", "(", "xid", ")" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/interfaces.py#L299-L302
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/geometry/polyhedron/double_description.py
python
DoubleDescriptionPair.are_adjacent
(self, r1, r2)
return A_Z12.rank() == self.problem.dim() - 2
Return whether the two rays are adjacent. INPUT: - ``r1``, ``r2`` -- two rays. OUTPUT: Boolean. Whether the two rays are adjacent. EXAMPLES:: sage: from sage.geometry.polyhedron.double_description import StandardAlgorithm sage: A = matrix(QQ, [(0,1,0...
Return whether the two rays are adjacent.
[ "Return", "whether", "the", "two", "rays", "are", "adjacent", "." ]
def are_adjacent(self, r1, r2): """ Return whether the two rays are adjacent. INPUT: - ``r1``, ``r2`` -- two rays. OUTPUT: Boolean. Whether the two rays are adjacent. EXAMPLES:: sage: from sage.geometry.polyhedron.double_description import Standa...
[ "def", "are_adjacent", "(", "self", ",", "r1", ",", "r2", ")", ":", "Z", "=", "self", ".", "zero_set", "(", "r1", ")", ".", "intersection", "(", "self", ".", "zero_set", "(", "r2", ")", ")", "if", "not", "Z", ":", "return", "self", ".", "problem"...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/polyhedron/double_description.py#L423-L455
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/console/vmrc.py
python
VMRCConsole.generate_password
(self, vim_session, pool, instance_name)
return base64.b64encode(json_data)
Returns VMRC Connection credentials. Return string is of the form '<VM PATH>:<ESX Username>@<ESX Password>'.
Returns VMRC Connection credentials.
[ "Returns", "VMRC", "Connection", "credentials", "." ]
def generate_password(self, vim_session, pool, instance_name): """Returns VMRC Connection credentials. Return string is of the form '<VM PATH>:<ESX Username>@<ESX Password>'. """ username, password = pool['username'], pool['password'] vms = vim_session._call_method(vim_util, 'g...
[ "def", "generate_password", "(", "self", ",", "vim_session", ",", "pool", ",", "instance_name", ")", ":", "username", ",", "password", "=", "pool", "[", "'username'", "]", ",", "pool", "[", "'password'", "]", "vms", "=", "vim_session", ".", "_call_method", ...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/console/vmrc.py#L73-L101
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
setuptools/command/egg_info.py
python
manifest_maker._manifest_normalize
(self, path)
return path.replace(os.sep, '/')
[]
def _manifest_normalize(self, path): path = unicode_utils.filesys_decode(path) return path.replace(os.sep, '/')
[ "def", "_manifest_normalize", "(", "self", ",", "path", ")", ":", "path", "=", "unicode_utils", ".", "filesys_decode", "(", "path", ")", "return", "path", ".", "replace", "(", "os", ".", "sep", ",", "'/'", ")" ]
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/command/egg_info.py#L550-L552
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
p2pool/util/math.py
python
add_tuples
(res, *tuples)
return res
[]
def add_tuples(res, *tuples): for t in tuples: if len(t) != len(res): raise ValueError('tuples must all be the same length') res = tuple(a + b for a, b in zip(res, t)) return res
[ "def", "add_tuples", "(", "res", ",", "*", "tuples", ")", ":", "for", "t", "in", "tuples", ":", "if", "len", "(", "t", ")", "!=", "len", "(", "res", ")", ":", "raise", "ValueError", "(", "'tuples must all be the same length'", ")", "res", "=", "tuple",...
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/p2pool/util/math.py#L165-L170
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py
python
parse_requirements
(strs)
Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof.
Yield ``Requirement`` objects for each specification in `strs`
[ "Yield", "Requirement", "objects", "for", "each", "specification", "in", "strs" ]
def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) for line in lines: # Dro...
[ "def", "parse_requirements", "(", "strs", ")", ":", "# create a steppable iterator, so we can handle \\-continuations", "lines", "=", "iter", "(", "yield_lines", "(", "strs", ")", ")", "for", "line", "in", "lines", ":", "# Drop comments -- a hash without a space may be in a...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L3066-L3085
blawar/nut
2cf351400418399a70164987e28670309f6c9cb5
nut/blockchain.py
python
Blockchain.resolve_conflicts
(self)
return False
This is our consensus algorithm, it resolves conflicts by replacing our chain with the longest one in the network. :return: True if our chain was replaced, False if not
This is our consensus algorithm, it resolves conflicts by replacing our chain with the longest one in the network.
[ "This", "is", "our", "consensus", "algorithm", "it", "resolves", "conflicts", "by", "replacing", "our", "chain", "with", "the", "longest", "one", "in", "the", "network", "." ]
def resolve_conflicts(self): """ This is our consensus algorithm, it resolves conflicts by replacing our chain with the longest one in the network. :return: True if our chain was replaced, False if not """ neighbours = self.nodes new_chain = None max_length = len(self.chain) for node in neighbours...
[ "def", "resolve_conflicts", "(", "self", ")", ":", "neighbours", "=", "self", ".", "nodes", "new_chain", "=", "None", "max_length", "=", "len", "(", "self", ".", "chain", ")", "for", "node", "in", "neighbours", ":", "response", "=", "requests", ".", "get...
https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/nut/blockchain.py#L238-L266
addam/Export-Paper-Model-from-Blender
a65d02008b4034f9c619af40b529309ce99d6e98
unfolder.py
python
is_upsidedown_wrong
(name)
return chars.issubset(rotatable) and not chars.isdisjoint(mistakable)
Tell if the string would get a different meaning if written upside down
Tell if the string would get a different meaning if written upside down
[ "Tell", "if", "the", "string", "would", "get", "a", "different", "meaning", "if", "written", "upside", "down" ]
def is_upsidedown_wrong(name): """Tell if the string would get a different meaning if written upside down""" chars = set(name) mistakable = set("69NZMWpbqd") rotatable = set("80oOxXIl").union(mistakable) return chars.issubset(rotatable) and not chars.isdisjoint(mistakable)
[ "def", "is_upsidedown_wrong", "(", "name", ")", ":", "chars", "=", "set", "(", "name", ")", "mistakable", "=", "set", "(", "\"69NZMWpbqd\"", ")", "rotatable", "=", "set", "(", "\"80oOxXIl\"", ")", ".", "union", "(", "mistakable", ")", "return", "chars", ...
https://github.com/addam/Export-Paper-Model-from-Blender/blob/a65d02008b4034f9c619af40b529309ce99d6e98/unfolder.py#L18-L23
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/_vendor/urllib3/poolmanager.py
python
ProxyManager.connection_from_host
(self, host, port=None, scheme="http", pool_kwargs=None)
return super(ProxyManager, self).connection_from_host( self.proxy.host, self.proxy.port, self.proxy.scheme, pool_kwargs=pool_kwargs )
[]
def connection_from_host(self, host, port=None, scheme="http", pool_kwargs=None): if scheme == "https": return super(ProxyManager, self).connection_from_host( host, port, scheme, pool_kwargs=pool_kwargs ) return super(ProxyManager, self).connection_from_host( ...
[ "def", "connection_from_host", "(", "self", ",", "host", ",", "port", "=", "None", ",", "scheme", "=", "\"http\"", ",", "pool_kwargs", "=", "None", ")", ":", "if", "scheme", "==", "\"https\"", ":", "return", "super", "(", "ProxyManager", ",", "self", ")"...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/_vendor/urllib3/poolmanager.py#L502-L510
BishopFox/zigdiggity
b969b3f7e8d7fc010aef0578acf04167320f1d6f
patch/zigbee.py
python
ZigbeeSecurityHeader.post_dissect
(self, s)
return s
[]
def post_dissect(self, s): # Get the mic dissected correctly mic_length = util_mic_len(self) if mic_length > 0: # Slice "data" into "data + mic" _data, _mic = self.data[:-mic_length], self.data[-mic_length:] self.data, self.mic = _data, _mic return s
[ "def", "post_dissect", "(", "self", ",", "s", ")", ":", "# Get the mic dissected correctly", "mic_length", "=", "util_mic_len", "(", "self", ")", "if", "mic_length", ">", "0", ":", "# Slice \"data\" into \"data + mic\"", "_data", ",", "_mic", "=", "self", ".", "...
https://github.com/BishopFox/zigdiggity/blob/b969b3f7e8d7fc010aef0578acf04167320f1d6f/patch/zigbee.py#L519-L525
vcs-python/vcspull
eebdc5933270234900184137a9a687b5e84f5c2d
vcspull/log.py
python
debug_log_template
(self, record)
return tpl
Return the prefix for the log message. Template for Formatter. Parameters ---------- record : :class:`logging.LogRecord` This is passed in from inside the :py:meth:`logging.Formatter.format` record.
Return the prefix for the log message. Template for Formatter.
[ "Return", "the", "prefix", "for", "the", "log", "message", ".", "Template", "for", "Formatter", "." ]
def debug_log_template(self, record): """Return the prefix for the log message. Template for Formatter. Parameters ---------- record : :class:`logging.LogRecord` This is passed in from inside the :py:meth:`logging.Formatter.format` record. """ reset = [Style.RESET_ALL] levelname = ...
[ "def", "debug_log_template", "(", "self", ",", "record", ")", ":", "reset", "=", "[", "Style", ".", "RESET_ALL", "]", "levelname", "=", "[", "LEVEL_COLORS", ".", "get", "(", "record", ".", "levelname", ")", ",", "Style", ".", "BRIGHT", ",", "'(%(levelnam...
https://github.com/vcs-python/vcspull/blob/eebdc5933270234900184137a9a687b5e84f5c2d/vcspull/log.py#L91-L141
Ultimaker/Uranium
66da853cd9a04edd3a8a03526fac81e83c03f5aa
UM/Math/Color.py
python
Color.fromHexString
(value)
Returns a new Color constructed from a 7- or 9-character string "#RRGGBB" or "#AARRGGBB" format. :param value: A 7- or 9-character string representing a color in "#RRGGBB" or "#AARRGGBB" format. :return: A Color constructed from the components of value.
Returns a new Color constructed from a 7- or 9-character string "#RRGGBB" or "#AARRGGBB" format.
[ "Returns", "a", "new", "Color", "constructed", "from", "a", "7", "-", "or", "9", "-", "character", "string", "#RRGGBB", "or", "#AARRGGBB", "format", "." ]
def fromHexString(value): """Returns a new Color constructed from a 7- or 9-character string "#RRGGBB" or "#AARRGGBB" format. :param value: A 7- or 9-character string representing a color in "#RRGGBB" or "#AARRGGBB" format. :return: A Color constructed from the components of value. """ ...
[ "def", "fromHexString", "(", "value", ")", ":", "if", "len", "(", "value", ")", "==", "9", ":", "return", "Color", "(", "int", "(", "value", "[", "3", ":", "5", "]", ",", "16", ")", "/", "255", ",", "int", "(", "value", "[", "5", ":", "7", ...
https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/UM/Math/Color.py#L112-L132
polakowo/vectorbt
6638735c131655760474d72b9f045d1dbdbd8fe9
vectorbt/indicators/nb.py
python
obv_custom_nb
(close: tp.Array2d, volume_ts: tp.Array2d)
return obv
Custom calculation function for `vectorbt.indicators.basic.OBV`.
Custom calculation function for `vectorbt.indicators.basic.OBV`.
[ "Custom", "calculation", "function", "for", "vectorbt", ".", "indicators", ".", "basic", ".", "OBV", "." ]
def obv_custom_nb(close: tp.Array2d, volume_ts: tp.Array2d) -> tp.Array2d: """Custom calculation function for `vectorbt.indicators.basic.OBV`.""" obv = generic_nb.set_by_mask_mult_nb(volume_ts, close < generic_nb.fshift_nb(close, 1), -volume_ts) obv = generic_nb.nancumsum_nb(obv) return obv
[ "def", "obv_custom_nb", "(", "close", ":", "tp", ".", "Array2d", ",", "volume_ts", ":", "tp", ".", "Array2d", ")", "->", "tp", ".", "Array2d", ":", "obv", "=", "generic_nb", ".", "set_by_mask_mult_nb", "(", "volume_ts", ",", "close", "<", "generic_nb", "...
https://github.com/polakowo/vectorbt/blob/6638735c131655760474d72b9f045d1dbdbd8fe9/vectorbt/indicators/nb.py#L221-L225
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
gluon/gluoncv2/models/seresnet_cifar.py
python
seresnet272bn_cifar100
(classes=100, **kwargs)
return get_seresnet_cifar(classes=classes, blocks=272, bottleneck=True, model_name="seresnet272bn_cifar100", **kwargs)
SE-ResNet-272(BN) model for CIFAR-100 from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- classes : int, default 100 Number of classification classes. pretrained : bool, default False Whether to load the pretrained weights for model. ctx ...
SE-ResNet-272(BN) model for CIFAR-100 from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507.
[ "SE", "-", "ResNet", "-", "272", "(", "BN", ")", "model", "for", "CIFAR", "-", "100", "from", "Squeeze", "-", "and", "-", "Excitation", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1709", ".", "01507", "." ]
def seresnet272bn_cifar100(classes=100, **kwargs): """ SE-ResNet-272(BN) model for CIFAR-100 from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- classes : int, default 100 Number of classification classes. pretrained : bool, default False ...
[ "def", "seresnet272bn_cifar100", "(", "classes", "=", "100", ",", "*", "*", "kwargs", ")", ":", "return", "get_seresnet_cifar", "(", "classes", "=", "classes", ",", "blocks", "=", "272", ",", "bottleneck", "=", "True", ",", "model_name", "=", "\"seresnet272b...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/gluoncv2/models/seresnet_cifar.py#L397-L413
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/controllers/misc/traceback_utils.py
python
get_traceback
()
return tb
[]
def get_traceback(): _, _, tb = sys.exc_info() return tb
[ "def", "get_traceback", "(", ")", ":", "_", ",", "_", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "return", "tb" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/misc/traceback_utils.py#L27-L29
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/models/bootresource.py
python
BootResourceManager.get_uploaded_resource
(self, name, architecture, subarchitecture)
return self._get_resource( BOOT_RESOURCE_TYPE.UPLOADED, name, architecture, subarchitecture )
Return `BootResource` with type of UPLOADED, and given name, architecture, and subarchitecture.
Return `BootResource` with type of UPLOADED, and given name, architecture, and subarchitecture.
[ "Return", "BootResource", "with", "type", "of", "UPLOADED", "and", "given", "name", "architecture", "and", "subarchitecture", "." ]
def get_uploaded_resource(self, name, architecture, subarchitecture): """Return `BootResource` with type of UPLOADED, and given name, architecture, and subarchitecture.""" return self._get_resource( BOOT_RESOURCE_TYPE.UPLOADED, name, architecture, subarchitecture )
[ "def", "get_uploaded_resource", "(", "self", ",", "name", ",", "architecture", ",", "subarchitecture", ")", ":", "return", "self", ".", "_get_resource", "(", "BOOT_RESOURCE_TYPE", ".", "UPLOADED", ",", "name", ",", "architecture", ",", "subarchitecture", ")" ]
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/models/bootresource.py#L105-L110
alan-turing-institute/sktime
79cc513346b1257a6f3fa8e4ed855b5a2a7de716
sktime/clustering/_base.py
python
BaseClusterer._initial_conversion
(X: Any)
return X
Format data as valid panel mtype of the data. Parameters ---------- X: Any Data to convert to panel mtype. Returns ------- X: np.ndarray (at least 2d) or pd.Dataframe or List[pd.Dataframe] Converted X.
Format data as valid panel mtype of the data.
[ "Format", "data", "as", "valid", "panel", "mtype", "of", "the", "data", "." ]
def _initial_conversion(X: Any) -> TimeSeriesInstances: """Format data as valid panel mtype of the data. Parameters ---------- X: Any Data to convert to panel mtype. Returns ------- X: np.ndarray (at least 2d) or pd.Dataframe or List[pd.Dataframe] ...
[ "def", "_initial_conversion", "(", "X", ":", "Any", ")", "->", "TimeSeriesInstances", ":", "if", "isinstance", "(", "X", ",", "np", ".", "ndarray", ")", ":", "if", "X", ".", "ndim", "==", "2", ":", "X", "=", "X", ".", "reshape", "(", "X", ".", "s...
https://github.com/alan-turing-institute/sktime/blob/79cc513346b1257a6f3fa8e4ed855b5a2a7de716/sktime/clustering/_base.py#L255-L271
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/sentiment/util.py
python
demo_movie_reviews
(trainer, n_instances=None, output=None)
Train classifier on all instances of the Movie Reviews dataset. The corpus has been preprocessed using the default sentence tokenizer and WordPunctTokenizer. Features are composed of: - most frequent unigrams :param trainer: `train` method of a classifier. :param n_instances: the number of tot...
Train classifier on all instances of the Movie Reviews dataset. The corpus has been preprocessed using the default sentence tokenizer and WordPunctTokenizer. Features are composed of:
[ "Train", "classifier", "on", "all", "instances", "of", "the", "Movie", "Reviews", "dataset", ".", "The", "corpus", "has", "been", "preprocessed", "using", "the", "default", "sentence", "tokenizer", "and", "WordPunctTokenizer", ".", "Features", "are", "composed", ...
def demo_movie_reviews(trainer, n_instances=None, output=None): """ Train classifier on all instances of the Movie Reviews dataset. The corpus has been preprocessed using the default sentence tokenizer and WordPunctTokenizer. Features are composed of: - most frequent unigrams :param traine...
[ "def", "demo_movie_reviews", "(", "trainer", ",", "n_instances", "=", "None", ",", "output", "=", "None", ")", ":", "from", "nltk", ".", "corpus", "import", "movie_reviews", "from", "nltk", ".", "sentiment", "import", "SentimentAnalyzer", "if", "n_instances", ...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/sentiment/util.py#L552-L618
fooof-tools/fooof
14d6196e0b60c7e6da95b5cf858b20adcc5fc0ac
fooof/plts/fm.py
python
_add_peaks_width
(fm, plt_log, ax, **plot_kwargs)
Add a line across the width of peaks. Parameters ---------- fm : FOOOF FOOOF object containing results from fitting. plt_log : boolean Whether to plot the frequency values in log10 spacing. ax : matplotlib.Axes Figure axes upon which to plot. **plot_kwargs Keywor...
Add a line across the width of peaks.
[ "Add", "a", "line", "across", "the", "width", "of", "peaks", "." ]
def _add_peaks_width(fm, plt_log, ax, **plot_kwargs): """Add a line across the width of peaks. Parameters ---------- fm : FOOOF FOOOF object containing results from fitting. plt_log : boolean Whether to plot the frequency values in log10 spacing. ax : matplotlib.Axes Fig...
[ "def", "_add_peaks_width", "(", "fm", ",", "plt_log", ",", "ax", ",", "*", "*", "plot_kwargs", ")", ":", "defaults", "=", "{", "'color'", ":", "PLT_COLORS", "[", "'periodic'", "]", ",", "'alpha'", ":", "0.6", ",", "'lw'", ":", "2.5", ",", "'ms'", ":"...
https://github.com/fooof-tools/fooof/blob/14d6196e0b60c7e6da95b5cf858b20adcc5fc0ac/fooof/plts/fm.py#L260-L292