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
wger-project/wger
3a17a2cf133d242d1f8c357faa53cf675a7b3223
wger/manager/views/log.py
python
WorkoutLogDetailView.dispatch
(self, request, *args, **kwargs)
return super(WorkoutLogDetailView, self).dispatch(request, *args, **kwargs)
Check for ownership
Check for ownership
[ "Check", "for", "ownership" ]
def dispatch(self, request, *args, **kwargs): """ Check for ownership """ workout = get_object_or_404(Workout, pk=kwargs['pk']) self.owner_user = workout.user is_owner = request.user == self.owner_user if not is_owner and not self.owner_user.userprofile.ro_acces...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "workout", "=", "get_object_or_404", "(", "Workout", ",", "pk", "=", "kwargs", "[", "'pk'", "]", ")", "self", ".", "owner_user", "=", "workout", ".",...
https://github.com/wger-project/wger/blob/3a17a2cf133d242d1f8c357faa53cf675a7b3223/wger/manager/views/log.py#L311-L324
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/ext/matproj.py
python
MPRester.get_entry_by_material_id
( self, material_id, compatible_only=True, inc_structure=None, property_data=None, conventional_unit_cell=False, )
return data[0]
Get a ComputedEntry corresponding to a material_id. Args: material_id (str): Materials Project material_id (a string, e.g., mp-1234). compatible_only (bool): Whether to return only "compatible" entries. Compatible entries are entries that have been ...
Get a ComputedEntry corresponding to a material_id.
[ "Get", "a", "ComputedEntry", "corresponding", "to", "a", "material_id", "." ]
def get_entry_by_material_id( self, material_id, compatible_only=True, inc_structure=None, property_data=None, conventional_unit_cell=False, ): """ Get a ComputedEntry corresponding to a material_id. Args: material_id (str): Materi...
[ "def", "get_entry_by_material_id", "(", "self", ",", "material_id", ",", "compatible_only", "=", "True", ",", "inc_structure", "=", "None", ",", "property_data", "=", "None", ",", "conventional_unit_cell", "=", "False", ",", ")", ":", "data", "=", "self", ".",...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/ext/matproj.py#L725-L766
ondyari/FaceForensics
b952e41cba017eb37593c39e12bd884a934791e1
dataset/DeepFakes/faceswap-master/lib/gui/display_page.py
python
DisplayPage.subnotebook_get_widgets
(self)
Return each widget that sits within each subnotebook frame
Return each widget that sits within each subnotebook frame
[ "Return", "each", "widget", "that", "sits", "within", "each", "subnotebook", "frame" ]
def subnotebook_get_widgets(self): """ Return each widget that sits within each subnotebook frame """ for child in self.subnotebook.winfo_children(): for widget in child.winfo_children(): yield widget
[ "def", "subnotebook_get_widgets", "(", "self", ")", ":", "for", "child", "in", "self", ".", "subnotebook", ".", "winfo_children", "(", ")", ":", "for", "widget", "in", "child", ".", "winfo_children", "(", ")", ":", "yield", "widget" ]
https://github.com/ondyari/FaceForensics/blob/b952e41cba017eb37593c39e12bd884a934791e1/dataset/DeepFakes/faceswap-master/lib/gui/display_page.py#L111-L116
deepmind/dm_control
806a10e896e7c887635328bfa8352604ad0fedae
dm_control/manipulation/props/primitive.py
python
Sphere._build
(self, radius=0.05, mass=None, name='sphere')
[]
def _build(self, radius=0.05, mass=None, name='sphere'): super(Sphere, self)._build( geom_type='sphere', size=radius, mass=mass, name=name)
[ "def", "_build", "(", "self", ",", "radius", "=", "0.05", ",", "mass", "=", "None", ",", "name", "=", "'sphere'", ")", ":", "super", "(", "Sphere", ",", "self", ")", ".", "_build", "(", "geom_type", "=", "'sphere'", ",", "size", "=", "radius", ",",...
https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/manipulation/props/primitive.py#L139-L141
plasticityai/magnitude
7ac0baeaf181263b661c3ae00643d21e3fd90216
pymagnitude/third_party/allennlp/common/from_params.py
python
create_kwargs
(cls , params , **extras)
return kwargs
u""" Given some class, a `Params` object, and potentially other keyword arguments, create a dict of keyword args suitable for passing to the class's constructor. The function does this by finding the class's constructor, matching the constructor arguments to entries in the `params` object, and instanti...
u""" Given some class, a `Params` object, and potentially other keyword arguments, create a dict of keyword args suitable for passing to the class's constructor.
[ "u", "Given", "some", "class", "a", "Params", "object", "and", "potentially", "other", "keyword", "arguments", "create", "a", "dict", "of", "keyword", "args", "suitable", "for", "passing", "to", "the", "class", "s", "constructor", "." ]
def create_kwargs(cls , params , **extras) : u""" Given some class, a `Params` object, and potentially other keyword arguments, create a dict of keyword args suitable for passing to the class's constructor. The function does this by finding the class's constructor, match...
[ "def", "create_kwargs", "(", "cls", ",", "params", ",", "*", "*", "extras", ")", ":", "# Get the signature of the constructor.", "signature", "=", "inspect", ".", "signature", "(", "cls", ".", "__init__", ")", "kwargs", "=", "{", "}", "# Iterate over all the con...
https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/third_party/allennlp/common/from_params.py#L88-L196
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/xml/etree/ElementTree.py
python
dump
(elem)
Write element tree or element structure to sys.stdout. This function should be used for debugging only. *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file.
Write element tree or element structure to sys.stdout.
[ "Write", "element", "tree", "or", "element", "structure", "to", "sys", ".", "stdout", "." ]
def dump(elem): """Write element tree or element structure to sys.stdout. This function should be used for debugging only. *elem* is either an ElementTree, or a single Element. The exact output format is implementation dependent. In this version, it's written as an ordinary XML file. """ ...
[ "def", "dump", "(", "elem", ")", ":", "# debugging", "if", "not", "isinstance", "(", "elem", ",", "ElementTree", ")", ":", "elem", "=", "ElementTree", "(", "elem", ")", "elem", ".", "write", "(", "sys", ".", "stdout", ",", "encoding", "=", "\"unicode\"...
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/xml/etree/ElementTree.py#L1153-L1169
jorgebastida/gordon
4c1cd0c4dea2499d98115672095714592f80f7aa
gordon/utils.py
python
get_template_s3_key
(filename)
return 'cf_templates/{}/{}.json'.format( datetime.now().strftime("%Y-%m-%d"), hashlib.sha1(six.text_type(data).encode('utf-8')).hexdigest()[:8] )
[]
def get_template_s3_key(filename): with open(filename, 'r') as f: data = f.read() return 'cf_templates/{}/{}.json'.format( datetime.now().strftime("%Y-%m-%d"), hashlib.sha1(six.text_type(data).encode('utf-8')).hexdigest()[:8] )
[ "def", "get_template_s3_key", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "data", "=", "f", ".", "read", "(", ")", "return", "'cf_templates/{}/{}.json'", ".", "format", "(", "datetime", ".", "now", "(", ...
https://github.com/jorgebastida/gordon/blob/4c1cd0c4dea2499d98115672095714592f80f7aa/gordon/utils.py#L286-L292
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/distutils/sysconfig.py
python
get_python_lib
(plat_specific=0, standard_lib=0, prefix=None)
Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_...
Return the directory containing the Python library (standard or site additions).
[ "Return", "the", "directory", "containing", "the", "Python", "library", "(", "standard", "or", "site", "additions", ")", "." ]
def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; ot...
[ "def", "get_python_lib", "(", "plat_specific", "=", "0", ",", "standard_lib", "=", "0", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "if", "standard_lib", ":", "prefix", "=", "plat_specific", "and", "BASE_EXEC_PREFIX", "or", "BA...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/distutils/sysconfig.py#L123-L161
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/trusthub/v1/supporting_document.py
python
SupportingDocumentContext.__init__
(self, version, sid)
Initialize the SupportingDocumentContext :param Version version: Version that contains the resource :param sid: The unique string that identifies the resource :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext :rtype: twilio.rest.trusthub.v1.supporting_docu...
Initialize the SupportingDocumentContext
[ "Initialize", "the", "SupportingDocumentContext" ]
def __init__(self, version, sid): """ Initialize the SupportingDocumentContext :param Version version: Version that contains the resource :param sid: The unique string that identifies the resource :returns: twilio.rest.trusthub.v1.supporting_document.SupportingDocumentContext ...
[ "def", "__init__", "(", "self", ",", "version", ",", "sid", ")", ":", "super", "(", "SupportingDocumentContext", ",", "self", ")", ".", "__init__", "(", "version", ")", "# Path Solution", "self", ".", "_solution", "=", "{", "'sid'", ":", "sid", ",", "}",...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/trusthub/v1/supporting_document.py#L205-L219
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/ldap3/operation/search.py
python
search_result_reference_response_to_dict
(response)
return {'uri': search_refs_to_list(response)}
[]
def search_result_reference_response_to_dict(response): return {'uri': search_refs_to_list(response)}
[ "def", "search_result_reference_response_to_dict", "(", "response", ")", ":", "return", "{", "'uri'", ":", "search_refs_to_list", "(", "response", ")", "}" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/ldap3/operation/search.py#L558-L559
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/spike/spike.py
python
SpikePlatform.send_cmd_raw_async
(self, data, wait_ms=0)
Send raw cmd which does not require a response.
Send raw cmd which does not require a response.
[ "Send", "raw", "cmd", "which", "does", "not", "require", "a", "response", "." ]
def send_cmd_raw_async(self, data, wait_ms=0): """Send raw cmd which does not require a response.""" # queue command self._cmd_queue.put_nowait((data, wait_ms))
[ "def", "send_cmd_raw_async", "(", "self", ",", "data", ",", "wait_ms", "=", "0", ")", ":", "# queue command", "self", ".", "_cmd_queue", ".", "put_nowait", "(", "(", "data", ",", "wait_ms", ")", ")" ]
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/spike/spike.py#L1180-L1183
chb/indivo_server
9826c67ab17d7fc0df935db327344fb0c7d237e5
indivo/views/record.py
python
_record_create
(request, principal_email=None, external_id=None)
return render_template('record', {'record' : record}, type='xml')
Create an Indivo record. request.POST must contain raw XML that is a valid Indivo Demographics document (see :doc:`/schemas/demographics-schema`). This call will create a new record containing the following information: * *creator*: Corresponds to ``request.principal``. * *label*: The full name of th...
Create an Indivo record.
[ "Create", "an", "Indivo", "record", "." ]
def _record_create(request, principal_email=None, external_id=None): """ Create an Indivo record. request.POST must contain raw XML that is a valid Indivo Demographics document (see :doc:`/schemas/demographics-schema`). This call will create a new record containing the following information: * *creato...
[ "def", "_record_create", "(", "request", ",", "principal_email", "=", "None", ",", "external_id", "=", "None", ")", ":", "# If the xml data is not valid return an HttpResponseBadRequest Obj", "xml_data", "=", "request", ".", "raw_post_data", "try", ":", "etree", ".", ...
https://github.com/chb/indivo_server/blob/9826c67ab17d7fc0df935db327344fb0c7d237e5/indivo/views/record.py#L292-L369
skylines-project/skylines
ce68ee280af05498b3859fc2c199b08043ad58a9
skylines/lib/string.py
python
isnumeric
(s)
return True
Check if a string can be parsed as floating point value
Check if a string can be parsed as floating point value
[ "Check", "if", "a", "string", "can", "be", "parsed", "as", "floating", "point", "value" ]
def isnumeric(s): """Check if a string can be parsed as floating point value""" try: float(s) except ValueError: return False return True
[ "def", "isnumeric", "(", "s", ")", ":", "try", ":", "float", "(", "s", ")", "except", "ValueError", ":", "return", "False", "return", "True" ]
https://github.com/skylines-project/skylines/blob/ce68ee280af05498b3859fc2c199b08043ad58a9/skylines/lib/string.py#L42-L49
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/mhlib.py
python
Folder._copysequences
(self, fromfolder, refileditems)
Helper for refilemessages() to copy sequences.
Helper for refilemessages() to copy sequences.
[ "Helper", "for", "refilemessages", "()", "to", "copy", "sequences", "." ]
def _copysequences(self, fromfolder, refileditems): """Helper for refilemessages() to copy sequences.""" fromsequences = fromfolder.getsequences() tosequences = self.getsequences() changed = 0 for name, seq in fromsequences.items(): try: toseq = tosequ...
[ "def", "_copysequences", "(", "self", ",", "fromfolder", ",", "refileditems", ")", ":", "fromsequences", "=", "fromfolder", ".", "getsequences", "(", ")", "tosequences", "=", "self", ".", "getsequences", "(", ")", "changed", "=", "0", "for", "name", ",", "...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/mhlib.py#L525-L544
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/lang/c3/codegenerator.py
python
CodeGenerator.gen_binop
(self, expr: ast.Binop)
return self.emit( ir.Binop(a_val, expr.op, b_val, "binop", a_val.ty), loc=expr.loc )
Generate code for binary operation
Generate code for binary operation
[ "Generate", "code", "for", "binary", "operation" ]
def gen_binop(self, expr: ast.Binop): """ Generate code for binary operation """ assert isinstance(expr, ast.Binop) assert expr.op not in ast.Binop.cond_ops expr.lvalue = False # Dealing with simple arithmatic a_val = self.gen_expr_code(expr.a, rvalue=True) b_val...
[ "def", "gen_binop", "(", "self", ",", "expr", ":", "ast", ".", "Binop", ")", ":", "assert", "isinstance", "(", "expr", ",", "ast", ".", "Binop", ")", "assert", "expr", ".", "op", "not", "in", "ast", ".", "Binop", ".", "cond_ops", "expr", ".", "lval...
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/lang/c3/codegenerator.py#L705-L721
merenlab/anvio
9b792e2cedc49ecb7c0bed768261595a0d87c012
anvio/kegg.py
python
KeggSetup.is_user_database_exists
(self)
This function checks whether user data has already been set up in the provided input directory.
This function checks whether user data has already been set up in the provided input directory.
[ "This", "function", "checks", "whether", "user", "data", "has", "already", "been", "set", "up", "in", "the", "provided", "input", "directory", "." ]
def is_user_database_exists(self): """This function checks whether user data has already been set up in the provided input directory.""" if os.path.exists(self.user_modules_db_path): raise ConfigError(f"It seems you already have a user modules database installed at '{self.user_modules_db_pa...
[ "def", "is_user_database_exists", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "user_modules_db_path", ")", ":", "raise", "ConfigError", "(", "f\"It seems you already have a user modules database installed at '{self.user_modules_db_path}'...
https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/kegg.py#L536-L541
NTMC-Community/MatchZoo
8a487ee5a574356fc91e4f48e219253dc11bcff2
matchzoo/engine/base_metric.py
python
BaseMetric.__call__
(self, y_true: np.array, y_pred: np.array)
Call to compute the metric. :param y_true: An array of groud truth labels. :param y_pred: An array of predicted values. :return: Evaluation of the metric.
Call to compute the metric.
[ "Call", "to", "compute", "the", "metric", "." ]
def __call__(self, y_true: np.array, y_pred: np.array) -> float: """ Call to compute the metric. :param y_true: An array of groud truth labels. :param y_pred: An array of predicted values. :return: Evaluation of the metric. """
[ "def", "__call__", "(", "self", ",", "y_true", ":", "np", ".", "array", ",", "y_pred", ":", "np", ".", "array", ")", "->", "float", ":" ]
https://github.com/NTMC-Community/MatchZoo/blob/8a487ee5a574356fc91e4f48e219253dc11bcff2/matchzoo/engine/base_metric.py#L14-L21
VIDA-NYU/reprozip
67bbe8d2e22e0493ba0ccc78521729b49dd70a1d
reprounzip/reprounzip/unpackers/provviewer.py
python
xml_escape
(s)
return (("%s" % s).replace('&', '&amp;').replace('"', '&quot;') .replace('<', '&lg;').replace('>', '&gt;'))
Escapes for XML.
Escapes for XML.
[ "Escapes", "for", "XML", "." ]
def xml_escape(s): """Escapes for XML. """ return (("%s" % s).replace('&', '&amp;').replace('"', '&quot;') .replace('<', '&lg;').replace('>', '&gt;'))
[ "def", "xml_escape", "(", "s", ")", ":", "return", "(", "(", "\"%s\"", "%", "s", ")", ".", "replace", "(", "'&'", ",", "'&amp;'", ")", ".", "replace", "(", "'\"'", ",", "'&quot;'", ")", ".", "replace", "(", "'<'", ",", "'&lg;'", ")", ".", "replac...
https://github.com/VIDA-NYU/reprozip/blob/67bbe8d2e22e0493ba0ccc78521729b49dd70a1d/reprounzip/reprounzip/unpackers/provviewer.py#L30-L34
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/tempfile.py
python
_TemporaryFileWrapper.__getattr__
(self, name)
return a
[]
def __getattr__(self, name): # Attribute lookups are delegated to the underlying file # and cached for non-numeric results # (i.e. methods are cached, closed and friends are not) file = self.__dict__['file'] a = getattr(file, name) if hasattr(a, '__call__'): f...
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "# Attribute lookups are delegated to the underlying file", "# and cached for non-numeric results", "# (i.e. methods are cached, closed and friends are not)", "file", "=", "self", ".", "__dict__", "[", "'file'", "]", "a"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tempfile.py#L464-L481
P1sec/QCSuper
c8cb8e2a115abaa27a7c3e657ac4961ef8d8354d
inputs/_base_input.py
python
BaseInput.__init__
(self)
Inter-thread context used for dispatching responses, when the self.send_recv() response is called
Inter-thread context used for dispatching responses, when the self.send_recv() response is called
[ "Inter", "-", "thread", "context", "used", "for", "dispatching", "responses", "when", "the", "self", ".", "send_recv", "()", "response", "is", "called" ]
def __init__(self): self.modules = [] # Instances for running modules self.modules_already_initialized = False # Whether these instances have been initialized yet """ Inter-thread context used for dispatching responses, when the self.send_recv()...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "modules", "=", "[", "]", "# Instances for running modules", "self", ".", "modules_already_initialized", "=", "False", "# Whether these instances have been initialized yet", "self", ".", "event_diag_response_received", ...
https://github.com/P1sec/QCSuper/blob/c8cb8e2a115abaa27a7c3e657ac4961ef8d8354d/inputs/_base_input.py#L32-L70
heynemann/pyccuracy
0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6
pyccuracy/airspeed.py
python
IncludeDirective.evaluate
(self, stream, namespace, loader)
[]
def evaluate(self, stream, namespace, loader): stream.write(loader.load_text(self.name.calculate(namespace, loader)))
[ "def", "evaluate", "(", "self", ",", "stream", ",", "namespace", ",", "loader", ")", ":", "stream", ".", "write", "(", "loader", ".", "load_text", "(", "self", ".", "name", ".", "calculate", "(", "namespace", ",", "loader", ")", ")", ")" ]
https://github.com/heynemann/pyccuracy/blob/0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6/pyccuracy/airspeed.py#L842-L843
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/cffLib/__init__.py
python
IndexCompiler.getItems
(self, items, strings)
return items
[]
def getItems(self, items, strings): return items
[ "def", "getItems", "(", "self", ",", "items", ",", "strings", ")", ":", "return", "items" ]
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/cffLib/__init__.py#L553-L554
nosmokingbandit/Watcher3
0217e75158b563bdefc8e01c3be7620008cf3977
lib/sqlalchemy/orm/base.py
python
_entity_descriptor
(entity, key)
Return a class attribute given an entity and string name. May return :class:`.InstrumentedAttribute` or user-defined attribute.
Return a class attribute given an entity and string name.
[ "Return", "a", "class", "attribute", "given", "an", "entity", "and", "string", "name", "." ]
def _entity_descriptor(entity, key): """Return a class attribute given an entity and string name. May return :class:`.InstrumentedAttribute` or user-defined attribute. """ insp = inspection.inspect(entity) if insp.is_selectable: description = entity entity = insp.c elif ins...
[ "def", "_entity_descriptor", "(", "entity", ",", "key", ")", ":", "insp", "=", "inspection", ".", "inspect", "(", "entity", ")", "if", "insp", ".", "is_selectable", ":", "description", "=", "entity", "entity", "=", "insp", ".", "c", "elif", "insp", ".", ...
https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/orm/base.py#L359-L384
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/webserve.py
python
WebInterface.home_stats
(self, time_range=30, stats_type='plays', stats_count=10, **kwargs)
return serve_template(templatename="home_stats.html", title="Stats", data=stats_data)
[]
def home_stats(self, time_range=30, stats_type='plays', stats_count=10, **kwargs): data_factory = datafactory.DataFactory() stats_data = data_factory.get_home_stats(time_range=time_range, stats_type=stats_type, ...
[ "def", "home_stats", "(", "self", ",", "time_range", "=", "30", ",", "stats_type", "=", "'plays'", ",", "stats_count", "=", "10", ",", "*", "*", "kwargs", ")", ":", "data_factory", "=", "datafactory", ".", "DataFactory", "(", ")", "stats_data", "=", "dat...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/webserve.py#L400-L406
x0rz/EQGRP_Lost_in_Translation
6692b1486f562f027567a49523b8c151a4050988
windows/fuzzbunch/pyreadline/modes/emacs.py
python
EmacsMode.tilde_expand
(self, e)
Perform tilde expansion on the current word.
Perform tilde expansion on the current word.
[ "Perform", "tilde", "expansion", "on", "the", "current", "word", "." ]
def tilde_expand(self, e): # (M-~) '''Perform tilde expansion on the current word.''' pass
[ "def", "tilde_expand", "(", "self", ",", "e", ")", ":", "# (M-~)", "pass" ]
https://github.com/x0rz/EQGRP_Lost_in_Translation/blob/6692b1486f562f027567a49523b8c151a4050988/windows/fuzzbunch/pyreadline/modes/emacs.py#L483-L485
tanghaibao/jcvi
5e720870c0928996f8b77a38208106ff0447ccb6
jcvi/utils/cbook.py
python
tile
(lt, width=70, gap=1)
return "\n".join("".join(x) for x in g)
Pretty print list of items.
Pretty print list of items.
[ "Pretty", "print", "list", "of", "items", "." ]
def tile(lt, width=70, gap=1): """ Pretty print list of items. """ from more_itertools import grouper max_len = max(len(x) for x in lt) + gap items_per_line = max(width // max_len, 1) lt = [x.rjust(max_len) for x in lt] g = list(grouper(lt, items_per_line, fillvalue="")) return "\n...
[ "def", "tile", "(", "lt", ",", "width", "=", "70", ",", "gap", "=", "1", ")", ":", "from", "more_itertools", "import", "grouper", "max_len", "=", "max", "(", "len", "(", "x", ")", "for", "x", "in", "lt", ")", "+", "gap", "items_per_line", "=", "m...
https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/utils/cbook.py#L432-L443
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_configmap.py
python
Yedit.delete
(self, path, index=None, value=None)
return (True, self.yaml_dict)
remove path from a dict
remove path from a dict
[ "remove", "path", "from", "a", "dict" ]
def delete(self, path, index=None, value=None): ''' remove path from a dict''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if entry is None: return (False, self.yaml_dict) result = Yedit.re...
[ "def", "delete", "(", "self", ",", "path", ",", "index", "=", "None", ",", "value", "=", "None", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separator", ")", "except"...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_configmap.py#L475-L489
hhstore/annotated-py-projects
4f4eca9a3913a19983cae496279a72699c083a0b
asyncio/asyncio-3.4.3/asyncio/sslproto.py
python
_SSLPipe.feed_ssldata
(self, data, only_handshake=False)
return (ssldata, appdata)
Feed SSL record level data into the pipe. The data must be a bytes instance. It is OK to send an empty bytes instance. This can be used to get ssldata for a handshake initiated by this endpoint. Return a (ssldata, appdata) tuple. The ssldata element is a list of buffers contain...
Feed SSL record level data into the pipe.
[ "Feed", "SSL", "record", "level", "data", "into", "the", "pipe", "." ]
def feed_ssldata(self, data, only_handshake=False): """Feed SSL record level data into the pipe. The data must be a bytes instance. It is OK to send an empty bytes instance. This can be used to get ssldata for a handshake initiated by this endpoint. Return a (ssldata, appdata) ...
[ "def", "feed_ssldata", "(", "self", ",", "data", ",", "only_handshake", "=", "False", ")", ":", "if", "self", ".", "_state", "==", "_UNWRAPPED", ":", "# If unwrapped, pass plaintext data straight through.", "if", "data", ":", "appdata", "=", "[", "data", "]", ...
https://github.com/hhstore/annotated-py-projects/blob/4f4eca9a3913a19983cae496279a72699c083a0b/asyncio/asyncio-3.4.3/asyncio/sslproto.py#L168-L240
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/codecs.py
python
getreader
(encoding)
return lookup(encoding).streamreader
Lookup up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found.
Lookup up the codec for the given encoding and return its StreamReader class or factory function.
[ "Lookup", "up", "the", "codec", "for", "the", "given", "encoding", "and", "return", "its", "StreamReader", "class", "or", "factory", "function", "." ]
def getreader(encoding): """ Lookup up the codec for the given encoding and return its StreamReader class or factory function. Raises a LookupError in case the encoding cannot be found. """ return lookup(encoding).streamreader
[ "def", "getreader", "(", "encoding", ")", ":", "return", "lookup", "(", "encoding", ")", ".", "streamreader" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/codecs.py#L976-L984
Netflix/vmaf
e768a2be57116c76bf33be7f8ee3566d8b774664
python/vmaf/core/executor.py
python
NorefExecutorMixin._get_workfile_yuv_type
(asset)
Same as original yuv type, unless it is notyuv; in this case, use format as set at a higher level
Same as original yuv type, unless it is notyuv; in this case, use format as set at a higher level
[ "Same", "as", "original", "yuv", "type", "unless", "it", "is", "notyuv", ";", "in", "this", "case", "use", "format", "as", "set", "at", "a", "higher", "level" ]
def _get_workfile_yuv_type(asset): """ Same as original yuv type, unless it is notyuv; in this case, use format as set at a higher level""" if asset.dis_yuv_type == 'notyuv': return asset.workfile_yuv_type else: return asset.dis_yuv_type
[ "def", "_get_workfile_yuv_type", "(", "asset", ")", ":", "if", "asset", ".", "dis_yuv_type", "==", "'notyuv'", ":", "return", "asset", ".", "workfile_yuv_type", "else", ":", "return", "asset", ".", "dis_yuv_type" ]
https://github.com/Netflix/vmaf/blob/e768a2be57116c76bf33be7f8ee3566d8b774664/python/vmaf/core/executor.py#L833-L840
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/distutils/command/register.py
python
register.classifiers
(self)
Fetch the list of classifiers from the server.
Fetch the list of classifiers from the server.
[ "Fetch", "the", "list", "of", "classifiers", "from", "the", "server", "." ]
def classifiers(self): ''' Fetch the list of classifiers from the server. ''' url = self.repository+'?:action=list_classifiers' response = urllib.request.urlopen(url) log.info(self._read_pypi_response(response))
[ "def", "classifiers", "(", "self", ")", ":", "url", "=", "self", ".", "repository", "+", "'?:action=list_classifiers'", "response", "=", "urllib", ".", "request", ".", "urlopen", "(", "url", ")", "log", ".", "info", "(", "self", ".", "_read_pypi_response", ...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/distutils/command/register.py#L85-L90
ipython/ipyparallel
d35d4fb9501da5b3280b11e83ed633a95f17be1d
ipyparallel/client/view.py
python
DirectView._really_apply
( self, f, args=None, kwargs=None, targets=None, block=None, track=None )
return ar
calls f(*args, **kwargs) on remote engines, returning the result. This method sets all of `apply`'s flags via this View's attributes. Parameters ---------- f : callable args : list [default: empty] kwargs : dict [default: empty] targets : target list [default: s...
calls f(*args, **kwargs) on remote engines, returning the result.
[ "calls", "f", "(", "*", "args", "**", "kwargs", ")", "on", "remote", "engines", "returning", "the", "result", "." ]
def _really_apply( self, f, args=None, kwargs=None, targets=None, block=None, track=None ): """calls f(*args, **kwargs) on remote engines, returning the result. This method sets all of `apply`'s flags via this View's attributes. Parameters ---------- f : callable ...
[ "def", "_really_apply", "(", "self", ",", "f", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "targets", "=", "None", ",", "block", "=", "None", ",", "track", "=", "None", ")", ":", "args", "=", "[", "]", "if", "args", "is", "None", ...
https://github.com/ipython/ipyparallel/blob/d35d4fb9501da5b3280b11e83ed633a95f17be1d/ipyparallel/client/view.py#L541-L601
labmlai/labml
97fac318b8e260b80295efe54a6f9fe0e4d2f958
remote/labml_remote/cli/basic.py
python
prepare
(server: str, show_output: bool)
Setup python, Rsync and Update pip packages
Setup python, Rsync and Update pip packages
[ "Setup", "python", "Rsync", "and", "Update", "pip", "packages" ]
def prepare(server: str, show_output: bool): """Setup python, Rsync and Update pip packages""" for k in util.get_servers(server): SERVERS[k].setup(ui_mode=UIMode.full if show_output else UIMode.dots) SERVERS[k].rsync(ui_mode=UIMode.full if show_output else UIMode.dots) SERVERS[k].update_...
[ "def", "prepare", "(", "server", ":", "str", ",", "show_output", ":", "bool", ")", ":", "for", "k", "in", "util", ".", "get_servers", "(", "server", ")", ":", "SERVERS", "[", "k", "]", ".", "setup", "(", "ui_mode", "=", "UIMode", ".", "full", "if",...
https://github.com/labmlai/labml/blob/97fac318b8e260b80295efe54a6f9fe0e4d2f958/remote/labml_remote/cli/basic.py#L51-L57
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/python/framework/ops.py
python
Output.dtype
(self)
return self._dtype
The `DType` of elements in this tensor.
The `DType` of elements in this tensor.
[ "The", "DType", "of", "elements", "in", "this", "tensor", "." ]
def dtype(self): """The `DType` of elements in this tensor.""" return self._dtype
[ "def", "dtype", "(", "self", ")", ":", "return", "self", ".", "_dtype" ]
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/framework/ops.py#L316-L318
wohlert/semi-supervised-pytorch
7cde4959468d271552febdcfed5e1cfae9857613
semi-supervised/models/vae.py
python
VariationalAutoencoder._kld
(self, z, q_param, p_param=None)
return kl
Computes the KL-divergence of some element z. KL(q||p) = -∫ q(z) log [ p(z) / q(z) ] = -E[log p(z) - log q(z)] :param z: sample from q-distribuion :param q_param: (mu, log_var) of the q-distribution :param p_param: (mu, log_var) of the p-distribution :r...
Computes the KL-divergence of some element z.
[ "Computes", "the", "KL", "-", "divergence", "of", "some", "element", "z", "." ]
def _kld(self, z, q_param, p_param=None): """ Computes the KL-divergence of some element z. KL(q||p) = -∫ q(z) log [ p(z) / q(z) ] = -E[log p(z) - log q(z)] :param z: sample from q-distribuion :param q_param: (mu, log_var) of the q-distribution ...
[ "def", "_kld", "(", "self", ",", "z", ",", "q_param", ",", "p_param", "=", "None", ")", ":", "(", "mu", ",", "log_var", ")", "=", "q_param", "if", "self", ".", "flow", "is", "not", "None", ":", "f_z", ",", "log_det_z", "=", "self", ".", "flow", ...
https://github.com/wohlert/semi-supervised-pytorch/blob/7cde4959468d271552febdcfed5e1cfae9857613/semi-supervised/models/vae.py#L118-L148
felipessalvatore/self_driving_pi_car
7dbb67b837b58ddc492ac5ea0822d69dfe6e2d34
self_driving/ml_training/util.py
python
accuracy_per_category
(pred, label, categories)
return results
Function to give the model's accuracy for each category. :param pred: model's prediction :type pred: np.array :param label: true labels :type label: np.array :param categories: number of categories :type categories: int :return: accuracy's list :rtype: list of float
Function to give the model's accuracy for each category.
[ "Function", "to", "give", "the", "model", "s", "accuracy", "for", "each", "category", "." ]
def accuracy_per_category(pred, label, categories): """ Function to give the model's accuracy for each category. :param pred: model's prediction :type pred: np.array :param label: true labels :type label: np.array :param categories: number of categories :type categories: int :return...
[ "def", "accuracy_per_category", "(", "pred", ",", "label", ",", "categories", ")", ":", "pred", ",", "label", "=", "list", "(", "pred", ")", ",", "list", "(", "label", ")", "results", "=", "[", "]", "for", "cat", "in", "range", "(", "categories", ")"...
https://github.com/felipessalvatore/self_driving_pi_car/blob/7dbb67b837b58ddc492ac5ea0822d69dfe6e2d34/self_driving/ml_training/util.py#L66-L91
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/asset_service/client.py
python
AssetServiceClient.get_asset
( self, request: asset_service.GetAssetRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), )
return response
r"""Returns the requested asset in full detail. List of thrown errors: `AuthenticationError <>`__ `AuthorizationError <>`__ `HeaderError <>`__ `InternalError <>`__ `QuotaError <>`__ `RequestError <>`__ Args: request (:class:`google.ads.googleads.v7.services.types.GetAssetRe...
r"""Returns the requested asset in full detail.
[ "r", "Returns", "the", "requested", "asset", "in", "full", "detail", "." ]
def get_asset( self, request: asset_service.GetAssetRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> asset.Asset: r"""Returns the request...
[ "def", "get_asset", "(", "self", ",", "request", ":", "asset_service", ".", "GetAssetRequest", "=", "None", ",", "*", ",", "resource_name", ":", "str", "=", "None", ",", "retry", ":", "retries", ".", "Retry", "=", "gapic_v1", ".", "method", ".", "DEFAULT...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/asset_service/client.py#L355-L437
ilastik/ilastik
6acd2c554bc517e9c8ddad3623a7aaa2e6970c28
ilastik/applets/dataSelection/datasetDetailedInfoTableView.py
python
DatasetDetailedInfoTableView.leaveEvent
(self, event)
return super(DatasetDetailedInfoTableView, self).enterEvent(event)
Disable the remove button overlay when mouse leaves this widget.
Disable the remove button overlay when mouse leaves this widget.
[ "Disable", "the", "remove", "button", "overlay", "when", "mouse", "leaves", "this", "widget", "." ]
def leaveEvent(self, event): """ Disable the remove button overlay when mouse leaves this widget. """ self.overlay.setVisible(False) return super(DatasetDetailedInfoTableView, self).enterEvent(event)
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "self", ".", "overlay", ".", "setVisible", "(", "False", ")", "return", "super", "(", "DatasetDetailedInfoTableView", ",", "self", ")", ".", "enterEvent", "(", "event", ")" ]
https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/ilastik/applets/dataSelection/datasetDetailedInfoTableView.py#L247-L252
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/intctrl.py
python
IntCtrl.__init__
( self, parent, id=-1, value = 0, pos = wx.DefaultPosition, size = wx.DefaultSize, style = 0, validator = wx.DefaultValidator, name = "integer", min=None, max=None, limited = 0, allow_none = 0, allow_long = 0, ...
Default constructor :param `parent`: parent window :param int `id`: window identifier. A value of -1 indicates a default value :param `value`: If no initial value is set, the default will be zero, or the minimum value, if specified. If an illegal string is speci...
Default constructor
[ "Default", "constructor" ]
def __init__ ( self, parent, id=-1, value = 0, pos = wx.DefaultPosition, size = wx.DefaultSize, style = 0, validator = wx.DefaultValidator, name = "integer", min=None, max=None, limited = 0, allow_none = 0, allow_long = 0, ...
[ "def", "__init__", "(", "self", ",", "parent", ",", "id", "=", "-", "1", ",", "value", "=", "0", ",", "pos", "=", "wx", ".", "DefaultPosition", ",", "size", "=", "wx", ".", "DefaultSize", ",", "style", "=", "0", ",", "validator", "=", "wx", ".", ...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/intctrl.py#L394-L498
twelvesec/gasmask
252737157d98f84b77d876045509006373ba00d1
gasmask.py
python
Report
(engine, emails, hostnames, output_basename)
Emails & Hostnames Console report
Emails & Hostnames Console report
[ "Emails", "&", "Hostnames", "Console", "report" ]
def Report(engine, emails, hostnames, output_basename): """ Emails & Hostnames Console report """ print() print("Emails:") for email in emails: print(email) print() print("Hostnames:") for host in hostnames: print(host) print() if output_basename: output1 = ...
[ "def", "Report", "(", "engine", ",", "emails", ",", "hostnames", ",", "output_basename", ")", ":", "print", "(", ")", "print", "(", "\"Emails:\"", ")", "for", "email", "in", "emails", ":", "print", "(", "email", ")", "print", "(", ")", "print", "(", ...
https://github.com/twelvesec/gasmask/blob/252737157d98f84b77d876045509006373ba00d1/gasmask.py#L1153-L1215
getsentry/raven-python
5b3f48c66269993a0202cfc988750e5fe66e0c00
raven/utils/serializer/manager.py
python
Serializer.transform
(self, value, **kwargs)
Primary function which handles recursively transforming values via their serializers
Primary function which handles recursively transforming values via their serializers
[ "Primary", "function", "which", "handles", "recursively", "transforming", "values", "via", "their", "serializers" ]
def transform(self, value, **kwargs): """ Primary function which handles recursively transforming values via their serializers """ if value is None: return None objid = id(value) if objid in self.context: return '<...>' self.contex...
[ "def", "transform", "(", "self", ",", "value", ",", "*", "*", "kwargs", ")", ":", "if", "value", "is", "None", ":", "return", "None", "objid", "=", "id", "(", "value", ")", "if", "objid", "in", "self", ".", "context", ":", "return", "'<...>'", "sel...
https://github.com/getsentry/raven-python/blob/5b3f48c66269993a0202cfc988750e5fe66e0c00/raven/utils/serializer/manager.py#L52-L85
dbcli/mssql-cli
6509aa2fc226dde8ce6bab7af9cbb5f03717b936
mssqlcli/jsonrpc/contracts/connectionservice.py
python
ConnectionRequest.decode_response
(response)
return response
Decode response dictionary into a Connection parameter type.
Decode response dictionary into a Connection parameter type.
[ "Decode", "response", "dictionary", "into", "a", "Connection", "parameter", "type", "." ]
def decode_response(response): """ Decode response dictionary into a Connection parameter type. """ if u'result' in response: return ConnectionResponse(response) if 'method' in response and response['method'] == 'connection/complete': return Connecti...
[ "def", "decode_response", "(", "response", ")", ":", "if", "u'result'", "in", "response", ":", "return", "ConnectionResponse", "(", "response", ")", "if", "'method'", "in", "response", "and", "response", "[", "'method'", "]", "==", "'connection/complete'", ":", ...
https://github.com/dbcli/mssql-cli/blob/6509aa2fc226dde8ce6bab7af9cbb5f03717b936/mssqlcli/jsonrpc/contracts/connectionservice.py#L31-L43
IdentityPython/pysaml2
6badb32d212257bd83ffcc816f9b625f68281b47
src/saml2/__init__.py
python
element_to_extension_element
(element)
return exel
Convert an element into a extension element :param element: The element instance :return: An extension element instance
Convert an element into a extension element
[ "Convert", "an", "element", "into", "a", "extension", "element" ]
def element_to_extension_element(element): """ Convert an element into a extension element :param element: The element instance :return: An extension element instance """ exel = ExtensionElement(element.c_tag, element.c_namespace, text=element.text) exel.attrib...
[ "def", "element_to_extension_element", "(", "element", ")", ":", "exel", "=", "ExtensionElement", "(", "element", ".", "c_tag", ",", "element", ".", "c_namespace", ",", "text", "=", "element", ".", "text", ")", "exel", ".", "attributes", ".", "update", "(", ...
https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/__init__.py#L928-L951
django-fluent/django-fluent-contents
5577567303d29b56fd48128c22c7dc5d8b2c7476
fluent_contents/admin/genericextensions.py
python
BaseInitialGenericInlineFormSet.__initial_minus_queryset
(self)
return list(filter(initial_not_in_queryset, self._initial))
Gives all elements from self._initial having a slot value that is not already in self.get_queryset()
Gives all elements from self._initial having a slot value that is not already in self.get_queryset()
[ "Gives", "all", "elements", "from", "self", ".", "_initial", "having", "a", "slot", "value", "that", "is", "not", "already", "in", "self", ".", "get_queryset", "()" ]
def __initial_minus_queryset(self): """ Gives all elements from self._initial having a slot value that is not already in self.get_queryset() """ queryset = self.get_queryset() def initial_not_in_queryset(initial): for x in queryset: if x.slot ...
[ "def", "__initial_minus_queryset", "(", "self", ")", ":", "queryset", "=", "self", ".", "get_queryset", "(", ")", "def", "initial_not_in_queryset", "(", "initial", ")", ":", "for", "x", "in", "queryset", ":", "if", "x", ".", "slot", "==", "initial", "[", ...
https://github.com/django-fluent/django-fluent-contents/blob/5577567303d29b56fd48128c22c7dc5d8b2c7476/fluent_contents/admin/genericextensions.py#L62-L76
jacoxu/encoder_decoder
6829c3bc42105aedfd1b8a81c81be19df4326c0a
keras/old_models.py
python
Graph.fit
(self, data, batch_size=128, nb_epoch=100, verbose=1, callbacks=[], validation_split=0., validation_data=None, shuffle=True, show_accuracy=False, class_weight={}, sample_weight={})
return history
Train the model for a fixed number of epochs. Returns a history object. Its `history` attribute is a record of training loss values at successive epochs, as well as validation loss values (if applicable). # Arguments data: dictionary mapping input names and outputs names to...
Train the model for a fixed number of epochs.
[ "Train", "the", "model", "for", "a", "fixed", "number", "of", "epochs", "." ]
def fit(self, data, batch_size=128, nb_epoch=100, verbose=1, callbacks=[], validation_split=0., validation_data=None, shuffle=True, show_accuracy=False, class_weight={}, sample_weight={}): '''Train the model for a fixed number of epochs. Returns a history object. Its...
[ "def", "fit", "(", "self", ",", "data", ",", "batch_size", "=", "128", ",", "nb_epoch", "=", "100", ",", "verbose", "=", "1", ",", "callbacks", "=", "[", "]", ",", "validation_split", "=", "0.", ",", "validation_data", "=", "None", ",", "shuffle", "=...
https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/old_models.py#L1316-L1404
pyodide/pyodide
dcef27fe3783fada747f257cce387ca1347dd514
packages/micropip/src/micropip/externals/pip/_vendor/pkg_resources.py
python
Requirement.__init__
(self, requirement_string)
DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!
DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!
[ "DO", "NOT", "CALL", "THIS", "UNDOCUMENTED", "METHOD", ";", "use", "Requirement", ".", "parse", "()", "!" ]
def __init__(self, requirement_string): """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!""" try: super(Requirement, self).__init__(requirement_string) except packaging.requirements.InvalidRequirement as e: raise RequirementParseError(str(e)) self....
[ "def", "__init__", "(", "self", ",", "requirement_string", ")", ":", "try", ":", "super", "(", "Requirement", ",", "self", ")", ".", "__init__", "(", "requirement_string", ")", "except", "packaging", ".", "requirements", ".", "InvalidRequirement", "as", "e", ...
https://github.com/pyodide/pyodide/blob/dcef27fe3783fada747f257cce387ca1347dd514/packages/micropip/src/micropip/externals/pip/_vendor/pkg_resources.py#L458-L475
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/config/local_config.py
python
Config._get_helper
(self, key_name='', default=None, value_is_relative_path=False)
return value
Helper for get and get_absolute_functions.
Helper for get and get_absolute_functions.
[ "Helper", "for", "get", "and", "get_absolute_functions", "." ]
def _get_helper(self, key_name='', default=None, value_is_relative_path=False): """Helper for get and get_absolute_functions.""" if self._root: key_name = self._root + SEPARATOR + key_name if key_name else self._root if not key_name: raise errors.InvalidConfigKey(key_name) ...
[ "def", "_get_helper", "(", "self", ",", "key_name", "=", "''", ",", "default", "=", "None", ",", "value_is_relative_path", "=", "False", ")", ":", "if", "self", ".", "_root", ":", "key_name", "=", "self", ".", "_root", "+", "SEPARATOR", "+", "key_name", ...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/config/local_config.py#L162-L182
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/models/charlm.py
python
repackage_hidden
(h)
Wraps hidden states in new Tensors, to detach them from their history.
Wraps hidden states in new Tensors, to detach them from their history.
[ "Wraps", "hidden", "states", "in", "new", "Tensors", "to", "detach", "them", "from", "their", "history", "." ]
def repackage_hidden(h): """Wraps hidden states in new Tensors, to detach them from their history.""" if isinstance(h, torch.Tensor): return h.detach() else: return tuple(repackage_hidden(v) for v in h)
[ "def", "repackage_hidden", "(", "h", ")", ":", "if", "isinstance", "(", "h", ",", "torch", ".", "Tensor", ")", ":", "return", "h", ".", "detach", "(", ")", "else", ":", "return", "tuple", "(", "repackage_hidden", "(", "v", ")", "for", "v", "in", "h...
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/charlm.py#L25-L31
dpgaspar/Flask-AppBuilder
557249f33b66d02a48c1322ef21324b815abe18e
flask_appbuilder/cli.py
python
create_user
(role, username, firstname, lastname, email, password)
Create a user
Create a user
[ "Create", "a", "user" ]
def create_user(role, username, firstname, lastname, email, password): """ Create a user """ user = current_app.appbuilder.sm.find_user(username=username) if user: click.echo(click.style(f"Error! User already exists {username}", fg="red")) return user = current_app.appbuilder...
[ "def", "create_user", "(", "role", ",", "username", ",", "firstname", ",", "lastname", ",", "email", ",", "password", ")", ":", "user", "=", "current_app", ".", "appbuilder", ".", "sm", ".", "find_user", "(", "username", "=", "username", ")", "if", "user...
https://github.com/dpgaspar/Flask-AppBuilder/blob/557249f33b66d02a48c1322ef21324b815abe18e/flask_appbuilder/cli.py#L91-L113
brightmart/slot_filling_intent_joint_model
06ee6932bca2e07b3667e7edbef878a79cdcf2d1
joint_model_knowl_v4_cnn_with_symbol_alime/a1_data_util.py
python
generate_training_data
(data_file,knowledge_path,test_mode=False,vocabulary_size=None,sequence_length=15)
return result
generate training data from a file, return training,validation and test set. traininig data contain x,y_intent,y_slots: x for sentence,y_intent for intent,y_slots for slots
generate training data from a file, return training,validation and test set. traininig data contain x,y_intent,y_slots: x for sentence,y_intent for intent,y_slots for slots
[ "generate", "training", "data", "from", "a", "file", "return", "training", "validation", "and", "test", "set", ".", "traininig", "data", "contain", "x", "y_intent", "y_slots", ":", "x", "for", "sentence", "y_intent", "for", "intent", "y_slots", "for", "slots" ...
def generate_training_data(data_file,knowledge_path,test_mode=False,vocabulary_size=None,sequence_length=15): """generate training data from a file, return training,validation and test set. traininig data contain x,y_intent,y_slots: x for sentence,y_intent for intent,y_slots for slots""" cache_file = kno...
[ "def", "generate_training_data", "(", "data_file", ",", "knowledge_path", ",", "test_mode", "=", "False", ",", "vocabulary_size", "=", "None", ",", "sequence_length", "=", "15", ")", ":", "cache_file", "=", "knowledge_path", "+", "'/cache_data.npy'", "print", "(",...
https://github.com/brightmart/slot_filling_intent_joint_model/blob/06ee6932bca2e07b3667e7edbef878a79cdcf2d1/joint_model_knowl_v4_cnn_with_symbol_alime/a1_data_util.py#L22-L63
otsaloma/gaupol
6dec7826654d223c71a8d3279dcd967e95c46714
gaupol/dialogs/position_transform.py
python
PositionTransformDialog._on_response
(self, dialog, response)
Save target and transform positions.
Save target and transform positions.
[ "Save", "target", "and", "transform", "positions", "." ]
def _on_response(self, dialog, response): """Save target and transform positions.""" gaupol.conf.position_transform.target = self._get_target() if response == Gtk.ResponseType.OK: self._transform_positions()
[ "def", "_on_response", "(", "self", ",", "dialog", ",", "response", ")", ":", "gaupol", ".", "conf", ".", "position_transform", ".", "target", "=", "self", ".", "_get_target", "(", ")", "if", "response", "==", "Gtk", ".", "ResponseType", ".", "OK", ":", ...
https://github.com/otsaloma/gaupol/blob/6dec7826654d223c71a8d3279dcd967e95c46714/gaupol/dialogs/position_transform.py#L145-L149
fooying/3102
0faee38c30b2e24154f41e68457cfd8f7a61c040
thirdparty/yaml/__init__.py
python
scan
(stream, Loader=Loader)
Scan a YAML stream and produce scanning tokens.
Scan a YAML stream and produce scanning tokens.
[ "Scan", "a", "YAML", "stream", "and", "produce", "scanning", "tokens", "." ]
def scan(stream, Loader=Loader): """ Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) try: while loader.check_token(): yield loader.get_token() finally: loader.dispose()
[ "def", "scan", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_token", "(", ")", ":", "yield", "loader", ".", "get_token", "(", ")", "finally", ":", "loade...
https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/yaml/__init__.py#L19-L28
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/function.py
python
block.at
(cls, bounds)
return cls.at(left)
Return the ``idaapi.BasicBlock`` identified by `bounds`.
Return the ``idaapi.BasicBlock`` identified by `bounds`.
[ "Return", "the", "idaapi", ".", "BasicBlock", "identified", "by", "bounds", "." ]
def at(cls, bounds): '''Return the ``idaapi.BasicBlock`` identified by `bounds`.''' left, _ = bounds return cls.at(left)
[ "def", "at", "(", "cls", ",", "bounds", ")", ":", "left", ",", "_", "=", "bounds", "return", "cls", ".", "at", "(", "left", ")" ]
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/function.py#L1184-L1187
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/netdata/sensor.py
python
NetdataAlarms.available
(self)
return self.netdata.available
Could the resource be accessed during the last update call.
Could the resource be accessed during the last update call.
[ "Could", "the", "resource", "be", "accessed", "during", "the", "last", "update", "call", "." ]
def available(self): """Could the resource be accessed during the last update call.""" return self.netdata.available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "netdata", ".", "available" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/netdata/sensor.py#L189-L191
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py
python
Session.delete
(self, url, **kwargs)
return self.request('DELETE', url, **kwargs)
Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response
Sends a DELETE request. Returns :class:`Response` object.
[ "Sends", "a", "DELETE", "request", ".", "Returns", ":", "class", ":", "Response", "object", "." ]
def delete(self, url, **kwargs): """Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request('DELETE', u...
[ "def", "delete", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "request", "(", "'DELETE'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py#L546-L554
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py
python
hybrid_property.deleter
(self, fdel)
return self._copy(fdel=fdel)
Provide a modifying decorator that defines a deletion method.
Provide a modifying decorator that defines a deletion method.
[ "Provide", "a", "modifying", "decorator", "that", "defines", "a", "deletion", "method", "." ]
def deleter(self, fdel): """Provide a modifying decorator that defines a deletion method.""" return self._copy(fdel=fdel)
[ "def", "deleter", "(", "self", ",", "fdel", ")", ":", "return", "self", ".", "_copy", "(", "fdel", "=", "fdel", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py#L939-L942
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/interpolate/interpolate.py
python
PPoly.from_spline
(cls, tck, extrapolate=None)
return cls.construct_fast(cvals, t, extrapolate)
Construct a piecewise polynomial from a spline Parameters ---------- tck A spline, as returned by `splrep` extrapolate : bool or 'periodic', optional If bool, determines whether to extrapolate to out-of-bounds points based on first and last intervals,...
Construct a piecewise polynomial from a spline
[ "Construct", "a", "piecewise", "polynomial", "from", "a", "spline" ]
def from_spline(cls, tck, extrapolate=None): """ Construct a piecewise polynomial from a spline Parameters ---------- tck A spline, as returned by `splrep` extrapolate : bool or 'periodic', optional If bool, determines whether to extrapolate to ou...
[ "def", "from_spline", "(", "cls", ",", "tck", ",", "extrapolate", "=", "None", ")", ":", "t", ",", "c", ",", "k", "=", "tck", "cvals", "=", "np", ".", "empty", "(", "(", "k", "+", "1", ",", "len", "(", "t", ")", "-", "1", ")", ",", "dtype",...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/interpolate/interpolate.py#L1163-L1183
michaldaniel/ebook-viewer
975a7bcecabcf4739363cbd87a88c1c1b4551f1c
src/components/header_bar.py
python
HeaderBarComponent.__on_open_clicked
(self, button)
Handles Open Document button clicked, shows file selector, saves book data and loads new book :param button:
Handles Open Document button clicked, shows file selector, saves book data and loads new book :param button:
[ "Handles", "Open", "Document", "button", "clicked", "shows", "file", "selector", "saves", "book", "data", "and", "loads", "new", "book", ":", "param", "button", ":" ]
def __on_open_clicked(self, button): """ Handles Open Document button clicked, shows file selector, saves book data and loads new book :param button: """ # Loads file chooser component file_chooser_component = file_chooser.FileChooserWindow() (response, filename)...
[ "def", "__on_open_clicked", "(", "self", ",", "button", ")", ":", "# Loads file chooser component", "file_chooser_component", "=", "file_chooser", ".", "FileChooserWindow", "(", ")", "(", "response", ",", "filename", ")", "=", "file_chooser_component", ".", "show_dial...
https://github.com/michaldaniel/ebook-viewer/blob/975a7bcecabcf4739363cbd87a88c1c1b4551f1c/src/components/header_bar.py#L212-L230
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py
python
Session.delete
(self, url, **kwargs)
return self.request('DELETE', url, **kwargs)
r"""Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response
r"""Sends a DELETE request. Returns :class:`Response` object.
[ "r", "Sends", "a", "DELETE", "request", ".", "Returns", ":", "class", ":", "Response", "object", "." ]
def delete(self, url, **kwargs): r"""Sends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ return self.request('DELETE', ...
[ "def", "delete", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "request", "(", "'DELETE'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py#L607-L615
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_5.9/pyasn1/debug.py
python
Scope.pop
(self)
return self._list.pop()
[]
def pop(self): return self._list.pop()
[ "def", "pop", "(", "self", ")", ":", "return", "self", ".", "_list", ".", "pop", "(", ")" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/pyasn1/debug.py#L62-L63
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/winobject/event_log.py
python
ChannelConfig.classic
(self)
return bool(chaninfo(self, gdef.EvtChannelConfigClassicEventlog).value)
``True`` if the channel is a classic event channel (for example the Application or System log)
``True`` if the channel is a classic event channel (for example the Application or System log)
[ "True", "if", "the", "channel", "is", "a", "classic", "event", "channel", "(", "for", "example", "the", "Application", "or", "System", "log", ")" ]
def classic(self): """``True`` if the channel is a classic event channel (for example the Application or System log)""" return bool(chaninfo(self, gdef.EvtChannelConfigClassicEventlog).value)
[ "def", "classic", "(", "self", ")", ":", "return", "bool", "(", "chaninfo", "(", "self", ",", "gdef", ".", "EvtChannelConfigClassicEventlog", ")", ".", "value", ")" ]
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winobject/event_log.py#L558-L560
caronc/apprise
e5945e0be1b7051ab4890bf78949058304f2d641
apprise/attachment/AttachBase.py
python
AttachBase.parse_url
(url, verify_host=True, mimetype_db=None)
return results
Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with the parsed URL which some child classes will ...
Parses the URL and returns it broken apart into a dictionary.
[ "Parses", "the", "URL", "and", "returns", "it", "broken", "apart", "into", "a", "dictionary", "." ]
def parse_url(url, verify_host=True, mimetype_db=None): """Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept ...
[ "def", "parse_url", "(", "url", ",", "verify_host", "=", "True", ",", "mimetype_db", "=", "None", ")", ":", "results", "=", "URLBase", ".", "parse_url", "(", "url", ",", "verify_host", "=", "verify_host", ")", "if", "not", "results", ":", "# We're done; we...
https://github.com/caronc/apprise/blob/e5945e0be1b7051ab4890bf78949058304f2d641/apprise/attachment/AttachBase.py#L314-L359
wanggrun/Adaptively-Connected-Neural-Networks
e27066ef52301bdafa5932f43af8feeb23647edb
tensorpack-installed/build/lib/tensorpack/utils/timer.py
python
print_total_timer
()
Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits.
Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits.
[ "Print", "the", "content", "of", "the", "TotalTimer", "if", "it", "s", "not", "empty", ".", "This", "function", "will", "automatically", "get", "called", "when", "program", "exits", "." ]
def print_total_timer(): """ Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits. """ if len(_TOTAL_TIMER_DATA) == 0: return for k, v in six.iteritems(_TOTAL_TIMER_DATA): logger.info("Total Time: {} -> {:.2f} sec,...
[ "def", "print_total_timer", "(", ")", ":", "if", "len", "(", "_TOTAL_TIMER_DATA", ")", "==", "0", ":", "return", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "_TOTAL_TIMER_DATA", ")", ":", "logger", ".", "info", "(", "\"Total Time: {} -> {:.2f...
https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/tensorpack-installed/build/lib/tensorpack/utils/timer.py#L60-L69
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_project.py
python
Yedit.update
(self, path, value, index=None, curr_value=None)
return (False, self.yaml_dict)
put path, value into a dict
put path, value into a dict
[ "put", "path", "value", "into", "a", "dict" ]
def update(self, path, value, index=None, curr_value=None): ''' put path, value into a dict ''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if isinstance(entry, dict): # AUDIT:maybe-no-member makes ...
[ "def", "update", "(", "self", ",", "path", ",", "value", ",", "index", "=", "None", ",", "curr_value", "=", "None", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separa...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_project.py#L554-L599
ohmyadd/wetland
76d296ec66dc438606e2455a848619d446f4a4b7
paramiko/sftp_handle.py
python
SFTPHandle.chattr
(self, attr)
return SFTP_OP_UNSUPPORTED
Change the attributes of this file. The ``attr`` object will contain only those fields provided by the client in its request, so you should check for the presence of fields before using them. :param .SFTPAttributes attr: the attributes to change on this file. :return: an `int` error co...
Change the attributes of this file. The ``attr`` object will contain only those fields provided by the client in its request, so you should check for the presence of fields before using them.
[ "Change", "the", "attributes", "of", "this", "file", ".", "The", "attr", "object", "will", "contain", "only", "those", "fields", "provided", "by", "the", "client", "in", "its", "request", "so", "you", "should", "check", "for", "the", "presence", "of", "fie...
def chattr(self, attr): """ Change the attributes of this file. The ``attr`` object will contain only those fields provided by the client in its request, so you should check for the presence of fields before using them. :param .SFTPAttributes attr: the attributes to change on t...
[ "def", "chattr", "(", "self", ",", "attr", ")", ":", "return", "SFTP_OP_UNSUPPORTED" ]
https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/sftp_handle.py#L158-L167
eleurent/highway-env
9d63973da854584fe51b00ccee7b24b1bf031418
highway_env/envs/common/graphics.py
python
EnvViewer.set_agent_action_sequence
(self, actions: List['Action'])
Set the sequence of actions chosen by the agent, so that it can be displayed :param actions: list of action, following the env's action space specification
Set the sequence of actions chosen by the agent, so that it can be displayed
[ "Set", "the", "sequence", "of", "actions", "chosen", "by", "the", "agent", "so", "that", "it", "can", "be", "displayed" ]
def set_agent_action_sequence(self, actions: List['Action']) -> None: """ Set the sequence of actions chosen by the agent, so that it can be displayed :param actions: list of action, following the env's action space specification """ if isinstance(self.env.action_type, DiscreteM...
[ "def", "set_agent_action_sequence", "(", "self", ",", "actions", ":", "List", "[", "'Action'", "]", ")", "->", "None", ":", "if", "isinstance", "(", "self", ".", "env", ".", "action_type", ",", "DiscreteMetaAction", ")", ":", "actions", "=", "[", "self", ...
https://github.com/eleurent/highway-env/blob/9d63973da854584fe51b00ccee7b24b1bf031418/highway_env/envs/common/graphics.py#L70-L82
phimpme/phimpme-generator
ba6d11190b9016238f27672e1ad55e6a875b74a0
Phimpme/site-packages/requests/models.py
python
Response.apparent_encoding
(self)
return chardet.detect(self.content)['encoding']
The apparent encoding, provided by the lovely Charade library (Thanks, Ian!).
The apparent encoding, provided by the lovely Charade library (Thanks, Ian!).
[ "The", "apparent", "encoding", "provided", "by", "the", "lovely", "Charade", "library", "(", "Thanks", "Ian!", ")", "." ]
def apparent_encoding(self): """The apparent encoding, provided by the lovely Charade library (Thanks, Ian!).""" return chardet.detect(self.content)['encoding']
[ "def", "apparent_encoding", "(", "self", ")", ":", "return", "chardet", ".", "detect", "(", "self", ".", "content", ")", "[", "'encoding'", "]" ]
https://github.com/phimpme/phimpme-generator/blob/ba6d11190b9016238f27672e1ad55e6a875b74a0/Phimpme/site-packages/requests/models.py#L594-L597
MrH0wl/Cloudmare
65e5bc9888f9d362ab2abfb103ea6c1e869d67aa
thirdparty/progressbar/bar.py
python
ProgressBar.finish
(self, end='\n', dirty=False)
Puts the ProgressBar bar in the finished state. Also flushes and disables output buffering if this was the last progressbar running. Args: end (str): The string to end the progressbar with, defaults to a newline dirty (bool): When True the progressbar ke...
Puts the ProgressBar bar in the finished state.
[ "Puts", "the", "ProgressBar", "bar", "in", "the", "finished", "state", "." ]
def finish(self, end='\n', dirty=False): ''' Puts the ProgressBar bar in the finished state. Also flushes and disables output buffering if this was the last progressbar running. Args: end (str): The string to end the progressbar with, defaults to a n...
[ "def", "finish", "(", "self", ",", "end", "=", "'\\n'", ",", "dirty", "=", "False", ")", ":", "if", "not", "dirty", ":", "self", ".", "end_time", "=", "datetime", ".", "now", "(", ")", "self", ".", "update", "(", "self", ".", "max_value", ",", "f...
https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/progressbar/bar.py#L770-L790
XanaduAI/strawberryfields
298601e409528f22c6717c2d816ab68ae8bda1fa
strawberryfields/backends/base.py
python
ModeMap.valid
(self, modes)
return True
checks if the mode list is valid
checks if the mode list is valid
[ "checks", "if", "the", "mode", "list", "is", "valid" ]
def valid(self, modes): """checks if the mode list is valid""" if modes is None: return False if isinstance(modes, int): modes = [modes] # pylint: disable=len-as-condition if len(modes) == 0 or len(modes) > len(self._map): return False ...
[ "def", "valid", "(", "self", ",", "modes", ")", ":", "if", "modes", "is", "None", ":", "return", "False", "if", "isinstance", "(", "modes", ",", "int", ")", ":", "modes", "=", "[", "modes", "]", "# pylint: disable=len-as-condition", "if", "len", "(", "...
https://github.com/XanaduAI/strawberryfields/blob/298601e409528f22c6717c2d816ab68ae8bda1fa/strawberryfields/backends/base.py#L72-L88
Phype/telnet-iot-honeypot
f1d4b75245d72990d339668f37a1670fc85c0c9b
backend/backend.py
python
get_asn
(asn)
return json.dumps(info)
[]
def get_asn(asn): info = web.get_asn(asn) if not info: return "", 404 return json.dumps(info)
[ "def", "get_asn", "(", "asn", ")", ":", "info", "=", "web", ".", "get_asn", "(", "asn", ")", "if", "not", "info", ":", "return", "\"\"", ",", "404", "return", "json", ".", "dumps", "(", "info", ")" ]
https://github.com/Phype/telnet-iot-honeypot/blob/f1d4b75245d72990d339668f37a1670fc85c0c9b/backend/backend.py#L323-L328
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
official/vision/beta/projects/yolo/ops/preprocessing_ops.py
python
set_random_seeds
(seed=0)
Sets all accessible global seeds to properly apply randomization. This is not the same as passing the seed as a variable to each call to tf.random.For more, see the documentation for tf.random on the tensorflow website https://www.tensorflow.org/api_docs/python/tf/random/set_seed. Note that passing the seed to...
Sets all accessible global seeds to properly apply randomization.
[ "Sets", "all", "accessible", "global", "seeds", "to", "properly", "apply", "randomization", "." ]
def set_random_seeds(seed=0): """Sets all accessible global seeds to properly apply randomization. This is not the same as passing the seed as a variable to each call to tf.random.For more, see the documentation for tf.random on the tensorflow website https://www.tensorflow.org/api_docs/python/tf/random/set_se...
[ "def", "set_random_seeds", "(", "seed", "=", "0", ")", ":", "if", "seed", "is", "not", "None", ":", "global", "GLOBAL_SEED_SET", "random", ".", "seed", "(", "seed", ")", "GLOBAL_SEED_SET", "=", "True", "tf", ".", "random", ".", "set_seed", "(", "seed", ...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/vision/beta/projects/yolo/ops/preprocessing_ops.py#L28-L45
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/tarfile.py
python
TarFile.gzopen
(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs)
return t
Open gzip compressed tar archive name for reading or writing. Appending is not allowed.
Open gzip compressed tar archive name for reading or writing. Appending is not allowed.
[ "Open", "gzip", "compressed", "tar", "archive", "name", "for", "reading", "or", "writing", ".", "Appending", "is", "not", "allowed", "." ]
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if mode not in ("r", "w", "x"): raise ValueError("mode must be 'r', 'w' or 'x'") try: ...
[ "def", "gzopen", "(", "cls", ",", "name", ",", "mode", "=", "\"r\"", ",", "fileobj", "=", "None", ",", "compresslevel", "=", "9", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "not", "in", "(", "\"r\"", ",", "\"w\"", ",", "\"x\"", ")", ":", ...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/tarfile.py#L1610-L1641
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/scrolledthumbnail.py
python
getShadow
()
return (sh_tr, sh_bl, sh_sh.ConvertToBitmap())
Creates a shadow behind every thumbnail.
Creates a shadow behind every thumbnail.
[ "Creates", "a", "shadow", "behind", "every", "thumbnail", "." ]
def getShadow(): """ Creates a shadow behind every thumbnail. """ sh_tr = wx.Image(six.BytesIO(getDataTR())).ConvertToBitmap() sh_bl = wx.Image(six.BytesIO(getDataBL())).ConvertToBitmap() sh_sh = wx.Image(six.BytesIO(getDataSH())).Rescale(500, 500, wx.IMAGE_QUALITY_HIGH) return (sh_tr, sh_bl, sh_sh...
[ "def", "getShadow", "(", ")", ":", "sh_tr", "=", "wx", ".", "Image", "(", "six", ".", "BytesIO", "(", "getDataTR", "(", ")", ")", ")", ".", "ConvertToBitmap", "(", ")", "sh_bl", "=", "wx", ".", "Image", "(", "six", ".", "BytesIO", "(", "getDataBL",...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/scrolledthumbnail.py#L308-L314
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/lib-tk/turtle.py
python
TurtleScreenBase._createline
(self)
return self.cv.create_line(0, 0, 0, 0, fill='', width=2, capstyle=TK.ROUND)
Create an invisible line item on canvas self.cv)
Create an invisible line item on canvas self.cv)
[ "Create", "an", "invisible", "line", "item", "on", "canvas", "self", ".", "cv", ")" ]
def _createline(self): """Create an invisible line item on canvas self.cv) """ return self.cv.create_line(0, 0, 0, 0, fill='', width=2, capstyle=TK.ROUND)
[ "def", "_createline", "(", "self", ")", ":", "return", "self", ".", "cv", ".", "create_line", "(", "0", ",", "0", ",", "0", ",", "0", ",", "fill", "=", "''", ",", "width", "=", "2", ",", "capstyle", "=", "TK", ".", "ROUND", ")" ]
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/lib-tk/turtle.py#L503-L506
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/browser/ui.py
python
Widget.sort_by_row
(self, *columns, has_title=False)
Sort rows by column. Each item in columns is either a number, or a tuple (column_number, ascending).
Sort rows by column. Each item in columns is either a number, or a tuple (column_number, ascending).
[ "Sort", "rows", "by", "column", ".", "Each", "item", "in", "columns", "is", "either", "a", "number", "or", "a", "tuple", "(", "column_number", "ascending", ")", "." ]
def sort_by_row(self, *columns, has_title=False): """Sort rows by column. Each item in columns is either a number, or a tuple (column_number, ascending).""" rows = list(self._table.rows) if has_title: head = rows[0] rows = rows[1:] def first_values(row, r...
[ "def", "sort_by_row", "(", "self", ",", "*", "columns", ",", "has_title", "=", "False", ")", ":", "rows", "=", "list", "(", "self", ".", "_table", ".", "rows", ")", "if", "has_title", ":", "head", "=", "rows", "[", "0", "]", "rows", "=", "rows", ...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/browser/ui.py#L370-L405
getsentry/sentry
83b1f25aac3e08075e0e2495bc29efaf35aca18a
src/sentry/utils/kvstore/abstract.py
python
KVStorage.delete
(self, key: K)
Delete the value at key (if it exists).
Delete the value at key (if it exists).
[ "Delete", "the", "value", "at", "key", "(", "if", "it", "exists", ")", "." ]
def delete(self, key: K) -> None: """ Delete the value at key (if it exists). """ raise NotImplementedError
[ "def", "delete", "(", "self", ",", "key", ":", "K", ")", "->", "None", ":", "raise", "NotImplementedError" ]
https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/utils/kvstore/abstract.py#L51-L55
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/ebooks/metadata/rtf.py
python
get_metadata
(stream)
return mi
Return metadata as a L{MetaInfo} object
Return metadata as a L{MetaInfo} object
[ "Return", "metadata", "as", "a", "L", "{", "MetaInfo", "}", "object" ]
def get_metadata(stream): """ Return metadata as a L{MetaInfo} object """ stream.seek(0) if stream.read(5) != br'{\rtf': return MetaInformation(_('Unknown')) block = get_document_info(stream)[0] if not block: return MetaInformation(_('Unknown')) stream.seek(0) cpg = ...
[ "def", "get_metadata", "(", "stream", ")", ":", "stream", ".", "seek", "(", "0", ")", "if", "stream", ".", "read", "(", "5", ")", "!=", "br'{\\rtf'", ":", "return", "MetaInformation", "(", "_", "(", "'Unknown'", ")", ")", "block", "=", "get_document_in...
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/ebooks/metadata/rtf.py#L112-L154
readbeyond/aeneas
4d200a050690903b30b3d885b44714fecb23f18a
aeneas/syncmap/fragmentlist.py
python
SyncMapFragmentList.nonspeech_fragments
(self)
Iterates through the nonspeech fragments in the list (which are sorted). :rtype: generator of (int, :class:`~aeneas.syncmap.SyncMapFragment`)
Iterates through the nonspeech fragments in the list (which are sorted).
[ "Iterates", "through", "the", "nonspeech", "fragments", "in", "the", "list", "(", "which", "are", "sorted", ")", "." ]
def nonspeech_fragments(self): """ Iterates through the nonspeech fragments in the list (which are sorted). :rtype: generator of (int, :class:`~aeneas.syncmap.SyncMapFragment`) """ for i, fragment in enumerate(self.__fragments): if fragment.fragment_type == S...
[ "def", "nonspeech_fragments", "(", "self", ")", ":", "for", "i", ",", "fragment", "in", "enumerate", "(", "self", ".", "__fragments", ")", ":", "if", "fragment", ".", "fragment_type", "==", "SyncMapFragment", ".", "NONSPEECH", ":", "yield", "(", "i", ",", ...
https://github.com/readbeyond/aeneas/blob/4d200a050690903b30b3d885b44714fecb23f18a/aeneas/syncmap/fragmentlist.py#L212-L221
ReactionMechanismGenerator/RMG-Py
2b7baf51febf27157def58fb3f6cee03fb6a684c
rmgpy/species.py
python
TransitionState.calculate_tunneling_function
(self, e_list)
Calculate and return the value of the microcanonical tunneling correction for the reaction at the given energies `e_list` in J/mol.
Calculate and return the value of the microcanonical tunneling correction for the reaction at the given energies `e_list` in J/mol.
[ "Calculate", "and", "return", "the", "value", "of", "the", "microcanonical", "tunneling", "correction", "for", "the", "reaction", "at", "the", "given", "energies", "e_list", "in", "J", "/", "mol", "." ]
def calculate_tunneling_function(self, e_list): """ Calculate and return the value of the microcanonical tunneling correction for the reaction at the given energies `e_list` in J/mol. """ if self.tunneling is not None: return self.tunneling.calculate_tunneling_functi...
[ "def", "calculate_tunneling_function", "(", "self", ",", "e_list", ")", ":", "if", "self", ".", "tunneling", "is", "not", "None", ":", "return", "self", ".", "tunneling", ".", "calculate_tunneling_function", "(", "e_list", ")", "else", ":", "# Return step functi...
https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/species.py#L1012-L1027
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/discrete/discrete_model.py
python
Poisson.fit_constrained
(self, constraints, start_params=None, **fit_kwds)
return res
fit the model subject to linear equality constraints The constraints are of the form `R params = q` where R is the constraint_matrix and q is the vector of constraint_values. The estimation creates a new model with transformed design matrix, exog, and converts the results bac...
fit the model subject to linear equality constraints
[ "fit", "the", "model", "subject", "to", "linear", "equality", "constraints" ]
def fit_constrained(self, constraints, start_params=None, **fit_kwds): """fit the model subject to linear equality constraints The constraints are of the form `R params = q` where R is the constraint_matrix and q is the vector of constraint_values. The estimation creates a ne...
[ "def", "fit_constrained", "(", "self", ",", "constraints", ",", "start_params", "=", "None", ",", "*", "*", "fit_kwds", ")", ":", "#constraints = (R, q)", "# TODO: temporary trailing underscore to not overwrite the monkey", "# patched version", "# TODO: decide whether to ...
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/discrete/discrete_model.py#L1336-L1403
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/abc.py
python
get_cache_token
()
return ABCMeta._abc_invalidation_counter
Returns the current ABC cache token. The token is an opaque object (supporting equality testing) identifying the current version of the ABC cache for virtual subclasses. The token changes with every call to ``register()`` on any ABC.
Returns the current ABC cache token.
[ "Returns", "the", "current", "ABC", "cache", "token", "." ]
def get_cache_token(): """Returns the current ABC cache token. The token is an opaque object (supporting equality testing) identifying the current version of the ABC cache for virtual subclasses. The token changes with every call to ``register()`` on any ABC. """ return ABCMeta._abc_invalidatio...
[ "def", "get_cache_token", "(", ")", ":", "return", "ABCMeta", ".", "_abc_invalidation_counter" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/abc.py#L241-L248
StanfordVL/ReferringRelationships
61e04c1ccad6a7f7dcbc07562ef68546ba4063cf
data.py
python
Dataset.__init__
(self, data_path, img_dir, im_metadata_path, im_dim=224, output_dim=224, num_images=None, max_rels_per_image=None)
Constructor for the VRD dataset object. Args: data_path: Annotations in the VRD dataset. img_dir: Location of the images. im_metadata_path: Location of the file containing image metadata. im_dim: The size of images. output_dim: The size of predictions...
Constructor for the VRD dataset object.
[ "Constructor", "for", "the", "VRD", "dataset", "object", "." ]
def __init__(self, data_path, img_dir, im_metadata_path, im_dim=224, output_dim=224, num_images=None, max_rels_per_image=None): """Constructor for the VRD dataset object. Args: data_path: Annotations in the VRD dataset. img_dir: Location of the ...
[ "def", "__init__", "(", "self", ",", "data_path", ",", "img_dir", ",", "im_metadata_path", ",", "im_dim", "=", "224", ",", "output_dim", "=", "224", ",", "num_images", "=", "None", ",", "max_rels_per_image", "=", "None", ")", ":", "data", "=", "json", "....
https://github.com/StanfordVL/ReferringRelationships/blob/61e04c1ccad6a7f7dcbc07562ef68546ba4063cf/data.py#L20-L46
Edinburgh-Genome-Foundry/Taskpacker
151b581e3b64c6f462e177a5b8b2ff3457529ad0
ez_setup.py
python
_extractall
(self, path=".", members=None)
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers().
Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers().
[ "Extract", "all", "members", "from", "the", "archive", "to", "the", "current", "working", "directory", "and", "set", "owner", "modification", "time", "and", "permissions", "on", "directories", "afterwards", ".", "path", "specifies", "a", "different", "directory", ...
def _extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by...
[ "def", "_extractall", "(", "self", ",", "path", "=", "\".\"", ",", "members", "=", "None", ")", ":", "import", "copy", "import", "operator", "from", "tarfile", "import", "ExtractError", "directories", "=", "[", "]", "if", "members", "is", "None", ":", "m...
https://github.com/Edinburgh-Genome-Foundry/Taskpacker/blob/151b581e3b64c6f462e177a5b8b2ff3457529ad0/ez_setup.py#L177-L221
TheAlgorithms/Python
9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c
ciphers/base85.py
python
base85_encode
(string: str)
return base64.a85encode(string.encode("utf-8"))
>>> base85_encode("") b'' >>> base85_encode("12345") b'0etOA2#' >>> base85_encode("base 85") b'@UX=h+?24'
>>> base85_encode("") b'' >>> base85_encode("12345") b'0etOA2#' >>> base85_encode("base 85") b'
[ ">>>", "base85_encode", "(", ")", "b", ">>>", "base85_encode", "(", "12345", ")", "b", "0etOA2#", ">>>", "base85_encode", "(", "base", "85", ")", "b" ]
def base85_encode(string: str) -> bytes: """ >>> base85_encode("") b'' >>> base85_encode("12345") b'0etOA2#' >>> base85_encode("base 85") b'@UX=h+?24' """ # encoded the input to a bytes-like object and then a85encode that return base64.a85encode(string.encode("utf-8"))
[ "def", "base85_encode", "(", "string", ":", "str", ")", "->", "bytes", ":", "# encoded the input to a bytes-like object and then a85encode that", "return", "base64", ".", "a85encode", "(", "string", ".", "encode", "(", "\"utf-8\"", ")", ")" ]
https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/ciphers/base85.py#L4-L14
my8100/scrapydweb
7a3b81dba2cba4279c9465064a693bb277ac20e9
scrapydweb/views/baseview.py
python
BaseView.get_selected_nodes
(self)
return selected_nodes
[]
def get_selected_nodes(self): selected_nodes = [] for n in range(1, self.SCRAPYD_SERVERS_AMOUNT + 1): if request.form.get(str(n)) == 'on': selected_nodes.append(n) return selected_nodes
[ "def", "get_selected_nodes", "(", "self", ")", ":", "selected_nodes", "=", "[", "]", "for", "n", "in", "range", "(", "1", ",", "self", ".", "SCRAPYD_SERVERS_AMOUNT", "+", "1", ")", ":", "if", "request", ".", "form", ".", "get", "(", "str", "(", "n", ...
https://github.com/my8100/scrapydweb/blob/7a3b81dba2cba4279c9465064a693bb277ac20e9/scrapydweb/views/baseview.py#L249-L254
iGio90/Dwarf
bb3011cdffd209c7e3f5febe558053bf649ca69c
dwarf_debugger/lib/core.py
python
Dwarf.dwarf_api
(self, api, args=None, tid=0)
[]
def dwarf_api(self, api, args=None, tid=0): if self.pid and self._pid == 0 or self.process is None: return # when tid is 0 we want to execute the api in the current breakpointed thread # however, when we release from menu, what we want to do is to release multiple contexts at once ...
[ "def", "dwarf_api", "(", "self", ",", "api", ",", "args", "=", "None", ",", "tid", "=", "0", ")", ":", "if", "self", ".", "pid", "and", "self", ".", "_pid", "==", "0", "or", "self", ".", "process", "is", "None", ":", "return", "# when tid is 0 we w...
https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/lib/core.py#L471-L500
blawar/nut
2cf351400418399a70164987e28670309f6c9cb5
Fs/Pfs0.py
python
Pfs0Stream.__init__
(self, path)
[]
def __init__(self, path): try: os.makedirs(os.path.dirname(path), exist_ok=True) except BaseException: pass self.path = path self.f = open(path, 'wb') self.offset = 0x8000 self.files = [] self.f.seek(self.offset)
[ "def", "__init__", "(", "self", ",", "path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ",", "exist_ok", "=", "True", ")", "except", "BaseException", ":", "pass", "self", ".", "path", "=",...
https://github.com/blawar/nut/blob/2cf351400418399a70164987e28670309f6c9cb5/Fs/Pfs0.py#L25-L35
wikimedia/pywikibot
81a01ffaec7271bf5b4b170f85a80388420a4e78
pywikibot/proofreadpage.py
python
decompose
(fn: Callable)
return wrapper
Decorator for ProofreadPage. Decompose text if needed and recompose text.
Decorator for ProofreadPage.
[ "Decorator", "for", "ProofreadPage", "." ]
def decompose(fn: Callable) -> Callable: # type: ignore # noqa: N805 """Decorator for ProofreadPage. Decompose text if needed and recompose text. """ def wrapper(self: 'ProofreadPage', *args: Any, **kwargs: Any) -> Any: if not hasattr(self, '_full_header'): self._decompose_page() ...
[ "def", "decompose", "(", "fn", ":", "Callable", ")", "->", "Callable", ":", "# type: ignore # noqa: N805", "def", "wrapper", "(", "self", ":", "'ProofreadPage'", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Any", ":", ...
https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/proofreadpage.py#L79-L91
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/nn/util.py
python
weighted_sum
(matrix: torch.Tensor, attention: torch.Tensor)
return intermediate.sum(dim=-2)
Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an "attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical computation performed after an attention mechanism. Note that while we call this a "matrix" of vectors and an attentio...
Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an "attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical computation performed after an attention mechanism.
[ "Takes", "a", "matrix", "of", "vectors", "and", "a", "set", "of", "weights", "over", "the", "rows", "in", "the", "matrix", "(", "which", "we", "call", "an", "attention", "vector", ")", "and", "returns", "a", "weighted", "sum", "of", "the", "rows", "in"...
def weighted_sum(matrix: torch.Tensor, attention: torch.Tensor) -> torch.Tensor: """ Takes a matrix of vectors and a set of weights over the rows in the matrix (which we call an "attention" vector), and returns a weighted sum of the rows in the matrix. This is the typical computation performed after an...
[ "def", "weighted_sum", "(", "matrix", ":", "torch", ".", "Tensor", ",", "attention", ":", "torch", ".", "Tensor", ")", "->", "torch", ".", "Tensor", ":", "# We'll special-case a few settings here, where there are efficient (but poorly-named)", "# operations in pytorch that ...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/nn/util.py#L661-L697
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/dayu/v20180709/dayu_client.py
python
DayuClient.DescribeDDoSAttackIPRegionMap
(self, request)
获取DDoS攻击源IP地域分布图,支持全球攻击分布和国内省份攻击分布; :param request: Request instance for DescribeDDoSAttackIPRegionMap. :type request: :class:`tencentcloud.dayu.v20180709.models.DescribeDDoSAttackIPRegionMapRequest` :rtype: :class:`tencentcloud.dayu.v20180709.models.DescribeDDoSAttackIPRegionMapResponse`
获取DDoS攻击源IP地域分布图,支持全球攻击分布和国内省份攻击分布;
[ "获取DDoS攻击源IP地域分布图,支持全球攻击分布和国内省份攻击分布;" ]
def DescribeDDoSAttackIPRegionMap(self, request): """获取DDoS攻击源IP地域分布图,支持全球攻击分布和国内省份攻击分布; :param request: Request instance for DescribeDDoSAttackIPRegionMap. :type request: :class:`tencentcloud.dayu.v20180709.models.DescribeDDoSAttackIPRegionMapRequest` :rtype: :class:`tencentcloud.dayu....
[ "def", "DescribeDDoSAttackIPRegionMap", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeDDoSAttackIPRegionMap\"", ",", "params", ")", "response", "=", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/dayu/v20180709/dayu_client.py#L1205-L1230
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
mx.zippy/mx_zippy_benchmark.py
python
CPython3BenchmarkSuite.getPath
(self)
return pathBench
[]
def getPath(self): return pathBench
[ "def", "getPath", "(", "self", ")", ":", "return", "pathBench" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/mx.zippy/mx_zippy_benchmark.py#L307-L308
rafaelpadilla/Object-Detection-Metrics
e3f29579afef10e8057bda1beb6154a3f354287c
lib/BoundingBoxes.py
python
BoundingBoxes.removeBoundingBox
(self, _boundingBox)
[]
def removeBoundingBox(self, _boundingBox): for d in self._boundingBoxes: if BoundingBox.compare(d, _boundingBox): del self._boundingBoxes[d] return
[ "def", "removeBoundingBox", "(", "self", ",", "_boundingBox", ")", ":", "for", "d", "in", "self", ".", "_boundingBoxes", ":", "if", "BoundingBox", ".", "compare", "(", "d", ",", "_boundingBox", ")", ":", "del", "self", ".", "_boundingBoxes", "[", "d", "]...
https://github.com/rafaelpadilla/Object-Detection-Metrics/blob/e3f29579afef10e8057bda1beb6154a3f354287c/lib/BoundingBoxes.py#L12-L16
locuslab/trellisnet
ec1de0a5ee09ef5a4c5bca4c83456dec8cbdf4c8
TrellisNet/seq_MNIST_CIFAR/model.py
python
TrellisNetModel.__init__
(self, ninp, nhid, nout, nlevels, kernel_size=2, dilation=[1], dropout=0.0, dropouti=0.0, dropouth=0.0, wdrop=0.0, temporalwdrop=True, wnorm=True, aux=False, aux_frequency=1e4)
A sequence model using TrellisNet (on sequential MNIST & CIFAR-10). Note that this is different from the models in other tasks (e.g. word-level PTB) because: 1) there is no more embedding; 2) we only need one output at the end for classification of the pixel stream; and 3) the input and output features ...
A sequence model using TrellisNet (on sequential MNIST & CIFAR-10). Note that this is different from the models in other tasks (e.g. word-level PTB) because: 1) there is no more embedding; 2) we only need one output at the end for classification of the pixel stream; and 3) the input and output features ...
[ "A", "sequence", "model", "using", "TrellisNet", "(", "on", "sequential", "MNIST", "&", "CIFAR", "-", "10", ")", ".", "Note", "that", "this", "is", "different", "from", "the", "models", "in", "other", "tasks", "(", "e", ".", "g", ".", "word", "-", "l...
def __init__(self, ninp, nhid, nout, nlevels, kernel_size=2, dilation=[1], dropout=0.0, dropouti=0.0, dropouth=0.0, wdrop=0.0, temporalwdrop=True, wnorm=True, aux=False, aux_frequency=1e4): """ A sequence model using TrellisNet (on sequential MNIST & CIFAR-10). Note tha...
[ "def", "__init__", "(", "self", ",", "ninp", ",", "nhid", ",", "nout", ",", "nlevels", ",", "kernel_size", "=", "2", ",", "dilation", "=", "[", "1", "]", ",", "dropout", "=", "0.0", ",", "dropouti", "=", "0.0", ",", "dropouth", "=", "0.0", ",", "...
https://github.com/locuslab/trellisnet/blob/ec1de0a5ee09ef5a4c5bca4c83456dec8cbdf4c8/TrellisNet/seq_MNIST_CIFAR/model.py#L11-L54
securisec/chepy
7abcc7ebcdab6583ffd89da11b5d6d419fd1b0dd
chepy/core.py
python
ChepyCore.save_recipe
(self, path: str)
return self
Save the current recipe A recipe will be all the previous methdos called on the chepy instance along with their args Args: path (str): The path to save the recipe Returns: Chepy: The Chepy object. Examples: >>> c = Chepy("some data").to_hex...
Save the current recipe
[ "Save", "the", "current", "recipe" ]
def save_recipe(self, path: str): """Save the current recipe A recipe will be all the previous methdos called on the chepy instance along with their args Args: path (str): The path to save the recipe Returns: Chepy: The Chepy object. Examples: ...
[ "def", "save_recipe", "(", "self", ",", "path", ":", "str", ")", ":", "with", "self", ".", "_abs_path", "(", "path", ")", "as", "f", ":", "f", ".", "write_text", "(", "json", ".", "dumps", "(", "self", ".", "_stack", ")", ")", "self", ".", "_info...
https://github.com/securisec/chepy/blob/7abcc7ebcdab6583ffd89da11b5d6d419fd1b0dd/chepy/core.py#L941-L962
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/distutils/text_file.py
python
TextFile.warn
(self, msg, line=None)
Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it overrides the current line number; it may be a...
Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it overrides the current line number; it may be a...
[ "Print", "(", "to", "stderr", ")", "a", "warning", "message", "tied", "to", "the", "current", "logical", "line", "in", "the", "current", "file", ".", "If", "the", "current", "logical", "line", "in", "the", "file", "spans", "multiple", "physical", "lines", ...
def warn(self, msg, line=None): """Print (to stderr) a warning message tied to the current logical line in the current file. If the current logical line in the file spans multiple physical lines, the warning refers to the whole range, eg. "lines 3-5". If 'line' supplied, it overrides ...
[ "def", "warn", "(", "self", ",", "msg", ",", "line", "=", "None", ")", ":", "sys", ".", "stderr", ".", "write", "(", "'warning: '", "+", "self", ".", "gen_error", "(", "msg", ",", "line", ")", "+", "'\\n'", ")" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/distutils/text_file.py#L134-L142
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/tune/suggest/suggestion.py
python
Searcher.restore_from_dir
(self, checkpoint_dir: str)
Restores the state of a searcher from a given checkpoint_dir. Typically, you should use this function to restore from an experiment directory such as `~/ray_results/trainable`. .. code-block:: python experiment_1 = tune.run( cost, num_samples=5, ...
Restores the state of a searcher from a given checkpoint_dir.
[ "Restores", "the", "state", "of", "a", "searcher", "from", "a", "given", "checkpoint_dir", "." ]
def restore_from_dir(self, checkpoint_dir: str): """Restores the state of a searcher from a given checkpoint_dir. Typically, you should use this function to restore from an experiment directory such as `~/ray_results/trainable`. .. code-block:: python experiment_1 = tune.r...
[ "def", "restore_from_dir", "(", "self", ",", "checkpoint_dir", ":", "str", ")", ":", "pattern", "=", "self", ".", "CKPT_FILE_TMPL", ".", "format", "(", "\"*\"", ")", "full_paths", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "che...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/tune/suggest/suggestion.py#L382-L410
phonopy/phonopy
816586d0ba8177482ecf40e52f20cbdee2260d51
phonopy/phonon/band_structure.py
python
_plot_legacy
( ax, all_distances, all_frequencies, labels, special_points, is_band_connection )
Plot band structure in legacy style.
Plot band structure in legacy style.
[ "Plot", "band", "structure", "in", "legacy", "style", "." ]
def _plot_legacy( ax, all_distances, all_frequencies, labels, special_points, is_band_connection ): """Plot band structure in legacy style.""" ax.xaxis.set_ticks_position("both") ax.yaxis.set_ticks_position("both") ax.xaxis.set_tick_params(which="both", direction="in") ax.yaxis.set_tick_params(w...
[ "def", "_plot_legacy", "(", "ax", ",", "all_distances", ",", "all_frequencies", ",", "labels", ",", "special_points", ",", "is_band_connection", ")", ":", "ax", ".", "xaxis", ".", "set_ticks_position", "(", "\"both\"", ")", "ax", ".", "yaxis", ".", "set_ticks_...
https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/phonon/band_structure.py#L899-L931
e2nIEE/pandapower
12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb
pandapower/std_types.py
python
load_std_type
(net, name, element="line")
Loads standard type data from the linetypes data base. Issues a warning if linetype is unknown. INPUT: **net** - The pandapower network **name** - name of the standard type as string **element** - "line", "trafo" or "trafo3w" OUTPUT: **typedata** - dictionary containing t...
Loads standard type data from the linetypes data base. Issues a warning if linetype is unknown.
[ "Loads", "standard", "type", "data", "from", "the", "linetypes", "data", "base", ".", "Issues", "a", "warning", "if", "linetype", "is", "unknown", "." ]
def load_std_type(net, name, element="line"): """ Loads standard type data from the linetypes data base. Issues a warning if linetype is unknown. INPUT: **net** - The pandapower network **name** - name of the standard type as string **element** - "line", "trafo" or "trafo3w" ...
[ "def", "load_std_type", "(", "net", ",", "name", ",", "element", "=", "\"line\"", ")", ":", "library", "=", "net", ".", "std_types", "[", "element", "]", "if", "name", "in", "library", ":", "return", "library", "[", "name", "]", "else", ":", "raise", ...
https://github.com/e2nIEE/pandapower/blob/12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb/pandapower/std_types.py#L143-L162
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
obsolete/pipeline_vitaminD.py
python
importGWASEnsembl
( infile, outfile )
compute overlap of intervals with regions of interest.
compute overlap of intervals with regions of interest.
[ "compute", "overlap", "of", "intervals", "with", "regions", "of", "interest", "." ]
def importGWASEnsembl( infile, outfile ): '''compute overlap of intervals with regions of interest.''' tmpfilename = P.getTempFilename( "." ) PGeneset.buildOverlapWithEnsembl( infile, tmpfilename, "gwas.bed" ) tablename...
[ "def", "importGWASEnsembl", "(", "infile", ",", "outfile", ")", ":", "tmpfilename", "=", "P", ".", "getTempFilename", "(", "\".\"", ")", "PGeneset", ".", "buildOverlapWithEnsembl", "(", "infile", ",", "tmpfilename", ",", "\"gwas.bed\"", ")", "tablename", "=", ...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/pipeline_vitaminD.py#L5857-L5880
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/urllib3/poolmanager.py
python
PoolManager.connection_from_url
(self, url)
return self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor. Additional parameters are taken from the :class:`.PoolManager` constructor.
Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor.
[ "Similar", "to", ":", "func", ":", "urllib3", ".", "connectionpool", ".", "connection_from_url", "but", "doesn", "t", "pass", "any", "additional", "parameters", "to", "the", ":", "class", ":", "urllib3", ".", "connectionpool", ".", "ConnectionPool", "constructor...
def connection_from_url(self, url): """ Similar to :func:`urllib3.connectionpool.connection_from_url` but doesn't pass any additional parameters to the :class:`urllib3.connectionpool.ConnectionPool` constructor. Additional parameters are taken from the :class:`.PoolManager` ...
[ "def", "connection_from_url", "(", "self", ",", "url", ")", ":", "u", "=", "parse_url", "(", "url", ")", "return", "self", ".", "connection_from_host", "(", "u", ".", "host", ",", "port", "=", "u", ".", "port", ",", "scheme", "=", "u", ".", "scheme",...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/urllib3/poolmanager.py#L90-L100