repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
kowalpy/Robot-Framework-FTP-Library | FtpLibrary.py | FtpLibrary.send_cmd | def send_cmd(self, command, connId='default'):
"""
Sends any command to FTP server. Returns server output.
Parameters:
- command - any valid command to be sent (invalid will result in exception).
- connId(optional) - connection identifier. By default equals 'default'
Exam... | python | def send_cmd(self, command, connId='default'):
"""
Sends any command to FTP server. Returns server output.
Parameters:
- command - any valid command to be sent (invalid will result in exception).
- connId(optional) - connection identifier. By default equals 'default'
Exam... | [
"def",
"send_cmd",
"(",
"self",
",",
"command",
",",
"connId",
"=",
"'default'",
")",
":",
"thisConn",
"=",
"self",
".",
"__getConnection",
"(",
"connId",
")",
"outputMsg",
"=",
"\"\"",
"try",
":",
"outputMsg",
"+=",
"str",
"(",
"thisConn",
".",
"sendcmd... | Sends any command to FTP server. Returns server output.
Parameters:
- command - any valid command to be sent (invalid will result in exception).
- connId(optional) - connection identifier. By default equals 'default'
Example:
| send cmd | HELP | | [
"Sends",
"any",
"command",
"to",
"FTP",
"server",
".",
"Returns",
"server",
"output",
".",
"Parameters",
":",
"-",
"command",
"-",
"any",
"valid",
"command",
"to",
"be",
"sent",
"(",
"invalid",
"will",
"result",
"in",
"exception",
")",
".",
"-",
"connId"... | train | https://github.com/kowalpy/Robot-Framework-FTP-Library/blob/90794be0a12af489ac98e8ae3b4ff450c83e2f3d/FtpLibrary.py#L419-L436 |
kowalpy/Robot-Framework-FTP-Library | FtpLibrary.py | FtpLibrary.ftp_close | def ftp_close(self, connId='default'):
"""
Closes FTP connection. Returns None.
Parameters:
- connId(optional) - connection identifier. By default equals 'default'
"""
thisConn = self.__getConnection(connId)
try:
thisConn.quit()
self.__remo... | python | def ftp_close(self, connId='default'):
"""
Closes FTP connection. Returns None.
Parameters:
- connId(optional) - connection identifier. By default equals 'default'
"""
thisConn = self.__getConnection(connId)
try:
thisConn.quit()
self.__remo... | [
"def",
"ftp_close",
"(",
"self",
",",
"connId",
"=",
"'default'",
")",
":",
"thisConn",
"=",
"self",
".",
"__getConnection",
"(",
"connId",
")",
"try",
":",
"thisConn",
".",
"quit",
"(",
")",
"self",
".",
"__removeConnection",
"(",
"connId",
")",
"except... | Closes FTP connection. Returns None.
Parameters:
- connId(optional) - connection identifier. By default equals 'default' | [
"Closes",
"FTP",
"connection",
".",
"Returns",
"None",
".",
"Parameters",
":",
"-",
"connId",
"(",
"optional",
")",
"-",
"connection",
"identifier",
".",
"By",
"default",
"equals",
"default"
] | train | https://github.com/kowalpy/Robot-Framework-FTP-Library/blob/90794be0a12af489ac98e8ae3b4ff450c83e2f3d/FtpLibrary.py#L438-L453 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/setup_logging.py | setup_logging | def setup_logging(verbose=0, colors=False, name=None):
"""Configure console logging. Info and below go to stdout, others go to stderr.
:param int verbose: Verbosity level. > 0 print debug statements. > 1 passed to sphinx-build.
:param bool colors: Print color text in non-verbose mode.
:param str name: ... | python | def setup_logging(verbose=0, colors=False, name=None):
"""Configure console logging. Info and below go to stdout, others go to stderr.
:param int verbose: Verbosity level. > 0 print debug statements. > 1 passed to sphinx-build.
:param bool colors: Print color text in non-verbose mode.
:param str name: ... | [
"def",
"setup_logging",
"(",
"verbose",
"=",
"0",
",",
"colors",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"root_logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"root_logger",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
"if",
"v... | Configure console logging. Info and below go to stdout, others go to stderr.
:param int verbose: Verbosity level. > 0 print debug statements. > 1 passed to sphinx-build.
:param bool colors: Print color text in non-verbose mode.
:param str name: Which logger name to set handlers to. Used for testing. | [
"Configure",
"console",
"logging",
".",
"Info",
"and",
"below",
"go",
"to",
"stdout",
"others",
"go",
"to",
"stderr",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/setup_logging.py#L55-L77 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/setup_logging.py | ColorFormatter.format | def format(self, record):
"""Apply little arrow and colors to the record.
Arrow and colors are only applied to sphinxcontrib.versioning log statements.
:param logging.LogRecord record: The log record object to log.
"""
formatted = super(ColorFormatter, self).format(record)
... | python | def format(self, record):
"""Apply little arrow and colors to the record.
Arrow and colors are only applied to sphinxcontrib.versioning log statements.
:param logging.LogRecord record: The log record object to log.
"""
formatted = super(ColorFormatter, self).format(record)
... | [
"def",
"format",
"(",
"self",
",",
"record",
")",
":",
"formatted",
"=",
"super",
"(",
"ColorFormatter",
",",
"self",
")",
".",
"format",
"(",
"record",
")",
"if",
"self",
".",
"verbose",
"or",
"not",
"record",
".",
"name",
".",
"startswith",
"(",
"s... | Apply little arrow and colors to the record.
Arrow and colors are only applied to sphinxcontrib.versioning log statements.
:param logging.LogRecord record: The log record object to log. | [
"Apply",
"little",
"arrow",
"and",
"colors",
"to",
"the",
"record",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/setup_logging.py#L29-L52 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | chunk | def chunk(iterator, max_size):
"""Chunk a list/set/etc.
:param iter iterator: The iterable object to chunk.
:param int max_size: Max size of each chunk. Remainder chunk may be smaller.
:return: Yield list of items.
:rtype: iter
"""
gen = iter(iterator)
while True:
chunked = lis... | python | def chunk(iterator, max_size):
"""Chunk a list/set/etc.
:param iter iterator: The iterable object to chunk.
:param int max_size: Max size of each chunk. Remainder chunk may be smaller.
:return: Yield list of items.
:rtype: iter
"""
gen = iter(iterator)
while True:
chunked = lis... | [
"def",
"chunk",
"(",
"iterator",
",",
"max_size",
")",
":",
"gen",
"=",
"iter",
"(",
"iterator",
")",
"while",
"True",
":",
"chunked",
"=",
"list",
"(",
")",
"for",
"i",
",",
"item",
"in",
"enumerate",
"(",
"gen",
")",
":",
"chunked",
".",
"append"... | Chunk a list/set/etc.
:param iter iterator: The iterable object to chunk.
:param int max_size: Max size of each chunk. Remainder chunk may be smaller.
:return: Yield list of items.
:rtype: iter | [
"Chunk",
"a",
"list",
"/",
"set",
"/",
"etc",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L94-L112 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | run_command | def run_command(local_root, command, env_var=True, pipeto=None, retry=0, environ=None):
"""Run a command and return the output.
:raise CalledProcessError: Command exits non-zero.
:param str local_root: Local path to git root directory.
:param iter command: Command to run.
:param dict environ: Envi... | python | def run_command(local_root, command, env_var=True, pipeto=None, retry=0, environ=None):
"""Run a command and return the output.
:raise CalledProcessError: Command exits non-zero.
:param str local_root: Local path to git root directory.
:param iter command: Command to run.
:param dict environ: Envi... | [
"def",
"run_command",
"(",
"local_root",
",",
"command",
",",
"env_var",
"=",
"True",
",",
"pipeto",
"=",
"None",
",",
"retry",
"=",
"0",
",",
"environ",
"=",
"None",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"# Setup env... | Run a command and return the output.
:raise CalledProcessError: Command exits non-zero.
:param str local_root: Local path to git root directory.
:param iter command: Command to run.
:param dict environ: Environment variables to set/override in the command.
:param bool env_var: Define GIT_DIR envir... | [
"Run",
"a",
"command",
"and",
"return",
"the",
"output",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L115-L158 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | get_root | def get_root(directory):
"""Get root directory of the local git repo from any subdirectory within it.
:raise GitError: If git command fails (dir not a git repo?).
:param str directory: Subdirectory in the local repo.
:return: Root directory of repository.
:rtype: str
"""
command = ['git',... | python | def get_root(directory):
"""Get root directory of the local git repo from any subdirectory within it.
:raise GitError: If git command fails (dir not a git repo?).
:param str directory: Subdirectory in the local repo.
:return: Root directory of repository.
:rtype: str
"""
command = ['git',... | [
"def",
"get_root",
"(",
"directory",
")",
":",
"command",
"=",
"[",
"'git'",
",",
"'rev-parse'",
",",
"'--show-toplevel'",
"]",
"try",
":",
"output",
"=",
"run_command",
"(",
"directory",
",",
"command",
",",
"env_var",
"=",
"False",
")",
"except",
"Called... | Get root directory of the local git repo from any subdirectory within it.
:raise GitError: If git command fails (dir not a git repo?).
:param str directory: Subdirectory in the local repo.
:return: Root directory of repository.
:rtype: str | [
"Get",
"root",
"directory",
"of",
"the",
"local",
"git",
"repo",
"from",
"any",
"subdirectory",
"within",
"it",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L161-L178 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | list_remote | def list_remote(local_root):
"""Get remote branch/tag latest SHAs.
:raise GitError: When git ls-remote fails.
:param str local_root: Local path to git root directory.
:return: List of tuples containing strings. Each tuple is sha, name, kind.
:rtype: list
"""
command = ['git', 'ls-remote',... | python | def list_remote(local_root):
"""Get remote branch/tag latest SHAs.
:raise GitError: When git ls-remote fails.
:param str local_root: Local path to git root directory.
:return: List of tuples containing strings. Each tuple is sha, name, kind.
:rtype: list
"""
command = ['git', 'ls-remote',... | [
"def",
"list_remote",
"(",
"local_root",
")",
":",
"command",
"=",
"[",
"'git'",
",",
"'ls-remote'",
",",
"'--heads'",
",",
"'--tags'",
"]",
"try",
":",
"output",
"=",
"run_command",
"(",
"local_root",
",",
"command",
")",
"except",
"CalledProcessError",
"as... | Get remote branch/tag latest SHAs.
:raise GitError: When git ls-remote fails.
:param str local_root: Local path to git root directory.
:return: List of tuples containing strings. Each tuple is sha, name, kind.
:rtype: list | [
"Get",
"remote",
"branch",
"/",
"tag",
"latest",
"SHAs",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L181-L209 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | filter_and_date | def filter_and_date(local_root, conf_rel_paths, commits):
"""Get commit Unix timestamps and first matching conf.py path. Exclude commits with no conf.py file.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: A commit SHA has not been fetched.
:param str local_root: Local path... | python | def filter_and_date(local_root, conf_rel_paths, commits):
"""Get commit Unix timestamps and first matching conf.py path. Exclude commits with no conf.py file.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: A commit SHA has not been fetched.
:param str local_root: Local path... | [
"def",
"filter_and_date",
"(",
"local_root",
",",
"conf_rel_paths",
",",
"commits",
")",
":",
"dates_paths",
"=",
"dict",
"(",
")",
"# Filter without docs.",
"for",
"commit",
"in",
"commits",
":",
"if",
"commit",
"in",
"dates_paths",
":",
"continue",
"command",
... | Get commit Unix timestamps and first matching conf.py path. Exclude commits with no conf.py file.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: A commit SHA has not been fetched.
:param str local_root: Local path to git root directory.
:param iter conf_rel_paths: List of p... | [
"Get",
"commit",
"Unix",
"timestamps",
"and",
"first",
"matching",
"conf",
".",
"py",
"path",
".",
"Exclude",
"commits",
"with",
"no",
"conf",
".",
"py",
"file",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L212-L249 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | fetch_commits | def fetch_commits(local_root, remotes):
"""Fetch from origin.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:param iter remotes: Output of list_remote().
"""
# Fetch all known branches.
command = ['git', 'fetch', 'origin'... | python | def fetch_commits(local_root, remotes):
"""Fetch from origin.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:param iter remotes: Output of list_remote().
"""
# Fetch all known branches.
command = ['git', 'fetch', 'origin'... | [
"def",
"fetch_commits",
"(",
"local_root",
",",
"remotes",
")",
":",
"# Fetch all known branches.",
"command",
"=",
"[",
"'git'",
",",
"'fetch'",
",",
"'origin'",
"]",
"run_command",
"(",
"local_root",
",",
"command",
")",
"# Fetch new branches/tags.",
"for",
"sha... | Fetch from origin.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:param iter remotes: Output of list_remote(). | [
"Fetch",
"from",
"origin",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L252-L270 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | export | def export(local_root, commit, target):
"""Export git commit to directory. "Extracts" all files at the commit to the target directory.
Set mtime of RST files to last commit date.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:pa... | python | def export(local_root, commit, target):
"""Export git commit to directory. "Extracts" all files at the commit to the target directory.
Set mtime of RST files to last commit date.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:pa... | [
"def",
"export",
"(",
"local_root",
",",
"commit",
",",
"target",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"target",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"target",
")",
"mtimes",
"=",
"list",
"(",
")",
"# Defi... | Export git commit to directory. "Extracts" all files at the commit to the target directory.
Set mtime of RST files to last commit date.
:raise CalledProcessError: Unhandled git command failure.
:param str local_root: Local path to git root directory.
:param str commit: Git commit SHA to export.
:... | [
"Export",
"git",
"commit",
"to",
"directory",
".",
"Extracts",
"all",
"files",
"at",
"the",
"commit",
"to",
"the",
"target",
"directory",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L273-L322 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | clone | def clone(local_root, new_root, remote, branch, rel_dest, exclude):
"""Clone "local_root" origin into a new directory and check out a specific branch. Optionally run "git rm".
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Handled git failures.
:param str local_root: Local ... | python | def clone(local_root, new_root, remote, branch, rel_dest, exclude):
"""Clone "local_root" origin into a new directory and check out a specific branch. Optionally run "git rm".
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Handled git failures.
:param str local_root: Local ... | [
"def",
"clone",
"(",
"local_root",
",",
"new_root",
",",
"remote",
",",
"branch",
",",
"rel_dest",
",",
"exclude",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"output",
"=",
"run_command",
"(",
"local_root",
",",
"[",
"'git'"... | Clone "local_root" origin into a new directory and check out a specific branch. Optionally run "git rm".
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Handled git failures.
:param str local_root: Local path to git root directory.
:param str new_root: Local path empty direc... | [
"Clone",
"local_root",
"origin",
"into",
"a",
"new",
"directory",
"and",
"check",
"out",
"a",
"specific",
"branch",
".",
"Optionally",
"run",
"git",
"rm",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L325-L390 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/git.py | commit_and_push | def commit_and_push(local_root, remote, versions):
"""Commit changed, new, and deleted files in the repo and attempt to push the branch to the remote repository.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Conflicting changes made in remote by other client and bad git config ... | python | def commit_and_push(local_root, remote, versions):
"""Commit changed, new, and deleted files in the repo and attempt to push the branch to the remote repository.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Conflicting changes made in remote by other client and bad git config ... | [
"def",
"commit_and_push",
"(",
"local_root",
",",
"remote",
",",
"versions",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"current_branch",
"=",
"run_command",
"(",
"local_root",
",",
"[",
"'git'",
",",
"'rev-parse'",
",",
"'--abb... | Commit changed, new, and deleted files in the repo and attempt to push the branch to the remote repository.
:raise CalledProcessError: Unhandled git command failure.
:raise GitError: Conflicting changes made in remote by other client and bad git config for commits.
:param str local_root: Local path to git... | [
"Commit",
"changed",
"new",
"and",
"deleted",
"files",
"in",
"the",
"repo",
"and",
"attempt",
"to",
"push",
"the",
"branch",
"to",
"the",
"remote",
"repository",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/git.py#L393-L457 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | semvers | def semvers(names):
"""Parse versions into integers and convert non-integer meta indicators into integers with ord().
Each return list item has an indicator as the first item. 0 for valid versions and 1 for invalid. Can be used to
sort non-version names (e.g. master, feature_branch, etc) after valid versio... | python | def semvers(names):
"""Parse versions into integers and convert non-integer meta indicators into integers with ord().
Each return list item has an indicator as the first item. 0 for valid versions and 1 for invalid. Can be used to
sort non-version names (e.g. master, feature_branch, etc) after valid versio... | [
"def",
"semvers",
"(",
"names",
")",
":",
"matches",
"=",
"[",
"(",
"RE_SEMVER",
".",
"findall",
"(",
"n",
")",
"or",
"[",
"[",
"]",
"]",
")",
"[",
"0",
"]",
"for",
"n",
"in",
"names",
"]",
"max_len_ints",
"=",
"0",
"max_len_str",
"=",
"0",
"# ... | Parse versions into integers and convert non-integer meta indicators into integers with ord().
Each return list item has an indicator as the first item. 0 for valid versions and 1 for invalid. Can be used to
sort non-version names (e.g. master, feature_branch, etc) after valid versions. No sorting is done in t... | [
"Parse",
"versions",
"into",
"integers",
"and",
"convert",
"non",
"-",
"integer",
"meta",
"indicators",
"into",
"integers",
"with",
"ord",
"()",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L8-L44 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | multi_sort | def multi_sort(remotes, sort):
"""Sort `remotes` in place. Allows sorting by multiple conditions.
This is needed because Python 3 no longer supports sorting lists of multiple types. Sort keys must all be of the
same type.
Problem: the user expects versions to be sorted latest first and timelogical to ... | python | def multi_sort(remotes, sort):
"""Sort `remotes` in place. Allows sorting by multiple conditions.
This is needed because Python 3 no longer supports sorting lists of multiple types. Sort keys must all be of the
same type.
Problem: the user expects versions to be sorted latest first and timelogical to ... | [
"def",
"multi_sort",
"(",
"remotes",
",",
"sort",
")",
":",
"exploded_alpha",
"=",
"list",
"(",
")",
"exploded_semver",
"=",
"list",
"(",
")",
"# Convert name to int if alpha is in sort.",
"if",
"'alpha'",
"in",
"sort",
":",
"alpha_max_len",
"=",
"max",
"(",
"... | Sort `remotes` in place. Allows sorting by multiple conditions.
This is needed because Python 3 no longer supports sorting lists of multiple types. Sort keys must all be of the
same type.
Problem: the user expects versions to be sorted latest first and timelogical to be most recent first (when viewing
... | [
"Sort",
"remotes",
"in",
"place",
".",
"Allows",
"sorting",
"by",
"multiple",
"conditions",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L47-L87 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | Versions.branches | def branches(self):
"""Return list of (name and urls) only branches."""
return [(r['name'], self.vpathto(r['name'])) for r in self.remotes if r['kind'] == 'heads'] | python | def branches(self):
"""Return list of (name and urls) only branches."""
return [(r['name'], self.vpathto(r['name'])) for r in self.remotes if r['kind'] == 'heads'] | [
"def",
"branches",
"(",
"self",
")",
":",
"return",
"[",
"(",
"r",
"[",
"'name'",
"]",
",",
"self",
".",
"vpathto",
"(",
"r",
"[",
"'name'",
"]",
")",
")",
"for",
"r",
"in",
"self",
".",
"remotes",
"if",
"r",
"[",
"'kind'",
"]",
"==",
"'heads'"... | Return list of (name and urls) only branches. | [
"Return",
"list",
"of",
"(",
"name",
"and",
"urls",
")",
"only",
"branches",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L196-L198 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | Versions.tags | def tags(self):
"""Return list of (name and urls) only tags."""
return [(r['name'], self.vpathto(r['name'])) for r in self.remotes if r['kind'] == 'tags'] | python | def tags(self):
"""Return list of (name and urls) only tags."""
return [(r['name'], self.vpathto(r['name'])) for r in self.remotes if r['kind'] == 'tags'] | [
"def",
"tags",
"(",
"self",
")",
":",
"return",
"[",
"(",
"r",
"[",
"'name'",
"]",
",",
"self",
".",
"vpathto",
"(",
"r",
"[",
"'name'",
"]",
")",
")",
"for",
"r",
"in",
"self",
".",
"remotes",
"if",
"r",
"[",
"'kind'",
"]",
"==",
"'tags'",
"... | Return list of (name and urls) only tags. | [
"Return",
"list",
"of",
"(",
"name",
"and",
"urls",
")",
"only",
"tags",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L201-L203 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | Versions.vhasdoc | def vhasdoc(self, other_version):
"""Return True if the other version has the current document. Like Sphinx's hasdoc().
:raise KeyError: If other_version doesn't exist.
:param str other_version: Version to link to.
:return: If current document is in the other version.
:rtype: ... | python | def vhasdoc(self, other_version):
"""Return True if the other version has the current document. Like Sphinx's hasdoc().
:raise KeyError: If other_version doesn't exist.
:param str other_version: Version to link to.
:return: If current document is in the other version.
:rtype: ... | [
"def",
"vhasdoc",
"(",
"self",
",",
"other_version",
")",
":",
"if",
"self",
".",
"context",
"[",
"'current_version'",
"]",
"==",
"other_version",
":",
"return",
"True",
"return",
"self",
".",
"context",
"[",
"'pagename'",
"]",
"in",
"self",
"[",
"other_ve... | Return True if the other version has the current document. Like Sphinx's hasdoc().
:raise KeyError: If other_version doesn't exist.
:param str other_version: Version to link to.
:return: If current document is in the other version.
:rtype: bool | [
"Return",
"True",
"if",
"the",
"other",
"version",
"has",
"the",
"current",
"document",
".",
"Like",
"Sphinx",
"s",
"hasdoc",
"()",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L205-L217 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/versions.py | Versions.vpathto | def vpathto(self, other_version):
"""Return relative path to current document in another version. Like Sphinx's pathto().
If the current document doesn't exist in the other version its master_doc path is returned instead.
:raise KeyError: If other_version doesn't exist.
:param str oth... | python | def vpathto(self, other_version):
"""Return relative path to current document in another version. Like Sphinx's pathto().
If the current document doesn't exist in the other version its master_doc path is returned instead.
:raise KeyError: If other_version doesn't exist.
:param str oth... | [
"def",
"vpathto",
"(",
"self",
",",
"other_version",
")",
":",
"is_root",
"=",
"self",
".",
"context",
"[",
"'scv_is_root'",
"]",
"pagename",
"=",
"self",
".",
"context",
"[",
"'pagename'",
"]",
"if",
"self",
".",
"context",
"[",
"'current_version'",
"]",
... | Return relative path to current document in another version. Like Sphinx's pathto().
If the current document doesn't exist in the other version its master_doc path is returned instead.
:raise KeyError: If other_version doesn't exist.
:param str other_version: Version to link to.
:ret... | [
"Return",
"relative",
"path",
"to",
"current",
"document",
"in",
"another",
"version",
".",
"Like",
"Sphinx",
"s",
"pathto",
"()",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/versions.py#L219-L241 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/routines.py | read_local_conf | def read_local_conf(local_conf):
"""Search for conf.py in any rel_source directory in CWD and if found read it and return.
:param str local_conf: Path to conf.py to read.
:return: Loaded conf.py.
:rtype: dict
"""
log = logging.getLogger(__name__)
# Attempt to read.
log.info('Reading c... | python | def read_local_conf(local_conf):
"""Search for conf.py in any rel_source directory in CWD and if found read it and return.
:param str local_conf: Path to conf.py to read.
:return: Loaded conf.py.
:rtype: dict
"""
log = logging.getLogger(__name__)
# Attempt to read.
log.info('Reading c... | [
"def",
"read_local_conf",
"(",
"local_conf",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"# Attempt to read.",
"log",
".",
"info",
"(",
"'Reading config from %s...'",
",",
"local_conf",
")",
"try",
":",
"config",
"=",
"read_config",
... | Search for conf.py in any rel_source directory in CWD and if found read it and return.
:param str local_conf: Path to conf.py to read.
:return: Loaded conf.py.
:rtype: dict | [
"Search",
"for",
"conf",
".",
"py",
"in",
"any",
"rel_source",
"directory",
"in",
"CWD",
"and",
"if",
"found",
"read",
"it",
"and",
"return",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/routines.py#L16-L35 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/routines.py | gather_git_info | def gather_git_info(root, conf_rel_paths, whitelist_branches, whitelist_tags):
"""Gather info about the remote git repository. Get list of refs.
:raise HandledError: If function fails with a handled error. Will be logged before raising.
:param str root: Root directory of repository.
:param iter conf_r... | python | def gather_git_info(root, conf_rel_paths, whitelist_branches, whitelist_tags):
"""Gather info about the remote git repository. Get list of refs.
:raise HandledError: If function fails with a handled error. Will be logged before raising.
:param str root: Root directory of repository.
:param iter conf_r... | [
"def",
"gather_git_info",
"(",
"root",
",",
"conf_rel_paths",
",",
"whitelist_branches",
",",
"whitelist_tags",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"# List remote.",
"log",
".",
"info",
"(",
"'Getting list of all remote branches/... | Gather info about the remote git repository. Get list of refs.
:raise HandledError: If function fails with a handled error. Will be logged before raising.
:param str root: Root directory of repository.
:param iter conf_rel_paths: List of possible relative paths (to git root) of Sphinx conf.py (e.g. docs/c... | [
"Gather",
"info",
"about",
"the",
"remote",
"git",
"repository",
".",
"Get",
"list",
"of",
"refs",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/routines.py#L38-L97 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/routines.py | pre_build | def pre_build(local_root, versions):
"""Build docs for all versions to determine root directory and master_doc names.
Need to build docs to (a) avoid filename collision with files from root_ref and branch/tag names and (b) determine
master_doc config values for all versions (in case master_doc changes from... | python | def pre_build(local_root, versions):
"""Build docs for all versions to determine root directory and master_doc names.
Need to build docs to (a) avoid filename collision with files from root_ref and branch/tag names and (b) determine
master_doc config values for all versions (in case master_doc changes from... | [
"def",
"pre_build",
"(",
"local_root",
",",
"versions",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"exported_root",
"=",
"TempDir",
"(",
"True",
")",
".",
"name",
"# Extract all.",
"for",
"sha",
"in",
"{",
"r",
"[",
"'sha'",... | Build docs for all versions to determine root directory and master_doc names.
Need to build docs to (a) avoid filename collision with files from root_ref and branch/tag names and (b) determine
master_doc config values for all versions (in case master_doc changes from e.g. contents.rst to index.rst between
... | [
"Build",
"docs",
"for",
"all",
"versions",
"to",
"determine",
"root",
"directory",
"and",
"master_doc",
"names",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/routines.py#L100-L154 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/routines.py | build_all | def build_all(exported_root, destination, versions):
"""Build all versions.
:param str exported_root: Tempdir path with exported commits as subdirectories.
:param str destination: Destination directory to copy/overwrite built docs to. Does not delete old files.
:param sphinxcontrib.versioning.versions.... | python | def build_all(exported_root, destination, versions):
"""Build all versions.
:param str exported_root: Tempdir path with exported commits as subdirectories.
:param str destination: Destination directory to copy/overwrite built docs to. Does not delete old files.
:param sphinxcontrib.versioning.versions.... | [
"def",
"build_all",
"(",
"exported_root",
",",
"destination",
",",
"versions",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"while",
"True",
":",
"# Build root.",
"remote",
"=",
"versions",
"[",
"Config",
".",
"from_context",
"(",... | Build all versions.
:param str exported_root: Tempdir path with exported commits as subdirectories.
:param str destination: Destination directory to copy/overwrite built docs to. Does not delete old files.
:param sphinxcontrib.versioning.versions.Versions versions: Versions class instance. | [
"Build",
"all",
"versions",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/routines.py#L157-L185 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | setup | def setup(app):
"""Called by Sphinx during phase 0 (initialization).
:param sphinx.application.Sphinx app: Sphinx application object.
:returns: Extension version.
:rtype: dict
"""
# Used internally. For rebuilding all pages when one or versions fail.
app.add_config_value('sphinxcontrib_ver... | python | def setup(app):
"""Called by Sphinx during phase 0 (initialization).
:param sphinx.application.Sphinx app: Sphinx application object.
:returns: Extension version.
:rtype: dict
"""
# Used internally. For rebuilding all pages when one or versions fail.
app.add_config_value('sphinxcontrib_ver... | [
"def",
"setup",
"(",
"app",
")",
":",
"# Used internally. For rebuilding all pages when one or versions fail.",
"app",
".",
"add_config_value",
"(",
"'sphinxcontrib_versioning_versions'",
",",
"SC_VERSIONING_VERSIONS",
",",
"'html'",
")",
"# Needed for banner.",
"app",
".",
"... | Called by Sphinx during phase 0 (initialization).
:param sphinx.application.Sphinx app: Sphinx application object.
:returns: Extension version.
:rtype: dict | [
"Called",
"by",
"Sphinx",
"during",
"phase",
"0",
"(",
"initialization",
")",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L137-L160 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | _build | def _build(argv, config, versions, current_name, is_root):
"""Build Sphinx docs via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param sphinxcontrib.versioning.versions.Versions versions: Versio... | python | def _build(argv, config, versions, current_name, is_root):
"""Build Sphinx docs via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param sphinxcontrib.versioning.versions.Versions versions: Versio... | [
"def",
"_build",
"(",
"argv",
",",
"config",
",",
"versions",
",",
"current_name",
",",
"is_root",
")",
":",
"# Patch.",
"application",
".",
"Config",
"=",
"ConfigInject",
"if",
"config",
".",
"show_banner",
":",
"EventHandlers",
".",
"BANNER_GREATEST_TAG",
"=... | Build Sphinx docs via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param sphinxcontrib.versioning.versions.Versions versions: Versions class instance.
:param str current_name: The ref name of th... | [
"Build",
"Sphinx",
"docs",
"via",
"multiprocessing",
"for",
"isolation",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L172-L204 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | _read_config | def _read_config(argv, config, current_name, queue):
"""Read the Sphinx config via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param str current_name: The ref name of the current version being ... | python | def _read_config(argv, config, current_name, queue):
"""Read the Sphinx config via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param str current_name: The ref name of the current version being ... | [
"def",
"_read_config",
"(",
"argv",
",",
"config",
",",
"current_name",
",",
"queue",
")",
":",
"# Patch.",
"EventHandlers",
".",
"ABORT_AFTER_READ",
"=",
"queue",
"# Run.",
"_build",
"(",
"argv",
",",
"config",
",",
"Versions",
"(",
"list",
"(",
")",
")",... | Read the Sphinx config via multiprocessing for isolation.
:param tuple argv: Arguments to pass to Sphinx.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param str current_name: The ref name of the current version being built.
:param multiprocessing.queues.Queue queue: Commun... | [
"Read",
"the",
"Sphinx",
"config",
"via",
"multiprocessing",
"for",
"isolation",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L207-L219 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | build | def build(source, target, versions, current_name, is_root):
"""Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
... | python | def build(source, target, versions, current_name, is_root):
"""Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
... | [
"def",
"build",
"(",
"source",
",",
"target",
",",
"versions",
",",
"current_name",
",",
"is_root",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"argv",
"=",
"(",
"'sphinx-build'",
",",
"source",
",",
"target",
")",
"config",
... | Build Sphinx docs for one version. Includes Versions class instance with names/urls in the HTML context.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
:param str target: Destination directory to write documentation t... | [
"Build",
"Sphinx",
"docs",
"for",
"one",
"version",
".",
"Includes",
"Versions",
"class",
"instance",
"with",
"names",
"/",
"urls",
"in",
"the",
"HTML",
"context",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L222-L243 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | read_config | def read_config(source, current_name):
"""Read the Sphinx config for one version.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
:param str current_name: The ref name of the current version being built.
:retu... | python | def read_config(source, current_name):
"""Read the Sphinx config for one version.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
:param str current_name: The ref name of the current version being built.
:retu... | [
"def",
"read_config",
"(",
"source",
",",
"current_name",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"queue",
"=",
"multiprocessing",
".",
"Queue",
"(",
")",
"config",
"=",
"Config",
".",
"from_context",
"(",
")",
"with",
"T... | Read the Sphinx config for one version.
:raise HandledError: If sphinx-build fails. Will be logged before raising.
:param str source: Source directory to pass to sphinx-build.
:param str current_name: The ref name of the current version being built.
:return: Specific Sphinx config values.
:rtype:... | [
"Read",
"the",
"Sphinx",
"config",
"for",
"one",
"version",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L246-L272 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | EventHandlers.builder_inited | def builder_inited(app):
"""Update the Sphinx builder.
:param sphinx.application.Sphinx app: Sphinx application object.
"""
# Add this extension's _templates directory to Sphinx.
templates_dir = os.path.join(os.path.dirname(__file__), '_templates')
app.builder.templates.... | python | def builder_inited(app):
"""Update the Sphinx builder.
:param sphinx.application.Sphinx app: Sphinx application object.
"""
# Add this extension's _templates directory to Sphinx.
templates_dir = os.path.join(os.path.dirname(__file__), '_templates')
app.builder.templates.... | [
"def",
"builder_inited",
"(",
"app",
")",
":",
"# Add this extension's _templates directory to Sphinx.",
"templates_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'_templates'",
")",
"app",
".",
"... | Update the Sphinx builder.
:param sphinx.application.Sphinx app: Sphinx application object. | [
"Update",
"the",
"Sphinx",
"builder",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L47-L62 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | EventHandlers.env_updated | def env_updated(cls, app, env):
"""Abort Sphinx after initializing config and discovering all pages to build.
:param sphinx.application.Sphinx app: Sphinx application object.
:param sphinx.environment.BuildEnvironment env: Sphinx build environment.
"""
if cls.ABORT_AFTER_READ:
... | python | def env_updated(cls, app, env):
"""Abort Sphinx after initializing config and discovering all pages to build.
:param sphinx.application.Sphinx app: Sphinx application object.
:param sphinx.environment.BuildEnvironment env: Sphinx build environment.
"""
if cls.ABORT_AFTER_READ:
... | [
"def",
"env_updated",
"(",
"cls",
",",
"app",
",",
"env",
")",
":",
"if",
"cls",
".",
"ABORT_AFTER_READ",
":",
"config",
"=",
"{",
"n",
":",
"getattr",
"(",
"app",
".",
"config",
",",
"n",
")",
"for",
"n",
"in",
"(",
"a",
"for",
"a",
"in",
"dir... | Abort Sphinx after initializing config and discovering all pages to build.
:param sphinx.application.Sphinx app: Sphinx application object.
:param sphinx.environment.BuildEnvironment env: Sphinx build environment. | [
"Abort",
"Sphinx",
"after",
"initializing",
"config",
"and",
"discovering",
"all",
"pages",
"to",
"build",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L65-L76 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/sphinx_.py | EventHandlers.html_page_context | def html_page_context(cls, app, pagename, templatename, context, doctree):
"""Update the Jinja2 HTML context, exposes the Versions class instance to it.
:param sphinx.application.Sphinx app: Sphinx application object.
:param str pagename: Name of the page being rendered (without .html or any fi... | python | def html_page_context(cls, app, pagename, templatename, context, doctree):
"""Update the Jinja2 HTML context, exposes the Versions class instance to it.
:param sphinx.application.Sphinx app: Sphinx application object.
:param str pagename: Name of the page being rendered (without .html or any fi... | [
"def",
"html_page_context",
"(",
"cls",
",",
"app",
",",
"pagename",
",",
"templatename",
",",
"context",
",",
"doctree",
")",
":",
"assert",
"templatename",
"or",
"doctree",
"# Unused, for linting.",
"cls",
".",
"VERSIONS",
".",
"context",
"=",
"context",
"ve... | Update the Jinja2 HTML context, exposes the Versions class instance to it.
:param sphinx.application.Sphinx app: Sphinx application object.
:param str pagename: Name of the page being rendered (without .html or any file extension).
:param str templatename: Page name with .html.
:param d... | [
"Update",
"the",
"Jinja2",
"HTML",
"context",
"exposes",
"the",
"Versions",
"class",
"instance",
"to",
"it",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/sphinx_.py#L79-L134 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | cli | def cli(config, **options):
"""Build versioned Sphinx docs for every branch and tag pushed to origin.
Supports only building locally with the "build" sub command or build and push to a remote with the "push" sub
command. For more information for either run them with their own --help.
The options below... | python | def cli(config, **options):
"""Build versioned Sphinx docs for every branch and tag pushed to origin.
Supports only building locally with the "build" sub command or build and push to a remote with the "push" sub
command. For more information for either run them with their own --help.
The options below... | [
"def",
"cli",
"(",
"config",
",",
"*",
"*",
"options",
")",
":",
"def",
"pre",
"(",
"rel_source",
")",
":",
"\"\"\"To be executed in a Click sub command.\n\n Needed because if this code is in cli() it will be executed when the user runs: <command> <sub command> --help\n\n ... | Build versioned Sphinx docs for every branch and tag pushed to origin.
Supports only building locally with the "build" sub command or build and push to a remote with the "push" sub
command. For more information for either run them with their own --help.
The options below are global and must be specified b... | [
"Build",
"versioned",
"Sphinx",
"docs",
"for",
"every",
"branch",
"and",
"tag",
"pushed",
"to",
"origin",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L121-L173 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | build_options | def build_options(func):
"""Add "build" Click options to function.
:param function func: The function to wrap.
:return: The wrapped function.
:rtype: function
"""
func = click.option('-a', '--banner-greatest-tag', is_flag=True,
help='Override banner-main-ref to be the t... | python | def build_options(func):
"""Add "build" Click options to function.
:param function func: The function to wrap.
:return: The wrapped function.
:rtype: function
"""
func = click.option('-a', '--banner-greatest-tag', is_flag=True,
help='Override banner-main-ref to be the t... | [
"def",
"build_options",
"(",
"func",
")",
":",
"func",
"=",
"click",
".",
"option",
"(",
"'-a'",
",",
"'--banner-greatest-tag'",
",",
"is_flag",
"=",
"True",
",",
"help",
"=",
"'Override banner-main-ref to be the tag with the highest version number.'",
")",
"(",
"fu... | Add "build" Click options to function.
:param function func: The function to wrap.
:return: The wrapped function.
:rtype: function | [
"Add",
"build",
"Click",
"options",
"to",
"function",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L176-L207 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | override_root_main_ref | def override_root_main_ref(config, remotes, banner):
"""Override root_ref or banner_main_ref with tags in config if user requested.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param iter remotes: List of dicts from Versions.remotes.
:param bool banner: Evaluate banner mai... | python | def override_root_main_ref(config, remotes, banner):
"""Override root_ref or banner_main_ref with tags in config if user requested.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param iter remotes: List of dicts from Versions.remotes.
:param bool banner: Evaluate banner mai... | [
"def",
"override_root_main_ref",
"(",
"config",
",",
"remotes",
",",
"banner",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"greatest_tag",
"=",
"config",
".",
"banner_greatest_tag",
"if",
"banner",
"else",
"config",
".",
"greatest_... | Override root_ref or banner_main_ref with tags in config if user requested.
:param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
:param iter remotes: List of dicts from Versions.remotes.
:param bool banner: Evaluate banner main ref instead of root ref.
:return: If root/main ref ex... | [
"Override",
"root_ref",
"or",
"banner_main_ref",
"with",
"tags",
"in",
"config",
"if",
"user",
"requested",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L210-L234 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | build | def build(config, rel_source, destination, **options):
"""Fetch branches/tags and build all locally.
Doesn't push anything to remote. Just fetch all remote branches and tags, export them to a temporary directory, run
sphinx-build on each one, and then store all built documentation in DESTINATION.
REL_... | python | def build(config, rel_source, destination, **options):
"""Fetch branches/tags and build all locally.
Doesn't push anything to remote. Just fetch all remote branches and tags, export them to a temporary directory, run
sphinx-build on each one, and then store all built documentation in DESTINATION.
REL_... | [
"def",
"build",
"(",
"config",
",",
"rel_source",
",",
"destination",
",",
"*",
"*",
"options",
")",
":",
"if",
"'pre'",
"in",
"config",
":",
"config",
".",
"pop",
"(",
"'pre'",
")",
"(",
"rel_source",
")",
"config",
".",
"update",
"(",
"{",
"k",
"... | Fetch branches/tags and build all locally.
Doesn't push anything to remote. Just fetch all remote branches and tags, export them to a temporary directory, run
sphinx-build on each one, and then store all built documentation in DESTINATION.
REL_SOURCE is the path to the docs directory relative to the git r... | [
"Fetch",
"branches",
"/",
"tags",
"and",
"build",
"all",
"locally",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L242-L318 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | push | def push(ctx, config, rel_source, dest_branch, rel_dest, **options):
"""Build locally and then push to remote branch.
First the build sub command is invoked which takes care of building all versions of your documentation in a
temporary directory. If that succeeds then all built documents will be pushed to ... | python | def push(ctx, config, rel_source, dest_branch, rel_dest, **options):
"""Build locally and then push to remote branch.
First the build sub command is invoked which takes care of building all versions of your documentation in a
temporary directory. If that succeeds then all built documents will be pushed to ... | [
"def",
"push",
"(",
"ctx",
",",
"config",
",",
"rel_source",
",",
"dest_branch",
",",
"rel_dest",
",",
"*",
"*",
"options",
")",
":",
"if",
"'pre'",
"in",
"config",
":",
"config",
".",
"pop",
"(",
"'pre'",
")",
"(",
"rel_source",
")",
"config",
".",
... | Build locally and then push to remote branch.
First the build sub command is invoked which takes care of building all versions of your documentation in a
temporary directory. If that succeeds then all built documents will be pushed to a remote branch.
REL_SOURCE is the path to the docs directory relative ... | [
"Build",
"locally",
"and",
"then",
"push",
"to",
"remote",
"branch",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L332-L395 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | ClickGroup.custom_sort | def custom_sort(param):
"""Custom Click(Command|Group).params sorter.
Case insensitive sort with capitals after lowercase. --version at the end since I can't sort --help.
:param click.core.Option param: Parameter to evaluate.
:return: Sort weight.
:rtype: int
"""
... | python | def custom_sort(param):
"""Custom Click(Command|Group).params sorter.
Case insensitive sort with capitals after lowercase. --version at the end since I can't sort --help.
:param click.core.Option param: Parameter to evaluate.
:return: Sort weight.
:rtype: int
"""
... | [
"def",
"custom_sort",
"(",
"param",
")",
":",
"option",
"=",
"param",
".",
"opts",
"[",
"0",
"]",
".",
"lstrip",
"(",
"'-'",
")",
"if",
"param",
".",
"param_type_name",
"!=",
"'option'",
":",
"return",
"False",
",",
"return",
"True",
",",
"option",
"... | Custom Click(Command|Group).params sorter.
Case insensitive sort with capitals after lowercase. --version at the end since I can't sort --help.
:param click.core.Option param: Parameter to evaluate.
:return: Sort weight.
:rtype: int | [
"Custom",
"Click",
"(",
"Command|Group",
")",
".",
"params",
"sorter",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L39-L52 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | ClickGroup.get_params | def get_params(self, ctx):
"""Sort order of options before displaying.
:param click.core.Context ctx: Click context.
:return: super() return value.
"""
self.params.sort(key=self.custom_sort)
return super(ClickGroup, self).get_params(ctx) | python | def get_params(self, ctx):
"""Sort order of options before displaying.
:param click.core.Context ctx: Click context.
:return: super() return value.
"""
self.params.sort(key=self.custom_sort)
return super(ClickGroup, self).get_params(ctx) | [
"def",
"get_params",
"(",
"self",
",",
"ctx",
")",
":",
"self",
".",
"params",
".",
"sort",
"(",
"key",
"=",
"self",
".",
"custom_sort",
")",
"return",
"super",
"(",
"ClickGroup",
",",
"self",
")",
".",
"get_params",
"(",
"ctx",
")"
] | Sort order of options before displaying.
:param click.core.Context ctx: Click context.
:return: super() return value. | [
"Sort",
"order",
"of",
"options",
"before",
"displaying",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L54-L62 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | ClickGroup.main | def main(self, *args, **kwargs):
"""Main function called by setuptools.
:param list args: Passed to super().
:param dict kwargs: Passed to super().
:return: super() return value.
"""
argv = kwargs.pop('args', click.get_os_args())
if '--' in argv:
pos... | python | def main(self, *args, **kwargs):
"""Main function called by setuptools.
:param list args: Passed to super().
:param dict kwargs: Passed to super().
:return: super() return value.
"""
argv = kwargs.pop('args', click.get_os_args())
if '--' in argv:
pos... | [
"def",
"main",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"argv",
"=",
"kwargs",
".",
"pop",
"(",
"'args'",
",",
"click",
".",
"get_os_args",
"(",
")",
")",
"if",
"'--'",
"in",
"argv",
":",
"pos",
"=",
"argv",
".",
"index... | Main function called by setuptools.
:param list args: Passed to super().
:param dict kwargs: Passed to super().
:return: super() return value. | [
"Main",
"function",
"called",
"by",
"setuptools",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L64-L78 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/__main__.py | ClickGroup.invoke | def invoke(self, ctx):
"""Inject overflow arguments into context state.
:param click.core.Context ctx: Click context.
:return: super() return value.
"""
if self.overflow:
ctx.ensure_object(Config).update(dict(overflow=self.overflow))
return super(ClickGroup,... | python | def invoke(self, ctx):
"""Inject overflow arguments into context state.
:param click.core.Context ctx: Click context.
:return: super() return value.
"""
if self.overflow:
ctx.ensure_object(Config).update(dict(overflow=self.overflow))
return super(ClickGroup,... | [
"def",
"invoke",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"self",
".",
"overflow",
":",
"ctx",
".",
"ensure_object",
"(",
"Config",
")",
".",
"update",
"(",
"dict",
"(",
"overflow",
"=",
"self",
".",
"overflow",
")",
")",
"return",
"super",
"(",
"C... | Inject overflow arguments into context state.
:param click.core.Context ctx: Click context.
:return: super() return value. | [
"Inject",
"overflow",
"arguments",
"into",
"context",
"state",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L80-L89 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/lib.py | Config.from_context | def from_context(cls):
"""Retrieve this class' instance from the current Click context.
:return: Instance of this class.
:rtype: Config
"""
try:
ctx = click.get_current_context()
except RuntimeError:
return cls()
return ctx.find_object(cls... | python | def from_context(cls):
"""Retrieve this class' instance from the current Click context.
:return: Instance of this class.
:rtype: Config
"""
try:
ctx = click.get_current_context()
except RuntimeError:
return cls()
return ctx.find_object(cls... | [
"def",
"from_context",
"(",
"cls",
")",
":",
"try",
":",
"ctx",
"=",
"click",
".",
"get_current_context",
"(",
")",
"except",
"RuntimeError",
":",
"return",
"cls",
"(",
")",
"return",
"ctx",
".",
"find_object",
"(",
"cls",
")"
] | Retrieve this class' instance from the current Click context.
:return: Instance of this class.
:rtype: Config | [
"Retrieve",
"this",
"class",
"instance",
"from",
"the",
"current",
"Click",
"context",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/lib.py#L81-L91 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/lib.py | Config.update | def update(self, params, ignore_set=False, overwrite=False):
"""Set instance values from dictionary.
:param dict params: Click context params.
:param bool ignore_set: Skip already-set values instead of raising AttributeError.
:param bool overwrite: Allow overwriting already-set values.
... | python | def update(self, params, ignore_set=False, overwrite=False):
"""Set instance values from dictionary.
:param dict params: Click context params.
:param bool ignore_set: Skip already-set values instead of raising AttributeError.
:param bool overwrite: Allow overwriting already-set values.
... | [
"def",
"update",
"(",
"self",
",",
"params",
",",
"ignore_set",
"=",
"False",
",",
"overwrite",
"=",
"False",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"valid",
"=",
"{",
"i",
"[",
"0",
"]",
"for",
"i",
"in",
"self",
... | Set instance values from dictionary.
:param dict params: Click context params.
:param bool ignore_set: Skip already-set values instead of raising AttributeError.
:param bool overwrite: Allow overwriting already-set values. | [
"Set",
"instance",
"values",
"from",
"dictionary",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/lib.py#L102-L125 |
Robpol86/sphinxcontrib-versioning | sphinxcontrib/versioning/lib.py | TempDir.cleanup | def cleanup(self):
"""Recursively delete directory."""
shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
if os.path.exists(self.name):
raise IOError(17, "File exists: '{}'".format(self.name)) | python | def cleanup(self):
"""Recursively delete directory."""
shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
if os.path.exists(self.name):
raise IOError(17, "File exists: '{}'".format(self.name)) | [
"def",
"cleanup",
"(",
"self",
")",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"name",
",",
"onerror",
"=",
"lambda",
"*",
"a",
":",
"os",
".",
"chmod",
"(",
"a",
"[",
"1",
"]",
",",
"__import__",
"(",
"'stat'",
")",
".",
"S_IWRITE",
")",
... | Recursively delete directory. | [
"Recursively",
"delete",
"directory",
"."
] | train | https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/lib.py#L165-L169 |
openstack/networking-cisco | networking_cisco/plugins/cisco/extensions/routertypeawarescheduler.py | Routertypeawarescheduler.get_resources | def get_resources(cls):
"""Returns Ext Resources."""
exts = []
parent = dict(member_name=ciscohostingdevicemanager.DEVICE,
collection_name=ciscohostingdevicemanager.DEVICES)
controller = resource.Resource(
RouterHostingDeviceSchedulerController(), cb_fau... | python | def get_resources(cls):
"""Returns Ext Resources."""
exts = []
parent = dict(member_name=ciscohostingdevicemanager.DEVICE,
collection_name=ciscohostingdevicemanager.DEVICES)
controller = resource.Resource(
RouterHostingDeviceSchedulerController(), cb_fau... | [
"def",
"get_resources",
"(",
"cls",
")",
":",
"exts",
"=",
"[",
"]",
"parent",
"=",
"dict",
"(",
"member_name",
"=",
"ciscohostingdevicemanager",
".",
"DEVICE",
",",
"collection_name",
"=",
"ciscohostingdevicemanager",
".",
"DEVICES",
")",
"controller",
"=",
"... | Returns Ext Resources. | [
"Returns",
"Ext",
"Resources",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/extensions/routertypeawarescheduler.py#L172-L187 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/scheduler/cfg_agentschedulers_db.py | CfgAgentSchedulerDbMixin.assign_hosting_device_to_cfg_agent | def assign_hosting_device_to_cfg_agent(self, context, cfg_agent_id,
hosting_device_id):
"""Make config agent handle an (unassigned) hosting device."""
hd_db = self._get_hosting_device(context, hosting_device_id)
if hd_db.cfg_agent_id:
if hd_... | python | def assign_hosting_device_to_cfg_agent(self, context, cfg_agent_id,
hosting_device_id):
"""Make config agent handle an (unassigned) hosting device."""
hd_db = self._get_hosting_device(context, hosting_device_id)
if hd_db.cfg_agent_id:
if hd_... | [
"def",
"assign_hosting_device_to_cfg_agent",
"(",
"self",
",",
"context",
",",
"cfg_agent_id",
",",
"hosting_device_id",
")",
":",
"hd_db",
"=",
"self",
".",
"_get_hosting_device",
"(",
"context",
",",
"hosting_device_id",
")",
"if",
"hd_db",
".",
"cfg_agent_id",
... | Make config agent handle an (unassigned) hosting device. | [
"Make",
"config",
"agent",
"handle",
"an",
"(",
"unassigned",
")",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/scheduler/cfg_agentschedulers_db.py#L88-L108 |
openstack/networking-cisco | networking_cisco/plugins/cisco/db/scheduler/cfg_agentschedulers_db.py | CfgAgentSchedulerDbMixin.unassign_hosting_device_from_cfg_agent | def unassign_hosting_device_from_cfg_agent(self, context, cfg_agent_id,
hosting_device_id):
"""Make config agent handle an (unassigned) hosting device."""
hd_db = self._get_hosting_device(context, hosting_device_id)
if hd_db.cfg_agent_id is None and... | python | def unassign_hosting_device_from_cfg_agent(self, context, cfg_agent_id,
hosting_device_id):
"""Make config agent handle an (unassigned) hosting device."""
hd_db = self._get_hosting_device(context, hosting_device_id)
if hd_db.cfg_agent_id is None and... | [
"def",
"unassign_hosting_device_from_cfg_agent",
"(",
"self",
",",
"context",
",",
"cfg_agent_id",
",",
"hosting_device_id",
")",
":",
"hd_db",
"=",
"self",
".",
"_get_hosting_device",
"(",
"context",
",",
"hosting_device_id",
")",
"if",
"hd_db",
".",
"cfg_agent_id"... | Make config agent handle an (unassigned) hosting device. | [
"Make",
"config",
"agent",
"handle",
"an",
"(",
"unassigned",
")",
"hosting",
"device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/scheduler/cfg_agentschedulers_db.py#L110-L128 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/trunk.py | NexusMDTrunkHandler.update_subports | def update_subports(self, port):
"""Set port attributes for trunk subports.
For baremetal deployments only, set the neutron port attributes
during the bind_port event.
"""
trunk_details = port.get('trunk_details')
subports = trunk_details['sub_ports']
host_id = ... | python | def update_subports(self, port):
"""Set port attributes for trunk subports.
For baremetal deployments only, set the neutron port attributes
during the bind_port event.
"""
trunk_details = port.get('trunk_details')
subports = trunk_details['sub_ports']
host_id = ... | [
"def",
"update_subports",
"(",
"self",
",",
"port",
")",
":",
"trunk_details",
"=",
"port",
".",
"get",
"(",
"'trunk_details'",
")",
"subports",
"=",
"trunk_details",
"[",
"'sub_ports'",
"]",
"host_id",
"=",
"port",
".",
"get",
"(",
"bc",
".",
"dns",
"."... | Set port attributes for trunk subports.
For baremetal deployments only, set the neutron port attributes
during the bind_port event. | [
"Set",
"port",
"attributes",
"for",
"trunk",
"subports",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/trunk.py#L52-L74 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.read_static_uplink | def read_static_uplink(self):
"""Read the static uplink from file, if given."""
if self.node_list is None or self.node_uplink_list is None:
return
for node, port in zip(self.node_list.split(','),
self.node_uplink_list.split(',')):
if node.str... | python | def read_static_uplink(self):
"""Read the static uplink from file, if given."""
if self.node_list is None or self.node_uplink_list is None:
return
for node, port in zip(self.node_list.split(','),
self.node_uplink_list.split(',')):
if node.str... | [
"def",
"read_static_uplink",
"(",
"self",
")",
":",
"if",
"self",
".",
"node_list",
"is",
"None",
"or",
"self",
".",
"node_uplink_list",
"is",
"None",
":",
"return",
"for",
"node",
",",
"port",
"in",
"zip",
"(",
"self",
".",
"node_list",
".",
"split",
... | Read the static uplink from file, if given. | [
"Read",
"the",
"static",
"uplink",
"from",
"file",
"if",
"given",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L168-L177 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.vdp_vlan_change_cb | def vdp_vlan_change_cb(self, port_uuid, lvid, vdp_vlan, fail_reason):
"""Callback function for updating the VDP VLAN in DB. """
LOG.info("Vlan change CB lvid %(lvid)s VDP %(vdp)s",
{'lvid': lvid, 'vdp': vdp_vlan})
self.update_vm_result(port_uuid, constants.RESULT_SUCCESS,
... | python | def vdp_vlan_change_cb(self, port_uuid, lvid, vdp_vlan, fail_reason):
"""Callback function for updating the VDP VLAN in DB. """
LOG.info("Vlan change CB lvid %(lvid)s VDP %(vdp)s",
{'lvid': lvid, 'vdp': vdp_vlan})
self.update_vm_result(port_uuid, constants.RESULT_SUCCESS,
... | [
"def",
"vdp_vlan_change_cb",
"(",
"self",
",",
"port_uuid",
",",
"lvid",
",",
"vdp_vlan",
",",
"fail_reason",
")",
":",
"LOG",
".",
"info",
"(",
"\"Vlan change CB lvid %(lvid)s VDP %(vdp)s\"",
",",
"{",
"'lvid'",
":",
"lvid",
",",
"'vdp'",
":",
"vdp_vlan",
"}"... | Callback function for updating the VDP VLAN in DB. | [
"Callback",
"function",
"for",
"updating",
"the",
"VDP",
"VLAN",
"in",
"DB",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L200-L206 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.process_bulk_vm_event | def process_bulk_vm_event(self, msg, phy_uplink):
"""Process the VM bulk event usually after a restart. """
LOG.info("In processing Bulk VM Event status %s", msg)
time.sleep(3)
if (not self.uplink_det_compl or
phy_uplink not in self.ovs_vdp_obj_dict):
# This c... | python | def process_bulk_vm_event(self, msg, phy_uplink):
"""Process the VM bulk event usually after a restart. """
LOG.info("In processing Bulk VM Event status %s", msg)
time.sleep(3)
if (not self.uplink_det_compl or
phy_uplink not in self.ovs_vdp_obj_dict):
# This c... | [
"def",
"process_bulk_vm_event",
"(",
"self",
",",
"msg",
",",
"phy_uplink",
")",
":",
"LOG",
".",
"info",
"(",
"\"In processing Bulk VM Event status %s\"",
",",
"msg",
")",
"time",
".",
"sleep",
"(",
"3",
")",
"if",
"(",
"not",
"self",
".",
"uplink_det_compl... | Process the VM bulk event usually after a restart. | [
"Process",
"the",
"VM",
"bulk",
"event",
"usually",
"after",
"a",
"restart",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L241-L269 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.is_openstack_running | def is_openstack_running(self):
"""Currently it just checks for the presence of both the bridges. """
try:
if (ovs_vdp.is_bridge_present(self.br_ex, self.root_helper) and
ovs_vdp.is_bridge_present(self.br_integ,
self.root_help... | python | def is_openstack_running(self):
"""Currently it just checks for the presence of both the bridges. """
try:
if (ovs_vdp.is_bridge_present(self.br_ex, self.root_helper) and
ovs_vdp.is_bridge_present(self.br_integ,
self.root_help... | [
"def",
"is_openstack_running",
"(",
"self",
")",
":",
"try",
":",
"if",
"(",
"ovs_vdp",
".",
"is_bridge_present",
"(",
"self",
".",
"br_ex",
",",
"self",
".",
"root_helper",
")",
"and",
"ovs_vdp",
".",
"is_bridge_present",
"(",
"self",
".",
"br_integ",
","... | Currently it just checks for the presence of both the bridges. | [
"Currently",
"it",
"just",
"checks",
"for",
"the",
"presence",
"of",
"both",
"the",
"bridges",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L368-L379 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr._fill_topology_cfg | def _fill_topology_cfg(self, topo_dict):
"""Fills the extra configurations in the topology. """
cfg_dict = {}
if topo_dict.bond_member_ports is not None:
cfg_dict.update({'bond_member_ports':
topo_dict.bond_member_ports})
if topo_dict.bond_interfa... | python | def _fill_topology_cfg(self, topo_dict):
"""Fills the extra configurations in the topology. """
cfg_dict = {}
if topo_dict.bond_member_ports is not None:
cfg_dict.update({'bond_member_ports':
topo_dict.bond_member_ports})
if topo_dict.bond_interfa... | [
"def",
"_fill_topology_cfg",
"(",
"self",
",",
"topo_dict",
")",
":",
"cfg_dict",
"=",
"{",
"}",
"if",
"topo_dict",
".",
"bond_member_ports",
"is",
"not",
"None",
":",
"cfg_dict",
".",
"update",
"(",
"{",
"'bond_member_ports'",
":",
"topo_dict",
".",
"bond_m... | Fills the extra configurations in the topology. | [
"Fills",
"the",
"extra",
"configurations",
"in",
"the",
"topology",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L404-L413 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.uplink_bond_intf_process | def uplink_bond_intf_process(self):
"""Process the case when uplink interface becomes part of a bond.
This is called to check if the phy interface became a part of the
bond. If the below condition is True, this means, a physical
interface that was not a part of a bond was earlier discov... | python | def uplink_bond_intf_process(self):
"""Process the case when uplink interface becomes part of a bond.
This is called to check if the phy interface became a part of the
bond. If the below condition is True, this means, a physical
interface that was not a part of a bond was earlier discov... | [
"def",
"uplink_bond_intf_process",
"(",
"self",
")",
":",
"bond_intf",
"=",
"sys_utils",
".",
"get_bond_intf",
"(",
"self",
".",
"phy_uplink",
")",
"if",
"bond_intf",
"is",
"None",
":",
"return",
"False",
"self",
".",
"save_uplink",
"(",
"fail_reason",
"=",
... | Process the case when uplink interface becomes part of a bond.
This is called to check if the phy interface became a part of the
bond. If the below condition is True, this means, a physical
interface that was not a part of a bond was earlier discovered as
uplink and now that interface b... | [
"Process",
"the",
"case",
"when",
"uplink",
"interface",
"becomes",
"part",
"of",
"a",
"bond",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L439-L483 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.check_periodic_bulk_vm_notif_rcvd | def check_periodic_bulk_vm_notif_rcvd(self):
"""Bulk VM check handler called from periodic uplink detection.
This gets called by the 'normal' stage of uplink detection.
The bulk VM event sends all the VM's running in this agent.
Sometimes during upgrades, it was found that due to some r... | python | def check_periodic_bulk_vm_notif_rcvd(self):
"""Bulk VM check handler called from periodic uplink detection.
This gets called by the 'normal' stage of uplink detection.
The bulk VM event sends all the VM's running in this agent.
Sometimes during upgrades, it was found that due to some r... | [
"def",
"check_periodic_bulk_vm_notif_rcvd",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"bulk_vm_rcvd_flag",
":",
"if",
"self",
".",
"bulk_vm_check_cnt",
">=",
"1",
":",
"self",
".",
"bulk_vm_check_cnt",
"=",
"0",
"self",
".",
"save_uplink",
"(",
"uplink"... | Bulk VM check handler called from periodic uplink detection.
This gets called by the 'normal' stage of uplink detection.
The bulk VM event sends all the VM's running in this agent.
Sometimes during upgrades, it was found that due to some race
condition, the server does not send the Bulk... | [
"Bulk",
"VM",
"check",
"handler",
"called",
"from",
"periodic",
"uplink",
"detection",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L485-L510 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.static_uplink_detect | def static_uplink_detect(self, veth):
"""Return the static uplink based on argument passed.
The very first time, this function is called, it returns the uplink
port read from a file.
After restart, when this function is called the first time, it
returns 'normal' assuming a veth ... | python | def static_uplink_detect(self, veth):
"""Return the static uplink based on argument passed.
The very first time, this function is called, it returns the uplink
port read from a file.
After restart, when this function is called the first time, it
returns 'normal' assuming a veth ... | [
"def",
"static_uplink_detect",
"(",
"self",
",",
"veth",
")",
":",
"LOG",
".",
"info",
"(",
"\"In static_uplink_detect %(veth)s\"",
",",
"{",
"'veth'",
":",
"veth",
"}",
")",
"if",
"self",
".",
"static_uplink_first",
":",
"self",
".",
"static_uplink_first",
"=... | Return the static uplink based on argument passed.
The very first time, this function is called, it returns the uplink
port read from a file.
After restart, when this function is called the first time, it
returns 'normal' assuming a veth is passed to this function which will
be ... | [
"Return",
"the",
"static",
"uplink",
"based",
"on",
"argument",
"passed",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L512-L532 |
openstack/networking-cisco | networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py | VdpMgr.vdp_uplink_proc | def vdp_uplink_proc(self):
"""Periodic handler to detect the uplink interface to the switch.
-> restart_uplink_called: should be called by agent initially to set
the stored uplink and veth from DB
-> process_uplink_ongoing: Will be set when uplink message is enqueue
and reset wh... | python | def vdp_uplink_proc(self):
"""Periodic handler to detect the uplink interface to the switch.
-> restart_uplink_called: should be called by agent initially to set
the stored uplink and veth from DB
-> process_uplink_ongoing: Will be set when uplink message is enqueue
and reset wh... | [
"def",
"vdp_uplink_proc",
"(",
"self",
")",
":",
"LOG",
".",
"info",
"(",
"\"In Periodic Uplink Task\"",
")",
"if",
"not",
"self",
".",
"is_os_run",
":",
"if",
"not",
"self",
".",
"is_openstack_running",
"(",
")",
":",
"LOG",
".",
"info",
"(",
"\"OpenStack... | Periodic handler to detect the uplink interface to the switch.
-> restart_uplink_called: should be called by agent initially to set
the stored uplink and veth from DB
-> process_uplink_ongoing: Will be set when uplink message is enqueue
and reset when dequeued and processed completely
... | [
"Periodic",
"handler",
"to",
"detect",
"the",
"uplink",
"interface",
"to",
"the",
"switch",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/vdp/dfa_vdp_mgr.py#L534-L653 |
openstack/networking-cisco | networking_cisco/neutronclient/hostingdevice.py | HostingDeviceGetConfig.get_hosting_device_config | def get_hosting_device_config(self, client, hosting_device_id):
"""Get config of hosting_device."""
return client.get((self.resource_path + HOSTING_DEVICE_CONFIG) %
hosting_device_id) | python | def get_hosting_device_config(self, client, hosting_device_id):
"""Get config of hosting_device."""
return client.get((self.resource_path + HOSTING_DEVICE_CONFIG) %
hosting_device_id) | [
"def",
"get_hosting_device_config",
"(",
"self",
",",
"client",
",",
"hosting_device_id",
")",
":",
"return",
"client",
".",
"get",
"(",
"(",
"self",
".",
"resource_path",
"+",
"HOSTING_DEVICE_CONFIG",
")",
"%",
"hosting_device_id",
")"
] | Get config of hosting_device. | [
"Get",
"config",
"of",
"hosting_device",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/neutronclient/hostingdevice.py#L255-L258 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.get_client_class | def get_client_class(self, client_class_name):
"""Returns a specific client class details from CPNR server."""
request_url = self._build_url(['ClientClass', client_class_name])
return self._do_request('GET', request_url) | python | def get_client_class(self, client_class_name):
"""Returns a specific client class details from CPNR server."""
request_url = self._build_url(['ClientClass', client_class_name])
return self._do_request('GET', request_url) | [
"def",
"get_client_class",
"(",
"self",
",",
"client_class_name",
")",
":",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'ClientClass'",
",",
"client_class_name",
"]",
")",
"return",
"self",
".",
"_do_request",
"(",
"'GET'",
",",
"request_url",
")... | Returns a specific client class details from CPNR server. | [
"Returns",
"a",
"specific",
"client",
"class",
"details",
"from",
"CPNR",
"server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L125-L128 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.get_vpn | def get_vpn(self, vpn_name):
"""Returns a specific VPN name details from CPNR server."""
request_url = self._build_url(['VPN', vpn_name])
return self._do_request('GET', request_url) | python | def get_vpn(self, vpn_name):
"""Returns a specific VPN name details from CPNR server."""
request_url = self._build_url(['VPN', vpn_name])
return self._do_request('GET', request_url) | [
"def",
"get_vpn",
"(",
"self",
",",
"vpn_name",
")",
":",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'VPN'",
",",
"vpn_name",
"]",
")",
"return",
"self",
".",
"_do_request",
"(",
"'GET'",
",",
"request_url",
")"
] | Returns a specific VPN name details from CPNR server. | [
"Returns",
"a",
"specific",
"VPN",
"name",
"details",
"from",
"CPNR",
"server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L135-L138 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.get_scopes | def get_scopes(self, vpnid='.*'):
"""Returns a list of all the scopes from CPNR server."""
request_url = self._build_url(['Scope'], vpn=vpnid)
return self._do_request('GET', request_url) | python | def get_scopes(self, vpnid='.*'):
"""Returns a list of all the scopes from CPNR server."""
request_url = self._build_url(['Scope'], vpn=vpnid)
return self._do_request('GET', request_url) | [
"def",
"get_scopes",
"(",
"self",
",",
"vpnid",
"=",
"'.*'",
")",
":",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'Scope'",
"]",
",",
"vpn",
"=",
"vpnid",
")",
"return",
"self",
".",
"_do_request",
"(",
"'GET'",
",",
"request_url",
")"
] | Returns a list of all the scopes from CPNR server. | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"scopes",
"from",
"CPNR",
"server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L140-L143 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.get_scope | def get_scope(self, scope_name):
"""Returns a specific scope name details from CPNR server."""
request_url = self._build_url(['Scope', scope_name])
return self._do_request('GET', request_url) | python | def get_scope(self, scope_name):
"""Returns a specific scope name details from CPNR server."""
request_url = self._build_url(['Scope', scope_name])
return self._do_request('GET', request_url) | [
"def",
"get_scope",
"(",
"self",
",",
"scope_name",
")",
":",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'Scope'",
",",
"scope_name",
"]",
")",
"return",
"self",
".",
"_do_request",
"(",
"'GET'",
",",
"request_url",
")"
] | Returns a specific scope name details from CPNR server. | [
"Returns",
"a",
"specific",
"scope",
"name",
"details",
"from",
"CPNR",
"server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L145-L148 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.get_client_entry | def get_client_entry(self, client_entry_name):
"""Returns a specific client entry name details from CPNR server."""
request_url = self._build_url(['ClientEntry', client_entry_name])
return self._do_request('GET', request_url) | python | def get_client_entry(self, client_entry_name):
"""Returns a specific client entry name details from CPNR server."""
request_url = self._build_url(['ClientEntry', client_entry_name])
return self._do_request('GET', request_url) | [
"def",
"get_client_entry",
"(",
"self",
",",
"client_entry_name",
")",
":",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'ClientEntry'",
",",
"client_entry_name",
"]",
")",
"return",
"self",
".",
"_do_request",
"(",
"'GET'",
",",
"request_url",
")... | Returns a specific client entry name details from CPNR server. | [
"Returns",
"a",
"specific",
"client",
"entry",
"name",
"details",
"from",
"CPNR",
"server",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L155-L158 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cpnr/cpnr_client.py | CpnrClient.release_address | def release_address(self, address, vpnid):
"""Release a specific lease, called after delete_client_entry"""
query = address + "?action=releaseAddress&vpnId=" + vpnid
request_url = self._build_url(['Lease', query])
return self._do_request('DELETE', request_url) | python | def release_address(self, address, vpnid):
"""Release a specific lease, called after delete_client_entry"""
query = address + "?action=releaseAddress&vpnId=" + vpnid
request_url = self._build_url(['Lease', query])
return self._do_request('DELETE', request_url) | [
"def",
"release_address",
"(",
"self",
",",
"address",
",",
"vpnid",
")",
":",
"query",
"=",
"address",
"+",
"\"?action=releaseAddress&vpnId=\"",
"+",
"vpnid",
"request_url",
"=",
"self",
".",
"_build_url",
"(",
"[",
"'Lease'",
",",
"query",
"]",
")",
"retur... | Release a specific lease, called after delete_client_entry | [
"Release",
"a",
"specific",
"lease",
"called",
"after",
"delete_client_entry"
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cpnr/cpnr_client.py#L346-L350 |
openstack/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/service_helpers/service_helper.py | QueueMixin.qsize | def qsize(self, qname):
"""Return the approximate size of the queue."""
if qname in self._queues:
return self._queues[qname].qsize()
else:
raise ValueError(_("queue %s is not defined"), qname) | python | def qsize(self, qname):
"""Return the approximate size of the queue."""
if qname in self._queues:
return self._queues[qname].qsize()
else:
raise ValueError(_("queue %s is not defined"), qname) | [
"def",
"qsize",
"(",
"self",
",",
"qname",
")",
":",
"if",
"qname",
"in",
"self",
".",
"_queues",
":",
"return",
"self",
".",
"_queues",
"[",
"qname",
"]",
".",
"qsize",
"(",
")",
"else",
":",
"raise",
"ValueError",
"(",
"_",
"(",
"\"queue %s is not ... | Return the approximate size of the queue. | [
"Return",
"the",
"approximate",
"size",
"of",
"the",
"queue",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/cfg_agent/service_helpers/service_helper.py#L92-L97 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_nexusport_binding | def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Lists a nexusport binding."""
LOG.debug("get_nexusport_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
vlan_id=vlan_id,
switch_ip=switch_i... | python | def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Lists a nexusport binding."""
LOG.debug("get_nexusport_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
vlan_id=vlan_id,
switch_ip=switch_i... | [
"def",
"get_nexusport_binding",
"(",
"port_id",
",",
"vlan_id",
",",
"switch_ip",
",",
"instance_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_nexusport_binding() called\"",
")",
"return",
"_lookup_all_nexus_bindings",
"(",
"port_id",
"=",
"port_id",
",",
"vlan_id... | Lists a nexusport binding. | [
"Lists",
"a",
"nexusport",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L37-L43 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_nexus_switchport_binding | def get_nexus_switchport_binding(port_id, switch_ip):
"""Lists all bindings for this switch & port."""
LOG.debug("get_nexus_switchport_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
switch_ip=switch_ip) | python | def get_nexus_switchport_binding(port_id, switch_ip):
"""Lists all bindings for this switch & port."""
LOG.debug("get_nexus_switchport_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
switch_ip=switch_ip) | [
"def",
"get_nexus_switchport_binding",
"(",
"port_id",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_nexus_switchport_binding() called\"",
")",
"return",
"_lookup_all_nexus_bindings",
"(",
"port_id",
"=",
"port_id",
",",
"switch_ip",
"=",
"switch_ip",
"... | Lists all bindings for this switch & port. | [
"Lists",
"all",
"bindings",
"for",
"this",
"switch",
"&",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L46-L50 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_nexusvlan_binding | def get_nexusvlan_binding(vlan_id, switch_ip):
"""Lists a vlan and switch binding."""
LOG.debug("get_nexusvlan_binding() called")
return _lookup_all_nexus_bindings(vlan_id=vlan_id, switch_ip=switch_ip) | python | def get_nexusvlan_binding(vlan_id, switch_ip):
"""Lists a vlan and switch binding."""
LOG.debug("get_nexusvlan_binding() called")
return _lookup_all_nexus_bindings(vlan_id=vlan_id, switch_ip=switch_ip) | [
"def",
"get_nexusvlan_binding",
"(",
"vlan_id",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_nexusvlan_binding() called\"",
")",
"return",
"_lookup_all_nexus_bindings",
"(",
"vlan_id",
"=",
"vlan_id",
",",
"switch_ip",
"=",
"switch_ip",
")"
] | Lists a vlan and switch binding. | [
"Lists",
"a",
"vlan",
"and",
"switch",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L53-L56 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_reserved_bindings | def get_reserved_bindings(vlan_id, instance_id, switch_ip=None,
port_id=None):
"""Lists reserved bindings."""
LOG.debug("get_reserved_bindings() called")
if port_id:
return _lookup_all_nexus_bindings(vlan_id=vlan_id,
switch_ip=switc... | python | def get_reserved_bindings(vlan_id, instance_id, switch_ip=None,
port_id=None):
"""Lists reserved bindings."""
LOG.debug("get_reserved_bindings() called")
if port_id:
return _lookup_all_nexus_bindings(vlan_id=vlan_id,
switch_ip=switc... | [
"def",
"get_reserved_bindings",
"(",
"vlan_id",
",",
"instance_id",
",",
"switch_ip",
"=",
"None",
",",
"port_id",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_reserved_bindings() called\"",
")",
"if",
"port_id",
":",
"return",
"_lookup_all_nexus_bindin... | Lists reserved bindings. | [
"Lists",
"reserved",
"bindings",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L59-L74 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | update_reserved_binding | def update_reserved_binding(vlan_id, switch_ip, instance_id,
port_id, is_switch_binding=True,
is_native=False, ch_grp=0):
"""Updates reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a swit... | python | def update_reserved_binding(vlan_id, switch_ip, instance_id,
port_id, is_switch_binding=True,
is_native=False, ch_grp=0):
"""Updates reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a swit... | [
"def",
"update_reserved_binding",
"(",
"vlan_id",
",",
"switch_ip",
",",
"instance_id",
",",
"port_id",
",",
"is_switch_binding",
"=",
"True",
",",
"is_native",
"=",
"False",
",",
"ch_grp",
"=",
"0",
")",
":",
"if",
"not",
"port_id",
":",
"LOG",
".",
"warn... | Updates reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a switch so it can be viewed by
all other neutron processes. There's also the case of
a reserved port binding to keep switch information on a given
interface.
The values of t... | [
"Updates",
"reserved",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L77-L119 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_reserved_binding | def remove_reserved_binding(vlan_id, switch_ip, instance_id,
port_id):
"""Removes reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a switch so it can be viewed by
all other neutron processes. There's also the cas... | python | def remove_reserved_binding(vlan_id, switch_ip, instance_id,
port_id):
"""Removes reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a switch so it can be viewed by
all other neutron processes. There's also the cas... | [
"def",
"remove_reserved_binding",
"(",
"vlan_id",
",",
"switch_ip",
",",
"instance_id",
",",
"port_id",
")",
":",
"if",
"not",
"port_id",
":",
"LOG",
".",
"warning",
"(",
"\"remove_reserved_binding called with no state\"",
")",
"return",
"LOG",
".",
"debug",
"(",
... | Removes reserved binding.
This overloads port bindings to support reserved Switch binding
used to maintain the state of a switch so it can be viewed by
all other neutron processes. There's also the case of
a reserved port binding to keep switch information on a given
interface.
The values of th... | [
"Removes",
"reserved",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L122-L151 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | add_reserved_switch_binding | def add_reserved_switch_binding(switch_ip, state):
"""Add a reserved switch binding."""
# overload port_id to contain switch state
add_nexusport_binding(
state,
const.NO_VLAN_OR_VNI_ID,
const.NO_VLAN_OR_VNI_ID,
switch_ip,
const.RESERVED_NEXUS_SWITCH_DEVICE_ID_R1) | python | def add_reserved_switch_binding(switch_ip, state):
"""Add a reserved switch binding."""
# overload port_id to contain switch state
add_nexusport_binding(
state,
const.NO_VLAN_OR_VNI_ID,
const.NO_VLAN_OR_VNI_ID,
switch_ip,
const.RESERVED_NEXUS_SWITCH_DEVICE_ID_R1) | [
"def",
"add_reserved_switch_binding",
"(",
"switch_ip",
",",
"state",
")",
":",
"# overload port_id to contain switch state",
"add_nexusport_binding",
"(",
"state",
",",
"const",
".",
"NO_VLAN_OR_VNI_ID",
",",
"const",
".",
"NO_VLAN_OR_VNI_ID",
",",
"switch_ip",
",",
"c... | Add a reserved switch binding. | [
"Add",
"a",
"reserved",
"switch",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L163-L172 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | update_reserved_switch_binding | def update_reserved_switch_binding(switch_ip, state):
"""Update a reserved switch binding."""
# overload port_id to contain switch state
update_reserved_binding(
const.NO_VLAN_OR_VNI_ID,
switch_ip,
const.RESERVED_NEXUS_SWITCH_DEVICE_ID_R1,
state) | python | def update_reserved_switch_binding(switch_ip, state):
"""Update a reserved switch binding."""
# overload port_id to contain switch state
update_reserved_binding(
const.NO_VLAN_OR_VNI_ID,
switch_ip,
const.RESERVED_NEXUS_SWITCH_DEVICE_ID_R1,
state) | [
"def",
"update_reserved_switch_binding",
"(",
"switch_ip",
",",
"state",
")",
":",
"# overload port_id to contain switch state",
"update_reserved_binding",
"(",
"const",
".",
"NO_VLAN_OR_VNI_ID",
",",
"switch_ip",
",",
"const",
".",
"RESERVED_NEXUS_SWITCH_DEVICE_ID_R1",
",",
... | Update a reserved switch binding. | [
"Update",
"a",
"reserved",
"switch",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L175-L183 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | add_nexusport_binding | def add_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id,
is_native=False, ch_grp=0):
"""Adds a nexusport binding."""
LOG.debug("add_nexusport_binding() called")
session = bc.get_writer_session()
binding = nexus_models_v2.NexusPortBinding(port_id=port_id,
... | python | def add_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id,
is_native=False, ch_grp=0):
"""Adds a nexusport binding."""
LOG.debug("add_nexusport_binding() called")
session = bc.get_writer_session()
binding = nexus_models_v2.NexusPortBinding(port_id=port_id,
... | [
"def",
"add_nexusport_binding",
"(",
"port_id",
",",
"vlan_id",
",",
"vni",
",",
"switch_ip",
",",
"instance_id",
",",
"is_native",
"=",
"False",
",",
"ch_grp",
"=",
"0",
")",
":",
"LOG",
".",
"debug",
"(",
"\"add_nexusport_binding() called\"",
")",
"session",... | Adds a nexusport binding. | [
"Adds",
"a",
"nexusport",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L241-L255 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_nexusport_binding | def remove_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id):
"""Removes a nexusport binding."""
LOG.debug("remove_nexusport_binding() called")
session = bc.get_writer_session()
binding = _lookup_all_nexus_bindings(session=session,
vlan_id=vlan_id,... | python | def remove_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id):
"""Removes a nexusport binding."""
LOG.debug("remove_nexusport_binding() called")
session = bc.get_writer_session()
binding = _lookup_all_nexus_bindings(session=session,
vlan_id=vlan_id,... | [
"def",
"remove_nexusport_binding",
"(",
"port_id",
",",
"vlan_id",
",",
"vni",
",",
"switch_ip",
",",
"instance_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_nexusport_binding() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"bin... | Removes a nexusport binding. | [
"Removes",
"a",
"nexusport",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L258-L271 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | update_nexusport_binding | def update_nexusport_binding(port_id, new_vlan_id):
"""Updates nexusport binding."""
if not new_vlan_id:
LOG.warning("update_nexusport_binding called with no vlan")
return
LOG.debug("update_nexusport_binding called")
session = bc.get_writer_session()
binding = _lookup_one_nexus_bindi... | python | def update_nexusport_binding(port_id, new_vlan_id):
"""Updates nexusport binding."""
if not new_vlan_id:
LOG.warning("update_nexusport_binding called with no vlan")
return
LOG.debug("update_nexusport_binding called")
session = bc.get_writer_session()
binding = _lookup_one_nexus_bindi... | [
"def",
"update_nexusport_binding",
"(",
"port_id",
",",
"new_vlan_id",
")",
":",
"if",
"not",
"new_vlan_id",
":",
"LOG",
".",
"warning",
"(",
"\"update_nexusport_binding called with no vlan\"",
")",
"return",
"LOG",
".",
"debug",
"(",
"\"update_nexusport_binding called\... | Updates nexusport binding. | [
"Updates",
"nexusport",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L274-L285 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_all_nexusport_bindings | def remove_all_nexusport_bindings():
"""Removes all nexusport bindings."""
LOG.debug("remove_all_nexusport_bindings() called")
session = bc.get_writer_session()
session.query(nexus_models_v2.NexusPortBinding).delete()
session.flush() | python | def remove_all_nexusport_bindings():
"""Removes all nexusport bindings."""
LOG.debug("remove_all_nexusport_bindings() called")
session = bc.get_writer_session()
session.query(nexus_models_v2.NexusPortBinding).delete()
session.flush() | [
"def",
"remove_all_nexusport_bindings",
"(",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_all_nexusport_bindings() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"session",
".",
"query",
"(",
"nexus_models_v2",
".",
"NexusPortBinding",
"... | Removes all nexusport bindings. | [
"Removes",
"all",
"nexusport",
"bindings",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L288-L294 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_nexusvm_bindings | def get_nexusvm_bindings(vlan_id, instance_id):
"""Lists nexusvm bindings."""
LOG.debug("get_nexusvm_bindings() called")
return _lookup_all_nexus_bindings(instance_id=instance_id,
vlan_id=vlan_id) | python | def get_nexusvm_bindings(vlan_id, instance_id):
"""Lists nexusvm bindings."""
LOG.debug("get_nexusvm_bindings() called")
return _lookup_all_nexus_bindings(instance_id=instance_id,
vlan_id=vlan_id) | [
"def",
"get_nexusvm_bindings",
"(",
"vlan_id",
",",
"instance_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_nexusvm_bindings() called\"",
")",
"return",
"_lookup_all_nexus_bindings",
"(",
"instance_id",
"=",
"instance_id",
",",
"vlan_id",
"=",
"vlan_id",
")"
] | Lists nexusvm bindings. | [
"Lists",
"nexusvm",
"bindings",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L297-L301 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_port_vlan_switch_binding | def get_port_vlan_switch_binding(port_id, vlan_id, switch_ip):
"""Lists nexusvm bindings."""
LOG.debug("get_port_vlan_switch_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
switch_ip=switch_ip,
vlan_id=vlan_id) | python | def get_port_vlan_switch_binding(port_id, vlan_id, switch_ip):
"""Lists nexusvm bindings."""
LOG.debug("get_port_vlan_switch_binding() called")
return _lookup_all_nexus_bindings(port_id=port_id,
switch_ip=switch_ip,
vlan_id=vlan_id) | [
"def",
"get_port_vlan_switch_binding",
"(",
"port_id",
",",
"vlan_id",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_port_vlan_switch_binding() called\"",
")",
"return",
"_lookup_all_nexus_bindings",
"(",
"port_id",
"=",
"port_id",
",",
"switch_ip",
"="... | Lists nexusvm bindings. | [
"Lists",
"nexusvm",
"bindings",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L304-L309 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_port_switch_bindings | def get_port_switch_bindings(port_id, switch_ip):
"""List all vm/vlan bindings on a Nexus switch port."""
LOG.debug("get_port_switch_bindings() called, "
"port:'%(port_id)s', switch:'%(switch_ip)s'",
{'port_id': port_id, 'switch_ip': switch_ip})
try:
return _lookup_all_ne... | python | def get_port_switch_bindings(port_id, switch_ip):
"""List all vm/vlan bindings on a Nexus switch port."""
LOG.debug("get_port_switch_bindings() called, "
"port:'%(port_id)s', switch:'%(switch_ip)s'",
{'port_id': port_id, 'switch_ip': switch_ip})
try:
return _lookup_all_ne... | [
"def",
"get_port_switch_bindings",
"(",
"port_id",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_port_switch_bindings() called, \"",
"\"port:'%(port_id)s', switch:'%(switch_ip)s'\"",
",",
"{",
"'port_id'",
":",
"port_id",
",",
"'switch_ip'",
":",
"switch_ip... | List all vm/vlan bindings on a Nexus switch port. | [
"List",
"all",
"vm",
"/",
"vlan",
"bindings",
"on",
"a",
"Nexus",
"switch",
"port",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L312-L321 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | _lookup_nexus_bindings | def _lookup_nexus_bindings(query_type, session=None, **bfilter):
"""Look up 'query_type' Nexus bindings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for bindings query
:returns: bindings if query gave a result, else
r... | python | def _lookup_nexus_bindings(query_type, session=None, **bfilter):
"""Look up 'query_type' Nexus bindings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for bindings query
:returns: bindings if query gave a result, else
r... | [
"def",
"_lookup_nexus_bindings",
"(",
"query_type",
",",
"session",
"=",
"None",
",",
"*",
"*",
"bfilter",
")",
":",
"if",
"session",
"is",
"None",
":",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"query_method",
"=",
"getattr",
"(",
"sessio... | Look up 'query_type' Nexus bindings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for bindings query
:returns: bindings if query gave a result, else
raise NexusPortBindingNotFound. | [
"Look",
"up",
"query_type",
"Nexus",
"bindings",
"matching",
"the",
"filter",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L330-L349 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | add_nexusnve_binding | def add_nexusnve_binding(vni, switch_ip, device_id, mcast_group):
"""Adds a nexus nve binding."""
LOG.debug("add_nexusnve_binding() called")
session = bc.get_writer_session()
binding = nexus_models_v2.NexusNVEBinding(vni=vni,
switch_ip=switch_ip,
... | python | def add_nexusnve_binding(vni, switch_ip, device_id, mcast_group):
"""Adds a nexus nve binding."""
LOG.debug("add_nexusnve_binding() called")
session = bc.get_writer_session()
binding = nexus_models_v2.NexusNVEBinding(vni=vni,
switch_ip=switch_ip,
... | [
"def",
"add_nexusnve_binding",
"(",
"vni",
",",
"switch_ip",
",",
"device_id",
",",
"mcast_group",
")",
":",
"LOG",
".",
"debug",
"(",
"\"add_nexusnve_binding() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"binding",
"=",
"nexus_mod... | Adds a nexus nve binding. | [
"Adds",
"a",
"nexus",
"nve",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L364-L374 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_nexusnve_binding | def remove_nexusnve_binding(vni, switch_ip, device_id):
"""Remove the nexus nve binding."""
LOG.debug("remove_nexusnve_binding() called")
session = bc.get_writer_session()
binding = (session.query(nexus_models_v2.NexusNVEBinding).
filter_by(vni=vni, switch_ip=switch_ip,
... | python | def remove_nexusnve_binding(vni, switch_ip, device_id):
"""Remove the nexus nve binding."""
LOG.debug("remove_nexusnve_binding() called")
session = bc.get_writer_session()
binding = (session.query(nexus_models_v2.NexusNVEBinding).
filter_by(vni=vni, switch_ip=switch_ip,
... | [
"def",
"remove_nexusnve_binding",
"(",
"vni",
",",
"switch_ip",
",",
"device_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_nexusnve_binding() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"binding",
"=",
"(",
"session",
".",
"... | Remove the nexus nve binding. | [
"Remove",
"the",
"nexus",
"nve",
"binding",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L377-L387 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_all_nexusnve_bindings | def remove_all_nexusnve_bindings():
"""Removes all nexusnve bindings."""
LOG.debug("remove_all_nexusport_bindings() called")
session = bc.get_writer_session()
session.query(nexus_models_v2.NexusNVEBinding).delete()
session.flush() | python | def remove_all_nexusnve_bindings():
"""Removes all nexusnve bindings."""
LOG.debug("remove_all_nexusport_bindings() called")
session = bc.get_writer_session()
session.query(nexus_models_v2.NexusNVEBinding).delete()
session.flush() | [
"def",
"remove_all_nexusnve_bindings",
"(",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_all_nexusport_bindings() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"session",
".",
"query",
"(",
"nexus_models_v2",
".",
"NexusNVEBinding",
")"... | Removes all nexusnve bindings. | [
"Removes",
"all",
"nexusnve",
"bindings",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L390-L396 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | get_nve_vni_switch_bindings | def get_nve_vni_switch_bindings(vni, switch_ip):
"""Return the nexus nve binding(s) per switch."""
LOG.debug("get_nve_vni_switch_bindings() called")
session = bc.get_reader_session()
try:
return (session.query(nexus_models_v2.NexusNVEBinding).
filter_by(vni=vni, switch_ip=switch_... | python | def get_nve_vni_switch_bindings(vni, switch_ip):
"""Return the nexus nve binding(s) per switch."""
LOG.debug("get_nve_vni_switch_bindings() called")
session = bc.get_reader_session()
try:
return (session.query(nexus_models_v2.NexusNVEBinding).
filter_by(vni=vni, switch_ip=switch_... | [
"def",
"get_nve_vni_switch_bindings",
"(",
"vni",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"get_nve_vni_switch_bindings() called\"",
")",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"try",
":",
"return",
"(",
"session",
".",
"query"... | Return the nexus nve binding(s) per switch. | [
"Return",
"the",
"nexus",
"nve",
"binding",
"(",
"s",
")",
"per",
"switch",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L399-L407 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | _lookup_host_mappings | def _lookup_host_mappings(query_type, session=None, **bfilter):
"""Look up 'query_type' Nexus mappings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for mappings query
:returns: mappings if query gave a result, else
ra... | python | def _lookup_host_mappings(query_type, session=None, **bfilter):
"""Look up 'query_type' Nexus mappings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for mappings query
:returns: mappings if query gave a result, else
ra... | [
"def",
"_lookup_host_mappings",
"(",
"query_type",
",",
"session",
"=",
"None",
",",
"*",
"*",
"bfilter",
")",
":",
"if",
"session",
"is",
"None",
":",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"query_method",
"=",
"getattr",
"(",
"session... | Look up 'query_type' Nexus mappings matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param bfilter: filter for mappings query
:returns: mappings if query gave a result, else
raise NexusHostMappingNotFound. | [
"Look",
"up",
"query_type",
"Nexus",
"mappings",
"matching",
"the",
"filter",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L444-L463 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | add_host_mapping | def add_host_mapping(host_id, nexus_ip, interface, ch_grp, is_static):
"""Add Host to interface mapping entry into mapping data base.
:param host_id: is the name of the host to add
:param interface: is the interface for this host
:param nexus_ip: is the ip addr of the nexus switch for this interface
... | python | def add_host_mapping(host_id, nexus_ip, interface, ch_grp, is_static):
"""Add Host to interface mapping entry into mapping data base.
:param host_id: is the name of the host to add
:param interface: is the interface for this host
:param nexus_ip: is the ip addr of the nexus switch for this interface
... | [
"def",
"add_host_mapping",
"(",
"host_id",
",",
"nexus_ip",
",",
"interface",
",",
"ch_grp",
",",
"is_static",
")",
":",
"LOG",
".",
"debug",
"(",
"\"add_nexusport_binding() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"mapping",
... | Add Host to interface mapping entry into mapping data base.
:param host_id: is the name of the host to add
:param interface: is the interface for this host
:param nexus_ip: is the ip addr of the nexus switch for this interface
:param ch_grp: is the port channel this interface belos
:param is_static... | [
"Add",
"Host",
"to",
"interface",
"mapping",
"entry",
"into",
"mapping",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L496-L525 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | update_host_mapping | def update_host_mapping(host_id, interface, nexus_ip, new_ch_grp):
"""Change channel_group in host/interface mapping data base."""
LOG.debug("update_host_mapping called")
session = bc.get_writer_session()
mapping = _lookup_one_host_mapping(
session=session,
host_id=h... | python | def update_host_mapping(host_id, interface, nexus_ip, new_ch_grp):
"""Change channel_group in host/interface mapping data base."""
LOG.debug("update_host_mapping called")
session = bc.get_writer_session()
mapping = _lookup_one_host_mapping(
session=session,
host_id=h... | [
"def",
"update_host_mapping",
"(",
"host_id",
",",
"interface",
",",
"nexus_ip",
",",
"new_ch_grp",
")",
":",
"LOG",
".",
"debug",
"(",
"\"update_host_mapping called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"mapping",
"=",
"_lookup_one... | Change channel_group in host/interface mapping data base. | [
"Change",
"channel_group",
"in",
"host",
"/",
"interface",
"mapping",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L528-L541 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_host_mapping | def remove_host_mapping(interface, nexus_ip):
"""Remove host to interface mapping entry from mapping data base."""
LOG.debug("remove_host_mapping() called")
session = bc.get_writer_session()
try:
mapping = _lookup_one_host_mapping(
session=session,
if... | python | def remove_host_mapping(interface, nexus_ip):
"""Remove host to interface mapping entry from mapping data base."""
LOG.debug("remove_host_mapping() called")
session = bc.get_writer_session()
try:
mapping = _lookup_one_host_mapping(
session=session,
if... | [
"def",
"remove_host_mapping",
"(",
"interface",
",",
"nexus_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_host_mapping() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"try",
":",
"mapping",
"=",
"_lookup_one_host_mapping",
"(",
... | Remove host to interface mapping entry from mapping data base. | [
"Remove",
"host",
"to",
"interface",
"mapping",
"entry",
"from",
"mapping",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L544-L557 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | remove_all_static_host_mappings | def remove_all_static_host_mappings():
"""Remove all entries defined in config file from mapping data base."""
LOG.debug("remove_host_mapping() called")
session = bc.get_writer_session()
try:
mapping = _lookup_all_host_mappings(
session=session,
is_st... | python | def remove_all_static_host_mappings():
"""Remove all entries defined in config file from mapping data base."""
LOG.debug("remove_host_mapping() called")
session = bc.get_writer_session()
try:
mapping = _lookup_all_host_mappings(
session=session,
is_st... | [
"def",
"remove_all_static_host_mappings",
"(",
")",
":",
"LOG",
".",
"debug",
"(",
"\"remove_host_mapping() called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"try",
":",
"mapping",
"=",
"_lookup_all_host_mappings",
"(",
"session",
"=",
"se... | Remove all entries defined in config file from mapping data base. | [
"Remove",
"all",
"entries",
"defined",
"in",
"config",
"file",
"from",
"mapping",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L560-L573 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | _lookup_vpc_allocs | def _lookup_vpc_allocs(query_type, session=None, order=None, **bfilter):
"""Look up 'query_type' Nexus VPC Allocs matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param order: select what field to order data
:param bfilter: filter for mappings query
:r... | python | def _lookup_vpc_allocs(query_type, session=None, order=None, **bfilter):
"""Look up 'query_type' Nexus VPC Allocs matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param order: select what field to order data
:param bfilter: filter for mappings query
:r... | [
"def",
"_lookup_vpc_allocs",
"(",
"query_type",
",",
"session",
"=",
"None",
",",
"order",
"=",
"None",
",",
"*",
"*",
"bfilter",
")",
":",
"if",
"session",
"is",
"None",
":",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"if",
"order",
":... | Look up 'query_type' Nexus VPC Allocs matching the filter.
:param query_type: 'all', 'one' or 'first'
:param session: db session
:param order: select what field to order data
:param bfilter: filter for mappings query
:returns: VPCs if query gave a result, else
raise NexusVPCAllocNotFou... | [
"Look",
"up",
"query_type",
"Nexus",
"VPC",
"Allocs",
"matching",
"the",
"filter",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L576-L606 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | _lookup_vpc_count_min_max | def _lookup_vpc_count_min_max(session=None, **bfilter):
"""Look up count/min/max Nexus VPC Allocs for given switch.
:param session: db session
:param bfilter: filter for mappings query
:returns: number of VPCs and min value if query gave a result,
else raise NexusVPCAllocNotFound.
"""
... | python | def _lookup_vpc_count_min_max(session=None, **bfilter):
"""Look up count/min/max Nexus VPC Allocs for given switch.
:param session: db session
:param bfilter: filter for mappings query
:returns: number of VPCs and min value if query gave a result,
else raise NexusVPCAllocNotFound.
"""
... | [
"def",
"_lookup_vpc_count_min_max",
"(",
"session",
"=",
"None",
",",
"*",
"*",
"bfilter",
")",
":",
"if",
"session",
"is",
"None",
":",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"try",
":",
"res",
"=",
"session",
".",
"query",
"(",
"f... | Look up count/min/max Nexus VPC Allocs for given switch.
:param session: db session
:param bfilter: filter for mappings query
:returns: number of VPCs and min value if query gave a result,
else raise NexusVPCAllocNotFound. | [
"Look",
"up",
"count",
"/",
"min",
"/",
"max",
"Nexus",
"VPC",
"Allocs",
"for",
"given",
"switch",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L609-L638 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | _get_free_vpcids_on_switches | def _get_free_vpcids_on_switches(switch_ip_list):
'''Get intersect list of free vpcids in list of switches.'''
session = bc.get_reader_session()
prev_view = aliased(nexus_models_v2.NexusVPCAlloc)
query = session.query(prev_view.vpc_id)
prev_swip = switch_ip_list[0]
for ip in switch_ip_list[1:... | python | def _get_free_vpcids_on_switches(switch_ip_list):
'''Get intersect list of free vpcids in list of switches.'''
session = bc.get_reader_session()
prev_view = aliased(nexus_models_v2.NexusVPCAlloc)
query = session.query(prev_view.vpc_id)
prev_swip = switch_ip_list[0]
for ip in switch_ip_list[1:... | [
"def",
"_get_free_vpcids_on_switches",
"(",
"switch_ip_list",
")",
":",
"session",
"=",
"bc",
".",
"get_reader_session",
"(",
")",
"prev_view",
"=",
"aliased",
"(",
"nexus_models_v2",
".",
"NexusVPCAlloc",
")",
"query",
"=",
"session",
".",
"query",
"(",
"prev_v... | Get intersect list of free vpcids in list of switches. | [
"Get",
"intersect",
"list",
"of",
"free",
"vpcids",
"in",
"list",
"of",
"switches",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L649-L670 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | init_vpc_entries | def init_vpc_entries(nexus_ip, vpc_list):
"""Initialize switch/vpc entries in vpc alloc data base.
param: nexus_ip ip addr of the nexus switch for this interface
param: vpc_list list of vpc integers to create
"""
LOG.debug("init_vpc_entries() called")
if not vpc_list:
return
ses... | python | def init_vpc_entries(nexus_ip, vpc_list):
"""Initialize switch/vpc entries in vpc alloc data base.
param: nexus_ip ip addr of the nexus switch for this interface
param: vpc_list list of vpc integers to create
"""
LOG.debug("init_vpc_entries() called")
if not vpc_list:
return
ses... | [
"def",
"init_vpc_entries",
"(",
"nexus_ip",
",",
"vpc_list",
")",
":",
"LOG",
".",
"debug",
"(",
"\"init_vpc_entries() called\"",
")",
"if",
"not",
"vpc_list",
":",
"return",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"for",
"vpc",
"in",
"vpc... | Initialize switch/vpc entries in vpc alloc data base.
param: nexus_ip ip addr of the nexus switch for this interface
param: vpc_list list of vpc integers to create | [
"Initialize",
"switch",
"/",
"vpc",
"entries",
"in",
"vpc",
"alloc",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L699-L719 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | update_vpc_entry | def update_vpc_entry(nexus_ips, vpc_id, learned, active):
"""Change active state in vpc_allocate data base."""
LOG.debug("update_vpc_entry called")
session = bc.get_writer_session()
with session.begin():
for n_ip in nexus_ips:
flipit = not active
x = session.execute(
... | python | def update_vpc_entry(nexus_ips, vpc_id, learned, active):
"""Change active state in vpc_allocate data base."""
LOG.debug("update_vpc_entry called")
session = bc.get_writer_session()
with session.begin():
for n_ip in nexus_ips:
flipit = not active
x = session.execute(
... | [
"def",
"update_vpc_entry",
"(",
"nexus_ips",
",",
"vpc_id",
",",
"learned",
",",
"active",
")",
":",
"LOG",
".",
"debug",
"(",
"\"update_vpc_entry called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"with",
"session",
".",
"begin",
"("... | Change active state in vpc_allocate data base. | [
"Change",
"active",
"state",
"in",
"vpc_allocate",
"data",
"base",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L722-L742 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | alloc_vpcid | def alloc_vpcid(nexus_ips):
"""Allocate a vpc id for the given list of switch_ips."""
LOG.debug("alloc_vpc() called")
vpc_id = 0
intersect = _get_free_vpcids_on_switches(nexus_ips)
for intersect_tuple in intersect:
try:
update_vpc_entry(nexus_ips, intersect_tuple.vpc_id,
... | python | def alloc_vpcid(nexus_ips):
"""Allocate a vpc id for the given list of switch_ips."""
LOG.debug("alloc_vpc() called")
vpc_id = 0
intersect = _get_free_vpcids_on_switches(nexus_ips)
for intersect_tuple in intersect:
try:
update_vpc_entry(nexus_ips, intersect_tuple.vpc_id,
... | [
"def",
"alloc_vpcid",
"(",
"nexus_ips",
")",
":",
"LOG",
".",
"debug",
"(",
"\"alloc_vpc() called\"",
")",
"vpc_id",
"=",
"0",
"intersect",
"=",
"_get_free_vpcids_on_switches",
"(",
"nexus_ips",
")",
"for",
"intersect_tuple",
"in",
"intersect",
":",
"try",
":",
... | Allocate a vpc id for the given list of switch_ips. | [
"Allocate",
"a",
"vpc",
"id",
"for",
"the",
"given",
"list",
"of",
"switch_ips",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L745-L765 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | free_vpcid_for_switch_list | def free_vpcid_for_switch_list(vpc_id, nexus_ips):
"""Free a vpc id for the given list of switch_ips."""
LOG.debug("free_vpcid_for_switch_list() called")
if vpc_id != 0:
update_vpc_entry(nexus_ips, vpc_id, False, False) | python | def free_vpcid_for_switch_list(vpc_id, nexus_ips):
"""Free a vpc id for the given list of switch_ips."""
LOG.debug("free_vpcid_for_switch_list() called")
if vpc_id != 0:
update_vpc_entry(nexus_ips, vpc_id, False, False) | [
"def",
"free_vpcid_for_switch_list",
"(",
"vpc_id",
",",
"nexus_ips",
")",
":",
"LOG",
".",
"debug",
"(",
"\"free_vpcid_for_switch_list() called\"",
")",
"if",
"vpc_id",
"!=",
"0",
":",
"update_vpc_entry",
"(",
"nexus_ips",
",",
"vpc_id",
",",
"False",
",",
"Fal... | Free a vpc id for the given list of switch_ips. | [
"Free",
"a",
"vpc",
"id",
"for",
"the",
"given",
"list",
"of",
"switch_ips",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L768-L773 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | free_vpcid_for_switch | def free_vpcid_for_switch(vpc_id, nexus_ip):
"""Free a vpc id for the given switch_ip."""
LOG.debug("free_vpcid_for_switch() called")
if vpc_id != 0:
update_vpc_entry([nexus_ip], vpc_id, False, False) | python | def free_vpcid_for_switch(vpc_id, nexus_ip):
"""Free a vpc id for the given switch_ip."""
LOG.debug("free_vpcid_for_switch() called")
if vpc_id != 0:
update_vpc_entry([nexus_ip], vpc_id, False, False) | [
"def",
"free_vpcid_for_switch",
"(",
"vpc_id",
",",
"nexus_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"free_vpcid_for_switch() called\"",
")",
"if",
"vpc_id",
"!=",
"0",
":",
"update_vpc_entry",
"(",
"[",
"nexus_ip",
"]",
",",
"vpc_id",
",",
"False",
",",
"F... | Free a vpc id for the given switch_ip. | [
"Free",
"a",
"vpc",
"id",
"for",
"the",
"given",
"switch_ip",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L776-L781 |
openstack/networking-cisco | networking_cisco/ml2_drivers/nexus/nexus_db_v2.py | delete_vpcid_for_switch | def delete_vpcid_for_switch(vpc_id, switch_ip):
"""Removes unused vpcid for a switch.
:param vpc_id: vpc id to remove
:param switch_ip: ip address of the switch
"""
LOG.debug("delete_vpcid_for_switch called")
session = bc.get_writer_session()
vpc = _lookup_one_vpc_allocs(vpc_id=vpc_id,
... | python | def delete_vpcid_for_switch(vpc_id, switch_ip):
"""Removes unused vpcid for a switch.
:param vpc_id: vpc id to remove
:param switch_ip: ip address of the switch
"""
LOG.debug("delete_vpcid_for_switch called")
session = bc.get_writer_session()
vpc = _lookup_one_vpc_allocs(vpc_id=vpc_id,
... | [
"def",
"delete_vpcid_for_switch",
"(",
"vpc_id",
",",
"switch_ip",
")",
":",
"LOG",
".",
"debug",
"(",
"\"delete_vpcid_for_switch called\"",
")",
"session",
"=",
"bc",
".",
"get_writer_session",
"(",
")",
"vpc",
"=",
"_lookup_one_vpc_allocs",
"(",
"vpc_id",
"=",
... | Removes unused vpcid for a switch.
:param vpc_id: vpc id to remove
:param switch_ip: ip address of the switch | [
"Removes",
"unused",
"vpcid",
"for",
"a",
"switch",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L784-L798 |
openstack/networking-cisco | networking_cisco/plugins/cisco/extensions/ciscocfgagentscheduler.py | Ciscocfgagentscheduler.get_resources | def get_resources(cls):
"""Returns Ext Resources."""
exts = []
parent = dict(member_name="agent",
collection_name="agents")
controller = resource.Resource(HostingDeviceSchedulerController(),
cb_faults.FAULT_MAP)
exts.ap... | python | def get_resources(cls):
"""Returns Ext Resources."""
exts = []
parent = dict(member_name="agent",
collection_name="agents")
controller = resource.Resource(HostingDeviceSchedulerController(),
cb_faults.FAULT_MAP)
exts.ap... | [
"def",
"get_resources",
"(",
"cls",
")",
":",
"exts",
"=",
"[",
"]",
"parent",
"=",
"dict",
"(",
"member_name",
"=",
"\"agent\"",
",",
"collection_name",
"=",
"\"agents\"",
")",
"controller",
"=",
"resource",
".",
"Resource",
"(",
"HostingDeviceSchedulerContro... | Returns Ext Resources. | [
"Returns",
"Ext",
"Resources",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/extensions/ciscocfgagentscheduler.py#L150-L166 |
openstack/networking-cisco | networking_cisco/apps/saf/common/dfa_sys_lib.py | create_process | def create_process(cmd, root_helper=None, addl_env=None, log_output=True):
"""Create a process object for the given command.
The return value will be a tuple of the process object and the
list of command arguments used to create it.
"""
if root_helper:
cmd = shlex.split(root_helper) + cmd
... | python | def create_process(cmd, root_helper=None, addl_env=None, log_output=True):
"""Create a process object for the given command.
The return value will be a tuple of the process object and the
list of command arguments used to create it.
"""
if root_helper:
cmd = shlex.split(root_helper) + cmd
... | [
"def",
"create_process",
"(",
"cmd",
",",
"root_helper",
"=",
"None",
",",
"addl_env",
"=",
"None",
",",
"log_output",
"=",
"True",
")",
":",
"if",
"root_helper",
":",
"cmd",
"=",
"shlex",
".",
"split",
"(",
"root_helper",
")",
"+",
"cmd",
"cmd",
"=",
... | Create a process object for the given command.
The return value will be a tuple of the process object and the
list of command arguments used to create it. | [
"Create",
"a",
"process",
"object",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/common/dfa_sys_lib.py#L271-L289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.