id stringlengths 20 20 | title stringclasses 1
value | text stringlengths 8 768k |
|---|---|---|
ff2f8cb6a4c605a7d037 | def __init__(self, artifact_info, config, **kwargs):
SimplePlugin.__init__(self, artifact_info, config, **kwargs)
self.timeline = dict()
self.share_memory = dict()
self.__origin = {
50: self._base_run,
95: self._base_clean
} | |
ff2fb627c2308f9b8308 | def _get_pdf_ev_covariance(self):
cov_matrix = numpy.zeros((self._nobsbins, self._nobsbins))
#TODO: Is it valid for symmetric eigenvectors?
if self._errortype == 'SEV':
raise NotImplementedError
if self._member_crosssections is None:
self._cache_member_crosssect... | |
ff2fcb772d9c9417e8d3 | def __init__(self, *args, **kwds):
if args or kwds:
super(Auction, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg._Header.Header()
if self.command is None:
self.command ... | |
ff2fcb8b8b1b2533b422 | def compute_contrast(aoi):
glcm = greycomatrix(aoi, distances=[5], angles=[0], levels=256,
symmetric=True, normed=True)
return (greycoprops(glcm, 'dissimilarity')[0, 0]) | |
ff2fcf50f1b07d2bafe8 | def get_revision(self, page):
# page.revision: (new) current 4 3 2 1 (old) page.revision
# page.githashes (new) 0 1 2 3 4 (old) if 5 revisions
index = len(page.githashes) - page.revision
commit_sha = str(page.githashes[index])
relpath = os.path.relpath(page.abspath,... | |
ff2fe631a7a87afcdd60 | def get_language_specification():
return read_yaml_file(SPECIFICATION_FILE) | |
ff2fee4913ff742cc9aa | def is_debug() -> bool:
return os.environ.get('RUNNER_DEBUG') == '1' | |
ff2ff234e5fc583a8122 | def parse_applist(filename):
apps = []
with open(filename) as appfile:
reader = DictReader(appfile)
if reader:
for row in reader:
apps.append(row)
return apps | |
ff30007f9ca354e23c2a | def get_resolution_info(self):
return self.send_command("/resolution/info", method="get") | |
ff301603196f4ff99b35 | def test_wraps():
def functools_decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
return 'wrapped'
return wrapper
def wrapping_decorator(f):
@wraps(f)
def wrapper(*args, **kwargs):
return 'wrapped'
return wrapper
@funct... | |
ff3031c15df2a5a0b447 | def active(self):
return self.data["active"] | |
ff3069d702951bc39c37 | def on_start(self):
self.client.post("/login", {
"username": "lifebear",
"password": "th850413"
}) | |
ff307b3e2d86d3c340bb | def runVagrantUp(scenario_name):
return requests.get('/'.join([vserver_url, "vagrant", scenario_name,"run"])).content | |
ff308b37ff5888a1735c | def plot_indcomb(name, pep_length, ylims, ylabels, window_size):
font_sizes = [32, 24]
x = np.arange(100000)
'''
capped_name = name[0]+"Ncapped_"+name[1]
capped_data = pd.read_csv(capped_name, usecols=['tot_hel'])
if "hel" or "strand" in name[1]:
capped_data['tot_hel'] = (capped_data['t... | |
ff3097a9ff44a4b73704 | def _add_loss_summaries(total_loss):
# Compute the moving average of all individual losses and the total loss.
loss_averages = tf.train.ExponentialMovingAverage(0.9, name='avg')
# losses = tf.get_collection('losses')
loss_averages_op = loss_averages.apply([total_loss])
# Attach a scalar summmary ... | |
ff30a2fbc9cdbdaccb8e | def visit(value):
if isinstance(value, Node):
return value.traverse(fun)
if isinstance(value, list):
return fun(list(map(visit, value)))
else:
return fun(value) | |
ff30c805e84cf7e318a1 | def user_v1(api_base: str) -> UserV1:
return UserV1(api_base) | |
ff30dbc0b207b8bdd2c0 | def media_position(self):
if self._state in [STATE_PLAYING, STATE_PAUSED]:
return self._track_position | |
ff30dc8d7f88fbc3e09c | def shift(array: np.ndarray, steps: int, fill_value=np.nan) -> np.ndarray:
result = np.empty_like(array)
if steps > 0:
result[:steps] = fill_value
result[steps:] = array[:-steps]
elif steps < 0:
result[steps:] = fill_value
result[:steps] = array[-steps:]
else:
res... | |
ff311578568f358c2c8c | def module(self): | |
ff3129167076a8e0fb20 | def _create_dict(lines):
ret = {}
idx = 0
# -- Idx specifies one line to process
while idx < len(lines):
# -- Skip any blank lines
if lines[idx].strip() == '':
idx += 1
continue
# -- Get the id of this line
# -- The id is just the number from a .... | |
ff31325e579cd7d01f17 | def get_all_sites() -> Any:
return session.sites | |
ff3136f2932d7251b757 | def form_invalid(self, form):
# super().form_invalid(form)
return HttpResponseRedirect(reverse_lazy('account:user-profile')) | |
ff3149eb5437ff724b7c | def zipper(dir, zip_file):
# Enable Zip64 to allow creation of large Zip files
zip = zipfile.ZipFile(zip_file, 'w',
compression=zipfile.ZIP_DEFLATED,
allowZip64=True)
root_len = len(os.path.abspath(dir))
for root, dirs, files in os.walk(dir):
a... | |
ff3161b5fe3ab98c966a | def set_chess_pieces(self):
# Set white pieces
self.board['A1'] = 'white', 'rook'
self.board['B1'] = 'white', 'knight'
self.board['C1'] = 'white', 'bishop'
self.board['D1'] = 'white', 'queen'
self.board['E1'] = 'white', 'king'
self.board['F1'] = 'white', 'bishop'
... | |
ff316922bc4b2532e10e | def crop(self, crop_size):
def int_float(val):
return float(int(val))
err_msg = 'Invalid use of argument "crop": \n {}'.format(self.crop.__doc__)
if crop_size:
try:
crop_size = map(int_float, crop_size)
if len(crop_size) == 2:
... | |
ff317727e6547b4a7f93 | def get_t2d_file_names(server):
#make a list to store all teh sub files of one specific study
file_listing = []
#get the list of sub-directories at the current dir and append them to a list
server.retrlines("LIST", file_listing.append)
#only grab the bam files from the list
files = [i.split()[-... | |
ff3191ccf1b2411ed683 | def search_topics(self, keywords, num_topics, keywords_neg=[]):
self._validate_num_topics(num_topics)
self._validate_keywords(keywords, keywords_neg)
word_vecs = [self.model[word] for word in keywords]
neg_word_vecs = [self.model[word] for word in keywords_neg]
combined_vector ... | |
ff31c44dda1efa027f9c | def first(self):
if self.is_empty():
raise Empty('Queue is empty')
return self._head._element # front aligned with head of list | |
ff31fa71cbfc188628ad | def M(self):
return np.array([
[1, 0, 0, 0.00],
[0, 1, 0, 1.65],
[0, 0, 1, 1.54],
[0, 0, 0, 1]
]) | |
ff321068aeeed7b562a9 | def clear(self):
self._image.fill(self._background_color)
self._mask.fill(MASK_WHITE)
self._updated() | |
ff321d6925eb69372bd0 | def download_created(req, download): | |
ff321eb67476f2f4077f | def argparse_init():
required = argparser.add_argument_group('Required', 'Required arguments')
required.add_argument('-b', dest='base_ami_name', required=True,
help='The name of base AMI on which to build')
required.add_argument('-p', dest='pkg', required=True,
... | |
ff323cf55d7b4ee75d0e | def gradient(self, node, output_grads):
raise NotImplementedError | |
ff32450650fb01d715a8 | def SetUpLayerManager(self):
pass | |
ff324d03287fc26fb2f3 | async def list_bot_channel_names(client, message):
names = await read_channels()
descriptions = []
if names:
lines = []
page_size = 0
for index, describer in enumerate(names, 1):
if page_size == 16:
description = '\n'.join(lines)
descr... | |
ff327816d72af4c03e9f | def __init__(self, input_dim, active_dims=None, name=None, v_w=1.0, v_b=1.0, depth=1):
super().__init__(input_dim, active_dims, name=name)
self.v_b = gpflow.params.Parameter(v_b, transform=gpflow.transforms.positive)
self.v_w = gpflow.params.Parameter(v_w, transform=gpflow.transforms.positive)
self.depth = dept... | |
ff3283d75dad1a68c6ed | def fetch_channel_data(self):
return self.fetch_data('channels') | |
ff329e1f59e56edab474 | def is_game_over(self):
# check legal moves across all rows
for row in range(self._grid_height):
value = self._game_board[row][0]
# empty space
if value == 0:
return False
# iteratively check next value in this row
... | |
ff32a556a6f7b19f72b5 | def tensor_flow(imgs):
imgs_tensor = []
for i, img in enumerate(imgs):
img_tensor = transforms.functional.to_tensor(img)
imgs_tensor.append(img_tensor)
return imgs_tensor | |
ff32b4f5511046baae9c | def metrics_using_variance(self) -> Set[str]: | |
ff32d61cf9458e11efa4 | def kill_process(self, pid_file, user, log_dir):
pid = get_user_call_output(format("cat {pid_file}"), user=user, is_checked_call=False)[1]
process_id_exists_command = format("ls {pid_file} >/dev/null 2>&1 && ps -p {pid} >/dev/null 2>&1")
kill_cmd = format("{sudo} kill {pid}")
Execute(kill_cmd,
... | |
ff32f6b1ced60e715f80 | def write_files(args, infilenames, outfilename):
write_actions = {
"print": utils.print_text,
"pdf": utils.write_pdf_files,
"csv": utils.write_csv_files,
"text": utils.write_text_files,
}
try:
for action in iterkeys(write_actions):
if args[action]:
... | |
ff32f9e5d06650c0a392 | def getTitle(self, soup):
title = f'Chapter {self.num:03}'
return title | |
ff3300e1f7d79b692ae5 | def parse_line(line: str) -> tuple[list]:
two_parts = line.split('|')
return tuple(part.split() for part in two_parts) | |
ff33101e29dc7f995071 | def dt_clean(dt):
dt = dt.replace('Z', '')
dt = dt.replace('OF', '')
return dt | |
ff3316e0feb871b35e3f | def add_child(self, node, value):
self.children.append((node, value)) | |
ff3323a75b16880fcec0 | def per_site_scaling(self) -> pulumi.Output[Optional[bool]]:
return pulumi.get(self, "per_site_scaling") | |
ff333c36cf293d7937d9 | def list_directory_contents(cls, path, list_dir=True):
list_files = list()
if not cls.is_exists(path):
return None
for filename in os.listdir(path):
if os.path.isdir(os.path.join(path, filename)):
if not list_dir:
continue
... | |
ff3340b5e82961f3bcc5 | def compile(self):
executable = os.path.join(self.path, MAKE_FILE)
self.logger.info('Compile C++ code to : '+str(executable))
print(executable)
if os.path.isfile(executable):
try:
old_path = os.getcwd()
# Change the current directory
... | |
ff3347a8a0291a8ff755 | def adjust_learning_rate_normal(optimizer, epoch, cfg):
e = False
for step in cfg.SOLVER.LR_STEPS[::-1]:
if epoch % step == 0:
e = True
break
lr_decay = cfg.SOLVER.LR_FACTOR
#lr_decay = cfg.SOLVER.LR_FACTOR ** (sum(epoch > np.array(cfg.SOLVER.LR_STEPS)))
if e:
... | |
ff3348232cac32938869 | def segment(self):
self.segment_sparse()
self.find_clumps()
self.segment_dense()
self.segment_combine() | |
ff3359efab2b2da3cf66 | def finish(self, delay = .5):
self.keepOnRunning = False
logging.info(self.id + " Stopping batch generator. Cleaning the queue which currently contains %s elements ..." % str(self.queue.qsize()))
while not self.queue.empty():
self.queue.get_nowait()
self.queue.task_done(... | |
ff337c32d4a0bc90e213 | def delete(cls, cluster_id_label):
conn = Qubole.agent(version=Cluster.api_version)
return conn.delete(cls.element_path(cluster_id_label)) | |
ff337d967be3b913394a | def _get_model_function(self):
def _model_fn(features, labels, mode):
"""Model function."""
assert labels is None, labels
(all_scores, model_predictions, losses,
training_op) = clustering_ops.KMeans(
self._parse_tensor_or_dict(features),
self._num_clusters,
... | |
ff338cda882757f46df1 | def get_all_items_user(self, user_id):
return self.dsession.query(Items).filter(
Items.user_id == user_id).order_by(Items.id).all() | |
ff33908837607573b439 | def _location_to_str(self) -> str:
s = [[b.start + 1, b.end] for b in self.location.blocks]
if self.location.strand == Strand.MINUS:
# flip every block, then flip the set of blocks
s = [b[::-1] for b in s][::-1]
# handle the incomplete sequences now
if self.star... | |
ff33aa0067af2c99c81c | def roll_cube_data(cube, shift, axis):
cube.data = da.roll(cube.core_data(), shift, axis=axis)
return cube | |
ff33bf3ef2f782517df2 | def latent_doc_term_mat(self, cutoff):
docs_id, D, s, T = self.lsa(cutoff)
S = np.diag(s)
return docs_id, np.dot(D, np.dot(S, T)) | |
ff33d49abe2929aa6f7c | def init_results(self):
results = {}
for vector in self.test:
results[vector["unique"]] = {
"baseline5": None,
"category": None,
"choice": None,
"gold": None if not Model.eval_gloss else vector["gram"],
"input": ... | |
ff3407f24a55478407a5 | def readRegister(self, reg):
pass | |
ff341e16f159e15a59fb | def get_pagelists() -> list:
url_list = ['http://monaha.ru/blog/' + str(i) for i in range(48, 0, -1)]
return url_list | |
ff343da45ece8b1f303b | def test_set_parameter_0(self):
pass | |
ff3441a9fe43cb018b90 | def amazing_feats():
feats= list()
with open( 'macgyver.html', "r" ) as f:
for line in f.readlines():
if '<li>' in line and not '/wiki/Special' in line:
try:
plain_line = html2text.html2text( line )
feats.append(plain_line.replace('*','... | |
ff348d71b2b4aef43d91 | def loop(self) -> None:
self.is_running = True
self.mainloop() | |
ff34b8ad9fd70ad98a97 | def addAdapter(self, adapterClass, ignoreClass=0):
adapt = adapterClass(self)
self.addComponent(adapt, ignoreClass)
return adapt | |
ff34eb09f2592dd4af97 | def _strip_shortcode(self, text, shortcode, callback=None):
# Default callback for processing which strips tags
def process(match):
return match.group(3)
return sub(
r'(\[%s(.*?)\](.*?)\[/%s\])' % (shortcode, shortcode),
callback or process,
text,
... | |
ff34f96b52c3f8a14881 | def multi_length_regions(
annotation, density, annotation_type,
upstream_offset, downstream_offset
):
up = {} # describes for every event the upstream region
down = {} # describes for every event the downstream region
with open(annotation) as f:
for line in f:
if not li... | |
ff350d954e89bb246be7 | def update_device_callback(self, dev_info):
self._LastDeviceInfoChanged = dev_info.to_json()
self.push_change_event("lastDeviceInfoChanged", dev_info.to_json()) | |
ff350f5c5f3270f8a28b | def get_content(self, recipe_link_list):
for ix in range(len(recipe_link_list)):
url = recipe_link_list[ix]['url']
r = requests.get(url) #returns a variable which contains the html doc unstructured
currRecipe = BeautifulSoup(r.content, "html.parser")
#there are t... | |
ff351d9757ecd00897ce | def escape(value):
return value.replace("'", "''") | |
ff358b25dd8de955c78a | def _maybe_download_and_extract(self):
dest_directory = self._data_dir
if not os.path.exists(dest_directory):
os.makedirs(dest_directory)
filename = self._data_url.split('/')[-1]
filepath = os.path.join(dest_directory, filename)
if not os.path.exists(filepath):
... | |
ff358e08a6aaae5d9f92 | def proper_divisors (n):
aux = [1]
for i in range(2, (n+1)/2+1):
if n%i==0:
aux.append(i)
return aux | |
ff35a855f1945f9c975e | def test_openid_store_created_with_datadir(self):
params = self.valid_servers['datadir']
datadir = params['datadir']
scaffold.mock("server.OpenIDStore",
outfile=self.mock_outfile)
expect_mock_output = """\
Called server.OpenIDStore(%(datadir)r)
""" % v... | |
ff35ad70ee0dd7379bf2 | def add_references(self, element, rmap, show_ids=False, lazy=None):
REFERENCE = self.TAG.reference
ATTRIBUTE = self.ATTRIBUTE
RESOURCE = ATTRIBUTE.resource
FIELD = ATTRIBUTE.field
VALUE = ATTRIBUTE.value
ID = ATTRIBUTE.id
RB = ATTRIBUTE.replaced_by
UID ... | |
ff35cbf71ea508715a0e | def Clone(self) -> "itkMaskedFFTNormalizedCorrelationImageFilterIF3IF3_Pointer":
return _itkMaskedFFTNormalizedCorrelationImageFilterPython.itkMaskedFFTNormalizedCorrelationImageFilterIF3IF3_Clone(self) | |
ff35d759bd1707a12cf5 | def __del__(self):
print "Closed connection to "+self.get_device_ID() | |
ff363b82cf25c4c5fcf7 | def search(string, arg):
string = string.lower()
names_list = TextClipNoFile.list(arg)
return [name for name in names_list if string in name.lower()] | |
ff36524ac2f210387ace | def test_check_label_name_1(self):
label_dict = {1: 'Age', 2: 'Education'}
xpl = SmartExplainer(self.model, label_dict=label_dict)
xpl.inv_label_dict = {v: k for k, v in xpl.label_dict.items()}
xpl._classes = [1, 2]
entry = 'Age'
expected_num = 0
expected_code = 1... | |
ff3652c35d634984218d | def _set_params(self, **kwargs):
for k, v in kwargs.items():
setattr(self.params, k, v) | |
ff36583d5396f5df36cb | def __init__(self, host):
from neptun_tcp import NeptunTcp
self._host = host
self.available = False
self.neptun = NeptunTcp(self._host) | |
ff366c274ee0dd540ff8 | def G1(N, x1):
if x1 != 0:
return g1[N, 0] + (g1[N, 1] * x1) + g1[N, 2] * (x1 ** 2)
else:
return 0 | |
ff36787609c2585ca4b6 | def homo_matrix(im1_pts: np.ndarray, im2_pts: np.ndarray):
assert len(im1_pts) == len(im2_pts)
num_pts = len(im1_pts)
A = []
B = []
for (x1, y1), (x2, y2) in zip(im1_pts, im2_pts):
row1 = [x1, y1, 1, 0, 0, 0, -x1 * x2, -y1 * x2]
row2 = [0, 0, 0, x1, y1, 1, -x1 * y2, -y1 * y2]
... | |
ff368a7cd7c4509ef54c | def optimizer(self):
return self._optimizers[0] | |
ff36baa9aebfc8f5bd45 | def get_jwt_token(dut, **kwargs):
username = kwargs.get('username')
password = kwargs.get('password')
url = kwargs.get('url', 'authenticate')
headers = kwargs.get('headers', {'Accept': 'application/json'})
data = {'username': username, 'password': password}
out = rest_call(dut, data=data, header... | |
ff36eaca13a0eb783b5f | def read_u16(buffer, offset):
buffer_val = buffer[offset : offset + 2]
value = [0, 0]
if type(buffer_val[0]) is str:
value[0] = ord(buffer_val[0])
value[1] = ord(buffer_val[1])
else:
value[0] = buffer_val[0]
value[1] = buffer_val[1]
if get_target_endianness() == LIT... | |
ff36f2cf1f92ce174e6c | def sum(self): | |
ff370e83c32a89adfe9b | def yaml_loader(filepath):
with open(filepath, "r") as file_descriptor:
data = yaml.load(file_descriptor)
return data | |
ff37139b472282e4f859 | def del_edge(graph, edge):
pass | |
ff3730c6cebbe36b252d | def remove(self, node: Node) -> None: | |
ff377dbfd960e7f59619 | def _test_pages_dir():
return os.path.realpath(__file__).rpartition('/')[0] + '/testpages' | |
ff377f925bbd7bcbe14d | def exp_analysis():
pass | |
ff379622fa8da7fe1ca1 | def teardown(self):
self.clean() | |
ff37a7920b5631306a76 | def last_close(ticker):
df= yf.Ticker(ticker).info['previousClose']
print("Previous Closing price: ",df) | |
ff37c0a6a2e6506301ec | def test_fail_tags_wrong_type(self):
self.assertFilterErrors(
{
'tags': Tag(self.trytes1),
},
{
'tags': [f.Type.CODE_WRONG_TYPE],
},
) | |
ff37c6fcca9aa2a16707 | def _is_type_valid(self, value, expected_type):
if expected_type["type"] == "int":
if not self._is_int(value):
raise ParserError(value, "Operand expected to be of type int")
elif expected_type["type"] == "choice":
if value not in expected_type["values"]:
... | |
ff37c74b5b5453871472 | def _validateSMIRKS(smirks, node=None): #TODO need rewrite this one (sw)
qmol = oechem.OEQMol()
if not oechem.OEParseSmarts(qmol, smirks):
if (node is not None) and ('sourceline' in node.attrib):
raise Exception("Line %s: Error parsing SMIRKS '%s'" % (node.attrib['sourceline'], node.attrib['... | |
ff37cd6450eb30e1be62 | def login():
status = userController.userLogin(request.json)
return status | |
ff37e48c8bf9caaf68a6 | def __findpath(self):
self.path=tkFileDialog.askdirectory(parent=self.main,title='Please select a directory')
#if the user heats the cancule batuoon the we will exit the program
if not self.path:
tkMessageBox.showinfo('','Exiting...')
self.main.destroy()
sel... | |
ff3826fb8505048c8554 | def gender_display(self):
return 'male' if self.gender == 'M' else 'female' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.