partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
AssetAttributes.compiler_extensions
The list of compiler extensions. Example:: >>> attrs = AssetAttributes(environment, 'js/lib/external.min.js.coffee') >>> attrs.compiler_extensions ['.coffee']
gears/asset_attributes.py
def compiler_extensions(self): """The list of compiler extensions. Example:: >>> attrs = AssetAttributes(environment, 'js/lib/external.min.js.coffee') >>> attrs.compiler_extensions ['.coffee'] """ try: index = self.extensions.index(self.fo...
def compiler_extensions(self): """The list of compiler extensions. Example:: >>> attrs = AssetAttributes(environment, 'js/lib/external.min.js.coffee') >>> attrs.compiler_extensions ['.coffee'] """ try: index = self.extensions.index(self.fo...
[ "The", "list", "of", "compiler", "extensions", ".", "Example", "::" ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L148-L161
[ "def", "compiler_extensions", "(", "self", ")", ":", "try", ":", "index", "=", "self", ".", "extensions", ".", "index", "(", "self", ".", "format_extension", ")", "except", "ValueError", ":", "index", "=", "0", "extensions", "=", "self", ".", "extensions",...
5729c2525a8c04c185e998bd9a86233708972921
test
AssetAttributes.compilers
The list of compilers used to build asset.
gears/asset_attributes.py
def compilers(self): """The list of compilers used to build asset.""" return [self.environment.compilers.get(e) for e in self.compiler_extensions]
def compilers(self): """The list of compilers used to build asset.""" return [self.environment.compilers.get(e) for e in self.compiler_extensions]
[ "The", "list", "of", "compilers", "used", "to", "build", "asset", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L164-L166
[ "def", "compilers", "(", "self", ")", ":", "return", "[", "self", ".", "environment", ".", "compilers", ".", "get", "(", "e", ")", "for", "e", "in", "self", ".", "compiler_extensions", "]" ]
5729c2525a8c04c185e998bd9a86233708972921
test
AssetAttributes.processors
The list of all processors (preprocessors, compilers, postprocessors) used to build asset.
gears/asset_attributes.py
def processors(self): """The list of all processors (preprocessors, compilers, postprocessors) used to build asset. """ return self.preprocessors + list(reversed(self.compilers)) + self.postprocessors
def processors(self): """The list of all processors (preprocessors, compilers, postprocessors) used to build asset. """ return self.preprocessors + list(reversed(self.compilers)) + self.postprocessors
[ "The", "list", "of", "all", "processors", "(", "preprocessors", "compilers", "postprocessors", ")", "used", "to", "build", "asset", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L179-L183
[ "def", "processors", "(", "self", ")", ":", "return", "self", ".", "preprocessors", "+", "list", "(", "reversed", "(", "self", ".", "compilers", ")", ")", "+", "self", ".", "postprocessors" ]
5729c2525a8c04c185e998bd9a86233708972921
test
AssetAttributes.mimetype
MIME type of the asset.
gears/asset_attributes.py
def mimetype(self): """MIME type of the asset.""" return (self.environment.mimetypes.get(self.format_extension) or self.compiler_mimetype or 'application/octet-stream')
def mimetype(self): """MIME type of the asset.""" return (self.environment.mimetypes.get(self.format_extension) or self.compiler_mimetype or 'application/octet-stream')
[ "MIME", "type", "of", "the", "asset", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L191-L194
[ "def", "mimetype", "(", "self", ")", ":", "return", "(", "self", ".", "environment", ".", "mimetypes", ".", "get", "(", "self", ".", "format_extension", ")", "or", "self", ".", "compiler_mimetype", "or", "'application/octet-stream'", ")" ]
5729c2525a8c04c185e998bd9a86233708972921
test
AssetAttributes.compiler_mimetype
Implicit MIME type of the asset by its compilers.
gears/asset_attributes.py
def compiler_mimetype(self): """Implicit MIME type of the asset by its compilers.""" for compiler in reversed(self.compilers): if compiler.result_mimetype: return compiler.result_mimetype return None
def compiler_mimetype(self): """Implicit MIME type of the asset by its compilers.""" for compiler in reversed(self.compilers): if compiler.result_mimetype: return compiler.result_mimetype return None
[ "Implicit", "MIME", "type", "of", "the", "asset", "by", "its", "compilers", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L197-L202
[ "def", "compiler_mimetype", "(", "self", ")", ":", "for", "compiler", "in", "reversed", "(", "self", ".", "compilers", ")", ":", "if", "compiler", ".", "result_mimetype", ":", "return", "compiler", ".", "result_mimetype", "return", "None" ]
5729c2525a8c04c185e998bd9a86233708972921
test
AssetAttributes.compiler_format_extension
Implicit format extension on the asset by its compilers.
gears/asset_attributes.py
def compiler_format_extension(self): """Implicit format extension on the asset by its compilers.""" for extension, mimetype in self.environment.mimetypes.items(): if mimetype == self.compiler_mimetype: return extension return None
def compiler_format_extension(self): """Implicit format extension on the asset by its compilers.""" for extension, mimetype in self.environment.mimetypes.items(): if mimetype == self.compiler_mimetype: return extension return None
[ "Implicit", "format", "extension", "on", "the", "asset", "by", "its", "compilers", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_attributes.py#L205-L210
[ "def", "compiler_format_extension", "(", "self", ")", ":", "for", "extension", ",", "mimetype", "in", "self", ".", "environment", ".", "mimetypes", ".", "items", "(", ")", ":", "if", "mimetype", "==", "self", ".", "compiler_mimetype", ":", "return", "extensi...
5729c2525a8c04c185e998bd9a86233708972921
test
Processors.register
Register passed `processor` for passed `mimetype`.
gears/environment.py
def register(self, mimetype, processor): """Register passed `processor` for passed `mimetype`.""" if mimetype not in self or processor not in self[mimetype]: self.setdefault(mimetype, []).append(processor)
def register(self, mimetype, processor): """Register passed `processor` for passed `mimetype`.""" if mimetype not in self or processor not in self[mimetype]: self.setdefault(mimetype, []).append(processor)
[ "Register", "passed", "processor", "for", "passed", "mimetype", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L99-L102
[ "def", "register", "(", "self", ",", "mimetype", ",", "processor", ")", ":", "if", "mimetype", "not", "in", "self", "or", "processor", "not", "in", "self", "[", "mimetype", "]", ":", "self", ".", "setdefault", "(", "mimetype", ",", "[", "]", ")", "."...
5729c2525a8c04c185e998bd9a86233708972921
test
Processors.unregister
Remove passed `processor` for passed `mimetype`. If processor for this MIME type does not found in the registry, nothing happens.
gears/environment.py
def unregister(self, mimetype, processor): """Remove passed `processor` for passed `mimetype`. If processor for this MIME type does not found in the registry, nothing happens. """ if mimetype in self and processor in self[mimetype]: self[mimetype].remove(processor)
def unregister(self, mimetype, processor): """Remove passed `processor` for passed `mimetype`. If processor for this MIME type does not found in the registry, nothing happens. """ if mimetype in self and processor in self[mimetype]: self[mimetype].remove(processor)
[ "Remove", "passed", "processor", "for", "passed", "mimetype", ".", "If", "processor", "for", "this", "MIME", "type", "does", "not", "found", "in", "the", "registry", "nothing", "happens", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L104-L109
[ "def", "unregister", "(", "self", ",", "mimetype", ",", "processor", ")", ":", "if", "mimetype", "in", "self", "and", "processor", "in", "self", "[", "mimetype", "]", ":", "self", "[", "mimetype", "]", ".", "remove", "(", "processor", ")" ]
5729c2525a8c04c185e998bd9a86233708972921
test
Preprocessors.register_defaults
Register :class:`~gears.processors.DirectivesProcessor` as a preprocessor for `text/css` and `application/javascript` MIME types.
gears/environment.py
def register_defaults(self): """Register :class:`~gears.processors.DirectivesProcessor` as a preprocessor for `text/css` and `application/javascript` MIME types. """ self.register('text/css', DirectivesProcessor.as_handler()) self.register('application/javascript', DirectivesProc...
def register_defaults(self): """Register :class:`~gears.processors.DirectivesProcessor` as a preprocessor for `text/css` and `application/javascript` MIME types. """ self.register('text/css', DirectivesProcessor.as_handler()) self.register('application/javascript', DirectivesProc...
[ "Register", ":", "class", ":", "~gears", ".", "processors", ".", "DirectivesProcessor", "as", "a", "preprocessor", "for", "text", "/", "css", "and", "application", "/", "javascript", "MIME", "types", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L126-L131
[ "def", "register_defaults", "(", "self", ")", ":", "self", ".", "register", "(", "'text/css'", ",", "DirectivesProcessor", ".", "as_handler", "(", ")", ")", "self", ".", "register", "(", "'application/javascript'", ",", "DirectivesProcessor", ".", "as_handler", ...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.suffixes
The registry for supported suffixes of assets. It is built from MIME types and compilers registries, and is cached at the first call. See :class:`~gears.environment.Suffixes` for more information.
gears/environment.py
def suffixes(self): """The registry for supported suffixes of assets. It is built from MIME types and compilers registries, and is cached at the first call. See :class:`~gears.environment.Suffixes` for more information. """ if not hasattr(self, '_suffixes'): suffixes ...
def suffixes(self): """The registry for supported suffixes of assets. It is built from MIME types and compilers registries, and is cached at the first call. See :class:`~gears.environment.Suffixes` for more information. """ if not hasattr(self, '_suffixes'): suffixes ...
[ "The", "registry", "for", "supported", "suffixes", "of", "assets", ".", "It", "is", "built", "from", "MIME", "types", "and", "compilers", "registries", "and", "is", "cached", "at", "the", "first", "call", ".", "See", ":", "class", ":", "~gears", ".", "en...
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L279-L291
[ "def", "suffixes", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_suffixes'", ")", ":", "suffixes", "=", "Suffixes", "(", ")", "for", "extension", ",", "mimetype", "in", "self", ".", "mimetypes", ".", "items", "(", ")", ":", "suf...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.paths
The list of search paths. It is built from registered finders, which has ``paths`` property. Can be useful for compilers to resolve internal dependencies.
gears/environment.py
def paths(self): """The list of search paths. It is built from registered finders, which has ``paths`` property. Can be useful for compilers to resolve internal dependencies. """ if not hasattr(self, '_paths'): paths = [] for finder in self.finders: ...
def paths(self): """The list of search paths. It is built from registered finders, which has ``paths`` property. Can be useful for compilers to resolve internal dependencies. """ if not hasattr(self, '_paths'): paths = [] for finder in self.finders: ...
[ "The", "list", "of", "search", "paths", ".", "It", "is", "built", "from", "registered", "finders", "which", "has", "paths", "property", ".", "Can", "be", "useful", "for", "compilers", "to", "resolve", "internal", "dependencies", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L294-L305
[ "def", "paths", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_paths'", ")", ":", "paths", "=", "[", "]", "for", "finder", "in", "self", ".", "finders", ":", "if", "hasattr", "(", "finder", ",", "'paths'", ")", ":", "paths", ...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.register_defaults
Register default compilers, preprocessors and MIME types.
gears/environment.py
def register_defaults(self): """Register default compilers, preprocessors and MIME types.""" self.mimetypes.register_defaults() self.preprocessors.register_defaults() self.postprocessors.register_defaults()
def register_defaults(self): """Register default compilers, preprocessors and MIME types.""" self.mimetypes.register_defaults() self.preprocessors.register_defaults() self.postprocessors.register_defaults()
[ "Register", "default", "compilers", "preprocessors", "and", "MIME", "types", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L307-L311
[ "def", "register_defaults", "(", "self", ")", ":", "self", ".", "mimetypes", ".", "register_defaults", "(", ")", "self", ".", "preprocessors", ".", "register_defaults", "(", ")", "self", ".", "postprocessors", ".", "register_defaults", "(", ")" ]
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.register_entry_points
Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with current environment during ``register_entry_points`` call:: entry_poin...
gears/environment.py
def register_entry_points(self, exclude=()): """Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with current environment during ...
def register_entry_points(self, exclude=()): """Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with current environment during ...
[ "Allow", "Gears", "plugins", "to", "inject", "themselves", "to", "the", "environment", ".", "For", "example", "if", "your", "plugin", "s", "package", "contains", "such", "entry_points", "definition", "in", "setup", ".", "py", "gears_plugin", ".", "register", "...
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L313-L340
[ "def", "register_entry_points", "(", "self", ",", "exclude", "=", "(", ")", ")", ":", "for", "entry_point", "in", "iter_entry_points", "(", "'gears'", ",", "'register'", ")", ":", "if", "entry_point", ".", "module_name", "not", "in", "exclude", ":", "registe...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.find
Find files using :attr:`finders` registry. The ``item`` parameter can be an instance of :class:`~gears.asset_attributes.AssetAttributes` class, a path to the asset or a logical path to the asset. If ``item`` is a logical path, `logical` parameter must be set to ``True``. Returns a tuple...
gears/environment.py
def find(self, item, logical=False): """Find files using :attr:`finders` registry. The ``item`` parameter can be an instance of :class:`~gears.asset_attributes.AssetAttributes` class, a path to the asset or a logical path to the asset. If ``item`` is a logical path, `logical` parameter m...
def find(self, item, logical=False): """Find files using :attr:`finders` registry. The ``item`` parameter can be an instance of :class:`~gears.asset_attributes.AssetAttributes` class, a path to the asset or a logical path to the asset. If ``item`` is a logical path, `logical` parameter m...
[ "Find", "files", "using", ":", "attr", ":", "finders", "registry", ".", "The", "item", "parameter", "can", "be", "an", "instance", "of", ":", "class", ":", "~gears", ".", "asset_attributes", ".", "AssetAttributes", "class", "a", "path", "to", "the", "asset...
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L342-L380
[ "def", "find", "(", "self", ",", "item", ",", "logical", "=", "False", ")", ":", "if", "isinstance", "(", "item", ",", "AssetAttributes", ")", ":", "for", "path", "in", "item", ".", "search_paths", ":", "try", ":", "return", "self", ".", "find", "(",...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.list
Yield two-tuples for all files found in the directory given by ``path`` parameter. Result can be filtered by the second parameter, ``mimetype``, that must be a MIME type of assets compiled source code. Each tuple has :class:`~gears.asset_attributes.AssetAttributes` instance for found fil...
gears/environment.py
def list(self, path, mimetype=None): """Yield two-tuples for all files found in the directory given by ``path`` parameter. Result can be filtered by the second parameter, ``mimetype``, that must be a MIME type of assets compiled source code. Each tuple has :class:`~gears.asset_attributes...
def list(self, path, mimetype=None): """Yield two-tuples for all files found in the directory given by ``path`` parameter. Result can be filtered by the second parameter, ``mimetype``, that must be a MIME type of assets compiled source code. Each tuple has :class:`~gears.asset_attributes...
[ "Yield", "two", "-", "tuples", "for", "all", "files", "found", "in", "the", "directory", "given", "by", "path", "parameter", ".", "Result", "can", "be", "filtered", "by", "the", "second", "parameter", "mimetype", "that", "must", "be", "a", "MIME", "type", ...
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L382-L417
[ "def", "list", "(", "self", ",", "path", ",", "mimetype", "=", "None", ")", ":", "basename_pattern", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "if", "path", ".", "endswith", "(", "'**'", ")", ":", "paths", "=", "[", "path", "]", ...
5729c2525a8c04c185e998bd9a86233708972921
test
Environment.save
Save handled public assets to :attr:`root` directory.
gears/environment.py
def save(self): """Save handled public assets to :attr:`root` directory.""" for asset_attributes, absolute_path in self.list('**'): logical_path = os.path.normpath(asset_attributes.logical_path) check_asset = build_asset(self, logical_path, check=True) if check_asset....
def save(self): """Save handled public assets to :attr:`root` directory.""" for asset_attributes, absolute_path in self.list('**'): logical_path = os.path.normpath(asset_attributes.logical_path) check_asset = build_asset(self, logical_path, check=True) if check_asset....
[ "Save", "handled", "public", "assets", "to", ":", "attr", ":", "root", "directory", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/environment.py#L424-L436
[ "def", "save", "(", "self", ")", ":", "for", "asset_attributes", ",", "absolute_path", "in", "self", ".", "list", "(", "'**'", ")", ":", "logical_path", "=", "os", ".", "path", ".", "normpath", "(", "asset_attributes", ".", "logical_path", ")", "check_asse...
5729c2525a8c04c185e998bd9a86233708972921
test
IdaSettingsEditor.PopulateForm
+-----------------------------------------------------------------------+ | +--- splitter ------------------------------------------------------+ | | | +-- list widget--------------+ +- IdaSettingsView -------------+ | | | | | | | | |...
ida_settings/ui/ida_settings_viewer.py
def PopulateForm(self): """ +-----------------------------------------------------------------------+ | +--- splitter ------------------------------------------------------+ | | | +-- list widget--------------+ +- IdaSettingsView -------------+ | | | | | ...
def PopulateForm(self): """ +-----------------------------------------------------------------------+ | +--- splitter ------------------------------------------------------+ | | | +-- list widget--------------+ +- IdaSettingsView -------------+ | | | | | ...
[ "+", "-----------------------------------------------------------------------", "+", "|", "+", "---", "splitter", "------------------------------------------------------", "+", "|", "|", "|", "+", "--", "list", "widget", "--------------", "+", "+", "-", "IdaSettingsView", "...
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ui/ida_settings_viewer.py#L19-L64
[ "def", "PopulateForm", "(", "self", ")", ":", "hbox", "=", "QtWidgets", ".", "QHBoxLayout", "(", "self", ".", "parent", ")", "self", ".", "_splitter", "=", "QtWidgets", ".", "QSplitter", "(", "QtCore", ".", "Qt", ".", "Horizontal", ")", "self", ".", "_...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
BaseAssetHandler.as_handler
Converts the class into an actual handler function that can be used when registering different types of processors in :class:`~gears.environment.Environment` class instance. The arguments passed to :meth:`as_handler` are forwarded to the constructor of the class.
gears/asset_handler.py
def as_handler(cls, **initkwargs): """Converts the class into an actual handler function that can be used when registering different types of processors in :class:`~gears.environment.Environment` class instance. The arguments passed to :meth:`as_handler` are forwarded to the con...
def as_handler(cls, **initkwargs): """Converts the class into an actual handler function that can be used when registering different types of processors in :class:`~gears.environment.Environment` class instance. The arguments passed to :meth:`as_handler` are forwarded to the con...
[ "Converts", "the", "class", "into", "an", "actual", "handler", "function", "that", "can", "be", "used", "when", "registering", "different", "types", "of", "processors", "in", ":", "class", ":", "~gears", ".", "environment", ".", "Environment", "class", "instan...
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_handler.py#L29-L42
[ "def", "as_handler", "(", "cls", ",", "*", "*", "initkwargs", ")", ":", "@", "wraps", "(", "cls", ",", "updated", "=", "(", ")", ")", "def", "handler", "(", "asset", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "handler", ".", ...
5729c2525a8c04c185e998bd9a86233708972921
test
ExecMixin.run
Runs :attr:`executable` with ``input`` as stdin. :class:`AssetHandlerError` exception is raised, if execution is failed, otherwise stdout is returned.
gears/asset_handler.py
def run(self, input): """Runs :attr:`executable` with ``input`` as stdin. :class:`AssetHandlerError` exception is raised, if execution is failed, otherwise stdout is returned. """ p = self.get_process() output, errors = p.communicate(input=input.encode('utf-8')) i...
def run(self, input): """Runs :attr:`executable` with ``input`` as stdin. :class:`AssetHandlerError` exception is raised, if execution is failed, otherwise stdout is returned. """ p = self.get_process() output, errors = p.communicate(input=input.encode('utf-8')) i...
[ "Runs", ":", "attr", ":", "executable", "with", "input", "as", "stdin", ".", ":", "class", ":", "AssetHandlerError", "exception", "is", "raised", "if", "execution", "is", "failed", "otherwise", "stdout", "is", "returned", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_handler.py#L55-L64
[ "def", "run", "(", "self", ",", "input", ")", ":", "p", "=", "self", ".", "get_process", "(", ")", "output", ",", "errors", "=", "p", ".", "communicate", "(", "input", "=", "input", ".", "encode", "(", "'utf-8'", ")", ")", "if", "p", ".", "return...
5729c2525a8c04c185e998bd9a86233708972921
test
ExecMixin.get_process
Returns :class:`subprocess.Popen` instance with args from :meth:`get_args` result and piped stdin, stdout and stderr.
gears/asset_handler.py
def get_process(self): """Returns :class:`subprocess.Popen` instance with args from :meth:`get_args` result and piped stdin, stdout and stderr. """ return Popen(self.get_args(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
def get_process(self): """Returns :class:`subprocess.Popen` instance with args from :meth:`get_args` result and piped stdin, stdout and stderr. """ return Popen(self.get_args(), stdin=PIPE, stdout=PIPE, stderr=PIPE)
[ "Returns", ":", "class", ":", "subprocess", ".", "Popen", "instance", "with", "args", "from", ":", "meth", ":", "get_args", "result", "and", "piped", "stdin", "stdout", "and", "stderr", "." ]
gears/gears
python
https://github.com/gears/gears/blob/5729c2525a8c04c185e998bd9a86233708972921/gears/asset_handler.py#L66-L70
[ "def", "get_process", "(", "self", ")", ":", "return", "Popen", "(", "self", ".", "get_args", "(", ")", ",", "stdin", "=", "PIPE", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")" ]
5729c2525a8c04c185e998bd9a86233708972921
test
import_qtcore
This nasty piece of code is here to force the loading of IDA's Qt bindings. Without it, Python attempts to load PySide from the site-packages directory, and failing, as it does not play nicely with IDA. via: github.com/tmr232/Cute
ida_settings/ida_settings.py
def import_qtcore(): """ This nasty piece of code is here to force the loading of IDA's Qt bindings. Without it, Python attempts to load PySide from the site-packages directory, and failing, as it does not play nicely with IDA. via: github.com/tmr232/Cute """ has_ida = False try: ...
def import_qtcore(): """ This nasty piece of code is here to force the loading of IDA's Qt bindings. Without it, Python attempts to load PySide from the site-packages directory, and failing, as it does not play nicely with IDA. via: github.com/tmr232/Cute """ has_ida = False try: ...
[ "This", "nasty", "piece", "of", "code", "is", "here", "to", "force", "the", "loading", "of", "IDA", "s", "Qt", "bindings", ".", "Without", "it", "Python", "attempts", "to", "load", "PySide", "from", "the", "site", "-", "packages", "directory", "and", "fa...
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L116-L162
[ "def", "import_qtcore", "(", ")", ":", "has_ida", "=", "False", "try", ":", "# if we're running under IDA,", "# then we'll use IDA's Qt bindings", "import", "idaapi", "has_ida", "=", "True", "except", "ImportError", ":", "# not running under IDA,", "# so use default Qt inst...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
get_meta_netnode
Get the netnode used to store settings metadata in the current IDB. Note that this implicitly uses the open IDB via the idc iterface.
ida_settings/ida_settings.py
def get_meta_netnode(): """ Get the netnode used to store settings metadata in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ node_name = "$ {org:s}.{application:s}".format( org=IDA_SETTINGS_ORGANIZATION, application=IDA_SETTINGS_APPLICATION) ...
def get_meta_netnode(): """ Get the netnode used to store settings metadata in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ node_name = "$ {org:s}.{application:s}".format( org=IDA_SETTINGS_ORGANIZATION, application=IDA_SETTINGS_APPLICATION) ...
[ "Get", "the", "netnode", "used", "to", "store", "settings", "metadata", "in", "the", "current", "IDB", ".", "Note", "that", "this", "implicitly", "uses", "the", "open", "IDB", "via", "the", "idc", "iterface", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L460-L468
[ "def", "get_meta_netnode", "(", ")", ":", "node_name", "=", "\"$ {org:s}.{application:s}\"", ".", "format", "(", "org", "=", "IDA_SETTINGS_ORGANIZATION", ",", "application", "=", "IDA_SETTINGS_APPLICATION", ")", "return", "netnode", ".", "Netnode", "(", "node_name", ...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
add_netnode_plugin_name
Add the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface.
ida_settings/ida_settings.py
def add_netnode_plugin_name(plugin_name): """ Add the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ current_names = set(get_netnode_plugin_names()) if plugin_name in current_names: ...
def add_netnode_plugin_name(plugin_name): """ Add the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ current_names = set(get_netnode_plugin_names()) if plugin_name in current_names: ...
[ "Add", "the", "given", "plugin", "name", "to", "the", "list", "of", "plugin", "names", "registered", "in", "the", "current", "IDB", ".", "Note", "that", "this", "implicitly", "uses", "the", "open", "IDB", "via", "the", "idc", "iterface", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L486-L498
[ "def", "add_netnode_plugin_name", "(", "plugin_name", ")", ":", "current_names", "=", "set", "(", "get_netnode_plugin_names", "(", ")", ")", "if", "plugin_name", "in", "current_names", ":", "return", "current_names", ".", "add", "(", "plugin_name", ")", "get_meta_...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
del_netnode_plugin_name
Remove the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface.
ida_settings/ida_settings.py
def del_netnode_plugin_name(plugin_name): """ Remove the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ current_names = set(get_netnode_plugin_names()) if plugin_name not in current_names: ...
def del_netnode_plugin_name(plugin_name): """ Remove the given plugin name to the list of plugin names registered in the current IDB. Note that this implicitly uses the open IDB via the idc iterface. """ current_names = set(get_netnode_plugin_names()) if plugin_name not in current_names: ...
[ "Remove", "the", "given", "plugin", "name", "to", "the", "list", "of", "plugin", "names", "registered", "in", "the", "current", "IDB", ".", "Note", "that", "this", "implicitly", "uses", "the", "open", "IDB", "via", "the", "idc", "iterface", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L501-L516
[ "def", "del_netnode_plugin_name", "(", "plugin_name", ")", ":", "current_names", "=", "set", "(", "get_netnode_plugin_names", "(", ")", ")", "if", "plugin_name", "not", "in", "current_names", ":", "return", "try", ":", "current_names", ".", "remove", "(", "plugi...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
import_settings
Import settings from the given file system path to given settings instance. type settings: IDASettingsInterface type config_path: str
ida_settings/ida_settings.py
def import_settings(settings, config_path): """ Import settings from the given file system path to given settings instance. type settings: IDASettingsInterface type config_path: str """ other = QtCore.QSettings(config_path, QtCore.QSettings.IniFormat) for k in other.allKeys(): setti...
def import_settings(settings, config_path): """ Import settings from the given file system path to given settings instance. type settings: IDASettingsInterface type config_path: str """ other = QtCore.QSettings(config_path, QtCore.QSettings.IniFormat) for k in other.allKeys(): setti...
[ "Import", "settings", "from", "the", "given", "file", "system", "path", "to", "given", "settings", "instance", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L823-L832
[ "def", "import_settings", "(", "settings", ",", "config_path", ")", ":", "other", "=", "QtCore", ".", "QSettings", "(", "config_path", ",", "QtCore", ".", "QSettings", ".", "IniFormat", ")", "for", "k", "in", "other", ".", "allKeys", "(", ")", ":", "sett...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
export_settings
Export the given settings instance to the given file system path. type settings: IDASettingsInterface type config_path: str
ida_settings/ida_settings.py
def export_settings(settings, config_path): """ Export the given settings instance to the given file system path. type settings: IDASettingsInterface type config_path: str """ other = QtCore.QSettings(config_path, QtCore.QSettings.IniFormat) for k, v in settings.iteritems(): other.s...
def export_settings(settings, config_path): """ Export the given settings instance to the given file system path. type settings: IDASettingsInterface type config_path: str """ other = QtCore.QSettings(config_path, QtCore.QSettings.IniFormat) for k, v in settings.iteritems(): other.s...
[ "Export", "the", "given", "settings", "instance", "to", "the", "given", "file", "system", "path", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L835-L844
[ "def", "export_settings", "(", "settings", ",", "config_path", ")", ":", "other", "=", "QtCore", ".", "QSettings", "(", "config_path", ",", "QtCore", ".", "QSettings", ".", "IniFormat", ")", "for", "k", ",", "v", "in", "settings", ".", "iteritems", "(", ...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
IDASettings.directory
Fetch the IDASettings instance for the curren plugin with directory scope. rtype: IDASettingsInterface
ida_settings/ida_settings.py
def directory(self): """ Fetch the IDASettings instance for the curren plugin with directory scope. rtype: IDASettingsInterface """ if self._config_directory is None: ensure_ida_loaded() return DirectoryIDASettings(self._plugin_name, directory=self._config_di...
def directory(self): """ Fetch the IDASettings instance for the curren plugin with directory scope. rtype: IDASettingsInterface """ if self._config_directory is None: ensure_ida_loaded() return DirectoryIDASettings(self._plugin_name, directory=self._config_di...
[ "Fetch", "the", "IDASettings", "instance", "for", "the", "curren", "plugin", "with", "directory", "scope", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L599-L607
[ "def", "directory", "(", "self", ")", ":", "if", "self", ".", "_config_directory", "is", "None", ":", "ensure_ida_loaded", "(", ")", "return", "DirectoryIDASettings", "(", "self", ".", "_plugin_name", ",", "directory", "=", "self", ".", "_config_directory", ")...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
IDASettings.get_value
Fetch the settings value with the highest precedence for the given key, or raise KeyError. Precedence: - IDB scope - directory scope - user scope - system scope type key: basestring rtype value: Union[basestring, int, float, List, Dict]
ida_settings/ida_settings.py
def get_value(self, key): """ Fetch the settings value with the highest precedence for the given key, or raise KeyError. Precedence: - IDB scope - directory scope - user scope - system scope type key: basestring rtype value: Union...
def get_value(self, key): """ Fetch the settings value with the highest precedence for the given key, or raise KeyError. Precedence: - IDB scope - directory scope - user scope - system scope type key: basestring rtype value: Union...
[ "Fetch", "the", "settings", "value", "with", "the", "highest", "precedence", "for", "the", "given", "key", "or", "raise", "KeyError", ".", "Precedence", ":", "-", "IDB", "scope", "-", "directory", "scope", "-", "user", "scope", "-", "system", "scope" ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L627-L657
[ "def", "get_value", "(", "self", ",", "key", ")", ":", "try", ":", "return", "self", ".", "idb", ".", "get_value", "(", "key", ")", "except", "(", "KeyError", ",", "EnvironmentError", ")", ":", "pass", "try", ":", "return", "self", ".", "directory", ...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
IDASettings.iterkeys
Enumerate the keys found at any scope for the current plugin. rtype: Generator[str]
ida_settings/ida_settings.py
def iterkeys(self): """ Enumerate the keys found at any scope for the current plugin. rtype: Generator[str] """ visited_keys = set() try: for key in self.idb.iterkeys(): if key not in visited_keys: yield key ...
def iterkeys(self): """ Enumerate the keys found at any scope for the current plugin. rtype: Generator[str] """ visited_keys = set() try: for key in self.idb.iterkeys(): if key not in visited_keys: yield key ...
[ "Enumerate", "the", "keys", "found", "at", "any", "scope", "for", "the", "current", "plugin", "." ]
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L659-L696
[ "def", "iterkeys", "(", "self", ")", ":", "visited_keys", "=", "set", "(", ")", "try", ":", "for", "key", "in", "self", ".", "idb", ".", "iterkeys", "(", ")", ":", "if", "key", "not", "in", "visited_keys", ":", "yield", "key", "visited_keys", ".", ...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
IDASettings.get_directory_plugin_names
Get the names of all plugins at the directory scope. Provide a config directory path to use this method outside of IDA. As this is a static method, you can call the directly on IDASettings: import ida_settings print( ida_settings.IDASettings.get_directory_plugin_names("/tmp/ida/...
ida_settings/ida_settings.py
def get_directory_plugin_names(config_directory=None): """ Get the names of all plugins at the directory scope. Provide a config directory path to use this method outside of IDA. As this is a static method, you can call the directly on IDASettings: import ida_settings ...
def get_directory_plugin_names(config_directory=None): """ Get the names of all plugins at the directory scope. Provide a config directory path to use this method outside of IDA. As this is a static method, you can call the directly on IDASettings: import ida_settings ...
[ "Get", "the", "names", "of", "all", "plugins", "at", "the", "directory", "scope", ".", "Provide", "a", "config", "directory", "path", "to", "use", "this", "method", "outside", "of", "IDA", ".", "As", "this", "is", "a", "static", "method", "you", "can", ...
williballenthin/ida-settings
python
https://github.com/williballenthin/ida-settings/blob/ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e/ida_settings/ida_settings.py#L791-L805
[ "def", "get_directory_plugin_names", "(", "config_directory", "=", "None", ")", ":", "ensure_ida_loaded", "(", ")", "return", "QtCore", ".", "QSettings", "(", "get_directory_config_path", "(", "directory", "=", "config_directory", ")", ",", "QtCore", ".", "QSettings...
ddfeab5bd0b6f6f177d0d50f8078c585602b1d9e
test
simple_error_handler
Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's builtin `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a 500 error to be raised.
rest_framework_custom_exceptions/exceptions.py
def simple_error_handler(exc, *args): """ Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's builtin `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a ...
def simple_error_handler(exc, *args): """ Returns the response that should be used for any given exception. By default we handle the REST framework `APIException`, and also Django's builtin `Http404` and `PermissionDenied` exceptions. Any unhandled exceptions may return `None`, which will cause a ...
[ "Returns", "the", "response", "that", "should", "be", "used", "for", "any", "given", "exception", "." ]
unistra/django-rest-framework-custom-exceptions
python
https://github.com/unistra/django-rest-framework-custom-exceptions/blob/b0fdd5c64146c4f25fb893bc84c58d7774ccb5ef/rest_framework_custom_exceptions/exceptions.py#L9-L39
[ "def", "simple_error_handler", "(", "exc", ",", "*", "args", ")", ":", "if", "isinstance", "(", "exc", ",", "exceptions", ".", "APIException", ")", ":", "headers", "=", "{", "}", "if", "getattr", "(", "exc", ",", "'auth_header'", ",", "None", ")", ":",...
b0fdd5c64146c4f25fb893bc84c58d7774ccb5ef
test
table
Returns a given table for the given user.
dynamo.py
def table(name, auth=None, eager=True): """Returns a given table for the given user.""" auth = auth or [] dynamodb = boto.connect_dynamodb(*auth) table = dynamodb.get_table(name) return Table(table=table, eager=eager)
def table(name, auth=None, eager=True): """Returns a given table for the given user.""" auth = auth or [] dynamodb = boto.connect_dynamodb(*auth) table = dynamodb.get_table(name) return Table(table=table, eager=eager)
[ "Returns", "a", "given", "table", "for", "the", "given", "user", "." ]
kenneth-reitz/dynamo
python
https://github.com/kenneth-reitz/dynamo/blob/e24276a7e68d868857fd1d0deabccd001920e0c2/dynamo.py#L113-L119
[ "def", "table", "(", "name", ",", "auth", "=", "None", ",", "eager", "=", "True", ")", ":", "auth", "=", "auth", "or", "[", "]", "dynamodb", "=", "boto", ".", "connect_dynamodb", "(", "*", "auth", ")", "table", "=", "dynamodb", ".", "get_table", "(...
e24276a7e68d868857fd1d0deabccd001920e0c2
test
tables
Returns a list of tables for the given user.
dynamo.py
def tables(auth=None, eager=True): """Returns a list of tables for the given user.""" auth = auth or [] dynamodb = boto.connect_dynamodb(*auth) return [table(t, auth, eager=eager) for t in dynamodb.list_tables()]
def tables(auth=None, eager=True): """Returns a list of tables for the given user.""" auth = auth or [] dynamodb = boto.connect_dynamodb(*auth) return [table(t, auth, eager=eager) for t in dynamodb.list_tables()]
[ "Returns", "a", "list", "of", "tables", "for", "the", "given", "user", "." ]
kenneth-reitz/dynamo
python
https://github.com/kenneth-reitz/dynamo/blob/e24276a7e68d868857fd1d0deabccd001920e0c2/dynamo.py#L122-L127
[ "def", "tables", "(", "auth", "=", "None", ",", "eager", "=", "True", ")", ":", "auth", "=", "auth", "or", "[", "]", "dynamodb", "=", "boto", ".", "connect_dynamodb", "(", "*", "auth", ")", "return", "[", "table", "(", "t", ",", "auth", ",", "eag...
e24276a7e68d868857fd1d0deabccd001920e0c2
test
Crates.fetch_items
Fetch packages and summary from Crates.io :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
perceval/backends/mozilla/crates.py
def fetch_items(self, category, **kwargs): """Fetch packages and summary from Crates.io :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ from_date = kwargs['from_date'] if category == CATEGORY_C...
def fetch_items(self, category, **kwargs): """Fetch packages and summary from Crates.io :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ from_date = kwargs['from_date'] if category == CATEGORY_C...
[ "Fetch", "packages", "and", "summary", "from", "Crates", ".", "io" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L91-L104
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "from_date", "=", "kwargs", "[", "'from_date'", "]", "if", "category", "==", "CATEGORY_CRATES", ":", "return", "self", ".", "__fetch_crates", "(", "from_date", ")", "els...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.metadata_id
Extracts the identifier from an item depending on its type.
perceval/backends/mozilla/crates.py
def metadata_id(item): """Extracts the identifier from an item depending on its type.""" if Crates.metadata_category(item) == CATEGORY_CRATES: return str(item['id']) else: ts = item['fetched_on'] ts = str_to_datetime(ts) return str(ts.timestamp())
def metadata_id(item): """Extracts the identifier from an item depending on its type.""" if Crates.metadata_category(item) == CATEGORY_CRATES: return str(item['id']) else: ts = item['fetched_on'] ts = str_to_datetime(ts) return str(ts.timestamp())
[ "Extracts", "the", "identifier", "from", "an", "item", "depending", "on", "its", "type", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L123-L131
[ "def", "metadata_id", "(", "item", ")", ":", "if", "Crates", ".", "metadata_category", "(", "item", ")", "==", "CATEGORY_CRATES", ":", "return", "str", "(", "item", "[", "'id'", "]", ")", "else", ":", "ts", "=", "item", "[", "'fetched_on'", "]", "ts", ...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.metadata_updated_on
Extracts the update time from an item. Depending on the item, the timestamp is extracted from the 'updated_at' or 'fetched_on' fields. This date is converted to UNIX timestamp format. :param item: item generated by the backend :returns: a UNIX timestamp
perceval/backends/mozilla/crates.py
def metadata_updated_on(item): """Extracts the update time from an item. Depending on the item, the timestamp is extracted from the 'updated_at' or 'fetched_on' fields. This date is converted to UNIX timestamp format. :param item: item generated by the backend :returns...
def metadata_updated_on(item): """Extracts the update time from an item. Depending on the item, the timestamp is extracted from the 'updated_at' or 'fetched_on' fields. This date is converted to UNIX timestamp format. :param item: item generated by the backend :returns...
[ "Extracts", "the", "update", "time", "from", "an", "item", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L134-L152
[ "def", "metadata_updated_on", "(", "item", ")", ":", "if", "Crates", ".", "metadata_category", "(", "item", ")", "==", "CATEGORY_CRATES", ":", "ts", "=", "item", "[", "'updated_at'", "]", "else", ":", "ts", "=", "item", "[", "'fetched_on'", "]", "ts", "=...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates._init_client
Init client
perceval/backends/mozilla/crates.py
def _init_client(self, from_archive=False): """Init client""" return CratesClient(self.sleep_time, self.archive, from_archive)
def _init_client(self, from_archive=False): """Init client""" return CratesClient(self.sleep_time, self.archive, from_archive)
[ "Init", "client" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L165-L168
[ "def", "_init_client", "(", "self", ",", "from_archive", "=", "False", ")", ":", "return", "CratesClient", "(", "self", ".", "sleep_time", ",", "self", ".", "archive", ",", "from_archive", ")" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_summary
Fetch summary
perceval/backends/mozilla/crates.py
def __fetch_summary(self): """Fetch summary""" raw_summary = self.client.summary() summary = json.loads(raw_summary) summary['fetched_on'] = str(datetime_utcnow()) yield summary
def __fetch_summary(self): """Fetch summary""" raw_summary = self.client.summary() summary = json.loads(raw_summary) summary['fetched_on'] = str(datetime_utcnow()) yield summary
[ "Fetch", "summary" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L170-L177
[ "def", "__fetch_summary", "(", "self", ")", ":", "raw_summary", "=", "self", ".", "client", ".", "summary", "(", ")", "summary", "=", "json", ".", "loads", "(", "raw_summary", ")", "summary", "[", "'fetched_on'", "]", "=", "str", "(", "datetime_utcnow", ...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crates
Fetch crates
perceval/backends/mozilla/crates.py
def __fetch_crates(self, from_date): """Fetch crates""" from_date = datetime_to_utc(from_date) crates_groups = self.client.crates() for raw_crates in crates_groups: crates = json.loads(raw_crates) for crate_container in crates['crates']: if st...
def __fetch_crates(self, from_date): """Fetch crates""" from_date = datetime_to_utc(from_date) crates_groups = self.client.crates() for raw_crates in crates_groups: crates = json.loads(raw_crates) for crate_container in crates['crates']: if st...
[ "Fetch", "crates" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L179-L202
[ "def", "__fetch_crates", "(", "self", ",", "from_date", ")", ":", "from_date", "=", "datetime_to_utc", "(", "from_date", ")", "crates_groups", "=", "self", ".", "client", ".", "crates", "(", ")", "for", "raw_crates", "in", "crates_groups", ":", "crates", "="...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crate_owner_team
Get crate team owner
perceval/backends/mozilla/crates.py
def __fetch_crate_owner_team(self, crate_id): """Get crate team owner""" raw_owner_team = self.client.crate_attribute(crate_id, 'owner_team') owner_team = json.loads(raw_owner_team) return owner_team
def __fetch_crate_owner_team(self, crate_id): """Get crate team owner""" raw_owner_team = self.client.crate_attribute(crate_id, 'owner_team') owner_team = json.loads(raw_owner_team) return owner_team
[ "Get", "crate", "team", "owner" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L204-L211
[ "def", "__fetch_crate_owner_team", "(", "self", ",", "crate_id", ")", ":", "raw_owner_team", "=", "self", ".", "client", ".", "crate_attribute", "(", "crate_id", ",", "'owner_team'", ")", "owner_team", "=", "json", ".", "loads", "(", "raw_owner_team", ")", "re...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crate_owner_user
Get crate user owners
perceval/backends/mozilla/crates.py
def __fetch_crate_owner_user(self, crate_id): """Get crate user owners""" raw_owner_user = self.client.crate_attribute(crate_id, 'owner_user') owner_user = json.loads(raw_owner_user) return owner_user
def __fetch_crate_owner_user(self, crate_id): """Get crate user owners""" raw_owner_user = self.client.crate_attribute(crate_id, 'owner_user') owner_user = json.loads(raw_owner_user) return owner_user
[ "Get", "crate", "user", "owners" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L213-L220
[ "def", "__fetch_crate_owner_user", "(", "self", ",", "crate_id", ")", ":", "raw_owner_user", "=", "self", ".", "client", ".", "crate_attribute", "(", "crate_id", ",", "'owner_user'", ")", "owner_user", "=", "json", ".", "loads", "(", "raw_owner_user", ")", "re...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crate_versions
Get crate versions data
perceval/backends/mozilla/crates.py
def __fetch_crate_versions(self, crate_id): """Get crate versions data""" raw_versions = self.client.crate_attribute(crate_id, "versions") version_downloads = json.loads(raw_versions) return version_downloads
def __fetch_crate_versions(self, crate_id): """Get crate versions data""" raw_versions = self.client.crate_attribute(crate_id, "versions") version_downloads = json.loads(raw_versions) return version_downloads
[ "Get", "crate", "versions", "data" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L222-L229
[ "def", "__fetch_crate_versions", "(", "self", ",", "crate_id", ")", ":", "raw_versions", "=", "self", ".", "client", ".", "crate_attribute", "(", "crate_id", ",", "\"versions\"", ")", "version_downloads", "=", "json", ".", "loads", "(", "raw_versions", ")", "r...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crate_version_downloads
Get crate version downloads
perceval/backends/mozilla/crates.py
def __fetch_crate_version_downloads(self, crate_id): """Get crate version downloads""" raw_version_downloads = self.client.crate_attribute(crate_id, "downloads") version_downloads = json.loads(raw_version_downloads) return version_downloads
def __fetch_crate_version_downloads(self, crate_id): """Get crate version downloads""" raw_version_downloads = self.client.crate_attribute(crate_id, "downloads") version_downloads = json.loads(raw_version_downloads) return version_downloads
[ "Get", "crate", "version", "downloads" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L231-L238
[ "def", "__fetch_crate_version_downloads", "(", "self", ",", "crate_id", ")", ":", "raw_version_downloads", "=", "self", ".", "client", ".", "crate_attribute", "(", "crate_id", ",", "\"downloads\"", ")", "version_downloads", "=", "json", ".", "loads", "(", "raw_ver...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Crates.__fetch_crate_data
Get crate data
perceval/backends/mozilla/crates.py
def __fetch_crate_data(self, crate_id): """Get crate data""" raw_crate = self.client.crate(crate_id) crate = json.loads(raw_crate) return crate['crate']
def __fetch_crate_data(self, crate_id): """Get crate data""" raw_crate = self.client.crate(crate_id) crate = json.loads(raw_crate) return crate['crate']
[ "Get", "crate", "data" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L240-L246
[ "def", "__fetch_crate_data", "(", "self", ",", "crate_id", ")", ":", "raw_crate", "=", "self", ".", "client", ".", "crate", "(", "crate_id", ")", "crate", "=", "json", ".", "loads", "(", "raw_crate", ")", "return", "crate", "[", "'crate'", "]" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.summary
Get Crates.io summary
perceval/backends/mozilla/crates.py
def summary(self): """Get Crates.io summary""" path = urijoin(CRATES_API_URL, CATEGORY_SUMMARY) raw_content = self.fetch(path) return raw_content
def summary(self): """Get Crates.io summary""" path = urijoin(CRATES_API_URL, CATEGORY_SUMMARY) raw_content = self.fetch(path) return raw_content
[ "Get", "Crates", ".", "io", "summary" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L267-L273
[ "def", "summary", "(", "self", ")", ":", "path", "=", "urijoin", "(", "CRATES_API_URL", ",", "CATEGORY_SUMMARY", ")", "raw_content", "=", "self", ".", "fetch", "(", "path", ")", "return", "raw_content" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.crates
Get crates in alphabetical order
perceval/backends/mozilla/crates.py
def crates(self, from_page=1): """Get crates in alphabetical order""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES) raw_crates = self.__fetch_items(path, from_page) return raw_crates
def crates(self, from_page=1): """Get crates in alphabetical order""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES) raw_crates = self.__fetch_items(path, from_page) return raw_crates
[ "Get", "crates", "in", "alphabetical", "order" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L275-L281
[ "def", "crates", "(", "self", ",", "from_page", "=", "1", ")", ":", "path", "=", "urijoin", "(", "CRATES_API_URL", ",", "CATEGORY_CRATES", ")", "raw_crates", "=", "self", ".", "__fetch_items", "(", "path", ",", "from_page", ")", "return", "raw_crates" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.crate
Get a crate by its ID
perceval/backends/mozilla/crates.py
def crate(self, crate_id): """Get a crate by its ID""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES, crate_id) raw_crate = self.fetch(path) return raw_crate
def crate(self, crate_id): """Get a crate by its ID""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES, crate_id) raw_crate = self.fetch(path) return raw_crate
[ "Get", "a", "crate", "by", "its", "ID" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L283-L289
[ "def", "crate", "(", "self", ",", "crate_id", ")", ":", "path", "=", "urijoin", "(", "CRATES_API_URL", ",", "CATEGORY_CRATES", ",", "crate_id", ")", "raw_crate", "=", "self", ".", "fetch", "(", "path", ")", "return", "raw_crate" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.crate_attribute
Get crate attribute
perceval/backends/mozilla/crates.py
def crate_attribute(self, crate_id, attribute): """Get crate attribute""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES, crate_id, attribute) raw_attribute_data = self.fetch(path) return raw_attribute_data
def crate_attribute(self, crate_id, attribute): """Get crate attribute""" path = urijoin(CRATES_API_URL, CATEGORY_CRATES, crate_id, attribute) raw_attribute_data = self.fetch(path) return raw_attribute_data
[ "Get", "crate", "attribute" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L291-L297
[ "def", "crate_attribute", "(", "self", ",", "crate_id", ",", "attribute", ")", ":", "path", "=", "urijoin", "(", "CRATES_API_URL", ",", "CATEGORY_CRATES", ",", "crate_id", ",", "attribute", ")", "raw_attribute_data", "=", "self", ".", "fetch", "(", "path", "...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.__fetch_items
Return the items from Crates.io API using pagination
perceval/backends/mozilla/crates.py
def __fetch_items(self, path, page=1): """Return the items from Crates.io API using pagination""" fetch_data = True parsed_crates = 0 total_crates = 0 while fetch_data: logger.debug("Fetching page: %i", page) try: payload = {'sort': 'alp...
def __fetch_items(self, path, page=1): """Return the items from Crates.io API using pagination""" fetch_data = True parsed_crates = 0 total_crates = 0 while fetch_data: logger.debug("Fetching page: %i", page) try: payload = {'sort': 'alp...
[ "Return", "the", "items", "from", "Crates", ".", "io", "API", "using", "pagination" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L299-L327
[ "def", "__fetch_items", "(", "self", ",", "path", ",", "page", "=", "1", ")", ":", "fetch_data", "=", "True", "parsed_crates", "=", "0", "total_crates", "=", "0", "while", "fetch_data", ":", "logger", ".", "debug", "(", "\"Fetching page: %i\"", ",", "page"...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
CratesClient.fetch
Return the textual content associated to the Response object
perceval/backends/mozilla/crates.py
def fetch(self, url, payload=None): """Return the textual content associated to the Response object""" response = super().fetch(url, payload=payload) return response.text
def fetch(self, url, payload=None): """Return the textual content associated to the Response object""" response = super().fetch(url, payload=payload) return response.text
[ "Return", "the", "textual", "content", "associated", "to", "the", "Response", "object" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L329-L334
[ "def", "fetch", "(", "self", ",", "url", ",", "payload", "=", "None", ")", ":", "response", "=", "super", "(", ")", ".", "fetch", "(", "url", ",", "payload", "=", "payload", ")", "return", "response", ".", "text" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Kitsune.fetch
Fetch questions from the Kitsune url. :param category: the category of items to fetch :offset: obtain questions after offset :returns: a generator of questions
perceval/backends/mozilla/kitsune.py
def fetch(self, category=CATEGORY_QUESTION, offset=DEFAULT_OFFSET): """Fetch questions from the Kitsune url. :param category: the category of items to fetch :offset: obtain questions after offset :returns: a generator of questions """ if not offset: offset = ...
def fetch(self, category=CATEGORY_QUESTION, offset=DEFAULT_OFFSET): """Fetch questions from the Kitsune url. :param category: the category of items to fetch :offset: obtain questions after offset :returns: a generator of questions """ if not offset: offset = ...
[ "Fetch", "questions", "from", "the", "Kitsune", "url", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L74-L87
[ "def", "fetch", "(", "self", ",", "category", "=", "CATEGORY_QUESTION", ",", "offset", "=", "DEFAULT_OFFSET", ")", ":", "if", "not", "offset", ":", "offset", "=", "DEFAULT_OFFSET", "kwargs", "=", "{", "\"offset\"", ":", "offset", "}", "items", "=", "super"...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Kitsune.fetch_items
Fetch questions from the Kitsune url :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
perceval/backends/mozilla/kitsune.py
def fetch_items(self, category, **kwargs): """Fetch questions from the Kitsune url :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ offset = kwargs['offset'] logger.info("Looking for questions a...
def fetch_items(self, category, **kwargs): """Fetch questions from the Kitsune url :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ offset = kwargs['offset'] logger.info("Looking for questions a...
[ "Fetch", "questions", "from", "the", "Kitsune", "url" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L89-L162
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "offset", "=", "kwargs", "[", "'offset'", "]", "logger", ".", "info", "(", "\"Looking for questions at url '%s' using offset %s\"", ",", "self", ".", "url", ",", "str", "(...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
Kitsune._init_client
Init client
perceval/backends/mozilla/kitsune.py
def _init_client(self, from_archive=False): """Init client""" return KitsuneClient(self.url, self.archive, from_archive)
def _init_client(self, from_archive=False): """Init client""" return KitsuneClient(self.url, self.archive, from_archive)
[ "Init", "client" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L223-L226
[ "def", "_init_client", "(", "self", ",", "from_archive", "=", "False", ")", ":", "return", "KitsuneClient", "(", "self", ".", "url", ",", "self", ".", "archive", ",", "from_archive", ")" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
KitsuneClient.get_questions
Retrieve questions from older to newer updated starting offset
perceval/backends/mozilla/kitsune.py
def get_questions(self, offset=None): """Retrieve questions from older to newer updated starting offset""" page = KitsuneClient.FIRST_PAGE if offset: page += int(offset / KitsuneClient.ITEMS_PER_PAGE) while True: api_questions_url = urijoin(self.base_url, '/que...
def get_questions(self, offset=None): """Retrieve questions from older to newer updated starting offset""" page = KitsuneClient.FIRST_PAGE if offset: page += int(offset / KitsuneClient.ITEMS_PER_PAGE) while True: api_questions_url = urijoin(self.base_url, '/que...
[ "Retrieve", "questions", "from", "older", "to", "newer", "updated", "starting", "offset" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L247-L270
[ "def", "get_questions", "(", "self", ",", "offset", "=", "None", ")", ":", "page", "=", "KitsuneClient", ".", "FIRST_PAGE", "if", "offset", ":", "page", "+=", "int", "(", "offset", "/", "KitsuneClient", ".", "ITEMS_PER_PAGE", ")", "while", "True", ":", "...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
KitsuneClient.get_question_answers
Retrieve all answers for a question from older to newer (updated)
perceval/backends/mozilla/kitsune.py
def get_question_answers(self, question_id): """Retrieve all answers for a question from older to newer (updated)""" page = KitsuneClient.FIRST_PAGE while True: api_answers_url = urijoin(self.base_url, '/answer') + '/' params = { "page": page, ...
def get_question_answers(self, question_id): """Retrieve all answers for a question from older to newer (updated)""" page = KitsuneClient.FIRST_PAGE while True: api_answers_url = urijoin(self.base_url, '/answer') + '/' params = { "page": page, ...
[ "Retrieve", "all", "answers", "for", "a", "question", "from", "older", "to", "newer", "(", "updated", ")" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L272-L291
[ "def", "get_question_answers", "(", "self", ",", "question_id", ")", ":", "page", "=", "KitsuneClient", ".", "FIRST_PAGE", "while", "True", ":", "api_answers_url", "=", "urijoin", "(", "self", ".", "base_url", ",", "'/answer'", ")", "+", "'/'", "params", "="...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
KitsuneClient.fetch
Return the textual content associated to the Response object
perceval/backends/mozilla/kitsune.py
def fetch(self, url, params): """Return the textual content associated to the Response object""" logger.debug("Kitsune client calls API: %s params: %s", url, str(params)) response = super().fetch(url, payload=params) return response.text
def fetch(self, url, params): """Return the textual content associated to the Response object""" logger.debug("Kitsune client calls API: %s params: %s", url, str(params)) response = super().fetch(url, payload=params) return response.text
[ "Return", "the", "textual", "content", "associated", "to", "the", "Response", "object" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/kitsune.py#L293-L301
[ "def", "fetch", "(", "self", ",", "url", ",", "params", ")", ":", "logger", ".", "debug", "(", "\"Kitsune client calls API: %s params: %s\"", ",", "url", ",", "str", "(", "params", ")", ")", "response", "=", "super", "(", ")", ".", "fetch", "(", "url", ...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMo.fetch
Fetch items from the ReMo url. The method retrieves, from a ReMo URL, the set of items of the given `category`. :param category: the category of items to fetch :param offset: obtain items after offset :returns: a generator of items
perceval/backends/mozilla/remo.py
def fetch(self, category=CATEGORY_EVENT, offset=REMO_DEFAULT_OFFSET): """Fetch items from the ReMo url. The method retrieves, from a ReMo URL, the set of items of the given `category`. :param category: the category of items to fetch :param offset: obtain items after offset ...
def fetch(self, category=CATEGORY_EVENT, offset=REMO_DEFAULT_OFFSET): """Fetch items from the ReMo url. The method retrieves, from a ReMo URL, the set of items of the given `category`. :param category: the category of items to fetch :param offset: obtain items after offset ...
[ "Fetch", "items", "from", "the", "ReMo", "url", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L73-L89
[ "def", "fetch", "(", "self", ",", "category", "=", "CATEGORY_EVENT", ",", "offset", "=", "REMO_DEFAULT_OFFSET", ")", ":", "if", "not", "offset", ":", "offset", "=", "REMO_DEFAULT_OFFSET", "kwargs", "=", "{", "\"offset\"", ":", "offset", "}", "items", "=", ...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMo.fetch_items
Fetch items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
perceval/backends/mozilla/remo.py
def fetch_items(self, category, **kwargs): """Fetch items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ offset = kwargs['offset'] logger.info("Looking for events at url '%s' of %s category an...
def fetch_items(self, category, **kwargs): """Fetch items :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ offset = kwargs['offset'] logger.info("Looking for events at url '%s' of %s category an...
[ "Fetch", "items" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L91-L135
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "offset", "=", "kwargs", "[", "'offset'", "]", "logger", ".", "info", "(", "\"Looking for events at url '%s' of %s category and %i offset\"", ",", "self", ".", "url", ",", "...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMo.metadata_updated_on
Extracts the update time from a ReMo item. The timestamp is extracted from 'end' field. This date is converted to a perceval format using a float value. :param item: item generated by the backend :returns: a UNIX timestamp
perceval/backends/mozilla/remo.py
def metadata_updated_on(item): """Extracts the update time from a ReMo item. The timestamp is extracted from 'end' field. This date is converted to a perceval format using a float value. :param item: item generated by the backend :returns: a UNIX timestamp """ ...
def metadata_updated_on(item): """Extracts the update time from a ReMo item. The timestamp is extracted from 'end' field. This date is converted to a perceval format using a float value. :param item: item generated by the backend :returns: a UNIX timestamp """ ...
[ "Extracts", "the", "update", "time", "from", "a", "ReMo", "item", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L173-L195
[ "def", "metadata_updated_on", "(", "item", ")", ":", "if", "'end'", "in", "item", ":", "# events updated field", "updated", "=", "item", "[", "'end'", "]", "elif", "'date_joined_program'", "in", "item", ":", "# users updated field that always appear", "updated", "="...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMo.metadata_category
Extracts the category from a ReMo item. This backend generates items types 'event', 'activity' or 'user'. To guess the type of item, the code will look for unique fields.
perceval/backends/mozilla/remo.py
def metadata_category(item): """Extracts the category from a ReMo item. This backend generates items types 'event', 'activity' or 'user'. To guess the type of item, the code will look for unique fields. """ if 'estimated_attendance' in item: category = CATEGO...
def metadata_category(item): """Extracts the category from a ReMo item. This backend generates items types 'event', 'activity' or 'user'. To guess the type of item, the code will look for unique fields. """ if 'estimated_attendance' in item: category = CATEGO...
[ "Extracts", "the", "category", "from", "a", "ReMo", "item", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L198-L214
[ "def", "metadata_category", "(", "item", ")", ":", "if", "'estimated_attendance'", "in", "item", ":", "category", "=", "CATEGORY_EVENT", "elif", "'activity'", "in", "item", ":", "category", "=", "CATEGORY_ACTIVITY", "elif", "'first_name'", "in", "item", ":", "ca...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMo._init_client
Init client
perceval/backends/mozilla/remo.py
def _init_client(self, from_archive=False): """Init client""" return ReMoClient(self.url, self.archive, from_archive)
def _init_client(self, from_archive=False): """Init client""" return ReMoClient(self.url, self.archive, from_archive)
[ "Init", "client" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L216-L219
[ "def", "_init_client", "(", "self", ",", "from_archive", "=", "False", ")", ":", "return", "ReMoClient", "(", "self", ".", "url", ",", "self", ".", "archive", ",", "from_archive", ")" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
ReMoClient.get_items
Retrieve all items for category using pagination
perceval/backends/mozilla/remo.py
def get_items(self, category=CATEGORY_EVENT, offset=REMO_DEFAULT_OFFSET): """Retrieve all items for category using pagination """ more = True # There are more items to be processed next_uri = None # URI for the next items page query page = ReMoClient.FIRST_PAGE page += int(off...
def get_items(self, category=CATEGORY_EVENT, offset=REMO_DEFAULT_OFFSET): """Retrieve all items for category using pagination """ more = True # There are more items to be processed next_uri = None # URI for the next items page query page = ReMoClient.FIRST_PAGE page += int(off...
[ "Retrieve", "all", "items", "for", "category", "using", "pagination" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/remo.py#L248-L286
[ "def", "get_items", "(", "self", ",", "category", "=", "CATEGORY_EVENT", ",", "offset", "=", "REMO_DEFAULT_OFFSET", ")", ":", "more", "=", "True", "# There are more items to be processed", "next_uri", "=", "None", "# URI for the next items page query", "page", "=", "R...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
AIOBlock.buffer_list
The buffer list this instance operates on. Only available in mode != AIOBLOCK_MODE_POLL. Changes on a submitted transfer are not fully applied until its next submission: kernel will still be using original buffer list.
libaio/__init__.py
def buffer_list(self): """ The buffer list this instance operates on. Only available in mode != AIOBLOCK_MODE_POLL. Changes on a submitted transfer are not fully applied until its next submission: kernel will still be using original buffer list. """ if self._ioc...
def buffer_list(self): """ The buffer list this instance operates on. Only available in mode != AIOBLOCK_MODE_POLL. Changes on a submitted transfer are not fully applied until its next submission: kernel will still be using original buffer list. """ if self._ioc...
[ "The", "buffer", "list", "this", "instance", "operates", "on", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L221-L232
[ "def", "buffer_list", "(", "self", ")", ":", "if", "self", ".", "_iocb", ".", "aio_lio_opcode", "==", "libaio", ".", "IO_CMD_POLL", ":", "raise", "AttributeError", "return", "self", ".", "_buffer_list" ]
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOBlock.io_priority
IO priority for this instance.
libaio/__init__.py
def io_priority(self): """ IO priority for this instance. """ return ( self._iocb.aio_reqprio if self._iocb.u.c.flags & libaio.IOCB_FLAG_IOPRIO else None )
def io_priority(self): """ IO priority for this instance. """ return ( self._iocb.aio_reqprio if self._iocb.u.c.flags & libaio.IOCB_FLAG_IOPRIO else None )
[ "IO", "priority", "for", "this", "instance", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L302-L310
[ "def", "io_priority", "(", "self", ")", ":", "return", "(", "self", ".", "_iocb", ".", "aio_reqprio", "if", "self", ".", "_iocb", ".", "u", ".", "c", ".", "flags", "&", "libaio", ".", "IOCB_FLAG_IOPRIO", "else", "None", ")" ]
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOContext.close
Cancels all pending IO blocks. Waits until all non-cancellable IO blocks finish. De-initialises AIO context.
libaio/__init__.py
def close(self): """ Cancels all pending IO blocks. Waits until all non-cancellable IO blocks finish. De-initialises AIO context. """ if self._ctx is not None: # Note: same as io_destroy self._io_queue_release(self._ctx) del self._ctx
def close(self): """ Cancels all pending IO blocks. Waits until all non-cancellable IO blocks finish. De-initialises AIO context. """ if self._ctx is not None: # Note: same as io_destroy self._io_queue_release(self._ctx) del self._ctx
[ "Cancels", "all", "pending", "IO", "blocks", ".", "Waits", "until", "all", "non", "-", "cancellable", "IO", "blocks", "finish", ".", "De", "-", "initialises", "AIO", "context", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L384-L393
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_ctx", "is", "not", "None", ":", "# Note: same as io_destroy", "self", ".", "_io_queue_release", "(", "self", ".", "_ctx", ")", "del", "self", ".", "_ctx" ]
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOContext.submit
Submits transfers. block_list (list of AIOBlock) The IO blocks to hand off to kernel. Returns the number of successfully submitted blocks.
libaio/__init__.py
def submit(self, block_list): """ Submits transfers. block_list (list of AIOBlock) The IO blocks to hand off to kernel. Returns the number of successfully submitted blocks. """ # io_submit ioctl will only return an error for issues with the first # t...
def submit(self, block_list): """ Submits transfers. block_list (list of AIOBlock) The IO blocks to hand off to kernel. Returns the number of successfully submitted blocks. """ # io_submit ioctl will only return an error for issues with the first # t...
[ "Submits", "transfers", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L414-L442
[ "def", "submit", "(", "self", ",", "block_list", ")", ":", "# io_submit ioctl will only return an error for issues with the first", "# transfer block. If there are issues with a later block, it will stop", "# submission and return the number of submitted blocks. So it is safe", "# to only upda...
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOContext.cancel
Cancel an IO block. block (AIOBlock) The IO block to cancel. Returns cancelled block's event data (see getEvents), or None if the kernel returned EINPROGRESS. In the latter case, event completion will happen on a later getEvents call.
libaio/__init__.py
def cancel(self, block): """ Cancel an IO block. block (AIOBlock) The IO block to cancel. Returns cancelled block's event data (see getEvents), or None if the kernel returned EINPROGRESS. In the latter case, event completion will happen on a later getEvents ...
def cancel(self, block): """ Cancel an IO block. block (AIOBlock) The IO block to cancel. Returns cancelled block's event data (see getEvents), or None if the kernel returned EINPROGRESS. In the latter case, event completion will happen on a later getEvents ...
[ "Cancel", "an", "IO", "block", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L453-L473
[ "def", "cancel", "(", "self", ",", "block", ")", ":", "event", "=", "libaio", ".", "io_event", "(", ")", "try", ":", "# pylint: disable=protected-access", "libaio", ".", "io_cancel", "(", "self", ".", "_ctx", ",", "byref", "(", "block", ".", "_iocb", ")"...
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOContext.cancelAll
Cancel all submitted IO blocks. Blocks until all submitted transfers have been finalised. Submitting more transfers or processing completion events while this method is running produces undefined behaviour. Returns the list of values returned by individual cancellations. See "ca...
libaio/__init__.py
def cancelAll(self): """ Cancel all submitted IO blocks. Blocks until all submitted transfers have been finalised. Submitting more transfers or processing completion events while this method is running produces undefined behaviour. Returns the list of values returned by ...
def cancelAll(self): """ Cancel all submitted IO blocks. Blocks until all submitted transfers have been finalised. Submitting more transfers or processing completion events while this method is running produces undefined behaviour. Returns the list of values returned by ...
[ "Cancel", "all", "submitted", "IO", "blocks", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L475-L496
[ "def", "cancelAll", "(", "self", ")", ":", "cancel", "=", "self", ".", "cancel", "result", "=", "[", "]", "for", "block", ",", "_", "in", "self", ".", "_submitted", ".", "itervalues", "(", ")", ":", "try", ":", "result", ".", "append", "(", "cancel...
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
AIOContext.getEvents
Returns a list of event data from submitted IO blocks. min_nr (int, None) When timeout is None, minimum number of events to collect before returning. If None, waits for all submitted events. nr (int, None) Maximum number of events to return. I...
libaio/__init__.py
def getEvents(self, min_nr=1, nr=None, timeout=None): """ Returns a list of event data from submitted IO blocks. min_nr (int, None) When timeout is None, minimum number of events to collect before returning. If None, waits for all submitted events. nr...
def getEvents(self, min_nr=1, nr=None, timeout=None): """ Returns a list of event data from submitted IO blocks. min_nr (int, None) When timeout is None, minimum number of events to collect before returning. If None, waits for all submitted events. nr...
[ "Returns", "a", "list", "of", "event", "data", "from", "submitted", "IO", "blocks", "." ]
vpelletier/python-libaio
python
https://github.com/vpelletier/python-libaio/blob/5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3/libaio/__init__.py#L498-L540
[ "def", "getEvents", "(", "self", ",", "min_nr", "=", "1", ",", "nr", "=", "None", ",", "timeout", "=", "None", ")", ":", "if", "min_nr", "is", "None", ":", "min_nr", "=", "len", "(", "self", ".", "_submitted", ")", "if", "nr", "is", "None", ":", ...
5b5a2fed5418e2bd1ac9197fa46c69dae86c6fe3
test
MozillaClub.fetch
Fetch events from the MozillaClub URL. The method retrieves, from a MozillaClub URL, the events. The data is a Google spreadsheet retrieved using the feed API REST. :param category: the category of items to fetch :returns: a generator of events
perceval/backends/mozilla/mozillaclub.py
def fetch(self, category=CATEGORY_EVENT): """Fetch events from the MozillaClub URL. The method retrieves, from a MozillaClub URL, the events. The data is a Google spreadsheet retrieved using the feed API REST. :param category: the category of items to fetch :returns: a...
def fetch(self, category=CATEGORY_EVENT): """Fetch events from the MozillaClub URL. The method retrieves, from a MozillaClub URL, the events. The data is a Google spreadsheet retrieved using the feed API REST. :param category: the category of items to fetch :returns: a...
[ "Fetch", "events", "from", "the", "MozillaClub", "URL", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L85-L99
[ "def", "fetch", "(", "self", ",", "category", "=", "CATEGORY_EVENT", ")", ":", "kwargs", "=", "{", "}", "items", "=", "super", "(", ")", ".", "fetch", "(", "category", ",", "*", "*", "kwargs", ")", "return", "items" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
MozillaClub.fetch_items
Fetch events :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
perceval/backends/mozilla/mozillaclub.py
def fetch_items(self, category, **kwargs): """Fetch events :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ logger.info("Looking for events at url '%s'", self.url) nevents = 0 # number of event...
def fetch_items(self, category, **kwargs): """Fetch events :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ logger.info("Looking for events at url '%s'", self.url) nevents = 0 # number of event...
[ "Fetch", "events" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L101-L120
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "info", "(", "\"Looking for events at url '%s'\"", ",", "self", ".", "url", ")", "nevents", "=", "0", "# number of events processed", "raw_cells", "=", "self"...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
MozillaClub._init_client
Init client
perceval/backends/mozilla/mozillaclub.py
def _init_client(self, from_archive=False): """Init client""" return MozillaClubClient(self.url, self.archive, from_archive)
def _init_client(self, from_archive=False): """Init client""" return MozillaClubClient(self.url, self.archive, from_archive)
[ "Init", "client" ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L168-L171
[ "def", "_init_client", "(", "self", ",", "from_archive", "=", "False", ")", ":", "return", "MozillaClubClient", "(", "self", ".", "url", ",", "self", ".", "archive", ",", "from_archive", ")" ]
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
MozillaClubClient.get_cells
Retrieve all cells from the spreadsheet.
perceval/backends/mozilla/mozillaclub.py
def get_cells(self): """Retrieve all cells from the spreadsheet.""" logger.info("Retrieving all cells spreadsheet data ...") logger.debug("MozillaClub client calls API: %s", self.base_url) raw_cells = self.fetch(self.base_url) return raw_cells.text
def get_cells(self): """Retrieve all cells from the spreadsheet.""" logger.info("Retrieving all cells spreadsheet data ...") logger.debug("MozillaClub client calls API: %s", self.base_url) raw_cells = self.fetch(self.base_url) return raw_cells.text
[ "Retrieve", "all", "cells", "from", "the", "spreadsheet", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L189-L196
[ "def", "get_cells", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Retrieving all cells spreadsheet data ...\"", ")", "logger", ".", "debug", "(", "\"MozillaClub client calls API: %s\"", ",", "self", ".", "base_url", ")", "raw_cells", "=", "self", ".", "fet...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
MozillaClubParser.parse
Parse the MozillaClub spreadsheet feed cells json.
perceval/backends/mozilla/mozillaclub.py
def parse(self): """Parse the MozillaClub spreadsheet feed cells json.""" nevents_wrong = 0 feed_json = json.loads(self.feed) if 'entry' not in feed_json['feed']: return self.cells = feed_json['feed']['entry'] self.ncell = 0 event_fields = self.__...
def parse(self): """Parse the MozillaClub spreadsheet feed cells json.""" nevents_wrong = 0 feed_json = json.loads(self.feed) if 'entry' not in feed_json['feed']: return self.cells = feed_json['feed']['entry'] self.ncell = 0 event_fields = self.__...
[ "Parse", "the", "MozillaClub", "spreadsheet", "feed", "cells", "json", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L265-L294
[ "def", "parse", "(", "self", ")", ":", "nevents_wrong", "=", "0", "feed_json", "=", "json", ".", "loads", "(", "self", ".", "feed", ")", "if", "'entry'", "not", "in", "feed_json", "[", "'feed'", "]", ":", "return", "self", ".", "cells", "=", "feed_js...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
MozillaClubParser.__get_event_fields
Get the events fields (columns) from the cells received.
perceval/backends/mozilla/mozillaclub.py
def __get_event_fields(self): """Get the events fields (columns) from the cells received.""" event_fields = {} # The cells in the first row are the column names # Check that the columns names are the same we have as template # Create the event template from the data retrieved ...
def __get_event_fields(self): """Get the events fields (columns) from the cells received.""" event_fields = {} # The cells in the first row are the column names # Check that the columns names are the same we have as template # Create the event template from the data retrieved ...
[ "Get", "the", "events", "fields", "(", "columns", ")", "from", "the", "cells", "received", "." ]
chaoss/grimoirelab-perceval-mozilla
python
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/mozillaclub.py#L296-L320
[ "def", "__get_event_fields", "(", "self", ")", ":", "event_fields", "=", "{", "}", "# The cells in the first row are the column names", "# Check that the columns names are the same we have as template", "# Create the event template from the data retrieved", "while", "self", ".", "nce...
4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4
test
get_data_files
Return data files in directory *dirname*
setup.py
def get_data_files(dirname): """Return data files in directory *dirname*""" flist = [] for dirpath, _dirnames, filenames in os.walk(dirname): for fname in filenames: flist.append(osp.join(dirpath, fname)) return flist
def get_data_files(dirname): """Return data files in directory *dirname*""" flist = [] for dirpath, _dirnames, filenames in os.walk(dirname): for fname in filenames: flist.append(osp.join(dirpath, fname)) return flist
[ "Return", "data", "files", "in", "directory", "*", "dirname", "*" ]
PierreRaybaut/PyQtdoc
python
https://github.com/PierreRaybaut/PyQtdoc/blob/71dce1cf11d958f72db2f5b9519d3540569b7720/setup.py#L8-L14
[ "def", "get_data_files", "(", "dirname", ")", ":", "flist", "=", "[", "]", "for", "dirpath", ",", "_dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "dirname", ")", ":", "for", "fname", "in", "filenames", ":", "flist", ".", "append", "(", "...
71dce1cf11d958f72db2f5b9519d3540569b7720
test
md5
Calculates the md5-hash of the file. :param file_path: full path to the file.
md5hash/md5hash.py
def md5(file_path): """Calculates the md5-hash of the file. :param file_path: full path to the file. """ hasher = hashlib.md5() with open(file_path, 'rb') as f: while True: buf = f.read(BLOCKSIZE) if not buf: break while len(buf...
def md5(file_path): """Calculates the md5-hash of the file. :param file_path: full path to the file. """ hasher = hashlib.md5() with open(file_path, 'rb') as f: while True: buf = f.read(BLOCKSIZE) if not buf: break while len(buf...
[ "Calculates", "the", "md5", "-", "hash", "of", "the", "file", ".", ":", "param", "file_path", ":", "full", "path", "to", "the", "file", "." ]
valsaven/md5hash
python
https://github.com/valsaven/md5hash/blob/83208769a8e9c74bd9e4ce72ac1df00615af82f2/md5hash/md5hash.py#L10-L25
[ "def", "md5", "(", "file_path", ")", ":", "hasher", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "file_path", ",", "'rb'", ")", "as", "f", ":", "while", "True", ":", "buf", "=", "f", ".", "read", "(", "BLOCKSIZE", ")", "if", "not", ...
83208769a8e9c74bd9e4ce72ac1df00615af82f2
test
size
Shows file size. :param full_path: full path to the file.
md5hash/md5hash.py
def size(full_path): """Shows file size. :param full_path: full path to the file. """ file_size = os.path.getsize(full_path) str_file_size = str(file_size) print(str_file_size, 'b') # Show size in b, kb, mb or gb depending on the dimension if len(str_file_size) >= 10: ...
def size(full_path): """Shows file size. :param full_path: full path to the file. """ file_size = os.path.getsize(full_path) str_file_size = str(file_size) print(str_file_size, 'b') # Show size in b, kb, mb or gb depending on the dimension if len(str_file_size) >= 10: ...
[ "Shows", "file", "size", ".", ":", "param", "full_path", ":", "full", "path", "to", "the", "file", "." ]
valsaven/md5hash
python
https://github.com/valsaven/md5hash/blob/83208769a8e9c74bd9e4ce72ac1df00615af82f2/md5hash/md5hash.py#L28-L43
[ "def", "size", "(", "full_path", ")", ":", "file_size", "=", "os", ".", "path", ".", "getsize", "(", "full_path", ")", "str_file_size", "=", "str", "(", "file_size", ")", "print", "(", "str_file_size", ",", "'b'", ")", "# Show size in b, kb, mb or gb depending...
83208769a8e9c74bd9e4ce72ac1df00615af82f2
test
calculate
Split the tuple (obtained from scan) to separate files. Alternately send full paths to the files in md5 and call it. :param directory: tuple of files in the directory.
md5hash/md5hash.py
def calculate(directory): """Split the tuple (obtained from scan) to separate files. Alternately send full paths to the files in md5 and call it. :param directory: tuple of files in the directory.""" # Set correct slashes for the OS if sys.platform == 'windows': slash = '\\' ...
def calculate(directory): """Split the tuple (obtained from scan) to separate files. Alternately send full paths to the files in md5 and call it. :param directory: tuple of files in the directory.""" # Set correct slashes for the OS if sys.platform == 'windows': slash = '\\' ...
[ "Split", "the", "tuple", "(", "obtained", "from", "scan", ")", "to", "separate", "files", ".", "Alternately", "send", "full", "paths", "to", "the", "files", "in", "md5", "and", "call", "it", ".", ":", "param", "directory", ":", "tuple", "of", "files", ...
valsaven/md5hash
python
https://github.com/valsaven/md5hash/blob/83208769a8e9c74bd9e4ce72ac1df00615af82f2/md5hash/md5hash.py#L46-L66
[ "def", "calculate", "(", "directory", ")", ":", "# Set correct slashes for the OS\r", "if", "sys", ".", "platform", "==", "'windows'", ":", "slash", "=", "'\\\\'", "elif", "sys", ".", "platform", "==", "'linux'", ":", "slash", "=", "'/'", "else", ":", "print...
83208769a8e9c74bd9e4ce72ac1df00615af82f2
test
scan
Scan the directory and send the obtained tuple to calculate. :param tree: path to file or directory
md5hash/md5hash.py
def scan(tree): """Scan the directory and send the obtained tuple to calculate. :param tree: path to file or directory""" tree = os.path.normpath(tree) assert os.path.exists(tree), "#Error. The path '{}' is" \ " invalid or doesn't exist.".format(str(tree)) ...
def scan(tree): """Scan the directory and send the obtained tuple to calculate. :param tree: path to file or directory""" tree = os.path.normpath(tree) assert os.path.exists(tree), "#Error. The path '{}' is" \ " invalid or doesn't exist.".format(str(tree)) ...
[ "Scan", "the", "directory", "and", "send", "the", "obtained", "tuple", "to", "calculate", ".", ":", "param", "tree", ":", "path", "to", "file", "or", "directory" ]
valsaven/md5hash
python
https://github.com/valsaven/md5hash/blob/83208769a8e9c74bd9e4ce72ac1df00615af82f2/md5hash/md5hash.py#L70-L93
[ "def", "scan", "(", "tree", ")", ":", "tree", "=", "os", ".", "path", ".", "normpath", "(", "tree", ")", "assert", "os", ".", "path", ".", "exists", "(", "tree", ")", ",", "\"#Error. The path '{}' is\"", "\" invalid or doesn't exist.\"", ".", "format", "("...
83208769a8e9c74bd9e4ce72ac1df00615af82f2
test
_RecordUIState.export_formats
List of export formats.
invenio_records_ui/ext.py
def export_formats(self, pid_type): """List of export formats.""" if pid_type not in self._export_formats: fmts = self.app.config.get('RECORDS_UI_EXPORT_FORMATS', {}).get( pid_type, {}) self._export_formats[pid_type] = sorted( [(k, v) for k, v in f...
def export_formats(self, pid_type): """List of export formats.""" if pid_type not in self._export_formats: fmts = self.app.config.get('RECORDS_UI_EXPORT_FORMATS', {}).get( pid_type, {}) self._export_formats[pid_type] = sorted( [(k, v) for k, v in f...
[ "List", "of", "export", "formats", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/ext.py#L29-L38
[ "def", "export_formats", "(", "self", ",", "pid_type", ")", ":", "if", "pid_type", "not", "in", "self", ".", "_export_formats", ":", "fmts", "=", "self", ".", "app", ".", "config", ".", "get", "(", "'RECORDS_UI_EXPORT_FORMATS'", ",", "{", "}", ")", ".", ...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
_RecordUIState.permission_factory
Load default permission factory.
invenio_records_ui/ext.py
def permission_factory(self): """Load default permission factory.""" if self._permission_factory is None: imp = self.app.config['RECORDS_UI_DEFAULT_PERMISSION_FACTORY'] self._permission_factory = obj_or_import_string(imp) return self._permission_factory
def permission_factory(self): """Load default permission factory.""" if self._permission_factory is None: imp = self.app.config['RECORDS_UI_DEFAULT_PERMISSION_FACTORY'] self._permission_factory = obj_or_import_string(imp) return self._permission_factory
[ "Load", "default", "permission", "factory", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/ext.py#L41-L46
[ "def", "permission_factory", "(", "self", ")", ":", "if", "self", ".", "_permission_factory", "is", "None", ":", "imp", "=", "self", ".", "app", ".", "config", "[", "'RECORDS_UI_DEFAULT_PERMISSION_FACTORY'", "]", "self", ".", "_permission_factory", "=", "obj_or_...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
InvenioRecordsUI.init_app
Flask application initialization. :param app: The Flask application.
invenio_records_ui/ext.py
def init_app(self, app): """Flask application initialization. :param app: The Flask application. """ self.init_config(app) app.extensions['invenio-records-ui'] = _RecordUIState(app)
def init_app(self, app): """Flask application initialization. :param app: The Flask application. """ self.init_config(app) app.extensions['invenio-records-ui'] = _RecordUIState(app)
[ "Flask", "application", "initialization", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/ext.py#L64-L70
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "self", ".", "init_config", "(", "app", ")", "app", ".", "extensions", "[", "'invenio-records-ui'", "]", "=", "_RecordUIState", "(", "app", ")" ]
ae92367978f2e1e96634685bd296f0fd92b4da54
test
create_blueprint
Create Invenio-Records-UI blueprint. The factory installs one URL route per endpoint defined, and adds an error handler for rendering tombstones. :param endpoints: Dictionary of endpoints to be installed. See usage documentation for further details. :returns: The initialized blueprint.
invenio_records_ui/views.py
def create_blueprint(endpoints): """Create Invenio-Records-UI blueprint. The factory installs one URL route per endpoint defined, and adds an error handler for rendering tombstones. :param endpoints: Dictionary of endpoints to be installed. See usage documentation for further details. :ret...
def create_blueprint(endpoints): """Create Invenio-Records-UI blueprint. The factory installs one URL route per endpoint defined, and adds an error handler for rendering tombstones. :param endpoints: Dictionary of endpoints to be installed. See usage documentation for further details. :ret...
[ "Create", "Invenio", "-", "Records", "-", "UI", "blueprint", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L48-L84
[ "def", "create_blueprint", "(", "endpoints", ")", ":", "blueprint", "=", "Blueprint", "(", "'invenio_records_ui'", ",", "__name__", ",", "url_prefix", "=", "''", ",", "template_folder", "=", "'templates'", ",", "static_folder", "=", "'static'", ",", ")", "@", ...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
create_url_rule
Create Werkzeug URL rule for a specific endpoint. The method takes care of creating a persistent identifier resolver for the given persistent identifier type. :param endpoint: Name of endpoint. :param route: URL route (must include ``<pid_value>`` pattern). Required. :param pid_type: Persistent id...
invenio_records_ui/views.py
def create_url_rule(endpoint, route=None, pid_type=None, template=None, permission_factory_imp=None, view_imp=None, record_class=None, methods=None): """Create Werkzeug URL rule for a specific endpoint. The method takes care of creating a persistent identifier resolver ...
def create_url_rule(endpoint, route=None, pid_type=None, template=None, permission_factory_imp=None, view_imp=None, record_class=None, methods=None): """Create Werkzeug URL rule for a specific endpoint. The method takes care of creating a persistent identifier resolver ...
[ "Create", "Werkzeug", "URL", "rule", "for", "a", "specific", "endpoint", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L87-L133
[ "def", "create_url_rule", "(", "endpoint", ",", "route", "=", "None", ",", "pid_type", "=", "None", ",", "template", "=", "None", ",", "permission_factory_imp", "=", "None", ",", "view_imp", "=", "None", ",", "record_class", "=", "None", ",", "methods", "=...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
record_view
Display record view. The two parameters ``resolver`` and ``template`` should not be included in the URL rule, but instead set by creating a partially evaluated function of the view. The template being rendered is passed two variables in the template context: - ``pid`` - ``record``. P...
invenio_records_ui/views.py
def record_view(pid_value=None, resolver=None, template=None, permission_factory=None, view_method=None, **kwargs): """Display record view. The two parameters ``resolver`` and ``template`` should not be included in the URL rule, but instead set by creating a partially evaluated function ...
def record_view(pid_value=None, resolver=None, template=None, permission_factory=None, view_method=None, **kwargs): """Display record view. The two parameters ``resolver`` and ``template`` should not be included in the URL rule, but instead set by creating a partially evaluated function ...
[ "Display", "record", "view", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L136-L205
[ "def", "record_view", "(", "pid_value", "=", "None", ",", "resolver", "=", "None", ",", "template", "=", "None", ",", "permission_factory", "=", "None", ",", "view_method", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "pid", ",", "record...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
default_view_method
r"""Display default view. Sends record_viewed signal and renders template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based on URL rule. :returns: The rendered template.
invenio_records_ui/views.py
def default_view_method(pid, record, template=None, **kwargs): r"""Display default view. Sends record_viewed signal and renders template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based on URL rule. ...
def default_view_method(pid, record, template=None, **kwargs): r"""Display default view. Sends record_viewed signal and renders template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based on URL rule. ...
[ "r", "Display", "default", "view", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L208-L228
[ "def", "default_view_method", "(", "pid", ",", "record", ",", "template", "=", "None", ",", "*", "*", "kwargs", ")", ":", "record_viewed", ".", "send", "(", "current_app", ".", "_get_current_object", "(", ")", ",", "pid", "=", "pid", ",", "record", "=", ...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
export
r"""Record serialization view. Serializes record with given format and renders record export template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based on URL rule. :return: The rendered template.
invenio_records_ui/views.py
def export(pid, record, template=None, **kwargs): r"""Record serialization view. Serializes record with given format and renders record export template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based...
def export(pid, record, template=None, **kwargs): r"""Record serialization view. Serializes record with given format and renders record export template. :param pid: PID object. :param record: Record object. :param template: Template to render. :param \*\*kwargs: Additional view arguments based...
[ "r", "Record", "serialization", "view", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/invenio_records_ui/views.py#L231-L260
[ "def", "export", "(", "pid", ",", "record", ",", "template", "=", "None", ",", "*", "*", "kwargs", ")", ":", "formats", "=", "current_app", ".", "config", ".", "get", "(", "'RECORDS_UI_EXPORT_FORMATS'", ",", "{", "}", ")", ".", "get", "(", "pid", "."...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
records
Load test data fixture.
examples/app.py
def records(): """Load test data fixture.""" import uuid from invenio_records.api import Record from invenio_pidstore.models import PersistentIdentifier, PIDStatus # Record 1 - Live record with db.session.begin_nested(): pid1 = PersistentIdentifier.create( 'recid', '1', obje...
def records(): """Load test data fixture.""" import uuid from invenio_records.api import Record from invenio_pidstore.models import PersistentIdentifier, PIDStatus # Record 1 - Live record with db.session.begin_nested(): pid1 = PersistentIdentifier.create( 'recid', '1', obje...
[ "Load", "test", "data", "fixture", "." ]
inveniosoftware/invenio-records-ui
python
https://github.com/inveniosoftware/invenio-records-ui/blob/ae92367978f2e1e96634685bd296f0fd92b4da54/examples/app.py#L107-L173
[ "def", "records", "(", ")", ":", "import", "uuid", "from", "invenio_records", ".", "api", "import", "Record", "from", "invenio_pidstore", ".", "models", "import", "PersistentIdentifier", ",", "PIDStatus", "# Record 1 - Live record", "with", "db", ".", "session", "...
ae92367978f2e1e96634685bd296f0fd92b4da54
test
Chronometer.time_callable
Send a Timer metric calculating duration of execution of the provided callable
statsdmetrics/client/timing.py
def time_callable(self, name, target, rate=None, args=(), kwargs={}): # type: (str, Callable, float, Tuple, Dict) -> Chronometer """Send a Timer metric calculating duration of execution of the provided callable""" assert callable(target) if rate is None: rate = self._rate ...
def time_callable(self, name, target, rate=None, args=(), kwargs={}): # type: (str, Callable, float, Tuple, Dict) -> Chronometer """Send a Timer metric calculating duration of execution of the provided callable""" assert callable(target) if rate is None: rate = self._rate ...
[ "Send", "a", "Timer", "metric", "calculating", "duration", "of", "execution", "of", "the", "provided", "callable" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/timing.py#L77-L88
[ "def", "time_callable", "(", "self", ",", "name", ",", "target", ",", "rate", "=", "None", ",", "args", "=", "(", ")", ",", "kwargs", "=", "{", "}", ")", ":", "# type: (str, Callable, float, Tuple, Dict) -> Chronometer", "assert", "callable", "(", "target", ...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AutoClosingSharedSocket.close
Close the socket to free system resources. After the socket is closed, further operations with socket will fail. Multiple calls to close will have no effect.
statsdmetrics/client/__init__.py
def close(self): # type: () -> None """Close the socket to free system resources. After the socket is closed, further operations with socket will fail. Multiple calls to close will have no effect. """ if self._closed: return self._socket.close() ...
def close(self): # type: () -> None """Close the socket to free system resources. After the socket is closed, further operations with socket will fail. Multiple calls to close will have no effect. """ if self._closed: return self._socket.close() ...
[ "Close", "the", "socket", "to", "free", "system", "resources", "." ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L51-L62
[ "def", "close", "(", "self", ")", ":", "# type: () -> None", "if", "self", ".", "_closed", ":", "return", "self", ".", "_socket", ".", "close", "(", ")", "self", ".", "_closed", "=", "True" ]
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AutoClosingSharedSocket.remove_client
Remove the client from the users of the socket. If there are no more clients for the socket, it will close automatically.
statsdmetrics/client/__init__.py
def remove_client(self, client): # type: (object) -> None """Remove the client from the users of the socket. If there are no more clients for the socket, it will close automatically. """ try: self._clients.remove(id(client)) except ValueError: ...
def remove_client(self, client): # type: (object) -> None """Remove the client from the users of the socket. If there are no more clients for the socket, it will close automatically. """ try: self._clients.remove(id(client)) except ValueError: ...
[ "Remove", "the", "client", "from", "the", "users", "of", "the", "socket", "." ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L74-L88
[ "def", "remove_client", "(", "self", ",", "client", ")", ":", "# type: (object) -> None", "try", ":", "self", ".", "_clients", ".", "remove", "(", "id", "(", "client", ")", ")", "except", "ValueError", ":", "pass", "if", "len", "(", "self", ".", "_client...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.increment
Increment a Counter metric
statsdmetrics/client/__init__.py
def increment(self, name, count=1, rate=1): # type: (str, int, float) -> None """Increment a Counter metric""" if self._should_send_metric(name, rate): self._request( Counter( self._create_metric_name_for_request(name), int(cou...
def increment(self, name, count=1, rate=1): # type: (str, int, float) -> None """Increment a Counter metric""" if self._should_send_metric(name, rate): self._request( Counter( self._create_metric_name_for_request(name), int(cou...
[ "Increment", "a", "Counter", "metric" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L133-L144
[ "def", "increment", "(", "self", ",", "name", ",", "count", "=", "1", ",", "rate", "=", "1", ")", ":", "# type: (str, int, float) -> None", "if", "self", ".", "_should_send_metric", "(", "name", ",", "rate", ")", ":", "self", ".", "_request", "(", "Count...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.timing
Send a Timer metric with the specified duration in milliseconds
statsdmetrics/client/__init__.py
def timing(self, name, milliseconds, rate=1): # type: (str, float, float) -> None """Send a Timer metric with the specified duration in milliseconds""" if self._should_send_metric(name, rate): milliseconds = int(milliseconds) self._request( Timer( ...
def timing(self, name, milliseconds, rate=1): # type: (str, float, float) -> None """Send a Timer metric with the specified duration in milliseconds""" if self._should_send_metric(name, rate): milliseconds = int(milliseconds) self._request( Timer( ...
[ "Send", "a", "Timer", "metric", "with", "the", "specified", "duration", "in", "milliseconds" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L159-L171
[ "def", "timing", "(", "self", ",", "name", ",", "milliseconds", ",", "rate", "=", "1", ")", ":", "# type: (str, float, float) -> None", "if", "self", ".", "_should_send_metric", "(", "name", ",", "rate", ")", ":", "milliseconds", "=", "int", "(", "millisecon...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.timing_since
Send a Timer metric calculating the duration from the start time
statsdmetrics/client/__init__.py
def timing_since(self, name, start_time, rate=1): # type: (str, Union[float, datetime], float) -> None """Send a Timer metric calculating the duration from the start time""" duration = 0 # type: float if isinstance(start_time, datetime): duration = (datetime.now(start_time.t...
def timing_since(self, name, start_time, rate=1): # type: (str, Union[float, datetime], float) -> None """Send a Timer metric calculating the duration from the start time""" duration = 0 # type: float if isinstance(start_time, datetime): duration = (datetime.now(start_time.t...
[ "Send", "a", "Timer", "metric", "calculating", "the", "duration", "from", "the", "start", "time" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L173-L184
[ "def", "timing_since", "(", "self", ",", "name", ",", "start_time", ",", "rate", "=", "1", ")", ":", "# type: (str, Union[float, datetime], float) -> None", "duration", "=", "0", "# type: float", "if", "isinstance", "(", "start_time", ",", "datetime", ")", ":", ...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.gauge
Send a Gauge metric with the specified value
statsdmetrics/client/__init__.py
def gauge(self, name, value, rate=1): # type: (str, float, float) -> None """Send a Gauge metric with the specified value""" if self._should_send_metric(name, rate): if not is_numeric(value): value = float(value) self._request( Gauge( ...
def gauge(self, name, value, rate=1): # type: (str, float, float) -> None """Send a Gauge metric with the specified value""" if self._should_send_metric(name, rate): if not is_numeric(value): value = float(value) self._request( Gauge( ...
[ "Send", "a", "Gauge", "metric", "with", "the", "specified", "value" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L186-L199
[ "def", "gauge", "(", "self", ",", "name", ",", "value", ",", "rate", "=", "1", ")", ":", "# type: (str, float, float) -> None", "if", "self", ".", "_should_send_metric", "(", "name", ",", "rate", ")", ":", "if", "not", "is_numeric", "(", "value", ")", ":...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.gauge_delta
Send a GaugeDelta metric to change a Gauge by the specified value
statsdmetrics/client/__init__.py
def gauge_delta(self, name, delta, rate=1): # type: (str, float, float) -> None """Send a GaugeDelta metric to change a Gauge by the specified value""" if self._should_send_metric(name, rate): if not is_numeric(delta): delta = float(delta) self._request( ...
def gauge_delta(self, name, delta, rate=1): # type: (str, float, float) -> None """Send a GaugeDelta metric to change a Gauge by the specified value""" if self._should_send_metric(name, rate): if not is_numeric(delta): delta = float(delta) self._request( ...
[ "Send", "a", "GaugeDelta", "metric", "to", "change", "a", "Gauge", "by", "the", "specified", "value" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L201-L214
[ "def", "gauge_delta", "(", "self", ",", "name", ",", "delta", ",", "rate", "=", "1", ")", ":", "# type: (str, float, float) -> None", "if", "self", ".", "_should_send_metric", "(", "name", ",", "rate", ")", ":", "if", "not", "is_numeric", "(", "delta", ")"...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
AbstractClient.set
Send a Set metric with the specified unique value
statsdmetrics/client/__init__.py
def set(self, name, value, rate=1): # type: (str, str, float) -> None """Send a Set metric with the specified unique value""" if self._should_send_metric(name, rate): value = str(value) self._request( Set( self._create_metric_name_for_...
def set(self, name, value, rate=1): # type: (str, str, float) -> None """Send a Set metric with the specified unique value""" if self._should_send_metric(name, rate): value = str(value) self._request( Set( self._create_metric_name_for_...
[ "Send", "a", "Set", "metric", "with", "the", "specified", "unique", "value" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L216-L228
[ "def", "set", "(", "self", ",", "name", ",", "value", ",", "rate", "=", "1", ")", ":", "# type: (str, str, float) -> None", "if", "self", ".", "_should_send_metric", "(", "name", ",", "rate", ")", ":", "value", "=", "str", "(", "value", ")", "self", "....
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
BatchClientMixIn._request
Override parent by buffering the metric instead of sending now
statsdmetrics/client/__init__.py
def _request(self, data): # type: (str) -> None """Override parent by buffering the metric instead of sending now""" data = bytearray("{}\n".format(data).encode()) self._prepare_batches_for_storage(len(data)) self._batches[-1].extend(data)
def _request(self, data): # type: (str) -> None """Override parent by buffering the metric instead of sending now""" data = bytearray("{}\n".format(data).encode()) self._prepare_batches_for_storage(len(data)) self._batches[-1].extend(data)
[ "Override", "parent", "by", "buffering", "the", "metric", "instead", "of", "sending", "now" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L295-L301
[ "def", "_request", "(", "self", ",", "data", ")", ":", "# type: (str) -> None", "data", "=", "bytearray", "(", "\"{}\\n\"", ".", "format", "(", "data", ")", ".", "encode", "(", ")", ")", "self", ".", "_prepare_batches_for_storage", "(", "len", "(", "data",...
153ff37b79777f208e49bb9d3fb737ba52b99f98
test
Client.batch_client
Return a batch client with same settings of the client
statsdmetrics/client/__init__.py
def batch_client(self, size=512): # type: (int) -> BatchClient """Return a batch client with same settings of the client""" batch_client = BatchClient(self.host, self.port, self.prefix, size) self._configure_client(batch_client) return batch_client
def batch_client(self, size=512): # type: (int) -> BatchClient """Return a batch client with same settings of the client""" batch_client = BatchClient(self.host, self.port, self.prefix, size) self._configure_client(batch_client) return batch_client
[ "Return", "a", "batch", "client", "with", "same", "settings", "of", "the", "client" ]
farzadghanei/statsd-metrics
python
https://github.com/farzadghanei/statsd-metrics/blob/153ff37b79777f208e49bb9d3fb737ba52b99f98/statsdmetrics/client/__init__.py#L329-L335
[ "def", "batch_client", "(", "self", ",", "size", "=", "512", ")", ":", "# type: (int) -> BatchClient", "batch_client", "=", "BatchClient", "(", "self", ".", "host", ",", "self", ".", "port", ",", "self", ".", "prefix", ",", "size", ")", "self", ".", "_co...
153ff37b79777f208e49bb9d3fb737ba52b99f98