repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
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. ...
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...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/chimera.py#L174-L234
dwavesystems/dwave-system
dwave/system/cache/cache_manager.py
cache_file
def cache_file(app_name=APPNAME, app_author=APPAUTHOR, filename=DATABASENAME): """Returns the filename (including path) for the data cache. The path will depend on the operating system, certain environmental variables and whether it is being run inside a virtual environment. See `homebase <https://gith...
python
def cache_file(app_name=APPNAME, app_author=APPAUTHOR, filename=DATABASENAME): """Returns the filename (including path) for the data cache. The path will depend on the operating system, certain environmental variables and whether it is being run inside a virtual environment. See `homebase <https://gith...
Returns the filename (including path) for the data cache. The path will depend on the operating system, certain environmental variables and whether it is being run inside a virtual environment. See `homebase <https://github.com/dwavesystems/homebase>`_. Args: app_name (str, optional): The appl...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/cache/cache_manager.py#L34-L60
dwavesystems/dwave-system
dwave/system/composites/cutoffcomposite.py
_restore_isolated
def _restore_isolated(sampleset, bqm, isolated): """Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables). """ samples = sampleset.record.sample variables = sampleset.variables new_samples = np.empty((l...
python
def _restore_isolated(sampleset, bqm, isolated): """Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables). """ samples = sampleset.record.sample variables = sampleset.variables new_samples = np.empty((l...
Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables).
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L147-L177
dwavesystems/dwave-system
dwave/system/composites/cutoffcomposite.py
_restore_isolated_higherorder
def _restore_isolated_higherorder(sampleset, poly, isolated): """Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables). Isolated should be ordered. """ samples = sampleset.record.sample variables = samp...
python
def _restore_isolated_higherorder(sampleset, poly, isolated): """Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables). Isolated should be ordered. """ samples = sampleset.record.sample variables = samp...
Return samples-like by adding isolated variables into sampleset in a way that minimizes the energy (relative to the other non-isolated variables). Isolated should be ordered.
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L299-L337
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 ...
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: ...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L79-L144
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...
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...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/system/composites/cutoffcomposite.py#L231-L296
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 ...
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 ...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/diagnostic.py#L23-L96
dwavesystems/dwave-system
dwave/embedding/diagnostic.py
is_valid_embedding
def is_valid_embedding(emb, source, target): """A simple (bool) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes source (graph or edgelist): the g...
python
def is_valid_embedding(emb, source, target): """A simple (bool) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes source (graph or edgelist): the g...
A simple (bool) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes source (graph or edgelist): the graph to be embedded target (graph or edgelis...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/diagnostic.py#L99-L115
dwavesystems/dwave-system
dwave/embedding/diagnostic.py
verify_embedding
def verify_embedding(emb, source, target, ignore_errors=()): """A simple (exception-raising) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes sour...
python
def verify_embedding(emb, source, target, ignore_errors=()): """A simple (exception-raising) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes sour...
A simple (exception-raising) diagnostic for minor embeddings. See :func:`diagnose_embedding` for a more detailed diagnostic / more information. Args: emb (dict): a dictionary mapping source nodes to arrays of target nodes source (graph or edgelist): the graph to be embedded target (gra...
https://github.com/dwavesystems/dwave-system/blob/86a1698f15ccd8b0ece0ed868ee49292d3f67f5b/dwave/embedding/diagnostic.py#L118-L145
Jaza/flask-restplus-patched
flask_restplus_patched/namespace.py
Namespace.resolve_object
def resolve_object(self, object_arg_name, resolver): """ A helper decorator to resolve object instance from arguments (e.g. identity). Example: >>> @namespace.route('/<int:user_id>') ... class MyResource(Resource): ... @namespace.resolve_object( ... obj...
python
def resolve_object(self, object_arg_name, resolver): """ A helper decorator to resolve object instance from arguments (e.g. identity). Example: >>> @namespace.route('/<int:user_id>') ... class MyResource(Resource): ... @namespace.resolve_object( ... obj...
A helper decorator to resolve object instance from arguments (e.g. identity). Example: >>> @namespace.route('/<int:user_id>') ... class MyResource(Resource): ... @namespace.resolve_object( ... object_arg_name='user', ... resolver=lambda kwargs: User.quer...
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L34-L60
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...
Model registration decorator.
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L62-L72
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...
Endpoint parameters registration decorator.
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L74-L94
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 ...
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...
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/namespace.py#L96-L192
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...
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...
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/resource.py#L16-L30
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...
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.
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/resource.py#L32-L81
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...
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 ...
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L97-L114
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...
Performs all necessary operations by calling class methods with corresponding names.
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L117-L137
Jaza/flask-restplus-patched
flask_restplus_patched/parameters.py
PatchJSONParameters._process_patch_operation
def _process_patch_operation(cls, operation, obj, state): """ Args: operation (dict): one patch operation in RFC 6902 format. obj (object): an instance which is needed to be patched. state (dict): inter-operations state storage Returns: processing...
python
def _process_patch_operation(cls, operation, obj, state): """ Args: operation (dict): one patch operation in RFC 6902 format. obj (object): an instance which is needed to be patched. state (dict): inter-operations state storage Returns: processing...
Args: operation (dict): one patch operation in RFC 6902 format. obj (object): an instance which is needed to be patched. state (dict): inter-operations state storage Returns: processing_status (bool): True if operation was handled, otherwise False.
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L140-L170
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...
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...
https://github.com/Jaza/flask-restplus-patched/blob/38b4a030f28e6aec374d105173aa5e9b6bd51e5e/flask_restplus_patched/parameters.py#L173-L190
chaoss/grimoirelab-elk
grimoire_elk/enriched/discourse.py
DiscourseEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ # All identities are in the post stream # The first post is the question. Next replies posts = item['data']['post_stream']['posts'] for post in posts: user = self.get_sh_identity(post) ...
python
def get_identities(self, item): """ Return the identities from an item """ # All identities are in the post stream # The first post is the question. Next replies posts = item['data']['post_stream']['posts'] for post in posts: user = self.get_sh_identity(post) ...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/discourse.py#L44-L54
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
Get all related categories to a given one
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/discourse.py#L148-L154
chaoss/grimoirelab-elk
grimoire_elk/enriched/discourse.py
DiscourseEnrich.__show_categories_tree
def __show_categories_tree(self): """ Show the category tree: list of categories and its subcategories """ for cat in self.categories_tree: print("%s (%i)" % (self.categories[cat], cat)) for subcat in self.categories_tree[cat]: print("-> %s (%i)" % (self.categorie...
python
def __show_categories_tree(self): """ Show the category tree: list of categories and its subcategories """ for cat in self.categories_tree: print("%s (%i)" % (self.categories[cat], cat)) for subcat in self.categories_tree[cat]: print("-> %s (%i)" % (self.categorie...
Show the category tree: list of categories and its subcategories
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/discourse.py#L156-L161
chaoss/grimoirelab-elk
grimoire_elk/track_items.py
fetch_track_items
def fetch_track_items(upstream_file_url, data_source): """ The file format is: # Upstream contributions, bitergia will crawl this and extract the relevant information # system is one of Gerrit, Bugzilla, Launchpad (insert more) --- - url: https://review.openstack.org/169836 system: Gerr...
python
def fetch_track_items(upstream_file_url, data_source): """ The file format is: # Upstream contributions, bitergia will crawl this and extract the relevant information # system is one of Gerrit, Bugzilla, Launchpad (insert more) --- - url: https://review.openstack.org/169836 system: Gerr...
The file format is: # Upstream contributions, bitergia will crawl this and extract the relevant information # system is one of Gerrit, Bugzilla, Launchpad (insert more) --- - url: https://review.openstack.org/169836 system: Gerrit
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/track_items.py#L40-L68
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...
Create a projects file from the items origin data
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/track_items.py#L194-L212
chaoss/grimoirelab-elk
grimoire_elk/enriched/mattermost.py
MattermostEnrich.__convert_booleans
def __convert_booleans(self, eitem): """ Convert True/False to 1/0 for better kibana processing """ for field in eitem.keys(): if isinstance(eitem[field], bool): if eitem[field]: eitem[field] = 1 else: eitem[field] = 0 ...
python
def __convert_booleans(self, eitem): """ Convert True/False to 1/0 for better kibana processing """ for field in eitem.keys(): if isinstance(eitem[field], bool): if eitem[field]: eitem[field] = 1 else: eitem[field] = 0 ...
Convert True/False to 1/0 for better kibana processing
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mattermost.py#L219-L228
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 ...
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
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/dockerhub.py#L125-L188
chaoss/grimoirelab-elk
utils/gh2k.py
get_params_parser
def get_params_parser(): """Parse command line arguments""" parser = argparse.ArgumentParser() ElasticOcean.add_params(parser) parser.add_argument('-g', '--debug', dest='debug', action='store_true') parser.add_argument('-t', '--token', dest='token', help="GitHub token") parser.add_argument('-...
python
def get_params_parser(): """Parse command line arguments""" parser = argparse.ArgumentParser() ElasticOcean.add_params(parser) parser.add_argument('-g', '--debug', dest='debug', action='store_true') parser.add_argument('-t', '--token', dest='token', help="GitHub token") parser.add_argument('-...
Parse command line arguments
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L49-L70
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_...
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 _
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L98-L123
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(), ...
owner could be an org or and user
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L126-L161
chaoss/grimoirelab-elk
utils/gh2k.py
create_redirect_web_page
def create_redirect_web_page(web_dir, org_name, kibana_url): """ Create HTML pages with the org name that redirect to the Kibana dashboard filtered for this org """ html_redirect = """ <html> <head> """ html_redirect += """<meta http-equiv="refresh" content="0; URL=%s/app/kibana"""\ ...
python
def create_redirect_web_page(web_dir, org_name, kibana_url): """ Create HTML pages with the org name that redirect to the Kibana dashboard filtered for this org """ html_redirect = """ <html> <head> """ html_redirect += """<meta http-equiv="refresh" content="0; URL=%s/app/kibana"""\ ...
Create HTML pages with the org name that redirect to the Kibana dashboard filtered for this org
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L164-L189
chaoss/grimoirelab-elk
utils/gh2k.py
notify_contact
def notify_contact(mail, owner, graas_url, repos, first_repo=False): """ Send an email to the contact with the details to access the Kibana dashboard """ footer = """ -- Bitergia Cauldron Team http://bitergia.com """ twitter_txt = "Check Cauldron.io dashboard for %s at %s/dashboards/%s" % (own...
python
def notify_contact(mail, owner, graas_url, repos, first_repo=False): """ Send an email to the contact with the details to access the Kibana dashboard """ footer = """ -- Bitergia Cauldron Team http://bitergia.com """ twitter_txt = "Check Cauldron.io dashboard for %s at %s/dashboards/%s" % (own...
Send an email to the contact with the details to access the Kibana dashboard
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L192-L250
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...
Publish in twitter the dashboard
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/gh2k.py#L253-L260
chaoss/grimoirelab-elk
grimoire_elk/enriched/mozillaclub.py
MozillaClubEnrich.get_identities
def get_identities(self, item): """Return the identities from an item""" user = self.get_sh_identity(item, self.get_field_author()) yield user
python
def get_identities(self, item): """Return the identities from an item""" user = self.get_sh_identity(item, self.get_field_author()) yield user
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mozillaclub.py#L83-L87
chaoss/grimoirelab-elk
grimoire_elk/enriched/bugzillarest.py
BugzillaRESTEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ for rol in self.roles: if rol in item['data']: yield self.get_sh_identity(item["data"][rol])
python
def get_identities(self, item): """ Return the identities from an item """ for rol in self.roles: if rol in item['data']: yield self.get_sh_identity(item["data"][rol])
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/bugzillarest.py#L49-L54
chaoss/grimoirelab-elk
grimoire_elk/enriched/gitlab.py
GitLabEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] for identity in self.issue_roles: if item[identity]: user = self.get_sh_identity(item[identity]) if user: yield user
python
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] for identity in self.issue_roles: if item[identity]: user = self.get_sh_identity(item[identity]) if user: yield user
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/gitlab.py#L99-L107
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
Get the perceval params given the URLs for the data source
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/mediawiki.py#L66-L73
chaoss/grimoirelab-elk
grimoire_elk/enriched/kitsune.py
KitsuneEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] for identity in ['creator']: # Todo: questions has also involved and solved_by if identity in item and item[identity]: user = self.get_sh_identity(item[identit...
python
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] for identity in ['creator']: # Todo: questions has also involved and solved_by if identity in item and item[identity]: user = self.get_sh_identity(item[identit...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/kitsune.py#L86-L99
chaoss/grimoirelab-elk
grimoire_elk/enriched/mbox_study_kip.py
kafka_kip
def kafka_kip(enrich): """ Kafka Improvement Proposals process study """ def extract_vote_and_binding(body): """ Extracts the vote and binding for a KIP process included in message body """ vote = 0 binding = 0 # by default the votes are binding for +1 nlines = 0 for...
python
def kafka_kip(enrich): """ Kafka Improvement Proposals process study """ def extract_vote_and_binding(body): """ Extracts the vote and binding for a KIP process included in message body """ vote = 0 binding = 0 # by default the votes are binding for +1 nlines = 0 for...
Kafka Improvement Proposals process study
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mbox_study_kip.py#L36-L448
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...
Load and identity list from backend in Sorting Hat
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L64-L102
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) ...
Load identities list from backend in Sorting Hat
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L105-L120
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...
Delete an identity from SortingHat. :param sh_db: SortingHat database :param ident_id: identity identifier
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L123-L137
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...
Delete a unique identity from SortingHat. :param sh_db: SortingHat database :param uuid: Unique identity identifier
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L140-L154
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...
List the unique identities available in SortingHat. :param sh_db: SortingHat database
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/sortinghat_gelk.py#L157-L166
chaoss/grimoirelab-elk
grimoire_elk/enriched/redmine.py
RedmineEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ data = item['data'] if 'assigned_to' in data: user = self.get_sh_identity(data, 'assigned_to') yield user author = self.get_sh_identity(data, 'author') yield author
python
def get_identities(self, item): """ Return the identities from an item """ data = item['data'] if 'assigned_to' in data: user = self.get_sh_identity(data, 'assigned_to') yield user author = self.get_sh_identity(data, 'author') yield author
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/redmine.py#L64-L72
chaoss/grimoirelab-elk
grimoire_elk/enriched/askbot.py
AskbotEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ # question user = self.get_sh_identity(item, self.get_field_author()) yield user # answers if 'answers' in item['data']: for answer in item['data']['answers']: # avoid...
python
def get_identities(self, item): """ Return the identities from an item """ # question user = self.get_sh_identity(item, self.get_field_author()) yield user # answers if 'answers' in item['data']: for answer in item['data']['answers']: # avoid...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/askbot.py#L70-L87
chaoss/grimoirelab-elk
grimoire_elk/enriched/puppetforge.py
PuppetForgeEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ user = self.get_sh_identity(item, self.get_field_author()) yield user # Get the identities from the releases for release in item['data']['releases']: user = self.get_sh_identity(release['modu...
python
def get_identities(self, item): """ Return the identities from an item """ user = self.get_sh_identity(item, self.get_field_author()) yield user # Get the identities from the releases for release in item['data']['releases']: user = self.get_sh_identity(release['modu...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/puppetforge.py#L44-L53
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...
Get the enriched events related to a module
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/puppetforge.py#L135-L176
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(...
Connect to the MySQL database.
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/database.py#L44-L55
chaoss/grimoirelab-elk
grimoire_elk/enriched/database.py
Database.execute
def execute(self, query): """Execute an SQL query with the corresponding database. The query can be "templated" with {scm_db} and {sh_db}. """ # sql = query.format(scm_db = self.scmdb, # sh_db = self.shdb, # prj_db = self.prjdb) ...
python
def execute(self, query): """Execute an SQL query with the corresponding database. The query can be "templated" with {scm_db} and {sh_db}. """ # sql = query.format(scm_db = self.scmdb, # sh_db = self.shdb, # prj_db = self.prjdb) ...
Execute an SQL query with the corresponding database. The query can be "templated" with {scm_db} and {sh_db}.
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/database.py#L57-L71
chaoss/grimoirelab-elk
grimoire_elk/elk.py
feed_arthur
def feed_arthur(): """ Feed Ocean with backend data collected from arthur redis queue""" logger.info("Collecting items from redis queue") db_url = 'redis://localhost/8' conn = redis.StrictRedis.from_url(db_url) logger.debug("Redis connection stablished with %s.", db_url) # Get and remove que...
python
def feed_arthur(): """ Feed Ocean with backend data collected from arthur redis queue""" logger.info("Collecting items from redis queue") db_url = 'redis://localhost/8' conn = redis.StrictRedis.from_url(db_url) logger.debug("Redis connection stablished with %s.", db_url) # Get and remove que...
Feed Ocean with backend data collected from arthur redis queue
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L54-L77
chaoss/grimoirelab-elk
grimoire_elk/elk.py
feed_backend_arthur
def feed_backend_arthur(backend_name, backend_params): """ Feed Ocean with backend data collected from arthur redis queue""" # Always get pending items from arthur for all data sources feed_arthur() logger.debug("Items available for %s", arthur_items.keys()) # Get only the items for the backend ...
python
def feed_backend_arthur(backend_name, backend_params): """ Feed Ocean with backend data collected from arthur redis queue""" # Always get pending items from arthur for all data sources feed_arthur() logger.debug("Items available for %s", arthur_items.keys()) # Get only the items for the backend ...
Feed Ocean with backend data collected from arthur redis queue
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L80-L102
chaoss/grimoirelab-elk
grimoire_elk/elk.py
feed_backend
def feed_backend(url, clean, fetch_archive, backend_name, backend_params, es_index=None, es_index_enrich=None, project=None, arthur=False, es_aliases=None, projects_json_repo=None): """ Feed Ocean with backend data """ backend = None repo = {'backend_name': backend_name, '...
python
def feed_backend(url, clean, fetch_archive, backend_name, backend_params, es_index=None, es_index_enrich=None, project=None, arthur=False, es_aliases=None, projects_json_repo=None): """ Feed Ocean with backend data """ backend = None repo = {'backend_name': backend_name, '...
Feed Ocean with backend data
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L105-L222
chaoss/grimoirelab-elk
grimoire_elk/elk.py
get_items_from_uuid
def get_items_from_uuid(uuid, enrich_backend, ocean_backend): """ Get all items that include uuid """ # logger.debug("Getting items for merged uuid %s " % (uuid)) uuid_fields = enrich_backend.get_fields_uuid() terms = "" # all terms with uuids in the enriched item for field in uuid_fields: ...
python
def get_items_from_uuid(uuid, enrich_backend, ocean_backend): """ Get all items that include uuid """ # logger.debug("Getting items for merged uuid %s " % (uuid)) uuid_fields = enrich_backend.get_fields_uuid() terms = "" # all terms with uuids in the enriched item for field in uuid_fields: ...
Get all items that include uuid
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L225-L291
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...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L309-L372
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_...
Get the ocean backend configured to start from the last enriched date
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L439-L487
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 ...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L490-L521
chaoss/grimoirelab-elk
grimoire_elk/elk.py
enrich_backend
def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name, ocean_index=None, ocean_index_enrich=None, db_projects_map=None, json_projects_map=None, db_sortinghat=None, no_incremental=False, only_identities...
python
def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name, ocean_index=None, ocean_index_enrich=None, db_projects_map=None, json_projects_map=None, db_sortinghat=None, no_incremental=False, only_identities...
Enrich Ocean index
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L524-L668
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...
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
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L671-L804
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...
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
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L807-L851
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...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L854-L873
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) ...
Init backend within the backend_cmd
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L876-L887
chaoss/grimoirelab-elk
grimoire_elk/elk.py
populate_identities_index
def populate_identities_index(es_enrichment_url, enrich_index): """Save the identities currently in use in the index IDENTITIES_INDEX. :param es_enrichment_url: url of the ElasticSearch with enriched data :param enrich_index: name of the enriched index """ class Mapping(BaseMapping): @stat...
python
def populate_identities_index(es_enrichment_url, enrich_index): """Save the identities currently in use in the index IDENTITIES_INDEX. :param es_enrichment_url: url of the ElasticSearch with enriched data :param enrich_index: name of the enriched index """ class Mapping(BaseMapping): @stat...
Save the identities currently in use in the index IDENTITIES_INDEX. :param es_enrichment_url: url of the ElasticSearch with enriched data :param enrich_index: name of the enriched index
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elk.py#L890-L961
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
Return a valid elastic index generated from unique_id
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L112-L117
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 ...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L120-L145
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...
Bulk PUT controlling unicode issues
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L153-L187
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...
List all aliases used in ES
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L189-L206
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...
List aliases linked to the index
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L208-L222
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.add_alias
def add_alias(self, alias): """Add an alias to the index set in the elastic obj :param alias: alias to add :returns: None """ aliases = self.list_aliases() if alias in aliases: logger.debug("Alias %s already exists on %s.", alias, self.anonymize_url(self.ind...
python
def add_alias(self, alias): """Add an alias to the index set in the elastic obj :param alias: alias to add :returns: None """ aliases = self.list_aliases() if alias in aliases: logger.debug("Alias %s already exists on %s.", alias, self.anonymize_url(self.ind...
Add an alias to the index set in the elastic obj :param alias: alias to add :returns: None
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L233-L268
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....
Upload in controlled packs items to ES using bulk API
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L270-L305
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.get_last_date
def get_last_date(self, field, filters_=[]): ''' :field: field with the data :filters_: additional filters to find the date ''' last_date = self.get_last_item_field(field, filters_=filters_) return last_date
python
def get_last_date(self, field, filters_=[]): ''' :field: field with the data :filters_: additional filters to find the date ''' last_date = self.get_last_item_field(field, filters_=filters_) return last_date
:field: field with the data :filters_: additional filters to find the date
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L380-L388
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.get_last_offset
def get_last_offset(self, field, filters_=[]): ''' :field: field with the data :filters_: additional filters to find the date ''' offset = self.get_last_item_field(field, filters_=filters_, offset=True) return offset
python
def get_last_offset(self, field, filters_=[]): ''' :field: field with the data :filters_: additional filters to find the date ''' offset = self.get_last_item_field(field, filters_=filters_, offset=True) return offset
:field: field with the data :filters_: additional filters to find the date
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L390-L398
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.get_last_item_field
def get_last_item_field(self, field, filters_=[], offset=False): ''' :field: field with the data :filters_: additional filters to find the date :offset: Return offset field insted of date field ''' last_value = None url = self.index_url url +...
python
def get_last_item_field(self, field, filters_=[], offset=False): ''' :field: field with the data :filters_: additional filters to find the date :offset: Return offset field insted of date field ''' last_value = None url = self.index_url url +...
:field: field with the data :filters_: additional filters to find the date :offset: Return offset field insted of date field
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L400-L464
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
ElasticSearch.delete_items
def delete_items(self, retention_time, time_field="metadata__updated_on"): """Delete documents updated before a given date :param retention_time: maximum number of minutes wrt the current date to retain the data :param time_field: time field to delete the data """ if retention_t...
python
def delete_items(self, retention_time, time_field="metadata__updated_on"): """Delete documents updated before a given date :param retention_time: maximum number of minutes wrt the current date to retain the data :param time_field: time field to delete the data """ if retention_t...
Delete documents updated before a given date :param retention_time: maximum number of minutes wrt the current date to retain the data :param time_field: time field to delete the data
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L466-L505
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...
Get all properties of a given index
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L507-L528
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 ...
Return kibiter major number version The url must point to the Elasticsearch used by Kibiter
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L262-L284
chaoss/grimoirelab-elk
grimoire_elk/utils.py
get_params_parser
def get_params_parser(): """Parse command line arguments""" parser = argparse.ArgumentParser(usage=ARTHUR_USAGE_MSG, description=ARTHUR_DESC_MSG, epilog=ARTHUR_EPILOG_MSG, formatter_class=argparse.Raw...
python
def get_params_parser(): """Parse command line arguments""" parser = argparse.ArgumentParser(usage=ARTHUR_USAGE_MSG, description=ARTHUR_DESC_MSG, epilog=ARTHUR_EPILOG_MSG, formatter_class=argparse.Raw...
Parse command line arguments
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L305-L373
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 ...
Get params definition from ElasticOcean and from all the backends
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L376-L388
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() /...
Number of days between two days
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/utils.py#L391-L405
chaoss/grimoirelab-elk
grimoire_elk/enriched/remo.py
ReMoEnrich.get_identities
def get_identities(self, item): """Return the identities from an item""" item = item['data'] if 'owner' in item: owner = self.get_sh_identity(item['owner']) yield owner if 'user' in item: user = self.get_sh_identity(item['user']) yield use...
python
def get_identities(self, item): """Return the identities from an item""" item = item['data'] if 'owner' in item: owner = self.get_sh_identity(item['owner']) yield owner if 'user' in item: user = self.get_sh_identity(item['user']) yield use...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/remo.py#L70-L82
chaoss/grimoirelab-elk
grimoire_elk/enriched/jira.py
JiraEnrich.get_item_sh
def get_item_sh(self, item, roles=None, date_field=None): """Add sorting hat enrichment fields""" eitem_sh = {} created = str_to_datetime(date_field) for rol in roles: identity = self.get_sh_identity(item, rol) eitem_sh.update(self.get_item_sh_fields(identity, c...
python
def get_item_sh(self, item, roles=None, date_field=None): """Add sorting hat enrichment fields""" eitem_sh = {} created = str_to_datetime(date_field) for rol in roles: identity = self.get_sh_identity(item, rol) eitem_sh.update(self.get_item_sh_fields(identity, c...
Add sorting hat enrichment fields
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jira.py#L109-L142
chaoss/grimoirelab-elk
grimoire_elk/enriched/jira.py
JiraEnrich.get_identities
def get_identities(self, item): """Return the identities from an item""" item = item['data'] for field in ["assignee", "reporter", "creator"]: if field not in item["fields"]: continue if item["fields"][field]: user = self.get_sh_identity(...
python
def get_identities(self, item): """Return the identities from an item""" item = item['data'] for field in ["assignee", "reporter", "creator"]: if field not in item["fields"]: continue if item["fields"][field]: user = self.get_sh_identity(...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jira.py#L159-L178
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...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jira.py#L197-L226
chaoss/grimoirelab-elk
grimoire_elk/enriched/mediawiki.py
MediaWikiEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ identities = [] if 'data' not in item: return identities if 'revisions' not in item['data']: return identities revisions = item['data']['revisions'] for revision in revis...
python
def get_identities(self, item): """ Return the identities from an item """ identities = [] if 'data' not in item: return identities if 'revisions' not in item['data']: return identities revisions = item['data']['revisions'] for revision in revis...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mediawiki.py#L67-L80
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
Add sorting hat enrichment fields for the author of the revision
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/mediawiki.py#L109-L116
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.get_identities
def get_identities(self, item): """Return the identities from an item""" category = item['category'] item = item['data'] if category == "issue": identity_types = ['user', 'assignee'] elif category == "pull_request": identity_types = ['user', 'merged_by']...
python
def get_identities(self, item): """Return the identities from an item""" category = item['category'] item = item['data'] if category == "issue": identity_types = ['user', 'assignee'] elif category == "pull_request": identity_types = ['user', 'merged_by']...
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L116-L134
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" + ...
Get cache data for items of _type using key_ as the cache dict key
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L194-L222
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'] ...
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
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L267-L278
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...
Get the first date at which a review was made on the PR by someone other than the user who created the PR
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L280-L288
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.get_num_commenters
def get_num_commenters(self, item): """Get the number of unique people who commented on the issue/pr""" commenters = [comment['user']['login'] for comment in item['comments_data']] return len(set(commenters))
python
def get_num_commenters(self, item): """Get the number of unique people who commented on the issue/pr""" commenters = [comment['user']['login'] for comment in item['comments_data']] return len(set(commenters))
Get the number of unique people who commented on the issue/pr
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L298-L302
chaoss/grimoirelab-elk
grimoire_elk/enriched/github.py
GitHubEnrich.enrich_pull_requests
def enrich_pull_requests(self, ocean_backend, enrich_backend, raw_issues_index="github_issues_raw"): """ The purpose of this Study is to add additional fields to the pull_requests only index. Basically to calculate some of the metrics from Code Development under GMD metrics: https://gith...
python
def enrich_pull_requests(self, ocean_backend, enrich_backend, raw_issues_index="github_issues_raw"): """ The purpose of this Study is to add additional fields to the pull_requests only index. Basically to calculate some of the metrics from Code Development under GMD metrics: https://gith...
The purpose of this Study is to add additional fields to the pull_requests only index. Basically to calculate some of the metrics from Code Development under GMD metrics: https://github.com/chaoss/wg-gmd/blob/master/2_Growth-Maturity-Decline.md#code-development When data from the pull requests ...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/github.py#L361-L518
chaoss/grimoirelab-elk
grimoire_elk/enriched/confluence.py
ConfluenceEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ field = self.get_field_author() yield self.get_sh_identity(item, field)
python
def get_identities(self, item): """ Return the identities from an item """ field = self.get_field_author() yield self.get_sh_identity(item, field)
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/confluence.py#L64-L68
chaoss/grimoirelab-elk
grimoire_elk/enriched/telegram.py
TelegramEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ message = item['data']['message'] identity = self.get_sh_identity(message['from']) yield identity
python
def get_identities(self, item): """ Return the identities from an item """ message = item['data']['message'] identity = self.get_sh_identity(message['from']) yield identity
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/telegram.py#L76-L82
chaoss/grimoirelab-elk
utils/get_git_repos.py
get_params
def get_params(): """Parse command line arguments""" parser = argparse.ArgumentParser() parser.add_argument('-g', '--debug', dest='debug', action='store_true') parser.add_argument('-t', '--token', dest='token', help="GitHub token") parser.add_argument('-o', '--owner', dest='owner', help='GitHub ow...
python
def get_params(): """Parse command line arguments""" parser = argparse.ArgumentParser() parser.add_argument('-g', '--debug', dest='debug', action='store_true') parser.add_argument('-t', '--token', dest='token', help="GitHub token") parser.add_argument('-o', '--owner', dest='owner', help='GitHub ow...
Parse command line arguments
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/get_git_repos.py#L38-L49
chaoss/grimoirelab-elk
grimoire_elk/raw/github.py
GitHubOcean.get_arthur_params_from_url
def get_arthur_params_from_url(cls, url): """ Get the arthur params given a URL for the data source """ params = {} owner = url.split('/')[-2] repository = url.split('/')[-1] # params.append('--owner') params['owner'] = owner # params.append('--repository') ...
python
def get_arthur_params_from_url(cls, url): """ Get the arthur params given a URL for the data source """ params = {} owner = url.split('/')[-2] repository = url.split('/')[-1] # params.append('--owner') params['owner'] = owner # params.append('--repository') ...
Get the arthur params given a URL for the data source
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/raw/github.py#L84-L94
chaoss/grimoirelab-elk
grimoire_elk/enriched/crates.py
CratesEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ identities = [] field = self.get_field_author() identities.append(self.get_sh_identity(item, field)) return identities
python
def get_identities(self, item): """ Return the identities from an item """ identities = [] field = self.get_field_author() identities.append(self.get_sh_identity(item, field)) return identities
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/crates.py#L65-L72
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...
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...
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/crates.py#L99-L125
chaoss/grimoirelab-elk
utils/e2k.py
get_params_parser_create_dash
def get_params_parser_create_dash(): """Parse command line arguments""" parser = argparse.ArgumentParser(usage="usage: e2k.py [options]", description="Create a Kibana dashboard from a template") ElasticOcean.add_params(parser) parser.add_argument("-d", "--dashboar...
python
def get_params_parser_create_dash(): """Parse command line arguments""" parser = argparse.ArgumentParser(usage="usage: e2k.py [options]", description="Create a Kibana dashboard from a template") ElasticOcean.add_params(parser) parser.add_argument("-d", "--dashboar...
Parse command line arguments
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/utils/e2k.py#L34-L48
chaoss/grimoirelab-elk
grimoire_elk/enriched/twitter.py
TwitterEnrich.get_identities
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] user = self.get_sh_identity(item) yield user
python
def get_identities(self, item): """ Return the identities from an item """ item = item['data'] user = self.get_sh_identity(item) yield user
Return the identities from an item
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/twitter.py#L85-L91
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 ...
Get project mapping enrichment field. Twitter mappings is pretty special so it needs a special implementacion.
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/twitter.py#L93-L121
chaoss/grimoirelab-elk
grimoire_elk/enriched/jenkins.py
JenkinsEnrich.set_jenkins_rename_file
def set_jenkins_rename_file(self, nodes_rename_file): """ File with nodes renaming mapping: Node,Comment arm-build1,remove arm-build2,keep ericsson-build3,merge into ericsson-build1 .... Once set in the next enrichment the rename will be done """ ...
python
def set_jenkins_rename_file(self, nodes_rename_file): """ File with nodes renaming mapping: Node,Comment arm-build1,remove arm-build2,keep ericsson-build3,merge into ericsson-build1 .... Once set in the next enrichment the rename will be done """ ...
File with nodes renaming mapping: Node,Comment arm-build1,remove arm-build2,keep ericsson-build3,merge into ericsson-build1 .... Once set in the next enrichment the rename will be done
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/jenkins.py#L73-L86