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
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/widgets/styledtexteditor.py
python
StyledTextEditor._create_spell_menu
(self)
return menu
Create a menu with all the installed spellchecks. It is called each time the popup menu is opened. Each spellcheck forms a radio menu item, and the selected spellcheck is set as active. :returns: menu containing all the installed spellchecks. :rtype: Gtk.Menu
Create a menu with all the installed spellchecks.
[ "Create", "a", "menu", "with", "all", "the", "installed", "spellchecks", "." ]
def _create_spell_menu(self): """ Create a menu with all the installed spellchecks. It is called each time the popup menu is opened. Each spellcheck forms a radio menu item, and the selected spellcheck is set as active. :returns: menu containing all the installed spellchecks. ...
[ "def", "_create_spell_menu", "(", "self", ")", ":", "active_spellcheck", "=", "self", ".", "spellcheck", ".", "get_active_spellcheck", "(", ")", "menu", "=", "Gtk", ".", "Menu", "(", ")", "group", "=", "None", "for", "lang", "in", "self", ".", "spellcheck"...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/widgets/styledtexteditor.py#L613-L636
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/codeintel2/parser_data.py
python
Node.dump_collection
(self, label, attr, indent_level)
[]
def dump_collection(self, label, attr, indent_level): if hasattr(self, attr): collection = getattr(self, attr) if len(collection) > 0: print("%s %s: " % (" " * indent_level, label)) for name, varInfo in list(collection.items()): line, t...
[ "def", "dump_collection", "(", "self", ",", "label", ",", "attr", ",", "indent_level", ")", ":", "if", "hasattr", "(", "self", ",", "attr", ")", ":", "collection", "=", "getattr", "(", "self", ",", "attr", ")", "if", "len", "(", "collection", ")", ">...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/parser_data.py#L119-L130
clovaai/tunit
49e633179c5670228a2319d2c99054322616b516
models/inception.py
python
InceptionV3.__init__
(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True)
Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling ...
Build pretrained InceptionV3
[ "Build", "pretrained", "InceptionV3" ]
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True): """Build pretrained InceptionV3 Parameters ---------- outpu...
[ "def", "__init__", "(", "self", ",", "output_blocks", "=", "[", "DEFAULT_BLOCK_INDEX", "]", ",", "resize_input", "=", "True", ",", "normalize_input", "=", "True", ",", "requires_grad", "=", "False", ",", "use_fid_inception", "=", "True", ")", ":", "super", "...
https://github.com/clovaai/tunit/blob/49e633179c5670228a2319d2c99054322616b516/models/inception.py#L36-L132
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/cffLib/__init__.py
python
TopDict.__init__
(self, strings=None, file=None, offset=None, GlobalSubrs=None, cff2GetGlyphOrder=None, isCFF2=None)
[]
def __init__(self, strings=None, file=None, offset=None, GlobalSubrs=None, cff2GetGlyphOrder=None, isCFF2=None): super(TopDict, self).__init__(strings, file, offset, isCFF2=isCFF2) self.cff2GetGlyphOrder = cff2GetGlyphOrder self.GlobalSubrs = GlobalSubrs if isCFF2: self.defaults = buildDefaults(topDictOpe...
[ "def", "__init__", "(", "self", ",", "strings", "=", "None", ",", "file", "=", "None", ",", "offset", "=", "None", ",", "GlobalSubrs", "=", "None", ",", "cff2GetGlyphOrder", "=", "None", ",", "isCFF2", "=", "None", ")", ":", "super", "(", "TopDict", ...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/cffLib/__init__.py#L2655-L2666
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
utils/meshes.py
python
PyMesh.cast
(self, mesh_type: Type[Mesh])
Convert itself into other mesh types
Convert itself into other mesh types
[ "Convert", "itself", "into", "other", "mesh", "types" ]
def cast(self, mesh_type: Type[Mesh]) -> Mesh: """Convert itself into other mesh types""" if mesh_type == PyMesh: return self elif mesh_type == NpMesh: cast_mesh = NpMesh(self.vertices.data, self.edges.data, self.polygons.data) cast_mesh.vertices.copy_attribut...
[ "def", "cast", "(", "self", ",", "mesh_type", ":", "Type", "[", "Mesh", "]", ")", "->", "Mesh", ":", "if", "mesh_type", "==", "PyMesh", ":", "return", "self", "elif", "mesh_type", "==", "NpMesh", ":", "cast_mesh", "=", "NpMesh", "(", "self", ".", "ve...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/utils/meshes.py#L156-L167
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
pcbasic/interface/sdl2.py
python
get_dll_file
()
return dll.libfile
Gets the file name of the loaded SDL2 library.
Gets the file name of the loaded SDL2 library.
[ "Gets", "the", "file", "name", "of", "the", "loaded", "SDL2", "library", "." ]
def get_dll_file(): """Gets the file name of the loaded SDL2 library.""" return dll.libfile
[ "def", "get_dll_file", "(", ")", ":", "return", "dll", ".", "libfile" ]
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/interface/sdl2.py#L216-L218
cbrgm/telegram-robot-rss
58fe98de427121fdc152c8df0721f1891174e6c9
venv/lib/python2.7/site-packages/pip/exceptions.py
python
HashError._requirement_name
(self)
return str(self.req) if self.req else 'unknown package'
Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers
Return a description of the requirement that triggered me.
[ "Return", "a", "description", "of", "the", "requirement", "that", "triggered", "me", "." ]
def _requirement_name(self): """Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers """ return str(self.req) if self.req else 'unknown package'
[ "def", "_requirement_name", "(", "self", ")", ":", "return", "str", "(", "self", ".", "req", ")", "if", "self", ".", "req", "else", "'unknown package'" ]
https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/pip/exceptions.py#L113-L120
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/fields.py
python
StreamField.contribute_to_class
(self, cls, name, **kwargs)
[]
def contribute_to_class(self, cls, name, **kwargs): super(StreamField, self).contribute_to_class(cls, name, **kwargs) # Add Creator descriptor to allow the field to be set from a list or a # JSON string. setattr(cls, self.name, Creator(self))
[ "def", "contribute_to_class", "(", "self", ",", "cls", ",", "name", ",", "*", "*", "kwargs", ")", ":", "super", "(", "StreamField", ",", "self", ")", ".", "contribute_to_class", "(", "cls", ",", "name", ",", "*", "*", "kwargs", ")", "# Add Creator descri...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailcore/fields.py#L135-L140
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/setuptools-0.6c11/setuptools/dist.py
python
Distribution.fetch_build_eggs
(self, requires)
Resolve pre-setup requirements
Resolve pre-setup requirements
[ "Resolve", "pre", "-", "setup", "requirements" ]
def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" from pkg_resources import working_set, parse_requirements for dist in working_set.resolve( parse_requirements(requires), installer=self.fetch_build_egg ): working_set.add(dist)
[ "def", "fetch_build_eggs", "(", "self", ",", "requires", ")", ":", "from", "pkg_resources", "import", "working_set", ",", "parse_requirements", "for", "dist", "in", "working_set", ".", "resolve", "(", "parse_requirements", "(", "requires", ")", ",", "installer", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/setuptools-0.6c11/setuptools/dist.py#L280-L286
pysathq/pysat
07bf3a5a4428d40eca804e7ebdf4f496aadf4213
examples/rc2.py
python
RC2.minimize_core
(self)
Reduce a previously extracted core and compute an over-approximation of an MUS. This is done using the simple deletion-based MUS extraction algorithm. The idea is to try to deactivate soft clauses of the unsatisfiable core one by one while checking if the rem...
Reduce a previously extracted core and compute an over-approximation of an MUS. This is done using the simple deletion-based MUS extraction algorithm.
[ "Reduce", "a", "previously", "extracted", "core", "and", "compute", "an", "over", "-", "approximation", "of", "an", "MUS", ".", "This", "is", "done", "using", "the", "simple", "deletion", "-", "based", "MUS", "extraction", "algorithm", "." ]
def minimize_core(self): """ Reduce a previously extracted core and compute an over-approximation of an MUS. This is done using the simple deletion-based MUS extraction algorithm. The idea is to try to deactivate soft clauses of the unsatisfiable core...
[ "def", "minimize_core", "(", "self", ")", ":", "if", "self", ".", "minz", "and", "len", "(", "self", ".", "core", ")", ">", "1", ":", "self", ".", "core", "=", "sorted", "(", "self", ".", "core", ",", "key", "=", "lambda", "l", ":", "self", "."...
https://github.com/pysathq/pysat/blob/07bf3a5a4428d40eca804e7ebdf4f496aadf4213/examples/rc2.py#L861-L890
miguelgrinberg/flasky-first-edition
923336f757c5665c56a2bbd21fe4e3b2d280b735
app/auth/views.py
python
password_reset_request
()
return render_template('auth/reset_password.html', form=form)
[]
def password_reset_request(): if not current_user.is_anonymous: return redirect(url_for('main.index')) form = PasswordResetRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: token = user.generate_reset_token() ...
[ "def", "password_reset_request", "(", ")", ":", "if", "not", "current_user", ".", "is_anonymous", ":", "return", "redirect", "(", "url_for", "(", "'main.index'", ")", ")", "form", "=", "PasswordResetRequestForm", "(", ")", "if", "form", ".", "validate_on_submit"...
https://github.com/miguelgrinberg/flasky-first-edition/blob/923336f757c5665c56a2bbd21fe4e3b2d280b735/app/auth/views.py#L105-L120
fitnr/SublimeDataConverter
d659d3b3615aade9e27b0fb6c5797947f7406518
DataConverter.py
python
DataConverterCommand.markdown
(self, data)
return self._spaced_text(data, '|', decorate, between=True)
markdown table format
markdown table format
[ "markdown", "table", "format" ]
def markdown(self, data): """markdown table format""" self.set_syntax('Text', 'Markdown') def decorate(lengths): fields = '|'.join(' ' + ('-' * v) + ' ' for v in lengths) return '|' + fields + '|' return self._spaced_text(data, '|', decorate, between=True)
[ "def", "markdown", "(", "self", ",", "data", ")", ":", "self", ".", "set_syntax", "(", "'Text'", ",", "'Markdown'", ")", "def", "decorate", "(", "lengths", ")", ":", "fields", "=", "'|'", ".", "join", "(", "' '", "+", "(", "'-'", "*", "v", ")", "...
https://github.com/fitnr/SublimeDataConverter/blob/d659d3b3615aade9e27b0fb6c5797947f7406518/DataConverter.py#L649-L657
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
src/templates/java_lexer.py
python
t_comment_cpp
(lexer,tok)
r' //.*\n?
r' //.*\n?
[ "r", "//", ".", "*", "\\", "n?" ]
def t_comment_cpp(lexer,tok): # \n? correct ? r' //.*\n?' pos = lexer.pos lineno = lexer.lineno col = pos-lexer.line_start_pos tok.start = lineno # == tok.lineno tok.col = col tok.end = lineno if tok.value[-1] == '\n': lexer.lineno += 1 lexer.line_start_pos = pos + le...
[ "def", "t_comment_cpp", "(", "lexer", ",", "tok", ")", ":", "# \\n? correct ?", "pos", "=", "lexer", ".", "pos", "lineno", "=", "lexer", ".", "lineno", "col", "=", "pos", "-", "lexer", ".", "line_start_pos", "tok", ".", "start", "=", "lineno", "# == tok....
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/src/templates/java_lexer.py#L269-L284
heynemann/motorengine
5e1fea7cc15060f768a697fe4c3593d20f23c4ed
motorengine/document.py
python
BaseDocument.find_list_field
(self, document, results, field_name, field)
[]
def find_list_field(self, document, results, field_name, field): from motorengine.fields.reference_field import ReferenceField if self.is_list_field(field): values = document._values.get(field_name) if values: document_type = values[0].__class__ if...
[ "def", "find_list_field", "(", "self", ",", "document", ",", "results", ",", "field_name", ",", "field", ")", ":", "from", "motorengine", ".", "fields", ".", "reference_field", "import", "ReferenceField", "if", "self", ".", "is_list_field", "(", "field", ")", ...
https://github.com/heynemann/motorengine/blob/5e1fea7cc15060f768a697fe4c3593d20f23c4ed/motorengine/document.py#L257-L278
ondyari/FaceForensics
b952e41cba017eb37593c39e12bd884a934791e1
dataset/DeepFakes/faceswap-master/lib/gui/display_analysis.py
python
Options.add_buttons
(self)
Add the option buttons
Add the option buttons
[ "Add", "the", "option", "buttons" ]
def add_buttons(self): """ Add the option buttons """ for btntype in ("reset", "clear", "save", "load"): cmd = getattr(self.parent, "{}_session".format(btntype)) btn = ttk.Button(self.optsframe, image=Images().icons[btntype], ...
[ "def", "add_buttons", "(", "self", ")", ":", "for", "btntype", "in", "(", "\"reset\"", ",", "\"clear\"", ",", "\"save\"", ",", "\"load\"", ")", ":", "cmd", "=", "getattr", "(", "self", ".", "parent", ",", "\"{}_session\"", ".", "format", "(", "btntype", ...
https://github.com/ondyari/FaceForensics/blob/b952e41cba017eb37593c39e12bd884a934791e1/dataset/DeepFakes/faceswap-master/lib/gui/display_analysis.py#L120-L129
qiucheng025/zao-
3a5edf3607b3a523f95746bc69b688090c76d89a
tools/lib_alignments/media.py
python
ExtractedFaces.get_faces_in_frame
(self, frame, update=False)
return self.faces
Return the faces for the selected frame
Return the faces for the selected frame
[ "Return", "the", "faces", "for", "the", "selected", "frame" ]
def get_faces_in_frame(self, frame, update=False): """ Return the faces for the selected frame """ logger.trace("frame: '%s', update: %s", frame, update) if self.current_frame != frame or update: self.get_faces(frame) return self.faces
[ "def", "get_faces_in_frame", "(", "self", ",", "frame", ",", "update", "=", "False", ")", ":", "logger", ".", "trace", "(", "\"frame: '%s', update: %s\"", ",", "frame", ",", "update", ")", "if", "self", ".", "current_frame", "!=", "frame", "or", "update", ...
https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/tools/lib_alignments/media.py#L330-L335
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/importlib/_bootstrap.py
python
_load
(spec)
Return a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered.
Return a new module object, loaded by the spec's loader.
[ "Return", "a", "new", "module", "object", "loaded", "by", "the", "spec", "s", "loader", "." ]
def _load(spec): """Return a new module object, loaded by the spec's loader. The module is not added to its parent. If a module is already in sys.modules, that existing module gets clobbered. """ with _ModuleLockManager(spec.name): return _load_unlocked(spec)
[ "def", "_load", "(", "spec", ")", ":", "with", "_ModuleLockManager", "(", "spec", ".", "name", ")", ":", "return", "_load_unlocked", "(", "spec", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/importlib/_bootstrap.py#L674-L684
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/iterio.py
python
IterI.writelines
(self, list)
[]
def writelines(self, list): for item in list: self.write(item)
[ "def", "writelines", "(", "self", ",", "list", ")", ":", "for", "item", "in", "list", ":", "self", ".", "write", "(", "item", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/contrib/iterio.py#L200-L202
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/_pyio.py
python
BufferedRWPair.__init__
(self, reader, writer, buffer_size=DEFAULT_BUFFER_SIZE)
Constructor. The arguments are two RawIO instances.
Constructor.
[ "Constructor", "." ]
def __init__(self, reader, writer, buffer_size=DEFAULT_BUFFER_SIZE): """Constructor. The arguments are two RawIO instances. """ if not reader.readable(): raise OSError('"reader" argument must be readable.') if not writer.writable(): raise OSError('"write...
[ "def", "__init__", "(", "self", ",", "reader", ",", "writer", ",", "buffer_size", "=", "DEFAULT_BUFFER_SIZE", ")", ":", "if", "not", "reader", ".", "readable", "(", ")", ":", "raise", "OSError", "(", "'\"reader\" argument must be readable.'", ")", "if", "not",...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/_pyio.py#L1369-L1381
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py-rest/gluon/compileapp.py
python
run_models_in
(environment)
Runs all models (in the app specified by the current folder) It tries pre-compiled models first before compiling them.
Runs all models (in the app specified by the current folder) It tries pre-compiled models first before compiling them.
[ "Runs", "all", "models", "(", "in", "the", "app", "specified", "by", "the", "current", "folder", ")", "It", "tries", "pre", "-", "compiled", "models", "first", "before", "compiling", "them", "." ]
def run_models_in(environment): """ Runs all models (in the app specified by the current folder) It tries pre-compiled models first before compiling them. """ request = current.request folder = request.folder c = request.controller #f = environment['request'].function response = cur...
[ "def", "run_models_in", "(", "environment", ")", ":", "request", "=", "current", ".", "request", "folder", "=", "request", ".", "folder", "c", "=", "request", ".", "controller", "#f = environment['request'].function", "response", "=", "current", ".", "response", ...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/compileapp.py#L535-L576
ktbyers/netmiko
4c3732346eea1a4a608abd9e09d65eeb2f577810
netmiko/huawei/huawei.py
python
HuaweiBase.exit_config_mode
(self, exit_config: str = "return", pattern: str = r">")
return super().exit_config_mode(exit_config=exit_config, pattern=pattern)
Exit configuration mode.
Exit configuration mode.
[ "Exit", "configuration", "mode", "." ]
def exit_config_mode(self, exit_config: str = "return", pattern: str = r">") -> str: """Exit configuration mode.""" return super().exit_config_mode(exit_config=exit_config, pattern=pattern)
[ "def", "exit_config_mode", "(", "self", ",", "exit_config", ":", "str", "=", "\"return\"", ",", "pattern", ":", "str", "=", "r\">\"", ")", "->", "str", ":", "return", "super", "(", ")", ".", "exit_config_mode", "(", "exit_config", "=", "exit_config", ",", ...
https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/huawei/huawei.py#L45-L47
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/ecdsa/numbertheory.py
python
gcd2
(a, b)
return b
Greatest common divisor using Euclid's algorithm.
Greatest common divisor using Euclid's algorithm.
[ "Greatest", "common", "divisor", "using", "Euclid", "s", "algorithm", "." ]
def gcd2(a, b): """Greatest common divisor using Euclid's algorithm.""" while a: a, b = b%a, a return b
[ "def", "gcd2", "(", "a", ",", "b", ")", ":", "while", "a", ":", "a", ",", "b", "=", "b", "%", "a", ",", "a", "return", "b" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/ecdsa/numbertheory.py#L206-L210
hyde/hyde
7f415402cc3e007a746eb2b5bc102281fdb415bd
hyde/ext/templates/jinja.py
python
Markdown._render_markdown
(self, caller=None)
return markdown(self.environment, output)
Calls the markdown filter to transform the output.
Calls the markdown filter to transform the output.
[ "Calls", "the", "markdown", "filter", "to", "transform", "the", "output", "." ]
def _render_markdown(self, caller=None): """ Calls the markdown filter to transform the output. """ if not caller: return '' output = caller().strip() return markdown(self.environment, output)
[ "def", "_render_markdown", "(", "self", ",", "caller", "=", "None", ")", ":", "if", "not", "caller", ":", "return", "''", "output", "=", "caller", "(", ")", ".", "strip", "(", ")", "return", "markdown", "(", "self", ".", "environment", ",", "output", ...
https://github.com/hyde/hyde/blob/7f415402cc3e007a746eb2b5bc102281fdb415bd/hyde/ext/templates/jinja.py#L309-L316
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/unifi/controller.py
python
UniFiController.async_heartbeat
( self, unique_id: str, heartbeat_expire_time: datetime | None = None )
Signal when a device has fresh home state.
Signal when a device has fresh home state.
[ "Signal", "when", "a", "device", "has", "fresh", "home", "state", "." ]
def async_heartbeat( self, unique_id: str, heartbeat_expire_time: datetime | None = None ) -> None: """Signal when a device has fresh home state.""" if heartbeat_expire_time is not None: self._heartbeat_time[unique_id] = heartbeat_expire_time return if unique...
[ "def", "async_heartbeat", "(", "self", ",", "unique_id", ":", "str", ",", "heartbeat_expire_time", ":", "datetime", "|", "None", "=", "None", ")", "->", "None", ":", "if", "heartbeat_expire_time", "is", "not", "None", ":", "self", ".", "_heartbeat_time", "["...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/unifi/controller.py#L372-L381
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.84/Libs/x86smt/sequenceanalyzer.py
python
SequenceAnalyzer.__init__
(self, imm, r_model=None, f_model=None, m_model=False, analysis_mods=[], simplifyState=True, queryTimeout=0, prettysolver=False)
@type r_model: Dict @param r_model: A dictionary mapping registers to concrete values. Any registers not described in this dict will be described as undefined to the solver which effectively implies they are entirely user controlled and can therefore be assigned...
@type r_model: Dict @param r_model: A dictionary mapping registers to concrete values. Any registers not described in this dict will be described as undefined to the solver which effectively implies they are entirely user controlled and can therefore be assigned...
[ "@type", "r_model", ":", "Dict", "@param", "r_model", ":", "A", "dictionary", "mapping", "registers", "to", "concrete", "values", ".", "Any", "registers", "not", "described", "in", "this", "dict", "will", "be", "described", "as", "undefined", "to", "the", "s...
def __init__(self, imm, r_model=None, f_model=None, m_model=False, analysis_mods=[], simplifyState=True, queryTimeout=0, prettysolver=False): """ @type r_model: Dict @param r_model: A dictionary mapping registers to concrete values. Any registers not described in th...
[ "def", "__init__", "(", "self", ",", "imm", ",", "r_model", "=", "None", ",", "f_model", "=", "None", ",", "m_model", "=", "False", ",", "analysis_mods", "=", "[", "]", ",", "simplifyState", "=", "True", ",", "queryTimeout", "=", "0", ",", "prettysolve...
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.84/Libs/x86smt/sequenceanalyzer.py#L791-L865
nanoporetech/tombo
afdb4d87249806d3a171d009f948f5b8558d35a0
tombo/_filter_reads.py
python
filter_reads_for_signal_matching
(fast5s_dir, corr_grp, sig_match_thresh)
return
Filter reads based on observed to expected signal matching score
Filter reads based on observed to expected signal matching score
[ "Filter", "reads", "based", "on", "observed", "to", "expected", "signal", "matching", "score" ]
def filter_reads_for_signal_matching(fast5s_dir, corr_grp, sig_match_thresh): """Filter reads based on observed to expected signal matching score """ def read_fails_matching_score(fast5_fn, corr_group): try: with h5py.File(fast5_fn, 'r') as fast5_data: return fast5_data['...
[ "def", "filter_reads_for_signal_matching", "(", "fast5s_dir", ",", "corr_grp", ",", "sig_match_thresh", ")", ":", "def", "read_fails_matching_score", "(", "fast5_fn", ",", "corr_group", ")", ":", "try", ":", "with", "h5py", ".", "File", "(", "fast5_fn", ",", "'r...
https://github.com/nanoporetech/tombo/blob/afdb4d87249806d3a171d009f948f5b8558d35a0/tombo/_filter_reads.py#L196-L235
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/common/validators.py
python
ValidatorBase.validate
(self, json_data, parent_schema=None)
Validate the input JSON. :param json_data: JSON to validate against this class' internal schema. :param parent_schema: Name of the parent schema to this schema. :returns: dict -- JSON content, post-validation and : normalization/defaulting. :raises: schema.Valida...
Validate the input JSON.
[ "Validate", "the", "input", "JSON", "." ]
def validate(self, json_data, parent_schema=None): """Validate the input JSON. :param json_data: JSON to validate against this class' internal schema. :param parent_schema: Name of the parent schema to this schema. :returns: dict -- JSON content, post-validation and : ...
[ "def", "validate", "(", "self", ",", "json_data", ",", "parent_schema", "=", "None", ")", ":" ]
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/common/validators.py#L95-L104
grnet/synnefo
d06ec8c7871092131cdaabf6b03ed0b504c93e43
snf-cyclades-app/synnefo/db/migrations/old/0037_network_migration.py
python
Migration.backwards
(self, orm)
Write your backwards methods here.
Write your backwards methods here.
[ "Write", "your", "backwards", "methods", "here", "." ]
def backwards(self, orm): "Write your backwards methods here." pass
[ "def", "backwards", "(", "self", ",", "orm", ")", ":", "pass" ]
https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-cyclades-app/synnefo/db/migrations/old/0037_network_migration.py#L52-L54
ospalh/anki-addons
4ece13423bd541e29d9b40ebe26ca0999a6962b1
downloadaudio/download.py
python
do_download
(note, field_data_list, language, hide_text=False)
Download audio data. Go through the list of words and list of sites and download each word from each site. Then call a function that asks the user what to do.
Download audio data.
[ "Download", "audio", "data", "." ]
def do_download(note, field_data_list, language, hide_text=False): """ Download audio data. Go through the list of words and list of sites and download each word from each site. Then call a function that asks the user what to do. """ retrieved_entries = [] for field_data in field_data_l...
[ "def", "do_download", "(", "note", ",", "field_data_list", ",", "language", ",", "hide_text", "=", "False", ")", ":", "retrieved_entries", "=", "[", "]", "for", "field_data", "in", "field_data_list", ":", "if", "field_data", ".", "empty", ":", "continue", "f...
https://github.com/ospalh/anki-addons/blob/4ece13423bd541e29d9b40ebe26ca0999a6962b1/downloadaudio/download.py#L62-L123
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/idlelib/SearchEngine.py
python
search_reverse
(prog, chars, col)
return found
Search backwards and return an re match object or None. This is done by searching forwards until there is no match. Prog: compiled re object with a search method returning a match. Chars: line of text, without \\n. Col: stop index for the search; the limit for match.end().
Search backwards and return an re match object or None.
[ "Search", "backwards", "and", "return", "an", "re", "match", "object", "or", "None", "." ]
def search_reverse(prog, chars, col): '''Search backwards and return an re match object or None. This is done by searching forwards until there is no match. Prog: compiled re object with a search method returning a match. Chars: line of text, without \\n. Col: stop index for the search; the limit f...
[ "def", "search_reverse", "(", "prog", ",", "chars", ",", "col", ")", ":", "m", "=", "prog", ".", "search", "(", "chars", ")", "if", "not", "m", ":", "return", "None", "found", "=", "None", "i", ",", "j", "=", "m", ".", "span", "(", ")", "# m.st...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/idlelib/SearchEngine.py#L189-L210
cduck/drawSvg
c9aaa230f54091774ba033b7aa57b791c0b0232a
drawSvg/animation.py
python
animate_video
(out_file, draw_func=None, jupyter=False, **video_args)
return AnimationContext(draw_func=draw_func, out_file=out_file, jupyter=jupyter, video_args=video_args)
Returns a context manager that stores frames and saves a video when the context exits. Example: ``` with animate_video('video.mp4') as anim: while True: ... anim.draw_frame(...) ```
Returns a context manager that stores frames and saves a video when the context exits.
[ "Returns", "a", "context", "manager", "that", "stores", "frames", "and", "saves", "a", "video", "when", "the", "context", "exits", "." ]
def animate_video(out_file, draw_func=None, jupyter=False, **video_args): ''' Returns a context manager that stores frames and saves a video when the context exits. Example: ``` with animate_video('video.mp4') as anim: while True: ... anim.draw_frame(...) ```...
[ "def", "animate_video", "(", "out_file", ",", "draw_func", "=", "None", ",", "jupyter", "=", "False", ",", "*", "*", "video_args", ")", ":", "return", "AnimationContext", "(", "draw_func", "=", "draw_func", ",", "out_file", "=", "out_file", ",", "jupyter", ...
https://github.com/cduck/drawSvg/blob/c9aaa230f54091774ba033b7aa57b791c0b0232a/drawSvg/animation.py#L73-L87
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/flask/blueprints.py
python
Blueprint.app_context_processor
(self, f)
return f
Like :meth:`Flask.context_processor` but for a blueprint. Such a function is executed each request, even if outside of the blueprint.
Like :meth:`Flask.context_processor` but for a blueprint. Such a function is executed each request, even if outside of the blueprint.
[ "Like", ":", "meth", ":", "Flask", ".", "context_processor", "but", "for", "a", "blueprint", ".", "Such", "a", "function", "is", "executed", "each", "request", "even", "if", "outside", "of", "the", "blueprint", "." ]
def app_context_processor(self, f): """Like :meth:`Flask.context_processor` but for a blueprint. Such a function is executed each request, even if outside of the blueprint. """ self.record_once(lambda s: s.app.template_context_processors .setdefault(None, []).append(f)) ...
[ "def", "app_context_processor", "(", "self", ",", "f", ")", ":", "self", ".", "record_once", "(", "lambda", "s", ":", "s", ".", "app", ".", "template_context_processors", ".", "setdefault", "(", "None", ",", "[", "]", ")", ".", "append", "(", "f", ")",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/flask/blueprints.py#L373-L379
davidmcclure/open-syllabus-project
078cfd4c5a257fbfb0901d43bfbc6350824eed4e
osp/www/utils/facets.py
python
bootstrap_facets
()
return dict( corpus = corpus_facets(), subfield = subfield_facets(), field = field_facets(), state = state_facets(), country = country_facets(), )
Bootstrap all facets for the front-end.
Bootstrap all facets for the front-end.
[ "Bootstrap", "all", "facets", "for", "the", "front", "-", "end", "." ]
def bootstrap_facets(): """ Bootstrap all facets for the front-end. """ return dict( corpus = corpus_facets(), subfield = subfield_facets(), field = field_facets(), state = state_facets(), country = country_facets(), )
[ "def", "bootstrap_facets", "(", ")", ":", "return", "dict", "(", "corpus", "=", "corpus_facets", "(", ")", ",", "subfield", "=", "subfield_facets", "(", ")", ",", "field", "=", "field_facets", "(", ")", ",", "state", "=", "state_facets", "(", ")", ",", ...
https://github.com/davidmcclure/open-syllabus-project/blob/078cfd4c5a257fbfb0901d43bfbc6350824eed4e/osp/www/utils/facets.py#L101-L113
ThilinaRajapakse/simpletransformers
9323c0398baea0157044e080617b2c4be59de7a9
simpletransformers/question_answering/question_answering_utils.py
python
write_predictions
( all_examples, all_features, all_results, n_best_size, max_answer_length, do_lower_case, output_prediction_file, output_nbest_file, output_null_log_odds_file, verbose_logging, version_2_with_negative, null_score_diff_threshold, )
return all_predictions, all_nbest_json, scores_diff_json
Write final predictions to the json file and log-odds of null if needed.
Write final predictions to the json file and log-odds of null if needed.
[ "Write", "final", "predictions", "to", "the", "json", "file", "and", "log", "-", "odds", "of", "null", "if", "needed", "." ]
def write_predictions( all_examples, all_features, all_results, n_best_size, max_answer_length, do_lower_case, output_prediction_file, output_nbest_file, output_null_log_odds_file, verbose_logging, version_2_with_negative, null_score_diff_threshold, ): """Write final ...
[ "def", "write_predictions", "(", "all_examples", ",", "all_features", ",", "all_results", ",", "n_best_size", ",", "max_answer_length", ",", "do_lower_case", ",", "output_prediction_file", ",", "output_nbest_file", ",", "output_null_log_odds_file", ",", "verbose_logging", ...
https://github.com/ThilinaRajapakse/simpletransformers/blob/9323c0398baea0157044e080617b2c4be59de7a9/simpletransformers/question_answering/question_answering_utils.py#L915-L1130
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tione/v20191022/models.py
python
VpcConfig.__init__
(self)
r""" :param SecurityGroupIds: 安全组id 注意:此字段可能返回 null,表示取不到有效值。 :type SecurityGroupIds: list of str :param SubnetId: 子网id 注意:此字段可能返回 null,表示取不到有效值。 :type SubnetId: str
r""" :param SecurityGroupIds: 安全组id 注意:此字段可能返回 null,表示取不到有效值。 :type SecurityGroupIds: list of str :param SubnetId: 子网id 注意:此字段可能返回 null,表示取不到有效值。 :type SubnetId: str
[ "r", ":", "param", "SecurityGroupIds", ":", "安全组id", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "SecurityGroupIds", ":", "list", "of", "str", ":", "param", "SubnetId", ":", "子网id", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "SubnetId", ":", "str" ]
def __init__(self): r""" :param SecurityGroupIds: 安全组id 注意:此字段可能返回 null,表示取不到有效值。 :type SecurityGroupIds: list of str :param SubnetId: 子网id 注意:此字段可能返回 null,表示取不到有效值。 :type SubnetId: str """ self.SecurityGroupIds = None self.SubnetId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "SecurityGroupIds", "=", "None", "self", ".", "SubnetId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tione/v20191022/models.py#L2462-L2472
PyHDI/Pyverilog
2a42539bebd1b4587ee577d491ff002d0cc7295d
pyverilog/vparser/parser.py
python
VerilogParser.p_expression_minus
(self, p)
expression : expression MINUS expression
expression : expression MINUS expression
[ "expression", ":", "expression", "MINUS", "expression" ]
def p_expression_minus(self, p): 'expression : expression MINUS expression' p[0] = Minus(p[1], p[3], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
[ "def", "p_expression_minus", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "Minus", "(", "p", "[", "1", "]", ",", "p", "[", "3", "]", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ")", "p", ".", "set_lineno", "(", "0", ...
https://github.com/PyHDI/Pyverilog/blob/2a42539bebd1b4587ee577d491ff002d0cc7295d/pyverilog/vparser/parser.py#L1028-L1031
HunterMcGushion/hyperparameter_hunter
28b1d48e01a993818510811b82a677e0a7a232b2
hyperparameter_hunter/space/space_core.py
python
Space.rvs
(self, n_samples=1, random_state=None)
return rows
Draw random samples. Samples are in the original (untransformed) space. They must be transformed before being passed to a model or minimizer via :meth:`transform` Parameters ---------- n_samples: Int, default=1 Number of samples to be drawn from the space random_stat...
Draw random samples. Samples are in the original (untransformed) space. They must be transformed before being passed to a model or minimizer via :meth:`transform`
[ "Draw", "random", "samples", ".", "Samples", "are", "in", "the", "original", "(", "untransformed", ")", "space", ".", "They", "must", "be", "transformed", "before", "being", "passed", "to", "a", "model", "or", "minimizer", "via", ":", "meth", ":", "transfo...
def rvs(self, n_samples=1, random_state=None): """Draw random samples. Samples are in the original (untransformed) space. They must be transformed before being passed to a model or minimizer via :meth:`transform` Parameters ---------- n_samples: Int, default=1 Number...
[ "def", "rvs", "(", "self", ",", "n_samples", "=", "1", ",", "random_state", "=", "None", ")", ":", "rng", "=", "check_random_state", "(", "random_state", ")", "#################### Draw ####################", "columns", "=", "[", "]", "for", "dim", "in", "self...
https://github.com/HunterMcGushion/hyperparameter_hunter/blob/28b1d48e01a993818510811b82a677e0a7a232b2/hyperparameter_hunter/space/space_core.py#L178-L221
mylar3/mylar3
fce4771c5b627f8de6868dd4ab6bc53f7b22d303
lib/transmissionrpc/torrent.py
python
Torrent._get_seed_idle_limit
(self)
return self._fields['seedIdleLimit'].value
Get the seed idle limit in minutes.
Get the seed idle limit in minutes.
[ "Get", "the", "seed", "idle", "limit", "in", "minutes", "." ]
def _get_seed_idle_limit(self): """ Get the seed idle limit in minutes. """ return self._fields['seedIdleLimit'].value
[ "def", "_get_seed_idle_limit", "(", "self", ")", ":", "return", "self", ".", "_fields", "[", "'seedIdleLimit'", "]", ".", "value" ]
https://github.com/mylar3/mylar3/blob/fce4771c5b627f8de6868dd4ab6bc53f7b22d303/lib/transmissionrpc/torrent.py#L312-L316
epiception/CalibNet
a4ae349867d6bbf13a4add671b1cb2636eb29e6f
code/utils/pointnet_util.py
python
sample_and_group
(npoint, radius, nsample, xyz, points, tnet_spec=None, knn=False, use_xyz=True)
return new_xyz, new_points, idx, grouped_xyz
Input: npoint: int32 radius: float32 nsample: int32 xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points tnet_spec: dict (keys: mlp, mlp2, is_training, bn_decay), if None do not apply tnet ...
Input: npoint: int32 radius: float32 nsample: int32 xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use xyz as points tnet_spec: dict (keys: mlp, mlp2, is_training, bn_decay), if None do not apply tnet ...
[ "Input", ":", "npoint", ":", "int32", "radius", ":", "float32", "nsample", ":", "int32", "xyz", ":", "(", "batch_size", "ndataset", "3", ")", "TF", "tensor", "points", ":", "(", "batch_size", "ndataset", "channel", ")", "TF", "tensor", "if", "None", "wil...
def sample_and_group(npoint, radius, nsample, xyz, points, tnet_spec=None, knn=False, use_xyz=True): ''' Input: npoint: int32 radius: float32 nsample: int32 xyz: (batch_size, ndataset, 3) TF tensor points: (batch_size, ndataset, channel) TF tensor, if None will just use x...
[ "def", "sample_and_group", "(", "npoint", ",", "radius", ",", "nsample", ",", "xyz", ",", "points", ",", "tnet_spec", "=", "None", ",", "knn", "=", "False", ",", "use_xyz", "=", "True", ")", ":", "new_xyz", "=", "gather_point", "(", "xyz", ",", "farthe...
https://github.com/epiception/CalibNet/blob/a4ae349867d6bbf13a4add671b1cb2636eb29e6f/code/utils/pointnet_util.py#L16-L64
d2l-ai/d2l-en
39a7d4174534740b2387b0dc5eb22f409b82ee10
d2l/torch.py
python
masked_softmax
(X, valid_lens)
Perform softmax operation by masking elements on the last axis. Defined in :numref:`sec_attention-scoring-functions`
Perform softmax operation by masking elements on the last axis.
[ "Perform", "softmax", "operation", "by", "masking", "elements", "on", "the", "last", "axis", "." ]
def masked_softmax(X, valid_lens): """Perform softmax operation by masking elements on the last axis. Defined in :numref:`sec_attention-scoring-functions`""" # `X`: 3D tensor, `valid_lens`: 1D or 2D tensor if valid_lens is None: return nn.functional.softmax(X, dim=-1) else: shape = ...
[ "def", "masked_softmax", "(", "X", ",", "valid_lens", ")", ":", "# `X`: 3D tensor, `valid_lens`: 1D or 2D tensor", "if", "valid_lens", "is", "None", ":", "return", "nn", ".", "functional", ".", "softmax", "(", "X", ",", "dim", "=", "-", "1", ")", "else", ":"...
https://github.com/d2l-ai/d2l-en/blob/39a7d4174534740b2387b0dc5eb22f409b82ee10/d2l/torch.py#L957-L974
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/logging/__init__.py
python
Logger.findCaller
(self, stack_info=False)
return rv
Find the stack frame of the caller so that we can note the source file name, line number and function name.
Find the stack frame of the caller so that we can note the source file name, line number and function name.
[ "Find", "the", "stack", "frame", "of", "the", "caller", "so", "that", "we", "can", "note", "the", "source", "file", "name", "line", "number", "and", "function", "name", "." ]
def findCaller(self, stack_info=False): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ f = currentframe() #On some versions of IronPython, currentframe() returns None if #IronPython isn't run wit...
[ "def", "findCaller", "(", "self", ",", "stack_info", "=", "False", ")", ":", "f", "=", "currentframe", "(", ")", "#On some versions of IronPython, currentframe() returns None if", "#IronPython isn't run with -X:Frames.", "if", "f", "is", "not", "None", ":", "f", "=", ...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/logging/__init__.py#L1347-L1375
choasup/SIN
4851efb7b1c64180026e51ab8abcd95265c0602c
lib/datasets/kitti_tracking.py
python
kitti_tracking._get_default_path
(self)
return os.path.join(datasets.ROOT_DIR, 'data', 'KITTI_Tracking')
Return the default path where kitti_tracking is expected to be installed.
Return the default path where kitti_tracking is expected to be installed.
[ "Return", "the", "default", "path", "where", "kitti_tracking", "is", "expected", "to", "be", "installed", "." ]
def _get_default_path(self): """ Return the default path where kitti_tracking is expected to be installed. """ return os.path.join(datasets.ROOT_DIR, 'data', 'KITTI_Tracking')
[ "def", "_get_default_path", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "datasets", ".", "ROOT_DIR", ",", "'data'", ",", "'KITTI_Tracking'", ")" ]
https://github.com/choasup/SIN/blob/4851efb7b1c64180026e51ab8abcd95265c0602c/lib/datasets/kitti_tracking.py#L126-L130
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/packages/linux/all/usniper.py
python
start
(path, addr, reg='ax', ret=False, cast=None, argtype='chr', event_id=None)
return pupy.manager.create( USniper, path, addr, reg, ret, cast, argtype, event_id=event_id ) is not None
[]
def start(path, addr, reg='ax', ret=False, cast=None, argtype='chr', event_id=None): try: if pupy.manager.active(USniper): return False except: try: pupy.manager.stop(USniper) except: pass if argtype and hasattr(builtins, argtype): argtype...
[ "def", "start", "(", "path", ",", "addr", ",", "reg", "=", "'ax'", ",", "ret", "=", "False", ",", "cast", "=", "None", ",", "argtype", "=", "'chr'", ",", "event_id", "=", "None", ")", ":", "try", ":", "if", "pupy", ".", "manager", ".", "active", ...
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/linux/all/usniper.py#L189-L207
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/compilers/mixins/arm.py
python
ArmclangCompiler.compute_parameters_with_absolute_paths
(self, parameter_list: T.List[str], build_dir: str)
return parameter_list
[]
def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]: for idx, i in enumerate(parameter_list): if i[:2] == '-I' or i[:2] == '-L': parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:])) return par...
[ "def", "compute_parameters_with_absolute_paths", "(", "self", ",", "parameter_list", ":", "T", ".", "List", "[", "str", "]", ",", "build_dir", ":", "str", ")", "->", "T", ".", "List", "[", "str", "]", ":", "for", "idx", ",", "i", "in", "enumerate", "("...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/compilers/mixins/arm.py#L185-L190
xflr6/graphviz
b764c3a3a62fc3b514ce4866a179819b377bad90
graphviz/_tools.py
python
mkdirs
(filename, *, mode: int = 0o777)
Recursively create directories up to the path of ``filename`` as needed.
Recursively create directories up to the path of ``filename`` as needed.
[ "Recursively", "create", "directories", "up", "to", "the", "path", "of", "filename", "as", "needed", "." ]
def mkdirs(filename, *, mode: int = 0o777) -> None: """Recursively create directories up to the path of ``filename`` as needed.""" dirname = os.path.dirname(filename) if not dirname: return log.debug('os.makedirs(%r)', dirname) os.makedirs(dirname, mode=mode, exist_ok=True)
[ "def", "mkdirs", "(", "filename", ",", "*", ",", "mode", ":", "int", "=", "0o777", ")", "->", "None", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "filename", ")", "if", "not", "dirname", ":", "return", "log", ".", "debug", "(", "...
https://github.com/xflr6/graphviz/blob/b764c3a3a62fc3b514ce4866a179819b377bad90/graphviz/_tools.py#L42-L49
CCExtractor/vardbg
8baabb93d2e8afccc5ee837bd8301a5f765635c2
vardbg/output/video_writer/text_format.py
python
_irepr_dict
(painter, dct, highlight_key=None, *args, **kwargs)
return elem_pos
[]
def _irepr_dict(painter, dct, highlight_key=None, *args, **kwargs): # Initialize state painter.write("{") elem_pos = None for idx, (key, elem) in enumerate(dct.items()): # Add comma separator if this isn't the first element if idx > 0: painter.write(", ") # Add key ...
[ "def", "_irepr_dict", "(", "painter", ",", "dct", ",", "highlight_key", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Initialize state", "painter", ".", "write", "(", "\"{\"", ")", "elem_pos", "=", "None", "for", "idx", ",", "(",...
https://github.com/CCExtractor/vardbg/blob/8baabb93d2e8afccc5ee837bd8301a5f765635c2/vardbg/output/video_writer/text_format.py#L32-L60
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/views/decorators/debug.py
python
sensitive_post_parameters
(*parameters)
return decorator
Indicate which POST parameters used in the decorated view are sensitive, so that those parameters can later be treated in a special way, for example by hiding them when logging unhandled exceptions. Accept two forms: * with specified parameters: @sensitive_post_parameters('password', 'credit_...
Indicate which POST parameters used in the decorated view are sensitive, so that those parameters can later be treated in a special way, for example by hiding them when logging unhandled exceptions.
[ "Indicate", "which", "POST", "parameters", "used", "in", "the", "decorated", "view", "are", "sensitive", "so", "that", "those", "parameters", "can", "later", "be", "treated", "in", "a", "special", "way", "for", "example", "by", "hiding", "them", "when", "log...
def sensitive_post_parameters(*parameters): """ Indicate which POST parameters used in the decorated view are sensitive, so that those parameters can later be treated in a special way, for example by hiding them when logging unhandled exceptions. Accept two forms: * with specified parameters: ...
[ "def", "sensitive_post_parameters", "(", "*", "parameters", ")", ":", "if", "len", "(", "parameters", ")", "==", "1", "and", "callable", "(", "parameters", "[", "0", "]", ")", ":", "raise", "TypeError", "(", "'sensitive_post_parameters() must be called to use it a...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/views/decorators/debug.py#L47-L92
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/clients/config.py
python
ClientConfigurationData.storage
(self)
return self._storage
[]
def storage(self): return self._storage
[ "def", "storage", "(", "self", ")", ":", "return", "self", ".", "_storage" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/clients/config.py#L68-L69
horstjens/ThePythonGameBook
e9be46cb519c65379c0d2c59d6434f2fa61b1232
en/pygame/003_static_blit_pretty_template_005.py
python
FlyingObject.wallcheck
(self)
check if Sprite is touching screen edge
check if Sprite is touching screen edge
[ "check", "if", "Sprite", "is", "touching", "screen", "edge" ]
def wallcheck(self): """check if Sprite is touching screen edge""" if self.kill_on_edge: if self.pos[0] - self.width // 2 < 0 or self.pos[1] - self.height // 2 < 0 or self.pos[0] + self.width //2 > PygView.width or self.pos[1] + self.height // 2 > PygView.height: self.kill...
[ "def", "wallcheck", "(", "self", ")", ":", "if", "self", ".", "kill_on_edge", ":", "if", "self", ".", "pos", "[", "0", "]", "-", "self", ".", "width", "//", "2", "<", "0", "or", "self", ".", "pos", "[", "1", "]", "-", "self", ".", "height", "...
https://github.com/horstjens/ThePythonGameBook/blob/e9be46cb519c65379c0d2c59d6434f2fa61b1232/en/pygame/003_static_blit_pretty_template_005.py#L134-L149
shiyanlou/louplus-python
4c61697259e286e3d9116c3299f170d019ba3767
Python 进阶挑战(旧)/05-income-tax-calculator-use-modules/calculator.py
python
Config.social_insurance_baseline_low
(self)
return self._get_config('JiShuL')
获取社保基数下限
获取社保基数下限
[ "获取社保基数下限" ]
def social_insurance_baseline_low(self): """ 获取社保基数下限 """ return self._get_config('JiShuL')
[ "def", "social_insurance_baseline_low", "(", "self", ")", ":", "return", "self", ".", "_get_config", "(", "'JiShuL'", ")" ]
https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/Python 进阶挑战(旧)/05-income-tax-calculator-use-modules/calculator.py#L147-L152
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/view/citationtreeview.py
python
CitationTreeView.get_default_gramplets
(self)
return (("Citation Filter",), ("Citation Gallery", "Citation Notes", "Citation Backlinks"))
Define the default gramplets for the sidebar and bottombar.
Define the default gramplets for the sidebar and bottombar.
[ "Define", "the", "default", "gramplets", "for", "the", "sidebar", "and", "bottombar", "." ]
def get_default_gramplets(self): """ Define the default gramplets for the sidebar and bottombar. """ return (("Citation Filter",), ("Citation Gallery", "Citation Notes", "Citation Backlinks"))
[ "def", "get_default_gramplets", "(", "self", ")", ":", "return", "(", "(", "\"Citation Filter\"", ",", ")", ",", "(", "\"Citation Gallery\"", ",", "\"Citation Notes\"", ",", "\"Citation Backlinks\"", ")", ")" ]
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/view/citationtreeview.py#L757-L764
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/plat-unixware7/IN.py
python
GET_TIME
(timep)
return
[]
def GET_TIME(timep): return
[ "def", "GET_TIME", "(", "timep", ")", ":", "return" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-unixware7/IN.py#L426-L426
michaelliao/sinaweibopy
eb5298ad84ea774bf2006f28b6158a9a05d723e5
weibo.py
python
_Executable.__call__
(self, **kw)
return _http_call('%s%s.json' % (self._client.api_url, self._path), method, self._client.access_token, **kw)
[]
def __call__(self, **kw): method = _METHOD_MAP[self._method] if method == _HTTP_POST and 'pic' in kw: method = _HTTP_UPLOAD return _http_call('%s%s.json' % (self._client.api_url, self._path), method, self._client.access_token, **kw)
[ "def", "__call__", "(", "self", ",", "*", "*", "kw", ")", ":", "method", "=", "_METHOD_MAP", "[", "self", ".", "_method", "]", "if", "method", "==", "_HTTP_POST", "and", "'pic'", "in", "kw", ":", "method", "=", "_HTTP_UPLOAD", "return", "_http_call", "...
https://github.com/michaelliao/sinaweibopy/blob/eb5298ad84ea774bf2006f28b6158a9a05d723e5/weibo.py#L323-L327
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/interpreter/dependencyfallbacks.py
python
DependencyFallbacksHolder._get_cached_dep
(self, name: str, kwargs: TYPE_nkwargs)
return None
[]
def _get_cached_dep(self, name: str, kwargs: TYPE_nkwargs) -> T.Optional[Dependency]: # Unlike other methods, this one returns not-found dependency instead # of None in the case the dependency is cached as not-found, or if cached # version does not match. In that case we don't want to continue w...
[ "def", "_get_cached_dep", "(", "self", ",", "name", ":", "str", ",", "kwargs", ":", "TYPE_nkwargs", ")", "->", "T", ".", "Optional", "[", "Dependency", "]", ":", "# Unlike other methods, this one returns not-found dependency instead", "# of None in the case the dependency...
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/interpreter/dependencyfallbacks.py#L195-L237
hupili/snsapi
129529b89f38cbee253a23e5ed31dae2a0ea4254
snsapi/third/twitter.py
python
User.NewFromJsonDict
(data)
return User(id=data.get('id', None), name=data.get('name', None), screen_name=data.get('screen_name', None), location=data.get('location', None), description=data.get('description', None), statuses_count=data.get('statuses_count', None), ...
Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.User instance
Create a new instance based on a JSON dict.
[ "Create", "a", "new", "instance", "based", "on", "a", "JSON", "dict", "." ]
def NewFromJsonDict(data): '''Create a new instance based on a JSON dict. Args: data: A JSON dict, as converted from the JSON in the twitter API Returns: A twitter.User instance ''' if 'status' in data: status = Status.NewFromJsonDict(data['status']) else: statu...
[ "def", "NewFromJsonDict", "(", "data", ")", ":", "if", "'status'", "in", "data", ":", "status", "=", "Status", ".", "NewFromJsonDict", "(", "data", "[", "'status'", "]", ")", "else", ":", "status", "=", "None", "return", "User", "(", "id", "=", "data",...
https://github.com/hupili/snsapi/blob/129529b89f38cbee253a23e5ed31dae2a0ea4254/snsapi/third/twitter.py#L1468-L1509
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/period.py
python
PeriodIndex.dtype_str
(self)
return self.inferred_type
return the dtype str of the underlying data
return the dtype str of the underlying data
[ "return", "the", "dtype", "str", "of", "the", "underlying", "data" ]
def dtype_str(self): """ return the dtype str of the underlying data """ return self.inferred_type
[ "def", "dtype_str", "(", "self", ")", ":", "return", "self", ".", "inferred_type" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/tseries/period.py#L586-L588
MozillaSecurity/grizzly
1c41478e32f323189a2c322ec041c3e0902a158a
grizzly/target/assets.py
python
AssetManager.__exit__
(self, *exc)
[]
def __exit__(self, *exc): self.cleanup()
[ "def", "__exit__", "(", "self", ",", "*", "exc", ")", ":", "self", ".", "cleanup", "(", ")" ]
https://github.com/MozillaSecurity/grizzly/blob/1c41478e32f323189a2c322ec041c3e0902a158a/grizzly/target/assets.py#L33-L34
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/multiprocessing/managers.py
python
Server.accepter
(self)
[]
def accepter(self): while True: try: c = self.listener.accept() except OSError: continue t = threading.Thread(target=self.handle_request, args=(c,)) t.daemon = True t.start()
[ "def", "accepter", "(", "self", ")", ":", "while", "True", ":", "try", ":", "c", "=", "self", ".", "listener", ".", "accept", "(", ")", "except", "OSError", ":", "continue", "t", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "ha...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/multiprocessing/managers.py#L169-L177
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/maps/hpx/utils.py
python
parse_hpxregion
(region)
Parse the ``HPX_REG`` header keyword into a list of tokens.
Parse the ``HPX_REG`` header keyword into a list of tokens.
[ "Parse", "the", "HPX_REG", "header", "keyword", "into", "a", "list", "of", "tokens", "." ]
def parse_hpxregion(region): """Parse the ``HPX_REG`` header keyword into a list of tokens.""" m = re.match(r"([A-Za-z\_]*?)\((.*?)\)", region) if m is None: raise ValueError(f"Failed to parse hpx region string: {region!r}") if not m.group(1): return re.split(",", m.group(2)) else:...
[ "def", "parse_hpxregion", "(", "region", ")", ":", "m", "=", "re", ".", "match", "(", "r\"([A-Za-z\\_]*?)\\((.*?)\\)\"", ",", "region", ")", "if", "m", "is", "None", ":", "raise", "ValueError", "(", "f\"Failed to parse hpx region string: {region!r}\"", ")", "if", ...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/maps/hpx/utils.py#L128-L138
cylc/cylc-flow
5ec221143476c7c616c156b74158edfbcd83794a
cylc/flow/exceptions.py
python
HostSelectException.__str__
(self)
return ret
[]
def __str__(self): ret = 'Could not select host from:' for host, data in sorted(self.data.items()): ret += f'\n {host}:' for key, value in data.items(): ret += f'\n {key}: {value}' return ret
[ "def", "__str__", "(", "self", ")", ":", "ret", "=", "'Could not select host from:'", "for", "host", ",", "data", "in", "sorted", "(", "self", ".", "data", ".", "items", "(", ")", ")", ":", "ret", "+=", "f'\\n {host}:'", "for", "key", ",", "value", ...
https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/exceptions.py#L314-L320
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/docutils/statemachine.py
python
_exception_data
()
return (type.__name__, value, code.co_filename, traceback.tb_lineno, code.co_name)
Return exception information: - the exception's class name; - the exception object; - the name of the file containing the offending code; - the line number of the offending code; - the function name of the offending code.
Return exception information:
[ "Return", "exception", "information", ":" ]
def _exception_data(): """ Return exception information: - the exception's class name; - the exception object; - the name of the file containing the offending code; - the line number of the offending code; - the function name of the offending code. """ type, value, traceback = sys.e...
[ "def", "_exception_data", "(", ")", ":", "type", ",", "value", ",", "traceback", "=", "sys", ".", "exc_info", "(", ")", "while", "traceback", ".", "tb_next", ":", "traceback", "=", "traceback", ".", "tb_next", "code", "=", "traceback", ".", "tb_frame", "...
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/statemachine.py#L1523-L1538
bashtage/arch
05fcc86500603352fb3e6035230a83d99e07fdc1
arch/univariate/distribution.py
python
Distribution.parameter_names
(self)
Names of distribution shape parameters Returns ------- names : list (str) Parameter names
Names of distribution shape parameters
[ "Names", "of", "distribution", "shape", "parameters" ]
def parameter_names(self) -> List[str]: """ Names of distribution shape parameters Returns ------- names : list (str) Parameter names """
[ "def", "parameter_names", "(", "self", ")", "->", "List", "[", "str", "]", ":" ]
https://github.com/bashtage/arch/blob/05fcc86500603352fb3e6035230a83d99e07fdc1/arch/univariate/distribution.py#L253-L261
conda/conda-build
2a19925f2b2ca188f80ffa625cd783e7d403793f
conda_build/jinja_context.py
python
compiler
(language, config, permit_undefined_jinja=False)
return compiler
Support configuration of compilers. This is somewhat platform specific. Native compilers never list their host - it is always implied. Generally, they are metapackages, pointing at a package that does specify the host. These in turn may be metapackages, pointing at a package where the host is the same a...
Support configuration of compilers. This is somewhat platform specific.
[ "Support", "configuration", "of", "compilers", ".", "This", "is", "somewhat", "platform", "specific", "." ]
def compiler(language, config, permit_undefined_jinja=False): """Support configuration of compilers. This is somewhat platform specific. Native compilers never list their host - it is always implied. Generally, they are metapackages, pointing at a package that does specify the host. These in turn may be...
[ "def", "compiler", "(", "language", ",", "config", ",", "permit_undefined_jinja", "=", "False", ")", ":", "compiler", "=", "native_compiler", "(", "language", ",", "config", ")", "version", "=", "None", "if", "config", ".", "variant", ":", "target_platform", ...
https://github.com/conda/conda-build/blob/2a19925f2b2ca188f80ffa625cd783e7d403793f/conda_build/jinja_context.py#L349-L376
lululxvi/deepxde
730c97282636e86c845ce2ba3253482f2178469e
deepxde/data/sampler.py
python
BatchSampler.epochs_completed
(self)
return self._epochs_completed
[]
def epochs_completed(self): return self._epochs_completed
[ "def", "epochs_completed", "(", "self", ")", ":", "return", "self", ".", "_epochs_completed" ]
https://github.com/lululxvi/deepxde/blob/730c97282636e86c845ce2ba3253482f2178469e/deepxde/data/sampler.py#L39-L40
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/spx/sphinxapi.py
python
SphinxClient._GetResponse
(self, sock, client_ver)
return response
INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server.
INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server.
[ "INTERNAL", "METHOD", "DO", "NOT", "CALL", ".", "Gets", "and", "checks", "response", "packet", "from", "searchd", "server", "." ]
def _GetResponse (self, sock, client_ver): """ INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server. """ (status, ver, length) = unpack('>2HL', sock.recv(8)) response = '' left = length while left>0: chunk = sock.recv(left) if chunk: response += chunk left -= len...
[ "def", "_GetResponse", "(", "self", ",", "sock", ",", "client_ver", ")", ":", "(", "status", ",", "ver", ",", "length", ")", "=", "unpack", "(", "'>2HL'", ",", "sock", ".", "recv", "(", "8", ")", ")", "response", "=", "''", "left", "=", "length", ...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/spx/sphinxapi.py#L216-L267
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/Traps/Integrations/PaloAltoNetworks_Traps/PaloAltoNetworks_Traps.py
python
extract_and_validate_http_response
(response, operation_err_message, test=False)
Args: response: raw response operation_err_message: error message to present in case of error test: boolean value, true if test Returns: Error if response is faulty.
[]
def extract_and_validate_http_response(response, operation_err_message, test=False): """ Args: response: raw response operation_err_message: error message to present in case of error test: boolean value, true if test Returns: Error if response is faulty. """ try: ...
[ "def", "extract_and_validate_http_response", "(", "response", ",", "operation_err_message", ",", "test", "=", "False", ")", ":", "try", ":", "response", ".", "raise_for_status", "(", ")", "return", "response", ".", "json", "(", ")", "if", "not", "test", "else"...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Traps/Integrations/PaloAltoNetworks_Traps/PaloAltoNetworks_Traps.py#L88-L111
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/ip_messaging/v2/service/channel/webhook.py
python
WebhookInstance.sid
(self)
return self._properties['sid']
:returns: The sid :rtype: unicode
:returns: The sid :rtype: unicode
[ ":", "returns", ":", "The", "sid", ":", "rtype", ":", "unicode" ]
def sid(self): """ :returns: The sid :rtype: unicode """ return self._properties['sid']
[ "def", "sid", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'sid'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v2/service/channel/webhook.py#L395-L400
iGio90/Dwarf
bb3011cdffd209c7e3f5febe558053bf649ca69c
dwarf_debugger/ui/widgets/hex_edit.py
python
HexEditor.is_highlighted
(self, address)
return False
Checks if given pos is already colored returns False or highlighttype
Checks if given pos is already colored returns False or highlighttype
[ "Checks", "if", "given", "pos", "is", "already", "colored", "returns", "False", "or", "highlighttype" ]
def is_highlighted(self, address): """ Checks if given pos is already colored returns False or highlighttype """ is_highlight = [ x for x in self._highlights if x.offset <= address <= x.offset + x.length - 1 ] if is_highlight: if is...
[ "def", "is_highlighted", "(", "self", ",", "address", ")", ":", "is_highlight", "=", "[", "x", "for", "x", "in", "self", ".", "_highlights", "if", "x", ".", "offset", "<=", "address", "<=", "x", ".", "offset", "+", "x", ".", "length", "-", "1", "]"...
https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/ui/widgets/hex_edit.py#L706-L718
hvac/hvac
ec048ded30d21c13c21cfa950d148c8bfc1467b0
hvac/api/secrets_engines/transform.py
python
Transform.decode
( self, role_name, value=None, transformation=None, tweak=None, batch_input=None, mount_point=DEFAULT_MOUNT_POINT, )
return self._adapter.post( url=api_path, json=params, )
Decode the provided value using a named role. Supported methods: POST: /{mount_point}/decode/:role_name. :param role_name: the role name to use for this operation. This is specified as part of the URL. :type role_name: str | unicode :param value: the value to be...
Decode the provided value using a named role.
[ "Decode", "the", "provided", "value", "using", "a", "named", "role", "." ]
def decode( self, role_name, value=None, transformation=None, tweak=None, batch_input=None, mount_point=DEFAULT_MOUNT_POINT, ): """Decode the provided value using a named role. Supported methods: POST: /{mount_point}/decode/:role_n...
[ "def", "decode", "(", "self", ",", "role_name", ",", "value", "=", "None", ",", "transformation", "=", "None", ",", "tweak", "=", "None", ",", "batch_input", "=", "None", ",", "mount_point", "=", "DEFAULT_MOUNT_POINT", ",", ")", ":", "params", "=", "util...
https://github.com/hvac/hvac/blob/ec048ded30d21c13c21cfa950d148c8bfc1467b0/hvac/api/secrets_engines/transform.py#L716-L767
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/scipy/stats/_multivariate.py
python
invwishart_gen.var
(self, df, scale)
return _squeeze_output(out) if out is not None else out
Variance of the inverse Wishart distribution Only valid if the degrees of freedom are greater than the dimension of the scale matrix plus three. Parameters ---------- %(_doc_default_callparams)s Returns ------- var : float The variance of th...
Variance of the inverse Wishart distribution
[ "Variance", "of", "the", "inverse", "Wishart", "distribution" ]
def var(self, df, scale): """ Variance of the inverse Wishart distribution Only valid if the degrees of freedom are greater than the dimension of the scale matrix plus three. Parameters ---------- %(_doc_default_callparams)s Returns ------- ...
[ "def", "var", "(", "self", ",", "df", ",", "scale", ")", ":", "dim", ",", "df", ",", "scale", "=", "self", ".", "_process_parameters", "(", "df", ",", "scale", ")", "out", "=", "self", ".", "_var", "(", "dim", ",", "df", ",", "scale", ")", "ret...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/stats/_multivariate.py#L2465-L2483
ethereum/trinity
6383280c5044feb06695ac2f7bc1100b7bcf4fe0
trinity/chains/light_eventbus.py
python
EventBusLightPeerChain.coro_get_account
(self, block_hash: Hash32, address: Address)
return pass_or_raise( await self.event_bus.request(event, TO_NETWORKING_BROADCAST_CONFIG) ).account
[]
async def coro_get_account(self, block_hash: Hash32, address: Address) -> Account: event = GetAccountRequest(block_hash, address) return pass_or_raise( await self.event_bus.request(event, TO_NETWORKING_BROADCAST_CONFIG) ).account
[ "async", "def", "coro_get_account", "(", "self", ",", "block_hash", ":", "Hash32", ",", "address", ":", "Address", ")", "->", "Account", ":", "event", "=", "GetAccountRequest", "(", "block_hash", ",", "address", ")", "return", "pass_or_raise", "(", "await", ...
https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/chains/light_eventbus.py#L69-L73
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/common/datastore/sql_notification.py
python
NotificationCollection.notificationObjectRecords
(self)
return NotificationObjectRecord.querysimple(self._txn, notificationHomeResourceID=self.id())
[]
def notificationObjectRecords(self): return NotificationObjectRecord.querysimple(self._txn, notificationHomeResourceID=self.id())
[ "def", "notificationObjectRecords", "(", "self", ")", ":", "return", "NotificationObjectRecord", ".", "querysimple", "(", "self", ".", "_txn", ",", "notificationHomeResourceID", "=", "self", ".", "id", "(", ")", ")" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/common/datastore/sql_notification.py#L347-L348
frappe/erpnext
9d36e30ef7043b391b5ed2523b8288bf46c45d18
erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
python
get_rfq_total_items
(scorecard)
return data
Gets the total number of RFQ items sent to supplier
Gets the total number of RFQ items sent to supplier
[ "Gets", "the", "total", "number", "of", "RFQ", "items", "sent", "to", "supplier" ]
def get_rfq_total_items(scorecard): """ Gets the total number of RFQ items sent to supplier""" supplier = frappe.get_doc('Supplier', scorecard.supplier) # Look up all PO Items with delivery dates between our dates data = frappe.db.sql(""" SELECT COUNT(rfq_item.name) as total_rfqs FROM `tabRequest for...
[ "def", "get_rfq_total_items", "(", "scorecard", ")", ":", "supplier", "=", "frappe", ".", "get_doc", "(", "'Supplier'", ",", "scorecard", ".", "supplier", ")", "# Look up all PO Items with delivery dates between our dates", "data", "=", "frappe", ".", "db", ".", "sq...
https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py#L390-L411
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/pkgutil.py
python
get_data
(package, resource)
return loader.get_data(resource_name)
Get a resource from a package. This is a wrapper round the PEP 302 loader get_data API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using '/' as the path separator. The parent directory na...
Get a resource from a package.
[ "Get", "a", "resource", "from", "a", "package", "." ]
def get_data(package, resource): """Get a resource from a package. This is a wrapper round the PEP 302 loader get_data API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using '/' as the...
[ "def", "get_data", "(", "package", ",", "resource", ")", ":", "loader", "=", "get_loader", "(", "package", ")", "if", "loader", "is", "None", "or", "not", "hasattr", "(", "loader", ",", "'get_data'", ")", ":", "return", "None", "mod", "=", "sys", ".", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/pkgutil.py#L548-L583
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py
python
Command.is_local_storage
(self)
return isinstance(self.storage, FileSystemStorage)
[]
def is_local_storage(self): return isinstance(self.storage, FileSystemStorage)
[ "def", "is_local_storage", "(", "self", ")", ":", "return", "isinstance", "(", "self", ".", "storage", ",", "FileSystemStorage", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py#L220-L221
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow2/LanguageModeling/BERT/official/nlp/transformer/beam_search_v1.py
python
_expand_to_beam_size
(tensor, beam_size)
return tf.tile(tensor, tile_dims)
Tiles a given tensor by beam_size. Args: tensor: tensor to tile [batch_size, ...] beam_size: How much to tile the tensor by. Returns: Tiled tensor [batch_size, beam_size, ...]
Tiles a given tensor by beam_size.
[ "Tiles", "a", "given", "tensor", "by", "beam_size", "." ]
def _expand_to_beam_size(tensor, beam_size): """Tiles a given tensor by beam_size. Args: tensor: tensor to tile [batch_size, ...] beam_size: How much to tile the tensor by. Returns: Tiled tensor [batch_size, beam_size, ...] """ tensor = tf.expand_dims(tensor, axis=1) tile_dims = [1] * tensor.s...
[ "def", "_expand_to_beam_size", "(", "tensor", ",", "beam_size", ")", ":", "tensor", "=", "tf", ".", "expand_dims", "(", "tensor", ",", "axis", "=", "1", ")", "tile_dims", "=", "[", "1", "]", "*", "tensor", ".", "shape", ".", "ndims", "tile_dims", "[", ...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow2/LanguageModeling/BERT/official/nlp/transformer/beam_search_v1.py#L557-L571
desbma/sacad
ee7a3da67cb45b3d1f9dda5405dcfed5dccdca47
sacad/sources/base.py
python
CoverSource.unaccentuate
(s)
return "".join(c for c in unicodedata.normalize("NFKD", s) if not unicodedata.combining(c))
Replace accentuated chars in string by their non accentuated equivalent.
Replace accentuated chars in string by their non accentuated equivalent.
[ "Replace", "accentuated", "chars", "in", "string", "by", "their", "non", "accentuated", "equivalent", "." ]
def unaccentuate(s): """ Replace accentuated chars in string by their non accentuated equivalent. """ return "".join(c for c in unicodedata.normalize("NFKD", s) if not unicodedata.combining(c))
[ "def", "unaccentuate", "(", "s", ")", ":", "return", "\"\"", ".", "join", "(", "c", "for", "c", "in", "unicodedata", ".", "normalize", "(", "\"NFKD\"", ",", "s", ")", "if", "not", "unicodedata", ".", "combining", "(", "c", ")", ")" ]
https://github.com/desbma/sacad/blob/ee7a3da67cb45b3d1f9dda5405dcfed5dccdca47/sacad/sources/base.py#L199-L201
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/requests/cookies.py
python
RequestsCookieJar.list_paths
(self)
return paths
Utility method to list all the paths in the jar.
Utility method to list all the paths in the jar.
[ "Utility", "method", "to", "list", "all", "the", "paths", "in", "the", "jar", "." ]
def list_paths(self): """Utility method to list all the paths in the jar.""" paths = [] for cookie in iter(self): if cookie.path not in paths: paths.append(cookie.path) return paths
[ "def", "list_paths", "(", "self", ")", ":", "paths", "=", "[", "]", "for", "cookie", "in", "iter", "(", "self", ")", ":", "if", "cookie", ".", "path", "not", "in", "paths", ":", "paths", ".", "append", "(", "cookie", ".", "path", ")", "return", "...
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/requests/cookies.py#L278-L284
datacenter/acitoolkit
629b84887dd0f0183b81efc8adb16817f985541a
acitoolkit/aciphysobject.py
python
Node._add_vpc_info
(self, working_data)
This method only runs for leaf switches. If the leaf has a VPC peer, the VPC information will be populated and the node.vpc_present flag will be set. check for vpcDom sub-object and if it exists, then create the entry as a dictionary of values. Will first check vpc_inst to see...
This method only runs for leaf switches. If the leaf has a VPC peer, the VPC information will be populated and the node.vpc_present flag will be set.
[ "This", "method", "only", "runs", "for", "leaf", "switches", ".", "If", "the", "leaf", "has", "a", "VPC", "peer", "the", "VPC", "information", "will", "be", "populated", "and", "the", "node", ".", "vpc_present", "flag", "will", "be", "set", "." ]
def _add_vpc_info(self, working_data): """ This method only runs for leaf switches. If the leaf has a VPC peer, the VPC information will be populated and the node.vpc_present flag will be set. check for vpcDom sub-object and if it exists, then create the entry as a dict...
[ "def", "_add_vpc_info", "(", "self", ",", "working_data", ")", ":", "partial_dn", "=", "'topology/pod-{0}/node-{1}/sys/vpc/inst'", ".", "format", "(", "self", ".", "pod", ",", "self", ".", "node", ")", "vpc_admin_state", "=", "'disabled'", "data", "=", "working_...
https://github.com/datacenter/acitoolkit/blob/629b84887dd0f0183b81efc8adb16817f985541a/acitoolkit/aciphysobject.py#L1532-L1589
awslabs/aws-ec2rescue-linux
8ecf40e7ea0d2563dac057235803fca2221029d2
lib/s3transfer/download.py
python
IOWriteTask._main
(self, fileobj, data, offset)
Pulls off an io queue to write contents to a file :param f: The file handle to write content to :param data: The data to write :param offset: The offset to write the data to.
Pulls off an io queue to write contents to a file
[ "Pulls", "off", "an", "io", "queue", "to", "write", "contents", "to", "a", "file" ]
def _main(self, fileobj, data, offset): """Pulls off an io queue to write contents to a file :param f: The file handle to write content to :param data: The data to write :param offset: The offset to write the data to. """ fileobj.seek(offset) fileobj.write(data)
[ "def", "_main", "(", "self", ",", "fileobj", ",", "data", ",", "offset", ")", ":", "fileobj", ".", "seek", "(", "offset", ")", "fileobj", ".", "write", "(", "data", ")" ]
https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/s3transfer/download.py#L561-L569
asciidisco/plugin.video.netflix
ceb2638a9676f5839250dadfd079b9e4e4bdd759
resources/lib/NetflixHttpSubRessourceHandler.py
python
NetflixHttpSubRessourceHandler.fetch_metadata
(self, params)
return self.netflix_session.fetch_metadata(id=video_id)
Metadata proxy function Parameters ---------- params : :obj:`dict` of :obj:`str` Request params Returns ------- :obj:`Requests.Response` Response of the remote call
Metadata proxy function
[ "Metadata", "proxy", "function" ]
def fetch_metadata(self, params): """Metadata proxy function Parameters ---------- params : :obj:`dict` of :obj:`str` Request params Returns ------- :obj:`Requests.Response` Response of the remote call """ video_id = param...
[ "def", "fetch_metadata", "(", "self", ",", "params", ")", ":", "video_id", "=", "params", ".", "get", "(", "'video_id'", ",", "[", "''", "]", ")", "[", "0", "]", "return", "self", ".", "netflix_session", ".", "fetch_metadata", "(", "id", "=", "video_id...
https://github.com/asciidisco/plugin.video.netflix/blob/ceb2638a9676f5839250dadfd079b9e4e4bdd759/resources/lib/NetflixHttpSubRessourceHandler.py#L295-L309
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/providers/metadata/mediabrowser.py
python
MediaBrowserMetadata.get_episode_thumb_path
(ep_obj)
return tbn_file_path
Returns a full show dir/metadata/episode.jpg path for MediaBrowser episode thumbs. ep_obj: a TVEpisode object to get the path from
Returns a full show dir/metadata/episode.jpg path for MediaBrowser episode thumbs.
[ "Returns", "a", "full", "show", "dir", "/", "metadata", "/", "episode", ".", "jpg", "path", "for", "MediaBrowser", "episode", "thumbs", "." ]
def get_episode_thumb_path(ep_obj): """ Returns a full show dir/metadata/episode.jpg path for MediaBrowser episode thumbs. ep_obj: a TVEpisode object to get the path from """ if os.path.isfile(ep_obj.location): tbn_filename = replace_extension(os.path.basena...
[ "def", "get_episode_thumb_path", "(", "ep_obj", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "ep_obj", ".", "location", ")", ":", "tbn_filename", "=", "replace_extension", "(", "os", ".", "path", ".", "basename", "(", "ep_obj", ".", "location", ...
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/providers/metadata/mediabrowser.py#L97-L112
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/site-packages/pip/_vendor/distlib/index.py
python
PackageIndex.send_request
(self, req)
return opener.open(req)
Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse).
Send a standard library :class:`Request` to PyPI and return its response.
[ "Send", "a", "standard", "library", ":", "class", ":", "Request", "to", "PyPI", "and", "return", "its", "response", "." ]
def send_request(self, req): """ Send a standard library :class:`Request` to PyPI and return its response. :param req: The request to send. :return: The HTTP response from PyPI (a standard library HTTPResponse). """ handlers = [] if self.password_handler:...
[ "def", "send_request", "(", "self", ",", "req", ")", ":", "handlers", "=", "[", "]", "if", "self", ".", "password_handler", ":", "handlers", ".", "append", "(", "self", ".", "password_handler", ")", "if", "self", ".", "ssl_verifier", ":", "handlers", "."...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_vendor/distlib/index.py#L450-L464
foremast/foremast
e8eb9bd24e975772532d90efa8a9ba1850e968cc
src/foremast/consts.py
python
_remove_empty_entries
(entries)
return sorted(valid_entries)
Remove empty entries in a list
Remove empty entries in a list
[ "Remove", "empty", "entries", "in", "a", "list" ]
def _remove_empty_entries(entries): """Remove empty entries in a list""" valid_entries = [] for entry in set(entries): if entry: valid_entries.append(entry) return sorted(valid_entries)
[ "def", "_remove_empty_entries", "(", "entries", ")", ":", "valid_entries", "=", "[", "]", "for", "entry", "in", "set", "(", "entries", ")", ":", "if", "entry", ":", "valid_entries", ".", "append", "(", "entry", ")", "return", "sorted", "(", "valid_entries"...
https://github.com/foremast/foremast/blob/e8eb9bd24e975772532d90efa8a9ba1850e968cc/src/foremast/consts.py#L148-L154
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
Lib/platform.py
python
_uname
()
return _uname_cache2
Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform. Note that unlike the os.uname function this also returns possible processor information as an additional tuple entry. Entries which c...
Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform.
[ "Fairly", "portable", "uname", "interface", ".", "Returns", "a", "tuple", "of", "strings", "(", "system", "node", "release", "version", "machine", "processor", ")", "identifying", "the", "underlying", "platform", "." ]
def _uname(): """ Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform. Note that unlike the os.uname function this also returns possible processor information as an additional tuple entry. ...
[ "def", "_uname", "(", ")", ":", "global", "_uname_cache2", "no_os_uname", "=", "0", "if", "_uname_cache2", "is", "not", "None", ":", "return", "_uname_cache2", "processor", "=", "''", "# Get some infos from the builtin os.uname API...", "try", ":", "system", ",", ...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/Lib/platform.py#L1247-L1385
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/graph.py
python
DotBackend.generate
( self, outputfile: Optional[str] = None, mapfile: Optional[str] = None )
return outputfile
Generates a graph file. :param str outputfile: filename and path [defaults to graphname.png] :param str mapfile: filename and path :rtype: str :return: a path to the generated file :raises RuntimeError: if the executable for rendering was not found
Generates a graph file.
[ "Generates", "a", "graph", "file", "." ]
def generate( self, outputfile: Optional[str] = None, mapfile: Optional[str] = None ) -> str: """Generates a graph file. :param str outputfile: filename and path [defaults to graphname.png] :param str mapfile: filename and path :rtype: str :return: a path to the gen...
[ "def", "generate", "(", "self", ",", "outputfile", ":", "Optional", "[", "str", "]", "=", "None", ",", "mapfile", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "graphviz_extensions", "=", "(", "\"dot\"", ",", "\"gv\"", ")", "n...
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/graph.py#L86-L147
MurtyShikhar/Question-Answering
86bc5952b5d8df683e10285d7607ed12d2a3462e
qa_model.py
python
QASystem.get_feed_dict
(self, questions, contexts, answers, dropout_val)
return feed
-arg questions: A list of list of ids representing the question sentence -arg contexts: A list of list of ids representing the context paragraph -arg dropout_val: A float representing the keep probability for dropout :return: dict {placeholders: value}
-arg questions: A list of list of ids representing the question sentence -arg contexts: A list of list of ids representing the context paragraph -arg dropout_val: A float representing the keep probability for dropout
[ "-", "arg", "questions", ":", "A", "list", "of", "list", "of", "ids", "representing", "the", "question", "sentence", "-", "arg", "contexts", ":", "A", "list", "of", "list", "of", "ids", "representing", "the", "context", "paragraph", "-", "arg", "dropout_va...
def get_feed_dict(self, questions, contexts, answers, dropout_val): """ -arg questions: A list of list of ids representing the question sentence -arg contexts: A list of list of ids representing the context paragraph -arg dropout_val: A float representing the keep probability for dropout...
[ "def", "get_feed_dict", "(", "self", ",", "questions", ",", "contexts", ",", "answers", ",", "dropout_val", ")", ":", "padded_questions", ",", "question_lengths", "=", "pad_sequences", "(", "questions", ",", "0", ")", "padded_contexts", ",", "passage_lengths", "...
https://github.com/MurtyShikhar/Question-Answering/blob/86bc5952b5d8df683e10285d7607ed12d2a3462e/qa_model.py#L281-L303
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/dateutil/tz/tz.py
python
tzrange._dst_base_offset
(self)
return self._dst_base_offset_
[]
def _dst_base_offset(self): return self._dst_base_offset_
[ "def", "_dst_base_offset", "(", "self", ")", ":", "return", "self", ".", "_dst_base_offset_" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dateutil/tz/tz.py#L1032-L1033
rotki/rotki
aafa446815cdd5e9477436d1b02bee7d01b398c8
tools/profiling/graph.py
python
memory_subplot
(output, data_list)
Plots all data in separated axes, a simple way to look at distinct executions, keep in mind that the time-axis will be skewed, since each plot has a differente running time but the same plotting area.
Plots all data in separated axes, a simple way to look at distinct executions, keep in mind that the time-axis will be skewed, since each plot has a differente running time but the same plotting area.
[ "Plots", "all", "data", "in", "separated", "axes", "a", "simple", "way", "to", "look", "at", "distinct", "executions", "keep", "in", "mind", "that", "the", "time", "-", "axis", "will", "be", "skewed", "since", "each", "plot", "has", "a", "differente", "r...
def memory_subplot(output, data_list): """Plots all data in separated axes, a simple way to look at distinct executions, keep in mind that the time-axis will be skewed, since each plot has a differente running time but the same plotting area.""" import matplotlib.pyplot as plt from matplotlib import...
[ "def", "memory_subplot", "(", "output", ",", "data_list", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "from", "matplotlib", "import", "dates", "number_plots", "=", "len", "(", "data_list", ")", "fig", ",", "all_memory_axes", "=", "plt", "."...
https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/tools/profiling/graph.py#L192-L233
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/header_control/__init__.py
python
force_header_for_response
(response, header, value)
Forces the given header for the given response using the header_control middleware.
Forces the given header for the given response using the header_control middleware.
[ "Forces", "the", "given", "header", "for", "the", "given", "response", "using", "the", "header_control", "middleware", "." ]
def force_header_for_response(response, header, value): """Forces the given header for the given response using the header_control middleware.""" force_headers = {} if hasattr(response, 'force_headers'): force_headers = response.force_headers force_headers[header] = value response.force_hea...
[ "def", "force_header_for_response", "(", "response", ",", "header", ",", "value", ")", ":", "force_headers", "=", "{", "}", "if", "hasattr", "(", "response", ",", "'force_headers'", ")", ":", "force_headers", "=", "response", ".", "force_headers", "force_headers...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/header_control/__init__.py#L15-L22
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pyparsing.py
python
ParseResults._asStringList
( self, sep='' )
return out
[]
def _asStringList( self, sep='' ): out = [] for item in self.__toklist: if out and sep: out.append(sep) if isinstance( item, ParseResults ): out += item._asStringList() else: out.append( _ustr(item) ) return out
[ "def", "_asStringList", "(", "self", ",", "sep", "=", "''", ")", ":", "out", "=", "[", "]", "for", "item", "in", "self", ".", "__toklist", ":", "if", "out", "and", "sep", ":", "out", ".", "append", "(", "sep", ")", "if", "isinstance", "(", "item"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L670-L679
scanny/python-pptx
71d1ca0b2b3b9178d64cdab565e8503a25a54e0b
pptx/chart/xlsx.py
python
CategoryWorkbookWriter._column_reference
(column_number)
return col_ref
Return str Excel column reference like 'BQ' for *column_number*. *column_number* is an int in the range 1-16384 inclusive, where 1 maps to column 'A'.
Return str Excel column reference like 'BQ' for *column_number*.
[ "Return", "str", "Excel", "column", "reference", "like", "BQ", "for", "*", "column_number", "*", "." ]
def _column_reference(column_number): """Return str Excel column reference like 'BQ' for *column_number*. *column_number* is an int in the range 1-16384 inclusive, where 1 maps to column 'A'. """ if column_number < 1 or column_number > 16384: raise ValueError("column...
[ "def", "_column_reference", "(", "column_number", ")", ":", "if", "column_number", "<", "1", "or", "column_number", ">", "16384", ":", "raise", "ValueError", "(", "\"column_number must be in range 1-16384\"", ")", "# ---Work right-to-left, one order of magnitude at a time. No...
https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/chart/xlsx.py#L89-L118
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.4/django/contrib/staticfiles/finders.py
python
_get_finder
(import_path)
return Finder()
Imports the staticfiles finder class described by import_path, where import_path is the full Python path to the class.
Imports the staticfiles finder class described by import_path, where import_path is the full Python path to the class.
[ "Imports", "the", "staticfiles", "finder", "class", "described", "by", "import_path", "where", "import_path", "is", "the", "full", "Python", "path", "to", "the", "class", "." ]
def _get_finder(import_path): """ Imports the staticfiles finder class described by import_path, where import_path is the full Python path to the class. """ module, attr = import_path.rsplit('.', 1) try: mod = import_module(module) except ImportError, e: raise ImproperlyConfi...
[ "def", "_get_finder", "(", "import_path", ")", ":", "module", ",", "attr", "=", "import_path", ".", "rsplit", "(", "'.'", ",", "1", ")", "try", ":", "mod", "=", "import_module", "(", "module", ")", "except", "ImportError", ",", "e", ":", "raise", "Impr...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/staticfiles/finders.py#L255-L274
cltk/cltk
1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1
src/cltk/tag/ner.py
python
NamedEntityReplacer.tag_ner_fr
(self, input_text, output_type=list)
return ner_tuple_list
[]
def tag_ner_fr(self, input_text, output_type=list): entities = self.entities for entity in entities: (name, kind) = entity word_tokenizer = PunktWordTokenizer() tokenized_text = word_tokenizer.tokenize(input_text) ner_tuple_list = [] match = False ...
[ "def", "tag_ner_fr", "(", "self", ",", "input_text", ",", "output_type", "=", "list", ")", ":", "entities", "=", "self", ".", "entities", "for", "entity", "in", "entities", ":", "(", "name", ",", "kind", ")", "=", "entity", "word_tokenizer", "=", "PunktW...
https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/tag/ner.py#L45-L66
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/plugins/enums.py
python
enum_name_callback
(ctx: 'mypy.plugin.AttributeContext')
This plugin refines the 'name' attribute in enums to act as if they were declared to be final. For example, the expression 'MyEnum.FOO.name' normally is inferred to be of type 'str'. This plugin will instead make the inferred type be a 'str' where the last known value is 'Literal["FOO"]'. This mea...
This plugin refines the 'name' attribute in enums to act as if they were declared to be final.
[ "This", "plugin", "refines", "the", "name", "attribute", "in", "enums", "to", "act", "as", "if", "they", "were", "declared", "to", "be", "final", "." ]
def enum_name_callback(ctx: 'mypy.plugin.AttributeContext') -> Type: """This plugin refines the 'name' attribute in enums to act as if they were declared to be final. For example, the expression 'MyEnum.FOO.name' normally is inferred to be of type 'str'. This plugin will instead make the inferred ...
[ "def", "enum_name_callback", "(", "ctx", ":", "'mypy.plugin.AttributeContext'", ")", "->", "Type", ":", "enum_field_name", "=", "_extract_underlying_field_name", "(", "ctx", ".", "type", ")", "if", "enum_field_name", "is", "None", ":", "return", "ctx", ".", "defau...
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/plugins/enums.py#L31-L52
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/FreeBSD/i386/ucs4/cryptography/x509/base.py
python
CertificateBuilder.issuer_name
(self, name)
return CertificateBuilder( name, self._subject_name, self._public_key, self._serial_number, self._not_valid_before, self._not_valid_after, self._extensions )
Sets the CA's distinguished name.
Sets the CA's distinguished name.
[ "Sets", "the", "CA", "s", "distinguished", "name", "." ]
def issuer_name(self, name): """ Sets the CA's distinguished name. """ if not isinstance(name, Name): raise TypeError('Expecting x509.Name object.') if self._issuer_name is not None: raise ValueError('The issuer name may only be set once.') return ...
[ "def", "issuer_name", "(", "self", ",", "name", ")", ":", "if", "not", "isinstance", "(", "name", ",", "Name", ")", ":", "raise", "TypeError", "(", "'Expecting x509.Name object.'", ")", "if", "self", ".", "_issuer_name", "is", "not", "None", ":", "raise", ...
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/FreeBSD/i386/ucs4/cryptography/x509/base.py#L390-L402
themix-project/oomox
1bb0f3033736c56652e25c7d7b47c7fc499bfeb1
oomox_gui/main.py
python
OomoxGtkApplication.do_startup
(self)
[]
def do_startup(self): # pylint: disable=arguments-differ Gtk.Application.do_startup(self) quit_action = Gio.SimpleAction.new( AppActions.quit, None ) quit_action.connect("activate", self._on_quit) self.add_action(quit_action) _shortcuts = {} def s...
[ "def", "do_startup", "(", "self", ")", ":", "# pylint: disable=arguments-differ", "Gtk", ".", "Application", ".", "do_startup", "(", "self", ")", "quit_action", "=", "Gio", ".", "SimpleAction", ".", "new", "(", "AppActions", ".", "quit", ",", "None", ")", "q...
https://github.com/themix-project/oomox/blob/1bb0f3033736c56652e25c7d7b47c7fc499bfeb1/oomox_gui/main.py#L793-L864
PyTorchLightning/pytorch-lightning
5914fb748fb53d826ab337fc2484feab9883a104
pytorch_lightning/profiler/pytorch.py
python
PyTorchProfiler.__init__
( self, dirpath: Optional[Union[str, Path]] = None, filename: Optional[str] = None, group_by_input_shapes: bool = False, emit_nvtx: bool = False, export_to_chrome: bool = True, row_limit: int = 20, sort_by_key: Optional[str] = None, record_function...
This profiler uses PyTorch's Autograd Profiler and lets you inspect the cost of. different operators inside your model - both on the CPU and GPU Args: dirpath: Directory path for the ``filename``. If ``dirpath`` is ``None`` but ``filename`` is present, the ``trainer.log_dir...
This profiler uses PyTorch's Autograd Profiler and lets you inspect the cost of.
[ "This", "profiler", "uses", "PyTorch", "s", "Autograd", "Profiler", "and", "lets", "you", "inspect", "the", "cost", "of", "." ]
def __init__( self, dirpath: Optional[Union[str, Path]] = None, filename: Optional[str] = None, group_by_input_shapes: bool = False, emit_nvtx: bool = False, export_to_chrome: bool = True, row_limit: int = 20, sort_by_key: Optional[str] = None, rec...
[ "def", "__init__", "(", "self", ",", "dirpath", ":", "Optional", "[", "Union", "[", "str", ",", "Path", "]", "]", "=", "None", ",", "filename", ":", "Optional", "[", "str", "]", "=", "None", ",", "group_by_input_shapes", ":", "bool", "=", "False", ",...
https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/profiler/pytorch.py#L220-L310
bcbio/bcbio-nextgen
c80f9b6b1be3267d1f981b7035e3b72441d258f2
bcbio/ngsalign/rtg.py
python
calculate_splits
(sdf_file, split_size)
return splits
Retrieve
Retrieve
[ "Retrieve" ]
def calculate_splits(sdf_file, split_size): """Retrieve """ counts = _sdfstats(sdf_file)["counts"] splits = [] cur = 0 for i in range(counts // split_size + (0 if counts % split_size == 0 else 1)): splits.append("%s-%s" % (cur, min(counts, cur + split_size))) cur += split_size ...
[ "def", "calculate_splits", "(", "sdf_file", ",", "split_size", ")", ":", "counts", "=", "_sdfstats", "(", "sdf_file", ")", "[", "\"counts\"", "]", "splits", "=", "[", "]", "cur", "=", "0", "for", "i", "in", "range", "(", "counts", "//", "split_size", "...
https://github.com/bcbio/bcbio-nextgen/blob/c80f9b6b1be3267d1f981b7035e3b72441d258f2/bcbio/ngsalign/rtg.py#L45-L54
biocore/scikit-bio
ecdfc7941d8c21eb2559ff1ab313d6e9348781da
skbio/sequence/_dna.py
python
DNA.transcribe
(self)
return skbio.RNA(seq, metadata=metadata, positional_metadata=positional_metadata, interval_metadata=interval_metadata, validate=False)
Transcribe DNA into RNA. DNA sequence is assumed to be the coding strand. Thymine (T) is replaced with uracil (U) in the transcribed sequence. Returns ------- RNA Transcribed sequence. See Also -------- translate translate_six_frames...
Transcribe DNA into RNA.
[ "Transcribe", "DNA", "into", "RNA", "." ]
def transcribe(self): """Transcribe DNA into RNA. DNA sequence is assumed to be the coding strand. Thymine (T) is replaced with uracil (U) in the transcribed sequence. Returns ------- RNA Transcribed sequence. See Also -------- trans...
[ "def", "transcribe", "(", "self", ")", ":", "seq", "=", "self", ".", "_string", ".", "replace", "(", "b'T'", ",", "b'U'", ")", "metadata", "=", "None", "if", "self", ".", "has_metadata", "(", ")", ":", "metadata", "=", "self", ".", "metadata", "posit...
https://github.com/biocore/scikit-bio/blob/ecdfc7941d8c21eb2559ff1ab313d6e9348781da/skbio/sequence/_dna.py#L145-L214