repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
find_cache_directory
def find_cache_directory(remote): """ Find the directory where temporary local checkouts are to be stored. :returns: The absolute pathname of a directory (a string). """ return os.path.join('/var/cache/vcs-repo-mgr' if os.access('/var/cache', os.W_OK) else tempfile.gettempdir(), ...
python
def find_cache_directory(remote): """ Find the directory where temporary local checkouts are to be stored. :returns: The absolute pathname of a directory (a string). """ return os.path.join('/var/cache/vcs-repo-mgr' if os.access('/var/cache', os.W_OK) else tempfile.gettempdir(), ...
[ "def", "find_cache_directory", "(", "remote", ")", ":", "return", "os", ".", "path", ".", "join", "(", "'/var/cache/vcs-repo-mgr'", "if", "os", ".", "access", "(", "'/var/cache'", ",", "os", ".", "W_OK", ")", "else", "tempfile", ".", "gettempdir", "(", ")"...
Find the directory where temporary local checkouts are to be stored. :returns: The absolute pathname of a directory (a string).
[ "Find", "the", "directory", "where", "temporary", "local", "checkouts", "are", "to", "be", "stored", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L271-L278
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
find_configured_repository
def find_configured_repository(name): """ Find a version control repository defined by the user in a configuration file. :param name: The name of the repository (a string). :returns: A :class:`Repository` object. :raises: :exc:`~vcs_repo_mgr.exceptions.NoSuchRepositoryError` when the g...
python
def find_configured_repository(name): """ Find a version control repository defined by the user in a configuration file. :param name: The name of the repository (a string). :returns: A :class:`Repository` object. :raises: :exc:`~vcs_repo_mgr.exceptions.NoSuchRepositoryError` when the g...
[ "def", "find_configured_repository", "(", "name", ")", ":", "parser", "=", "configparser", ".", "RawConfigParser", "(", ")", "for", "config_file", "in", "[", "SYSTEM_CONFIG_FILE", ",", "USER_CONFIG_FILE", "]", ":", "config_file", "=", "parse_path", "(", "config_fi...
Find a version control repository defined by the user in a configuration file. :param name: The name of the repository (a string). :returns: A :class:`Repository` object. :raises: :exc:`~vcs_repo_mgr.exceptions.NoSuchRepositoryError` when the given repository name doesn't match any of the conf...
[ "Find", "a", "version", "control", "repository", "defined", "by", "the", "user", "in", "a", "configuration", "file", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L281-L351
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
repository_factory
def repository_factory(vcs_type, **kw): """ Instantiate a :class:`Repository` object based on the given type and arguments. :param vcs_type: One of the strings 'bazaar', 'bzr', 'git', 'hg' or 'mercurial' or a subclass of :class:`Repository`. :param kw: The keyword arguments to :fun...
python
def repository_factory(vcs_type, **kw): """ Instantiate a :class:`Repository` object based on the given type and arguments. :param vcs_type: One of the strings 'bazaar', 'bzr', 'git', 'hg' or 'mercurial' or a subclass of :class:`Repository`. :param kw: The keyword arguments to :fun...
[ "def", "repository_factory", "(", "vcs_type", ",", "*", "*", "kw", ")", ":", "# Resolve VCS aliases to Repository subclasses.", "if", "isinstance", "(", "vcs_type", ",", "string_types", ")", ":", "vcs_type", "=", "vcs_type", ".", "lower", "(", ")", "for", "cls",...
Instantiate a :class:`Repository` object based on the given type and arguments. :param vcs_type: One of the strings 'bazaar', 'bzr', 'git', 'hg' or 'mercurial' or a subclass of :class:`Repository`. :param kw: The keyword arguments to :func:`Repository.__init__()`. :returns: A :class:`R...
[ "Instantiate", "a", ":", "class", ":", "Repository", "object", "based", "on", "the", "given", "type", "and", "arguments", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L386-L415
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
sum_revision_numbers
def sum_revision_numbers(arguments): """ Sum revision numbers of multiple repository/revision pairs. :param arguments: A list of strings with repository names and revision strings. :returns: A single integer containing the summed revision numbers. This is useful when you're b...
python
def sum_revision_numbers(arguments): """ Sum revision numbers of multiple repository/revision pairs. :param arguments: A list of strings with repository names and revision strings. :returns: A single integer containing the summed revision numbers. This is useful when you're b...
[ "def", "sum_revision_numbers", "(", "arguments", ")", ":", "arguments", "=", "list", "(", "arguments", ")", "if", "len", "(", "arguments", ")", "%", "2", "!=", "0", ":", "raise", "ValueError", "(", "\"Please provide an even number of arguments! (one or more reposito...
Sum revision numbers of multiple repository/revision pairs. :param arguments: A list of strings with repository names and revision strings. :returns: A single integer containing the summed revision numbers. This is useful when you're building a package based on revisions from mul...
[ "Sum", "revision", "numbers", "of", "multiple", "repository", "/", "revision", "pairs", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L418-L438
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
FeatureBranchSpec.location
def location(self): """The location of the repository that contains :attr:`revision` (a string or :data:`None`).""" location, _, revision = self.expression.partition('#') return location if location and revision else None
python
def location(self): """The location of the repository that contains :attr:`revision` (a string or :data:`None`).""" location, _, revision = self.expression.partition('#') return location if location and revision else None
[ "def", "location", "(", "self", ")", ":", "location", ",", "_", ",", "revision", "=", "self", ".", "expression", ".", "partition", "(", "'#'", ")", "return", "location", "if", "location", "and", "revision", "else", "None" ]
The location of the repository that contains :attr:`revision` (a string or :data:`None`).
[ "The", "location", "of", "the", "repository", "that", "contains", ":", "attr", ":", "revision", "(", "a", "string", "or", ":", "data", ":", "None", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L517-L520
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
FeatureBranchSpec.revision
def revision(self): """The name of the feature branch (a string).""" location, _, revision = self.expression.partition('#') return revision if location and revision else self.expression
python
def revision(self): """The name of the feature branch (a string).""" location, _, revision = self.expression.partition('#') return revision if location and revision else self.expression
[ "def", "revision", "(", "self", ")", ":", "location", ",", "_", ",", "revision", "=", "self", ".", "expression", ".", "partition", "(", "'#'", ")", "return", "revision", "if", "location", "and", "revision", "else", "self", ".", "expression" ]
The name of the feature branch (a string).
[ "The", "name", "of", "the", "feature", "branch", "(", "a", "string", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L523-L526
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.contains_repository
def contains_repository(cls, context, directory): """ Check whether the given directory contains a local repository. :param directory: The pathname of a directory (a string). :returns: :data:`True` if the directory contains a local repository, :data:`False` otherwise. ...
python
def contains_repository(cls, context, directory): """ Check whether the given directory contains a local repository. :param directory: The pathname of a directory (a string). :returns: :data:`True` if the directory contains a local repository, :data:`False` otherwise. ...
[ "def", "contains_repository", "(", "cls", ",", "context", ",", "directory", ")", ":", "return", "context", ".", "is_directory", "(", "cls", ".", "get_vcs_directory", "(", "context", ",", "directory", ")", ")" ]
Check whether the given directory contains a local repository. :param directory: The pathname of a directory (a string). :returns: :data:`True` if the directory contains a local repository, :data:`False` otherwise. By default :func:`contains_repository()` just checks whether ...
[ "Check", "whether", "the", "given", "directory", "contains", "a", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L557-L570
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.branches
def branches(self): """ A dictionary that maps branch names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote...
python
def branches(self): """ A dictionary that maps branch names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote...
[ "def", "branches", "(", "self", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Create a mapping of branch names to revisions.", "return", "dict", "(", "(", "r", ".", "branch", ",", "r", ")", "for", "r", "in", "self", "....
A dictionary that maps branch names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote='https://github.com/git/git.git') ...
[ "A", "dictionary", "that", "maps", "branch", "names", "to", ":", "class", ":", "Revision", "objects", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L647-L666
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.last_updated
def last_updated(self): """ The date and time when `vcs-repo-mgr` last checked for updates (an integer). Used internally by :func:`pull()` when used in combination with :class:`limit_vcs_updates`. The value is a UNIX time stamp (0 for remote repositories that don't have a local ...
python
def last_updated(self): """ The date and time when `vcs-repo-mgr` last checked for updates (an integer). Used internally by :func:`pull()` when used in combination with :class:`limit_vcs_updates`. The value is a UNIX time stamp (0 for remote repositories that don't have a local ...
[ "def", "last_updated", "(", "self", ")", ":", "try", ":", "if", "self", ".", "context", ".", "exists", "(", "self", ".", "last_updated_file", ")", ":", "return", "int", "(", "self", ".", "context", ".", "read_file", "(", "self", ".", "last_updated_file",...
The date and time when `vcs-repo-mgr` last checked for updates (an integer). Used internally by :func:`pull()` when used in combination with :class:`limit_vcs_updates`. The value is a UNIX time stamp (0 for remote repositories that don't have a local clone yet).
[ "The", "date", "and", "time", "when", "vcs", "-", "repo", "-", "mgr", "last", "checked", "for", "updates", "(", "an", "integer", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L752-L765
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.release_branches
def release_branches(self): """A dictionary that maps branch names to :class:`Release` objects.""" self.ensure_release_scheme('branches') return dict((r.revision.branch, r) for r in self.releases.values())
python
def release_branches(self): """A dictionary that maps branch names to :class:`Release` objects.""" self.ensure_release_scheme('branches') return dict((r.revision.branch, r) for r in self.releases.values())
[ "def", "release_branches", "(", "self", ")", ":", "self", ".", "ensure_release_scheme", "(", "'branches'", ")", "return", "dict", "(", "(", "r", ".", "revision", ".", "branch", ",", "r", ")", "for", "r", "in", "self", ".", "releases", ".", "values", "(...
A dictionary that maps branch names to :class:`Release` objects.
[ "A", "dictionary", "that", "maps", "branch", "names", "to", ":", "class", ":", "Release", "objects", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L824-L827
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.release_filter
def release_filter(self, value): """Validate the release filter.""" compiled_pattern = coerce_pattern(value) if compiled_pattern.groups > 1: raise ValueError(compact(""" Release filter regular expression pattern is expected to have zero or one capture ...
python
def release_filter(self, value): """Validate the release filter.""" compiled_pattern = coerce_pattern(value) if compiled_pattern.groups > 1: raise ValueError(compact(""" Release filter regular expression pattern is expected to have zero or one capture ...
[ "def", "release_filter", "(", "self", ",", "value", ")", ":", "compiled_pattern", "=", "coerce_pattern", "(", "value", ")", "if", "compiled_pattern", ".", "groups", ">", "1", ":", "raise", "ValueError", "(", "compact", "(", "\"\"\"\n Release filter ...
Validate the release filter.
[ "Validate", "the", "release", "filter", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L846-L855
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.release_scheme
def release_scheme(self, value): """Validate the release scheme.""" if value not in KNOWN_RELEASE_SCHEMES: msg = "Release scheme %r is not supported! (valid options are %s)" raise ValueError(msg % (value, concatenate(map(repr, KNOWN_RELEASE_SCHEMES)))) set_property(self, ...
python
def release_scheme(self, value): """Validate the release scheme.""" if value not in KNOWN_RELEASE_SCHEMES: msg = "Release scheme %r is not supported! (valid options are %s)" raise ValueError(msg % (value, concatenate(map(repr, KNOWN_RELEASE_SCHEMES)))) set_property(self, ...
[ "def", "release_scheme", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "KNOWN_RELEASE_SCHEMES", ":", "msg", "=", "\"Release scheme %r is not supported! (valid options are %s)\"", "raise", "ValueError", "(", "msg", "%", "(", "value", ",", "concaten...
Validate the release scheme.
[ "Validate", "the", "release", "scheme", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L871-L876
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.releases
def releases(self): r""" A dictionary that maps release identifiers to :class:`Release` objects. Here's an example based on a mirror of the git project's repository which shows the last ten releases based on tags, where each release identifier captures a tag without its 'v' pref...
python
def releases(self): r""" A dictionary that maps release identifiers to :class:`Release` objects. Here's an example based on a mirror of the git project's repository which shows the last ten releases based on tags, where each release identifier captures a tag without its 'v' pref...
[ "def", "releases", "(", "self", ")", ":", "available_releases", "=", "{", "}", "available_revisions", "=", "getattr", "(", "self", ",", "self", ".", "release_scheme", ")", "for", "identifier", ",", "revision", "in", "available_revisions", ".", "items", "(", ...
r""" A dictionary that maps release identifiers to :class:`Release` objects. Here's an example based on a mirror of the git project's repository which shows the last ten releases based on tags, where each release identifier captures a tag without its 'v' prefix: >>> from pprint...
[ "r", "A", "dictionary", "that", "maps", "release", "identifiers", "to", ":", "class", ":", "Release", "objects", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L879-L919
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.tags
def tags(self): """ A dictionary that maps tag names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote='https...
python
def tags(self): """ A dictionary that maps tag names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote='https...
[ "def", "tags", "(", "self", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Create a mapping of tag names to revisions.", "return", "dict", "(", "(", "r", ".", "tag", ",", "r", ")", "for", "r", "in", "self", ".", "find...
A dictionary that maps tag names to :class:`Revision` objects. Here's an example based on a mirror of the git project's repository: >>> from pprint import pprint >>> from vcs_repo_mgr.backends.git import GitRepo >>> repository = GitRepo(remote='https://github.com/git/git.git') ...
[ "A", "dictionary", "that", "maps", "tag", "names", "to", ":", "class", ":", "Revision", "objects", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L935-L968
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.add_files
def add_files(self, *filenames, **kw): """ Include added and/or removed files in the working tree in the next commit. :param filenames: The filenames of the files to include in the next commit (zero or more strings). If no arguments are given ...
python
def add_files(self, *filenames, **kw): """ Include added and/or removed files in the working tree in the next commit. :param filenames: The filenames of the files to include in the next commit (zero or more strings). If no arguments are given ...
[ "def", "add_files", "(", "self", ",", "*", "filenames", ",", "*", "*", "kw", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "create", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "# Include added and/or remove...
Include added and/or removed files in the working tree in the next commit. :param filenames: The filenames of the files to include in the next commit (zero or more strings). If no arguments are given all untracked files are added. :param kw: Keyword a...
[ "Include", "added", "and", "/", "or", "removed", "files", "in", "the", "working", "tree", "in", "the", "next", "commit", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1019-L1036
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.checkout
def checkout(self, revision=None, clean=False): """ Update the working tree of the local repository to the specified revision. :param revision: The revision to check out (a string, defaults to :attr:`default_revision`). :param clean: :data:`True` to discard chan...
python
def checkout(self, revision=None, clean=False): """ Update the working tree of the local repository to the specified revision. :param revision: The revision to check out (a string, defaults to :attr:`default_revision`). :param clean: :data:`True` to discard chan...
[ "def", "checkout", "(", "self", ",", "revision", "=", "None", ",", "clean", "=", "False", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "create", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "# Update the w...
Update the working tree of the local repository to the specified revision. :param revision: The revision to check out (a string, defaults to :attr:`default_revision`). :param clean: :data:`True` to discard changes in the working tree, :data:`False` otherwi...
[ "Update", "the", "working", "tree", "of", "the", "local", "repository", "to", "the", "specified", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1038-L1053
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.commit
def commit(self, message, author=None): """ Commit changes to tracked files in the working tree. :param message: The commit message (a string). :param author: Override :attr:`author` (refer to :func:`coerce_author()` for details on argument ...
python
def commit(self, message, author=None): """ Commit changes to tracked files in the working tree. :param message: The commit message (a string). :param author: Override :attr:`author` (refer to :func:`coerce_author()` for details on argument ...
[ "def", "commit", "(", "self", ",", "message", ",", "author", "=", "None", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "ensure_exists", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "logger", ".", "info", ...
Commit changes to tracked files in the working tree. :param message: The commit message (a string). :param author: Override :attr:`author` (refer to :func:`coerce_author()` for details on argument handling).
[ "Commit", "changes", "to", "tracked", "files", "in", "the", "working", "tree", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1055-L1069
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.create
def create(self): """ Create the local repository (if it doesn't already exist). :returns: :data:`True` if the local repository was just created, :data:`False` if it already existed. What :func:`create()` does depends on the situation: - When :attr:`exists` i...
python
def create(self): """ Create the local repository (if it doesn't already exist). :returns: :data:`True` if the local repository was just created, :data:`False` if it already existed. What :func:`create()` does depends on the situation: - When :attr:`exists` i...
[ "def", "create", "(", "self", ")", ":", "if", "self", ".", "exists", ":", "logger", ".", "debug", "(", "\"Local %s repository (%s) already exists, ignoring request to create it.\"", ",", "self", ".", "friendly_name", ",", "format_path", "(", "self", ".", "local", ...
Create the local repository (if it doesn't already exist). :returns: :data:`True` if the local repository was just created, :data:`False` if it already existed. What :func:`create()` does depends on the situation: - When :attr:`exists` is :data:`True` nothing is done. ...
[ "Create", "the", "local", "repository", "(", "if", "it", "doesn", "t", "already", "exist", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1071-L1111
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.create_branch
def create_branch(self, branch_name): """ Create a new branch based on the working tree's revision. :param branch_name: The name of the branch to create (a string). This method automatically checks out the new branch, but note that the new branch may not actually exist until a ...
python
def create_branch(self, branch_name): """ Create a new branch based on the working tree's revision. :param branch_name: The name of the branch to create (a string). This method automatically checks out the new branch, but note that the new branch may not actually exist until a ...
[ "def", "create_branch", "(", "self", ",", "branch_name", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "create", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "# Create the new branch in the local repository.", "logge...
Create a new branch based on the working tree's revision. :param branch_name: The name of the branch to create (a string). This method automatically checks out the new branch, but note that the new branch may not actually exist until a commit has been made on the branch.
[ "Create", "a", "new", "branch", "based", "on", "the", "working", "tree", "s", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1113-L1128
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.create_release_branch
def create_release_branch(self, branch_name): """ Create a new release branch. :param branch_name: The name of the release branch to create (a string). :raises: The following exceptions can be raised: - :exc:`~exceptions.TypeError` when :attr:`release_scheme` ...
python
def create_release_branch(self, branch_name): """ Create a new release branch. :param branch_name: The name of the release branch to create (a string). :raises: The following exceptions can be raised: - :exc:`~exceptions.TypeError` when :attr:`release_scheme` ...
[ "def", "create_release_branch", "(", "self", ",", "branch_name", ")", ":", "# Validate the release scheme.", "self", ".", "ensure_release_scheme", "(", "'branches'", ")", "# Validate the name of the release branch.", "if", "self", ".", "compiled_filter", ".", "match", "("...
Create a new release branch. :param branch_name: The name of the release branch to create (a string). :raises: The following exceptions can be raised: - :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't set to 'branches'. - :exc:`~ex...
[ "Create", "a", "new", "release", "branch", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1130-L1163
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.create_tag
def create_tag(self, tag_name): """ Create a new tag based on the working tree's revision. :param tag_name: The name of the tag to create (a string). """ # Make sure the local repository exists and supports a working tree. self.create() self.ensure_working_tree()...
python
def create_tag(self, tag_name): """ Create a new tag based on the working tree's revision. :param tag_name: The name of the tag to create (a string). """ # Make sure the local repository exists and supports a working tree. self.create() self.ensure_working_tree()...
[ "def", "create_tag", "(", "self", ",", "tag_name", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "create", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "# Create the new tag in the local repository.", "logger", "."...
Create a new tag based on the working tree's revision. :param tag_name: The name of the tag to create (a string).
[ "Create", "a", "new", "tag", "based", "on", "the", "working", "tree", "s", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1165-L1176
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.delete_branch
def delete_branch(self, branch_name, message=None, author=None): """ Delete or close a branch in the local repository. :param branch_name: The name of the branch to delete or close (a string). :param message: The message to use when closing the branch requires a ...
python
def delete_branch(self, branch_name, message=None, author=None): """ Delete or close a branch in the local repository. :param branch_name: The name of the branch to delete or close (a string). :param message: The message to use when closing the branch requires a ...
[ "def", "delete_branch", "(", "self", ",", "branch_name", ",", "message", "=", "None", ",", "author", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Delete the branch in the local repository.", "logger", ".", "i...
Delete or close a branch in the local repository. :param branch_name: The name of the branch to delete or close (a string). :param message: The message to use when closing the branch requires a commit (a string or :data:`None`, defaults to the string "Clo...
[ "Delete", "or", "close", "a", "branch", "in", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1178-L1198
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.ensure_clean
def ensure_clean(self): """ Make sure the working tree is clean (contains no changes to tracked files). :raises: :exc:`~vcs_repo_mgr.exceptions.WorkingTreeNotCleanError` when the working tree contains changes to tracked files. """ if not self.is_clean: ...
python
def ensure_clean(self): """ Make sure the working tree is clean (contains no changes to tracked files). :raises: :exc:`~vcs_repo_mgr.exceptions.WorkingTreeNotCleanError` when the working tree contains changes to tracked files. """ if not self.is_clean: ...
[ "def", "ensure_clean", "(", "self", ")", ":", "if", "not", "self", ".", "is_clean", ":", "raise", "WorkingTreeNotCleanError", "(", "compact", "(", "\"\"\"\n The repository's local working tree ({local})\n contains changes to tracked files!\n ...
Make sure the working tree is clean (contains no changes to tracked files). :raises: :exc:`~vcs_repo_mgr.exceptions.WorkingTreeNotCleanError` when the working tree contains changes to tracked files.
[ "Make", "sure", "the", "working", "tree", "is", "clean", "(", "contains", "no", "changes", "to", "tracked", "files", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1200-L1211
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.ensure_exists
def ensure_exists(self): """ Make sure the local repository exists. :raises: :exc:`~exceptions.ValueError` when the local repository doesn't exist yet. """ if not self.exists: msg = "The local %s repository %s doesn't exist!" raise ValueE...
python
def ensure_exists(self): """ Make sure the local repository exists. :raises: :exc:`~exceptions.ValueError` when the local repository doesn't exist yet. """ if not self.exists: msg = "The local %s repository %s doesn't exist!" raise ValueE...
[ "def", "ensure_exists", "(", "self", ")", ":", "if", "not", "self", ".", "exists", ":", "msg", "=", "\"The local %s repository %s doesn't exist!\"", "raise", "ValueError", "(", "msg", "%", "(", "self", ".", "friendly_name", ",", "format_path", "(", "self", "."...
Make sure the local repository exists. :raises: :exc:`~exceptions.ValueError` when the local repository doesn't exist yet.
[ "Make", "sure", "the", "local", "repository", "exists", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1213-L1222
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.ensure_hexadecimal_string
def ensure_hexadecimal_string(self, value, command=None): """ Make sure the given value is a hexadecimal string. :param value: The value to check (a string). :param command: The command that produced the value (a string or :data:`None`). :returns: The validated hexadecimal strin...
python
def ensure_hexadecimal_string(self, value, command=None): """ Make sure the given value is a hexadecimal string. :param value: The value to check (a string). :param command: The command that produced the value (a string or :data:`None`). :returns: The validated hexadecimal strin...
[ "def", "ensure_hexadecimal_string", "(", "self", ",", "value", ",", "command", "=", "None", ")", ":", "if", "not", "HEX_PATTERN", ".", "match", "(", "value", ")", ":", "msg", "=", "\"Expected a hexadecimal string, got '%s' instead!\"", "if", "command", ":", "msg...
Make sure the given value is a hexadecimal string. :param value: The value to check (a string). :param command: The command that produced the value (a string or :data:`None`). :returns: The validated hexadecimal string. :raises: :exc:`~exceptions.ValueError` when `value` is not a hexade...
[ "Make", "sure", "the", "given", "value", "is", "a", "hexadecimal", "string", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1224-L1241
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.ensure_release_scheme
def ensure_release_scheme(self, expected_scheme): """ Make sure the release scheme is correctly configured. :param expected_scheme: The expected release scheme (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` doesn't match the expected relea...
python
def ensure_release_scheme(self, expected_scheme): """ Make sure the release scheme is correctly configured. :param expected_scheme: The expected release scheme (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` doesn't match the expected relea...
[ "def", "ensure_release_scheme", "(", "self", ",", "expected_scheme", ")", ":", "if", "self", ".", "release_scheme", "!=", "expected_scheme", ":", "msg", "=", "\"Repository isn't using '%s' release scheme!\"", "raise", "TypeError", "(", "msg", "%", "expected_scheme", "...
Make sure the release scheme is correctly configured. :param expected_scheme: The expected release scheme (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` doesn't match the expected release scheme.
[ "Make", "sure", "the", "release", "scheme", "is", "correctly", "configured", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1243-L1253
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.ensure_working_tree
def ensure_working_tree(self): """ Make sure the local repository has working tree support. :raises: :exc:`~vcs_repo_mgr.exceptions.MissingWorkingTreeError` when the local repository doesn't support a working tree. """ if not self.supports_working_tree: ...
python
def ensure_working_tree(self): """ Make sure the local repository has working tree support. :raises: :exc:`~vcs_repo_mgr.exceptions.MissingWorkingTreeError` when the local repository doesn't support a working tree. """ if not self.supports_working_tree: ...
[ "def", "ensure_working_tree", "(", "self", ")", ":", "if", "not", "self", ".", "supports_working_tree", ":", "raise", "MissingWorkingTreeError", "(", "compact", "(", "\"\"\"\n A working tree is required but the local {friendly_name}\n repository at {di...
Make sure the local repository has working tree support. :raises: :exc:`~vcs_repo_mgr.exceptions.MissingWorkingTreeError` when the local repository doesn't support a working tree.
[ "Make", "sure", "the", "local", "repository", "has", "working", "tree", "support", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1255-L1266
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.export
def export(self, directory, revision=None): """ Export the complete tree from the local version control repository. :param directory: The directory where the tree should be exported (a string). :param revision: The revision to export (a string or :data:`None`, ...
python
def export(self, directory, revision=None): """ Export the complete tree from the local version control repository. :param directory: The directory where the tree should be exported (a string). :param revision: The revision to export (a string or :data:`None`, ...
[ "def", "export", "(", "self", ",", "directory", ",", "revision", "=", "None", ")", ":", "# Make sure we're dealing with an absolute pathname (because a relative", "# pathname would be interpreted as relative to the repository's main", "# directory, which isn't necessarily what the caller...
Export the complete tree from the local version control repository. :param directory: The directory where the tree should be exported (a string). :param revision: The revision to export (a string or :data:`None`, defaults to :attr:`default_revision`).
[ "Export", "the", "complete", "tree", "from", "the", "local", "version", "control", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1268-L1289
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.find_remote
def find_remote(self, default=False, name=None, role=None): """ Find a remote repository connected to the local repository. :param default: :data:`True` to only look for default remotes, :data:`False` otherwise. :param name: The name of the remote to look for ...
python
def find_remote(self, default=False, name=None, role=None): """ Find a remote repository connected to the local repository. :param default: :data:`True` to only look for default remotes, :data:`False` otherwise. :param name: The name of the remote to look for ...
[ "def", "find_remote", "(", "self", ",", "default", "=", "False", ",", "name", "=", "None", ",", "role", "=", "None", ")", ":", "for", "remote", "in", "self", ".", "known_remotes", ":", "if", "(", "(", "remote", ".", "default", "if", "default", "else"...
Find a remote repository connected to the local repository. :param default: :data:`True` to only look for default remotes, :data:`False` otherwise. :param name: The name of the remote to look for (a string or :data:`None`). :param role: A role that t...
[ "Find", "a", "remote", "repository", "connected", "to", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1323-L1339
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.generate_control_field
def generate_control_field(self, revision=None): """ Generate a Debian control file field referring for this repository and revision. :param revision: A reference to a revision, most likely the name of a branch (a string, defaults to :attr:`default_revision`). :...
python
def generate_control_field(self, revision=None): """ Generate a Debian control file field referring for this repository and revision. :param revision: A reference to a revision, most likely the name of a branch (a string, defaults to :attr:`default_revision`). :...
[ "def", "generate_control_field", "(", "self", ",", "revision", "=", "None", ")", ":", "value", "=", "\"%s#%s\"", "%", "(", "self", ".", "remote", "or", "self", ".", "local", ",", "self", ".", "find_revision_id", "(", "revision", ")", ")", "return", "self...
Generate a Debian control file field referring for this repository and revision. :param revision: A reference to a revision, most likely the name of a branch (a string, defaults to :attr:`default_revision`). :returns: A tuple with two strings: The name of the field and the valu...
[ "Generate", "a", "Debian", "control", "file", "field", "referring", "for", "this", "repository", "and", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1372-L1391
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.interactive_merge_conflict_handler
def interactive_merge_conflict_handler(self, exception): """ Give the operator a chance to interactively resolve merge conflicts. :param exception: An :exc:`~executor.ExternalCommandFailed` object. :returns: :data:`True` if the operator has interactively resolved any m...
python
def interactive_merge_conflict_handler(self, exception): """ Give the operator a chance to interactively resolve merge conflicts. :param exception: An :exc:`~executor.ExternalCommandFailed` object. :returns: :data:`True` if the operator has interactively resolved any m...
[ "def", "interactive_merge_conflict_handler", "(", "self", ",", "exception", ")", ":", "if", "connected_to_terminal", "(", "sys", ".", "stdin", ")", ":", "logger", ".", "info", "(", "compact", "(", "\"\"\"\n It seems that I'm connected to a terminal so I'll ...
Give the operator a chance to interactively resolve merge conflicts. :param exception: An :exc:`~executor.ExternalCommandFailed` object. :returns: :data:`True` if the operator has interactively resolved any merge conflicts (and as such the merge error doesn't need to ...
[ "Give", "the", "operator", "a", "chance", "to", "interactively", "resolve", "merge", "conflicts", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1532-L1568
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.is_feature_branch
def is_feature_branch(self, branch_name): """ Try to determine whether a branch name refers to a feature branch. :param branch_name: The name of a branch (a string). :returns: :data:`True` if the branch name appears to refer to a feature branch, :data:`False` otherwise...
python
def is_feature_branch(self, branch_name): """ Try to determine whether a branch name refers to a feature branch. :param branch_name: The name of a branch (a string). :returns: :data:`True` if the branch name appears to refer to a feature branch, :data:`False` otherwise...
[ "def", "is_feature_branch", "(", "self", ",", "branch_name", ")", ":", "# The following checks are intentionally ordered from lightweight to heavyweight.", "if", "branch_name", "==", "self", ".", "default_revision", ":", "# The default branch is never a feature branch.", "return", ...
Try to determine whether a branch name refers to a feature branch. :param branch_name: The name of a branch (a string). :returns: :data:`True` if the branch name appears to refer to a feature branch, :data:`False` otherwise. This method is used by :func:`merge_up()` to determ...
[ "Try", "to", "determine", "whether", "a", "branch", "name", "refers", "to", "a", "feature", "branch", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1570-L1597
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.merge
def merge(self, revision=None): """ Merge a revision into the current branch (without committing the result). :param revision: The revision to merge in (a string or :data:`None`, defaults to :attr:`default_revision`). :raises: The following exceptions can be rai...
python
def merge(self, revision=None): """ Merge a revision into the current branch (without committing the result). :param revision: The revision to merge in (a string or :data:`None`, defaults to :attr:`default_revision`). :raises: The following exceptions can be rai...
[ "def", "merge", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists and supports a working tree.", "self", ".", "create", "(", ")", "self", ".", "ensure_working_tree", "(", ")", "# Merge the specified revision into the current branc...
Merge a revision into the current branch (without committing the result). :param revision: The revision to merge in (a string or :data:`None`, defaults to :attr:`default_revision`). :raises: The following exceptions can be raised: - :exc:`~vcs_repo_mgr.excepti...
[ "Merge", "a", "revision", "into", "the", "current", "branch", "(", "without", "committing", "the", "result", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1603-L1647
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.merge_up
def merge_up(self, target_branch=None, feature_branch=None, delete=True, create=True): """ Merge a change into one or more release branches and the default branch. :param target_branch: The name of the release branch where merging of the feature branch starts (a st...
python
def merge_up(self, target_branch=None, feature_branch=None, delete=True, create=True): """ Merge a change into one or more release branches and the default branch. :param target_branch: The name of the release branch where merging of the feature branch starts (a st...
[ "def", "merge_up", "(", "self", ",", "target_branch", "=", "None", ",", "feature_branch", "=", "None", ",", "delete", "=", "True", ",", "create", "=", "True", ")", ":", "timer", "=", "Timer", "(", ")", "repository_was_created", "=", "self", ".", "create"...
Merge a change into one or more release branches and the default branch. :param target_branch: The name of the release branch where merging of the feature branch starts (a string or :data:`None`, defaults to :attr:`curren...
[ "Merge", "a", "change", "into", "one", "or", "more", "release", "branches", "and", "the", "default", "branch", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1654-L1763
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.pull
def pull(self, remote=None, revision=None): """ Pull changes from a remote repository into the local repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to pull (a string or :data:`None`). If used in co...
python
def pull(self, remote=None, revision=None): """ Pull changes from a remote repository into the local repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to pull (a string or :data:`None`). If used in co...
[ "def", "pull", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "remote", "=", "remote", "or", "self", ".", "remote", "# Make sure the local repository exists.", "if", "self", ".", "create", "(", ")", "and", "(", "remote", ...
Pull changes from a remote repository into the local repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to pull (a string or :data:`None`). If used in combination with :class:`limit_vcs_updates` this won't per...
[ "Pull", "changes", "from", "a", "remote", "repository", "into", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1765-L1797
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.push
def push(self, remote=None, revision=None): """ Push changes from the local repository to a remote repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to push (a string or :data:`None`). .. warning:: De...
python
def push(self, remote=None, revision=None): """ Push changes from the local repository to a remote repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to push (a string or :data:`None`). .. warning:: De...
[ "def", "push", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "ensure_exists", "(", ")", "# Make sure there is a remote repository to push to.", "if", "not", "(", "remote", "o...
Push changes from the local repository to a remote repository. :param remote: The location of a remote repository (a string or :data:`None`). :param revision: A specific revision to push (a string or :data:`None`). .. warning:: Depending on the version control backend the push command ...
[ "Push", "changes", "from", "the", "local", "repository", "to", "a", "remote", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1799-L1823
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.release_to_branch
def release_to_branch(self, release_id): """ Shortcut to translate a release identifier to a branch name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A branch name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't...
python
def release_to_branch(self, release_id): """ Shortcut to translate a release identifier to a branch name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A branch name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't...
[ "def", "release_to_branch", "(", "self", ",", "release_id", ")", ":", "self", ".", "ensure_release_scheme", "(", "'branches'", ")", "return", "self", ".", "releases", "[", "release_id", "]", ".", "revision", ".", "branch" ]
Shortcut to translate a release identifier to a branch name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A branch name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't 'branches'.
[ "Shortcut", "to", "translate", "a", "release", "identifier", "to", "a", "branch", "name", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1825-L1835
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.release_to_tag
def release_to_tag(self, release_id): """ Shortcut to translate a release identifier to a tag name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A tag name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't ...
python
def release_to_tag(self, release_id): """ Shortcut to translate a release identifier to a tag name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A tag name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't ...
[ "def", "release_to_tag", "(", "self", ",", "release_id", ")", ":", "self", ".", "ensure_release_scheme", "(", "'tags'", ")", "return", "self", ".", "releases", "[", "release_id", "]", ".", "revision", ".", "tag" ]
Shortcut to translate a release identifier to a tag name. :param release_id: A :attr:`Release.identifier` value (a string). :returns: A tag name (a string). :raises: :exc:`~exceptions.TypeError` when :attr:`release_scheme` isn't 'tags'.
[ "Shortcut", "to", "translate", "a", "release", "identifier", "to", "a", "tag", "name", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1837-L1847
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.select_release
def select_release(self, highest_allowed_release): """ Select the newest release that is not newer than the given release. :param highest_allowed_release: The identifier of the release that sets the upper bound for the selection (a ...
python
def select_release(self, highest_allowed_release): """ Select the newest release that is not newer than the given release. :param highest_allowed_release: The identifier of the release that sets the upper bound for the selection (a ...
[ "def", "select_release", "(", "self", ",", "highest_allowed_release", ")", ":", "matching_releases", "=", "[", "]", "highest_allowed_key", "=", "natsort_key", "(", "highest_allowed_release", ")", "for", "release", "in", "self", ".", "ordered_releases", ":", "release...
Select the newest release that is not newer than the given release. :param highest_allowed_release: The identifier of the release that sets the upper bound for the selection (a string). :returns: The identifier of the selec...
[ "Select", "the", "newest", "release", "that", "is", "not", "newer", "than", "the", "given", "release", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1849-L1869
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
Repository.update_context
def update_context(self): """ Try to ensure that external commands are executed in the local repository. What :func:`update_context()` does depends on whether the directory given by :attr:`local` exists: - If :attr:`local` exists then the working directory of :attr:`context` ...
python
def update_context(self): """ Try to ensure that external commands are executed in the local repository. What :func:`update_context()` does depends on whether the directory given by :attr:`local` exists: - If :attr:`local` exists then the working directory of :attr:`context` ...
[ "def", "update_context", "(", "self", ")", ":", "if", "self", ".", "context", ".", "is_directory", "(", "self", ".", "local", ")", ":", "# Set the working directory of the execution context", "# to the directory containing the local repository.", "self", ".", "context", ...
Try to ensure that external commands are executed in the local repository. What :func:`update_context()` does depends on whether the directory given by :attr:`local` exists: - If :attr:`local` exists then the working directory of :attr:`context` will be set to :attr:`local`. This is ...
[ "Try", "to", "ensure", "that", "external", "commands", "are", "executed", "in", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1875-L1896
jbaiter/hidapi-cffi
hidapi.py
enumerate
def enumerate(vendor_id=0, product_id=0): """ Enumerate the HID Devices. Returns a generator that yields all of the HID devices attached to the system. :param vendor_id: Only return devices which match this vendor id :type vendor_id: int :param product_id: Only return devices which match...
python
def enumerate(vendor_id=0, product_id=0): """ Enumerate the HID Devices. Returns a generator that yields all of the HID devices attached to the system. :param vendor_id: Only return devices which match this vendor id :type vendor_id: int :param product_id: Only return devices which match...
[ "def", "enumerate", "(", "vendor_id", "=", "0", ",", "product_id", "=", "0", ")", ":", "info", "=", "hidapi", ".", "hid_enumerate", "(", "vendor_id", ",", "product_id", ")", "while", "info", ":", "yield", "DeviceInfo", "(", "info", ")", "info", "=", "i...
Enumerate the HID Devices. Returns a generator that yields all of the HID devices attached to the system. :param vendor_id: Only return devices which match this vendor id :type vendor_id: int :param product_id: Only return devices which match this product id :type product_id: int :...
[ "Enumerate", "the", "HID", "Devices", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L100-L119
jbaiter/hidapi-cffi
hidapi.py
Device.write
def write(self, data, report_id=b'\0'): """ Write an Output report to a HID device. This will send the data on the first OUT endpoint, if one exists. If it does not, it will be sent the data through the Control Endpoint (Endpoint 0). :param data: The data to be sent ...
python
def write(self, data, report_id=b'\0'): """ Write an Output report to a HID device. This will send the data on the first OUT endpoint, if one exists. If it does not, it will be sent the data through the Control Endpoint (Endpoint 0). :param data: The data to be sent ...
[ "def", "write", "(", "self", ",", "data", ",", "report_id", "=", "b'\\0'", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "len", "(", "data", ")", "+", "1", ")", "buf", "=", ...
Write an Output report to a HID device. This will send the data on the first OUT endpoint, if one exists. If it does not, it will be sent the data through the Control Endpoint (Endpoint 0). :param data: The data to be sent :type data: str/bytes :param rep...
[ "Write", "an", "Output", "report", "to", "a", "HID", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L167-L186
jbaiter/hidapi-cffi
hidapi.py
Device.read
def read(self, length, timeout_ms=0, blocking=False): """ Read an Input report from a HID device with timeout. Input reports are returned to the host through the `INTERRUPT IN` endpoint. The first byte will contain the Report number if the device uses numbered reports. By defaul...
python
def read(self, length, timeout_ms=0, blocking=False): """ Read an Input report from a HID device with timeout. Input reports are returned to the host through the `INTERRUPT IN` endpoint. The first byte will contain the Report number if the device uses numbered reports. By defaul...
[ "def", "read", "(", "self", ",", "length", ",", "timeout_ms", "=", "0", ",", "blocking", "=", "False", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "length", ")", "if", "not",...
Read an Input report from a HID device with timeout. Input reports are returned to the host through the `INTERRUPT IN` endpoint. The first byte will contain the Report number if the device uses numbered reports. By default reads are non-blocking, i.e. the method will return `Non...
[ "Read", "an", "Input", "report", "from", "a", "HID", "device", "with", "timeout", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L188-L222
jbaiter/hidapi-cffi
hidapi.py
Device.get_manufacturer_string
def get_manufacturer_string(self): """ Get the Manufacturer String from the HID device. :return: The Manufacturer String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_manufacturer_string(self._device...
python
def get_manufacturer_string(self): """ Get the Manufacturer String from the HID device. :return: The Manufacturer String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_manufacturer_string(self._device...
[ "def", "get_manufacturer_string", "(", "self", ")", ":", "self", ".", "_check_device_status", "(", ")", "str_p", "=", "ffi", ".", "new", "(", "\"wchar_t[]\"", ",", "255", ")", "rv", "=", "hidapi", ".", "hid_get_manufacturer_string", "(", "self", ".", "_devic...
Get the Manufacturer String from the HID device. :return: The Manufacturer String :rtype: unicode
[ "Get", "the", "Manufacturer", "String", "from", "the", "HID", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L224-L237
jbaiter/hidapi-cffi
hidapi.py
Device.get_product_string
def get_product_string(self): """ Get the Product String from the HID device. :return: The Product String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_product_string(self._device, str_p, 255) ...
python
def get_product_string(self): """ Get the Product String from the HID device. :return: The Product String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_product_string(self._device, str_p, 255) ...
[ "def", "get_product_string", "(", "self", ")", ":", "self", ".", "_check_device_status", "(", ")", "str_p", "=", "ffi", ".", "new", "(", "\"wchar_t[]\"", ",", "255", ")", "rv", "=", "hidapi", ".", "hid_get_product_string", "(", "self", ".", "_device", ",",...
Get the Product String from the HID device. :return: The Product String :rtype: unicode
[ "Get", "the", "Product", "String", "from", "the", "HID", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L239-L252
jbaiter/hidapi-cffi
hidapi.py
Device.get_serial_number_string
def get_serial_number_string(self): """ Get the Serial Number String from the HID device. :return: The Serial Number String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_serial_number_string(self._de...
python
def get_serial_number_string(self): """ Get the Serial Number String from the HID device. :return: The Serial Number String :rtype: unicode """ self._check_device_status() str_p = ffi.new("wchar_t[]", 255) rv = hidapi.hid_get_serial_number_string(self._de...
[ "def", "get_serial_number_string", "(", "self", ")", ":", "self", ".", "_check_device_status", "(", ")", "str_p", "=", "ffi", ".", "new", "(", "\"wchar_t[]\"", ",", "255", ")", "rv", "=", "hidapi", ".", "hid_get_serial_number_string", "(", "self", ".", "_dev...
Get the Serial Number String from the HID device. :return: The Serial Number String :rtype: unicode
[ "Get", "the", "Serial", "Number", "String", "from", "the", "HID", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L254-L267
jbaiter/hidapi-cffi
hidapi.py
Device.send_feature_report
def send_feature_report(self, data, report_id=0x0): """ Send a Feature report to the device. Feature reports are sent over the Control endpoint as a Set_Report transfer. :param data: The data to send :type data: str/bytes :param report_id: The Report ID...
python
def send_feature_report(self, data, report_id=0x0): """ Send a Feature report to the device. Feature reports are sent over the Control endpoint as a Set_Report transfer. :param data: The data to send :type data: str/bytes :param report_id: The Report ID...
[ "def", "send_feature_report", "(", "self", ",", "data", ",", "report_id", "=", "0x0", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "len", "(", "data", ")", "+", "1", ")", "buf...
Send a Feature report to the device. Feature reports are sent over the Control endpoint as a Set_Report transfer. :param data: The data to send :type data: str/bytes :param report_id: The Report ID to send to :type report_id: int
[ "Send", "a", "Feature", "report", "to", "the", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L269-L289
jbaiter/hidapi-cffi
hidapi.py
Device.get_feature_report
def get_feature_report(self, report_id, length): """ Get a feature report from the device. :param report_id: The Report ID of the report to be read :type report_id: int :return: The report data :rtype: str/bytes """ self._check_device...
python
def get_feature_report(self, report_id, length): """ Get a feature report from the device. :param report_id: The Report ID of the report to be read :type report_id: int :return: The report data :rtype: str/bytes """ self._check_device...
[ "def", "get_feature_report", "(", "self", ",", "report_id", ",", "length", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "length", "+", "1", ")", "buf", "=", "ffi", ".", "buffer"...
Get a feature report from the device. :param report_id: The Report ID of the report to be read :type report_id: int :return: The report data :rtype: str/bytes
[ "Get", "a", "feature", "report", "from", "the", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L291-L308
jbaiter/hidapi-cffi
hidapi.py
Device.get_indexed_string
def get_indexed_string(self, idx): """ Get a string from the device, based on its string index. :param idx: The index of the string to get :type idx: int :return: The string at the index :rtype: unicode """ self._check_device_status() bufp = ffi....
python
def get_indexed_string(self, idx): """ Get a string from the device, based on its string index. :param idx: The index of the string to get :type idx: int :return: The string at the index :rtype: unicode """ self._check_device_status() bufp = ffi....
[ "def", "get_indexed_string", "(", "self", ",", "idx", ")", ":", "self", ".", "_check_device_status", "(", ")", "bufp", "=", "ffi", ".", "new", "(", "\"wchar_t*\"", ")", "rv", "=", "hidapi", ".", "hid_get_indexed_string", "(", "self", ".", "_device", ",", ...
Get a string from the device, based on its string index. :param idx: The index of the string to get :type idx: int :return: The string at the index :rtype: unicode
[ "Get", "a", "string", "from", "the", "device", "based", "on", "its", "string", "index", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L310-L326
jbaiter/hidapi-cffi
hidapi.py
Device.close
def close(self): """ Close connection to HID device. Automatically run when a Device object is garbage-collected, though manual invocation is recommended. """ self._check_device_status() hidapi.hid_close(self._device) self._device = None
python
def close(self): """ Close connection to HID device. Automatically run when a Device object is garbage-collected, though manual invocation is recommended. """ self._check_device_status() hidapi.hid_close(self._device) self._device = None
[ "def", "close", "(", "self", ")", ":", "self", ".", "_check_device_status", "(", ")", "hidapi", ".", "hid_close", "(", "self", ".", "_device", ")", "self", ".", "_device", "=", "None" ]
Close connection to HID device. Automatically run when a Device object is garbage-collected, though manual invocation is recommended.
[ "Close", "connection", "to", "HID", "device", "." ]
train
https://github.com/jbaiter/hidapi-cffi/blob/227116a2a2ba25ff5a56bf5205ae2bd58ee98c82/hidapi.py#L328-L336
svven/summary
summary/filters.py
AdblockURLFilterMeta.load_raw_rules
def load_raw_rules(cls, url): "Load raw rules from url or package file." raw_rules = [] filename = url.split('/')[-1] # e.g.: easylist.txt try: with closing(request.get(url, stream=True)) as file: file.raise_for_status() # lines = 0 # to...
python
def load_raw_rules(cls, url): "Load raw rules from url or package file." raw_rules = [] filename = url.split('/')[-1] # e.g.: easylist.txt try: with closing(request.get(url, stream=True)) as file: file.raise_for_status() # lines = 0 # to...
[ "def", "load_raw_rules", "(", "cls", ",", "url", ")", ":", "raw_rules", "=", "[", "]", "filename", "=", "url", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "# e.g.: easylist.txt\r", "try", ":", "with", "closing", "(", "request", ".", "get", "("...
Load raw rules from url or package file.
[ "Load", "raw", "rules", "from", "url", "or", "package", "file", "." ]
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L38-L56
svven/summary
summary/filters.py
AdblockURLFilterMeta.get_all_rules
def get_all_rules(cls): "Load all available Adblock rules." from adblockparser import AdblockRules raw_rules = [] for url in [ config.ADBLOCK_EASYLIST_URL, config.ADBLOCK_EXTRALIST_URL]: raw_rules.extend(cls.load_raw_rules(url)) rules = ...
python
def get_all_rules(cls): "Load all available Adblock rules." from adblockparser import AdblockRules raw_rules = [] for url in [ config.ADBLOCK_EASYLIST_URL, config.ADBLOCK_EXTRALIST_URL]: raw_rules.extend(cls.load_raw_rules(url)) rules = ...
[ "def", "get_all_rules", "(", "cls", ")", ":", "from", "adblockparser", "import", "AdblockRules", "raw_rules", "=", "[", "]", "for", "url", "in", "[", "config", ".", "ADBLOCK_EASYLIST_URL", ",", "config", ".", "ADBLOCK_EXTRALIST_URL", "]", ":", "raw_rules", "."...
Load all available Adblock rules.
[ "Load", "all", "available", "Adblock", "rules", "." ]
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L58-L68
svven/summary
summary/filters.py
NoImageFilter.get_image
def get_image(cls, url): """ Returned Image instance has response url. This might be different than the url param because of redirects. """ from PIL.ImageFile import Parser as PILParser length = 0 raw_image = None with closing(request.get(url, st...
python
def get_image(cls, url): """ Returned Image instance has response url. This might be different than the url param because of redirects. """ from PIL.ImageFile import Parser as PILParser length = 0 raw_image = None with closing(request.get(url, st...
[ "def", "get_image", "(", "cls", ",", "url", ")", ":", "from", "PIL", ".", "ImageFile", "import", "Parser", "as", "PILParser", "length", "=", "0", "raw_image", "=", "None", "with", "closing", "(", "request", ".", "get", "(", "url", ",", "stream", "=", ...
Returned Image instance has response url. This might be different than the url param because of redirects.
[ "Returned", "Image", "instance", "has", "response", "url", ".", "This", "might", "be", "different", "than", "the", "url", "param", "because", "of", "redirects", "." ]
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L112-L143
svven/summary
summary/filters.py
MonoImageFilter.check_color
def check_color(cls, raw_image): """ Just check if raw_image is completely white. http://stackoverflow.com/questions/14041562/python-pil-detect-if-an-image-is-completely-black-or-white """ # sum(img.convert("L").getextrema()) in (0, 2) extrema = raw_image.convert("L...
python
def check_color(cls, raw_image): """ Just check if raw_image is completely white. http://stackoverflow.com/questions/14041562/python-pil-detect-if-an-image-is-completely-black-or-white """ # sum(img.convert("L").getextrema()) in (0, 2) extrema = raw_image.convert("L...
[ "def", "check_color", "(", "cls", ",", "raw_image", ")", ":", "# sum(img.convert(\"L\").getextrema()) in (0, 2)\r", "extrema", "=", "raw_image", ".", "convert", "(", "\"L\"", ")", ".", "getextrema", "(", ")", "if", "extrema", "==", "(", "255", ",", "255", ")",...
Just check if raw_image is completely white. http://stackoverflow.com/questions/14041562/python-pil-detect-if-an-image-is-completely-black-or-white
[ "Just", "check", "if", "raw_image", "is", "completely", "white", ".", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "14041562", "/", "python", "-", "pil", "-", "detect", "-", "if", "-", "an", "-", "image", "-", "is", "-", "co...
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L223-L231
svven/summary
summary/filters.py
FormatImageFilter.check_animated
def check_animated(cls, raw_image): "Checks whether the gif is animated." try: raw_image.seek(1) except EOFError: isanimated= False else: isanimated= True raise cls.AnimatedImageException
python
def check_animated(cls, raw_image): "Checks whether the gif is animated." try: raw_image.seek(1) except EOFError: isanimated= False else: isanimated= True raise cls.AnimatedImageException
[ "def", "check_animated", "(", "cls", ",", "raw_image", ")", ":", "try", ":", "raw_image", ".", "seek", "(", "1", ")", "except", "EOFError", ":", "isanimated", "=", "False", "else", ":", "isanimated", "=", "True", "raise", "cls", ".", "AnimatedImageExceptio...
Checks whether the gif is animated.
[ "Checks", "whether", "the", "gif", "is", "animated", "." ]
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L259-L267
squidsoup/muddle.py
muddle/api.py
valid_options
def valid_options(kwargs, allowed_options): """ Checks that kwargs are valid API options""" diff = set(kwargs) - set(allowed_options) if diff: print("Invalid option(s): ", ', '.join(diff)) return False return True
python
def valid_options(kwargs, allowed_options): """ Checks that kwargs are valid API options""" diff = set(kwargs) - set(allowed_options) if diff: print("Invalid option(s): ", ', '.join(diff)) return False return True
[ "def", "valid_options", "(", "kwargs", ",", "allowed_options", ")", ":", "diff", "=", "set", "(", "kwargs", ")", "-", "set", "(", "allowed_options", ")", "if", "diff", ":", "print", "(", "\"Invalid option(s): \"", ",", "', '", ".", "join", "(", "diff", "...
Checks that kwargs are valid API options
[ "Checks", "that", "kwargs", "are", "valid", "API", "options" ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L6-L13
squidsoup/muddle.py
muddle/api.py
Course.create
def create(self, fullname, shortname, category_id, **kwargs): """ Create a new course :param string fullname: The course's fullname :param string shortname: The course's shortname :param int category_id: The course's category :keyword string idnumber: (optional) Course ...
python
def create(self, fullname, shortname, category_id, **kwargs): """ Create a new course :param string fullname: The course's fullname :param string shortname: The course's shortname :param int category_id: The course's category :keyword string idnumber: (optional) Course ...
[ "def", "create", "(", "self", ",", "fullname", ",", "shortname", ",", "category_id", ",", "*", "*", "kwargs", ")", ":", "allowed_options", "=", "[", "'idnumber'", ",", "'summaryformat'", ",", "'format'", ",", "'showgrades'", ",", "'newsitems'", ",", "'startd...
Create a new course :param string fullname: The course's fullname :param string shortname: The course's shortname :param int category_id: The course's category :keyword string idnumber: (optional) Course ID number. \ Yes, it's a string, blame Moodle. :keyword int su...
[ "Create", "a", "new", "course" ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L46-L120
squidsoup/muddle.py
muddle/api.py
Course.delete
def delete(self): """ Deletes a specified courses Example Usage:: >>> import muddle >>> muddle.course(10).delete() """ params = {'wsfunction': 'core_course_delete_courses', 'courseids[0]': self.course_id} params.update(self.request_par...
python
def delete(self): """ Deletes a specified courses Example Usage:: >>> import muddle >>> muddle.course(10).delete() """ params = {'wsfunction': 'core_course_delete_courses', 'courseids[0]': self.course_id} params.update(self.request_par...
[ "def", "delete", "(", "self", ")", ":", "params", "=", "{", "'wsfunction'", ":", "'core_course_delete_courses'", ",", "'courseids[0]'", ":", "self", ".", "course_id", "}", "params", ".", "update", "(", "self", ".", "request_params", ")", "return", "requests", ...
Deletes a specified courses Example Usage:: >>> import muddle >>> muddle.course(10).delete()
[ "Deletes", "a", "specified", "courses" ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L122-L136
squidsoup/muddle.py
muddle/api.py
Course.contents
def contents(self): """ Returns entire contents of course page :returns: response object Example Usage:: >>> import muddle >>> muddle.course(10).content() """ params = self.request_params params.update({'wsfunction': 'core_course_get_contents',...
python
def contents(self): """ Returns entire contents of course page :returns: response object Example Usage:: >>> import muddle >>> muddle.course(10).content() """ params = self.request_params params.update({'wsfunction': 'core_course_get_contents',...
[ "def", "contents", "(", "self", ")", ":", "params", "=", "self", ".", "request_params", "params", ".", "update", "(", "{", "'wsfunction'", ":", "'core_course_get_contents'", ",", "'courseid'", ":", "self", ".", "course_id", "}", ")", "return", "requests", "....
Returns entire contents of course page :returns: response object Example Usage:: >>> import muddle >>> muddle.course(10).content()
[ "Returns", "entire", "contents", "of", "course", "page" ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L138-L154
squidsoup/muddle.py
muddle/api.py
Course.duplicate
def duplicate(self, fullname, shortname, categoryid, visible=True, **kwargs): """ Duplicates an existing course with options. Note: Can be very slow running. :param string fullname: The new course's full name :param string shortname: The new course's short name...
python
def duplicate(self, fullname, shortname, categoryid, visible=True, **kwargs): """ Duplicates an existing course with options. Note: Can be very slow running. :param string fullname: The new course's full name :param string shortname: The new course's short name...
[ "def", "duplicate", "(", "self", ",", "fullname", ",", "shortname", ",", "categoryid", ",", "visible", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# TODO", "# Ideally categoryid should be optional here and", "# should default to catid of course being duplicated.", ...
Duplicates an existing course with options. Note: Can be very slow running. :param string fullname: The new course's full name :param string shortname: The new course's short name :param string categoryid: Category new course should be created under :keyword bool visible: Defau...
[ "Duplicates", "an", "existing", "course", "with", "options", ".", "Note", ":", "Can", "be", "very", "slow", "running", "." ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L156-L219
squidsoup/muddle.py
muddle/api.py
Course.export_data
def export_data(self, export_to, delete_content=False): """ Export course data to another course. Does not include any user data. :param bool delete_content: (optional) Delete content \ from source course. Example Usage:: >>> import muddle >>> muddl...
python
def export_data(self, export_to, delete_content=False): """ Export course data to another course. Does not include any user data. :param bool delete_content: (optional) Delete content \ from source course. Example Usage:: >>> import muddle >>> muddl...
[ "def", "export_data", "(", "self", ",", "export_to", ",", "delete_content", "=", "False", ")", ":", "params", "=", "{", "'wsfunction'", ":", "'core_course_import_course'", ",", "'importfrom'", ":", "self", ".", "course_id", ",", "'importto'", ":", "export_to", ...
Export course data to another course. Does not include any user data. :param bool delete_content: (optional) Delete content \ from source course. Example Usage:: >>> import muddle >>> muddle.course(10).export_data(12)
[ "Export", "course", "data", "to", "another", "course", ".", "Does", "not", "include", "any", "user", "data", "." ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L221-L240
squidsoup/muddle.py
muddle/api.py
Category.details
def details(self): """ Returns details for given category :returns: category response object Example Usage:: >>> import muddle >>> muddle.category(10).details() """ params = {'wsfunction': 'core_course_get_categories', 'criteria[0][key...
python
def details(self): """ Returns details for given category :returns: category response object Example Usage:: >>> import muddle >>> muddle.category(10).details() """ params = {'wsfunction': 'core_course_get_categories', 'criteria[0][key...
[ "def", "details", "(", "self", ")", ":", "params", "=", "{", "'wsfunction'", ":", "'core_course_get_categories'", ",", "'criteria[0][key]'", ":", "'id'", ",", "'criteria[0][value]'", ":", "self", ".", "category_id", "}", "params", ".", "update", "(", "self", "...
Returns details for given category :returns: category response object Example Usage:: >>> import muddle >>> muddle.category(10).details()
[ "Returns", "details", "for", "given", "category" ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L249-L266
squidsoup/muddle.py
muddle/api.py
Category.delete
def delete(self, new_parent=None, recursive=False): """ Deletes a category. Optionally moves content to new category. Note: If category is in root, new_parent must be specified. :param int new_parent: (optional) Category ID of new parent :param bool recursive: recursively delete...
python
def delete(self, new_parent=None, recursive=False): """ Deletes a category. Optionally moves content to new category. Note: If category is in root, new_parent must be specified. :param int new_parent: (optional) Category ID of new parent :param bool recursive: recursively delete...
[ "def", "delete", "(", "self", ",", "new_parent", "=", "None", ",", "recursive", "=", "False", ")", ":", "params", "=", "{", "'wsfunction'", ":", "'core_course_delete_categories'", ",", "'categories[0][id]'", ":", "self", ".", "category_id", ",", "'categories[0][...
Deletes a category. Optionally moves content to new category. Note: If category is in root, new_parent must be specified. :param int new_parent: (optional) Category ID of new parent :param bool recursive: recursively delete contents inside this category Example Usage:: >>> imp...
[ "Deletes", "a", "category", ".", "Optionally", "moves", "content", "to", "new", "category", ".", "Note", ":", "If", "category", "is", "in", "root", "new_parent", "must", "be", "specified", "." ]
train
https://github.com/squidsoup/muddle.py/blob/f58c62e7d92b9ac24a16de007c0fbd6607b15687/muddle/api.py#L308-L329
jelmer/python-fastimport
fastimport/commands.py
check_path
def check_path(path): """Check that a path is legal. :return: the path if all is OK :raise ValueError: if the path is illegal """ if path is None or path == b'' or path.startswith(b'/'): raise ValueError("illegal path '%s'" % path) if ( (sys.version_info[0] >= 3 and not isinsta...
python
def check_path(path): """Check that a path is legal. :return: the path if all is OK :raise ValueError: if the path is illegal """ if path is None or path == b'' or path.startswith(b'/'): raise ValueError("illegal path '%s'" % path) if ( (sys.version_info[0] >= 3 and not isinsta...
[ "def", "check_path", "(", "path", ")", ":", "if", "path", "is", "None", "or", "path", "==", "b''", "or", "path", ".", "startswith", "(", "b'/'", ")", ":", "raise", "ValueError", "(", "\"illegal path '%s'\"", "%", "path", ")", "if", "(", "(", "sys", "...
Check that a path is legal. :return: the path if all is OK :raise ValueError: if the path is illegal
[ "Check", "that", "a", "path", "is", "legal", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L462-L477
jelmer/python-fastimport
fastimport/commands.py
format_path
def format_path(p, quote_spaces=False): """Format a path in utf8, quoting it if necessary.""" if b'\n' in p: p = re.sub(b'\n', b'\\n', p) quote = True else: quote = p[0] == b'"' or (quote_spaces and b' ' in p) if quote: extra = GIT_FAST_IMPORT_NEEDS_EXTRA_SPACE_AFTER_QUOT...
python
def format_path(p, quote_spaces=False): """Format a path in utf8, quoting it if necessary.""" if b'\n' in p: p = re.sub(b'\n', b'\\n', p) quote = True else: quote = p[0] == b'"' or (quote_spaces and b' ' in p) if quote: extra = GIT_FAST_IMPORT_NEEDS_EXTRA_SPACE_AFTER_QUOT...
[ "def", "format_path", "(", "p", ",", "quote_spaces", "=", "False", ")", ":", "if", "b'\\n'", "in", "p", ":", "p", "=", "re", ".", "sub", "(", "b'\\n'", ",", "b'\\\\n'", ",", "p", ")", "quote", "=", "True", "else", ":", "quote", "=", "p", "[", "...
Format a path in utf8, quoting it if necessary.
[ "Format", "a", "path", "in", "utf8", "quoting", "it", "if", "necessary", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L480-L490
jelmer/python-fastimport
fastimport/commands.py
format_who_when
def format_who_when(fields): """Format a tuple of name,email,secs-since-epoch,utc-offset-secs as a string.""" offset = fields[3] if offset < 0: offset_sign = b'-' offset = abs(offset) else: offset_sign = b'+' offset_hours = offset // 3600 offset_minutes = offset // 60 - o...
python
def format_who_when(fields): """Format a tuple of name,email,secs-since-epoch,utc-offset-secs as a string.""" offset = fields[3] if offset < 0: offset_sign = b'-' offset = abs(offset) else: offset_sign = b'+' offset_hours = offset // 3600 offset_minutes = offset // 60 - o...
[ "def", "format_who_when", "(", "fields", ")", ":", "offset", "=", "fields", "[", "3", "]", "if", "offset", "<", "0", ":", "offset_sign", "=", "b'-'", "offset", "=", "abs", "(", "offset", ")", "else", ":", "offset_sign", "=", "b'+'", "offset_hours", "="...
Format a tuple of name,email,secs-since-epoch,utc-offset-secs as a string.
[ "Format", "a", "tuple", "of", "name", "email", "secs", "-", "since", "-", "epoch", "utc", "-", "offset", "-", "secs", "as", "a", "string", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L493-L517
jelmer/python-fastimport
fastimport/commands.py
format_property
def format_property(name, value): """Format the name and value (both unicode) of a property as a string.""" result = b'' utf8_name = utf8_bytes_string(name) result = b'property ' + utf8_name if value is not None: utf8_value = utf8_bytes_string(value) result += b' ' + ('%d' % len(utf...
python
def format_property(name, value): """Format the name and value (both unicode) of a property as a string.""" result = b'' utf8_name = utf8_bytes_string(name) result = b'property ' + utf8_name if value is not None: utf8_value = utf8_bytes_string(value) result += b' ' + ('%d' % len(utf...
[ "def", "format_property", "(", "name", ",", "value", ")", ":", "result", "=", "b''", "utf8_name", "=", "utf8_bytes_string", "(", "name", ")", "result", "=", "b'property '", "+", "utf8_name", "if", "value", "is", "not", "None", ":", "utf8_value", "=", "utf8...
Format the name and value (both unicode) of a property as a string.
[ "Format", "the", "name", "and", "value", "(", "both", "unicode", ")", "of", "a", "property", "as", "a", "string", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L520-L530
jelmer/python-fastimport
fastimport/commands.py
ImportCommand.dump_str
def dump_str(self, names=None, child_lists=None, verbose=False): """Dump fields as a string. For debugging. :param names: the list of fields to include or None for all public fields :param child_lists: dictionary of child command names to fields for that child c...
python
def dump_str(self, names=None, child_lists=None, verbose=False): """Dump fields as a string. For debugging. :param names: the list of fields to include or None for all public fields :param child_lists: dictionary of child command names to fields for that child c...
[ "def", "dump_str", "(", "self", ",", "names", "=", "None", ",", "child_lists", "=", "None", ",", "verbose", "=", "False", ")", ":", "interesting", "=", "{", "}", "if", "names", "is", "None", ":", "fields", "=", "[", "k", "for", "k", "in", "list", ...
Dump fields as a string. For debugging. :param names: the list of fields to include or None for all public fields :param child_lists: dictionary of child command names to fields for that child command to include :param verbose: if True, prefix each line with the...
[ "Dump", "fields", "as", "a", "string", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L83-L112
jelmer/python-fastimport
fastimport/commands.py
CommitCommand.iter_files
def iter_files(self): """Iterate over files.""" # file_iter may be a callable or an iterator if callable(self.file_iter): return self.file_iter() return iter(self.file_iter)
python
def iter_files(self): """Iterate over files.""" # file_iter may be a callable or an iterator if callable(self.file_iter): return self.file_iter() return iter(self.file_iter)
[ "def", "iter_files", "(", "self", ")", ":", "# file_iter may be a callable or an iterator", "if", "callable", "(", "self", ".", "file_iter", ")", ":", "return", "self", ".", "file_iter", "(", ")", "return", "iter", "(", "self", ".", "file_iter", ")" ]
Iterate over files.
[ "Iterate", "over", "files", "." ]
train
https://github.com/jelmer/python-fastimport/blob/5cef9e037b7d7b37f58f522ac9ea4e343e6a1dff/fastimport/commands.py#L270-L275
Robin8Put/pmes
ams/utils/pagination.py
Paginator.get_range
def get_range(self): """ Get range """ if not self.page: return (1, self.last_blocks[self.coinid]) # Get start of the range start = self.page * self.limit # Get finish of the range end = (self.page + 1) * self.limit if start > self.last_blocks[self.coinid]: return (1,1) if end > self.last_bloc...
python
def get_range(self): """ Get range """ if not self.page: return (1, self.last_blocks[self.coinid]) # Get start of the range start = self.page * self.limit # Get finish of the range end = (self.page + 1) * self.limit if start > self.last_blocks[self.coinid]: return (1,1) if end > self.last_bloc...
[ "def", "get_range", "(", "self", ")", ":", "if", "not", "self", ".", "page", ":", "return", "(", "1", ",", "self", ".", "last_blocks", "[", "self", ".", "coinid", "]", ")", "# Get start of the range", "start", "=", "self", ".", "page", "*", "self", "...
Get range
[ "Get", "range" ]
train
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/ams/utils/pagination.py#L28-L44
abingham/spor
src/spor/cli.py
_open_repo
def _open_repo(args, path_key='<path>'): """Open and return the repository containing the specified file. The file is specified by looking up `path_key` in `args`. This value or `None` is passed to `open_repository`. Returns: A `Repository` instance. Raises: ExitError: If there is a probl...
python
def _open_repo(args, path_key='<path>'): """Open and return the repository containing the specified file. The file is specified by looking up `path_key` in `args`. This value or `None` is passed to `open_repository`. Returns: A `Repository` instance. Raises: ExitError: If there is a probl...
[ "def", "_open_repo", "(", "args", ",", "path_key", "=", "'<path>'", ")", ":", "path", "=", "pathlib", ".", "Path", "(", "args", "[", "path_key", "]", ")", "if", "args", "[", "path_key", "]", "else", "None", "try", ":", "repo", "=", "open_repository", ...
Open and return the repository containing the specified file. The file is specified by looking up `path_key` in `args`. This value or `None` is passed to `open_repository`. Returns: A `Repository` instance. Raises: ExitError: If there is a problem opening the repo.
[ "Open", "and", "return", "the", "repository", "containing", "the", "specified", "file", "." ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L29-L47
abingham/spor
src/spor/cli.py
_get_anchor
def _get_anchor(repo, id_prefix): """Get an anchor by ID, or a prefix of its id. """ result = None for anchor_id, anchor in repo.items(): if anchor_id.startswith(id_prefix): if result is not None: raise ExitError( ExitCode.DATA_ERR, ...
python
def _get_anchor(repo, id_prefix): """Get an anchor by ID, or a prefix of its id. """ result = None for anchor_id, anchor in repo.items(): if anchor_id.startswith(id_prefix): if result is not None: raise ExitError( ExitCode.DATA_ERR, ...
[ "def", "_get_anchor", "(", "repo", ",", "id_prefix", ")", ":", "result", "=", "None", "for", "anchor_id", ",", "anchor", "in", "repo", ".", "items", "(", ")", ":", "if", "anchor_id", ".", "startswith", "(", "id_prefix", ")", ":", "if", "result", "is", ...
Get an anchor by ID, or a prefix of its id.
[ "Get", "an", "anchor", "by", "ID", "or", "a", "prefix", "of", "its", "id", "." ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L50-L68
abingham/spor
src/spor/cli.py
init_handler
def init_handler(args): """usage: {program} init Initialize a new spor repository in the current directory. """ try: initialize_repository(pathlib.Path.cwd()) except ValueError as exc: print(exc, file=sys.stderr) return ExitCode.DATAERR return ExitCode.OK
python
def init_handler(args): """usage: {program} init Initialize a new spor repository in the current directory. """ try: initialize_repository(pathlib.Path.cwd()) except ValueError as exc: print(exc, file=sys.stderr) return ExitCode.DATAERR return ExitCode.OK
[ "def", "init_handler", "(", "args", ")", ":", "try", ":", "initialize_repository", "(", "pathlib", ".", "Path", ".", "cwd", "(", ")", ")", "except", "ValueError", "as", "exc", ":", "print", "(", "exc", ",", "file", "=", "sys", ".", "stderr", ")", "re...
usage: {program} init Initialize a new spor repository in the current directory.
[ "usage", ":", "{", "program", "}", "init" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L72-L83
abingham/spor
src/spor/cli.py
list_handler
def list_handler(args): """usage: {program} list List the anchors for a file. """ repo = open_repository(None) for anchor_id, anchor in repo.items(): print("{} {}:{} => {}".format(anchor_id, anchor.file_path.relative_to(repo.root), ...
python
def list_handler(args): """usage: {program} list List the anchors for a file. """ repo = open_repository(None) for anchor_id, anchor in repo.items(): print("{} {}:{} => {}".format(anchor_id, anchor.file_path.relative_to(repo.root), ...
[ "def", "list_handler", "(", "args", ")", ":", "repo", "=", "open_repository", "(", "None", ")", "for", "anchor_id", ",", "anchor", "in", "repo", ".", "items", "(", ")", ":", "print", "(", "\"{} {}:{} => {}\"", ".", "format", "(", "anchor_id", ",", "ancho...
usage: {program} list List the anchors for a file.
[ "usage", ":", "{", "program", "}", "list" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L87-L98
abingham/spor
src/spor/cli.py
add_handler
def add_handler(args): """usage: {program} add <source-file> <offset> <width> <context-width> Add a new anchor for a file. """ file_path = pathlib.Path(args['<source-file>']).resolve() try: offset = int(args['<offset>']) width = int(args['<width>']) context_width = int(args...
python
def add_handler(args): """usage: {program} add <source-file> <offset> <width> <context-width> Add a new anchor for a file. """ file_path = pathlib.Path(args['<source-file>']).resolve() try: offset = int(args['<offset>']) width = int(args['<width>']) context_width = int(args...
[ "def", "add_handler", "(", "args", ")", ":", "file_path", "=", "pathlib", ".", "Path", "(", "args", "[", "'<source-file>'", "]", ")", ".", "resolve", "(", ")", "try", ":", "offset", "=", "int", "(", "args", "[", "'<offset>'", "]", ")", "width", "=", ...
usage: {program} add <source-file> <offset> <width> <context-width> Add a new anchor for a file.
[ "usage", ":", "{", "program", "}", "add", "<source", "-", "file", ">", "<offset", ">", "<width", ">", "<context", "-", "width", ">" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L102-L138
abingham/spor
src/spor/cli.py
remove_handler
def remove_handler(args): """usage: {program} remove <anchor-id> [<path>] Remove an existing anchor. """ repo = _open_repo(args) anchor_id, anchor = _get_anchor(repo, args['<anchor-id>']) del repo[anchor_id] return ExitCode.OK
python
def remove_handler(args): """usage: {program} remove <anchor-id> [<path>] Remove an existing anchor. """ repo = _open_repo(args) anchor_id, anchor = _get_anchor(repo, args['<anchor-id>']) del repo[anchor_id] return ExitCode.OK
[ "def", "remove_handler", "(", "args", ")", ":", "repo", "=", "_open_repo", "(", "args", ")", "anchor_id", ",", "anchor", "=", "_get_anchor", "(", "repo", ",", "args", "[", "'<anchor-id>'", "]", ")", "del", "repo", "[", "anchor_id", "]", "return", "ExitCo...
usage: {program} remove <anchor-id> [<path>] Remove an existing anchor.
[ "usage", ":", "{", "program", "}", "remove", "<anchor", "-", "id", ">", "[", "<path", ">", "]" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L142-L152
abingham/spor
src/spor/cli.py
_launch_editor
def _launch_editor(starting_text=''): "Launch editor, let user write text, then return that text." # TODO: What is a reasonable default for windows? Does this approach even # make sense on windows? editor = os.environ.get('EDITOR', 'vim') with tempfile.TemporaryDirectory() as dirname: filen...
python
def _launch_editor(starting_text=''): "Launch editor, let user write text, then return that text." # TODO: What is a reasonable default for windows? Does this approach even # make sense on windows? editor = os.environ.get('EDITOR', 'vim') with tempfile.TemporaryDirectory() as dirname: filen...
[ "def", "_launch_editor", "(", "starting_text", "=", "''", ")", ":", "# TODO: What is a reasonable default for windows? Does this approach even", "# make sense on windows?", "editor", "=", "os", ".", "environ", ".", "get", "(", "'EDITOR'", ",", "'vim'", ")", "with", "tem...
Launch editor, let user write text, then return that text.
[ "Launch", "editor", "let", "user", "write", "text", "then", "return", "that", "text", "." ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L155-L169
abingham/spor
src/spor/cli.py
update_handler
def update_handler(args): """usage: {program} update [<path>] Update out of date anchors in the current repository. """ repo = _open_repo(args) for anchor_id, anchor in repo.items(): try: anchor = update(anchor) except AlignmentError as e: print('Unable to u...
python
def update_handler(args): """usage: {program} update [<path>] Update out of date anchors in the current repository. """ repo = _open_repo(args) for anchor_id, anchor in repo.items(): try: anchor = update(anchor) except AlignmentError as e: print('Unable to u...
[ "def", "update_handler", "(", "args", ")", ":", "repo", "=", "_open_repo", "(", "args", ")", "for", "anchor_id", ",", "anchor", "in", "repo", ".", "items", "(", ")", ":", "try", ":", "anchor", "=", "update", "(", "anchor", ")", "except", "AlignmentErro...
usage: {program} update [<path>] Update out of date anchors in the current repository.
[ "usage", ":", "{", "program", "}", "update", "[", "<path", ">", "]" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L173-L187
abingham/spor
src/spor/cli.py
status_handler
def status_handler(args): """usage: {program} status [<path>] Validate the anchors in the current repository. """ repo = _open_repo(args) for anchor_id, anchor in repo.items(): diff_lines = get_anchor_diff(anchor) if diff_lines: print('{} {}:{} out-of-date'.format( ...
python
def status_handler(args): """usage: {program} status [<path>] Validate the anchors in the current repository. """ repo = _open_repo(args) for anchor_id, anchor in repo.items(): diff_lines = get_anchor_diff(anchor) if diff_lines: print('{} {}:{} out-of-date'.format( ...
[ "def", "status_handler", "(", "args", ")", ":", "repo", "=", "_open_repo", "(", "args", ")", "for", "anchor_id", ",", "anchor", "in", "repo", ".", "items", "(", ")", ":", "diff_lines", "=", "get_anchor_diff", "(", "anchor", ")", "if", "diff_lines", ":", ...
usage: {program} status [<path>] Validate the anchors in the current repository.
[ "usage", ":", "{", "program", "}", "status", "[", "<path", ">", "]" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L191-L207
abingham/spor
src/spor/cli.py
diff_handler
def diff_handler(args): """usage: {program} diff <anchor-id> Show the difference between an anchor and the current state of the source. """ repo = _open_repo(args) anchor_id, anchor = _get_anchor(repo, args['<anchor-id>']) diff_lines = get_anchor_diff(anchor) sys.stdout.writelines(diff_li...
python
def diff_handler(args): """usage: {program} diff <anchor-id> Show the difference between an anchor and the current state of the source. """ repo = _open_repo(args) anchor_id, anchor = _get_anchor(repo, args['<anchor-id>']) diff_lines = get_anchor_diff(anchor) sys.stdout.writelines(diff_li...
[ "def", "diff_handler", "(", "args", ")", ":", "repo", "=", "_open_repo", "(", "args", ")", "anchor_id", ",", "anchor", "=", "_get_anchor", "(", "repo", ",", "args", "[", "'<anchor-id>'", "]", ")", "diff_lines", "=", "get_anchor_diff", "(", "anchor", ")", ...
usage: {program} diff <anchor-id> Show the difference between an anchor and the current state of the source.
[ "usage", ":", "{", "program", "}", "diff", "<anchor", "-", "id", ">" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L211-L223
abingham/spor
src/spor/cli.py
details_handler
def details_handler(args): """usage: {program} details <anchor-id> [<path>] Get the details of a single anchor. """ repo = _open_repo(args) _, anchor = _get_anchor(repo, args['<anchor-id>']) print("""path: {file_path} encoding: {encoding} [before] {before} -------------- [topic] {topic} ---...
python
def details_handler(args): """usage: {program} details <anchor-id> [<path>] Get the details of a single anchor. """ repo = _open_repo(args) _, anchor = _get_anchor(repo, args['<anchor-id>']) print("""path: {file_path} encoding: {encoding} [before] {before} -------------- [topic] {topic} ---...
[ "def", "details_handler", "(", "args", ")", ":", "repo", "=", "_open_repo", "(", "args", ")", "_", ",", "anchor", "=", "_get_anchor", "(", "repo", ",", "args", "[", "'<anchor-id>'", "]", ")", "print", "(", "\"\"\"path: {file_path}\nencoding: {encoding}\n\n[befor...
usage: {program} details <anchor-id> [<path>] Get the details of a single anchor.
[ "usage", ":", "{", "program", "}", "details", "<anchor", "-", "id", ">", "[", "<path", ">", "]" ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/cli.py#L227-L261
royi1000/py-libhdate
hdate/converters.py
_days_from_3744
def _days_from_3744(hebrew_year): """Return: Number of days since 3,1,3744.""" # Start point for calculation is Molad new year 3744 (16BC) years_from_3744 = hebrew_year - 3744 molad_3744 = get_chalakim(1 + 6, 779) # Molad 3744 + 6 hours in parts # Time in months # Number of leap months ...
python
def _days_from_3744(hebrew_year): """Return: Number of days since 3,1,3744.""" # Start point for calculation is Molad new year 3744 (16BC) years_from_3744 = hebrew_year - 3744 molad_3744 = get_chalakim(1 + 6, 779) # Molad 3744 + 6 hours in parts # Time in months # Number of leap months ...
[ "def", "_days_from_3744", "(", "hebrew_year", ")", ":", "# Start point for calculation is Molad new year 3744 (16BC)", "years_from_3744", "=", "hebrew_year", "-", "3744", "molad_3744", "=", "get_chalakim", "(", "1", "+", "6", ",", "779", ")", "# Molad 3744 + 6 hours in pa...
Return: Number of days since 3,1,3744.
[ "Return", ":", "Number", "of", "days", "since", "3", "1", "3744", "." ]
train
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L23-L67
royi1000/py-libhdate
hdate/converters.py
gdate_to_jdn
def gdate_to_jdn(date): """ Compute Julian day from Gregorian day, month and year. Algorithm from wikipedia's julian_day article. Return: The julian day number """ not_jan_or_feb = (14 - date.month) // 12 year_since_4800bc = date.year + 4800 - not_jan_or_feb month_since_4800bc = date.mo...
python
def gdate_to_jdn(date): """ Compute Julian day from Gregorian day, month and year. Algorithm from wikipedia's julian_day article. Return: The julian day number """ not_jan_or_feb = (14 - date.month) // 12 year_since_4800bc = date.year + 4800 - not_jan_or_feb month_since_4800bc = date.mo...
[ "def", "gdate_to_jdn", "(", "date", ")", ":", "not_jan_or_feb", "=", "(", "14", "-", "date", ".", "month", ")", "//", "12", "year_since_4800bc", "=", "date", ".", "year", "+", "4800", "-", "not_jan_or_feb", "month_since_4800bc", "=", "date", ".", "month", ...
Compute Julian day from Gregorian day, month and year. Algorithm from wikipedia's julian_day article. Return: The julian day number
[ "Compute", "Julian", "day", "from", "Gregorian", "day", "month", "and", "year", "." ]
train
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L75-L89
royi1000/py-libhdate
hdate/converters.py
hdate_to_jdn
def hdate_to_jdn(date): """ Compute Julian day from Hebrew day, month and year. Return: julian day number, 1 of tishrey julians, 1 of tishrey julians next year """ day = date.day month = date.month if date.month == 13: month = 6 if date.month == 14: ...
python
def hdate_to_jdn(date): """ Compute Julian day from Hebrew day, month and year. Return: julian day number, 1 of tishrey julians, 1 of tishrey julians next year """ day = date.day month = date.month if date.month == 13: month = 6 if date.month == 14: ...
[ "def", "hdate_to_jdn", "(", "date", ")", ":", "day", "=", "date", ".", "day", "month", "=", "date", ".", "month", "if", "date", ".", "month", "==", "13", ":", "month", "=", "6", "if", "date", ".", "month", "==", "14", ":", "month", "=", "6", "d...
Compute Julian day from Hebrew day, month and year. Return: julian day number, 1 of tishrey julians, 1 of tishrey julians next year
[ "Compute", "Julian", "day", "from", "Hebrew", "day", "month", "and", "year", "." ]
train
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L92-L122
royi1000/py-libhdate
hdate/converters.py
jdn_to_gdate
def jdn_to_gdate(jdn): """ Convert from the Julian day to the Gregorian day. Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer. Return: day, month, year """ # pylint: disable=invalid-name # The algorithm is a verbatim copy from Peter Meyer's article # No explanation in t...
python
def jdn_to_gdate(jdn): """ Convert from the Julian day to the Gregorian day. Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer. Return: day, month, year """ # pylint: disable=invalid-name # The algorithm is a verbatim copy from Peter Meyer's article # No explanation in t...
[ "def", "jdn_to_gdate", "(", "jdn", ")", ":", "# pylint: disable=invalid-name", "# The algorithm is a verbatim copy from Peter Meyer's article", "# No explanation in the article is given for the variables", "# Hence the exceptions for pylint and for flake8 (E741)", "l", "=", "jdn", "+", "...
Convert from the Julian day to the Gregorian day. Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer. Return: day, month, year
[ "Convert", "from", "the", "Julian", "day", "to", "the", "Gregorian", "day", "." ]
train
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L125-L149
royi1000/py-libhdate
hdate/converters.py
jdn_to_hdate
def jdn_to_hdate(jdn): """Convert from the Julian day to the Hebrew day.""" # calculate Gregorian date date = jdn_to_gdate(jdn) # Guess Hebrew year is Gregorian year + 3760 year = date.year + 3760 jdn_tishrey1 = hdate_to_jdn(HebrewDate(year, 1, 1)) jdn_tishrey1_next_year = hdate_to_jdn(Heb...
python
def jdn_to_hdate(jdn): """Convert from the Julian day to the Hebrew day.""" # calculate Gregorian date date = jdn_to_gdate(jdn) # Guess Hebrew year is Gregorian year + 3760 year = date.year + 3760 jdn_tishrey1 = hdate_to_jdn(HebrewDate(year, 1, 1)) jdn_tishrey1_next_year = hdate_to_jdn(Heb...
[ "def", "jdn_to_hdate", "(", "jdn", ")", ":", "# calculate Gregorian date", "date", "=", "jdn_to_gdate", "(", "jdn", ")", "# Guess Hebrew year is Gregorian year + 3760", "year", "=", "date", ".", "year", "+", "3760", "jdn_tishrey1", "=", "hdate_to_jdn", "(", "HebrewD...
Convert from the Julian day to the Hebrew day.
[ "Convert", "from", "the", "Julian", "day", "to", "the", "Hebrew", "day", "." ]
train
https://github.com/royi1000/py-libhdate/blob/12af759fb69f1d6403abed3762beaf5ace16a34b/hdate/converters.py#L152-L202
abingham/spor
src/spor/updating.py
update
def update(anchor, handle=None): """Update an anchor based on the current contents of its source file. Args: anchor: The `Anchor` to be updated. handle: File-like object containing contents of the anchor's file. If `None`, then this function will open the file and read it. Retu...
python
def update(anchor, handle=None): """Update an anchor based on the current contents of its source file. Args: anchor: The `Anchor` to be updated. handle: File-like object containing contents of the anchor's file. If `None`, then this function will open the file and read it. Retu...
[ "def", "update", "(", "anchor", ",", "handle", "=", "None", ")", ":", "if", "handle", "is", "None", ":", "with", "anchor", ".", "file_path", ".", "open", "(", "mode", "=", "'rt'", ")", "as", "fp", ":", "source_text", "=", "fp", ".", "read", "(", ...
Update an anchor based on the current contents of its source file. Args: anchor: The `Anchor` to be updated. handle: File-like object containing contents of the anchor's file. If `None`, then this function will open the file and read it. Returns: A new `Anchor`, possibly identical ...
[ "Update", "an", "anchor", "based", "on", "the", "current", "contents", "of", "its", "source", "file", "." ]
train
https://github.com/abingham/spor/blob/673c8c36c99a4b9ea882f002bfb529f1eca89126/src/spor/updating.py#L28-L84
Clinical-Genomics/housekeeper
housekeeper/cli/get.py
get
def get(context, tags: List[str], version: int, verbose: bool, bundle: str): """Get files.""" store = Store(context.obj['database'], context.obj['root']) files = store.files(bundle=bundle, tags=tags, version=version) for file_obj in files: if verbose: tags = ', '.join(tag.name for ta...
python
def get(context, tags: List[str], version: int, verbose: bool, bundle: str): """Get files.""" store = Store(context.obj['database'], context.obj['root']) files = store.files(bundle=bundle, tags=tags, version=version) for file_obj in files: if verbose: tags = ', '.join(tag.name for ta...
[ "def", "get", "(", "context", ",", "tags", ":", "List", "[", "str", "]", ",", "version", ":", "int", ",", "verbose", ":", "bool", ",", "bundle", ":", "str", ")", ":", "store", "=", "Store", "(", "context", ".", "obj", "[", "'database'", "]", ",",...
Get files.
[ "Get", "files", "." ]
train
https://github.com/Clinical-Genomics/housekeeper/blob/a7d10d327dc9f06274bdef5504ed1b9413f2c8c1/housekeeper/cli/get.py#L14-L24
cimatosa/progression
progression/decorators.py
ProgressBar._get_callargs
def _get_callargs(self, *args, **kwargs): """ Retrieve all arguments that `self.func` needs and return a dictionary with call arguments. """ callargs = getcallargs(self.func, *args, **kwargs) return callargs
python
def _get_callargs(self, *args, **kwargs): """ Retrieve all arguments that `self.func` needs and return a dictionary with call arguments. """ callargs = getcallargs(self.func, *args, **kwargs) return callargs
[ "def", "_get_callargs", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "callargs", "=", "getcallargs", "(", "self", ".", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", "callargs" ]
Retrieve all arguments that `self.func` needs and return a dictionary with call arguments.
[ "Retrieve", "all", "arguments", "that", "self", ".", "func", "needs", "and", "return", "a", "dictionary", "with", "call", "arguments", "." ]
train
https://github.com/cimatosa/progression/blob/82cf74a25a47f9bda96157cc2c88e5975c20b41d/progression/decorators.py#L130-L136
vinta/sbi.py
sbi.py
search_by
def search_by(url=None, file=None): """ TODO: support file """ image_url = url # image_file = file """ Search result page """ result_url = GOOGLE_SEARCH_BY_ENDPOINT + image_url referer = 'http://www.google.com/imghp' result_html = fire_request(result_url, referer) re...
python
def search_by(url=None, file=None): """ TODO: support file """ image_url = url # image_file = file """ Search result page """ result_url = GOOGLE_SEARCH_BY_ENDPOINT + image_url referer = 'http://www.google.com/imghp' result_html = fire_request(result_url, referer) re...
[ "def", "search_by", "(", "url", "=", "None", ",", "file", "=", "None", ")", ":", "image_url", "=", "url", "# image_file = file", "\"\"\"\n Search result page\n \"\"\"", "result_url", "=", "GOOGLE_SEARCH_BY_ENDPOINT", "+", "image_url", "referer", "=", "'http://ww...
TODO: support file
[ "TODO", ":", "support", "file" ]
train
https://github.com/vinta/sbi.py/blob/7355b81efd0588a674d36206de9a7c54f347c32b/sbi.py#L109-L169
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.export
def export(self): """Export all attributes of the user to a dict. :return: attributes of the user. :rtype: dict. """ data = {} data["name"] = self.name data["contributions"] = self.contributions data["avatar"] = self.avatar data["followers"] = sel...
python
def export(self): """Export all attributes of the user to a dict. :return: attributes of the user. :rtype: dict. """ data = {} data["name"] = self.name data["contributions"] = self.contributions data["avatar"] = self.avatar data["followers"] = sel...
[ "def", "export", "(", "self", ")", ":", "data", "=", "{", "}", "data", "[", "\"name\"", "]", "=", "self", ".", "name", "data", "[", "\"contributions\"", "]", "=", "self", ".", "contributions", "data", "[", "\"avatar\"", "]", "=", "self", ".", "avatar...
Export all attributes of the user to a dict. :return: attributes of the user. :rtype: dict.
[ "Export", "all", "attributes", "of", "the", "user", "to", "a", "dict", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L79-L97
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getContributions
def __getContributions(self, web): """Scrap the contributions from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ contributions_raw = web.find_all('h2', {'class': 'f4 text-normal mb-2'}) try: ...
python
def __getContributions(self, web): """Scrap the contributions from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ contributions_raw = web.find_all('h2', {'class': 'f4 text-normal mb-2'}) try: ...
[ "def", "__getContributions", "(", "self", ",", "web", ")", ":", "contributions_raw", "=", "web", ".", "find_all", "(", "'h2'", ",", "{", "'class'", ":", "'f4 text-normal mb-2'", "}", ")", "try", ":", "contrText", "=", "contributions_raw", "[", "0", "]", "....
Scrap the contributions from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "contributions", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L110-L129
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getAvatar
def __getAvatar(self, web): """Scrap the avatar from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ try: self.avatar = web.find("img", {"class": "avatar"})['src'][:-10] except IndexError as error: print("There was an ...
python
def __getAvatar(self, web): """Scrap the avatar from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ try: self.avatar = web.find("img", {"class": "avatar"})['src'][:-10] except IndexError as error: print("There was an ...
[ "def", "__getAvatar", "(", "self", ",", "web", ")", ":", "try", ":", "self", ".", "avatar", "=", "web", ".", "find", "(", "\"img\"", ",", "{", "\"class\"", ":", "\"avatar\"", "}", ")", "[", "'src'", "]", "[", ":", "-", "10", "]", "except", "Index...
Scrap the avatar from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "avatar", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L131-L144
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getNumberOfRepositories
def __getNumberOfRepositories(self, web): """Scrap the number of repositories from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ counters = web.find_all('span', {'class': 'Counter'}) try: if 'k' not in counters[0].text: ...
python
def __getNumberOfRepositories(self, web): """Scrap the number of repositories from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ counters = web.find_all('span', {'class': 'Counter'}) try: if 'k' not in counters[0].text: ...
[ "def", "__getNumberOfRepositories", "(", "self", ",", "web", ")", ":", "counters", "=", "web", ".", "find_all", "(", "'span'", ",", "{", "'class'", ":", "'Counter'", "}", ")", "try", ":", "if", "'k'", "not", "in", "counters", "[", "0", "]", ".", "tex...
Scrap the number of repositories from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "number", "of", "repositories", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L146-L170
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getNumberOfFollowers
def __getNumberOfFollowers(self, web): """Scrap the number of followers from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ counters = web.find_all('span', {'class': 'Counter'}) try: if 'k' not in counters[2].text: ...
python
def __getNumberOfFollowers(self, web): """Scrap the number of followers from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ counters = web.find_all('span', {'class': 'Counter'}) try: if 'k' not in counters[2].text: ...
[ "def", "__getNumberOfFollowers", "(", "self", ",", "web", ")", ":", "counters", "=", "web", ".", "find_all", "(", "'span'", ",", "{", "'class'", ":", "'Counter'", "}", ")", "try", ":", "if", "'k'", "not", "in", "counters", "[", "2", "]", ".", "text",...
Scrap the number of followers from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "number", "of", "followers", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L172-L196
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getLocation
def __getLocation(self, web): """Scrap the location from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ try: self.location = web.find("span", {"class": "p-label"}).text except AttributeError as error: print("There was...
python
def __getLocation(self, web): """Scrap the location from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ try: self.location = web.find("span", {"class": "p-label"}).text except AttributeError as error: print("There was...
[ "def", "__getLocation", "(", "self", ",", "web", ")", ":", "try", ":", "self", ".", "location", "=", "web", ".", "find", "(", "\"span\"", ",", "{", "\"class\"", ":", "\"p-label\"", "}", ")", ".", "text", "except", "AttributeError", "as", "error", ":", ...
Scrap the location from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "location", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L198-L208
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getJoin
def __getJoin(self, web): """Scrap the join date from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ join = web.findAll("a", {"class": "dropdown-item"}) for j in join: try: if "Joined GitHub" in j.text: ...
python
def __getJoin(self, web): """Scrap the join date from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ join = web.findAll("a", {"class": "dropdown-item"}) for j in join: try: if "Joined GitHub" in j.text: ...
[ "def", "__getJoin", "(", "self", ",", "web", ")", ":", "join", "=", "web", ".", "findAll", "(", "\"a\"", ",", "{", "\"class\"", ":", "\"dropdown-item\"", "}", ")", "for", "j", "in", "join", ":", "try", ":", "if", "\"Joined GitHub\"", "in", "j", ".", ...
Scrap the join date from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "join", "date", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L210-L226
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getBio
def __getBio(self, web): """Scrap the bio from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ bio = web.find_all("div", {"class": "user-profile-bio"}) if bio: try: bio = bio[0].text if bio and Git...
python
def __getBio(self, web): """Scrap the bio from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ bio = web.find_all("div", {"class": "user-profile-bio"}) if bio: try: bio = bio[0].text if bio and Git...
[ "def", "__getBio", "(", "self", ",", "web", ")", ":", "bio", "=", "web", ".", "find_all", "(", "\"div\"", ",", "{", "\"class\"", ":", "\"user-profile-bio\"", "}", ")", "if", "bio", ":", "try", ":", "bio", "=", "bio", "[", "0", "]", ".", "text", "...
Scrap the bio from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "bio", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L228-L251
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.__getOrganizations
def __getOrganizations(self, web): """Scrap the number of organizations from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ orgsElements = web.find_all("a", {"class": "avatar-group-item"}) self.organizations = len(orgsElements)
python
def __getOrganizations(self, web): """Scrap the number of organizations from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node. """ orgsElements = web.find_all("a", {"class": "avatar-group-item"}) self.organizations = len(orgsElements)
[ "def", "__getOrganizations", "(", "self", ",", "web", ")", ":", "orgsElements", "=", "web", ".", "find_all", "(", "\"a\"", ",", "{", "\"class\"", ":", "\"avatar-group-item\"", "}", ")", "self", ".", "organizations", "=", "len", "(", "orgsElements", ")" ]
Scrap the number of organizations from a GitHub profile. :param web: parsed web. :type web: BeautifulSoup node.
[ "Scrap", "the", "number", "of", "organizations", "from", "a", "GitHub", "profile", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L253-L260
iblancasa/GitHubCity
src/githubcity/ghuser.py
GitHubUser.getData
def getData(self): """Get data of the GitHub user.""" url = self.server + self.name data = GitHubUser.__getDataFromURL(url) web = BeautifulSoup(data, "lxml") self.__getContributions(web) self.__getLocation(web) self.__getAvatar(web) self.__getNumberOfRepos...
python
def getData(self): """Get data of the GitHub user.""" url = self.server + self.name data = GitHubUser.__getDataFromURL(url) web = BeautifulSoup(data, "lxml") self.__getContributions(web) self.__getLocation(web) self.__getAvatar(web) self.__getNumberOfRepos...
[ "def", "getData", "(", "self", ")", ":", "url", "=", "self", ".", "server", "+", "self", ".", "name", "data", "=", "GitHubUser", ".", "__getDataFromURL", "(", "url", ")", "web", "=", "BeautifulSoup", "(", "data", ",", "\"lxml\"", ")", "self", ".", "_...
Get data of the GitHub user.
[ "Get", "data", "of", "the", "GitHub", "user", "." ]
train
https://github.com/iblancasa/GitHubCity/blob/c5299c6859dbefbd869e2ac6ff2faff2a39cf32f/src/githubcity/ghuser.py#L262-L274