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
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/xmpp/SleekXMPP/sleekxmpp/xmlstream/xmlstream.py
python
XMLStream.del_filter
(self, mode, handler)
Remove an incoming or outgoing filter.
Remove an incoming or outgoing filter.
[ "Remove", "an", "incoming", "or", "outgoing", "filter", "." ]
def del_filter(self, mode, handler): """Remove an incoming or outgoing filter.""" self.__filters[mode].remove(handler)
[ "def", "del_filter", "(", "self", ",", "mode", ",", "handler", ")", ":", "self", ".", "__filters", "[", "mode", "]", ".", "remove", "(", "handler", ")" ]
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/xmlstream/xmlstream.py#L990-L992
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/ma/core.py
python
_DomainedBinaryOperation.__call__
(self, a, b, *args, **kwargs)
return result
Execute the call behavior.
Execute the call behavior.
[ "Execute", "the", "call", "behavior", "." ]
def __call__(self, a, b, *args, **kwargs): "Execute the call behavior." # Get the data and the mask (da, db) = (getdata(a, subok=False), getdata(b, subok=False)) (ma, mb) = (getmask(a), getmask(b)) # Get the result with np.errstate(divide='ignore', invalid='ignore'): ...
[ "def", "__call__", "(", "self", ",", "a", ",", "b", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Get the data and the mask", "(", "da", ",", "db", ")", "=", "(", "getdata", "(", "a", ",", "subok", "=", "False", ")", ",", "getdata", "("...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/ma/core.py#L1075-L1111
GothicAi/Instaboost
b6f80405b8706adad4aca1c1bdbb650b9c1c71e5
mmdetection/mmdet/core/bbox/transforms.py
python
bbox2roi
(bbox_list)
return rois
Convert a list of bboxes to roi format. Args: bbox_list (list[Tensor]): a list of bboxes corresponding to a batch of images. Returns: Tensor: shape (n, 5), [batch_ind, x1, y1, x2, y2]
Convert a list of bboxes to roi format.
[ "Convert", "a", "list", "of", "bboxes", "to", "roi", "format", "." ]
def bbox2roi(bbox_list): """Convert a list of bboxes to roi format. Args: bbox_list (list[Tensor]): a list of bboxes corresponding to a batch of images. Returns: Tensor: shape (n, 5), [batch_ind, x1, y1, x2, y2] """ rois_list = [] for img_id, bboxes in enumerate(bbo...
[ "def", "bbox2roi", "(", "bbox_list", ")", ":", "rois_list", "=", "[", "]", "for", "img_id", ",", "bboxes", "in", "enumerate", "(", "bbox_list", ")", ":", "if", "bboxes", ".", "size", "(", "0", ")", ">", "0", ":", "img_inds", "=", "bboxes", ".", "ne...
https://github.com/GothicAi/Instaboost/blob/b6f80405b8706adad4aca1c1bdbb650b9c1c71e5/mmdetection/mmdet/core/bbox/transforms.py#L106-L125
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/provenance_event_dto.py
python
ProvenanceEventDTO.event_time
(self)
return self._event_time
Gets the event_time of this ProvenanceEventDTO. The timestamp of the event. :return: The event_time of this ProvenanceEventDTO. :rtype: str
Gets the event_time of this ProvenanceEventDTO. The timestamp of the event.
[ "Gets", "the", "event_time", "of", "this", "ProvenanceEventDTO", ".", "The", "timestamp", "of", "the", "event", "." ]
def event_time(self): """ Gets the event_time of this ProvenanceEventDTO. The timestamp of the event. :return: The event_time of this ProvenanceEventDTO. :rtype: str """ return self._event_time
[ "def", "event_time", "(", "self", ")", ":", "return", "self", ".", "_event_time" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/provenance_event_dto.py#L298-L306
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py
python
dictOf
( key, value )
return Dict( ZeroOrMore( Group ( key + value ) ) )
Helper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, ...
Helper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens in the proper order. The key pattern can include delimiting markers or punctuation, as long as they are suppressed, ...
[ "Helper", "to", "easily", "and", "clearly", "define", "a", "dictionary", "by", "specifying", "the", "respective", "patterns", "for", "the", "key", "and", "value", ".", "Takes", "care", "of", "defining", "the", "C", "{", "L", "{", "Dict", "}}", "C", "{", ...
def dictOf( key, value ): """ Helper to easily and clearly define a dictionary by specifying the respective patterns for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens in the proper order. The key pattern can include delimiting markers or punctuation...
[ "def", "dictOf", "(", "key", ",", "value", ")", ":", "return", "Dict", "(", "ZeroOrMore", "(", "Group", "(", "key", "+", "value", ")", ")", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L4605-L4638
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/botocore/vendored/requests/api.py
python
options
(url, **kwargs)
return request('options', url, **kwargs)
Sends a OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response
Sends a OPTIONS request.
[ "Sends", "a", "OPTIONS", "request", "." ]
def options(url, **kwargs): """Sends a OPTIONS request. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :return: :class:`Response <Response>` object :rtype: requests.Response """ kwargs.setdefault('allow_redirects', True) ...
[ "def", "options", "(", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'allow_redirects'", ",", "True", ")", "return", "request", "(", "'options'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/botocore/vendored/requests/api.py#L93-L103
deepset-ai/haystack
79fdda8a7cf393d774803608a4874f2a6e63cf6f
haystack/modeling/model/prediction_head.py
python
QuestionAnsweringHead.calibrate_conf
(self, logits, label_all)
Learning a temperature parameter to apply temperature scaling to calibrate confidence scores
Learning a temperature parameter to apply temperature scaling to calibrate confidence scores
[ "Learning", "a", "temperature", "parameter", "to", "apply", "temperature", "scaling", "to", "calibrate", "confidence", "scores" ]
def calibrate_conf(self, logits, label_all): """ Learning a temperature parameter to apply temperature scaling to calibrate confidence scores """ logits = torch.cat(logits, dim=0) # To handle no_answer labels correctly (-1,-1), we set their start_position to 0. The logit at inde...
[ "def", "calibrate_conf", "(", "self", ",", "logits", ",", "label_all", ")", ":", "logits", "=", "torch", ".", "cat", "(", "logits", ",", "dim", "=", "0", ")", "# To handle no_answer labels correctly (-1,-1), we set their start_position to 0. The logit at index 0 also refe...
https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/haystack/modeling/model/prediction_head.py#L363-L399
danecjensen/subscribely
4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0
src/flask/wrappers.py
python
Request.endpoint
(self)
The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be `None`.
The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be `None`.
[ "The", "endpoint", "that", "matched", "the", "request", ".", "This", "in", "combination", "with", ":", "attr", ":", "view_args", "can", "be", "used", "to", "reconstruct", "the", "same", "or", "a", "modified", "URL", ".", "If", "an", "exception", "happened"...
def endpoint(self): """The endpoint that matched the request. This in combination with :attr:`view_args` can be used to reconstruct the same or a modified URL. If an exception happened when matching, this will be `None`. """ if self.url_rule is not None: ret...
[ "def", "endpoint", "(", "self", ")", ":", "if", "self", ".", "url_rule", "is", "not", "None", ":", "return", "self", ".", "url_rule", ".", "endpoint" ]
https://github.com/danecjensen/subscribely/blob/4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0/src/flask/wrappers.py#L63-L70
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/io/_harwell_boeing/hb.py
python
HBInfo.__init__
(self, title, key, total_nlines, pointer_nlines, indices_nlines, values_nlines, mxtype, nrows, ncols, nnon_zeros, pointer_format_str, indices_format_str, values_format_str, right_hand_sides_nlines=0, nelementals=0)
Do not use this directly, but the class ctrs (from_* functions).
Do not use this directly, but the class ctrs (from_* functions).
[ "Do", "not", "use", "this", "directly", "but", "the", "class", "ctrs", "(", "from_", "*", "functions", ")", "." ]
def __init__(self, title, key, total_nlines, pointer_nlines, indices_nlines, values_nlines, mxtype, nrows, ncols, nnon_zeros, pointer_format_str, indices_format_str, values_format_str, right_hand_sides_nlines=0, nelementals=0): """Do not use this directly, but the...
[ "def", "__init__", "(", "self", ",", "title", ",", "key", ",", "total_nlines", ",", "pointer_nlines", ",", "indices_nlines", ",", "values_nlines", ",", "mxtype", ",", "nrows", ",", "ncols", ",", "nnon_zeros", ",", "pointer_format_str", ",", "indices_format_str",...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/io/_harwell_boeing/hb.py#L208-L278
Garvit244/Leetcode
a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29
1000-1100q/1081.py
python
Solution.smallestSubsequence
(self, text)
return result
:type text: str :rtype: str
:type text: str :rtype: str
[ ":", "type", "text", ":", "str", ":", "rtype", ":", "str" ]
def smallestSubsequence(self, text): """ :type text: str :rtype: str """ if not text: return '' import collections freq_map = collections.Counter(text) used = [False]*26 result = '' for char in text: freq_ma...
[ "def", "smallestSubsequence", "(", "self", ",", "text", ")", ":", "if", "not", "text", ":", "return", "''", "import", "collections", "freq_map", "=", "collections", ".", "Counter", "(", "text", ")", "used", "=", "[", "False", "]", "*", "26", "result", ...
https://github.com/Garvit244/Leetcode/blob/a1d31ff0f9f251f3dd0bee5cc8b191b7ebbccc29/1000-1100q/1081.py#L29-L51
ApostropheEditor/Apostrophe
cc30858c15f3408296d73202497d3cdef5a46064
apostrophe/export_dialog.py
python
ExportDialog.__init__
(self, file, _format, text)
[]
def __init__(self, file, _format, text): self.format = _format self.text = text self._show_texlive_warning = (self.format == "pdf" and not helpers.exist_executable("pdftex")) if (self._show_texlive_warning): self.dialog = Gtk.MessageDia...
[ "def", "__init__", "(", "self", ",", "file", ",", "_format", ",", "text", ")", ":", "self", ".", "format", "=", "_format", "self", ".", "text", "=", "text", "self", ".", "_show_texlive_warning", "=", "(", "self", ".", "format", "==", "\"pdf\"", "and", ...
https://github.com/ApostropheEditor/Apostrophe/blob/cc30858c15f3408296d73202497d3cdef5a46064/apostrophe/export_dialog.py#L108-L142
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/GLU/tess.py
python
GLUtesselator.vertexWrapper
( self, function )
return wrap
Converts a vertex-pointer into an OOR vertex for processing
Converts a vertex-pointer into an OOR vertex for processing
[ "Converts", "a", "vertex", "-", "pointer", "into", "an", "OOR", "vertex", "for", "processing" ]
def vertexWrapper( self, function ): """Converts a vertex-pointer into an OOR vertex for processing""" if (function is not None) and (not hasattr( function,'__call__' )): raise TypeError( """Require a callable callback, got: %s"""%(function,)) def wrap( vertex, data=None ): ...
[ "def", "vertexWrapper", "(", "self", ",", "function", ")", ":", "if", "(", "function", "is", "not", "None", ")", "and", "(", "not", "hasattr", "(", "function", ",", "'__call__'", ")", ")", ":", "raise", "TypeError", "(", "\"\"\"Require a callable callback, g...
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GLU/tess.py#L148-L164
LuxCoreRender/BlendLuxCore
bf31ca58501d54c02acd97001b6db7de81da7cbf
ui/world.py
python
register
()
[]
def register(): for panel in compatible_panels(): panel.COMPAT_ENGINES.add("LUXCORE")
[ "def", "register", "(", ")", ":", "for", "panel", "in", "compatible_panels", "(", ")", ":", "panel", ".", "COMPAT_ENGINES", ".", "add", "(", "\"LUXCORE\"", ")" ]
https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/ui/world.py#L283-L285
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/decimal.py
python
Context.remainder
(self, a, b)
Returns the remainder from integer division. The result is the residue of the dividend after the operation of calculating integer division as described for divide-integer, rounded to precision digits if necessary. The sign of the result, if non-zero, is the same as that of the original...
Returns the remainder from integer division.
[ "Returns", "the", "remainder", "from", "integer", "division", "." ]
def remainder(self, a, b): """Returns the remainder from integer division. The result is the residue of the dividend after the operation of calculating integer division as described for divide-integer, rounded to precision digits if necessary. The sign of the result, if non-zer...
[ "def", "remainder", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "r", "=", "a", ".", "__mod__", "(", "b", ",", "context", "=", "self", ")", "if", "r", "is", "NotImplemented", ...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/decimal.py#L5292-L5328
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/cryptography/hazmat/bindings/openssl/_conditional.py
python
cryptography_has_ed448
()
return [ "EVP_PKEY_ED448", "NID_ED448", ]
[]
def cryptography_has_ed448(): return [ "EVP_PKEY_ED448", "NID_ED448", ]
[ "def", "cryptography_has_ed448", "(", ")", ":", "return", "[", "\"EVP_PKEY_ED448\"", ",", "\"NID_ED448\"", ",", "]" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cryptography/hazmat/bindings/openssl/_conditional.py#L230-L234
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Signature/pss.py
python
PSS_SigScheme.__init__
(self, key, mgfunc, saltLen, randfunc)
Initialize this PKCS#1 PSS signature scheme object. :Parameters: key : an RSA key object If a private half is given, both signature and verification are possible. If a public half is given, only verification is possible. mgfunc : callable A ma...
Initialize this PKCS#1 PSS signature scheme object.
[ "Initialize", "this", "PKCS#1", "PSS", "signature", "scheme", "object", "." ]
def __init__(self, key, mgfunc, saltLen, randfunc): """Initialize this PKCS#1 PSS signature scheme object. :Parameters: key : an RSA key object If a private half is given, both signature and verification are possible. If a public half is given, only verific...
[ "def", "__init__", "(", "self", ",", "key", ",", "mgfunc", ",", "saltLen", ",", "randfunc", ")", ":", "self", ".", "_key", "=", "key", "self", ".", "_saltLen", "=", "saltLen", "self", ".", "_mgfunc", "=", "mgfunc", "self", ".", "_randfunc", "=", "ran...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Signature/pss.py#L47-L68
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/bs4/builder/__init__.py
python
TreeBuilder.prepare_markup
(self, markup, user_specified_encoding=None, document_declared_encoding=None, exclude_encodings=None)
Run any preliminary steps necessary to make incoming markup acceptable to the parser. :param markup: Some markup -- probably a bytestring. :param user_specified_encoding: The user asked to try this encoding. :param document_declared_encoding: The markup itself claims to be i...
Run any preliminary steps necessary to make incoming markup acceptable to the parser.
[ "Run", "any", "preliminary", "steps", "necessary", "to", "make", "incoming", "markup", "acceptable", "to", "the", "parser", "." ]
def prepare_markup(self, markup, user_specified_encoding=None, document_declared_encoding=None, exclude_encodings=None): """Run any preliminary steps necessary to make incoming markup acceptable to the parser. :param markup: Some markup -- probably a bytestring. :...
[ "def", "prepare_markup", "(", "self", ",", "markup", ",", "user_specified_encoding", "=", "None", ",", "document_declared_encoding", "=", "None", ",", "exclude_encodings", "=", "None", ")", ":", "yield", "markup", ",", "None", ",", "None", ",", "False" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/bs4/builder/__init__.py#L229-L255
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gen/proxy/proxybase.py
python
ProxyDbBase.get_person_handles
(self, sort_handles=False, locale=glocale)
Return a list of database handles, one handle for each Person in the database. If sort_handles is True, the list is sorted by surnames
Return a list of database handles, one handle for each Person in the database. If sort_handles is True, the list is sorted by surnames
[ "Return", "a", "list", "of", "database", "handles", "one", "handle", "for", "each", "Person", "in", "the", "database", ".", "If", "sort_handles", "is", "True", "the", "list", "is", "sorted", "by", "surnames" ]
def get_person_handles(self, sort_handles=False, locale=glocale): """ Return a list of database handles, one handle for each Person in the database. If sort_handles is True, the list is sorted by surnames """ if (self.db is not None) and self.db.is_open(): proxied = s...
[ "def", "get_person_handles", "(", "self", ",", "sort_handles", "=", "False", ",", "locale", "=", "glocale", ")", ":", "if", "(", "self", ".", "db", "is", "not", "None", ")", "and", "self", ".", "db", ".", "is_open", "(", ")", ":", "proxied", "=", "...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/proxy/proxybase.py#L203-L214
jaychsu/algorithm
87dac5456b74a515dd97507ac68e9b8588066a04
leetcode/643_maximum_average_subarray_i.py
python
Solution.findMaxAverage
(self, nums, k)
return max_sum / float(k)
:type nums: List[int] :type k: int :rtype: float
:type nums: List[int] :type k: int :rtype: float
[ ":", "type", "nums", ":", "List", "[", "int", "]", ":", "type", "k", ":", "int", ":", "rtype", ":", "float" ]
def findMaxAverage(self, nums, k): """ :type nums: List[int] :type k: int :rtype: float """ """ Assuming k = 3 i: 0 1 2 3 |--> Start to find max sum |--> Start to remove past child """ max_sum, tmp_sum = float(...
[ "def", "findMaxAverage", "(", "self", ",", "nums", ",", "k", ")", ":", "\"\"\"\n Assuming k = 3\n i: 0 1 2 3\n |--> Start to find max sum\n |--> Start to remove past child\n \"\"\"", "max_sum", ",", "tmp_sum", "=", "float", "(", "'-i...
https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/leetcode/643_maximum_average_subarray_i.py#L27-L46
jackschultz/jbc
dbea920d49f9bcff1fa21be6b425ca88e46490e9
chain.py
python
Chain.self_save
(self)
return True
We want to save this in the file system as we do.
We want to save this in the file system as we do.
[ "We", "want", "to", "save", "this", "in", "the", "file", "system", "as", "we", "do", "." ]
def self_save(self): ''' We want to save this in the file system as we do. ''' for b in self.blocks: b.self_save() return True
[ "def", "self_save", "(", "self", ")", ":", "for", "b", "in", "self", ".", "blocks", ":", "b", ".", "self_save", "(", ")", "return", "True" ]
https://github.com/jackschultz/jbc/blob/dbea920d49f9bcff1fa21be6b425ca88e46490e9/chain.py#L31-L37
Alfanous-team/alfanous
594514729473c24efa3908e3107b45a38255de4b
src/alfanous/Support/whoosh/fields.py
python
FieldType.clean
(self)
Clears any cached information in the field and any child objects.
Clears any cached information in the field and any child objects.
[ "Clears", "any", "cached", "information", "in", "the", "field", "and", "any", "child", "objects", "." ]
def clean(self): """Clears any cached information in the field and any child objects. """ if self.format and hasattr(self.format, "clean"): self.format.clean() if self.vector and hasattr(self.vector, "clean"): self.vector.clean()
[ "def", "clean", "(", "self", ")", ":", "if", "self", ".", "format", "and", "hasattr", "(", "self", ".", "format", ",", "\"clean\"", ")", ":", "self", ".", "format", ".", "clean", "(", ")", "if", "self", ".", "vector", "and", "hasattr", "(", "self",...
https://github.com/Alfanous-team/alfanous/blob/594514729473c24efa3908e3107b45a38255de4b/src/alfanous/Support/whoosh/fields.py#L94-L101
redhat-cop/casl-ansible
51ad6830df8657f4839a04cb7be3a65364c6cb8b
inventory/sample.gcp.example.com.d/inventory/gce.py
python
GceInventory.parse_env_zones
(self)
return [z for z in zones[0]]
returns a list of comma separated zones parsed from the GCE_ZONE environment variable. If provided, this will be used to filter the results of the grouped_instances call
returns a list of comma separated zones parsed from the GCE_ZONE environment variable. If provided, this will be used to filter the results of the grouped_instances call
[ "returns", "a", "list", "of", "comma", "separated", "zones", "parsed", "from", "the", "GCE_ZONE", "environment", "variable", ".", "If", "provided", "this", "will", "be", "used", "to", "filter", "the", "results", "of", "the", "grouped_instances", "call" ]
def parse_env_zones(self): '''returns a list of comma separated zones parsed from the GCE_ZONE environment variable. If provided, this will be used to filter the results of the grouped_instances call''' import csv reader = csv.reader([os.environ.get('GCE_ZONE', "")], skipinitialspace=Tru...
[ "def", "parse_env_zones", "(", "self", ")", ":", "import", "csv", "reader", "=", "csv", ".", "reader", "(", "[", "os", ".", "environ", ".", "get", "(", "'GCE_ZONE'", ",", "\"\"", ")", "]", ",", "skipinitialspace", "=", "True", ")", "zones", "=", "[",...
https://github.com/redhat-cop/casl-ansible/blob/51ad6830df8657f4839a04cb7be3a65364c6cb8b/inventory/sample.gcp.example.com.d/inventory/gce.py#L324-L330
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
gluon/gluoncv2/models/sepreresnet.py
python
sepreresnetbc26b
(**kwargs)
return get_sepreresnet(blocks=26, bottleneck=True, conv1_stride=False, model_name="sepreresnetbc26b", **kwargs)
SE-PreResNet-BC-26b model from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. ...
SE-PreResNet-BC-26b model from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507.
[ "SE", "-", "PreResNet", "-", "BC", "-", "26b", "model", "from", "Squeeze", "-", "and", "-", "Excitation", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1709", ".", "01507", "." ]
def sepreresnetbc26b(**kwargs): """ SE-PreResNet-BC-26b model from 'Squeeze-and-Excitation Networks,' https://arxiv.org/abs/1709.01507. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The contex...
[ "def", "sepreresnetbc26b", "(", "*", "*", "kwargs", ")", ":", "return", "get_sepreresnet", "(", "blocks", "=", "26", ",", "bottleneck", "=", "True", ",", "conv1_stride", "=", "False", ",", "model_name", "=", "\"sepreresnetbc26b\"", ",", "*", "*", "kwargs", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/gluoncv2/models/sepreresnet.py#L351-L364
pyqteval/evlal_win
ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92
Clicked_Controller/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.items
(self)
return [(key, self[key]) for key in self]
od.items() -> list of (key, value) pairs in od
od.items() -> list of (key, value) pairs in od
[ "od", ".", "items", "()", "-", ">", "list", "of", "(", "key", "value", ")", "pairs", "in", "od" ]
def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self]
[ "def", "items", "(", "self", ")", ":", "return", "[", "(", "key", ",", "self", "[", "key", "]", ")", "for", "key", "in", "self", "]" ]
https://github.com/pyqteval/evlal_win/blob/ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92/Clicked_Controller/requests/packages/urllib3/packages/ordered_dict.py#L124-L126
pyGrowler/Growler
5492466d8828115bb04c665917d6aeb4f4323f44
growler/routing.py
python
MiddlewareChain.first
(self)
return self.mw_list[0]
Returns first element in list. Returns: MiddlewareNode: The first middleware in the chain. Raises: IndexError: If the chain is empty
Returns first element in list.
[ "Returns", "first", "element", "in", "list", "." ]
def first(self): """ Returns first element in list. Returns: MiddlewareNode: The first middleware in the chain. Raises: IndexError: If the chain is empty """ return self.mw_list[0]
[ "def", "first", "(", "self", ")", ":", "return", "self", ".", "mw_list", "[", "0", "]" ]
https://github.com/pyGrowler/Growler/blob/5492466d8828115bb04c665917d6aeb4f4323f44/growler/routing.py#L339-L349
davidfoerster/aptsources-cleanup
8ea6b410be2aa7c6fa9382ae25137be71639443d
src/aptsources_cleanup/util/itertools.py
python
_pairs_helper
(iterable, n, *, _mapper=lambda i, it: islice(it, i, None) if i else it )
return map(_mapper, count(), tee(iterable, n))
[]
def _pairs_helper(iterable, n, *, _mapper=lambda i, it: islice(it, i, None) if i else it ): return map(_mapper, count(), tee(iterable, n))
[ "def", "_pairs_helper", "(", "iterable", ",", "n", ",", "*", ",", "_mapper", "=", "lambda", "i", ",", "it", ":", "islice", "(", "it", ",", "i", ",", "None", ")", "if", "i", "else", "it", ")", ":", "return", "map", "(", "_mapper", ",", "count", ...
https://github.com/davidfoerster/aptsources-cleanup/blob/8ea6b410be2aa7c6fa9382ae25137be71639443d/src/aptsources_cleanup/util/itertools.py#L63-L66
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/xmlrpc/server.py
python
SimpleXMLRPCRequestHandler.is_rpc_path_valid
(self)
[]
def is_rpc_path_valid(self): if self.rpc_paths: return self.path in self.rpc_paths else: # If .rpc_paths is empty, just assume all paths are legal return True
[ "def", "is_rpc_path_valid", "(", "self", ")", ":", "if", "self", ".", "rpc_paths", ":", "return", "self", ".", "path", "in", "self", ".", "rpc_paths", "else", ":", "# If .rpc_paths is empty, just assume all paths are legal", "return", "True" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xmlrpc/server.py#L448-L453
Bitmessage/PyBitmessage
97612b049e0453867d6d90aa628f8e7b007b4d85
src/network/announcethread.py
python
AnnounceThread.announceSelf
()
Announce our presence
Announce our presence
[ "Announce", "our", "presence" ]
def announceSelf(): """Announce our presence""" for connection in BMConnectionPool().udpSockets.values(): if not connection.announcing: continue for stream in state.streamsInWhichIAmParticipating: addr = ( stream, ...
[ "def", "announceSelf", "(", ")", ":", "for", "connection", "in", "BMConnectionPool", "(", ")", ".", "udpSockets", ".", "values", "(", ")", ":", "if", "not", "connection", ".", "announcing", ":", "continue", "for", "stream", "in", "state", ".", "streamsInWh...
https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/network/announcethread.py#L30-L43
mozman/ezdxf
59d0fc2ea63f5cf82293428f5931da7e9f9718e9
src/ezdxf/render/arrows.py
python
_Arrows.render_arrow
( self, layout: "GenericLayoutType", name: str, insert: Vertex = NULLVEC, size: float = 1.0, rotation: float = 0, *, dxfattribs = None )
return connection_point( name, insert=insert, scale=size, rotation=rotation )
Render arrow as basic DXF entities into `layout`.
Render arrow as basic DXF entities into `layout`.
[ "Render", "arrow", "as", "basic", "DXF", "entities", "into", "layout", "." ]
def render_arrow( self, layout: "GenericLayoutType", name: str, insert: Vertex = NULLVEC, size: float = 1.0, rotation: float = 0, *, dxfattribs = None ) -> Vec2: """Render arrow as basic DXF entities into `layout`.""" dxfattribs = dict(...
[ "def", "render_arrow", "(", "self", ",", "layout", ":", "\"GenericLayoutType\"", ",", "name", ":", "str", ",", "insert", ":", "Vertex", "=", "NULLVEC", ",", "size", ":", "float", "=", "1.0", ",", "rotation", ":", "float", "=", "0", ",", "*", ",", "dx...
https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/render/arrows.py#L544-L560
makelinux/linux_kernel_map
d65d7f3ded60100b1e5b1d5361f198b50da31e77
srcxray.py
python
call_tree
(node, printed=None, level=0)
prints call tree of a function Ex: start_kernel Obsoleted by doxygen_xml.
prints call tree of a function Ex: start_kernel Obsoleted by doxygen_xml.
[ "prints", "call", "tree", "of", "a", "function", "Ex", ":", "start_kernel", "Obsoleted", "by", "doxygen_xml", "." ]
def call_tree(node, printed=None, level=0): ''' prints call tree of a function Ex: start_kernel Obsoleted by doxygen_xml. ''' if not os.path.isfile('cscope.out'): print("Please run: cscope -Rcbk", file=sys.stderr) return False if printed is None: printed = set() i...
[ "def", "call_tree", "(", "node", ",", "printed", "=", "None", ",", "level", "=", "0", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "'cscope.out'", ")", ":", "print", "(", "\"Please run: cscope -Rcbk\"", ",", "file", "=", "sys", ".", ...
https://github.com/makelinux/linux_kernel_map/blob/d65d7f3ded60100b1e5b1d5361f198b50da31e77/srcxray.py#L276-L316
mediacloud/backend
d36b489e4fbe6e44950916a04d9543a1d6cd5df0
apps/common/src/python/mediawords/util/config/common.py
python
RabbitMQConfig.hostname
(self)
return self.__hostname
Hostname.
Hostname.
[ "Hostname", "." ]
def hostname(self) -> str: """Hostname.""" return self.__hostname
[ "def", "hostname", "(", "self", ")", "->", "str", ":", "return", "self", ".", "__hostname" ]
https://github.com/mediacloud/backend/blob/d36b489e4fbe6e44950916a04d9543a1d6cd5df0/apps/common/src/python/mediawords/util/config/common.py#L230-L232
KoreLogicSecurity/mastiff
04d569e4fa59513572e77c74b049cad82f9b0310
mastiff/core.py
python
Mastiff.activate_plugins
(self, single_plugin=None)
Activate all plugins that are in the categories we selected. If single_plugin is given, only activate that plug-in. Note: File Information plug-in is ALWAYS run.
Activate all plugins that are in the categories we selected. If single_plugin is given, only activate that plug-in. Note: File Information plug-in is ALWAYS run.
[ "Activate", "all", "plugins", "that", "are", "in", "the", "categories", "we", "selected", ".", "If", "single_plugin", "is", "given", "only", "activate", "that", "plug", "-", "in", ".", "Note", ":", "File", "Information", "plug", "-", "in", "is", "ALWAYS", ...
def activate_plugins(self, single_plugin=None): """ Activate all plugins that are in the categories we selected. If single_plugin is given, only activate that plug-in. Note: File Information plug-in is ALWAYS run. """ has_prereq = list() for cats in sel...
[ "def", "activate_plugins", "(", "self", ",", "single_plugin", "=", "None", ")", ":", "has_prereq", "=", "list", "(", ")", "for", "cats", "in", "self", ".", "cat_list", ":", "log", "=", "logging", ".", "getLogger", "(", "'Mastiff.Plugins.Activate'", ")", "l...
https://github.com/KoreLogicSecurity/mastiff/blob/04d569e4fa59513572e77c74b049cad82f9b0310/mastiff/core.py#L316-L380
httpie/httpie
4c56d894ba9e2bb1c097a3a6067006843ac2944d
httpie/plugins/builtin.py
python
HTTPBearerAuth.__call__
(self, request: requests.PreparedRequest)
return request
[]
def __call__(self, request: requests.PreparedRequest) -> requests.PreparedRequest: request.headers['Authorization'] = f'Bearer {self.token}' return request
[ "def", "__call__", "(", "self", ",", "request", ":", "requests", ".", "PreparedRequest", ")", "->", "requests", ".", "PreparedRequest", ":", "request", ".", "headers", "[", "'Authorization'", "]", "=", "f'Bearer {self.token}'", "return", "request" ]
https://github.com/httpie/httpie/blob/4c56d894ba9e2bb1c097a3a6067006843ac2944d/httpie/plugins/builtin.py#L42-L44
eBay/bayesian-belief-networks
23c3e3ce1c7f99d83efb79f9b7798af2a1537e1c
bayesian/utils.py
python
shrink_matrix
(x)
return x
Remove Nulls
Remove Nulls
[ "Remove", "Nulls" ]
def shrink_matrix(x): '''Remove Nulls''' while True: if len([x for x in m[0] if x is None]) == x.cols: x.pop() x = x.tr() continue return x
[ "def", "shrink_matrix", "(", "x", ")", ":", "while", "True", ":", "if", "len", "(", "[", "x", "for", "x", "in", "m", "[", "0", "]", "if", "x", "is", "None", "]", ")", "==", "x", ".", "cols", ":", "x", ".", "pop", "(", ")", "x", "=", "x", ...
https://github.com/eBay/bayesian-belief-networks/blob/23c3e3ce1c7f99d83efb79f9b7798af2a1537e1c/bayesian/utils.py#L68-L75
onionshare/onionshare
4ab5e0003c83853476ae68b06ba936c8792dc362
desktop/src/onionshare/tab/mode/__init__.py
python
Mode.human_friendly_time
(self, secs)
return result
Returns a human-friendly time delta from given seconds.
Returns a human-friendly time delta from given seconds.
[ "Returns", "a", "human", "-", "friendly", "time", "delta", "from", "given", "seconds", "." ]
def human_friendly_time(self, secs): """ Returns a human-friendly time delta from given seconds. """ days = secs // 86400 hours = (secs - days * 86400) // 3600 minutes = (secs - days * 86400 - hours * 3600) // 60 seconds = secs - days * 86400 - hours * 3600 - minu...
[ "def", "human_friendly_time", "(", "self", ",", "secs", ")", ":", "days", "=", "secs", "//", "86400", "hours", "=", "(", "secs", "-", "days", "*", "86400", ")", "//", "3600", "minutes", "=", "(", "secs", "-", "days", "*", "86400", "-", "hours", "*"...
https://github.com/onionshare/onionshare/blob/4ab5e0003c83853476ae68b06ba936c8792dc362/desktop/src/onionshare/tab/mode/__init__.py#L148-L165
pyqtgraph/pyqtgraph
ac3887abfca4e529aac44f022f8e40556a2587b0
pyqtgraph/functions.py
python
interpolateArray
(data, x, default=0.0, order=1)
return result
N-dimensional interpolation similar to scipy.ndimage.map_coordinates. This function returns linearly-interpolated values sampled from a regular grid of data. It differs from `ndimage.map_coordinates` by allowing broadcasting within the input array. ============== =============================...
N-dimensional interpolation similar to scipy.ndimage.map_coordinates. This function returns linearly-interpolated values sampled from a regular grid of data. It differs from `ndimage.map_coordinates` by allowing broadcasting within the input array. ============== =============================...
[ "N", "-", "dimensional", "interpolation", "similar", "to", "scipy", ".", "ndimage", ".", "map_coordinates", ".", "This", "function", "returns", "linearly", "-", "interpolated", "values", "sampled", "from", "a", "regular", "grid", "of", "data", ".", "It", "diff...
def interpolateArray(data, x, default=0.0, order=1): """ N-dimensional interpolation similar to scipy.ndimage.map_coordinates. This function returns linearly-interpolated values sampled from a regular grid of data. It differs from `ndimage.map_coordinates` by allowing broadcasting within the in...
[ "def", "interpolateArray", "(", "data", ",", "x", ",", "default", "=", "0.0", ",", "order", "=", "1", ")", ":", "if", "order", "not", "in", "(", "0", ",", "1", ")", ":", "raise", "ValueError", "(", "\"interpolateArray requires order=0 or 1 (got %s)\"", "%"...
https://github.com/pyqtgraph/pyqtgraph/blob/ac3887abfca4e529aac44f022f8e40556a2587b0/pyqtgraph/functions.py#L884-L1015
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/_interface.py
python
switch_t.handler
(self, ea)
return tuple(case for case in self.range if self.case(case) == ea)
Return all the cases that are handled by the address `ea` as a tuple.
Return all the cases that are handled by the address `ea` as a tuple.
[ "Return", "all", "the", "cases", "that", "are", "handled", "by", "the", "address", "ea", "as", "a", "tuple", "." ]
def handler(self, ea): '''Return all the cases that are handled by the address `ea` as a tuple.''' return tuple(case for case in self.range if self.case(case) == ea)
[ "def", "handler", "(", "self", ",", "ea", ")", ":", "return", "tuple", "(", "case", "for", "case", "in", "self", ".", "range", "if", "self", ".", "case", "(", "case", ")", "==", "ea", ")" ]
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/_interface.py#L1836-L1838
bookwyrm-social/bookwyrm
0c2537e27a2cdbc0136880dfbbf170d5fec72986
bookwyrm/templatetags/bookwyrm_tags.py
python
related_status
(notification)
return load_subclass(notification.related_status)
for notifications
for notifications
[ "for", "notifications" ]
def related_status(notification): """for notifications""" if not notification.related_status: return None return load_subclass(notification.related_status)
[ "def", "related_status", "(", "notification", ")", ":", "if", "not", "notification", ".", "related_status", ":", "return", "None", "return", "load_subclass", "(", "notification", ".", "related_status", ")" ]
https://github.com/bookwyrm-social/bookwyrm/blob/0c2537e27a2cdbc0136880dfbbf170d5fec72986/bookwyrm/templatetags/bookwyrm_tags.py#L124-L128
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_attached_volume.py
python
V1AttachedVolume.to_str
(self)
return pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_attached_volume.py#L122-L126
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractSotranslations.py
python
extractSotranslations
(item)
return False
# Supreme Origin Translations
# Supreme Origin Translations
[ "#", "Supreme", "Origin", "Translations" ]
def extractSotranslations(item): """ # Supreme Origin Translations """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'hachi-nan chapter' in item['title'].lower() and not 'draft' in item['title'].lower(): ret...
[ "def", "extractSotranslations", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "'preview'", "in", "it...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractSotranslations.py#L1-L13
opendatacube/datacube-core
b062184be61c140a168de94510bc3661748f112e
datacube/index/_datasets.py
python
DatasetResource.search_eager
(self, **query)
return list(self.search(**query))
Perform a search, returning results as Dataset objects. :param dict[str,str|float|datacube.model.Range] query: :rtype: list[Dataset]
Perform a search, returning results as Dataset objects.
[ "Perform", "a", "search", "returning", "results", "as", "Dataset", "objects", "." ]
def search_eager(self, **query): """ Perform a search, returning results as Dataset objects. :param dict[str,str|float|datacube.model.Range] query: :rtype: list[Dataset] """ return list(self.search(**query))
[ "def", "search_eager", "(", "self", ",", "*", "*", "query", ")", ":", "return", "list", "(", "self", ".", "search", "(", "*", "*", "query", ")", ")" ]
https://github.com/opendatacube/datacube-core/blob/b062184be61c140a168de94510bc3661748f112e/datacube/index/_datasets.py#L742-L749
vyos/vyos-1x
6e8a8934a7d4e1b21d7c828e372303683b499b56
src/helpers/strip-private.py
python
strip_address
(line: str)
return ipv4_re.sub(lambda match: ip_match(match, ipv4_subst), ipv6_re.sub(lambda match: ip_match(match, ipv6_subst), line))
Strip IPv4 and IPv6 addresses from the given string.
Strip IPv4 and IPv6 addresses from the given string.
[ "Strip", "IPv4", "and", "IPv6", "addresses", "from", "the", "given", "string", "." ]
def strip_address(line: str) -> str: """ Strip IPv4 and IPv6 addresses from the given string. """ return ipv4_re.sub(lambda match: ip_match(match, ipv4_subst), ipv6_re.sub(lambda match: ip_match(match, ipv6_subst), line))
[ "def", "strip_address", "(", "line", ":", "str", ")", "->", "str", ":", "return", "ipv4_re", ".", "sub", "(", "lambda", "match", ":", "ip_match", "(", "match", ",", "ipv4_subst", ")", ",", "ipv6_re", ".", "sub", "(", "lambda", "match", ":", "ip_match",...
https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/src/helpers/strip-private.py#L72-L76
tijme/angularjs-csti-scanner
dcf5bf3d36a0a6ee3a9db1340e68de95b33e4615
extended.py
python
require_arguments
()
return parser.parse_args()
Get the arguments from CLI input. Returns: :class:`argparse.Namespace`: A namespace with all the parsed CLI arguments.
Get the arguments from CLI input.
[ "Get", "the", "arguments", "from", "CLI", "input", "." ]
def require_arguments(): """Get the arguments from CLI input. Returns: :class:`argparse.Namespace`: A namespace with all the parsed CLI arguments. """ parser = argparse.ArgumentParser( prog=PackageHelper.get_alias(), formatter_class=lambda prog: argparse.HelpFormatter(prog, ma...
[ "def", "require_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "PackageHelper", ".", "get_alias", "(", ")", ",", "formatter_class", "=", "lambda", "prog", ":", "argparse", ".", "HelpFormatter", "(", "prog", ","...
https://github.com/tijme/angularjs-csti-scanner/blob/dcf5bf3d36a0a6ee3a9db1340e68de95b33e4615/extended.py#L64-L97
OpenKMIP/PyKMIP
c0c980395660ea1b1a8009e97f17ab32d1100233
kmip/core/messages/payloads/archive.py
python
ArchiveRequestPayload.__init__
(self, unique_identifier=None)
Construct an Archive request payload struct. Args: unique_identifier (string): The ID of the managed object (e.g., a public key) to archive. Optional, defaults to None.
Construct an Archive request payload struct.
[ "Construct", "an", "Archive", "request", "payload", "struct", "." ]
def __init__(self, unique_identifier=None): """ Construct an Archive request payload struct. Args: unique_identifier (string): The ID of the managed object (e.g., a public key) to archive. Optional, defaults to None. """ super(ArchiveRequestPayload, s...
[ "def", "__init__", "(", "self", ",", "unique_identifier", "=", "None", ")", ":", "super", "(", "ArchiveRequestPayload", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_unique_identifier", "=", "None", "self", ".", "unique_identifier", "=", "uniqu...
https://github.com/OpenKMIP/PyKMIP/blob/c0c980395660ea1b1a8009e97f17ab32d1100233/kmip/core/messages/payloads/archive.py#L32-L43
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/chdfs/v20201112/models.py
python
DeleteFileSystemResponse.__init__
(self)
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/chdfs/v20201112/models.py#L604-L609
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/_internal/antlr3/tree.py
python
TreeAdaptor.deleteChild
(self, t, i)
Remove ith child and shift children down from right.
Remove ith child and shift children down from right.
[ "Remove", "ith", "child", "and", "shift", "children", "down", "from", "right", "." ]
def deleteChild(self, t, i): """Remove ith child and shift children down from right.""" raise NotImplementedError
[ "def", "deleteChild", "(", "self", ",", "t", ",", "i", ")", ":", "raise", "NotImplementedError" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/_internal/antlr3/tree.py#L507-L510
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/integrations.py
python
WandbCallback.on_train_begin
(self, args, state, control, model=None, **kwargs)
[]
def on_train_begin(self, args, state, control, model=None, **kwargs): if self._wandb is None: return hp_search = state.is_hyper_param_search if hp_search: self._wandb.finish() self._initialized = False if not self._initialized: self.setup(a...
[ "def", "on_train_begin", "(", "self", ",", "args", ",", "state", ",", "control", ",", "model", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_wandb", "is", "None", ":", "return", "hp_search", "=", "state", ".", "is_hyper_param_sea...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/integrations.py#L538-L546
Billwilliams1952/PiCameraApp
61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0
Source/PreferencesDialog.py
python
Interface.ShowTooltipsChecked
( self )
[]
def ShowTooltipsChecked ( self ): ToolTip.ShowToolTips = self.ShowTooltips.get()
[ "def", "ShowTooltipsChecked", "(", "self", ")", ":", "ToolTip", ".", "ShowToolTips", "=", "self", ".", "ShowTooltips", ".", "get", "(", ")" ]
https://github.com/Billwilliams1952/PiCameraApp/blob/61802b367d620aafb6b4e0bb84ea1ebd0dbd42c0/Source/PreferencesDialog.py#L351-L352
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py
python
Table.read_coordinates
(self, where=None, start=None, stop=None, **kwargs)
return Index(coords)
select coordinates (row numbers) from a table; return the coordinates object
select coordinates (row numbers) from a table; return the coordinates object
[ "select", "coordinates", "(", "row", "numbers", ")", "from", "a", "table", ";", "return", "the", "coordinates", "object" ]
def read_coordinates(self, where=None, start=None, stop=None, **kwargs): """select coordinates (row numbers) from a table; return the coordinates object """ # validate the version self.validate_version(where) # infer the data kind if not self.infer_axes(): ...
[ "def", "read_coordinates", "(", "self", ",", "where", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# validate the version", "self", ".", "validate_version", "(", "where", ")", "# infer the data kind", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/io/pytables.py#L3791-L3814
criteo/biggraphite
1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30
biggraphite/drivers/cassandra.py
python
_CassandraAccessor.create_metric
(self, metric)
See bg_accessor.Accessor.
See bg_accessor.Accessor.
[ "See", "bg_accessor", ".", "Accessor", "." ]
def create_metric(self, metric): """See bg_accessor.Accessor.""" super(_CassandraAccessor, self).create_metric(metric) if self.__bulkimport: return components = self._components_from_name(metric.name) assert metric.id is not None and metric.metadata is not None ...
[ "def", "create_metric", "(", "self", ",", "metric", ")", ":", "super", "(", "_CassandraAccessor", ",", "self", ")", ".", "create_metric", "(", "metric", ")", "if", "self", ".", "__bulkimport", ":", "return", "components", "=", "self", ".", "_components_from_...
https://github.com/criteo/biggraphite/blob/1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30/biggraphite/drivers/cassandra.py#L1706-L1744
MeanEYE/Sunflower
1024bbdde3b8e202ddad3553b321a7b6230bffc9
sunflower/gui/main_window.py
python
MainWindow._toggle_media_preview
(self, widget, data=None)
return True
Enable/disable fast image preview
Enable/disable fast image preview
[ "Enable", "/", "disable", "fast", "image", "preview" ]
def _toggle_media_preview(self, widget, data=None): """Enable/disable fast image preview""" if not isinstance(widget, Gio.SimpleAction): action = self.lookup_action('view.fast_media_preview') else: action = widget state = not action.get_state() action.set_state(GLib.Variant.new_boolean(state)) self.o...
[ "def", "_toggle_media_preview", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "if", "not", "isinstance", "(", "widget", ",", "Gio", ".", "SimpleAction", ")", ":", "action", "=", "self", ".", "lookup_action", "(", "'view.fast_media_preview'"...
https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/gui/main_window.py#L795-L820
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/deberta/modeling_tf_deberta.py
python
TFDebertaEncoder.call
( self, hidden_states: tf.Tensor, attention_mask: tf.Tensor, query_states: tf.Tensor = None, relative_pos: tf.Tensor = None, output_attentions: bool = False, output_hidden_states: bool = False, return_dict: bool = True, training: bool = False, ...
return TFBaseModelOutput( last_hidden_state=hidden_states, hidden_states=all_hidden_states, attentions=all_attentions )
[]
def call( self, hidden_states: tf.Tensor, attention_mask: tf.Tensor, query_states: tf.Tensor = None, relative_pos: tf.Tensor = None, output_attentions: bool = False, output_hidden_states: bool = False, return_dict: bool = True, training: bool = Fal...
[ "def", "call", "(", "self", ",", "hidden_states", ":", "tf", ".", "Tensor", ",", "attention_mask", ":", "tf", ".", "Tensor", ",", "query_states", ":", "tf", ".", "Tensor", "=", "None", ",", "relative_pos", ":", "tf", ".", "Tensor", "=", "None", ",", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/deberta/modeling_tf_deberta.py#L331-L390
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/mpd/media_player.py
python
MpdDevice.media_duration
(self)
return self._currentsong.get("time")
Return the duration of current playing media in seconds.
Return the duration of current playing media in seconds.
[ "Return", "the", "duration", "of", "current", "playing", "media", "in", "seconds", "." ]
def media_duration(self): """Return the duration of current playing media in seconds.""" # Time does not exist for streams return self._currentsong.get("time")
[ "def", "media_duration", "(", "self", ")", ":", "# Time does not exist for streams", "return", "self", ".", "_currentsong", ".", "get", "(", "\"time\"", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mpd/media_player.py#L218-L221
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/encodings/cp1254.py
python
Codec.encode
(self,input,errors='strict')
return codecs.charmap_encode(input,errors,encoding_table)
[]
def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table)
[ "def", "encode", "(", "self", ",", "input", ",", "errors", "=", "'strict'", ")", ":", "return", "codecs", ".", "charmap_encode", "(", "input", ",", "errors", ",", "encoding_table", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/encodings/cp1254.py#L11-L12
timvieira/arsenal
3a626722f46fd7ef6768abfdffc0eb28cae7dfa2
arsenal/iterview.py
python
time_elapsed
(elapsed)
return '%02d:%02d:%02d' % (hours, minutes, seconds)
Returns a string indicating the time elapsed.
Returns a string indicating the time elapsed.
[ "Returns", "a", "string", "indicating", "the", "time", "elapsed", "." ]
def time_elapsed(elapsed): """ Returns a string indicating the time elapsed. """ seconds = int(elapsed) # if complete, total time elapsed minutes, seconds = divmod(seconds, 60) hours, minutes = divmod(minutes, 60) return '%02d:%02d:%02d' % (hours, minutes, seconds)
[ "def", "time_elapsed", "(", "elapsed", ")", ":", "seconds", "=", "int", "(", "elapsed", ")", "# if complete, total time elapsed", "minutes", ",", "seconds", "=", "divmod", "(", "seconds", ",", "60", ")", "hours", ",", "minutes", "=", "divmod", "(", "minutes"...
https://github.com/timvieira/arsenal/blob/3a626722f46fd7ef6768abfdffc0eb28cae7dfa2/arsenal/iterview.py#L63-L72
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/transport/inbound/manager.py
python
InboundTransportManager.create_session
( self, transport_type: str, *, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: BaseWireFormat = None, )
return session
Create a new inbound session. Args: transport_type: The inbound transport identifier accept_undelivered: Flag for accepting undelivered messages can_respond: Flag indicating that the transport can send responses client_info: An optional dict describing the client...
Create a new inbound session.
[ "Create", "a", "new", "inbound", "session", "." ]
async def create_session( self, transport_type: str, *, accept_undelivered: bool = False, can_respond: bool = False, client_info: dict = None, wire_format: BaseWireFormat = None, ): """ Create a new inbound session. Args: t...
[ "async", "def", "create_session", "(", "self", ",", "transport_type", ":", "str", ",", "*", ",", "accept_undelivered", ":", "bool", "=", "False", ",", "can_respond", ":", "bool", "=", "False", ",", "client_info", ":", "dict", "=", "None", ",", "wire_format...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/transport/inbound/manager.py#L147-L182
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_http_get_action.py
python
V1HTTPGetAction.port
(self, port)
Sets the port of this V1HTTPGetAction. Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. :param port: The port of this V1HTTPGetAction. :type: str
Sets the port of this V1HTTPGetAction. Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
[ "Sets", "the", "port", "of", "this", "V1HTTPGetAction", ".", "Name", "or", "number", "of", "the", "port", "to", "access", "on", "the", "container", ".", "Number", "must", "be", "in", "the", "range", "1", "to", "65535", ".", "Name", "must", "be", "an", ...
def port(self, port): """ Sets the port of this V1HTTPGetAction. Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. :param port: The port of this V1HTTPGetAction. :type: str """ if port is...
[ "def", "port", "(", "self", ",", "port", ")", ":", "if", "port", "is", "None", ":", "raise", "ValueError", "(", "\"Invalid value for `port`, must not be `None`\"", ")", "self", ".", "_port", "=", "port" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_http_get_action.py#L136-L147
ralphm/wokkel
76edbf80f0d314e314e2d4d1510c6e5438a538f7
wokkel/iwokkel.py
python
IPubSubService.getConfigurationOptions
()
Retrieve all known node configuration options. The returned dictionary holds the possible node configuration options by option name. The value of each entry represents the specifics for that option in a dictionary: - C{'type'} (C{str}): The option's type (see L{Field<wokkel...
Retrieve all known node configuration options.
[ "Retrieve", "all", "known", "node", "configuration", "options", "." ]
def getConfigurationOptions(): """ Retrieve all known node configuration options. The returned dictionary holds the possible node configuration options by option name. The value of each entry represents the specifics for that option in a dictionary: - C{'type'} (C{str}...
[ "def", "getConfigurationOptions", "(", ")", ":" ]
https://github.com/ralphm/wokkel/blob/76edbf80f0d314e314e2d4d1510c6e5438a538f7/wokkel/iwokkel.py#L317-L350
glutanimate/cloze-overlapper
9eabb6a9d2a6807595478647fd968e8e4bac86fc
src/cloze_overlapper/libaddon/gui/basic/interface.py
python
CommonWidgetInterface.setMinValue
(self, widget, value)
Set lower boundary of widget Arguments: widget {Qt widget} -- Qt widget to update. Supported: QSpinBox, QDoubleSpinBox, QDateEdit value {int,float} -- Number to set lower boundary to. In case of QDateEdit: ...
Set lower boundary of widget Arguments: widget {Qt widget} -- Qt widget to update. Supported: QSpinBox, QDoubleSpinBox, QDateEdit value {int,float} -- Number to set lower boundary to. In case of QDateEdit: ...
[ "Set", "lower", "boundary", "of", "widget", "Arguments", ":", "widget", "{", "Qt", "widget", "}", "--", "Qt", "widget", "to", "update", ".", "Supported", ":", "QSpinBox", "QDoubleSpinBox", "QDateEdit", "value", "{", "int", "float", "}", "--", "Number", "to...
def setMinValue(self, widget, value): """ Set lower boundary of widget Arguments: widget {Qt widget} -- Qt widget to update. Supported: QSpinBox, QDoubleSpinBox, QDateEdit value {int,float} -- Number to set lower boundary to. ...
[ "def", "setMinValue", "(", "self", ",", "widget", ",", "value", ")", ":", "try", ":", "assert", "isinstance", "(", "value", ",", "(", "int", ",", "float", ")", ")", ",", "\"value should be an int or float\"", "except", "AssertionError", "as", "error", ":", ...
https://github.com/glutanimate/cloze-overlapper/blob/9eabb6a9d2a6807595478647fd968e8e4bac86fc/src/cloze_overlapper/libaddon/gui/basic/interface.py#L648-L679
zhaoolee/StarsAndClown
b2d4039cad2f9232b691e5976f787b49a0a2c113
node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
python
VisualStudioVersion.UsesVcxproj
(self)
return self.uses_vcxproj
Returns true if this version uses a vcxproj file.
Returns true if this version uses a vcxproj file.
[ "Returns", "true", "if", "this", "version", "uses", "a", "vcxproj", "file", "." ]
def UsesVcxproj(self): """Returns true if this version uses a vcxproj file.""" return self.uses_vcxproj
[ "def", "UsesVcxproj", "(", "self", ")", ":", "return", "self", ".", "uses_vcxproj" ]
https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py#L50-L52
SUSE/DeepSea
9c7fad93915ba1250c40d50c855011e9fe41ed21
srv/salt/_modules/osd.py
python
OSDGrains._grains
(self, storage)
Load and save grains when changed
Load and save grains when changed
[ "Load", "and", "save", "grains", "when", "changed" ]
def _grains(self, storage): """ Load and save grains when changed """ content = {} if os.path.exists(self.filename): with open(self.filename, 'r') as minion_grains: content = yaml.safe_load(minion_grains) if 'ceph' in content and content['ceph'...
[ "def", "_grains", "(", "self", ",", "storage", ")", ":", "content", "=", "{", "}", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "filename", ")", ":", "with", "open", "(", "self", ".", "filename", ",", "'r'", ")", "as", "minion_grains",...
https://github.com/SUSE/DeepSea/blob/9c7fad93915ba1250c40d50c855011e9fe41ed21/srv/salt/_modules/osd.py#L773-L785
apachecn/AiLearning
228b62a905a2a9bf6066f65c16d53056b10ec610
src/py3.x/ml/8.Regression/regression.py
python
ridgeTest
(xArr, yArr)
return wMat
Desc: 函数 ridgeTest() 用于在一组 λ 上测试结果 Args: xArr: 样本数据的特征,即 feature yArr: 样本数据的类别标签,即真实数据 Returns: wMat: 将所有的回归系数输出到一个矩阵并返回
Desc: 函数 ridgeTest() 用于在一组 λ 上测试结果 Args: xArr: 样本数据的特征,即 feature yArr: 样本数据的类别标签,即真实数据 Returns: wMat: 将所有的回归系数输出到一个矩阵并返回
[ "Desc", ":", "函数", "ridgeTest", "()", "用于在一组", "λ", "上测试结果", "Args", ":", "xArr", ":", "样本数据的特征,即", "feature", "yArr", ":", "样本数据的类别标签,即真实数据", "Returns", ":", "wMat", ":", "将所有的回归系数输出到一个矩阵并返回" ]
def ridgeTest(xArr, yArr): ''' Desc: 函数 ridgeTest() 用于在一组 λ 上测试结果 Args: xArr: 样本数据的特征,即 feature yArr: 样本数据的类别标签,即真实数据 Returns: wMat: 将所有的回归系数输出到一个矩阵并返回 ''' xMat = mat(xArr) yMat = mat(yArr).T # 计算Y的均值 yMean = mean(yMat, ...
[ "def", "ridgeTest", "(", "xArr", ",", "yArr", ")", ":", "xMat", "=", "mat", "(", "xArr", ")", "yMat", "=", "mat", "(", "yArr", ")", ".", "T", "# 计算Y的均值", "yMean", "=", "mean", "(", "yMat", ",", "0", ")", "# Y的所有的特征减去均值", "yMat", "=", "yMat", "-",...
https://github.com/apachecn/AiLearning/blob/228b62a905a2a9bf6066f65c16d53056b10ec610/src/py3.x/ml/8.Regression/regression.py#L202-L233
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_baseprocess.py
python
BaseProcess.processEnded
(self, status)
This is called when the child terminates.
This is called when the child terminates.
[ "This", "is", "called", "when", "the", "child", "terminates", "." ]
def processEnded(self, status): """ This is called when the child terminates. """ self.status = status self.lostProcess += 1 self.pid = None self._callProcessExited(self._getReason(status)) self.maybeCallProcessEnded()
[ "def", "processEnded", "(", "self", ",", "status", ")", ":", "self", ".", "status", "=", "status", "self", ".", "lostProcess", "+=", "1", "self", ".", "pid", "=", "None", "self", ".", "_callProcessExited", "(", "self", ".", "_getReason", "(", "status", ...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/_baseprocess.py#L44-L52
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/pprint.py
python
_safe_tuple
(t)
return _safe_key(t[0]), _safe_key(t[1])
Helper function for comparing 2-tuples
Helper function for comparing 2-tuples
[ "Helper", "function", "for", "comparing", "2", "-", "tuples" ]
def _safe_tuple(t): "Helper function for comparing 2-tuples" return _safe_key(t[0]), _safe_key(t[1])
[ "def", "_safe_tuple", "(", "t", ")", ":", "return", "_safe_key", "(", "t", "[", "0", "]", ")", ",", "_safe_key", "(", "t", "[", "1", "]", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/pprint.py#L102-L104
leuchine/S-LSTM
fd9462efbd7f577d7f89c2bc1d64f6c477416746
sequence_tagging/model/ner_model.py
python
NERModel.add_logits_op
(self)
Defines self.logits For each word in each sentence of the batch, it corresponds to a vector of scores, of dimension equal to the number of tags.
Defines self.logits
[ "Defines", "self", ".", "logits" ]
def add_logits_op(self): """Defines self.logits For each word in each sentence of the batch, it corresponds to a vector of scores, of dimension equal to the number of tags. """ print("Using model: "+self.config.model_type) if self.config.model_type=='slstm': ...
[ "def", "add_logits_op", "(", "self", ")", ":", "print", "(", "\"Using model: \"", "+", "self", ".", "config", ".", "model_type", ")", "if", "self", ".", "config", ".", "model_type", "==", "'slstm'", ":", "self", ".", "create_layers_two_gates", "(", ")", "e...
https://github.com/leuchine/S-LSTM/blob/fd9462efbd7f577d7f89c2bc1d64f6c477416746/sequence_tagging/model/ner_model.py#L442-L452
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pip/pip/_vendor/cachecontrol/heuristics.py
python
BaseHeuristic.update_headers
(self, response)
return {}
Update the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers.
Update the response headers with any new headers.
[ "Update", "the", "response", "headers", "with", "any", "new", "headers", "." ]
def update_headers(self, response): """Update the response headers with any new headers. NOTE: This SHOULD always include some Warning header to signify that the response was cached by the client, not by way of the provided headers. """ return {}
[ "def", "update_headers", "(", "self", ",", "response", ")", ":", "return", "{", "}" ]
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/_vendor/cachecontrol/heuristics.py#L33-L40
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/idlelib/AutoComplete.py
python
AutoComplete.get_entity
(self, name)
return eval(name, namespace)
Lookup name in a namespace spanning sys.modules and __main.dict__
Lookup name in a namespace spanning sys.modules and __main.dict__
[ "Lookup", "name", "in", "a", "namespace", "spanning", "sys", ".", "modules", "and", "__main", ".", "dict__" ]
def get_entity(self, name): """Lookup name in a namespace spanning sys.modules and __main.dict__""" namespace = sys.modules.copy() namespace.update(__main__.__dict__) return eval(name, namespace)
[ "def", "get_entity", "(", "self", ",", "name", ")", ":", "namespace", "=", "sys", ".", "modules", ".", "copy", "(", ")", "namespace", ".", "update", "(", "__main__", ".", "__dict__", ")", "return", "eval", "(", "name", ",", "namespace", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/idlelib/AutoComplete.py#L225-L229
erocarrera/pefile
bdcafa7f5d6564067330731af15a6141c57d1a61
pefile.py
python
PE.parse_resource_entry
(self, rva)
return resource
Parse a directory entry from the resources directory.
Parse a directory entry from the resources directory.
[ "Parse", "a", "directory", "entry", "from", "the", "resources", "directory", "." ]
def parse_resource_entry(self, rva): """Parse a directory entry from the resources directory.""" try: data = self.get_data( rva, Structure(self.__IMAGE_RESOURCE_DIRECTORY_ENTRY_format__).sizeof() ) except PEFormatError: # A warning will be add...
[ "def", "parse_resource_entry", "(", "self", ",", "rva", ")", ":", "try", ":", "data", "=", "self", ".", "get_data", "(", "rva", ",", "Structure", "(", "self", ".", "__IMAGE_RESOURCE_DIRECTORY_ENTRY_format__", ")", ".", "sizeof", "(", ")", ")", "except", "P...
https://github.com/erocarrera/pefile/blob/bdcafa7f5d6564067330731af15a6141c57d1a61/pefile.py#L4437-L4466
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pip/_vendor/ipaddress.py
python
v6_int_to_packed
(address)
Represent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order.
Represent an address as 16 packed bytes in network (big-endian) order.
[ "Represent", "an", "address", "as", "16", "packed", "bytes", "in", "network", "(", "big", "-", "endian", ")", "order", "." ]
def v6_int_to_packed(address): """Represent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. """ try: return _compat_t...
[ "def", "v6_int_to_packed", "(", "address", ")", ":", "try", ":", "return", "_compat_to_bytes", "(", "address", ",", "16", ",", "'big'", ")", "except", "(", "struct", ".", "error", ",", "OverflowError", ")", ":", "raise", "ValueError", "(", "\"Address negativ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L260-L273
boto/boto
b2a6f08122b2f1b89888d2848e730893595cd001
boto/cloudsearch2/layer1.py
python
CloudSearchConnection.delete_analysis_scheme
(self, domain_name, analysis_scheme_name)
return self._make_request( action='DeleteAnalysisScheme', verb='POST', path='/', params=params)
Deletes an analysis scheme. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by ...
Deletes an analysis scheme. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide .
[ "Deletes", "an", "analysis", "scheme", ".", "For", "more", "information", "see", "Configuring", "Analysis", "Schemes", "_", "in", "the", "Amazon", "CloudSearch", "Developer", "Guide", "." ]
def delete_analysis_scheme(self, domain_name, analysis_scheme_name): """ Deletes an analysis scheme. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represen...
[ "def", "delete_analysis_scheme", "(", "self", ",", "domain_name", ",", "analysis_scheme_name", ")", ":", "params", "=", "{", "'DomainName'", ":", "domain_name", ",", "'AnalysisSchemeName'", ":", "analysis_scheme_name", ",", "}", "return", "self", ".", "_make_request...
https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/cloudsearch2/layer1.py#L238-L263
ibis-project/ibis
e1ef8b6870ac53de9d1fe5c52851fa41872109c4
ibis/backends/impala/client.py
python
ImpalaConnection.close
(self)
Close all open Impyla sessions
Close all open Impyla sessions
[ "Close", "all", "open", "Impyla", "sessions" ]
def close(self): """ Close all open Impyla sessions """ for impyla_connection in self._connections: impyla_connection.close() self._connections.clear() self.connection_pool.clear()
[ "def", "close", "(", "self", ")", ":", "for", "impyla_connection", "in", "self", ".", "_connections", ":", "impyla_connection", ".", "close", "(", ")", "self", ".", "_connections", ".", "clear", "(", ")", "self", ".", "connection_pool", ".", "clear", "(", ...
https://github.com/ibis-project/ibis/blob/e1ef8b6870ac53de9d1fe5c52851fa41872109c4/ibis/backends/impala/client.py#L65-L73
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/algorithms/nas/auto_lane/utils/resnext_all_variant_codec.py
python
ResNeXt_all_Variant.__str__
(self)
return self.arch_code
Repr.
Repr.
[ "Repr", "." ]
def __str__(self): """Repr.""" return self.arch_code
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "arch_code" ]
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/algorithms/nas/auto_lane/utils/resnext_all_variant_codec.py#L64-L66
alberanid/imdbpy
88cf37772186e275eff212857f512669086b382c
bin/imdbpy2sql.py
python
readMovieList
()
Read the movies.list.gz file.
Read the movies.list.gz file.
[ "Read", "the", "movies", ".", "list", ".", "gz", "file", "." ]
def readMovieList(): """Read the movies.list.gz file.""" try: mdbf = SourceFile(MOVIES, start=MOVIES_START, stop=MOVIES_STOP) except IOError: return count = 0 for line in mdbf: line_d = unpack(line, ('title', 'year')) title = line_d['title'] yearData = None ...
[ "def", "readMovieList", "(", ")", ":", "try", ":", "mdbf", "=", "SourceFile", "(", "MOVIES", ",", "start", "=", "MOVIES_START", ",", "stop", "=", "MOVIES_STOP", ")", "except", "IOError", ":", "return", "count", "=", "0", "for", "line", "in", "mdbf", ":...
https://github.com/alberanid/imdbpy/blob/88cf37772186e275eff212857f512669086b382c/bin/imdbpy2sql.py#L1546-L1569
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/packaging/version.py
python
LegacyVersion.public
(self)
return self._version
[]
def public(self): return self._version
[ "def", "public", "(", "self", ")", ":", "return", "self", ".", "_version" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/packaging/version.py#L85-L86
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/_vendor/pyparsing.py
python
ParserElement.searchString
( self, instring, maxMatches=_MAX_INT )
Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. Example:: # a capitalized word starts with an uppercase ...
Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. Example:: # a capitalized word starts with an uppercase ...
[ "Another", "extension", "to", "C", "{", "L", "{", "scanString", "}}", "simplifying", "the", "access", "to", "the", "tokens", "found", "to", "match", "the", "given", "parse", "expression", ".", "May", "be", "called", "with", "optional", "C", "{", "maxMatche...
def searchString( self, instring, maxMatches=_MAX_INT ): """ Another extension to C{L{scanString}}, simplifying the access to the tokens found to match the given parse expression. May be called with optional C{maxMatches} argument, to clip searching after 'n' matches are found. ...
[ "def", "searchString", "(", "self", ",", "instring", ",", "maxMatches", "=", "_MAX_INT", ")", ":", "try", ":", "return", "ParseResults", "(", "[", "t", "for", "t", ",", "s", ",", "e", "in", "self", ".", "scanString", "(", "instring", ",", "maxMatches",...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/_vendor/pyparsing.py#L1772-L1797
PyOCL/OpenCLGA
8192a337d5317795b5d4f1d5c9b76299bf4c4df4
examples/taiwan_travel/taiwan_travel_server.py
python
get_taiwan_travel_info
()
return dict_info
NOTE : Config TaiwanTravel GA parameters in dictionary 'dict_info'.
NOTE : Config TaiwanTravel GA parameters in dictionary 'dict_info'.
[ "NOTE", ":", "Config", "TaiwanTravel", "GA", "parameters", "in", "dictionary", "dict_info", "." ]
def get_taiwan_travel_info(): ''' NOTE : Config TaiwanTravel GA parameters in dictionary 'dict_info'. ''' cities, city_info, city_infoX, city_infoY = read_all_cities('TW319_368Addresses-no-far-islands.json') city_ids = list(range(len(cities))) random.seed() tsp_path = os.path.dirname(os.pat...
[ "def", "get_taiwan_travel_info", "(", ")", ":", "cities", ",", "city_info", ",", "city_infoX", ",", "city_infoY", "=", "read_all_cities", "(", "'TW319_368Addresses-no-far-islands.json'", ")", "city_ids", "=", "list", "(", "range", "(", "len", "(", "cities", ")", ...
https://github.com/PyOCL/OpenCLGA/blob/8192a337d5317795b5d4f1d5c9b76299bf4c4df4/examples/taiwan_travel/taiwan_travel_server.py#L43-L79
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
doc/tutorials/pymunk_platformer/pymunk_demo_platformer_11.py
python
GameWindow.setup
(self)
Set up everything with the game
Set up everything with the game
[ "Set", "up", "everything", "with", "the", "game" ]
def setup(self): """ Set up everything with the game """ # Create the sprite lists self.player_list = arcade.SpriteList() self.bullet_list = arcade.SpriteList() # Map name map_name = "pymunk_test_map.json" # Load in TileMap tile_map = arcade.load_tilema...
[ "def", "setup", "(", "self", ")", ":", "# Create the sprite lists", "self", ".", "player_list", "=", "arcade", ".", "SpriteList", "(", ")", "self", ".", "bullet_list", "=", "arcade", ".", "SpriteList", "(", ")", "# Map name", "map_name", "=", "\"pymunk_test_ma...
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/doc/tutorials/pymunk_platformer/pymunk_demo_platformer_11.py#L201-L301
christabor/flask_jsondash
c8984790722327e86694e15409ff4dea0621aab0
example_app/endpoints.py
python
dtable
()
return jsonify({})
Fake endpoint.
Fake endpoint.
[ "Fake", "endpoint", "." ]
def dtable(): """Fake endpoint.""" if 'stress' in request.args: return jsonify([ dict( foo=rr(1, 1000), bar=rr(1, 1000), baz=rr(1, 1000), quux=rr(1, 1000)) for _ in range(STRESS_MAX_POINTS) ]) fname = 'dtable-overrid...
[ "def", "dtable", "(", ")", ":", "if", "'stress'", "in", "request", ".", "args", ":", "return", "jsonify", "(", "[", "dict", "(", "foo", "=", "rr", "(", "1", ",", "1000", ")", ",", "bar", "=", "rr", "(", "1", ",", "1000", ")", ",", "baz", "=",...
https://github.com/christabor/flask_jsondash/blob/c8984790722327e86694e15409ff4dea0621aab0/example_app/endpoints.py#L384-L397
YaoZeyuan/ZhihuHelp_archived
a0e4a7acd4512452022ce088fff2adc6f8d30195
src/lib/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
python
match_hostname
(cert, hostname)
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing.
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*.
[ "Verify", "that", "*", "cert", "*", "(", "in", "decoded", "format", "as", "returned", "by", "SSLSocket", ".", "getpeercert", "()", ")", "matches", "the", "*", "hostname", "*", ".", "RFC", "2818", "and", "RFC", "6125", "rules", "are", "followed", "but", ...
def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function r...
[ "def", "match_hostname", "(", "cert", ",", "hostname", ")", ":", "if", "not", "cert", ":", "raise", "ValueError", "(", "\"empty or no certificate\"", ")", "dnsnames", "=", "[", "]", "san", "=", "cert", ".", "get", "(", "'subjectAltName'", ",", "(", ")", ...
https://github.com/YaoZeyuan/ZhihuHelp_archived/blob/a0e4a7acd4512452022ce088fff2adc6f8d30195/src/lib/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py#L67-L105
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/xmpp/SleekXMPP/sleekxmpp/roster/item.py
python
RosterItem.handle_unsubscribe
(self, presence)
+------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | no | no state change | | "None + P...
+------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | no | no state change | | "None + P...
[ "+", "------------------------------------------------------------------", "+", "|", "EXISTING", "STATE", "|", "DELIVER?", "|", "NEW", "STATE", "|", "+", "------------------------------------------------------------------", "+", "|", "None", "|", "no", "|", "no", "state", ...
def handle_unsubscribe(self, presence): """ +------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | ...
[ "def", "handle_unsubscribe", "(", "self", ",", "presence", ")", ":", "if", "self", ".", "xmpp", ".", "is_component", ":", "if", "not", "self", "[", "'from'", "]", "and", "self", "[", "'pending_in'", "]", ":", "self", "[", "'pending_in'", "]", "=", "Fal...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/roster/item.py#L427-L453
Calysto/calysto_scheme
15bf81987870bcae1264e5a0a06feb9a8ee12b8b
calysto_scheme/scheme.py
python
b_cont2_103_d
(src, tokens_left, env2, handler, k)
[]
def b_cont2_103_d(src, tokens_left, env2, handler, k): GLOBALS['k_reg'] = make_cont2(b_cont2_102_d, src, tokens_left, env2, handler, k) GLOBALS['fail_reg'] = value2_reg GLOBALS['handler_reg'] = handler GLOBALS['env_reg'] = env2 GLOBALS['exp_reg'] = value1_reg GLOBALS['pc'] = m
[ "def", "b_cont2_103_d", "(", "src", ",", "tokens_left", ",", "env2", ",", "handler", ",", "k", ")", ":", "GLOBALS", "[", "'k_reg'", "]", "=", "make_cont2", "(", "b_cont2_102_d", ",", "src", ",", "tokens_left", ",", "env2", ",", "handler", ",", "k", ")"...
https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L3125-L3131
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/trainer_callback.py
python
ProgressCallback.on_train_begin
(self, args, state, control, **kwargs)
[]
def on_train_begin(self, args, state, control, **kwargs): if state.is_local_process_zero: self.training_bar = tqdm(total=state.max_steps) self.current_step = 0
[ "def", "on_train_begin", "(", "self", ",", "args", ",", "state", ",", "control", ",", "*", "*", "kwargs", ")", ":", "if", "state", ".", "is_local_process_zero", ":", "self", ".", "training_bar", "=", "tqdm", "(", "total", "=", "state", ".", "max_steps", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/trainer_callback.py#L462-L465
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/utils/sysinfo.py
python
get_sys_info
()
return pkg_info(path)
Return useful information about IPython and the system, as a dict.
Return useful information about IPython and the system, as a dict.
[ "Return", "useful", "information", "about", "IPython", "and", "the", "system", "as", "a", "dict", "." ]
def get_sys_info(): """Return useful information about IPython and the system, as a dict.""" p = os.path path = p.dirname(p.abspath(p.join(__file__, '..'))) return pkg_info(path)
[ "def", "get_sys_info", "(", ")", ":", "p", "=", "os", ".", "path", "path", "=", "p", ".", "dirname", "(", "p", ".", "abspath", "(", "p", ".", "join", "(", "__file__", ",", "'..'", ")", ")", ")", "return", "pkg_info", "(", "path", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/utils/sysinfo.py#L95-L99
minio/minio-py
b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3
minio/deleteobjects.py
python
DeleteRequest.toxml
(self, element)
return element
Convert to XML.
Convert to XML.
[ "Convert", "to", "XML", "." ]
def toxml(self, element): """Convert to XML.""" element = Element("Delete") if self._quiet: SubElement(element, "Quiet", str(self._quiet)) for obj in self._object_list: obj.toxml(element) return element
[ "def", "toxml", "(", "self", ",", "element", ")", ":", "element", "=", "Element", "(", "\"Delete\"", ")", "if", "self", ".", "_quiet", ":", "SubElement", "(", "element", ",", "\"Quiet\"", ",", "str", "(", "self", ".", "_quiet", ")", ")", "for", "obj"...
https://github.com/minio/minio-py/blob/b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3/minio/deleteobjects.py#L47-L54
mautrix/telegram
9f48eca5a6654bc38012cb761ecaaaf416aabdd0
mautrix_telegram/db/upgrade/v02_sponsored_events.py
python
upgrade_v2
(conn: Connection)
[]
async def upgrade_v2(conn: Connection) -> None: await conn.execute("ALTER TABLE portal ADD COLUMN sponsored_event_id TEXT") await conn.execute("ALTER TABLE portal ADD COLUMN sponsored_event_ts BIGINT") await conn.execute("ALTER TABLE portal ADD COLUMN sponsored_msg_random_id bytea")
[ "async", "def", "upgrade_v2", "(", "conn", ":", "Connection", ")", "->", "None", ":", "await", "conn", ".", "execute", "(", "\"ALTER TABLE portal ADD COLUMN sponsored_event_id TEXT\"", ")", "await", "conn", ".", "execute", "(", "\"ALTER TABLE portal ADD COLUMN sponsored...
https://github.com/mautrix/telegram/blob/9f48eca5a6654bc38012cb761ecaaaf416aabdd0/mautrix_telegram/db/upgrade/v02_sponsored_events.py#L22-L25
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/reportlab/build/lib.linux-i686-2.7/reportlab/graphics/shapes.py
python
_renderPath
(path, drawFuncs)
return hadMoveTo == hadClosePath
Helper function for renderers.
Helper function for renderers.
[ "Helper", "function", "for", "renderers", "." ]
def _renderPath(path, drawFuncs): """Helper function for renderers.""" # this could be a method of Path... points = path.points i = 0 hadClosePath = 0 hadMoveTo = 0 for op in path.operators: nArgs = _PATH_OP_ARG_COUNT[op] func = drawFuncs[op] j = i + nArgs fun...
[ "def", "_renderPath", "(", "path", ",", "drawFuncs", ")", ":", "# this could be a method of Path...", "points", "=", "path", ".", "points", "i", "=", "0", "hadClosePath", "=", "0", "hadMoveTo", "=", "0", "for", "op", "in", "path", ".", "operators", ":", "n...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/build/lib.linux-i686-2.7/reportlab/graphics/shapes.py#L963-L980
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/utils/win_runas.py
python
runas
(cmdLine, username, password=None, cwd=None)
return ret
Run a command as another user. If the process is running as an admin or system account this method does not require a password. Other non privileged accounts need to provide a password for the user to runas. Commands are run in with the highest level privileges possible for the account provided.
Run a command as another user. If the process is running as an admin or system account this method does not require a password. Other non privileged accounts need to provide a password for the user to runas. Commands are run in with the highest level privileges possible for the account provided.
[ "Run", "a", "command", "as", "another", "user", ".", "If", "the", "process", "is", "running", "as", "an", "admin", "or", "system", "account", "this", "method", "does", "not", "require", "a", "password", ".", "Other", "non", "privileged", "accounts", "need"...
def runas(cmdLine, username, password=None, cwd=None): """ Run a command as another user. If the process is running as an admin or system account this method does not require a password. Other non privileged accounts need to provide a password for the user to runas. Commands are run in with the high...
[ "def", "runas", "(", "cmdLine", ",", "username", ",", "password", "=", "None", ",", "cwd", "=", "None", ")", ":", "# Validate the domain and sid exist for the username", "username", ",", "domain", "=", "split_username", "(", "username", ")", "try", ":", "_", "...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/win_runas.py#L85-L250
weewx/weewx
cb594fce224560bd8696050fc5c7843c7839320e
bin/weewx/manager.py
python
DaySummaryManager._read_metadata
(self, key, cursor=None)
return _row[0] if _row else None
Obtain a value from the daily summary metadata table. Returns: Value of the metadata field. Returns None if no value was found.
Obtain a value from the daily summary metadata table.
[ "Obtain", "a", "value", "from", "the", "daily", "summary", "metadata", "table", "." ]
def _read_metadata(self, key, cursor=None): """Obtain a value from the daily summary metadata table. Returns: Value of the metadata field. Returns None if no value was found. """ _row = self.getSql(DaySummaryManager.meta_select_str % self.table_name, (key,), cursor) ...
[ "def", "_read_metadata", "(", "self", ",", "key", ",", "cursor", "=", "None", ")", ":", "_row", "=", "self", ".", "getSql", "(", "DaySummaryManager", ".", "meta_select_str", "%", "self", ".", "table_name", ",", "(", "key", ",", ")", ",", "cursor", ")",...
https://github.com/weewx/weewx/blob/cb594fce224560bd8696050fc5c7843c7839320e/bin/weewx/manager.py#L1476-L1483
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/utils/translation/__init__.py
python
npgettext
(context, singular, plural, number)
return _trans.npgettext(context, singular, plural, number)
[]
def npgettext(context, singular, plural, number): return _trans.npgettext(context, singular, plural, number)
[ "def", "npgettext", "(", "context", ",", "singular", ",", "plural", ",", "number", ")", ":", "return", "_trans", ".", "npgettext", "(", "context", ",", "singular", ",", "plural", ",", "number", ")" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/utils/translation/__init__.py#L100-L101
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/com.oracle.graal.python.benchmarks/python/meso/chaos-sized2.py
python
GVector.__repr__
(self)
return "GVector(%f, %f, %f)" % (self.x, self.y, self.z)
[]
def __repr__(self): return "GVector(%f, %f, %f)" % (self.x, self.y, self.z)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"GVector(%f, %f, %f)\"", "%", "(", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "z", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/com.oracle.graal.python.benchmarks/python/meso/chaos-sized2.py#L78-L79
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/xml/dom/minidom.py
python
ProcessingInstruction.__setattr__
(self, name, value)
[]
def __setattr__(self, name, value): if name == "data" or name == "nodeValue": self.__dict__['data'] = self.__dict__['nodeValue'] = value elif name == "target" or name == "nodeName": self.__dict__['target'] = self.__dict__['nodeName'] = value else: self.__dict_...
[ "def", "__setattr__", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "==", "\"data\"", "or", "name", "==", "\"nodeValue\"", ":", "self", ".", "__dict__", "[", "'data'", "]", "=", "self", ".", "__dict__", "[", "'nodeValue'", "]", "=", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/xml/dom/minidom.py#L926-L932
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pygments/lexer.py
python
DelegatingLexer.get_tokens_unprocessed
(self, text)
return do_insertions(insertions, self.root_lexer.get_tokens_unprocessed(buffered))
[]
def get_tokens_unprocessed(self, text): buffered = '' insertions = [] lng_buffer = [] for i, t, v in self.language_lexer.get_tokens_unprocessed(text): if t is self.needle: if lng_buffer: insertions.append((len(buffered), lng_buffer)) ...
[ "def", "get_tokens_unprocessed", "(", "self", ",", "text", ")", ":", "buffered", "=", "''", "insertions", "=", "[", "]", "lng_buffer", "=", "[", "]", "for", "i", ",", "t", ",", "v", "in", "self", ".", "language_lexer", ".", "get_tokens_unprocessed", "(",...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pygments/lexer.py#L225-L240
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/win_service.py
python
start
(name, timeout=90)
return srv_status["Status"] == "Running"
Start the specified service. .. warning:: You cannot start a disabled service in Windows. If the service is disabled, it will be changed to ``Manual`` start. Args: name (str): The name of the service to start timeout (int): The time in seconds to wait for the servi...
Start the specified service.
[ "Start", "the", "specified", "service", "." ]
def start(name, timeout=90): """ Start the specified service. .. warning:: You cannot start a disabled service in Windows. If the service is disabled, it will be changed to ``Manual`` start. Args: name (str): The name of the service to start timeout (int): ...
[ "def", "start", "(", "name", ",", "timeout", "=", "90", ")", ":", "# Set the service to manual if disabled", "if", "disabled", "(", "name", ")", ":", "modify", "(", "name", ",", "start_type", "=", "\"Manual\"", ")", "try", ":", "win32serviceutil", ".", "Star...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/win_service.py#L307-L353
home-assistant/supervisor
69c2517d5211b483fdfe968b0a2b36b672ee7ab2
supervisor/backups/backup.py
python
Backup.addon_list
(self)
return [addon_data[ATTR_SLUG] for addon_data in self.addons]
Return a list of add-ons slugs.
Return a list of add-ons slugs.
[ "Return", "a", "list", "of", "add", "-", "ons", "slugs", "." ]
def addon_list(self): """Return a list of add-ons slugs.""" return [addon_data[ATTR_SLUG] for addon_data in self.addons]
[ "def", "addon_list", "(", "self", ")", ":", "return", "[", "addon_data", "[", "ATTR_SLUG", "]", "for", "addon_data", "in", "self", ".", "addons", "]" ]
https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/backups/backup.py#L99-L101
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/translate/meteor_score.py
python
stem_match
( hypothesis: Iterable[str], reference: Iterable[str], stemmer: StemmerI = PorterStemmer(), )
return _enum_stem_match(enum_hypothesis_list, enum_reference_list, stemmer=stemmer)
Stems each word and matches them in hypothesis and reference and returns a word mapping between hypothesis and reference :param hypothesis: pre-tokenized hypothesis :param reference: pre-tokenized reference :param stemmer: nltk.stem.api.StemmerI object (default PorterStemmer()) :return: enumerated ...
Stems each word and matches them in hypothesis and reference and returns a word mapping between hypothesis and reference
[ "Stems", "each", "word", "and", "matches", "them", "in", "hypothesis", "and", "reference", "and", "returns", "a", "word", "mapping", "between", "hypothesis", "and", "reference" ]
def stem_match( hypothesis: Iterable[str], reference: Iterable[str], stemmer: StemmerI = PorterStemmer(), ) -> Tuple[List[Tuple[int, int]], List[Tuple[int, str]], List[Tuple[int, str]]]: """ Stems each word and matches them in hypothesis and reference and returns a word mapping between hypothesi...
[ "def", "stem_match", "(", "hypothesis", ":", "Iterable", "[", "str", "]", ",", "reference", ":", "Iterable", "[", "str", "]", ",", "stemmer", ":", "StemmerI", "=", "PorterStemmer", "(", ")", ",", ")", "->", "Tuple", "[", "List", "[", "Tuple", "[", "i...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/translate/meteor_score.py#L119-L135
huawei-noah/Pretrained-Language-Model
d4694a134bdfacbaef8ff1d99735106bd3b3372b
DynaBERT/transformers/data/processors/glue.py
python
Sst2Processor.get_labels
(self)
return ["0", "1"]
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/DynaBERT/transformers/data/processors/glue.py#L447-L449
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_service.py
python
OpenShiftCLI._run
(self, cmds, input_data)
return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
Actually executes the command. This makes mocking easier.
Actually executes the command. This makes mocking easier.
[ "Actually", "executes", "the", "command", ".", "This", "makes", "mocking", "easier", "." ]
def _run(self, cmds, input_data): ''' Actually executes the command. This makes mocking easier. ''' curr_env = os.environ.copy() curr_env.update({'KUBECONFIG': self.kubeconfig}) proc = subprocess.Popen(cmds, stdin=subprocess.PIPE, ...
[ "def", "_run", "(", "self", ",", "cmds", ",", "input_data", ")", ":", "curr_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "curr_env", ".", "update", "(", "{", "'KUBECONFIG'", ":", "self", ".", "kubeconfig", "}", ")", "proc", "=", "subproces...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_service.py#L1160-L1172
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py
python
_ProxyFile.readlines
(self, sizehint=None)
return result
Read multiple lines.
Read multiple lines.
[ "Read", "multiple", "lines", "." ]
def readlines(self, sizehint=None): """Read multiple lines.""" result = [] for line in self: result.append(line) if sizehint is not None: sizehint -= len(line) if sizehint <= 0: break return result
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "None", ")", ":", "result", "=", "[", "]", "for", "line", "in", "self", ":", "result", ".", "append", "(", "line", ")", "if", "sizehint", "is", "not", "None", ":", "sizehint", "-=", "len", "(",...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/mailbox.py#L1829-L1838
LexPredict/lexpredict-contraxsuite
1d5a2540d31f8f3f1adc442cfa13a7c007319899
contraxsuite_services/apps/analyze/ml/features.py
python
DocumentFeatures.get_feature_df
(self)
return df, unqualified_item_ids
Transform incoming data into pandas dataframe :return: tuple(features pandas.DataFrame, unqualified item id list)
Transform incoming data into pandas dataframe :return: tuple(features pandas.DataFrame, unqualified item id list)
[ "Transform", "incoming", "data", "into", "pandas", "dataframe", ":", "return", ":", "tuple", "(", "features", "pandas", ".", "DataFrame", "unqualified", "item", "id", "list", ")" ]
def get_feature_df(self) -> Tuple[pd.DataFrame, List[Any]]: """ Transform incoming data into pandas dataframe :return: tuple(features pandas.DataFrame, unqualified item id list) """ # prepare features dataframe target_qs = self.get_queryset() all_sample_ids = list...
[ "def", "get_feature_df", "(", "self", ")", "->", "Tuple", "[", "pd", ".", "DataFrame", ",", "List", "[", "Any", "]", "]", ":", "# prepare features dataframe", "target_qs", "=", "self", ".", "get_queryset", "(", ")", "all_sample_ids", "=", "list", "(", "tar...
https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/contraxsuite_services/apps/analyze/ml/features.py#L227-L364
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/idlelib/tabbedpages.py
python
TabSet._arrange_tabs
(self)
Arrange the tabs in rows, in the order in which they were added. If n_rows >= 1, this will be the number of rows used. Otherwise the number of rows will be calculated according to the number of tabs and max_tabs_per_row. In this case, the number of rows may change when adding/removing t...
Arrange the tabs in rows, in the order in which they were added.
[ "Arrange", "the", "tabs", "in", "rows", "in", "the", "order", "in", "which", "they", "were", "added", "." ]
def _arrange_tabs(self): """ Arrange the tabs in rows, in the order in which they were added. If n_rows >= 1, this will be the number of rows used. Otherwise the number of rows will be calculated according to the number of tabs and max_tabs_per_row. In this case, the number of r...
[ "def", "_arrange_tabs", "(", "self", ")", ":", "# remove all tabs and rows", "for", "tab_name", "in", "self", ".", "_tabs", ".", "keys", "(", ")", ":", "self", ".", "_tabs", ".", "pop", "(", "tab_name", ")", ".", "destroy", "(", ")", "self", ".", "_res...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/idlelib/tabbedpages.py#L135-L173