partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | Backend.metadata | Add metadata to an item.
It adds metadata to a given item such as how and
when it was fetched. The contents from the original item will
be stored under the 'data' keyword.
:param item: an item fetched by a backend
:param filter_classified: sets if classified fields were filtere... | perceval/backend.py | def metadata(self, item, filter_classified=False):
"""Add metadata to an item.
It adds metadata to a given item such as how and
when it was fetched. The contents from the original item will
be stored under the 'data' keyword.
:param item: an item fetched by a backend
:p... | def metadata(self, item, filter_classified=False):
"""Add metadata to an item.
It adds metadata to a given item such as how and
when it was fetched. The contents from the original item will
be stored under the 'data' keyword.
:param item: an item fetched by a backend
:p... | [
"Add",
"metadata",
"to",
"an",
"item",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L211-L235 | [
"def",
"metadata",
"(",
"self",
",",
"item",
",",
"filter_classified",
"=",
"False",
")",
":",
"item",
"=",
"{",
"'backend_name'",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"'backend_version'",
":",
"self",
".",
"version",
",",
"'perceval_version'... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommandArgumentParser.parse | Parse a list of arguments.
Parse argument strings needed to run a backend command. The result
will be a `argparse.Namespace` object populated with the values
obtained after the validation of the parameters.
:param args: argument strings
:result: an object with the parsed value... | perceval/backend.py | def parse(self, *args):
"""Parse a list of arguments.
Parse argument strings needed to run a backend command. The result
will be a `argparse.Namespace` object populated with the values
obtained after the validation of the parameters.
:param args: argument strings
:resu... | def parse(self, *args):
"""Parse a list of arguments.
Parse argument strings needed to run a backend command. The result
will be a `argparse.Namespace` object populated with the values
obtained after the validation of the parameters.
:param args: argument strings
:resu... | [
"Parse",
"a",
"list",
"of",
"arguments",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L340-L375 | [
"def",
"parse",
"(",
"self",
",",
"*",
"args",
")",
":",
"parsed_args",
"=",
"self",
".",
"parser",
".",
"parse_args",
"(",
"args",
")",
"# Category was not set, remove it",
"if",
"parsed_args",
".",
"category",
"is",
"None",
":",
"delattr",
"(",
"parsed_arg... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommandArgumentParser._set_auth_arguments | Activate authentication arguments parsing | perceval/backend.py | def _set_auth_arguments(self, basic_auth=True, token_auth=False):
"""Activate authentication arguments parsing"""
group = self.parser.add_argument_group('authentication arguments')
if basic_auth:
group.add_argument('-u', '--backend-user', dest='user',
... | def _set_auth_arguments(self, basic_auth=True, token_auth=False):
"""Activate authentication arguments parsing"""
group = self.parser.add_argument_group('authentication arguments')
if basic_auth:
group.add_argument('-u', '--backend-user', dest='user',
... | [
"Activate",
"authentication",
"arguments",
"parsing"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L377-L389 | [
"def",
"_set_auth_arguments",
"(",
"self",
",",
"basic_auth",
"=",
"True",
",",
"token_auth",
"=",
"False",
")",
":",
"group",
"=",
"self",
".",
"parser",
".",
"add_argument_group",
"(",
"'authentication arguments'",
")",
"if",
"basic_auth",
":",
"group",
".",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommandArgumentParser._set_archive_arguments | Activate archive arguments parsing | perceval/backend.py | def _set_archive_arguments(self):
"""Activate archive arguments parsing"""
group = self.parser.add_argument_group('archive arguments')
group.add_argument('--archive-path', dest='archive_path', default=None,
help="directory path to the archives")
group.add_argu... | def _set_archive_arguments(self):
"""Activate archive arguments parsing"""
group = self.parser.add_argument_group('archive arguments')
group.add_argument('--archive-path', dest='archive_path', default=None,
help="directory path to the archives")
group.add_argu... | [
"Activate",
"archive",
"arguments",
"parsing"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L391-L402 | [
"def",
"_set_archive_arguments",
"(",
"self",
")",
":",
"group",
"=",
"self",
".",
"parser",
".",
"add_argument_group",
"(",
"'archive arguments'",
")",
"group",
".",
"add_argument",
"(",
"'--archive-path'",
",",
"dest",
"=",
"'archive_path'",
",",
"default",
"=... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommandArgumentParser._set_output_arguments | Activate output arguments parsing | perceval/backend.py | def _set_output_arguments(self):
"""Activate output arguments parsing"""
group = self.parser.add_argument_group('output arguments')
group.add_argument('-o', '--output', type=argparse.FileType('w'),
dest='outfile', default=sys.stdout,
help="o... | def _set_output_arguments(self):
"""Activate output arguments parsing"""
group = self.parser.add_argument_group('output arguments')
group.add_argument('-o', '--output', type=argparse.FileType('w'),
dest='outfile', default=sys.stdout,
help="o... | [
"Activate",
"output",
"arguments",
"parsing"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L404-L412 | [
"def",
"_set_output_arguments",
"(",
"self",
")",
":",
"group",
"=",
"self",
".",
"parser",
".",
"add_argument_group",
"(",
"'output arguments'",
")",
"group",
".",
"add_argument",
"(",
"'-o'",
",",
"'--output'",
",",
"type",
"=",
"argparse",
".",
"FileType",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommand.run | Fetch and write items.
This method runs the backend to fetch the items from the given
origin. Items are converted to JSON objects and written to the
defined output.
If `fetch-archive` parameter was given as an argument during
the inizialization of the instance, the items will b... | perceval/backend.py | def run(self):
"""Fetch and write items.
This method runs the backend to fetch the items from the given
origin. Items are converted to JSON objects and written to the
defined output.
If `fetch-archive` parameter was given as an argument during
the inizialization of the ... | def run(self):
"""Fetch and write items.
This method runs the backend to fetch the items from the given
origin. Items are converted to JSON objects and written to the
defined output.
If `fetch-archive` parameter was given as an argument during
the inizialization of the ... | [
"Fetch",
"and",
"write",
"items",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L445-L482 | [
"def",
"run",
"(",
"self",
")",
":",
"backend_args",
"=",
"vars",
"(",
"self",
".",
"parsed_args",
")",
"category",
"=",
"backend_args",
".",
"pop",
"(",
"'category'",
",",
"None",
")",
"filter_classified",
"=",
"backend_args",
".",
"pop",
"(",
"'filter_cl... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | BackendCommand._initialize_archive | Initialize archive based on the parsed parameters | perceval/backend.py | def _initialize_archive(self):
"""Initialize archive based on the parsed parameters"""
if 'archive_path' not in self.parsed_args:
manager = None
elif self.parsed_args.no_archive:
manager = None
else:
if not self.parsed_args.archive_path:
... | def _initialize_archive(self):
"""Initialize archive based on the parsed parameters"""
if 'archive_path' not in self.parsed_args:
manager = None
elif self.parsed_args.no_archive:
manager = None
else:
if not self.parsed_args.archive_path:
... | [
"Initialize",
"archive",
"based",
"on",
"the",
"parsed",
"parameters"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backend.py#L492-L507 | [
"def",
"_initialize_archive",
"(",
"self",
")",
":",
"if",
"'archive_path'",
"not",
"in",
"self",
".",
"parsed_args",
":",
"manager",
"=",
"None",
"elif",
"self",
".",
"parsed_args",
".",
"no_archive",
":",
"manager",
"=",
"None",
"else",
":",
"if",
"not",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox.fetch_items | Fetch the messages
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | perceval/backends/core/mbox.py | def fetch_items(self, category, **kwargs):
"""Fetch the messages
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
logger.info("Looking for messages from '%s' on '... | def fetch_items(self, category, **kwargs):
"""Fetch the messages
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
logger.info("Looking for messages from '%s' on '... | [
"Fetch",
"the",
"messages"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L98-L118 | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"from_date",
"=",
"kwargs",
"[",
"'from_date'",
"]",
"logger",
".",
"info",
"(",
"\"Looking for messages from '%s' on '%s' since %s\"",
",",
"self",
".",
"uri",
",",
"self",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox.metadata_updated_on | Extracts the update time from a MBox item.
The timestamp used is extracted from 'Date' field in its
several forms. This date is converted to UNIX timestamp
format.
:param item: item generated by the backend
:returns: a UNIX timestamp | perceval/backends/core/mbox.py | def metadata_updated_on(item):
"""Extracts the update time from a MBox item.
The timestamp used is extracted from 'Date' field in its
several forms. This date is converted to UNIX timestamp
format.
:param item: item generated by the backend
:returns: a UNIX timestamp
... | def metadata_updated_on(item):
"""Extracts the update time from a MBox item.
The timestamp used is extracted from 'Date' field in its
several forms. This date is converted to UNIX timestamp
format.
:param item: item generated by the backend
:returns: a UNIX timestamp
... | [
"Extracts",
"the",
"update",
"time",
"from",
"a",
"MBox",
"item",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L143-L157 | [
"def",
"metadata_updated_on",
"(",
"item",
")",
":",
"ts",
"=",
"item",
"[",
"MBox",
".",
"DATE_FIELD",
"]",
"ts",
"=",
"str_to_datetime",
"(",
"ts",
")",
"return",
"ts",
".",
"timestamp",
"(",
")"
] | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox.parse_mbox | Parse a mbox file.
This method parses a mbox file and returns an iterator of dictionaries.
Each one of this contains an email message.
:param filepath: path of the mbox to parse
:returns : generator of messages; each message is stored in a
dictionary of type `requests.stru... | perceval/backends/core/mbox.py | def parse_mbox(filepath):
"""Parse a mbox file.
This method parses a mbox file and returns an iterator of dictionaries.
Each one of this contains an email message.
:param filepath: path of the mbox to parse
:returns : generator of messages; each message is stored in a
... | def parse_mbox(filepath):
"""Parse a mbox file.
This method parses a mbox file and returns an iterator of dictionaries.
Each one of this contains an email message.
:param filepath: path of the mbox to parse
:returns : generator of messages; each message is stored in a
... | [
"Parse",
"a",
"mbox",
"file",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L169-L184 | [
"def",
"parse_mbox",
"(",
"filepath",
")",
":",
"mbox",
"=",
"_MBox",
"(",
"filepath",
",",
"create",
"=",
"False",
")",
"for",
"msg",
"in",
"mbox",
":",
"message",
"=",
"message_to_dict",
"(",
"msg",
")",
"yield",
"message"
] | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox._fetch_and_parse_messages | Fetch and parse the messages from a mailing list | perceval/backends/core/mbox.py | def _fetch_and_parse_messages(self, mailing_list, from_date):
"""Fetch and parse the messages from a mailing list"""
from_date = datetime_to_utc(from_date)
nmsgs, imsgs, tmsgs = (0, 0, 0)
for mbox in mailing_list.mboxes:
tmp_path = None
try:
tm... | def _fetch_and_parse_messages(self, mailing_list, from_date):
"""Fetch and parse the messages from a mailing list"""
from_date = datetime_to_utc(from_date)
nmsgs, imsgs, tmsgs = (0, 0, 0)
for mbox in mailing_list.mboxes:
tmp_path = None
try:
tm... | [
"Fetch",
"and",
"parse",
"the",
"messages",
"from",
"a",
"mailing",
"list"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L189-L236 | [
"def",
"_fetch_and_parse_messages",
"(",
"self",
",",
"mailing_list",
",",
"from_date",
")",
":",
"from_date",
"=",
"datetime_to_utc",
"(",
"from_date",
")",
"nmsgs",
",",
"imsgs",
",",
"tmsgs",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
"for",
"mbox",
"in"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox._copy_mbox | Copy the contents of a mbox to a temporary file | perceval/backends/core/mbox.py | def _copy_mbox(self, mbox):
"""Copy the contents of a mbox to a temporary file"""
tmp_path = tempfile.mktemp(prefix='perceval_')
with mbox.container as f_in:
with open(tmp_path, mode='wb') as f_out:
for l in f_in:
f_out.write(l)
return tm... | def _copy_mbox(self, mbox):
"""Copy the contents of a mbox to a temporary file"""
tmp_path = tempfile.mktemp(prefix='perceval_')
with mbox.container as f_in:
with open(tmp_path, mode='wb') as f_out:
for l in f_in:
f_out.write(l)
return tm... | [
"Copy",
"the",
"contents",
"of",
"a",
"mbox",
"to",
"a",
"temporary",
"file"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L238-L247 | [
"def",
"_copy_mbox",
"(",
"self",
",",
"mbox",
")",
":",
"tmp_path",
"=",
"tempfile",
".",
"mktemp",
"(",
"prefix",
"=",
"'perceval_'",
")",
"with",
"mbox",
".",
"container",
"as",
"f_in",
":",
"with",
"open",
"(",
"tmp_path",
",",
"mode",
"=",
"'wb'",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox._validate_message | Check if the given message has the mandatory fields | perceval/backends/core/mbox.py | def _validate_message(self, message):
"""Check if the given message has the mandatory fields"""
# This check is "case insensitive" because we're
# using 'CaseInsensitiveDict' from requests.structures
# module to store the contents of a message.
if self.MESSAGE_ID_FIELD not in me... | def _validate_message(self, message):
"""Check if the given message has the mandatory fields"""
# This check is "case insensitive" because we're
# using 'CaseInsensitiveDict' from requests.structures
# module to store the contents of a message.
if self.MESSAGE_ID_FIELD not in me... | [
"Check",
"if",
"the",
"given",
"message",
"has",
"the",
"mandatory",
"fields"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L249-L282 | [
"def",
"_validate_message",
"(",
"self",
",",
"message",
")",
":",
"# This check is \"case insensitive\" because we're",
"# using 'CaseInsensitiveDict' from requests.structures",
"# module to store the contents of a message.",
"if",
"self",
".",
"MESSAGE_ID_FIELD",
"not",
"in",
"me... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MBox._casedict_to_dict | Convert a message in CaseInsensitiveDict to dict.
This method also converts well known problematic headers,
such as Message-ID and Date to a common name. | perceval/backends/core/mbox.py | def _casedict_to_dict(self, message):
"""Convert a message in CaseInsensitiveDict to dict.
This method also converts well known problematic headers,
such as Message-ID and Date to a common name.
"""
message_id = message.pop(self.MESSAGE_ID_FIELD)
date = message.pop(self.... | def _casedict_to_dict(self, message):
"""Convert a message in CaseInsensitiveDict to dict.
This method also converts well known problematic headers,
such as Message-ID and Date to a common name.
"""
message_id = message.pop(self.MESSAGE_ID_FIELD)
date = message.pop(self.... | [
"Convert",
"a",
"message",
"in",
"CaseInsensitiveDict",
"to",
"dict",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L284-L297 | [
"def",
"_casedict_to_dict",
"(",
"self",
",",
"message",
")",
":",
"message_id",
"=",
"message",
".",
"pop",
"(",
"self",
".",
"MESSAGE_ID_FIELD",
")",
"date",
"=",
"message",
".",
"pop",
"(",
"self",
".",
"DATE_FIELD",
")",
"msg",
"=",
"{",
"k",
":",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | _MBox.get_message | Return a Message representation or raise a KeyError. | perceval/backends/core/mbox.py | def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
from_line = self._file.readline().replace(mailbox.linesep, b'')
string = self._file.read(stop - self._file.tell())
msg = self._me... | def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
from_line = self._file.readline().replace(mailbox.linesep, b'')
string = self._file.read(stop - self._file.tell())
msg = self._me... | [
"Return",
"a",
"Message",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L303-L323 | [
"def",
"get_message",
"(",
"self",
",",
"key",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"self",
".",
"_file",
".",
"seek",
"(",
"start",
")",
"from_line",
"=",
"self",
".",
"_file",
".",
"readline",
"(",
")",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | MailingList.mboxes | Get the mboxes managed by this mailing list.
Returns the archives sorted by name.
:returns: a list of `.MBoxArchive` objects | perceval/backends/core/mbox.py | def mboxes(self):
"""Get the mboxes managed by this mailing list.
Returns the archives sorted by name.
:returns: a list of `.MBoxArchive` objects
"""
archives = []
if os.path.isfile(self.dirpath):
try:
archives.append(MBoxArchive(self.dirpat... | def mboxes(self):
"""Get the mboxes managed by this mailing list.
Returns the archives sorted by name.
:returns: a list of `.MBoxArchive` objects
"""
archives = []
if os.path.isfile(self.dirpath):
try:
archives.append(MBoxArchive(self.dirpat... | [
"Get",
"the",
"mboxes",
"managed",
"by",
"this",
"mailing",
"list",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/mbox.py#L400-L422 | [
"def",
"mboxes",
"(",
"self",
")",
":",
"archives",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"dirpath",
")",
":",
"try",
":",
"archives",
".",
"append",
"(",
"MBoxArchive",
"(",
"self",
".",
"dirpath",
")",
")",
"e... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Git.fetch | Fetch commits.
The method retrieves from a Git repository or a log file
a list of commits. Commits are returned in the same order
they were obtained.
When `from_date` parameter is given it returns items commited
since the given date.
The list of `branches` is a list of... | perceval/backends/core/git.py | def fetch(self, category=CATEGORY_COMMIT, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME,
branches=None, latest_items=False, no_update=False):
"""Fetch commits.
The method retrieves from a Git repository or a log file
a list of commits. Commits are returned in the same ... | def fetch(self, category=CATEGORY_COMMIT, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME,
branches=None, latest_items=False, no_update=False):
"""Fetch commits.
The method retrieves from a Git repository or a log file
a list of commits. Commits are returned in the same ... | [
"Fetch",
"commits",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L78-L132 | [
"def",
"fetch",
"(",
"self",
",",
"category",
"=",
"CATEGORY_COMMIT",
",",
"from_date",
"=",
"DEFAULT_DATETIME",
",",
"to_date",
"=",
"DEFAULT_LAST_DATETIME",
",",
"branches",
"=",
"None",
",",
"latest_items",
"=",
"False",
",",
"no_update",
"=",
"False",
")",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Git.fetch_items | Fetch the commits
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | perceval/backends/core/git.py | def fetch_items(self, category, **kwargs):
"""Fetch the commits
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
to_date = kwargs['to_date']
branches = kwa... | def fetch_items(self, category, **kwargs):
"""Fetch the commits
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
to_date = kwargs['to_date']
branches = kwa... | [
"Fetch",
"the",
"commits"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L134-L164 | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"from_date",
"=",
"kwargs",
"[",
"'from_date'",
"]",
"to_date",
"=",
"kwargs",
"[",
"'to_date'",
"]",
"branches",
"=",
"kwargs",
"[",
"'branches'",
"]",
"latest_items",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Git.parse_git_log_from_file | Parse a Git log file.
The method parses the Git log file and returns an iterator of
dictionaries. Each one of this, contains a commit.
:param filepath: path to the log file
:returns: a generator of parsed commits
:raises ParseError: raised when the format of the Git log file
... | perceval/backends/core/git.py | def parse_git_log_from_file(filepath):
"""Parse a Git log file.
The method parses the Git log file and returns an iterator of
dictionaries. Each one of this, contains a commit.
:param filepath: path to the log file
:returns: a generator of parsed commits
:raises Parse... | def parse_git_log_from_file(filepath):
"""Parse a Git log file.
The method parses the Git log file and returns an iterator of
dictionaries. Each one of this, contains a commit.
:param filepath: path to the log file
:returns: a generator of parsed commits
:raises Parse... | [
"Parse",
"a",
"Git",
"log",
"file",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L215-L235 | [
"def",
"parse_git_log_from_file",
"(",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"'r'",
",",
"errors",
"=",
"'surrogateescape'",
",",
"newline",
"=",
"os",
".",
"linesep",
")",
"as",
"f",
":",
"parser",
"=",
"GitParser",
"(",
"f",
")",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitCommand._pre_init | Initialize repositories directory path | perceval/backends/core/git.py | def _pre_init(self):
"""Initialize repositories directory path"""
if self.parsed_args.git_log:
git_path = self.parsed_args.git_log
elif not self.parsed_args.git_path:
base_path = os.path.expanduser('~/.perceval/repositories/')
processed_uri = self.parsed_args... | def _pre_init(self):
"""Initialize repositories directory path"""
if self.parsed_args.git_log:
git_path = self.parsed_args.git_log
elif not self.parsed_args.git_path:
base_path = os.path.expanduser('~/.perceval/repositories/')
processed_uri = self.parsed_args... | [
"Initialize",
"repositories",
"directory",
"path"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L330-L342 | [
"def",
"_pre_init",
"(",
"self",
")",
":",
"if",
"self",
".",
"parsed_args",
".",
"git_log",
":",
"git_path",
"=",
"self",
".",
"parsed_args",
".",
"git_log",
"elif",
"not",
"self",
".",
"parsed_args",
".",
"git_path",
":",
"base_path",
"=",
"os",
".",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitCommand.setup_cmd_parser | Returns the Git argument parser. | perceval/backends/core/git.py | def setup_cmd_parser(cls):
"""Returns the Git argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
to_date=True)
# Optional arguments
group = parser.... | def setup_cmd_parser(cls):
"""Returns the Git argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
to_date=True)
# Optional arguments
group = parser.... | [
"Returns",
"the",
"Git",
"argument",
"parser",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L345-L377 | [
"def",
"setup_cmd_parser",
"(",
"cls",
")",
":",
"parser",
"=",
"BackendCommandArgumentParser",
"(",
"cls",
".",
"BACKEND",
".",
"CATEGORIES",
",",
"from_date",
"=",
"True",
",",
"to_date",
"=",
"True",
")",
"# Optional arguments",
"group",
"=",
"parser",
".",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitParser.parse | Parse the Git log stream. | perceval/backends/core/git.py | def parse(self):
"""Parse the Git log stream."""
for line in self.stream:
line = line.rstrip('\n')
parsed = False
self.nline += 1
while not parsed:
parsed = self.handlers[self.state](line)
if self.state == self.COMMIT and... | def parse(self):
"""Parse the Git log stream."""
for line in self.stream:
line = line.rstrip('\n')
parsed = False
self.nline += 1
while not parsed:
parsed = self.handlers[self.state](line)
if self.state == self.COMMIT and... | [
"Parse",
"the",
"Git",
"log",
"stream",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L525-L545 | [
"def",
"parse",
"(",
"self",
")",
":",
"for",
"line",
"in",
"self",
".",
"stream",
":",
"line",
"=",
"line",
".",
"rstrip",
"(",
"'\\n'",
")",
"parsed",
"=",
"False",
"self",
".",
"nline",
"+=",
"1",
"while",
"not",
"parsed",
":",
"parsed",
"=",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitParser.__get_old_filepath | Get the old filepath of a moved/renamed file.
Moved or renamed files can be found in the log with any of the
next patterns:
'old_name => new_name'
'{old_prefix => new_prefix}/name'
'name/{old_suffix => new_suffix}'
This method returns the filepath before the file ... | perceval/backends/core/git.py | def __get_old_filepath(self, f):
"""Get the old filepath of a moved/renamed file.
Moved or renamed files can be found in the log with any of the
next patterns:
'old_name => new_name'
'{old_prefix => new_prefix}/name'
'name/{old_suffix => new_suffix}'
This ... | def __get_old_filepath(self, f):
"""Get the old filepath of a moved/renamed file.
Moved or renamed files can be found in the log with any of the
next patterns:
'old_name => new_name'
'{old_prefix => new_prefix}/name'
'name/{old_suffix => new_suffix}'
This ... | [
"Get",
"the",
"old",
"filepath",
"of",
"a",
"moved",
"/",
"renamed",
"file",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L704-L727 | [
"def",
"__get_old_filepath",
"(",
"self",
",",
"f",
")",
":",
"i",
"=",
"f",
".",
"find",
"(",
"'{'",
")",
"j",
"=",
"f",
".",
"find",
"(",
"'}'",
")",
"if",
"i",
">",
"-",
"1",
"and",
"j",
">",
"-",
"1",
":",
"prefix",
"=",
"f",
"[",
"0"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.clone | Clone a Git repository.
Make a bare copy of the repository stored in `uri` into `dirpath`.
The repository would be either local or remote.
:param uri: URI of the repository
:param dirtpath: directory where the repository will be cloned
:returns: a `GitRepository` class having ... | perceval/backends/core/git.py | def clone(cls, uri, dirpath):
"""Clone a Git repository.
Make a bare copy of the repository stored in `uri` into `dirpath`.
The repository would be either local or remote.
:param uri: URI of the repository
:param dirtpath: directory where the repository will be cloned
... | def clone(cls, uri, dirpath):
"""Clone a Git repository.
Make a bare copy of the repository stored in `uri` into `dirpath`.
The repository would be either local or remote.
:param uri: URI of the repository
:param dirtpath: directory where the repository will be cloned
... | [
"Clone",
"a",
"Git",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L804-L829 | [
"def",
"clone",
"(",
"cls",
",",
"uri",
",",
"dirpath",
")",
":",
"cmd",
"=",
"[",
"'git'",
",",
"'clone'",
",",
"'--bare'",
",",
"uri",
",",
"dirpath",
"]",
"env",
"=",
"{",
"'LANG'",
":",
"'C'",
",",
"'HOME'",
":",
"os",
".",
"getenv",
"(",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.count_objects | Count the objects of a repository.
The method returns the total number of objects (packed and unpacked)
available on the repository.
:raises RepositoryError: when an error occurs counting the objects
of a repository | perceval/backends/core/git.py | def count_objects(self):
"""Count the objects of a repository.
The method returns the total number of objects (packed and unpacked)
available on the repository.
:raises RepositoryError: when an error occurs counting the objects
of a repository
"""
cmd_count ... | def count_objects(self):
"""Count the objects of a repository.
The method returns the total number of objects (packed and unpacked)
available on the repository.
:raises RepositoryError: when an error occurs counting the objects
of a repository
"""
cmd_count ... | [
"Count",
"the",
"objects",
"of",
"a",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L831-L859 | [
"def",
"count_objects",
"(",
"self",
")",
":",
"cmd_count",
"=",
"[",
"'git'",
",",
"'count-objects'",
",",
"'-v'",
"]",
"outs",
"=",
"self",
".",
"_exec",
"(",
"cmd_count",
",",
"cwd",
"=",
"self",
".",
"dirpath",
",",
"env",
"=",
"self",
".",
"gite... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.is_detached | Check if the repo is in a detached state.
The repository is in a detached state when HEAD is not a symbolic
reference.
:returns: whether the repository is detached or not
:raises RepositoryError: when an error occurs checking the state
of the repository | perceval/backends/core/git.py | def is_detached(self):
"""Check if the repo is in a detached state.
The repository is in a detached state when HEAD is not a symbolic
reference.
:returns: whether the repository is detached or not
:raises RepositoryError: when an error occurs checking the state
of ... | def is_detached(self):
"""Check if the repo is in a detached state.
The repository is in a detached state when HEAD is not a symbolic
reference.
:returns: whether the repository is detached or not
:raises RepositoryError: when an error occurs checking the state
of ... | [
"Check",
"if",
"the",
"repo",
"is",
"in",
"a",
"detached",
"state",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L861-L881 | [
"def",
"is_detached",
"(",
"self",
")",
":",
"cmd_sym",
"=",
"[",
"'git'",
",",
"'symbolic-ref'",
",",
"'HEAD'",
"]",
"try",
":",
"self",
".",
"_exec",
"(",
"cmd_sym",
",",
"cwd",
"=",
"self",
".",
"dirpath",
",",
"env",
"=",
"self",
".",
"gitenv",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.update | Update repository from its remote.
Calling this method, the repository will be synchronized with
the remote repository using 'fetch' command for 'heads' refs.
Any commit stored in the local copy will be removed; refs
will be overwritten.
:raises RepositoryError: when an error o... | perceval/backends/core/git.py | def update(self):
"""Update repository from its remote.
Calling this method, the repository will be synchronized with
the remote repository using 'fetch' command for 'heads' refs.
Any commit stored in the local copy will be removed; refs
will be overwritten.
:raises Rep... | def update(self):
"""Update repository from its remote.
Calling this method, the repository will be synchronized with
the remote repository using 'fetch' command for 'heads' refs.
Any commit stored in the local copy will be removed; refs
will be overwritten.
:raises Rep... | [
"Update",
"repository",
"from",
"its",
"remote",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L895-L910 | [
"def",
"update",
"(",
"self",
")",
":",
"cmd_update",
"=",
"[",
"'git'",
",",
"'fetch'",
",",
"'origin'",
",",
"'+refs/heads/*:refs/heads/*'",
",",
"'--prune'",
"]",
"self",
".",
"_exec",
"(",
"cmd_update",
",",
"cwd",
"=",
"self",
".",
"dirpath",
",",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.sync | Keep the repository in sync.
This method will synchronize the repository with its 'origin',
fetching newest objects and updating references. It uses low
level commands which allow to keep track of which things
have changed in the repository.
The method also returns a list of ha... | perceval/backends/core/git.py | def sync(self):
"""Keep the repository in sync.
This method will synchronize the repository with its 'origin',
fetching newest objects and updating references. It uses low
level commands which allow to keep track of which things
have changed in the repository.
The metho... | def sync(self):
"""Keep the repository in sync.
This method will synchronize the repository with its 'origin',
fetching newest objects and updating references. It uses low
level commands which allow to keep track of which things
have changed in the repository.
The metho... | [
"Keep",
"the",
"repository",
"in",
"sync",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L912-L942 | [
"def",
"sync",
"(",
"self",
")",
":",
"pack_name",
",",
"refs",
"=",
"self",
".",
"_fetch_pack",
"(",
")",
"if",
"pack_name",
":",
"commits",
"=",
"self",
".",
"_read_commits_from_pack",
"(",
"pack_name",
")",
"else",
":",
"commits",
"=",
"[",
"]",
"lo... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.rev_list | Read the list commits from the repository
The list of branches is a list of strings, with the names of the
branches to fetch. If the list of branches is empty, no commit
is fetched. If the list of branches is None, all commits
for all branches will be fetched.
The method return... | perceval/backends/core/git.py | def rev_list(self, branches=None):
"""Read the list commits from the repository
The list of branches is a list of strings, with the names of the
branches to fetch. If the list of branches is empty, no commit
is fetched. If the list of branches is None, all commits
for all branch... | def rev_list(self, branches=None):
"""Read the list commits from the repository
The list of branches is a list of strings, with the names of the
branches to fetch. If the list of branches is empty, no commit
is fetched. If the list of branches is None, all commits
for all branch... | [
"Read",
"the",
"list",
"commits",
"from",
"the",
"repository"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L944-L982 | [
"def",
"rev_list",
"(",
"self",
",",
"branches",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"logger",
".",
"warning",
"(",
"\"Git %s repository is empty; unable to get the rev-list\"",
",",
"self",
".",
"uri",
")",
"raise",
"EmptyRepo... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.log | Read the commit log from the repository.
The method returns the Git log of the repository using the
following options:
git log --raw --numstat --pretty=fuller --decorate=full
--all --reverse --topo-order --parents -M -C -c
--remotes=origin
When `fro... | perceval/backends/core/git.py | def log(self, from_date=None, to_date=None, branches=None, encoding='utf-8'):
"""Read the commit log from the repository.
The method returns the Git log of the repository using the
following options:
git log --raw --numstat --pretty=fuller --decorate=full
--all --re... | def log(self, from_date=None, to_date=None, branches=None, encoding='utf-8'):
"""Read the commit log from the repository.
The method returns the Git log of the repository using the
following options:
git log --raw --numstat --pretty=fuller --decorate=full
--all --re... | [
"Read",
"the",
"commit",
"log",
"from",
"the",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L984-L1041 | [
"def",
"log",
"(",
"self",
",",
"from_date",
"=",
"None",
",",
"to_date",
"=",
"None",
",",
"branches",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"logger",
".",
"warning",
"(",
"\"Git %s rep... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository.show | Show the data of a set of commits.
The method returns the output of Git show command for a
set of commits using the following options:
git show --raw --numstat --pretty=fuller --decorate=full
--parents -M -C -c [<commit>...<commit>]
When the list of commits is empt... | perceval/backends/core/git.py | def show(self, commits=None, encoding='utf-8'):
"""Show the data of a set of commits.
The method returns the output of Git show command for a
set of commits using the following options:
git show --raw --numstat --pretty=fuller --decorate=full
--parents -M -C -c [<co... | def show(self, commits=None, encoding='utf-8'):
"""Show the data of a set of commits.
The method returns the output of Git show command for a
set of commits using the following options:
git show --raw --numstat --pretty=fuller --decorate=full
--parents -M -C -c [<co... | [
"Show",
"the",
"data",
"of",
"a",
"set",
"of",
"commits",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1043-L1081 | [
"def",
"show",
"(",
"self",
",",
"commits",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"self",
".",
"is_empty",
"(",
")",
":",
"logger",
".",
"warning",
"(",
"\"Git %s repository is empty; unable to run show\"",
",",
"self",
".",
"uri",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._fetch_pack | Fetch changes and store them in a pack. | perceval/backends/core/git.py | def _fetch_pack(self):
"""Fetch changes and store them in a pack."""
def prepare_refs(refs):
return [ref.hash.encode('utf-8') for ref in refs
if not ref.refname.endswith('^{}')]
def determine_wants(refs):
remote_refs = prepare_refs(self._discover_ref... | def _fetch_pack(self):
"""Fetch changes and store them in a pack."""
def prepare_refs(refs):
return [ref.hash.encode('utf-8') for ref in refs
if not ref.refname.endswith('^{}')]
def determine_wants(refs):
remote_refs = prepare_refs(self._discover_ref... | [
"Fetch",
"changes",
"and",
"store",
"them",
"in",
"a",
"pack",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1083-L1117 | [
"def",
"_fetch_pack",
"(",
"self",
")",
":",
"def",
"prepare_refs",
"(",
"refs",
")",
":",
"return",
"[",
"ref",
".",
"hash",
".",
"encode",
"(",
"'utf-8'",
")",
"for",
"ref",
"in",
"refs",
"if",
"not",
"ref",
".",
"refname",
".",
"endswith",
"(",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._read_commits_from_pack | Read the commits of a pack. | perceval/backends/core/git.py | def _read_commits_from_pack(self, packet_name):
"""Read the commits of a pack."""
filepath = 'objects/pack/pack-' + packet_name
cmd_verify_pack = ['git', 'verify-pack', '-v', filepath]
outs = self._exec(cmd_verify_pack, cwd=self.dirpath, env=self.gitenv)
outs = outs.decode('ut... | def _read_commits_from_pack(self, packet_name):
"""Read the commits of a pack."""
filepath = 'objects/pack/pack-' + packet_name
cmd_verify_pack = ['git', 'verify-pack', '-v', filepath]
outs = self._exec(cmd_verify_pack, cwd=self.dirpath, env=self.gitenv)
outs = outs.decode('ut... | [
"Read",
"the",
"commits",
"of",
"a",
"pack",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1119-L1135 | [
"def",
"_read_commits_from_pack",
"(",
"self",
",",
"packet_name",
")",
":",
"filepath",
"=",
"'objects/pack/pack-'",
"+",
"packet_name",
"cmd_verify_pack",
"=",
"[",
"'git'",
",",
"'verify-pack'",
",",
"'-v'",
",",
"filepath",
"]",
"outs",
"=",
"self",
".",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._update_references | Update references removing old ones. | perceval/backends/core/git.py | def _update_references(self, refs):
"""Update references removing old ones."""
new_refs = [ref.refname for ref in refs]
# Delete old references
for old_ref in self._discover_refs():
if not old_ref.refname.startswith('refs/heads/'):
continue
if ol... | def _update_references(self, refs):
"""Update references removing old ones."""
new_refs = [ref.refname for ref in refs]
# Delete old references
for old_ref in self._discover_refs():
if not old_ref.refname.startswith('refs/heads/'):
continue
if ol... | [
"Update",
"references",
"removing",
"old",
"ones",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1137-L1167 | [
"def",
"_update_references",
"(",
"self",
",",
"refs",
")",
":",
"new_refs",
"=",
"[",
"ref",
".",
"refname",
"for",
"ref",
"in",
"refs",
"]",
"# Delete old references",
"for",
"old_ref",
"in",
"self",
".",
"_discover_refs",
"(",
")",
":",
"if",
"not",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._discover_refs | Get the current list of local or remote refs. | perceval/backends/core/git.py | def _discover_refs(self, remote=False):
"""Get the current list of local or remote refs."""
if remote:
cmd_refs = ['git', 'ls-remote', '-h', '-t', '--exit-code', 'origin']
sep = '\t'
ignored_error_codes = [2]
else:
# Check first whether the local ... | def _discover_refs(self, remote=False):
"""Get the current list of local or remote refs."""
if remote:
cmd_refs = ['git', 'ls-remote', '-h', '-t', '--exit-code', 'origin']
sep = '\t'
ignored_error_codes = [2]
else:
# Check first whether the local ... | [
"Get",
"the",
"current",
"list",
"of",
"local",
"or",
"remote",
"refs",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1169-L1202 | [
"def",
"_discover_refs",
"(",
"self",
",",
"remote",
"=",
"False",
")",
":",
"if",
"remote",
":",
"cmd_refs",
"=",
"[",
"'git'",
",",
"'ls-remote'",
",",
"'-h'",
",",
"'-t'",
",",
"'--exit-code'",
",",
"'origin'",
"]",
"sep",
"=",
"'\\t'",
"ignored_error... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._update_ref | Update a reference. | perceval/backends/core/git.py | def _update_ref(self, ref, delete=False):
"""Update a reference."""
cmd = ['git', 'update-ref']
if delete:
cmd.extend(['-d', ref.refname])
action = 'deleted'
else:
cmd.extend([ref.refname, ref.hash])
action = 'updated to %s' % ref.hash
... | def _update_ref(self, ref, delete=False):
"""Update a reference."""
cmd = ['git', 'update-ref']
if delete:
cmd.extend(['-d', ref.refname])
action = 'deleted'
else:
cmd.extend([ref.refname, ref.hash])
action = 'updated to %s' % ref.hash
... | [
"Update",
"a",
"reference",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1204-L1223 | [
"def",
"_update_ref",
"(",
"self",
",",
"ref",
",",
"delete",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'git'",
",",
"'update-ref'",
"]",
"if",
"delete",
":",
"cmd",
".",
"extend",
"(",
"[",
"'-d'",
",",
"ref",
".",
"refname",
"]",
")",
"action",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._exec_nb | Run a command with a non blocking call.
Execute `cmd` command with a non blocking call. The command will
be run in the directory set by `cwd`. Enviroment variables can be
set using the `env` dictionary. The output data is returned
as encoded bytes in an iterator. Each item will be a lin... | perceval/backends/core/git.py | def _exec_nb(self, cmd, cwd=None, env=None, encoding='utf-8'):
"""Run a command with a non blocking call.
Execute `cmd` command with a non blocking call. The command will
be run in the directory set by `cwd`. Enviroment variables can be
set using the `env` dictionary. The output data is... | def _exec_nb(self, cmd, cwd=None, env=None, encoding='utf-8'):
"""Run a command with a non blocking call.
Execute `cmd` command with a non blocking call. The command will
be run in the directory set by `cwd`. Enviroment variables can be
set using the `env` dictionary. The output data is... | [
"Run",
"a",
"command",
"with",
"a",
"non",
"blocking",
"call",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1225-L1267 | [
"def",
"_exec_nb",
"(",
"self",
",",
"cmd",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"self",
".",
"failed_message",
"=",
"None",
"logger",
".",
"debug",
"(",
"\"Running command %s (cwd: %s, env: %s)\"",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._read_stderr | Reads self.proc.stderr.
Usually, this should be read in a thread, to prevent blocking
the read from stdout of the stderr buffer is filled, and this
function is not called becuase the program is busy in the
stderr reading loop.
Reads self.proc.stderr (self.proc is the subprocess... | perceval/backends/core/git.py | def _read_stderr(self, encoding='utf-8'):
"""Reads self.proc.stderr.
Usually, this should be read in a thread, to prevent blocking
the read from stdout of the stderr buffer is filled, and this
function is not called becuase the program is busy in the
stderr reading loop.
... | def _read_stderr(self, encoding='utf-8'):
"""Reads self.proc.stderr.
Usually, this should be read in a thread, to prevent blocking
the read from stdout of the stderr buffer is filled, and this
function is not called becuase the program is busy in the
stderr reading loop.
... | [
"Reads",
"self",
".",
"proc",
".",
"stderr",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1269-L1293 | [
"def",
"_read_stderr",
"(",
"self",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"for",
"line",
"in",
"self",
".",
"proc",
".",
"stderr",
":",
"err_line",
"=",
"line",
".",
"decode",
"(",
"encoding",
",",
"errors",
"=",
"'surrogateescape'",
")",
"if",
"s... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitRepository._exec | Run a command.
Execute `cmd` command in the directory set by `cwd`. Environment
variables can be set using the `env` dictionary. The output
data is returned as encoded bytes.
Commands which their returning status codes are non-zero will
be treated as failed. Error codes conside... | perceval/backends/core/git.py | def _exec(cmd, cwd=None, env=None, ignored_error_codes=None,
encoding='utf-8'):
"""Run a command.
Execute `cmd` command in the directory set by `cwd`. Environment
variables can be set using the `env` dictionary. The output
data is returned as encoded bytes.
Comman... | def _exec(cmd, cwd=None, env=None, ignored_error_codes=None,
encoding='utf-8'):
"""Run a command.
Execute `cmd` command in the directory set by `cwd`. Environment
variables can be set using the `env` dictionary. The output
data is returned as encoded bytes.
Comman... | [
"Run",
"a",
"command",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/git.py#L1296-L1333 | [
"def",
"_exec",
"(",
"cmd",
",",
"cwd",
"=",
"None",
",",
"env",
"=",
"None",
",",
"ignored_error_codes",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"ignored_error_codes",
"is",
"None",
":",
"ignored_error_codes",
"=",
"[",
"]",
"logge... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Twitter.fetch | Fetch the tweets from the server.
This method fetches tweets from the TwitterSearch API published in the last seven days.
:param category: the category of items to fetch
:param since_id: if not null, it returns results with an ID greater than the specified ID
:param max_id: when it is ... | perceval/backends/core/twitter.py | def fetch(self, category=CATEGORY_TWEET, since_id=None, max_id=None,
geocode=None, lang=None,
include_entities=True, tweets_type=TWEET_TYPE_MIXED):
"""Fetch the tweets from the server.
This method fetches tweets from the TwitterSearch API published in the last seven days.
... | def fetch(self, category=CATEGORY_TWEET, since_id=None, max_id=None,
geocode=None, lang=None,
include_entities=True, tweets_type=TWEET_TYPE_MIXED):
"""Fetch the tweets from the server.
This method fetches tweets from the TwitterSearch API published in the last seven days.
... | [
"Fetch",
"the",
"tweets",
"from",
"the",
"server",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L99-L124 | [
"def",
"fetch",
"(",
"self",
",",
"category",
"=",
"CATEGORY_TWEET",
",",
"since_id",
"=",
"None",
",",
"max_id",
"=",
"None",
",",
"geocode",
"=",
"None",
",",
"lang",
"=",
"None",
",",
"include_entities",
"=",
"True",
",",
"tweets_type",
"=",
"TWEET_TY... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Twitter.fetch_items | Fetch the tweets
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | perceval/backends/core/twitter.py | def fetch_items(self, category, **kwargs):
"""Fetch the tweets
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
since_id = kwargs['since_id']
max_id = kwargs['max_id']
geocode = kwargs['g... | def fetch_items(self, category, **kwargs):
"""Fetch the tweets
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
since_id = kwargs['since_id']
max_id = kwargs['max_id']
geocode = kwargs['g... | [
"Fetch",
"the",
"tweets"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L126-L165 | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"since_id",
"=",
"kwargs",
"[",
"'since_id'",
"]",
"max_id",
"=",
"kwargs",
"[",
"'max_id'",
"]",
"geocode",
"=",
"kwargs",
"[",
"'geocode'",
"]",
"lang",
"=",
"kwar... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Twitter._init_client | Init client | perceval/backends/core/twitter.py | def _init_client(self, from_archive=False):
"""Init client"""
return TwitterClient(self.api_token, self.max_items,
self.sleep_for_rate, self.min_rate_to_sleep, self.sleep_time,
self.archive, from_archive) | def _init_client(self, from_archive=False):
"""Init client"""
return TwitterClient(self.api_token, self.max_items,
self.sleep_for_rate, self.min_rate_to_sleep, self.sleep_time,
self.archive, from_archive) | [
"Init",
"client"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L214-L219 | [
"def",
"_init_client",
"(",
"self",
",",
"from_archive",
"=",
"False",
")",
":",
"return",
"TwitterClient",
"(",
"self",
".",
"api_token",
",",
"self",
".",
"max_items",
",",
"self",
".",
"sleep_for_rate",
",",
"self",
".",
"min_rate_to_sleep",
",",
"self",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | TwitterClient.tweets | Fetch tweets for a given query between since_id and max_id.
:param query: query to fetch tweets
:param since_id: if not null, it returns results with an ID greater than the specified ID
:param max_id: if not null, it returns results with an ID less than the specified ID
:param geocode: ... | perceval/backends/core/twitter.py | def tweets(self, query, since_id=None, max_id=None, geocode=None, lang=None,
include_entities=True, result_type=TWEET_TYPE_MIXED):
"""Fetch tweets for a given query between since_id and max_id.
:param query: query to fetch tweets
:param since_id: if not null, it returns results w... | def tweets(self, query, since_id=None, max_id=None, geocode=None, lang=None,
include_entities=True, result_type=TWEET_TYPE_MIXED):
"""Fetch tweets for a given query between since_id and max_id.
:param query: query to fetch tweets
:param since_id: if not null, it returns results w... | [
"Fetch",
"tweets",
"for",
"a",
"given",
"query",
"between",
"since_id",
"and",
"max_id",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L274-L315 | [
"def",
"tweets",
"(",
"self",
",",
"query",
",",
"since_id",
"=",
"None",
",",
"max_id",
"=",
"None",
",",
"geocode",
"=",
"None",
",",
"lang",
"=",
"None",
",",
"include_entities",
"=",
"True",
",",
"result_type",
"=",
"TWEET_TYPE_MIXED",
")",
":",
"r... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | TwitterClient._fetch | Fetch a resource.
Method to fetch and to iterate over the contents of a
type of resource. The method returns a generator of
pages for that resource and parameters.
:param url: the endpoint of the API
:param params: parameters to filter
:returns: the text of the respons... | perceval/backends/core/twitter.py | def _fetch(self, url, params):
"""Fetch a resource.
Method to fetch and to iterate over the contents of a
type of resource. The method returns a generator of
pages for that resource and parameters.
:param url: the endpoint of the API
:param params: parameters to filter
... | def _fetch(self, url, params):
"""Fetch a resource.
Method to fetch and to iterate over the contents of a
type of resource. The method returns a generator of
pages for that resource and parameters.
:param url: the endpoint of the API
:param params: parameters to filter
... | [
"Fetch",
"a",
"resource",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L317-L338 | [
"def",
"_fetch",
"(",
"self",
",",
"url",
",",
"params",
")",
":",
"if",
"not",
"self",
".",
"from_archive",
":",
"self",
".",
"sleep_for_rate_limit",
"(",
")",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Bearer '",
"+",
"self",
".",
"api_key",
"}",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | TwitterCommand.setup_cmd_parser | Returns the Twitter argument parser. | perceval/backends/core/twitter.py | def setup_cmd_parser(cls):
"""Returns the Twitter argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
token_auth=True,
archive=True)
# Backend token is required
act... | def setup_cmd_parser(cls):
"""Returns the Twitter argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
token_auth=True,
archive=True)
# Backend token is required
act... | [
"Returns",
"the",
"Twitter",
"argument",
"parser",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/twitter.py#L347-L386 | [
"def",
"setup_cmd_parser",
"(",
"cls",
")",
":",
"parser",
"=",
"BackendCommandArgumentParser",
"(",
"cls",
".",
"BACKEND",
".",
"CATEGORIES",
",",
"token_auth",
"=",
"True",
",",
"archive",
"=",
"True",
")",
"# Backend token is required",
"action",
"=",
"parser... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GoogleHits.fetch | Fetch data from Google API.
The method retrieves a list of hits for some
given keywords using the Google API.
:param category: the category of items to fetch
:returns: a generator of data | perceval/backends/core/googlehits.py | def fetch(self, category=CATEGORY_HITS):
"""Fetch data from Google API.
The method retrieves a list of hits for some
given keywords using the Google API.
:param category: the category of items to fetch
:returns: a generator of data
"""
kwargs = {}
items... | def fetch(self, category=CATEGORY_HITS):
"""Fetch data from Google API.
The method retrieves a list of hits for some
given keywords using the Google API.
:param category: the category of items to fetch
:returns: a generator of data
"""
kwargs = {}
items... | [
"Fetch",
"data",
"from",
"Google",
"API",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L81-L94 | [
"def",
"fetch",
"(",
"self",
",",
"category",
"=",
"CATEGORY_HITS",
")",
":",
"kwargs",
"=",
"{",
"}",
"items",
"=",
"super",
"(",
")",
".",
"fetch",
"(",
"category",
",",
"*",
"*",
"kwargs",
")",
"return",
"items"
] | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GoogleHits.fetch_items | Fetch Google hit items
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | perceval/backends/core/googlehits.py | def fetch_items(self, category, **kwargs):
"""Fetch Google hit items
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
logger.info("Fetching data for '%s'", self.keywords)
hits_raw = self.client.... | def fetch_items(self, category, **kwargs):
"""Fetch Google hit items
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
logger.info("Fetching data for '%s'", self.keywords)
hits_raw = self.client.... | [
"Fetch",
"Google",
"hit",
"items"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L96-L111 | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"logger",
".",
"info",
"(",
"\"Fetching data for '%s'\"",
",",
"self",
".",
"keywords",
")",
"hits_raw",
"=",
"self",
".",
"client",
".",
"hits",
"(",
"self",
".",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GoogleHits._init_client | Init client | perceval/backends/core/googlehits.py | def _init_client(self, from_archive=False):
"""Init client"""
return GoogleHitsClient(self.sleep_time, self.max_retries,
archive=self.archive, from_archive=from_archive) | def _init_client(self, from_archive=False):
"""Init client"""
return GoogleHitsClient(self.sleep_time, self.max_retries,
archive=self.archive, from_archive=from_archive) | [
"Init",
"client"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L158-L162 | [
"def",
"_init_client",
"(",
"self",
",",
"from_archive",
"=",
"False",
")",
":",
"return",
"GoogleHitsClient",
"(",
"self",
".",
"sleep_time",
",",
"self",
".",
"max_retries",
",",
"archive",
"=",
"self",
".",
"archive",
",",
"from_archive",
"=",
"from_archi... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GoogleHits.__parse_hits | Parse the hits returned by the Google Search API | perceval/backends/core/googlehits.py | def __parse_hits(self, hit_raw):
"""Parse the hits returned by the Google Search API"""
# Create the soup and get the desired div
bs_result = bs4.BeautifulSoup(hit_raw, 'html.parser')
hit_string = bs_result.find("div", id="resultStats").text
# Remove commas or dots
hit_... | def __parse_hits(self, hit_raw):
"""Parse the hits returned by the Google Search API"""
# Create the soup and get the desired div
bs_result = bs4.BeautifulSoup(hit_raw, 'html.parser')
hit_string = bs_result.find("div", id="resultStats").text
# Remove commas or dots
hit_... | [
"Parse",
"the",
"hits",
"returned",
"by",
"the",
"Google",
"Search",
"API"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L164-L196 | [
"def",
"__parse_hits",
"(",
"self",
",",
"hit_raw",
")",
":",
"# Create the soup and get the desired div",
"bs_result",
"=",
"bs4",
".",
"BeautifulSoup",
"(",
"hit_raw",
",",
"'html.parser'",
")",
"hit_string",
"=",
"bs_result",
".",
"find",
"(",
"\"div\"",
",",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GoogleHitsClient.hits | Fetch information about a list of keywords. | perceval/backends/core/googlehits.py | def hits(self, keywords):
"""Fetch information about a list of keywords."""
if len(keywords) == 1:
query_str = keywords[0]
else:
query_str = ' '.join([k for k in keywords])
logger.info("Fetching hits for '%s'", query_str)
params = {'q': query_str}
... | def hits(self, keywords):
"""Fetch information about a list of keywords."""
if len(keywords) == 1:
query_str = keywords[0]
else:
query_str = ' '.join([k for k in keywords])
logger.info("Fetching hits for '%s'", query_str)
params = {'q': query_str}
... | [
"Fetch",
"information",
"about",
"a",
"list",
"of",
"keywords",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/googlehits.py#L219-L233 | [
"def",
"hits",
"(",
"self",
",",
"keywords",
")",
":",
"if",
"len",
"(",
"keywords",
")",
"==",
"1",
":",
"query_str",
"=",
"keywords",
"[",
"0",
"]",
"else",
":",
"query_str",
"=",
"' '",
".",
"join",
"(",
"[",
"k",
"for",
"k",
"in",
"keywords",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.fetch | Fetch the issues/pull requests from the repository.
The method retrieves, from a GitHub repository, the issues/pull requests
updated since the given date.
:param category: the category of items to fetch
:param from_date: obtain issues/pull requests updated since this date
:para... | perceval/backends/core/github.py | def fetch(self, category=CATEGORY_ISSUE, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME):
"""Fetch the issues/pull requests from the repository.
The method retrieves, from a GitHub repository, the issues/pull requests
updated since the given date.
:param category: the catego... | def fetch(self, category=CATEGORY_ISSUE, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME):
"""Fetch the issues/pull requests from the repository.
The method retrieves, from a GitHub repository, the issues/pull requests
updated since the given date.
:param category: the catego... | [
"Fetch",
"the",
"issues",
"/",
"pull",
"requests",
"from",
"the",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L117-L143 | [
"def",
"fetch",
"(",
"self",
",",
"category",
"=",
"CATEGORY_ISSUE",
",",
"from_date",
"=",
"DEFAULT_DATETIME",
",",
"to_date",
"=",
"DEFAULT_LAST_DATETIME",
")",
":",
"if",
"not",
"from_date",
":",
"from_date",
"=",
"DEFAULT_DATETIME",
"if",
"not",
"to_date",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.fetch_items | Fetch the items (issues or pull_requests)
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items | perceval/backends/core/github.py | def fetch_items(self, category, **kwargs):
"""Fetch the items (issues or pull_requests)
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
to_date = kwargs['to_date'... | def fetch_items(self, category, **kwargs):
"""Fetch the items (issues or pull_requests)
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
to_date = kwargs['to_date'... | [
"Fetch",
"the",
"items",
"(",
"issues",
"or",
"pull_requests",
")"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L145-L163 | [
"def",
"fetch_items",
"(",
"self",
",",
"category",
",",
"*",
"*",
"kwargs",
")",
":",
"from_date",
"=",
"kwargs",
"[",
"'from_date'",
"]",
"to_date",
"=",
"kwargs",
"[",
"'to_date'",
"]",
"if",
"category",
"==",
"CATEGORY_ISSUE",
":",
"items",
"=",
"sel... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.metadata_updated_on | Extracts the update time from a GitHub item.
The timestamp used is extracted from 'updated_at' field.
This date is converted to UNIX timestamp format. As GitHub
dates are in UTC the conversion is straightforward.
:param item: item generated by the backend
:returns: a UNIX time... | perceval/backends/core/github.py | def metadata_updated_on(item):
"""Extracts the update time from a GitHub item.
The timestamp used is extracted from 'updated_at' field.
This date is converted to UNIX timestamp format. As GitHub
dates are in UTC the conversion is straightforward.
:param item: item generated by ... | def metadata_updated_on(item):
"""Extracts the update time from a GitHub item.
The timestamp used is extracted from 'updated_at' field.
This date is converted to UNIX timestamp format. As GitHub
dates are in UTC the conversion is straightforward.
:param item: item generated by ... | [
"Extracts",
"the",
"update",
"time",
"from",
"a",
"GitHub",
"item",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L191-L208 | [
"def",
"metadata_updated_on",
"(",
"item",
")",
":",
"if",
"\"forks_count\"",
"in",
"item",
":",
"return",
"item",
"[",
"'fetched_on'",
"]",
"else",
":",
"ts",
"=",
"item",
"[",
"'updated_at'",
"]",
"ts",
"=",
"str_to_datetime",
"(",
"ts",
")",
"return",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.metadata_category | Extracts the category from a GitHub item.
This backend generates two types of item which are
'issue' and 'pull_request'. | perceval/backends/core/github.py | def metadata_category(item):
"""Extracts the category from a GitHub item.
This backend generates two types of item which are
'issue' and 'pull_request'.
"""
if "base" in item:
category = CATEGORY_PULL_REQUEST
elif "forks_count" in item:
category ... | def metadata_category(item):
"""Extracts the category from a GitHub item.
This backend generates two types of item which are
'issue' and 'pull_request'.
"""
if "base" in item:
category = CATEGORY_PULL_REQUEST
elif "forks_count" in item:
category ... | [
"Extracts",
"the",
"category",
"from",
"a",
"GitHub",
"item",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L211-L225 | [
"def",
"metadata_category",
"(",
"item",
")",
":",
"if",
"\"base\"",
"in",
"item",
":",
"category",
"=",
"CATEGORY_PULL_REQUEST",
"elif",
"\"forks_count\"",
"in",
"item",
":",
"category",
"=",
"CATEGORY_REPO",
"else",
":",
"category",
"=",
"CATEGORY_ISSUE",
"ret... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub._init_client | Init client | perceval/backends/core/github.py | def _init_client(self, from_archive=False):
"""Init client"""
return GitHubClient(self.owner, self.repository, self.api_token, self.base_url,
self.sleep_for_rate, self.min_rate_to_sleep,
self.sleep_time, self.max_retries,
... | def _init_client(self, from_archive=False):
"""Init client"""
return GitHubClient(self.owner, self.repository, self.api_token, self.base_url,
self.sleep_for_rate, self.min_rate_to_sleep,
self.sleep_time, self.max_retries,
... | [
"Init",
"client"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L227-L233 | [
"def",
"_init_client",
"(",
"self",
",",
"from_archive",
"=",
"False",
")",
":",
"return",
"GitHubClient",
"(",
"self",
".",
"owner",
",",
"self",
".",
"repository",
",",
"self",
".",
"api_token",
",",
"self",
".",
"base_url",
",",
"self",
".",
"sleep_fo... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__fetch_issues | Fetch the issues | perceval/backends/core/github.py | def __fetch_issues(self, from_date, to_date):
"""Fetch the issues"""
issues_groups = self.client.issues(from_date=from_date)
for raw_issues in issues_groups:
issues = json.loads(raw_issues)
for issue in issues:
if str_to_datetime(issue['updated_at']) > ... | def __fetch_issues(self, from_date, to_date):
"""Fetch the issues"""
issues_groups = self.client.issues(from_date=from_date)
for raw_issues in issues_groups:
issues = json.loads(raw_issues)
for issue in issues:
if str_to_datetime(issue['updated_at']) > ... | [
"Fetch",
"the",
"issues"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L235-L265 | [
"def",
"__fetch_issues",
"(",
"self",
",",
"from_date",
",",
"to_date",
")",
":",
"issues_groups",
"=",
"self",
".",
"client",
".",
"issues",
"(",
"from_date",
"=",
"from_date",
")",
"for",
"raw_issues",
"in",
"issues_groups",
":",
"issues",
"=",
"json",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__fetch_pull_requests | Fetch the pull requests | perceval/backends/core/github.py | def __fetch_pull_requests(self, from_date, to_date):
"""Fetch the pull requests"""
raw_pulls = self.client.pulls(from_date=from_date)
for raw_pull in raw_pulls:
pull = json.loads(raw_pull)
if str_to_datetime(pull['updated_at']) > to_date:
return
... | def __fetch_pull_requests(self, from_date, to_date):
"""Fetch the pull requests"""
raw_pulls = self.client.pulls(from_date=from_date)
for raw_pull in raw_pulls:
pull = json.loads(raw_pull)
if str_to_datetime(pull['updated_at']) > to_date:
return
... | [
"Fetch",
"the",
"pull",
"requests"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L267-L294 | [
"def",
"__fetch_pull_requests",
"(",
"self",
",",
"from_date",
",",
"to_date",
")",
":",
"raw_pulls",
"=",
"self",
".",
"client",
".",
"pulls",
"(",
"from_date",
"=",
"from_date",
")",
"for",
"raw_pull",
"in",
"raw_pulls",
":",
"pull",
"=",
"json",
".",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__fetch_repo_info | Get repo info about stars, watchers and forks | perceval/backends/core/github.py | def __fetch_repo_info(self):
"""Get repo info about stars, watchers and forks"""
raw_repo = self.client.repo()
repo = json.loads(raw_repo)
fetched_on = datetime_utcnow()
repo['fetched_on'] = fetched_on.timestamp()
yield repo | def __fetch_repo_info(self):
"""Get repo info about stars, watchers and forks"""
raw_repo = self.client.repo()
repo = json.loads(raw_repo)
fetched_on = datetime_utcnow()
repo['fetched_on'] = fetched_on.timestamp()
yield repo | [
"Get",
"repo",
"info",
"about",
"stars",
"watchers",
"and",
"forks"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L296-L305 | [
"def",
"__fetch_repo_info",
"(",
"self",
")",
":",
"raw_repo",
"=",
"self",
".",
"client",
".",
"repo",
"(",
")",
"repo",
"=",
"json",
".",
"loads",
"(",
"raw_repo",
")",
"fetched_on",
"=",
"datetime_utcnow",
"(",
")",
"repo",
"[",
"'fetched_on'",
"]",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_issue_reactions | Get issue reactions | perceval/backends/core/github.py | def __get_issue_reactions(self, issue_number, total_count):
"""Get issue reactions"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.issue_reactions(issue_number)
for raw_reactions in group_reactions:
for reaction i... | def __get_issue_reactions(self, issue_number, total_count):
"""Get issue reactions"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.issue_reactions(issue_number)
for raw_reactions in group_reactions:
for reaction i... | [
"Get",
"issue",
"reactions"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L307-L323 | [
"def",
"__get_issue_reactions",
"(",
"self",
",",
"issue_number",
",",
"total_count",
")",
":",
"reactions",
"=",
"[",
"]",
"if",
"total_count",
"==",
"0",
":",
"return",
"reactions",
"group_reactions",
"=",
"self",
".",
"client",
".",
"issue_reactions",
"(",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_issue_comments | Get issue comments | perceval/backends/core/github.py | def __get_issue_comments(self, issue_number):
"""Get issue comments"""
comments = []
group_comments = self.client.issue_comments(issue_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comment.get('id')
... | def __get_issue_comments(self, issue_number):
"""Get issue comments"""
comments = []
group_comments = self.client.issue_comments(issue_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comment.get('id')
... | [
"Get",
"issue",
"comments"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L325-L340 | [
"def",
"__get_issue_comments",
"(",
"self",
",",
"issue_number",
")",
":",
"comments",
"=",
"[",
"]",
"group_comments",
"=",
"self",
".",
"client",
".",
"issue_comments",
"(",
"issue_number",
")",
"for",
"raw_comments",
"in",
"group_comments",
":",
"for",
"com... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_issue_comment_reactions | Get reactions on issue comments | perceval/backends/core/github.py | def __get_issue_comment_reactions(self, comment_id, total_count):
"""Get reactions on issue comments"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.issue_comment_reactions(comment_id)
for raw_reactions in group_reactions:
... | def __get_issue_comment_reactions(self, comment_id, total_count):
"""Get reactions on issue comments"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.issue_comment_reactions(comment_id)
for raw_reactions in group_reactions:
... | [
"Get",
"reactions",
"on",
"issue",
"comments"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L342-L358 | [
"def",
"__get_issue_comment_reactions",
"(",
"self",
",",
"comment_id",
",",
"total_count",
")",
":",
"reactions",
"=",
"[",
"]",
"if",
"total_count",
"==",
"0",
":",
"return",
"reactions",
"group_reactions",
"=",
"self",
".",
"client",
".",
"issue_comment_react... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_issue_assignees | Get issue assignees | perceval/backends/core/github.py | def __get_issue_assignees(self, raw_assignees):
"""Get issue assignees"""
assignees = []
for ra in raw_assignees:
assignees.append(self.__get_user(ra['login']))
return assignees | def __get_issue_assignees(self, raw_assignees):
"""Get issue assignees"""
assignees = []
for ra in raw_assignees:
assignees.append(self.__get_user(ra['login']))
return assignees | [
"Get",
"issue",
"assignees"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L367-L374 | [
"def",
"__get_issue_assignees",
"(",
"self",
",",
"raw_assignees",
")",
":",
"assignees",
"=",
"[",
"]",
"for",
"ra",
"in",
"raw_assignees",
":",
"assignees",
".",
"append",
"(",
"self",
".",
"__get_user",
"(",
"ra",
"[",
"'login'",
"]",
")",
")",
"retur... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_pull_requested_reviewers | Get pull request requested reviewers | perceval/backends/core/github.py | def __get_pull_requested_reviewers(self, pr_number):
"""Get pull request requested reviewers"""
requested_reviewers = []
group_requested_reviewers = self.client.pull_requested_reviewers(pr_number)
for raw_requested_reviewers in group_requested_reviewers:
group_requested_rev... | def __get_pull_requested_reviewers(self, pr_number):
"""Get pull request requested reviewers"""
requested_reviewers = []
group_requested_reviewers = self.client.pull_requested_reviewers(pr_number)
for raw_requested_reviewers in group_requested_reviewers:
group_requested_rev... | [
"Get",
"pull",
"request",
"requested",
"reviewers"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L376-L389 | [
"def",
"__get_pull_requested_reviewers",
"(",
"self",
",",
"pr_number",
")",
":",
"requested_reviewers",
"=",
"[",
"]",
"group_requested_reviewers",
"=",
"self",
".",
"client",
".",
"pull_requested_reviewers",
"(",
"pr_number",
")",
"for",
"raw_requested_reviewers",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_pull_commits | Get pull request commit hashes | perceval/backends/core/github.py | def __get_pull_commits(self, pr_number):
"""Get pull request commit hashes"""
hashes = []
group_pull_commits = self.client.pull_commits(pr_number)
for raw_pull_commits in group_pull_commits:
for commit in json.loads(raw_pull_commits):
commit_hash = commit['... | def __get_pull_commits(self, pr_number):
"""Get pull request commit hashes"""
hashes = []
group_pull_commits = self.client.pull_commits(pr_number)
for raw_pull_commits in group_pull_commits:
for commit in json.loads(raw_pull_commits):
commit_hash = commit['... | [
"Get",
"pull",
"request",
"commit",
"hashes"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L391-L403 | [
"def",
"__get_pull_commits",
"(",
"self",
",",
"pr_number",
")",
":",
"hashes",
"=",
"[",
"]",
"group_pull_commits",
"=",
"self",
".",
"client",
".",
"pull_commits",
"(",
"pr_number",
")",
"for",
"raw_pull_commits",
"in",
"group_pull_commits",
":",
"for",
"com... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_pull_review_comments | Get pull request review comments | perceval/backends/core/github.py | def __get_pull_review_comments(self, pr_number):
"""Get pull request review comments"""
comments = []
group_comments = self.client.pull_review_comments(pr_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comm... | def __get_pull_review_comments(self, pr_number):
"""Get pull request review comments"""
comments = []
group_comments = self.client.pull_review_comments(pr_number)
for raw_comments in group_comments:
for comment in json.loads(raw_comments):
comment_id = comm... | [
"Get",
"pull",
"request",
"review",
"comments"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L405-L427 | [
"def",
"__get_pull_review_comments",
"(",
"self",
",",
"pr_number",
")",
":",
"comments",
"=",
"[",
"]",
"group_comments",
"=",
"self",
".",
"client",
".",
"pull_review_comments",
"(",
"pr_number",
")",
"for",
"raw_comments",
"in",
"group_comments",
":",
"for",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_pull_review_comment_reactions | Get pull review comment reactions | perceval/backends/core/github.py | def __get_pull_review_comment_reactions(self, comment_id, total_count):
"""Get pull review comment reactions"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.pull_review_comment_reactions(comment_id)
for raw_reactions in group_... | def __get_pull_review_comment_reactions(self, comment_id, total_count):
"""Get pull review comment reactions"""
reactions = []
if total_count == 0:
return reactions
group_reactions = self.client.pull_review_comment_reactions(comment_id)
for raw_reactions in group_... | [
"Get",
"pull",
"review",
"comment",
"reactions"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L429-L445 | [
"def",
"__get_pull_review_comment_reactions",
"(",
"self",
",",
"comment_id",
",",
"total_count",
")",
":",
"reactions",
"=",
"[",
"]",
"if",
"total_count",
"==",
"0",
":",
"return",
"reactions",
"group_reactions",
"=",
"self",
".",
"client",
".",
"pull_review_c... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHub.__get_user | Get user and org data for the login | perceval/backends/core/github.py | def __get_user(self, login):
"""Get user and org data for the login"""
user = {}
if not login:
return user
user_raw = self.client.user(login)
user = json.loads(user_raw)
user_orgs_raw = \
self.client.user_orgs(login)
user['organizations'... | def __get_user(self, login):
"""Get user and org data for the login"""
user = {}
if not login:
return user
user_raw = self.client.user(login)
user = json.loads(user_raw)
user_orgs_raw = \
self.client.user_orgs(login)
user['organizations'... | [
"Get",
"user",
"and",
"org",
"data",
"for",
"the",
"login"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L447-L461 | [
"def",
"__get_user",
"(",
"self",
",",
"login",
")",
":",
"user",
"=",
"{",
"}",
"if",
"not",
"login",
":",
"return",
"user",
"user_raw",
"=",
"self",
".",
"client",
".",
"user",
"(",
"login",
")",
"user",
"=",
"json",
".",
"loads",
"(",
"user_raw"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.issue_reactions | Get reactions of an issue | perceval/backends/core/github.py | def issue_reactions(self, issue_number):
"""Get reactions of an issue"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
path = urijoin("issues", str(issue_number), "reactions")
return self.fetch_items(path, payload) | def issue_reactions(self, issue_number):
"""Get reactions of an issue"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
path = urijoin("issues", str(issue_number), "reactions")
return self.fetch_items(path, payload) | [
"Get",
"reactions",
"of",
"an",
"issue"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L542-L552 | [
"def",
"issue_reactions",
"(",
"self",
",",
"issue_number",
")",
":",
"payload",
"=",
"{",
"'per_page'",
":",
"PER_PAGE",
",",
"'direction'",
":",
"'asc'",
",",
"'sort'",
":",
"'updated'",
"}",
"path",
"=",
"urijoin",
"(",
"\"issues\"",
",",
"str",
"(",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.issues | Fetch the issues from the repository.
The method retrieves, from a GitHub repository, the issues
updated since the given date.
:param from_date: obtain issues updated since this date
:returns: a generator of issues | perceval/backends/core/github.py | def issues(self, from_date=None):
"""Fetch the issues from the repository.
The method retrieves, from a GitHub repository, the issues
updated since the given date.
:param from_date: obtain issues updated since this date
:returns: a generator of issues
"""
paylo... | def issues(self, from_date=None):
"""Fetch the issues from the repository.
The method retrieves, from a GitHub repository, the issues
updated since the given date.
:param from_date: obtain issues updated since this date
:returns: a generator of issues
"""
paylo... | [
"Fetch",
"the",
"issues",
"from",
"the",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L578-L598 | [
"def",
"issues",
"(",
"self",
",",
"from_date",
"=",
"None",
")",
":",
"payload",
"=",
"{",
"'state'",
":",
"'all'",
",",
"'per_page'",
":",
"PER_PAGE",
",",
"'direction'",
":",
"'asc'",
",",
"'sort'",
":",
"'updated'",
"}",
"if",
"from_date",
":",
"pa... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.pulls | Fetch the pull requests from the repository.
The method retrieves, from a GitHub repository, the pull requests
updated since the given date.
:param from_date: obtain pull requests updated since this date
:returns: a generator of pull requests | perceval/backends/core/github.py | def pulls(self, from_date=None):
"""Fetch the pull requests from the repository.
The method retrieves, from a GitHub repository, the pull requests
updated since the given date.
:param from_date: obtain pull requests updated since this date
:returns: a generator of pull request... | def pulls(self, from_date=None):
"""Fetch the pull requests from the repository.
The method retrieves, from a GitHub repository, the pull requests
updated since the given date.
:param from_date: obtain pull requests updated since this date
:returns: a generator of pull request... | [
"Fetch",
"the",
"pull",
"requests",
"from",
"the",
"repository",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L600-L625 | [
"def",
"pulls",
"(",
"self",
",",
"from_date",
"=",
"None",
")",
":",
"issues_groups",
"=",
"self",
".",
"issues",
"(",
"from_date",
"=",
"from_date",
")",
"for",
"raw_issues",
"in",
"issues_groups",
":",
"issues",
"=",
"json",
".",
"loads",
"(",
"raw_is... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.repo | Get repository data | perceval/backends/core/github.py | def repo(self):
"""Get repository data"""
path = urijoin(self.base_url, 'repos', self.owner, self.repository)
r = self.fetch(path)
repo = r.text
return repo | def repo(self):
"""Get repository data"""
path = urijoin(self.base_url, 'repos', self.owner, self.repository)
r = self.fetch(path)
repo = r.text
return repo | [
"Get",
"repository",
"data"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L627-L635 | [
"def",
"repo",
"(",
"self",
")",
":",
"path",
"=",
"urijoin",
"(",
"self",
".",
"base_url",
",",
"'repos'",
",",
"self",
".",
"owner",
",",
"self",
".",
"repository",
")",
"r",
"=",
"self",
".",
"fetch",
"(",
"path",
")",
"repo",
"=",
"r",
".",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.pull_requested_reviewers | Get pull requested reviewers | perceval/backends/core/github.py | def pull_requested_reviewers(self, pr_number):
"""Get pull requested reviewers"""
requested_reviewers_url = urijoin("pulls", str(pr_number), "requested_reviewers")
return self.fetch_items(requested_reviewers_url, {}) | def pull_requested_reviewers(self, pr_number):
"""Get pull requested reviewers"""
requested_reviewers_url = urijoin("pulls", str(pr_number), "requested_reviewers")
return self.fetch_items(requested_reviewers_url, {}) | [
"Get",
"pull",
"requested",
"reviewers"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L637-L641 | [
"def",
"pull_requested_reviewers",
"(",
"self",
",",
"pr_number",
")",
":",
"requested_reviewers_url",
"=",
"urijoin",
"(",
"\"pulls\"",
",",
"str",
"(",
"pr_number",
")",
",",
"\"requested_reviewers\"",
")",
"return",
"self",
".",
"fetch_items",
"(",
"requested_r... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.pull_commits | Get pull request commits | perceval/backends/core/github.py | def pull_commits(self, pr_number):
"""Get pull request commits"""
payload = {
'per_page': PER_PAGE,
}
commit_url = urijoin("pulls", str(pr_number), "commits")
return self.fetch_items(commit_url, payload) | def pull_commits(self, pr_number):
"""Get pull request commits"""
payload = {
'per_page': PER_PAGE,
}
commit_url = urijoin("pulls", str(pr_number), "commits")
return self.fetch_items(commit_url, payload) | [
"Get",
"pull",
"request",
"commits"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L643-L651 | [
"def",
"pull_commits",
"(",
"self",
",",
"pr_number",
")",
":",
"payload",
"=",
"{",
"'per_page'",
":",
"PER_PAGE",
",",
"}",
"commit_url",
"=",
"urijoin",
"(",
"\"pulls\"",
",",
"str",
"(",
"pr_number",
")",
",",
"\"commits\"",
")",
"return",
"self",
".... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.pull_review_comments | Get pull request review comments | perceval/backends/core/github.py | def pull_review_comments(self, pr_number):
"""Get pull request review comments"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
comments_url = urijoin("pulls", str(pr_number), "comments")
return self.fetch_items(co... | def pull_review_comments(self, pr_number):
"""Get pull request review comments"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
comments_url = urijoin("pulls", str(pr_number), "comments")
return self.fetch_items(co... | [
"Get",
"pull",
"request",
"review",
"comments"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L653-L663 | [
"def",
"pull_review_comments",
"(",
"self",
",",
"pr_number",
")",
":",
"payload",
"=",
"{",
"'per_page'",
":",
"PER_PAGE",
",",
"'direction'",
":",
"'asc'",
",",
"'sort'",
":",
"'updated'",
"}",
"comments_url",
"=",
"urijoin",
"(",
"\"pulls\"",
",",
"str",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.pull_review_comment_reactions | Get reactions of a review comment | perceval/backends/core/github.py | def pull_review_comment_reactions(self, comment_id):
"""Get reactions of a review comment"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
path = urijoin("pulls", "comments", str(comment_id), "reactions")
return se... | def pull_review_comment_reactions(self, comment_id):
"""Get reactions of a review comment"""
payload = {
'per_page': PER_PAGE,
'direction': 'asc',
'sort': 'updated'
}
path = urijoin("pulls", "comments", str(comment_id), "reactions")
return se... | [
"Get",
"reactions",
"of",
"a",
"review",
"comment"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L665-L675 | [
"def",
"pull_review_comment_reactions",
"(",
"self",
",",
"comment_id",
")",
":",
"payload",
"=",
"{",
"'per_page'",
":",
"PER_PAGE",
",",
"'direction'",
":",
"'asc'",
",",
"'sort'",
":",
"'updated'",
"}",
"path",
"=",
"urijoin",
"(",
"\"pulls\"",
",",
"\"co... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.user | Get the user information and update the user cache | perceval/backends/core/github.py | def user(self, login):
"""Get the user information and update the user cache"""
user = None
if login in self._users:
return self._users[login]
url_user = urijoin(self.base_url, 'users', login)
logging.info("Getting info for %s" % (url_user))
r = self.fetch... | def user(self, login):
"""Get the user information and update the user cache"""
user = None
if login in self._users:
return self._users[login]
url_user = urijoin(self.base_url, 'users', login)
logging.info("Getting info for %s" % (url_user))
r = self.fetch... | [
"Get",
"the",
"user",
"information",
"and",
"update",
"the",
"user",
"cache"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L677-L692 | [
"def",
"user",
"(",
"self",
",",
"login",
")",
":",
"user",
"=",
"None",
"if",
"login",
"in",
"self",
".",
"_users",
":",
"return",
"self",
".",
"_users",
"[",
"login",
"]",
"url_user",
"=",
"urijoin",
"(",
"self",
".",
"base_url",
",",
"'users'",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient.user_orgs | Get the user public organizations | perceval/backends/core/github.py | def user_orgs(self, login):
"""Get the user public organizations"""
if login in self._users_orgs:
return self._users_orgs[login]
url = urijoin(self.base_url, 'users', login, 'orgs')
try:
r = self.fetch(url)
orgs = r.text
except requests.except... | def user_orgs(self, login):
"""Get the user public organizations"""
if login in self._users_orgs:
return self._users_orgs[login]
url = urijoin(self.base_url, 'users', login, 'orgs')
try:
r = self.fetch(url)
orgs = r.text
except requests.except... | [
"Get",
"the",
"user",
"public",
"organizations"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L694-L713 | [
"def",
"user_orgs",
"(",
"self",
",",
"login",
")",
":",
"if",
"login",
"in",
"self",
".",
"_users_orgs",
":",
"return",
"self",
".",
"_users_orgs",
"[",
"login",
"]",
"url",
"=",
"urijoin",
"(",
"self",
".",
"base_url",
",",
"'users'",
",",
"login",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient._get_token_rate_limit | Return token's remaining API points | perceval/backends/core/github.py | def _get_token_rate_limit(self, token):
"""Return token's remaining API points"""
rate_url = urijoin(self.base_url, "rate_limit")
self.session.headers.update({'Authorization': 'token ' + token})
remaining = 0
try:
headers = super().fetch(rate_url).headers
... | def _get_token_rate_limit(self, token):
"""Return token's remaining API points"""
rate_url = urijoin(self.base_url, "rate_limit")
self.session.headers.update({'Authorization': 'token ' + token})
remaining = 0
try:
headers = super().fetch(rate_url).headers
... | [
"Return",
"token",
"s",
"remaining",
"API",
"points"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L772-L784 | [
"def",
"_get_token_rate_limit",
"(",
"self",
",",
"token",
")",
":",
"rate_url",
"=",
"urijoin",
"(",
"self",
".",
"base_url",
",",
"\"rate_limit\"",
")",
"self",
".",
"session",
".",
"headers",
".",
"update",
"(",
"{",
"'Authorization'",
":",
"'token '",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient._get_tokens_rate_limits | Return array of all tokens remaining API points | perceval/backends/core/github.py | def _get_tokens_rate_limits(self):
"""Return array of all tokens remaining API points"""
remainings = [0] * self.n_tokens
# Turn off archiving when checking rates, because that would cause
# archive key conflict (the same URLs giving different responses)
arch = self.archive
... | def _get_tokens_rate_limits(self):
"""Return array of all tokens remaining API points"""
remainings = [0] * self.n_tokens
# Turn off archiving when checking rates, because that would cause
# archive key conflict (the same URLs giving different responses)
arch = self.archive
... | [
"Return",
"array",
"of",
"all",
"tokens",
"remaining",
"API",
"points"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L786-L800 | [
"def",
"_get_tokens_rate_limits",
"(",
"self",
")",
":",
"remainings",
"=",
"[",
"0",
"]",
"*",
"self",
".",
"n_tokens",
"# Turn off archiving when checking rates, because that would cause",
"# archive key conflict (the same URLs giving different responses)",
"arch",
"=",
"self... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient._choose_best_api_token | Check all API tokens defined and choose one with most remaining API points | perceval/backends/core/github.py | def _choose_best_api_token(self):
"""Check all API tokens defined and choose one with most remaining API points"""
# Return if no tokens given
if self.n_tokens == 0:
return
# If multiple tokens given, choose best
token_idx = 0
if self.n_tokens > 1:
... | def _choose_best_api_token(self):
"""Check all API tokens defined and choose one with most remaining API points"""
# Return if no tokens given
if self.n_tokens == 0:
return
# If multiple tokens given, choose best
token_idx = 0
if self.n_tokens > 1:
... | [
"Check",
"all",
"API",
"tokens",
"defined",
"and",
"choose",
"one",
"with",
"most",
"remaining",
"API",
"points"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L802-L820 | [
"def",
"_choose_best_api_token",
"(",
"self",
")",
":",
"# Return if no tokens given",
"if",
"self",
".",
"n_tokens",
"==",
"0",
":",
"return",
"# If multiple tokens given, choose best",
"token_idx",
"=",
"0",
"if",
"self",
".",
"n_tokens",
">",
"1",
":",
"remaini... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient._need_check_tokens | Check if we need to switch GitHub API tokens | perceval/backends/core/github.py | def _need_check_tokens(self):
"""Check if we need to switch GitHub API tokens"""
if self.n_tokens <= 1 or self.rate_limit is None:
return False
elif self.last_rate_limit_checked is None:
self.last_rate_limit_checked = self.rate_limit
return True
# If... | def _need_check_tokens(self):
"""Check if we need to switch GitHub API tokens"""
if self.n_tokens <= 1 or self.rate_limit is None:
return False
elif self.last_rate_limit_checked is None:
self.last_rate_limit_checked = self.rate_limit
return True
# If... | [
"Check",
"if",
"we",
"need",
"to",
"switch",
"GitHub",
"API",
"tokens"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L822-L846 | [
"def",
"_need_check_tokens",
"(",
"self",
")",
":",
"if",
"self",
".",
"n_tokens",
"<=",
"1",
"or",
"self",
".",
"rate_limit",
"is",
"None",
":",
"return",
"False",
"elif",
"self",
".",
"last_rate_limit_checked",
"is",
"None",
":",
"self",
".",
"last_rate_... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | GitHubClient._update_current_rate_limit | Update rate limits data for the current token | perceval/backends/core/github.py | def _update_current_rate_limit(self):
"""Update rate limits data for the current token"""
url = urijoin(self.base_url, "rate_limit")
try:
# Turn off archiving when checking rates, because that would cause
# archive key conflict (the same URLs giving different responses)
... | def _update_current_rate_limit(self):
"""Update rate limits data for the current token"""
url = urijoin(self.base_url, "rate_limit")
try:
# Turn off archiving when checking rates, because that would cause
# archive key conflict (the same URLs giving different responses)
... | [
"Update",
"rate",
"limits",
"data",
"for",
"the",
"current",
"token"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/github.py#L848-L865 | [
"def",
"_update_current_rate_limit",
"(",
"self",
")",
":",
"url",
"=",
"urijoin",
"(",
"self",
".",
"base_url",
",",
"\"rate_limit\"",
")",
"try",
":",
"# Turn off archiving when checking rates, because that would cause",
"# archive key conflict (the same URLs giving different... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive.init_metadata | Init metadata information.
Metatada is composed by basic information needed to identify
where archived data came from and how it can be retrieved
and built into Perceval items.
:param: origin: identifier of the repository
:param: backend_name: name of the backend
:param... | perceval/archive.py | def init_metadata(self, origin, backend_name, backend_version,
category, backend_params):
"""Init metadata information.
Metatada is composed by basic information needed to identify
where archived data came from and how it can be retrieved
and built into Perceval it... | def init_metadata(self, origin, backend_name, backend_version,
category, backend_params):
"""Init metadata information.
Metatada is composed by basic information needed to identify
where archived data came from and how it can be retrieved
and built into Perceval it... | [
"Init",
"metadata",
"information",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L106-L151 | [
"def",
"init_metadata",
"(",
"self",
",",
"origin",
",",
"backend_name",
",",
"backend_version",
",",
"category",
",",
"backend_params",
")",
":",
"created_on",
"=",
"datetime_to_utc",
"(",
"datetime_utcnow",
"(",
")",
")",
"created_on_dumped",
"=",
"created_on",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive.store | Store a raw item in this archive.
The method will store `data` content in this archive. The unique
identifier for that item will be generated using the rest of the
parameters.
:param uri: request URI
:param payload: request payload
:param headers: request headers
... | perceval/archive.py | def store(self, uri, payload, headers, data):
"""Store a raw item in this archive.
The method will store `data` content in this archive. The unique
identifier for that item will be generated using the rest of the
parameters.
:param uri: request URI
:param payload: reque... | def store(self, uri, payload, headers, data):
"""Store a raw item in this archive.
The method will store `data` content in this archive. The unique
identifier for that item will be generated using the rest of the
parameters.
:param uri: request URI
:param payload: reque... | [
"Store",
"a",
"raw",
"item",
"in",
"this",
"archive",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L153-L191 | [
"def",
"store",
"(",
"self",
",",
"uri",
",",
"payload",
",",
"headers",
",",
"data",
")",
":",
"hashcode",
"=",
"self",
".",
"make_hashcode",
"(",
"uri",
",",
"payload",
",",
"headers",
")",
"payload_dump",
"=",
"pickle",
".",
"dumps",
"(",
"payload",... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive.retrieve | Retrieve a raw item from the archive.
The method will return the `data` content corresponding to the
hascode derived from the given parameters.
:param uri: request URI
:param payload: request payload
:param headers: request headers
:returns: the archived data
... | perceval/archive.py | def retrieve(self, uri, payload, headers):
"""Retrieve a raw item from the archive.
The method will return the `data` content corresponding to the
hascode derived from the given parameters.
:param uri: request URI
:param payload: request payload
:param headers: request ... | def retrieve(self, uri, payload, headers):
"""Retrieve a raw item from the archive.
The method will return the `data` content corresponding to the
hascode derived from the given parameters.
:param uri: request URI
:param payload: request payload
:param headers: request ... | [
"Retrieve",
"a",
"raw",
"item",
"from",
"the",
"archive",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L193-L232 | [
"def",
"retrieve",
"(",
"self",
",",
"uri",
",",
"payload",
",",
"headers",
")",
":",
"hashcode",
"=",
"self",
".",
"make_hashcode",
"(",
"uri",
",",
"payload",
",",
"headers",
")",
"logger",
".",
"debug",
"(",
"\"Retrieving entry %s with %s %s %s in %s\"",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive.create | Create a brand new archive.
Call this method to create a new and empty archive. It will initialize
the storage file in the path defined by `archive_path`.
:param archive_path: absolute path where the archive file will be created
:raises ArchiveError: when the archive file already ex... | perceval/archive.py | def create(cls, archive_path):
"""Create a brand new archive.
Call this method to create a new and empty archive. It will initialize
the storage file in the path defined by `archive_path`.
:param archive_path: absolute path where the archive file will be created
:raises Arch... | def create(cls, archive_path):
"""Create a brand new archive.
Call this method to create a new and empty archive. It will initialize
the storage file in the path defined by `archive_path`.
:param archive_path: absolute path where the archive file will be created
:raises Arch... | [
"Create",
"a",
"brand",
"new",
"archive",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L235-L263 | [
"def",
"create",
"(",
"cls",
",",
"archive_path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"archive_path",
")",
":",
"msg",
"=",
"\"archive %s already exists; remove it before creating a new one\"",
"raise",
"ArchiveError",
"(",
"cause",
"=",
"msg",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive.make_hashcode | Generate a SHA1 based on the given arguments.
Hashcodes created by this method will used as unique identifiers
for the raw items or resources stored by this archive.
:param uri: URI to the resource
:param payload: payload of the request needed to fetch the resource
:param heade... | perceval/archive.py | def make_hashcode(uri, payload, headers):
"""Generate a SHA1 based on the given arguments.
Hashcodes created by this method will used as unique identifiers
for the raw items or resources stored by this archive.
:param uri: URI to the resource
:param payload: payload of the requ... | def make_hashcode(uri, payload, headers):
"""Generate a SHA1 based on the given arguments.
Hashcodes created by this method will used as unique identifiers
for the raw items or resources stored by this archive.
:param uri: URI to the resource
:param payload: payload of the requ... | [
"Generate",
"a",
"SHA1",
"based",
"on",
"the",
"given",
"arguments",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L266-L283 | [
"def",
"make_hashcode",
"(",
"uri",
",",
"payload",
",",
"headers",
")",
":",
"def",
"dict_to_json_str",
"(",
"data",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"data",
",",
"sort_keys",
"=",
"True",
")",
"content",
"=",
"':'",
".",
"join",
"(",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive._verify_archive | Check whether the archive is valid or not.
This method will check if tables were created and if they
contain valid data. | perceval/archive.py | def _verify_archive(self):
"""Check whether the archive is valid or not.
This method will check if tables were created and if they
contain valid data.
"""
nentries = self._count_table_rows(self.ARCHIVE_TABLE)
nmetadata = self._count_table_rows(self.METADATA_TABLE)
... | def _verify_archive(self):
"""Check whether the archive is valid or not.
This method will check if tables were created and if they
contain valid data.
"""
nentries = self._count_table_rows(self.ARCHIVE_TABLE)
nmetadata = self._count_table_rows(self.METADATA_TABLE)
... | [
"Check",
"whether",
"the",
"archive",
"is",
"valid",
"or",
"not",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L285-L302 | [
"def",
"_verify_archive",
"(",
"self",
")",
":",
"nentries",
"=",
"self",
".",
"_count_table_rows",
"(",
"self",
".",
"ARCHIVE_TABLE",
")",
"nmetadata",
"=",
"self",
".",
"_count_table_rows",
"(",
"self",
".",
"METADATA_TABLE",
")",
"if",
"nmetadata",
">",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive._load_metadata | Load metadata from the archive file | perceval/archive.py | def _load_metadata(self):
"""Load metadata from the archive file"""
logger.debug("Loading metadata infomation of archive %s", self.archive_path)
cursor = self._db.cursor()
select_stmt = "SELECT origin, backend_name, backend_version, " \
"category, backend_params, ... | def _load_metadata(self):
"""Load metadata from the archive file"""
logger.debug("Loading metadata infomation of archive %s", self.archive_path)
cursor = self._db.cursor()
select_stmt = "SELECT origin, backend_name, backend_version, " \
"category, backend_params, ... | [
"Load",
"metadata",
"from",
"the",
"archive",
"file"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L304-L328 | [
"def",
"_load_metadata",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Loading metadata infomation of archive %s\"",
",",
"self",
".",
"archive_path",
")",
"cursor",
"=",
"self",
".",
"_db",
".",
"cursor",
"(",
")",
"select_stmt",
"=",
"\"SELECT origin,... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | Archive._count_table_rows | Fetch the number of rows in a table | perceval/archive.py | def _count_table_rows(self, table_name):
"""Fetch the number of rows in a table"""
cursor = self._db.cursor()
select_stmt = "SELECT COUNT(*) FROM " + table_name
try:
cursor.execute(select_stmt)
row = cursor.fetchone()
except sqlite3.DatabaseError as e:
... | def _count_table_rows(self, table_name):
"""Fetch the number of rows in a table"""
cursor = self._db.cursor()
select_stmt = "SELECT COUNT(*) FROM " + table_name
try:
cursor.execute(select_stmt)
row = cursor.fetchone()
except sqlite3.DatabaseError as e:
... | [
"Fetch",
"the",
"number",
"of",
"rows",
"in",
"a",
"table"
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L330-L345 | [
"def",
"_count_table_rows",
"(",
"self",
",",
"table_name",
")",
":",
"cursor",
"=",
"self",
".",
"_db",
".",
"cursor",
"(",
")",
"select_stmt",
"=",
"\"SELECT COUNT(*) FROM \"",
"+",
"table_name",
"try",
":",
"cursor",
".",
"execute",
"(",
"select_stmt",
")... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | ArchiveManager.create_archive | Create a new archive.
The method creates in the filesystem a brand new archive with
a random SHA1 as its name. The first byte of the hashcode will
be the name of the subdirectory; the remaining bytes, the
archive name.
:returns: a new `Archive` object
:raises ArchiveMa... | perceval/archive.py | def create_archive(self):
"""Create a new archive.
The method creates in the filesystem a brand new archive with
a random SHA1 as its name. The first byte of the hashcode will
be the name of the subdirectory; the remaining bytes, the
archive name.
:returns: a new `Archi... | def create_archive(self):
"""Create a new archive.
The method creates in the filesystem a brand new archive with
a random SHA1 as its name. The first byte of the hashcode will
be the name of the subdirectory; the remaining bytes, the
archive name.
:returns: a new `Archi... | [
"Create",
"a",
"new",
"archive",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L368-L394 | [
"def",
"create_archive",
"(",
"self",
")",
":",
"hashcode",
"=",
"uuid",
".",
"uuid4",
"(",
")",
".",
"hex",
"archive_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dirpath",
",",
"hashcode",
"[",
"0",
":",
"2",
"]",
")",
"archive_na... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | ArchiveManager.remove_archive | Remove an archive.
This method deletes from the filesystem the archive stored
in `archive_path`.
:param archive_path: path to the archive
:raises ArchiveManangerError: when an error occurs removing the
archive | perceval/archive.py | def remove_archive(self, archive_path):
"""Remove an archive.
This method deletes from the filesystem the archive stored
in `archive_path`.
:param archive_path: path to the archive
:raises ArchiveManangerError: when an error occurs removing the
archive
"""
... | def remove_archive(self, archive_path):
"""Remove an archive.
This method deletes from the filesystem the archive stored
in `archive_path`.
:param archive_path: path to the archive
:raises ArchiveManangerError: when an error occurs removing the
archive
"""
... | [
"Remove",
"an",
"archive",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L396-L412 | [
"def",
"remove_archive",
"(",
"self",
",",
"archive_path",
")",
":",
"try",
":",
"Archive",
"(",
"archive_path",
")",
"except",
"ArchiveError",
"as",
"e",
":",
"raise",
"ArchiveManagerError",
"(",
"cause",
"=",
"str",
"(",
"e",
")",
")",
"os",
".",
"remo... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | ArchiveManager.search | Search archives.
Get the archives which store data based on the given parameters.
These parameters define which the origin was (`origin`), how data
was fetched (`backend_name`) and data type ('category').
Only those archives created on or after `archived_after` will be
returned.... | perceval/archive.py | def search(self, origin, backend_name, category, archived_after):
"""Search archives.
Get the archives which store data based on the given parameters.
These parameters define which the origin was (`origin`), how data
was fetched (`backend_name`) and data type ('category').
Only ... | def search(self, origin, backend_name, category, archived_after):
"""Search archives.
Get the archives which store data based on the given parameters.
These parameters define which the origin was (`origin`), how data
was fetched (`backend_name`) and data type ('category').
Only ... | [
"Search",
"archives",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L414-L438 | [
"def",
"search",
"(",
"self",
",",
"origin",
",",
"backend_name",
",",
"category",
",",
"archived_after",
")",
":",
"archives",
"=",
"self",
".",
"_search_archives",
"(",
"origin",
",",
"backend_name",
",",
"category",
",",
"archived_after",
")",
"archives",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | ArchiveManager._search_archives | Search archives using filters. | perceval/archive.py | def _search_archives(self, origin, backend_name, category, archived_after):
"""Search archives using filters."""
for archive_path in self._search_files():
try:
archive = Archive(archive_path)
except ArchiveError:
continue
match = arch... | def _search_archives(self, origin, backend_name, category, archived_after):
"""Search archives using filters."""
for archive_path in self._search_files():
try:
archive = Archive(archive_path)
except ArchiveError:
continue
match = arch... | [
"Search",
"archives",
"using",
"filters",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L440-L457 | [
"def",
"_search_archives",
"(",
"self",
",",
"origin",
",",
"backend_name",
",",
"category",
",",
"archived_after",
")",
":",
"for",
"archive_path",
"in",
"self",
".",
"_search_files",
"(",
")",
":",
"try",
":",
"archive",
"=",
"Archive",
"(",
"archive_path"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | ArchiveManager._search_files | Retrieve the file paths stored under the base path. | perceval/archive.py | def _search_files(self):
"""Retrieve the file paths stored under the base path."""
for root, _, files in os.walk(self.dirpath):
for filename in files:
location = os.path.join(root, filename)
yield location | def _search_files(self):
"""Retrieve the file paths stored under the base path."""
for root, _, files in os.walk(self.dirpath):
for filename in files:
location = os.path.join(root, filename)
yield location | [
"Retrieve",
"the",
"file",
"paths",
"stored",
"under",
"the",
"base",
"path",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/archive.py#L459-L465 | [
"def",
"_search_files",
"(",
"self",
")",
":",
"for",
"root",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"dirpath",
")",
":",
"for",
"filename",
"in",
"files",
":",
"location",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ro... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | check_compressed_file_type | Check if filename is a compressed file supported by the tool.
This function uses magic numbers (first four bytes) to determine
the type of the file. Supported types are 'gz' and 'bz2'. When
the filetype is not supported, the function returns `None`.
:param filepath: path to the file
:returns: 'gz... | perceval/utils.py | def check_compressed_file_type(filepath):
"""Check if filename is a compressed file supported by the tool.
This function uses magic numbers (first four bytes) to determine
the type of the file. Supported types are 'gz' and 'bz2'. When
the filetype is not supported, the function returns `None`.
:pa... | def check_compressed_file_type(filepath):
"""Check if filename is a compressed file supported by the tool.
This function uses magic numbers (first four bytes) to determine
the type of the file. Supported types are 'gz' and 'bz2'. When
the filetype is not supported, the function returns `None`.
:pa... | [
"Check",
"if",
"filename",
"is",
"a",
"compressed",
"file",
"supported",
"by",
"the",
"tool",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/utils.py#L50-L76 | [
"def",
"check_compressed_file_type",
"(",
"filepath",
")",
":",
"def",
"compressed_file_type",
"(",
"content",
")",
":",
"magic_dict",
"=",
"{",
"b'\\x1f\\x8b\\x08'",
":",
"'gz'",
",",
"b'\\x42\\x5a\\x68'",
":",
"'bz2'",
",",
"b'PK\\x03\\x04'",
":",
"'zip'",
"}",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | months_range | Generate a months range.
Generator of months starting on `from_date` util `to_date`. Each
returned item is a tuple of two datatime objects like in (month, month+1).
Thus, the result will follow the sequence:
((fd, fd+1), (fd+1, fd+2), ..., (td-2, td-1), (td-1, td))
:param from_date: generate d... | perceval/utils.py | def months_range(from_date, to_date):
"""Generate a months range.
Generator of months starting on `from_date` util `to_date`. Each
returned item is a tuple of two datatime objects like in (month, month+1).
Thus, the result will follow the sequence:
((fd, fd+1), (fd+1, fd+2), ..., (td-2, td-1), ... | def months_range(from_date, to_date):
"""Generate a months range.
Generator of months starting on `from_date` util `to_date`. Each
returned item is a tuple of two datatime objects like in (month, month+1).
Thus, the result will follow the sequence:
((fd, fd+1), (fd+1, fd+2), ..., (td-2, td-1), ... | [
"Generate",
"a",
"months",
"range",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/utils.py#L79-L102 | [
"def",
"months_range",
"(",
"from_date",
",",
"to_date",
")",
":",
"start",
"=",
"datetime",
".",
"datetime",
"(",
"from_date",
".",
"year",
",",
"from_date",
".",
"month",
",",
"1",
")",
"end",
"=",
"datetime",
".",
"datetime",
"(",
"to_date",
".",
"y... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | message_to_dict | Convert an email message into a dictionary.
This function transforms an `email.message.Message` object
into a dictionary. Headers are stored as key:value pairs
while the body of the message is stored inside `body` key.
Body may have two other keys inside, 'plain', for plain body
messages and 'html'... | perceval/utils.py | def message_to_dict(msg):
"""Convert an email message into a dictionary.
This function transforms an `email.message.Message` object
into a dictionary. Headers are stored as key:value pairs
while the body of the message is stored inside `body` key.
Body may have two other keys inside, 'plain', for p... | def message_to_dict(msg):
"""Convert an email message into a dictionary.
This function transforms an `email.message.Message` object
into a dictionary. Headers are stored as key:value pairs
while the body of the message is stored inside `body` key.
Body may have two other keys inside, 'plain', for p... | [
"Convert",
"an",
"email",
"message",
"into",
"a",
"dictionary",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/utils.py#L105-L189 | [
"def",
"message_to_dict",
"(",
"msg",
")",
":",
"def",
"parse_headers",
"(",
"msg",
")",
":",
"headers",
"=",
"{",
"}",
"for",
"header",
",",
"value",
"in",
"msg",
".",
"items",
"(",
")",
":",
"hv",
"=",
"[",
"]",
"for",
"text",
",",
"charset",
"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | remove_invalid_xml_chars | Remove control and invalid characters from an xml stream.
Looks for invalid characters and subtitutes them with whitespaces.
This solution is based on these two posts: Olemis Lang's reponse
on StackOverflow (http://stackoverflow.com/questions/1707890) and
lawlesst's on GitHub Gist (https://gist.github.... | perceval/utils.py | def remove_invalid_xml_chars(raw_xml):
"""Remove control and invalid characters from an xml stream.
Looks for invalid characters and subtitutes them with whitespaces.
This solution is based on these two posts: Olemis Lang's reponse
on StackOverflow (http://stackoverflow.com/questions/1707890) and
l... | def remove_invalid_xml_chars(raw_xml):
"""Remove control and invalid characters from an xml stream.
Looks for invalid characters and subtitutes them with whitespaces.
This solution is based on these two posts: Olemis Lang's reponse
on StackOverflow (http://stackoverflow.com/questions/1707890) and
l... | [
"Remove",
"control",
"and",
"invalid",
"characters",
"from",
"an",
"xml",
"stream",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/utils.py#L192-L221 | [
"def",
"remove_invalid_xml_chars",
"(",
"raw_xml",
")",
":",
"illegal_unichrs",
"=",
"[",
"(",
"0x00",
",",
"0x08",
")",
",",
"(",
"0x0B",
",",
"0x1F",
")",
",",
"(",
"0x7F",
",",
"0x84",
")",
",",
"(",
"0x86",
",",
"0x9F",
")",
"]",
"illegal_ranges"... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
test | xml_to_dict | Convert a XML stream into a dictionary.
This function transforms a xml stream into a dictionary. The
attributes are stored as single elements while child nodes are
stored into lists. The text node is stored using the special
key '__text__'.
This code is based on Winston Ewert's solution to this pr... | perceval/utils.py | def xml_to_dict(raw_xml):
"""Convert a XML stream into a dictionary.
This function transforms a xml stream into a dictionary. The
attributes are stored as single elements while child nodes are
stored into lists. The text node is stored using the special
key '__text__'.
This code is based on Wi... | def xml_to_dict(raw_xml):
"""Convert a XML stream into a dictionary.
This function transforms a xml stream into a dictionary. The
attributes are stored as single elements while child nodes are
stored into lists. The text node is stored using the special
key '__text__'.
This code is based on Wi... | [
"Convert",
"a",
"XML",
"stream",
"into",
"a",
"dictionary",
"."
] | chaoss/grimoirelab-perceval | python | https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/utils.py#L224-L270 | [
"def",
"xml_to_dict",
"(",
"raw_xml",
")",
":",
"def",
"node_to_dict",
"(",
"node",
")",
":",
"d",
"=",
"{",
"}",
"d",
".",
"update",
"(",
"node",
".",
"items",
"(",
")",
")",
"text",
"=",
"getattr",
"(",
"node",
",",
"'text'",
",",
"None",
")",
... | 41c908605e88b7ebc3a536c643fa0f212eaf9e0e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.