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
valid
Nemo.r_assets
Route for specific assets. :param filetype: Asset Type :param asset: Filename of an asset :return: Response
flask_nemo/__init__.py
def r_assets(self, filetype, asset): """ Route for specific assets. :param filetype: Asset Type :param asset: Filename of an asset :return: Response """ if filetype in self.assets and asset in self.assets[filetype] and self.assets[filetype][asset]: return sen...
def r_assets(self, filetype, asset): """ Route for specific assets. :param filetype: Asset Type :param asset: Filename of an asset :return: Response """ if filetype in self.assets and asset in self.assets[filetype] and self.assets[filetype][asset]: return sen...
[ "Route", "for", "specific", "assets", "." ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L678-L690
[ "def", "r_assets", "(", "self", ",", "filetype", ",", "asset", ")", ":", "if", "filetype", "in", "self", ".", "assets", "and", "asset", "in", "self", ".", "assets", "[", "filetype", "]", "and", "self", ".", "assets", "[", "filetype", "]", "[", "asset...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.register_assets
Merge and register assets, both as routes and dictionary :return: None
flask_nemo/__init__.py
def register_assets(self): """ Merge and register assets, both as routes and dictionary :return: None """ self.blueprint.add_url_rule( # Register another path to ensure assets compatibility "{0}.secondary/<filetype>/<asset>".format(self.static_url_path), ...
def register_assets(self): """ Merge and register assets, both as routes and dictionary :return: None """ self.blueprint.add_url_rule( # Register another path to ensure assets compatibility "{0}.secondary/<filetype>/<asset>".format(self.static_url_path), ...
[ "Merge", "and", "register", "assets", "both", "as", "routes", "and", "dictionary" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L692-L703
[ "def", "register_assets", "(", "self", ")", ":", "self", ".", "blueprint", ".", "add_url_rule", "(", "# Register another path to ensure assets compatibility", "\"{0}.secondary/<filetype>/<asset>\"", ".", "format", "(", "self", ".", "static_url_path", ")", ",", "view_func"...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.create_blueprint
Create blueprint and register rules :return: Blueprint of the current nemo app :rtype: flask.Blueprint
flask_nemo/__init__.py
def create_blueprint(self): """ Create blueprint and register rules :return: Blueprint of the current nemo app :rtype: flask.Blueprint """ self.register_plugins() self.blueprint = Blueprint( self.name, "nemo", url_prefix=self.prefix, ...
def create_blueprint(self): """ Create blueprint and register rules :return: Blueprint of the current nemo app :rtype: flask.Blueprint """ self.register_plugins() self.blueprint = Blueprint( self.name, "nemo", url_prefix=self.prefix, ...
[ "Create", "blueprint", "and", "register", "rules" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L705-L759
[ "def", "create_blueprint", "(", "self", ")", ":", "self", ".", "register_plugins", "(", ")", "self", ".", "blueprint", "=", "Blueprint", "(", "self", ".", "name", ",", "\"nemo\"", ",", "url_prefix", "=", "self", ".", "prefix", ",", "template_folder", "=", ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.view_maker
Create a view :param name: Name of the route function to use for the view. :type name: str :return: Route function which makes use of Nemo context (such as menu informations) :rtype: function
flask_nemo/__init__.py
def view_maker(self, name, instance=None): """ Create a view :param name: Name of the route function to use for the view. :type name: str :return: Route function which makes use of Nemo context (such as menu informations) :rtype: function """ if instance is None:...
def view_maker(self, name, instance=None): """ Create a view :param name: Name of the route function to use for the view. :type name: str :return: Route function which makes use of Nemo context (such as menu informations) :rtype: function """ if instance is None:...
[ "Create", "a", "view" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L761-L782
[ "def", "view_maker", "(", "self", ",", "name", ",", "instance", "=", "None", ")", ":", "if", "instance", "is", "None", ":", "instance", "=", "self", "sig", "=", "\"lang\"", "in", "[", "parameter", ".", "name", "for", "parameter", "in", "inspect", ".", ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.main_collections
Retrieve main parent collections of a repository :param lang: Language to retrieve information in :return: Sorted collections representations
flask_nemo/__init__.py
def main_collections(self, lang=None): """ Retrieve main parent collections of a repository :param lang: Language to retrieve information in :return: Sorted collections representations """ return sorted([ { "id": member.id, "label": st...
def main_collections(self, lang=None): """ Retrieve main parent collections of a repository :param lang: Language to retrieve information in :return: Sorted collections representations """ return sorted([ { "id": member.id, "label": st...
[ "Retrieve", "main", "parent", "collections", "of", "a", "repository" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L784-L799
[ "def", "main_collections", "(", "self", ",", "lang", "=", "None", ")", ":", "return", "sorted", "(", "[", "{", "\"id\"", ":", "member", ".", "id", ",", "\"label\"", ":", "str", "(", "member", ".", "get_label", "(", "lang", "=", "lang", ")", ")", ",...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.make_cache_keys
This function is built to provide cache keys for templates :param endpoint: Current endpoint :param kwargs: Keyword Arguments :return: tuple of i18n dependant cache key and i18n ignoring cache key :rtype: tuple(str)
flask_nemo/__init__.py
def make_cache_keys(self, endpoint, kwargs): """ This function is built to provide cache keys for templates :param endpoint: Current endpoint :param kwargs: Keyword Arguments :return: tuple of i18n dependant cache key and i18n ignoring cache key :rtype: tuple(str) """ ...
def make_cache_keys(self, endpoint, kwargs): """ This function is built to provide cache keys for templates :param endpoint: Current endpoint :param kwargs: Keyword Arguments :return: tuple of i18n dependant cache key and i18n ignoring cache key :rtype: tuple(str) """ ...
[ "This", "function", "is", "built", "to", "provide", "cache", "keys", "for", "templates" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L801-L815
[ "def", "make_cache_keys", "(", "self", ",", "endpoint", ",", "kwargs", ")", ":", "keys", "=", "sorted", "(", "kwargs", ".", "keys", "(", ")", ")", "i18n_cache_key", "=", "endpoint", "+", "\"|\"", "+", "\"|\"", ".", "join", "(", "[", "kwargs", "[", "k...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.render
Render a route template and adds information to this route. :param template: Template name. :type template: str :param kwargs: dictionary of named arguments used to be passed to the template :type kwargs: dict :return: Http Response with rendered template :rtype: flask.R...
flask_nemo/__init__.py
def render(self, template, **kwargs): """ Render a route template and adds information to this route. :param template: Template name. :type template: str :param kwargs: dictionary of named arguments used to be passed to the template :type kwargs: dict :return: Http Respo...
def render(self, template, **kwargs): """ Render a route template and adds information to this route. :param template: Template name. :type template: str :param kwargs: dictionary of named arguments used to be passed to the template :type kwargs: dict :return: Http Respo...
[ "Render", "a", "route", "template", "and", "adds", "information", "to", "this", "route", "." ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L817-L840
[ "def", "render", "(", "self", ",", "template", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"cache_key\"", "]", "=", "\"%s\"", "%", "kwargs", "[", "\"url\"", "]", ".", "values", "(", ")", "kwargs", "[", "\"lang\"", "]", "=", "self", ".", "ge...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.route
Route helper : apply fn function but keep the calling object, *ie* kwargs, for other functions :param fn: Function to run the route with :type fn: function :param kwargs: Parsed url arguments :type kwargs: dict :return: HTTP Response with rendered template :rtype: flask....
flask_nemo/__init__.py
def route(self, fn, **kwargs): """ Route helper : apply fn function but keep the calling object, *ie* kwargs, for other functions :param fn: Function to run the route with :type fn: function :param kwargs: Parsed url arguments :type kwargs: dict :return: HTTP Response wi...
def route(self, fn, **kwargs): """ Route helper : apply fn function but keep the calling object, *ie* kwargs, for other functions :param fn: Function to run the route with :type fn: function :param kwargs: Parsed url arguments :type kwargs: dict :return: HTTP Response wi...
[ "Route", "helper", ":", "apply", "fn", "function", "but", "keep", "the", "calling", "object", "*", "ie", "*", "kwargs", "for", "other", "functions" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L842-L859
[ "def", "route", "(", "self", ",", "fn", ",", "*", "*", "kwargs", ")", ":", "new_kwargs", "=", "fn", "(", "*", "*", "kwargs", ")", "# If there is no templates, we assume that the response is finalized :", "if", "not", "isinstance", "(", "new_kwargs", ",", "dict",...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.register
Register the app using Blueprint :return: Nemo blueprint :rtype: flask.Blueprint
flask_nemo/__init__.py
def register(self): """ Register the app using Blueprint :return: Nemo blueprint :rtype: flask.Blueprint """ if self.app is not None: if not self.blueprint: self.blueprint = self.create_blueprint() self.app.register_blueprint(self.blueprin...
def register(self): """ Register the app using Blueprint :return: Nemo blueprint :rtype: flask.Blueprint """ if self.app is not None: if not self.blueprint: self.blueprint = self.create_blueprint() self.app.register_blueprint(self.blueprin...
[ "Register", "the", "app", "using", "Blueprint" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L861-L876
[ "def", "register", "(", "self", ")", ":", "if", "self", ".", "app", "is", "not", "None", ":", "if", "not", "self", ".", "blueprint", ":", "self", ".", "blueprint", "=", "self", ".", "create_blueprint", "(", ")", "self", ".", "app", ".", "register_blu...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.register_filters
Register filters for Jinja to use .. note:: Extends the dictionary filters of jinja_env using self._filters list
flask_nemo/__init__.py
def register_filters(self): """ Register filters for Jinja to use .. note:: Extends the dictionary filters of jinja_env using self._filters list """ for _filter, instance in self._filters: if not instance: self.app.jinja_env.filters[ _filt...
def register_filters(self): """ Register filters for Jinja to use .. note:: Extends the dictionary filters of jinja_env using self._filters list """ for _filter, instance in self._filters: if not instance: self.app.jinja_env.filters[ _filt...
[ "Register", "filters", "for", "Jinja", "to", "use" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L878-L891
[ "def", "register_filters", "(", "self", ")", ":", "for", "_filter", ",", "instance", "in", "self", ".", "_filters", ":", "if", "not", "instance", ":", "self", ".", "app", ".", "jinja_env", ".", "filters", "[", "_filter", ".", "replace", "(", "\"f_\"", ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.register_plugins
Register plugins in Nemo instance - Clear routes first if asked by one plugin - Clear assets if asked by one plugin and replace by the last plugin registered static_folder - Register each plugin - Append plugin routes to registered routes - Append plugin filters to regis...
flask_nemo/__init__.py
def register_plugins(self): """ Register plugins in Nemo instance - Clear routes first if asked by one plugin - Clear assets if asked by one plugin and replace by the last plugin registered static_folder - Register each plugin - Append plugin routes to registered routes ...
def register_plugins(self): """ Register plugins in Nemo instance - Clear routes first if asked by one plugin - Clear assets if asked by one plugin and replace by the last plugin registered static_folder - Register each plugin - Append plugin routes to registered routes ...
[ "Register", "plugins", "in", "Nemo", "instance" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L893-L931
[ "def", "register_plugins", "(", "self", ")", ":", "if", "len", "(", "[", "plugin", "for", "plugin", "in", "self", ".", "__plugins__", ".", "values", "(", ")", "if", "plugin", ".", "clear_routes", "]", ")", ">", "0", ":", "# Clear current routes", "self",...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Nemo.chunk
Handle a list of references depending on the text identifier using the chunker dictionary. :param text: Text object from which comes the references :type text: MyCapytains.resources.texts.api.Text :param reffs: List of references to transform :type reffs: References :return: Tra...
flask_nemo/__init__.py
def chunk(self, text, reffs): """ Handle a list of references depending on the text identifier using the chunker dictionary. :param text: Text object from which comes the references :type text: MyCapytains.resources.texts.api.Text :param reffs: List of references to transform :t...
def chunk(self, text, reffs): """ Handle a list of references depending on the text identifier using the chunker dictionary. :param text: Text object from which comes the references :type text: MyCapytains.resources.texts.api.Text :param reffs: List of references to transform :t...
[ "Handle", "a", "list", "of", "references", "depending", "on", "the", "text", "identifier", "using", "the", "chunker", "dictionary", "." ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L933-L945
[ "def", "chunk", "(", "self", ",", "text", ",", "reffs", ")", ":", "if", "str", "(", "text", ".", "id", ")", "in", "self", ".", "chunker", ":", "return", "self", ".", "chunker", "[", "str", "(", "text", ".", "id", ")", "]", "(", "text", ",", "...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
ChangeTracker.update
Returns the appropriate current value, based on the changes recorded by this ChangeTracker, the value stored by the server (`localValue`), and the value stored by the synchronizing client (`remoteValue`). If `remoteValue` conflicts with changes stored locally, then a `pysyncml.ConflictError` is raised. ...
pysyncml/change/tracker.py
def update(self, fieldname, localValue, remoteValue): ''' Returns the appropriate current value, based on the changes recorded by this ChangeTracker, the value stored by the server (`localValue`), and the value stored by the synchronizing client (`remoteValue`). If `remoteValue` conflicts with chang...
def update(self, fieldname, localValue, remoteValue): ''' Returns the appropriate current value, based on the changes recorded by this ChangeTracker, the value stored by the server (`localValue`), and the value stored by the synchronizing client (`remoteValue`). If `remoteValue` conflicts with chang...
[ "Returns", "the", "appropriate", "current", "value", "based", "on", "the", "changes", "recorded", "by", "this", "ChangeTracker", "the", "value", "stored", "by", "the", "server", "(", "localValue", ")", "and", "the", "value", "stored", "by", "the", "synchronizi...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/change/tracker.py#L232-L280
[ "def", "update", "(", "self", ",", "fieldname", ",", "localValue", ",", "remoteValue", ")", ":", "if", "localValue", "==", "remoteValue", ":", "return", "localValue", "ct", "=", "constants", ".", "ITEM_DELETED", "if", "remoteValue", "is", "None", "else", "co...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
AttributeChangeTracker.isChange
Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is simply the fieldname that needs to be updated with the `newValue`. Currently, this is always equal to `fieldname`.
pysyncml/change/tracker.py
def isChange(self, fieldname, changeType, newValue=None, isMd5=False): ''' Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is simply the fieldname that needs to be updated with the `newValue`. Currently, this is always equal to `fieldname`. ''' # todo: thi...
def isChange(self, fieldname, changeType, newValue=None, isMd5=False): ''' Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is simply the fieldname that needs to be updated with the `newValue`. Currently, this is always equal to `fieldname`. ''' # todo: thi...
[ "Implements", "as", "specified", "in", ":", "meth", ":", ".", "ChangeTracker", ".", "isChange", "where", "the", "changeObject", "is", "simply", "the", "fieldname", "that", "needs", "to", "be", "updated", "with", "the", "newValue", ".", "Currently", "this", "...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/change/tracker.py#L431-L475
[ "def", "isChange", "(", "self", ",", "fieldname", ",", "changeType", ",", "newValue", "=", "None", ",", "isMd5", "=", "False", ")", ":", "# todo: this seems inefficient...", "changes", "=", "self", ".", "_collapseChanges", "(", "self", ".", "baseline", ",", ...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
ListChangeTracker.append
Adds a change spec to the current list of changes. The `listIndex` represents the line number (in multi-line mode) or word number (in single-line mode), and must be **INCLUSIVE** of both additions and deletions.
pysyncml/change/tracker.py
def append(self, listIndex, changeType, initialValue=None, isMd5=False): ''' Adds a change spec to the current list of changes. The `listIndex` represents the line number (in multi-line mode) or word number (in single-line mode), and must be **INCLUSIVE** of both additions and deletions. ''' ...
def append(self, listIndex, changeType, initialValue=None, isMd5=False): ''' Adds a change spec to the current list of changes. The `listIndex` represents the line number (in multi-line mode) or word number (in single-line mode), and must be **INCLUSIVE** of both additions and deletions. ''' ...
[ "Adds", "a", "change", "spec", "to", "the", "current", "list", "of", "changes", ".", "The", "listIndex", "represents", "the", "line", "number", "(", "in", "multi", "-", "line", "mode", ")", "or", "word", "number", "(", "in", "single", "-", "line", "mod...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/change/tracker.py#L570-L595
[ "def", "append", "(", "self", ",", "listIndex", ",", "changeType", ",", "initialValue", "=", "None", ",", "isMd5", "=", "False", ")", ":", "if", "not", "isMd5", "and", "initialValue", "is", "not", "None", "and", "len", "(", "initialValue", ")", ">", "3...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
ListChangeTracker.isChange
Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is a two-element tuple. The first element is the index at which the change should be applied, and the second element is an abstract token that should be passed back into this method at every iteration. IMPORTANT: un...
pysyncml/change/tracker.py
def isChange(self, listIndex, changeType, newValue=None, isMd5=False, token=None): ''' Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is a two-element tuple. The first element is the index at which the change should be applied, and the second element is an abstra...
def isChange(self, listIndex, changeType, newValue=None, isMd5=False, token=None): ''' Implements as specified in :meth:`.ChangeTracker.isChange` where the `changeObject` is a two-element tuple. The first element is the index at which the change should be applied, and the second element is an abstra...
[ "Implements", "as", "specified", "in", ":", "meth", ":", ".", "ChangeTracker", ".", "isChange", "where", "the", "changeObject", "is", "a", "two", "-", "element", "tuple", ".", "The", "first", "element", "is", "the", "index", "at", "which", "the", "change",...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/change/tracker.py#L598-L707
[ "def", "isChange", "(", "self", ",", "listIndex", ",", "changeType", ",", "newValue", "=", "None", ",", "isMd5", "=", "False", ",", "token", "=", "None", ")", ":", "# THE INDEX PASSED TO ListChangeTracker.isChange() DOES NOT INCLUDE:", "# - local deletions", "# - ...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
add_tag
Obtains the data from the pipe and appends the given tag.
jackal/scripts/tags.py
def add_tag(): """ Obtains the data from the pipe and appends the given tag. """ if len(sys.argv) > 1: tag = sys.argv[1] doc_mapper = DocMapper() if doc_mapper.is_pipe: count = 0 for obj in doc_mapper.get_pipe(): obj.add_tag(tag) ...
def add_tag(): """ Obtains the data from the pipe and appends the given tag. """ if len(sys.argv) > 1: tag = sys.argv[1] doc_mapper = DocMapper() if doc_mapper.is_pipe: count = 0 for obj in doc_mapper.get_pipe(): obj.add_tag(tag) ...
[ "Obtains", "the", "data", "from", "the", "pipe", "and", "appends", "the", "given", "tag", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/tags.py#L8-L26
[ "def", "add_tag", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", ">", "1", ":", "tag", "=", "sys", ".", "argv", "[", "1", "]", "doc_mapper", "=", "DocMapper", "(", ")", "if", "doc_mapper", ".", "is_pipe", ":", "count", "=", "0", "for...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
manual_configure
Function to manually configure jackal.
jackal/config.py
def manual_configure(): """ Function to manually configure jackal. """ print("Manual configuring jackal") mapping = { '1': 'y', '0': 'n'} config = Config() # Host host = input_with_default("What is the Elasticsearch host?", config.get('jackal', 'host')) config.set('jackal', 'host...
def manual_configure(): """ Function to manually configure jackal. """ print("Manual configuring jackal") mapping = { '1': 'y', '0': 'n'} config = Config() # Host host = input_with_default("What is the Elasticsearch host?", config.get('jackal', 'host')) config.set('jackal', 'host...
[ "Function", "to", "manually", "configure", "jackal", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/config.py#L24-L95
[ "def", "manual_configure", "(", ")", ":", "print", "(", "\"Manual configuring jackal\"", ")", "mapping", "=", "{", "'1'", ":", "'y'", ",", "'0'", ":", "'n'", "}", "config", "=", "Config", "(", ")", "# Host", "host", "=", "input_with_default", "(", "\"What ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Config.set
Creates the section value if it does not exists and sets the value. Use write_config to actually set the value.
jackal/config.py
def set(self, section, key, value): """ Creates the section value if it does not exists and sets the value. Use write_config to actually set the value. """ if not section in self.config: self.config.add_section(section) self.config.set(section, key, va...
def set(self, section, key, value): """ Creates the section value if it does not exists and sets the value. Use write_config to actually set the value. """ if not section in self.config: self.config.add_section(section) self.config.set(section, key, va...
[ "Creates", "the", "section", "value", "if", "it", "does", "not", "exists", "and", "sets", "the", "value", ".", "Use", "write_config", "to", "actually", "set", "the", "value", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/config.py#L191-L198
[ "def", "set", "(", "self", ",", "section", ",", "key", ",", "value", ")", ":", "if", "not", "section", "in", "self", ".", "config", ":", "self", ".", "config", ".", "add_section", "(", "section", ")", "self", ".", "config", ".", "set", "(", "sectio...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Config.get
This function tries to retrieve the value from the configfile otherwise will return a default.
jackal/config.py
def get(self, section, key): """ This function tries to retrieve the value from the configfile otherwise will return a default. """ try: return self.config.get(section, key) except configparser.NoSectionError: pass except configpars...
def get(self, section, key): """ This function tries to retrieve the value from the configfile otherwise will return a default. """ try: return self.config.get(section, key) except configparser.NoSectionError: pass except configpars...
[ "This", "function", "tries", "to", "retrieve", "the", "value", "from", "the", "configfile", "otherwise", "will", "return", "a", "default", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/config.py#L201-L212
[ "def", "get", "(", "self", ",", "section", ",", "key", ")", ":", "try", ":", "return", "self", ".", "config", ".", "get", "(", "section", ",", "key", ")", "except", "configparser", ".", "NoSectionError", ":", "pass", "except", "configparser", ".", "NoO...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Config.config_dir
Returns the configuration directory
jackal/config.py
def config_dir(self): """ Returns the configuration directory """ home = expanduser('~') config_dir = os.path.join(home, '.jackal') return config_dir
def config_dir(self): """ Returns the configuration directory """ home = expanduser('~') config_dir = os.path.join(home, '.jackal') return config_dir
[ "Returns", "the", "configuration", "directory" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/config.py#L223-L229
[ "def", "config_dir", "(", "self", ")", ":", "home", "=", "expanduser", "(", "'~'", ")", "config_dir", "=", "os", ".", "path", ".", "join", "(", "home", ",", "'.jackal'", ")", "return", "config_dir" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Config.write_config
Write the current config to disk to store them.
jackal/config.py
def write_config(self, initialize_indices=False): """ Write the current config to disk to store them. """ if not os.path.exists(self.config_dir): os.mkdir(self.config_dir) with open(self.config_file, 'w') as configfile: self.config.write(configfile) ...
def write_config(self, initialize_indices=False): """ Write the current config to disk to store them. """ if not os.path.exists(self.config_dir): os.mkdir(self.config_dir) with open(self.config_file, 'w') as configfile: self.config.write(configfile) ...
[ "Write", "the", "current", "config", "to", "disk", "to", "store", "them", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/config.py#L231-L251
[ "def", "write_config", "(", "self", ",", "initialize_indices", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "config_dir", ")", ":", "os", ".", "mkdir", "(", "self", ".", "config_dir", ")", "with", "open", "...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
ensure_remote_branch_is_tracked
Track the specified remote branch if it is not already tracked.
git_ready.py
def ensure_remote_branch_is_tracked(branch): """Track the specified remote branch if it is not already tracked.""" if branch == MASTER_BRANCH: # We don't need to explicitly track the master branch, so we're done. return # Ensure the specified branch is in the local branch list. output =...
def ensure_remote_branch_is_tracked(branch): """Track the specified remote branch if it is not already tracked.""" if branch == MASTER_BRANCH: # We don't need to explicitly track the master branch, so we're done. return # Ensure the specified branch is in the local branch list. output =...
[ "Track", "the", "specified", "remote", "branch", "if", "it", "is", "not", "already", "tracked", "." ]
dolph/git-ready
python
https://github.com/dolph/git-ready/blob/4e237efcc9bff2ac7807a74d28fa68cd0081207b/git_ready.py#L23-L42
[ "def", "ensure_remote_branch_is_tracked", "(", "branch", ")", ":", "if", "branch", "==", "MASTER_BRANCH", ":", "# We don't need to explicitly track the master branch, so we're done.", "return", "# Ensure the specified branch is in the local branch list.", "output", "=", "subprocess",...
4e237efcc9bff2ac7807a74d28fa68cd0081207b
valid
main
Checkout, update and branch from the specified branch.
git_ready.py
def main(branch): """Checkout, update and branch from the specified branch.""" try: # Ensure that we're in a git repository. This command is silent unless # you're not actually in a git repository, in which case, you receive a # "Not a git repository" error message. output = subp...
def main(branch): """Checkout, update and branch from the specified branch.""" try: # Ensure that we're in a git repository. This command is silent unless # you're not actually in a git repository, in which case, you receive a # "Not a git repository" error message. output = subp...
[ "Checkout", "update", "and", "branch", "from", "the", "specified", "branch", "." ]
dolph/git-ready
python
https://github.com/dolph/git-ready/blob/4e237efcc9bff2ac7807a74d28fa68cd0081207b/git_ready.py#L45-L77
[ "def", "main", "(", "branch", ")", ":", "try", ":", "# Ensure that we're in a git repository. This command is silent unless", "# you're not actually in a git repository, in which case, you receive a", "# \"Not a git repository\" error message.", "output", "=", "subprocess", ".", "check...
4e237efcc9bff2ac7807a74d28fa68cd0081207b
valid
get_interface_name
Returns the interface name of the first not link_local and not loopback interface.
jackal/scripts/relaying.py
def get_interface_name(): """ Returns the interface name of the first not link_local and not loopback interface. """ interface_name = '' interfaces = psutil.net_if_addrs() for name, details in interfaces.items(): for detail in details: if detail.family == socket.AF_INET: ...
def get_interface_name(): """ Returns the interface name of the first not link_local and not loopback interface. """ interface_name = '' interfaces = psutil.net_if_addrs() for name, details in interfaces.items(): for detail in details: if detail.family == socket.AF_INET: ...
[ "Returns", "the", "interface", "name", "of", "the", "first", "not", "link_local", "and", "not", "loopback", "interface", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L179-L192
[ "def", "get_interface_name", "(", ")", ":", "interface_name", "=", "''", "interfaces", "=", "psutil", ".", "net_if_addrs", "(", ")", "for", "name", ",", "details", "in", "interfaces", ".", "items", "(", ")", ":", "for", "detail", "in", "details", ":", "i...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.load_targets
load_targets will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open.
jackal/scripts/relaying.py
def load_targets(self): """ load_targets will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open. """ ldap_services = [] if self.ldap: ldap_services = self.search.get_services(ports=[389], up=True) self...
def load_targets(self): """ load_targets will load the services with smb signing disabled and if ldap is enabled the services with the ldap port open. """ ldap_services = [] if self.ldap: ldap_services = self.search.get_services(ports=[389], up=True) self...
[ "load_targets", "will", "load", "the", "services", "with", "smb", "signing", "disabled", "and", "if", "ldap", "is", "enabled", "the", "services", "with", "the", "ldap", "port", "open", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L48-L58
[ "def", "load_targets", "(", "self", ")", ":", "ldap_services", "=", "[", "]", "if", "self", ".", "ldap", ":", "ldap_services", "=", "self", ".", "search", ".", "get_services", "(", "ports", "=", "[", "389", "]", ",", "up", "=", "True", ")", "self", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.write_targets
write_targets will write the contents of ips and ldap_strings to the targets_file.
jackal/scripts/relaying.py
def write_targets(self): """ write_targets will write the contents of ips and ldap_strings to the targets_file. """ if len(self.ldap_strings) == 0 and len(self.ips) == 0: print_notification("No targets left") if self.auto_exit: if self.notifier...
def write_targets(self): """ write_targets will write the contents of ips and ldap_strings to the targets_file. """ if len(self.ldap_strings) == 0 and len(self.ips) == 0: print_notification("No targets left") if self.auto_exit: if self.notifier...
[ "write_targets", "will", "write", "the", "contents", "of", "ips", "and", "ldap_strings", "to", "the", "targets_file", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L61-L73
[ "def", "write_targets", "(", "self", ")", ":", "if", "len", "(", "self", ".", "ldap_strings", ")", "==", "0", "and", "len", "(", "self", ".", "ips", ")", "==", "0", ":", "print_notification", "(", "\"No targets left\"", ")", "if", "self", ".", "auto_ex...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.start_processes
Starts the ntlmrelayx.py and responder processes. Assumes you have these programs in your path.
jackal/scripts/relaying.py
def start_processes(self): """ Starts the ntlmrelayx.py and responder processes. Assumes you have these programs in your path. """ self.relay = subprocess.Popen(['ntlmrelayx.py', '-6', '-tf', self.targets_file, '-w', '-l', self.directory, '-of', self.output_file], cwd=sel...
def start_processes(self): """ Starts the ntlmrelayx.py and responder processes. Assumes you have these programs in your path. """ self.relay = subprocess.Popen(['ntlmrelayx.py', '-6', '-tf', self.targets_file, '-w', '-l', self.directory, '-of', self.output_file], cwd=sel...
[ "Starts", "the", "ntlmrelayx", ".", "py", "and", "responder", "processes", ".", "Assumes", "you", "have", "these", "programs", "in", "your", "path", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L76-L82
[ "def", "start_processes", "(", "self", ")", ":", "self", ".", "relay", "=", "subprocess", ".", "Popen", "(", "[", "'ntlmrelayx.py'", ",", "'-6'", ",", "'-tf'", ",", "self", ".", "targets_file", ",", "'-w'", ",", "'-l'", ",", "self", ".", "directory", "...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.callback
Function that gets called on each event from pyinotify.
jackal/scripts/relaying.py
def callback(self, event): """ Function that gets called on each event from pyinotify. """ # IN_CLOSE_WRITE -> 0x00000008 if event.mask == 0x00000008: if event.name.endswith('.json'): print_success("Ldapdomaindump file found") if ev...
def callback(self, event): """ Function that gets called on each event from pyinotify. """ # IN_CLOSE_WRITE -> 0x00000008 if event.mask == 0x00000008: if event.name.endswith('.json'): print_success("Ldapdomaindump file found") if ev...
[ "Function", "that", "gets", "called", "on", "each", "event", "from", "pyinotify", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L85-L117
[ "def", "callback", "(", "self", ",", "event", ")", ":", "# IN_CLOSE_WRITE -> 0x00000008", "if", "event", ".", "mask", "==", "0x00000008", ":", "if", "event", ".", "name", ".", "endswith", "(", "'.json'", ")", ":", "print_success", "(", "\"Ldapdomaindump file f...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.watch
Watches directory for changes
jackal/scripts/relaying.py
def watch(self): """ Watches directory for changes """ wm = pyinotify.WatchManager() self.notifier = pyinotify.Notifier(wm, default_proc_fun=self.callback) wm.add_watch(self.directory, pyinotify.ALL_EVENTS) try: self.notifier.loop() except ...
def watch(self): """ Watches directory for changes """ wm = pyinotify.WatchManager() self.notifier = pyinotify.Notifier(wm, default_proc_fun=self.callback) wm.add_watch(self.directory, pyinotify.ALL_EVENTS) try: self.notifier.loop() except ...
[ "Watches", "directory", "for", "changes" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L120-L133
[ "def", "watch", "(", "self", ")", ":", "wm", "=", "pyinotify", ".", "WatchManager", "(", ")", "self", ".", "notifier", "=", "pyinotify", ".", "Notifier", "(", "wm", ",", "default_proc_fun", "=", "self", ".", "callback", ")", "wm", ".", "add_watch", "("...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.terminate_processes
Terminate the processes.
jackal/scripts/relaying.py
def terminate_processes(self): """ Terminate the processes. """ if self.relay: self.relay.terminate() if self.responder: self.responder.terminate()
def terminate_processes(self): """ Terminate the processes. """ if self.relay: self.relay.terminate() if self.responder: self.responder.terminate()
[ "Terminate", "the", "processes", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L136-L143
[ "def", "terminate_processes", "(", "self", ")", ":", "if", "self", ".", "relay", ":", "self", ".", "relay", ".", "terminate", "(", ")", "if", "self", ".", "responder", ":", "self", ".", "responder", ".", "terminate", "(", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Spoofing.wait
This function waits for the relay and responding processes to exit. Captures KeyboardInterrupt to shutdown these processes.
jackal/scripts/relaying.py
def wait(self): """ This function waits for the relay and responding processes to exit. Captures KeyboardInterrupt to shutdown these processes. """ try: self.relay.wait() self.responder.wait() except KeyboardInterrupt: print_not...
def wait(self): """ This function waits for the relay and responding processes to exit. Captures KeyboardInterrupt to shutdown these processes. """ try: self.relay.wait() self.responder.wait() except KeyboardInterrupt: print_not...
[ "This", "function", "waits", "for", "the", "relay", "and", "responding", "processes", "to", "exit", ".", "Captures", "KeyboardInterrupt", "to", "shutdown", "these", "processes", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L146-L157
[ "def", "wait", "(", "self", ")", ":", "try", ":", "self", ".", "relay", ".", "wait", "(", ")", "self", ".", "responder", ".", "wait", "(", ")", "except", "KeyboardInterrupt", ":", "print_notification", "(", "\"Stopping\"", ")", "finally", ":", "self", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
QueryPrototype.getAnnotations
Retrieve annotations from the query provider :param targets: The CTS URN(s) to query as the target of annotations :type targets: [MyCapytain.common.reference.URN], URN or None :param wildcard: Wildcard specifier for how to match the URN :type wildcard: str :param include: URI(s)...
flask_nemo/query/proto.py
def getAnnotations(self, targets, wildcard=".", include=None, exclude=None, limit=None, start=1, expand=False, **kwargs): """ Retrieve annotations from the query provider :param targets: The CTS URN(s) to query as the target of annotations :type targets: [MyCapytain.commo...
def getAnnotations(self, targets, wildcard=".", include=None, exclude=None, limit=None, start=1, expand=False, **kwargs): """ Retrieve annotations from the query provider :param targets: The CTS URN(s) to query as the target of annotations :type targets: [MyCapytain.commo...
[ "Retrieve", "annotations", "from", "the", "query", "provider" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/proto.py#L23-L58
[ "def", "getAnnotations", "(", "self", ",", "targets", ",", "wildcard", "=", "\".\"", ",", "include", "=", "None", ",", "exclude", "=", "None", ",", "limit", "=", "None", ",", "start", "=", "1", ",", "expand", "=", "False", ",", "*", "*", "kwargs", ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
Breadcrumb.render
Make breadcrumbs for a route :param kwargs: dictionary of named arguments used to construct the view :type kwargs: dict :return: List of dict items the view can use to construct the link. :rtype: {str: list({ "link": str, "title", str, "args", dict})}
flask_nemo/plugins/default.py
def render(self, **kwargs): """ Make breadcrumbs for a route :param kwargs: dictionary of named arguments used to construct the view :type kwargs: dict :return: List of dict items the view can use to construct the link. :rtype: {str: list({ "link": str, "title", str, "args", dic...
def render(self, **kwargs): """ Make breadcrumbs for a route :param kwargs: dictionary of named arguments used to construct the view :type kwargs: dict :return: List of dict items the view can use to construct the link. :rtype: {str: list({ "link": str, "title", str, "args", dic...
[ "Make", "breadcrumbs", "for", "a", "route" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/plugins/default.py#L17-L63
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "breadcrumbs", "=", "[", "]", "# this is the list of items we want to accumulate in the breadcrumb trail.", "# item[0] is the key into the kwargs[\"url\"] object and item[1] is the name of the route", "# setting a rout...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
main
This function obtains hosts from core and starts a nessus scan on these hosts. The nessus tag is appended to the host tags.
jackal/scripts/nessus.py
def main(): """ This function obtains hosts from core and starts a nessus scan on these hosts. The nessus tag is appended to the host tags. """ config = Config() core = HostSearch() hosts = core.get_hosts(tags=['!nessus'], up=True) hosts = [host for host in hosts] host_ips = ...
def main(): """ This function obtains hosts from core and starts a nessus scan on these hosts. The nessus tag is appended to the host tags. """ config = Config() core = HostSearch() hosts = core.get_hosts(tags=['!nessus'], up=True) hosts = [host for host in hosts] host_ips = ...
[ "This", "function", "obtains", "hosts", "from", "core", "and", "starts", "a", "nessus", "scan", "on", "these", "hosts", ".", "The", "nessus", "tag", "is", "appended", "to", "the", "host", "tags", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L61-L86
[ "def", "main", "(", ")", ":", "config", "=", "Config", "(", ")", "core", "=", "HostSearch", "(", ")", "hosts", "=", "core", ".", "get_hosts", "(", "tags", "=", "[", "'!nessus'", "]", ",", "up", "=", "True", ")", "hosts", "=", "[", "host", "for", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Nessus.get_template_uuid
Retrieves the uuid of the given template name.
jackal/scripts/nessus.py
def get_template_uuid(self): """ Retrieves the uuid of the given template name. """ response = requests.get(self.url + 'editor/scan/templates', headers=self.headers, verify=False) templates = json.loads(response.text) for template in templates['templates']: ...
def get_template_uuid(self): """ Retrieves the uuid of the given template name. """ response = requests.get(self.url + 'editor/scan/templates', headers=self.headers, verify=False) templates = json.loads(response.text) for template in templates['templates']: ...
[ "Retrieves", "the", "uuid", "of", "the", "given", "template", "name", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L24-L32
[ "def", "get_template_uuid", "(", "self", ")", ":", "response", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'editor/scan/templates'", ",", "headers", "=", "self", ".", "headers", ",", "verify", "=", "False", ")", "templates", "=", "json", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Nessus.create_scan
Creates a scan with the given host ips Returns the scan id of the created object.
jackal/scripts/nessus.py
def create_scan(self, host_ips): """ Creates a scan with the given host ips Returns the scan id of the created object. """ now = datetime.datetime.now() data = { "uuid": self.get_template_uuid(), "settings": { "name": "jacka...
def create_scan(self, host_ips): """ Creates a scan with the given host ips Returns the scan id of the created object. """ now = datetime.datetime.now() data = { "uuid": self.get_template_uuid(), "settings": { "name": "jacka...
[ "Creates", "a", "scan", "with", "the", "given", "host", "ips", "Returns", "the", "scan", "id", "of", "the", "created", "object", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L35-L51
[ "def", "create_scan", "(", "self", ",", "host_ips", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "data", "=", "{", "\"uuid\"", ":", "self", ".", "get_template_uuid", "(", ")", ",", "\"settings\"", ":", "{", "\"name\"", ":", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Nessus.start_scan
Starts the scan identified by the scan_id.s
jackal/scripts/nessus.py
def start_scan(self, scan_id): """ Starts the scan identified by the scan_id.s """ requests.post(self.url + 'scans/{}/launch'.format(scan_id), verify=False, headers=self.headers)
def start_scan(self, scan_id): """ Starts the scan identified by the scan_id.s """ requests.post(self.url + 'scans/{}/launch'.format(scan_id), verify=False, headers=self.headers)
[ "Starts", "the", "scan", "identified", "by", "the", "scan_id", ".", "s" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nessus.py#L54-L58
[ "def", "start_scan", "(", "self", ",", "scan_id", ")", ":", "requests", ".", "post", "(", "self", ".", "url", "+", "'scans/{}/launch'", ".", "format", "(", "scan_id", ")", ",", "verify", "=", "False", ",", "headers", "=", "self", ".", "headers", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
stable
r""" rankings[(a, n)] = partner that a ranked n^th >>> from itertools import product >>> A = ['1','2','3','4','5','6'] >>> B = ['a','b','c','d','e','f'] >>> rank = dict() >>> rank['1'] = (1,4,2,6,5,3) >>> rank['2'] = (3,1,2,4,5,6) >>> rank['3'] = (1,2,4,3,5,6) >>> rank['4'] = (4,1,2,5,3,6) >>> rank...
pysyncml/smp.py
def stable(rankings, A, B): r""" rankings[(a, n)] = partner that a ranked n^th >>> from itertools import product >>> A = ['1','2','3','4','5','6'] >>> B = ['a','b','c','d','e','f'] >>> rank = dict() >>> rank['1'] = (1,4,2,6,5,3) >>> rank['2'] = (3,1,2,4,5,6) >>> rank['3'] = (1,2,4,3,5,6) >>> rank['...
def stable(rankings, A, B): r""" rankings[(a, n)] = partner that a ranked n^th >>> from itertools import product >>> A = ['1','2','3','4','5','6'] >>> B = ['a','b','c','d','e','f'] >>> rank = dict() >>> rank['1'] = (1,4,2,6,5,3) >>> rank['2'] = (3,1,2,4,5,6) >>> rank['3'] = (1,2,4,3,5,6) >>> rank['...
[ "r", "rankings", "[", "(", "a", "n", ")", "]", "=", "partner", "that", "a", "ranked", "n^th" ]
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/smp.py#L81-L124
[ "def", "stable", "(", "rankings", ",", "A", ",", "B", ")", ":", "partners", "=", "dict", "(", "(", "a", ",", "(", "rankings", "[", "(", "a", ",", "1", ")", "]", ",", "1", ")", ")", "for", "a", "in", "A", ")", "is_stable", "=", "False", "# w...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
cmpToDataStore_uri
Bases the comparison of the datastores on URI alone.
pysyncml/matcher.py
def cmpToDataStore_uri(base, ds1, ds2): '''Bases the comparison of the datastores on URI alone.''' ret = difflib.get_close_matches(base.uri, [ds1.uri, ds2.uri], 1, cutoff=0.5) if len(ret) <= 0: return 0 if ret[0] == ds1.uri: return -1 return 1
def cmpToDataStore_uri(base, ds1, ds2): '''Bases the comparison of the datastores on URI alone.''' ret = difflib.get_close_matches(base.uri, [ds1.uri, ds2.uri], 1, cutoff=0.5) if len(ret) <= 0: return 0 if ret[0] == ds1.uri: return -1 return 1
[ "Bases", "the", "comparison", "of", "the", "datastores", "on", "URI", "alone", "." ]
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/matcher.py#L81-L88
[ "def", "cmpToDataStore_uri", "(", "base", ",", "ds1", ",", "ds2", ")", ":", "ret", "=", "difflib", ".", "get_close_matches", "(", "base", ".", "uri", ",", "[", "ds1", ".", "uri", ",", "ds2", ".", "uri", "]", ",", "1", ",", "cutoff", "=", "0.5", "...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
JackalDoc.add_tag
Adds a tag to the list of tags and makes sure the result list contains only unique results.
jackal/documents.py
def add_tag(self, tag): """ Adds a tag to the list of tags and makes sure the result list contains only unique results. """ self.tags = list(set(self.tags or []) | set([tag]))
def add_tag(self, tag): """ Adds a tag to the list of tags and makes sure the result list contains only unique results. """ self.tags = list(set(self.tags or []) | set([tag]))
[ "Adds", "a", "tag", "to", "the", "list", "of", "tags", "and", "makes", "sure", "the", "result", "list", "contains", "only", "unique", "results", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L24-L28
[ "def", "add_tag", "(", "self", ",", "tag", ")", ":", "self", ".", "tags", "=", "list", "(", "set", "(", "self", ".", "tags", "or", "[", "]", ")", "|", "set", "(", "[", "tag", "]", ")", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
JackalDoc.remove_tag
Removes a tag from this object
jackal/documents.py
def remove_tag(self, tag): """ Removes a tag from this object """ self.tags = list(set(self.tags or []) - set([tag]))
def remove_tag(self, tag): """ Removes a tag from this object """ self.tags = list(set(self.tags or []) - set([tag]))
[ "Removes", "a", "tag", "from", "this", "object" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L31-L35
[ "def", "remove_tag", "(", "self", ",", "tag", ")", ":", "self", ".", "tags", "=", "list", "(", "set", "(", "self", ".", "tags", "or", "[", "]", ")", "-", "set", "(", "[", "tag", "]", ")", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
JackalDoc.to_dict
Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype.
jackal/documents.py
def to_dict(self, include_meta=False): """ Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype. """ result = super(JackalDoc, self).to_dict(include_meta=include_meta) if include_meta: source = result.pop...
def to_dict(self, include_meta=False): """ Returns the result as a dictionary, provide the include_meta flag to als show information like index and doctype. """ result = super(JackalDoc, self).to_dict(include_meta=include_meta) if include_meta: source = result.pop...
[ "Returns", "the", "result", "as", "a", "dictionary", "provide", "the", "include_meta", "flag", "to", "als", "show", "information", "like", "index", "and", "doctype", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/documents.py#L40-L49
[ "def", "to_dict", "(", "self", ",", "include_meta", "=", "False", ")", ":", "result", "=", "super", "(", "JackalDoc", ",", "self", ")", ".", "to_dict", "(", "include_meta", "=", "include_meta", ")", "if", "include_meta", ":", "source", "=", "result", "."...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
AnnotationsApiPlugin.r_annotations
Route to retrieve annotations by target :param target_urn: The CTS URN for which to retrieve annotations :type target_urn: str :return: a JSON string containing count and list of resources :rtype: {str: Any}
flask_nemo/plugins/annotations_api.py
def r_annotations(self): """ Route to retrieve annotations by target :param target_urn: The CTS URN for which to retrieve annotations :type target_urn: str :return: a JSON string containing count and list of resources :rtype: {str: Any} """ target = request.ar...
def r_annotations(self): """ Route to retrieve annotations by target :param target_urn: The CTS URN for which to retrieve annotations :type target_urn: str :return: a JSON string containing count and list of resources :rtype: {str: Any} """ target = request.ar...
[ "Route", "to", "retrieve", "annotations", "by", "target" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/plugins/annotations_api.py#L42-L95
[ "def", "r_annotations", "(", "self", ")", ":", "target", "=", "request", ".", "args", ".", "get", "(", "\"target\"", ",", "None", ")", "wildcard", "=", "request", ".", "args", ".", "get", "(", "\"wildcard\"", ",", "\".\"", ",", "type", "=", "str", ")...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
AnnotationsApiPlugin.r_annotation
Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any}
flask_nemo/plugins/annotations_api.py
def r_annotation(self, sha): """ Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any} """ annotation = self.__queryinterface__.getResource(sha) i...
def r_annotation(self, sha): """ Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any} """ annotation = self.__queryinterface__.getResource(sha) i...
[ "Route", "to", "retrieve", "contents", "of", "an", "annotation", "resource" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/plugins/annotations_api.py#L97-L118
[ "def", "r_annotation", "(", "self", ",", "sha", ")", ":", "annotation", "=", "self", ".", "__queryinterface__", ".", "getResource", "(", "sha", ")", "if", "not", "annotation", ":", "return", "\"invalid resource uri\"", ",", "404", "response", "=", "{", "\"@c...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
AnnotationsApiPlugin.r_annotation_body
Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any}
flask_nemo/plugins/annotations_api.py
def r_annotation_body(self, sha): """ Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any} """ annotation = self.__queryinterface__.getResource(sha) ...
def r_annotation_body(self, sha): """ Route to retrieve contents of an annotation resource :param uri: The uri of the annotation resource :type uri: str :return: annotation contents :rtype: {str: Any} """ annotation = self.__queryinterface__.getResource(sha) ...
[ "Route", "to", "retrieve", "contents", "of", "an", "annotation", "resource" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/plugins/annotations_api.py#L120-L138
[ "def", "r_annotation_body", "(", "self", ",", "sha", ")", ":", "annotation", "=", "self", ".", "__queryinterface__", ".", "getResource", "(", "sha", ")", "if", "not", "annotation", ":", "return", "\"invalid resource uri\"", ",", "404", "# TODO this should inspect ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
describeStats
Renders an ASCII-table of the synchronization statistics `stats`, example output: .. code-block:: +----------------------------------------------------------------------------------+ | TITLE | +----------+------+---------------...
pysyncml/common.py
def describeStats(stats, stream, title=None, details=True, totals=True, gettext=None): ''' Renders an ASCII-table of the synchronization statistics `stats`, example output: .. code-block:: +----------------------------------------------------------------------------------+ | ...
def describeStats(stats, stream, title=None, details=True, totals=True, gettext=None): ''' Renders an ASCII-table of the synchronization statistics `stats`, example output: .. code-block:: +----------------------------------------------------------------------------------+ | ...
[ "Renders", "an", "ASCII", "-", "table", "of", "the", "synchronization", "statistics", "stats", "example", "output", ":" ]
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/common.py#L211-L459
[ "def", "describeStats", "(", "stats", ",", "stream", ",", "title", "=", "None", ",", "details", "=", "True", ",", "totals", "=", "True", ",", "gettext", "=", "None", ")", ":", "from", ".", "import", "state", "modeStringLut", "=", "dict", "(", "(", "(...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Enum.lookup
Returns the label for a given Enum key
enum21/__init__.py
def lookup(cls, key, get=False): """Returns the label for a given Enum key""" if get: item = cls._item_dict.get(key) return item.name if item else key return cls._item_dict[key].name
def lookup(cls, key, get=False): """Returns the label for a given Enum key""" if get: item = cls._item_dict.get(key) return item.name if item else key return cls._item_dict[key].name
[ "Returns", "the", "label", "for", "a", "given", "Enum", "key" ]
bmorgan21/python-enum
python
https://github.com/bmorgan21/python-enum/blob/91a3a3cbaddce5db5fe3ac09dfd60b89cb8e22f4/enum21/__init__.py#L229-L234
[ "def", "lookup", "(", "cls", ",", "key", ",", "get", "=", "False", ")", ":", "if", "get", ":", "item", "=", "cls", ".", "_item_dict", ".", "get", "(", "key", ")", "return", "item", ".", "name", "if", "item", "else", "key", "return", "cls", ".", ...
91a3a3cbaddce5db5fe3ac09dfd60b89cb8e22f4
valid
Enum.verbose
Returns the verbose name for a given enum value
enum21/__init__.py
def verbose(cls, key=False, default=''): """Returns the verbose name for a given enum value""" if key is False: items = cls._item_dict.values() return [(x.key, x.value) for x in sorted(items, key=lambda x:x.sort or x.key)] item = cls._item_dict.get(key) return it...
def verbose(cls, key=False, default=''): """Returns the verbose name for a given enum value""" if key is False: items = cls._item_dict.values() return [(x.key, x.value) for x in sorted(items, key=lambda x:x.sort or x.key)] item = cls._item_dict.get(key) return it...
[ "Returns", "the", "verbose", "name", "for", "a", "given", "enum", "value" ]
bmorgan21/python-enum
python
https://github.com/bmorgan21/python-enum/blob/91a3a3cbaddce5db5fe3ac09dfd60b89cb8e22f4/enum21/__init__.py#L252-L259
[ "def", "verbose", "(", "cls", ",", "key", "=", "False", ",", "default", "=", "''", ")", ":", "if", "key", "is", "False", ":", "items", "=", "cls", ".", "_item_dict", ".", "values", "(", ")", "return", "[", "(", "x", ".", "key", ",", "x", ".", ...
91a3a3cbaddce5db5fe3ac09dfd60b89cb8e22f4
valid
get_configured_dns
Returns the configured DNS servers with the use f nmcli.
jackal/scripts/dns_discover.py
def get_configured_dns(): """ Returns the configured DNS servers with the use f nmcli. """ ips = [] try: output = subprocess.check_output(['nmcli', 'device', 'show']) output = output.decode('utf-8') for line in output.split('\n'): if 'DNS' in line: ...
def get_configured_dns(): """ Returns the configured DNS servers with the use f nmcli. """ ips = [] try: output = subprocess.check_output(['nmcli', 'device', 'show']) output = output.decode('utf-8') for line in output.split('\n'): if 'DNS' in line: ...
[ "Returns", "the", "configured", "DNS", "servers", "with", "the", "use", "f", "nmcli", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L15-L31
[ "def", "get_configured_dns", "(", ")", ":", "ips", "=", "[", "]", "try", ":", "output", "=", "subprocess", ".", "check_output", "(", "[", "'nmcli'", ",", "'device'", ",", "'show'", "]", ")", "output", "=", "output", ".", "decode", "(", "'utf-8'", ")", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
get_resolv_dns
Returns the dns servers configured in /etc/resolv.conf
jackal/scripts/dns_discover.py
def get_resolv_dns(): """ Returns the dns servers configured in /etc/resolv.conf """ result = [] try: for line in open('/etc/resolv.conf', 'r'): if line.startswith('search'): result.append(line.strip().split(' ')[1]) except FileNotFoundError: pass ...
def get_resolv_dns(): """ Returns the dns servers configured in /etc/resolv.conf """ result = [] try: for line in open('/etc/resolv.conf', 'r'): if line.startswith('search'): result.append(line.strip().split(' ')[1]) except FileNotFoundError: pass ...
[ "Returns", "the", "dns", "servers", "configured", "in", "/", "etc", "/", "resolv", ".", "conf" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L34-L45
[ "def", "get_resolv_dns", "(", ")", ":", "result", "=", "[", "]", "try", ":", "for", "line", "in", "open", "(", "'/etc/resolv.conf'", ",", "'r'", ")", ":", "if", "line", ".", "startswith", "(", "'search'", ")", ":", "result", ".", "append", "(", "line...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
zone_transfer
Tries to perform a zone transfer.
jackal/scripts/dns_discover.py
def zone_transfer(address, dns_name): """ Tries to perform a zone transfer. """ ips = [] try: print_notification("Attempting dns zone transfer for {} on {}".format(dns_name, address)) z = dns.zone.from_xfr(dns.query.xfr(address, dns_name)) except dns.exception.FormError: ...
def zone_transfer(address, dns_name): """ Tries to perform a zone transfer. """ ips = [] try: print_notification("Attempting dns zone transfer for {} on {}".format(dns_name, address)) z = dns.zone.from_xfr(dns.query.xfr(address, dns_name)) except dns.exception.FormError: ...
[ "Tries", "to", "perform", "a", "zone", "transfer", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L48-L70
[ "def", "zone_transfer", "(", "address", ",", "dns_name", ")", ":", "ips", "=", "[", "]", "try", ":", "print_notification", "(", "\"Attempting dns zone transfer for {} on {}\"", ".", "format", "(", "dns_name", ",", "address", ")", ")", "z", "=", "dns", ".", "...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
resolve_domains
Resolves the list of domains and returns the ips.
jackal/scripts/dns_discover.py
def resolve_domains(domains, disable_zone=False): """ Resolves the list of domains and returns the ips. """ dnsresolver = dns.resolver.Resolver() ips = [] for domain in domains: print_notification("Resolving {}".format(domain)) try: result = dnsresolver.query(do...
def resolve_domains(domains, disable_zone=False): """ Resolves the list of domains and returns the ips. """ dnsresolver = dns.resolver.Resolver() ips = [] for domain in domains: print_notification("Resolving {}".format(domain)) try: result = dnsresolver.query(do...
[ "Resolves", "the", "list", "of", "domains", "and", "returns", "the", "ips", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L73-L91
[ "def", "resolve_domains", "(", "domains", ",", "disable_zone", "=", "False", ")", ":", "dnsresolver", "=", "dns", ".", "resolver", ".", "Resolver", "(", ")", "ips", "=", "[", "]", "for", "domain", "in", "domains", ":", "print_notification", "(", "\"Resolvi...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
parse_ips
Parses the list of ips, turns these into ranges based on the netmask given. Set include_public to True to include public IP adresses.
jackal/scripts/dns_discover.py
def parse_ips(ips, netmask, include_public): """ Parses the list of ips, turns these into ranges based on the netmask given. Set include_public to True to include public IP adresses. """ hs = HostSearch() rs = RangeSearch() ranges = [] ips = list(set(ips)) included_ips = [] ...
def parse_ips(ips, netmask, include_public): """ Parses the list of ips, turns these into ranges based on the netmask given. Set include_public to True to include public IP adresses. """ hs = HostSearch() rs = RangeSearch() ranges = [] ips = list(set(ips)) included_ips = [] ...
[ "Parses", "the", "list", "of", "ips", "turns", "these", "into", "ranges", "based", "on", "the", "netmask", "given", ".", "Set", "include_public", "to", "True", "to", "include", "public", "IP", "adresses", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/dns_discover.py#L94-L133
[ "def", "parse_ips", "(", "ips", ",", "netmask", ",", "include_public", ")", ":", "hs", "=", "HostSearch", "(", ")", "rs", "=", "RangeSearch", "(", ")", "ranges", "=", "[", "]", "ips", "=", "list", "(", "set", "(", "ips", ")", ")", "included_ips", "...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
create_connection
Creates a connection based upon the given configuration object.
jackal/core.py
def create_connection(conf): """ Creates a connection based upon the given configuration object. """ host_config = {} host_config['hosts'] = [conf.get('jackal', 'host')] if int(conf.get('jackal', 'use_ssl')): host_config['use_ssl'] = True if conf.get('jackal', 'ca_certs'): ...
def create_connection(conf): """ Creates a connection based upon the given configuration object. """ host_config = {} host_config['hosts'] = [conf.get('jackal', 'host')] if int(conf.get('jackal', 'use_ssl')): host_config['use_ssl'] = True if conf.get('jackal', 'ca_certs'): ...
[ "Creates", "a", "connection", "based", "upon", "the", "given", "configuration", "object", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L21-L38
[ "def", "create_connection", "(", "conf", ")", ":", "host_config", "=", "{", "}", "host_config", "[", "'hosts'", "]", "=", "[", "conf", ".", "get", "(", "'jackal'", ",", "'host'", ")", "]", "if", "int", "(", "conf", ".", "get", "(", "'jackal'", ",", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CoreSearch.search
Searches the elasticsearch instance to retrieve the requested documents.
jackal/core.py
def search(self, number=None, *args, **kwargs): """ Searches the elasticsearch instance to retrieve the requested documents. """ search = self.create_search(*args, **kwargs) try: if number: response = search[0:number] else: ...
def search(self, number=None, *args, **kwargs): """ Searches the elasticsearch instance to retrieve the requested documents. """ search = self.create_search(*args, **kwargs) try: if number: response = search[0:number] else: ...
[ "Searches", "the", "elasticsearch", "instance", "to", "retrieve", "the", "requested", "documents", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L55-L76
[ "def", "search", "(", "self", ",", "number", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "search", "=", "self", ".", "create_search", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "if", "number", ":", "response...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CoreSearch.argument_search
Uses the command line arguments to fill the search function and call it.
jackal/core.py
def argument_search(self): """ Uses the command line arguments to fill the search function and call it. """ arguments, _ = self.argparser.parse_known_args() return self.search(**vars(arguments))
def argument_search(self): """ Uses the command line arguments to fill the search function and call it. """ arguments, _ = self.argparser.parse_known_args() return self.search(**vars(arguments))
[ "Uses", "the", "command", "line", "arguments", "to", "fill", "the", "search", "function", "and", "call", "it", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L79-L84
[ "def", "argument_search", "(", "self", ")", ":", "arguments", ",", "_", "=", "self", ".", "argparser", ".", "parse_known_args", "(", ")", "return", "self", ".", "search", "(", "*", "*", "vars", "(", "arguments", ")", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CoreSearch.count
Returns the number of results after filtering with the given arguments.
jackal/core.py
def count(self, *args, **kwargs): """ Returns the number of results after filtering with the given arguments. """ search = self.create_search(*args, **kwargs) try: return search.count() except NotFoundError: print_error("The index was not found...
def count(self, *args, **kwargs): """ Returns the number of results after filtering with the given arguments. """ search = self.create_search(*args, **kwargs) try: return search.count() except NotFoundError: print_error("The index was not found...
[ "Returns", "the", "number", "of", "results", "after", "filtering", "with", "the", "given", "arguments", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L87-L97
[ "def", "count", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "search", "=", "self", ".", "create_search", "(", "*", "args", ",", "*", "*", "kwargs", ")", "try", ":", "return", "search", ".", "count", "(", ")", "except", "NotF...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CoreSearch.argument_count
Uses the command line arguments to fill the count function and call it.
jackal/core.py
def argument_count(self): """ Uses the command line arguments to fill the count function and call it. """ arguments, _ = self.argparser.parse_known_args() return self.count(**vars(arguments))
def argument_count(self): """ Uses the command line arguments to fill the count function and call it. """ arguments, _ = self.argparser.parse_known_args() return self.count(**vars(arguments))
[ "Uses", "the", "command", "line", "arguments", "to", "fill", "the", "count", "function", "and", "call", "it", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L100-L105
[ "def", "argument_count", "(", "self", ")", ":", "arguments", ",", "_", "=", "self", ".", "argparser", ".", "parse_known_args", "(", ")", "return", "self", ".", "count", "(", "*", "*", "vars", "(", "arguments", ")", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CoreSearch.get_pipe
Returns a generator that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json.
jackal/core.py
def get_pipe(self, object_type): """ Returns a generator that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json. """ for line in sys.stdin: try: data = json.loads(line.strip(...
def get_pipe(self, object_type): """ Returns a generator that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json. """ for line in sys.stdin: try: data = json.loads(line.strip(...
[ "Returns", "a", "generator", "that", "maps", "the", "input", "of", "the", "pipe", "to", "an", "elasticsearch", "object", ".", "Will", "call", "id_to_object", "if", "it", "cannot", "serialize", "the", "data", "from", "json", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L129-L140
[ "def", "get_pipe", "(", "self", ",", "object_type", ")", ":", "for", "line", "in", "sys", ".", "stdin", ":", "try", ":", "data", "=", "json", ".", "loads", "(", "line", ".", "strip", "(", ")", ")", "obj", "=", "object_type", "(", "*", "*", "data"...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
RangeSearch.id_to_object
Resolves an ip adres to a range object, creating it if it doesn't exists.
jackal/core.py
def id_to_object(self, line): """ Resolves an ip adres to a range object, creating it if it doesn't exists. """ result = Range.get(line, ignore=404) if not result: result = Range(range=line) result.save() return result
def id_to_object(self, line): """ Resolves an ip adres to a range object, creating it if it doesn't exists. """ result = Range.get(line, ignore=404) if not result: result = Range(range=line) result.save() return result
[ "Resolves", "an", "ip", "adres", "to", "a", "range", "object", "creating", "it", "if", "it", "doesn", "t", "exists", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L184-L192
[ "def", "id_to_object", "(", "self", ",", "line", ")", ":", "result", "=", "Range", ".", "get", "(", "line", ",", "ignore", "=", "404", ")", "if", "not", "result", ":", "result", "=", "Range", "(", "range", "=", "line", ")", "result", ".", "save", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
RangeSearch.argparser
Argparser option with search functionality specific for ranges.
jackal/core.py
def argparser(self): """ Argparser option with search functionality specific for ranges. """ core_parser = self.core_parser core_parser.add_argument('-r', '--range', type=str, help="The range to search for use") return core_parser
def argparser(self): """ Argparser option with search functionality specific for ranges. """ core_parser = self.core_parser core_parser.add_argument('-r', '--range', type=str, help="The range to search for use") return core_parser
[ "Argparser", "option", "with", "search", "functionality", "specific", "for", "ranges", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L204-L210
[ "def", "argparser", "(", "self", ")", ":", "core_parser", "=", "self", ".", "core_parser", "core_parser", ".", "add_argument", "(", "'-r'", ",", "'--range'", ",", "type", "=", "str", ",", "help", "=", "\"The range to search for use\"", ")", "return", "core_par...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
ServiceSearch.object_to_id
Searches elasticsearch for objects with the same address, protocol, port and state.
jackal/core.py
def object_to_id(self, obj): """ Searches elasticsearch for objects with the same address, protocol, port and state. """ search = Service.search() search = search.filter("term", address=obj.address) search = search.filter("term", protocol=obj.protocol) search ...
def object_to_id(self, obj): """ Searches elasticsearch for objects with the same address, protocol, port and state. """ search = Service.search() search = search.filter("term", address=obj.address) search = search.filter("term", protocol=obj.protocol) search ...
[ "Searches", "elasticsearch", "for", "objects", "with", "the", "same", "address", "protocol", "port", "and", "state", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L334-L347
[ "def", "object_to_id", "(", "self", ",", "obj", ")", ":", "search", "=", "Service", ".", "search", "(", ")", "search", "=", "search", ".", "filter", "(", "\"term\"", ",", "address", "=", "obj", ".", "address", ")", "search", "=", "search", ".", "filt...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
UserSearch.id_to_object
Resolves the given id to a user object, if it doesn't exists it will be created.
jackal/core.py
def id_to_object(self, line): """ Resolves the given id to a user object, if it doesn't exists it will be created. """ user = User.get(line, ignore=404) if not user: user = User(username=line) user.save() return user
def id_to_object(self, line): """ Resolves the given id to a user object, if it doesn't exists it will be created. """ user = User.get(line, ignore=404) if not user: user = User(username=line) user.save() return user
[ "Resolves", "the", "given", "id", "to", "a", "user", "object", "if", "it", "doesn", "t", "exists", "it", "will", "be", "created", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L393-L401
[ "def", "id_to_object", "(", "self", ",", "line", ")", ":", "user", "=", "User", ".", "get", "(", "line", ",", "ignore", "=", "404", ")", "if", "not", "user", ":", "user", "=", "User", "(", "username", "=", "line", ")", "user", ".", "save", "(", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
UserSearch.get_users
Retrieves the users from elastic.
jackal/core.py
def get_users(self, *args, **kwargs): """ Retrieves the users from elastic. """ arguments, _ = self.argparser.parse_known_args() if self.is_pipe and self.use_pipe: return self.get_pipe(self.object_type) elif arguments.tags or arguments.group or arguments.s...
def get_users(self, *args, **kwargs): """ Retrieves the users from elastic. """ arguments, _ = self.argparser.parse_known_args() if self.is_pipe and self.use_pipe: return self.get_pipe(self.object_type) elif arguments.tags or arguments.group or arguments.s...
[ "Retrieves", "the", "users", "from", "elastic", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L413-L423
[ "def", "get_users", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "arguments", ",", "_", "=", "self", ".", "argparser", ".", "parse_known_args", "(", ")", "if", "self", ".", "is_pipe", "and", "self", ".", "use_pipe", ":", "return"...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
UserSearch.get_domains
Retrieves the domains of the users from elastic.
jackal/core.py
def get_domains(self): """ Retrieves the domains of the users from elastic. """ search = User.search() search.aggs.bucket('domains', 'terms', field='domain', order={'_count': 'desc'}, size=100) response = search.execute() return [entry.key for entry in respons...
def get_domains(self): """ Retrieves the domains of the users from elastic. """ search = User.search() search.aggs.bucket('domains', 'terms', field='domain', order={'_count': 'desc'}, size=100) response = search.execute() return [entry.key for entry in respons...
[ "Retrieves", "the", "domains", "of", "the", "users", "from", "elastic", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L434-L441
[ "def", "get_domains", "(", "self", ")", ":", "search", "=", "User", ".", "search", "(", ")", "search", ".", "aggs", ".", "bucket", "(", "'domains'", ",", "'terms'", ",", "field", "=", "'domain'", ",", "order", "=", "{", "'_count'", ":", "'desc'", "}"...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CredentialSearch.find_object
Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id.
jackal/core.py
def find_object(self, username, secret, domain=None, host_ip=None, service_id=None): """ Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id. """ # Not sure yet if this is advisable... Older passwords can be overwritten... ...
def find_object(self, username, secret, domain=None, host_ip=None, service_id=None): """ Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id. """ # Not sure yet if this is advisable... Older passwords can be overwritten... ...
[ "Searches", "elasticsearch", "for", "objects", "with", "the", "same", "username", "password", "optional", "domain", "host_ip", "and", "service_id", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L495-L519
[ "def", "find_object", "(", "self", ",", "username", ",", "secret", ",", "domain", "=", "None", ",", "host_ip", "=", "None", ",", "service_id", "=", "None", ")", ":", "# Not sure yet if this is advisable... Older passwords can be overwritten...", "search", "=", "Cred...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CredentialSearch.object_to_id
Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id.
jackal/core.py
def object_to_id(self, obj): """ Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id. """ # Not sure yet if this is advisable... Older passwords can be overwritten... search = Credential.search() search = search...
def object_to_id(self, obj): """ Searches elasticsearch for objects with the same username, password, optional domain, host_ip and service_id. """ # Not sure yet if this is advisable... Older passwords can be overwritten... search = Credential.search() search = search...
[ "Searches", "elasticsearch", "for", "objects", "with", "the", "same", "username", "password", "optional", "domain", "host_ip", "and", "service_id", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L522-L546
[ "def", "object_to_id", "(", "self", ",", "obj", ")", ":", "# Not sure yet if this is advisable... Older passwords can be overwritten...", "search", "=", "Credential", ".", "search", "(", ")", "search", "=", "search", ".", "filter", "(", "\"term\"", ",", "username", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
CredentialSearch.get_credentials
Retrieves the users from elastic.
jackal/core.py
def get_credentials(self, *args, **kwargs): """ Retrieves the users from elastic. """ arguments, _ = self.argparser.parse_known_args() if self.is_pipe and self.use_pipe: return self.get_pipe(self.object_type) elif arguments.tags or arguments.type or argume...
def get_credentials(self, *args, **kwargs): """ Retrieves the users from elastic. """ arguments, _ = self.argparser.parse_known_args() if self.is_pipe and self.use_pipe: return self.get_pipe(self.object_type) elif arguments.tags or arguments.type or argume...
[ "Retrieves", "the", "users", "from", "elastic", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L549-L559
[ "def", "get_credentials", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "arguments", ",", "_", "=", "self", ".", "argparser", ".", "parse_known_args", "(", ")", "if", "self", ".", "is_pipe", "and", "self", ".", "use_pipe", ":", "r...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
DocMapper.get_pipe
Returns a list that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json.
jackal/core.py
def get_pipe(self): """ Returns a list that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json. """ lines = [] for line in sys.stdin: try: lines.append(self.line_to_ob...
def get_pipe(self): """ Returns a list that maps the input of the pipe to an elasticsearch object. Will call id_to_object if it cannot serialize the data from json. """ lines = [] for line in sys.stdin: try: lines.append(self.line_to_ob...
[ "Returns", "a", "list", "that", "maps", "the", "input", "of", "the", "pipe", "to", "an", "elasticsearch", "object", ".", "Will", "call", "id_to_object", "if", "it", "cannot", "serialize", "the", "data", "from", "json", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/core.py#L610-L623
[ "def", "get_pipe", "(", "self", ")", ":", "lines", "=", "[", "]", "for", "line", "in", "sys", ".", "stdin", ":", "try", ":", "lines", ".", "append", "(", "self", ".", "line_to_object", "(", "line", ".", "strip", "(", ")", ")", ")", "except", "Val...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
Protocol.commands2tree
Consumes state.Command commands and converts them to an ET protocol tree
pysyncml/protocol.py
def commands2tree(self, adapter, session, commands): '''Consumes state.Command commands and converts them to an ET protocol tree''' # todo: trap errors... hdrcmd = commands[0] commands = commands[1:] if hdrcmd.name != constants.CMD_SYNCHDR: raise common.InternalError('unexpected first comma...
def commands2tree(self, adapter, session, commands): '''Consumes state.Command commands and converts them to an ET protocol tree''' # todo: trap errors... hdrcmd = commands[0] commands = commands[1:] if hdrcmd.name != constants.CMD_SYNCHDR: raise common.InternalError('unexpected first comma...
[ "Consumes", "state", ".", "Command", "commands", "and", "converts", "them", "to", "an", "ET", "protocol", "tree" ]
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/protocol.py#L184-L380
[ "def", "commands2tree", "(", "self", ",", "adapter", ",", "session", ",", "commands", ")", ":", "# todo: trap errors...", "hdrcmd", "=", "commands", "[", "0", "]", "commands", "=", "commands", "[", "1", ":", "]", "if", "hdrcmd", ".", "name", "!=", "const...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Protocol.tree2commands
Consumes an ET protocol tree and converts it to state.Command commands
pysyncml/protocol.py
def tree2commands(self, adapter, session, lastcmds, xsync): '''Consumes an ET protocol tree and converts it to state.Command commands''' # do some preliminary sanity checks... # todo: do i really want to be using assert statements?... assert xsync.tag == constants.NODE_SYNCML assert len(xsync) == ...
def tree2commands(self, adapter, session, lastcmds, xsync): '''Consumes an ET protocol tree and converts it to state.Command commands''' # do some preliminary sanity checks... # todo: do i really want to be using assert statements?... assert xsync.tag == constants.NODE_SYNCML assert len(xsync) == ...
[ "Consumes", "an", "ET", "protocol", "tree", "and", "converts", "it", "to", "state", ".", "Command", "commands" ]
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/protocol.py#L383-L440
[ "def", "tree2commands", "(", "self", ",", "adapter", ",", "session", ",", "lastcmds", ",", "xsync", ")", ":", "# do some preliminary sanity checks...", "# todo: do i really want to be using assert statements?...", "assert", "xsync", ".", "tag", "==", "constants", ".", "...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Item.dumps
[OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provided content-type should be overridden or enhanced. The default impl...
pysyncml/items/base.py
def dumps(self, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provided conten...
def dumps(self, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provided conten...
[ "[", "OPTIONAL", "]", "Identical", "to", ":", "meth", ":", "dump", "except", "the", "serialized", "form", "is", "returned", "as", "a", "string", "representation", ".", "As", "documented", "in", ":", "meth", ":", "dump", "the", "return", "value", "can", "...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/base.py#L70-L83
[ "def", "dumps", "(", "self", ",", "contentType", "=", "None", ",", "version", "=", "None", ")", ":", "buf", "=", "six", ".", "StringIO", "(", ")", "ret", "=", "self", ".", "dump", "(", "buf", ",", "contentType", ",", "version", ")", "if", "ret", ...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Item.loads
[OPTIONAL] Identical to :meth:`load`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`load`.
pysyncml/items/base.py
def loads(cls, data, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`load`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`load`. ''' buf = six.StringIO(data) return cls.load...
def loads(cls, data, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`load`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`load`. ''' buf = six.StringIO(data) return cls.load...
[ "[", "OPTIONAL", "]", "Identical", "to", ":", "meth", ":", "load", "except", "the", "serialized", "form", "is", "provided", "as", "a", "string", "representation", "in", "data", "instead", "of", "as", "a", "stream", ".", "The", "default", "implementation", ...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/base.py#L101-L108
[ "def", "loads", "(", "cls", ",", "data", ",", "contentType", "=", "None", ",", "version", "=", "None", ")", ":", "buf", "=", "six", ".", "StringIO", "(", "data", ")", "return", "cls", ".", "load", "(", "buf", ",", "contentType", ",", "version", ")"...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Agent.dumpsItem
[OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provided content-type should be overridden or enhanced. The default impl...
pysyncml/agents/base.py
def dumpsItem(self, item, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provi...
def dumpsItem(self, item, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`dump`, except the serialized form is returned as a string representation. As documented in :meth:`dump`, the return value can optionally be a three-element tuple of (contentType, version, data) if the provi...
[ "[", "OPTIONAL", "]", "Identical", "to", ":", "meth", ":", "dump", "except", "the", "serialized", "form", "is", "returned", "as", "a", "string", "representation", ".", "As", "documented", "in", ":", "meth", ":", "dump", "the", "return", "value", "can", "...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/agents/base.py#L106-L119
[ "def", "dumpsItem", "(", "self", ",", "item", ",", "contentType", "=", "None", ",", "version", "=", "None", ")", ":", "buf", "=", "six", ".", "StringIO", "(", ")", "ret", "=", "self", ".", "dumpItem", "(", "item", ",", "buf", ",", "contentType", ",...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Agent.loadsItem
[OPTIONAL] Identical to :meth:`loadItem`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`loadItem`.
pysyncml/agents/base.py
def loadsItem(self, data, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`loadItem`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`loadItem`. ''' buf = six.StringIO(data) ...
def loadsItem(self, data, contentType=None, version=None): ''' [OPTIONAL] Identical to :meth:`loadItem`, except the serialized form is provided as a string representation in `data` instead of as a stream. The default implementation just wraps :meth:`loadItem`. ''' buf = six.StringIO(data) ...
[ "[", "OPTIONAL", "]", "Identical", "to", ":", "meth", ":", "loadItem", "except", "the", "serialized", "form", "is", "provided", "as", "a", "string", "representation", "in", "data", "instead", "of", "as", "a", "stream", ".", "The", "default", "implementation"...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/agents/base.py#L135-L143
[ "def", "loadsItem", "(", "self", ",", "data", ",", "contentType", "=", "None", ",", "version", "=", "None", ")", ":", "buf", "=", "six", ".", "StringIO", "(", "data", ")", "return", "self", ".", "loadItem", "(", "buf", ",", "contentType", ",", "versi...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
Agent.matchItem
[OPTIONAL] Attempts to find the specified item and returns an item that describes the same object although it's specific properties may be different. For example, a contact whose name is an identical match, but whose telephone number has changed would return the matched item. ``None`` should be returned...
pysyncml/agents/base.py
def matchItem(self, item): ''' [OPTIONAL] Attempts to find the specified item and returns an item that describes the same object although it's specific properties may be different. For example, a contact whose name is an identical match, but whose telephone number has changed would return the ma...
def matchItem(self, item): ''' [OPTIONAL] Attempts to find the specified item and returns an item that describes the same object although it's specific properties may be different. For example, a contact whose name is an identical match, but whose telephone number has changed would return the ma...
[ "[", "OPTIONAL", "]", "Attempts", "to", "find", "the", "specified", "item", "and", "returns", "an", "item", "that", "describes", "the", "same", "object", "although", "it", "s", "specific", "properties", "may", "be", "different", ".", "For", "example", "a", ...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/agents/base.py#L208-L239
[ "def", "matchItem", "(", "self", ",", "item", ")", ":", "for", "match", "in", "self", ".", "getAllItems", "(", ")", ":", "if", "cmp", "(", "match", ",", "item", ")", "==", "0", ":", "return", "match", "return", "None" ]
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
initialize_indices
Initializes the indices
jackal/scripts/status.py
def initialize_indices(): """ Initializes the indices """ Host.init() Range.init() Service.init() User.init() Credential.init() Log.init()
def initialize_indices(): """ Initializes the indices """ Host.init() Range.init() Service.init() User.init() Credential.init() Log.init()
[ "Initializes", "the", "indices" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/status.py#L34-L43
[ "def", "initialize_indices", "(", ")", ":", "Host", ".", "init", "(", ")", "Range", ".", "init", "(", ")", "Service", ".", "init", "(", ")", "User", ".", "init", "(", ")", "Credential", ".", "init", "(", ")", "Log", ".", "init", "(", ")" ]
7fe62732eb5194b7246215d5277fb37c398097bf
valid
ContentTypeInfoMixIn.toSyncML
Returns an ElementTree node representing this ContentTypeInfo. If `nodeName` is not None, then it will be used as the containing element node name (this is useful, for example, to differentiate between a standard content-type and a preferred content-type). If `uniqueVerCt` is True, then an array of elem...
pysyncml/ctype.py
def toSyncML(self, nodeName=None, uniqueVerCt=False): ''' Returns an ElementTree node representing this ContentTypeInfo. If `nodeName` is not None, then it will be used as the containing element node name (this is useful, for example, to differentiate between a standard content-type and a preferred ...
def toSyncML(self, nodeName=None, uniqueVerCt=False): ''' Returns an ElementTree node representing this ContentTypeInfo. If `nodeName` is not None, then it will be used as the containing element node name (this is useful, for example, to differentiate between a standard content-type and a preferred ...
[ "Returns", "an", "ElementTree", "node", "representing", "this", "ContentTypeInfo", ".", "If", "nodeName", "is", "not", "None", "then", "it", "will", "be", "used", "as", "the", "containing", "element", "node", "name", "(", "this", "is", "useful", "for", "exam...
metagriffin/pysyncml
python
https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/ctype.py#L87-L109
[ "def", "toSyncML", "(", "self", ",", "nodeName", "=", "None", ",", "uniqueVerCt", "=", "False", ")", ":", "if", "uniqueVerCt", ":", "ret", "=", "[", "]", "for", "v", "in", "self", ".", "versions", ":", "tmp", "=", "ET", ".", "Element", "(", "nodeNa...
a583fe0dbffa8b24e5a3e151524f84868b2382bb
valid
parse_single_computer
Parse the entry into a computer object.
jackal/scripts/domaindump.py
def parse_single_computer(entry): """ Parse the entry into a computer object. """ computer = Computer(dns_hostname=get_field(entry, 'dNSHostName'), description=get_field( entry, 'description'), os=get_field(entry, 'operatingSystem'), group_id=get_field(entry, 'primaryGroupID')) try: ...
def parse_single_computer(entry): """ Parse the entry into a computer object. """ computer = Computer(dns_hostname=get_field(entry, 'dNSHostName'), description=get_field( entry, 'description'), os=get_field(entry, 'operatingSystem'), group_id=get_field(entry, 'primaryGroupID')) try: ...
[ "Parse", "the", "entry", "into", "a", "computer", "object", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L48-L63
[ "def", "parse_single_computer", "(", "entry", ")", ":", "computer", "=", "Computer", "(", "dns_hostname", "=", "get_field", "(", "entry", ",", "'dNSHostName'", ")", ",", "description", "=", "get_field", "(", "entry", ",", "'description'", ")", ",", "os", "="...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
parse_domain_computers
Parse the file and extract the computers, import the computers that resolve into jackal.
jackal/scripts/domaindump.py
def parse_domain_computers(filename): """ Parse the file and extract the computers, import the computers that resolve into jackal. """ with open(filename) as f: data = json.loads(f.read()) hs = HostSearch() count = 0 entry_count = 0 print_notification("Parsing {} entries".for...
def parse_domain_computers(filename): """ Parse the file and extract the computers, import the computers that resolve into jackal. """ with open(filename) as f: data = json.loads(f.read()) hs = HostSearch() count = 0 entry_count = 0 print_notification("Parsing {} entries".for...
[ "Parse", "the", "file", "and", "extract", "the", "computers", "import", "the", "computers", "that", "resolve", "into", "jackal", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L66-L97
[ "def", "parse_domain_computers", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "f", ":", "data", "=", "json", ".", "loads", "(", "f", ".", "read", "(", ")", ")", "hs", "=", "HostSearch", "(", ")", "count", "=", "0", "entry_...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
parse_user
Parses a single entry from the domaindump
jackal/scripts/domaindump.py
def parse_user(entry, domain_groups): """ Parses a single entry from the domaindump """ result = {} distinguished_name = get_field(entry, 'distinguishedName') result['domain'] = ".".join(distinguished_name.split(',DC=')[1:]) result['name'] = get_field(entry, 'name') result['username'...
def parse_user(entry, domain_groups): """ Parses a single entry from the domaindump """ result = {} distinguished_name = get_field(entry, 'distinguishedName') result['domain'] = ".".join(distinguished_name.split(',DC=')[1:]) result['name'] = get_field(entry, 'name') result['username'...
[ "Parses", "a", "single", "entry", "from", "the", "domaindump" ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L125-L157
[ "def", "parse_user", "(", "entry", ",", "domain_groups", ")", ":", "result", "=", "{", "}", "distinguished_name", "=", "get_field", "(", "entry", ",", "'distinguishedName'", ")", "result", "[", "'domain'", "]", "=", "\".\"", ".", "join", "(", "distinguished_...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
parse_domain_users
Parses the domain users and groups files.
jackal/scripts/domaindump.py
def parse_domain_users(domain_users_file, domain_groups_file): """ Parses the domain users and groups files. """ with open(domain_users_file) as f: users = json.loads(f.read()) domain_groups = {} if domain_groups_file: with open(domain_groups_file) as f: groups =...
def parse_domain_users(domain_users_file, domain_groups_file): """ Parses the domain users and groups files. """ with open(domain_users_file) as f: users = json.loads(f.read()) domain_groups = {} if domain_groups_file: with open(domain_groups_file) as f: groups =...
[ "Parses", "the", "domain", "users", "and", "groups", "files", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L160-L195
[ "def", "parse_domain_users", "(", "domain_users_file", ",", "domain_groups_file", ")", ":", "with", "open", "(", "domain_users_file", ")", "as", "f", ":", "users", "=", "json", ".", "loads", "(", "f", ".", "read", "(", ")", ")", "domain_groups", "=", "{", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
import_domaindump
Parses ldapdomaindump files and stores hosts and users in elasticsearch.
jackal/scripts/domaindump.py
def import_domaindump(): """ Parses ldapdomaindump files and stores hosts and users in elasticsearch. """ parser = argparse.ArgumentParser( description="Imports users, groups and computers result files from the ldapdomaindump tool, will resolve the names from domain_computers output for IPs"...
def import_domaindump(): """ Parses ldapdomaindump files and stores hosts and users in elasticsearch. """ parser = argparse.ArgumentParser( description="Imports users, groups and computers result files from the ldapdomaindump tool, will resolve the names from domain_computers output for IPs"...
[ "Parses", "ldapdomaindump", "files", "and", "stores", "hosts", "and", "users", "in", "elasticsearch", "." ]
mwgielen/jackal
python
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/domaindump.py#L198-L229
[ "def", "import_domaindump", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Imports users, groups and computers result files from the ldapdomaindump tool, will resolve the names from domain_computers output for IPs\"", ")", "parser", ".", ...
7fe62732eb5194b7246215d5277fb37c398097bf
valid
autocomplete
Make an autocomplete API request This can be used to find cities and/or hurricanes by name :param string query: city :param string country: restrict search to a specific country. Must be a two letter country code :param boolean hurricanes: whether to search for hurricanes or not :param boolean cit...
pywunderground/core.py
def autocomplete(query, country=None, hurricanes=False, cities=True, timeout=5): """Make an autocomplete API request This can be used to find cities and/or hurricanes by name :param string query: city :param string country: restrict search to a specific country. Must be a two letter country code :...
def autocomplete(query, country=None, hurricanes=False, cities=True, timeout=5): """Make an autocomplete API request This can be used to find cities and/or hurricanes by name :param string query: city :param string country: restrict search to a specific country. Must be a two letter country code :...
[ "Make", "an", "autocomplete", "API", "request" ]
Diaoul/pywunderground
python
https://github.com/Diaoul/pywunderground/blob/d0fcb7c573e1c8285f6fc3930c6bddab820a9de7/pywunderground/core.py#L33-L55
[ "def", "autocomplete", "(", "query", ",", "country", "=", "None", ",", "hurricanes", "=", "False", ",", "cities", "=", "True", ",", "timeout", "=", "5", ")", ":", "data", "=", "{", "}", "data", "[", "'query'", "]", "=", "quote", "(", "query", ")", ...
d0fcb7c573e1c8285f6fc3930c6bddab820a9de7
valid
request
Make an API request :param string key: API key to use :param list features: features to request. It must be a subset of :data:`FEATURES` :param string query: query to send :param integer timeout: timeout of the request :returns: result of the API request :rtype: dict
pywunderground/core.py
def request(key, features, query, timeout=5): """Make an API request :param string key: API key to use :param list features: features to request. It must be a subset of :data:`FEATURES` :param string query: query to send :param integer timeout: timeout of the request :returns: result of the API...
def request(key, features, query, timeout=5): """Make an API request :param string key: API key to use :param list features: features to request. It must be a subset of :data:`FEATURES` :param string query: query to send :param integer timeout: timeout of the request :returns: result of the API...
[ "Make", "an", "API", "request" ]
Diaoul/pywunderground
python
https://github.com/Diaoul/pywunderground/blob/d0fcb7c573e1c8285f6fc3930c6bddab820a9de7/pywunderground/core.py#L58-L76
[ "def", "request", "(", "key", ",", "features", ",", "query", ",", "timeout", "=", "5", ")", ":", "data", "=", "{", "}", "data", "[", "'key'", "]", "=", "key", "data", "[", "'features'", "]", "=", "'/'", ".", "join", "(", "[", "f", "for", "f", ...
d0fcb7c573e1c8285f6fc3930c6bddab820a9de7
valid
_unicode
Try to convert a string to unicode using different encodings
pywunderground/core.py
def _unicode(string): """Try to convert a string to unicode using different encodings""" for encoding in ['utf-8', 'latin1']: try: result = unicode(string, encoding) return result except UnicodeDecodeError: pass result = unicode(string, 'utf-8', 'replace')...
def _unicode(string): """Try to convert a string to unicode using different encodings""" for encoding in ['utf-8', 'latin1']: try: result = unicode(string, encoding) return result except UnicodeDecodeError: pass result = unicode(string, 'utf-8', 'replace')...
[ "Try", "to", "convert", "a", "string", "to", "unicode", "using", "different", "encodings" ]
Diaoul/pywunderground
python
https://github.com/Diaoul/pywunderground/blob/d0fcb7c573e1c8285f6fc3930c6bddab820a9de7/pywunderground/core.py#L79-L88
[ "def", "_unicode", "(", "string", ")", ":", "for", "encoding", "in", "[", "'utf-8'", ",", "'latin1'", "]", ":", "try", ":", "result", "=", "unicode", "(", "string", ",", "encoding", ")", "return", "result", "except", "UnicodeDecodeError", ":", "pass", "r...
d0fcb7c573e1c8285f6fc3930c6bddab820a9de7
valid
http_get_provider
Handle HTTP GET requests on an authentication endpoint. Authentication flow begins when ``params`` has a ``login`` key with a value of ``start``. For instance, ``/auth/twitter?login=start``. :param str provider: An provider to obtain a user ID from. :param str request_url: The authentication endpoint/...
socialauth/authentication.py
def http_get_provider(provider, request_url, params, token_secret, token_cookie = None): '''Handle HTTP GET requests on an authentication endpoint. Authentication flow begins when ``params`` has a ``login`` key with a value of ``start``. For instance, ``/auth/twitter?login=start``. ...
def http_get_provider(provider, request_url, params, token_secret, token_cookie = None): '''Handle HTTP GET requests on an authentication endpoint. Authentication flow begins when ``params`` has a ``login`` key with a value of ``start``. For instance, ``/auth/twitter?login=start``. ...
[ "Handle", "HTTP", "GET", "requests", "on", "an", "authentication", "endpoint", "." ]
emilyhorsman/socialauth
python
https://github.com/emilyhorsman/socialauth/blob/2246a5b2cbbea0936a9b76cc3a7f0a224434d9f6/socialauth/authentication.py#L14-L60
[ "def", "http_get_provider", "(", "provider", ",", "request_url", ",", "params", ",", "token_secret", ",", "token_cookie", "=", "None", ")", ":", "if", "not", "validate_provider", "(", "provider", ")", ":", "raise", "InvalidUsage", "(", "'Provider not supported'", ...
2246a5b2cbbea0936a9b76cc3a7f0a224434d9f6
valid
Target.to_json
Method to call to get a serializable object for json.dump or jsonify based on the target :return: dict
flask_nemo/query/annotation.py
def to_json(self): """ Method to call to get a serializable object for json.dump or jsonify based on the target :return: dict """ if self.subreference is not None: return { "source": self.objectId, "selector": { "type": "Fr...
def to_json(self): """ Method to call to get a serializable object for json.dump or jsonify based on the target :return: dict """ if self.subreference is not None: return { "source": self.objectId, "selector": { "type": "Fr...
[ "Method", "to", "call", "to", "get", "a", "serializable", "object", "for", "json", ".", "dump", "or", "jsonify", "based", "on", "the", "target" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/annotation.py#L39-L54
[ "def", "to_json", "(", "self", ")", ":", "if", "self", ".", "subreference", "is", "not", "None", ":", "return", "{", "\"source\"", ":", "self", ".", "objectId", ",", "\"selector\"", ":", "{", "\"type\"", ":", "\"FragmentSelector\"", ",", "\"conformsTo\"", ...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
AnnotationResource.read
Read the contents of the Annotation Resource :return: the contents of the resource :rtype: str or bytes or flask.response
flask_nemo/query/annotation.py
def read(self): """ Read the contents of the Annotation Resource :return: the contents of the resource :rtype: str or bytes or flask.response """ if not self.__content__: self.__retriever__ = self.__resolver__.resolve(self.uri) self.__content__, self.__mi...
def read(self): """ Read the contents of the Annotation Resource :return: the contents of the resource :rtype: str or bytes or flask.response """ if not self.__content__: self.__retriever__ = self.__resolver__.resolve(self.uri) self.__content__, self.__mi...
[ "Read", "the", "contents", "of", "the", "Annotation", "Resource" ]
Capitains/flask-capitains-nemo
python
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/annotation.py#L132-L141
[ "def", "read", "(", "self", ")", ":", "if", "not", "self", ".", "__content__", ":", "self", ".", "__retriever__", "=", "self", ".", "__resolver__", ".", "resolve", "(", "self", ".", "uri", ")", "self", ".", "__content__", ",", "self", ".", "__mimetype_...
8d91f2c05b925a6c8ea8c997baf698c87257bc58
valid
build_index_and_mapping
index all triples into indexes and return their mappings
kgekit/data.py
def build_index_and_mapping(triples): """index all triples into indexes and return their mappings""" ents = bidict() rels = bidict() ent_id = 0 rel_id = 0 collected = [] for t in triples: for e in (t.head, t.tail): if e not in ents: ents[e] = ent_id ...
def build_index_and_mapping(triples): """index all triples into indexes and return their mappings""" ents = bidict() rels = bidict() ent_id = 0 rel_id = 0 collected = [] for t in triples: for e in (t.head, t.tail): if e not in ents: ents[e] = ent_id ...
[ "index", "all", "triples", "into", "indexes", "and", "return", "their", "mappings" ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L108-L126
[ "def", "build_index_and_mapping", "(", "triples", ")", ":", "ents", "=", "bidict", "(", ")", "rels", "=", "bidict", "(", ")", "ent_id", "=", "0", "rel_id", "=", "0", "collected", "=", "[", "]", "for", "t", "in", "triples", ":", "for", "e", "in", "(...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
recover_triples_from_mapping
recover triples from mapping.
kgekit/data.py
def recover_triples_from_mapping(indexes, ents: bidict, rels: bidict): """recover triples from mapping.""" triples = [] for t in indexes: triples.append(kgedata.Triple(ents.inverse[t.head], rels.inverse[t.relation], ents.inverse[t.tail])) return triples
def recover_triples_from_mapping(indexes, ents: bidict, rels: bidict): """recover triples from mapping.""" triples = [] for t in indexes: triples.append(kgedata.Triple(ents.inverse[t.head], rels.inverse[t.relation], ents.inverse[t.tail])) return triples
[ "recover", "triples", "from", "mapping", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L129-L134
[ "def", "recover_triples_from_mapping", "(", "indexes", ",", "ents", ":", "bidict", ",", "rels", ":", "bidict", ")", ":", "triples", "=", "[", "]", "for", "t", "in", "indexes", ":", "triples", ".", "append", "(", "kgedata", ".", "Triple", "(", "ents", "...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
split_golden_set
Split the data into train/valid/test sets.
kgekit/data.py
def split_golden_set(triples, valid_ratio, test_ratio): """Split the data into train/valid/test sets.""" assert valid_ratio >= 0.0 assert test_ratio >= 0.0 num_valid = int(len(triples) * valid_ratio) num_test = int(len(triples) * test_ratio) valid_set = triples[:num_valid] test_set = triples...
def split_golden_set(triples, valid_ratio, test_ratio): """Split the data into train/valid/test sets.""" assert valid_ratio >= 0.0 assert test_ratio >= 0.0 num_valid = int(len(triples) * valid_ratio) num_test = int(len(triples) * test_ratio) valid_set = triples[:num_valid] test_set = triples...
[ "Split", "the", "data", "into", "train", "/", "valid", "/", "test", "sets", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L145-L156
[ "def", "split_golden_set", "(", "triples", ",", "valid_ratio", ",", "test_ratio", ")", ":", "assert", "valid_ratio", ">=", "0.0", "assert", "test_ratio", ">=", "0.0", "num_valid", "=", "int", "(", "len", "(", "triples", ")", "*", "valid_ratio", ")", "num_tes...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
_transform_triple_numpy
Transform triple index into a 1-D numpy array.
kgekit/data.py
def _transform_triple_numpy(x): """Transform triple index into a 1-D numpy array.""" return np.array([x.head, x.relation, x.tail], dtype=np.int64)
def _transform_triple_numpy(x): """Transform triple index into a 1-D numpy array.""" return np.array([x.head, x.relation, x.tail], dtype=np.int64)
[ "Transform", "triple", "index", "into", "a", "1", "-", "D", "numpy", "array", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L158-L160
[ "def", "_transform_triple_numpy", "(", "x", ")", ":", "return", "np", ".", "array", "(", "[", "x", ".", "head", ",", "x", ".", "relation", ",", "x", ".", "tail", "]", ",", "dtype", "=", "np", ".", "int64", ")" ]
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
pack_triples_numpy
Packs a list of triple indexes into a 2D numpy array.
kgekit/data.py
def pack_triples_numpy(triples): """Packs a list of triple indexes into a 2D numpy array.""" if len(triples) == 0: return np.array([], dtype=np.int64) return np.stack(list(map(_transform_triple_numpy, triples)), axis=0)
def pack_triples_numpy(triples): """Packs a list of triple indexes into a 2D numpy array.""" if len(triples) == 0: return np.array([], dtype=np.int64) return np.stack(list(map(_transform_triple_numpy, triples)), axis=0)
[ "Packs", "a", "list", "of", "triple", "indexes", "into", "a", "2D", "numpy", "array", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L162-L166
[ "def", "pack_triples_numpy", "(", "triples", ")", ":", "if", "len", "(", "triples", ")", "==", "0", ":", "return", "np", ".", "array", "(", "[", "]", ",", "dtype", "=", "np", ".", "int64", ")", "return", "np", ".", "stack", "(", "list", "(", "map...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
remove_near_duplicate_relation
If entity pairs in a relation is as close as another relations, only keep one relation of such set.
kgekit/data.py
def remove_near_duplicate_relation(triples, threshold=0.97): """If entity pairs in a relation is as close as another relations, only keep one relation of such set.""" logging.debug("remove duplicate") _assert_threshold(threshold) duplicate_rel_counter = defaultdict(list) relations = set() for ...
def remove_near_duplicate_relation(triples, threshold=0.97): """If entity pairs in a relation is as close as another relations, only keep one relation of such set.""" logging.debug("remove duplicate") _assert_threshold(threshold) duplicate_rel_counter = defaultdict(list) relations = set() for ...
[ "If", "entity", "pairs", "in", "a", "relation", "is", "as", "close", "as", "another", "relations", "only", "keep", "one", "relation", "of", "such", "set", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L190-L219
[ "def", "remove_near_duplicate_relation", "(", "triples", ",", "threshold", "=", "0.97", ")", ":", "logging", ".", "debug", "(", "\"remove duplicate\"", ")", "_assert_threshold", "(", "threshold", ")", "duplicate_rel_counter", "=", "defaultdict", "(", "list", ")", ...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
remove_direct_link_triples
Remove direct links in the training sets.
kgekit/data.py
def remove_direct_link_triples(train, valid, test): """Remove direct links in the training sets.""" pairs = set() merged = valid + test for t in merged: pairs.add((t.head, t.tail)) filtered = filterfalse(lambda t: (t.head, t.tail) in pairs or (t.tail, t.head) in pairs, train) return lis...
def remove_direct_link_triples(train, valid, test): """Remove direct links in the training sets.""" pairs = set() merged = valid + test for t in merged: pairs.add((t.head, t.tail)) filtered = filterfalse(lambda t: (t.head, t.tail) in pairs or (t.tail, t.head) in pairs, train) return lis...
[ "Remove", "direct", "links", "in", "the", "training", "sets", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L256-L264
[ "def", "remove_direct_link_triples", "(", "train", ",", "valid", ",", "test", ")", ":", "pairs", "=", "set", "(", ")", "merged", "=", "valid", "+", "test", "for", "t", "in", "merged", ":", "pairs", ".", "add", "(", "(", "t", ".", "head", ",", "t", ...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
Indexer.shrink_indexes_in_place
Uses a union find to find segment.
kgekit/data.py
def shrink_indexes_in_place(self, triples): """Uses a union find to find segment.""" _ent_roots = self.UnionFind(self._ent_id) _rel_roots = self.UnionFind(self._rel_id) for t in triples: _ent_roots.add(t.head) _ent_roots.add(t.tail) _rel_roots.add(t....
def shrink_indexes_in_place(self, triples): """Uses a union find to find segment.""" _ent_roots = self.UnionFind(self._ent_id) _rel_roots = self.UnionFind(self._rel_id) for t in triples: _ent_roots.add(t.head) _ent_roots.add(t.tail) _rel_roots.add(t....
[ "Uses", "a", "union", "find", "to", "find", "segment", "." ]
fantasticfears/kgekit
python
https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/data.py#L69-L105
[ "def", "shrink_indexes_in_place", "(", "self", ",", "triples", ")", ":", "_ent_roots", "=", "self", ".", "UnionFind", "(", "self", ".", "_ent_id", ")", "_rel_roots", "=", "self", ".", "UnionFind", "(", "self", ".", "_rel_id", ")", "for", "t", "in", "trip...
5e464e1fc3ae9c7e216f6dd94f879a967d065247
valid
IndexBuilder.freeze
Create a usable data structure for serializing.
sphinxcontrib/lunrsearch/__init__.py
def freeze(self): """Create a usable data structure for serializing.""" data = super(IndexBuilder, self).freeze() try: # Sphinx >= 1.5 format # Due to changes from github.com/sphinx-doc/sphinx/pull/2454 base_file_names = data['docnames'] except KeyErro...
def freeze(self): """Create a usable data structure for serializing.""" data = super(IndexBuilder, self).freeze() try: # Sphinx >= 1.5 format # Due to changes from github.com/sphinx-doc/sphinx/pull/2454 base_file_names = data['docnames'] except KeyErro...
[ "Create", "a", "usable", "data", "structure", "for", "serializing", "." ]
rmcgibbo/sphinxcontrib-lunrsearch
python
https://github.com/rmcgibbo/sphinxcontrib-lunrsearch/blob/fd24e6ab524e0a24a805eb1f9c4613646cb03291/sphinxcontrib/lunrsearch/__init__.py#L14-L50
[ "def", "freeze", "(", "self", ")", ":", "data", "=", "super", "(", "IndexBuilder", ",", "self", ")", ".", "freeze", "(", ")", "try", ":", "# Sphinx >= 1.5 format", "# Due to changes from github.com/sphinx-doc/sphinx/pull/2454", "base_file_names", "=", "data", "[", ...
fd24e6ab524e0a24a805eb1f9c4613646cb03291
valid
log_entity_creation
Logs an entity creation
gadget/__init__.py
def log_entity_creation(entity, params=None): """Logs an entity creation """ p = {'entity': entity} if params: p['params'] = params _log(TYPE_CODES.CREATE, p)
def log_entity_creation(entity, params=None): """Logs an entity creation """ p = {'entity': entity} if params: p['params'] = params _log(TYPE_CODES.CREATE, p)
[ "Logs", "an", "entity", "creation" ]
getslash/gadget-python
python
https://github.com/getslash/gadget-python/blob/ff22506f41798c6e11a117b2c1a27f62d8b7b9ad/gadget/__init__.py#L44-L50
[ "def", "log_entity_creation", "(", "entity", ",", "params", "=", "None", ")", ":", "p", "=", "{", "'entity'", ":", "entity", "}", "if", "params", ":", "p", "[", "'params'", "]", "=", "params", "_log", "(", "TYPE_CODES", ".", "CREATE", ",", "p", ")" ]
ff22506f41798c6e11a117b2c1a27f62d8b7b9ad