repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
dwavesystems/dwave-system
dwave/embedding/chimera.py
find_biclique_embedding
def find_biclique_embedding(a, b, m, n=None, t=None, target_edges=None): """Find an embedding for a biclique in a Chimera graph. Given a target :term:`Chimera` graph size, and a biclique (a bipartite graph where every vertex in a set in connected to all vertices in the other set), attempts to find an embed...
python
def find_biclique_embedding(a, b, m, n=None, t=None, target_edges=None): """Find an embedding for a biclique in a Chimera graph. Given a target :term:`Chimera` graph size, and a biclique (a bipartite graph where every vertex in a set in connected to all vertices in the other set), attempts to find an embed...
[ "def", "find_biclique_embedding", "(", "a", ",", "b", ",", "m", ",", "n", "=", "None", ",", "t", "=", "None", ",", "target_edges", "=", "None", ")", ":", "_", ",", "anodes", "=", "a", "_", ",", "bnodes", "=", "b", "m", ",", "n", ",", "t", ","...
Find an embedding for a biclique in a Chimera graph. Given a target :term:`Chimera` graph size, and a biclique (a bipartite graph where every vertex in a set in connected to all vertices in the other set), attempts to find an embedding. Args: a (int/iterable): Left shore of the bicliqu...
[ "Find", "an", "embedding", "for", "a", "biclique", "in", "a", "Chimera", "graph", "." ]
86a1698f15ccd8b0ece0ed868ee49292d3f67f5b
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/chimera.py#L111-L171
train
dwavesystems/dwave-system
dwave/embedding/chimera.py
find_grid_embedding
def find_grid_embedding(dim, m, n=None, t=4): """Find an embedding for a grid in a Chimera graph. Given a target :term:`Chimera` graph size, and grid dimensions, attempts to find an embedding. Args: dim (iterable[int]): Sizes of each grid dimension. Length can be between 1 and 3. ...
python
def find_grid_embedding(dim, m, n=None, t=4): """Find an embedding for a grid in a Chimera graph. Given a target :term:`Chimera` graph size, and grid dimensions, attempts to find an embedding. Args: dim (iterable[int]): Sizes of each grid dimension. Length can be between 1 and 3. ...
[ "def", "find_grid_embedding", "(", "dim", ",", "m", ",", "n", "=", "None", ",", "t", "=", "4", ")", ":", "m", ",", "n", ",", "t", ",", "target_edges", "=", "_chimera_input", "(", "m", ",", "n", ",", "t", ",", "None", ")", "indexer", "=", "dnx",...
Find an embedding for a grid in a Chimera graph. Given a target :term:`Chimera` graph size, and grid dimensions, attempts to find an embedding. Args: dim (iterable[int]): Sizes of each grid dimension. Length can be between 1 and 3. m (int): Number of rows in the Chimer...
[ "Find", "an", "embedding", "for", "a", "grid", "in", "a", "Chimera", "graph", "." ]
86a1698f15ccd8b0ece0ed868ee49292d3f67f5b
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/chimera.py#L174-L234
train
dwavesystems/dwave-system
dwave/system/composites/cutoffcomposite.py
CutOffComposite.sample
def sample(self, bqm, **parameters): """Cutoff and sample from the provided binary quadratic model. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they ...
python
def sample(self, bqm, **parameters): """Cutoff and sample from the provided binary quadratic model. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they ...
[ "def", "sample", "(", "self", ",", "bqm", ",", "**", "parameters", ")", ":", "child", "=", "self", ".", "child", "cutoff", "=", "self", ".", "_cutoff", "cutoff_vartype", "=", "self", ".", "_cutoff_vartype", "comp", "=", "self", ".", "_comparison", "if", ...
Cutoff and sample from the provided binary quadratic model. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they will also be affected. Args: ...
[ "Cutoff", "and", "sample", "from", "the", "provided", "binary", "quadratic", "model", "." ]
86a1698f15ccd8b0ece0ed868ee49292d3f67f5b
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L79-L144
train
dwavesystems/dwave-system
dwave/system/composites/cutoffcomposite.py
PolyCutOffComposite.sample_poly
def sample_poly(self, poly, **kwargs): """Cutoff and sample from the provided binary polynomial. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they wil...
python
def sample_poly(self, poly, **kwargs): """Cutoff and sample from the provided binary polynomial. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they wil...
[ "def", "sample_poly", "(", "self", ",", "poly", ",", "**", "kwargs", ")", ":", "child", "=", "self", ".", "child", "cutoff", "=", "self", ".", "_cutoff", "cutoff_vartype", "=", "self", ".", "_cutoff_vartype", "comp", "=", "self", ".", "_comparison", "if"...
Cutoff and sample from the provided binary polynomial. Removes interactions smaller than a given cutoff. Isolated variables (after the cutoff) are also removed. Note that if the problem had isolated variables before the cutoff, they will also be affected. Args: pol...
[ "Cutoff", "and", "sample", "from", "the", "provided", "binary", "polynomial", "." ]
86a1698f15ccd8b0ece0ed868ee49292d3f67f5b
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L231-L296
train
dwavesystems/dwave-system
dwave/embedding/diagnostic.py
diagnose_embedding
def diagnose_embedding(emb, source, target): """A detailed diagnostic for minor embeddings. This diagnostic produces a generator, which lists all issues with `emb`. The errors are yielded in the form ExceptionClass, arg1, arg2,... where the arguments following the class are used to construct ...
python
def diagnose_embedding(emb, source, target): """A detailed diagnostic for minor embeddings. This diagnostic produces a generator, which lists all issues with `emb`. The errors are yielded in the form ExceptionClass, arg1, arg2,... where the arguments following the class are used to construct ...
[ "def", "diagnose_embedding", "(", "emb", ",", "source", ",", "target", ")", ":", "if", "not", "hasattr", "(", "source", ",", "'edges'", ")", ":", "source", "=", "nx", ".", "Graph", "(", "source", ")", "if", "not", "hasattr", "(", "target", ",", "'edg...
A detailed diagnostic for minor embeddings. This diagnostic produces a generator, which lists all issues with `emb`. The errors are yielded in the form ExceptionClass, arg1, arg2,... where the arguments following the class are used to construct the exception object. User-friendly variants of ...
[ "A", "detailed", "diagnostic", "for", "minor", "embeddings", "." ]
86a1698f15ccd8b0ece0ed868ee49292d3f67f5b
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/diagnostic.py#L23-L96
train
Jaza/flask-restplus-patched
flask_restplus_patched/namespace.py
Namespace.model
def model(self, name=None, model=None, mask=None, **kwargs): """ Model registration decorator. """ if isinstance(model, (flask_marshmallow.Schema, flask_marshmallow.base_fields.FieldABC)): if not name: name = model.__class__.__name__ api_model = Mo...
python
def model(self, name=None, model=None, mask=None, **kwargs): """ Model registration decorator. """ if isinstance(model, (flask_marshmallow.Schema, flask_marshmallow.base_fields.FieldABC)): if not name: name = model.__class__.__name__ api_model = Mo...
[ "def", "model", "(", "self", ",", "name", "=", "None", ",", "model", "=", "None", ",", "mask", "=", "None", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "model", ",", "(", "flask_marshmallow", ".", "Schema", ",", "flask_marshmallow", ".", ...
Model registration decorator.
[ "Model", "registration", "decorator", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L62-L72
train
Jaza/flask-restplus-patched
flask_restplus_patched/namespace.py
Namespace.parameters
def parameters(self, parameters, locations=None): """ Endpoint parameters registration decorator. """ def decorator(func): if locations is None and parameters.many: _locations = ('json', ) else: _locations = locations if...
python
def parameters(self, parameters, locations=None): """ Endpoint parameters registration decorator. """ def decorator(func): if locations is None and parameters.many: _locations = ('json', ) else: _locations = locations if...
[ "def", "parameters", "(", "self", ",", "parameters", ",", "locations", "=", "None", ")", ":", "def", "decorator", "(", "func", ")", ":", "if", "locations", "is", "None", "and", "parameters", ".", "many", ":", "_locations", "=", "(", "'json'", ",", ")",...
Endpoint parameters registration decorator.
[ "Endpoint", "parameters", "registration", "decorator", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L74-L94
train
Jaza/flask-restplus-patched
flask_restplus_patched/namespace.py
Namespace.response
def response(self, model=None, code=HTTPStatus.OK, description=None, **kwargs): """ Endpoint response OpenAPI documentation decorator. It automatically documents HTTPError%(code)d responses with relevant schemas. Arguments: model (flask_marshmallow.Schema) - it can ...
python
def response(self, model=None, code=HTTPStatus.OK, description=None, **kwargs): """ Endpoint response OpenAPI documentation decorator. It automatically documents HTTPError%(code)d responses with relevant schemas. Arguments: model (flask_marshmallow.Schema) - it can ...
[ "def", "response", "(", "self", ",", "model", "=", "None", ",", "code", "=", "HTTPStatus", ".", "OK", ",", "description", "=", "None", ",", "**", "kwargs", ")", ":", "code", "=", "HTTPStatus", "(", "code", ")", "if", "code", "is", "HTTPStatus", ".", ...
Endpoint response OpenAPI documentation decorator. It automatically documents HTTPError%(code)d responses with relevant schemas. Arguments: model (flask_marshmallow.Schema) - it can be a class or an instance of the class, which will be used for OpenAPI documentation...
[ "Endpoint", "response", "OpenAPI", "documentation", "decorator", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L96-L192
train
Jaza/flask-restplus-patched
flask_restplus_patched/resource.py
Resource._apply_decorator_to_methods
def _apply_decorator_to_methods(cls, decorator): """ This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case, this method applies decorators directly and override me...
python
def _apply_decorator_to_methods(cls, decorator): """ This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case, this method applies decorators directly and override me...
[ "def", "_apply_decorator_to_methods", "(", "cls", ",", "decorator", ")", ":", "for", "method", "in", "cls", ".", "methods", ":", "method_name", "=", "method", ".", "lower", "(", ")", "decorated_method_func", "=", "decorator", "(", "getattr", "(", "cls", ",",...
This helper can apply a given decorator to all methods on the current Resource. NOTE: In contrast to ``Resource.method_decorators``, which has a similar use-case, this method applies decorators directly and override methods in-place, while the decorators listed in ``Resource.met...
[ "This", "helper", "can", "apply", "a", "given", "decorator", "to", "all", "methods", "on", "the", "current", "Resource", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/resource.py#L16-L30
train
Jaza/flask-restplus-patched
flask_restplus_patched/resource.py
Resource.options
def options(self, *args, **kwargs): """ Check which methods are allowed. Use this method if you need to know what operations are allowed to be performed on this endpoint, e.g. to decide wether to display a button in your UI. The list of allowed methods is provided in `A...
python
def options(self, *args, **kwargs): """ Check which methods are allowed. Use this method if you need to know what operations are allowed to be performed on this endpoint, e.g. to decide wether to display a button in your UI. The list of allowed methods is provided in `A...
[ "def", "options", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "method_funcs", "=", "[", "getattr", "(", "self", ",", "m", ".", "lower", "(", ")", ")", "for", "m", "in", "self", ".", "methods", "]", "allowed_methods", "=", "[", "...
Check which methods are allowed. Use this method if you need to know what operations are allowed to be performed on this endpoint, e.g. to decide wether to display a button in your UI. The list of allowed methods is provided in `Allow` response header.
[ "Check", "which", "methods", "are", "allowed", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/resource.py#L32-L81
train
Jaza/flask-restplus-patched
flask_restplus_patched/parameters.py
PatchJSONParameters.validate_patch_structure
def validate_patch_structure(self, data): """ Common validation of PATCH structure Provide check that 'value' present in all operations expect it. Provide check if 'path' is present. 'path' can be absent if provided without '/' at the start. Supposed that if 'path' is present t...
python
def validate_patch_structure(self, data): """ Common validation of PATCH structure Provide check that 'value' present in all operations expect it. Provide check if 'path' is present. 'path' can be absent if provided without '/' at the start. Supposed that if 'path' is present t...
[ "def", "validate_patch_structure", "(", "self", ",", "data", ")", ":", "if", "data", "[", "'op'", "]", "not", "in", "self", ".", "NO_VALUE_OPERATIONS", "and", "'value'", "not", "in", "data", ":", "raise", "ValidationError", "(", "'value is required'", ")", "...
Common validation of PATCH structure Provide check that 'value' present in all operations expect it. Provide check if 'path' is present. 'path' can be absent if provided without '/' at the start. Supposed that if 'path' is present than it is prepended with '/'. Removing '/' in ...
[ "Common", "validation", "of", "PATCH", "structure" ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L97-L114
train
Jaza/flask-restplus-patched
flask_restplus_patched/parameters.py
PatchJSONParameters.perform_patch
def perform_patch(cls, operations, obj, state=None): """ Performs all necessary operations by calling class methods with corresponding names. """ if state is None: state = {} for operation in operations: if not cls._process_patch_operation(operatio...
python
def perform_patch(cls, operations, obj, state=None): """ Performs all necessary operations by calling class methods with corresponding names. """ if state is None: state = {} for operation in operations: if not cls._process_patch_operation(operatio...
[ "def", "perform_patch", "(", "cls", ",", "operations", ",", "obj", ",", "state", "=", "None", ")", ":", "if", "state", "is", "None", ":", "state", "=", "{", "}", "for", "operation", "in", "operations", ":", "if", "not", "cls", ".", "_process_patch_oper...
Performs all necessary operations by calling class methods with corresponding names.
[ "Performs", "all", "necessary", "operations", "by", "calling", "class", "methods", "with", "corresponding", "names", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L117-L137
train
Jaza/flask-restplus-patched
flask_restplus_patched/parameters.py
PatchJSONParameters.replace
def replace(cls, obj, field, value, state): """ This is method for replace operation. It is separated to provide a possibility to easily override it in your Parameters. Args: obj (object): an instance to change. field (str): field name value (str): ne...
python
def replace(cls, obj, field, value, state): """ This is method for replace operation. It is separated to provide a possibility to easily override it in your Parameters. Args: obj (object): an instance to change. field (str): field name value (str): ne...
[ "def", "replace", "(", "cls", ",", "obj", ",", "field", ",", "value", ",", "state", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "field", ")", ":", "raise", "ValidationError", "(", "\"Field '%s' does not exist, so it cannot be patched\"", "%", "field", ...
This is method for replace operation. It is separated to provide a possibility to easily override it in your Parameters. Args: obj (object): an instance to change. field (str): field name value (str): new value state (dict): inter-operations state storage...
[ "This", "is", "method", "for", "replace", "operation", ".", "It", "is", "separated", "to", "provide", "a", "possibility", "to", "easily", "override", "it", "in", "your", "Parameters", "." ]
38b4a030f28e6aec374d105173aa5e9b6bd51e5e
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L173-L190
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/discourse.py
DiscourseEnrich.__related_categories
def __related_categories(self, category_id): """ Get all related categories to a given one """ related = [] for cat in self.categories_tree: if category_id in self.categories_tree[cat]: related.append(self.categories[cat]) return related
python
def __related_categories(self, category_id): """ Get all related categories to a given one """ related = [] for cat in self.categories_tree: if category_id in self.categories_tree[cat]: related.append(self.categories[cat]) return related
[ "def", "__related_categories", "(", "self", ",", "category_id", ")", ":", "related", "=", "[", "]", "for", "cat", "in", "self", ".", "categories_tree", ":", "if", "category_id", "in", "self", ".", "categories_tree", "[", "cat", "]", ":", "related", ".", ...
Get all related categories to a given one
[ "Get", "all", "related", "categories", "to", "a", "given", "one" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/discourse.py#L148-L154
train
chaoss/grimoirelab-elk
grimoire_elk/track_items.py
_create_projects_file
def _create_projects_file(project_name, data_source, items): """ Create a projects file from the items origin data """ repositories = [] for item in items: if item['origin'] not in repositories: repositories.append(item['origin']) projects = { project_name: { dat...
python
def _create_projects_file(project_name, data_source, items): """ Create a projects file from the items origin data """ repositories = [] for item in items: if item['origin'] not in repositories: repositories.append(item['origin']) projects = { project_name: { dat...
[ "def", "_create_projects_file", "(", "project_name", ",", "data_source", ",", "items", ")", ":", "repositories", "=", "[", "]", "for", "item", "in", "items", ":", "if", "item", "[", "'origin'", "]", "not", "in", "repositories", ":", "repositories", ".", "a...
Create a projects file from the items origin data
[ "Create", "a", "projects", "file", "from", "the", "items", "origin", "data" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/track_items.py#L194-L212
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/dockerhub.py
DockerHubEnrich.enrich_items
def enrich_items(self, ocean_backend, events=False): """ A custom enrich items is needed because apart from the enriched events from raw items, a image item with the last data for an image must be created """ max_items = self.elastic.max_items_bulk current = 0 total = 0 ...
python
def enrich_items(self, ocean_backend, events=False): """ A custom enrich items is needed because apart from the enriched events from raw items, a image item with the last data for an image must be created """ max_items = self.elastic.max_items_bulk current = 0 total = 0 ...
[ "def", "enrich_items", "(", "self", ",", "ocean_backend", ",", "events", "=", "False", ")", ":", "max_items", "=", "self", ".", "elastic", ".", "max_items_bulk", "current", "=", "0", "total", "=", "0", "bulk_json", "=", "\"\"", "items", "=", "ocean_backend...
A custom enrich items is needed because apart from the enriched events from raw items, a image item with the last data for an image must be created
[ "A", "custom", "enrich", "items", "is", "needed", "because", "apart", "from", "the", "enriched", "events", "from", "raw", "items", "a", "image", "item", "with", "the", "last", "data", "for", "an", "image", "must", "be", "created" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/dockerhub.py#L125-L188
train
chaoss/grimoirelab-elk
utils/gh2k.py
get_owner_repos_url
def get_owner_repos_url(owner, token): """ The owner could be a org or a user. It waits if need to have rate limit. Also it fixes a djando issue changing - with _ """ url_org = GITHUB_API_URL + "/orgs/" + owner + "/repos" url_user = GITHUB_API_URL + "/users/" + owner + "/repos" url_...
python
def get_owner_repos_url(owner, token): """ The owner could be a org or a user. It waits if need to have rate limit. Also it fixes a djando issue changing - with _ """ url_org = GITHUB_API_URL + "/orgs/" + owner + "/repos" url_user = GITHUB_API_URL + "/users/" + owner + "/repos" url_...
[ "def", "get_owner_repos_url", "(", "owner", ",", "token", ")", ":", "url_org", "=", "GITHUB_API_URL", "+", "\"/orgs/\"", "+", "owner", "+", "\"/repos\"", "url_user", "=", "GITHUB_API_URL", "+", "\"/users/\"", "+", "owner", "+", "\"/repos\"", "url_owner", "=", ...
The owner could be a org or a user. It waits if need to have rate limit. Also it fixes a djando issue changing - with _
[ "The", "owner", "could", "be", "a", "org", "or", "a", "user", ".", "It", "waits", "if", "need", "to", "have", "rate", "limit", ".", "Also", "it", "fixes", "a", "djando", "issue", "changing", "-", "with", "_" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L98-L123
train
chaoss/grimoirelab-elk
utils/gh2k.py
get_repositores
def get_repositores(owner_url, token, nrepos): """ owner could be an org or and user """ all_repos = [] url = owner_url while True: logging.debug("Getting repos from: %s" % (url)) try: r = requests.get(url, params=get_payload(), ...
python
def get_repositores(owner_url, token, nrepos): """ owner could be an org or and user """ all_repos = [] url = owner_url while True: logging.debug("Getting repos from: %s" % (url)) try: r = requests.get(url, params=get_payload(), ...
[ "def", "get_repositores", "(", "owner_url", ",", "token", ",", "nrepos", ")", ":", "all_repos", "=", "[", "]", "url", "=", "owner_url", "while", "True", ":", "logging", ".", "debug", "(", "\"Getting repos from: %s\"", "%", "(", "url", ")", ")", "try", ":...
owner could be an org or and user
[ "owner", "could", "be", "an", "org", "or", "and", "user" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L126-L161
train
chaoss/grimoirelab-elk
utils/gh2k.py
publish_twitter
def publish_twitter(twitter_contact, owner): """ Publish in twitter the dashboard """ dashboard_url = CAULDRON_DASH_URL + "/%s" % (owner) tweet = "@%s your http://cauldron.io dashboard for #%s at GitHub is ready: %s. Check it out! #oscon" \ % (twitter_contact, owner, dashboard_url) status = quot...
python
def publish_twitter(twitter_contact, owner): """ Publish in twitter the dashboard """ dashboard_url = CAULDRON_DASH_URL + "/%s" % (owner) tweet = "@%s your http://cauldron.io dashboard for #%s at GitHub is ready: %s. Check it out! #oscon" \ % (twitter_contact, owner, dashboard_url) status = quot...
[ "def", "publish_twitter", "(", "twitter_contact", ",", "owner", ")", ":", "dashboard_url", "=", "CAULDRON_DASH_URL", "+", "\"/%s\"", "%", "(", "owner", ")", "tweet", "=", "\"@%s your http://cauldron.io dashboard for #%s at GitHub is ready: %s. Check it out! #oscon\"", "%", ...
Publish in twitter the dashboard
[ "Publish", "in", "twitter", "the", "dashboard" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L253-L260
train
chaoss/grimoirelab-elk
grimoire_elk/raw/mediawiki.py
MediaWikiOcean.get_perceval_params_from_url
def get_perceval_params_from_url(cls, urls): """ Get the perceval params given the URLs for the data source """ params = [] dparam = cls.get_arthur_params_from_url(urls) params.append(dparam["url"]) return params
python
def get_perceval_params_from_url(cls, urls): """ Get the perceval params given the URLs for the data source """ params = [] dparam = cls.get_arthur_params_from_url(urls) params.append(dparam["url"]) return params
[ "def", "get_perceval_params_from_url", "(", "cls", ",", "urls", ")", ":", "params", "=", "[", "]", "dparam", "=", "cls", ".", "get_arthur_params_from_url", "(", "urls", ")", "params", ".", "append", "(", "dparam", "[", "\"url\"", "]", ")", "return", "param...
Get the perceval params given the URLs for the data source
[ "Get", "the", "perceval", "params", "given", "the", "URLs", "for", "the", "data", "source" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/mediawiki.py#L66-L73
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/sortinghat_gelk.py
SortingHat.add_identity
def add_identity(cls, db, identity, backend): """ Load and identity list from backend in Sorting Hat """ uuid = None try: uuid = api.add_identity(db, backend, identity['email'], identity['name'], identity['username']) logger.debug("Ne...
python
def add_identity(cls, db, identity, backend): """ Load and identity list from backend in Sorting Hat """ uuid = None try: uuid = api.add_identity(db, backend, identity['email'], identity['name'], identity['username']) logger.debug("Ne...
[ "def", "add_identity", "(", "cls", ",", "db", ",", "identity", ",", "backend", ")", ":", "uuid", "=", "None", "try", ":", "uuid", "=", "api", ".", "add_identity", "(", "db", ",", "backend", ",", "identity", "[", "'email'", "]", ",", "identity", "[", ...
Load and identity list from backend in Sorting Hat
[ "Load", "and", "identity", "list", "from", "backend", "in", "Sorting", "Hat" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L64-L102
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/sortinghat_gelk.py
SortingHat.add_identities
def add_identities(cls, db, identities, backend): """ Load identities list from backend in Sorting Hat """ logger.info("Adding the identities to SortingHat") total = 0 for identity in identities: try: cls.add_identity(db, identity, backend) ...
python
def add_identities(cls, db, identities, backend): """ Load identities list from backend in Sorting Hat """ logger.info("Adding the identities to SortingHat") total = 0 for identity in identities: try: cls.add_identity(db, identity, backend) ...
[ "def", "add_identities", "(", "cls", ",", "db", ",", "identities", ",", "backend", ")", ":", "logger", ".", "info", "(", "\"Adding the identities to SortingHat\"", ")", "total", "=", "0", "for", "identity", "in", "identities", ":", "try", ":", "cls", ".", ...
Load identities list from backend in Sorting Hat
[ "Load", "identities", "list", "from", "backend", "in", "Sorting", "Hat" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L105-L120
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/sortinghat_gelk.py
SortingHat.remove_identity
def remove_identity(cls, sh_db, ident_id): """Delete an identity from SortingHat. :param sh_db: SortingHat database :param ident_id: identity identifier """ success = False try: api.delete_identity(sh_db, ident_id) logger.debug("Identity %s delete...
python
def remove_identity(cls, sh_db, ident_id): """Delete an identity from SortingHat. :param sh_db: SortingHat database :param ident_id: identity identifier """ success = False try: api.delete_identity(sh_db, ident_id) logger.debug("Identity %s delete...
[ "def", "remove_identity", "(", "cls", ",", "sh_db", ",", "ident_id", ")", ":", "success", "=", "False", "try", ":", "api", ".", "delete_identity", "(", "sh_db", ",", "ident_id", ")", "logger", ".", "debug", "(", "\"Identity %s deleted\"", ",", "ident_id", ...
Delete an identity from SortingHat. :param sh_db: SortingHat database :param ident_id: identity identifier
[ "Delete", "an", "identity", "from", "SortingHat", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L123-L137
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/sortinghat_gelk.py
SortingHat.remove_unique_identity
def remove_unique_identity(cls, sh_db, uuid): """Delete a unique identity from SortingHat. :param sh_db: SortingHat database :param uuid: Unique identity identifier """ success = False try: api.delete_unique_identity(sh_db, uuid) logger.debug("Uni...
python
def remove_unique_identity(cls, sh_db, uuid): """Delete a unique identity from SortingHat. :param sh_db: SortingHat database :param uuid: Unique identity identifier """ success = False try: api.delete_unique_identity(sh_db, uuid) logger.debug("Uni...
[ "def", "remove_unique_identity", "(", "cls", ",", "sh_db", ",", "uuid", ")", ":", "success", "=", "False", "try", ":", "api", ".", "delete_unique_identity", "(", "sh_db", ",", "uuid", ")", "logger", ".", "debug", "(", "\"Unique identity %s deleted\"", ",", "...
Delete a unique identity from SortingHat. :param sh_db: SortingHat database :param uuid: Unique identity identifier
[ "Delete", "a", "unique", "identity", "from", "SortingHat", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L140-L154
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/sortinghat_gelk.py
SortingHat.unique_identities
def unique_identities(cls, sh_db): """List the unique identities available in SortingHat. :param sh_db: SortingHat database """ try: for unique_identity in api.unique_identities(sh_db): yield unique_identity except Exception as e: logger.d...
python
def unique_identities(cls, sh_db): """List the unique identities available in SortingHat. :param sh_db: SortingHat database """ try: for unique_identity in api.unique_identities(sh_db): yield unique_identity except Exception as e: logger.d...
[ "def", "unique_identities", "(", "cls", ",", "sh_db", ")", ":", "try", ":", "for", "unique_identity", "in", "api", ".", "unique_identities", "(", "sh_db", ")", ":", "yield", "unique_identity", "except", "Exception", "as", "e", ":", "logger", ".", "debug", ...
List the unique identities available in SortingHat. :param sh_db: SortingHat database
[ "List", "the", "unique", "identities", "available", "in", "SortingHat", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L157-L166
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/puppetforge.py
PuppetForgeEnrich.get_rich_events
def get_rich_events(self, item): """ Get the enriched events related to a module """ module = item['data'] if not item['data']['releases']: return [] for release in item['data']['releases']: event = self.get_rich_item(item) # Update sp...
python
def get_rich_events(self, item): """ Get the enriched events related to a module """ module = item['data'] if not item['data']['releases']: return [] for release in item['data']['releases']: event = self.get_rich_item(item) # Update sp...
[ "def", "get_rich_events", "(", "self", ",", "item", ")", ":", "module", "=", "item", "[", "'data'", "]", "if", "not", "item", "[", "'data'", "]", "[", "'releases'", "]", ":", "return", "[", "]", "for", "release", "in", "item", "[", "'data'", "]", "...
Get the enriched events related to a module
[ "Get", "the", "enriched", "events", "related", "to", "a", "module" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/puppetforge.py#L135-L176
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/database.py
Database._connect
def _connect(self): """Connect to the MySQL database. """ try: db = pymysql.connect(user=self.user, passwd=self.passwd, host=self.host, port=self.port, db=self.shdb, use_unicode=True) return db, db.cursor(...
python
def _connect(self): """Connect to the MySQL database. """ try: db = pymysql.connect(user=self.user, passwd=self.passwd, host=self.host, port=self.port, db=self.shdb, use_unicode=True) return db, db.cursor(...
[ "def", "_connect", "(", "self", ")", ":", "try", ":", "db", "=", "pymysql", ".", "connect", "(", "user", "=", "self", ".", "user", ",", "passwd", "=", "self", ".", "passwd", ",", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", ...
Connect to the MySQL database.
[ "Connect", "to", "the", "MySQL", "database", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/database.py#L44-L55
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
refresh_identities
def refresh_identities(enrich_backend, author_field=None, author_values=None): """Refresh identities in enriched index. Retrieve items from the enriched index corresponding to enrich_backend, and update their identities information, with fresh data from the SortingHat database. Instead of the whol...
python
def refresh_identities(enrich_backend, author_field=None, author_values=None): """Refresh identities in enriched index. Retrieve items from the enriched index corresponding to enrich_backend, and update their identities information, with fresh data from the SortingHat database. Instead of the whol...
[ "def", "refresh_identities", "(", "enrich_backend", ",", "author_field", "=", "None", ",", "author_values", "=", "None", ")", ":", "def", "update_items", "(", "new_filter_author", ")", ":", "for", "eitem", "in", "enrich_backend", ".", "fetch", "(", "new_filter_a...
Refresh identities in enriched index. Retrieve items from the enriched index corresponding to enrich_backend, and update their identities information, with fresh data from the SortingHat database. Instead of the whole index, only items matching the filter_author filter are fitered, if that paramet...
[ "Refresh", "identities", "in", "enriched", "index", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L309-L372
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
get_ocean_backend
def get_ocean_backend(backend_cmd, enrich_backend, no_incremental, filter_raw=None, filter_raw_should=None): """ Get the ocean backend configured to start from the last enriched date """ if no_incremental: last_enrich = None else: last_enrich = get_last_enrich(backend_...
python
def get_ocean_backend(backend_cmd, enrich_backend, no_incremental, filter_raw=None, filter_raw_should=None): """ Get the ocean backend configured to start from the last enriched date """ if no_incremental: last_enrich = None else: last_enrich = get_last_enrich(backend_...
[ "def", "get_ocean_backend", "(", "backend_cmd", ",", "enrich_backend", ",", "no_incremental", ",", "filter_raw", "=", "None", ",", "filter_raw_should", "=", "None", ")", ":", "if", "no_incremental", ":", "last_enrich", "=", "None", "else", ":", "last_enrich", "=...
Get the ocean backend configured to start from the last enriched date
[ "Get", "the", "ocean", "backend", "configured", "to", "start", "from", "the", "last", "enriched", "date" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L439-L487
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
do_studies
def do_studies(ocean_backend, enrich_backend, studies_args, retention_time=None): """Execute studies related to a given enrich backend. If `retention_time` is not None, the study data is deleted based on the number of minutes declared in `retention_time`. :param ocean_backend: backend to access raw items ...
python
def do_studies(ocean_backend, enrich_backend, studies_args, retention_time=None): """Execute studies related to a given enrich backend. If `retention_time` is not None, the study data is deleted based on the number of minutes declared in `retention_time`. :param ocean_backend: backend to access raw items ...
[ "def", "do_studies", "(", "ocean_backend", ",", "enrich_backend", ",", "studies_args", ",", "retention_time", "=", "None", ")", ":", "for", "study", "in", "enrich_backend", ".", "studies", ":", "selected_studies", "=", "[", "(", "s", "[", "'name'", "]", ",",...
Execute studies related to a given enrich backend. If `retention_time` is not None, the study data is deleted based on the number of minutes declared in `retention_time`. :param ocean_backend: backend to access raw items :param enrich_backend: backend to access enriched items :param retention_time: max...
[ "Execute", "studies", "related", "to", "a", "given", "enrich", "backend", ".", "If", "retention_time", "is", "not", "None", "the", "study", "data", "is", "deleted", "based", "on", "the", "number", "of", "minutes", "declared", "in", "retention_time", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L490-L521
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
delete_orphan_unique_identities
def delete_orphan_unique_identities(es, sortinghat_db, current_data_source, active_data_sources): """Delete all unique identities which appear in SortingHat, but not in the IDENTITIES_INDEX. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param current_data...
python
def delete_orphan_unique_identities(es, sortinghat_db, current_data_source, active_data_sources): """Delete all unique identities which appear in SortingHat, but not in the IDENTITIES_INDEX. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param current_data...
[ "def", "delete_orphan_unique_identities", "(", "es", ",", "sortinghat_db", ",", "current_data_source", ",", "active_data_sources", ")", ":", "def", "get_uuids_in_index", "(", "target_uuids", ")", ":", "page", "=", "es", ".", "search", "(", "index", "=", "IDENTITIE...
Delete all unique identities which appear in SortingHat, but not in the IDENTITIES_INDEX. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param current_data_source: current data source :param active_data_sources: list of active data sources
[ "Delete", "all", "unique", "identities", "which", "appear", "in", "SortingHat", "but", "not", "in", "the", "IDENTITIES_INDEX", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L671-L804
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
delete_inactive_unique_identities
def delete_inactive_unique_identities(es, sortinghat_db, before_date): """Select the unique identities not seen before `before_date` and delete them from SortingHat. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param before_date: datetime str to filt...
python
def delete_inactive_unique_identities(es, sortinghat_db, before_date): """Select the unique identities not seen before `before_date` and delete them from SortingHat. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param before_date: datetime str to filt...
[ "def", "delete_inactive_unique_identities", "(", "es", ",", "sortinghat_db", ",", "before_date", ")", ":", "page", "=", "es", ".", "search", "(", "index", "=", "IDENTITIES_INDEX", ",", "scroll", "=", "\"360m\"", ",", "size", "=", "SIZE_SCROLL_IDENTITIES_INDEX", ...
Select the unique identities not seen before `before_date` and delete them from SortingHat. :param es: ElasticSearchDSL object :param sortinghat_db: instance of the SortingHat database :param before_date: datetime str to filter the identities
[ "Select", "the", "unique", "identities", "not", "seen", "before", "before_date", "and", "delete", "them", "from", "SortingHat", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L807-L851
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
retain_identities
def retain_identities(retention_time, es_enrichment_url, sortinghat_db, data_source, active_data_sources): """Select the unique identities not seen before `retention_time` and delete them from SortingHat. Furthermore, it deletes also the orphan unique identities, those ones stored in SortingHat but not in I...
python
def retain_identities(retention_time, es_enrichment_url, sortinghat_db, data_source, active_data_sources): """Select the unique identities not seen before `retention_time` and delete them from SortingHat. Furthermore, it deletes also the orphan unique identities, those ones stored in SortingHat but not in I...
[ "def", "retain_identities", "(", "retention_time", ",", "es_enrichment_url", ",", "sortinghat_db", ",", "data_source", ",", "active_data_sources", ")", ":", "before_date", "=", "get_diff_current_date", "(", "minutes", "=", "retention_time", ")", "before_date_str", "=", ...
Select the unique identities not seen before `retention_time` and delete them from SortingHat. Furthermore, it deletes also the orphan unique identities, those ones stored in SortingHat but not in IDENTITIES_INDEX. :param retention_time: maximum number of minutes wrt the current date to retain the identiti...
[ "Select", "the", "unique", "identities", "not", "seen", "before", "retention_time", "and", "delete", "them", "from", "SortingHat", ".", "Furthermore", "it", "deletes", "also", "the", "orphan", "unique", "identities", "those", "ones", "stored", "in", "SortingHat", ...
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L854-L873
train
chaoss/grimoirelab-elk
grimoire_elk/elk.py
init_backend
def init_backend(backend_cmd): """Init backend within the backend_cmd""" try: backend_cmd.backend except AttributeError: parsed_args = vars(backend_cmd.parsed_args) init_args = find_signature_parameters(backend_cmd.BACKEND, parsed_args) ...
python
def init_backend(backend_cmd): """Init backend within the backend_cmd""" try: backend_cmd.backend except AttributeError: parsed_args = vars(backend_cmd.parsed_args) init_args = find_signature_parameters(backend_cmd.BACKEND, parsed_args) ...
[ "def", "init_backend", "(", "backend_cmd", ")", ":", "try", ":", "backend_cmd", ".", "backend", "except", "AttributeError", ":", "parsed_args", "=", "vars", "(", "backend_cmd", ".", "parsed_args", ")", "init_args", "=", "find_signature_parameters", "(", "backend_c...
Init backend within the backend_cmd
[ "Init", "backend", "within", "the", "backend_cmd" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L876-L887
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.safe_index
def safe_index(cls, unique_id): """ Return a valid elastic index generated from unique_id """ index = unique_id if unique_id: index = unique_id.replace("/", "_").lower() return index
python
def safe_index(cls, unique_id): """ Return a valid elastic index generated from unique_id """ index = unique_id if unique_id: index = unique_id.replace("/", "_").lower() return index
[ "def", "safe_index", "(", "cls", ",", "unique_id", ")", ":", "index", "=", "unique_id", "if", "unique_id", ":", "index", "=", "unique_id", ".", "replace", "(", "\"/\"", ",", "\"_\"", ")", ".", "lower", "(", ")", "return", "index" ]
Return a valid elastic index generated from unique_id
[ "Return", "a", "valid", "elastic", "index", "generated", "from", "unique_id" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L112-L117
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch._check_instance
def _check_instance(url, insecure): """Checks if there is an instance of Elasticsearch in url. Actually, it checks if GET on the url returns a JSON document with a field tagline "You know, for search", and a field version.number. :value url: url of the instance to check ...
python
def _check_instance(url, insecure): """Checks if there is an instance of Elasticsearch in url. Actually, it checks if GET on the url returns a JSON document with a field tagline "You know, for search", and a field version.number. :value url: url of the instance to check ...
[ "def", "_check_instance", "(", "url", ",", "insecure", ")", ":", "res", "=", "grimoire_con", "(", "insecure", ")", ".", "get", "(", "url", ")", "if", "res", ".", "status_code", "!=", "200", ":", "logger", ".", "error", "(", "\"Didn't get 200 OK from url %s...
Checks if there is an instance of Elasticsearch in url. Actually, it checks if GET on the url returns a JSON document with a field tagline "You know, for search", and a field version.number. :value url: url of the instance to check :value insecure: don't verify ssl connect...
[ "Checks", "if", "there", "is", "an", "instance", "of", "Elasticsearch", "in", "url", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L120-L145
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.safe_put_bulk
def safe_put_bulk(self, url, bulk_json): """ Bulk PUT controlling unicode issues """ headers = {"Content-Type": "application/x-ndjson"} try: res = self.requests.put(url + '?refresh=true', data=bulk_json, headers=headers) res.raise_for_status() except UnicodeEnco...
python
def safe_put_bulk(self, url, bulk_json): """ Bulk PUT controlling unicode issues """ headers = {"Content-Type": "application/x-ndjson"} try: res = self.requests.put(url + '?refresh=true', data=bulk_json, headers=headers) res.raise_for_status() except UnicodeEnco...
[ "def", "safe_put_bulk", "(", "self", ",", "url", ",", "bulk_json", ")", ":", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/x-ndjson\"", "}", "try", ":", "res", "=", "self", ".", "requests", ".", "put", "(", "url", "+", "'?refresh=true'", ","...
Bulk PUT controlling unicode issues
[ "Bulk", "PUT", "controlling", "unicode", "issues" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L153-L187
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.all_es_aliases
def all_es_aliases(self): """List all aliases used in ES""" r = self.requests.get(self.url + "/_aliases", headers=HEADER_JSON, verify=False) try: r.raise_for_status() except requests.exceptions.HTTPError as ex: logger.warning("Something went wrong when retrieving...
python
def all_es_aliases(self): """List all aliases used in ES""" r = self.requests.get(self.url + "/_aliases", headers=HEADER_JSON, verify=False) try: r.raise_for_status() except requests.exceptions.HTTPError as ex: logger.warning("Something went wrong when retrieving...
[ "def", "all_es_aliases", "(", "self", ")", ":", "r", "=", "self", ".", "requests", ".", "get", "(", "self", ".", "url", "+", "\"/_aliases\"", ",", "headers", "=", "HEADER_JSON", ",", "verify", "=", "False", ")", "try", ":", "r", ".", "raise_for_status"...
List all aliases used in ES
[ "List", "all", "aliases", "used", "in", "ES" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L189-L206
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.list_aliases
def list_aliases(self): """List aliases linked to the index""" # check alias doesn't exist r = self.requests.get(self.index_url + "/_alias", headers=HEADER_JSON, verify=False) try: r.raise_for_status() except requests.exceptions.HTTPError as ex: logger.wa...
python
def list_aliases(self): """List aliases linked to the index""" # check alias doesn't exist r = self.requests.get(self.index_url + "/_alias", headers=HEADER_JSON, verify=False) try: r.raise_for_status() except requests.exceptions.HTTPError as ex: logger.wa...
[ "def", "list_aliases", "(", "self", ")", ":", "r", "=", "self", ".", "requests", ".", "get", "(", "self", ".", "index_url", "+", "\"/_alias\"", ",", "headers", "=", "HEADER_JSON", ",", "verify", "=", "False", ")", "try", ":", "r", ".", "raise_for_statu...
List aliases linked to the index
[ "List", "aliases", "linked", "to", "the", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L208-L222
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.bulk_upload
def bulk_upload(self, items, field_id): """Upload in controlled packs items to ES using bulk API""" current = 0 new_items = 0 # total items added with bulk bulk_json = "" if not items: return new_items url = self.index_url + '/items/_bulk' logger....
python
def bulk_upload(self, items, field_id): """Upload in controlled packs items to ES using bulk API""" current = 0 new_items = 0 # total items added with bulk bulk_json = "" if not items: return new_items url = self.index_url + '/items/_bulk' logger....
[ "def", "bulk_upload", "(", "self", ",", "items", ",", "field_id", ")", ":", "current", "=", "0", "new_items", "=", "0", "bulk_json", "=", "\"\"", "if", "not", "items", ":", "return", "new_items", "url", "=", "self", ".", "index_url", "+", "'/items/_bulk'...
Upload in controlled packs items to ES using bulk API
[ "Upload", "in", "controlled", "packs", "items", "to", "ES", "using", "bulk", "API" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L270-L305
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.all_properties
def all_properties(self): """Get all properties of a given index""" properties = {} r = self.requests.get(self.index_url + "/_mapping", headers=HEADER_JSON, verify=False) try: r.raise_for_status() r_json = r.json() if 'items' not in r_json[self.index...
python
def all_properties(self): """Get all properties of a given index""" properties = {} r = self.requests.get(self.index_url + "/_mapping", headers=HEADER_JSON, verify=False) try: r.raise_for_status() r_json = r.json() if 'items' not in r_json[self.index...
[ "def", "all_properties", "(", "self", ")", ":", "properties", "=", "{", "}", "r", "=", "self", ".", "requests", ".", "get", "(", "self", ".", "index_url", "+", "\"/_mapping\"", ",", "headers", "=", "HEADER_JSON", ",", "verify", "=", "False", ")", "try"...
Get all properties of a given index
[ "Get", "all", "properties", "of", "a", "given", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L507-L528
train
chaoss/grimoirelab-elk
grimoire_elk/utils.py
get_kibiter_version
def get_kibiter_version(url): """ Return kibiter major number version The url must point to the Elasticsearch used by Kibiter """ config_url = '.kibana/config/_search' # Avoid having // in the URL because ES will fail if url[-1] != '/': url += "/" url += config_url ...
python
def get_kibiter_version(url): """ Return kibiter major number version The url must point to the Elasticsearch used by Kibiter """ config_url = '.kibana/config/_search' # Avoid having // in the URL because ES will fail if url[-1] != '/': url += "/" url += config_url ...
[ "def", "get_kibiter_version", "(", "url", ")", ":", "config_url", "=", "'.kibana/config/_search'", "if", "url", "[", "-", "1", "]", "!=", "'/'", ":", "url", "+=", "\"/\"", "url", "+=", "config_url", "r", "=", "requests", ".", "get", "(", "url", ")", "r...
Return kibiter major number version The url must point to the Elasticsearch used by Kibiter
[ "Return", "kibiter", "major", "number", "version" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L262-L284
train
chaoss/grimoirelab-elk
grimoire_elk/utils.py
get_params
def get_params(): """ Get params definition from ElasticOcean and from all the backends """ parser = get_params_parser() args = parser.parse_args() if not args.enrich_only and not args.only_identities and not args.only_studies: if not args.index: # Check that the raw index name is ...
python
def get_params(): """ Get params definition from ElasticOcean and from all the backends """ parser = get_params_parser() args = parser.parse_args() if not args.enrich_only and not args.only_identities and not args.only_studies: if not args.index: # Check that the raw index name is ...
[ "def", "get_params", "(", ")", ":", "parser", "=", "get_params_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "if", "not", "args", ".", "enrich_only", "and", "not", "args", ".", "only_identities", "and", "not", "args", ".", "only_...
Get params definition from ElasticOcean and from all the backends
[ "Get", "params", "definition", "from", "ElasticOcean", "and", "from", "all", "the", "backends" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L376-L388
train
chaoss/grimoirelab-elk
grimoire_elk/utils.py
get_time_diff_days
def get_time_diff_days(start_txt, end_txt): ''' Number of days between two days ''' if start_txt is None or end_txt is None: return None start = parser.parse(start_txt) end = parser.parse(end_txt) seconds_day = float(60 * 60 * 24) diff_days = \ (end - start).total_seconds() /...
python
def get_time_diff_days(start_txt, end_txt): ''' Number of days between two days ''' if start_txt is None or end_txt is None: return None start = parser.parse(start_txt) end = parser.parse(end_txt) seconds_day = float(60 * 60 * 24) diff_days = \ (end - start).total_seconds() /...
[ "def", "get_time_diff_days", "(", "start_txt", ",", "end_txt", ")", ":", "if", "start_txt", "is", "None", "or", "end_txt", "is", "None", ":", "return", "None", "start", "=", "parser", ".", "parse", "(", "start_txt", ")", "end", "=", "parser", ".", "parse...
Number of days between two days
[ "Number", "of", "days", "between", "two", "days" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L391-L405
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/jira.py
JiraEnrich.enrich_fields
def enrich_fields(cls, fields, eitem): """Enrich the fields property of an issue. Loops through al properties in issue['fields'], using those that are relevant to enrich eitem with new properties. Those properties are user defined, depending on options configured in Jira. For ex...
python
def enrich_fields(cls, fields, eitem): """Enrich the fields property of an issue. Loops through al properties in issue['fields'], using those that are relevant to enrich eitem with new properties. Those properties are user defined, depending on options configured in Jira. For ex...
[ "def", "enrich_fields", "(", "cls", ",", "fields", ",", "eitem", ")", ":", "for", "field", "in", "fields", ":", "if", "field", ".", "startswith", "(", "'customfield_'", ")", ":", "if", "type", "(", "fields", "[", "field", "]", ")", "is", "dict", ":",...
Enrich the fields property of an issue. Loops through al properties in issue['fields'], using those that are relevant to enrich eitem with new properties. Those properties are user defined, depending on options configured in Jira. For example, if SCRUM is activated, we have a fi...
[ "Enrich", "the", "fields", "property", "of", "an", "issue", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jira.py#L197-L226
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/mediawiki.py
MediaWikiEnrich.get_review_sh
def get_review_sh(self, revision, item): """ Add sorting hat enrichment fields for the author of the revision """ identity = self.get_sh_identity(revision) update = parser.parse(item[self.get_field_date()]) erevision = self.get_item_sh_fields(identity, update) return erevision
python
def get_review_sh(self, revision, item): """ Add sorting hat enrichment fields for the author of the revision """ identity = self.get_sh_identity(revision) update = parser.parse(item[self.get_field_date()]) erevision = self.get_item_sh_fields(identity, update) return erevision
[ "def", "get_review_sh", "(", "self", ",", "revision", ",", "item", ")", ":", "identity", "=", "self", ".", "get_sh_identity", "(", "revision", ")", "update", "=", "parser", ".", "parse", "(", "item", "[", "self", ".", "get_field_date", "(", ")", "]", "...
Add sorting hat enrichment fields for the author of the revision
[ "Add", "sorting", "hat", "enrichment", "fields", "for", "the", "author", "of", "the", "revision" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mediawiki.py#L109-L116
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.get_github_cache
def get_github_cache(self, kind, key_): """ Get cache data for items of _type using key_ as the cache dict key """ cache = {} res_size = 100 # best size? from_ = 0 index_github = "github/" + kind url = self.elastic.url + "/" + index_github url += "/_search" + ...
python
def get_github_cache(self, kind, key_): """ Get cache data for items of _type using key_ as the cache dict key """ cache = {} res_size = 100 # best size? from_ = 0 index_github = "github/" + kind url = self.elastic.url + "/" + index_github url += "/_search" + ...
[ "def", "get_github_cache", "(", "self", ",", "kind", ",", "key_", ")", ":", "cache", "=", "{", "}", "res_size", "=", "100", "from_", "=", "0", "index_github", "=", "\"github/\"", "+", "kind", "url", "=", "self", ".", "elastic", ".", "url", "+", "\"/\...
Get cache data for items of _type using key_ as the cache dict key
[ "Get", "cache", "data", "for", "items", "of", "_type", "using", "key_", "as", "the", "cache", "dict", "key" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L194-L222
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.get_time_to_first_attention
def get_time_to_first_attention(self, item): """Get the first date at which a comment or reaction was made to the issue by someone other than the user who created the issue """ comment_dates = [str_to_datetime(comment['created_at']) for comment in item['comments_data'] ...
python
def get_time_to_first_attention(self, item): """Get the first date at which a comment or reaction was made to the issue by someone other than the user who created the issue """ comment_dates = [str_to_datetime(comment['created_at']) for comment in item['comments_data'] ...
[ "def", "get_time_to_first_attention", "(", "self", ",", "item", ")", ":", "comment_dates", "=", "[", "str_to_datetime", "(", "comment", "[", "'created_at'", "]", ")", "for", "comment", "in", "item", "[", "'comments_data'", "]", "if", "item", "[", "'user'", "...
Get the first date at which a comment or reaction was made to the issue by someone other than the user who created the issue
[ "Get", "the", "first", "date", "at", "which", "a", "comment", "or", "reaction", "was", "made", "to", "the", "issue", "by", "someone", "other", "than", "the", "user", "who", "created", "the", "issue" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L267-L278
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.get_time_to_merge_request_response
def get_time_to_merge_request_response(self, item): """Get the first date at which a review was made on the PR by someone other than the user who created the PR """ review_dates = [str_to_datetime(review['created_at']) for review in item['review_comments_data'] if...
python
def get_time_to_merge_request_response(self, item): """Get the first date at which a review was made on the PR by someone other than the user who created the PR """ review_dates = [str_to_datetime(review['created_at']) for review in item['review_comments_data'] if...
[ "def", "get_time_to_merge_request_response", "(", "self", ",", "item", ")", ":", "review_dates", "=", "[", "str_to_datetime", "(", "review", "[", "'created_at'", "]", ")", "for", "review", "in", "item", "[", "'review_comments_data'", "]", "if", "item", "[", "'...
Get the first date at which a review was made on the PR by someone other than the user who created the PR
[ "Get", "the", "first", "date", "at", "which", "a", "review", "was", "made", "on", "the", "PR", "by", "someone", "other", "than", "the", "user", "who", "created", "the", "PR" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L280-L288
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/crates.py
CratesEnrich.get_rich_events
def get_rich_events(self, item): """ In the events there are some common fields with the crate. The name of the field must be the same in the create and in the downloads event so we can filer using it in crate and event at the same time. * Fields that don't change: the field doe...
python
def get_rich_events(self, item): """ In the events there are some common fields with the crate. The name of the field must be the same in the create and in the downloads event so we can filer using it in crate and event at the same time. * Fields that don't change: the field doe...
[ "def", "get_rich_events", "(", "self", ",", "item", ")", ":", "if", "\"version_downloads_data\"", "not", "in", "item", "[", "'data'", "]", ":", "return", "[", "]", "eitem", "=", "self", ".", "get_rich_item", "(", "item", ")", "for", "sample", "in", "item...
In the events there are some common fields with the crate. The name of the field must be the same in the create and in the downloads event so we can filer using it in crate and event at the same time. * Fields that don't change: the field does not change with the events in a create so t...
[ "In", "the", "events", "there", "are", "some", "common", "fields", "with", "the", "crate", ".", "The", "name", "of", "the", "field", "must", "be", "the", "same", "in", "the", "create", "and", "in", "the", "downloads", "event", "so", "we", "can", "filer...
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/crates.py#L99-L125
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/twitter.py
TwitterEnrich.get_item_project
def get_item_project(self, eitem): """ Get project mapping enrichment field. Twitter mappings is pretty special so it needs a special implementacion. """ project = None eitem_project = {} ds_name = self.get_connector_name() # data source name in projects map ...
python
def get_item_project(self, eitem): """ Get project mapping enrichment field. Twitter mappings is pretty special so it needs a special implementacion. """ project = None eitem_project = {} ds_name = self.get_connector_name() # data source name in projects map ...
[ "def", "get_item_project", "(", "self", ",", "eitem", ")", ":", "project", "=", "None", "eitem_project", "=", "{", "}", "ds_name", "=", "self", ".", "get_connector_name", "(", ")", "if", "ds_name", "not", "in", "self", ".", "prjs_map", ":", "return", "ei...
Get project mapping enrichment field. Twitter mappings is pretty special so it needs a special implementacion.
[ "Get", "project", "mapping", "enrichment", "field", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/twitter.py#L93-L121
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/jenkins.py
JenkinsEnrich.get_fields_from_job_name
def get_fields_from_job_name(self, job_name): """Analyze a Jenkins job name, producing a dictionary The produced dictionary will include information about the category and subcategory of the job name, and any extra information which could be useful. For each deployment of a Jen...
python
def get_fields_from_job_name(self, job_name): """Analyze a Jenkins job name, producing a dictionary The produced dictionary will include information about the category and subcategory of the job name, and any extra information which could be useful. For each deployment of a Jen...
[ "def", "get_fields_from_job_name", "(", "self", ",", "job_name", ")", ":", "extra_fields", "=", "{", "'category'", ":", "None", ",", "'installer'", ":", "None", ",", "'scenario'", ":", "None", ",", "'testproject'", ":", "None", ",", "'pod'", ":", "None", "...
Analyze a Jenkins job name, producing a dictionary The produced dictionary will include information about the category and subcategory of the job name, and any extra information which could be useful. For each deployment of a Jenkins dashboard, an implementation of this functio...
[ "Analyze", "a", "Jenkins", "job", "name", "producing", "a", "dictionary" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jenkins.py#L122-L174
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/jenkins.py
JenkinsEnrich.extract_builton
def extract_builton(self, built_on, regex): """Extracts node name using a regular expression. Node name is expected to be group 1. """ pattern = re.compile(regex, re.M | re.I) match = pattern.search(built_on) if match and len(match.groups()) >= 1: node_name = ...
python
def extract_builton(self, built_on, regex): """Extracts node name using a regular expression. Node name is expected to be group 1. """ pattern = re.compile(regex, re.M | re.I) match = pattern.search(built_on) if match and len(match.groups()) >= 1: node_name = ...
[ "def", "extract_builton", "(", "self", ",", "built_on", ",", "regex", ")", ":", "pattern", "=", "re", ".", "compile", "(", "regex", ",", "re", ".", "M", "|", "re", ".", "I", ")", "match", "=", "pattern", ".", "search", "(", "built_on", ")", "if", ...
Extracts node name using a regular expression. Node name is expected to be group 1.
[ "Extracts", "node", "name", "using", "a", "regular", "expression", ".", "Node", "name", "is", "expected", "to", "be", "group", "1", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jenkins.py#L176-L189
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
onion_study
def onion_study(in_conn, out_conn, data_source): """Build and index for onion from a given Git index. :param in_conn: ESPandasConnector to read from. :param out_conn: ESPandasConnector to write to. :param data_source: name of the date source to generate onion from. :return: number of documents writ...
python
def onion_study(in_conn, out_conn, data_source): """Build and index for onion from a given Git index. :param in_conn: ESPandasConnector to read from. :param out_conn: ESPandasConnector to write to. :param data_source: name of the date source to generate onion from. :return: number of documents writ...
[ "def", "onion_study", "(", "in_conn", ",", "out_conn", ",", "data_source", ")", ":", "onion", "=", "OnionStudy", "(", "in_connector", "=", "in_conn", ",", "out_connector", "=", "out_conn", ",", "data_source", "=", "data_source", ")", "ndocs", "=", "onion", "...
Build and index for onion from a given Git index. :param in_conn: ESPandasConnector to read from. :param out_conn: ESPandasConnector to write to. :param data_source: name of the date source to generate onion from. :return: number of documents written in ElasticSearch enriched index.
[ "Build", "and", "index", "for", "onion", "from", "a", "given", "Git", "index", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L371-L381
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
ESOnionConnector.read_block
def read_block(self, size=None, from_date=None): """Read author commits by Quarter, Org and Project. :param from_date: not used here. Incremental mode not supported yet. :param size: not used here. :return: DataFrame with commit count per author, split by quarter, org and project. ...
python
def read_block(self, size=None, from_date=None): """Read author commits by Quarter, Org and Project. :param from_date: not used here. Incremental mode not supported yet. :param size: not used here. :return: DataFrame with commit count per author, split by quarter, org and project. ...
[ "def", "read_block", "(", "self", ",", "size", "=", "None", ",", "from_date", "=", "None", ")", ":", "quarters", "=", "self", ".", "__quarters", "(", ")", "for", "quarter", "in", "quarters", ":", "logger", ".", "info", "(", "self", ".", "__log_prefix",...
Read author commits by Quarter, Org and Project. :param from_date: not used here. Incremental mode not supported yet. :param size: not used here. :return: DataFrame with commit count per author, split by quarter, org and project.
[ "Read", "author", "commits", "by", "Quarter", "Org", "and", "Project", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L72-L131
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
ESOnionConnector.__quarters
def __quarters(self, from_date=None): """Get a set of quarters with available items from a given index date. :param from_date: :return: list of `pandas.Period` corresponding to quarters """ s = Search(using=self._es_conn, index=self._es_index) if from_date: #...
python
def __quarters(self, from_date=None): """Get a set of quarters with available items from a given index date. :param from_date: :return: list of `pandas.Period` corresponding to quarters """ s = Search(using=self._es_conn, index=self._es_index) if from_date: #...
[ "def", "__quarters", "(", "self", ",", "from_date", "=", "None", ")", ":", "s", "=", "Search", "(", "using", "=", "self", ".", "_es_conn", ",", "index", "=", "self", ".", "_es_index", ")", "if", "from_date", ":", "q", "=", "Q", "(", "'range'", ")",...
Get a set of quarters with available items from a given index date. :param from_date: :return: list of `pandas.Period` corresponding to quarters
[ "Get", "a", "set", "of", "quarters", "with", "available", "items", "from", "a", "given", "index", "date", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L214-L239
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
ESOnionConnector.__list_uniques
def __list_uniques(self, date_range, field_name): """Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values. """ # Get project list s = Search(using=self._es_conn, index=self._e...
python
def __list_uniques(self, date_range, field_name): """Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values. """ # Get project list s = Search(using=self._es_conn, index=self._e...
[ "def", "__list_uniques", "(", "self", ",", "date_range", ",", "field_name", ")", ":", "s", "=", "Search", "(", "using", "=", "self", ".", "_es_conn", ",", "index", "=", "self", ".", "_es_index", ")", "s", "=", "s", ".", "filter", "(", "'range'", ",",...
Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values.
[ "Retrieve", "a", "list", "of", "unique", "values", "in", "a", "given", "field", "within", "a", "date", "range", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L241-L259
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
ESOnionConnector.__build_dataframe
def __build_dataframe(self, timing, project_name=None, org_name=None): """Build a DataFrame from a time bucket. :param timing: :param project_name: :param org_name: :return: """ date_list = [] uuid_list = [] name_list = [] contribs_list = ...
python
def __build_dataframe(self, timing, project_name=None, org_name=None): """Build a DataFrame from a time bucket. :param timing: :param project_name: :param org_name: :return: """ date_list = [] uuid_list = [] name_list = [] contribs_list = ...
[ "def", "__build_dataframe", "(", "self", ",", "timing", ",", "project_name", "=", "None", ",", "org_name", "=", "None", ")", ":", "date_list", "=", "[", "]", "uuid_list", "=", "[", "]", "name_list", "=", "[", "]", "contribs_list", "=", "[", "]", "lates...
Build a DataFrame from a time bucket. :param timing: :param project_name: :param org_name: :return:
[ "Build", "a", "DataFrame", "from", "a", "time", "bucket", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L285-L326
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
OnionStudy.process
def process(self, items_block): """Process a DataFrame to compute Onion. :param items_block: items to be processed. Expects to find a pandas DataFrame. """ logger.info(self.__log_prefix + " Authors to process: " + str(len(items_block))) onion_enrich = Onion(items_block) ...
python
def process(self, items_block): """Process a DataFrame to compute Onion. :param items_block: items to be processed. Expects to find a pandas DataFrame. """ logger.info(self.__log_prefix + " Authors to process: " + str(len(items_block))) onion_enrich = Onion(items_block) ...
[ "def", "process", "(", "self", ",", "items_block", ")", ":", "logger", ".", "info", "(", "self", ".", "__log_prefix", "+", "\" Authors to process: \"", "+", "str", "(", "len", "(", "items_block", ")", ")", ")", "onion_enrich", "=", "Onion", "(", "items_blo...
Process a DataFrame to compute Onion. :param items_block: items to be processed. Expects to find a pandas DataFrame.
[ "Process", "a", "DataFrame", "to", "compute", "Onion", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L346-L368
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/projects.py
GrimoireLibProjects.get_projects
def get_projects(self): """ Get the projects list from database """ repos_list = [] gerrit_projects_db = self.projects_db db = Database(user="root", passwd="", host="localhost", port=3306, scrdb=None, shdb=gerrit_projects_db, prjdb=None) sql = """ ...
python
def get_projects(self): """ Get the projects list from database """ repos_list = [] gerrit_projects_db = self.projects_db db = Database(user="root", passwd="", host="localhost", port=3306, scrdb=None, shdb=gerrit_projects_db, prjdb=None) sql = """ ...
[ "def", "get_projects", "(", "self", ")", ":", "repos_list", "=", "[", "]", "gerrit_projects_db", "=", "self", ".", "projects_db", "db", "=", "Database", "(", "user", "=", "\"root\"", ",", "passwd", "=", "\"\"", ",", "host", "=", "\"localhost\"", ",", "po...
Get the projects list from database
[ "Get", "the", "projects", "list", "from", "database" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/projects.py#L37-L62
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
metadata
def metadata(func): """Add metadata to an item. Decorator that adds metadata to a given item such as the gelk revision used. """ @functools.wraps(func) def decorator(self, *args, **kwargs): eitem = func(self, *args, **kwargs) metadata = { 'metadata__gelk_version': s...
python
def metadata(func): """Add metadata to an item. Decorator that adds metadata to a given item such as the gelk revision used. """ @functools.wraps(func) def decorator(self, *args, **kwargs): eitem = func(self, *args, **kwargs) metadata = { 'metadata__gelk_version': s...
[ "def", "metadata", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "decorator", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "eitem", "=", "func", "(", "self", ",", "*", "args", ",", "**", "kwargs"...
Add metadata to an item. Decorator that adds metadata to a given item such as the gelk revision used.
[ "Add", "metadata", "to", "an", "item", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L78-L95
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_grimoire_fields
def get_grimoire_fields(self, creation_date, item_name): """ Return common grimoire fields for all data sources """ grimoire_date = None try: grimoire_date = str_to_datetime(creation_date).isoformat() except Exception as ex: pass name = "is_" + self.get_...
python
def get_grimoire_fields(self, creation_date, item_name): """ Return common grimoire fields for all data sources """ grimoire_date = None try: grimoire_date = str_to_datetime(creation_date).isoformat() except Exception as ex: pass name = "is_" + self.get_...
[ "def", "get_grimoire_fields", "(", "self", ",", "creation_date", ",", "item_name", ")", ":", "grimoire_date", "=", "None", "try", ":", "grimoire_date", "=", "str_to_datetime", "(", "creation_date", ")", ".", "isoformat", "(", ")", "except", "Exception", "as", ...
Return common grimoire fields for all data sources
[ "Return", "common", "grimoire", "fields", "for", "all", "data", "sources" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L489-L503
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.add_project_levels
def add_project_levels(cls, project): """ Add project sub levels extra items """ eitem_path = '' eitem_project_levels = {} if project is not None: subprojects = project.split('.') for i in range(0, len(subprojects)): if i > 0: ...
python
def add_project_levels(cls, project): """ Add project sub levels extra items """ eitem_path = '' eitem_project_levels = {} if project is not None: subprojects = project.split('.') for i in range(0, len(subprojects)): if i > 0: ...
[ "def", "add_project_levels", "(", "cls", ",", "project", ")", ":", "eitem_path", "=", "''", "eitem_project_levels", "=", "{", "}", "if", "project", "is", "not", "None", ":", "subprojects", "=", "project", ".", "split", "(", "'.'", ")", "for", "i", "in", ...
Add project sub levels extra items
[ "Add", "project", "sub", "levels", "extra", "items" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L515-L529
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_item_metadata
def get_item_metadata(self, eitem): """ In the projects.json file, inside each project, there is a field called "meta" which has a dictionary with fields to be added to the enriched items for this project. This fields must be added with the prefix cm_ (custom metadata). This me...
python
def get_item_metadata(self, eitem): """ In the projects.json file, inside each project, there is a field called "meta" which has a dictionary with fields to be added to the enriched items for this project. This fields must be added with the prefix cm_ (custom metadata). This me...
[ "def", "get_item_metadata", "(", "self", ",", "eitem", ")", ":", "eitem_metadata", "=", "{", "}", "project", "=", "self", ".", "find_item_project", "(", "eitem", ")", "if", "project", "and", "'meta'", "in", "self", ".", "json_projects", "[", "project", "]"...
In the projects.json file, inside each project, there is a field called "meta" which has a dictionary with fields to be added to the enriched items for this project. This fields must be added with the prefix cm_ (custom metadata). This method fetch the metadata fields for the project in which ...
[ "In", "the", "projects", ".", "json", "file", "inside", "each", "project", "there", "is", "a", "field", "called", "meta", "which", "has", "a", "dictionary", "with", "fields", "to", "be", "added", "to", "the", "enriched", "items", "for", "this", "project", ...
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L607-L630
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_domain
def get_domain(self, identity): """ Get the domain from a SH identity """ domain = None if identity['email']: try: domain = identity['email'].split("@")[1] except IndexError: # logger.warning("Bad email format: %s" % (identity['email'])) ...
python
def get_domain(self, identity): """ Get the domain from a SH identity """ domain = None if identity['email']: try: domain = identity['email'].split("@")[1] except IndexError: # logger.warning("Bad email format: %s" % (identity['email'])) ...
[ "def", "get_domain", "(", "self", ",", "identity", ")", ":", "domain", "=", "None", "if", "identity", "[", "'email'", "]", ":", "try", ":", "domain", "=", "identity", "[", "'email'", "]", ".", "split", "(", "\"@\"", ")", "[", "1", "]", "except", "I...
Get the domain from a SH identity
[ "Get", "the", "domain", "from", "a", "SH", "identity" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L640-L649
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_enrollment
def get_enrollment(self, uuid, item_date): """ Get the enrollment for the uuid when the item was done """ # item_date must be offset-naive (utc) if item_date and item_date.tzinfo: item_date = (item_date - item_date.utcoffset()).replace(tzinfo=None) enrollments = self.get_enr...
python
def get_enrollment(self, uuid, item_date): """ Get the enrollment for the uuid when the item was done """ # item_date must be offset-naive (utc) if item_date and item_date.tzinfo: item_date = (item_date - item_date.utcoffset()).replace(tzinfo=None) enrollments = self.get_enr...
[ "def", "get_enrollment", "(", "self", ",", "uuid", ",", "item_date", ")", ":", "if", "item_date", "and", "item_date", ".", "tzinfo", ":", "item_date", "=", "(", "item_date", "-", "item_date", ".", "utcoffset", "(", ")", ")", ".", "replace", "(", "tzinfo"...
Get the enrollment for the uuid when the item was done
[ "Get", "the", "enrollment", "for", "the", "uuid", "when", "the", "item", "was", "done" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L658-L674
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.__get_item_sh_fields_empty
def __get_item_sh_fields_empty(self, rol, undefined=False): """ Return a SH identity with all fields to empty_field """ # If empty_field is None, the fields do not appear in index patterns empty_field = '' if not undefined else '-- UNDEFINED --' return { rol + "_id": empty_fi...
python
def __get_item_sh_fields_empty(self, rol, undefined=False): """ Return a SH identity with all fields to empty_field """ # If empty_field is None, the fields do not appear in index patterns empty_field = '' if not undefined else '-- UNDEFINED --' return { rol + "_id": empty_fi...
[ "def", "__get_item_sh_fields_empty", "(", "self", ",", "rol", ",", "undefined", "=", "False", ")", ":", "empty_field", "=", "''", "if", "not", "undefined", "else", "'-- UNDEFINED --'", "return", "{", "rol", "+", "\"_id\"", ":", "empty_field", ",", "rol", "+"...
Return a SH identity with all fields to empty_field
[ "Return", "a", "SH", "identity", "with", "all", "fields", "to", "empty_field" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L676-L690
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_item_sh_fields
def get_item_sh_fields(self, identity=None, item_date=None, sh_id=None, rol='author'): """ Get standard SH fields from a SH identity """ eitem_sh = self.__get_item_sh_fields_empty(rol) if identity: # Use the identity to get the SortingHat identity ...
python
def get_item_sh_fields(self, identity=None, item_date=None, sh_id=None, rol='author'): """ Get standard SH fields from a SH identity """ eitem_sh = self.__get_item_sh_fields_empty(rol) if identity: # Use the identity to get the SortingHat identity ...
[ "def", "get_item_sh_fields", "(", "self", ",", "identity", "=", "None", ",", "item_date", "=", "None", ",", "sh_id", "=", "None", ",", "rol", "=", "'author'", ")", ":", "eitem_sh", "=", "self", ".", "__get_item_sh_fields_empty", "(", "rol", ")", "if", "i...
Get standard SH fields from a SH identity
[ "Get", "standard", "SH", "fields", "from", "a", "SH", "identity" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L692-L741
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_item_sh
def get_item_sh(self, item, roles=None, date_field=None): """ Add sorting hat enrichment fields for different roles If there are no roles, just add the author fields. """ eitem_sh = {} # Item enriched author_field = self.get_field_author() if not roles: ...
python
def get_item_sh(self, item, roles=None, date_field=None): """ Add sorting hat enrichment fields for different roles If there are no roles, just add the author fields. """ eitem_sh = {} # Item enriched author_field = self.get_field_author() if not roles: ...
[ "def", "get_item_sh", "(", "self", ",", "item", ",", "roles", "=", "None", ",", "date_field", "=", "None", ")", ":", "eitem_sh", "=", "{", "}", "author_field", "=", "self", ".", "get_field_author", "(", ")", "if", "not", "roles", ":", "roles", "=", "...
Add sorting hat enrichment fields for different roles If there are no roles, just add the author fields.
[ "Add", "sorting", "hat", "enrichment", "fields", "for", "different", "roles" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L801-L852
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/enrich.py
Enrich.get_sh_ids
def get_sh_ids(self, identity, backend_name): """ Return the Sorting Hat id and uuid for an identity """ # Convert the dict to tuple so it is hashable identity_tuple = tuple(identity.items()) sh_ids = self.__get_sh_ids_cache(identity_tuple, backend_name) return sh_ids
python
def get_sh_ids(self, identity, backend_name): """ Return the Sorting Hat id and uuid for an identity """ # Convert the dict to tuple so it is hashable identity_tuple = tuple(identity.items()) sh_ids = self.__get_sh_ids_cache(identity_tuple, backend_name) return sh_ids
[ "def", "get_sh_ids", "(", "self", ",", "identity", ",", "backend_name", ")", ":", "identity_tuple", "=", "tuple", "(", "identity", ".", "items", "(", ")", ")", "sh_ids", "=", "self", ".", "__get_sh_ids_cache", "(", "identity_tuple", ",", "backend_name", ")",...
Return the Sorting Hat id and uuid for an identity
[ "Return", "the", "Sorting", "Hat", "id", "and", "uuid", "for", "an", "identity" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/enrich.py#L867-L872
train
chaoss/grimoirelab-elk
grimoire_elk/elastic_items.py
ElasticItems.get_repository_filter_raw
def get_repository_filter_raw(self, term=False): """ Returns the filter to be used in queries in a repository items """ perceval_backend_name = self.get_connector_name() filter_ = get_repository_filter(self.perceval_backend, perceval_backend_name, term) return filter_
python
def get_repository_filter_raw(self, term=False): """ Returns the filter to be used in queries in a repository items """ perceval_backend_name = self.get_connector_name() filter_ = get_repository_filter(self.perceval_backend, perceval_backend_name, term) return filter_
[ "def", "get_repository_filter_raw", "(", "self", ",", "term", "=", "False", ")", ":", "perceval_backend_name", "=", "self", ".", "get_connector_name", "(", ")", "filter_", "=", "get_repository_filter", "(", "self", ".", "perceval_backend", ",", "perceval_backend_nam...
Returns the filter to be used in queries in a repository items
[ "Returns", "the", "filter", "to", "be", "used", "in", "queries", "in", "a", "repository", "items" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic_items.py#L67-L71
train
chaoss/grimoirelab-elk
grimoire_elk/elastic_items.py
ElasticItems.set_filter_raw
def set_filter_raw(self, filter_raw): """Filter to be used when getting items from Ocean index""" self.filter_raw = filter_raw self.filter_raw_dict = [] splitted = re.compile(FILTER_SEPARATOR).split(filter_raw) for fltr_raw in splitted: fltr = self.__process_filter(...
python
def set_filter_raw(self, filter_raw): """Filter to be used when getting items from Ocean index""" self.filter_raw = filter_raw self.filter_raw_dict = [] splitted = re.compile(FILTER_SEPARATOR).split(filter_raw) for fltr_raw in splitted: fltr = self.__process_filter(...
[ "def", "set_filter_raw", "(", "self", ",", "filter_raw", ")", ":", "self", ".", "filter_raw", "=", "filter_raw", "self", ".", "filter_raw_dict", "=", "[", "]", "splitted", "=", "re", ".", "compile", "(", "FILTER_SEPARATOR", ")", ".", "split", "(", "filter_...
Filter to be used when getting items from Ocean index
[ "Filter", "to", "be", "used", "when", "getting", "items", "from", "Ocean", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic_items.py#L104-L114
train
chaoss/grimoirelab-elk
grimoire_elk/elastic_items.py
ElasticItems.set_filter_raw_should
def set_filter_raw_should(self, filter_raw_should): """Bool filter should to be used when getting items from Ocean index""" self.filter_raw_should = filter_raw_should self.filter_raw_should_dict = [] splitted = re.compile(FILTER_SEPARATOR).split(filter_raw_should) for fltr_raw ...
python
def set_filter_raw_should(self, filter_raw_should): """Bool filter should to be used when getting items from Ocean index""" self.filter_raw_should = filter_raw_should self.filter_raw_should_dict = [] splitted = re.compile(FILTER_SEPARATOR).split(filter_raw_should) for fltr_raw ...
[ "def", "set_filter_raw_should", "(", "self", ",", "filter_raw_should", ")", ":", "self", ".", "filter_raw_should", "=", "filter_raw_should", "self", ".", "filter_raw_should_dict", "=", "[", "]", "splitted", "=", "re", ".", "compile", "(", "FILTER_SEPARATOR", ")", ...
Bool filter should to be used when getting items from Ocean index
[ "Bool", "filter", "should", "to", "be", "used", "when", "getting", "items", "from", "Ocean", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic_items.py#L116-L126
train
chaoss/grimoirelab-elk
grimoire_elk/elastic_items.py
ElasticItems.fetch
def fetch(self, _filter=None, ignore_incremental=False): """ Fetch the items from raw or enriched index. An optional _filter could be provided to filter the data collected """ logger.debug("Creating a elastic items generator.") scroll_id = None page = self.get_elastic_items(scr...
python
def fetch(self, _filter=None, ignore_incremental=False): """ Fetch the items from raw or enriched index. An optional _filter could be provided to filter the data collected """ logger.debug("Creating a elastic items generator.") scroll_id = None page = self.get_elastic_items(scr...
[ "def", "fetch", "(", "self", ",", "_filter", "=", "None", ",", "ignore_incremental", "=", "False", ")", ":", "logger", ".", "debug", "(", "\"Creating a elastic items generator.\"", ")", "scroll_id", "=", "None", "page", "=", "self", ".", "get_elastic_items", "...
Fetch the items from raw or enriched index. An optional _filter could be provided to filter the data collected
[ "Fetch", "the", "items", "from", "raw", "or", "enriched", "index", ".", "An", "optional", "_filter", "could", "be", "provided", "to", "filter", "the", "data", "collected" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic_items.py#L140-L174
train
chaoss/grimoirelab-elk
utils/index_mapping.py
find_uuid
def find_uuid(es_url, index): """ Find the unique identifier field for a given index """ uid_field = None # Get the first item to detect the data source and raw/enriched type res = requests.get('%s/%s/_search?size=1' % (es_url, index)) first_item = res.json()['hits']['hits'][0]['_source'] fiel...
python
def find_uuid(es_url, index): """ Find the unique identifier field for a given index """ uid_field = None # Get the first item to detect the data source and raw/enriched type res = requests.get('%s/%s/_search?size=1' % (es_url, index)) first_item = res.json()['hits']['hits'][0]['_source'] fiel...
[ "def", "find_uuid", "(", "es_url", ",", "index", ")", ":", "uid_field", "=", "None", "res", "=", "requests", ".", "get", "(", "'%s/%s/_search?size=1'", "%", "(", "es_url", ",", "index", ")", ")", "first_item", "=", "res", ".", "json", "(", ")", "[", ...
Find the unique identifier field for a given index
[ "Find", "the", "unique", "identifier", "field", "for", "a", "given", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/index_mapping.py#L62-L89
train
chaoss/grimoirelab-elk
utils/index_mapping.py
find_mapping
def find_mapping(es_url, index): """ Find the mapping given an index """ mapping = None backend = find_perceval_backend(es_url, index) if backend: mapping = backend.get_elastic_mappings() if mapping: logging.debug("MAPPING FOUND:\n%s", json.dumps(json.loads(mapping['items']), ind...
python
def find_mapping(es_url, index): """ Find the mapping given an index """ mapping = None backend = find_perceval_backend(es_url, index) if backend: mapping = backend.get_elastic_mappings() if mapping: logging.debug("MAPPING FOUND:\n%s", json.dumps(json.loads(mapping['items']), ind...
[ "def", "find_mapping", "(", "es_url", ",", "index", ")", ":", "mapping", "=", "None", "backend", "=", "find_perceval_backend", "(", "es_url", ",", "index", ")", "if", "backend", ":", "mapping", "=", "backend", ".", "get_elastic_mappings", "(", ")", "if", "...
Find the mapping given an index
[ "Find", "the", "mapping", "given", "an", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/index_mapping.py#L130-L142
train
chaoss/grimoirelab-elk
utils/index_mapping.py
get_elastic_items
def get_elastic_items(elastic, elastic_scroll_id=None, limit=None): """ Get the items from the index """ scroll_size = limit if not limit: scroll_size = DEFAULT_LIMIT if not elastic: return None url = elastic.index_url max_process_items_pack_time = "5m" # 10 minutes url +...
python
def get_elastic_items(elastic, elastic_scroll_id=None, limit=None): """ Get the items from the index """ scroll_size = limit if not limit: scroll_size = DEFAULT_LIMIT if not elastic: return None url = elastic.index_url max_process_items_pack_time = "5m" # 10 minutes url +...
[ "def", "get_elastic_items", "(", "elastic", ",", "elastic_scroll_id", "=", "None", ",", "limit", "=", "None", ")", ":", "scroll_size", "=", "limit", "if", "not", "limit", ":", "scroll_size", "=", "DEFAULT_LIMIT", "if", "not", "elastic", ":", "return", "None"...
Get the items from the index
[ "Get", "the", "items", "from", "the", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/index_mapping.py#L145-L190
train
chaoss/grimoirelab-elk
utils/index_mapping.py
fetch
def fetch(elastic, backend, limit=None, search_after_value=None, scroll=True): """ Fetch the items from raw or enriched index """ logging.debug("Creating a elastic items generator.") elastic_scroll_id = None search_after = search_after_value while True: if scroll: rjson = get_...
python
def fetch(elastic, backend, limit=None, search_after_value=None, scroll=True): """ Fetch the items from raw or enriched index """ logging.debug("Creating a elastic items generator.") elastic_scroll_id = None search_after = search_after_value while True: if scroll: rjson = get_...
[ "def", "fetch", "(", "elastic", ",", "backend", ",", "limit", "=", "None", ",", "search_after_value", "=", "None", ",", "scroll", "=", "True", ")", ":", "logging", ".", "debug", "(", "\"Creating a elastic items generator.\"", ")", "elastic_scroll_id", "=", "No...
Fetch the items from raw or enriched index
[ "Fetch", "the", "items", "from", "raw", "or", "enriched", "index" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/index_mapping.py#L261-L294
train
chaoss/grimoirelab-elk
utils/index_mapping.py
export_items
def export_items(elastic_url, in_index, out_index, elastic_url_out=None, search_after=False, search_after_value=None, limit=None, copy=False): """ Export items from in_index to out_index using the correct mapping """ if not limit: limit = DEFAULT_LIMIT if search_a...
python
def export_items(elastic_url, in_index, out_index, elastic_url_out=None, search_after=False, search_after_value=None, limit=None, copy=False): """ Export items from in_index to out_index using the correct mapping """ if not limit: limit = DEFAULT_LIMIT if search_a...
[ "def", "export_items", "(", "elastic_url", ",", "in_index", ",", "out_index", ",", "elastic_url_out", "=", "None", ",", "search_after", "=", "False", ",", "search_after_value", "=", "None", ",", "limit", "=", "None", ",", "copy", "=", "False", ")", ":", "i...
Export items from in_index to out_index using the correct mapping
[ "Export", "items", "from", "in_index", "to", "out_index", "using", "the", "correct", "mapping" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/index_mapping.py#L297-L347
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/gerrit.py
GerritEnrich._fix_review_dates
def _fix_review_dates(self, item): """Convert dates so ES detect them""" for date_field in ['timestamp', 'createdOn', 'lastUpdated']: if date_field in item.keys(): date_ts = item[date_field] item[date_field] = unixtime_to_datetime(date_ts).isoformat() ...
python
def _fix_review_dates(self, item): """Convert dates so ES detect them""" for date_field in ['timestamp', 'createdOn', 'lastUpdated']: if date_field in item.keys(): date_ts = item[date_field] item[date_field] = unixtime_to_datetime(date_ts).isoformat() ...
[ "def", "_fix_review_dates", "(", "self", ",", "item", ")", ":", "for", "date_field", "in", "[", "'timestamp'", ",", "'createdOn'", ",", "'lastUpdated'", "]", ":", "if", "date_field", "in", "item", ".", "keys", "(", ")", ":", "date_ts", "=", "item", "[", ...
Convert dates so ES detect them
[ "Convert", "dates", "so", "ES", "detect", "them" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/gerrit.py#L145-L166
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/bugzilla.py
BugzillaEnrich.get_sh_identity
def get_sh_identity(self, item, identity_field=None): """ Return a Sorting Hat identity using bugzilla user data """ def fill_list_identity(identity, user_list_data): """ Fill identity with user data in first item in list """ identity['username'] = user_list_data[0]['__text__'] ...
python
def get_sh_identity(self, item, identity_field=None): """ Return a Sorting Hat identity using bugzilla user data """ def fill_list_identity(identity, user_list_data): """ Fill identity with user data in first item in list """ identity['username'] = user_list_data[0]['__text__'] ...
[ "def", "get_sh_identity", "(", "self", ",", "item", ",", "identity_field", "=", "None", ")", ":", "def", "fill_list_identity", "(", "identity", ",", "user_list_data", ")", ":", "identity", "[", "'username'", "]", "=", "user_list_data", "[", "0", "]", "[", ...
Return a Sorting Hat identity using bugzilla user data
[ "Return", "a", "Sorting", "Hat", "identity", "using", "bugzilla", "user", "data" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/bugzilla.py#L47-L70
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
CeresBase.analyze
def analyze(self): """Populate an enriched index by processing input items in blocks. :return: total number of out_items written. """ from_date = self._out.latest_date() if from_date: logger.info("Reading items since " + from_date) else: logger.in...
python
def analyze(self): """Populate an enriched index by processing input items in blocks. :return: total number of out_items written. """ from_date = self._out.latest_date() if from_date: logger.info("Reading items since " + from_date) else: logger.in...
[ "def", "analyze", "(", "self", ")", ":", "from_date", "=", "self", ".", "_out", ".", "latest_date", "(", ")", "if", "from_date", ":", "logger", ".", "info", "(", "\"Reading items since \"", "+", "from_date", ")", "else", ":", "logger", ".", "info", "(", ...
Populate an enriched index by processing input items in blocks. :return: total number of out_items written.
[ "Populate", "an", "enriched", "index", "by", "processing", "input", "items", "in", "blocks", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L77-L119
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector.read_item
def read_item(self, from_date=None): """Read items and return them one by one. :param from_date: start date for incremental reading. :return: next single item when any available. :raises ValueError: `metadata__timestamp` field not found in index :raises NotFoundError: index not ...
python
def read_item(self, from_date=None): """Read items and return them one by one. :param from_date: start date for incremental reading. :return: next single item when any available. :raises ValueError: `metadata__timestamp` field not found in index :raises NotFoundError: index not ...
[ "def", "read_item", "(", "self", ",", "from_date", "=", "None", ")", ":", "search_query", "=", "self", ".", "_build_search_query", "(", "from_date", ")", "for", "hit", "in", "helpers", ".", "scan", "(", "self", ".", "_es_conn", ",", "search_query", ",", ...
Read items and return them one by one. :param from_date: start date for incremental reading. :return: next single item when any available. :raises ValueError: `metadata__timestamp` field not found in index :raises NotFoundError: index not found in ElasticSearch
[ "Read", "items", "and", "return", "them", "one", "by", "one", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L161-L175
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector.read_block
def read_block(self, size, from_date=None): """Read items and return them in blocks. :param from_date: start date for incremental reading. :param size: block size. :return: next block of items when any available. :raises ValueError: `metadata__timestamp` field not found in index...
python
def read_block(self, size, from_date=None): """Read items and return them in blocks. :param from_date: start date for incremental reading. :param size: block size. :return: next block of items when any available. :raises ValueError: `metadata__timestamp` field not found in index...
[ "def", "read_block", "(", "self", ",", "size", ",", "from_date", "=", "None", ")", ":", "search_query", "=", "self", ".", "_build_search_query", "(", "from_date", ")", "hits_block", "=", "[", "]", "for", "hit", "in", "helpers", ".", "scan", "(", "self", ...
Read items and return them in blocks. :param from_date: start date for incremental reading. :param size: block size. :return: next block of items when any available. :raises ValueError: `metadata__timestamp` field not found in index :raises NotFoundError: index not found in Elas...
[ "Read", "items", "and", "return", "them", "in", "blocks", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L177-L203
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector.write
def write(self, items): """Upload items to ElasticSearch. :param items: items to be uploaded. """ if self._read_only: raise IOError("Cannot write, Connector created as Read Only") # Uploading info to the new ES docs = [] for item in items: ...
python
def write(self, items): """Upload items to ElasticSearch. :param items: items to be uploaded. """ if self._read_only: raise IOError("Cannot write, Connector created as Read Only") # Uploading info to the new ES docs = [] for item in items: ...
[ "def", "write", "(", "self", ",", "items", ")", ":", "if", "self", ".", "_read_only", ":", "raise", "IOError", "(", "\"Cannot write, Connector created as Read Only\"", ")", "docs", "=", "[", "]", "for", "item", "in", "items", ":", "doc", "=", "{", "\"_inde...
Upload items to ElasticSearch. :param items: items to be uploaded.
[ "Upload", "items", "to", "ElasticSearch", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L205-L225
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector.create_alias
def create_alias(self, alias_name): """Creates an alias pointing to the index configured in this connection""" return self._es_conn.indices.put_alias(index=self._es_index, name=alias_name)
python
def create_alias(self, alias_name): """Creates an alias pointing to the index configured in this connection""" return self._es_conn.indices.put_alias(index=self._es_index, name=alias_name)
[ "def", "create_alias", "(", "self", ",", "alias_name", ")", ":", "return", "self", ".", "_es_conn", ".", "indices", ".", "put_alias", "(", "index", "=", "self", ".", "_es_index", ",", "name", "=", "alias_name", ")" ]
Creates an alias pointing to the index configured in this connection
[ "Creates", "an", "alias", "pointing", "to", "the", "index", "configured", "in", "this", "connection" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L292-L295
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector.exists_alias
def exists_alias(self, alias_name, index_name=None): """Check whether or not the given alias exists :return: True if alias already exist""" return self._es_conn.indices.exists_alias(index=index_name, name=alias_name)
python
def exists_alias(self, alias_name, index_name=None): """Check whether or not the given alias exists :return: True if alias already exist""" return self._es_conn.indices.exists_alias(index=index_name, name=alias_name)
[ "def", "exists_alias", "(", "self", ",", "alias_name", ",", "index_name", "=", "None", ")", ":", "return", "self", ".", "_es_conn", ".", "indices", ".", "exists_alias", "(", "index", "=", "index_name", ",", "name", "=", "alias_name", ")" ]
Check whether or not the given alias exists :return: True if alias already exist
[ "Check", "whether", "or", "not", "the", "given", "alias", "exists" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L297-L302
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/ceres_base.py
ESConnector._build_search_query
def _build_search_query(self, from_date): """Build an ElasticSearch search query to retrieve items for read methods. :param from_date: date to start retrieving items from. :return: JSON query in dict format """ sort = [{self._sort_on_field: {"order": "asc"}}] filters =...
python
def _build_search_query(self, from_date): """Build an ElasticSearch search query to retrieve items for read methods. :param from_date: date to start retrieving items from. :return: JSON query in dict format """ sort = [{self._sort_on_field: {"order": "asc"}}] filters =...
[ "def", "_build_search_query", "(", "self", ",", "from_date", ")", ":", "sort", "=", "[", "{", "self", ".", "_sort_on_field", ":", "{", "\"order\"", ":", "\"asc\"", "}", "}", "]", "filters", "=", "[", "]", "if", "self", ".", "_repo", ":", "filters", "...
Build an ElasticSearch search query to retrieve items for read methods. :param from_date: date to start retrieving items from. :return: JSON query in dict format
[ "Build", "an", "ElasticSearch", "search", "query", "to", "retrieve", "items", "for", "read", "methods", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/ceres_base.py#L304-L330
train
chaoss/grimoirelab-elk
grimoire_elk/raw/elastic.py
ElasticOcean.add_params
def add_params(cls, cmdline_parser): """ Shared params in all backends """ parser = cmdline_parser parser.add_argument("-e", "--elastic_url", default="http://127.0.0.1:9200", help="Host with elastic search (default: http://127.0.0.1:9200)") parser.add_argume...
python
def add_params(cls, cmdline_parser): """ Shared params in all backends """ parser = cmdline_parser parser.add_argument("-e", "--elastic_url", default="http://127.0.0.1:9200", help="Host with elastic search (default: http://127.0.0.1:9200)") parser.add_argume...
[ "def", "add_params", "(", "cls", ",", "cmdline_parser", ")", ":", "parser", "=", "cmdline_parser", "parser", ".", "add_argument", "(", "\"-e\"", ",", "\"--elastic_url\"", ",", "default", "=", "\"http://127.0.0.1:9200\"", ",", "help", "=", "\"Host with elastic search...
Shared params in all backends
[ "Shared", "params", "in", "all", "backends" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/elastic.py#L47-L55
train
chaoss/grimoirelab-elk
grimoire_elk/raw/elastic.py
ElasticOcean.get_p2o_params_from_url
def get_p2o_params_from_url(cls, url): """ Get the p2o params given a URL for the data source """ # if the url doesn't contain a filter separator, return it if PRJ_JSON_FILTER_SEPARATOR not in url: return {"url": url} # otherwise, add the url to the params params = ...
python
def get_p2o_params_from_url(cls, url): """ Get the p2o params given a URL for the data source """ # if the url doesn't contain a filter separator, return it if PRJ_JSON_FILTER_SEPARATOR not in url: return {"url": url} # otherwise, add the url to the params params = ...
[ "def", "get_p2o_params_from_url", "(", "cls", ",", "url", ")", ":", "if", "PRJ_JSON_FILTER_SEPARATOR", "not", "in", "url", ":", "return", "{", "\"url\"", ":", "url", "}", "params", "=", "{", "'url'", ":", "url", ".", "split", "(", "' '", ",", "1", ")",...
Get the p2o params given a URL for the data source
[ "Get", "the", "p2o", "params", "given", "a", "URL", "for", "the", "data", "source" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/elastic.py#L98-L127
train
chaoss/grimoirelab-elk
grimoire_elk/raw/elastic.py
ElasticOcean.feed
def feed(self, from_date=None, from_offset=None, category=None, latest_items=None, arthur_items=None, filter_classified=None): """ Feed data in Elastic from Perceval or Arthur """ if self.fetch_archive: items = self.perceval_backend.fetch_from_archive() self.feed_it...
python
def feed(self, from_date=None, from_offset=None, category=None, latest_items=None, arthur_items=None, filter_classified=None): """ Feed data in Elastic from Perceval or Arthur """ if self.fetch_archive: items = self.perceval_backend.fetch_from_archive() self.feed_it...
[ "def", "feed", "(", "self", ",", "from_date", "=", "None", ",", "from_offset", "=", "None", ",", "category", "=", "None", ",", "latest_items", "=", "None", ",", "arthur_items", "=", "None", ",", "filter_classified", "=", "None", ")", ":", "if", "self", ...
Feed data in Elastic from Perceval or Arthur
[ "Feed", "data", "in", "Elastic", "from", "Perceval", "or", "Arthur" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/elastic.py#L155-L226
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/git.py
GitEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item. If the repo is in GitHub, get the usernames from GitHub. """ def add_sh_github_identity(user, user_field, rol): """ Add a new github identity to SH if it does not exists """ github_repo = None ...
python
def get_identities(self, item): """ Return the identities from an item. If the repo is in GitHub, get the usernames from GitHub. """ def add_sh_github_identity(user, user_field, rol): """ Add a new github identity to SH if it does not exists """ github_repo = None ...
[ "def", "get_identities", "(", "self", ",", "item", ")", ":", "def", "add_sh_github_identity", "(", "user", ",", "user_field", ",", "rol", ")", ":", "github_repo", "=", "None", "if", "GITHUB", "in", "item", "[", "'origin'", "]", ":", "github_repo", "=", "...
Return the identities from an item. If the repo is in GitHub, get the usernames from GitHub.
[ "Return", "the", "identities", "from", "an", "item", ".", "If", "the", "repo", "is", "in", "GitHub", "get", "the", "usernames", "from", "GitHub", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/git.py#L148-L211
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/git.py
GitEnrich.__fix_field_date
def __fix_field_date(self, item, attribute): """Fix possible errors in the field date""" field_date = str_to_datetime(item[attribute]) try: _ = int(field_date.strftime("%z")[0:3]) except ValueError: logger.warning("%s in commit %s has a wrong format", attribute,...
python
def __fix_field_date(self, item, attribute): """Fix possible errors in the field date""" field_date = str_to_datetime(item[attribute]) try: _ = int(field_date.strftime("%z")[0:3]) except ValueError: logger.warning("%s in commit %s has a wrong format", attribute,...
[ "def", "__fix_field_date", "(", "self", ",", "item", ",", "attribute", ")", ":", "field_date", "=", "str_to_datetime", "(", "item", "[", "attribute", "]", ")", "try", ":", "_", "=", "int", "(", "field_date", ".", "strftime", "(", "\"%z\"", ")", "[", "0...
Fix possible errors in the field date
[ "Fix", "possible", "errors", "in", "the", "field", "date" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/git.py#L425-L434
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/git.py
GitEnrich.update_items
def update_items(self, ocean_backend, enrich_backend): """Retrieve the commits not present in the original repository and delete the corresponding documents from the raw and enriched indexes""" fltr = { 'name': 'origin', 'value': [self.perceval_backend.origin] } ...
python
def update_items(self, ocean_backend, enrich_backend): """Retrieve the commits not present in the original repository and delete the corresponding documents from the raw and enriched indexes""" fltr = { 'name': 'origin', 'value': [self.perceval_backend.origin] } ...
[ "def", "update_items", "(", "self", ",", "ocean_backend", ",", "enrich_backend", ")", ":", "fltr", "=", "{", "'name'", ":", "'origin'", ",", "'value'", ":", "[", "self", ".", "perceval_backend", ".", "origin", "]", "}", "logger", ".", "debug", "(", "\"[u...
Retrieve the commits not present in the original repository and delete the corresponding documents from the raw and enriched indexes
[ "Retrieve", "the", "commits", "not", "present", "in", "the", "original", "repository", "and", "delete", "the", "corresponding", "documents", "from", "the", "raw", "and", "enriched", "indexes" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/git.py#L668-L725
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/git.py
GitEnrich.add_commit_branches
def add_commit_branches(self, git_repo, enrich_backend): """Add the information about branches to the documents representing commits in the enriched index. Branches are obtained using the command `git ls-remote`, then for each branch, the list of commits is retrieved via the command `git rev-lis...
python
def add_commit_branches(self, git_repo, enrich_backend): """Add the information about branches to the documents representing commits in the enriched index. Branches are obtained using the command `git ls-remote`, then for each branch, the list of commits is retrieved via the command `git rev-lis...
[ "def", "add_commit_branches", "(", "self", ",", "git_repo", ",", "enrich_backend", ")", ":", "to_process", "=", "[", "]", "for", "hash", ",", "refname", "in", "git_repo", ".", "_discover_refs", "(", "remote", "=", "True", ")", ":", "if", "not", "refname", ...
Add the information about branches to the documents representing commits in the enriched index. Branches are obtained using the command `git ls-remote`, then for each branch, the list of commits is retrieved via the command `git rev-list branch-name` and used to update the corresponding items in...
[ "Add", "the", "information", "about", "branches", "to", "the", "documents", "representing", "commits", "in", "the", "enriched", "index", ".", "Branches", "are", "obtained", "using", "the", "command", "git", "ls", "-", "remote", "then", "for", "each", "branch",...
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/git.py#L770-L807
train
chaoss/grimoirelab-elk
utils/gelk_mapping.py
find_ds_mapping
def find_ds_mapping(data_source, es_major_version): """ Find the mapping given a perceval data source :param data_source: name of the perceval data source :param es_major_version: string with the major version for Elasticsearch :return: a dict with the mappings (raw and enriched) """ mappin...
python
def find_ds_mapping(data_source, es_major_version): """ Find the mapping given a perceval data source :param data_source: name of the perceval data source :param es_major_version: string with the major version for Elasticsearch :return: a dict with the mappings (raw and enriched) """ mappin...
[ "def", "find_ds_mapping", "(", "data_source", ",", "es_major_version", ")", ":", "mappings", "=", "{", "\"raw\"", ":", "None", ",", "\"enriched\"", ":", "None", "}", "connectors", "=", "get_connectors", "(", ")", "try", ":", "raw_klass", "=", "connectors", "...
Find the mapping given a perceval data source :param data_source: name of the perceval data source :param es_major_version: string with the major version for Elasticsearch :return: a dict with the mappings (raw and enriched)
[ "Find", "the", "mapping", "given", "a", "perceval", "data", "source" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gelk_mapping.py#L95-L128
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_aoc.py
areas_of_code
def areas_of_code(git_enrich, in_conn, out_conn, block_size=100): """Build and index for areas of code from a given Perceval RAW index. :param block_size: size of items block. :param git_enrich: GitEnrich object to deal with SortingHat affiliations. :param in_conn: ESPandasConnector to read from. :...
python
def areas_of_code(git_enrich, in_conn, out_conn, block_size=100): """Build and index for areas of code from a given Perceval RAW index. :param block_size: size of items block. :param git_enrich: GitEnrich object to deal with SortingHat affiliations. :param in_conn: ESPandasConnector to read from. :...
[ "def", "areas_of_code", "(", "git_enrich", ",", "in_conn", ",", "out_conn", ",", "block_size", "=", "100", ")", ":", "aoc", "=", "AreasOfCode", "(", "in_connector", "=", "in_conn", ",", "out_connector", "=", "out_conn", ",", "block_size", "=", "block_size", ...
Build and index for areas of code from a given Perceval RAW index. :param block_size: size of items block. :param git_enrich: GitEnrich object to deal with SortingHat affiliations. :param in_conn: ESPandasConnector to read from. :param out_conn: ESPandasConnector to write to. :return: number of doc...
[ "Build", "and", "index", "for", "areas", "of", "code", "from", "a", "given", "Perceval", "RAW", "index", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_aoc.py#L214-L226
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_aoc.py
AreasOfCode.process
def process(self, items_block): """Process items to add file related information. Eventize items creating one new item per each file found in the commit (excluding files with no actions performed on them). For each event, file path, file name, path parts, file type and file extension ar...
python
def process(self, items_block): """Process items to add file related information. Eventize items creating one new item per each file found in the commit (excluding files with no actions performed on them). For each event, file path, file name, path parts, file type and file extension ar...
[ "def", "process", "(", "self", ",", "items_block", ")", ":", "logger", ".", "info", "(", "self", ".", "__log_prefix", "+", "\" New commits: \"", "+", "str", "(", "len", "(", "items_block", ")", ")", ")", "git_events", "=", "Git", "(", "items_block", ",",...
Process items to add file related information. Eventize items creating one new item per each file found in the commit (excluding files with no actions performed on them). For each event, file path, file name, path parts, file type and file extension are added as fields. :param items_bl...
[ "Process", "items", "to", "add", "file", "related", "information", "." ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_aoc.py#L165-L211
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/utils.py
get_time_diff_days
def get_time_diff_days(start, end): ''' Number of days between two dates in UTC format ''' if start is None or end is None: return None if type(start) is not datetime.datetime: start = parser.parse(start).replace(tzinfo=None) if type(end) is not datetime.datetime: end = parser...
python
def get_time_diff_days(start, end): ''' Number of days between two dates in UTC format ''' if start is None or end is None: return None if type(start) is not datetime.datetime: start = parser.parse(start).replace(tzinfo=None) if type(end) is not datetime.datetime: end = parser...
[ "def", "get_time_diff_days", "(", "start", ",", "end", ")", ":", "if", "start", "is", "None", "or", "end", "is", "None", ":", "return", "None", "if", "type", "(", "start", ")", "is", "not", "datetime", ".", "datetime", ":", "start", "=", "parser", "....
Number of days between two dates in UTC format
[ "Number", "of", "days", "between", "two", "dates", "in", "UTC", "format" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/utils.py#L91-L106
train
chaoss/grimoirelab-elk
grimoire_elk/enriched/phabricator.py
PhabricatorEnrich.__fill_phab_ids
def __fill_phab_ids(self, item): """ Get mappings between phab ids and names """ for p in item['projects']: if p and 'name' in p and 'phid' in p: self.phab_ids_names[p['phid']] = p['name'] if 'authorData' not in item['fields'] or not item['fields']['authorData']: ...
python
def __fill_phab_ids(self, item): """ Get mappings between phab ids and names """ for p in item['projects']: if p and 'name' in p and 'phid' in p: self.phab_ids_names[p['phid']] = p['name'] if 'authorData' not in item['fields'] or not item['fields']['authorData']: ...
[ "def", "__fill_phab_ids", "(", "self", ",", "item", ")", ":", "for", "p", "in", "item", "[", "'projects'", "]", ":", "if", "p", "and", "'name'", "in", "p", "and", "'phid'", "in", "p", ":", "self", ".", "phab_ids_names", "[", "p", "[", "'phid'", "]"...
Get mappings between phab ids and names
[ "Get", "mappings", "between", "phab", "ids", "and", "names" ]
64e08b324b36d9f6909bf705145d6451c8d34e65
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/phabricator.py#L229-L247
train