id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ffc9b7448f1fe10a188b | def list_vnfs(self):
try:
vnf_list = self.client.vnf.list()
except ClientException as e:
raise NFVOAgentsException(ERROR, str(e))
vnfs = []
for vnf in vnf_list:
vnf_id = vnf['id']
vdu0 = vnf['vdur'][0]
# OSM does not show a V... | |
ffc9e696cc38d703d69e | def validate(self):
# Account must exist.
assert self.acct
# Symbol must exist.
assert self.sym
# Quantity must exist and be an integer greater than zero.
# Partials are sold when # shares held is less than one.
assert int(self.qty) > 0
# Order type must e... | |
ffc9f90564642fa8e288 | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
legalMoves = gameState.getLegalActions(0)
v = float("-inf")
bestAction = legalMoves[0]
for action in legalMoves:
successorState = gameState.generateSuccessor(0, action)
stateVal = self.expecti(succes... | |
ffc9fc54bcebb7fb68ca | def _select_parition_and_mode_in_policy_function(self, partition_name, mode):
partition_select_box = select.Select(self.parent.browser.find_element_by_id('policy-partition-to-apply'))
partition_select_box.select_by_value(partition_name)
mode_select_box = select.Select(self.parent.browser.find_el... | |
ffca0183fa76c91dac73 | def p(*args, **kwargs):
print(*args, **kwargs) | |
ffca1969ee52f5ad9175 | def get_routes(self):
for battery in self.batteries:
self.routes[battery] = []
for house in battery.houses:
coordinate = get_coordinates(house, battery)
self.routes[battery].append(coordinate) | |
ffca2af8ca6691ef35f3 | def collect_experiences(self):
for i in range(self.num_frames_per_proc):
# Do one agent-environment interaction
preprocessed_obs = self.preprocess_obss(self.obs, device=self.device)
with torch.no_grad():
masked_prev_action = self.prev_action * self.mask.int(... | |
ffca2b2fb88021cae283 | def insert(self, i, newChild, setParent=True):
if type(newChild) == str:
newChild = self.ownerDocument.createTextNode(newChild)
if newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE:
for item in newChild:
self.insert(i, item, setParent=setParent)
i +... | |
ffca349f1f06b940c6fd | def get_admin_role(controller): | |
ffca3f0f65cfd18c9e33 | def _mdens_deriv(self, m):
return (
-self._mdens(m) * (self.a * self.alpha + self.beta * m) / m / (self.a + m)
) | |
ffca9890c39b0ff44c1e | def funclg(E,prereqs):
model,psigood = prereqs
#if E is an array, compose arrays of upper limits, lower limits, arguments
# and prefactors
if isinstance(E,(list,ndarray))==True:
dls = zeros(len(E))
uls = []
plist = []
for index in range(len(E)):
uls.append(1./... | |
ffcaa5d687864a8d1c8f | def getObsYears():
return {1:1990,11:2000,17:2006,23:2012,29:2018} | |
ffcab9387607426c4a8a | def is_float(self, s):
try:
float(s)
return True
except ValueError:
return False | |
ffcad7e2d7cb90497403 | def gaussian(x, FWHM=3., center=100., amplitude=10., offset=0.):
two_sig_sq = (FWHM / (2 * np.log(2) ) )**2
return amplitude * np.exp( -(x-center)**2/two_sig_sq ) + offset | |
ffcae3adb0943d68c601 | async def find_one_and_replace(
self,
*,
query: dict,
replacement: dict,
upsert: bool = False,
sort: list[tuple[str, int]] = None,
projection: typing.Union[list[str], dict[str, bool]] = None,
session: pymongo.client_session.ClientSession = None,
re... | |
ffcb0adaa2b7a9eff174 | def where_rewrite(self):
if self._where == []:
return "let keep = filter (\\row -> true) db\n"
where_eq_adjusted = self._where.replace("=", " == ")
if where_eq_adjusted.find(" and ") != -1:
where_and_adjusted = "(" + where_eq_adjusted.replace(" and ", ") && ")
e... | |
ffcb13047440f2919592 | def viewgrid(self):
try:
self.grid_itemnum += 1
self.plot(self.Atomsobject, dictionary=False)
except Exception as e:
print(e) | |
ffcb407cd043916c7c59 | def run(self):
for pathin in glob.glob(os.path.join(self._dirin, '*')):
self._inputs.put(pathin)
workers = []
for i in range(self._num_threads):
w = threading.Thread(target=self._worker_thread, args=(i,))
w.start()
workers.append(w)
for w in workers:
w.join()
results ... | |
ffcb93c14fa2fc37c8ec | def save_data(df, database_filename):
# create engine for database connection
engine = create_engine('sqlite:///'+database_filename)
# save dataframe to database file
df.to_sql('Table', engine, index=False) | |
ffcb9c44247000c79092 | def commercial_area_size(self):
try:
if self.data_from_search:
info = self.data_from_search.find("ul", {"class": "info"}).text
s = info.split("|")
return s[1].strip()
else:
return
except Exception as e:
l... | |
ffcbd0343720d0b6b103 | def test_dont_copy_read_permissions(self):
permissions = {"canDownload": False}
with patch.object(
self.syn, "get", return_value=self.file_ent
) as patch_syn_get, patch.object(
self.syn, "restGET", return_value=permissions
) as patch_rest_get:
copied_f... | |
ffcbd1c1c0d5ca545387 | def pretty_print(self):
as_string = ElementTree.tostring(self._root, 'utf-8')
dom = minidom.parseString(as_string)
return dom.toprettyxml(indent=" ") | |
ffcbdb17b83f12730c31 | def find_matching_pairs(e1, e2):
# this is actually pretty difficult with this library! | |
ffcbdea06b9fb317fbd0 | def simplifyUnitsFactor( self ) :
ignores = []
result = PQU( 1 )
keys = self.symbols.keys( )
for i1, key in enumerate( keys ) :
if( i1 in ignores ) : continue
ignores.append( i1 )
u1 = PQU( 1, key )
for i2 in range( i1 + 1, len( keys ) ) :... | |
ffcbf3d3985c18bb14a8 | def get_media(self, mediaext):
medialist = []
for root, dirs, files in os.walk(self.path):
for fil in files:
name, ext = os.path.splitext(fil)
# only add requested media
if ext in mediaext:
# TODO: fix '/' to be OS independent
medialist.append(root + "/" + fil)
return medialist | |
ffcc0daad977a53c86a2 | def _merge_prior_elements(self) -> None:
if len(self.to_merge) == 0:
return
# Determine the new tag type based on the tags that will be merged. For now, we can assume
# that it's the same as the first type of element that will be merged.
tag_name = self.to_merge[0].name
... | |
ffcc14dc13e399e873bd | def val_ok(sud, i, j, val):
row = all(sud[i,s] != val for s in range(0,9))
if row:
col = all(sud[t,j] != val for t in range(0,9))
if col:
# For i,j in subgrid h, find minimum row and column of h.
# That is, find top-le... | |
ffcc157534c2ba0f1458 | def plot(self):
array = self.to_array()
plt.figure(figsize=(8, 6))
plt.plot(array[:, 0], array[:, 1], 'r.')
plt.show() | |
ffcc24011a77ed40c44d | def get_motion_detection(self):
return self.send_command('motion.cgi') | |
ffcc558261a9d4ebcdd4 | def inquiry_date_time(self, inquiry_date_time):
self._inquiry_date_time = inquiry_date_time | |
ffcca2d3d4c449c1b21f | def writeJsonToFile(outputMatrix,filename):
with open (filename, 'w') as f:
for senDict in outputMatrix:
for word in senDict:
j=json.dumps(word)
f.write(str(j))
f.write('\n')
f.close() | |
ffccb1bb0ee19e85272c | def show_output():
output_stream = cv2.VideoCapture(args["output"])
if (output_stream.isOpened() == False):
print("Error opening video file, try opening it from the output path")
while output_stream.isOpened():
grabbed, frame = output_stream.read()
if grabbed == True:
cv2.imshow('Frame', frame)
# pre... | |
ffccefc068bcacebebc6 | def _get_distance_from_center(self) -> int:
image = self.binary_output.get_image()
viewport_width = image.shape[1]
viewport_height = image.shape[0]
viewport_middle = viewport_width/2
rightx = (
(self._right_fit[0]*viewport_height**2) +
(self._right_fit[1]... | |
ffcd11b56809bb9599d3 | def roman_to_int(input):
if type(input) != type(""):
raise TypeError, "expected string, got %s" % type(input)
input = input.upper()
nums = ['M', 'D', 'C', 'L', 'X', 'V', 'I']
ints = [1000, 500, 100, 50, 10, 5, 1]
places = []
for c in input:
if not c in nums:
raise Val... | |
ffcd5491192ac0363d99 | def get_good_features(bond_type):
good_feats = pd.read_csv("fi/FI_ANALYSIS_M054_GOODFEATS.csv", index_col=0)
good_feats = good_feats.fillna(False)
return good_feats.loc[good_feats[bond_type]].index.tolist() | |
ffcd80a4aa8f6e268287 | def MoveWav(position):
MaiTai.write(f"WAV {position}") | |
ffcd8abf5bc2011a751c | def KNWLoss_GSVIB_ATTCOOP(outputl, outlab, reg_lamda, model, cstep, beta_warmup, scale_factor=0.1,scale_factor2=0.0):
outputl = outputl.permute(1, 2, 0)
lossc = torch.nn.CrossEntropyLoss()
loss1 = lossc(outputl, outlab)
# context,prior should be log probability
context, p_prior,... | |
ffcda9ac55b519829383 | def do_POST(self):
# gadmogzavnili kontentis zoma | |
ffcdb4c4c943fc3c7b89 | def write(self, value):
if value not in (0, 1):
raise ValueError('Cannot write a value other than 0 or 1 to a Pin')
self.gpio.write(self.pin, value) | |
ffcdcf2fbad242ad6f00 | def Compact3D(x):
if x < 0:
raise Exception("""ERROR: Morton code is always positive""")
x &= 0x49249249249249249249249L
x = (x ^ (x >> 2)) & 0x430c30c30c30c30c30c30c3L
x = (x ^ (x >> 4)) & 0x700f00f00f00f00f00f00fL
x = (x ^ (x >> 8)) & 0x7f0000ff0000ff0000ffL
x = (x ^ (x ... | |
ffcddc7de3ccd8410652 | def _nestable_class(cls): | |
ffcde8036b57c40c4408 | def test_pool_create(self):
pool_name = p_n()
self.unittest_command(
[STRATIS_CLI, "pool", "create", pool_name, DISKS[0]], 0, True, True
) | |
ffcdf23084d54c41aa9d | def plot_reward(self, smoothing = 30):
plottable = self.collected_rewards[:]
while len(plottable) > 1000:
for i in range(0, len(plottable) - 1, 2):
plottable[i//2] = (plottable[i] + plottable[i+1]) / 2
plottable = plottable[:(len(plottable) // 2)]
x = []
... | |
ffcdfea9310bce0b9c7c | def _add_entry(self) -> None:
self._custom.append(TableItem(""))
self._set_table() | |
ffce059e4734b56ecf30 | def buyzweihander(self):
# Check if user has enough gold and has not already purchased item
if self.gold >= 20000 and wp.zweihander not in self.weaponinventory:
# Pops item from list to a single variable
item = self.shopinventory.pop(4)
# Adds item to player inventory... | |
ffce3a4efae20ef07450 | def _logout(self):
return self.app.get('/logout', follow_redirects=True) | |
ffce6b5e6a04b660a762 | def add_log(self, level, message):
self.__log.append((level, time(), message)) | |
ffce733e9150b3261104 | def TestForMissingMoveIds(self, program):
stepList = program.stepList
moveId = 0
for s in stepList:
moveId = moveId + 1
msg = f"Step {s.name} has no playbackFrames. Move Id {moveId} is missing"
self.assertNotEqual(len(s.frameList) , 0, msg) | |
ffce8bcd7e40ac2c983d | def padder(arr):
r,c = arr.shape
dt = arr.dtype # To preserve array's dtype
rows = zeros((r,1),dt)
cols = zeros((1,c+2),dt)
rowpad = hstack((rows,arr,rows))
colpad = vstack((cols,rowpad,cols))
return colpad | |
ffce8ecae6b96d02ffb3 | def update_count(self):
self.bttn_clicks += 1
self.bttn1["text"] = "positive clicker " + str(self.bttn_clicks)
self.label = Label(self, text="Total clicks: " + str(self.bttn_clicks))
self.label.grid() | |
ffcea207ec7b7d7e63a6 | def install_pkg():
try:
subprocess.run(["sudo {} install -y {}".format(PKG_MGR, PKG_LIST)], shell=True, check=True)
except subprocess.CalledProcessError:
assert False, "{} one of installation package failed".format(PKG_LIST) | |
ffcec56ebf1007882ef0 | def write(self, filename, data):
raise NotImplementedError | |
ffcef0953076610d9505 | def initiate(self):
self.io.debug("Inititating")
if self.location is None:
self.location = './'
files = glob.glob(self.location + '/*.%s' % self.suff)
for f in files:
index = f.split('/')[-1].split('.')[0]
self._files[index] = f
if self._au... | |
ffcefce75abaaee8f476 | def commands():
pass | |
ffcf035872735e15b2c6 | def abort(self, exc=None):
return super(ThreadInProgress, self).abort(exc) | |
ffcf0456cae377f95294 | def test_embedding_parameters(self):
for metric in [EuclideanMetric, MaximumMetric, TaxicabMetric]:
settings = Settings(self.time_series,
similarity_measure=metric,
embedding_dimension=5,
time_delay=3,
... | |
ffcf0e0f62ac273863a4 | def get_params(self): | |
ffcf2303a3e8a1526888 | def EnableMinFrameSize(self):
return self._get_attribute('enableMinFrameSize') | |
ffcf254c492462f885c7 | def create_new_wlan(configs):
wlan = {}
wlan['enabled'] = 'true'
wlan['apply_to'] = 'site'
wlan['auth'] = {'type': configs['wlan']['type'], 'psk': configs['wlan']['psk']}
wlan['hostname_ie'] = configs['wlan']['hostname_ie']
wlan['ssid'] = configs['wlan']['ssid']
wlan['band'] = configs['wlan... | |
ffcf39f02d42167bc061 | def _determine_user_access(self):
try:
current_user = self.environ['tiddlyweb.usersign']
except KeyError:
return False
if current_user['name'] != u'GUEST':
return True
return False | |
ffcf8d0e331e510d28ae | def run(self, tFinal, tPrint):
# Remember the final time
self.tFinal = tFinal
# Run simulation
self.result = self.simSolver.simulate(
tfinal = tFinal,
ncp = math.floor(tFinal/tPrint)
) | |
ffcfa4bf6196f123db13 | def test1(self):
self.assertEqual(
(
0,
[]
),
self.sut.solve(
0,
[],
[]
)
) | |
ffcfa7c7d6acd1cbb8d1 | def list_topics(self) -> List[str]:
return list(self.topic_dic.keys()) | |
ffcfe846dd13a65964de | def __init__(self,var,nbinsmax = None):
NMIN = 10
if nbinsmax==None: nbinsmax= 500
xlist = map(float,var)
xlist.sort()
n = len(xlist)
nbins0 = int((1.*n)/NMIN)
self.size = min(nbins0,nbinsmax)
self.xaxis = self.size*[0.]
self.yaxis = self.size*[0.]
supmin = .5/len... | |
ffd00b3b8f30d219cbb7 | def test_parse_page_content_02(self, page, expected, errors):
actual, err = article.parse_content(page)
if errors or err:
assert errors == len(err)
else:
assert actual == expected | |
ffd0223ff6d591f698e0 | def __collect_comments(self, list_of_comments):
for comment in list_of_comments:
for comment_type in CommentTypes.InterestingTypes:
if comment.startswith(comment_type):
self.context = comment_type
type_specific_string_list = StringHelper.split_... | |
ffd05e3a9f6e23de96f1 | def labels_to_placeholders(self):
FIELDS_TO_HIDE = (forms.ChoiceField, forms.MultiValueField)
for field_name in self.fields:
field = self.fields[field_name]
if isinstance(field, forms.CharField):
# Make Charfields have a placeholder as the label
f... | |
ffd080d25db3ffec7c4e | def matrixVectorMul(matrix,vector1):
vector2=[0]*len(matrix[0])
for element in range(len(vector1)):
vector2 = vectorAddition(vector2,scalarVectorMultiply(matrix[element],vector1[element]))
return vector2 | |
ffd0b53e246a14489e1b | def reset_hit(self):
self.target_hit = 0 | |
ffd0bc69483167198ef4 | def sort(self):
self._objs.sort(key=lambda a: a.key)
self.update() | |
ffd0cc913b8ccca68639 | def build_directories(directory):
# If the root directory doesn't exist, create it
if not os.path.exists(directory):
os.mkdir(directory)
# Now make the subdirectories
subdirectories = ["output", "stderr", "stdout", "jobs"];
directories = [os.path.join(directory, subdir) for subdir in \
su... | |
ffd148824230618286db | def __init__(self, vocab: Dict[str, int], eow: str = "_EOW"):
super().__init__()
self.vocab = torch.jit.Attribute(vocab, Dict[str, int])
self.eow = torch.jit.Attribute(eow, str) | |
ffd14cf8d22750e6fadb | def get_project_config() -> Path:
return get_project_root().joinpath('.projectusher.toml') | |
ffd14d6ed6803600c7c3 | def apis_by_mashup(self, mashup):
pairs = self.db.pairs.find({"mashup": mashup["id"]})
apis = []
for pair in pairs:
apis.extend([api for api in self.db.apis.find({"id": pair["api"]})])
return apis | |
ffd160557fc89b3e9f56 | def check_if_in_members(self,patron_id):
if patron_id in self._members:
return True
else:
return False | |
ffd1d233dc67e5af56a3 | def test_trouver_symbole(self):
# résultats supposés de la fonction 'trouver_symbole'
liste_O = [(0,0), (1,0), (2,0), (3,0), (0,1), (3,1), (0,2), (0,3), (1,3), (2,3), (3,3)]
liste_X = []
# comparaison avec le résultat de la fonction
self.assertEqual(s_mur.trouver_symbole(self.carte), liste_O) | |
ffd1f101a6554171e1d5 | def backgroundReplicateGroups(self):
tcs=[]
for idx in self.backgroundReplicateGroupIndices():
tcs.append(self.replicateGroups[idx])
return tcs | |
ffd205a56ffff9837d6c | def submit_task(task, *args, callback=lambda _: None, **kwargs):
future_to_callback[executor.submit(task, *args, **kwargs)] = callback | |
ffd21c1231b5088adf89 | def too_many_errors(self):
return self.counters[self.ERROR] >= self.max_error_count | |
ffd2375310d644b85347 | def _compute_lowrank_factors(data, n_components, modes=None):
if modes is None:
modes = range(data.ndim)
return [np.linalg.svd(unfold(data, mode), full_matrices=False)[0][:, :n_components]
for mode in modes] | |
ffd24ffb3c0d395b61eb | def heuristic_kernel_width(self, x1, x2):
x_row = x1.unsqueeze(-2) # x_row = [n1, 1, x_dim]
x_col = x2.unsqueeze(-3) # x_col = [1, n2, x_dim]
pairwise_distance = torch.sqrt(torch.sum((x_row - x_col) ** 2, dim=-1)) # list of pairwise distance
kernel_width = torch.median(
pa... | |
ffd261af4de05c07a86f | def test_declined_amended(self):
# create/amend ...
ret = self._create_lodge_and_amend_return()
self._lodge_reg17_return(ret)
expected_status = 'amended'
self.assertEqual(ret.status, expected_status)
self.assertEqual(ret.pending_amendments_qs.count(), 0)
url = re... | |
ffd26ab3c277dd99dde9 | def get(self, submission_id):
user_data, status = Auth.get_logged_in_user(request)
if status == 200:
username = user_data['data']['username']
return get_submission_texts(username, submission_id)
else:
return user_data, status | |
ffd26ac935fa2b09434c | def name(self, number):
male_number = random.randint(number*2//5, number*3//5+1)
result_list = []
with open("student_app/static/surnames.txt", "r") as s_file:
surnames = s_file.readlines()
with open("student_app/static/male_names.txt") as m_f... | |
ffd270de421c1955bde0 | def run(self):
while True:
contig_list, output_file = self.queue.get()
contig_list = " ".join(contig_list)
log.info("Extracting contigs...")
# For some reason I couldn't get plumbum to work here with threading
command = " ".join(
["sam... | |
ffd27a034c83dfd3f6cb | def FindCenter(img):
xmass, ymass, totalmass = 0, 0, 0
for y,l in enumerate(img):
for x,wt in enumerate(l):
if wt==255:
xmass+=x*1
ymass+=y*1
totalmass+=1
if totalmass == 0:
return None, None
return xmass*1.0/total... | |
ffd2b50f7f5cede92de7 | def kernel(self):
log.hline()
log('MP3 Calculation Section'.format())
log.hline()
ham = copy.deepcopy(self.ham)
wfn = copy.deepcopy(self.wfn)
hf_results = self.hf_results
nspatial = ham.nspatial
occ = wfn.occ
C = wfn.coeffici... | |
ffd2d3910152992ec718 | def _reset(self) -> ts.TimeStep:
return ts.restart(
self._observe(),
batch_size=self.batch_size,
reward_spec=self.reward_spec(),
) | |
ffd2f83ee078e7362ada | def run_main_loop(self):
result = self.parse_input()
while result:
result = self.parse_input()
if result == 2:
self.respond("? unknown command\n\n") | |
ffd303d46457d5e1a566 | def list_export_jobs(self, **kwargs):
return ModelCardExportJob.list_export_jobs(
model_card_name=self.name,
sagemaker_session=self.sagemaker_session,
**kwargs,
) | |
ffd314eb2431fc47aad0 | def user_list():
users = User.query.all()
return render_template("users.html", users=users) | |
ffd32f1c57c465d37743 | def person_insert(self, person):
query_to_execute = '''INSERT INTO Person(Name, Surname, Phone, Address, City, Postal_code, Country, Mail, URL )
VALUES('{}', '{}', {}, '{}', '{}', {}, '{}', '{}', '{}')'''.format(
person.name, person.surname, person.phone, person.... | |
ffd341b1b3854509e5c2 | def load(self, sess):
latest_checkpoint = tf.train.latest_checkpoint(self.config.checkpoint_dir)
if latest_checkpoint:
print("Loading model checkpoint{} ...".format(latest_checkpoint))
self.saver.restore(sess, latest_checkpoint)
print("Model loaded") | |
ffd35545144a0abc7c51 | def _needMoveParam(local, parameters):
# if there are 16 locals, then there is no need to move
# otherwise, adding a local will push a parameter out of 4-bit registers
return local < 16 and (local + parameters) >= 16 | |
ffd36af28ea346bd3ca8 | def cmdscale(D, full=False):
# number of points
n = len(D)
# for multiple points, solve eigenvalue problem
if n > 1:
# Centering matrix
H = np.eye(n) - np.ones((n, n)) / n
# YY^T
B = -H.dot(D ** 2).dot(H) / 2
# diagonalize
if full:
... | |
ffd3ad7f53a16a9435ea | def __getattr__(self, attribute) -> Any:
return super().__getattr__(attribute) | |
ffd3cc1d201fe131bdc0 | def search_questions(cursor: RealDictCursor, s_phrase):
query = """
SELECT *
FROM question
WHERE LOWER(title) LIKE LOWER(%(search_key)s)
OR LOWER(message) LIKE LOWER(%(search_key)s)
ORDER BY submission_time DESC
"""
cursor.execute(query, {... | |
ffd3d611892c674c1b58 | def _raw_prediction_to_proba(self, raw_predictions): | |
ffd409c09c68e5554182 | def inference(self, inputs, sess, mode):
fetches = {}
if mode == 'depth':
fetches['depth'] = self.est_depth
inputs_ph = self.inputs_depth
if mode == 'egomotion':
fetches['egomotion'] = self.est_egomotion
inputs_ph = self.inputs_egomotion
if mode =='flow':
fetches['flow'] = ... | |
ffd40ce4037b00e54642 | def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.