content stringlengths 22 815k | id int64 0 4.91M |
|---|---|
def org_repos(info):
"""
处理组织的仓库
:param info: 字典
:return: 两个列表,第一个包含字典(id,全名,url),第二个包含所用到的语言
"""
repo_info = []
languages = []
if info:
for repo in info:
temp = {"id": repo["id"], "full_name": repo["full_name"], "url": repo["url"], "language": repo["language"]}
... | 5,349,500 |
def year(yyyy_mm_dd: Union[str, datetime.date]) -> int:
"""
Extracts the year of a given date, similar to yyyy function but returns an int
>>> year('2020-05-14')
2020
"""
date, _ = _parse(yyyy_mm_dd, at_least="%Y")
return date.year | 5,349,501 |
def getTypeLevel(Type):
"""Checks whether a spectral data type is available in the endmember library.
Args:
Type: the type of spectra to select.
Returns:
level: the metadata "level" of the group for subsetting. returns 0 if not found.
"""
for i in range(4):
level = i + 1
... | 5,349,502 |
def main():
"""The main entry."""
app = wx.App(False)
frame = SuhpysisFrame(None, title='Jarry Test')
app.MainLoop() | 5,349,503 |
def construct_creator(creator: Union[dict, str], ignore_email):
"""Parse input and return an instance of Person."""
if not creator:
return None, None
if isinstance(creator, str):
person = Person.from_string(creator)
elif isinstance(creator, dict):
person = Person.from_dict(creat... | 5,349,504 |
def _encode_query(items: dict, *, mask=False) -> str:
"""Encode a dict to query string per CLI specifications."""
pairs = []
for key in sorted(items.keys()):
value = _MASK if mask and key in _MASKED_PARAMS else items[key]
item = "{}={}".format(key, _quote(value))
# Ensure 'url' goes ... | 5,349,505 |
def spatial_shape_after_conv(input_spatial_shape, kernel_size, strides, dilation, padding):
""" This function calculates the spatial shape after conv layer.
The formula is obtained from: https://www.tensorflow.org/api_docs/python/tf/nn/convolution
It should be note that current function assumes PS is d... | 5,349,506 |
def sample_partition(dependency_tensor, null_distribution,
updates=100,
initial_partition=None
):
"""
Sample partition for a multilayer network with specified interlayer dependencies
:param dependency_tensor: dependency tensor
:param null_d... | 5,349,507 |
def normalize_spaces(s: str) -> str:
"""
連続する空白を1つのスペースに置き換え、前後の空白を削除した新しい文字列を取得する。
"""
return re.sub(r'\s+', ' ', s).strip() | 5,349,508 |
def power_iter(mat_g, error_tolerance=1e-6, num_iters=100):
"""Power iteration.
Args:
mat_g: the symmetric PSD matrix.
error_tolerance: Iterative exit condition.
num_iters: Number of iterations.
Returns:
eigen vector, eigen value, num_iters
"""
mat_g_size = mat_g.shape[-1]
def _iter_condit... | 5,349,509 |
def _get_values_target_representation(
val: Union[str, Any],
target_representation: str,
conversion_type: str,
conversion_rate: float,
n_round: int,
split: bool,
input_symbol: str,
target_symbol: str,
) -> Any:
"""
Returns the value of the converted currency in the specified form... | 5,349,510 |
def GetResidues(mol, atom_list=None):
"""Create dictrionary that maps residues to atom IDs:
(res number, res name, chain id) --> [atom1 idx, atom2 idx, ...]
"""
residues = OrderedDict()
if atom_list is None:
atom_list = range(mol.GetNumAtoms())
for aid in atom_list:
res_id = G... | 5,349,511 |
def _parse_tokenize(filter_rule):
"""Tokenizer for the attribute filtering language.
Most of the single-character tokens are specified in the
_tokenize_re; however, parentheses need to be handled specially,
because they can appear inside a check string. Thankfully, those
parentheses that appear in... | 5,349,512 |
def main(n):
"""Stream the video into a Kafka producer in an infinite loop"""
topic = choose_channel(n)
video_reader = imageio.get_reader(DATA + topic + '.mp4', 'ffmpeg')
metadata = video_reader.get_meta_data()
fps = metadata['fps']
producer = KafkaProducer(bootstrap_servers='localhost:909... | 5,349,513 |
def create_huoguoml_folders(huoguoml_path: str):
"""
Create HuoguoML folders if not exist
Args:
huoguoml_path: path to the huoguoml dir
NOTE: Required for later stages, when huoguoml folder gets larger
"""
os.makedirs(huoguoml_path, exist_ok=True) | 5,349,514 |
def cli(obj, username, password, hostname, session):
""" CLI for the GAMS-Hydra application. """
obj['hostname'] = hostname
obj['username'] = username
obj['password'] = password
obj['session'] = session | 5,349,515 |
def BIC(y_pred, y, k, llf = None):
"""Bayesian Information Criterion
Args:
y_pred (array-like)
y (array-like)
k (int): number of featuers
llf (float): result of log-likelihood function
"""
n = len(y)
if llf is None:
llf = np.log(SSE(y_pred, y))
return np... | 5,349,516 |
def create_abstract_insert(table_name, row_json, return_field=None):
"""Create an abstracted raw insert psql statement for inserting a single
row of data
:param table_name: String of a table_name
:param row_json: dictionary of ingestion data
:param return_field: String of the column name to RETURNI... | 5,349,517 |
def get_childs(root_dir, is_dir=False, extension='.jpg', max_depth=0):
"""
get files or directories related root dir
:param root_dir:
:param is_dir:
:param extension:
:param max_depth:
:return:
"""
if os.path.exists(root_dir) is False:
raise FileNotFoundError("not exist dir :... | 5,349,518 |
def descsum_create(s):
"""Add a checksum to a descriptor without"""
symbols = descsum_expand(s) + [0, 0, 0, 0, 0, 0, 0, 0]
checksum = descsum_polymod(symbols) ^ 1
return s + '#' + ''.join(CHECKSUM_CHARSET[(checksum >> (5 * (7 - i))) & 31] for i in range(8)) | 5,349,519 |
def test(device):
"""
Test if read_measured_values_raw() returns the expected values.
"""
device.start_measurement()
time.sleep(1.1)
# check the read values
raw_humidity, raw_temperature, raw_voc_ticks, raw_nox_ticks = \
device.read_measured_values_raw()
# raw types
assert t... | 5,349,520 |
def _get_header(key):
"""Return message header"""
try:
return request.headers[key]
except KeyError:
abort(400, "Missing header: " + key) | 5,349,521 |
def compute_solution(primes_list, triangle_sequence):
""" Auxiliary function to compute the solution to the problem.
"""
factorise_w_primes = partial(factorise, primes=primes_list)
all_factors = vmap(factorise_w_primes)(triangle_sequence)
# number of divisors = number of possible combinations of pri... | 5,349,522 |
def key_description(character):
"""
Return the readable description for a key.
:param character: An ASCII character.
:return: Readable description for key.
"""
if "Windows" in platform.system():
for key, value in hex_keycodes.items():
if value == character:
re... | 5,349,523 |
def find_paste_config():
"""Find freezer's paste.deploy configuration file.
freezer's paste.deploy configuration file is specified in the
``[paste_deploy]`` section of the main freezer-api configuration file,
``freezer-api.conf``.
For example::
[paste_deploy]
config_file = freezer-pa... | 5,349,524 |
def combine_index(df, n1, n2):
"""將dataframe df中的股票代號與股票名稱合併
Keyword arguments:
Args:
df (pandas.DataFrame): 此dataframe含有column n1, n2
n1 (str): 股票代號
n2 (str): 股票名稱
Returns:
df (pandas.DataFrame): 此dataframe的index為「股票代號+股票名稱」
"""
return df.set_index(df[n1].st... | 5,349,525 |
def safe_get_stopwords(stopwords_language):
"""
:type stopwords_language: basestring
:rtype: list
"""
try:
return get_stopwords(stopwords_language)
except LanguageNotAvailable:
return [] | 5,349,526 |
def fetch_dataloader(types, data_dir, params):
"""
Fetches the DataLoader object for each type in types from data_dir.
Args:
types: (list) has one or more of 'train', 'val', 'test' depending on which data is required
data_dir: (string) directory containing the dataset
params: (Param... | 5,349,527 |
def setup_mock_device(mock_device):
"""Prepare mock ONVIFDevice."""
mock_device.async_setup = AsyncMock(return_value=True)
mock_device.available = True
mock_device.name = NAME
mock_device.info = DeviceInfo(
MANUFACTURER,
MODEL,
FIRMWARE_VERSION,
SERIAL_NUMBER,
... | 5,349,528 |
def execution_environment(tmp_path: Path, config_yaml: Path, request: FixtureRequest) -> Generator[Path, None, None]:
"""Move to temporary directory with ./config.yml and ./output/ directory."""
copyfile(config_yaml, tmp_path / "config.yml")
(tmp_path / "output").mkdir()
os.chdir(tmp_path)
yield tmp... | 5,349,529 |
def hap_cli():
"""
Work with Haplotigs
"""
pass | 5,349,530 |
def join(*args):
"""Join multiple path - join('c:', 'pp', 'c.txt') -> 'c:\pp\c.txt'"""
assert len(args) >= 2
ret_arg = args[0]
for arg in args[1:]:
ret_arg = os.path.join(ret_arg, arg)
return ret_arg | 5,349,531 |
def for_loop(*args):
"""
Creates a for-loop container to be executed on the server
Parameters
----------
args : :class:`sasoptpy.abstract.Set` objects
Any number of :class:`sasoptpy.abstract.Set` objects can be given
Returns
-------
set_iterator : :class:`sasoptpy.abstract.SetI... | 5,349,532 |
def test_get_model_components_and_override_from_model_template_single():
"""Tests `get_model_components_and_override_from_model_template` for single model template"""
sst = SimpleSilverkiteTemplate()
model_components = sst._SimpleSilverkiteTemplate__get_model_components_and_override_from_model_template(
... | 5,349,533 |
def branches(directory=None, verbose=False):
"""Show current branch points"""
config = migrate_manager.migrate_config.migrate.get_config(directory)
command.branches(config, verbose=verbose) | 5,349,534 |
def test_lugaro_label_parser(val):
"""Parse a label."""
label = val[0]
expected = val[1]
assert lugaro.label_parser(label) == expected | 5,349,535 |
def renyientropy(px,alpha=1,logbase=2,measure='R'):
"""
Renyi's generalized entropy
Parameters
----------
px : array-like
Discrete probability distribution of random variable X. Note that
px is assumed to be a proper probability distribution.
logbase : int or np.e, optional
... | 5,349,536 |
def convert(digits, base1, base2):
"""Convert given digits in base1 to digits in base2.
digits: str -- string representation of number (in base1)
base1: int -- base of given number
base2: int -- base to convert to
return: str -- string representation of number (in base2)"""
# Handle up to base 3... | 5,349,537 |
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Fast.com sensor."""
data = SpeedtestData(hass, config)
sensor = SpeedtestSensor(data)
add_devices([sensor])
def update(call=None):
"""Update service for manual updates."""
data.update(dt_util.now())
... | 5,349,538 |
def reset_sensors():
"""
Resets sensors
"""
if DEBUG:
print("\tResets all gopigo sensors")
dexgp = gopigo3.GoPiGo3()
dexgp.reset_all() | 5,349,539 |
def visualizeVoxels(voxelGrids, frameRate=10):
"""
Args:
voxelGrid (tensor): 4D tensor indicating (batchSize x zSize x ySize x xSize)
frameRate (float) : rate at which the plot should update (in Hz)
"""
batchSize = voxelGrids.shape[0]
print("Batch Size = ",batchSize)
# batchSize ... | 5,349,540 |
def h(b, W ,X):
"""
This function implments the softmax regression hypothesis function
Argument:
b -- bias
W -- predictive weight matrix
X -- data matrix of size (numbers_examples, number_predictors)
Returns:
softmax(XW + b)
"""
return softmax( (X @ W) + b) | 5,349,541 |
def get_random_points(N):
"""
- Takes number of parameters N
- Returns tuple (x1,x2), where x1 and x2 are vectors
"""
x1 = np.random.uniform(-1,1,N)
x2 = np.random.uniform(-1,1,N)
return (x1,x2) | 5,349,542 |
def n_bit_color(clk, din, vga_signals, vga_ports):
"""
Maps n bit input, din, to n bit vga color ports
Ex: din=10010101, r=100, g=101, b=01
"""
blu = len(vga_ports.blu)
grn = len(vga_ports.grn) + blu
red = len(vga_ports.red) + grn
assert len(din) == red
@always(clk.posedge)
... | 5,349,543 |
def point_cloud_transform_net(point_cloud: nn.Variable, train: bool) -> Tuple[nn.Variable, Dict[str, nn.Variable]]:
"""T net, create transformation matrix for point cloud
Args:
point_cloud (nn.Variable): point cloud, shape(batch, number of points, 3)
train (bool): training flag
Returns:
... | 5,349,544 |
def assert_array_less(x: numpy.float64, y: numpy.float64, err_msg: str):
"""
usage.scipy: 2
"""
... | 5,349,545 |
def diffie_hellman_server(p, g, public_key_pem):
"""
Function used to apply the Diffie Hellman algorithm in the server.
It calculates the private and public components of server.
:param p: Shared parameter
:param g: Shared parameter
:param public_key_pem: Public component of client
:return: The private compon... | 5,349,546 |
def posix_getpgid(space, pid):
""" posix_getpgid - Get process group id for job control """
try:
return space.newint(os.getpgid(pid))
except OSError, e:
space.set_errno(e.errno)
return space.newbool(False)
except OverflowError:
return space.newbool(False) | 5,349,547 |
def test_list_double_length_4_nistxml_sv_iv_list_double_length_5_4(mode, save_output, output_format):
"""
Type list/double is restricted by facet length with value 10.
"""
assert_bindings(
schema="nistData/list/double/Schema+Instance/NISTSchema-SV-IV-list-double-length-5.xsd",
instance="... | 5,349,548 |
def on_display_disconnected():
"""Shortcut for registering handlers for ACTION_DISPLAY_DISCONNECTED events.
Functions decorated with this decorator will be called when push2-python loses connection with the Push2
display. It will have the following positional arguments:
* Push2 object instance
... | 5,349,549 |
def parse_received_data(blockpage_matcher: BlockpageMatcher,
received: Union[str, Dict[str,
Any]], anomaly: bool) -> Row:
"""Parse a received field into a section of a row to write to bigquery.
Args:
blockpage_matcher: Matcher object
... | 5,349,550 |
def change_cwd(change_to):
"""A context manager to temporarily change current working directory
:param change_to: Path to change current working directory to
:type change_to: ``str``
"""
curdir = os.getcwd()
os.chdir(change_to)
try:
yield
finally:
os.chdir(curdir) | 5,349,551 |
def get_filters():
""" Returns sidebar filters """
filters = {
'organisations': Organisation.objects.all(),
'topics': Topic.objects.all(),
'licenses': License.objects.all(),
'formats': Format.objects.all()
}
return filters | 5,349,552 |
def irdl_op_builder(cls: typing.Type[OpT], operands: List,
operand_defs: List[Tuple[str, OperandDef]],
res_types: List, res_defs: List[Tuple[str, ResultDef]],
attributes: typing.Dict[str, typing.Any],
attr_defs: typing.Dict[str, AttributeDe... | 5,349,553 |
def _listify(single: st.SearchStrategy) -> st.SearchStrategy:
"""
Put the result of `single` strategy into a list
(all strategies should return lists)
"""
@st.composite
def listify_(draw):
return [draw(single)]
strategy = listify_()
strategy.function.__name__ = f"listified<{repr... | 5,349,554 |
def get_text(selector):
"""
Type the keys specified into the element, or the currently active element.
"""
if not get_instance():
raise Exception("You need to start a browser first with open_browser()")
return get_text_g(get_instance(), selector) | 5,349,555 |
def _eps(code, version, file_or_path, scale=1, module_color=(0, 0, 0),
background=None, quiet_zone=4):
"""This function writes the QR code out as an EPS document. The
code is drawn by drawing only the modules corresponding to a 1. They
are drawn using a line, such that contiguous modules in a row
... | 5,349,556 |
def test_generate(
stemming_file, lexicon_file, test_file,
global_tags=None, debug=False
):
"""
generates all the forms in the test_file using the lexicon_file and
stemming_file and outputs any discrepancies (or everything if debug on)
"""
ginflexion = GreekInflexion(stemming_file, lexicon_... | 5,349,557 |
def _group_energy_terms(ener_xvg):
"""Parse energy.xvg file to extract and group the energy terms in a dict. """
with open(ener_xvg) as f:
all_lines = f.readlines()
energy_types = [line.split('"')[1] for line in all_lines if line[:3] == '@ s']
energy_values = [float(x) * units.kilojoule_per_mole... | 5,349,558 |
def test_list_boolean_pattern_3_nistxml_sv_iv_list_boolean_pattern_4_5(mode, save_output, output_format):
"""
Type list/boolean is restricted by facet pattern with value [1]{1}
false [0]{1} true true [0]{1}.
"""
assert_bindings(
schema="nistData/list/boolean/Schema+Instance/NISTSchema-SV-IV-... | 5,349,559 |
def get_packager_targets(
targets: List[Target], connections: Dict[str, Connection], remote_api: ConnectionClient
) -> List[PackagerTarget]:
"""
Build targets for calling packager. Fetch and base64 decode connections by names using local manifest and
ODAHU connections API
:param targets: Targets... | 5,349,560 |
def test_name2idfobject():
"""py.test for name2idfobject"""
idf = IDF(StringIO(""))
plantloopname = "plantloopname"
branchname = "branchname"
pumpname = "pumpname"
zonename = "zonename"
plantloop = idf.newidfobject('PlantLoop',
Name=plantloopname,
Pla... | 5,349,561 |
def export_documents(documents, csvfilepath):
"""
Writes the documents data in `documents` to the CSV file at `csvfilepath`.
"""
with open(csvfilepath, "w") as csv_file:
csvwriter = csv.DictWriter(csv_file, CURRICULUM_DOCUMENT_HEADER_V0)
csvwriter.writeheader()
for document in do... | 5,349,562 |
def create_installer_repo():
"""Execute setup.sh corresponding to contrail-installer-packages in
all nodes
"""
execute("create_installer_repo_node", env.host_string) | 5,349,563 |
def elina_texpr0_permute_dimensions(texpr2, dimperm):
"""
Permute dimensions of an ElinaTexpr0 following the semantics of an ElinaDimperm.
Parameters
----------
texpr2 : ElinaTexpr0Ptr
Pointer to the ElinaTexpr0 which dimensions we want to permute.
dimperm : ElinaDimpermPtr
Poin... | 5,349,564 |
def rgb(red: int, green: int, blue: int, background: bool = False) -> Chalk:
"""Generate a new truecolor chalk from an RGB tuple.
Args:
red (int):
The intensity of red (0-255).
green (int):
The intensity of green (0-255).
blue (int):
The intensity of ... | 5,349,565 |
def add_log_arguments(parser: argparse.ArgumentParser):
"""Adds arguments for setting up the logger to the given argument parser.
Arguments added:
- log_name
- log_filename
- log_dir
- log_level
Params:
- parser (argparse.ArgumentParser): The argument parser to which to add t... | 5,349,566 |
def first(x: pd.Series) -> pd.Series:
"""
First value of series
:param x: time series
:return: time series of first value
**Usage**
Return series with first value of `X` for all dates:
:math:`R_t = X_0`
where :math:`X_0` is the first value in the series
**Examples**
Last v... | 5,349,567 |
def simulate(iterations, graph_generator, graph_params, n_nodes, beta, rho, steps, n_infected_init, vacc=None):
"""Perform `iterations` simulations and compute averages. If vacc is not
None, run the simulation using the SIRV model, otherwise use SIR."""
# Initialize arrays for computing averages over simul... | 5,349,568 |
def check_collections_are_supported(saved_model_handler, supported):
"""Checks that SavedModelHandler only uses supported collections."""
for meta_graph in saved_model_handler.meta_graphs:
used_collection_keys = set(meta_graph.collection_def.keys())
unsupported = used_collection_keys - supported
if unsu... | 5,349,569 |
def lookup_location():
"""
Geolocation lookup of current position.
Determines latitude and longitude coordinates of the system's position
using the ipinfo.io service.
Returns:
Tuple (lat, lon) containing the latitude and longitude coordinates
associated with the IP from which the r... | 5,349,570 |
def _str_or_none(value):
"""Helper: serialize value to JSON string."""
if value is not None:
return str(value) | 5,349,571 |
def archive_results(filename,results,algo,script):
"""
:type algo: basestring
:type script: basestring
:type results: DataFrame
"""
#assert results == pd.DataFrame
now=time.time()[0:5]
dirname='../archive'
subdirfmt='%4d-%02d-%02d-%02d-%02d'
subdir=subdirfmt %now
if not os.pa... | 5,349,572 |
def cleanup():
"""
Clean up Environmental Variable for enable before and after tests
"""
if XRAY_ENABLED_KEY in os.environ:
del os.environ[XRAY_ENABLED_KEY]
yield
if XRAY_ENABLED_KEY in os.environ:
del os.environ[XRAY_ENABLED_KEY]
global_sdk_config.set_sdk_enabled(True) | 5,349,573 |
def test_matches_regex():
"""Test matches_regex validator."""
schema = vol.Schema(cv.matches_regex(".*uiae.*"))
with pytest.raises(vol.Invalid):
schema(1.0)
with pytest.raises(vol.Invalid):
schema(" nrtd ")
test_str = "This is a test including uiae."
assert schema(test_str)... | 5,349,574 |
def create_song_graph_from_songs(songs: list[Song],
parent_graph: song_graph.SongGraph = None,
year_separation: int = 10) -> song_graph.SongGraph:
"""Create and return a song graph from a list of songs.
(Optional) Add a parent graph from a large... | 5,349,575 |
def convert(secs):
"""Takes a time in seconds and converts to min:sec:msec"""
mins = int(secs // 60)
secs %= 60
msecs = int(round(((secs - int(secs)) * 1000)))
secs = int(secs)
return f'{mins} mins, {secs} secs, {msecs} msecs' | 5,349,576 |
def from_data(symbols, key_matrix, name_matrix, one_indexed=False):
""" z-matrix constructor
:param symbols: atomic symbols
:type symbols: tuple[str]
:param key_matrix: key/index columns of the z-matrix, zero-indexed
:type key_matrix: tuple[tuple[float, float or None, float or None]]
:param nam... | 5,349,577 |
def should_drop_from_right_deck(n_left: int, n_right:int, seed: int=None) -> bool:
"""
Determine whether we drop a card from the right or left sub-deck.
Either `n_left` or `n_right` (or both) must be greater than zero.
:param n_left: the number of cards in the left sub-deck.
:param n_right: the nu... | 5,349,578 |
def which(program):
"""
Locate an executable binary's full path by its name.
:param str program: The executable's name.
:return: The full path to the executable.
:rtype: str
"""
is_exe = lambda fpath: (os.path.isfile(fpath) and os.access(fpath, os.X_OK))
for path in os.environ['PATH'].split(os.pathsep):
path... | 5,349,579 |
def EXPOSED(mu=1.0):
"""
matrix of exposed sites
Parameters
----------
mu: rate
"""
pis = np.array([0.088367,0.078147,0.047163,0.087976,0.004517,0.058526,0.128039,0.056993,0.024856,0.025277,0.045202,0.094639,0.012338,0.016158,0.060124,0.055346,0.051290,0.006771,0.021554,0.036718])
... | 5,349,580 |
async def rename_conflicting_targets(
ptgts: PutativeTargets, all_existing_tgts: AllUnexpandedTargets
) -> UniquelyNamedPutativeTargets:
"""Ensure that no target addresses collide."""
existing_addrs: set[str] = {tgt.address.spec for tgt in all_existing_tgts}
uniquely_named_putative_targets: list[Putativ... | 5,349,581 |
def get_time_and_time():
"""
Get the current date and time and speak it
"""
current_time = datetime.datetime.now().strftime("%d %B %Y %H:%M:%S")
speak("Current date is ")
speak(current_time) | 5,349,582 |
def select(filename):
"""
Выбрать человека по фамилии.
"""
people = load_people(filename)
who = input('Кого ищем?: ')
count = 0
line = '+-{}-+-{}-+-{}-+-{}-+'.format(
'-' * 4,
'-' * 30,
'-' * 20,
'-' * 20
)
print(line)
print(
'| {:^4} | {:^... | 5,349,583 |
def outer2D(v1, v2):
"""Calculates the magnitude of the outer product of two 2D vectors, v1 and v2"""
return v1[0]*v2[1] - v1[1]*v2[0] | 5,349,584 |
def get_job_details(jobId=None):
"""
Returns information about a job. Used for custom actions only.
See also: AWS API Documentation
Exceptions
:example: response = client.get_job_details(
jobId='string'
)
:type jobId: string
:param jobId: [REQUIRED]\nThe uniqu... | 5,349,585 |
def get_item_indent(item: Union[int, str]) -> Union[int, None]:
"""Gets the item's indent.
Returns:
indent as a int or None
"""
return internal_dpg.get_item_configuration(item)["indent"] | 5,349,586 |
def test_7_custom_docker_lines_predict():
"""Check that setup.py dockerlines works as expected for prediction"""
# Build the distribution without building the image
code = baklava.predict(example('7-custom-docker-lines'), ['--nobuild'])
assert code == 0
test_7_build_and_check() | 5,349,587 |
def V_RSJ_asym(i, ic_pos, ic_neg, rn, io, vo):
"""Return voltage with asymmetric Ic's in RSJ model"""
if ic_pos < 0 or ic_neg > 0 or rn < 0:
#or abs(ic_neg/ic_pos) > 1.2 or abs(ic_pos/ic_neg) > 1.2 :
# set boundaries for fitting
#pass
v = 1e10
else:
v = np.zeros(len(i... | 5,349,588 |
def h2_gas_costs(pipe_dist=-102.75, truck_dist=-106.0, pipeline=True, max_pipeline_dist=2000):
"""Calculates the transport cost of H2 gas. Requires as input the distance that H2 will be piped and
trucked."""
if max_pipeline_dist > pipe_dist > 400:
pipe = 0.0004 * pipe_dist + 0.0424
elif p... | 5,349,589 |
def number_to_words(input_: Union[int, str], capitalize: bool = False) -> str:
"""Converts integer version of a number into words.
Args:
input_: Takes the integer version of a number as an argument.
capitalize: Boolean flag to capitalize the first letter.
Returns:
str:
Stri... | 5,349,590 |
def get_size_reduction_by_cropping(analyzer: DatasetAnalyzer) -> Dict[str, Dict]:
"""
Compute all size reductions of each case
Args:
analyzer: analzer which calls this property
Returns:
Dict: computed size reductions
`size_reductions`: dictionary with each case id a... | 5,349,591 |
def getProxyFile(path):
"""
Opens a text file and returns the contents with any setting of a certificate file
replaced with the mitmproxy certificate.
"""
with open(path, "r") as fd:
contents = fd.read()
certReferences = re.findall("setcertificatesfile\(.*\)", contents, re.IGNORECASE... | 5,349,592 |
def ceph_version(ctx, package):
"""Commands related to fetching of Ceph version."""
ctx.obj["packages"] = sorted(set(package)) | 5,349,593 |
def bytes_filesize_to_readable_str(bytes_filesize: int) -> str:
"""Convert bytes integer to kilobyte/megabyte/gigabyte/terabyte equivalent string"""
if bytes_filesize < 1024:
return "{} B"
num = float(bytes_filesize)
for unit in ["B", "KB", "MB", "GB"]:
if abs(num) < 1024.0:
... | 5,349,594 |
def braf_mane_data():
"""Create test fixture for BRAF MANE data."""
return {
"#NCBI_GeneID": "GeneID:673",
"Ensembl_Gene": "ENSG00000157764.14",
"HGNC_ID": "HGNC:1097",
"symbol": "BRAF",
"name": "B-Raf proto-oncogene, serine/threonine kinase",
"RefSeq_nuc": "NM_00... | 5,349,595 |
def get_decopath_genesets(decopath_ontology, gmt_dir: str):
"""Generate DecoPath gene sets with super pathways."""
concatenated_genesets_dict = {}
dc_mapping = defaultdict(list)
if not os.path.isdir(gmt_dir):
make_geneset_dir()
super_pathway_mappings, ontology_df = get_equivalent_pathway_d... | 5,349,596 |
def rename_state_dict_keys(source, key_transformation, target=None):
"""
source -> Path to the saved state dict.
key_transformation -> Function that accepts the old key names of the state
dict as the only argument and returns the new key name.
target (optional) -> ... | 5,349,597 |
def test_iot_get_raci_default_email(monkeypatch):
"""
Scenario: checking the responsiblie email is the default one specified in IOT_CONFIG
Given
- A device with an IoT Vulnerability
When
- Calculating the RACI model result
Then
- Ensure the r_email is the default email in IOT_CONFIG
... | 5,349,598 |
def import_class(path):
"""
Import a class from a dot-delimited module path. Accepts both dot and
colon seperators for the class portion of the path.
ex::
import_class('package.module.ClassName')
or
import_class('package.module:ClassName')
"""
if ':' in path:
m... | 5,349,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.