text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
def getpaths_fromlookback(input_prefix_, lookback_, start_date_=None):
"""
Generates input paths for ONE day *lookback_* days prior to *start_date_*
:type input_prefix_: str
:param input_prefix_: root folder of the source data
:type lookback_: int
:param lookback_: number of day... | code_fim | hard | {
"lang": "python",
"repo": "kleopatra999/filemerge",
"path": "/filemerge/filemerge.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._cert_type
@cert_type.setter
def cert_type(self, value):
self._cert_type = value
@property
def channel_user_id(self):
return self._channel_user_id
@channel_user_id.setter
def channel_user_id(self, value):
self._channel_user_id = value
... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/InsQueryPerson.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._channel_user_source = value
@property
def type(self):
return self._type
@type.setter
def type(self, value):
self._type = value
def to_alipay_dict(self):
params = dict()
if self.cert_no:
if hasattr(self.cert_no, 'to_alipay_dic... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/InsQueryPerson.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/InsQueryPerson.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InsQueryPerson(object):
def __init__(self):
self._cert_no = None
self._cert_type... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/InsQueryPerson.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ral Public License.
See file COPYING.txt for more information."""<|fim_prefix|># repo: lino-framework/book path: /lino_book/projects/homeworkschool/__init__.py
# -*- coding: UTF-8 -*-
__copyright__ = """\
Copyright (c) 201<|fim_middle|>2-2013 Rumma & Ko Ltd.
This software comes with ABSOLUTELY NO WARRA... | code_fim | medium | {
"lang": "python",
"repo": "lino-framework/book",
"path": "/lino_book/projects/homeworkschool/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lino-framework/book path: /lino_book/projects/homeworkschool/__init__.py
# -*- coding: UTF-8 -*-
__copyright__ = """\
Copyright (c) 201<|fim_suffix|>ral Public License.
See file COPYING.txt for more information."""<|fim_middle|>2-2013 Rumma & Ko Ltd.
This software comes with ABSOLUTELY NO WARRA... | code_fim | medium | {
"lang": "python",
"repo": "lino-framework/book",
"path": "/lino_book/projects/homeworkschool/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>RRANTY and is
distributed under the terms of the GNU Lesser General Public License.
See file COPYING.txt for more information."""<|fim_prefix|># repo: lino-framework/book path: /lino_book/projects/homeworkschool/__init__.py
# -*- coding: UTF-8 -*-
__copyright__ = """\
Copyright (c) 201<|fim_middle|>2-2... | code_fim | medium | {
"lang": "python",
"repo": "lino-framework/book",
"path": "/lino_book/projects/homeworkschool/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qklee-lz/Lanedet_framework path: /configs/resa/resa34_tusimple.py
net = dict(
type='Detector',
)
backbone = dict(
type='ResNetWrapper',
resnet='resnet34',
pretrained=False,
replace_stride_with_dilation=[False, True, True],
out_conv=True,
)
featuremap_out_channel = 128
fea... | code_fim | hard | {
"lang": "python",
"repo": "qklee-lz/Lanedet_framework",
"path": "/configs/resa/resa34_tusimple.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>img_norm = dict(
mean=[103.939, 116.779, 123.68],
std=[1., 1., 1.]
)
img_height = 368
img_width = 640
cut_height = 160
ori_img_h = 720
ori_img_w = 1280
train_process = [
dict(type='RandomRotation'),
dict(type='RandomHorizontalFlip'),
dict(type='Resize', size=(img_width, img_height)),... | code_fim | hard | {
"lang": "python",
"repo": "qklee-lz/Lanedet_framework",
"path": "/configs/resa/resa34_tusimple.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VEEOS-Team/VEEOS_Scripting path: /src/bridgescripts.py
:[ """from collections import OrderedDict
import socket
import json
import re
import argparse
import sys
import traceback
import ast
import struct
def checkforVEE(script):
returnToVEE = []
checkRegex = r'returnToVEE( +)(((.+)(,)?)+)'
... | code_fim | hard | {
"lang": "python",
"repo": "VEEOS-Team/VEEOS_Scripting",
"path": "/src/bridgescripts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> script, returnToVEE = checkforVEE(script)
for field_name in input_data:
if(input_data[field_name][0] != "str"):
input_data[field_name][1] = ast.literal_eval(input_data[field_name][1])
send_expressions = []
for item in input_data:
if(input_data[item][2]):
... | code_fim | hard | {
"lang": "python",
"repo": "VEEOS-Team/VEEOS_Scripting",
"path": "/src/bridgescripts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VEEOS-Team/VEEOS_Scripting path: /src/bridgescripts.py
e
import sys
import traceback
import ast
import struct
def checkforVEE(script):
returnToVEE = []
checkRegex = r'returnToVEE( +)(((.+)(,)?)+)'
returnScript = ''
for line in script.split("\\n"):
if(re.match(checkRegex, l... | code_fim | hard | {
"lang": "python",
"repo": "VEEOS-Team/VEEOS_Scripting",
"path": "/src/bridgescripts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> err_min = 1
last_improved = 0
reset = 0
#show_batch(seq2seq, es, sess, rlut1, rlut2, embed2, True)
for i in range(FLAGS.epochs):
print('Training epoch %d' % (i+1))
trainer.train(ts, sess, train_writer, FLAGS.dropout)
if FLAGS.sho... | code_fim | hard | {
"lang": "python",
"repo": "vode/baseline",
"path": "/seq2seq/python/tf/seq2seq.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vode/baseline path: /seq2seq/python/tf/seq2seq.py
import tensorflow as tf
import numpy as np
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
from w2v import Word2VecModel
from data import load_sentences, build_vocab
from utils import *
from model impor... | code_fim | hard | {
"lang": "python",
"repo": "vode/baseline",
"path": "/seq2seq/python/tf/seq2seq.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if i > MAX_EXAMPLES:
break
i += 1
print('========================================================================')
sent = lookup_sentence(rlut1, src_i, True)
print('[OP] %s' % sent)
sent = lookup_sentence(rlut2, tgt_i)
print('[Actual] %s... | code_fim | hard | {
"lang": "python",
"repo": "vode/baseline",
"path": "/seq2seq/python/tf/seq2seq.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThakeeNathees/cb-imgui path: /thirdparty/glfw/src/search.py
import re, os, sys
## help : > python search.py regex [path="."] [output='result.txt']
## usage: > python search.py "func .*?\(\)"
## override skip_search() for ignore file/dirs
VALID_FORMAT = ['.h', '.cpp']
def skip_search(_dir):
<|f... | code_fim | hard | {
"lang": "python",
"repo": "ThakeeNathees/cb-imgui",
"path": "/thirdparty/glfw/src/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
search_str, path, out = (sys.argv[1:] + ['', '', ''])[:3]
if path == '': path = '.'
if out == '': out = 'result.log'
with open(out, 'w', encoding='utf8'):
pass # clear last results
if search_str[0] == '"' and search_str[-1] == '"':
search_str... | code_fim | hard | {
"lang": "python",
"repo": "ThakeeNathees/cb-imgui",
"path": "/thirdparty/glfw/src/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jakirkham/z5 path: /src/python/module/z5py/dataset.py
import os
import numbers
import json
import numpy as np
from ._z5py import DatasetImpl, open_dataset
from ._z5py import write_subarray, write_scalar, read_subarray, convert_array_to_format
from .attribute_manager import AttributeManager
cla... | code_fim | hard | {
"lang": "python",
"repo": "jakirkham/z5",
"path": "/src/python/module/z5py/dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # most checks are done in c++
def __getitem__(self, index):
roi_begin, shape = self.index_to_roi(index)
out = np.empty(shape, dtype=self.dtype)
read_subarray(self._impl, out, roi_begin)
return out
# most checks are done in c++
def __setitem__(self, index, i... | code_fim | hard | {
"lang": "python",
"repo": "jakirkham/z5",
"path": "/src/python/module/z5py/dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO support ellipsis
def index_to_roi(self, index):
# check index types of index and normalize the index
assert isinstance(index, (slice, tuple)), \
"z5py.Dataset: index must be slice or tuple of slices"
index_ = (index,) if isinstance(index, slice) else ind... | code_fim | hard | {
"lang": "python",
"repo": "jakirkham/z5",
"path": "/src/python/module/z5py/dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TK-21st/neuroarch path: /loaders/load_larva.py
""" Janelia Larva TEM data
Some design choices:
1. Neurons default to local neuron. Mostly for those in AL
2. Synapse's neuropil follows presynaptic neuron's neuropil
3. Datasource only owns neuron morphology but not synapse morphology, following cu... | code_fim | hard | {
"lang": "python",
"repo": "TK-21st/neuroarch",
"path": "/loaders/load_larva.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO: add synapses
conn_df = pd.read_csv(conn_file_name)
for pre_neuron_name in conn_df.presynaptic.unique():
post_rows = conn_df[conn_df['presynaptic']==pre_neuron_name]
pre_neuron_node = self.g_orient.Neurons.query(uname=pre_neuron_name).first()
... | code_fim | hard | {
"lang": "python",
"repo": "TK-21st/neuroarch",
"path": "/loaders/load_larva.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> rho_b = grid_cell_array.get_cell_attr(index, "rho_b")
print("rho_b: ", rho_b)
print("Sum of particles in the grid cell: ", sum_weight)
return
# normalizes particle_orders_array_accum so that the aggregating
# particles assigned to each grid cell is Vb particles in total
def n... | code_fim | hard | {
"lang": "python",
"repo": "mark-koren/AdaptiveStressTestingToolbox",
"path": "/examples/hifi/EnvironmentPrediction/Predictions/ParticleFilter/NewParticleInitialization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mark-koren/AdaptiveStressTestingToolbox path: /examples/hifi/EnvironmentPrediction/Predictions/ParticleFilter/NewParticleInitialization.py
import examples.hifi.EnvironmentPrediction.Predictions.ParticleFilter.Particle
import examples.hifi.EnvironmentPrediction.Predictions.ParticleFilter.Grid
impo... | code_fim | hard | {
"lang": "python",
"repo": "mark-koren/AdaptiveStressTestingToolbox",
"path": "/examples/hifi/EnvironmentPrediction/Predictions/ParticleFilter/NewParticleInitialization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if cell_index == 0:
return 0
else:
return int(particle_orders_array_accum[cell_index - 1])
# Calculates last index in birth_particle_array of cell j
def calc_end_idx(particle_orders_array_accum, cell_index):
# end_idx would be start_idx - 1 if mass = 0 for cell
return int(... | code_fim | hard | {
"lang": "python",
"repo": "mark-koren/AdaptiveStressTestingToolbox",
"path": "/examples/hifi/EnvironmentPrediction/Predictions/ParticleFilter/NewParticleInitialization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiankangren/scheduling-rl path: /src/schedulers/scheduler_value_iteration.py
import numpy as np
from collections import OrderedDict
from environment import State
import pdb, sys
# FIXME remove these
# Action constants
NOP = 0
SCHEDULE = 1
# FIXME remove job_gen because it not needed any more
c... | code_fim | hard | {
"lang": "python",
"repo": "jiankangren/scheduling-rl",
"path": "/src/schedulers/scheduler_value_iteration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Constants
#epsilon = 0.001
epsilon = 0.000001
gamma = 0.8
# Value iteration
iterations = 0
delta = epsilon
while delta >= epsilon:
delta = 0
for state, actions in Q.items():
for action, Q_sa in enum... | code_fim | hard | {
"lang": "python",
"repo": "jiankangren/scheduling-rl",
"path": "/src/schedulers/scheduler_value_iteration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> nexts = []
for next_state in next_states:
prob = probabilities[next_state[0]]
# FIXME
#reward = next_state[1][0]
if state[1][1] == 1:
reward ... | code_fim | hard | {
"lang": "python",
"repo": "jiankangren/scheduling-rl",
"path": "/src/schedulers/scheduler_value_iteration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shahid92/Full-Face-Classifier path: /detecting system.py
= cv2.VideoCapture(0)
font1=cv2.FONT_HERSHEY_SIMPLEX
font2=cv2.FONT_HERSHEY_DUPLEX
#/////////////////////////////////////////////////////////////////////
face_cascade = cv2.CascadeClassifier('faces.xml')
eye_cascade = cv2.CascadeCla... | code_fim | hard | {
"lang": "python",
"repo": "shahid92/Full-Face-Classifier",
"path": "/detecting system.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def chin_module():
root = Toplevel()
chin_module.lmain =Label(root)
chin_module.lmain.pack()
exit_button=Button(root,text="quit",height=5,width=45,fg="red",bg="white",command=root.destroy)
exit_button.pack()
chin_frame()
root.mainloop()
cap.release()
def hair_module():
... | code_fim | hard | {
"lang": "python",
"repo": "shahid92/Full-Face-Classifier",
"path": "/detecting system.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shahid92/Full-Face-Classifier path: /detecting system.py
/
def FACE(gray, frame):
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
cv2.putText(frame,'face detection system is activated',(50,20),font2,1,(0,0,100),1)
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, ... | code_fim | hard | {
"lang": "python",
"repo": "shahid92/Full-Face-Classifier",
"path": "/detecting system.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(file_path) as documentation_file:
replacing = False
result: List[str] = []
text = documentation_file.readlines()
for line in text:
if line.startswith(header):
replacing = True
result.append(line)
resu... | code_fim | medium | {
"lang": "python",
"repo": "github/incubator-airflow",
"path": "/scripts/ci/pre_commit/pre_commit_insert_extras.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
install_file_path = os.path.join(AIRFLOW_SOURCES_DIR, 'INSTALL')
contributing_file_path = os.path.join(AIRFLOW_SOURCES_DIR, 'CONTRIBUTING.rst')
extras = wrap(", ".join(EXTRAS_REQUIREMENTS.keys()), 100)
extras = [line + "\n" for line in extras]
insert_document... | code_fim | hard | {
"lang": "python",
"repo": "github/incubator-airflow",
"path": "/scripts/ci/pre_commit/pre_commit_insert_extras.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: github/incubator-airflow path: /scripts/ci/pre_commit/pre_commit_insert_extras.py
#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding ... | code_fim | hard | {
"lang": "python",
"repo": "github/incubator-airflow",
"path": "/scripts/ci/pre_commit/pre_commit_insert_extras.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Qkrisi/PTML-Framework path: /PTML_Tags.py
from inspect import getfullargspec
from PTML_Constants import *
Tags = {}
Functions = {}
ExecuteOnLoad = {}
def Tag(name):
def TagHandler(func):
def TagWrapper(**kwargs):
argspec = getfullargspec(func)
NewArgs = {}... | code_fim | medium | {
"lang": "python",
"repo": "Qkrisi/PTML-Framework",
"path": "/PTML_Tags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ExecuteOnLoad[Route].append((UpdateData(data), str(ParentID)))
return ""
@Tag("pyfunc")
def PyFunction(*, name, data, Route):
name = name.strip() if name!=None else ""
if not name:raise ValueError(f"Invalid function name: {name}")
Functions[Route][name]=UpdateData(data)
return ""<... | code_fim | hard | {
"lang": "python",
"repo": "Qkrisi/PTML-Framework",
"path": "/PTML_Tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Graficando los valores')
lr.plot_regression(data_x, data_y, b)
if __name__ == '__main__':
main()<|fim_prefix|># repo: OscarPalominoC/linearRegression path: /main.py
import linearRegression as lr
import numpy as np
# Código main
def main():
# Dataset: Estos valores los obtuve al ... | code_fim | medium | {
"lang": "python",
"repo": "OscarPalominoC/linearRegression",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OscarPalominoC/linearRegression path: /main.py
import linearRegression as lr
import numpy as np
# Código main
def main():
# Dataset: Estos valores los obtuve al tomar la lectura diaria del consumo de luz en mi hogar el mes de abril
data_x = np.array([1,2,3,4,5, 6, 7 ,8, 9, 10, 11, 12, 13... | code_fim | medium | {
"lang": "python",
"repo": "OscarPalominoC/linearRegression",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jacobmontiel/river path: /river/tree/_attribute_observer/nominal_attribute_regression_observer.py
from river.stats import Var
from river.utils import VectorDict
from .._attribute_test import NominalAttributeBinaryTest
from .._attribute_test import NominalAttributeMultiwayTest
from .._attribute_te... | code_fim | hard | {
"lang": "python",
"repo": "jacobmontiel/river",
"path": "/river/tree/_attribute_observer/nominal_attribute_regression_observer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for att_val in ordered_feature_values:
actual_dist = self._statistics[att_val]
remaining_dist = pre_split_dist - actual_dist
post_split_dist = [actual_dist, remaining_dist]
merit = criterion.merit_of_split(pre_split_dist, post_split_dist)
... | code_fim | hard | {
"lang": "python",
"repo": "jacobmontiel/river",
"path": "/river/tree/_attribute_observer/nominal_attribute_regression_observer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anna-g-arbeiter/base64 path: /base64.py
#!/usr/bin/env python3
import sys
class Base64Encoder:
def encode(self, unicode_string=None):
if(unicode_string is None):
print("Provide a string to be encoded.")
return
get_bits = lambda c : bin(ord(c))[2:]
... | code_fim | hard | {
"lang": "python",
"repo": "anna-g-arbeiter/base64",
"path": "/base64.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> encoder = Base64Encoder()
print(encoder.encode(sys.argv[1]))
if __name__ == "__main__":
if(len(sys.argv) != 2):
print("One input string required.")
sys.exit(-1)
else:
main()<|fim_prefix|># repo: anna-g-arbeiter/base64 path: /base64.py
#!/usr/bin/env python3
import... | code_fim | hard | {
"lang": "python",
"repo": "anna-g-arbeiter/base64",
"path": "/base64.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> index = 0
while index < bit_stream.__len__():
base64_decimal = get_decimal(index)
base64_char = get_base64_char(base64_decimal)
base64_stream += base64_char
index += 6
# The filling zero bytes are wrongly completely encoded with A.
... | code_fim | hard | {
"lang": "python",
"repo": "anna-g-arbeiter/base64",
"path": "/base64.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhayychoudhary/Dialogflow path: /main.py
import csv
import json
import trainingjsonfile
import os
# Define The folder name
csvfile = "TrainingCSV/Templet.csv"
# Define the Folder name where you want to create all the JSON file.
importFolder="Intent/"
with open(csvfile, 'r', encoding='utf-8') ... | code_fim | hard | {
"lang": "python",
"repo": "abhayychoudhary/Dialogflow",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if row[3] and row[4] or row[3]:
trainingjsonfile.outputOutputContext(row)
print(trainingjsonfile.outputOutputContext(row))
with open(importFolder+row[0]+".json", 'w', encoding='utf-8') as f:
json.dump(trainingjsonfile.outputOu... | code_fim | hard | {
"lang": "python",
"repo": "abhayychoudhary/Dialogflow",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> inter = (probs * gts).sum(dim=-1)
union = (probs + gts).sum(dim=-1)
iou_loss = 1 - (inter + smooth_factor) / (union - inter + smooth_factor)
return iou_loss
@check_args
def cal_iou_loss(logits, gts, reduction="mean"):
"""
IOU Loss
:param logits: N,C,H,W
:param gts: N,1,H... | code_fim | hard | {
"lang": "python",
"repo": "lartpang/PyLoss",
"path": "/losspy/region_based/dice_iou.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lartpang/PyLoss path: /losspy/region_based/dice_iou.py
# -*- coding: utf-8 -*-
# @Time : 2020/12/12
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from ..utils.misc import check_args, reduce_loss
def _cal_dice_loss(probs, gts, smooth_factor: int = 1):
numerator = 2 * (p... | code_fim | hard | {
"lang": "python",
"repo": "lartpang/PyLoss",
"path": "/losspy/region_based/dice_iou.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
IOU Loss
:param logits: N,C,H,W
:param gts: N,1,H,W
:param reduction: mean, sum or none
:return: iou loss
"""
probs = logits.sigmoid().flatten(2).permute(1, 0, 2) # C,N,HW
gts = gts.flatten(1) # N,HW
# 对类别平均
num_classes = probs.shape[0]
if num_classe... | code_fim | medium | {
"lang": "python",
"repo": "lartpang/PyLoss",
"path": "/losspy/region_based/dice_iou.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Metatab/rowgenerators path: /rowgenerators/appurl/file/file.py
# Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the
# MIT, included in this distribution as LICENSE
"""Base class for file URLs, URLs on a local file system. These are URLs that can be opened and read""... | code_fim | hard | {
"lang": "python",
"repo": "Metatab/rowgenerators",
"path": "/rowgenerators/appurl/file/file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return contents of the target file"""
path = self.get_resource().get_target().fspath
with open(path, mode=mode) as f:
return f.read()
def join_target(self, tf):
"""For normal files, joining a target assumes the target is a child of the current target's... | code_fim | hard | {
"lang": "python",
"repo": "Metatab/rowgenerators",
"path": "/rowgenerators/appurl/file/file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def testABC():
md2Encoder = MD2()
message = "abc"
assert md2Encoder.encodeMessage(message) == MD2Tests.get('abc')
def testMessageDigest():
md2Encoder = MD2()
message = "message digest"
assert md2Encoder.encodeMessage(message) == MD2Tests.get('message digest')
def testAbecedary... | code_fim | hard | {
"lang": "python",
"repo": "davidrodriguezpozo/cryptographic-hash-functions",
"path": "/functions/md2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidrodriguezpozo/cryptographic-hash-functions path: /functions/md2.py
"""
Given a message of length n:
1. Extend the message so its length is congruent to 0 modulo 16.
Now the message has a length that is a multiple of 16.
2. Append Checksum. 16 byte checksum is appended to the previous ... | code_fim | hard | {
"lang": "python",
"repo": "davidrodriguezpozo/cryptographic-hash-functions",
"path": "/functions/md2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
name: str,
fields: List[DataModelFieldBase],
decorators: Optional[List[str]] = None,
path: Optional[Path] = None,
description: Optional[str] = None,
):
super().__init__(
name=name,
fields=fields,
decorato... | code_fim | medium | {
"lang": "python",
"repo": "dldinternet-rs/datamodel-code-generator",
"path": "/datamodel_code_generator/model/enum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dldinternet-rs/datamodel-code-generator path: /datamodel_code_generator/model/enum.py
from pathlib import Path
from typing import Any, List, Optional
from datamodel_code_generator.imports import IMPORT_ENUM
from datamodel_code_generator.model import DataModel, DataModelFieldBase
from datamodel_c... | code_fim | medium | {
"lang": "python",
"repo": "dldinternet-rs/datamodel-code-generator",
"path": "/datamodel_code_generator/model/enum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(
self,
name: str,
fields: List[DataModelFieldBase],
decorators: Optional[List[str]] = None,
path: Optional[Path] = None,
description: Optional[str] = None,
):
super().__init__(
name=name,
fields=fields,
... | code_fim | medium | {
"lang": "python",
"repo": "dldinternet-rs/datamodel-code-generator",
"path": "/datamodel_code_generator/model/enum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emabello42/visual-search path: /tests/conftest.py
import pytest
from visualsearch.app import create_app
from visualsearch.flask_settings import TestConfig
<|fim_suffix|> return create_app(TestConfig)<|fim_middle|>@pytest.yield_fixture(scope='function')
def app():
| code_fim | easy | {
"lang": "python",
"repo": "emabello42/visual-search",
"path": "/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return create_app(TestConfig)<|fim_prefix|># repo: emabello42/visual-search path: /tests/conftest.py
import pytest
from visualsearch.app import create_app
from visualsearch.flask_settings import TestConfig
<|fim_middle|>@pytest.yield_fixture(scope='function')
def app():
| code_fim | easy | {
"lang": "python",
"repo": "emabello42/visual-search",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>RepoExists',
'GitHubRepoDoesNotExist',
'GitHubUnknownError',
'GitHubNoTeamFound',
]<|fim_prefix|># repo: mitodl/orcoursetrion path: /orcoursetrion/lib/__init__.py
# -*- coding: utf-8 -*-
"""
Orchestrion library
"""
from orcoursetrion.lib.github import (
<|fim_middle|> GitHub,
GitHubExc... | code_fim | medium | {
"lang": "python",
"repo": "mitodl/orcoursetrion",
"path": "/orcoursetrion/lib/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitodl/orcoursetrion path: /orcoursetrion/lib/__init__.py
# -*- coding: utf-8 -*-
"""
Orchestrion library
"""
from orcoursetrion.lib.github import (
GitHub,
GitHubException,
GitHubRepoExists,
GitHubRepoDoesNotExist,
GitHubUnkno<|fim_suffix|>RepoExists',
'GitHubRepoDoesNotE... | code_fim | medium | {
"lang": "python",
"repo": "mitodl/orcoursetrion",
"path": "/orcoursetrion/lib/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>wnError,
GitHubNoTeamFound
)
__all__ = [
'GitHub',
'GitHubException',
'GitHubRepoExists',
'GitHubRepoDoesNotExist',
'GitHubUnknownError',
'GitHubNoTeamFound',
]<|fim_prefix|># repo: mitodl/orcoursetrion path: /orcoursetrion/lib/__init__.py
# -*- coding: utf-8 -*-
"""
Orchestr... | code_fim | medium | {
"lang": "python",
"repo": "mitodl/orcoursetrion",
"path": "/orcoursetrion/lib/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Afshari9978/django-avishan path: /avishan/migrations/0018_auto_20200802_1619.py
# Generated by Django 3.0.8 on 2020-08-02 16:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('avishan', '0017_auto_20200801_1907'),
]
opera... | code_fim | hard | {
"lang": "python",
"repo": "Afshari9978/django-avishan",
"path": "/avishan/migrations/0018_auto_20200802_1619.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>eField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name='emailotpauthentication',
name='date_verified',
field=models.DateTimeField(blank=True, default=None, null=True),
),
migrations.AddField(
model_nam... | code_fim | hard | {
"lang": "python",
"repo": "Afshari9978/django-avishan",
"path": "/avishan/migrations/0018_auto_20200802_1619.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huan/python-facenet path: /tutorial/matplotlib-tutorial/layout.py
""" layout """
import matplotlib.pyplot as plt
import numpy as np
x<|fim_suffix|>ts(2, 2, sharex=True)
print(plt.figure)
axes[0, 0].plot(x, y)
axes[1, 1].set_title('Sharing Y axis')
axes[1, 0].scatter(x, y)
plt.show()<|fim_middle... | code_fim | medium | {
"lang": "python",
"repo": "huan/python-facenet",
"path": "/tutorial/matplotlib-tutorial/layout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>, 1].set_title('Sharing Y axis')
axes[1, 0].scatter(x, y)
plt.show()<|fim_prefix|># repo: huan/python-facenet path: /tutorial/matplotlib-tutorial/layout.py
""" layout """
import matplotlib.pyplot as plt
import numpy as np
x<|fim_middle|> = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
f, axes = plt.sub... | code_fim | medium | {
"lang": "python",
"repo": "huan/python-facenet",
"path": "/tutorial/matplotlib-tutorial/layout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sim_Hoover = pd.read_csv('Synthetic_streamflows/synthetic_discharge_Hoover.csv',header=None)
sim_Hoover=sim_Hoover.values
sim_Hoover = sim_Hoover[:effect_sim_year*365]
collect_data=np.column_stack((sim_month,sim_day,sim_year,np.zeros(effect_sim_year*365),sim_dow,sim_Hoover,syn_Path65,syn_Path66))
collec... | code_fim | hard | {
"lang": "python",
"repo": "romulus97/CAPOW_PY36",
"path": "/Stochastic_engine/demand_pathflows.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>jan2 = df_data_sim.loc[df_data_sim['Month'] == 1,:]
feb2 = df_data_sim.loc[df_data_sim['Month'] == 2,:]
mar2 = df_data_sim.loc[df_data_sim['Month'] == 3,:]
apr2 = df_data_sim.loc[df_data_sim['Month'] == 4,:]
may2 = df_data_sim.loc[df_data_sim['Month'] == 5,:]
jun2 = df_data_sim.loc[df_data_sim['Month'] ==... | code_fim | hard | {
"lang": "python",
"repo": "romulus97/CAPOW_PY36",
"path": "/Stochastic_engine/demand_pathflows.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: romulus97/CAPOW_PY36 path: /Stochastic_engine/demand_pathflows.py
line])
name='oct_reg_NW' + str(line)
locals()[name].fit(oct.loc[:,'BPA_wind':],oct.loc[:,line])
name='nov_reg_NW' + str(line)
locals()[name].fit(nov.loc[:,'BPA_wind':],nov.loc[:,line])
name='dec_r... | code_fim | hard | {
"lang": "python",
"repo": "romulus97/CAPOW_PY36",
"path": "/Stochastic_engine/demand_pathflows.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from gifter import update_values
from gifter import GIFTER_DICT
update_values(name, ammt)
assert name in GIFTER_DICT<|fim_prefix|># repo: flegald/mailroom path: /_test_gifter.py
# -*- coding:utf-8 -*-
import pytest
TEST_VALIDATOR = {
('send a thank you', True),
('create a report'... | code_fim | medium | {
"lang": "python",
"repo": "flegald/mailroom",
"path": "/_test_gifter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
TEST_PRINT_EMAIL = {
("David, 100", "Dear David, \n Thank you so much for your donation of $100. You are one cool cat \n"),
("Alison, 200", "Dear Alison, \n Thank you so much for your donation of $200. You are one cool cat \n")
}
@pytest.mark.parametrize("fn, result", TEST_PRINT_EMAIL)
def test_... | code_fim | medium | {
"lang": "python",
"repo": "flegald/mailroom",
"path": "/_test_gifter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flegald/mailroom path: /_test_gifter.py
# -*- coding:utf-8 -*-
import pytest
TEST_VALIDATOR = {
('send a thank you', True),
('create a report', False)
}
@pytest.mark.parametrize("fn, result", TEST_VALIDATOR)
def test_validator(fn, result):
<|fim_suffix|> from gifter import validator
... | code_fim | hard | {
"lang": "python",
"repo": "flegald/mailroom",
"path": "/_test_gifter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #get the track
if is_subtitle(p):
print("New track name:", track)
track = is_subtitle(p)
writer.writerow([track])
continue
raw_text = unspace(p.get_text())
pdf = None
if has_pdf(p) and "presentation" not in p.text:
... | code_fim | hard | {
"lang": "python",
"repo": "mardub1635/mt-archive",
"path": "/scripts/parse_2002.amta.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mardub1635/mt-archive path: /scripts/parse_2002.amta.py
# -*- coding: utf-8 -*-
"""
This script is an example of how to generate a tsv file from an mt-archive conference page.
NOTE:
-Make sure the conferenceList.csv file is present in the parent folder
-The name of the script is important, make... | code_fim | hard | {
"lang": "python",
"repo": "mardub1635/mt-archive",
"path": "/scripts/parse_2002.amta.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if has_pdf(p) and "presentation" not in p.text:
pdf = has_pdf(p)
pdf = urljoin(URL, pdf)
#print(pdf)
presentation = None
if "presentation" in p.text:
presentation = has_pdf(p)
presentation = urljoin(URL, presentation)
... | code_fim | hard | {
"lang": "python",
"repo": "mardub1635/mt-archive",
"path": "/scripts/parse_2002.amta.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mir-dataset-loaders/mirdata path: /scripts/legacy/make_maestro_index.py
import argparse
import hashlib
import json
import csv
import os
MAESTRO_INDEX_PATH = '../mirdata/indexes/maestro_index.json'
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path:... | code_fim | medium | {
"lang": "python",
"repo": "mir-dataset-loaders/mirdata",
"path": "/scripts/legacy/make_maestro_index.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> metadata_path = os.path.join(data_path, 'maestro-v2.0.0.json')
print(metadata_path)
maestro_index = {}
with open(metadata_path, 'r') as fhandle:
metadata = json.load(fhandle)
for i, row in enumerate(metadata):
print(i)
trackid = row['midi_filename'... | code_fim | hard | {
"lang": "python",
"repo": "mir-dataset-loaders/mirdata",
"path": "/scripts/legacy/make_maestro_index.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("creating index...")
make_maestro_index(args.maestro_data_path)
print("done!")
if __name__ == '__main__':
PARSER = argparse.ArgumentParser(description='Make MAESTRO index file.')
PARSER.add_argument(
'maestro_data_path', type=str, help='Path to MAESTRO data folder.'
... | code_fim | hard | {
"lang": "python",
"repo": "mir-dataset-loaders/mirdata",
"path": "/scripts/legacy/make_maestro_index.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Hands-On-Web-Scraping-with-Python path: /Chapter05/toscrape_quotes.py
'''
Listing Quotes from first 5 or less pages found
from 'http://quotes.toscrape.com/'
'''
import requests
import re
from bs4 import BeautifulSoup
import csv
sourceUrl = 'http://quotes.toscrape.com/'
keys = ['... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Hands-On-Web-Scraping-with-Python",
"path": "/Chapter05/toscrape_quotes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> title = row.find(attrs={'itemprop':'text'}).text.strip()
author = row.find(attrs={'itemprop':'author'}).text.strip()
authorLink = row.find('a',href=re.compile(r'/author/')).get('href')
tags = row.find('div','tags').find(itempr... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Hands-On-Web-Scraping-with-Python",
"path": "/Chapter05/toscrape_quotes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baical77/Spectral-Gromov-Wasserstein path: /benchmark_eu.py
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib
import time
import ot
from scipy import linalg
from scipy import sparse
import gromovWassersteinAveraging as gwa
import spectralGW as sgw
from geo... | code_fim | hard | {
"lang": "python",
"repo": "baical77/Spectral-Gromov-Wasserstein",
"path": "/benchmark_eu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
###########################################################
###########################################################
# Method: GWL, symmetrized
###########################################################
# Raw
start = time.time()
cost = nx.adjacency_matrix(G).toarray()
mutual_info = process_sgwl_eu(c... | code_fim | hard | {
"lang": "python",
"repo": "baical77/Spectral-Gromov-Wasserstein",
"path": "/benchmark_eu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Noisy
mis = []
rt = []
ts = [7.474] #np.linspace(7,10,20)
for t in ts:
start = time.time()
cost = sgw.undirected_normalized_heat_kernel(nG,t)
mi = process_sgwl_eu(cost,database,num_nodes,num_partitions);
mis.append(mi)
end = time.time()
rt.append(end-start)
# print('--- Nois... | code_fim | hard | {
"lang": "python",
"repo": "baical77/Spectral-Gromov-Wasserstein",
"path": "/benchmark_eu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olubiyiontheweb/malliva path: /old_django_malliva/malliva/locale/alllanguages.py
# language settings
# TODO: let's tidy this setting file, move this to a new file and load from there
from django.utils.translation import gettext_lazy as _
LANGUAGE_OPTIONS = [
("af", _("Afrikaans")),
("ar... | code_fim | hard | {
"lang": "python",
"repo": "olubiyiontheweb/malliva",
"path": "/old_django_malliva/malliva/locale/alllanguages.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>("ro", _("Romanian")),
("ru", _("Russian")),
("sk", _("Slovak")),
("sl", _("Slovenian")),
("sq", _("Albanian")),
("sr", _("Serbian")),
("sr-latn", _("Serbian Latin")),
("sv", _("Swedish")),
("sw", _("Swahili")),
("ta", _("Tamil")),
("te", _("Telugu")),
("tg", _(... | code_fim | hard | {
"lang": "python",
"repo": "olubiyiontheweb/malliva",
"path": "/old_django_malliva/malliva/locale/alllanguages.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janus/teena path: /test/test_thread_loop.py
import os
from teena import Error
from teena.thread_loop import ThreadLoop
def test_thread_loop_runs_in_background():
<|fim_suffix|> while True:
try:
data = os.read(fd, 4096)
except (Error.EAGAIN, Error.... | code_fim | medium | {
"lang": "python",
"repo": "janus/teena",
"path": "/test/test_thread_loop.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> loop = ThreadLoop()
loop.add_handler(read_fd, process_input, loop.READ)
with loop.background():
os.write(write_fd, "Message 1\n")
os.write(write_fd, "Message 2\n")
os.close(write_fd)
assert ''.join(strings) == "Message 1\nMessage 2\n"
os.close(read_fd)<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "janus/teena",
"path": "/test/test_thread_loop.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>AX,numbers[i])
MIN = min(MIN,numbers[i])
if MAX - MIN < 5:
return True
else:
return False<|fim_prefix|># repo: Microstrong0305/coding_interviews path: /61.扑克牌顺子/61.扑克牌顺子.py
# -*- coding:utf-8 -*-
class Solution:
def IsContinuous(self, numbers):
... | code_fim | hard | {
"lang": "python",
"repo": "Microstrong0305/coding_interviews",
"path": "/61.扑克牌顺子/61.扑克牌顺子.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if numbers[i] == 0:
continue
if d[numbers[i]] > 1:
return False
MAX = max(MAX,numbers[i])
MIN = min(MIN,numbers[i])
if MAX - MIN < 5:
return True
else:
return False<|fim_prefix|># repo: Mic... | code_fim | hard | {
"lang": "python",
"repo": "Microstrong0305/coding_interviews",
"path": "/61.扑克牌顺子/61.扑克牌顺子.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Microstrong0305/coding_interviews path: /61.扑克牌顺子/61.扑克牌顺子.py
# -*- coding:utf-8 -*-
class Solution:
def IsContinuous(self, numbers):
# write code here
if len(numbers) <5:
<|fim_suffix|> if numbers[i] == 0:
continue
if d[numbers[i]... | code_fim | hard | {
"lang": "python",
"repo": "Microstrong0305/coding_interviews",
"path": "/61.扑克牌顺子/61.扑克牌顺子.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app = dash.Dash(__name__, external_stylesheets=stylesheet)
df = pd.DataFrame({
"University": ["Bentley", "Boston University", "Boston College",
"Harvard", "Brandeis", "Northeastern"],
"Enrollment": [5314, 33720, 14171, 21015, 5825, 22207],
"City": ["Waltham", "Boston", "Che... | code_fim | hard | {
"lang": "python",
"repo": "bbaddwoa/hello-github-actions",
"path": "/boston_universities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app.layout = html.Div([
html.H1('Welcome to my dashboard!',
style={'textAlign' : 'center'}),
html.A('Click here to go to Bentley',
href='http://www.bentley.edu',
target='_blank'),
dcc.Graph(figure=fig, id='univ_plot'),
html.Div([html.H4('Cities to Display:... | code_fim | hard | {
"lang": "python",
"repo": "bbaddwoa/hello-github-actions",
"path": "/boston_universities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbaddwoa/hello-github-actions path: /boston_universities.py
"""
Dashboard created in lecture Week 11
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
stylesheet = ['... | code_fim | hard | {
"lang": "python",
"repo": "bbaddwoa/hello-github-actions",
"path": "/boston_universities.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Droxef/darts path: /darts/tests/test_metrics.py
import unittest
import numpy as np
import pandas as pd
import logging
from ..timeseries import TimeSeries
from ..metrics import metrics
class MetricsTestCase(unittest.TestCase):
pd_train = pd.Series(np.sin(np.pi * np.arange(31) / 4) + 1, ind... | code_fim | hard | {
"lang": "python",
"repo": "Droxef/darts",
"path": "/darts/tests/test_metrics.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_mase(self):
self.helper_test_multivariate_duplication_equality(metrics.mase, insample=self.series_train)
with self.assertRaises(ValueError):
metrics.mase(self.series1, self.series2, self.series3, 1)
def test_ope(self):
self.helper_test_multivariate_du... | code_fim | hard | {
"lang": "python",
"repo": "Droxef/darts",
"path": "/darts/tests/test_metrics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Content scraping
#browser.execute_script("return something")
data = []
for tr in browser.find_elements_by_xpath('//table[@id="mySchTable"]//tr'):
tds = tr.find_elements_by_tag_name('td')
if tds:
data.append([td.text for td in tds])
print(data)
# take a screenshot (for debugging)
browse... | code_fim | medium | {
"lang": "python",
"repo": "josh-tf/studio-helper",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: josh-tf/studio-helper path: /app.py
import os
import time
import atexit
from setup import *
from functions import *
from selenium.webdriver.common.by import By
envStudio = os.environ['envStudio']
def handleExit():
print("Cleaning up resources..")
browser.quit()
display.stop()
def q... | code_fim | hard | {
"lang": "python",
"repo": "josh-tf/studio-helper",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># navigate to our main front page
browser.get('https://clients.mindbodyonline.com/classic/mainclass?studioid=' + envStudio)
# login to our browser, exit if not successful
if not loginBrowser(browser): quitwithErr()
# navigate to our schedules page
browser.get('https://clients.mindbodyonline.com/ASP/my_s... | code_fim | hard | {
"lang": "python",
"repo": "josh-tf/studio-helper",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GregGrigorop/Iterators-Generators path: /unlimited_multiples.py
def get_unlimited_multiples(num=1):
next_num = num
while True:
yield next_num
next_num += num
<|fim_suffix|>tens = get_unlimited_multiples(10)
for i in range(5):
print(next(tens))
ones = get_unlimited_multip... | code_fim | medium | {
"lang": "python",
"repo": "GregGrigorop/Iterators-Generators",
"path": "/unlimited_multiples.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tens = get_unlimited_multiples(10)
for i in range(5):
print(next(tens))
ones = get_unlimited_multiples()
for i in range(12):
print(next(ones))<|fim_prefix|># repo: GregGrigorop/Iterators-Generators path: /unlimited_multiples.py
def get_unlimited_multiples(num=1):
next_num = num
while True:
... | code_fim | medium | {
"lang": "python",
"repo": "GregGrigorop/Iterators-Generators",
"path": "/unlimited_multiples.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>er/filelists/ChestX-Ray8"
CropDisease_path = "/home/data3/WYX/datasets"
EuroSAT_path = "/home/data3/WYX/datasets/2750"<|fim_prefix|># repo: Darkria8/Deep-Transfer-Meta-Learning path: /configs.py
save_dir = './logs'
miniImageNet_path = '/home/data3/WYX/CrossDomainFewShot-mas... | code_fim | hard | {
"lang": "python",
"repo": "Darkria8/Deep-Transfer-Meta-Learning",
"path": "/configs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>chmark/filelists/CUB'
ISIC_path = "/home/data3/WYX/datasets/"
ChestX_path = "/home/data3/WYX/CrossDomainFewShot-master/filelists/ChestX-Ray8"
CropDisease_path = "/home/data3/WYX/datasets"
EuroSAT_path = "/home/data3/WYX/datasets/2750"<|fim_prefix|># repo: Darkria8/Deep-Transfer-Meta-Learning path: /conf... | code_fim | medium | {
"lang": "python",
"repo": "Darkria8/Deep-Transfer-Meta-Learning",
"path": "/configs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.