INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Get award emojis for issue/ merge request | def __get_award_emoji(self, item_type, item_id):
"""Get award emojis for issue/merge request"""
emojis = []
group_emojis = self.client.emojis(item_type, item_id)
for raw_emojis in group_emojis:
for emoji in json.loads(raw_emojis):
emojis.append(emoji)
... |
Fetch emojis for a note of an issue/ merge request | def __get_note_award_emoji(self, item_type, item_id, note_id):
"""Fetch emojis for a note of an issue/merge request"""
emojis = []
group_emojis = self.client.note_emojis(item_type, item_id, note_id)
try:
for raw_emojis in group_emojis:
for emoji in json.loa... |
Get the issues from pagination | def issues(self, from_date=None):
"""Get the issues from pagination"""
payload = {
'state': 'all',
'order_by': 'updated_at',
'sort': 'asc',
'per_page': PER_PAGE
}
if from_date:
payload['updated_after'] = from_date.isoformat()
... |
Get the merge requests from pagination | def merges(self, from_date=None):
"""Get the merge requests from pagination"""
payload = {
'state': 'all',
'order_by': 'updated_at',
'sort': 'asc',
'view': 'simple',
'per_page': PER_PAGE
}
if from_date:
payload['up... |
Get the merge full data | def merge(self, merge_id):
"""Get the merge full data"""
path = urijoin(self.base_url,
GitLabClient.PROJECTS, self.owner + '%2F' + self.repository,
GitLabClient.MERGES, merge_id)
response = self.fetch(path)
return response.text |
Get the merge versions from pagination | def merge_versions(self, merge_id):
"""Get the merge versions from pagination"""
payload = {
'order_by': 'updated_at',
'sort': 'asc',
'per_page': PER_PAGE
}
path = urijoin(GitLabClient.MERGES, str(merge_id), GitLabClient.VERSIONS)
return self... |
Get merge version detail | def merge_version(self, merge_id, version_id):
"""Get merge version detail"""
path = urijoin(self.base_url,
GitLabClient.PROJECTS, self.owner + '%2F' + self.repository,
GitLabClient.MERGES, merge_id, GitLabClient.VERSIONS, version_id)
response = se... |
Get the notes from pagination | def notes(self, item_type, item_id):
"""Get the notes from pagination"""
payload = {
'order_by': 'updated_at',
'sort': 'asc',
'per_page': PER_PAGE
}
path = urijoin(item_type, str(item_id), GitLabClient.NOTES)
return self.fetch_items(path, pa... |
Get emojis from pagination | def emojis(self, item_type, item_id):
"""Get emojis from pagination"""
payload = {
'order_by': 'updated_at',
'sort': 'asc',
'per_page': PER_PAGE
}
path = urijoin(item_type, str(item_id), GitLabClient.EMOJI)
return self.fetch_items(path, payl... |
Get emojis of a note | def note_emojis(self, item_type, item_id, note_id):
"""Get emojis of a note"""
payload = {
'order_by': 'updated_at',
'sort': 'asc',
'per_page': PER_PAGE
}
path = urijoin(item_type, str(item_id), GitLabClient.NOTES,
str(note_id)... |
Calculate the seconds to reset the token requests by obtaining the different between the current date and the next date when the token is fully regenerated. | def calculate_time_to_reset(self):
"""Calculate the seconds to reset the token requests, by obtaining the different
between the current date and the next date when the token is fully regenerated.
"""
time_to_reset = self.rate_limit_reset_ts - (datetime_utcnow().replace(microsecond=0).ti... |
Fetch the data from a given URL. | def fetch(self, url, payload=None, headers=None, method=HttpClient.GET, stream=False):
"""Fetch the data from a given URL.
:param url: link to the resource
:param payload: payload of the request
:param headers: headers of the request
:param method: type of request call (GET or P... |
Return the items from GitLab API using links pagination | def fetch_items(self, path, payload):
"""Return the items from GitLab API using links pagination"""
page = 0 # current page
last_page = None # last page
url_next = urijoin(self.base_url, GitLabClient.PROJECTS, self.owner + '%2F' + self.repository, path)
logger.debug("Get GitL... |
Sanitize payload of a HTTP request by removing the token information before storing/ retrieving archived items | def sanitize_for_archive(url, headers, payload):
"""Sanitize payload of a HTTP request by removing the token information
before storing/retrieving archived items
:param: url: HTTP url request
:param: headers: HTTP headers request
:param: payload: HTTP payload request
:r... |
Initialize rate limit information | def _init_rate_limit(self):
"""Initialize rate limit information"""
url = urijoin(self.base_url, 'projects', self.owner + '%2F' + self.repository)
try:
response = super().fetch(url)
self.update_rate_limit(response)
except requests.exceptions.HTTPError as error:
... |
Returns the GitLab argument parser. | def setup_cmd_parser(cls):
"""Returns the GitLab argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
token_auth=True,
a... |
Fetch the messages from the channel. | def fetch(self, category=CATEGORY_MESSAGE, from_date=DEFAULT_DATETIME):
"""Fetch the messages from the channel.
This method fetches the messages stored on the channel that were
sent since the given date.
:param category: the category of items to fetch
:param from_date: obtain m... |
Fetch the messages | 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']
latest = kwargs['latest']
logger.info("F... |
Extracts the identifier from a Slack item. | def metadata_id(item):
"""Extracts the identifier from a Slack item.
This identifier will be the mix of two fields because Slack
messages does not have any unique identifier. In this case,
'ts' and 'user' values (or 'bot_id' when the message is sent by a bot)
are combined becaus... |
Init client | def _init_client(self, from_archive=False):
"""Init client"""
return SlackClient(self.api_token, self.max_items, self.archive, from_archive) |
Fetch the number of members in a conversation which is a supertype for public and private ones DM and group DM. | def conversation_members(self, conversation):
"""Fetch the number of members in a conversation, which is a supertype for public and
private ones, DM and group DM.
:param conversation: the ID of the conversation
"""
members = 0
resource = self.RCONVERSATION_INFO
... |
Fetch information about a channel. | def channel_info(self, channel):
"""Fetch information about a channel."""
resource = self.RCHANNEL_INFO
params = {
self.PCHANNEL: channel,
}
response = self._fetch(resource, params)
return response |
Fetch the history of a channel. | def history(self, channel, oldest=None, latest=None):
"""Fetch the history of a channel."""
resource = self.RCHANNEL_HISTORY
params = {
self.PCHANNEL: channel,
self.PCOUNT: self.max_items
}
if oldest is not None:
params[self.POLDEST] = oldes... |
Fetch user info. | def user(self, user_id):
"""Fetch user info."""
resource = self.RUSER_INFO
params = {
self.PUSER: user_id
}
response = self._fetch(resource, params)
return response |
Sanitize payload of a HTTP request by removing the token information before storing/ retrieving archived items | def sanitize_for_archive(url, headers, payload):
"""Sanitize payload of a HTTP request by removing the token information
before storing/retrieving archived items
:param: url: HTTP url request
:param: headers: HTTP headers request
:param: payload: HTTP payload request
:r... |
Fetch a resource. | def _fetch(self, resource, params):
"""Fetch a resource.
:param resource: resource to get
:param params: dict with the HTTP parameters needed to get
the given resource
"""
url = self.URL % {'resource': resource}
params[self.PTOKEN] = self.api_token
l... |
Returns the Slack argument parser. | def setup_cmd_parser(cls):
"""Returns the Slack argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
token_auth=True,
ar... |
Fetch the bugs | def fetch_items(self, category, **kwargs):
"""Fetch the bugs
: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 bugs: '%s' updated from '%... |
Extracts and coverts the update time from a Bugzilla item. | def metadata_updated_on(item):
"""Extracts and coverts the update time from a Bugzilla item.
The timestamp is extracted from 'delta_ts' field. This date is
converted to UNIX timestamp format. Due Bugzilla servers ignore
the timezone on HTTP requests, it will be ignored during the
... |
Parse a Bugzilla CSV bug list. | def parse_buglist(raw_csv):
"""Parse a Bugzilla CSV bug list.
The method parses the CSV file and returns an iterator of
dictionaries. Each one of this, contains the summary of a bug.
:param raw_csv: CSV string to parse
:returns: a generator of parsed bugs
"""
r... |
Parse a Bugilla bugs details XML stream. | def parse_bugs_details(raw_xml):
"""Parse a Bugilla bugs details XML stream.
This method returns a generator which parses the given XML,
producing an iterator of dictionaries. Each dictionary stores
the information related to a parsed bug.
If the given XML is invalid or does no... |
Parse a Bugzilla bug activity HTML stream. | def parse_bug_activity(raw_html):
"""Parse a Bugzilla bug activity HTML stream.
This method extracts the information about activity from the
given HTML stream. The bug activity is stored into a HTML
table. Each parsed activity event is returned into a dictionary.
If the given H... |
Init client | def _init_client(self, from_archive=False):
"""Init client"""
return BugzillaClient(self.url, user=self.user, password=self.password,
max_bugs_csv=self.max_bugs_csv,
archive=self.archive, from_archive=from_archive) |
Authenticate a user in the server. | def login(self, user, password):
"""Authenticate a user in the server.
:param user: Bugzilla user
:param password: user password
"""
url = self.URL % {'base': self.base_url, 'cgi': self.CGI_LOGIN}
payload = {
self.PBUGZILLA_LOGIN: user,
self.PBUG... |
Logout from the server. | def logout(self):
"""Logout from the server."""
params = {
self.PLOGOUT: '1'
}
self.call(self.CGI_LOGIN, params)
self._close_http_session()
logger.debug("Bugzilla user logged out from %s",
self.base_url) |
Get metadata information in XML format. | def metadata(self):
"""Get metadata information in XML format."""
params = {
self.PCTYPE: self.CTYPE_XML
}
response = self.call(self.CGI_BUG, params)
return response |
Get a summary of bugs in CSV format. | def buglist(self, from_date=DEFAULT_DATETIME):
"""Get a summary of bugs in CSV format.
:param from_date: retrieve bugs that where updated from that date
"""
if not self.version:
self.version = self.__fetch_version()
if self.version in self.OLD_STYLE_VERSIONS:
... |
Get the information of a list of bugs in XML format. | def bugs(self, *bug_ids):
"""Get the information of a list of bugs in XML format.
:param bug_ids: list of bug identifiers
"""
params = {
self.PBUG_ID: bug_ids,
self.PCTYPE: self.CTYPE_XML,
self.PEXCLUDE_FIELD: 'attachmentdata'
}
respo... |
Get the activity of a bug in HTML format. | def bug_activity(self, bug_id):
"""Get the activity of a bug in HTML format.
:param bug_id: bug identifier
"""
params = {
self.PBUG_ID: bug_id
}
response = self.call(self.CGI_BUG_ACTIVITY, params)
return response |
Run an API command. | def call(self, cgi, params):
"""Run an API command.
:param cgi: cgi command to run on the server
:param params: dict with the HTTP parameters needed to run
the given command
"""
url = self.URL % {'base': self.base_url, 'cgi': cgi}
logger.debug("Bugzilla clie... |
Sanitize payload of a HTTP request by removing the login and password information before storing/ retrieving archived items | def sanitize_for_archive(url, headers, payload):
"""Sanitize payload of a HTTP request by removing the login and password information
before storing/retrieving archived items
:param: url: HTTP url request
:param: headers: HTTP headers request
:param: payload: HTTP payload reques... |
Fetch the events from the server. | def fetch(self, category=CATEGORY_EVENT, from_date=DEFAULT_DATETIME, to_date=None,
filter_classified=False):
"""Fetch the events from the server.
This method fetches those events of a group stored on the server
that were updated since the given date. Data comments and rsvps
... |
Fetch the events | def fetch_items(self, category, **kwargs):
"""Fetch the events
: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']
logger.info("F... |
Fetch the events pages of a given group. | def events(self, group, from_date=DEFAULT_DATETIME):
"""Fetch the events pages of a given group."""
date = datetime_to_utc(from_date)
date = date.strftime("since:%Y-%m-%dT%H:%M:%S.000Z")
resource = urijoin(group, self.REVENTS)
# Hack required due to Metup API does not support ... |
Fetch the comments of a given event. | def comments(self, group, event_id):
"""Fetch the comments of a given event."""
resource = urijoin(group, self.REVENTS, event_id, self.RCOMMENTS)
params = {
self.PPAGE: self.max_items
}
for page in self._fetch(resource, params):
yield page |
Fetch the rsvps of a given event. | def rsvps(self, group, event_id):
"""Fetch the rsvps of a given event."""
resource = urijoin(group, self.REVENTS, event_id, self.RRSVPS)
# Same hack that in 'events' method
fixed_params = '?' + self.PFIELDS + '=' + ','.join(self.VRSVP_FIELDS)
fixed_params += '&' + self.PRESPONS... |
Sanitize payload of a HTTP request by removing the token information before storing/ retrieving archived items | def sanitize_for_archive(url, headers, payload):
"""Sanitize payload of a HTTP request by removing the token information
before storing/retrieving archived items
:param: url: HTTP url request
:param: headers: HTTP headers request
:param: payload: HTTP payload request
:r... |
Fetch a resource. | def _fetch(self, resource, 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 resource: type of the resource
:param params: parameters to ... |
Fetch the questions | def fetch_items(self, category, **kwargs):
"""Fetch the questions
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = datetime_to_utc(kwargs['from_date']).timestamp()
questions_groups ... |
Init client | def _init_client(self, from_archive=False):
"""Init client"""
return AskbotClient(self.url, self.archive, from_archive) |
Fetch an Askbot HTML question body. | def __fetch_question(self, question):
"""Fetch an Askbot HTML question body.
The method fetchs the HTML question retrieving the
question body of the item question received
:param question: item with the question itself
:returns: a list of HTML page/s for the question
"... |
Fetch all the comments of an Askbot question and answers. | def __fetch_comments(self, question):
"""Fetch all the comments of an Askbot question and answers.
The method fetchs the list of every comment existing in a question and
its answers.
:param question: item with the question itself
:returns: a list of comments with the ids as ha... |
Build an Askbot HTML response. | def __build_question(html_question, question, comments):
"""Build an Askbot HTML response.
The method puts together all the information regarding a question
:param html_question: array of HTML raw pages
:param question: question object from the API
:param comments: list of comm... |
Retrieve a question page using the API. | def get_api_questions(self, path):
"""Retrieve a question page using the API.
:param page: page to retrieve
"""
npages = 1
next_request = True
path = urijoin(self.base_url, path)
while next_request:
try:
params = {
... |
Retrieve a raw HTML question and all it s information. | def get_html_question(self, question_id, page=1):
"""Retrieve a raw HTML question and all it's information.
:param question_id: question identifier
:param page: page to retrieve
"""
path = urijoin(self.base_url, self.HTML_QUESTION, question_id)
params = {
'pa... |
Retrieve a list of comments by a given id. | def get_comments(self, post_id):
"""Retrieve a list of comments by a given id.
:param object_id: object identifiere
"""
path = urijoin(self.base_url, self.COMMENTS if self._use_new_urls else self.COMMENTS_OLD)
params = {
'post_id': post_id,
'post_type': '... |
Parse the question info container of a given HTML question. | def parse_question_container(html_question):
"""Parse the question info container of a given HTML question.
The method parses the information available in the question information
container. The container can have up to 2 elements: the first one
contains the information related with the... |
Parse the answers of a given HTML question. | def parse_answers(html_question):
"""Parse the answers of a given HTML question.
The method parses the answers related with a given HTML question,
as well as all the comments related to the answer.
:param html_question: raw HTML question element
:returns: a list with the answe... |
Parse number of answer pages to paginate over them. | def parse_number_of_html_pages(html_question):
"""Parse number of answer pages to paginate over them.
:param html_question: raw HTML question element
:returns: an integer with the number of pages
"""
bs_question = bs4.BeautifulSoup(html_question, "html.parser")
try:
... |
Parse the user information of a given HTML container. | def parse_user_info(update_info):
"""Parse the user information of a given HTML container.
The method parses all the available user information in the container.
If the class "user-info" exists, the method will get all the available
information in the container. If not, if a class "tip"... |
Fetch the reviews | def fetch_items(self, category, **kwargs):
"""Fetch the reviews
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
if self.client.version[0] == 2 and self.client.ve... |
Parse a Gerrit reviews list. | def parse_reviews(raw_data):
"""Parse a Gerrit reviews list."""
# Join isolated reviews in JSON in array for parsing
items_raw = "[" + raw_data.replace("\n", ",") + "]"
items_raw = items_raw.replace(",]", "]")
items = json.loads(items_raw)
reviews = []
for item ... |
Specific fetch for gerrit 2. 8 version. | def _fetch_gerrit28(self, from_date=DEFAULT_DATETIME):
""" Specific fetch for gerrit 2.8 version.
Get open and closed reviews in different queries.
Take the newer review from both lists and iterate.
"""
# Convert date to Unix time
from_ut = datetime_to_utc(from_date)
... |
Return the Gerrit server version. | def version(self):
"""Return the Gerrit server version."""
if self._version:
return self._version
cmd = self.gerrit_cmd + " %s " % (GerritClient.CMD_VERSION)
logger.debug("Getting version: %s" % (cmd))
raw_data = self.__execute(cmd)
raw_data = str(raw_data,... |
Get the reviews starting from last_item. | def reviews(self, last_item, filter_=None):
"""Get the reviews starting from last_item."""
cmd = self._get_gerrit_cmd(last_item, filter_)
logger.debug("Getting reviews with command: %s", cmd)
raw_data = self.__execute(cmd)
raw_data = str(raw_data, "UTF-8")
return raw_d... |
Return the item to start from in next reviews group. | def next_retrieve_group_item(self, last_item=None, entry=None):
"""Return the item to start from in next reviews group."""
next_item = None
gerrit_version = self.version
if gerrit_version[0] == 2 and gerrit_version[1] > 9:
if last_item is None:
next_item = ... |
Execute gerrit command | def __execute(self, cmd):
"""Execute gerrit command"""
if self.from_archive:
response = self.__execute_from_archive(cmd)
else:
response = self.__execute_from_remote(cmd)
return response |
Execute gerrit command against the archive | def __execute_from_archive(self, cmd):
"""Execute gerrit command against the archive"""
cmd = self.sanitize_for_archive(cmd)
response = self.archive.retrieve(cmd, None, None)
if isinstance(response, RuntimeError):
raise response
return response |
Execute gerrit command with retry if it fails | def __execute_from_remote(self, cmd):
"""Execute gerrit command with retry if it fails"""
result = None # data result from the cmd execution
retries = 0
while retries < self.MAX_RETRIES:
try:
result = subprocess.check_output(cmd, shell=True)
... |
Returns the Gerrit argument parser. | def setup_cmd_parser(cls):
"""Returns the Gerrit argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
archive=True)
# Gerrit options
group = parser.p... |
Fetch the issues | def fetch_items(self, category, **kwargs):
"""Fetch the issues
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
logger.info("Fetching issues of '%s' distribution ... |
Init client | def _init_client(self, from_archive=False):
"""Init client"""
return LaunchpadClient(self.distribution, self.package, self.items_per_page,
self.sleep_time, self.archive, from_archive) |
Fetch the issues from a project ( distribution/ package ) | def _fetch_issues(self, from_date):
"""Fetch the issues from a project (distribution/package)"""
issues_groups = self.client.issues(start=from_date)
for raw_issues in issues_groups:
issues = json.loads(raw_issues)['entries']
for issue in issues:
issue =... |
Get data associated to an issue | def __fetch_issue_data(self, issue_id):
"""Get data associated to an issue"""
raw_issue = self.client.issue(issue_id)
issue = json.loads(raw_issue)
return issue |
Get attachments of an issue | def __fetch_issue_attachments(self, issue_id):
"""Get attachments of an issue"""
for attachments_raw in self.client.issue_collection(issue_id, "attachments"):
attachments = json.loads(attachments_raw)
for attachment in attachments['entries']:
yield attachment |
Get messages of an issue | def __fetch_issue_messages(self, issue_id):
"""Get messages of an issue"""
for messages_raw in self.client.issue_collection(issue_id, "messages"):
messages = json.loads(messages_raw)
for msg in messages['entries']:
msg['owner_data'] = self.__fetch_user_data('{OW... |
Get activities on an issue | def __fetch_issue_activities(self, issue_id):
"""Get activities on an issue"""
for activities_raw in self.client.issue_collection(issue_id, "activity"):
activities = json.loads(activities_raw)
for act in activities['entries']:
act['person_data'] = self.__fetch_u... |
Get data associated to an user | def __fetch_user_data(self, tag_type, user_link):
"""Get data associated to an user"""
user_name = self.client.user_name(user_link)
user = {}
if not user_name:
return user
user_raw = self.client.user(user_name)
user = json.loads(user_raw)
return u... |
Get the issues from pagination | def issues(self, start=None):
"""Get the issues from pagination"""
payload = self.__build_payload(size=self.items_per_page, operation=True, startdate=start)
path = self.__get_url_project()
return self.__fetch_items(path=path, payload=payload) |
Get the user data by URL | def user(self, user_name):
"""Get the user data by URL"""
user = None
if user_name in self._users:
return self._users[user_name]
url_user = self.__get_url("~" + user_name)
logger.info("Getting info for %s" % (url_user))
try:
raw_user = self.__... |
Get the issue data by its ID | def issue(self, issue_id):
"""Get the issue data by its ID"""
path = urijoin("bugs", str(issue_id))
url_issue = self.__get_url(path)
raw_text = self.__send_request(url_issue)
return raw_text |
Get a collection list of a given issue | def issue_collection(self, issue_id, collection_name):
"""Get a collection list of a given issue"""
path = urijoin("bugs", str(issue_id), collection_name)
url_collection = self.__get_url(path)
payload = {'ws.size': self.items_per_page, 'ws.start': 0, 'order_by': 'date_last_updated'}
... |
Build URL project | def __get_url_project(self):
"""Build URL project"""
if self.package:
url = self.__get_url_distribution_package()
else:
url = self.__get_url_distribution()
return url |
Send request | def __send_request(self, url, params=None):
"""Send request"""
r = self.fetch(url, payload=params)
return r.text |
Build payload | def __build_payload(self, size, operation=False, startdate=None):
"""Build payload"""
payload = {
'ws.size': size,
'order_by': 'date_last_updated',
'omit_duplicates': 'false',
'status': ["New", "Incomplete", "Opinion", "Invalid", "Won't Fix",
... |
Return the items from Launchpad API using pagination | def __fetch_items(self, path, payload):
"""Return the items from Launchpad API using pagination"""
page = 0 # current page
url_next = path
fetch_data = True
while fetch_data:
logger.debug("Fetching page: %i", page)
try:
raw_content = se... |
Fetch the messages | 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' sinc... |
Fetch the mbox files from the remote archiver. | def fetch(self):
"""Fetch the mbox files from the remote archiver.
Stores the archives in the path given during the initialization
of this object. Those archives which a not valid extension will
be ignored.
Groups.io archives are returned as a .zip file, which contains
... |
Fetch the groupsio paginated subscriptions for a given token | def subscriptions(self, per_page=PER_PAGE):
"""Fetch the groupsio paginated subscriptions for a given token
:param per_page: number of subscriptions per page
:returns: an iterator of subscriptions
"""
url = urijoin(GROUPSIO_API_URL, self.GET_SUBSCRIPTIONS)
logger.debug(... |
Find the id of a group given its name by iterating on the list of subscriptions | def __find_group_id(self):
"""Find the id of a group given its name by iterating on the list of subscriptions"""
group_subscriptions = self.subscriptions(self.auth)
for subscriptions in group_subscriptions:
for sub in subscriptions:
if sub['group_name'] == self.grou... |
Fetch requests from groupsio API | def __fetch(self, url, payload):
"""Fetch requests from groupsio API"""
r = requests.get(url, params=payload, auth=self.auth, verify=self.verify)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e:
raise e
return r |
Initialize mailing lists directory path | def _pre_init(self):
"""Initialize mailing lists directory path"""
if not self.parsed_args.mboxes_path:
base_path = os.path.expanduser('~/.perceval/mailinglists/')
dirpath = os.path.join(base_path, GROUPSIO_URL, 'g', self.parsed_args.group_name)
else:
dirpath... |
Returns the Groupsio argument parser. | def setup_cmd_parser(cls):
"""Returns the Groupsio argument parser."""
parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES,
from_date=True,
token_auth=True)
# Backend token is required
... |
Generate a UUID based on the given parameters. | def uuid(*args):
"""Generate a UUID based on the given parameters.
The UUID will be the SHA1 of the concatenation of the values
from the list. The separator bewteedn these values is ':'.
Each value must be a non-empty string, otherwise, the function
will raise an exception.
:param *args: list ... |
Fetch items using the given backend. | def fetch(backend_class, backend_args, category, filter_classified=False,
manager=None):
"""Fetch items using the given backend.
Generator to get items using the given backend class. When
an archive manager is given, this function will store
the fetched items in an `Archive`. If an exception ... |
Fetch items from an archive manager. | def fetch_from_archive(backend_class, backend_args, manager,
category, archived_after):
"""Fetch items from an archive manager.
Generator to get the items of a category (previously fetched
by the given backend class) from an archive manager. Only those
items archived after the gi... |
Find available backends. | def find_backends(top_package):
"""Find available backends.
Look for the Perceval backends and commands under `top_package`
and its sub-packages. When `top_package` defines a namespace,
backends under that same namespace will be found too.
:param top_package: package storing backends
:returns... |
Fetch items from the repository. | def fetch(self, category, filter_classified=False, **kwargs):
"""Fetch items from the repository.
The method retrieves items from a repository.
To removed classified fields from the resulting items, set
the parameter `filter_classified`. Take into account this
parameter is inco... |
Fetch the questions from an archive. | def fetch_from_archive(self):
"""Fetch the questions from an archive.
It returns the items stored within an archive. If this method is called but
no archive was provided, the method will raise a `ArchiveError` exception.
:returns: a generator of items
:raises ArchiveError: rai... |
Remove classified or confidential data from an item. | def filter_classified_data(self, item):
"""Remove classified or confidential data from an item.
It removes those fields that contain data considered as classified.
Classified fields are defined in `CLASSIFIED_FIELDS` class attribute.
:param item: fields will be removed from this item
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.