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
Cue/scales
0aced26eb050ceb98ee9d5d6cdca8db448666986
src/greplin/scales/flaskhandler.py
python
registerStatsHandler
(app, serverName, prefix='/status/')
Register the stats handler with a Flask app, serving routes with a given prefix. The prefix defaults to '/status/', which is generally what you want.
Register the stats handler with a Flask app, serving routes with a given prefix. The prefix defaults to '/status/', which is generally what you want.
[ "Register", "the", "stats", "handler", "with", "a", "Flask", "app", "serving", "routes", "with", "a", "given", "prefix", ".", "The", "prefix", "defaults", "to", "/", "status", "/", "which", "is", "generally", "what", "you", "want", "." ]
def registerStatsHandler(app, serverName, prefix='/status/'): """Register the stats handler with a Flask app, serving routes with a given prefix. The prefix defaults to '/status/', which is generally what you want.""" if prefix[-1] != '/': prefix += '/' handler = functools.partial(statsHandler, serverName...
[ "def", "registerStatsHandler", "(", "app", ",", "serverName", ",", "prefix", "=", "'/status/'", ")", ":", "if", "prefix", "[", "-", "1", "]", "!=", "'/'", ":", "prefix", "+=", "'/'", "handler", "=", "functools", ".", "partial", "(", "statsHandler", ",", ...
https://github.com/Cue/scales/blob/0aced26eb050ceb98ee9d5d6cdca8db448666986/src/greplin/scales/flaskhandler.py#L53-L61
RDFLib/rdflib
c0bd5eaaa983461445b9469d731be4ae0e0cfc54
rdflib/graph.py
python
Graph.update
( self, update_object, processor="sparql", initNs=None, initBindings=None, use_store_provided=True, **kwargs, )
return processor.update(update_object, initBindings, initNs, **kwargs)
Update this graph with the given update query.
Update this graph with the given update query.
[ "Update", "this", "graph", "with", "the", "given", "update", "query", "." ]
def update( self, update_object, processor="sparql", initNs=None, initBindings=None, use_store_provided=True, **kwargs, ): """Update this graph with the given update query.""" initBindings = initBindings or {} initNs = initNs or dict(se...
[ "def", "update", "(", "self", ",", "update_object", ",", "processor", "=", "\"sparql\"", ",", "initNs", "=", "None", ",", "initBindings", "=", "None", ",", "use_store_provided", "=", "True", ",", "*", "*", "kwargs", ",", ")", ":", "initBindings", "=", "i...
https://github.com/RDFLib/rdflib/blob/c0bd5eaaa983461445b9469d731be4ae0e0cfc54/rdflib/graph.py#L1287-L1315
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/asyncio/base_subprocess.py
python
WriteSubprocessPipeProto.__init__
(self, proc, fd)
[]
def __init__(self, proc, fd): self.proc = proc self.fd = fd self.pipe = None self.disconnected = False
[ "def", "__init__", "(", "self", ",", "proc", ",", "fd", ")", ":", "self", ".", "proc", "=", "proc", "self", ".", "fd", "=", "fd", "self", ".", "pipe", "=", "None", "self", ".", "disconnected", "=", "False" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/base_subprocess.py#L257-L261
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/musicxml/xmlToM21.py
python
PartParser.adjustTimeAttributesFromMeasure
(self, m: stream.Measure)
Adds padAsAnacrusis to pickup measures and other measures that do not fill the whole tile, if the first measure of the piece, or immediately follows an incomplete measure (such as a repeat sign mid-measure in a piece where each phrase begins with a pickup and ends with an incomplete meas...
Adds padAsAnacrusis to pickup measures and other measures that do not fill the whole tile, if the first measure of the piece, or immediately follows an incomplete measure (such as a repeat sign mid-measure in a piece where each phrase begins with a pickup and ends with an incomplete meas...
[ "Adds", "padAsAnacrusis", "to", "pickup", "measures", "and", "other", "measures", "that", "do", "not", "fill", "the", "whole", "tile", "if", "the", "first", "measure", "of", "the", "piece", "or", "immediately", "follows", "an", "incomplete", "measure", "(", ...
def adjustTimeAttributesFromMeasure(self, m: stream.Measure): ''' Adds padAsAnacrusis to pickup measures and other measures that do not fill the whole tile, if the first measure of the piece, or immediately follows an incomplete measure (such as a repeat sign mid-measure in a pie...
[ "def", "adjustTimeAttributesFromMeasure", "(", "self", ",", "m", ":", "stream", ".", "Measure", ")", ":", "# note: we cannot assume that the time signature properly", "# describes the offsets w/n this bar. need to look at", "# offsets within measure; if the .highestTime value is greater"...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/musicxml/xmlToM21.py#L2040-L2130
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
cwhile_t.__eq__
(self, *args)
return _idaapi.cwhile_t___eq__(self, *args)
__eq__(self, r) -> bool
__eq__(self, r) -> bool
[ "__eq__", "(", "self", "r", ")", "-", ">", "bool" ]
def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _idaapi.cwhile_t___eq__(self, *args)
[ "def", "__eq__", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "cwhile_t___eq__", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L37940-L37944
nedbat/coveragepy
d004b18a1ad59ec89b89c96c03a789a55cc51693
coverage/files.py
python
find_python_files
(dirname)
Yield all of the importable Python files in `dirname`, recursively. To be importable, the files have to be in a directory with a __init__.py, except for `dirname` itself, which isn't required to have one. The assumption is that `dirname` was specified directly, so the user knows best, but sub-director...
Yield all of the importable Python files in `dirname`, recursively.
[ "Yield", "all", "of", "the", "importable", "Python", "files", "in", "dirname", "recursively", "." ]
def find_python_files(dirname): """Yield all of the importable Python files in `dirname`, recursively. To be importable, the files have to be in a directory with a __init__.py, except for `dirname` itself, which isn't required to have one. The assumption is that `dirname` was specified directly, so th...
[ "def", "find_python_files", "(", "dirname", ")", ":", "for", "i", ",", "(", "dirpath", ",", "dirnames", ",", "filenames", ")", "in", "enumerate", "(", "os", ".", "walk", "(", "dirname", ")", ")", ":", "if", "i", ">", "0", "and", "'__init__.py'", "not...
https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/files.py#L398-L419
MDAnalysis/mdanalysis
3488df3cdb0c29ed41c4fb94efe334b541e31b21
benchmarks/benchmarks/analysis/distances.py
python
DistancesBench.time_contact_matrix_sparse
(self, num_atoms)
Benchmark calculation of contacts within a single numpy array using the slower reduced memory implementation of contact_matrix intended for larger systems.
Benchmark calculation of contacts within a single numpy array using the slower reduced memory implementation of contact_matrix intended for larger systems.
[ "Benchmark", "calculation", "of", "contacts", "within", "a", "single", "numpy", "array", "using", "the", "slower", "reduced", "memory", "implementation", "of", "contact_matrix", "intended", "for", "larger", "systems", "." ]
def time_contact_matrix_sparse(self, num_atoms): """Benchmark calculation of contacts within a single numpy array using the slower reduced memory implementation of contact_matrix intended for larger systems. """ distances.contact_matrix(coord=self.coords_1, ...
[ "def", "time_contact_matrix_sparse", "(", "self", ",", "num_atoms", ")", ":", "distances", ".", "contact_matrix", "(", "coord", "=", "self", ".", "coords_1", ",", "cutoff", "=", "15.0", ",", "returntype", "=", "'sparse'", ",", "box", "=", "None", ")" ]
https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/benchmarks/benchmarks/analysis/distances.py#L93-L102
ilastik/ilastik
6acd2c554bc517e9c8ddad3623a7aaa2e6970c28
ilastik/workflows/newAutocontext/newAutocontextWorkflow.py
python
NewAutocontextWorkflowBase.distribute_labels_from_current_stage
(self)
Distrubute labels from the currently viewed stage across all other stages.
Distrubute labels from the currently viewed stage across all other stages.
[ "Distrubute", "labels", "from", "the", "currently", "viewed", "stage", "across", "all", "other", "stages", "." ]
def distribute_labels_from_current_stage(self): """ Distrubute labels from the currently viewed stage across all other stages. """ # Late import. # (Don't import PyQt in headless mode.) from PyQt5.QtWidgets import QMessageBox current_applet = self._applets[self.s...
[ "def", "distribute_labels_from_current_stage", "(", "self", ")", ":", "# Late import.", "# (Don't import PyQt in headless mode.)", "from", "PyQt5", ".", "QtWidgets", "import", "QMessageBox", "current_applet", "=", "self", ".", "_applets", "[", "self", ".", "shell", ".",...
https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/ilastik/workflows/newAutocontext/newAutocontextWorkflow.py#L539-L630
scotch/engineauth
e6e8f76edb3974c631f843e4e482723fddd1a36c
engineauth/strategies/base.py
python
BaseStrategy.user_info
(self, req)
:param req: :returns dict() Portable Contacts spec { 'auth_id': User.generate_auth_id(req.provider, user['id']), 'uid': user['id'], # Unique ID to the service provider 'info': { 'id': user.get('id'), 'displayName': user.get('name'), ...
[]
def user_info(self, req): """ :param req: :returns dict() Portable Contacts spec { 'auth_id': User.generate_auth_id(req.provider, user['id']), 'uid': user['id'], # Unique ID to the service provider 'info': { 'id': user.get('id'), ...
[ "def", "user_info", "(", "self", ",", "req", ")", ":", "_abstract", "(", ")" ]
https://github.com/scotch/engineauth/blob/e6e8f76edb3974c631f843e4e482723fddd1a36c/engineauth/strategies/base.py#L53-L147
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/swapoff.py
python
check_swap_in_fstab
(module)
Check for uncommented swap entries in fstab
Check for uncommented swap entries in fstab
[ "Check", "for", "uncommented", "swap", "entries", "in", "fstab" ]
def check_swap_in_fstab(module): '''Check for uncommented swap entries in fstab''' res = subprocess.call(['grep', '^[^#].*swap', '/etc/fstab']) if res == 2: # rc 2 == cannot open file. result = {'failed': True, 'changed': False, 'msg': 'unable to read /et...
[ "def", "check_swap_in_fstab", "(", "module", ")", ":", "res", "=", "subprocess", ".", "call", "(", "[", "'grep'", ",", "'^[^#].*swap'", ",", "'/etc/fstab'", "]", ")", "if", "res", "==", "2", ":", "# rc 2 == cannot open file.", "result", "=", "{", "'failed'",...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/swapoff.py#L46-L69
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.py
python
PGInspector.get_enums
(self, schema=None)
return self.dialect._load_enums(self.bind, schema)
Return a list of ENUM objects. Each member is a dictionary containing these fields: * name - name of the enum * schema - the schema name for the enum. * visible - boolean, whether or not this enum is visible in the default search path. * labels - a...
Return a list of ENUM objects.
[ "Return", "a", "list", "of", "ENUM", "objects", "." ]
def get_enums(self, schema=None): """Return a list of ENUM objects. Each member is a dictionary containing these fields: * name - name of the enum * schema - the schema name for the enum. * visible - boolean, whether or not this enum is visible in the ...
[ "def", "get_enums", "(", "self", ",", "schema", "=", "None", ")", ":", "schema", "=", "schema", "or", "self", ".", "default_schema_name", "return", "self", ".", "dialect", ".", "_load_enums", "(", "self", ".", "bind", ",", "schema", ")" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.py#L1808-L1827
django-salesforce/django-salesforce
745c26196037234c70d01de7a6db089cc9977d6d
salesforce/dbapi/subselect.py
python
simplify_expression
(txt: str)
return re.sub(r'\)(?=\w)', ') ', re.sub(r'(,|\b(?:{}))\('.format('|'.join(RESERVED_WORDS)), '\\1 (', minimal) )
Remove all unecessary whitespace and some very usual space
Remove all unecessary whitespace and some very usual space
[ "Remove", "all", "unecessary", "whitespace", "and", "some", "very", "usual", "space" ]
def simplify_expression(txt: str) -> str: """Remove all unecessary whitespace and some very usual space""" minimal = re.sub(r'\s', ' ', re.sub(r'\s(?=\W)', '', re.sub(r'(?<=\W)\s', '', txt.strip()))) # add space before some ...
[ "def", "simplify_expression", "(", "txt", ":", "str", ")", "->", "str", ":", "minimal", "=", "re", ".", "sub", "(", "r'\\s'", ",", "' '", ",", "re", ".", "sub", "(", "r'\\s(?=\\W)'", ",", "''", ",", "re", ".", "sub", "(", "r'(?<=\\W)\\s'", ",", "''...
https://github.com/django-salesforce/django-salesforce/blob/745c26196037234c70d01de7a6db089cc9977d6d/salesforce/dbapi/subselect.py#L312-L321
apeterswu/RL4NMT
3c66a2d8142abc5ce73db63e05d3cc9bf4663b65
tensor2tensor/layers/common_attention.py
python
get_timing_signal_1d
( length, channels, min_timescale=1.0, max_timescale=1.0e4)
return signal
Gets a bunch of sinusoids of different frequencies. Each channel of the input Tensor is incremented by a sinusoid of a different frequency and phase. This allows attention to learn to use absolute and relative positions. Timing signals should be added to some precursors of both the query and the memory inpu...
Gets a bunch of sinusoids of different frequencies.
[ "Gets", "a", "bunch", "of", "sinusoids", "of", "different", "frequencies", "." ]
def get_timing_signal_1d( length, channels, min_timescale=1.0, max_timescale=1.0e4): """Gets a bunch of sinusoids of different frequencies. Each channel of the input Tensor is incremented by a sinusoid of a different frequency and phase. This allows attention to learn to use absolute and relative position...
[ "def", "get_timing_signal_1d", "(", "length", ",", "channels", ",", "min_timescale", "=", "1.0", ",", "max_timescale", "=", "1.0e4", ")", ":", "position", "=", "tf", ".", "to_float", "(", "tf", ".", "range", "(", "length", ")", ")", "num_timescales", "=", ...
https://github.com/apeterswu/RL4NMT/blob/3c66a2d8142abc5ce73db63e05d3cc9bf4663b65/tensor2tensor/layers/common_attention.py#L271-L313
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/translations/app_translations/download.py
python
get_list_detail_case_property_row
(module_row, sheet_name)
return [ sheet_name, case_property, list_or_detail, '', # label name, '', # image '', # audio '', # video '', # unique_id ]
Returns case list/detail case property name
Returns case list/detail case property name
[ "Returns", "case", "list", "/", "detail", "case", "property", "name" ]
def get_list_detail_case_property_row(module_row, sheet_name): """ Returns case list/detail case property name """ case_property, list_or_detail, name = module_row return [ sheet_name, case_property, list_or_detail, '', # label name, '', # image ...
[ "def", "get_list_detail_case_property_row", "(", "module_row", ",", "sheet_name", ")", ":", "case_property", ",", "list_or_detail", ",", "name", "=", "module_row", "return", "[", "sheet_name", ",", "case_property", ",", "list_or_detail", ",", "''", ",", "# label", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/translations/app_translations/download.py#L141-L156
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3/s3anonymize.py
python
S3AnonymizeWidget.selector
(rules)
return selector
Generate the rule selector for anonymise-form Args: rules: the list of configured rules Returns: the selector (DIV)
Generate the rule selector for anonymise-form
[ "Generate", "the", "rule", "selector", "for", "anonymise", "-", "form" ]
def selector(rules): """ Generate the rule selector for anonymise-form Args: rules: the list of configured rules Returns: the selector (DIV) """ T = current.T selector = DIV(_class = "anonymize-select", ...
[ "def", "selector", "(", "rules", ")", ":", "T", "=", "current", ".", "T", "selector", "=", "DIV", "(", "_class", "=", "\"anonymize-select\"", ",", ")", "for", "rule", "in", "rules", ":", "name", "=", "rule", ".", "get", "(", "\"name\"", ")", "if", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3anonymize.py#L523-L556
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Util/asn1.py
python
DerSequence.decode
(self, der_encoded, nr_elements=None, only_ints_expected=False, strict=False)
return result
Decode a complete DER SEQUENCE, and re-initializes this object with it. Args: der_encoded (byte string): A complete SEQUENCE DER element. nr_elements (None or integer or list of integers): The number of members ...
Decode a complete DER SEQUENCE, and re-initializes this object with it.
[ "Decode", "a", "complete", "DER", "SEQUENCE", "and", "re", "-", "initializes", "this", "object", "with", "it", "." ]
def decode(self, der_encoded, nr_elements=None, only_ints_expected=False, strict=False): """Decode a complete DER SEQUENCE, and re-initializes this object with it. Args: der_encoded (byte string): A complete SEQUENCE DER element. ...
[ "def", "decode", "(", "self", ",", "der_encoded", ",", "nr_elements", "=", "None", ",", "only_ints_expected", "=", "False", ",", "strict", "=", "False", ")", ":", "self", ".", "_nr_elements", "=", "nr_elements", "result", "=", "DerObject", ".", "decode", "...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/Crypto/Util/asn1.py#L478-L505
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/scapy/route6.py
python
Route6.ifdel
(self, iff)
removes all route entries that uses 'iff' interface.
removes all route entries that uses 'iff' interface.
[ "removes", "all", "route", "entries", "that", "uses", "iff", "interface", "." ]
def ifdel(self, iff): """ removes all route entries that uses 'iff' interface. """ new_routes=[] for rt in self.routes: if rt[3] != iff: new_routes.append(rt) self.invalidate_cache() self.routes = new_routes
[ "def", "ifdel", "(", "self", ",", "iff", ")", ":", "new_routes", "=", "[", "]", "for", "rt", "in", "self", ".", "routes", ":", "if", "rt", "[", "3", "]", "!=", "iff", ":", "new_routes", ".", "append", "(", "rt", ")", "self", ".", "invalidate_cach...
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/route6.py#L140-L147
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/Alfred-Time-Keeper/PyAl/Request/requests/packages/urllib3/packages/six.py
python
remove_move
(name)
Remove item from six.moves.
Remove item from six.moves.
[ "Remove", "item", "from", "six", ".", "moves", "." ]
def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,))
[ "def", "remove_move", "(", "name", ")", ":", "try", ":", "delattr", "(", "_MovedItems", ",", "name", ")", "except", "AttributeError", ":", "try", ":", "del", "moves", ".", "__dict__", "[", "name", "]", "except", "KeyError", ":", "raise", "AttributeError", ...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Alfred-Time-Keeper/PyAl/Request/requests/packages/urllib3/packages/six.py#L189-L197
ethan-funny/Google-Alfred3-Workflow
309d64a9a27c33b435c6891a9dda6e331462c5eb
src/alfred_google/PySocks/socks.py
python
get_default_proxy
()
return socksocket.default_proxy
Returns the default proxy, set by set_default_proxy.
Returns the default proxy, set by set_default_proxy.
[ "Returns", "the", "default", "proxy", "set", "by", "set_default_proxy", "." ]
def get_default_proxy(): """ Returns the default proxy, set by set_default_proxy. """ return socksocket.default_proxy
[ "def", "get_default_proxy", "(", ")", ":", "return", "socksocket", ".", "default_proxy" ]
https://github.com/ethan-funny/Google-Alfred3-Workflow/blob/309d64a9a27c33b435c6891a9dda6e331462c5eb/src/alfred_google/PySocks/socks.py#L128-L132
hasgeek/hasjob
38098e8034ee749704dea65394b366e8adc5c71f
hasjob/uploads.py
python
image_extension
(img_format)
return '.unknown'
[]
def image_extension(img_format): if img_format in common_extensions: return common_extensions[img_format] for extension, ext_format in Image.EXTENSION.items(): if img_format == ext_format: return extension return '.unknown'
[ "def", "image_extension", "(", "img_format", ")", ":", "if", "img_format", "in", "common_extensions", ":", "return", "common_extensions", "[", "img_format", "]", "for", "extension", ",", "ext_format", "in", "Image", ".", "EXTENSION", ".", "items", "(", ")", ":...
https://github.com/hasgeek/hasjob/blob/38098e8034ee749704dea65394b366e8adc5c71f/hasjob/uploads.py#L25-L31
django-parler/django-parler
577ca2f4a80713a9272c48db30e914a4d9332358
parler/managers.py
python
TranslatableManager.get_queryset
(self)
return qs
[]
def get_queryset(self): qs = super().get_queryset() if not isinstance(qs, TranslatableQuerySet): raise ImproperlyConfigured( f"{self.__class__.__name__}._queryset_class does not inherit from TranslatableQuerySet" ) return qs
[ "def", "get_queryset", "(", "self", ")", ":", "qs", "=", "super", "(", ")", ".", "get_queryset", "(", ")", "if", "not", "isinstance", "(", "qs", ",", "TranslatableQuerySet", ")", ":", "raise", "ImproperlyConfigured", "(", "f\"{self.__class__.__name__}._queryset_...
https://github.com/django-parler/django-parler/blob/577ca2f4a80713a9272c48db30e914a4d9332358/parler/managers.py#L132-L138
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pylibs/osx64/gevent/_socket3.py
python
socket.detach
(self)
return self._sock.detach()
detach() -> file descriptor Close the socket object without closing the underlying file descriptor. The object cannot be used after this call, but the file descriptor can be reused for other purposes. The file descriptor is returned.
detach() -> file descriptor
[ "detach", "()", "-", ">", "file", "descriptor" ]
def detach(self): """detach() -> file descriptor Close the socket object without closing the underlying file descriptor. The object cannot be used after this call, but the file descriptor can be reused for other purposes. The file descriptor is returned. """ self._close...
[ "def", "detach", "(", "self", ")", ":", "self", ".", "_closed", "=", "True", "return", "self", ".", "_sock", ".", "detach", "(", ")" ]
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/osx64/gevent/_socket3.py#L263-L271
apachecn/python_data_analysis_and_mining_action
b392ee4f9097dec1eb1fec3e6621d27367da3092
chapter15/code.py
python
programmer_5
()
sep设置分割词,由于csv默认半角逗号为分割词,而且该词恰好位于停用词表中 所以会导致读取错误 解决办法是手动设置一个不存在的分割词,这里使用的是tipdm 参数engine加上,指定引擎,避免警告
sep设置分割词,由于csv默认半角逗号为分割词,而且该词恰好位于停用词表中 所以会导致读取错误 解决办法是手动设置一个不存在的分割词,这里使用的是tipdm 参数engine加上,指定引擎,避免警告
[ "sep设置分割词,由于csv默认半角逗号为分割词,而且该词恰好位于停用词表中", "所以会导致读取错误", "解决办法是手动设置一个不存在的分割词,这里使用的是tipdm", "参数engine加上,指定引擎,避免警告" ]
def programmer_5(): negfile = "data/meidi_jd_neg_cut.txt" posfile = "data/meidi_jd_pos_cut.txt" stoplist = "data/stoplist.txt" neg = pd.read_csv(negfile, encoding="utf8", header=None) pos = pd.read_csv(posfile, encoding="utf8", header=None) """ sep设置分割词,由于csv默认半角逗号为分割词,而且该词恰好位于停用词表中 所以会...
[ "def", "programmer_5", "(", ")", ":", "negfile", "=", "\"data/meidi_jd_neg_cut.txt\"", "posfile", "=", "\"data/meidi_jd_pos_cut.txt\"", "stoplist", "=", "\"data/stoplist.txt\"", "neg", "=", "pd", ".", "read_csv", "(", "negfile", ",", "encoding", "=", "\"utf8\"", ","...
https://github.com/apachecn/python_data_analysis_and_mining_action/blob/b392ee4f9097dec1eb1fec3e6621d27367da3092/chapter15/code.py#L78-L119
openstack/magnum
fa298eeab19b1d87070d72c7c4fb26cd75b0781e
magnum/common/cert_manager/local_cert_manager.py
python
Cert.get_certificate
(self)
return self.certificate
[]
def get_certificate(self): return self.certificate
[ "def", "get_certificate", "(", "self", ")", ":", "return", "self", ".", "certificate" ]
https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/common/cert_manager/local_cert_manager.py#L40-L41
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/babel/dates.py
python
DateTimeFormat.format_month
(self, char, num)
return get_month_names(width, context, self.locale)[self.value.month]
[]
def format_month(self, char, num): if num <= 2: return '%0*d' % (num, self.value.month) width = {3: 'abbreviated', 4: 'wide', 5: 'narrow'}[num] context = {'M': 'format', 'L': 'stand-alone'}[char] return get_month_names(width, context, self.locale)[self.value.month]
[ "def", "format_month", "(", "self", ",", "char", ",", "num", ")", ":", "if", "num", "<=", "2", ":", "return", "'%0*d'", "%", "(", "num", ",", "self", ".", "value", ".", "month", ")", "width", "=", "{", "3", ":", "'abbreviated'", ",", "4", ":", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/dates.py#L1338-L1343
LZQthePlane/Online-Realtime-Action-Recognition-based-on-OpenPose
33664be6ae7a26e9875f9771dc43d05a8b071dce
Pose/human.py
python
Human._get_uidx
(part_idx, idx)
return '%d-%d' % (part_idx, idx)
[]
def _get_uidx(part_idx, idx): return '%d-%d' % (part_idx, idx)
[ "def", "_get_uidx", "(", "part_idx", ",", "idx", ")", ":", "return", "'%d-%d'", "%", "(", "part_idx", ",", "idx", ")" ]
https://github.com/LZQthePlane/Online-Realtime-Action-Recognition-based-on-OpenPose/blob/33664be6ae7a26e9875f9771dc43d05a8b071dce/Pose/human.py#L15-L16
Dman95/SASM
7e3ae6da1c219a68e26d38939338567e5c27151a
Windows/MinGW64/opt/lib/python2.7/site.py
python
setcopyright
()
Set 'copyright' and 'credits' in __builtin__
Set 'copyright' and 'credits' in __builtin__
[ "Set", "copyright", "and", "credits", "in", "__builtin__" ]
def setcopyright(): """Set 'copyright' and 'credits' in __builtin__""" __builtin__.copyright = _Printer("copyright", sys.copyright) if sys.platform[:4] == 'java': __builtin__.credits = _Printer( "credits", "Jython is maintained by the Jython developers (www.jython.org).") ...
[ "def", "setcopyright", "(", ")", ":", "__builtin__", ".", "copyright", "=", "_Printer", "(", "\"copyright\"", ",", "sys", ".", "copyright", ")", "if", "sys", ".", "platform", "[", ":", "4", "]", "==", "'java'", ":", "__builtin__", ".", "credits", "=", ...
https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/opt/lib/python2.7/site.py#L426-L441
tomopy/tomopy
51b58c8055428181d91913c91362f443a79ad0cd
source/tomopy/util/extern/accel.py
python
c_accel_mlem
(tomo, center, recon, theta, **kwargs)
return LIB_TOMOPY_ACCEL.cxx_mlem( dtype.as_c_float_p(tomo), dtype.as_c_int(dy), dtype.as_c_int(dt), dtype.as_c_int(dx), dtype.as_c_float_p(center), dtype.as_c_float_p(theta), dtype.as_c_float_p(recon), dtype.as_c_int(kwargs['num_gridx']), dtype.as_...
[]
def c_accel_mlem(tomo, center, recon, theta, **kwargs): if LIB_TOMOPY_ACCEL is None: _missing_library("MLEM ACCEL") if len(tomo.shape) == 2: # no y-axis (only one slice) dy = 1 dt, dx = tomo.shape else: dy, dt, dx = tomo.shape LIB_TOMOPY_ACCEL.cxx_mlem.restype ...
[ "def", "c_accel_mlem", "(", "tomo", ",", "center", ",", "recon", ",", "theta", ",", "*", "*", "kwargs", ")", ":", "if", "LIB_TOMOPY_ACCEL", "is", "None", ":", "_missing_library", "(", "\"MLEM ACCEL\"", ")", "if", "len", "(", "tomo", ".", "shape", ")", ...
https://github.com/tomopy/tomopy/blob/51b58c8055428181d91913c91362f443a79ad0cd/source/tomopy/util/extern/accel.py#L66-L94
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/requests/adapters.py
python
BaseAdapter.send
(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None)
Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up...
Sends PreparedRequest object. Returns Response object.
[ "Sends", "PreparedRequest", "object", ".", "Returns", "Response", "object", "." ]
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None): """Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest <PreparedRequest>` being sent. :param stream: (optional) Whether to stream the request co...
[ "def", "send", "(", "self", ",", "request", ",", "stream", "=", "False", ",", "timeout", "=", "None", ",", "verify", "=", "True", ",", "cert", "=", "None", ",", "proxies", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/requests/adapters.py#L61-L77
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/billiard/managers.py
python
Server.serve_forever
(self)
Run the server forever
Run the server forever
[ "Run", "the", "server", "forever" ]
def serve_forever(self): ''' Run the server forever ''' self.stop_event = threading.Event() process.current_process()._manager_server = self try: accepter = threading.Thread(target=self.accepter) accepter.daemon = True accepter.start() ...
[ "def", "serve_forever", "(", "self", ")", ":", "self", ".", "stop_event", "=", "threading", ".", "Event", "(", ")", "process", ".", "current_process", "(", ")", ".", "_manager_server", "=", "self", "try", ":", "accepter", "=", "threading", ".", "Thread", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/billiard/managers.py#L165-L185
openstack/swift
b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100
swift/common/wsgi.py
python
WorkersStrategy.register_worker_exit
(self, pid)
Called when a worker has exited. NOTE: a re-exec'ed server can reap the dead worker PIDs from the old server process that is being replaced as part of a service reload (SIGUSR1). So we need to be robust to getting some unknown PID here. :param int pid: The PID of the worker that exite...
Called when a worker has exited.
[ "Called", "when", "a", "worker", "has", "exited", "." ]
def register_worker_exit(self, pid): """ Called when a worker has exited. NOTE: a re-exec'ed server can reap the dead worker PIDs from the old server process that is being replaced as part of a service reload (SIGUSR1). So we need to be robust to getting some unknown PID here. ...
[ "def", "register_worker_exit", "(", "self", ",", "pid", ")", ":", "sock", "=", "self", ".", "tracking_data", ".", "pop", "(", "pid", ",", "None", ")", "if", "sock", "is", "None", ":", "self", ".", "logger", ".", "info", "(", "'Ignoring wait() result from...
https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/wsgi.py#L861-L879
deepmind/sonnet
5cbfdc356962d9b6198d5b63f0826a80acfdf35b
sonnet/src/recurrent.py
python
dynamic_unroll
( core, input_sequence, # time-major. initial_state, sequence_length=None, parallel_iterations=1, swap_memory=False)
return output_sequence, state
Performs a dynamic unroll of an RNN. >>> core = snt.LSTM(hidden_size=16) >>> batch_size = 3 >>> input_sequence = tf.random.uniform([1, batch_size, 2]) >>> output_sequence, final_state = snt.dynamic_unroll( ... core, ... input_sequence, ... core.initial_state(batch_...
Performs a dynamic unroll of an RNN.
[ "Performs", "a", "dynamic", "unroll", "of", "an", "RNN", "." ]
def dynamic_unroll( core, input_sequence, # time-major. initial_state, sequence_length=None, parallel_iterations=1, swap_memory=False): """Performs a dynamic unroll of an RNN. >>> core = snt.LSTM(hidden_size=16) >>> batch_size = 3 >>> input_sequence = tf.random.uniform([1, ...
[ "def", "dynamic_unroll", "(", "core", ",", "input_sequence", ",", "# time-major.", "initial_state", ",", "sequence_length", "=", "None", ",", "parallel_iterations", "=", "1", ",", "swap_memory", "=", "False", ")", ":", "num_steps", ",", "input_tas", "=", "_unsta...
https://github.com/deepmind/sonnet/blob/5cbfdc356962d9b6198d5b63f0826a80acfdf35b/sonnet/src/recurrent.py#L296-L384
ganglia/gmond_python_modules
2f7fcab3d27926ef4a2feb1b53c09af16a43e729
gpu/nvidia/nvidia-ml-py-3.295.00/pynvml.py
python
nvmlInit
()
return None
[]
def nvmlInit(): global nvmlLib global libLoadLock # # Load the library if it isn't loaded already # if (nvmlLib == None): # lock to ensure only one caller loads the library libLoadLock.acquire() try: # ensure the library still isn't loaded ...
[ "def", "nvmlInit", "(", ")", ":", "global", "nvmlLib", "global", "libLoadLock", "#", "# Load the library if it isn't loaded already", "#", "if", "(", "nvmlLib", "==", "None", ")", ":", "# lock to ensure only one caller loads the library", "libLoadLock", ".", "acquire", ...
https://github.com/ganglia/gmond_python_modules/blob/2f7fcab3d27926ef4a2feb1b53c09af16a43e729/gpu/nvidia/nvidia-ml-py-3.295.00/pynvml.py#L322-L359
NVIDIA/OpenSeq2Seq
8681d381ed404fde516e2c1b823de5a213c59aba
open_seq2seq/utils/ctc_decoder.py
python
ctc_greedy_decoder
(logits, wordmap, step_size, blank_idx, start_shift, end_shift)
return output, start, end
Decodes logits to chars using greedy ctc format, outputs start and end time for every word Args : logits: time x chars (log probabilities) wordmap: vocab (maps index to characters) step_size: number of steps to take in time domain per block of input blank_idx: index of blank char start_shift: sh...
Decodes logits to chars using greedy ctc format, outputs start and end time for every word Args : logits: time x chars (log probabilities) wordmap: vocab (maps index to characters) step_size: number of steps to take in time domain per block of input blank_idx: index of blank char start_shift: sh...
[ "Decodes", "logits", "to", "chars", "using", "greedy", "ctc", "format", "outputs", "start", "and", "end", "time", "for", "every", "word", "Args", ":", "logits", ":", "time", "x", "chars", "(", "log", "probabilities", ")", "wordmap", ":", "vocab", "(", "m...
def ctc_greedy_decoder(logits, wordmap, step_size, blank_idx, start_shift, end_shift): """Decodes logits to chars using greedy ctc format, outputs start and end time for every word Args : logits: time x chars (log probabilities) wordmap: vocab (maps index to characters) step_siz...
[ "def", "ctc_greedy_decoder", "(", "logits", ",", "wordmap", ",", "step_size", ",", "blank_idx", ",", "start_shift", ",", "end_shift", ")", ":", "prev_idx", "=", "-", "1", "output", "=", "[", "]", "start", "=", "[", "]", "end", "=", "[", "]", "lst_lette...
https://github.com/NVIDIA/OpenSeq2Seq/blob/8681d381ed404fde516e2c1b823de5a213c59aba/open_seq2seq/utils/ctc_decoder.py#L5-L38
snakemake/snakemake
987282dde8a2db5174414988c134a39ae8836a61
snakemake/utils.py
python
report
( text, path, stylesheet=None, defaultenc="utf8", template=None, metadata=None, **files )
Create an HTML report using python docutils. This is deprecated in favor of the --report flag. Attention: This function needs Python docutils to be installed for the python installation you use with Snakemake. All keywords not listed below are intepreted as paths to files that shall be embedded i...
Create an HTML report using python docutils.
[ "Create", "an", "HTML", "report", "using", "python", "docutils", "." ]
def report( text, path, stylesheet=None, defaultenc="utf8", template=None, metadata=None, **files ): """Create an HTML report using python docutils. This is deprecated in favor of the --report flag. Attention: This function needs Python docutils to be installed for the pyth...
[ "def", "report", "(", "text", ",", "path", ",", "stylesheet", "=", "None", ",", "defaultenc", "=", "\"utf8\"", ",", "template", "=", "None", ",", "metadata", "=", "None", ",", "*", "*", "files", ")", ":", "if", "stylesheet", "is", "None", ":", "os", ...
https://github.com/snakemake/snakemake/blob/987282dde8a2db5174414988c134a39ae8836a61/snakemake/utils.py#L223-L288
mgear-dev/mgear
06ddc26c5adb5eab07ca470c7fafa77404c8a1de
scripts/mgear/maya/curve.py
python
collect_curve_data
(objs=None)
return curves_dict
Generate a dictionary descriving the curve data Suport multiple objects Args: objs (dagNode, optional): Curve object to store collect_trans (bool, optional): if false will skip the transformation matrix Returns: dict: Curves data
Generate a dictionary descriving the curve data
[ "Generate", "a", "dictionary", "descriving", "the", "curve", "data" ]
def collect_curve_data(objs=None): """Generate a dictionary descriving the curve data Suport multiple objects Args: objs (dagNode, optional): Curve object to store collect_trans (bool, optional): if false will skip the transformation matrix Returns: dict: Curves da...
[ "def", "collect_curve_data", "(", "objs", "=", "None", ")", ":", "if", "not", "objs", ":", "objs", "=", "pm", ".", "selected", "(", ")", "if", "not", "isinstance", "(", "objs", ",", "list", ")", ":", "objs", "=", "[", "objs", "]", "curves_dict", "=...
https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/curve.py#L342-L384
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
NLP/MRQA2019-BASELINE/src/tokenization.py
python
whitespace_tokenize
(text)
return tokens
Runs basic whitespace cleaning and splitting on a peice of text.
Runs basic whitespace cleaning and splitting on a peice of text.
[ "Runs", "basic", "whitespace", "cleaning", "and", "splitting", "on", "a", "peice", "of", "text", "." ]
def whitespace_tokenize(text): """Runs basic whitespace cleaning and splitting on a peice of text.""" text = text.strip() if not text: return [] tokens = text.split() return tokens
[ "def", "whitespace_tokenize", "(", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "not", "text", ":", "return", "[", "]", "tokens", "=", "text", ".", "split", "(", ")", "return", "tokens" ]
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/NLP/MRQA2019-BASELINE/src/tokenization.py#L100-L106
adamhadani/logtools
0b47662179b6d29be5629702e1eaddefb2b281fb
logtools/_sample.py
python
logsample
(fh, num_samples, **kwargs)
Use a Reservoir Sampling algorithm to sample uniformly random lines from input stream.
Use a Reservoir Sampling algorithm to sample uniformly random lines from input stream.
[ "Use", "a", "Reservoir", "Sampling", "algorithm", "to", "sample", "uniformly", "random", "lines", "from", "input", "stream", "." ]
def logsample(fh, num_samples, **kwargs): """Use a Reservoir Sampling algorithm to sample uniformly random lines from input stream.""" R = [] N = num_samples for i, k in enumerate(fh): if i < N: R.append(k) else: r = randint(0,i) if r < N: ...
[ "def", "logsample", "(", "fh", ",", "num_samples", ",", "*", "*", "kwargs", ")", ":", "R", "=", "[", "]", "N", "=", "num_samples", "for", "i", ",", "k", "in", "enumerate", "(", "fh", ")", ":", "if", "i", "<", "N", ":", "R", ".", "append", "("...
https://github.com/adamhadani/logtools/blob/0b47662179b6d29be5629702e1eaddefb2b281fb/logtools/_sample.py#L60-L76
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/pip/_vendor/pyparsing.py
python
withAttribute
(*args,**attrDict)
return pa
Helper to create a validating parse action to be used with start tags created with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{<TD>} or C{<DIV>}. Call C{withAttribute} with a ser...
Helper to create a validating parse action to be used with start tags created with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{<TD>} or C{<DIV>}.
[ "Helper", "to", "create", "a", "validating", "parse", "action", "to", "be", "used", "with", "start", "tags", "created", "with", "C", "{", "L", "{", "makeXMLTags", "}}", "or", "C", "{", "L", "{", "makeHTMLTags", "}}", ".", "Use", "C", "{", "withAttribut...
def withAttribute(*args,**attrDict): """ Helper to create a validating parse action to be used with start tags created with C{L{makeXMLTags}} or C{L{makeHTMLTags}}. Use C{withAttribute} to qualify a starting tag with a required attribute value, to avoid false matches on common tags such as C{<TD>} o...
[ "def", "withAttribute", "(", "*", "args", ",", "*", "*", "attrDict", ")", ":", "if", "args", ":", "attrs", "=", "args", "[", ":", "]", "else", ":", "attrs", "=", "attrDict", ".", "items", "(", ")", "attrs", "=", "[", "(", "k", ",", "v", ")", ...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L4891-L4953
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/analyses/cfg/cfg_base.py
python
CFGBase._process_jump_table_targeted_functions
(self, functions, predetermined_function_addrs, blockaddr_to_function)
return functions_to_remove
Sometimes compilers will optimize "cold" code regions, make them separate functions, mark them as cold, which conflicts with how angr handles jumps to these functions (because they weren't functions to start with). Here is an example (in function version_etc_arn() from gllib):: switch (n_author...
Sometimes compilers will optimize "cold" code regions, make them separate functions, mark them as cold, which conflicts with how angr handles jumps to these functions (because they weren't functions to start with). Here is an example (in function version_etc_arn() from gllib)::
[ "Sometimes", "compilers", "will", "optimize", "cold", "code", "regions", "make", "them", "separate", "functions", "mark", "them", "as", "cold", "which", "conflicts", "with", "how", "angr", "handles", "jumps", "to", "these", "functions", "(", "because", "they", ...
def _process_jump_table_targeted_functions(self, functions, predetermined_function_addrs, blockaddr_to_function) -> Set[int]: """ Sometimes compilers will optimize...
[ "def", "_process_jump_table_targeted_functions", "(", "self", ",", "functions", ",", "predetermined_function_addrs", ",", "blockaddr_to_function", ")", "->", "Set", "[", "int", "]", ":", "jumptable_entries", ":", "Set", "[", "int", "]", "=", "set", "(", ")", "fo...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/cfg/cfg_base.py#L1736-L1797
sacmehta/EdgeNets
2b232d3f7fb60658755dad1ebca0ffc895cc795e
nn_layers/cnn_utils.py
python
CBR.__init__
(self, nIn, nOut, kSize, stride=1, dilation=1, groups=1, act_name='prelu')
:param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for down-sampling. Default is 1 :param groups: # of groups for group-wise convolution :param act_name: Name of the activation function
[]
def __init__(self, nIn, nOut, kSize, stride=1, dilation=1, groups=1, act_name='prelu'): ''' :param nIn: number of input channels :param nOut: number of output channels :param kSize: kernel size :param stride: stride rate for down-sampling. Default is 1 :param groups: # o...
[ "def", "__init__", "(", "self", ",", "nIn", ",", "nOut", ",", "kSize", ",", "stride", "=", "1", ",", "dilation", "=", "1", ",", "groups", "=", "1", ",", "act_name", "=", "'prelu'", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "padding"...
https://github.com/sacmehta/EdgeNets/blob/2b232d3f7fb60658755dad1ebca0ffc895cc795e/nn_layers/cnn_utils.py#L31-L47
cognitect-labs/transducers-python
11ac3e5c78a5a9dd30719d3aba91bf333c249a94
transducers/transducers.py
python
drop_while
(pred)
return _drop_while_xducer
Drops values so long as a condition is true.
Drops values so long as a condition is true.
[ "Drops", "values", "so", "long", "as", "a", "condition", "is", "true", "." ]
def drop_while(pred): """Drops values so long as a condition is true.""" def _drop_while_xducer(step): outer = {"trigger": False} def _drop_while_step(r=Missing, x=Missing): if r is Missing: return step() if x is Missing: return step(r) if oute...
[ "def", "drop_while", "(", "pred", ")", ":", "def", "_drop_while_xducer", "(", "step", ")", ":", "outer", "=", "{", "\"trigger\"", ":", "False", "}", "def", "_drop_while_step", "(", "r", "=", "Missing", ",", "x", "=", "Missing", ")", ":", "if", "r", "...
https://github.com/cognitect-labs/transducers-python/blob/11ac3e5c78a5a9dd30719d3aba91bf333c249a94/transducers/transducers.py#L166-L181
stanford-futuredata/noscope
6c6aa72e09280530dfdcf87871c1ac43df3b6cc3
example/noscope_accuracy.py
python
window_yolo
(frames)
return smooth_indicator(true_indicator)
[]
def window_yolo(frames): true_indicator = np.asarray( map(lambda x: int(x.confidence > YOLO_CONFIDENCE), frames) ) # smooth and window the yolo labels return smooth_indicator(true_indicator)
[ "def", "window_yolo", "(", "frames", ")", ":", "true_indicator", "=", "np", ".", "asarray", "(", "map", "(", "lambda", "x", ":", "int", "(", "x", ".", "confidence", ">", "YOLO_CONFIDENCE", ")", ",", "frames", ")", ")", "# smooth and window the yolo labels", ...
https://github.com/stanford-futuredata/noscope/blob/6c6aa72e09280530dfdcf87871c1ac43df3b6cc3/example/noscope_accuracy.py#L150-L154
glinscott/fishtest
8d2b823a63fbe7be169a2177a130018c389d7aea
worker/packages/idna/intranges.py
python
intranges_from_list
(list_)
return tuple(ranges)
Represent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples.
Represent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i.
[ "Represent", "a", "list", "of", "integers", "as", "a", "sequence", "of", "ranges", ":", "((", "start_0", "end_0", ")", "(", "start_1", "end_1", ")", "...", ")", "such", "that", "the", "original", "integers", "are", "exactly", "those", "x", "such", "that"...
def intranges_from_list(list_): """Represent a list of integers as a sequence of ranges: ((start_0, end_0), (start_1, end_1), ...), such that the original integers are exactly those x such that start_i <= x < end_i for some i. Ranges are encoded as single integers (start << 32 | end), not as tuples. ...
[ "def", "intranges_from_list", "(", "list_", ")", ":", "sorted_list", "=", "sorted", "(", "list_", ")", "ranges", "=", "[", "]", "last_write", "=", "-", "1", "for", "i", "in", "range", "(", "len", "(", "sorted_list", ")", ")", ":", "if", "i", "+", "...
https://github.com/glinscott/fishtest/blob/8d2b823a63fbe7be169a2177a130018c389d7aea/worker/packages/idna/intranges.py#L10-L29
jeanharb/option_critic
5d6c81a650a8f452bc8ad3250f1f211d317fde8c
launcher.py
python
process_args
(args, defaults, description)
return parameters
Handle the command line. args - list of command line arguments (not including executable name) defaults - a name space with variables corresponding to each of the required default command line values. description - a string to display at the top of the help message.
Handle the command line.
[ "Handle", "the", "command", "line", "." ]
def process_args(args, defaults, description): """ Handle the command line. args - list of command line arguments (not including executable name) defaults - a name space with variables corresponding to each of the required default command line values. description - a string to di...
[ "def", "process_args", "(", "args", ",", "defaults", ",", "description", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "description", ")", "parser", ".", "add_argument", "(", "'-r'", ",", "'--rom'", ",", "dest", "=", ...
https://github.com/jeanharb/option_critic/blob/5d6c81a650a8f452bc8ad3250f1f211d317fde8c/launcher.py#L11-L158
girder/girder
0766ba8e7f9b25ce81e7c0d19bd343479bceea20
girder/models/collection.py
python
Collection.subtreeCount
(self, doc, includeItems=True, user=None, level=None)
return count
Return the size of the folders within the collection. The collection is counted as well. :param doc: The collection. :param includeItems: Whether items should be included in the count. :type includeItems: bool :param user: If filtering by permission, the user to filter against....
Return the size of the folders within the collection. The collection is counted as well.
[ "Return", "the", "size", "of", "the", "folders", "within", "the", "collection", ".", "The", "collection", "is", "counted", "as", "well", "." ]
def subtreeCount(self, doc, includeItems=True, user=None, level=None): """ Return the size of the folders within the collection. The collection is counted as well. :param doc: The collection. :param includeItems: Whether items should be included in the count. :type incl...
[ "def", "subtreeCount", "(", "self", ",", "doc", ",", "includeItems", "=", "True", ",", "user", "=", "None", ",", "level", "=", "None", ")", ":", "from", ".", "folder", "import", "Folder", "count", "=", "1", "folderModel", "=", "Folder", "(", ")", "fo...
https://github.com/girder/girder/blob/0766ba8e7f9b25ce81e7c0d19bd343479bceea20/girder/models/collection.py#L279-L303
pyparsing/pyparsing
1ccf846394a055924b810faaf9628dac53633848
examples/pymicko.py
python
CodeGenerator.take_register
(self, rtype=SharedData.TYPES.NO_TYPE)
return reg
Reserves one working register and sets its type
Reserves one working register and sets its type
[ "Reserves", "one", "working", "register", "and", "sets", "its", "type" ]
def take_register(self, rtype=SharedData.TYPES.NO_TYPE): """Reserves one working register and sets its type""" if len(self.free_registers) == 0: self.error("no more free registers") reg = self.free_registers.pop() self.used_registers.append(reg) self.symtab.set_type(r...
[ "def", "take_register", "(", "self", ",", "rtype", "=", "SharedData", ".", "TYPES", ".", "NO_TYPE", ")", ":", "if", "len", "(", "self", ".", "free_registers", ")", "==", "0", ":", "self", ".", "error", "(", "\"no more free registers\"", ")", "reg", "=", ...
https://github.com/pyparsing/pyparsing/blob/1ccf846394a055924b810faaf9628dac53633848/examples/pymicko.py#L697-L704
KinglittleQ/GST-Tacotron
1870f6e1b5b27b556212efd93faa629197e00c46
Data.py
python
collate_fn
(batch)
return {'text': texts, 'mel': mels, 'mag': mags}
texts: [N, max_T_x] mels: [N, max_T_y/r, n_mels*r] mags: [N, max_T_y, 1+n_fft/2]
texts: [N, max_T_x] mels: [N, max_T_y/r, n_mels*r] mags: [N, max_T_y, 1+n_fft/2]
[ "texts", ":", "[", "N", "max_T_x", "]", "mels", ":", "[", "N", "max_T_y", "/", "r", "n_mels", "*", "r", "]", "mags", ":", "[", "N", "max_T_y", "1", "+", "n_fft", "/", "2", "]" ]
def collate_fn(batch): ''' texts: [N, max_T_x] mels: [N, max_T_y/r, n_mels*r] mags: [N, max_T_y, 1+n_fft/2] ''' texts = [d['text'] for d in batch] mels = [d['mel'] for d in batch] mags = [d['mag'] for d in batch] texts = pad_sequence(texts) mels = pad_sequence(mels) mags ...
[ "def", "collate_fn", "(", "batch", ")", ":", "texts", "=", "[", "d", "[", "'text'", "]", "for", "d", "in", "batch", "]", "mels", "=", "[", "d", "[", "'mel'", "]", "for", "d", "in", "batch", "]", "mags", "=", "[", "d", "[", "'mag'", "]", "for"...
https://github.com/KinglittleQ/GST-Tacotron/blob/1870f6e1b5b27b556212efd93faa629197e00c46/Data.py#L42-L57
cea-sec/miasm
09376c524aedc7920a7eda304d6095e12f6958f4
miasm/analysis/binary.py
python
Container.__init__
(self, data, loc_db, **kwargs)
Alias for 'parse
Alias for 'parse
[ "Alias", "for", "parse" ]
def __init__(self, data, loc_db, **kwargs): "Alias for 'parse'" # Init attributes self._executable = None self._bin_stream = None self._entry_point = None self._arch = None self._loc_db = loc_db # Launch parsing self.parse(data, **kwargs)
[ "def", "__init__", "(", "self", ",", "data", ",", "loc_db", ",", "*", "*", "kwargs", ")", ":", "# Init attributes", "self", ".", "_executable", "=", "None", "self", ".", "_bin_stream", "=", "None", "self", ".", "_entry_point", "=", "None", "self", ".", ...
https://github.com/cea-sec/miasm/blob/09376c524aedc7920a7eda304d6095e12f6958f4/miasm/analysis/binary.py#L82-L92
pabigot/pyxb
14737c23a125fd12c954823ad64fc4497816fae3
pyxb/binding/content.py
python
ElementUse.typeDefinition
(self)
return self.__elementDeclaration.elementBinding().typeDefinition()
Return the element type. Equivalent to L{elementDeclaration}().L{elementBinding()<pyxb.binding.content.ElementDeclaration.elementBinding>}.L{typeDefinition()<pyxb.binding.basis.element.typeDefinition>}.
Return the element type.
[ "Return", "the", "element", "type", "." ]
def typeDefinition (self): """Return the element type. Equivalent to L{elementDeclaration}().L{elementBinding()<pyxb.binding.content.ElementDeclaration.elementBinding>}.L{typeDefinition()<pyxb.binding.basis.element.typeDefinition>}.""" return self.__elementDeclaration.elementBinding().typeDefin...
[ "def", "typeDefinition", "(", "self", ")", ":", "return", "self", ".", "__elementDeclaration", ".", "elementBinding", "(", ")", ".", "typeDefinition", "(", ")" ]
https://github.com/pabigot/pyxb/blob/14737c23a125fd12c954823ad64fc4497816fae3/pyxb/binding/content.py#L716-L720
Map-A-Droid/MAD
81375b5c9ccc5ca3161eb487aa81469d40ded221
mapadroid/utils/language.py
python
i8ln
(word)
return word
[]
def i8ln(word): lang_file = 'locale/' + os.environ['LANGUAGE'] + '/mad.json' if os.path.isfile(lang_file): with open(lang_file, encoding='utf8') as f: language_file = json.load(f) if word in language_file: return language_file[word] return word
[ "def", "i8ln", "(", "word", ")", ":", "lang_file", "=", "'locale/'", "+", "os", ".", "environ", "[", "'LANGUAGE'", "]", "+", "'/mad.json'", "if", "os", ".", "path", ".", "isfile", "(", "lang_file", ")", ":", "with", "open", "(", "lang_file", ",", "en...
https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/utils/language.py#L16-L24
pymc-devs/pymc
38867dd19e96afb0ceccc8ccd74a9795f118dfe3
pymc/backends/ndarray.py
python
point_list_to_multitrace
( point_list: List[Dict[str, np.ndarray]], model: Optional[Model] = None )
return MultiTrace([chain])
transform point list into MultiTrace
transform point list into MultiTrace
[ "transform", "point", "list", "into", "MultiTrace" ]
def point_list_to_multitrace( point_list: List[Dict[str, np.ndarray]], model: Optional[Model] = None ) -> MultiTrace: """transform point list into MultiTrace""" _model = modelcontext(model) varnames = list(point_list[0].keys()) with _model: chain = NDArray(model=_model, vars=[_model[vn] for ...
[ "def", "point_list_to_multitrace", "(", "point_list", ":", "List", "[", "Dict", "[", "str", ",", "np", ".", "ndarray", "]", "]", ",", "model", ":", "Optional", "[", "Model", "]", "=", "None", ")", "->", "MultiTrace", ":", "_model", "=", "modelcontext", ...
https://github.com/pymc-devs/pymc/blob/38867dd19e96afb0ceccc8ccd74a9795f118dfe3/pymc/backends/ndarray.py#L214-L231
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/turtle.py
python
TNavigator._rotate
(self, angle)
Turn turtle counterclockwise by specified angle if angle > 0.
Turn turtle counterclockwise by specified angle if angle > 0.
[ "Turn", "turtle", "counterclockwise", "by", "specified", "angle", "if", "angle", ">", "0", "." ]
def _rotate(self, angle): """Turn turtle counterclockwise by specified angle if angle > 0.""" angle *= self._degreesPerAU self._orient = self._orient.rotate(angle)
[ "def", "_rotate", "(", "self", ",", "angle", ")", ":", "angle", "*=", "self", ".", "_degreesPerAU", "self", ".", "_orient", "=", "self", ".", "_orient", ".", "rotate", "(", "angle", ")" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/turtle.py#L1607-L1610
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/voiper/sulley/impacket/dcerpc/conv.py
python
WhoAreYou.set_activity_binuuid
(self, binuuid)
[]
def set_activity_binuuid(self, binuuid): assert 16 == len(binuuid) self.get_bytes()[0:0+16] = array.array('B', binuuid)
[ "def", "set_activity_binuuid", "(", "self", ",", "binuuid", ")", ":", "assert", "16", "==", "len", "(", "binuuid", ")", "self", ".", "get_bytes", "(", ")", "[", "0", ":", "0", "+", "16", "]", "=", "array", ".", "array", "(", "'B'", ",", "binuuid", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/voiper/sulley/impacket/dcerpc/conv.py#L29-L31
akirafukui/vqa-mcb
172775b2ec927456eecbe1aa5878b673482f2a54
train/v4/vqa_data_provider_layer.py
python
VQADataProvider.vec_to_answer
(self, ans_symbol)
return self.rev_adict[ans_symbol]
Return answer id if the answer is included in vocabulary otherwise ''
Return answer id if the answer is included in vocabulary otherwise ''
[ "Return", "answer", "id", "if", "the", "answer", "is", "included", "in", "vocabulary", "otherwise" ]
def vec_to_answer(self, ans_symbol): """ Return answer id if the answer is included in vocabulary otherwise '' """ if self.rev_adict is None: rev_adict = {} for k,v in self.adict.items(): rev_adict[v] = k self.rev_adict = rev_adict return self...
[ "def", "vec_to_answer", "(", "self", ",", "ans_symbol", ")", ":", "if", "self", ".", "rev_adict", "is", "None", ":", "rev_adict", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "adict", ".", "items", "(", ")", ":", "rev_adict", "[", "v", ...
https://github.com/akirafukui/vqa-mcb/blob/172775b2ec927456eecbe1aa5878b673482f2a54/train/v4/vqa_data_provider_layer.py#L177-L185
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/xml/dom/expatbuilder.py
python
ExpatBuilder.getParser
(self)
return self._parser
Return the parser object, creating a new one if needed.
Return the parser object, creating a new one if needed.
[ "Return", "the", "parser", "object", "creating", "a", "new", "one", "if", "needed", "." ]
def getParser(self): """Return the parser object, creating a new one if needed.""" if not self._parser: self._parser = self.createParser() self._intern_setdefault = self._parser.intern.setdefault self._parser.buffer_text = True self._parser.ordered_attribu...
[ "def", "getParser", "(", "self", ")", ":", "if", "not", "self", ".", "_parser", ":", "self", ".", "_parser", "=", "self", ".", "createParser", "(", ")", "self", ".", "_intern_setdefault", "=", "self", ".", "_parser", ".", "intern", ".", "setdefault", "...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/xml/dom/expatbuilder.py#L155-L164
Anaconda-Platform/anaconda-project
df5ec33c12591e6512436d38d36c6132fa2e9618
anaconda_project/internal/conda_api.py
python
_get_platform_hacked_conda_command
(extra_args, platform)
Get conda command and a string representing it in error messages.
Get conda command and a string representing it in error messages.
[ "Get", "conda", "command", "and", "a", "string", "representing", "it", "in", "error", "messages", "." ]
def _get_platform_hacked_conda_command(extra_args, platform): """Get conda command and a string representing it in error messages.""" if platform == current_platform() or platform is None: cmd_list = _get_conda_command(extra_args) return (cmd_list, " ".join(cmd_list)) else: (platform...
[ "def", "_get_platform_hacked_conda_command", "(", "extra_args", ",", "platform", ")", ":", "if", "platform", "==", "current_platform", "(", ")", "or", "platform", "is", "None", ":", "cmd_list", "=", "_get_conda_command", "(", "extra_args", ")", "return", "(", "c...
https://github.com/Anaconda-Platform/anaconda-project/blob/df5ec33c12591e6512436d38d36c6132fa2e9618/anaconda_project/internal/conda_api.py#L111-L135
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/sharing.py
python
SharedResourceMixin.downgradeFromShare
(self, request)
[]
def downgradeFromShare(self, request): # Change status on store object yield self._newStoreObject.setShared(False) # Remove all invitees for invitation in (yield self._newStoreObject.allInvitations()): yield self._newStoreObject.uninviteUIDFromShare(invitation.shareeUID) ...
[ "def", "downgradeFromShare", "(", "self", ",", "request", ")", ":", "# Change status on store object", "yield", "self", ".", "_newStoreObject", ".", "setShared", "(", "False", ")", "# Remove all invitees", "for", "invitation", "in", "(", "yield", "self", ".", "_ne...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/sharing.py#L127-L136
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pip/pip/req/req_uninstall.py
python
UninstallPathSet.commit
(self)
Remove temporary save dir: rollback will no longer be possible.
Remove temporary save dir: rollback will no longer be possible.
[ "Remove", "temporary", "save", "dir", ":", "rollback", "will", "no", "longer", "be", "possible", "." ]
def commit(self): """Remove temporary save dir: rollback will no longer be possible.""" if self.save_dir is not None: rmtree(self.save_dir) self.save_dir = None self._moved_paths = []
[ "def", "commit", "(", "self", ")", ":", "if", "self", ".", "save_dir", "is", "not", "None", ":", "rmtree", "(", "self", ".", "save_dir", ")", "self", ".", "save_dir", "=", "None", "self", ".", "_moved_paths", "=", "[", "]" ]
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/req/req_uninstall.py#L149-L154
i-pan/kaggle-rsna18
2db498fe99615d935aa676f04847d0c562fd8e46
models/DeformableConvNets/fpn/core/module.py
python
Module.data_names
(self)
return self._data_names
A list of names for data required by this module.
A list of names for data required by this module.
[ "A", "list", "of", "names", "for", "data", "required", "by", "this", "module", "." ]
def data_names(self): """A list of names for data required by this module.""" return self._data_names
[ "def", "data_names", "(", "self", ")", ":", "return", "self", ".", "_data_names" ]
https://github.com/i-pan/kaggle-rsna18/blob/2db498fe99615d935aa676f04847d0c562fd8e46/models/DeformableConvNets/fpn/core/module.py#L178-L180
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/codec/whoosh3.py
python
W3PerDocReader._get_column_file
(self, fieldname)
return colfile, 0, length
[]
def _get_column_file(self, fieldname): filename = W3Codec.column_filename(self._segment, fieldname) length = self._storage.file_length(filename) colfile = self._storage.open_file(filename) return colfile, 0, length
[ "def", "_get_column_file", "(", "self", ",", "fieldname", ")", ":", "filename", "=", "W3Codec", ".", "column_filename", "(", "self", ".", "_segment", ",", "fieldname", ")", "length", "=", "self", ".", "_storage", ".", "file_length", "(", "filename", ")", "...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/codec/whoosh3.py#L390-L394
blue-oil/blueoil
0c9160b524b17482d59ae48a0c11384f1d26dccc
blueoil/datasets/cifar100.py
python
Cifar100._get_image
(self, index)
return image
Returns numpy array of an image
Returns numpy array of an image
[ "Returns", "numpy", "array", "of", "an", "image" ]
def _get_image(self, index): """Returns numpy array of an image""" image = self.images[index, :] image = image.reshape((3, 32, 32)) image = image.transpose([1, 2, 0]) return image
[ "def", "_get_image", "(", "self", ",", "index", ")", ":", "image", "=", "self", ".", "images", "[", "index", ",", ":", "]", "image", "=", "image", ".", "reshape", "(", "(", "3", ",", "32", ",", "32", ")", ")", "image", "=", "image", ".", "trans...
https://github.com/blue-oil/blueoil/blob/0c9160b524b17482d59ae48a0c11384f1d26dccc/blueoil/datasets/cifar100.py#L56-L63
NationalSecurityAgency/qgis-latlontools-plugin
c93c31294b457a2be6059fc3fc8cef62b2ecb7ba
latLonTools.py
python
LatLonTools.convertCoordinatesTool
(self)
Display the Convert Coordinate Tool Dialog box.
Display the Convert Coordinate Tool Dialog box.
[ "Display", "the", "Convert", "Coordinate", "Tool", "Dialog", "box", "." ]
def convertCoordinatesTool(self): '''Display the Convert Coordinate Tool Dialog box.''' if self.convertCoordinateDialog is None: from .coordinateConverter import CoordinateConverterWidget self.convertCoordinateDialog = CoordinateConverterWidget(self, self.settingsDialog, self.ifa...
[ "def", "convertCoordinatesTool", "(", "self", ")", ":", "if", "self", ".", "convertCoordinateDialog", "is", "None", ":", "from", ".", "coordinateConverter", "import", "CoordinateConverterWidget", "self", ".", "convertCoordinateDialog", "=", "CoordinateConverterWidget", ...
https://github.com/NationalSecurityAgency/qgis-latlontools-plugin/blob/c93c31294b457a2be6059fc3fc8cef62b2ecb7ba/latLonTools.py#L322-L329
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_manage_node.py
python
Yedit.read
(self)
return contents
read from file
read from file
[ "read", "from", "file" ]
def read(self): ''' read from file ''' # check if it exists if self.filename is None or not self.file_exists(): return None contents = None with open(self.filename) as yfd: contents = yfd.read() return contents
[ "def", "read", "(", "self", ")", ":", "# check if it exists", "if", "self", ".", "filename", "is", "None", "or", "not", "self", ".", "file_exists", "(", ")", ":", "return", "None", "contents", "=", "None", "with", "open", "(", "self", ".", "filename", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_adm_manage_node.py#L388-L398
naparuba/shinken
8163d645e801fa43ee1704f099a4684f120e667b
shinken/property.py
python
Property.__init__
(self, default=none_object, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, override=False,...
`default`: default value to be used if this property is not set. If default is None, this property is required. `class_inherit`: List of 2-tuples, (Service, 'blabla'): must set this property to the Service class with name blabla. if (Service, None): must...
`default`: default value to be used if this property is not set. If default is None, this property is required.
[ "default", ":", "default", "value", "to", "be", "used", "if", "this", "property", "is", "not", "set", ".", "If", "default", "is", "None", "this", "property", "is", "required", "." ]
def __init__(self, default=none_object, class_inherit=None, unmanaged=False, help='', no_slots=False, fill_brok=None, conf_send_preparation=None, brok_transformation=None, retention=False, retention_preparation=None, to_send=False, ove...
[ "def", "__init__", "(", "self", ",", "default", "=", "none_object", ",", "class_inherit", "=", "None", ",", "unmanaged", "=", "False", ",", "help", "=", "''", ",", "no_slots", "=", "False", ",", "fill_brok", "=", "None", ",", "conf_send_preparation", "=", ...
https://github.com/naparuba/shinken/blob/8163d645e801fa43ee1704f099a4684f120e667b/shinken/property.py#L56-L124
sabnzbd/sabnzbd
52d21e94d3cc6e30764a833fe2a256783d1a8931
sabnzbd/nzbqueue.py
python
NzbQueue.remove_all
(self, search: Optional[str] = None)
return self.remove_multiple(nzo_ids)
Remove NZO's that match the search-pattern
Remove NZO's that match the search-pattern
[ "Remove", "NZO", "s", "that", "match", "the", "search", "-", "pattern" ]
def remove_all(self, search: Optional[str] = None) -> List[str]: """Remove NZO's that match the search-pattern""" nzo_ids = [] search = safe_lower(search) for nzo_id, nzo in self.__nzo_table.items(): if not search or search in nzo.final_name.lower(): nzo_ids.a...
[ "def", "remove_all", "(", "self", ",", "search", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "str", "]", ":", "nzo_ids", "=", "[", "]", "search", "=", "safe_lower", "(", "search", ")", "for", "nzo_id", ",", "nzo", "in", ...
https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/sabnzbd/nzbqueue.py#L424-L431
markstory/lint-review
b0a5f34ab3808a4752c8e6eac278557530717057
lintreview/git.py
python
branch_exists
(path, name)
return len(matching) == 1
See if a branch exists
See if a branch exists
[ "See", "if", "a", "branch", "exists" ]
def branch_exists(path, name): """See if a branch exists """ command = ['git', 'branch'] return_code, output = _process(command, chdir=path) if return_code: raise IOError(u"Unable to read branches {}'".format(output)) matching = [branch for branch in output.split('\n') if...
[ "def", "branch_exists", "(", "path", ",", "name", ")", ":", "command", "=", "[", "'git'", ",", "'branch'", "]", "return_code", ",", "output", "=", "_process", "(", "command", ",", "chdir", "=", "path", ")", "if", "return_code", ":", "raise", "IOError", ...
https://github.com/markstory/lint-review/blob/b0a5f34ab3808a4752c8e6eac278557530717057/lintreview/git.py#L162-L171
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pytz/__init__.py
python
_FixedOffset.localize
(self, dt, is_dst=False)
return dt.replace(tzinfo=self)
Convert naive time to local time
Convert naive time to local time
[ "Convert", "naive", "time", "to", "local", "time" ]
def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError('Not naive datetime (tzinfo is already set)') return dt.replace(tzinfo=self)
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "return", "dt", ".", "replace", "(", "tz...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/pytz/__init__.py#L432-L436
dmlc/gluon-cv
709bc139919c02f7454cb411311048be188cde64
gluoncv/model_zoo/yolo/darknet.py
python
_conv2d
(channel, kernel, padding, stride, norm_layer=BatchNorm, norm_kwargs=None)
return cell
A common conv-bn-leakyrelu cell
A common conv-bn-leakyrelu cell
[ "A", "common", "conv", "-", "bn", "-", "leakyrelu", "cell" ]
def _conv2d(channel, kernel, padding, stride, norm_layer=BatchNorm, norm_kwargs=None): """A common conv-bn-leakyrelu cell""" cell = nn.HybridSequential(prefix='') cell.add(nn.Conv2D(channel, kernel_size=kernel, strides=stride, padding=padding, use_bias=False)) cell.add(norm_layer(...
[ "def", "_conv2d", "(", "channel", ",", "kernel", ",", "padding", ",", "stride", ",", "norm_layer", "=", "BatchNorm", ",", "norm_kwargs", "=", "None", ")", ":", "cell", "=", "nn", ".", "HybridSequential", "(", "prefix", "=", "''", ")", "cell", ".", "add...
https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/model_zoo/yolo/darknet.py#L13-L20
jbjorne/TEES
caf19a4a1352ac59f5dc13a8684cc42ce4342d9d
Core/RecallAdjust.py
python
getClassRanges
(entities)
return classRanges
[]
def getClassRanges(entities): classRanges = {} for entity in entities: if entity.get("given") == "True": continue predictions=entity.get("predictions") if predictions: for labelConfidence in predictions.split(","): label,confidence=labelConfidence....
[ "def", "getClassRanges", "(", "entities", ")", ":", "classRanges", "=", "{", "}", "for", "entity", "in", "entities", ":", "if", "entity", ".", "get", "(", "\"given\"", ")", "==", "\"True\"", ":", "continue", "predictions", "=", "entity", ".", "get", "(",...
https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/Core/RecallAdjust.py#L62-L75
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/core/worlds.py
python
MultiWorld.epoch_done
(self)
return True
Return if *all* the subworlds are done.
Return if *all* the subworlds are done.
[ "Return", "if", "*", "all", "*", "the", "subworlds", "are", "done", "." ]
def epoch_done(self): """Return if *all* the subworlds are done.""" for t in self.worlds: if not t.epoch_done(): return False return True
[ "def", "epoch_done", "(", "self", ")", ":", "for", "t", "in", "self", ".", "worlds", ":", "if", "not", "t", ".", "epoch_done", "(", ")", ":", "return", "False", "return", "True" ]
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/core/worlds.py#L540-L545
OpenBazaar/OpenBazaar-Server
6bfd8f0c899d7133dadd38d1afdd537a2e182ff1
daemon.py
python
Daemon.restart
(self)
Restart the daemon
Restart the daemon
[ "Restart", "the", "daemon" ]
def restart(self): """ Restart the daemon """ self.stop() self.start()
[ "def", "restart", "(", "self", ")", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
https://github.com/OpenBazaar/OpenBazaar-Server/blob/6bfd8f0c899d7133dadd38d1afdd537a2e182ff1/daemon.py#L117-L122
coreemu/core
7e18a7a72023a69a92ad61d87461bd659ba27f7c
daemon/core/api/grpc/client.py
python
CoreGrpcClient.get_emane_model_config
( self, session_id: int, node_id: int, model: str, iface_id: int = -1 )
return self.stub.GetEmaneModelConfig(request)
Get emane model configuration for a node or a node's interface. :param session_id: session id :param node_id: node id :param model: emane model name :param iface_id: node interface id :return: response with a list of configuration groups :raises grpc.RpcError: when sessi...
Get emane model configuration for a node or a node's interface.
[ "Get", "emane", "model", "configuration", "for", "a", "node", "or", "a", "node", "s", "interface", "." ]
def get_emane_model_config( self, session_id: int, node_id: int, model: str, iface_id: int = -1 ) -> GetEmaneModelConfigResponse: """ Get emane model configuration for a node or a node's interface. :param session_id: session id :param node_id: node id :param model: e...
[ "def", "get_emane_model_config", "(", "self", ",", "session_id", ":", "int", ",", "node_id", ":", "int", ",", "model", ":", "str", ",", "iface_id", ":", "int", "=", "-", "1", ")", "->", "GetEmaneModelConfigResponse", ":", "request", "=", "GetEmaneModelConfig...
https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/api/grpc/client.py#L1095-L1111
mayank93/Twitter-Sentiment-Analysis
f095c6ca6bf69787582b5dabb140fefaf278eb37
front-end/web2py/site-packages/python-ldap-2.4.3/build/lib.linux-x86_64-2.7/dsml.py
python
DSMLWriter.writeHeader
(self)
Write the header
Write the header
[ "Write", "the", "header" ]
def writeHeader(self): """ Write the header """ self._output_file.write('\n'.join([ '<?xml version="1.0" encoding="UTF-8"?>', '<!DOCTYPE root PUBLIC "dsml.dtd" "http://www.dsml.org/1.0/dsml.dtd">', '<dsml:dsml xmlns:dsml="http://www.dsml.org/DSML">', '%s<dsml:directory-en...
[ "def", "writeHeader", "(", "self", ")", ":", "self", ".", "_output_file", ".", "write", "(", "'\\n'", ".", "join", "(", "[", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>'", ",", "'<!DOCTYPE root PUBLIC \"dsml.dtd\" \"http://www.dsml.org/1.0/dsml.dtd\">'", ",", "'<dsml:dsml ...
https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/site-packages/python-ldap-2.4.3/build/lib.linux-x86_64-2.7/dsml.py#L66-L80
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/client/grr_response_client/windows/process.py
python
Process.__exit__
(self, exc_type=None, exc_val=None, exc_tb=None)
[]
def __exit__(self, exc_type=None, exc_val=None, exc_tb=None): self.Close()
[ "def", "__exit__", "(", "self", ",", "exc_type", "=", "None", ",", "exc_val", "=", "None", ",", "exc_tb", "=", "None", ")", ":", "self", ".", "Close", "(", ")" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/client/grr_response_client/windows/process.py#L120-L121
ucfopen/canvasapi
3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36
canvasapi/page.py
python
Page.delete
(self, **kwargs)
return Page(self._requester, response.json())
Delete this page. :calls: `DELETE /api/v1/courses/:course_id/pages/:url \ <https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy>`_ :rtype: :class:`canvasapi.page.Page`
Delete this page.
[ "Delete", "this", "page", "." ]
def delete(self, **kwargs): """ Delete this page. :calls: `DELETE /api/v1/courses/:course_id/pages/:url \ <https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.destroy>`_ :rtype: :class:`canvasapi.page.Page` """ response = self._requester.requ...
[ "def", "delete", "(", "self", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_requester", ".", "request", "(", "\"DELETE\"", ",", "\"courses/{}/pages/{}\"", ".", "format", "(", "self", ".", "course_id", ",", "self", ".", "url", ")", ...
https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/page.py#L10-L24
pyscf/pyscf
0adfb464333f5ceee07b664f291d4084801bae64
pyscf/lib/linalg_helper.py
python
dgeev1
(abop, x0, precond, type=1, tol=1e-12, max_cycle=50, max_space=12, lindep=DAVIDSON_LINDEP, max_memory=MAX_MEMORY, dot=numpy.dot, callback=None, nroots=1, lessio=False, verbose=logger.WARN, tol_residual=None)
return conv, e, x0
Davidson diagonalization method to solve A c = e B c. Args: abop : function([x]) => ([array_like_x], [array_like_x]) abop applies two matrix vector multiplications and returns tuple (Ax, Bx) x0 : 1D array Initial guess precond : diagonal elements of the matrix or f...
Davidson diagonalization method to solve A c = e B c.
[ "Davidson", "diagonalization", "method", "to", "solve", "A", "c", "=", "e", "B", "c", "." ]
def dgeev1(abop, x0, precond, type=1, tol=1e-12, max_cycle=50, max_space=12, lindep=DAVIDSON_LINDEP, max_memory=MAX_MEMORY, dot=numpy.dot, callback=None, nroots=1, lessio=False, verbose=logger.WARN, tol_residual=None): '''Davidson diagonalization method to solve A c = e B c. A...
[ "def", "dgeev1", "(", "abop", ",", "x0", ",", "precond", ",", "type", "=", "1", ",", "tol", "=", "1e-12", ",", "max_cycle", "=", "50", ",", "max_space", "=", "12", ",", "lindep", "=", "DAVIDSON_LINDEP", ",", "max_memory", "=", "MAX_MEMORY", ",", "dot...
https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/lib/linalg_helper.py#L1043-L1267
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
modules/sfp_dnsresolve.py
python
sfp_dnsresolve.handleEvent
(self, event)
[]
def handleEvent(self, event) -> None: eventName = event.eventType srcModuleName = event.module eventData = event.data eventDataHash = self.sf.hashstring(eventData) addrs = None parentEvent = event # Don't be recursive for names if srcModuleName in ["sfp_d...
[ "def", "handleEvent", "(", "self", ",", "event", ")", "->", "None", ":", "eventName", "=", "event", ".", "eventType", "srcModuleName", "=", "event", ".", "module", "eventData", "=", "event", ".", "data", "eventDataHash", "=", "self", ".", "sf", ".", "has...
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_dnsresolve.py#L209-L413
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
libnamebench/nameserver.py
python
NameServer.GetNameFromNameWithDuration
(self, name)
Get a name from another name (with duration). Used for node id lookups.
Get a name from another name (with duration). Used for node id lookups.
[ "Get", "a", "name", "from", "another", "name", "(", "with", "duration", ")", ".", "Used", "for", "node", "id", "lookups", "." ]
def GetNameFromNameWithDuration(self, name): """Get a name from another name (with duration). Used for node id lookups.""" (ip, duration) = self.GetIpFromNameWithDuration(name) if ip: return (self.GetReverseIp(ip), duration) else: return (None, duration)
[ "def", "GetNameFromNameWithDuration", "(", "self", ",", "name", ")", ":", "(", "ip", ",", "duration", ")", "=", "self", ".", "GetIpFromNameWithDuration", "(", "name", ")", "if", "ip", ":", "return", "(", "self", ".", "GetReverseIp", "(", "ip", ")", ",", ...
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/libnamebench/nameserver.py#L532-L538
dhlee347/pytorchic-bert
fefcbd988bc3bcdd2cd67072101a3d94ef362f7e
checkpoint.py
python
load_model
(model, checkpoint_file)
Load the pytorch model from checkpoint file
Load the pytorch model from checkpoint file
[ "Load", "the", "pytorch", "model", "from", "checkpoint", "file" ]
def load_model(model, checkpoint_file): """ Load the pytorch model from checkpoint file """ # Embedding layer e, p = model.embed, 'bert/embeddings/' load_param(checkpoint_file, { e.tok_embed.weight: p+"word_embeddings", e.pos_embed.weight: p+"position_embeddings", e.seg_embed.we...
[ "def", "load_model", "(", "model", ",", "checkpoint_file", ")", ":", "# Embedding layer", "e", ",", "p", "=", "model", ".", "embed", ",", "'bert/embeddings/'", "load_param", "(", "checkpoint_file", ",", "{", "e", ".", "tok_embed", ".", "weight", ":", "p", ...
https://github.com/dhlee347/pytorchic-bert/blob/fefcbd988bc3bcdd2cd67072101a3d94ef362f7e/checkpoint.py#L32-L65
moses-palmer/pystray
c986535e00fbd3dfa003e51660eb03ba7c0a7f17
lib/pystray/_base.py
python
Icon._start_setup
(self, setup)
Starts the setup thread. :param callable setup: The thread handler.
Starts the setup thread.
[ "Starts", "the", "setup", "thread", "." ]
def _start_setup(self, setup): """Starts the setup thread. :param callable setup: The thread handler. """ def setup_handler(): self.__queue.get() if setup: setup(self) else: self.visible = True self._setup_thre...
[ "def", "_start_setup", "(", "self", ",", "setup", ")", ":", "def", "setup_handler", "(", ")", ":", "self", ".", "__queue", ".", "get", "(", ")", "if", "setup", ":", "setup", "(", "self", ")", "else", ":", "self", ".", "visible", "=", "True", "self"...
https://github.com/moses-palmer/pystray/blob/c986535e00fbd3dfa003e51660eb03ba7c0a7f17/lib/pystray/_base.py#L368-L381
AlexFlipnote/discord_bot.py
106cc68decf698f577088784c57f1fbee5bbc3f0
cogs/encryption.py
python
Encryption.encode_base32
(self, ctx, *, input: commands.clean_content = None)
Encode in base32
Encode in base32
[ "Encode", "in", "base32" ]
async def encode_base32(self, ctx, *, input: commands.clean_content = None): """ Encode in base32 """ if not input: input = await self.detect_file(ctx) await self.encryptout( ctx, "Text -> base32", base64.b32encode(input.encode("utf-8")) )
[ "async", "def", "encode_base32", "(", "self", ",", "ctx", ",", "*", ",", "input", ":", "commands", ".", "clean_content", "=", "None", ")", ":", "if", "not", "input", ":", "input", "=", "await", "self", ".", "detect_file", "(", "ctx", ")", "await", "s...
https://github.com/AlexFlipnote/discord_bot.py/blob/106cc68decf698f577088784c57f1fbee5bbc3f0/cogs/encryption.py#L72-L79
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
src/outwiker/gui/controls/ultimatelistctrl.py
python
UltimateListHeaderData.IsFooterChecked
(self)
return self._footerChecked
Returns whether the footer item is checked or not.
Returns whether the footer item is checked or not.
[ "Returns", "whether", "the", "footer", "item", "is", "checked", "or", "not", "." ]
def IsFooterChecked(self): """ Returns whether the footer item is checked or not. """ return self._footerChecked
[ "def", "IsFooterChecked", "(", "self", ")", ":", "return", "self", ".", "_footerChecked" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L3631-L3634
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python3-alpha/python-libs/pyxmpp2/ext/disco.py
python
DiscoItem.set_node
(self,node)
Set the node of the item. :Parameters: - `node`: the new node or `None`. :Types: - `node`: `str`
Set the node of the item.
[ "Set", "the", "node", "of", "the", "item", "." ]
def set_node(self,node): """Set the node of the item. :Parameters: - `node`: the new node or `None`. :Types: - `node`: `str` """ if node is None: if self.xmlnode.hasProp("node"): self.xmlnode.unsetProp("node") retur...
[ "def", "set_node", "(", "self", ",", "node", ")", ":", "if", "node", "is", "None", ":", "if", "self", ".", "xmlnode", ".", "hasProp", "(", "\"node\"", ")", ":", "self", ".", "xmlnode", ".", "unsetProp", "(", "\"node\"", ")", "return", "node", "=", ...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/pyxmpp2/ext/disco.py#L167-L180
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/secure_information_retrieval/base_secure_information_retrieval.py
python
BaseSecureInformationRetrieval._parse_security_level
(self, data_instance)
Cooperatively parse the security level index :param data_instance: :return:
Cooperatively parse the security level index :param data_instance: :return:
[ "Cooperatively", "parse", "the", "security", "level", "index", ":", "param", "data_instance", ":", ":", "return", ":" ]
def _parse_security_level(self, data_instance): """ Cooperatively parse the security level index :param data_instance: :return: """ pass
[ "def", "_parse_security_level", "(", "self", ",", "data_instance", ")", ":", "pass" ]
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/secure_information_retrieval/base_secure_information_retrieval.py#L114-L120
pychess/pychess
e3f9b12947e429993edcc2b9288f79bc181e6500
lib/pychess/Utils/lutils/leval.py
python
evalTrappedBishops
(board, color)
return score if color == WHITE else -score
Check for bishops trapped at A2/H2/A7/H7
Check for bishops trapped at A2/H2/A7/H7
[ "Check", "for", "bishops", "trapped", "at", "A2", "/", "H2", "/", "A7", "/", "H7" ]
def evalTrappedBishops(board, color): """ Check for bishops trapped at A2/H2/A7/H7 """ _bitPosArray = bitPosArray wbishops = board.boards[WHITE][BISHOP] bbishops = board.boards[BLACK][BISHOP] wpawns = board.boards[WHITE][PAWN] bpawns = board.boards[BLACK][PAWN] score = 0 if bbishops: ...
[ "def", "evalTrappedBishops", "(", "board", ",", "color", ")", ":", "_bitPosArray", "=", "bitPosArray", "wbishops", "=", "board", ".", "boards", "[", "WHITE", "]", "[", "BISHOP", "]", "bbishops", "=", "board", ".", "boards", "[", "BLACK", "]", "[", "BISHO...
https://github.com/pychess/pychess/blob/e3f9b12947e429993edcc2b9288f79bc181e6500/lib/pychess/Utils/lutils/leval.py#L580-L610
MITRECND/chopshop
1d26a775f718fe1ef259883ce82d3bde36a21461
shop/ChopConfig.py
python
ChopConfig.interface
(self)
return self.options['interface'].value
interface to listen on.
interface to listen on.
[ "interface", "to", "listen", "on", "." ]
def interface(self): """interface to listen on.""" return self.options['interface'].value
[ "def", "interface", "(", "self", ")", ":", "return", "self", ".", "options", "[", "'interface'", "]", ".", "value" ]
https://github.com/MITRECND/chopshop/blob/1d26a775f718fe1ef259883ce82d3bde36a21461/shop/ChopConfig.py#L160-L162
Calysto/calysto_scheme
15bf81987870bcae1264e5a0a06feb9a8ee12b8b
calysto_scheme/scheme.py
python
b_cont2_45_d
(bindings, k)
[]
def b_cont2_45_d(bindings, k): GLOBALS['value_reg'] = cons(append(List(value1_reg), List(value2_reg)), bindings) GLOBALS['k_reg'] = k GLOBALS['pc'] = apply_cont
[ "def", "b_cont2_45_d", "(", "bindings", ",", "k", ")", ":", "GLOBALS", "[", "'value_reg'", "]", "=", "cons", "(", "append", "(", "List", "(", "value1_reg", ")", ",", "List", "(", "value2_reg", ")", ")", ",", "bindings", ")", "GLOBALS", "[", "'k_reg'", ...
https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L2612-L2615
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
mako/_ast_util.py
python
dump
(node)
return _format(node)
A very verbose representation of the node passed. This is useful for debugging purposes.
A very verbose representation of the node passed. This is useful for debugging purposes.
[ "A", "very", "verbose", "representation", "of", "the", "node", "passed", ".", "This", "is", "useful", "for", "debugging", "purposes", "." ]
def dump(node): """ A very verbose representation of the node passed. This is useful for debugging purposes. """ def _format(node): if isinstance(node, AST): return '%s(%s)' % (node.__class__.__name__, ', '.join('%s=%s' % (a, _format(b)) ...
[ "def", "dump", "(", "node", ")", ":", "def", "_format", "(", "node", ")", ":", "if", "isinstance", "(", "node", ",", "AST", ")", ":", "return", "'%s(%s)'", "%", "(", "node", ".", "__class__", ".", "__name__", ",", "', '", ".", "join", "(", "'%s=%s'...
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/mako/_ast_util.py#L107-L122
Damcy/prioritized-experience-replay
edb1437f65bc60534f728690564398370c18f4c5
rank_based.py
python
Experience.store
(self, experience)
store experience, suggest that experience is a tuple of (s1, a, r, s2, t) so each experience is valid :param experience: maybe a tuple, or list :return: bool, indicate insert status
store experience, suggest that experience is a tuple of (s1, a, r, s2, t) so each experience is valid :param experience: maybe a tuple, or list :return: bool, indicate insert status
[ "store", "experience", "suggest", "that", "experience", "is", "a", "tuple", "of", "(", "s1", "a", "r", "s2", "t", ")", "so", "each", "experience", "is", "valid", ":", "param", "experience", ":", "maybe", "a", "tuple", "or", "list", ":", "return", ":", ...
def store(self, experience): """ store experience, suggest that experience is a tuple of (s1, a, r, s2, t) so each experience is valid :param experience: maybe a tuple, or list :return: bool, indicate insert status """ insert_index = self.fix_index() if in...
[ "def", "store", "(", "self", ",", "experience", ")", ":", "insert_index", "=", "self", ".", "fix_index", "(", ")", "if", "insert_index", ">", "0", ":", "if", "insert_index", "in", "self", ".", "_experience", ":", "del", "self", ".", "_experience", "[", ...
https://github.com/Damcy/prioritized-experience-replay/blob/edb1437f65bc60534f728690564398370c18f4c5/rank_based.py#L101-L119
zhangziliang04/kgRobot
739dd5dcc6d4bb1e39f28cdca8c2b3c4f9b11db9
code/KGQA/kgqa/KB_query/question2sparql.py
python
Question2Sparql.get_sparql
(self, question)
进行语义解析,找到匹配的模板,返回对应的SPARQL查询语句 :param question: :return:
进行语义解析,找到匹配的模板,返回对应的SPARQL查询语句 :param question: :return:
[ "进行语义解析,找到匹配的模板,返回对应的SPARQL查询语句", ":", "param", "question", ":", ":", "return", ":" ]
def get_sparql(self, question): """ 进行语义解析,找到匹配的模板,返回对应的SPARQL查询语句 :param question: :return: """ word_objects = self.tw.get_word_objects(question) queries_dict = dict() for rule in self.rules: #print(rule) # word_objects是一个列表,元素为是包...
[ "def", "get_sparql", "(", "self", ",", "question", ")", ":", "word_objects", "=", "self", ".", "tw", ".", "get_word_objects", "(", "question", ")", "queries_dict", "=", "dict", "(", ")", "for", "rule", "in", "self", ".", "rules", ":", "#print(rule)", "# ...
https://github.com/zhangziliang04/kgRobot/blob/739dd5dcc6d4bb1e39f28cdca8c2b3c4f9b11db9/code/KGQA/kgqa/KB_query/question2sparql.py#L16-L40
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
components/isceobj/RtcProc/runLooks.py
python
runLooks
(self)
return
Make sure that a DEM is available for processing the given data.
Make sure that a DEM is available for processing the given data.
[ "Make", "sure", "that", "a", "DEM", "is", "available", "for", "processing", "the", "given", "data", "." ]
def runLooks(self): ''' Make sure that a DEM is available for processing the given data. ''' refPol = self._grd.polarizations[0] reference = self._grd.loadProduct( os.path.join(self._grd.outputFolder, 'beta_{0}.xml'.format(refPol))) azlooks, rglooks = self._grd.getLooks( self.posting, refe...
[ "def", "runLooks", "(", "self", ")", ":", "refPol", "=", "self", ".", "_grd", ".", "polarizations", "[", "0", "]", "reference", "=", "self", ".", "_grd", ".", "loadProduct", "(", "os", ".", "path", ".", "join", "(", "self", ".", "_grd", ".", "outpu...
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/RtcProc/runLooks.py#L43-L68
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/inject/thirdparty/chardet/mbcharsetprober.py
python
MultiByteCharSetProber.get_confidence
(self)
return self._mDistributionAnalyzer.get_confidence()
[]
def get_confidence(self): return self._mDistributionAnalyzer.get_confidence()
[ "def", "get_confidence", "(", "self", ")", ":", "return", "self", ".", "_mDistributionAnalyzer", ".", "get_confidence", "(", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/chardet/mbcharsetprober.py#L85-L86
kovidgoyal/calibre
2b41671370f2a9eb1109b9ae901ccf915f1bd0c8
src/calibre/utils/winreg/lib.py
python
Key.itervalues
(self, get_data=False, sub_key=None)
Iterate over all values in this key (or optionally the specified sub-key. If get_data is True also return the data for every value, otherwise, just the name.
Iterate over all values in this key (or optionally the specified sub-key. If get_data is True also return the data for every value, otherwise, just the name.
[ "Iterate", "over", "all", "values", "in", "this", "key", "(", "or", "optionally", "the", "specified", "sub", "-", "key", ".", "If", "get_data", "is", "True", "also", "return", "the", "data", "for", "every", "value", "otherwise", "just", "the", "name", "....
def itervalues(self, get_data=False, sub_key=None): '''Iterate over all values in this key (or optionally the specified sub-key. If get_data is True also return the data for every value, otherwise, just the name.''' key = self.hkey if sub_key is not None: try: ...
[ "def", "itervalues", "(", "self", ",", "get_data", "=", "False", ",", "sub_key", "=", "None", ")", ":", "key", "=", "self", ".", "hkey", "if", "sub_key", "is", "not", "None", ":", "try", ":", "key", "=", "RegOpenKey", "(", "key", ",", "sub_key", ")...
https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/utils/winreg/lib.py#L305-L348
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/lxml/html/__init__.py
python
FormElement.action
(self)
Get/set the form's ``action`` attribute.
Get/set the form's ``action`` attribute.
[ "Get", "/", "set", "the", "form", "s", "action", "attribute", "." ]
def action(self): """ Get/set the form's ``action`` attribute. """ base_url = self.base_url action = self.get('action') if base_url and action is not None: return urljoin(base_url, action) else: return action
[ "def", "action", "(", "self", ")", ":", "base_url", "=", "self", ".", "base_url", "action", "=", "self", ".", "get", "(", "'action'", ")", "if", "base_url", "and", "action", "is", "not", "None", ":", "return", "urljoin", "(", "base_url", ",", "action",...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/lxml/html/__init__.py#L1047-L1056
aws/sagemaker-python-sdk
9d259b316f7f43838c16f35c10e98a110b56735b
src/sagemaker/xgboost/utils.py
python
validate_framework_version
(framework_version)
Placeholder docstring
Placeholder docstring
[ "Placeholder", "docstring" ]
def validate_framework_version(framework_version): """Placeholder docstring""" xgboost_version = framework_version.split("-")[0] if xgboost_version in defaults.XGBOOST_UNSUPPORTED_VERSIONS: msg = defaults.XGBOOST_UNSUPPORTED_VERSIONS[xgboost_version] raise ValueError(msg)
[ "def", "validate_framework_version", "(", "framework_version", ")", ":", "xgboost_version", "=", "framework_version", ".", "split", "(", "\"-\"", ")", "[", "0", "]", "if", "xgboost_version", "in", "defaults", ".", "XGBOOST_UNSUPPORTED_VERSIONS", ":", "msg", "=", "...
https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/xgboost/utils.py#L25-L31
ufal/neuralmonkey
8b1465270f6bb28d5417a85cec492f7179036ede
neuralmonkey/evaluators/beer.py
python
BeerWrapper.__init__
(self, wrapper: str, name: str = "BEER", encoding: str = "utf-8")
Initialize the BEER wrapper. Args: name: Name of the evaluator. wrapper: Path to the BEER's executable. encoding: Data encoding.
Initialize the BEER wrapper.
[ "Initialize", "the", "BEER", "wrapper", "." ]
def __init__(self, wrapper: str, name: str = "BEER", encoding: str = "utf-8") -> None: """Initialize the BEER wrapper. Args: name: Name of the evaluator. wrapper: Path to the BEER's executable. encoding: Data encodin...
[ "def", "__init__", "(", "self", ",", "wrapper", ":", "str", ",", "name", ":", "str", "=", "\"BEER\"", ",", "encoding", ":", "str", "=", "\"utf-8\"", ")", "->", "None", ":", "check_argument_types", "(", ")", "super", "(", ")", ".", "__init__", "(", "n...
https://github.com/ufal/neuralmonkey/blob/8b1465270f6bb28d5417a85cec492f7179036ede/neuralmonkey/evaluators/beer.py#L18-L32
biocore/qiime
76d633c0389671e93febbe1338b5ded658eba31f
qiime/normalize_table.py
python
multiple_file_normalize_DESeq2
(input_dir, output_dir, DESeq_negatives_to_zero)
performs DESeq2VS normalization on a directory of raw abundance OTU matrices
performs DESeq2VS normalization on a directory of raw abundance OTU matrices
[ "performs", "DESeq2VS", "normalization", "on", "a", "directory", "of", "raw", "abundance", "OTU", "matrices" ]
def multiple_file_normalize_DESeq2(input_dir, output_dir, DESeq_negatives_to_zero): """performs DESeq2VS normalization on a directory of raw abundance OTU matrices """ if not exists(output_dir): makedirs(output_dir) file_names = [fname for fname in listdir(input_dir) if not (fname.startswith('.'...
[ "def", "multiple_file_normalize_DESeq2", "(", "input_dir", ",", "output_dir", ",", "DESeq_negatives_to_zero", ")", ":", "if", "not", "exists", "(", "output_dir", ")", ":", "makedirs", "(", "output_dir", ")", "file_names", "=", "[", "fname", "for", "fname", "in",...
https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/normalize_table.py#L92-L112
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
external/linux32/lib/python2.6/site-packages/matplotlib/artist.py
python
Artist.get_children
(self)
return []
Return a list of the child :class:`Artist`s this :class:`Artist` contains.
Return a list of the child :class:`Artist`s this :class:`Artist` contains.
[ "Return", "a", "list", "of", "the", "child", ":", "class", ":", "Artist", "s", "this", ":", "class", ":", "Artist", "contains", "." ]
def get_children(self): """ Return a list of the child :class:`Artist`s this :class:`Artist` contains. """ return []
[ "def", "get_children", "(", "self", ")", ":", "return", "[", "]" ]
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/artist.py#L206-L211
microsoft/knack
d407b81d451d36c6ca1baeb3cd067a3f1275cb85
knack/invocation.py
python
CommandInvoker._rudimentary_get_command
(self, args)
return ' '.join(nouns)
Rudimentary parsing to get the command
Rudimentary parsing to get the command
[ "Rudimentary", "parsing", "to", "get", "the", "command" ]
def _rudimentary_get_command(self, args): """ Rudimentary parsing to get the command """ nouns = [] command_names = self.commands_loader.command_table.keys() for arg in args: if arg and arg[0] != '-': nouns.append(arg) else: break ...
[ "def", "_rudimentary_get_command", "(", "self", ",", "args", ")", ":", "nouns", "=", "[", "]", "command_names", "=", "self", ".", "commands_loader", ".", "command_table", ".", "keys", "(", ")", "for", "arg", "in", "args", ":", "if", "arg", "and", "arg", ...
https://github.com/microsoft/knack/blob/d407b81d451d36c6ca1baeb3cd067a3f1275cb85/knack/invocation.py#L67-L89