INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Create a commit on this repository. | def create_commit(self, message, tree, parents, author={}, committer={}):
"""Create a commit on this repository.
:param str message: (required), commit message
:param str tree: (required), SHA of the tree object this
commit points to
:param list parents: (required), SHAs of ... |
Create a deployment. | def create_deployment(self, ref, force=False, payload='',
auto_merge=False, description='', environment=None):
"""Create a deployment.
:param str ref: (required), The ref to deploy. This can be a branch,
tag, or sha.
:param bool force: Optional parameter to... |
Create a file in this repository. | def create_file(self, path, message, content, branch=None,
committer=None, author=None):
"""Create a file in this repository.
See also: http://developer.github.com/v3/repos/contents/#create-a-file
:param str path: (required), path of the file in the repository
:para... |
Create a fork of this repository. | def create_fork(self, organization=None):
"""Create a fork of this repository.
:param str organization: (required), login for organization to create
the fork under
:returns: :class:`Repository <Repository>` if successful, else None
"""
url = self._build_url('forks', ... |
Create a hook on this repository. | def create_hook(self, name, config, events=['push'], active=True):
"""Create a hook on this repository.
:param str name: (required), name of the hook
:param dict config: (required), key-value pairs which act as settings
for this hook
:param list events: (optional), events th... |
Creates an issue on this repository. | def create_issue(self,
title,
body=None,
assignee=None,
milestone=None,
labels=None):
"""Creates an issue on this repository.
:param str title: (required), title of the issue
:param str body... |
Create a deploy key. | def create_key(self, title, key):
"""Create a deploy key.
:param str title: (required), title of key
:param str key: (required), key text
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if title and key:
data = {'ti... |
Create a label for this repository. | def create_label(self, name, color):
"""Create a label for this repository.
:param str name: (required), name to give to the label
:param str color: (required), value of the color to assign to the
label, e.g., '#fafafa' or 'fafafa' (the latter is what is sent)
:returns: :cla... |
Create a milestone for this repository. | def create_milestone(self, title, state=None, description=None,
due_on=None):
"""Create a milestone for this repository.
:param str title: (required), title of the milestone
:param str state: (optional), state of the milestone, accepted
values: ('open', 'clo... |
Create a pull request of head onto base branch in this repo. | def create_pull(self, title, base, head, body=None):
"""Create a pull request of ``head`` onto ``base`` branch in this repo.
:param str title: (required)
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:param str body: (optional),... |
Create a pull request from issue # issue. | def create_pull_from_issue(self, issue, base, head):
"""Create a pull request from issue #``issue``.
:param int issue: (required), issue number
:param str base: (required), e.g., 'master'
:param str head: (required), e.g., 'username:branch'
:returns: :class:`PullRequest <github3... |
Create a reference in this repository. | def create_ref(self, ref, sha):
"""Create a reference in this repository.
:param str ref: (required), fully qualified name of the reference,
e.g. ``refs/heads/master``. If it doesn't start with ``refs`` and
contain at least two slashes, GitHub's API will reject it.
:para... |
Create a release for this repository. | def create_release(self, tag_name, target_commitish=None, name=None,
body=None, draft=False, prerelease=False):
"""Create a release for this repository.
:param str tag_name: (required), name to give to the tag
:param str target_commitish: (optional), vague concept of a ta... |
Create a status object on a commit. | def create_status(self, sha, state, target_url=None, description=None,
context='default'):
"""Create a status object on a commit.
:param str sha: (required), SHA of the commit to create the status on
:param str state: (required), state of the test; only the following
... |
Create a tag in this repository. | def create_tag(self, tag, message, sha, obj_type, tagger,
lightweight=False):
"""Create a tag in this repository.
:param str tag: (required), name of the tag
:param str message: (required), tag message
:param str sha: (required), SHA of the git object this is tagging
... |
Create a tree on this repository. | def create_tree(self, tree, base_tree=''):
"""Create a tree on this repository.
:param list tree: (required), specifies the tree structure.
Format: [{'path': 'path/file', 'mode':
'filemode', 'type': 'blob or tree', 'sha': '44bfc6d...'}]
:param str base_tree: (optional), ... |
Delete the file located at path. | def delete_file(self, path, message, sha, branch=None, committer=None,
author=None):
"""Delete the file located at ``path``.
This is part of the Contents CrUD (Create Update Delete) API. See
http://developer.github.com/v3/repos/contents/#delete-a-file for more
inform... |
Delete the key with the specified id from your deploy keys list. | def delete_key(self, key_id):
"""Delete the key with the specified id from your deploy keys list.
:returns: bool -- True if successful, False otherwise
"""
if int(key_id) <= 0:
return False
url = self._build_url('keys', str(key_id), base_url=self._api)
return... |
Edit this repository. | def edit(self,
name,
description=None,
homepage=None,
private=None,
has_issues=None,
has_wiki=None,
has_downloads=None,
default_branch=None):
"""Edit this repository.
:param str name: (required), nam... |
Get a single ( git ) commit. | def git_commit(self, sha):
"""Get a single (git) commit.
:param str sha: (required), sha of the commit
:returns: :class:`Commit <github3.git.Commit>` if successful,
otherwise None
"""
json = {}
if sha:
url = self._build_url('git', 'commits', sha, ... |
Get a single hook. | def hook(self, id_num):
"""Get a single hook.
:param int id_num: (required), id of the hook
:returns: :class:`Hook <github3.repos.hook.Hook>` if successful,
otherwise None
"""
json = None
if int(id_num) > 0:
url = self._build_url('hooks', str(id_n... |
Check if the user is a possible assignee for an issue on this repository. | def is_assignee(self, login):
"""Check if the user is a possible assignee for an issue on this
repository.
:returns: :class:`bool`
"""
if not login:
return False
url = self._build_url('assignees', login, base_url=self._api)
return self._boolean(self._... |
Get the issue specified by number. | def issue(self, number):
"""Get the issue specified by ``number``.
:param int number: (required), number of the issue on this repository
:returns: :class:`Issue <github3.issues.issue.Issue>` if successful,
otherwise None
"""
json = None
if int(number) > 0:
... |
Get the specified deploy key. | def key(self, id_num):
"""Get the specified deploy key.
:param int id_num: (required), id of the key
:returns: :class:`Key <github3.users.Key>` if successful, else None
"""
json = None
if int(id_num) > 0:
url = self._build_url('keys', str(id_num), base_url=se... |
Get the label specified by name | def label(self, name):
"""Get the label specified by ``name``
:param str name: (required), name of the label
:returns: :class:`Label <github3.issues.label.Label>` if successful,
else None
"""
json = None
if name:
url = self._build_url('labels', na... |
Iterate over the branches in this repository. | def iter_branches(self, number=-1, etag=None):
"""Iterate over the branches in this repository.
:param int number: (optional), number of branches to return. Default:
-1 returns all branches
:param str etag: (optional), ETag from a previous request to the same
endpoint
... |
Iterate over the code frequency per week. | def iter_code_frequency(self, number=-1, etag=None):
"""Iterate over the code frequency per week.
Returns a weekly aggregate of the number of additions and deletions
pushed to this repository.
:param int number: (optional), number of weeks to return. Default: -1
returns all... |
Iterate over comments for a single commit. | def iter_comments_on_commit(self, sha, number=1, etag=None):
"""Iterate over comments for a single commit.
:param sha: (required), sha of the commit to list comments on
:type sha: str
:param int number: (optional), number of comments to return. Default:
-1 returns all commen... |
Iterate over last year of commit activity by week. | def iter_commit_activity(self, number=-1, etag=None):
"""Iterate over last year of commit activity by week.
See: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str et... |
Iterate over commits in this repository. | def iter_commits(self, sha=None, path=None, author=None, number=-1,
etag=None, since=None, until=None):
"""Iterate over commits in this repository.
:param str sha: (optional), sha or branch to start listing commits
from
:param str path: (optional), commits conta... |
Iterate over the contributors to this repository. | def iter_contributors(self, anon=False, number=-1, etag=None):
"""Iterate over the contributors to this repository.
:param bool anon: (optional), True lists anonymous contributors as
well
:param int number: (optional), number of contributors to return.
Default: -1 return... |
Iterate over the contributors list. | def iter_contributor_statistics(self, number=-1, etag=None):
"""Iterate over the contributors list.
See also: http://developer.github.com/v3/repos/statistics/
:param int number: (optional), number of weeks to return. Default -1
will return all of the weeks.
:param str etag:... |
Iterate over deployments for this repository. | def iter_deployments(self, number=-1, etag=None):
"""Iterate over deployments for this repository.
:param int number: (optional), number of deployments to return.
Default: -1, returns all available deployments
:param str etag: (optional), ETag from a previous request for all
... |
Iterate over forks of this repository. | def iter_forks(self, sort='', number=-1, etag=None):
"""Iterate over forks of this repository.
:param str sort: (optional), accepted values:
('newest', 'oldest', 'watchers'), API default: 'newest'
:param int number: (optional), number of forks to return. Default: -1
retu... |
Iterate over hooks registered on this repository. | def iter_hooks(self, number=-1, etag=None):
"""Iterate over hooks registered on this repository.
:param int number: (optional), number of hoks to return. Default: -1
returns all hooks
:param str etag: (optional), ETag from a previous request to the same
endpoint
... |
Iterate over issues on this repo based upon parameters passed. | def iter_issues(self,
milestone=None,
state=None,
assignee=None,
mentioned=None,
labels=None,
sort=None,
direction=None,
since=None,
number=... |
Iterates over issue events on this repository. | def iter_issue_events(self, number=-1, etag=None):
"""Iterates over issue events on this repository.
:param int number: (optional), number of events to return. Default: -1
returns all available events
:param str etag: (optional), ETag from a previous request to the same
... |
Iterate over the programming languages used in the repository. | def iter_languages(self, number=-1, etag=None):
"""Iterate over the programming languages used in the repository.
:param int number: (optional), number of languages to return. Default:
-1 returns all used languages
:param str etag: (optional), ETag from a previous request to the sam... |
Iterates over the milestones on this repository. | def iter_milestones(self, state=None, sort=None, direction=None,
number=-1, etag=None):
"""Iterates over the milestones on this repository.
:param str state: (optional), state of the milestones, accepted
values: ('open', 'closed')
:param str sort: (optional),... |
Iterates over events on a network of repositories. | def iter_network_events(self, number=-1, etag=None):
"""Iterates over events on a network of repositories.
:param int number: (optional), number of events to return. Default: -1
returns all available events
:param str etag: (optional), ETag from a previous request to the same
... |
Iterates over the notifications for this repository. | def iter_notifications(self, all=False, participating=False, since=None,
number=-1, etag=None):
"""Iterates over the notifications for this repository.
:param bool all: (optional), show all notifications, including ones
marked as read
:param bool participa... |
Iterate over pages builds of this repository. | def iter_pages_builds(self, number=-1, etag=None):
"""Iterate over pages builds of this repository.
:returns: generator of :class:`PagesBuild
<github3.repos.pages.PagesBuild>`
"""
url = self._build_url('pages', 'builds', base_url=self._api)
return self._iter(int(numb... |
List pull requests on repository. | def iter_pulls(self, state=None, head=None, base=None, sort='created',
direction='desc', number=-1, etag=None):
"""List pull requests on repository.
.. versionchanged:: 0.9.0
- The ``state`` parameter now accepts 'all' in addition to 'open'
and 'closed'.
... |
Iterates over references for this repository. | def iter_refs(self, subspace='', number=-1, etag=None):
"""Iterates over references for this repository.
:param str subspace: (optional), e.g. 'tags', 'stashes', 'notes'
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param st... |
Iterates over releases for this repository. | def iter_releases(self, number=-1, etag=None):
"""Iterates over releases for this repository.
:param int number: (optional), number of refs to return. Default: -1
returns all available refs
:param str etag: (optional), ETag from a previous request to the same
endpoint
... |
Iterates over the statuses for a specific SHA. | def iter_statuses(self, sha, number=-1, etag=None):
"""Iterates over the statuses for a specific SHA.
:param str sha: SHA of the commit to list the statuses of
:param int number: (optional), return up to number statuses. Default:
-1 returns all available statuses.
:param str... |
Iterates over tags on this repository. | def iter_tags(self, number=-1, etag=None):
"""Iterates over tags on this repository.
:param int number: (optional), return up to at most number tags.
Default: -1 returns all available tags.
:param str etag: (optional), ETag from a previous request to the same
endpoint
... |
Mark all notifications in this repository as read. | def mark_notifications(self, last_read=''):
"""Mark all notifications in this repository as read.
:param str last_read: (optional), Describes the last point that
notifications were checked. Anything updated since this time will
not be updated. Default: Now. Expected in ISO 8601 ... |
Perform a merge from head into base. | def merge(self, base, head, message=''):
"""Perform a merge from ``head`` into ``base``.
:param str base: (required), where you're merging into
:param str head: (required), where you're merging from
:param str message: (optional), message to be used for the commit
:returns: :cla... |
Get the milestone indicated by number. | def milestone(self, number):
"""Get the milestone indicated by ``number``.
:param int number: (required), unique id number of the milestone
:returns: :class:`Milestone <github3.issues.milestone.Milestone>`
"""
json = None
if int(number) > 0:
url = self._build... |
Get information about this repository s pages site. | def pages(self):
"""Get information about this repository's pages site.
:returns: :class:`PagesInfo <github3.repos.pages.PagesInfo>`
"""
url = self._build_url('pages', base_url=self._api)
json = self._json(self._get(url), 200)
return PagesInfo(json) if json else None |
Get the pull request indicated by number. | def pull_request(self, number):
"""Get the pull request indicated by ``number``.
:param int number: (required), number of the pull request.
:returns: :class:`PullRequest <github3.pulls.PullRequest>`
"""
json = None
if int(number) > 0:
url = self._build_url('p... |
Get the README for this repository. | def readme(self):
"""Get the README for this repository.
:returns: :class:`Contents <github3.repos.contents.Contents>`
"""
url = self._build_url('readme', base_url=self._api)
json = self._json(self._get(url), 200)
return Contents(json, self) if json else None |
Get a reference pointed to by ref. | def ref(self, ref):
"""Get a reference pointed to by ``ref``.
The most common will be branches and tags. For a branch, you must
specify 'heads/branchname' and for a tag, 'tags/tagname'. Essentially,
the system should return any reference you provide it in the namespace,
includin... |
Get a single release. | def release(self, id):
"""Get a single release.
:param int id: (required), id of release
:returns: :class:`Release <github3.repos.release.Release>`
"""
json = None
if int(id) > 0:
url = self._build_url('releases', str(id), base_url=self._api)
json... |
Remove collaborator login from the repository. | def remove_collaborator(self, login):
"""Remove collaborator ``login`` from the repository.
:param str login: (required), login name of the collaborator
:returns: bool
"""
resp = False
if login:
url = self._build_url('collaborators', login, base_url=self._api... |
Get an annotated tag. | def tag(self, sha):
"""Get an annotated tag.
http://learn.github.com/p/tagging.html
:param str sha: (required), sha of the object for this tag
:returns: :class:`Tag <github3.git.Tag>`
"""
json = None
if sha:
url = self._build_url('git', 'tags', sha, ... |
Get a tree. | def tree(self, sha):
"""Get a tree.
:param str sha: (required), sha of the object for this tree
:returns: :class:`Tree <github3.git.Tree>`
"""
json = None
if sha:
url = self._build_url('git', 'trees', sha, base_url=self._api)
json = self._json(sel... |
Update the label name. | def update_label(self, name, color, new_name=''):
"""Update the label ``name``.
:param str name: (required), name of the label
:param str color: (required), color code
:param str new_name: (optional), new name of the label
:returns: bool
"""
label = self.label(na... |
Returns the total commit counts. | def weekly_commit_count(self):
"""Returns the total commit counts.
The dictionary returned has two entries: ``all`` and ``owner``. Each
has a fifty-two element long list of commit counts. (Note: ``all``
includes the owner.) ``d['all'][0]`` will be the oldest week,
``d['all'][51]... |
Supply two names: Existing instance name or ID and new name to assign to the instance. | def rename(args):
"""Supply two names: Existing instance name or ID, and new name to assign to the instance."""
old_name, new_name = args.names
add_tags(resources.ec2.Instance(resolve_instance_id(old_name)), Name=new_name, dry_run=args.dry_run) |
Create a new deployment status for this deployment. | def create_status(self, state, target_url='', description=''):
"""Create a new deployment status for this deployment.
:param str state: (required), The state of the status. Can be one of
``pending``, ``success``, ``error``, or ``failure``.
:param str target_url: The target URL to as... |
Iterate over the deployment statuses for this deployment. | def iter_statuses(self, number=-1, etag=None):
"""Iterate over the deployment statuses for this deployment.
:param int number: (optional), the number of statuses to return.
Default: -1, returns all statuses.
:param str etag: (optional), the ETag header value from the last time
... |
Retrieve the gist at this version. | def get_gist(self):
"""Retrieve the gist at this version.
:returns: :class:`Gist <github3.gists.gist.Gist>`
"""
from .gist import Gist
json = self._json(self._get(self._api), 200)
return Gist(json, self) |
Update this reference. | def update(self, sha, force=False):
"""Update this reference.
:param str sha: (required), sha of the reference
:param bool force: (optional), force the update or not
:returns: bool
"""
data = {'sha': sha, 'force': force}
json = self._json(self._patch(self._api, ... |
Recurse into the tree. | def recurse(self):
"""Recurse into the tree.
:returns: :class:`Tree <Tree>`
"""
json = self._json(self._get(self._api, params={'recursive': '1'}),
200)
return Tree(json, self._session) if json else None |
Table pretty printer. Expects tables to be given as arrays of arrays:: | def format_table(table, column_names=None, column_specs=None, max_col_width=32, auto_col_width=False):
"""
Table pretty printer. Expects tables to be given as arrays of arrays::
print(format_table([[1, "2"], [3, "456"]], column_names=['A', 'B']))
"""
orig_col_args = dict(column_names=column_nam... |
Get an Aegea configuration parameter by name | def get(args):
"""Get an Aegea configuration parameter by name"""
from . import config
for key in args.key.split("."):
config = getattr(config, key)
print(json.dumps(config)) |
Set an Aegea configuration parameter to a given value | def set(args):
"""Set an Aegea configuration parameter to a given value"""
from . import config, tweak
class ConfigSaver(tweak.Config):
@property
def config_files(self):
return [config.config_files[2]]
config_saver = ConfigSaver(use_yaml=True, save_on_exit=False)
c = co... |
Obtain an authorization token for the GitHub API. | def authorize(login, password, scopes, note='', note_url='', client_id='',
client_secret='', two_factor_callback=None):
"""Obtain an authorization token for the GitHub API.
:param str login: (required)
:param str password: (required)
:param list scopes: (required), areas you want this tok... |
Construct and return an authenticated GitHub session. | def login(username=None, password=None, token=None, url=None,
two_factor_callback=None):
"""Construct and return an authenticated GitHub session.
This will return a GitHubEnterprise session if a url is provided.
:param str username: login name
:param str password: password for the login
... |
List the followers of username. | def iter_followers(username, number=-1, etag=None):
"""List the followers of ``username``.
:param str username: (required), login of the person to list the followers
of
:param int number: (optional), number of followers to return, Default: -1,
return all of them
:param str etag: (option... |
List the people username follows. | def iter_following(username, number=-1, etag=None):
"""List the people ``username`` follows.
:param str username: (required), login of the user
:param int number: (optional), number of users being followed by username
to return. Default: -1, return all of them
:param str etag: (optional), ETag ... |
List issues on owner/ repository. Only owner and repository are required. | def iter_repo_issues(owner, repository, milestone=None, state=None,
assignee=None, mentioned=None, labels=None, sort=None,
direction=None, since=None, number=-1, etag=None):
"""List issues on owner/repository. Only owner and repository are
required.
.. versionchang... |
List the organizations associated with username. | def iter_orgs(username, number=-1, etag=None):
"""List the organizations associated with ``username``.
:param str username: (required), login of the user
:param int number: (optional), number of orgs to return. Default: -1,
return all of the issues
:param str etag: (optional), ETag from a previ... |
List public repositories for the specified login. | def iter_user_repos(login, type=None, sort=None, direction=None, number=-1,
etag=None):
"""List public repositories for the specified ``login``.
.. versionadded:: 0.6
.. note:: This replaces github3.iter_repos
:param str login: (required)
:param str type: (optional), accepted ... |
Render an arbitrary markdown document. | def markdown(text, mode='', context='', raw=False):
"""Render an arbitrary markdown document.
:param str text: (required), the text of the document to render
:param str mode: (optional), 'markdown' or 'gfm'
:param str context: (optional), only important when using mode 'gfm',
this is the reposi... |
Find repositories via various criteria. | def search_repositories(query, sort=None, order=None, per_page=None,
text_match=False, number=-1, etag=None):
"""Find repositories via various criteria.
.. warning::
You will only be able to make 5 calls with this or other search
functions. To raise the rate-limit on th... |
Describe limits in effect on your AWS account. See also https:// console. aws. amazon. com/ ec2/ v2/ home#Limits: | def limits(args):
"""
Describe limits in effect on your AWS account. See also https://console.aws.amazon.com/ec2/v2/home#Limits:
"""
# https://aws.amazon.com/about-aws/whats-new/2014/06/19/amazon-ec2-service-limits-report-now-available/
# Console-only APIs: getInstanceLimits, getAccountLimits, getAu... |
Add labels to this issue. | def add_labels(self, *args):
"""Add labels to this issue.
:param str args: (required), names of the labels you wish to add
:returns: list of :class:`Label`\ s
"""
url = self._build_url('labels', base_url=self._api)
json = self._json(self._post(url, data=args), 200)
... |
Assigns user login to this issue. This is a short cut for issue. edit. | def assign(self, login):
"""Assigns user ``login`` to this issue. This is a short cut for
``issue.edit``.
:param str login: username of the person to assign this issue to
:returns: bool
"""
if not login:
return False
number = self.milestone.number if ... |
Get a single comment by its id. | def comment(self, id_num):
"""Get a single comment by its id.
The catch here is that id is NOT a simple number to obtain. If
you were to look at the comments on issue #15 in
sigmavirus24/Todo.txt-python, the first comment's id is 4150787.
:param int id_num: (required), comment ... |
Create a comment on this issue. | def create_comment(self, body):
"""Create a comment on this issue.
:param str body: (required), comment body
:returns: :class:`IssueComment <github3.issues.comment.IssueComment>`
"""
json = None
if body:
url = self._build_url('comments', base_url=self._api)
... |
Edit this issue. | def edit(self, title=None, body=None, assignee=None, state=None,
milestone=None, labels=None):
"""Edit this issue.
:param str title: Title of the issue
:param str body: markdown formatted body (description) of the issue
:param str assignee: login name of user the issue shou... |
Iterate over the comments on this issue. | def iter_comments(self, number=-1):
"""Iterate over the comments on this issue.
:param int number: (optional), number of comments to iterate over
:returns: iterator of
:class:`IssueComment <github3.issues.comment.IssueComment>`\ s
"""
url = self._build_url('comments'... |
Iterate over events associated with this issue only. | def iter_events(self, number=-1):
"""Iterate over events associated with this issue only.
:param int number: (optional), number of events to return. Default: -1
returns all events available.
:returns: generator of
:class:`IssueEvent <github3.issues.event.IssueEvent>`\ s
... |
Removes label name from this issue. | def remove_label(self, name):
"""Removes label ``name`` from this issue.
:param str name: (required), name of the label to remove
:returns: bool
"""
url = self._build_url('labels', name, base_url=self._api)
# Docs say it should be a list of strings returned, practice say... |
Replace all labels on this issue with labels. | def replace_labels(self, labels):
"""Replace all labels on this issue with ``labels``.
:param list labels: label names
:returns: bool
"""
url = self._build_url('labels', base_url=self._api)
json = self._json(self._put(url, data=dumps(labels)), 200)
return [Label(... |
Re - open a closed issue. | def reopen(self):
"""Re-open a closed issue.
:returns: bool
"""
assignee = self.assignee.login if self.assignee else ''
number = self.milestone.number if self.milestone else None
labels = [str(l) for l in self.labels]
return self.edit(self.title, self.body, assig... |
Convert an ISO 8601 formatted string in UTC into a timezone - aware datetime object. | def _strptime(self, time_str):
"""Convert an ISO 8601 formatted string in UTC into a
timezone-aware datetime object."""
if time_str:
# Parse UTC string into naive datetime, then add timezone
dt = datetime.strptime(time_str, __timeformat__)
return dt.replace(tz... |
Generic iterator for this project. | def _iter(self, count, url, cls, params=None, etag=None):
"""Generic iterator for this project.
:param int count: How many items to return.
:param int url: First URL to start with
:param class cls: cls to return an object of
:param params dict: (optional) Parameters for the requ... |
Number of requests before GitHub imposes a ratelimit. | def ratelimit_remaining(self):
"""Number of requests before GitHub imposes a ratelimit.
:returns: int
"""
json = self._json(self._get(self._github_url + '/rate_limit'), 200)
core = json.get('resources', {}).get('core', {})
self._remaining = core.get('remaining', 0)
... |
Re - retrieve the information for this object and returns the refreshed instance. | def refresh(self, conditional=False):
"""Re-retrieve the information for this object and returns the
refreshed instance.
:param bool conditional: If True, then we will search for a stored
header ('Last-Modified', or 'ETag') on the object and send that
as described in the... |
Edit this comment. | def edit(self, body):
"""Edit this comment.
:param str body: (required), new body of the comment, Markdown
formatted
:returns: bool
"""
if body:
json = self._json(self._patch(self._api,
data=dumps({'body': body})), 200)
... |
To plot formatter | def toplot(ts,
filename=None,
grid=True,
legend=True,
pargs=(),
**kwargs):
'''To plot formatter'''
fig = plt.figure()
ax = fig.add_subplot(111)
dates = list(ts.dates())
ax.plot(dates, ts.values(), *pargs)
ax.grid(grid)
# ro... |
Ensure the table is valid for converting to grid table. | def check_table(table):
"""
Ensure the table is valid for converting to grid table.
* The table must a list of lists
* Each row must contain the same number of columns
* The table must not be empty
Parameters
----------
table : list of lists of str
The list of rows of strings t... |
Gets the span containing the [ row column ] pair | def get_span(spans, row, column):
"""
Gets the span containing the [row, column] pair
Parameters
----------
spans : list of lists of lists
A list containing spans, which are lists of [row, column] pairs
that define where a span is inside a table.
Returns
-------
span : ... |
Search through a table and return the first [ row column ] pair who s value is None. | def find_unassigned_table_cell(table):
"""
Search through a table and return the first [row, column] pair
who's value is None.
Parameters
----------
table : list of lists of str
Returns
-------
list of int
The row column pair of the None type cell
"""
for row in ran... |
insert * values * at date * dte *. | def insert(self, dte, values):
'''insert *values* at date *dte*.'''
if len(values):
dte = self.dateconvert(dte)
if not self:
self._date = np.array([dte])
self._data = np.array([values])
else:
# search for the date
... |
Convert node names into node instances... | def _translate_nodes(root, *nodes):
"""
Convert node names into node instances...
"""
#name2node = {[n, None] for n in nodes if type(n) is str}
name2node = dict([[n, None] for n in nodes if type(n) is str])
for n in root.traverse():
if n.name in name2node:
if name2node[n.name... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.