content stringlengths 22 815k | id int64 0 4.91M |
|---|---|
def test_csi_snapshot_with_invalid_param(client, volume_name): # NOQA
"""
Context:
After deploy the CSI snapshot CRDs, Controller at
https://longhorn.io/docs/1.2.3/snapshots-and-backups/
csi-snapshot-support/enable-csi-snapshot-support/
Create VolumeSnapshotClass with type=invalid
- inva... | 5,324,100 |
def ScreenToMouse(pt):
"""Convert a value in screen coordinates to mouse coordinates.
Mouse coordinates are specified as a percentage of screen dimensions,
normalized to 16 bits. 0 represents the far left/top of the screen,
65535 represents the far right/bottom. This function assumes that
the size of the s... | 5,324,101 |
def triadic_closure_algorithm():
"""
How to do triadic closure.
"""
ans = """
I would suggest the following strategy:
1. Pick a node
1. For every pair of neighbors:
1. If neighbors are not connected,
then this is a potential triangle to close.
This strategy gives you potential triadic closures... | 5,324,102 |
def export_reaction_subsystem_and_pathways(model, csv_fn):
"""
Use pandas to write a csv-file which can be used to curate the subsystem
annotation. The csv-file is written with the following columns:
Reaction ID, Reaction name, KEGG ID, Biocyc-annotation,
KEGG Subsystem, KEGG pathway, Subsyste... | 5,324,103 |
def _stat_to_tarinfo(
base_path: str, arch_path: str, *, umask: Optional[int] = None, follow_link=True
) -> tarfile.TarInfo:
"""
Convert a stat_result into a TarInfo structure.
"""
tarinfo = tarfile.TarInfo()
if follow_link:
statres = os.stat(os.path.join(base_path, arch_path))
else:... | 5,324,104 |
def parsed_args_gen():
"""Returns a function which creates an emulated parsed_args from kwargs
"""
def generator(**kwargs):
pdict = {}
for k, v in kwargs.items():
pdict[k] = v
return AttrDict(pdict)
return generator | 5,324,105 |
def floordiv(a, b):
"""Compute the floordiv of two expressions.
Parameters
----------
a : PrimExpr
The left hand operand
b : PrimExpr
The right hand operand
Returns
-------
res : PrimExpr
The result expression.
"""
return _ffi_api._OpFloorDiv(a, b) | 5,324,106 |
def optional(converter: typing.Callable) -> typing.Any:
"""
A modified version of attrs optional decorator that supports both `None` and `MISSING`
Type annotations will be inferred from the wrapped converter's, if it
has any.
args:
converter: The convertor that is used for the non-None or ... | 5,324,107 |
def convert_symbol(mpl_symbol):
"""Convert mpl marker symbol to plotly symbol and return symbol."""
if isinstance(mpl_symbol, list):
symbol = list()
for s in mpl_symbol:
symbol += [convert_symbol(s)]
return symbol
elif mpl_symbol in SYMBOL_MAP:
return SYMBOL_MAP[m... | 5,324,108 |
def remove_none_dict(input_dict: Dict) -> Dict:
"""
removes all none values from a dict
:param input_dict: any dictionary in the world is OK
:return: same dictionary but without None values
"""
return {key: value for key, value in input_dict.items() if value is not None} | 5,324,109 |
def get_host(request, host_id, segment_id):
"""return single host """
return openstack_connection(request).get_host(host_id, segment_id) | 5,324,110 |
def object_main():
"""OBJECT DETECTION APP"""
#Favicon
favpath=os.path.join(os.path.dirname( __file__ ),'images','icons8-coronavirus-16.png')
img1=Image.open(favpath)
#st.set_page_config(layout='wide')
st.set_page_config(layout='wide',page_title='Object detection',page_icon=img1,i... | 5,324,111 |
def _GetAttachedDevices(blacklist_file, test_device):
"""Get all attached devices.
Args:
test_device: Name of a specific device to use.
Returns:
A list of attached devices.
"""
blacklist = (device_blacklist.Blacklist(blacklist_file)
if blacklist_file
else None)
attac... | 5,324,112 |
def li_dong_2016_load_uy_profiles():
""" Load and return the y-velocity profiles (digitized from Fig. 4b).
Returns
-------
numpy.ndarray
y positions as a 1D array of floats.
numpy.ndarray
y-velocity (plus x position) as a 1D array of floats.
"""
filepath = DATADIR / 'li_don... | 5,324,113 |
def msg_queue_mode(params):
"""
Generate outgoing messages for `queue_mode_...` commands. The supported option is ``set``.
Parameters
----------
params : list
List of parameters of the command. The first two elements of the list are expected to
be ``mode`` and ``set`` keywords.
... | 5,324,114 |
def read_tiff(path, pages=None):
"""
Reads in a tiff stack
:param path: Full path to file
:param pages: list or numpy array of pages to load
:return: height x width x num_pages array of image files
"""
# Get number of requested pages
if pages is None:
num_pages = 1
elif type... | 5,324,115 |
def parse_file_buffer_to_seldon_request(file):
"""
Reads file buffer and parse to seldon request.
Parameters
----------
file : dict
Spooled temporary file.
Returns
-------
dict
Seldon API request
Raises
------
BadRequest
When `file` has no header.
... | 5,324,116 |
def is_pro():
"""Check if working in PRO"""
return os.environ.get("VTASKS_ENV", "False") == "True" | 5,324,117 |
def test_get_invalid_chunks(harness):
"""
Attempts:
requesting data with invalid chunk numbers, which are:
- 0 as numbering start with 1
- chunk count + 1 (or any more) as it exceeds maximum no of chunks
requesting data with invalid rxID:
- rxID != current rxID transfer
"""
... | 5,324,118 |
def recursive_file_discover(folder: str) -> tuple:
"""Generator based approach to discovering files in the specified folder
Args:
folder (str): The folder to search in
Yields:
tuple: The root path as the first element, and a list of the files
"""
for root, dirs, files in os... | 5,324,119 |
def test_get_no_session(
resource_config: dict[str, str], static_files: "Path", requests_mock: "Mocker"
) -> None:
"""Test the `get()` method - session is `None`."""
from optimade.adapters import Structure
from oteapi_optimade.models.strategies.resource import OPTIMADEResourceSession
from oteapi_op... | 5,324,120 |
def load(data_dir, config, use_feature_transform=False, numeric=False, categorical=False):
"""
Load specific dataset.
Args:
data_dir (str): path to the dataset directory.
config (dict): general dict with settings.
use_feature_transform (bool): apply dense feature transform or not
... | 5,324,121 |
def generate_computer_vis_task(config, logger, device, data_dir):
"""Generate a computer vision datahandler.
Args:
config: Command-line arguments.
logger: The logger.
device: The cuda device.
data_dir (str): The data directory.
Returns:
(....): See docstring of func... | 5,324,122 |
def setenv():
"""set some basic env pargs"""
global CIN
if sys.version > '3':
CIN = input
else:
CIN = raw_input | 5,324,123 |
def create(client, spec: str, namespace: str = "default", timeout=100):
"""Create a CronJob.
:batch_v1_api: The Batch V1 API object.
:spec: A valid CronJob YAML manifest.
:namespace: The namespace of the CronJob.
:timeout: Timeout in seconds to wait for object creation/modification
:returns: T... | 5,324,124 |
def pick_projects(directory):
"""
Finds all subdirectories in directory containing a .json file
:param directory: string containing directory of subdirectories to search
:return: list projects found under the given directory
"""
ext = '.json'
subs = [x[0] for x in os.walk(directory)]
pro... | 5,324,125 |
def get_expanded_types(types, type_hierarchy):
"""Expands a set of types with both more specific and more generic types
(i.e., all super-types and sub-types)."""
expanded_types = set()
for type in types:
# Adding all supertypes.
expanded_types.update(get_type_path(type, type_hierarchy))
... | 5,324,126 |
def render(template, **kwargs):
"""Render a Jinja2 template.
Parameters
----------
template : str
Name of the template file (without '.template' suffix). It must be
located in the directory 'pywrap/template_data'.
kwargs : dict
Template arguments.
Returns
-------
... | 5,324,127 |
def test_get_value_repr():
"""
Тест утилиты get_value_repr()
"""
v1 = 12345
v1_repr = '12345'
assert get_value_repr(v1) == v1_repr
v2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
v2_repr = '[1, 2, 3, 4, 5, 6, 7, 8, 9...]'
assert get_value_repr(v2) == v2_repr | 5,324,128 |
def wait_for_user_credentials():
"""
Although the key creation via IAM immediately returns credentials, it takes a little time
(on the order of ~10s) before the key is propagated widely enough to allow it to be used in an
sts:AssumeRole call. Unfortunately, there isn't a good way to test for the propaga... | 5,324,129 |
def create_clean_db():
"""
Use from a python shell to create a fresh database.
"""
with hnp.test_request_context():
db.create_all()
# Creating superuser entry.
superuser = user_datastore.create_user(
email=hnp.config.get('SUPERUSER_EMAIL'),
passwor... | 5,324,130 |
def exceptor():
"""
This function just raises an exception.
:return: None
"""
# Raise an exception with the raise statement. Try raising different exceptions, to see what the effects on the
# try-except-else block in this file. These three exceptions are all built-in exceptions in Python. M... | 5,324,131 |
def main(files, **kwargs):
"""Generate or check SHA3-512."""
from hashlib import sha3_512 as H
script_main(H(), files, **kwargs) | 5,324,132 |
def inject_where(builder):
"""
helper function to append to the query the generated where clause
:param builder: the current builder
:return:
"""
query = builder.v.query
if callable(query):
return builder
lower = query.lower()
where = lower.find(' where ')
before = -1
for before_q in [' group ... | 5,324,133 |
def loadCPT(path):
"""A function that loads a .cpt file and converts it into a colormap for the colorbar.
This code was adapted from the GEONETClass Tutorial written by Diego Souza, retrieved 18 July 2019.
https://geonetcast.wordpress.com/2017/06/02/geonetclass-manipulating-goes-16-data-with-python-pa... | 5,324,134 |
def main():
"""
The main function to execute upon call.
Returns
-------
int
returns integer 0 for safe executions.
"""
print("Program to find the character from an input ASCII value.")
ascii_val = int(input("Enter ASCII value to find character: "))
print("... | 5,324,135 |
def get_random_greeting():
"""
Return random greeting message.
"""
return random.choice(GREETINGS) | 5,324,136 |
def dyad_completion(w):
""" Return the dyadic completion of ``w``.
Return ``w`` if ``w`` is already dyadic.
We assume the input is a tuple of nonnegative Fractions or integers which sum to 1.
Examples
--------
>>> w = (Fraction(1,3), Fraction(1,3), Fraction(1, 3))
>>> dyad_complet... | 5,324,137 |
def create_pv_string_points(x_coord: float,
y_coord: float,
string_width: float,
string_height: float
) -> [Polygon, np.ndarray]:
"""
:param x_coord:
:param y_coord:
:param string_width:
... | 5,324,138 |
def phasor(H):
"""
Caculate phasor values from given histogram
g = 1 / N * sum(H * cos(f))
s = 1 / N * sum(H * sin(f))
===========================================================================
Input Meaning
---------- ---------------------------------------------------------------
... | 5,324,139 |
def if_stmt(cond, body, orelse):
"""Functional form of an if statement.
Args:
cond: Boolean.
body: Callable with no arguments, and outputs of the positive (if) branch
as return type.
orelse: Callable with no arguments, and outputs of the negative (else)
branch as return type.
Returns... | 5,324,140 |
def download_file(save_dir, filename, url, md5=None):
"""
Download the file from the url to specified directory.
Check md5 value when the file is exists, if the md5 value is the same as the existed file, just use
the older file, if not, will download the file from the url.
Args:
save_dir(... | 5,324,141 |
def load_db(DB_Filename, ValueType, ValueColumnIdx, KeyColumnIdx):
"""Loads a database contained in file 'DB_Filename'. Creates a python dictionary
that maps from a string (contained in column KeyColumnIdx) to a number set
or a single number (contained in column ValueColumnIdx).
NOTE: The 'key... | 5,324,142 |
def insert_tables(cur, conn):
"""
Description: This function triggers the transform and load process.
Arguments:
cur: the cursor object
conn: object of the connection to the database
Returns:
None
"""
try:
for query in insert_table_queries:
... | 5,324,143 |
def createFoodObject(dataset, row):
"""
Create food URI and triples related to food properties
"""
food_onto_term = str(row['Food Ontology Term'])
food_label = row['Food']
food_type = row['NEW Food Type']
food_amount = row['NEW Food Matrix']
food_source = food_amount.split('\n')[0].repla... | 5,324,144 |
def business():
""" RESTful CRUD controller """
def rheader_table(r):
if r.record:
return TABLE( TR( TH("%s: %s" % (T("Name"),
r.record.business_name)),
TH("%s: %s %s" % (T("Address"),
... | 5,324,145 |
def points_from_svg(svg_file_path):
""" Takes a SVG file as an input and returns a list of points in the complex plane from its path. """
# Read SVG into a list of curves.
paths, attributes = svg2paths(svg_file_path)
curves = paths[0]
# Get a list of the coordinates from each curve.
# Coordina... | 5,324,146 |
def cluster_mols(
mols: List[Chem.rdchem.Mol],
cutoff: float = 0.2,
feature_fn: Callable = None,
n_jobs: Optional[int] = 1,
):
"""Cluster a set of molecules using the butina clustering algorithm and a given threshold.
Args:
mols: a list of molecules.
cutoff: Cuttoff for the clus... | 5,324,147 |
def process_data(cur, conn, filepath, func):
"""Resolve files under filepath root, parse and insert elements into the database.
Arguments:
cur -- database cursor used to insert data
conn -- database network connection
filepath -- path to JSON data files
func -- function used to extract data ele... | 5,324,148 |
def test_create_or_update_log_level_update():
"""Will update the log level to "WARN".
:return: Should return: "WARN"
"""
syn = syncope.Syncope(syncope_url="http://192.168.1.145:9080", username="admin", password="password")
update_log_level = '{"name": "org.apache.http", "level": "WARN"}'
log_le... | 5,324,149 |
def match_depends(module):
""" Check for matching dependencies.
This inspects spell's dependencies with the desired states and returns
'False' if a recast is needed to match them. It also adds required lines
to the system-wide depends file for proper recast procedure.
"""
params = module.para... | 5,324,150 |
def reshape_shuffle_ctg(fhr: np.array, uc: np.array, y: np.array, time: Optional[np.array]) -> Tuple[np.array, np.array, np.array, Optional[np.array], Optional[np.array]]:
"""
Reshape and optionally shuffle inputs and targets for the keras/tf input in model
Args:
fhr, y : (np.arrays) combines batch... | 5,324,151 |
def do_project(project: str) -> Optional[Tuple[str, str, str]]:
"""
Query Anitya and zypper for current version.
"""
max_version = None
prog_id = anitya_find_project_id(proj_name=project)
if prog_id:
res = requests.get('https://release-monitoring.org/project/%d/' % prog_id)
res.r... | 5,324,152 |
def save_channel_videoid(channel_id: str, video_id: str):
"""儲存單個影片ID與頻道ID
Args:
channel_id (str): [channel_id]
video_id (str): [video_id]
Returns:
[bool]]: [suss/fail]
"""
schemas = {
"video_id": video_id,
"channel_id": channel_id
}
play_list_model ... | 5,324,153 |
def mark_point(mark_point=None, **kwargs):
"""
:param mark_point:
标记点,有'min', 'max', 'average'可选
:param kwargs:
:return:
"""
return _mark(mark_point, **kwargs) | 5,324,154 |
def get_keys(opts):
"""Gets keys from keystore and known-hosts store"""
hosts = KnownHostsStore()
serverkey = hosts.serverkey(opts.vip_address)
key_store = KeyStore()
publickey = key_store.public
secretkey = key_store.secret
return {"publickey": publickey, "secretkey": secretkey,
... | 5,324,155 |
def _get_model_ptr_from_binary(binary_path=None, byte_string=None):
"""Returns a pointer to an mjModel from the contents of a MuJoCo model binary.
Args:
binary_path: Path to an MJB file (as produced by MjModel.save_binary).
byte_string: String of bytes (as returned by MjModel.to_bytes).
One of `binary... | 5,324,156 |
def plot_work_terms(constants_class, fig_name=None):
"""
Calculate actual work terms to use and plot to check them.
We need both n and b in image space.
TODO: What exactly are these work terms??
:param constants_class: BaseArrays class object
containing fundamental and d... | 5,324,157 |
def emulate_decoding_routine(vw, function_index, function: int, context, max_instruction_count: int) -> List[Delta]:
"""
Emulate a function with a given context and extract the CPU and
memory contexts at interesting points during emulation.
These "interesting points" include calls to other functions an... | 5,324,158 |
def probs_to_costs(costs, beta=.5):
""" Transform probabilities to costs (in-place)
"""
p_min = 0.001
p_max = 1. - p_min
costs = (p_max - p_min) * costs + p_min
# probabilities to costs, second term is boundary bias
costs = np.log((1. - costs) / costs) + np.log((1. - beta) / beta)
return... | 5,324,159 |
def requires_ids_or_filenames(method):
"""
A decorator for spectrum library methods that require either a list of Ids or a list of filenames.
:param method:
A method belonging to a sub-class of SpectrumLibrary.
"""
def wrapper(model, *args, **kwargs):
have_ids = ("ids" in kwargs) a... | 5,324,160 |
def _list_nsrr(
db_slug: str,
subfolder: str = '',
pattern: str = '*',
shallow: bool = False,
) -> List[Tuple[str, str]]:
"""
Recursively list filenames and checksums for a dataset.
Specify a subfolder and/or a filename-pattern to filter results.
Implemented according to the NSRR API d... | 5,324,161 |
def red():
"""
Returns the red RGB tensor
Returns
-------
Tensor
the (1,3,) red tensor
"""
return color2float(Uint8Tensor([237, 28, 36])) | 5,324,162 |
def get_temporary_text_file(contents, filename):
"""
Creates a temporary text file
:param contents: contents of the file
:param filename: name of the file
:type contents: str
:type filename: str
"""
f = StringIO()
flength = f.write(contents)
text_file = InMemoryUploadedFile(f, N... | 5,324,163 |
def print_wf_integrity_stats(stats, workflow_id, dax_label, fmt):
"""
Prints the integrity statistics of workflow
stats : workflow statistics object reference
workflow_id : UUID of workflow
dax_label : Name of workflow
format : Format of report ('text' or 'csv')
"""
if fmt n... | 5,324,164 |
def build_dynamic_focal_key_loss(task_cfgs):
"""According to "Dynamic Task Prioritization for Multitask Learning"
by Michelle Guo et al."""
losses = {}
for task_cfg in task_cfgs:
name = task_cfg['name']
losses[name] = build_dynamic_focal_key_task(task_cfg)
return WeightModule(losses... | 5,324,165 |
def settings_from_task_id(
task_id: int,
inj_data_path: str = "./data_raw_injections/task_files/",
) -> Tuple[str, Dict[str, Union[str, Optional[Dict[str, str]], bool, int]], int]:
"""Returns injection file (with path), waveform parameters in a dictionary, and number of injections for the given task id.
... | 5,324,166 |
def test_should_parse_word2vec_with_multiple_entires(load_embedding_func, tmp_path):
"""Loading a Word2Vec Embedding should pass for multiple word entries"""
# GIVEN
word2vec_path = create_tmp_word_embedding(
tmp_path,
"""
4 2
word1 1.0 2.0
word2 3.0 4.0
... | 5,324,167 |
def remove_comments_and_docstrings(source):
"""
Returns *source* minus comments and docstrings.
.. note:: Uses Python's built-in tokenize module to great effect.
Example::
def noop(): # This is a comment
'''
Does nothing.
'''
pass # Don't do any... | 5,324,168 |
def get_arg_loc(callingconvention: str, bytecounter: int, size: int) -> str:
"""Return a string that denotes the location of a given function argument."""
index = bytecounter // 4
if index < 0:
raise Exception(
"Argument index cannot be smaller than zero: " + str(index))
if callingc... | 5,324,169 |
def alignments_pass(alignments: pathlib.Path) -> Alignments:
"""Peform a single pass on all alignments to calculate meta information."""
meta = Alignments()
for speaker in tqdm(list(alignments.glob("*")), desc="Alignment Pass"):
# To ignore hidden files etc.
if str(speaker.stem).isnumeric... | 5,324,170 |
def BRepBlend_HCurve2dTool_Intervals(*args):
"""
:param C:
:type C: Handle_Adaptor2d_HCurve2d &
:param T:
:type T: TColStd_Array1OfReal &
:param S:
:type S: GeomAbs_Shape
:rtype: void
"""
return _BRepBlend.BRepBlend_HCurve2dTool_Intervals(*args) | 5,324,171 |
async def test_ternary(dut):
"""Try accessing the design."""
dut._log.info("Running test...")
cocotb.fork(Clock(dut.clk, 1, units="ns").start())
fail = 0
for i in range(10):
dut.rst <= 1
bit_str = prg(700)
dut.bit_str <= int.from_bytes(bit_str, "big")
await Rising... | 5,324,172 |
def get_block_objects(disasm, nodes, func_addr):
"""
Get a list of objects to be displayed in a block in disassembly view. Objects may include instructions, stack
variables, and labels.
:param angr.analyses.Disassembly disasm: The angr Disassembly Analysis instance.
:param iterable nodes: ... | 5,324,173 |
def new_lunar_system_in_time(time_JD=2457099.5|units.day):
"""
Initial conditions of Solar system --
particle set with the sun + eight moons,
at the center-of-mass reference frame.
Defined attributes:
name, mass, radius, x, y, z, vx, vy, vz
"""
time_0 = 2457099.5 | units.day
delta_JD = time_JD-time_... | 5,324,174 |
def read_annot(fname):
"""Read a Freesurfer annotation from a .annot file.
Note : Copied from nibabel
Parameters
----------
fname : str
Path to annotation file
Returns
-------
annot : numpy array, shape=(n_verts)
Annotation id at each vertex
ctab : numpy array, shape... | 5,324,175 |
def overlap3(data):
"""
"""
#
dataC = copy.copy(data)
temp = [[] for i in range(0, 12)]
index = int(dataC[0][0][5 : 7])
for x in dataC:
temp[(index % 12) - 1].append(x[1:])
index += 1
final = []
for x in temp:
final.append(np.array(x))
return final | 5,324,176 |
def gen_qsub_script(exp, run_type):
"""Populate qsub script with settings"""
reps = {}
qsub_path = ''
if config.is_cp_job(run_type):
reps = gen_cp_qsub_constants(exp, run_type)
else:
reps = gen_mask_qsub_constants(exp, run_type)
qsub_script = ''
qsub_template_path = config.get_template_qsub(run... | 5,324,177 |
def quat_diff_rad(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor:
"""
Get the difference in radians between two quaternions.
Args:
a: first quaternion, shape (N, 4)
b: second quaternion, shape (N, 4)
Returns:
Difference in radians, shape (N,)
"""
b_conj = quat_conjuga... | 5,324,178 |
def PairsMerging(xIn: list):
"""
Recursive function for merging pairs formed at the first step
Parameters
----------
xIn : list
xIn - input list containing pairs of subarrays for sorting.
Returns
-------
Merged pair.
"""
# print(xIn,"input array for Pairs Merging") # De... | 5,324,179 |
def generate_dataset_db(
connection_string: str, file_name: str, include_null: bool
) -> str:
"""
Given a database connection string, extract all tables/fields from it
and write out a boilerplate dataset manifest, excluding optional null attributes.
"""
db_engine = get_db_engine(connection_strin... | 5,324,180 |
def save_path_plan(path_wp):
"""
Compute the waypoints (distance and angle).
"""
path_dist_cm = []
path_dist_px = []
path_angle = []
for index in range(len(path_wp)):
# Skip the first and second index.
if index > 0:
dist_px = get_distance(path_wp[index - 1], path_wp[index])
dist_cm = dist_px * MAP_SI... | 5,324,181 |
def on_key_press(symbol, modifiers):
"""
This handler processes keyboard commands that control the simulation
"""
if symbol == key.BACKSPACE or symbol == key.SLASH:
env.reset()
env.render()
return
elif symbol == key.ESCAPE:
env.close()
sys.exit(0)
elif s... | 5,324,182 |
def salt(secret: str) -> str:
"""A PBKDF salt."""
return sha256(secret.encode("utf-8")).hexdigest() | 5,324,183 |
async def async_get_service(
hass: HomeAssistant,
config: ConfigType,
discovery_info: DiscoveryInfoType | None = None,
) -> KNXNotificationService | None:
"""Get the KNX notification service."""
if not discovery_info or not discovery_info["platform_config"]:
return None
platform_config ... | 5,324,184 |
def docx_to_df(file_path):
"""
Convert docx file to dataframe
Parameters
----------
file_path : str
A file path of documnet
Returns
-------
dataframe
speech | transcript_filepath | id | transcriber_id | wave_filepath
--------------------------------------------... | 5,324,185 |
def write_current_station(config, station):
"""
Upisuje oznaku trenutno selektovanog računara u fajl u kojem se evidentira ta informacija
config - globalna konfiguracija alata za pregled
station - oznaka trenutno selektovanog računara
"""
with open (config.STATION_FILENAME, 'w') as wfile:
wfile.write(station) | 5,324,186 |
def _is_referenced_by_a_stack_frame_name(referrers, obj, name):
"""
Is there a reference among the given referrers, that is a stack frame,
which contains a local variable of the given name, which points to
the object of interest?
:param referrers: The references to scan.
:param obj: The object o... | 5,324,187 |
def get_table_value(table, row_name, column, namespace='default', network=None, base_url=DEFAULT_BASE_URL):
"""Retrieve the value from a specific row and column from node, edge or network tables.
Args:
table (str): Name of table, e.g., node (default), edge, network
row_name (str): Node, edge or... | 5,324,188 |
def polling_wait(
poller: Union[LROPoller, Future],
message: str = None,
start_time: float = None,
is_local=False,
timeout=LROConfigurations.POLLING_TIMEOUT,
) -> Any:
"""Print out status while polling and time of operation once completed.
:param Union[LROPoller, concurrent.futures.Future] ... | 5,324,189 |
def _check_circular_dependency(nodes_qty: int, ind_nodes_qty: int) -> None:
"""Checks for a circular dependency.
The circular dependency prevents the formation of the topological order.
Parameters
----------
nodes_qty : int
Quantity of nodes.
ind_nodes_qty : int
Quantity of ind... | 5,324,190 |
def prettify_name_tuple(tup):
""" Processes the intersect tuples from the steam API. """
res = []
for name in tup:
res.append(name.split("_")[0])
return ", ".join(res) | 5,324,191 |
def init_repository(path, bare=False,
flags=C.GIT_REPOSITORY_INIT_MKPATH,
mode=0,
workdir_path=None,
description=None,
template_path=None,
initial_head=None,
origin_url=None):
"""
Creates a new Git repository in the given *path*.
If *bare* is True the repository will be bare, i.e.... | 5,324,192 |
def set_color(frame: np.ndarray, x: int, y: int, color: Tuple[int]) -> None:
"""Sets the pixel at position (x, y) on the frame to the specified color.
"""
frame[x, y, :] = np.asarray(color) | 5,324,193 |
def carrington_rotation_number_relative(time, lon):
"""
A function that returns the decimal carrington rotation number for a spacecraft position
that may not be at the same place at earth. In this case you know the carrington longitude
of the spacecraft, and want to convert that to a decimal carrington ... | 5,324,194 |
def _impl_ufunc_remainder(x1, x2):
"""
Returns the remainder of division for each element x1_i of the input array x1 and the
respective element x2_i of the input array x2.
"""
pass | 5,324,195 |
def plot_square_lattice(width, height, numbered=False, title='', save_path=None):
"""
Plot a figure of square lattice
:param width: width of the square lattice
:param height: height of the square lattice
:param numbered: if show each each lattice dot a number
:param title: title of the ... | 5,324,196 |
def delete_volume_backup(cinder, vol_backup_id):
"""Delete the given volume from cinder.
:param cinder: Authenticated cinderclient
:type cinder: cinderclient.Client
:param vol_backup_id: unique name or id for the openstack resource
:type vol_backup_id: str
"""
delete_resource(cinder.backups... | 5,324,197 |
def wrap_elasticluster(args):
"""Wrap elasticluster commands to avoid need to call separately.
- Uses .bcbio/elasticluster as default configuration location.
- Sets NFS client parameters for elasticluster Ansible playbook. Uses async
clients which provide better throughput on reads/writes:
http... | 5,324,198 |
def test_turn_on_not_connected(device):
"""Test the CLI."""
light = Light("00:11:22")
with pytest.raises(RuntimeError):
light.turn_on() | 5,324,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.