id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ff6f202416bd44a2294b | def remove_node(self):
pass | |
ff6f5e72172bc0c0df2a | def tag_release(self, version, push):
calls = list()
if not self._is_tag_present(version):
calls.append(
lambda: self._add_tag(version, 'Release {version}'.format(
version=version), push=push))
if push:
calls.append(self._push)
... | |
ff6f82b71e5a34fc301d | def get_wav_duration(wav_bytes: bytes) -> float:
with io.BytesIO(wav_bytes) as wav_buffer:
wav_file: wave.Wave_read = wave.open(wav_buffer, "rb")
with wav_file:
frames = wav_file.getnframes()
rate = wav_file.getframerate()
return frames / float(rate) | |
ff6fcdffd5916cd78321 | def test_get_user_courses(self):
my_courses = Course.get_my_courses(self.user1)
self.assertTrue(self.course1 in my_courses)
self.assertTrue(self.course2 in my_courses) | |
ff6fce51b92ce7bf1596 | def journeys(self):
response = self._get(self.uri_for('journeys'))
return json_to_py(response) | |
ff6fd7fe709960255256 | def sample_names(self):
samples = getattr(self,"samples",{})
if getattr(self, "_sample_names", None) is None:
sample_names = []
with open(self.samplesheet,"r") as fh:
for line in fh:
if line.startswith("[Data]"):
... | |
ff70019449ad2dabc89b | def update_initial(self, n=1):
self.i = (self.i + n) % len(self.lst) | |
ff7005ada0b7bad57b2c | def sig_t1(self, source):
t1 = source["end_time_mjd"] + self.offset
return min(t1, self.t1) | |
ff700bb9eb4672578ced | def header(): # done
return ZeroOrMore(Not([scenario_outline, scenario, background]), AnyChar) | |
ff7026cabf8740659c5d | def remove_url(tokens):
tokens = filter(lambda x: "http" not in x, tokens)
return list(tokens) | |
ff7028b5fdfbebe6571f | def do_set(self, line):
vs = line.strip().split()
if len(vs) == 2 and vs[0] == 'verbose' and vs[1] in ("True", "T", "False", 'F'):
if vs[1].startswith("T"):
self.v_verbose = True
print " now verbose = True"
elif vs[1].startswith("F"):
... | |
ff70486a8a7738accea7 | def get_duration(self):
self.duration_seconds = self.duration.days*86400 + self.duration.seconds
self.duration_minutes = self.duration_seconds/60
self.duration_hours = self.duration_seconds/3600
return {'hours':self.duration_hours, 'minutes':self.duration_minutes, 'seconds':self.duration_seconds... | |
ff7063ae4d3e66ea6f8e | def procura_aluno(nome):
pass | |
ff70a9d378f969aa4410 | def to_kilometers(distance):
if isinstance(distance, Number):
return distance
elif not isinstance(distance, str):
raise ValueError("Distance must be a number or a string!")
length, unit = split_units(distance)
if length == 0:
raise ValueError("A valid distance length must be gi... | |
ff70bfdbc6f637ac63bf | def extendLeft(currentHit, cdsSeq,geneSeq):
k=0
se1= reversed(cdsSeq[:currentHit[0]])
se2= reversed(geneSeq[:currentHit[2]])
for i, j in zip(se1,se2):
if i == j:
k=k+1
else:
break
hit= [currentHit[0]-k, currentHit[1], currentHit[2]-k, currentHit[3], currentHit[4], currentHit[5]]
return hit | |
ff70c397f6533dc40f5e | def cast(*args):
return _itkRecursiveMultiResolutionPyramidImageFilterPython.itkRecursiveMultiResolutionPyramidImageFilterIUS3IUS3_cast(*args) | |
ff70c47e5e048be7b429 | def get_queryset(self):
tags = self.request.query_params.get("tags")
ingredients = self.request.query_params.get("ingredients")
queryset = self.queryset
if tags:
tags_id = list(map(int, tags.split(",")))
queryset = queryset.filter(tags__id__in=tags_id)
i... | |
ff70cf6090a625f3b2bf | def isBlank(str):
ret = libxsltmod.xsltIsBlank(str)
return ret | |
ff70d3643db825ad62b4 | def is_binary(string):
return string in mathwords.BINARY_OPERATORS | |
ff70fd5a1731e6603268 | def program_interval_type(self):
data = self._get_mdi(57, 0)
return data[0] | |
ff71191c0663f4be09c7 | def make_video(imagelist, fps=8, video_name='vid.mp4', reverse=False):
if not os.path.exists('videos'):
os.makedirs('videos')
# sort and reverse if desired
imagelist = sorted(imagelist)
imagelist = imagelist[::-1] if reverse else imagelist
# loop over each frame and add to video
wi... | |
ff714fe5bd1d5a354897 | def bypass_wizard_prompts(self, wizard_next_button = '#hpid-wizard-next-button'):
if self.is_visible(wizard_next_button):
while not self.exists('#hpid-wizard-next-button.hp-disabled'):
log.debug("Press #hpid-wizard-next-button")
self.press_virtual(wizard_next_... | |
ff715089f215cdb5c253 | def cv(self):
bins = np.linspace(0, max(self.Y_train), 5)
y_binned = np.digitize(self.Y_train, bins)
skf = StratifiedKFold(n_splits=CONFIG.num_fold)
for i, (index_train, index_valid) in enumerate(skf.split(self.X_train, y_binned)):
self._cv_one_fold(index_train, index_valid,... | |
ff7152d08c0f3718597b | def solve():
blank = find_blank()
if not blank:
return True
row, col = blank
for number in range(1,10):
if is_possible(row, col, number):
GRID[row][col] = number
if solve():
return True
GRID[row][col] = 0
return False | |
ff71542ae9ac469d9c5b | def test_fast_n1_test(self):
res = self.saw.fast_n1_test()
self.assertEqual(res, True) | |
ff716cf05d1c7d8bd1ad | def _model_variance(frame,cskyflux,cskyivar,skyfibers) :
log = get_logger()
tivar = util.combine_ivar(frame.ivar[skyfibers], cskyivar[skyfibers])
# the chi2 at a given wavelength can be large because on a cosmic
# and not a psf error or sky non uniformity
# so we need to consider only waves for ... | |
ff71798e53bdf9adccf3 | def value_from_id(key, converted_data, errors, context):
converted_data[key] = converted_data[('id',)] | |
ff7193a997b5584d6f6f | def neighbors(self) -> Dict[Text, "NumPuzzle"]:
# Variable to be returned.
neighbors = dict()
# Find the position of the blank tile.
pos_x, pos_y = self._find(0)
# Check if the blank tile is near the horizontal edges.
if 0 < int(pos_x) < int(self.size_x) - 1:
... | |
ff71b626705312a9d08e | def SaveAs(self):
pass | |
ff71be3192d323d176dd | def get_status(self):
pass | |
ff71fb8110246ad6e9fe | def SetDisableRemoteLockoutState(self, On = True):
if On:
Cmd = 'OVRM 1' #Front panel is not locked out
else:
Cmd = 'OVRM 0' #Front panel is locked out
self.SendString(Cmd)
return | |
ff721ed321f4ced65b8b | def address_check(self, address: str) -> bool:
pass | |
ff7226f5849a177ba5fc | def _process_user_choice(self): # zasticena metoda
verifying_choice = True
idx = 0
print("Trenutni okupanti: {}". format(self.get_occupants()))
while verifying_choice:
user_choice = input("Odaberite broj kucice (1-5): ")
# hvataj iznimku ako se ne unese broj
try:
idx = int(user_choice)... | |
ff7240801c9f204e0509 | def insert_session_data(self):
try:
session_insert = "INSERT INTO Sessions (SessionTable, SessionDate, SessionTime, SessionHands, " \
"SessionResults) " \
"VALUES (%s, %s, %s, %s, %s)"
cursor.execute(session_insert, (
... | |
ff725e10740d9e218365 | def __buttonEvent(event):
global boxRoot, __widgetTexts, __replyButtonText
__replyButtonText = __widgetTexts[event.widget]
boxRoot.quit() # quit the main loop | |
ff7274046e5420f0cb74 | def add_rule(self, state1, state2, condition, action):
rule = Rule(state1, state2, condition, action)
self.rules.append(rule) | |
ff72762516691fc8de78 | def parse_modified_dlc_test_files_info(files, framework, pattern=""):
rule = re.findall(rf"{pattern}", files)
# JobParameters variables are not set with constants.ALL
for test_file in rule:
test_dirs = test_file.split("/")
test_folder = test_dirs[0]
if test_folder == "dlc_tests":
... | |
ff72853b21d509d5cfd3 | def _repr_html_(self):
vis_id = str(uuid4()).replace("-", "")
html = """<div id="vis%s"></div>
<script>
( function() {
var _do_plot = function() {
if (typeof vg === 'undefined') {
window.addEventListener('vincent_libs_loaded', _do_plot)
return;
}
vg.parse.s... | |
ff7285b550fd46d9e785 | def decrease_count(sender, instance, using, **kwargs):
instance.flag.decrease_count()
instance.flag.toggle_flagged_state() | |
ff728f3d001cd483c604 | def step1_get_authorize_url(self):
uri_base = self.params['auth_uri']
uri_params = (
{ 'userid': self.params['userid']
, 'continuation_url': self.params['continuation_url']
})
return uri_with_params(uri_base, uri_params) | |
ff72a3a1405568448c3c | def test_thread_pagination(self): | |
ff72e06ac302fe418ca5 | def get_filenames(self) -> List[str]:
filenames_on_server = self._mappings_api.get_sample_mappings_by_dataset_id(
dataset_id=self.dataset_id, field="fileName"
)
return filenames_on_server | |
ff72ee70a711eb592c02 | def get_command(self, ctx, name):
try:
if sys.version_info[0] == 2:
name = name.encode('ascii', 'replace')
mod = __import__('cli.commands.cmd_' + name,
None, None, ['cli'])
except ImportError as e:
logging.error('Error impo... | |
ff735908a5737da1a79e | def print_cost(self):
costs = self.cost
plt.plot(np.squeeze(costs))
plt.ylabel('cost')
plt.xlabel('iterations (per hundreds)')
plt.title("Learning rate =" + str(self.learning_rate))
plt.show() | |
ff73bca1307769f040a6 | def send_queued_messages():
messages = BroadcastMessage.objects.filter(status='queued')[:50]
logger.info('Found {0} message(s) to send'.format(messages.count()))
for message in messages:
connection = message.recipient.default_connection
try:
msg = send(message.broadcast.body, con... | |
ff73cbf272d523075eaf | def test_list_to_filter_values__invalid(self):
assert HuntingQueryBuilder.get_filter_values(42) is None | |
ff73ce44f1045fc2cc6a | async def fetch_trading_fees(self, params={}):
await self.load_markets()
method = None
defaultType = self.safe_string_2(self.options, 'fetchTradingFees', 'defaultType', 'linear')
type = self.safe_string(params, 'type', defaultType)
params = self.omit(params, 'type')
subTy... | |
ff73e51ecdfc5a79b2cb | def eval_step(
state,
module,
batch,
metrics_dict,
rng):
rng, new_rng = jax.random.split(rng)
with nn.stochastic(rng), flax.deprecated.nn.stateful(
state.model_state, mutable=False):
logits, stats = module.call(state.model_params, batch["image"], train=False)
metrics = {m: fn(logits,... | |
ff73f44b2b364bbb6e9f | def capabilities(self) -> pulumi.Output[Sequence[str]]:
return pulumi.get(self, "capabilities") | |
ff73fd501101831a6447 | def evaluate_gradient(self):
alm = hp.map2alm(self.map_in)
m, self.map_dtheta, self.map_dphi = hp.alm2map_der1(alm,
self._NSIDE_small)
del m, alm | |
ff7412d7b13c5049fb53 | def backprop(self,inputs,y):
activations = [inputs]
linear_outputs = []
#perform feedforward operation
for w,b in zip(self.weights,self.biases):
linear = np.dot(w,activations[-1])+b
linear_outputs.append(linear)
activations.append(self.activation.tr... | |
ff743cf1cf90d18673e7 | def Rectangle(xlo, ylo, xhi, yhi):
return Geometry({
'type': 'Polygon',
'coordinates': [[[xlo, yhi], [xlo, ylo], [xhi, ylo], [xhi, yhi]]]
}) | |
ff744df9a7874735249e | def close(self):
self.input.close()
self.output.close() | |
ff745a4cd1c2e2151daf | def __init__(__self__, *,
auth_token_url: str,
client_id: str,
client_secret: str):
pulumi.set(__self__, "auth_token_url", auth_token_url)
pulumi.set(__self__, "client_id", client_id)
pulumi.set(__self__, "client_secret", client_secret) | |
ff745d8f31b7b8984c5b | def get_nof_events(table, column_name="evt_number"):
return len(set(table.read(field=column_name))) | |
ff748b6cb0bb90d89074 | def activateAttachments(self):
for attach in self.getAllPlugins():
if attach.plugin_object.makeactive:
try:
if isinstance(attach.plugin_object, EmpPlug):
logging.debug("should have loaded events for: %s"%attach.name)
... | |
ff74c88b03d3154b3512 | def grid(self):
# Create a blank grid in the shape of the mino
h, w = self.shape
grid = [[False]*w for row in range(h)]
# Fill the grid with the values in the mino
for i, j in self:
grid[i][j] = True
return grid | |
ff74f6d5665284d7fed4 | def test_elements_exist(self):
self.assert_elements_exist('test_elements_exist') | |
ff74f9b4cde9fa8bc354 | def seed_with_noise():
a2 = analogio.AnalogIn(board.A2)
a3 = analogio.AnalogIn(board.A3)
a4 = analogio.AnalogIn(board.A4)
a5 = analogio.AnalogIn(board.A5)
random_value = ((a2.value >> 4) + (a3.value << 1) +
(a4.value << 6) + (a5.value << 11))
for pin in (a2, a3, a4, a5):
... | |
ff750e87f09d5fa15e2b | def get_command_line(self, n_iter):
... | |
ff753cf495d185eb5ea6 | def tick_size(self, digit=2):
bid_price, ask_price = self.get_price("bid"), self.get_price("ask")
return min(abs(bid_price["bid1_price"] - bid_price["bid2_price"]).min().round(digit),
abs(ask_price["ask1_price"] - ask_price["ask2_price"]).min().round(digit)) | |
ff753d5ff7ff14e1507c | def calculate_function_errors(
func: Callable[..., float], fit_result: BaseFitResult, x: npt.NDArray[Any]
) -> npt.NDArray[Any]:
# Setup the parameters needed to execute the function.
# Determine the arguments for the fit function and the parameters to use in calculating the fit errors.
args_at_minimum,... | |
ff754d56a452fea7142d | def _install_importer():
sys.meta_path.insert(0, Finder()) | |
ff759425d03960e262b3 | def __hash__(self) -> int:
return hash(self.id) | |
ff75b8e7c112faa54ce3 | def _calc_initial_state(self,func):
for i in range(self._size_):
new_i_ = self._start_x_ + self._spatial_step_ * i
for j in range(self._size_):
new_j_ = self._start_y_ + self._spatial_step_ * j
... | |
ff75dcaf8d49518983a0 | def build_rst_dir(directory, out_dir, template):
for root, dirs, files in os.walk(directory):
for fname in files:
if fname.endswith('.rst'):
convert_rst(join(root, fname), join(out_dir, fname.replace('.rst', '.html')), template)
create_dox_wrapper(join(root, fname... | |
ff760ec1c9464883ccc2 | def __init__(self, input_file_url=None, input_file_data=None, table_start_tag=None, table_end_tag=None, data_to_fill_in=None): # noqa: E501 # noqa: E501
self._input_file_url = None
self._input_file_data = None
self._table_start_tag = None
self._table_end_tag = None
self._data_... | |
ff760fdfb34536789bd5 | def solve(self):
raise NotImplementedError | |
ff7610c79e6ae3fed35f | def teardown_request(exception):
try:
g.conn.close()
except Exception as e:
pass | |
ff764126f2a7f181fcf6 | def getPort(): | |
ff764e251ecf190b28ff | def create_token(self):
self._token_id, self.files_endpoint, self.queues_endpoint = \
self.token_func() | |
ff7660e263c5bde4ac50 | def _fetch_help(self, assert_test, tell_who, message=None, callback=lambda: True, timeout=1800):
try:
return assert_test()
except Exception as exception:
if callback() == False or assert_test in self.help_fetched_list:
raise
self.help_fetched_list.ap... | |
ff766d0ed5e33b0586d2 | def download(url, file_name):
with io.FileIO(file_name, "w") as file:
# get request
response = get(url)
# write to file
file.write(response.content) | |
ff767ea92d94396ec28c | def word2vec(text_dict,embedding_model='text8_emb'):
embeddings = {}
text_list = [*text_dict]
for text in text_list:
sentence_split = word_tokenize(text)
embeddings[text] = vs.query(sentence_split, embedding_model).mean().values
if embeddings[text].size == 0:
embeddings[text] = np.zeros(50,)
embedding_d... | |
ff768bb965312f141bbd | def register_session_factory(instance, **options):
return get_component(DatabasePackage.COMPONENT_NAME).register_session_factory(instance,
**options) | |
ff76944f9907b1bf24b6 | def fill_missing_data(data_frame: pd.DataFrame) -> pd.DataFrame:
return data_frame.interpolate() | |
ff76c9cb54cacf9a77a8 | def _points(number):
return (math.ceil(number / 100) * 100) / 10 | |
ff770fda4f646909c712 | def can_ingest(cls, path) -> bool:
return cls.ext_from_path(path) in cls.allowed_extensions | |
ff7714fafdd2039b6fad | def version(self):
return self.tr('Version: %s' % get_version()) | |
ff77329962be56bdf229 | def is_cfd(self):
if not self.__get_dates_valid_from_csd():
return False
return True | |
ff774b3054eba38adfce | def simple_handler(request):
logger.debug('')
return Response(200, 'OK', {}, '') | |
ff7754a6759c8688b326 | def forwarding(self, data):
data = encrypt_msg(self.pw, data, self.encryptor)
self.s.sendall(data)
while True:
msg = socket_recvall(self.s)
if msg:
break
msg = decrypt_ct(self.pw, msg, self.encryptor)
Socks5ClientConn.traffic.setdefault(sel... | |
ff777ac25c27ecc1ff67 | def __init__(self):
super(CaclaAgentExperimenter, self).__init__()
# Handle command line argument:
parser = argparse.ArgumentParser(description='Neural rl agent.')
parser.add_argument('--action_learning_rate', type=float, default=.01,
help='Learning rate')
... | |
ff77927d3dde5a6c5d18 | def reconstruct(self, sess, x):
x_reconstr_mean = sess.run(self.x_reconstr_mean, feed_dict={self.x, x})
return x_reconstr_mean | |
ff77d829ecefe66ebcdf | def __init__(self, config=None):
logger.info('Creating Model Service')
self.config = Config(parameters=config)
self.digital_client = self.create_digital_client()
self.file_manager = self.create_file_manager()
self.audit_client = self.create_audit_client()
self.reload_mode... | |
ff77f624c49614b587d1 | def pixel_coord_min(sp, axis=None):
return sp.return_switch(sp.get_xyz_min_um, axis) | |
ff77f8c323a9101e6444 | def fit_univariate_spline(self, smoothingFactor = None, weight = None):
if smoothingFactor is None:
smoothingFactor = self.smoothingFactor
try:
spline = interpolate.UnivariateSpline(self.xRange,
self.y... | |
ff784b9939cb6f374c1e | def connect(self):
if self.db is None:
self.db = sqlite3.connect(self.filename) | |
ff785c7b63973205c236 | def test_parse_genome_data_15(self):
self.feature_list = [self.seqfeature1,
self.seqfeature2,
self.seqfeature3,
self.seqfeature4,
self.seqfeature5,
self.seqfeature6,
... | |
ff7883f278938f4772e0 | def send_form(form, data):
requests.post(form, data)
print('Submitted') | |
ff7894a220e33ecdc0bc | def __call__(self, t):
if t < self.time[-1]:
# prev_time_point is the previous value in the time array
# after the current simulation time
prev_time_point = self.time[self.time <= t][-1]
# index is the index of the time array where
# prev_time_po... | |
ff789e9859eaaf78d9d0 | def csv_dict_reader(file_obj):
ret = []
reader = csv.DictReader(file_obj, delimiter=',')
n = 0
for line in reader:
ret.append([])
ret[n].append(line["name"])
ret[n].append(line["shortname"])
n=n+1
return ret | |
ff78d05e7d85b8c021f9 | def patch(self):
if not self.validate_complaint_document("update"):
return
return super(TenderUaAwardComplaintDocumentResource, self).patch() | |
ff78d63d4aef1904c00d | def get_app_root():
return os.path.dirname(os.path.realpath(__file__)) | |
ff78ed6df4ae93660ecb | def get_details(self):
return self.dm.get_data_group_details(self.id) | |
ff790f69bd9ab5d307b6 | def computeDiscountedRewards(rewards, gamma):
T = len(rewards)
R = np.zeros(T)
R[-1] = rewards[-1]
for t in range(T-2, -1, -1):
R[t] = gamma * R[t + 1] + rewards[t]
return R | |
ff7924c0cbfe08d77d3b | def greedy_backpack_gather(
map,
startTiles,
turns,
targetArmy=None,
valueFunc=None,
baseCaseFunc=None,
negativeTiles=None,
skipTiles=None,
searchingPlayer=-2,
priorityFunc=None,
skipFunc=None,
priorityTiles=None,
ig... | |
ff792f0e53a9c52aaf21 | def delete_root_volume(self):
if not self.is_ebs_backed():
return
root_vol = self.block_device_mapping[self.root_device_name]
vol_id = root_vol.volume_id
vol = self.ec2.get_volume(vol_id)
vol.detach()
while vol.update() != 'available':
time.sleep(5... | |
ff79358d20a50d1bb2a9 | def fetch_data():
return requests.get('http://codekata.com/data/04/weather.dat').text | |
ff7948998d55d6ca3655 | def main():
parser = argparse.ArgumentParser()
parser.add_argument("states",
help="IQ-TREE states outfile")
parser.add_argument("treefile",
help="IQ-TREE phylogeny outfile")
parser.add_argument("alignment",
help="Fasta alignment us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.