body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
def main():
' Driver ' | 4,307,824,353,820,192,300 | Driver | common.py | main | ajyl/KEMP | python | def main():
' ' |
def __init__(self, dataset_spec: DatasetSpec=None, dev_strs: List[str]=None, v_keychains=None, keep_v_keychains=False, build_mode='explicit', **kwargs) -> None:
'\n base class for storing general specifications of the neural network\n '
kw = locals_to_kwargs(locals())
super().__init__(dataset_... | 6,158,320,943,500,329,000 | base class for storing general specifications of the neural network | ivy_builder/specs/network_spec.py | __init__ | ivy-dl/builder | python | def __init__(self, dataset_spec: DatasetSpec=None, dev_strs: List[str]=None, v_keychains=None, keep_v_keychains=False, build_mode='explicit', **kwargs) -> None:
'\n \n '
kw = locals_to_kwargs(locals())
super().__init__(dataset_spec=dataset_spec, dev_strs=dev_strs, v_keychains=v_keychains, keep... |
def __init__(self, backup_policy=None):
'SetBackupPolicyRequestBody - a model defined in huaweicloud sdk'
self._backup_policy = None
self.discriminator = None
self.backup_policy = backup_policy | -1,608,957,040,764,722,000 | SetBackupPolicyRequestBody - a model defined in huaweicloud sdk | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __init__ | JeffreyDin/huaweicloud-sdk-python-v3 | python | def __init__(self, backup_policy=None):
self._backup_policy = None
self.discriminator = None
self.backup_policy = backup_policy |
@property
def backup_policy(self):
'Gets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :return: The backup_policy of this SetBackupPolicyRequestBody.\n :rtype: BackupPolicy\n '
return self._backup_policy | 38,454,043,653,194,840 | Gets the backup_policy of this SetBackupPolicyRequestBody.
:return: The backup_policy of this SetBackupPolicyRequestBody.
:rtype: BackupPolicy | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | backup_policy | JeffreyDin/huaweicloud-sdk-python-v3 | python | @property
def backup_policy(self):
'Gets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :return: The backup_policy of this SetBackupPolicyRequestBody.\n :rtype: BackupPolicy\n '
return self._backup_policy |
@backup_policy.setter
def backup_policy(self, backup_policy):
'Sets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.\n :type: BackupPolicy\n '
self._backup_policy = backup_policy | -1,252,242,191,143,817,700 | Sets the backup_policy of this SetBackupPolicyRequestBody.
:param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.
:type: BackupPolicy | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | backup_policy | JeffreyDin/huaweicloud-sdk-python-v3 | python | @backup_policy.setter
def backup_policy(self, backup_policy):
'Sets the backup_policy of this SetBackupPolicyRequestBody.\n\n\n :param backup_policy: The backup_policy of this SetBackupPolicyRequestBody.\n :type: BackupPolicy\n '
self._backup_policy = backup_policy |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | 2,594,216,033,120,720,000 | Returns the model properties as a dict | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | to_dict | JeffreyDin/huaweicloud-sdk-python-v3 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | to_str | JeffreyDin/huaweicloud-sdk-python-v3 | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __repr__ | JeffreyDin/huaweicloud-sdk-python-v3 | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, SetBackupPolicyRequestBody)):
return False
return (self.__dict__ == other.__dict__) | -4,800,433,257,394,585,000 | Returns true if both objects are equal | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __eq__ | JeffreyDin/huaweicloud-sdk-python-v3 | python | def __eq__(self, other):
if (not isinstance(other, SetBackupPolicyRequestBody)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | huaweicloud-sdk-dds/huaweicloudsdkdds/v3/model/set_backup_policy_request_body.py | __ne__ | JeffreyDin/huaweicloud-sdk-python-v3 | python | def __ne__(self, other):
return (not (self == other)) |
def sinkhorn(a, b, C, reg=0.1, method='sinkhorn', maxIter=1000, tau=1000.0, stopThr=1e-09, verbose=True, log=True, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
"\n Solve the entropic regularization optimal transport\n The input should be PyTorch tensors\n The function solves the following opti... | -8,494,778,803,771,725,000 | Solve the entropic regularization optimal transport
The input should be PyTorch tensors
The function solves the following optimization problem:
.. math::
\gamma = arg\min_\gamma <\gamma,C>_F + reg\cdot\Omega(\gamma)
s.t. \gamma 1 = a
\gamma^T 1= b
\gamma\geq 0
where :
- C is the (ns,nt) metri... | losses/bregman_pytorch.py | sinkhorn | SelmanOzleyen/DRDM-Count | python | def sinkhorn(a, b, C, reg=0.1, method='sinkhorn', maxIter=1000, tau=1000.0, stopThr=1e-09, verbose=True, log=True, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
"\n Solve the entropic regularization optimal transport\n The input should be PyTorch tensors\n The function solves the following opti... |
def sinkhorn_knopp(a, b, C, reg=0.1, maxIter=1000, stopThr=1e-09, verbose=True, log=True, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization optimal transport\n The input should be PyTorch tensors\n The function solves the following optimization problem:\n\n ... | -2,522,005,486,510,639,600 | Solve the entropic regularization optimal transport
The input should be PyTorch tensors
The function solves the following optimization problem:
.. math::
\gamma = arg\min_\gamma <\gamma,C>_F + reg\cdot\Omega(\gamma)
s.t. \gamma 1 = a
\gamma^T 1= b
\gamma\geq 0
where :
- C is the (ns,nt) metri... | losses/bregman_pytorch.py | sinkhorn_knopp | SelmanOzleyen/DRDM-Count | python | def sinkhorn_knopp(a, b, C, reg=0.1, maxIter=1000, stopThr=1e-09, verbose=True, log=True, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization optimal transport\n The input should be PyTorch tensors\n The function solves the following optimization problem:\n\n ... |
def sinkhorn_stabilized(a, b, C, reg=0.1, maxIter=1000, tau=1000.0, stopThr=1e-09, verbose=False, log=False, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization OT problem with log stabilization\n The function solves the following optimization problem:\n\n .. mat... | 664,508,433,491,841,800 | Solve the entropic regularization OT problem with log stabilization
The function solves the following optimization problem:
.. math::
\gamma = arg\min_\gamma <\gamma,C>_F + reg\cdot\Omega(\gamma)
s.t. \gamma 1 = a
\gamma^T 1= b
\gamma\geq 0
where :
- C is the (ns,nt) metric cost matrix
- :mat... | losses/bregman_pytorch.py | sinkhorn_stabilized | SelmanOzleyen/DRDM-Count | python | def sinkhorn_stabilized(a, b, C, reg=0.1, maxIter=1000, tau=1000.0, stopThr=1e-09, verbose=False, log=False, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization OT problem with log stabilization\n The function solves the following optimization problem:\n\n .. mat... |
def sinkhorn_epsilon_scaling(a, b, C, reg=0.1, maxIter=100, maxInnerIter=100, tau=1000.0, scaling_base=0.75, scaling_coef=None, stopThr=1e-09, verbose=False, log=False, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization OT problem with log stabilization\n The funct... | 3,222,460,278,742,383,600 | Solve the entropic regularization OT problem with log stabilization
The function solves the following optimization problem:
.. math::
\gamma = arg\min_\gamma <\gamma,C>_F + reg\cdot\Omega(\gamma)
s.t. \gamma 1 = a
\gamma^T 1= b
\gamma\geq 0
where :
- C is the (ns,nt) metric cost matrix
- :mat... | losses/bregman_pytorch.py | sinkhorn_epsilon_scaling | SelmanOzleyen/DRDM-Count | python | def sinkhorn_epsilon_scaling(a, b, C, reg=0.1, maxIter=100, maxInnerIter=100, tau=1000.0, scaling_base=0.75, scaling_coef=None, stopThr=1e-09, verbose=False, log=False, warm_start=None, eval_freq=10, print_freq=200, **kwargs):
'\n Solve the entropic regularization OT problem with log stabilization\n The funct... |
def update_K(alpha, beta):
'log space computation'
'memory efficient'
torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=K)
torch.add(K, (- C), out=K)
torch.div(K, reg, out=K)
torch.exp(K, out=K) | 7,934,780,117,655,571,000 | log space computation | losses/bregman_pytorch.py | update_K | SelmanOzleyen/DRDM-Count | python | def update_K(alpha, beta):
'memory efficient'
torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=K)
torch.add(K, (- C), out=K)
torch.div(K, reg, out=K)
torch.exp(K, out=K) |
def update_P(alpha, beta, u, v, ab_updated=False):
'log space P (gamma) computation'
torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=P)
torch.add(P, (- C), out=P)
torch.div(P, reg, out=P)
if (not ab_updated):
torch.add(P, torch.log((u + M_EPS)).reshape((- 1), 1), out=P)
... | 6,091,197,225,457,190,000 | log space P (gamma) computation | losses/bregman_pytorch.py | update_P | SelmanOzleyen/DRDM-Count | python | def update_P(alpha, beta, u, v, ab_updated=False):
torch.add(alpha.reshape((- 1), 1), beta.reshape(1, (- 1)), out=P)
torch.add(P, (- C), out=P)
torch.div(P, reg, out=P)
if (not ab_updated):
torch.add(P, torch.log((u + M_EPS)).reshape((- 1), 1), out=P)
torch.add(P, torch.log((v + M_E... |
def bubblesort(nums: List[int]):
' sort list '
for i in range(0, len(nums)):
for j in range(0, ((len(nums) - i) - 1)):
if (nums[j] > nums[(j + 1)]):
tmp = nums[j]
nums[j] = nums[(j + 1)]
nums[(j + 1)] = tmp
return nums | -7,130,790,351,319,383,000 | sort list | bubblesort/bubblesort_logic.py | bubblesort | vscode-debug-specs/python | python | def bubblesort(nums: List[int]):
' '
for i in range(0, len(nums)):
for j in range(0, ((len(nums) - i) - 1)):
if (nums[j] > nums[(j + 1)]):
tmp = nums[j]
nums[j] = nums[(j + 1)]
nums[(j + 1)] = tmp
return nums |
def make_sqlx(conn, schema, tables):
'Make sqlx lookup function for given tables'
table_func_map = {}
for table in tables:
ntRec = namedtuple(table, tables[table].columns.keys())
table_func_map[table] = SqlX(conn, table, schema, ntRec)
def sqlx(expr) -> SqlX:
obj = jmespath.sear... | 8,371,756,681,237,449,000 | Make sqlx lookup function for given tables | xutil/database/base.py | make_sqlx | flarco/n1slutil | python | def make_sqlx(conn, schema, tables):
table_func_map = {}
for table in tables:
ntRec = namedtuple(table, tables[table].columns.keys())
table_func_map[table] = SqlX(conn, table, schema, ntRec)
def sqlx(expr) -> SqlX:
obj = jmespath.search(expr, table_func_map)
if (not obj... |
def get_sql_sources(sql_text, echo=False):
'Obtain the source tables of a query\n '
import sqlparse
sql_text = re.sub('as\\(', 'as (', sql_text, 0, (re.MULTILINE | re.IGNORECASE))
statements = sqlparse.parse(sql_text)
cte_aliases = set()
sql_sources = {}
def get_sources(statement):
... | 3,964,499,382,857,007,600 | Obtain the source tables of a query | xutil/database/base.py | get_sql_sources | flarco/n1slutil | python | def get_sql_sources(sql_text, echo=False):
'\n '
import sqlparse
sql_text = re.sub('as\\(', 'as (', sql_text, 0, (re.MULTILINE | re.IGNORECASE))
statements = sqlparse.parse(sql_text)
cte_aliases = set()
sql_sources = {}
def get_sources(statement):
sources_dict = {}
last_kw_... |
def __init__(self, conn_dict, profile=None, echo=False):
'Inititate connection'
self._cred = struct(conn_dict)
self._cred.kwargs = conn_dict.get('kwargs', {})
self.name = self._cred.get('name', None)
self.username = self._cred.get('username', None)
self.type = self._cred.type
self.engine = N... | -3,225,673,821,873,554,000 | Inititate connection | xutil/database/base.py | __init__ | flarco/n1slutil | python | def __init__(self, conn_dict, profile=None, echo=False):
self._cred = struct(conn_dict)
self._cred.kwargs = conn_dict.get('kwargs', {})
self.name = self._cred.get('name', None)
self.username = self._cred.get('username', None)
self.type = self._cred.type
self.engine = None
self._cursor_d... |
def connect(self):
'Connect to Database'
self.engine = self.get_engine()
self.connection = self.engine.connect() | -1,046,290,792,239,417,200 | Connect to Database | xutil/database/base.py | connect | flarco/n1slutil | python | def connect(self):
self.engine = self.get_engine()
self.connection = self.engine.connect() |
def close(self):
'Close database connection'
self.conn.connection.close() | -5,488,695,872,408,102,000 | Close database connection | xutil/database/base.py | close | flarco/n1slutil | python | def close(self):
self.conn.connection.close() |
def reconnect(self, min_tresh=0):
'Re-Connect to Database if minute threshold reached'
if ((now() - self.last_connect).total_seconds() > (min_tresh * 60)):
log('Reconnecting to {}...'.format(self.name))
self.connect()
self.last_connect = now() | -6,871,993,079,269,828,000 | Re-Connect to Database if minute threshold reached | xutil/database/base.py | reconnect | flarco/n1slutil | python | def reconnect(self, min_tresh=0):
if ((now() - self.last_connect).total_seconds() > (min_tresh * 60)):
log('Reconnecting to {}...'.format(self.name))
self.connect()
self.last_connect = now() |
def set_variables(self):
'Set custom variables'
raise Exception("Method 'set_variables' is not implemented!") | 2,225,049,539,593,413,400 | Set custom variables | xutil/database/base.py | set_variables | flarco/n1slutil | python | def set_variables(self):
raise Exception("Method 'set_variables' is not implemented!") |
def get_dialect(self, echo=False):
'SQLAlchemy dialect'
raise Exception("Method 'get_dialect' is not implemented!") | -1,235,546,418,178,482,200 | SQLAlchemy dialect | xutil/database/base.py | get_dialect | flarco/n1slutil | python | def get_dialect(self, echo=False):
raise Exception("Method 'get_dialect' is not implemented!") |
def check_pk(self, table, fields):
'Check Primary key to ensure there are not duplicates'
if ('where' in fields.lower()):
(fields, where_clause) = fields.lower().split('where')
where_clause = ('where ' + where_clause)
else:
where_clause = ''
sql = "\n select\n '{table}' a... | -4,513,796,390,382,553,000 | Check Primary key to ensure there are not duplicates | xutil/database/base.py | check_pk | flarco/n1slutil | python | def check_pk(self, table, fields):
if ('where' in fields.lower()):
(fields, where_clause) = fields.lower().split('where')
where_clause = ('where ' + where_clause)
else:
where_clause =
sql = "\n select\n '{table}' as table,\n case when count(1) = count({fields}) the... |
def execute_multi(self, sql, dtype='namedtuple', limit=None, echo=True, query_name='Record', log=log):
"\n Execute multiple SQL statements separtated by ';'. Returns a generator.\n Example:\n for fields, rows in conn.execute(sql):\n print(fields)\n print(len(rows))\n "
self.reconnect... | -3,723,596,037,332,706,300 | Execute multiple SQL statements separtated by ';'. Returns a generator.
Example:
for fields, rows in conn.execute(sql):
print(fields)
print(len(rows)) | xutil/database/base.py | execute_multi | flarco/n1slutil | python | def execute_multi(self, sql, dtype='namedtuple', limit=None, echo=True, query_name='Record', log=log):
"\n Execute multiple SQL statements separtated by ';'. Returns a generator.\n Example:\n for fields, rows in conn.execute(sql):\n print(fields)\n print(len(rows))\n "
self.reconnect... |
def execute(self, sql, dtype='tuple', limit=None, echo=True, query_name='Record', log=log):
'Execute SQL, return last result'
self.reconnect(min_tresh=10)
data = None
fields = None
rows = []
message_mapping = {'drop ': 'Dropping {}.', 'truncate ': 'Truncating {}.', 'select ': 'Selecting {}.', 'c... | -6,452,716,125,294,067,000 | Execute SQL, return last result | xutil/database/base.py | execute | flarco/n1slutil | python | def execute(self, sql, dtype='tuple', limit=None, echo=True, query_name='Record', log=log):
self.reconnect(min_tresh=10)
data = None
fields = None
rows = []
message_mapping = {'drop ': 'Dropping {}.', 'truncate ': 'Truncating {}.', 'select ': 'Selecting {}.', 'create ': 'Creating {}.', 'insert ... |
def insert(self, table, data, echo=False):
'Insert records of namedtuple or dicts'
raise Exception('insert not implemented') | -4,606,335,496,427,840,000 | Insert records of namedtuple or dicts | xutil/database/base.py | insert | flarco/n1slutil | python | def insert(self, table, data, echo=False):
raise Exception('insert not implemented') |
def drop_table(self, table, log=log):
'Drop table'
try:
sql = self._template('core.drop_table').format(table)
self._do_execute(sql)
except Exception as E:
message = get_exception_message().lower()
if (self._template('error_filter.table_not_exist') in message):
if ... | 315,493,088,537,622,700 | Drop table | xutil/database/base.py | drop_table | flarco/n1slutil | python | def drop_table(self, table, log=log):
try:
sql = self._template('core.drop_table').format(table)
self._do_execute(sql)
except Exception as E:
message = get_exception_message().lower()
if (self._template('error_filter.table_not_exist') in message):
if self.echo:
... |
def create_table(self, table, field_types, drop=False, log=log):
'Create table'
if drop:
self.drop_table(table, log=log)
new_ftypes = OrderedDict()
for f in field_types:
(ftype, max_len, dec_len) = field_types[f]
if dec_len:
suff = '({},{})'.format(max_len, dec_len)
... | -7,000,479,734,006,737,000 | Create table | xutil/database/base.py | create_table | flarco/n1slutil | python | def create_table(self, table, field_types, drop=False, log=log):
if drop:
self.drop_table(table, log=log)
new_ftypes = OrderedDict()
for f in field_types:
(ftype, max_len, dec_len) = field_types[f]
if dec_len:
suff = '({},{})'.format(max_len, dec_len)
elif ma... |
def _get_cursor_fields(self, as_dict=False, native_type=True, cursor_desc=None):
'Get fields of active Select cursor'
fields = OrderedDict()
cursor_desc = (cursor_desc if cursor_desc else self._cursor_description)
if (cursor_desc == None):
return []
for f in cursor_desc:
f_name = f[0... | 1,978,626,377,709,983,000 | Get fields of active Select cursor | xutil/database/base.py | _get_cursor_fields | flarco/n1slutil | python | def _get_cursor_fields(self, as_dict=False, native_type=True, cursor_desc=None):
fields = OrderedDict()
cursor_desc = (cursor_desc if cursor_desc else self._cursor_description)
if (cursor_desc == None):
return []
for f in cursor_desc:
f_name = f[0].lower()
if as_dict:
... |
def stream(self, sql, rec_name='Record', dtype='namedtuple', yield_chuncks=False, chunk_size=None, limit=None, echo=True):
'Stream Select from SQL, yield records as they come in'
self.reconnect(min_tresh=10)
if echo:
log("Streaming SQL for '{}'.".format(rec_name))
fetch_size = (limit if limit el... | -7,889,304,083,964,760,000 | Stream Select from SQL, yield records as they come in | xutil/database/base.py | stream | flarco/n1slutil | python | def stream(self, sql, rec_name='Record', dtype='namedtuple', yield_chuncks=False, chunk_size=None, limit=None, echo=True):
self.reconnect(min_tresh=10)
if echo:
log("Streaming SQL for '{}'.".format(rec_name))
fetch_size = (limit if limit else self.fetch_size)
fetch_size = (chunk_size if chu... |
def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
'Select from SQL, return list of namedtuples'
self.reconnect(min_tresh=10)
s_t = datetime.datetime.now()
_data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
if (not self.resu... | -2,469,832,208,219,459,000 | Select from SQL, return list of namedtuples | xutil/database/base.py | query | flarco/n1slutil | python | def query(self, sql, rec_name='Record', dtype='namedtuple', limit=None, echo=True, retrying=False, log=log):
self.reconnect(min_tresh=10)
s_t = datetime.datetime.now()
_data = list(self.stream(sql, dtype=dtype, echo=False, limit=limit))
if (not self.result.closed):
self.result.close()
f... |
def get_schemas(self, echo=True):
'Get list of schemas.'
Rec = namedtuple('Schemas', 'schema')
self._fields = Rec._fields
sql_tmpl = self._template('metadata.schemas')
if sql_tmpl:
schemas = [r[0] for r in self.query(sql_tmpl)]
else:
self.get_engine(echo=echo)
schemas = s... | -6,565,010,715,667,272,000 | Get list of schemas. | xutil/database/base.py | get_schemas | flarco/n1slutil | python | def get_schemas(self, echo=True):
Rec = namedtuple('Schemas', 'schema')
self._fields = Rec._fields
sql_tmpl = self._template('metadata.schemas')
if sql_tmpl:
schemas = [r[0] for r in self.query(sql_tmpl)]
else:
self.get_engine(echo=echo)
schemas = self.engine_inspect.get... |
def get_objects(self, schema, object_type='all', echo=True):
"Get metadata for objects. object_type in 'all', 'table', 'view'"
Rec = namedtuple('Table', 'schema object_name object_type')
self._fields = Rec._fields
def get_rec(object_name, object_type):
r_dict = dict(schema=schema, object_name=o... | 6,508,891,224,793,525,000 | Get metadata for objects. object_type in 'all', 'table', 'view' | xutil/database/base.py | get_objects | flarco/n1slutil | python | def get_objects(self, schema, object_type='all', echo=True):
Rec = namedtuple('Table', 'schema object_name object_type')
self._fields = Rec._fields
def get_rec(object_name, object_type):
r_dict = dict(schema=schema, object_name=object_name, object_type=object_type)
return Rec(**r_dict)... |
def get_tables(self, schema, echo=True):
'Get metadata for tables.'
schemas = (schema if isinstance(schema, list) else [schema])
def get_tables_for(schema):
def get_rec(table):
self._fields = ['schema', 'table']
return tuple([schema, table])
Rec = namedtuple('Ta... | 4,581,136,877,876,844,500 | Get metadata for tables. | xutil/database/base.py | get_tables | flarco/n1slutil | python | def get_tables(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_tables_for(schema):
def get_rec(table):
self._fields = ['schema', 'table']
return tuple([schema, table])
Rec = namedtuple('Table', 'schema table')
... |
def get_views(self, schema, echo=True):
'Get metadata for views.'
schemas = (schema if isinstance(schema, list) else [schema])
def get_views_for(schema):
def get_rec(view):
self._fields = ['schema', 'view']
return tuple([schema, view])
Rec = namedtuple('View', '... | -4,287,179,280,659,660,300 | Get metadata for views. | xutil/database/base.py | get_views | flarco/n1slutil | python | def get_views(self, schema, echo=True):
schemas = (schema if isinstance(schema, list) else [schema])
def get_views_for(schema):
def get_rec(view):
self._fields = ['schema', 'view']
return tuple([schema, view])
Rec = namedtuple('View', 'schema view')
... |
def get_columns(self, table_name, object_type=None, echo=False, include_schema_table=True, native_type=True):
'Get column metadata for table'
if include_schema_table:
headers = 'schema table id column_name type nullable default autoincrement'
else:
headers = 'id column_name type nullable de... | 8,247,970,183,440,504,000 | Get column metadata for table | xutil/database/base.py | get_columns | flarco/n1slutil | python | def get_columns(self, table_name, object_type=None, echo=False, include_schema_table=True, native_type=True):
if include_schema_table:
headers = 'schema table id column_name type nullable default autoincrement'
else:
headers = 'id column_name type nullable default autoincrement'
Rec = ... |
def get_primary_keys(self, table_name, echo=False):
'Get PK metadata for table'
Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(col, pk_name, column_order):
r_dict = {}
... | 2,235,318,896,555,382,800 | Get PK metadata for table | xutil/database/base.py | get_primary_keys | flarco/n1slutil | python | def get_primary_keys(self, table_name, echo=False):
Rec = namedtuple('PKs', 'schema table pk_name column_name column_order')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(col, pk_name, column_order):
r_dict = {}
r_dict['schema'] = sch... |
def get_indexes(self, table_name, echo=False):
'Get indexes metadata for table'
Rec = namedtuple('Indexes', 'schema table index_name column_name column_order unique')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(r_dict):
r_dict['schema'] = sc... | -815,508,692,130,674,400 | Get indexes metadata for table | xutil/database/base.py | get_indexes | flarco/n1slutil | python | def get_indexes(self, table_name, echo=False):
Rec = namedtuple('Indexes', 'schema table index_name column_name column_order unique')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
def get_rec(r_dict):
r_dict['schema'] = schema
r_dict['table'] = t... |
def get_ddl(self, table_name, object_type=None, echo=True):
'Get ddl for table'
Rec = namedtuple('DDL', 'ddl')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
sql_tmpl = self._template('metadata.ddl')
if sql_tmpl:
rows = self.query(sql_tmpl.format(schema... | 7,846,279,401,217,097,000 | Get ddl for table | xutil/database/base.py | get_ddl | flarco/n1slutil | python | def get_ddl(self, table_name, object_type=None, echo=True):
Rec = namedtuple('DDL', 'ddl')
self._fields = Rec._fields
(schema, table) = self._split_schema_table(table_name)
sql_tmpl = self._template('metadata.ddl')
if sql_tmpl:
rows = self.query(sql_tmpl.format(schema=schema, table=tabl... |
def get_all_columns(self):
'Get all columns for all tables / views'
sql_tmpl = self._template('metadata.all_columns')
if (not sql_tmpl):
raise Exception('get_all_columns not implemented for {}'.format(self.type))
rows = self.query(sql_tmpl)
return rows | -4,695,411,077,918,565,000 | Get all columns for all tables / views | xutil/database/base.py | get_all_columns | flarco/n1slutil | python | def get_all_columns(self):
sql_tmpl = self._template('metadata.all_columns')
if (not sql_tmpl):
raise Exception('get_all_columns not implemented for {}'.format(self.type))
rows = self.query(sql_tmpl)
return rows |
def get_all_tables(self, filter, as_sql=False):
'Get all tables / views'
sql_tmpl = self._template('metadata.all_tables')
if (not sql_tmpl):
raise Exception('get_all_tables not implemented for {}'.format(self.type))
sql = sql_tmpl.format(filter=filter)
return (sql if as_sql else self.query(s... | -5,292,261,201,790,711,000 | Get all tables / views | xutil/database/base.py | get_all_tables | flarco/n1slutil | python | def get_all_tables(self, filter, as_sql=False):
sql_tmpl = self._template('metadata.all_tables')
if (not sql_tmpl):
raise Exception('get_all_tables not implemented for {}'.format(self.type))
sql = sql_tmpl.format(filter=filter)
return (sql if as_sql else self.query(sql, echo=False)) |
def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
'Base function for field level analysis\n expr_func_map: contains mapping for expression to SQL function to all fields\n '
if ('.' not in table_name):
raise Exception("table_name must... | 8,955,735,028,112,068,000 | Base function for field level analysis
expr_func_map: contains mapping for expression to SQL function to all fields | xutil/database/base.py | analyze_fields | flarco/n1slutil | python | def analyze_fields(self, analysis, table_name, fields=[], as_sql=False, union=True, expr_func_map={}, **kwargs):
'Base function for field level analysis\n expr_func_map: contains mapping for expression to SQL function to all fields\n '
if ('.' not in table_name):
raise Exception("table_name must... |
def analyze_tables(self, analysis, tables=[], as_sql=False, **kwargs):
'Base function for table level analysis'
if (analysis not in self.template_dict['analysis']):
raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
if ((not tables) and ('schema' in kwargs)):
... | 4,400,742,215,244,150,000 | Base function for table level analysis | xutil/database/base.py | analyze_tables | flarco/n1slutil | python | def analyze_tables(self, analysis, tables=[], as_sql=False, **kwargs):
if (analysis not in self.template_dict['analysis']):
raise Exception("'{}' not found in template for '{}'.".format(analysis, self.type))
if ((not tables) and ('schema' in kwargs)):
rows = self.get_schemas(kwargs['schema'... |
def begin_delete(self, resource_group_name, route_table_name, route_name, **kwargs):
'Deletes the specified route from a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n ... | 2,944,561,345,238,298,600 | Deletes the specified route from a route table.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param route_table_name: The name of the route table.
:type route_table_name: str
:param route_name: The name of the route.
:type route_name: str
:keyword callable cls: A custom ty... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_routes_operations.py | begin_delete | 4thel00z/microsoft-crap-that-doesnt-work | python | def begin_delete(self, resource_group_name, route_table_name, route_name, **kwargs):
'Deletes the specified route from a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n ... |
def get(self, resource_group_name, route_table_name, route_name, **kwargs):
'Gets the specified route from a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n :type route... | -1,434,715,254,335,339,000 | Gets the specified route from a route table.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param route_table_name: The name of the route table.
:type route_table_name: str
:param route_name: The name of the route.
:type route_name: str
:keyword callable cls: A custom type ... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_routes_operations.py | get | 4thel00z/microsoft-crap-that-doesnt-work | python | def get(self, resource_group_name, route_table_name, route_name, **kwargs):
'Gets the specified route from a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n :type route... |
def begin_create_or_update(self, resource_group_name, route_table_name, route_name, route_parameters, **kwargs):
'Creates or updates a route in the specified route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: ... | -6,914,312,637,091,370,000 | Creates or updates a route in the specified route table.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param route_table_name: The name of the route table.
:type route_table_name: str
:param route_name: The name of the route.
:type route_name: str
:param route_parameters: ... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_routes_operations.py | begin_create_or_update | 4thel00z/microsoft-crap-that-doesnt-work | python | def begin_create_or_update(self, resource_group_name, route_table_name, route_name, route_parameters, **kwargs):
'Creates or updates a route in the specified route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: ... |
def list(self, resource_group_name, route_table_name, **kwargs):
'Gets all routes in a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n :type route_table_name: str\n ... | 621,652,106,427,642,600 | Gets all routes in a route table.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param route_table_name: The name of the route table.
:type route_table_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator li... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_routes_operations.py | list | 4thel00z/microsoft-crap-that-doesnt-work | python | def list(self, resource_group_name, route_table_name, **kwargs):
'Gets all routes in a route table.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param route_table_name: The name of the route table.\n :type route_table_name: str\n ... |
def describe(self, onlyActive=True):
'Return a description of the current state of all active light sources.\n\n If onlyActive is False, then information for all sources will be returned, whether or not they are active.\n '
if onlyActive:
return OrderedDict([(n, s) for (n, s) in self._sour... | -3,250,613,416,447,644,700 | Return a description of the current state of all active light sources.
If onlyActive is False, then information for all sources will be returned, whether or not they are active. | acq4/devices/LightSource/LightSource.py | describe | RonnyBergmann/acq4 | python | def describe(self, onlyActive=True):
'Return a description of the current state of all active light sources.\n\n If onlyActive is False, then information for all sources will be returned, whether or not they are active.\n '
if onlyActive:
return OrderedDict([(n, s) for (n, s) in self._sour... |
def activeSources(self):
'Return the names of all active light sources.\n '
return [s['name'] for s in self._sources if s['active']] | -5,335,197,598,235,236,000 | Return the names of all active light sources. | acq4/devices/LightSource/LightSource.py | activeSources | RonnyBergmann/acq4 | python | def activeSources(self):
'\n '
return [s['name'] for s in self._sources if s['active']] |
def sourceActive(self, name):
'Return True if the named light source is currently active.\n '
return self._sources[name]['active'] | -8,691,415,396,041,450,000 | Return True if the named light source is currently active. | acq4/devices/LightSource/LightSource.py | sourceActive | RonnyBergmann/acq4 | python | def sourceActive(self, name):
'\n '
return self._sources[name]['active'] |
def setSourceActive(self, name, active):
'Activate / deactivate a light source.\n '
raise NotImplementedError() | -3,596,929,846,804,946,000 | Activate / deactivate a light source. | acq4/devices/LightSource/LightSource.py | setSourceActive | RonnyBergmann/acq4 | python | def setSourceActive(self, name, active):
'\n '
raise NotImplementedError() |
@staticmethod
async def create(coin_store: CoinStore, block_store: BlockStore, consensus_constants: ConsensusConstants, hint_store: HintStore):
'\n Initializes a blockchain with the BlockRecords from disk, assuming they have all been\n validated. Uses the genesis block given in override_constants, or ... | -5,395,361,207,020,217,000 | Initializes a blockchain with the BlockRecords from disk, assuming they have all been
validated. Uses the genesis block given in override_constants, or as a fallback,
in the consensus constants config. | kujenga/consensus/blockchain.py | create | Kujenga-Network/kujenga-blockchain | python | @staticmethod
async def create(coin_store: CoinStore, block_store: BlockStore, consensus_constants: ConsensusConstants, hint_store: HintStore):
'\n Initializes a blockchain with the BlockRecords from disk, assuming they have all been\n validated. Uses the genesis block given in override_constants, or ... |
async def _load_chain_from_store(self) -> None:
'\n Initializes the state of the Blockchain class from the database.\n '
(height_to_hash, sub_epoch_summaries) = (await self.block_store.get_peak_height_dicts())
self.__height_to_hash = height_to_hash
self.__sub_epoch_summaries = sub_epoch_su... | -4,490,703,506,348,418,000 | Initializes the state of the Blockchain class from the database. | kujenga/consensus/blockchain.py | _load_chain_from_store | Kujenga-Network/kujenga-blockchain | python | async def _load_chain_from_store(self) -> None:
'\n \n '
(height_to_hash, sub_epoch_summaries) = (await self.block_store.get_peak_height_dicts())
self.__height_to_hash = height_to_hash
self.__sub_epoch_summaries = sub_epoch_summaries
self.__block_records = {}
self.__heights_in_cach... |
def get_peak(self) -> Optional[BlockRecord]:
'\n Return the peak of the blockchain\n '
if (self._peak_height is None):
return None
return self.height_to_block_record(self._peak_height) | 8,711,432,366,473,672,000 | Return the peak of the blockchain | kujenga/consensus/blockchain.py | get_peak | Kujenga-Network/kujenga-blockchain | python | def get_peak(self) -> Optional[BlockRecord]:
'\n \n '
if (self._peak_height is None):
return None
return self.height_to_block_record(self._peak_height) |
async def receive_block(self, block: FullBlock, pre_validation_result: Optional[PreValidationResult]=None, fork_point_with_peak: Optional[uint32]=None) -> Tuple[(ReceiveBlockResult, Optional[Err], Optional[uint32], Tuple[(List[CoinRecord], Dict[(bytes, Dict[(bytes32, CoinRecord)])])])]:
"\n This method must ... | 5,664,638,515,299,313,000 | This method must be called under the blockchain lock
Adds a new block into the blockchain, if it's valid and connected to the current
blockchain, regardless of whether it is the child of a head, or another block.
Returns a header if block is added to head. Returns an error if the block is
invalid. Also returns the fork... | kujenga/consensus/blockchain.py | receive_block | Kujenga-Network/kujenga-blockchain | python | async def receive_block(self, block: FullBlock, pre_validation_result: Optional[PreValidationResult]=None, fork_point_with_peak: Optional[uint32]=None) -> Tuple[(ReceiveBlockResult, Optional[Err], Optional[uint32], Tuple[(List[CoinRecord], Dict[(bytes, Dict[(bytes32, CoinRecord)])])])]:
"\n This method must ... |
async def _reconsider_peak(self, block_record: BlockRecord, genesis: bool, fork_point_with_peak: Optional[uint32], npc_result: Optional[NPCResult]) -> Tuple[(Optional[uint32], Optional[uint32], List[BlockRecord], Tuple[(List[CoinRecord], Dict[(bytes, Dict[(bytes32, CoinRecord)])])])]:
'\n When a new block is... | 1,807,132,108,882,397,400 | When a new block is added, this is called, to check if the new block is the new peak of the chain.
This also handles reorgs by reverting blocks which are not in the heaviest chain.
It returns the height of the fork between the previous chain and the new chain, or returns
None if there was no update to the heaviest chai... | kujenga/consensus/blockchain.py | _reconsider_peak | Kujenga-Network/kujenga-blockchain | python | async def _reconsider_peak(self, block_record: BlockRecord, genesis: bool, fork_point_with_peak: Optional[uint32], npc_result: Optional[NPCResult]) -> Tuple[(Optional[uint32], Optional[uint32], List[BlockRecord], Tuple[(List[CoinRecord], Dict[(bytes, Dict[(bytes32, CoinRecord)])])])]:
'\n When a new block is... |
def contains_block(self, header_hash: bytes32) -> bool:
'\n True if we have already added this block to the chain. This may return false for orphan blocks\n that we have added but no longer keep in memory.\n '
return (header_hash in self.__block_records) | -9,152,929,373,722,569,000 | True if we have already added this block to the chain. This may return false for orphan blocks
that we have added but no longer keep in memory. | kujenga/consensus/blockchain.py | contains_block | Kujenga-Network/kujenga-blockchain | python | def contains_block(self, header_hash: bytes32) -> bool:
'\n True if we have already added this block to the chain. This may return false for orphan blocks\n that we have added but no longer keep in memory.\n '
return (header_hash in self.__block_records) |
async def warmup(self, fork_point: uint32):
'\n Loads blocks into the cache. The blocks loaded include all blocks from\n fork point - BLOCKS_CACHE_SIZE up to and including the fork_point.\n\n Args:\n fork_point: the last block height to load in the cache\n\n '
if (self._pe... | 6,246,685,826,707,292,000 | Loads blocks into the cache. The blocks loaded include all blocks from
fork point - BLOCKS_CACHE_SIZE up to and including the fork_point.
Args:
fork_point: the last block height to load in the cache | kujenga/consensus/blockchain.py | warmup | Kujenga-Network/kujenga-blockchain | python | async def warmup(self, fork_point: uint32):
'\n Loads blocks into the cache. The blocks loaded include all blocks from\n fork point - BLOCKS_CACHE_SIZE up to and including the fork_point.\n\n Args:\n fork_point: the last block height to load in the cache\n\n '
if (self._pe... |
def clean_block_record(self, height: int):
'\n Clears all block records in the cache which have block_record < height.\n Args:\n height: Minimum height that we need to keep in the cache\n '
if (height < 0):
return None
blocks_to_remove = self.__heights_in_cache.get(ui... | 8,406,551,519,050,297,000 | Clears all block records in the cache which have block_record < height.
Args:
height: Minimum height that we need to keep in the cache | kujenga/consensus/blockchain.py | clean_block_record | Kujenga-Network/kujenga-blockchain | python | def clean_block_record(self, height: int):
'\n Clears all block records in the cache which have block_record < height.\n Args:\n height: Minimum height that we need to keep in the cache\n '
if (height < 0):
return None
blocks_to_remove = self.__heights_in_cache.get(ui... |
def clean_block_records(self):
'\n Cleans the cache so that we only maintain relevant blocks. This removes\n block records that have height < peak - BLOCKS_CACHE_SIZE.\n These blocks are necessary for calculating future difficulty adjustments.\n '
if (len(self.__block_records) < self... | 4,200,059,749,752,214,500 | Cleans the cache so that we only maintain relevant blocks. This removes
block records that have height < peak - BLOCKS_CACHE_SIZE.
These blocks are necessary for calculating future difficulty adjustments. | kujenga/consensus/blockchain.py | clean_block_records | Kujenga-Network/kujenga-blockchain | python | def clean_block_records(self):
'\n Cleans the cache so that we only maintain relevant blocks. This removes\n block records that have height < peak - BLOCKS_CACHE_SIZE.\n These blocks are necessary for calculating future difficulty adjustments.\n '
if (len(self.__block_records) < self... |
async def get_block_records_at(self, heights: List[uint32], batch_size=900) -> List[BlockRecord]:
'\n gets block records by height (only blocks that are part of the chain)\n '
records: List[BlockRecord] = []
hashes = []
assert (batch_size < 999)
for height in heights:
hashes.ap... | 2,921,475,375,414,308,000 | gets block records by height (only blocks that are part of the chain) | kujenga/consensus/blockchain.py | get_block_records_at | Kujenga-Network/kujenga-blockchain | python | async def get_block_records_at(self, heights: List[uint32], batch_size=900) -> List[BlockRecord]:
'\n \n '
records: List[BlockRecord] = []
hashes = []
assert (batch_size < 999)
for height in heights:
hashes.append(self.height_to_hash(height))
if (len(hashes) > batch_siz... |
def add_block_record(self, block_record: BlockRecord):
'\n Adds a block record to the cache.\n '
self.__block_records[block_record.header_hash] = block_record
if (block_record.height not in self.__heights_in_cache.keys()):
self.__heights_in_cache[block_record.height] = set()
self._... | 1,117,064,767,505,630,700 | Adds a block record to the cache. | kujenga/consensus/blockchain.py | add_block_record | Kujenga-Network/kujenga-blockchain | python | def add_block_record(self, block_record: BlockRecord):
'\n \n '
self.__block_records[block_record.header_hash] = block_record
if (block_record.height not in self.__heights_in_cache.keys()):
self.__heights_in_cache[block_record.height] = set()
self.__heights_in_cache[block_record.he... |
def headers(instance):
'\n Returns the first row of the instance.dataset\n\n Returns:\n List\n\n '
return instance.dataset[0] | -5,050,454,796,651,471,000 | Returns the first row of the instance.dataset
Returns:
List | preprocessor/ListData.py | headers | clokman/KFIR | python | def headers(instance):
'\n Returns the first row of the instance.dataset\n\n Returns:\n List\n\n '
return instance.dataset[0] |
def data_rows(instance):
'\n Returns the rows of the instance.dataset except the first rows.\n\n Returns:\n List\n '
return instance.dataset[1:len(instance.dataset)] | -8,125,771,205,555,917,000 | Returns the rows of the instance.dataset except the first rows.
Returns:
List | preprocessor/ListData.py | data_rows | clokman/KFIR | python | def data_rows(instance):
'\n Returns the rows of the instance.dataset except the first rows.\n\n Returns:\n List\n '
return instance.dataset[1:len(instance.dataset)] |
def import_csv_file(instance, input_file_path, column_delimiter_pattern_in_input_file, line_head_pattern_to_remove='', line_tail_pattern_to_remove='', cell_head_and_tail_characters_to_remove=''):
'\n Returns:\n nothing\n\n Examples:\n >>> # Import a CSV file (yasgui.org formattin... | 4,266,730,992,492,970,500 | Returns:
nothing
Examples:
>>> # Import a CSV file (yasgui.org formatting)
>>> my_list_data = ListData()
>>> my_list_data.import_csv_file('test_data//yasgui_output_100.csv',
... column_delimiter_pattern_in_input_file=' , ',
... line_tail... | preprocessor/ListData.py | import_csv_file | clokman/KFIR | python | def import_csv_file(instance, input_file_path, column_delimiter_pattern_in_input_file, line_head_pattern_to_remove=, line_tail_pattern_to_remove=, cell_head_and_tail_characters_to_remove=):
'\n Returns:\n nothing\n\n Examples:\n >>> # Import a CSV file (yasgui.org formatting)\n ... |
def import_json_object(instance, json_object):
"\n Converts a JSON formatted object to a ListData object.\n\n Args:\n json_dictionary(dict): a dictionary that is formatted as JSON\n\n Returns:\n \n Examples:\n >>> my_json_object = {\n ... 1: {'... | -6,396,754,683,567,436,000 | Converts a JSON formatted object to a ListData object.
Args:
json_dictionary(dict): a dictionary that is formatted as JSON
Returns:
Examples:
>>> my_json_object = {
... 1: {'label': 'Example', 'value': 3},
... 2: {'label': 'Test', 'value': 1},
... 3: {'label': 'Tryout'}
... }
>>> prin... | preprocessor/ListData.py | import_json_object | clokman/KFIR | python | def import_json_object(instance, json_object):
"\n Converts a JSON formatted object to a ListData object.\n\n Args:\n json_dictionary(dict): a dictionary that is formatted as JSON\n\n Returns:\n \n Examples:\n >>> my_json_object = {\n ... 1: {'... |
def import_bibliography_object(instance, bibliography_object):
"\n Converts a Bibliography class object to a ListData object.\n\n Returns:\n ListData class object\n\n Examples:\n >>> from triplicator.bibTools import Bibliography\n >>> my_bibliography = Bibliogra... | -4,453,412,358,065,190,000 | Converts a Bibliography class object to a ListData object.
Returns:
ListData class object
Examples:
>>> from triplicator.bibTools import Bibliography
>>> my_bibliography = Bibliography()
>>> my_bibliography.setEntry('01', 'author', 'John Doe')
>>> my_bibliography.setEntry('02', 'author', 'Jane Doe... | preprocessor/ListData.py | import_bibliography_object | clokman/KFIR | python | def import_bibliography_object(instance, bibliography_object):
"\n Converts a Bibliography class object to a ListData object.\n\n Returns:\n ListData class object\n\n Examples:\n >>> from triplicator.bibTools import Bibliography\n >>> my_bibliography = Bibliogra... |
def get_column_at_index(instance, index):
"\n Allows columns to be selected (i.e., returned) by entering their index position.\n \n :return: A list vector that contains values from the queried column\n \n :example:\n >>> my_listdata = ListData()\n >>> my_list... | 7,221,061,146,976,088,000 | Allows columns to be selected (i.e., returned) by entering their index position.
:return: A list vector that contains values from the queried column
:example:
>>> my_listdata = ListData()
>>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]
>>> my_listdata.get_column_at_index... | preprocessor/ListData.py | get_column_at_index | clokman/KFIR | python | def get_column_at_index(instance, index):
"\n Allows columns to be selected (i.e., returned) by entering their index position.\n \n :return: A list vector that contains values from the queried column\n \n :example:\n >>> my_listdata = ListData()\n >>> my_list... |
def get_row_length(instance):
"\n Gets the length of a sample row from the dataset.\n\n Returns:\n Integer\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]\n >>> my_listdata.get_row_... | 5,714,986,125,114,063,000 | Gets the length of a sample row from the dataset.
Returns:
Integer
Examples:
>>> my_listdata = ListData()
>>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]
>>> my_listdata.get_row_length()
2 | preprocessor/ListData.py | get_row_length | clokman/KFIR | python | def get_row_length(instance):
"\n Gets the length of a sample row from the dataset.\n\n Returns:\n Integer\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]\n >>> my_listdata.get_row_... |
def transpose_dataset(instance):
"\n\n >>> my_listdata = ListData()\n >>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]\n >>> my_listdata.transpose_dataset().dataset\n [['name', 'john', 'jane'], ['birth_date', 2084, 2054]]\n >>> my_listdata.transpo... | -2,419,339,717,802,129,400 | >>> my_listdata = ListData()
>>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]
>>> my_listdata.transpose_dataset().dataset
[['name', 'john', 'jane'], ['birth_date', 2084, 2054]]
>>> my_listdata.transpose_dataset().dataset
[['name', 'birth_date'], ['john', 2084], ['jane', 2054]]
>>> my_... | preprocessor/ListData.py | transpose_dataset | clokman/KFIR | python | def transpose_dataset(instance):
"\n\n >>> my_listdata = ListData()\n >>> my_listdata.dataset = [['name', 'birth_date'], ['john', 2084], ['jane', 2054]]\n >>> my_listdata.transpose_dataset().dataset\n [['name', 'john', 'jane'], ['birth_date', 2084, 2054]]\n >>> my_listdata.transpo... |
def merge_all_rows_to_one(instance, value_separator_pattern=' | '):
'\n >>> my_listdata = ListData().append_row([\'john\', 2054]).append_row([\'john\', 3254])\n >>> my_listdata.merge_all_rows_to_one().dataset\n [\'john\', \'2054 | 3254\']\n\n >>> my_listdata = ListData()\n >>> my_... | -8,251,441,568,987,171,000 | >>> my_listdata = ListData().append_row(['john', 2054]).append_row(['john', 3254])
>>> my_listdata.merge_all_rows_to_one().dataset
['john', '2054 | 3254']
>>> my_listdata = ListData()
>>> my_listdata.dataset = [['john', 2054], ['john', 3254], ['john', 2672]]
>>> my_listdata.merge_all_rows_to_one().dataset
['john', '20... | preprocessor/ListData.py | merge_all_rows_to_one | clokman/KFIR | python | def merge_all_rows_to_one(instance, value_separator_pattern=' | '):
'\n >>> my_listdata = ListData().append_row([\'john\', 2054]).append_row([\'john\', 3254])\n >>> my_listdata.merge_all_rows_to_one().dataset\n [\'john\', \'2054 | 3254\']\n\n >>> my_listdata = ListData()\n >>> my_... |
def append_row(instance, new_row):
"\n Appends a row the ListData object's dataset variable.\n\n Returns:\n ListData object (instance)\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.append_row([1,2,3]).dataset\n [[1, 2, 3]]\n\n ... | 9,212,340,499,343,603,000 | Appends a row the ListData object's dataset variable.
Returns:
ListData object (instance)
Examples:
>>> my_listdata = ListData()
>>> my_listdata.append_row([1,2,3]).dataset
[[1, 2, 3]]
>>> my_listdata.dataset
[[1, 2, 3]]
>>> my_listdata.append_row(['a','b','c']).dataset
[[1, 2, 3], ['... | preprocessor/ListData.py | append_row | clokman/KFIR | python | def append_row(instance, new_row):
"\n Appends a row the ListData object's dataset variable.\n\n Returns:\n ListData object (instance)\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.append_row([1,2,3]).dataset\n [[1, 2, 3]]\n\n ... |
def clear_all(instance):
"\n Resets ListData object's dataset variable to its empty state.\n\n Returns:\n ListData object\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.append_row([1,2,3]).dataset\n [[1, 2, 3]]\n >>> my_list... | 4,490,231,985,143,969,300 | Resets ListData object's dataset variable to its empty state.
Returns:
ListData object
Examples:
>>> my_listdata = ListData()
>>> my_listdata.append_row([1,2,3]).dataset
[[1, 2, 3]]
>>> my_listdata.dataset
[[1, 2, 3]]
>>> my_listdata.clear_all().dataset
[]
>>> my_listdata.dataset
... | preprocessor/ListData.py | clear_all | clokman/KFIR | python | def clear_all(instance):
"\n Resets ListData object's dataset variable to its empty state.\n\n Returns:\n ListData object\n\n Examples:\n >>> my_listdata = ListData()\n >>> my_listdata.append_row([1,2,3]).dataset\n [[1, 2, 3]]\n >>> my_list... |
def append_column(instance, new_column_values, new_column_name):
'\n\n :param new_column_values:\n :param new_column_name:\n :param dataset:\n :return: Changes the inputted dataset when ran (no need for assigning the output to a variable).\n :usage: append_column(NEW_COLUMN_VARIAB... | -4,321,684,749,884,232,700 | :param new_column_values:
:param new_column_name:
:param dataset:
:return: Changes the inputted dataset when ran (no need for assigning the output to a variable).
:usage: append_column(NEW_COLUMN_VARIABLES_LIST, NEW_COLUMN_NAME_STRING, DATASET)
:example:
>>> my_list_data = ListData()
>>> my_list_data.dataset =... | preprocessor/ListData.py | append_column | clokman/KFIR | python | def append_column(instance, new_column_values, new_column_name):
'\n\n :param new_column_values:\n :param new_column_name:\n :param dataset:\n :return: Changes the inputted dataset when ran (no need for assigning the output to a variable).\n :usage: append_column(NEW_COLUMN_VARIAB... |
def remove_column(instance, target_column_header):
"\n Removes a column from dataset.\n\n Args:\n target_column_header(str): Name of the column to be removed.\n\n Returns:\n Nothing; modifies dataset.\n\n Examples:\n >>> example_data = [['day', 'month', '... | 7,980,447,242,423,446,000 | Removes a column from dataset.
Args:
target_column_header(str): Name of the column to be removed.
Returns:
Nothing; modifies dataset.
Examples:
>>> example_data = [['day', 'month', 'hour'], ['1', 'June', '12.00'], ['3', 'May', '11.00'],
... ['4', 'Jun', '15.00']]
>>> my_list_data =... | preprocessor/ListData.py | remove_column | clokman/KFIR | python | def remove_column(instance, target_column_header):
"\n Removes a column from dataset.\n\n Args:\n target_column_header(str): Name of the column to be removed.\n\n Returns:\n Nothing; modifies dataset.\n\n Examples:\n >>> example_data = [['day', 'month', '... |
def remove_columns(instance, target_column_headers_list):
'\n Removes multiple columns from dataset. Is a variation of .remove_column() method to support efficient removal\n of multiple columns.\n\n Args:\n target_column_headers_list(list): A list of strings whose items are the heade... | 1,848,056,667,119,853,600 | Removes multiple columns from dataset. Is a variation of .remove_column() method to support efficient removal
of multiple columns.
Args:
target_column_headers_list(list): A list of strings whose items are the header names of columns to
be removed
Returns:
Nothing; modifies dataset. | preprocessor/ListData.py | remove_columns | clokman/KFIR | python | def remove_columns(instance, target_column_headers_list):
'\n Removes multiple columns from dataset. Is a variation of .remove_column() method to support efficient removal\n of multiple columns.\n\n Args:\n target_column_headers_list(list): A list of strings whose items are the heade... |
def replace_headers(instance, header_replacements_list):
"\n Replaces headers of a dataset.\n\n Args:\n header_replacements_list(list): A list of strings to replace headers\n\n Returns:\n Nothing; modifies the provided dataset.\n\n Examples:\n >>> example... | 8,936,132,330,508,127,000 | Replaces headers of a dataset.
Args:
header_replacements_list(list): A list of strings to replace headers
Returns:
Nothing; modifies the provided dataset.
Examples:
>>> example_data = [['day', 'month'], ['1', 'June'], ['3', 'May'], ['4', 'Jun']]
>>> my_list_data = ListData()
>>> my_list_data.data... | preprocessor/ListData.py | replace_headers | clokman/KFIR | python | def replace_headers(instance, header_replacements_list):
"\n Replaces headers of a dataset.\n\n Args:\n header_replacements_list(list): A list of strings to replace headers\n\n Returns:\n Nothing; modifies the provided dataset.\n\n Examples:\n >>> example... |
def append_row(self, new_row):
"\n Overrides the ListData method of the same name to change buffer state to 'not empty' after adding something to\n the buffer\n\n Args:\n new_row(list, bool, str, int): The object to be added as a new row to buffer\n\n Returns:\n Lis... | -741,385,359,228,105,700 | Overrides the ListData method of the same name to change buffer state to 'not empty' after adding something to
the buffer
Args:
new_row(list, bool, str, int): The object to be added as a new row to buffer
Returns:
ListData object (self)
Examples:
# initiate
>>> my_buffer = ListBuffer()
# empty?
... | preprocessor/ListData.py | append_row | clokman/KFIR | python | def append_row(self, new_row):
"\n Overrides the ListData method of the same name to change buffer state to 'not empty' after adding something to\n the buffer\n\n Args:\n new_row(list, bool, str, int): The object to be added as a new row to buffer\n\n Returns:\n Lis... |
def is_each_row_balanced(self, exclude_special_rows_of_syntax=None):
'\n Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can\n exclude special row types (e.g., comment) from evaluation.\n\n Args:\n exclude_special_rows_of_synt... | -7,911,168,897,088,828,000 | Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can
exclude special row types (e.g., comment) from evaluation.
Args:
exclude_special_rows_of_syntax(str): specifies what type of rows to exclude from evaluation
(e.g., comment rows). Uses predefined sy... | preprocessor/ListData.py | is_each_row_balanced | clokman/KFIR | python | def is_each_row_balanced(self, exclude_special_rows_of_syntax=None):
'\n Checks whether each row in buffer is balanced (i.e., does not have unmatched parantheses, brackets, etc). Can\n exclude special row types (e.g., comment) from evaluation.\n\n Args:\n exclude_special_rows_of_synt... |
def is_parsable(self, syntax_to_parse_by='bibtex'):
'\n\n Args:\n syntax_to_parse_by:\n\n Returns:\n boolean\n\n Examples:\n # bibtex entry with no issues\n >>> my_buffer = ListBuffer()\n >>> my_buffer.dataset = [\'@article{5f3ed8a5037f4837... | -4,502,546,403,636,217,300 | Args:
syntax_to_parse_by:
Returns:
boolean
Examples:
# bibtex entry with no issues
>>> my_buffer = ListBuffer()
>>> my_buffer.dataset = ['@article{5f3ed8a5037f4837be0c7e8e5a1f0948,',
... 'title = "New Horizons biedt eindelijk goede blik op Pluto",',
... 'author = "B. Andeweg",',
... | preprocessor/ListData.py | is_parsable | clokman/KFIR | python | def is_parsable(self, syntax_to_parse_by='bibtex'):
'\n\n Args:\n syntax_to_parse_by:\n\n Returns:\n boolean\n\n Examples:\n # bibtex entry with no issues\n >>> my_buffer = ListBuffer()\n >>> my_buffer.dataset = [\'@article{5f3ed8a5037f4837... |
def _id(thing):
'Quote string if needed for it to be a valid identifier.'
if isinstance(thing, AspObject):
return thing
elif isinstance(thing, bool):
return ('"%s"' % str(thing))
elif isinstance(thing, int):
return str(thing)
else:
return ('"%s"' % str(thing)) | -9,163,242,725,028,129,000 | Quote string if needed for it to be a valid identifier. | lib/spack/spack/solver/asp.py | _id | AaltoSciComp/spack | python | def _id(thing):
if isinstance(thing, AspObject):
return thing
elif isinstance(thing, bool):
return ('"%s"' % str(thing))
elif isinstance(thing, int):
return str(thing)
else:
return ('"%s"' % str(thing)) |
def extend_flag_list(flag_list, new_flags):
'Extend a list of flags, preserving order and precedence.\n\n Add new_flags at the end of flag_list. If any flags in new_flags are\n already in flag_list, they are moved to the end so that they take\n higher precedence on the compile line.\n\n '
for flag ... | 5,304,618,090,113,952,000 | Extend a list of flags, preserving order and precedence.
Add new_flags at the end of flag_list. If any flags in new_flags are
already in flag_list, they are moved to the end so that they take
higher precedence on the compile line. | lib/spack/spack/solver/asp.py | extend_flag_list | AaltoSciComp/spack | python | def extend_flag_list(flag_list, new_flags):
'Extend a list of flags, preserving order and precedence.\n\n Add new_flags at the end of flag_list. If any flags in new_flags are\n already in flag_list, they are moved to the end so that they take\n higher precedence on the compile line.\n\n '
for flag ... |
def check_same_flags(flag_dict_1, flag_dict_2):
'Return True if flag dicts contain the same flags regardless of order.'
types = set(flag_dict_1.keys()).union(set(flag_dict_2.keys()))
for t in types:
values1 = set(flag_dict_1.get(t, []))
values2 = set(flag_dict_2.get(t, []))
assert (v... | 1,949,529,931,564,383,700 | Return True if flag dicts contain the same flags regardless of order. | lib/spack/spack/solver/asp.py | check_same_flags | AaltoSciComp/spack | python | def check_same_flags(flag_dict_1, flag_dict_2):
types = set(flag_dict_1.keys()).union(set(flag_dict_2.keys()))
for t in types:
values1 = set(flag_dict_1.get(t, []))
values2 = set(flag_dict_2.get(t, []))
assert (values1 == values2) |
def check_packages_exist(specs):
'Ensure all packages mentioned in specs exist.'
repo = spack.repo.path
for spec in specs:
for s in spec.traverse():
try:
check_passed = (repo.exists(s.name) or repo.is_virtual(s.name))
except Exception as e:
msg... | 5,778,717,062,947,235,000 | Ensure all packages mentioned in specs exist. | lib/spack/spack/solver/asp.py | check_packages_exist | AaltoSciComp/spack | python | def check_packages_exist(specs):
repo = spack.repo.path
for spec in specs:
for s in spec.traverse():
try:
check_passed = (repo.exists(s.name) or repo.is_virtual(s.name))
except Exception as e:
msg = 'Cannot find package: {0}'.format(str(e))
... |
def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False):
'Solve for a stable model of specs.\n\n Arguments:\n specs (list): list of Specs to solve.\n dump (tuple): what to dump\n models (int): number of models to search (default: 0)\n '
driver = PyclingoDriver()
... | 3,040,711,511,748,255,000 | Solve for a stable model of specs.
Arguments:
specs (list): list of Specs to solve.
dump (tuple): what to dump
models (int): number of models to search (default: 0) | lib/spack/spack/solver/asp.py | solve | AaltoSciComp/spack | python | def solve(specs, dump=(), models=0, timers=False, stats=False, tests=False):
'Solve for a stable model of specs.\n\n Arguments:\n specs (list): list of Specs to solve.\n dump (tuple): what to dump\n models (int): number of models to search (default: 0)\n '
driver = PyclingoDriver()
... |
@property
def specs(self):
'List of concretized specs satisfying the initial\n abstract request.\n '
if self._concrete_specs:
return self._concrete_specs
msg = 'cannot compute specs ["satisfiable" is not True ]'
assert self.satisfiable, msg
self._concrete_specs = []
best = ... | 6,606,093,366,351,177,000 | List of concretized specs satisfying the initial
abstract request. | lib/spack/spack/solver/asp.py | specs | AaltoSciComp/spack | python | @property
def specs(self):
'List of concretized specs satisfying the initial\n abstract request.\n '
if self._concrete_specs:
return self._concrete_specs
msg = 'cannot compute specs ["satisfiable" is not True ]'
assert self.satisfiable, msg
self._concrete_specs = []
best = ... |
def __init__(self, cores=True, asp=None):
'Driver for the Python clingo interface.\n\n Arguments:\n cores (bool): whether to generate unsatisfiable cores for better\n error reporting.\n asp (file-like): optional stream to write a text-based ASP program\n fo... | -6,134,784,348,510,137,000 | Driver for the Python clingo interface.
Arguments:
cores (bool): whether to generate unsatisfiable cores for better
error reporting.
asp (file-like): optional stream to write a text-based ASP program
for debugging or verification. | lib/spack/spack/solver/asp.py | __init__ | AaltoSciComp/spack | python | def __init__(self, cores=True, asp=None):
'Driver for the Python clingo interface.\n\n Arguments:\n cores (bool): whether to generate unsatisfiable cores for better\n error reporting.\n asp (file-like): optional stream to write a text-based ASP program\n fo... |
def fact(self, head):
'ASP fact (a rule without a body).'
symbol = (head.symbol() if hasattr(head, 'symbol') else head)
self.out.write(('%s.\n' % str(symbol)))
atom = self.backend.add_atom(symbol)
self.backend.add_rule([atom], [], choice=self.cores)
if self.cores:
self.assumptions.append... | 7,479,646,998,659,304,000 | ASP fact (a rule without a body). | lib/spack/spack/solver/asp.py | fact | AaltoSciComp/spack | python | def fact(self, head):
symbol = (head.symbol() if hasattr(head, 'symbol') else head)
self.out.write(('%s.\n' % str(symbol)))
atom = self.backend.add_atom(symbol)
self.backend.add_rule([atom], [], choice=self.cores)
if self.cores:
self.assumptions.append(atom) |
def pkg_version_rules(self, pkg):
'Output declared versions of a package.\n\n This uses self.possible_versions so that we include any versions\n that arise from a spec.\n '
def key_fn(version):
return (version.origin, version.idx)
pkg = packagize(pkg)
declared_versions = se... | 1,797,884,597,056,406,300 | Output declared versions of a package.
This uses self.possible_versions so that we include any versions
that arise from a spec. | lib/spack/spack/solver/asp.py | pkg_version_rules | AaltoSciComp/spack | python | def pkg_version_rules(self, pkg):
'Output declared versions of a package.\n\n This uses self.possible_versions so that we include any versions\n that arise from a spec.\n '
def key_fn(version):
return (version.origin, version.idx)
pkg = packagize(pkg)
declared_versions = se... |
def spec_versions(self, spec):
"Return list of clauses expressing spec's version constraints."
spec = specify(spec)
assert spec.name
if spec.concrete:
return [fn.version(spec.name, spec.version)]
if (spec.versions == spack.version.ver(':')):
return []
self.version_constraints.add... | 5,945,572,827,840,501,000 | Return list of clauses expressing spec's version constraints. | lib/spack/spack/solver/asp.py | spec_versions | AaltoSciComp/spack | python | def spec_versions(self, spec):
spec = specify(spec)
assert spec.name
if spec.concrete:
return [fn.version(spec.name, spec.version)]
if (spec.versions == spack.version.ver(':')):
return []
self.version_constraints.add((spec.name, spec.versions))
return [fn.version_satisfies(s... |
def available_compilers(self):
'Facts about available compilers.'
self.gen.h2('Available compilers')
compilers = self.possible_compilers
compiler_versions = collections.defaultdict((lambda : set()))
for compiler in compilers:
compiler_versions[compiler.name].add(compiler.version)
for com... | -4,816,124,531,095,553,000 | Facts about available compilers. | lib/spack/spack/solver/asp.py | available_compilers | AaltoSciComp/spack | python | def available_compilers(self):
self.gen.h2('Available compilers')
compilers = self.possible_compilers
compiler_versions = collections.defaultdict((lambda : set()))
for compiler in compilers:
compiler_versions[compiler.name].add(compiler.version)
for compiler in sorted(compiler_versions)... |
def compiler_defaults(self):
'Set compiler defaults, given a list of possible compilers.'
self.gen.h2('Default compiler preferences')
compiler_list = self.possible_compilers.copy()
compiler_list = sorted(compiler_list, key=(lambda x: (x.name, x.version)), reverse=True)
ppk = spack.package_prefs.Pack... | 2,857,875,852,841,491,500 | Set compiler defaults, given a list of possible compilers. | lib/spack/spack/solver/asp.py | compiler_defaults | AaltoSciComp/spack | python | def compiler_defaults(self):
self.gen.h2('Default compiler preferences')
compiler_list = self.possible_compilers.copy()
compiler_list = sorted(compiler_list, key=(lambda x: (x.name, x.version)), reverse=True)
ppk = spack.package_prefs.PackagePrefs('all', 'compiler', all=False)
matches = sorted(... |
def package_compiler_defaults(self, pkg):
"Facts about packages' compiler prefs."
packages = spack.config.get('packages')
pkg_prefs = packages.get(pkg.name)
if ((not pkg_prefs) or ('compiler' not in pkg_prefs)):
return
compiler_list = self.possible_compilers.copy()
compiler_list = sorted... | -6,119,435,165,651,928,000 | Facts about packages' compiler prefs. | lib/spack/spack/solver/asp.py | package_compiler_defaults | AaltoSciComp/spack | python | def package_compiler_defaults(self, pkg):
packages = spack.config.get('packages')
pkg_prefs = packages.get(pkg.name)
if ((not pkg_prefs) or ('compiler' not in pkg_prefs)):
return
compiler_list = self.possible_compilers.copy()
compiler_list = sorted(compiler_list, key=(lambda x: (x.name,... |
def condition(self, required_spec, imposed_spec=None, name=None):
'Generate facts for a dependency or virtual provider condition.\n\n Arguments:\n required_spec (spack.spec.Spec): the spec that triggers this condition\n imposed_spec (spack.spec.Spec or None): the sepc with constraints t... | -6,618,896,958,326,488,000 | Generate facts for a dependency or virtual provider condition.
Arguments:
required_spec (spack.spec.Spec): the spec that triggers this condition
imposed_spec (spack.spec.Spec or None): the sepc with constraints that
are imposed when this condition is triggered
name (str or None): name for `required... | lib/spack/spack/solver/asp.py | condition | AaltoSciComp/spack | python | def condition(self, required_spec, imposed_spec=None, name=None):
'Generate facts for a dependency or virtual provider condition.\n\n Arguments:\n required_spec (spack.spec.Spec): the spec that triggers this condition\n imposed_spec (spack.spec.Spec or None): the sepc with constraints t... |
def package_dependencies_rules(self, pkg, tests):
"Translate 'depends_on' directives into ASP logic."
for (_, conditions) in sorted(pkg.dependencies.items()):
for (cond, dep) in sorted(conditions.items()):
deptypes = dep.type.copy()
if (not tests):
deptypes.discar... | 6,123,517,379,699,171,000 | Translate 'depends_on' directives into ASP logic. | lib/spack/spack/solver/asp.py | package_dependencies_rules | AaltoSciComp/spack | python | def package_dependencies_rules(self, pkg, tests):
for (_, conditions) in sorted(pkg.dependencies.items()):
for (cond, dep) in sorted(conditions.items()):
deptypes = dep.type.copy()
if (not tests):
deptypes.discard('test')
if ((not isinstance(tests, bo... |
def virtual_preferences(self, pkg_name, func):
"Call func(vspec, provider, i) for each of pkg's provider prefs."
config = spack.config.get('packages')
pkg_prefs = config.get(pkg_name, {}).get('providers', {})
for (vspec, providers) in pkg_prefs.items():
if (vspec not in self.possible_virtuals):
... | -4,192,218,378,398,953,000 | Call func(vspec, provider, i) for each of pkg's provider prefs. | lib/spack/spack/solver/asp.py | virtual_preferences | AaltoSciComp/spack | python | def virtual_preferences(self, pkg_name, func):
config = spack.config.get('packages')
pkg_prefs = config.get(pkg_name, {}).get('providers', {})
for (vspec, providers) in pkg_prefs.items():
if (vspec not in self.possible_virtuals):
continue
for (i, provider) in enumerate(provi... |
def external_packages(self):
'Facts on external packages, as read from packages.yaml'
packages_yaml = spack.config.get('packages')
packages_yaml = _normalize_packages_yaml(packages_yaml)
self.gen.h1('External packages')
for (pkg_name, data) in packages_yaml.items():
if (pkg_name == 'all'):
... | 3,756,903,581,268,894,700 | Facts on external packages, as read from packages.yaml | lib/spack/spack/solver/asp.py | external_packages | AaltoSciComp/spack | python | def external_packages(self):
packages_yaml = spack.config.get('packages')
packages_yaml = _normalize_packages_yaml(packages_yaml)
self.gen.h1('External packages')
for (pkg_name, data) in packages_yaml.items():
if (pkg_name == 'all'):
continue
if (pkg_name not in spack.re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.