id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ff82b7132609786e22cc | def get_filename(self):
return os.path.basename(self.img.name) | |
ff82ba726a22813d9d52 | def view_colormap(cmap):
cmap = plt.cm.get_cmap(cmap)
colors = cmap(np.arange(cmap.N))
cmap = grayscale_cmap(cmap)
grayscale = cmap(np.arange(cmap.N))
fig, ax = plt.subplots(2, figsize=(6, 2),
subplot_kw=dict(xticks=[], yticks=[]))
ax[0].imshow([colors], extent=... | |
ff82bd992d172718f717 | def control(self, state, reference):
# Set the reference
self.ref[-1-self.control_e_idx] = reference[self.ref_idx]
# Iterate through the high-level controller stages
for i in range(len(self.controller_stages) - 1, 0 + self.control_e_idx - self.control_omega, -1):
# Set the ... | |
ff82c330381d15bf9f19 | def glGetConstants( self ):
table = {}
for block in self.constantBlocks():
for title, section in self.blocks( block ):
for possible in (
'GetBooleanv','GetIntegerv','<pname> of Get'
):
if possible in title:
... | |
ff82f2af24c5c6ae3adb | def analysis_log_site(source_file_name="task_4_statistics.txt"):
log_data = open_file(source_file_name)
result_file_path_write = check_result_file(source_file_name)
all_time_from_log = [] # list of all timestamps of user activity
popular_days_of_week = {} # dictionary by pattern [ip]:[popular days or ... | |
ff831a7bcfee320f61f9 | def __str__(self):
return "Row {}".format(self.row) | |
ff831eb9c8700311c460 | def visualize_data(number, img_array, label_array):
fig, ax = plt.subplots(nrows=10, ncols=10, sharex=True, sharey=True)
ax = ax.flatten()
for i in range(100):
img = img_array[label_array==number][i].reshape(28,28)
ax[i].imshow(img, cmap='Greys', interpolation='nearest')
plt.show() | |
ff8323c22465bc0b9ce8 | def resizeGLObjectBuffers(self, *args):
return _osgText.Text3D_resizeGLObjectBuffers(self, *args) | |
ff8331226edb7ee96f39 | def __init__(self, grid_height, grid_width, obstacle_list = None,
zombie_list = None, human_list = None):
poc_grid.Grid.__init__(self, grid_height, grid_width)
self._obstacle_list = []
if obstacle_list != None:
self._obstacle_list = obstacle_list
for cel... | |
ff8336e06b51eff84a32 | def build_docker_build(latest=True):
tmpl = "{} build -t {{tagname}}:{{tagtag}} {{pathtodockerfile}} --squash".format(OCI_CMD)
_latest = LATEST if latest else NEXT
pathtodockerfile = os.path.join(CONFD["devstation_config_root"], "." + _latest)
return tmpl.format(
tagname=CONFD["tagname"], tagtag... | |
ff8363062ea141ea5181 | def get_tasks(asana_api_object, project_id) :
return asana_api_object.get_project_tasks(project_id) | |
ff8367e8a225a6d74caa | def get_private_key(key_pair):
return key_pair[1], key_pair[2] | |
ff83ad8578e952bee1f3 | def create(*args, **kwargs):
env = kwargs.pop('env', {'ROS_NAMESPACE': "/"})
process = subprocess.Popen(args, env=dict(os.environ, **env))
return process | |
ff83b73dc4ad5734a1f3 | def _reset_value(self, initial_value=None):
with torch.no_grad():
self.R_vec.fill_(initial_value or self.initial_value)
return self.R_vec | |
ff83bc1ed304447d065c | def plot_1D(npz_name, baselines=[]):
plot_data = np.load(npz_name)
if len(baselines):
baselines = [i-1 for i in baselines]
else:
baselines = range(len(plot_data['wslices']))
plt.figure(figsize=(12, 6))
G = gridspec.GridSpec(2, 9)
plt.subplot(G[:, 0:4])
for i ... | |
ff83c26c7daf54ed649b | def create_masks(self):
if self.gridded:
for ix, grid in self.grids.items():
# Create data masks
points = MultiPoint(list(zip(grid.xg.flatten(), grid.yg.flatten())))
shapes = self._shapes[ix]
for key in shapes:
grid.... | |
ff83cecbc353a6a753ae | def get_list_as_csv(self):
csv_buffer = io.StringIO()
self.df.to_csv(csv_buffer, index=False)
csv_buffer.seek(0)
return csv_buffer | |
ff83f2930ac5bc3816a9 | def test_extend_to_y(self):
p1 = f.vector(0, 0, 0)
p2 = f.vector(1, 1, 0)
y = 5
self.assert_np_equal(
f.extend_to_y(p1, p2, y),
f.vector(y, y, 0)
) | |
ff84147fa9073957ca88 | def Product(self):
if self._context == None:
self._core.log.error('Client platform information is unavailable in this context.')
return None
return self._context.product | |
ff841ab2d58f15b88ba0 | def submit_time(self, submit_time):
self._submit_time = submit_time | |
ff84274cb8c5f4e6d8dc | def add_column(self, table_name, column):
raise NotImplementedError | |
ff842eb3f7fa2750f1c8 | def list_module_contents(module_name): | |
ff845e43c01b5a509c13 | def delete(self, node):
node_val = node.value
current_node = self.head
previous_node = None
while current_node.next:
next = current_node.next
if current_node == node:
current_node.next = None
previous_node.next = next
... | |
ff847286c56b9178bc95 | def test_field_deconstruction(self):
test_field = django_forcedfields.TimestampField(
auto_now_add=True,
auto_now_update=True,
null=True)
name, path, args, kwargs = test_field.deconstruct()
reconstructed_test_field = django_forcedfields.TimestampField(
... | |
ff847760326dbc1b59dd | def test_write_01a(self):
mybucket, mykey = create_bucket_and_key()
try:
with smart_open.s3.BufferedOutputBase('mybucket', 'writekey') as fin:
fin.write(None)
except TypeError:
pass
else:
self.fail() | |
ff8478083a8fb7164825 | def longest_ORF(dna):
full_string = find_all_ORFs_both_strands(dna)
x = len(full_string)
r = 'A'
for i in range(0, x):
z=full_string[i]
b=len(z)
if len(z) > len(r):
r = z
return r | |
ff847e20522db3b75420 | def list_book(self):
# TODO: implement the method to list all books and return a string shows that all books have been listed
# write your code below
for key,value in self.example_books.items(): #loops for listing books
print(key)
pass | |
ff848c4d6f594240d387 | def display_aux(root):
# No child.
if root.right is None and root.left is None:
line = '%s' % root.key
width = len(line)
height = 1
middle = width // 2
return [line], width, height, middle
# Only left child.
if root.right is None:
lines, n, p, x = display... | |
ff848e15303d9fd773a4 | def getPosY(self):
return self.positionY | |
ff84a16e44090602c80a | def visit_Compare(self, node: ast.Compare) -> None:
self._check_ordering(node)
self.generic_visit(node) | |
ff84a64a787429e39951 | def index(doc): | |
ff84f24f4191127a42e6 | def stop(self):
self._osc.stop()
self._raw_stream.setValue([0,0,0])
self._analyzed_stream.setValue([0,0,0])
self._trig_func.stop() | |
ff84fdcac367d69d4e0a | def remove_attribute(self, attribute):
# Normalise the name to an index
attribute = self.normalise_attribute_reference(attribute)
# Delete the attribute
self.attributes.pop(attribute)
# Delete the data
for row in self.data:
row.pop(attribute) | |
ff84fe3d6f762b831110 | def get_widget(self) -> Widget:
return self.widget | |
ff854ce2f4589917ce2f | def setup_conf(rootdir, target_dir):
d = {'rootdir':rootdir}
with open(os.path.join(target_dir, "apt.conf"), 'w') as apt_conf:
apt_conf.write(expand_file(Templates.apt_conf, d)) | |
ff855db477f2ad86b332 | def firmware_version(self) -> Optional[str]:
return self._backend.get_firmware_version(self) | |
ff855f590cd5b4f750b9 | def maskImage(self):
if self.magnitudeImage.mask is None:
self.magnitudeImage.setMask(Mask=filt.mask(self.image))
else:
self.magnitudeImage.removeMask() | |
ff85609ad21adcb982ed | def ResNet34_Model(input_shape, classes):
return ResNet(input_shape, classes, basic_block, repetitions=[3, 4, 6, 3], include_top=False) | |
ff856fc4119979091e3b | def itkScanlineFilterCommonIUS2ISS2_cast(obj: 'itkLightObject') -> "itkScanlineFilterCommonIUS2ISS2 *":
return _itkScanlineFilterCommonPython.itkScanlineFilterCommonIUS2ISS2_cast(obj) | |
ff857e5505508dff081a | def _get_today() -> datetime.date:
return datetime.datetime.today() + datetime.timedelta(hours=6) | |
ff858a69755952cff355 | def __contains__(self, ext):
return ext in self.file | |
ff85900fe5f50289ac1d | def generate_user_name(spawner):
return spawner.user.name | |
ff8598ca1adee981178a | def get_next(self):
return self.next_node | |
ff85ac17fd3691ba831b | def getSignature(signingKey, data):
while 1:
signature = signingKey.sign_digest(data, sigencode=ecdsa.util.sigencode_der)
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
r, s = ecdsa.util.sigdecode_der(signature, signingKey.curve.generator.order())
if s < N/2:
... | |
ff85cfb9958d6ded2654 | def random_sampler(self, model, architect, args):
rand_spec_id, rand_spec = self.search_space.random_topology()
self.model_spec_id = rand_spec_id
self.model_spec = rand_spec
new_model = change_model_spec(model, rand_spec)
# this is saved per sample.
self.trained_model_spe... | |
ff85e6ae3b659b7776fe | def heuristic(self):
goal = goalState(len(self.Sequence))
count = 0
for idx, i in enumerate(self.Sequence):
if i is not goal[idx]:
count += 1
return count | |
ff85f30d4bfbfcee0a5c | def binarization(self):
img = np.copy(self.image)
if len(img.shape) == 2:
threshold = img.mean() + self.bias_for_threshold
img[img < threshold] = 0
img[img >= threshold] = 1
elif len(img.shape) == 3:
"""suppose read from a jpg file with three chann... | |
ff8615b1b895fc18f2f3 | def identity():
return quaternion(1) | |
ff8620ae77de47f6bb3b | def get_indicators_command(client: CyCognitoFeedClient, args: Dict[str, Any]) -> CommandResults:
asset_type = args.get('asset_type', '').lower()
count = arg_to_number(args.get('count', 50), arg_name='count')
offset = max(arg_to_number(args.get('offset', 0), arg_name='offset'), 0) # type: ignore
sort_or... | |
ff8621a347e602c614f6 | def create_filter_bank(wavelet_type='bior2.2'):
# Load the wavelet from pywt
w = pywt.Wavelet(wavelet_type)
# Tensorflow implements convolutional operators
# as cross-correlations, which is equivalent to
# convolutions with a flipped kernel. Flip the
# wavelets in order to be compatibl... | |
ff8646c6fc191f3b9493 | def categories(self):
return self.categories_ | |
ff866800e6886f666a2e | def getResults(self, communications): | |
ff8674ccde596d0d4863 | def user_response(self):
return self.get('user_response') | |
ff867ede684a312a0ef7 | def get_by_email(self, email: str):
return User.query.filter_by(email=email).first() | |
ff8680e64a74ad47f821 | def moment_monomials(self, maxdeg):
import sympy.polys.monomials as mn
allvars = self.sym_betas
terms = mn.itermonomials(allvars, maxdeg)
return terms | |
ff86ae12bab2d1f74e3e | def str2fp(data):
return BytesIO(bytearray(data, const.ENCODING)) if const.PY3 else StringIO(data) | |
ff86b9af7b2c4fde45fb | def __init__(self, to_user_id=None, message_type=None, persona_id=None, content=None, client_msg_id=None): # noqa: E501 # noqa: E501
self._to_user_id = None
self._message_type = None
self._persona_id = None
self._content = None
self._client_msg_id = None
self.discrimina... | |
ff86bf5eefe4c7d41389 | def clean(self):
cleaned_data = super(IngestionRequestForm, self).clean()
if not self.is_valid():
return
# this id done to get rid of some weird rounding issues - a lot of the solid BBs end up being 3.999999999123412 rather than
# the expected 4
cleaned_data['latitu... | |
ff86cdef2aea4004cc9d | def build_model(self):
kwargs = self.compile_kwargs or {}
self._model = supervised.build_keras_model(layers=self.layers,
optimizer=self.optimizer,
loss=self.loss,
... | |
ff86d991acd716c2b5a0 | def index_page():
return render_template('index.html') | |
ff86e4737cc9459a54cd | def create_default_admin():
criteria = {
'username': u"admin",
'first_name': u"Administrator",
'is_active': True,
'is_superuser': True,
'is_staff': True,
}
admin = User(**criteria)
admin.set_password("admin")
admin.save() | |
ff86f2d11972a160ed45 | def _runge_kutta_variable_step(self, Us_rk, Uphi_rk):
return self._runge_kutta_helper(Us_rk, Uphi_rk, self.data["time_to_cover_entire_perimeter"]) | |
ff870578b511aaa1dc96 | def set_white(white_value = 0):
white_pwm.duty(white_value) | |
ff87180dc38eeb725c0d | def get_addresses(self, limit=5, page=0):
return [
self.get_address(account_id)
for account_id in range(page * limit, (page + 1) * limit)
] | |
ff87303577e28dd1c72c | def vgremove(self, group_label):
log.info('running vgremove')
command = 'vgremove --force %s' % group_label
return self.__execute(command) | |
ff875ced09db815fecf4 | def GetResult (self):
if self.state & self.STATE_DONE:
if self.state & self.STATE_FAIL:
return None, self.value
else:
return self.value, None
raise FutureNotReady () | |
ff87639bd9a99842e693 | def get_scan_type_id_from_name(self, scan_type_name):
results = self.db.pselect(
query='SELECT ID FROM mri_scan_type WHERE Scan_type = %s',
args=(scan_type_name,)
)
return results[0]['ID'] if results else None | |
ff879bd8da1f330d8d4c | def list_available_solution_stacks():
pass | |
ff87bc88512805c24bfe | def _process_message(self, message, sender):
if message.is_credit():
self._credit(message.amount)
elif message.is_debit():
if self._check_amount(message.amount):
self._debit(message.amount, sender)
else:
self._send_refuse(sender)
elif message.is_marker():
logging.info("Processing marker messa... | |
ff87cf1a6a26aa91384b | def step(self, action):
raise NotImplementedError | |
ff87d21627973635195c | def citation_sections(cite):
return re.findall(SUBSECTION_RE, cite) | |
ff87d2b0f88bd8eca0e5 | def create_folder(self, ignore_existing=False, recursive=False):
raise NotImplementedError | |
ff87e3f0f4193d750b16 | def first_outermost_dus(self):
def is_interesting_du(n):
return self.is_edu(n) or\
(self.is_cdu(n) and self.cdu_members(n))
dus = list(filter(is_interesting_du,self.nodes()))
return self.sorted_first_outermost(dus) | |
ff883db10c8477b6c3ec | def find_nearest_positive_definite(matrix: np.ndarray) -> np.ndarray:
if check_positive_definite(matrix):
return matrix
warnings.warn("The estimated covariance matrix was not positive definite, the nearest positive "
"definite matrix has been found and will be used.")
B = (matri... | |
ff8840164614223524e5 | def hms_to_time(hours, minutes, seconds):
d = time(0,0,0,0)
if seconds < 60:
d = d.replace(second=seconds)
else:
d = d.replace(second=seconds % 60)
minutes += (seconds // 60)
if minutes < 60:
d = d.replace(minute=minutes)
else:
d = d.replace(min... | |
ff884c018c8615ef51c9 | def _write(self, value, word_offset=0, blindwrite=True):
self.host.write_int(self.control_register, value,
word_offset=word_offset, blindwrite=blindwrite) | |
ff88576065e1b9bc0647 | def _circuit_body(params, wires):
for param in params[:-1]:
for wire in wires:
qml.RY(param[wire], wires=wire)
_u_ent(wires)
for wire in wires:
qml.RY(params[-1, wire], wires=wire) | |
ff8871a9ad8f7efcaef4 | def connection():
global _connection
if _connection is None:
_connection = StrictRedis.from_url(REDIS_URL)
return _connection | |
ff888efdfc2eefc57a42 | def onLoadAlignment(self):
self.message_to_main.put({"LOAD_ALIGNMENT": True}) | |
ff889526df879d4c21ea | def _to_dict(self, line):
ret = dict()
cols = line.split('\t')
for i in range(len(self._columns)):
c = self._columns[i].lower()
ret[c] = cols[i]
return ret | |
ff88979e61e5783a779e | def _register_connection(self, connection, shell_name): | |
ff8898adabf345bf4c5b | def save(self, path, *args, **kwargs): # pylint: disable=arguments-differ
if self.estimator is not None:
with open(path, "wb") as file:
dill.dump(self.estimator, file)
else:
raise ValueError("HMM estimator does not exist. Check your cofig for 'estimator'.") | |
ff88a13f92b7cb140ead | def is_hermitian(self): | |
ff88ab99da46e036571f | def addr_eq(a, b):
return (
a.spend_public_key == b.spend_public_key
and a.view_public_key == b.view_public_key
) | |
ff88ac0e0c4fbd88f2b1 | def __init__(self):
super(DictionaryWithDefinitions, self).__init__() | |
ff88acbea98678008011 | def seperateByType(self):
self.clearList()
self._layout = 'seperateByType'
self.__cardsToTypeSeparators()
self.__typeToTopLevel()
self.applyFilters()
self.resizeColumns() | |
ff88adc71f4f46b9f29c | async def error(request):
logger.error(f"Unknown exception has occurred. Use debug mode to troubleshoot")
raise RuntimeError("Oh no") | |
ff88aec0c882afbee025 | def __get_mode(self):
return VehicleMode(self.__module.flightmode) | |
ff88fe213e3312e22018 | def output(self, sequence):
with open ("assembly sequence of " + self.filename + ".txt", "w") as f:
f.write(sequence) | |
ff8907c57fc5854d8428 | def evaluate_nmi(courses, modularities):
return sklearn.metrics.normalized_mutual_info_score(courses, modularities) | |
ff8923c643cfbc6e35a8 | def checkInstallfailed(self):
self.info = self.return_json.json()
time.sleep(1)
beaurl = self.info['rcs'][0]['beaconurl']
time.sleep(1)
self.url = self.info['rcs'][0]['beacon']['installfailed'][0]['parameters']
self.url = beaurl + self.url
self.code = requests.re... | |
ff895f29c4adc374020c | def get_widths_from_bins(bins):
# return bins[1:] - bins[:-1]
return np.array([np.abs(bins[i+1] - bins[i]) for i in range(len(bins)-1)]) | |
ff89629626b1079ed285 | def random_color():
return choice(color_list) | |
ff896cc85e87c8371af8 | def get_type(self, directory, test_name):
return ArtHeader(os.path.join(directory, test_name)).get(ArtHeader.ART_TYPE) | |
ff89857130e0f824ad5e | def filter_remove_prompts(stream):
for line in stream:
line = re.sub(r".*:[ \t]*", "", line)
if re.search(r"\S", line):
yield line | |
ff89894b1a5068f991b6 | def check_generic_object(self):
ct_pk = int(self.data['content_type'])
obj_pk = int(self.data['object_id'])
return generic_object_get(ct_pk, obj_pk) | |
ff89a7c96172cd79535b | def total_regions(used_squares):
count = 0
while used_squares:
q = [used_squares[0]]
while q:
(x, y) = q.pop()
if (x, y) in used_squares:
used_squares.remove((x, y))
q += [(x - 1, y), (x + 1, y), (x, y + 1), (x, y - 1)]
count += 1
... | |
ff89ac1dbe3abca188e5 | def subnet_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "subnet_id") | |
ff89ac85d7d0abd7601a | def create_layouts(self):
self.main_layout = QtWidgets.QGridLayout(self) | |
ff89c23340b57dee9b4f | def cos_theta_solar_func(sun_elevation):
return math.sin(sun_elevation * math.pi / 180.) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.