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 |
|---|---|---|---|---|---|---|---|
@pytest.mark.parametrize('n_voters', range(8))
def test_vote_actions(n_voters):
'* Legal transitions are UNDECIDED -> [VALID|INVALID] only\n * Block is never left UNDECIDED after voting\n * Accomodates rogues on previous block / invalid schema\n '
class TestVoting(Voting):
@classmethod
... | -6,545,330,417,013,052,000 | * Legal transitions are UNDECIDED -> [VALID|INVALID] only
* Block is never left UNDECIDED after voting
* Accomodates rogues on previous block / invalid schema | tests/test_voting.py | test_vote_actions | RiddleAndCode/bigchaindb | python | @pytest.mark.parametrize('n_voters', range(8))
def test_vote_actions(n_voters):
'* Legal transitions are UNDECIDED -> [VALID|INVALID] only\n * Block is never left UNDECIDED after voting\n * Accomodates rogues on previous block / invalid schema\n '
class TestVoting(Voting):
@classmethod
... |
def get_home():
'Get home directory of user, using Windows home directory for WSL.'
if (PF in {'WSL1', 'WSL2'}):
return (wsl.get_wsl_home() or Path.home().expanduser())
return Path.home().expanduser() | -8,916,673,993,594,660,000 | Get home directory of user, using Windows home directory for WSL. | sc2/paths.py | get_home | Sc2-AI-Cup/example-bot-marinerush | python | def get_home():
if (PF in {'WSL1', 'WSL2'}):
return (wsl.get_wsl_home() or Path.home().expanduser())
return Path.home().expanduser() |
def get_user_sc2_install():
"Attempts to find a user's SC2 install if their OS has ExecuteInfo.txt"
if USERPATH[PF]:
einfo = str((get_home() / Path(USERPATH[PF])))
if os.path.isfile(einfo):
with open(einfo) as f:
content = f.read()
if content:
... | -7,270,016,686,687,919,000 | Attempts to find a user's SC2 install if their OS has ExecuteInfo.txt | sc2/paths.py | get_user_sc2_install | Sc2-AI-Cup/example-bot-marinerush | python | def get_user_sc2_install():
if USERPATH[PF]:
einfo = str((get_home() / Path(USERPATH[PF])))
if os.path.isfile(einfo):
with open(einfo) as f:
content = f.read()
if content:
base = re.search(' = (.*)Versions', content).group(1)
... |
def logits_process(logits):
'\n Get the logits as a tuple of softmax logits ,bounding boxes and labels.\n Output: to matrices:\n logits_mat in size (dataset, 300, 1231) - top 300 logits for each image.\n bboxes_mat in size (dataset, 300, 4) - top 300 bboxes for each image.\n labels_mat in size (datas... | 7,758,338,616,256,155,000 | Get the logits as a tuple of softmax logits ,bounding boxes and labels.
Output: to matrices:
logits_mat in size (dataset, 300, 1231) - top 300 logits for each image.
bboxes_mat in size (dataset, 300, 4) - top 300 bboxes for each image.
labels_mat in size (dataset, 300, 1) - corresponding labels. 300 for each image. | tools/test_lvis.py | logits_process | ydiller/BalancedGroupSoftmax | python | def logits_process(logits):
'\n Get the logits as a tuple of softmax logits ,bounding boxes and labels.\n Output: to matrices:\n logits_mat in size (dataset, 300, 1231) - top 300 logits for each image.\n bboxes_mat in size (dataset, 300, 4) - top 300 bboxes for each image.\n labels_mat in size (datas... |
def find_file(path, reg):
'\n path: 要遍历的目录\n reg: 符合条件的文件\n '
FileLst = []
try:
lst = os.walk(path)
for (root, dirs, files) in lst:
for name in files:
try:
m = re.match(reg, name)
except Exception as e:
... | -6,400,951,898,583,274,000 | path: 要遍历的目录
reg: 符合条件的文件 | lib/pb_io.py | find_file | NingAnMe/snow_cover_of_remote_sensing | python | def find_file(path, reg):
'\n path: 要遍历的目录\n reg: 符合条件的文件\n '
FileLst = []
try:
lst = os.walk(path)
for (root, dirs, files) in lst:
for name in files:
try:
m = re.match(reg, name)
except Exception as e:
... |
def path_replace_ymd(path, ymd):
'\n path:替换路径中的日期 ,path中%YYYY%MM%DD%JJJ 等关键字会被ymd日期实例\n ymd: yyyymmdd (20180101)\n '
ymd = datetime.strptime(ymd, '%Y%m%d')
yy = ymd.strftime('%Y')
mm = ymd.strftime('%m')
dd = ymd.strftime('%d')
jj = ymd.strftime('%j')
path = path.replace('%YYYY', ... | 4,353,463,753,659,498,500 | path:替换路径中的日期 ,path中%YYYY%MM%DD%JJJ 等关键字会被ymd日期实例
ymd: yyyymmdd (20180101) | lib/pb_io.py | path_replace_ymd | NingAnMe/snow_cover_of_remote_sensing | python | def path_replace_ymd(path, ymd):
'\n path:替换路径中的日期 ,path中%YYYY%MM%DD%JJJ 等关键字会被ymd日期实例\n ymd: yyyymmdd (20180101)\n '
ymd = datetime.strptime(ymd, '%Y%m%d')
yy = ymd.strftime('%Y')
mm = ymd.strftime('%m')
dd = ymd.strftime('%d')
jj = ymd.strftime('%j')
path = path.replace('%YYYY', ... |
def is_none(*args):
'\n 判断传入的变量中是否有 None\n :param args:\n :return:\n '
has_none = False
for arg in args:
if (arg is None):
has_none = True
return has_none | 7,719,742,756,869,125,000 | 判断传入的变量中是否有 None
:param args:
:return: | lib/pb_io.py | is_none | NingAnMe/snow_cover_of_remote_sensing | python | def is_none(*args):
'\n 判断传入的变量中是否有 None\n :param args:\n :return:\n '
has_none = False
for arg in args:
if (arg is None):
has_none = True
return has_none |
def copy_attrs_h5py(pre_object, out_object):
'\n 复制 file、dataset 或者 group 的属性\n :param pre_object: 被复制属性的 dataset 或者 group\n :param out_object: 复制属性的 dataset 或者 group\n :return:\n '
for akey in list(pre_object.attrs.keys()):
out_object.attrs[akey] = pre_object.attrs[akey] | 6,695,034,932,447,956,000 | 复制 file、dataset 或者 group 的属性
:param pre_object: 被复制属性的 dataset 或者 group
:param out_object: 复制属性的 dataset 或者 group
:return: | lib/pb_io.py | copy_attrs_h5py | NingAnMe/snow_cover_of_remote_sensing | python | def copy_attrs_h5py(pre_object, out_object):
'\n 复制 file、dataset 或者 group 的属性\n :param pre_object: 被复制属性的 dataset 或者 group\n :param out_object: 复制属性的 dataset 或者 group\n :return:\n '
for akey in list(pre_object.attrs.keys()):
out_object.attrs[akey] = pre_object.attrs[akey] |
def read_dataset_hdf5(file_path, set_name):
'\n 读取 hdf5 文件,返回一个 numpy 多维数组\n :param file_path: (unicode)文件路径\n :param set_name: (str or list)表的名字\n :return: 如果传入的表名字是一个字符串,返回 numpy.ndarray\n 如果传入的表名字是一个列表,返回一个字典,key 是表名字,\n value 是 numpy.ndarry\n '
if isinstance(set_name, ... | 828,793,903,532,586,800 | 读取 hdf5 文件,返回一个 numpy 多维数组
:param file_path: (unicode)文件路径
:param set_name: (str or list)表的名字
:return: 如果传入的表名字是一个字符串,返回 numpy.ndarray
如果传入的表名字是一个列表,返回一个字典,key 是表名字,
value 是 numpy.ndarry | lib/pb_io.py | read_dataset_hdf5 | NingAnMe/snow_cover_of_remote_sensing | python | def read_dataset_hdf5(file_path, set_name):
'\n 读取 hdf5 文件,返回一个 numpy 多维数组\n :param file_path: (unicode)文件路径\n :param set_name: (str or list)表的名字\n :return: 如果传入的表名字是一个字符串,返回 numpy.ndarray\n 如果传入的表名字是一个列表,返回一个字典,key 是表名字,\n value 是 numpy.ndarry\n '
if isinstance(set_name, ... |
def attrs2dict(attrs):
'\n 将一个 HDF5 attr 类转为 Dict 类\n :return:\n '
d = {}
for (k, v) in list(attrs.items()):
d[k] = v
return d | -215,780,085,529,066,880 | 将一个 HDF5 attr 类转为 Dict 类
:return: | lib/pb_io.py | attrs2dict | NingAnMe/snow_cover_of_remote_sensing | python | def attrs2dict(attrs):
'\n 将一个 HDF5 attr 类转为 Dict 类\n :return:\n '
d = {}
for (k, v) in list(attrs.items()):
d[k] = v
return d |
def write_txt(in_file, head, bodys, keylens=8):
'\n description: wangpeng add 20180615 (写入或更新txt)\n :in_file 写入文件位置\n :head 文件头信息\n :bodys 文件体\n :keylens 更新文件使用的第一列关键字长度\n '
allLines = []
DICT_D = {}
FilePath = os.path.dirname(in_file)
if (not os.path.exists(FilePath)):
os... | 2,325,851,969,103,667,700 | description: wangpeng add 20180615 (写入或更新txt)
:in_file 写入文件位置
:head 文件头信息
:bodys 文件体
:keylens 更新文件使用的第一列关键字长度 | lib/pb_io.py | write_txt | NingAnMe/snow_cover_of_remote_sensing | python | def write_txt(in_file, head, bodys, keylens=8):
'\n description: wangpeng add 20180615 (写入或更新txt)\n :in_file 写入文件位置\n :head 文件头信息\n :bodys 文件体\n :keylens 更新文件使用的第一列关键字长度\n '
allLines = []
DICT_D = {}
FilePath = os.path.dirname(in_file)
if (not os.path.exists(FilePath)):
os... |
def str_format(string, values):
'\n 格式化字符串\n :param string:(str) "DCC: %sat_sensor_Projection_%ymd(分辨率 %resolution 度)"\n :param values:(dict) {"sat_sensor": sat_sensor, "resolution": str(resolution), "ymd": ymd}\n :return: DCC: FY3D+MERSI_Projection_201712(分辨率 1 度)\n '
if (not isinstance(string, ... | 3,361,385,951,881,129,500 | 格式化字符串
:param string:(str) "DCC: %sat_sensor_Projection_%ymd(分辨率 %resolution 度)"
:param values:(dict) {"sat_sensor": sat_sensor, "resolution": str(resolution), "ymd": ymd}
:return: DCC: FY3D+MERSI_Projection_201712(分辨率 1 度) | lib/pb_io.py | str_format | NingAnMe/snow_cover_of_remote_sensing | python | def str_format(string, values):
'\n 格式化字符串\n :param string:(str) "DCC: %sat_sensor_Projection_%ymd(分辨率 %resolution 度)"\n :param values:(dict) {"sat_sensor": sat_sensor, "resolution": str(resolution), "ymd": ymd}\n :return: DCC: FY3D+MERSI_Projection_201712(分辨率 1 度)\n '
if (not isinstance(string, ... |
def get_files_by_ymd(dir_path, time_start, time_end, ext=None, pattern_ymd=None):
'\n :param dir_path: 文件夹\n :param time_start: 开始时间\n :param time_end: 结束时间\n :param ext: 后缀名, \'.hdf5\'\n :param pattern_ymd: 匹配时间的模式, 可以是 r".*(\\d{8})_(\\d{4})_"\n :return: list\n '
files_found = []
if (p... | 344,630,162,736,734,340 | :param dir_path: 文件夹
:param time_start: 开始时间
:param time_end: 结束时间
:param ext: 后缀名, '.hdf5'
:param pattern_ymd: 匹配时间的模式, 可以是 r".*(\d{8})_(\d{4})_"
:return: list | lib/pb_io.py | get_files_by_ymd | NingAnMe/snow_cover_of_remote_sensing | python | def get_files_by_ymd(dir_path, time_start, time_end, ext=None, pattern_ymd=None):
'\n :param dir_path: 文件夹\n :param time_start: 开始时间\n :param time_end: 结束时间\n :param ext: 后缀名, \'.hdf5\'\n :param pattern_ymd: 匹配时间的模式, 可以是 r".*(\\d{8})_(\\d{4})_"\n :return: list\n '
files_found = []
if (p... |
def ymdhms2date(ymd, hms):
'\n ymd = 20180101\n hms = 04:04:04\n '
ymdhms = (ymd + hms)
return datetime.strptime(ymdhms, '%Y%m%d%H:%M:%S') | 8,144,697,994,038,613,000 | ymd = 20180101
hms = 04:04:04 | lib/pb_io.py | ymdhms2date | NingAnMe/snow_cover_of_remote_sensing | python | def ymdhms2date(ymd, hms):
'\n ymd = 20180101\n hms = 04:04:04\n '
ymdhms = (ymd + hms)
return datetime.strptime(ymdhms, '%Y%m%d%H:%M:%S') |
def get_files_by_date(dir_path, time_start=None, time_end=None, ext=None, pattern=None):
"\n :param dir_path: 文件夹\n :param time_start: 开始时间\n :param time_end: 结束时间\n :param ext: 后缀名, '.hdf5'\n :param pattern: 匹配时间的模式\n :return: list\n "
files_found = []
for (root, dirs, files) in os.wal... | 574,180,708,283,089,540 | :param dir_path: 文件夹
:param time_start: 开始时间
:param time_end: 结束时间
:param ext: 后缀名, '.hdf5'
:param pattern: 匹配时间的模式
:return: list | lib/pb_io.py | get_files_by_date | NingAnMe/snow_cover_of_remote_sensing | python | def get_files_by_date(dir_path, time_start=None, time_end=None, ext=None, pattern=None):
"\n :param dir_path: 文件夹\n :param time_start: 开始时间\n :param time_end: 结束时间\n :param ext: 后缀名, '.hdf5'\n :param pattern: 匹配时间的模式\n :return: list\n "
files_found = []
for (root, dirs, files) in os.wal... |
@staticmethod
def read_cross_file(in_file, file_type):
'\n :param in_file:\n :param file_type:\n :return:\n '
data = {'ymdhms1': None, 'ymdhms2': None, 'lon1': None, 'lat1': None, 'lon2': None, 'lat2': None, 'fix_name': None}
if (not os.path.isfile(in_file)):
print('***WA... | -4,966,384,043,776,749,000 | :param in_file:
:param file_type:
:return: | lib/pb_io.py | read_cross_file | NingAnMe/snow_cover_of_remote_sensing | python | @staticmethod
def read_cross_file(in_file, file_type):
'\n :param in_file:\n :param file_type:\n :return:\n '
data = {'ymdhms1': None, 'ymdhms2': None, 'lon1': None, 'lat1': None, 'lon2': None, 'lat2': None, 'fix_name': None}
if (not os.path.isfile(in_file)):
print('***WA... |
def move_organ(self, new_location: int, cost: float, shortest_path: shortest_path_structure) -> None:
"\n This function allows an organ's attributes to be altered to represent it's\n transportation across the network. This is intended to be used with\n Dijkstra.shortest_path (this will be the s... | -5,861,527,202,163,004,000 | This function allows an organ's attributes to be altered to represent it's
transportation across the network. This is intended to be used with
Dijkstra.shortest_path (this will be the source of the cost parameter)
:param int new_location: node id representing the destination location
:param cost: weight/cost associate... | network_simulator/Organ.py | move_organ | zspatter/Network-Simulation | python | def move_organ(self, new_location: int, cost: float, shortest_path: shortest_path_structure) -> None:
"\n This function allows an organ's attributes to be altered to represent it's\n transportation across the network. This is intended to be used with\n Dijkstra.shortest_path (this will be the s... |
@staticmethod
def get_viability(organ_type: OrganType) -> float:
'\n Gets viability rating for each organ individually\n\n Viability is represented by hours an organ can be out of body * 10\n\n :param int organ_type: constant corresponding to an organ type\n :return: int viability rating... | 7,959,193,242,337,898,000 | Gets viability rating for each organ individually
Viability is represented by hours an organ can be out of body * 10
:param int organ_type: constant corresponding to an organ type
:return: int viability rating (used in __init__()) | network_simulator/Organ.py | get_viability | zspatter/Network-Simulation | python | @staticmethod
def get_viability(organ_type: OrganType) -> float:
'\n Gets viability rating for each organ individually\n\n Viability is represented by hours an organ can be out of body * 10\n\n :param int organ_type: constant corresponding to an organ type\n :return: int viability rating... |
def __str__(self) -> str:
'\n Builds an easily readable string representing an organ\n\n :return: str\n '
return f'''Organ:
Organ ID: {'{:05d}'.format(self.organ_id)}
Organ type: {OrganType(self.organ_type).name}
Blood type: {self.blood_type}
Viability: {self.viability}
Origin location... | 7,500,228,580,813,923,000 | Builds an easily readable string representing an organ
:return: str | network_simulator/Organ.py | __str__ | zspatter/Network-Simulation | python | def __str__(self) -> str:
'\n Builds an easily readable string representing an organ\n\n :return: str\n '
return f'Organ:
Organ ID: {'{:05d}'.format(self.organ_id)}
Organ type: {OrganType(self.organ_type).name}
Blood type: {self.blood_type}
Viability: {self.viability}
Origin location: ... |
def _sentry_llvm_version():
'\n Make sure we meet min llvmpy version\n '
import warnings
import llvm
min_version = (0, 12, 6)
regex = re.compile('(\\d+)\\.(\\d+).(\\d+)')
m = regex.match(llvm.__version__)
if m:
ver = tuple(map(int, m.groups()))
if (ver < min_version):
... | -4,261,973,195,286,988,000 | Make sure we meet min llvmpy version | numba/__init__.py | _sentry_llvm_version | meawoppl/numba | python | def _sentry_llvm_version():
'\n \n '
import warnings
import llvm
min_version = (0, 12, 6)
regex = re.compile('(\\d+)\\.(\\d+).(\\d+)')
m = regex.match(llvm.__version__)
if m:
ver = tuple(map(int, m.groups()))
if (ver < min_version):
msg = ('Numba requires at... |
def train(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n data (torch.Tensor): [descripti... | -5,516,086,070,360,717,000 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | train | GJBoth/MultiTaskPINN | python | def train(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n data (torch.Tensor): [descripti... |
def train_auto_split(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n da... | -557,119,499,946,742,100 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | train_auto_split | GJBoth/MultiTaskPINN | python | def train_auto_split(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n da... |
def train_auto_split_scaled(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n ... | -7,852,028,519,855,341,000 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | train_auto_split_scaled | GJBoth/MultiTaskPINN | python | def train_auto_split_scaled(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n ... |
def train_auto_split_MSE(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n ... | -2,845,149,371,688,520,700 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | train_auto_split_MSE | GJBoth/MultiTaskPINN | python | def train_auto_split_MSE(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]\n ... |
def train_split_full(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, test='mse', split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]... | -5,188,684,247,511,856,000 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | train_split_full | GJBoth/MultiTaskPINN | python | def train_split_full(model: DeepMoD, data: torch.Tensor, target: torch.Tensor, optimizer, sparsity_scheduler, test='mse', split: float=0.8, log_dir: Optional[str]=None, max_iterations: int=10000, write_iterations: int=25, **convergence_kwargs) -> None:
'[summary]\n\n Args:\n model (DeepMoD): [description]... |
def _verify_error(res: int):
'\n Validate k4a_module result\n '
res = Result(res)
if (res == Result.Failed):
raise K4AException()
elif (res == Result.Timeout):
raise K4ATimeoutException() | -5,525,237,422,260,999,000 | Validate k4a_module result | deepclaw/driver/sensors/camera/pyk4a_cfg/errors.py | _verify_error | 1079931505/ME336-Yellow-Team-SUSTech | python | def _verify_error(res: int):
'\n \n '
res = Result(res)
if (res == Result.Failed):
raise K4AException()
elif (res == Result.Timeout):
raise K4ATimeoutException() |
def __init__(self, session, object_factory, request_validator):
'Initialize a new SxpConnections\n object with the provided RestSession.\n\n Args:\n session(RestSession): The RESTful session object to be used for\n API calls to the Identity Services Engine service.\n\n ... | -4,665,961,750,954,259,000 | Initialize a new SxpConnections
object with the provided RestSession.
Args:
session(RestSession): The RESTful session object to be used for
API calls to the Identity Services Engine service.
Raises:
TypeError: If the parameter types are incorrect. | ciscoisesdk/api/v3_0_0/sxp_connections.py | __init__ | CiscoISE/ciscoisesdk | python | def __init__(self, session, object_factory, request_validator):
'Initialize a new SxpConnections\n object with the provided RestSession.\n\n Args:\n session(RestSession): The RESTful session object to be used for\n API calls to the Identity Services Engine service.\n\n ... |
def get_sxp_connections_by_id(self, id, headers=None, **query_parameters):
"This API allows the client to get a SXP connection by ID.\n\n Args:\n id(basestring): id path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **que... | 3,230,320,443,717,295,600 | This API allows the client to get a SXP connection by ID.
Args:
id(basestring): id path parameter.
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns... | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_sxp_connections_by_id | CiscoISE/ciscoisesdk | python | def get_sxp_connections_by_id(self, id, headers=None, **query_parameters):
"This API allows the client to get a SXP connection by ID.\n\n Args:\n id(basestring): id path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **que... |
def get_by_id(self, id, headers=None, **query_parameters):
'Alias for `get_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections_by_id>`_\n '
return self.get_sxp_connections_by_id(id=id, headers=headers, **query_parameters) | 7,004,977,335,190,405,000 | Alias for `get_sxp_connections_by_id <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.get_sxp_connections_by_id>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_by_id | CiscoISE/ciscoisesdk | python | def get_by_id(self, id, headers=None, **query_parameters):
'Alias for `get_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections_by_id>`_\n '
return self.get_sxp_connections_by_id(id=id, headers=headers, **query_parameters) |
def update_sxp_connections_by_id(self, id, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API allows the client to update a SXP connection.\n\n Args:\n... | 5,528,890,898,895,734,000 | This API allows the client to update a SXP connection.
Args:
description(string): description, property of the
request body.
enabled(boolean): enabled, property of the request body.
id(string): id, property of the request body.
ip_address(string): ipAddress, property of the request
body... | ciscoisesdk/api/v3_0_0/sxp_connections.py | update_sxp_connections_by_id | CiscoISE/ciscoisesdk | python | def update_sxp_connections_by_id(self, id, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API allows the client to update a SXP connection.\n\n Args:\n... |
def update_by_id(self, id, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `update_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connection... | -3,714,477,195,803,711,000 | Alias for `update_sxp_connections_by_id <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.update_sxp_connections_by_id>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | update_by_id | CiscoISE/ciscoisesdk | python | def update_by_id(self, id, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `update_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connection... |
def delete_sxp_connections_by_id(self, id, headers=None, **query_parameters):
"This API deletes a SXP connection.\n\n Args:\n id(basestring): id path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Addit... | 8,403,939,434,304,790,000 | This API deletes a SXP connection.
Args:
id(basestring): id path parameter.
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestResponse: RE... | ciscoisesdk/api/v3_0_0/sxp_connections.py | delete_sxp_connections_by_id | CiscoISE/ciscoisesdk | python | def delete_sxp_connections_by_id(self, id, headers=None, **query_parameters):
"This API deletes a SXP connection.\n\n Args:\n id(basestring): id path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Addit... |
def delete_by_id(self, id, headers=None, **query_parameters):
'Alias for `delete_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.delete_sxp_connections_by_id>`_\n '
return self.delete_sxp_connections_by_id(id=id, headers=headers, **query_parameters) | 1,913,868,147,716,121,000 | Alias for `delete_sxp_connections_by_id <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.delete_sxp_connections_by_id>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | delete_by_id | CiscoISE/ciscoisesdk | python | def delete_by_id(self, id, headers=None, **query_parameters):
'Alias for `delete_sxp_connections_by_id <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.delete_sxp_connections_by_id>`_\n '
return self.delete_sxp_connections_by_id(id=id, headers=headers, **query_parameters) |
def get_sxp_connections(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'This API allows the client to get all the SXP connections.\n Filter: [name, description] To search resources by\n using toDate column,follow the form... | 5,598,542,891,324,423,000 | This API allows the client to get all the SXP connections.
Filter: [name, description] To search resources by
using toDate column,follow the format: DD-MON-YY
(Example:13-SEP-18) Day or Year:GET
/ers/config/guestuser/?filter=toDate.CONTAINS.13
Month:GET
/ers/config/guestuser/?filter=toDate.CONTAINS.SEP
Date... | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_sxp_connections | CiscoISE/ciscoisesdk | python | def get_sxp_connections(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'This API allows the client to get all the SXP connections.\n Filter: [name, description] To search resources by\n using toDate column,follow the form... |
def get_all(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'Alias for `get_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections>`_\n '
return self.get_sxp_connections(filt... | -5,183,008,879,214,946,000 | Alias for `get_sxp_connections <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.get_sxp_connections>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_all | CiscoISE/ciscoisesdk | python | def get_all(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'Alias for `get_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections>`_\n '
return self.get_sxp_connections(filt... |
def get_sxp_connections_generator(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'This API allows the client to get all the SXP connections.\n Filter: [name, description] To search resources by\n using toDate column,follo... | 1,249,936,647,909,373,700 | This API allows the client to get all the SXP connections.
Filter: [name, description] To search resources by
using toDate column,follow the format: DD-MON-YY
(Example:13-SEP-18) Day or Year:GET
/ers/config/guestuser/?filter=toDate.CONTAINS.13
Month:GET
/ers/config/guestuser/?filter=toDate.CONTAINS.SEP
Date... | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_sxp_connections_generator | CiscoISE/ciscoisesdk | python | def get_sxp_connections_generator(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'This API allows the client to get all the SXP connections.\n Filter: [name, description] To search resources by\n using toDate column,follo... |
def get_all_generator(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'Alias for `get_sxp_connections_generator <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections_generator>`_\n '
(yield... | -806,000,813,169,550,700 | Alias for `get_sxp_connections_generator <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.get_sxp_connections_generator>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_all_generator | CiscoISE/ciscoisesdk | python | def get_all_generator(self, filter=None, filter_type=None, page=None, size=None, sortasc=None, sortdsc=None, headers=None, **query_parameters):
'Alias for `get_sxp_connections_generator <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.get_sxp_connections_generator>`_\n '
(yield... |
def create_sxp_connections(self, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API creates a SXP connection.\n\n Args:\n description(string... | 8,456,330,866,147,297,000 | This API creates a SXP connection.
Args:
description(string): description, property of the
request body.
enabled(boolean): enabled, property of the request body.
ip_address(string): ipAddress, property of the request
body.
sxp_mode(string): sxpMode, property of the request body.
sxp... | ciscoisesdk/api/v3_0_0/sxp_connections.py | create_sxp_connections | CiscoISE/ciscoisesdk | python | def create_sxp_connections(self, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API creates a SXP connection.\n\n Args:\n description(string... |
def create(self, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `create_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpC... | 8,035,656,819,289,710,000 | Alias for `create_sxp_connections <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.create_sxp_connections>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | create | CiscoISE/ciscoisesdk | python | def create(self, description=None, enabled=None, ip_address=None, sxp_mode=None, sxp_node=None, sxp_peer=None, sxp_version=None, sxp_vpn=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `create_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpC... |
def get_version(self, headers=None, **query_parameters):
"This API helps to retrieve the version information related to\n the SXP connections.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query ... | 3,095,936,805,751,979,500 | This API helps to retrieve the version information related to
the SXP connections.
Args:
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
Returns:
RestRes... | ciscoisesdk/api/v3_0_0/sxp_connections.py | get_version | CiscoISE/ciscoisesdk | python | def get_version(self, headers=None, **query_parameters):
"This API helps to retrieve the version information related to\n the SXP connections.\n\n Args:\n headers(dict): Dictionary of HTTP Headers to send with the Request\n .\n **query_parameters: Additional query ... |
def bulk_request_for_sxp_connections(self, operation_type=None, resource_media_type=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API allows the client to submit the bulk request.\n\n Args:\n operation_type(string): operationType, property of the\n ... | -40,799,253,086,491,080 | This API allows the client to submit the bulk request.
Args:
operation_type(string): operationType, property of the
request body.
resource_media_type(string): resourceMediaType, property
of the request body.
headers(dict): Dictionary of HTTP Headers to send with the Request
.
pa... | ciscoisesdk/api/v3_0_0/sxp_connections.py | bulk_request_for_sxp_connections | CiscoISE/ciscoisesdk | python | def bulk_request_for_sxp_connections(self, operation_type=None, resource_media_type=None, headers=None, payload=None, active_validation=True, **query_parameters):
"This API allows the client to submit the bulk request.\n\n Args:\n operation_type(string): operationType, property of the\n ... |
def bulk_request(self, operation_type=None, resource_media_type=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `bulk_request_for_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.bulk_request_for_sxp_connections>`_\n '
r... | -2,038,944,062,834,316,800 | Alias for `bulk_request_for_sxp_connections <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.bulk_request_for_sxp_connections>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | bulk_request | CiscoISE/ciscoisesdk | python | def bulk_request(self, operation_type=None, resource_media_type=None, headers=None, payload=None, active_validation=True, **query_parameters):
'Alias for `bulk_request_for_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.bulk_request_for_sxp_connections>`_\n '
r... |
def monitor_bulk_status_sxp_connections(self, bulkid, headers=None, **query_parameters):
"This API allows the client to monitor the bulk request.\n\n Args:\n bulkid(basestring): bulkid path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n ... | 6,279,486,229,551,649,000 | This API allows the client to monitor the bulk request.
Args:
bulkid(basestring): bulkid path parameter.
headers(dict): Dictionary of HTTP Headers to send with the Request
.
**query_parameters: Additional query parameters (provides
support for parameters that may be added in the future).
R... | ciscoisesdk/api/v3_0_0/sxp_connections.py | monitor_bulk_status_sxp_connections | CiscoISE/ciscoisesdk | python | def monitor_bulk_status_sxp_connections(self, bulkid, headers=None, **query_parameters):
"This API allows the client to monitor the bulk request.\n\n Args:\n bulkid(basestring): bulkid path parameter.\n headers(dict): Dictionary of HTTP Headers to send with the Request\n ... |
def monitor_bulk_status(self, bulkid, headers=None, **query_parameters):
'Alias for `monitor_bulk_status_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.monitor_bulk_status_sxp_connections>`_\n '
return self.monitor_bulk_status_sxp_connections(bulkid=bulkid, he... | 779,299,447,832,129,700 | Alias for `monitor_bulk_status_sxp_connections <#ciscoisesdk.
api.v3_0_0.sxp_connections.
SxpConnections.monitor_bulk_status_sxp_connections>`_ | ciscoisesdk/api/v3_0_0/sxp_connections.py | monitor_bulk_status | CiscoISE/ciscoisesdk | python | def monitor_bulk_status(self, bulkid, headers=None, **query_parameters):
'Alias for `monitor_bulk_status_sxp_connections <#ciscoisesdk.\n api.v3_0_0.sxp_connections.\n SxpConnections.monitor_bulk_status_sxp_connections>`_\n '
return self.monitor_bulk_status_sxp_connections(bulkid=bulkid, he... |
def __getitem__(self, key):
'\n This allows an object which is an instance of this class to behave\n like a dictionary when queried with [] syntax\n '
return self.config[key] | 6,932,194,484,295,522,000 | This allows an object which is an instance of this class to behave
like a dictionary when queried with [] syntax | blipp/conf.py | __getitem__ | periscope-ps/blipp | python | def __getitem__(self, key):
'\n This allows an object which is an instance of this class to behave\n like a dictionary when queried with [] syntax\n '
return self.config[key] |
def entropy_score(kmer):
'\n Schmieder and Edwards. Quality control and preprocessing of metagenomic datasets. (2011) Bioinformatics\n https://academic.oup.com/bioinformatics/article/27/6/863/236283/Quality-control-and-preprocessing-of-metagenomic\n '
l = (len(kmer) - 2)
k = (l if (l < 64) else 64)... | -6,284,588,666,856,321,000 | Schmieder and Edwards. Quality control and preprocessing of metagenomic datasets. (2011) Bioinformatics
https://academic.oup.com/bioinformatics/article/27/6/863/236283/Quality-control-and-preprocessing-of-metagenomic | jcvi/assembly/kmer.py | entropy_score | lufuhao/jcvi | python | def entropy_score(kmer):
'\n Schmieder and Edwards. Quality control and preprocessing of metagenomic datasets. (2011) Bioinformatics\n https://academic.oup.com/bioinformatics/article/27/6/863/236283/Quality-control-and-preprocessing-of-metagenomic\n '
l = (len(kmer) - 2)
k = (l if (l < 64) else 64)... |
def entropy(args):
'\n %prog entropy kmc_dump.out\n\n kmc_dump.out contains two columns:\n AAAAAAAAAAAGAAGAAAGAAA 34\n '
p = OptionParser(entropy.__doc__)
p.add_option('--threshold', default=0, type='int', help='Complexity needs to be above')
(opts, args) = p.parse_args(args)
if (len(ar... | -6,110,690,022,701,924,000 | %prog entropy kmc_dump.out
kmc_dump.out contains two columns:
AAAAAAAAAAAGAAGAAAGAAA 34 | jcvi/assembly/kmer.py | entropy | lufuhao/jcvi | python | def entropy(args):
'\n %prog entropy kmc_dump.out\n\n kmc_dump.out contains two columns:\n AAAAAAAAAAAGAAGAAAGAAA 34\n '
p = OptionParser(entropy.__doc__)
p.add_option('--threshold', default=0, type='int', help='Complexity needs to be above')
(opts, args) = p.parse_args(args)
if (len(ar... |
def bed(args):
'\n %prog bed fastafile kmer.dump.txt\n\n Map kmers on FASTA.\n '
from jcvi.formats.fasta import rc, parse_fasta
p = OptionParser(bed.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(fastafile, dumpfile) = args
fp... | 510,515,766,485,658,300 | %prog bed fastafile kmer.dump.txt
Map kmers on FASTA. | jcvi/assembly/kmer.py | bed | lufuhao/jcvi | python | def bed(args):
'\n %prog bed fastafile kmer.dump.txt\n\n Map kmers on FASTA.\n '
from jcvi.formats.fasta import rc, parse_fasta
p = OptionParser(bed.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(fastafile, dumpfile) = args
fp... |
def kmcop(args):
'\n %prog kmcop *.kmc_suf\n\n Intersect or union kmc indices.\n '
p = OptionParser(kmcop.__doc__)
p.add_option('--action', choices=('union', 'intersect'), default='union', help='Action')
p.add_option('-o', default='results', help='Output name')
(opts, args) = p.parse_args(a... | 5,931,948,310,414,970,000 | %prog kmcop *.kmc_suf
Intersect or union kmc indices. | jcvi/assembly/kmer.py | kmcop | lufuhao/jcvi | python | def kmcop(args):
'\n %prog kmcop *.kmc_suf\n\n Intersect or union kmc indices.\n '
p = OptionParser(kmcop.__doc__)
p.add_option('--action', choices=('union', 'intersect'), default='union', help='Action')
p.add_option('-o', default='results', help='Output name')
(opts, args) = p.parse_args(a... |
def kmc(args):
'\n %prog kmc folder\n\n Run kmc3 on Illumina reads.\n '
p = OptionParser(kmc.__doc__)
p.add_option('-k', default=21, type='int', help='Kmer size')
p.add_option('--ci', default=2, type='int', help='Exclude kmers with less than ci counts')
p.add_option('--cs', default=2, type=... | 6,032,916,289,647,153,000 | %prog kmc folder
Run kmc3 on Illumina reads. | jcvi/assembly/kmer.py | kmc | lufuhao/jcvi | python | def kmc(args):
'\n %prog kmc folder\n\n Run kmc3 on Illumina reads.\n '
p = OptionParser(kmc.__doc__)
p.add_option('-k', default=21, type='int', help='Kmer size')
p.add_option('--ci', default=2, type='int', help='Exclude kmers with less than ci counts')
p.add_option('--cs', default=2, type=... |
def meryl(args):
'\n %prog meryl folder\n\n Run meryl on Illumina reads.\n '
p = OptionParser(meryl.__doc__)
p.add_option('-k', default=19, type='int', help='Kmer size')
p.set_cpus()
(opts, args) = p.parse_args(args)
if (len(args) != 1):
sys.exit((not p.print_help()))
(folde... | 7,407,222,545,709,982,000 | %prog meryl folder
Run meryl on Illumina reads. | jcvi/assembly/kmer.py | meryl | lufuhao/jcvi | python | def meryl(args):
'\n %prog meryl folder\n\n Run meryl on Illumina reads.\n '
p = OptionParser(meryl.__doc__)
p.add_option('-k', default=19, type='int', help='Kmer size')
p.set_cpus()
(opts, args) = p.parse_args(args)
if (len(args) != 1):
sys.exit((not p.print_help()))
(folde... |
def model(args):
'\n %prog model erate\n\n Model kmer distribution given error rate. See derivation in FIONA paper:\n <http://bioinformatics.oxfordjournals.org/content/30/17/i356.full>\n '
from scipy.stats import binom, poisson
p = OptionParser(model.__doc__)
p.add_option('-k', default=23, t... | 6,194,723,951,826,256,000 | %prog model erate
Model kmer distribution given error rate. See derivation in FIONA paper:
<http://bioinformatics.oxfordjournals.org/content/30/17/i356.full> | jcvi/assembly/kmer.py | model | lufuhao/jcvi | python | def model(args):
'\n %prog model erate\n\n Model kmer distribution given error rate. See derivation in FIONA paper:\n <http://bioinformatics.oxfordjournals.org/content/30/17/i356.full>\n '
from scipy.stats import binom, poisson
p = OptionParser(model.__doc__)
p.add_option('-k', default=23, t... |
def logodds(args):
'\n %prog logodds cnt1 cnt2\n\n Compute log likelihood between two db.\n '
from math import log
from jcvi.formats.base import DictFile
p = OptionParser(logodds.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(... | 6,346,075,636,277,798,000 | %prog logodds cnt1 cnt2
Compute log likelihood between two db. | jcvi/assembly/kmer.py | logodds | lufuhao/jcvi | python | def logodds(args):
'\n %prog logodds cnt1 cnt2\n\n Compute log likelihood between two db.\n '
from math import log
from jcvi.formats.base import DictFile
p = OptionParser(logodds.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(... |
def get_K(jfdb):
'\n Infer K from jellyfish db.\n '
j = jfdb.rsplit('_', 1)[0].rsplit('-', 1)[(- 1)]
assert (j[0] == 'K')
return int(j[1:]) | 2,435,800,455,511,185,000 | Infer K from jellyfish db. | jcvi/assembly/kmer.py | get_K | lufuhao/jcvi | python | def get_K(jfdb):
'\n \n '
j = jfdb.rsplit('_', 1)[0].rsplit('-', 1)[(- 1)]
assert (j[0] == 'K')
return int(j[1:]) |
def count(args):
'\n %prog count fastafile jf.db\n\n Run dump - jellyfish - bin - bincount in serial.\n '
from bitarray import bitarray
p = OptionParser(count.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(fastafile, jfdb) = args
... | 4,242,329,288,736,255,000 | %prog count fastafile jf.db
Run dump - jellyfish - bin - bincount in serial. | jcvi/assembly/kmer.py | count | lufuhao/jcvi | python | def count(args):
'\n %prog count fastafile jf.db\n\n Run dump - jellyfish - bin - bincount in serial.\n '
from bitarray import bitarray
p = OptionParser(count.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(fastafile, jfdb) = args
... |
def bincount(args):
'\n %prog bincount fastafile binfile\n\n Count K-mers in the bin.\n '
from bitarray import bitarray
from jcvi.formats.sizes import Sizes
p = OptionParser(bincount.__doc__)
p.add_option('-K', default=23, type='int', help='K-mer size')
p.set_outfile()
(opts, args) ... | 1,612,570,740,213,328,000 | %prog bincount fastafile binfile
Count K-mers in the bin. | jcvi/assembly/kmer.py | bincount | lufuhao/jcvi | python | def bincount(args):
'\n %prog bincount fastafile binfile\n\n Count K-mers in the bin.\n '
from bitarray import bitarray
from jcvi.formats.sizes import Sizes
p = OptionParser(bincount.__doc__)
p.add_option('-K', default=23, type='int', help='K-mer size')
p.set_outfile()
(opts, args) ... |
def bin(args):
'\n %prog bin filename filename.bin\n\n Serialize counts to bitarrays.\n '
from bitarray import bitarray
p = OptionParser(bin.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(inp, outp) = args
fp = must_open(inp)
... | -320,122,754,336,861,250 | %prog bin filename filename.bin
Serialize counts to bitarrays. | jcvi/assembly/kmer.py | bin | lufuhao/jcvi | python | def bin(args):
'\n %prog bin filename filename.bin\n\n Serialize counts to bitarrays.\n '
from bitarray import bitarray
p = OptionParser(bin.__doc__)
(opts, args) = p.parse_args(args)
if (len(args) != 2):
sys.exit((not p.print_help()))
(inp, outp) = args
fp = must_open(inp)
... |
def dump(args):
'\n %prog dump fastafile\n\n Convert FASTA sequences to list of K-mers.\n '
p = OptionParser(dump.__doc__)
p.add_option('-K', default=23, type='int', help='K-mer size')
p.set_outfile()
(opts, args) = p.parse_args(args)
if (len(args) != 1):
sys.exit((not p.print_h... | -9,024,217,095,251,740,000 | %prog dump fastafile
Convert FASTA sequences to list of K-mers. | jcvi/assembly/kmer.py | dump | lufuhao/jcvi | python | def dump(args):
'\n %prog dump fastafile\n\n Convert FASTA sequences to list of K-mers.\n '
p = OptionParser(dump.__doc__)
p.add_option('-K', default=23, type='int', help='K-mer size')
p.set_outfile()
(opts, args) = p.parse_args(args)
if (len(args) != 1):
sys.exit((not p.print_h... |
def jellyfish(args):
'\n %prog jellyfish [*.fastq|*.fasta]\n\n Run jellyfish to dump histogram to be used in kmer.histogram().\n '
from jcvi.apps.base import getfilesize
from jcvi.utils.cbook import human_size
p = OptionParser(jellyfish.__doc__)
p.add_option('-K', default=23, type='int', he... | -7,835,718,848,644,380,000 | %prog jellyfish [*.fastq|*.fasta]
Run jellyfish to dump histogram to be used in kmer.histogram(). | jcvi/assembly/kmer.py | jellyfish | lufuhao/jcvi | python | def jellyfish(args):
'\n %prog jellyfish [*.fastq|*.fasta]\n\n Run jellyfish to dump histogram to be used in kmer.histogram().\n '
from jcvi.apps.base import getfilesize
from jcvi.utils.cbook import human_size
p = OptionParser(jellyfish.__doc__)
p.add_option('-K', default=23, type='int', he... |
def merylhistogram(merylfile):
'\n Run meryl to dump histogram to be used in kmer.histogram(). The merylfile\n are the files ending in .mcidx or .mcdat.\n '
(pf, sf) = op.splitext(merylfile)
outfile = (pf + '.histogram')
if need_update(merylfile, outfile):
cmd = 'meryl -Dh -s {0}'.forma... | 4,546,519,817,128,407,000 | Run meryl to dump histogram to be used in kmer.histogram(). The merylfile
are the files ending in .mcidx or .mcdat. | jcvi/assembly/kmer.py | merylhistogram | lufuhao/jcvi | python | def merylhistogram(merylfile):
'\n Run meryl to dump histogram to be used in kmer.histogram(). The merylfile\n are the files ending in .mcidx or .mcdat.\n '
(pf, sf) = op.splitext(merylfile)
outfile = (pf + '.histogram')
if need_update(merylfile, outfile):
cmd = 'meryl -Dh -s {0}'.forma... |
def multihistogram(args):
"\n %prog multihistogram *.histogram species\n\n Plot the histogram based on a set of K-mer hisotograms. The method is based\n on Star et al.'s method (Atlantic Cod genome paper).\n "
p = OptionParser(multihistogram.__doc__)
p.add_option('--kmin', default=15, type='int'... | -2,772,674,749,330,491,400 | %prog multihistogram *.histogram species
Plot the histogram based on a set of K-mer hisotograms. The method is based
on Star et al.'s method (Atlantic Cod genome paper). | jcvi/assembly/kmer.py | multihistogram | lufuhao/jcvi | python | def multihistogram(args):
"\n %prog multihistogram *.histogram species\n\n Plot the histogram based on a set of K-mer hisotograms. The method is based\n on Star et al.'s method (Atlantic Cod genome paper).\n "
p = OptionParser(multihistogram.__doc__)
p.add_option('--kmin', default=15, type='int'... |
def histogram(args):
'\n %prog histogram meryl.histogram species K\n\n Plot the histogram based on meryl K-mer distribution, species and N are\n only used to annotate the graphic.\n '
p = OptionParser(histogram.__doc__)
p.add_option('--vmin', dest='vmin', default=1, type='int', help='minimum val... | 4,191,076,299,505,616,400 | %prog histogram meryl.histogram species K
Plot the histogram based on meryl K-mer distribution, species and N are
only used to annotate the graphic. | jcvi/assembly/kmer.py | histogram | lufuhao/jcvi | python | def histogram(args):
'\n %prog histogram meryl.histogram species K\n\n Plot the histogram based on meryl K-mer distribution, species and N are\n only used to annotate the graphic.\n '
p = OptionParser(histogram.__doc__)
p.add_option('--vmin', dest='vmin', default=1, type='int', help='minimum val... |
def analyze(self, ploidy=2, K=23, covmax=1000000):
'\n Analyze Kmer spectrum, calculations derived from\n allpathslg/src/kmers/KmerSpectra.cc\n '
from math import sqrt
data = self.data
kf_ceil = max((K for (K, c) in data))
if (kf_ceil > covmax):
exceeds = sum((1 for (K, ... | 7,798,149,655,913,767,000 | Analyze Kmer spectrum, calculations derived from
allpathslg/src/kmers/KmerSpectra.cc | jcvi/assembly/kmer.py | analyze | lufuhao/jcvi | python | def analyze(self, ploidy=2, K=23, covmax=1000000):
'\n Analyze Kmer spectrum, calculations derived from\n allpathslg/src/kmers/KmerSpectra.cc\n '
from math import sqrt
data = self.data
kf_ceil = max((K for (K, c) in data))
if (kf_ceil > covmax):
exceeds = sum((1 for (K, ... |
def __init__(self, classifier, confidence=0.0, targeted=True, learning_rate=0.01, binary_search_steps=9, max_iter=10000, beta=0.001, initial_const=0.001, batch_size=128, decision_rule='EN'):
"\n Create an ElasticNet attack instance.\n\n :param classifier: A trained model.\n :type classifier: :c... | -4,750,755,069,409,097,000 | Create an ElasticNet attack instance.
:param classifier: A trained model.
:type classifier: :class:`.Classifier`
:param confidence: Confidence of adversarial examples: a higher value produces examples that are farther
away, from the original input, but classified with higher confidence as the target class.
:typ... | art/attacks/elastic_net.py | __init__ | Viktour19/adversarial-robustness-toolbox | python | def __init__(self, classifier, confidence=0.0, targeted=True, learning_rate=0.01, binary_search_steps=9, max_iter=10000, beta=0.001, initial_const=0.001, batch_size=128, decision_rule='EN'):
"\n Create an ElasticNet attack instance.\n\n :param classifier: A trained model.\n :type classifier: :c... |
def _loss(self, x, x_adv):
'\n Compute the loss function values.\n\n :param x: An array with the original input.\n :type x: `np.ndarray`\n :param x_adv: An array with the adversarial input.\n :type x_adv: `np.ndarray`\n :return: A tuple holding the current logits, l1 distan... | -4,277,042,601,095,220,700 | Compute the loss function values.
:param x: An array with the original input.
:type x: `np.ndarray`
:param x_adv: An array with the adversarial input.
:type x_adv: `np.ndarray`
:return: A tuple holding the current logits, l1 distance, l2 distance and elastic net loss.
:rtype: `(np.ndarray, float, float, float)` | art/attacks/elastic_net.py | _loss | Viktour19/adversarial-robustness-toolbox | python | def _loss(self, x, x_adv):
'\n Compute the loss function values.\n\n :param x: An array with the original input.\n :type x: `np.ndarray`\n :param x_adv: An array with the adversarial input.\n :type x_adv: `np.ndarray`\n :return: A tuple holding the current logits, l1 distan... |
def _gradient_of_loss(self, target, x, x_adv, c):
'\n Compute the gradient of the loss function.\n\n :param target: An array with the target class (one-hot encoded).\n :type target: `np.ndarray`\n :param x: An array with the original input.\n :type x: `np.ndarray`\n :param ... | 4,549,419,303,303,440,400 | Compute the gradient of the loss function.
:param target: An array with the target class (one-hot encoded).
:type target: `np.ndarray`
:param x: An array with the original input.
:type x: `np.ndarray`
:param x_adv: An array with the adversarial input.
:type x_adv: `np.ndarray`
:param c: Weight of the loss term aiming ... | art/attacks/elastic_net.py | _gradient_of_loss | Viktour19/adversarial-robustness-toolbox | python | def _gradient_of_loss(self, target, x, x_adv, c):
'\n Compute the gradient of the loss function.\n\n :param target: An array with the target class (one-hot encoded).\n :type target: `np.ndarray`\n :param x: An array with the original input.\n :type x: `np.ndarray`\n :param ... |
def _decay_learning_rate(self, global_step, end_learning_rate, decay_steps):
'\n Applies a square-root decay to the learning rate.\n\n :param global_step: Global step to use for the decay computation.\n :type global_step: `int`\n :param end_learning_rate: The minimal end learning rate.\n... | -6,411,596,237,137,459,000 | Applies a square-root decay to the learning rate.
:param global_step: Global step to use for the decay computation.
:type global_step: `int`
:param end_learning_rate: The minimal end learning rate.
:type end_learning_rate: `float`
:param decay_steps: Number of decayed steps.
:type decay_steps: `int`
:return: The decay... | art/attacks/elastic_net.py | _decay_learning_rate | Viktour19/adversarial-robustness-toolbox | python | def _decay_learning_rate(self, global_step, end_learning_rate, decay_steps):
'\n Applies a square-root decay to the learning rate.\n\n :param global_step: Global step to use for the decay computation.\n :type global_step: `int`\n :param end_learning_rate: The minimal end learning rate.\n... |
def generate(self, x, **kwargs):
'\n Generate adversarial samples and return them in an array.\n\n :param x: An array with the original inputs to be attacked.\n :type x: `np.ndarray`\n :param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are... | 2,876,953,417,174,144,500 | Generate adversarial samples and return them in an array.
:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are the
original class labels.
:type y: `np.ndarray`
:return: An arra... | art/attacks/elastic_net.py | generate | Viktour19/adversarial-robustness-toolbox | python | def generate(self, x, **kwargs):
'\n Generate adversarial samples and return them in an array.\n\n :param x: An array with the original inputs to be attacked.\n :type x: `np.ndarray`\n :param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are... |
def _generate_batch(self, x_batch, y_batch):
'\n Run the attack on a batch of images and labels.\n\n :param x_batch: A batch of original examples.\n :type x_batch: `np.ndarray`\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch: `np.ndarray`\n :return: A batch ... | 3,505,459,309,053,157,000 | Run the attack on a batch of images and labels.
:param x_batch: A batch of original examples.
:type x_batch: `np.ndarray`
:param y_batch: A batch of targets (0-1 hot).
:type y_batch: `np.ndarray`
:return: A batch of adversarial examples.
:rtype: `np.ndarray` | art/attacks/elastic_net.py | _generate_batch | Viktour19/adversarial-robustness-toolbox | python | def _generate_batch(self, x_batch, y_batch):
'\n Run the attack on a batch of images and labels.\n\n :param x_batch: A batch of original examples.\n :type x_batch: `np.ndarray`\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch: `np.ndarray`\n :return: A batch ... |
def _update_const(self, y_batch, best_label, c, c_lower_bound, c_upper_bound):
'\n Update constants.\n\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch: `np.ndarray`\n :param best_label: A batch of best labels.\n :type best_label: `np.ndarray`\n :param c: A b... | 4,948,646,841,644,730,000 | Update constants.
:param y_batch: A batch of targets (0-1 hot).
:type y_batch: `np.ndarray`
:param best_label: A batch of best labels.
:type best_label: `np.ndarray`
:param c: A batch of constants.
:type c: `np.ndarray`
:param c_lower_bound: A batch of lower bound constants.
:type c_lower_bound: `np.ndarray`
:param c_... | art/attacks/elastic_net.py | _update_const | Viktour19/adversarial-robustness-toolbox | python | def _update_const(self, y_batch, best_label, c, c_lower_bound, c_upper_bound):
'\n Update constants.\n\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch: `np.ndarray`\n :param best_label: A batch of best labels.\n :type best_label: `np.ndarray`\n :param c: A b... |
def _generate_bss(self, x_batch, y_batch, c):
'\n Generate adversarial examples for a batch of inputs with a specific batch of constants.\n\n :param x_batch: A batch of original examples.\n :type x_batch: `np.ndarray`\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch... | 6,796,829,875,461,924,000 | Generate adversarial examples for a batch of inputs with a specific batch of constants.
:param x_batch: A batch of original examples.
:type x_batch: `np.ndarray`
:param y_batch: A batch of targets (0-1 hot).
:type y_batch: `np.ndarray`
:param c: A batch of constants.
:type c: `np.ndarray`
:return: A tuple of best elas... | art/attacks/elastic_net.py | _generate_bss | Viktour19/adversarial-robustness-toolbox | python | def _generate_bss(self, x_batch, y_batch, c):
'\n Generate adversarial examples for a batch of inputs with a specific batch of constants.\n\n :param x_batch: A batch of original examples.\n :type x_batch: `np.ndarray`\n :param y_batch: A batch of targets (0-1 hot).\n :type y_batch... |
@staticmethod
def _shrinkage_threshold(z, x, beta):
'\n Implement the element-wise projected shrinkage-threshold function.\n\n :param z: a batch of examples.\n :type z: `np.ndarray`\n :param x: a batch of original examples.\n :type x: `np.ndarray`\n :param beta: the shrink ... | -1,600,375,961,511,805,000 | Implement the element-wise projected shrinkage-threshold function.
:param z: a batch of examples.
:type z: `np.ndarray`
:param x: a batch of original examples.
:type x: `np.ndarray`
:param beta: the shrink parameter.
:type beta: `float`
:return: a shrinked version of z.
:rtype: `np.ndarray` | art/attacks/elastic_net.py | _shrinkage_threshold | Viktour19/adversarial-robustness-toolbox | python | @staticmethod
def _shrinkage_threshold(z, x, beta):
'\n Implement the element-wise projected shrinkage-threshold function.\n\n :param z: a batch of examples.\n :type z: `np.ndarray`\n :param x: a batch of original examples.\n :type x: `np.ndarray`\n :param beta: the shrink ... |
def set_params(self, **kwargs):
"\n Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.\n\n :param confidence: Confidence of adversarial examples: a higher value produces examples that are farther\n away, from the original input, but cl... | -3,578,810,808,230,838,000 | Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.
:param confidence: Confidence of adversarial examples: a higher value produces examples that are farther
away, from the original input, but classified with higher confidence as the target class.
:type confide... | art/attacks/elastic_net.py | set_params | Viktour19/adversarial-robustness-toolbox | python | def set_params(self, **kwargs):
"\n Take in a dictionary of parameters and applies attack-specific checks before saving them as attributes.\n\n :param confidence: Confidence of adversarial examples: a higher value produces examples that are farther\n away, from the original input, but cl... |
def begin_delete(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, **kwargs):
"Deletes the specified ServiceEndpoint policy definitions.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param serv... | 372,264,440,778,412,100 | Deletes the specified ServiceEndpoint policy definitions.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_endpoint_policy_name: The name of the Service Endpoint Policy.
:type service_endpoint_policy_name: str
:param service_endpoint_policy_definition_name: The ... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | begin_delete | AriZavala2/azure-sdk-for-python | python | def begin_delete(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, **kwargs):
"Deletes the specified ServiceEndpoint policy definitions.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param serv... |
def get(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, **kwargs):
'Get the specified service endpoint policy definitions from service endpoint policy.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n ... | -5,661,216,426,108,417,000 | Get the specified service endpoint policy definitions from service endpoint policy.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_endpoint_policy_name: The name of the service endpoint policy name.
:type service_endpoint_policy_name: str
:param service_endpoi... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | get | AriZavala2/azure-sdk-for-python | python | def get(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, **kwargs):
'Get the specified service endpoint policy definitions from service endpoint policy.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n ... |
def begin_create_or_update(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, **kwargs):
"Creates or updates a service endpoint policy definition in the specified service endpoint\n policy.\n\n :param resource_group_na... | 2,602,152,074,877,339,000 | Creates or updates a service endpoint policy definition in the specified service endpoint
policy.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_endpoint_policy_name: The name of the service endpoint policy.
:type service_endpoint_policy_name: str
:param servi... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | begin_create_or_update | AriZavala2/azure-sdk-for-python | python | def begin_create_or_update(self, resource_group_name, service_endpoint_policy_name, service_endpoint_policy_definition_name, service_endpoint_policy_definitions, **kwargs):
"Creates or updates a service endpoint policy definition in the specified service endpoint\n policy.\n\n :param resource_group_na... |
def list_by_resource_group(self, resource_group_name, service_endpoint_policy_name, **kwargs):
'Gets all service endpoint policy definitions in a service end point policy.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param service_endpoint_... | -7,057,014,527,002,522,000 | Gets all service endpoint policy definitions in a service end point policy.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param service_endpoint_policy_name: The name of the service endpoint policy name.
:type service_endpoint_policy_name: str
:keyword callable cls: A cust... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | list_by_resource_group | AriZavala2/azure-sdk-for-python | python | def list_by_resource_group(self, resource_group_name, service_endpoint_policy_name, **kwargs):
'Gets all service endpoint policy definitions in a service end point policy.\n\n :param resource_group_name: The name of the resource group.\n :type resource_group_name: str\n :param service_endpoint_... |
@staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
'Register args.'
return adam(parser) | -6,958,970,453,263,638,000 | Register args. | espnet/optimizer/pytorch.py | add_arguments | 18445864529/espnet | python | @staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
return adam(parser) |
@staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... | 8,811,270,693,832,894,000 | Initialize optimizer from argparse Namespace.
Args:
target: for pytorch `model.parameters()`,
for chainer `model`
args (argparse.Namespace): parsed command-line args | espnet/optimizer/pytorch.py | from_args | 18445864529/espnet | python | @staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... |
@staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
'Register args.'
return sgd(parser) | -6,548,284,684,296,972,000 | Register args. | espnet/optimizer/pytorch.py | add_arguments | 18445864529/espnet | python | @staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
return sgd(parser) |
@staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... | -1,372,828,614,147,998,000 | Initialize optimizer from argparse Namespace.
Args:
target: for pytorch `model.parameters()`,
for chainer `model`
args (argparse.Namespace): parsed command-line args | espnet/optimizer/pytorch.py | from_args | 18445864529/espnet | python | @staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... |
@staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
'Register args.'
return adadelta(parser) | 1,074,600,873,994,255,400 | Register args. | espnet/optimizer/pytorch.py | add_arguments | 18445864529/espnet | python | @staticmethod
def add_arguments(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
return adadelta(parser) |
@staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... | -835,190,803,597,173,800 | Initialize optimizer from argparse Namespace.
Args:
target: for pytorch `model.parameters()`,
for chainer `model`
args (argparse.Namespace): parsed command-line args | espnet/optimizer/pytorch.py | from_args | 18445864529/espnet | python | @staticmethod
def from_args(target, args: argparse.Namespace):
'Initialize optimizer from argparse Namespace.\n\n Args:\n target: for pytorch `model.parameters()`,\n for chainer `model`\n args (argparse.Namespace): parsed command-line args\n\n '
return torch.op... |
def save_form(self, request, form, change):
'Here we pluck out the data to create a new cloned repo.\n\n Form is an instance of NewRepoForm.\n '
name = form.cleaned_data['name']
origin_url = form.cleaned_data['origin_url']
res = ClonedRepo(name=name, origin=origin_url)
LOG.info(('Ne... | -5,554,163,953,822,890,000 | Here we pluck out the data to create a new cloned repo.
Form is an instance of NewRepoForm. | registry/admin.py | save_form | Tinche/django-bower-cache | python | def save_form(self, request, form, change):
'Here we pluck out the data to create a new cloned repo.\n\n Form is an instance of NewRepoForm.\n '
name = form.cleaned_data['name']
origin_url = form.cleaned_data['origin_url']
res = ClonedRepo(name=name, origin=origin_url)
LOG.info(('Ne... |
def get_readonly_fields(self, request, obj=None):
'Hide the origin field from editing, but not creation.'
return (('origin',) if obj else ()) | 2,997,009,665,775,063,600 | Hide the origin field from editing, but not creation. | registry/admin.py | get_readonly_fields | Tinche/django-bower-cache | python | def get_readonly_fields(self, request, obj=None):
return (('origin',) if obj else ()) |
def add_view(self, request, **kwargs):
"A custom add_view, to catch exceptions from 'save_model'.\n\n Just to be clear, this is very filthy.\n "
try:
return super(ClonedRepoAdmin, self).add_view(request, **kwargs)
except ValidationError:
return redirect(request.path) | 5,035,110,400,913,509,000 | A custom add_view, to catch exceptions from 'save_model'.
Just to be clear, this is very filthy. | registry/admin.py | add_view | Tinche/django-bower-cache | python | def add_view(self, request, **kwargs):
"A custom add_view, to catch exceptions from 'save_model'.\n\n Just to be clear, this is very filthy.\n "
try:
return super(ClonedRepoAdmin, self).add_view(request, **kwargs)
except ValidationError:
return redirect(request.path) |
def git_pull_view(self, request, repo_name):
'Perform a git pull and redirect back to the repo.'
LOG.info(('Pull requested for %s.' % repo_name))
repo = get_object_or_404(self.model, name=repo_name)
repo.pull()
self.message_user(request, ('Repo %s successfully updated.' % repo_name), level=messages.... | 1,953,967,152,983,711,000 | Perform a git pull and redirect back to the repo. | registry/admin.py | git_pull_view | Tinche/django-bower-cache | python | def git_pull_view(self, request, repo_name):
LOG.info(('Pull requested for %s.' % repo_name))
repo = get_object_or_404(self.model, name=repo_name)
repo.pull()
self.message_user(request, ('Repo %s successfully updated.' % repo_name), level=messages.SUCCESS)
return redirect('admin:registry_cloned... |
def update_all_view(self, request):
'Update all repositories and redirect back to the repo list.'
LOG.info('Total update requested.')
total_count = errors = 0
for repo in self.model.objects.all():
total_count += 1
try:
repo.pull()
except:
LOG.exception(('W... | 3,799,456,152,004,995,600 | Update all repositories and redirect back to the repo list. | registry/admin.py | update_all_view | Tinche/django-bower-cache | python | def update_all_view(self, request):
LOG.info('Total update requested.')
total_count = errors = 0
for repo in self.model.objects.all():
total_count += 1
try:
repo.pull()
except:
LOG.exception(('While updating %s.' % repo))
errors += 1
msg =... |
def clean(self):
'Validate the new repo form.\n\n Might perform a request to upstream Bower.'
cleaned_data = super(NewRepoForm, self).clean()
origin_url = cleaned_data['origin_url']
origin_source = cleaned_data['origin_source']
if ((origin_source == 'origin_url') and (not origin_url)):
... | -8,217,690,029,197,501,000 | Validate the new repo form.
Might perform a request to upstream Bower. | registry/admin.py | clean | Tinche/django-bower-cache | python | def clean(self):
'Validate the new repo form.\n\n Might perform a request to upstream Bower.'
cleaned_data = super(NewRepoForm, self).clean()
origin_url = cleaned_data['origin_url']
origin_source = cleaned_data['origin_source']
if ((origin_source == 'origin_url') and (not origin_url)):
... |
def test_postcode(self, faker, num_samples):
'https://stackoverflow.com/questions/33391412/validation-for-irish-eircode'
for _ in range(num_samples):
postcode = faker.postcode()
assert isinstance(postcode, str)
assert re.fullmatch('(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{... | 1,849,701,552,127,415,300 | https://stackoverflow.com/questions/33391412/validation-for-irish-eircode | tests/providers/test_address.py | test_postcode | Pipoline/faker | python | def test_postcode(self, faker, num_samples):
for _ in range(num_samples):
postcode = faker.postcode()
assert isinstance(postcode, str)
assert re.fullmatch('(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}$', postcode) |
def test_street_address(self, faker, num_samples):
'\n Tests street address.\n\n A street address must consist of a street name, a place type and a number, and end in a period point.\n '
for _ in range(num_samples):
address = faker.street_address()
assert (address[(- 1)] == ... | -2,341,447,547,604,299,300 | Tests street address.
A street address must consist of a street name, a place type and a number, and end in a period point. | tests/providers/test_address.py | test_street_address | Pipoline/faker | python | def test_street_address(self, faker, num_samples):
'\n Tests street address.\n\n A street address must consist of a street name, a place type and a number, and end in a period point.\n '
for _ in range(num_samples):
address = faker.street_address()
assert (address[(- 1)] == ... |
def test_street_address_with_county(self, faker, num_samples):
'Tests street address with country. A street address must be:\n - in three rows,\n - starting with a valid street address,\n - contain a valid post code,\n - contain the place name validly capitalized.\n '
for _ in... | -3,124,989,030,859,973,600 | Tests street address with country. A street address must be:
- in three rows,
- starting with a valid street address,
- contain a valid post code,
- contain the place name validly capitalized. | tests/providers/test_address.py | test_street_address_with_county | Pipoline/faker | python | def test_street_address_with_county(self, faker, num_samples):
'Tests street address with country. A street address must be:\n - in three rows,\n - starting with a valid street address,\n - contain a valid post code,\n - contain the place name validly capitalized.\n '
for _ in... |
@pytest.mark.parametrize('street_title,street_suffix,expected', [('Фрунзе', 'ул.', 'ул. Фрунзе'), ('Ставропольская', 'ул.', 'ул. Ставропольская'), ('Фрунзе', 'пр.', 'пр. Фрунзе'), ('Осенняя', 'пр.', 'пр. Осенний'), ('Гвардейская', 'пр.', 'пр. Гвардейский'), ('Рыбацкая', 'пр.', 'пр. Рыбацкий'), ('Безымянная', 'пр.', 'пр... | -6,692,898,459,401,839,000 | Test that random street names are formed correctly, given
the case of suffixes and streets that have been randomly selected. | tests/providers/test_address.py | test_street_name_lexical | Pipoline/faker | python | @pytest.mark.parametrize('street_title,street_suffix,expected', [('Фрунзе', 'ул.', 'ул. Фрунзе'), ('Ставропольская', 'ул.', 'ул. Ставропольская'), ('Фрунзе', 'пр.', 'пр. Фрунзе'), ('Осенняя', 'пр.', 'пр. Осенний'), ('Гвардейская', 'пр.', 'пр. Гвардейский'), ('Рыбацкая', 'пр.', 'пр. Рыбацкий'), ('Безымянная', 'пр.', 'пр... |
def select_plugins(session, directory: str) -> List[Plugin]:
'\n Select all plugins that should be tested in this session.\n Considers the current Python version and operating systems against the supported ones,\n as well as the user plugins selection (via the PLUGINS environment variable).\n '
asse... | -1,294,786,704,034,799,900 | Select all plugins that should be tested in this session.
Considers the current Python version and operating systems against the supported ones,
as well as the user plugins selection (via the PLUGINS environment variable). | noxfile.py | select_plugins | strx2322/hydra | python | def select_plugins(session, directory: str) -> List[Plugin]:
'\n Select all plugins that should be tested in this session.\n Considers the current Python version and operating systems against the supported ones,\n as well as the user plugins selection (via the PLUGINS environment variable).\n '
asse... |
def determine_appliers(self, label_id, version):
'Figure out which layers to apply by checking the GET args'
if ('layers' in self.request.GET.keys()):
return utils.handle_specified_layers(self.request.GET['layers'], label_id, version, self.__class__.sectional_links)
else:
layer_creator = gen... | 2,181,151,661,838,374,400 | Figure out which layers to apply by checking the GET args | regulations/views/partial.py | determine_appliers | DalavanCloud/regulations-site | python | def determine_appliers(self, label_id, version):
if ('layers' in self.request.GET.keys()):
return utils.handle_specified_layers(self.request.GET['layers'], label_id, version, self.__class__.sectional_links)
else:
layer_creator = generator.LayerCreator()
layer_creator.add_layers(gene... |
@classmethod
def snapshot_message_from_exchange(cls, msg: Dict[(str, Any)], timestamp: float, *args, **kwargs):
'\n Convert json snapshot data into standard OrderBookMessage format\n :param msg: json snapshot data from live web socket stream\n :param timestamp: timestamp attached to incoming da... | 2,630,302,331,819,362,000 | Convert json snapshot data into standard OrderBookMessage format
:param msg: json snapshot data from live web socket stream
:param timestamp: timestamp attached to incoming data
:return: BinarzOrderBookMessage | hummingbot/connector/exchange/binarz/binarz_order_book.py | snapshot_message_from_exchange | amirhosein-fasihi/hummingbot | python | @classmethod
def snapshot_message_from_exchange(cls, msg: Dict[(str, Any)], timestamp: float, *args, **kwargs):
'\n Convert json snapshot data into standard OrderBookMessage format\n :param msg: json snapshot data from live web socket stream\n :param timestamp: timestamp attached to incoming da... |
@classmethod
def snapshot_message_from_db(cls, record: RowProxy):
'\n *used for backtesting\n Convert a row of snapshot data into standard OrderBookMessage format\n :param record: a row of snapshot data from the database\n :return: BinarzBookMessage\n '
return BinarzOrderBookM... | 6,984,927,935,560,781,000 | *used for backtesting
Convert a row of snapshot data into standard OrderBookMessage format
:param record: a row of snapshot data from the database
:return: BinarzBookMessage | hummingbot/connector/exchange/binarz/binarz_order_book.py | snapshot_message_from_db | amirhosein-fasihi/hummingbot | python | @classmethod
def snapshot_message_from_db(cls, record: RowProxy):
'\n *used for backtesting\n Convert a row of snapshot data into standard OrderBookMessage format\n :param record: a row of snapshot data from the database\n :return: BinarzBookMessage\n '
return BinarzOrderBookM... |
@classmethod
def diff_message_from_exchange(cls, msg: Dict[(str, any)], timestamp: Optional[float]=None):
'\n Convert json diff data into standard OrderBookMessage format\n :param msg: json diff data from live web socket stream\n :param timestamp: timestamp attached to incoming data\n :r... | -8,485,638,870,252,996,000 | Convert json diff data into standard OrderBookMessage format
:param msg: json diff data from live web socket stream
:param timestamp: timestamp attached to incoming data
:return: BinarzOrderBookMessage | hummingbot/connector/exchange/binarz/binarz_order_book.py | diff_message_from_exchange | amirhosein-fasihi/hummingbot | python | @classmethod
def diff_message_from_exchange(cls, msg: Dict[(str, any)], timestamp: Optional[float]=None):
'\n Convert json diff data into standard OrderBookMessage format\n :param msg: json diff data from live web socket stream\n :param timestamp: timestamp attached to incoming data\n :r... |
@classmethod
def diff_message_from_db(cls, record: RowProxy):
'\n *used for backtesting\n Convert a row of diff data into standard OrderBookMessage format\n :param record: a row of diff data from the database\n :return: BinarzBookMessage\n '
return BinarzOrderBookMessage(messa... | -4,607,532,064,758,849,000 | *used for backtesting
Convert a row of diff data into standard OrderBookMessage format
:param record: a row of diff data from the database
:return: BinarzBookMessage | hummingbot/connector/exchange/binarz/binarz_order_book.py | diff_message_from_db | amirhosein-fasihi/hummingbot | python | @classmethod
def diff_message_from_db(cls, record: RowProxy):
'\n *used for backtesting\n Convert a row of diff data into standard OrderBookMessage format\n :param record: a row of diff data from the database\n :return: BinarzBookMessage\n '
return BinarzOrderBookMessage(messa... |
@classmethod
def trade_message_from_exchange(cls, msg: BinarzTrade, timestamp: Optional[float]=None):
'\n Convert a trade data into standard OrderBookMessage format\n '
msg = {'exchange_order_id': msg.order_id, 'trade_type': msg.type, 'price': msg.price, 'amount': msg.amount}
return BinarzOrde... | -265,529,715,953,605,300 | Convert a trade data into standard OrderBookMessage format | hummingbot/connector/exchange/binarz/binarz_order_book.py | trade_message_from_exchange | amirhosein-fasihi/hummingbot | python | @classmethod
def trade_message_from_exchange(cls, msg: BinarzTrade, timestamp: Optional[float]=None):
'\n \n '
msg = {'exchange_order_id': msg.order_id, 'trade_type': msg.type, 'price': msg.price, 'amount': msg.amount}
return BinarzOrderBookMessage(message_type=OrderBookMessageType.TRADE, cont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.