function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def simple_separated_format(separator):
"""Construct a simple TableFormat with columns separated by a separator.
>>> tsv = simple_separated_format("\\t") ; \
tabulate([["foo", 1], ["spam", 23]], tablefmt=tsv) == 'foo \\t 1\\nspam\\t23'
True
""" # noqa
return TableFormat(None, None, None, N... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _isnumber(string):
"""
>>> _isnumber("123.45")
True
>>> _isnumber("123")
True
>>> _isnumber("spam")
False
>>> _isnumber("123e45678")
False
>>> _isnumber("inf")
True
"""
if not _isconvertible(float, string):
return False
elif isinstance(string, (_text_t... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _isbool(string):
"""
>>> _isbool(True)
True
>>> _isbool("False")
True
>>> _isbool(1)
False
"""
return (type(string) is _bool_type or
(isinstance(string, (_binary_type, _text_type))
and string in ("True", "False"))) | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _afterpoint(string):
"""Symbols after a decimal point, -1 if the string lacks the decimal point.
>>> _afterpoint("123.45")
2
>>> _afterpoint("1001")
-1
>>> _afterpoint("eggs")
-1
>>> _afterpoint("123e45")
2
"""
if _isnumber(string):
if _isint(string):
... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _padright(width, s):
"""Flush left.
>>> _padright(6, '\u044f\u0439\u0446\u0430') == '\u044f\u0439\u0446\u0430 '
True
""" # noqa
fmt = "{0:<%ds}" % width
return fmt.format(s) | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _padnone(ignore_width, s):
return s | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _visible_width(s):
"""Visible width of a printed string. ANSI color codes are removed.
>>> _visible_width('\x1b[31mhello\x1b[0m'), _visible_width("world")
(5, 5)
"""
# optional wide-character support
if wcwidth is not None and WIDE_CHARS_MODE:
len_fn = wcwidth.wcswidth
else:
... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _multiline_width(multiline_s, line_width_fn=len):
"""Visible width of a potentially multiline content."""
return max(map(line_width_fn, re.split("[\r\n]", multiline_s))) | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _align_column_choose_padfn(strings, alignment, has_invisible):
if alignment == "right":
if not PRESERVE_WHITESPACE:
strings = [s.strip() for s in strings]
padfn = _padleft
elif alignment == "center":
if not PRESERVE_WHITESPACE:
strings = [s.strip() for s in st... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _more_generic(type1, type2):
types = {_none_type: 0,
_bool_type: 1,
int: 2,
float: 3,
_binary_type: 4,
_text_type: 5}
invtypes = {5: _text_type,
4: _binary_type,
3: float,
2: int,
... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _format(val, valtype, floatfmt, missingval="", has_invisible=True):
"""Format a value according to its type.
Unicode is supported:
>>> hrow = ['\u0431\u0443\u043a\u0432\u0430', '\u0446\u0438\u0444\u0440\u0430'] ; \
tbl = [['\u0430\u0437', 2], ['\u0431\u0443\u043a\u0438', 4]] ; \
good_r... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _prepend_row_index(rows, index):
"""Add a left-most index column."""
if index is None or index is False:
return rows
if len(index) != len(rows):
print('index=', index)
print('rows=', rows)
raise ValueError('index must be as long as the number of data rows')
rows = [[v... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _normalize_tabular_data(tabular_data, headers, showindex="default"):
"""Transform a supported data type to a list of lists, and a list of headers.
Supported tabular data types:
* list-of-lists or another iterable of iterables
* list of named tuples (usually used with headers="keys")
* list o... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _expand_numparse(disable_numparse, column_count):
"""
Return a list of bools of length `column_count` which indicates whether
number parsing should be used on each column.
If `disable_numparse` is a list of indices, each of those indices are
False, and everything else is True.
If `disable_nu... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _build_simple_row(padded_cells, rowfmt):
"Format row according to DataRow format without padding."
begin, sep, end = rowfmt
return (begin + sep.join(padded_cells) + end).rstrip() | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _append_basic_row(lines, padded_cells, colwidths, colaligns, rowfmt):
lines.append(_build_row(padded_cells, colwidths, colaligns, rowfmt))
return lines | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _build_line(colwidths, colaligns, linefmt):
"Return a string which represents a horizontal line."
if not linefmt:
return None
if hasattr(linefmt, "__call__"):
return linefmt(colwidths, colaligns)
else:
begin, fill, sep, end = linefmt
cells = [fill*w for w in colwidth... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _format_table(fmt, headers, rows, colwidths, colaligns, is_multiline):
"""Produce a plain-text representation of the table."""
lines = []
hidden = fmt.with_header_hide if (headers and fmt.with_header_hide) else []
pad = fmt.padding
headerrow = fmt.headerrow
padded_widths = [(w + 2*pad) for ... | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def _pprint_file(fobject, headers, tablefmt, sep, floatfmt, file, colalign):
rows = fobject.readlines()
table = [re.split(sep, r.rstrip()) for r in rows if r.strip()]
print(tabulate(table, headers, tablefmt, floatfmt=floatfmt,
colalign=colalign), file=file) | anlambert/tulip | [
2,
1,
2,
1,
1486498884
] |
def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None):
# those lines are copied from distutils.ccompiler.CCompiler directly
macros, objects, extra_postargs, pp_opts, build = self._setup_compile(output_dir, macros, inc... | peter-ch/MultiNEAT | [
319,
101,
319,
32,
1344853505
] |
def _single_compile(obj):
try: src, ext = build[obj]
except KeyError: return
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) | peter-ch/MultiNEAT | [
319,
101,
319,
32,
1344853505
] |
def getExtensions():
platform = sys.platform
extensionsList = []
sources = ['src/Genome.cpp',
'src/Innovation.cpp',
'src/NeuralNetwork.cpp',
'src/Parameters.cpp',
'src/PhenotypeBehavior.cpp',
'src/Population.cpp',
'sr... | peter-ch/MultiNEAT | [
319,
101,
319,
32,
1344853505
] |
def __init__(self, config=None, args=None):
# Init
self.config = config
self.args = args
# Init windows positions
self.term_w = 80
self.term_h = 24
# Space between stats
self.space_between_column = 3
self.space_between_line = 2
# Init th... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def is_theme(self, name):
"""Return True if the theme *name* should be used."""
return getattr(self.args, 'theme_' + name) or self.theme['name'] == name | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def _init_cursor(self):
"""Init cursors."""
if hasattr(curses, 'noecho'):
curses.noecho()
if hasattr(curses, 'cbreak'):
curses.cbreak()
self.set_cursor(0) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def set_cursor(self, value):
"""Configure the curse cursor appearance.
0: invisible
1: visible
2: very visible
"""
if hasattr(curses, 'curs_set'):
try:
curses.curs_set(value)
except Exception:
pass | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def __catch_key(self, return_to_browser=False):
# Catch the pressed key
self.pressedkey = self.get_key(self.term_window)
if self.pressedkey == -1:
return -1
# Actions (available in the global hotkey dict)...
logger.debug("Keypressed (code: {})".format(self.pressedkey... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def disable_top(self):
"""Disable the top panel"""
for p in ['quicklook', 'cpu', 'gpu', 'mem', 'memswap', 'load']:
setattr(self.args, 'disable_' + p, True) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def disable_fullquicklook(self):
"""Disable the full quicklook mode"""
for p in ['quicklook', 'cpu', 'gpu', 'mem', 'memswap']:
setattr(self.args, 'disable_' + p, False) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def end(self):
"""Shutdown the curses window."""
if hasattr(curses, 'echo'):
curses.echo()
if hasattr(curses, 'nocbreak'):
curses.nocbreak()
if hasattr(curses, 'curs_set'):
try:
curses.curs_set(1)
except Exception:
... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def init_line(self):
"""Init the line position for the curses interface."""
self.line = 0
self.next_line = 0 | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def new_line(self, separator=False):
"""New line in the curses interface."""
self.line = self.next_line | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def separator_line(self, color='TITLE'):
"""New separator line in the curses interface."""
if not self.args.enable_separator:
return
self.new_line()
self.line -= 1
line_width = self.term_window.getmaxyx()[1] - self.column
self.term_window.addnstr(self.line, se... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def display(self, stats, cs_status=None):
"""Display stats on the screen.
:param stats: Stats database to display
:param cs_status:
"None": standalone or server mode
"Connected": Client is connected to a Glances server
"SNMP": Client is connected to a SNMP se... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def __display_top(self, stat_display, stats):
"""Display the second line in the Curses interface.
<QUICKLOOK> + CPU|PERCPU + <GPU> + MEM + SWAP + LOAD
"""
self.init_column()
self.new_line()
# Init quicklook
stat_display['quicklook'] = {'msgdict': []}
# ... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def __display_right(self, stat_display):
"""Display the right sidebar in the Curses interface.
docker + processcount + amps + processlist + alert
"""
# Do not display anything if space is not available...
if self.term_window.getmaxyx()[1] < self._left_sidebar_min_width:
... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def display_plugin(self, plugin_stats, display_optional=True, display_additional=True, max_y=65535, add_space=0):
"""Display the plugin_stats on the screen.
:param plugin_stats:
:param display_optional: display the optional stats if True
:param display_additional: display additional sta... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def flush(self, stats, cs_status=None):
"""Clear and update the screen.
:param stats: Stats database to display
:param cs_status:
"None": standalone or server mode
"Connected": Client is connected to the server
"Disconnected": Client is disconnected from the ... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def wait(self, delay=100):
"""Wait delay in ms"""
curses.napms(100) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def get_stats_display_height(self, curse_msg):
"""Return the height of the formatted curses message.
The height is defined by the number of '\n' (new line).
"""
try:
c = [i['msg'] for i in curse_msg['msgdict']].count('\n')
except Exception as e:
logger.de... | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def __init__(self, *args, **kwargs):
super(GlancesTextbox, self).__init__(*args, **kwargs) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def __init__(self, *args, **kwargs):
super(GlancesTextboxYesNo, self).__init__(*args, **kwargs) | nicolargo/glances | [
22397,
1365,
22397,
239,
1322988555
] |
def forwards(self, orm):
# Adding model 'Category'
db.create_table(u'core_category', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=75)),
))
db.send_create_signal(u'core'... | jplusplus/dystopia-tracker | [
22,
1,
22,
15,
1395838587
] |
def compute_q_noisy_max(counts, noise_eps):
"""returns ~ Pr[outcome != winner].
Args:
counts: a list of scores
noise_eps: privacy parameter for noisy_max
Returns:
q: the probability that outcome is different from true winner.
"""
# For noisy max, we only get an upper bound.
# Pr[ j beats i*] \l... | cshallue/models | [
6,
3,
6,
1,
1473384593
] |
def logmgf_exact(q, priv_eps, l):
"""Computes the logmgf value given q and privacy eps.
The bound used is the min of three terms. The first term is from
https://arxiv.org/pdf/1605.02065.pdf.
The second term is based on the fact that when event has probability (1-q) for
q close to zero, q can only change by e... | cshallue/models | [
6,
3,
6,
1,
1473384593
] |
def sens_at_k(counts, noise_eps, l, k):
"""Return sensitivity at distane k.
Args:
counts: an array of scores
noise_eps: noise parameter used
l: moment whose sensitivity is being computed
k: distance
Returns:
sensitivity: at distance k
"""
counts_sorted = sorted(counts, reverse=True)
if ... | cshallue/models | [
6,
3,
6,
1,
1473384593
] |
def main(unused_argv):
##################################################################
# If we are reproducing results from paper https://arxiv.org/abs/1610.05755,
# download the required binaries with label information.
##################################################################
# Binaries for MNI... | cshallue/models | [
6,
3,
6,
1,
1473384593
] |
def random_uuid(x, cache=True):
import uuid
return str(uuid.uuid4()) | Parsl/parsl | [
369,
114,
369,
333,
1476980871
] |
def collect_activations(
model_path: str,
layers: List[str],
dataset: str,
data_format: str = None,
split: str = FULL,
batch_size: int = 128,
output_directory: str = 'results',
gpus: List[str] = None,
gpu_memory_limit: int =None,
allow_para... | uber/ludwig | [
8787,
1030,
8787,
265,
1545955092
] |
def collect_weights(
model_path: str,
tensors: List[str],
output_directory: str = 'results',
debug: bool = False,
**kwargs | uber/ludwig | [
8787,
1030,
8787,
265,
1545955092
] |
def save_tensors(collected_tensors, output_directory):
filenames = []
for tensor_name, tensor_value in collected_tensors:
np_filename = os.path.join(
output_directory,
make_safe_filename(tensor_name) + '.npy'
)
np.save(np_filename, tensor_value.numpy())
fi... | uber/ludwig | [
8787,
1030,
8787,
265,
1545955092
] |
def cli_collect_activations(sys_argv):
"""Command Line Interface to communicate with the collection of tensors and
there are several options that can specified when calling this function:
--data_csv: Filepath for the input csv
--data_hdf5: Filepath for the input hdf5 file, if there is a csv file, this
... | uber/ludwig | [
8787,
1030,
8787,
265,
1545955092
] |
def cli_collect_summary(sys_argv):
"""Command Line Interface to collecting a summary of the model layers and weights.
--m: Input model that is necessary to collect to the tensors, this is a
required *option*
--v: Verbose: Defines the logging level that the user will be exposed to
"""
parser... | uber/ludwig | [
8787,
1030,
8787,
265,
1545955092
] |
def setup_loader(request):
setup_loader_modules = {pdbedit: {}}
with pytest.helpers.loader_mock(request, setup_loader_modules) as loader_mock:
yield loader_mock | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_when_no_users_returned_no_data_should_be_returned(verbose):
expected_users = {} if verbose else []
with patch.dict(
pdbedit.__salt__,
{
"cmd.run_all": MagicMock(
return_value={"stdout": "", "stderr": "", "retcode": 0}
)
},
):
a... | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_when_verbose_and_single_good_output_expected_data_should_be_parsed():
expected_data = {
"roscivs": {
"unix username": "roscivs",
"nt username": "bottia",
"full name": "Roscivs Bottia",
"user sid": "42",
"primary group sid": "99",
... | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def __init__(self):
self._swaps = []
self._data = [] | xunilrj/sandbox | [
8,
4,
8,
117,
1469995922
] |
def WriteResponse(self):
print(len(self._swaps))
for swap in self._swaps:
print(swap[0], swap[1]) | xunilrj/sandbox | [
8,
4,
8,
117,
1469995922
] |
def Solve(self):
self.ReadData()
self.GenerateSwaps()
self.WriteResponse() | xunilrj/sandbox | [
8,
4,
8,
117,
1469995922
] |
def __init__(self):
self._must_match_all_bonds: bool = True
self._smiles_with_h: bool = False
self._smiles_with_labels: bool = True
# A variant on matching is to consider all N and O as neutral forms during
# matching, and then as a post processing step, see whether a valid,
# neutral, molecule... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def must_match_all_bonds(self):
return self._must_match_all_bonds | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def must_match_all_bonds(self, value):
self._must_match_all_bonds = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def smiles_with_h(self):
return self._smiles_with_h | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def smiles_with_h(self, value):
self._smiles_with_h = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def smiles_with_labels(self):
return self._smiles_with_labels | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def smiles_with_labels(self, value):
self._smiles_with_labels = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def neutral_forms_during_bond_matching(self):
return self._neutral_forms_during_bond_matching | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def neutral_forms_during_bond_matching(self, value):
self._neutral_forms_during_bond_matching = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def consider_not_bonded(self):
return self._consider_not_bonded | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def consider_not_bonded(self, value):
self._consider_not_bonded = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def ring_atom_count_cannot_decrease(self):
return self._ring_atom_count_cannot_decrease | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def ring_atom_count_cannot_decrease(self, value):
self._ring_atom_count_cannot_decrease = value | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def __init__(self, hydrogens_attached, bonds_to_scores, matching_parameters):
"""Class to perform bonding assessments.
Args:
hydrogens_attached: a BondTopology that has all atoms, and the bonds
associated with the Hydrogen atoms.
bonds_to_scores: A dict that maps tuples of pairs of atoms, t... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def set_initial_score_and_incrementer(self, initial_score, op):
"""Update values used for computing scores."""
self._initial_score = initial_score
self._accumulate_score = op | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def _place_bond(self, a1, a2, btype):
"""Possibly add a new bond to the current config.
If the bond can be placed, updates self._current_bonds_attached for
both `a`` and `a2`.
Args:
a1:
a2:
btype:
Returns:
Bool.
"""
if self._current_bonds_attached[a1] + btype > self... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def place_bonds_inner(self, state):
"""Place bonds corresponding to `state`.
No validity checking is done, the calling function is responsible
for that.
Args:
state: for each pair of atoms, the kind of bond to be placed.
Returns:
If successful, a BondTopology.
"""
self._curren... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def get(ar,index):
l=len(ar);
if index<0:
return ar[l+index];
else:
return ar[index]; | ferventdesert/Hawk-Projects | [
148,
102,
148,
1,
1462091270
] |
def find(ar,filter):
for r in ar:
if filter(r):
return r;
return None; | ferventdesert/Hawk-Projects | [
148,
102,
148,
1,
1462091270
] |
def work2(x):
x.Enabled=not_repeat; | ferventdesert/Hawk-Projects | [
148,
102,
148,
1,
1462091270
] |
def is_operational(method):
# Decorator to check we are operational before provisioning.
def wrapper(*args, **kwargs):
instance = args[0]
if instance.operational:
try:
return method(*args, **kwargs)
except IOError as ioe:
LOG.error('IO Erro... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def __init__(self, conf, registerOpts=True):
# The registerOpts parameter allows a test to
# turn off config option handling so that it can
# set the options manually instead.
super(iControlDriver, self).__init__(conf)
self.conf = conf
if registerOpts:
self.co... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_valid_esd_names(self):
LOG.debug("verified esd names in get_valid_esd_names():")
LOG.debug(self.esd_names)
return self.esd_names | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def _init_bigip_hostnames(self):
# Validate and parse bigip credentials
if not self.conf.icontrol_hostname:
raise f5ex.F5InvalidConfigurationOption(
opt_name='icontrol_hostname',
opt_value='valid hostname or IP address'
)
if not self.conf.i... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def _init_errored_bigips(self):
try:
errored_bigips = self.get_errored_bigips_hostnames()
if errored_bigips:
LOG.debug('attempting to recover %s BIG-IPs' %
len(errored_bigips))
for hostname in errored_bigips:
#... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def _init_bigip(self, bigip, hostname, check_group_name=None):
# Prepare a bigip for usage
try:
major_version, minor_version = self._validate_bigip_version(
bigip, hostname)
device_group_name = None
extramb = self.system_helper.get_provision_extramb(b... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def _validate_ha(self, bigip):
# if there was only one address supplied and
# this is not a standalone device, get the
# devices trusted by this device.
device_group_name = None
if self.conf.f5_ha_type == 'standalone':
if len(self.hostnames) != 1:
bigi... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def _init_agent_config(self, bigip):
# Init agent config
ic_host = {}
ic_host['version'] = self.system_helper.get_version(bigip)
ic_host['device_name'] = bigip.device_name
ic_host['platform'] = self.system_helper.get_platform(bigip)
ic_host['serial_number'] = self.system_... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_failover_state(self, bigip):
try:
if hasattr(bigip, 'tm'):
fs = bigip.tm.sys.dbs.db.load(name='failover.state')
bigip.failover_state = fs.value
return bigip.failover_state
else:
return 'error'
except Exceptio... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def recover_errored_devices(self):
# trigger a retry on errored BIG-IPs
try:
self._init_errored_bigips()
except Exception as exc:
LOG.error('Could not recover devices: %s' % exc.message) | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def generate_capacity_score(self, capacity_policy=None):
"""Generate the capacity score of connected devices."""
if capacity_policy:
highest_metric = 0.0
highest_metric_name = None
my_methods = dir(self)
bigips = self.get_all_bigips()
for metri... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def set_plugin_rpc(self, plugin_rpc):
# Provide Plugin RPC access
self.plugin_rpc = plugin_rpc | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def set_l2pop_rpc(self, l2pop_rpc):
# Provide FDB Connector with ML2 RPC access
if self.network_builder:
self.network_builder.set_l2pop_rpc(l2pop_rpc) | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def service_exists(self, service):
return self._service_exists(service) | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_all_deployed_loadbalancers(self, purge_orphaned_folders=False):
LOG.debug('getting all deployed loadbalancers on BIG-IPs')
deployed_lb_dict = {}
for bigip in self.get_all_bigips():
folders = self.system_helper.get_folders(bigip)
for folder in folders:
... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_all_deployed_listeners(self, expand_subcollections=False):
LOG.debug('getting all deployed listeners on BIG-IPs')
deployed_virtual_dict = {}
for bigip in self.get_all_bigips():
folders = self.system_helper.get_folders(bigip)
for folder in folders:
... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def purge_orphaned_nodes(self, tenant_members):
node_helper = resource_helper.BigIPResourceHelper(
resource_helper.ResourceType.node)
node_dict = dict()
for bigip in self.get_all_bigips():
for tenant_id, members in tenant_members.iteritems():
partition = s... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_all_deployed_pools(self):
LOG.debug('getting all deployed pools on BIG-IPs')
deployed_pool_dict = {}
for bigip in self.get_all_bigips():
folders = self.system_helper.get_folders(bigip)
for folder in folders:
tenant_id = folder[len(self.service_adap... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def purge_orphaned_pool(self, tenant_id=None, pool_id=None,
hostnames=list()):
node_helper = resource_helper.BigIPResourceHelper(
resource_helper.ResourceType.node)
for bigip in self.get_all_bigips():
if bigip.hostname in hostnames:
try... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def get_all_deployed_health_monitors(self):
"""Retrieve a list of all Health Monitors deployed"""
LOG.debug('getting all deployed monitors on BIG-IP\'s')
monitor_types = ['http_monitor', 'https_monitor', 'tcp_monitor',
'ping_monitor']
deployed_monitor_dict = {}
... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
def purge_orphaned_health_monitor(self, tenant_id=None, monitor_id=None,
hostnames=list()):
"""Purge all monitors that exist on the BIG-IP but not in Neutron"""
resource_types = [
resource_helper.BigIPResourceHelper(x) for x in [
resource... | F5Networks/f5-openstack-agent | [
14,
37,
14,
83,
1444753730
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.