query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Create data directories and clean them if already exist
def init_dirs(paths): in_dir = os.path.join(paths["ssd_path"], "input_files") out_dir = os.path.join(paths["ssd_path"], "output_files") workdir = os.getcwd() for dirpath in [in_dir, out_dir]: if not os.path.isdir(dirpath): os.mkdir(dirpath) # create dir else: # clean dir ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_directory():\n if os.path.exists('data'):\n shutil.rmtree('data')\n os.makedirs('data')\n\n if os.path.exists('returns'):\n shutil.rmtree('returns')\n os.makedirs('returns')", "def create_data_folders() -> None:\n if not os.path.exists(\"data/save\"):\n os.mkdir(\"./...
[ "0.8044033", "0.79538065", "0.74755734", "0.74340737", "0.7410291", "0.7283279", "0.7137517", "0.71346706", "0.7128989", "0.70568436", "0.700875", "0.69888985", "0.6983273", "0.6889932", "0.68754596", "0.6872131", "0.6827534", "0.68170947", "0.68105453", "0.68056834", "0.6789...
0.6499005
40
Clean input and output files.
def clean_chunk_files(dirpath): workdir = os.getcwd() os.chdir(dirpath) for filename in glob.glob("[0-9]*_[0-9]*_[0-9]*.hdf5"): os.remove(filename) os.chdir(workdir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n clean_files()", "def clean(self):\n print(\"Cleaning outputs in %s\" % self.args.output)\n files = glob.glob(self.args.output + \"*.pkl\")\n for f in files:\n if os.path.exists(f):\n os.remove(f)", "def clean_folder(self):\n # Remove the 1...
[ "0.77348846", "0.76904", "0.75767004", "0.7524616", "0.7488981", "0.7438978", "0.74261254", "0.734578", "0.73165834", "0.7224452", "0.7202809", "0.7184859", "0.71725035", "0.7117608", "0.7077611", "0.70484006", "0.7030057", "0.701318", "0.70115083", "0.69429016", "0.69319636"...
0.0
-1
Randomly create input files for the rechunk process.
def create_input_files(in_dir, R, I): def get_filepath(in_volume, infiles_partition): _3d_pos = numeric_to_3d_pos(in_volume.index, infiles_partition, order='F') i, j, k = _3d_pos out_filename = f'{i}_{j}_{k}.hdf5' return os.path.join(in_dir, out_filename) infiles_partition = get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_files(self, dir, num_files=10):\n for i in range(num_files):\n self._make_random_file(dir)", "def create_test_input_files(input1, input2):\n random.shuffle(input1)\n random.shuffle(input2)\n filename1 = application.join_abs_path(EMPTY_TEST_DIR, 'file-1.gz')\n filename2 = a...
[ "0.6962208", "0.6631072", "0.6529495", "0.6497521", "0.64922875", "0.63915706", "0.6333289", "0.63242024", "0.6296205", "0.6286895", "0.6284717", "0.62249404", "0.6140272", "0.5977355", "0.59745073", "0.5955077", "0.5948572", "0.5944595", "0.5943396", "0.5931011", "0.5914501"...
0.6280535
11
Prepare cube for tests.
def setUp(self): self.cube = _create_2d_cube()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.orography_cube = set_up_threshold_cube()\n self.percentiles_cube = set_up_percentiles_cube()", "def setUp(self):\n self.precip_cube = setup_precipitation_cube()\n self.oe_cube = setup_orographic_enhancement_cube()\n self.vel_x = set_up_xy_velocity_cube(\...
[ "0.6925194", "0.6767546", "0.6649443", "0.66417235", "0.6315537", "0.6255097", "0.61865866", "0.6153492", "0.6049269", "0.6007402", "0.5999484", "0.59469235", "0.587496", "0.58691937", "0.58679867", "0.58539665", "0.5844027", "0.58297664", "0.5817659", "0.58157086", "0.580913...
0.76851386
0
Test rolling_window_statistics over time coordinate.
def test_rolling_window_time(self): cube_time_sum = rolling_window_statistics(self.cube, coordinate='time', operator='sum', window_length=2) expected_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rolling_with_non_window_op(con, ibis_windows, spark_range):\n table = con.table(\"time_indexed_table\")\n context = (\n pd.Timestamp(\"20170102 07:00:00\", tz=\"UTC\"),\n pd.Timestamp(\"20170105\", tz=\"UTC\"),\n )\n result_pd = table.mutate(\n count_1h=table[\"value\"].co...
[ "0.6921305", "0.68341964", "0.6522597", "0.65145284", "0.64855874", "0.64805263", "0.63059545", "0.612616", "0.60977197", "0.608205", "0.5973177", "0.58838135", "0.5823563", "0.57382536", "0.572127", "0.5679405", "0.5648791", "0.564112", "0.56372875", "0.56219643", "0.5574735...
0.7689785
0
Test rolling_window_statistics over latitude coordinate.
def test_rolling_window_latitude(self): cube_lat_mean = rolling_window_statistics(self.cube, coordinate='latitude', operator='mean', window_length=3) expe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rolling_window_time(self):\n cube_time_sum = rolling_window_statistics(self.cube,\n coordinate='time',\n operator='sum',\n window_length=2)\n exp...
[ "0.6361515", "0.5893057", "0.57790065", "0.5740249", "0.5442331", "0.53272176", "0.53247106", "0.53071976", "0.52695274", "0.52675396", "0.5216561", "0.5208686", "0.5191926", "0.5147597", "0.5087674", "0.5055235", "0.5054563", "0.5036732", "0.5036584", "0.50346494", "0.503363...
0.7912801
0
Singly Linked List Node class.
def __init__(self, key: str, value: object) -> None: self.next = None self.key = key self.value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.head = ListNode()", "def __init__(self):\n self.head = None\n self.tail = None\n self.current_node = None", "def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = node\n self.len = 0", "def __init_...
[ "0.7117212", "0.70768267", "0.70628655", "0.6832603", "0.6740588", "0.6723775", "0.6723775", "0.6723775", "0.6723775", "0.6723775", "0.66723776", "0.66317385", "0.6605092", "0.6588505", "0.6580435", "0.6541727", "0.6500344", "0.65001905", "0.6414454", "0.64032686", "0.6384015...
0.0
-1
Return content of the node in humanreadable form.
def __str__(self): return '(' + str(self.key) + ': ' + str(self.value) + ')'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_text(self):\n return self.node_text", "def __str__(self) -> str:\n\t\treturn get_node_description(self.name)", "def text(self):\n return self.content", "def content(node: etree.Element) -> str:\n return node.text if node.text else \"\"", "def pretty_print_content(self):\n\n ...
[ "0.72680706", "0.7157139", "0.69255555", "0.69029945", "0.6885855", "0.6860343", "0.6800352", "0.6782518", "0.6782518", "0.6782518", "0.6768898", "0.6737154", "0.67310023", "0.6696522", "0.66582614", "0.6654783", "0.6653878", "0.6632735", "0.6616956", "0.6613648", "0.661328",...
0.0
-1
Return content of SLL in humanreadable form.
def __str__(self) -> str: content = '' if self.head is not None: content = str(self.head) cur = self.head.next while cur is not None: content += ' -> ' + str(cur) cur = cur.next return 'SLL [' + content + ']'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\n return get_paragraphs(self.description)[0]", "def analyse_slt(self):\n slt_content = self.get_slt()\n # SLT is only available in internal builds.\n if slt_content != None:\n self.formatter.section_start('SLT')\n self.formatter.output_list(sel...
[ "0.6009445", "0.5970806", "0.5943531", "0.58704644", "0.58370364", "0.5823974", "0.5801404", "0.57882625", "0.57671016", "0.5763196", "0.5763196", "0.5763196", "0.5746133", "0.5734627", "0.57184327", "0.5711513", "0.5682485", "0.56596804", "0.5652599", "0.5616605", "0.5612615...
0.6354961
1
Insert new node at the beginning of the list.
def insert(self, key: str, value: object) -> None: new_node = SLNode(key, value) new_node.next = self.head self.head = new_node self.size = self.size + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp", "def prepend(self, value):\r\n if self.head is None:\r\n self.head = N...
[ "0.77808535", "0.77274454", "0.7689688", "0.76597255", "0.7659181", "0.76521987", "0.76361793", "0.76311517", "0.7571801", "0.75325745", "0.75214666", "0.75045174", "0.74570006", "0.74384606", "0.74276674", "0.7357503", "0.73145", "0.72937196", "0.72582", "0.72568065", "0.724...
0.6260958
86
Remove first node with matching key.
def remove(self, key: str) -> bool: prev, cur = None, self.head while cur is not None: if cur.key == key: if prev: prev.next = cur.next else: self.head = cur.next self.size -= 1 return Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_node(self, key) -> Node:", "def remove_node(self, node_key: NodeKey) -> Node:", "def delete(self, key):\n node = self.search(key)\n if node:\n self.remove_node(node)", "def remove(self, key):\n index = self._hash_mod(key)\n node = self.storage[index]\n ...
[ "0.8761041", "0.8423715", "0.83446836", "0.82543206", "0.7850633", "0.7842921", "0.7819129", "0.7807595", "0.7804518", "0.7799748", "0.7784981", "0.77473146", "0.77238697", "0.76739335", "0.7645963", "0.76252997", "0.76059556", "0.7567101", "0.7561593", "0.7552706", "0.748532...
0.66606355
72
If node with matching key in the list > return pointer to that node (SLNode), otherwise return None.
def contains(self, key: str) -> SLNode: cur = self.head while cur is not None: if cur.key == key: return cur cur = cur.next return cur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, key):\n curr_node = self.head\n\n while curr_node is not None: # a normal traversal and checking first match\n if curr_node.data == key:\n return curr_node\n curr_node = curr_node.next\n\n return None", "def search(self, key):\n\n ...
[ "0.79759616", "0.7830726", "0.7624208", "0.74692166", "0.74533087", "0.73312855", "0.7285754", "0.7285754", "0.71479887", "0.71477455", "0.7145311", "0.710239", "0.7044694", "0.6911209", "0.68380284", "0.682071", "0.67118555", "0.6704684", "0.66968876", "0.6644994", "0.663808...
0.7710549
3
Return the length of the list.
def length(self) -> int: return self.size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLength(self):\r\n return len(self.list)", "def length(self):\n return self.list.length", "def length(self):\n return self.list.length", "def length(self):\n return self.list.length()", "def length(self):\n return len(self.list)", "def get_list_length(self):\r\n ...
[ "0.8951374", "0.8849228", "0.8849228", "0.8814738", "0.87976426", "0.8726981", "0.8683492", "0.86306", "0.8614819", "0.8600436", "0.85798347", "0.8574574", "0.847817", "0.84479386", "0.8354162", "0.8267897", "0.82436377", "0.8238873", "0.8131206", "0.8104193", "0.80899423", ...
0.7395965
58
Provides iterator capability for the SLL class so it can be used in for ... in ... type of loops.
def __iter__(self) -> SLNode: cur = self.head while cur is not None: yield cur cur = cur.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__():", "def __iter__():", "def __iter__():", "def __iter__():", "def __iter__(self):\n raise NotImplementedError", "def __iter__(self):\n raise NotImplementedError", "def __iter__(self):\n raise NotImplementedError", "def __iter__(self):\n raise NotImplementedEr...
[ "0.71113145", "0.71113145", "0.71113145", "0.71113145", "0.6898655", "0.6898655", "0.6898655", "0.6898655", "0.6898655", "0.68978643", "0.68865126", "0.6873239", "0.6853579", "0.6839671", "0.68087745", "0.6801656", "0.6790927", "0.6790927", "0.6789609", "0.6789609", "0.678960...
0.66202575
39
simulate runs through the model using posterior parameter. uses the algorithm of Nielsen, Skov et al. to generate tracklength distribution.
def pred_sims( trans, emissions, beta, alpha0, n, states, n_sims=100, decode=True, keep_loc=False, ): output = [] for i, (e, b, n_) in enumerate(zip(emissions, beta, n)): df = pred_sims_single(trans, e, b, alpha0, n_, states, n_sims, decode, keep_loc) df["chro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posterior_sample(self):\n pass", "def simulationDelayedTreatment(numTrials):\n \n #Initialization\n #delayList = [300, 150, 75, 0]\n delayList = [150]\n #Patient init variables\n numViruses = 100\n maxPop = 1000\n #Virus init variables\n maxBirthProb = 0.1\n clearProb = 0...
[ "0.6184284", "0.6112583", "0.6052626", "0.60481393", "0.5935519", "0.59006697", "0.5869163", "0.58557004", "0.58138984", "0.5796458", "0.5794023", "0.57830626", "0.5747007", "0.5724005", "0.5707442", "0.5706396", "0.5702955", "0.5685649", "0.56651944", "0.5664626", "0.5661121...
0.0
-1
Office365 Outlook client context
def __init__(self, auth_context): self._resource = "https://outlook.office365.com" super(OutlookClient, self).__init__(auth_context) self._pendingRequest = ODataRequest(self, V4JsonFormat("minimal")) self._pendingRequest.beforeExecute += self._build_specific_query
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_client(self):\n return workflow_ctx.internal.handler.rest_client", "def outlook(self):\n if \"outlook\" in self._prop_dict:\n if isinstance(self._prop_dict[\"outlook\"], OneDriveObjectBase):\n return self._prop_dict[\"outlook\"]\n else :\n ...
[ "0.55623454", "0.550653", "0.5458932", "0.54345864", "0.540564", "0.53858006", "0.529377", "0.5292701", "0.52796125", "0.5193349", "0.5184064", "0.5147242", "0.5138333", "0.511263", "0.50996125", "0.50981236", "0.5088751", "0.50259906", "0.50184834", "0.50147486", "0.50108236...
0.6708075
0
The Me endpoint is provided as a shortcut for specifying the current user by SMTP address.
def me(self): return User(self, ResourcePath("me", None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_user_me():\n\tendpoint = '/me'\n\treturn endpoint", "def get_user_me(request):\r\n auth = (DaemonServer._user['_email'], DaemonServer._user['_token'])\r\n res = requests.get(DaemonServer._base_url + '/user/me.json', auth=auth)\r\n return res", "def current_user(self, **kwargs):\n ...
[ "0.6396591", "0.62310934", "0.6207774", "0.60627633", "0.6031281", "0.59875834", "0.5912879", "0.58234483", "0.58216655", "0.5805106", "0.57982486", "0.57834905", "0.57403386", "0.5722079", "0.5712581", "0.5670227", "0.56619495", "0.56585705", "0.5637089", "0.5595522", "0.559...
0.5538127
45
get data from request
def get_json_data(request): # First we need to write request logs record_logs(request) if request.method == "GET": return json.loads(request.GET["data"]) else: return json.loads(request.POST["data"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_data():\n if request.method in ('POST', \"PUT\"):\n return request.get_json(force=True)\n else:\n return request.values", "def request_data(self):\n pass", "def get_data(self, request, url):\n data = request.get(endpoint=url)\n return data[0], data[1]", "d...
[ "0.79300874", "0.781201", "0.78079355", "0.7140797", "0.70844877", "0.7066902", "0.7048091", "0.70243424", "0.69306535", "0.6907323", "0.67872775", "0.6777056", "0.6760997", "0.6760997", "0.6760997", "0.67327493", "0.67258555", "0.665812", "0.665812", "0.66532934", "0.6645114...
0.67171764
17
Generate a token with random letters with length
def token_generator(length): token_list = \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" s = [] for i in range(length): s.append(random.choice(token_list)) return "".join(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in range(length))", "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in...
[ "0.869654", "0.869654", "0.86412734", "0.85131264", "0.85017395", "0.8308035", "0.81617856", "0.80150723", "0.7694371", "0.7593965", "0.75904083", "0.7447171", "0.7431913", "0.7379307", "0.7360987", "0.72811204", "0.7254398", "0.7188803", "0.71364963", "0.70949674", "0.707447...
0.8507378
4
Login api. Require username and password. return {stats, error_code, data(user info), auth_token}
def login_require(request): if request.method == "GET": data = request.GET else: data = request.POST user = authenticate(username=data["username"], password=data["password"]) if user and user.is_active: ret = Response(SUCCESS, error_code[SUCCESS]) else: ret = Res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login():\n\n username = str(request.parsed_json['username'])\n password = str(request.parsed_json['password'])\n\n if not auth.check_password(username, password):\n return create_error(401, \"login failed\")\n\n return auth.create_auth_token(username, password), 200", "def login(**kwargs):...
[ "0.77608573", "0.7734477", "0.7660057", "0.7658638", "0.7558921", "0.7555374", "0.7495566", "0.74902076", "0.74797565", "0.7455088", "0.7443561", "0.74367833", "0.74106705", "0.7326442", "0.7309544", "0.7306872", "0.7294039", "0.7289022", "0.7273258", "0.72200245", "0.7216601...
0.0
-1
This function is used to check whether the current user is authenticated or not
def authenticate_user(data): try: auth_token = data["auth_token"] user_token = Token.objects.get(username=data["username"]) if user_token.token == auth_token: return True except: return False return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self, request, **kwargs):\r\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_authenticated(sel...
[ "0.86295855", "0.8592263", "0.8592263", "0.8592263", "0.8592263", "0.8592263", "0.8592263", "0.8592263", "0.84283805", "0.8378546", "0.8339303", "0.830436", "0.8289001", "0.82229775", "0.81869656", "0.8175106", "0.8156433", "0.81395084", "0.81395084", "0.81395084", "0.8139508...
0.0
-1
User api, receive a json object data = {
def get_user(request): try: parsed_data = get_json_data(request) user = User.objects.get(username=parsed_data["username"]) user_serializer = UserSerializer(user.appuser) ret = Response(SUCCESS, error_code[SUCCESS]) ret.set_ret("data", user_serializer.serialize()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_data(self, access_token, *args, **kwargs):\n response = self.request(\n \"https://openapi.naver.com/v1/nid/me\",\n headers={\n \"Authorization\": f\"Bearer {access_token}\",\n \"Content_Type\": \"text/json\",\n },\n )\n\n ...
[ "0.71353304", "0.7120681", "0.697824", "0.6920987", "0.6860415", "0.67718065", "0.67334056", "0.6664187", "0.6616031", "0.6569272", "0.656755", "0.65605485", "0.6530744", "0.64855516", "0.64759815", "0.64567256", "0.64498657", "0.64466643", "0.64401764", "0.6423629", "0.64146...
0.6617404
8
User api, receive a json object data = {
def add_user(request): try: parsed_data = get_json_data(request) user = User( username=parsed_data["username"], ) user.set_password(parsed_data["password"]) user.save() appuser = AppUser.objects.create( user=user, usertype=parsed_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_data(self, access_token, *args, **kwargs):\n response = self.request(\n \"https://openapi.naver.com/v1/nid/me\",\n headers={\n \"Authorization\": f\"Bearer {access_token}\",\n \"Content_Type\": \"text/json\",\n },\n )\n\n ...
[ "0.7135122", "0.7119869", "0.6977991", "0.6920502", "0.6860718", "0.6770765", "0.6733", "0.6664196", "0.6617122", "0.6615439", "0.6569054", "0.6567001", "0.65596807", "0.6531029", "0.64862114", "0.6476112", "0.6456583", "0.6449737", "0.644712", "0.64400256", "0.642323", "0....
0.59306973
95
edit an user profile. This function needs to be authenticated. receive a json object data = {
def edit_userprofile(request): try: parsed_data = get_json_data(request) # authentication if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) user = User.objects...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile(request, userId):\n try:\n try:\n user = User.objects.get(pk=userId)\n profile = Profile.objects.get(user_id=userId)\n user.first_name = request.data['first_name'] if 'first_name' in request.data else user.first_name\n user.last_name = request....
[ "0.79282564", "0.791677", "0.7830605", "0.77724093", "0.77428484", "0.7717022", "0.76947033", "0.7653291", "0.7541835", "0.7464173", "0.7371231", "0.73672324", "0.7335172", "0.73010546", "0.7279789", "0.7264652", "0.7263382", "0.72328204", "0.7185694", "0.71831006", "0.718126...
0.7796568
3
Api to delete images
def delete_image(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) image = CarImage(image_id=parsed_data["image_id"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_image(self):\n Image.objects.get(id = self.id).delete()", "def cmd_image_delete(client, args):\n image_to_delete = client.delete_image(args.image_id)\n generate_output({'deleted': image_to_delete})", "def delete(self, req, id):\n context = None\n try:\n db_api.im...
[ "0.78998524", "0.78065366", "0.7719746", "0.7628636", "0.7616183", "0.75561106", "0.7419063", "0.7417206", "0.73732936", "0.72621316", "0.7237006", "0.71729285", "0.71568364", "0.71325517", "0.71177745", "0.71059144", "0.70969796", "0.70918393", "0.700263", "0.70001554", "0.6...
0.73934954
8
Api to add images to the car
def add_car_image(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) car_id = parsed_data["car_id"] car = Car....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_car_index_image(request):\n\n try:\n parsed_data = get_json_data(request)\n if not authenticate_user(parsed_data):\n ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL])\n return HttpResponse(ret.serialize(f))\n \n car_id = parsed_data[\"...
[ "0.6910971", "0.6743566", "0.6423908", "0.63757104", "0.63624233", "0.63452667", "0.6329673", "0.6299511", "0.6270978", "0.6270978", "0.6270978", "0.6270978", "0.6253819", "0.62360173", "0.6212775", "0.619199", "0.6189333", "0.61782897", "0.6168795", "0.61622983", "0.6146073"...
0.72720706
0
Api to add the introduction image to the car
def add_car_index_image(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) car_id = parsed_data["car_id"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def introduction_function(self):\n pass", "async def olá(self):\r\n\t\tawait self.client.say('© Maddie 2017')\r\n\t\te = Embed()\r\n\t\te.set_image(url='https://cdn.discovery.pgsitecore.com/en-us/-/media/Olay_PathFinder/Images/a/OLAY%20TE%207IN1%20DEEP%20PENETRATING%20MOISTURE%20BODY%20WASH_Front.png?w=46...
[ "0.5876566", "0.56719434", "0.56660837", "0.56626064", "0.56523126", "0.5631561", "0.5611806", "0.5598474", "0.55979633", "0.5587232", "0.5585586", "0.55850595", "0.55800086", "0.55581206", "0.5538705", "0.5526545", "0.55165225", "0.5508396", "0.5504185", "0.5501418", "0.5491...
0.5298035
35
Api that get all images of a certain car_id
def get_car_images(request): try: parsed_data = get_json_data(request) car = Car.objects.get(car_id=parsed_data["car_id"]) images = CarImage.objects.filter(car=car) image_path = [] for image in images: image_path.append(ImageSerializer(image).serialize()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_city_images(request, city_id):\n try:\n city_images = CityImage.objects.filter(city=city_id)\n except CityImage.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\n\n serializer = CityImageSerializer(city_images, many=True)\n return Response(serializer.data)", ...
[ "0.6803292", "0.6663593", "0.65214324", "0.64842665", "0.64832675", "0.6476719", "0.64447606", "0.64101243", "0.64048415", "0.6395973", "0.63517296", "0.635148", "0.6348054", "0.6332059", "0.6329344", "0.63088846", "0.62225556", "0.62047935", "0.6185176", "0.61598706", "0.615...
0.79177487
0
api to add car This function needs to be authenticated data = {
def add_car(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) user = User.objects.get(username=parsed_data["usernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_add_car():\n session_id = request.args.get('session-id', None)\n user_id = request.args.get('user-id', None)\n if check_authentication(session_id, user_id) and is_admin_user(user_id):\n return render_template('new_car.html', user=user_id, session_id=session_id,\n ...
[ "0.6976403", "0.68692696", "0.6787214", "0.64364094", "0.642609", "0.62968695", "0.6116073", "0.60255545", "0.6019659", "0.59333986", "0.58781105", "0.5815925", "0.5803441", "0.5771502", "0.56991774", "0.5679903", "0.56668764", "0.56538844", "0.5627919", "0.56167316", "0.5611...
0.699394
0
Delete the car with the car_id receive a json object data = { car_id = "1" } return {status, error_code}
def delete_car(request): try: parsed_data = get_json_data(request) car = Car.objects.get(car_id=parsed_data["car_id"]) car.delete() ret = Response(SUCCESS, error_code[SUCCESS]) except ObjectDoesNotExist as e: ret = Response(NONEXIST_DATA, error_code[NONEXIST_DATA].for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_car(id):\n car = Car.query.get(id)\n\n db.session.delete(car)\n db.session.commit()\n\n return carSchema.jsonify(car)", "def test_delete_car_valid_id():\n initial_number_of_cars = len(client.get(\"/\").json())\n\n response = client.delete(\"/1\")\n assert response.status_code == STAT...
[ "0.8185845", "0.7373735", "0.72583807", "0.70575875", "0.67972386", "0.67968684", "0.67750496", "0.6759448", "0.6742534", "0.6725134", "0.6653738", "0.6637086", "0.6585412", "0.6579141", "0.65774304", "0.657693", "0.6498493", "0.64876956", "0.6442214", "0.6414477", "0.6407549...
0.8570252
0
Edit the car info given car_id receive a json object data = { car_id = "1", used = "2", model = "3", ..... } return {status, error_code, data(car_info)}
def edit_car(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) car = Car.objects.get(car_id=parsed_data["car_id"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_car():\n carid = request.form[\"carid\"]\n make = request.form[\"make\"]\n bodytype = request.form[\"bodytype\"] \n color = request.form[\"color\"]\n seats = request.form[\"seats\"]\n location = request.form[\"location\"]\n costperhour = request.form[\"costperhour\"]\n\n # create a...
[ "0.7468365", "0.6669337", "0.65150374", "0.63757503", "0.6337304", "0.6288194", "0.61077744", "0.5961732", "0.5890917", "0.5864226", "0.5838485", "0.57958025", "0.57762665", "0.5762462", "0.57314473", "0.5647342", "0.56307065", "0.5587375", "0.55309385", "0.550685", "0.548634...
0.7290608
1
Get all cars from user receive a json object data = { username = "username" } return {status, error_code, data([car1_info, car2_info, ...])}
def get_cars(request): try: parsed_data = get_json_data(request) if not authenticate_user(parsed_data): ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL]) return HttpResponse(ret.serialize(f)) ret_list = [] user = User.objects.get(usernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_car():\n params = (\n ('fields', 'batteryLevel,connection.connected,connection.since,doors.allClosed,doors.leftOpen,doors.locked,doors.rightOpen,doors.trunkOpen,engineOn,fuelLevel,geo.latitude,geo.longitude,immobilizerEngaged,mileage,powerState,vin'),)\n r = requests.get(HOST, params=params, c...
[ "0.62472326", "0.6224683", "0.6120991", "0.60858727", "0.59794945", "0.59657836", "0.596093", "0.59167427", "0.5887537", "0.5884386", "0.57649136", "0.57583237", "0.57410055", "0.5737226", "0.57347286", "0.5734401", "0.57097995", "0.57022816", "0.5695659", "0.56941134", "0.56...
0.7392168
0
Get the most recent posted cars receive a json object data = { start = 1, end = 2 }
def get_recent_cars(request): try: parsed_data = get_json_data(request) ret_list = [] cars = Car.objects.all() sorted_cars = sorted(cars, key=lambda x: x.last_edit, reverse=True) start = int(parsed_data["start"]) end = int(parsed_data["end"]) end = min(en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(self):\n data = self._http_get(\"last\")\n return data.json()", "def get_last_data(request):\n\n return_list = []\n if request.POST:\n try:\n conn = psycopg2.connect(dbname=DB_NAME,\n user=DB_USER,\n ...
[ "0.6138192", "0.59883475", "0.59533083", "0.58350104", "0.57525367", "0.5696679", "0.56359804", "0.55815715", "0.55174816", "0.55026615", "0.5491506", "0.5405283", "0.538379", "0.5355811", "0.53283286", "0.52971864", "0.5277565", "0.5271555", "0.5258697", "0.52500385", "0.523...
0.75390077
0
Creates/take from pool MongoDB connection
def __init__(self, cfg_db): self.__logger = logging.getLogger(__class__.__name__) cfg = na3x_cfg[NA3X_DB][cfg_db] self.__connection = MongoClient( 'mongodb://{}:{}@{}:{:d}/'.format(cfg[MongoDb.__CFG_PARAM_MONGO_USER], cfg[MongoDb.__CFG_PARAM_MONGO_PSWD], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connection(self):\n\t\tfrom pymongo import MongoClient\n\n\t\tif self._connection is None:\n\t\t\tself._connection = MongoClient(host=self.url, max_pool_size=10)\n\n\t\treturn self._connection", "def mongodb_init(cls, host=\"127.0.0.1\", port=27017, username=\"\", password=\"\", dbname=\"admin\"):\n ...
[ "0.7108491", "0.70459586", "0.6723373", "0.6644471", "0.66297036", "0.66198874", "0.652059", "0.65044606", "0.6500182", "0.649217", "0.6466196", "0.64647925", "0.643453", "0.64170104", "0.64120543", "0.6372018", "0.63434315", "0.63223374", "0.63021594", "0.6265656", "0.626315...
0.0
-1
Returns symbol for LSTM model up to loss/softmax
def _lstm_unroll_base(num_lstm_layer, seq_len, num_hidden): param_cells = [] last_states = [] for i in range(num_lstm_layer): param_cells.append(LSTMParam(i2h_weight=mx.sym.Variable("l%d_i2h_weight" % i), i2h_bias=mx.sym.Variable("l%d_i2h_bias" % i), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LSTM_train(X_train, Y_train, X_dev, Y_dev, R_train, R_dev, hyperparams):", "def __init__(self, incoming, n_units,\n W_ci=tf.zeros, W_ig=tf.zeros, W_og=tf.zeros, W_fg=tf.zeros,\n b_ci=tf.zeros, b_ig=tf.zeros, b_og=tf.zeros, b_fg=tf.zeros,\n a_ci=tf.tanh, a_ig=tf...
[ "0.60274804", "0.59170765", "0.58912086", "0.5882927", "0.58675116", "0.58305377", "0.580802", "0.5801968", "0.5801779", "0.5768921", "0.57045865", "0.57016975", "0.56983745", "0.56668764", "0.5656724", "0.56454974", "0.5624774", "0.56042695", "0.55990034", "0.55751944", "0.5...
0.53032947
63
Adds Symbol.contrib.ctc_loss on top of pred symbol and returns the resulting symbol
def _add_warp_ctc_loss(pred, seq_len, num_label, label): label = mx.sym.Reshape(data=label, shape=(-1,)) label = mx.sym.Cast(data=label, dtype='int32') return mx.sym.WarpCTC(data=pred, label=label, label_length=num_label, input_length=seq_len)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_mxnet_ctc_loss(pred, seq_len, label):\n pred_ctc = mx.sym.Reshape(data=pred, shape=(-4, seq_len, -1, 0))\n\n loss = mx.sym.contrib.ctc_loss(data=pred_ctc, label=label)\n ctc_loss = mx.sym.MakeLoss(loss)\n\n softmax_class = mx.symbol.SoftmaxActivation(data=pred)\n softmax_loss = mx.sym.MakeL...
[ "0.7470702", "0.73144186", "0.6810144", "0.66586685", "0.6641258", "0.6636599", "0.6468572", "0.6442352", "0.62373173", "0.60394776", "0.60171413", "0.601083", "0.5912159", "0.5845447", "0.5817598", "0.57780397", "0.5765815", "0.57568926", "0.57506424", "0.57445663", "0.57267...
0.71684057
2
Adds Symbol.WapCTC on top of pred symbol and returns the resulting symbol
def _add_mxnet_ctc_loss(pred, seq_len, label): pred_ctc = mx.sym.Reshape(data=pred, shape=(-4, seq_len, -1, 0)) loss = mx.sym.contrib.ctc_loss(data=pred_ctc, label=label) ctc_loss = mx.sym.MakeLoss(loss) softmax_class = mx.symbol.SoftmaxActivation(data=pred) softmax_loss = mx.sym.MakeLoss(softmax_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_warp_ctc_loss(pred, seq_len, num_label, label):\n label = mx.sym.Reshape(data=label, shape=(-1,))\n label = mx.sym.Cast(data=label, dtype='int32')\n return mx.sym.WarpCTC(data=pred, label=label, label_length=num_label, input_length=seq_len)", "def _add_ctc_loss(pred, seq_len, num_label, loss_ty...
[ "0.58642644", "0.5755872", "0.5511471", "0.51243395", "0.48937795", "0.48192322", "0.48166335", "0.47167754", "0.4664304", "0.46299458", "0.46042278", "0.45823675", "0.4570847", "0.45587048", "0.45524484", "0.4521148", "0.4504483", "0.44903123", "0.44836128", "0.4414451", "0....
0.557523
2
Adds CTC loss on top of pred symbol and returns the resulting symbol
def _add_ctc_loss(pred, seq_len, num_label, loss_type): label = mx.sym.Variable('label') if loss_type == 'warpctc': print("Using WarpCTC Loss") sm = _add_warp_ctc_loss(pred, seq_len, num_label, label) else: print("Using MXNet CTC Loss") assert loss_type == 'ctc' sm = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_mxnet_ctc_loss(pred, seq_len, label):\n pred_ctc = mx.sym.Reshape(data=pred, shape=(-4, seq_len, -1, 0))\n\n loss = mx.sym.contrib.ctc_loss(data=pred_ctc, label=label)\n ctc_loss = mx.sym.MakeLoss(loss)\n\n softmax_class = mx.symbol.SoftmaxActivation(data=pred)\n softmax_loss = mx.sym.MakeL...
[ "0.7279776", "0.67509294", "0.6634631", "0.64416933", "0.636777", "0.6334527", "0.62488717", "0.62174857", "0.6172037", "0.5912462", "0.5818996", "0.58138746", "0.5788817", "0.5786746", "0.57292295", "0.5714518", "0.5672616", "0.56589985", "0.5637777", "0.55821425", "0.553402...
0.73154473
0
Creates an unrolled LSTM symbol for inference if loss_type is not specified, and for training if loss_type is specified. loss_type must be one of 'ctc' or 'warpctc'
def lstm_unroll(num_lstm_layer, seq_len, num_hidden, num_label, loss_type=None): # Create the base (shared between training and inference) and add loss to the end pred = _lstm_unroll_base(num_lstm_layer, seq_len, num_hidden) if loss_type: # Training mode, add loss return _add_ctc_loss(pred,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, incoming, n_units,\n W_ci=tf.zeros, W_ig=tf.zeros, W_og=tf.zeros, W_fg=tf.zeros,\n b_ci=tf.zeros, b_ig=tf.zeros, b_og=tf.zeros, b_fg=tf.zeros,\n a_ci=tf.tanh, a_ig=tf.sigmoid, a_og=tf.sigmoid, a_fg=tf.sigmoid, a_out=tf.identity,\n c...
[ "0.6248323", "0.61311096", "0.60797215", "0.60686815", "0.60521054", "0.60028666", "0.5984797", "0.59480095", "0.58063996", "0.57800037", "0.5692031", "0.5684242", "0.56633073", "0.5610074", "0.5585353", "0.558503", "0.5528418", "0.55205464", "0.551147", "0.55097836", "0.5505...
0.71515894
0
Returns name and shape of init states of LSTM network
def init_states(batch_size, num_lstm_layer, num_hidden): init_c = [('l%d_init_c' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)] init_h = [('l%d_init_h' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)] return init_c + init_h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_initial_state(state_sizes: list, batch_size, name):\n\n init_states = []\n\n # for each layer, create a tf variable and tile\n for i, tupl in enumerate(state_sizes):\n c = tf.get_variable(name+\"_c_%d\"%i, shape=[1, tupl[0]])\n h = tf.get_variable(name+\"_h_%d\"%i, shape=[1, tupl[1]...
[ "0.6832012", "0.6490874", "0.64794016", "0.63486713", "0.61073273", "0.61069", "0.6104121", "0.61003625", "0.6077626", "0.6058606", "0.60517395", "0.5974428", "0.5965294", "0.5960053", "0.5928339", "0.592516", "0.5925127", "0.591759", "0.587162", "0.58607215", "0.5859695", ...
0.6766326
1
Test _attach_and_stream when the container stops normally.
def test_container_stops_normally(self, m_sys, m_docker_client): # attach(..., stream=True) returns a generator. def container_output_gen(): yield ("Some output\n") yield ("from the container.") m_docker_client.attach.return_value = container_output_gen() m_stdo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_killed(self, m_sys, m_docker_client):\n # attach(..., stream=True) returns a generator.\n def container_output_gen():\n yield (\"Some output\\n\")\n yield (\"from the container.\")\n # Commit suicide, simulating being killed from another terminal.\n ...
[ "0.6251586", "0.5918803", "0.58964515", "0.58917296", "0.58857954", "0.581574", "0.5713234", "0.5620514", "0.5608439", "0.56070626", "0.55646825", "0.55644155", "0.5562548", "0.5554517", "0.5540115", "0.548404", "0.5483997", "0.5481819", "0.5453746", "0.5448113", "0.54479104"...
0.68866575
0
Test _attach_and_stream when a Keyboard interrupt is generated.
def test_ctrl_c(self, m_sys, m_docker_client): # attach(..., stream=True) returns a generator. def container_output_gen(): yield ("Some output\n") yield ("from the container.") raise KeyboardInterrupt() yield ("This output is not printed.") m_dock...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_keyboard_interrupt(self) -> None:\n try:\n self.test()\n except BaseException as error:\n self.logger.exception(error)\n traceback.print_exc()\n LocalSocket.send(\"Test failed\")\n raise\n else:\n LocalSocket.send(\"Tes...
[ "0.66921604", "0.64062625", "0.6314439", "0.597203", "0.5872971", "0.5862403", "0.5861672", "0.5764907", "0.56469566", "0.5525977", "0.5494341", "0.54770654", "0.547298", "0.5460595", "0.5448227", "0.54386437", "0.53787875", "0.5347784", "0.53470653", "0.53451484", "0.5326776...
0.5742392
8
Test _attach_and_stream when killed by another process.
def test_killed(self, m_sys, m_docker_client): # attach(..., stream=True) returns a generator. def container_output_gen(): yield ("Some output\n") yield ("from the container.") # Commit suicide, simulating being killed from another terminal. os.kill(os.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mp_pipe_replacement(self):\n parent, child = create_psuedo_anonymous_duct_pair()\n\n def mp_child_target():\n parent.close()\n time.sleep(3)\n child.send(\"hello world\")\n child.close()\n\n p = multiprocessing.Process(target=mp_child_target...
[ "0.5820887", "0.5777434", "0.57680166", "0.5731921", "0.5641282", "0.5630609", "0.5615017", "0.5594535", "0.5577908", "0.55604076", "0.555966", "0.55333686", "0.55158263", "0.5509919", "0.5502959", "0.5460285", "0.5447026", "0.5431141", "0.53817034", "0.5374262", "0.5365074",...
0.60617507
0
Initialize a new cardanonode
def __init__(self, path: str, network: str, logfile: str): self._logfile = logfile self._network = network self._dbsync_path = path self._working_dir = os.getcwd()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, cards):\n self.cards = cards", "def __init__(self, cards = []):\n self.cards=cards", "def __init__(self):\n self._cards = []\n #Add a single card for each suit and rank\n for suit in Card.SUITS:\n for rank in Card.RANKS:\n c = Card...
[ "0.71805245", "0.6996836", "0.69228107", "0.6902137", "0.6826285", "0.679355", "0.6741009", "0.6737449", "0.6708894", "0.67046124", "0.66997784", "0.66888833", "0.6660861", "0.6623482", "0.65892506", "0.65864843", "0.65560246", "0.64756393", "0.6467995", "0.6398685", "0.63946...
0.0
-1
Run dbsync for a specified duration
def run_dbsync(self, run_time: int = 0): with open((self._working_dir + '/logs/dbsync/' + self._logfile), "w+") as dbsync_logfile: self._start_dbsync(dbsync_logfile) if run_time > 0: time.sleep(run_time) self.stop_dbsync()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(timeSync):\r\n while True:\r\n runSched(timeSync)\r\n # Syncdb()\r", "def sync_db():\n pass", "def syncDBLoop(self):\n while 1:\n self.evSyncDB.wait()\n if self.bQuit == True:\n return\n \n self.evSyncDB.clear()\n self.db.syncDB()\n \n sel...
[ "0.7578095", "0.66645306", "0.6235826", "0.6131023", "0.6005941", "0.59655493", "0.5887655", "0.58157724", "0.5800394", "0.5766759", "0.57633954", "0.5666165", "0.56166655", "0.5612632", "0.5546815", "0.55266", "0.5525298", "0.5483633", "0.5416993", "0.5412211", "0.53690493",...
0.7918123
0
Reads ArcGIS dbf file Returns a pysal.lib.weights.weights.W object Examples Type 'dir(w)' at the interpreter to see what methods are supported. Open an ArcGIS dbf file and read it into a pysal weights object >>> import pysal.lib >>> w = pysal.lib.io.open(pysal.lib.examples.get_path('arcgis_ohio.dbf'),'r','arcgis_dbf')....
def _read(self): if self.pos > 0: raise StopIteration id_var = self.file.header[1] startPos = len(self.file.header) if startPos == 3: startPos = 0 elif startPos == 4: startPos = 1 else: raise ValueError("Wrong structure, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cfdReadNeighbourFile(self): \r\n with open(self.neighbourFile,\"r\") as fpid:\r\n print('Reading neighbour file ...')\r\n\r\n ## (list) 1D, indices refer to faces, list value is the face's neighbour cell\r\n self.neighbours=[]\r\n start=False\r\n \r...
[ "0.553539", "0.5275145", "0.5228641", "0.51275873", "0.5003142", "0.49990562", "0.48962325", "0.4857007", "0.480897", "0.46667188", "0.46583158", "0.4651854", "0.46031675", "0.4603103", "0.45909962", "0.45832577", "0.4564821", "0.45395407", "0.45395404", "0.44673905", "0.4466...
0.5436518
1
Compare position of val to position of self. Return true if the two pieces have the same position.
def __eq__(self, val): if type(val)== type(self): return val.getPosition()==self.getPosition() and self.getName()==val.getName() return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_position_for_same_occupancy(self, position1, position2):\n return self.board.board[position1] == self.board.board[position2]", "def __flt_eq_pos(self, other):\n if self.position is None:\n return True\n\n return (\n self.position == other.position\n ...
[ "0.6700722", "0.6460452", "0.629321", "0.6234782", "0.6168382", "0.614241", "0.6116273", "0.6066237", "0.603371", "0.6020098", "0.5977026", "0.5946027", "0.5944572", "0.59200644", "0.58380294", "0.58275545", "0.5816172", "0.5812624", "0.58060807", "0.57808554", "0.5780674", ...
0.7136205
0
Used to determine if a pawn can double move or if a kingrook pair can castle
def getMoveStatus(self): return self.hasMoved
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _checkPawn(self):\r\n pawn = self.startCell.getPawn()\r\n if(not pawn.can_go_on(self.endCell)):\r\n message = (\"This pawn (%r) cannot go on this type of cell (%r)\" %\r\n (pawn, self.endCell.type))\r\n raise IllegalMoveException(message)\r\n ret...
[ "0.68017167", "0.65882826", "0.65570635", "0.6477345", "0.6434115", "0.6402673", "0.63874745", "0.63869435", "0.6369581", "0.63669324", "0.63384396", "0.6332993", "0.6329806", "0.63245606", "0.6283036", "0.6264848", "0.6228", "0.6205946", "0.61584026", "0.6152898", "0.6136885...
0.0
-1
Load parameters of Unit3D component into state_dict.
def load_unit3d(state_dict, eval_type, src_name, tgt_name, h5_dir, use_batch_norm=True, use_bias=False): h5f = h5py.File(os.path.join(h5_dir, '{:s}_{:s}.h5'.format(eval_type, src_name)), 'r') state_dict[tgt_name + '.conv3d.weight'] = torch.from_numpy(h5f['weight'][...]).permute(4, 3, 0, 1, 2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state_dict(self, arg):\n self.TrajectoryAutoencoder.load_state_dict(torch.load(arg))", "def load_i3d(eval_type, h5_dir='param/'):\n state_dict = {}\n load_unit3d(state_dict, eval_type, 'Conv3d_1a_7x7', 'conv_1a', h5_dir)\n\n load_unit3d(state_dict, eval_type, 'Conv3d_2b_1x1', 'conv_2b', ...
[ "0.65356356", "0.62873423", "0.5968935", "0.5948332", "0.5845028", "0.57920855", "0.5693434", "0.5679292", "0.5609613", "0.554131", "0.55263484", "0.5508585", "0.54796845", "0.5435286", "0.5420295", "0.5355181", "0.5350723", "0.53325725", "0.5328443", "0.5325811", "0.5320041"...
0.63032746
1
Load parameters of InceptionBlock component into state_dict.
def load_block(state_dict, eval_type, src_name, tgt_name, h5_dir): h5f = h5py.File(os.path.join(h5_dir, '{:s}_{:s}.h5'.format(eval_type, src_name)), 'r') state_dict[tgt_name + '.branch_0.conv3d.weight'] = torch.from_numpy(h5f['b0_weight'][...]).permute(4, 3, 0, 1, 2) output_channels = state_dict[tgt_name +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state_dict(self, state_dict):\n own_state = self.state_dict()\n new_state = OrderedDict()\n for name, param in state_dict.items():\n if name in own_state:\n new_state[name] = param\n\n super(EncoderImagePrecomp, self).load_state_dict(new_state)", "de...
[ "0.6853173", "0.66839004", "0.666484", "0.6515416", "0.6287945", "0.6191885", "0.6187667", "0.6151155", "0.6062903", "0.6057919", "0.60512805", "0.6046763", "0.6022121", "0.6022121", "0.6022121", "0.6020537", "0.60135454", "0.59804255", "0.59377486", "0.593586", "0.5868328", ...
0.5295593
91
Load all the parameters of InceptionI3D model into state_dict.
def load_i3d(eval_type, h5_dir='param/'): state_dict = {} load_unit3d(state_dict, eval_type, 'Conv3d_1a_7x7', 'conv_1a', h5_dir) load_unit3d(state_dict, eval_type, 'Conv3d_2b_1x1', 'conv_2b', h5_dir) load_unit3d(state_dict, eval_type, 'Conv3d_2c_3x3', 'conv_2c', h5_dir) load_block(state_dict, eval...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_state_dict(self, arg):\n self.TrajectoryAutoencoder.load_state_dict(torch.load(arg))", "def load_state_dict(self, state_dict):\n self.XY_net.load_state_dict(state_dict['XY_net'])\n self.XY_optimizer_minee.load_state_dict(\n state_dict['XY_optimizer_minee'])\n self....
[ "0.68653655", "0.65390885", "0.64288425", "0.62878567", "0.6253509", "0.6241428", "0.6186826", "0.6078195", "0.60680234", "0.6052236", "0.6028413", "0.6012456", "0.5968443", "0.59386265", "0.59187746", "0.58965504", "0.5872777", "0.58593005", "0.5853677", "0.5827504", "0.5795...
0.66550106
1
Initialize a subscribers dict.
def __init__(self): self.subscribers = {} self.followers = {} self.nackables = {} self.threads = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __initSubscribers(self):\n\t\t\n\t\t# Drone estimated pose (from FCU)\n\t\tself.__subs['pose'] = MySubscriber('mavros/local_position/pose',\n\t\t\t\t\t\t\t\t\t\t\tPoseStamped)\n\t\t\n\t\t# Drone state (connected, armed, mode)\n\t\tself.__subs['state'] = MySubscriber('mavros/state',\n\t\t\t\t\t\t\t\t\t\t\tState...
[ "0.66926306", "0.66666377", "0.6462468", "0.62672824", "0.60253507", "0.6011272", "0.5986701", "0.59848255", "0.5983119", "0.59363717", "0.58701694", "0.582639", "0.5738487", "0.571974", "0.57129836", "0.5708491", "0.5689837", "0.5641494", "0.56350106", "0.5600856", "0.559479...
0.63646674
3
Add a subscriber callback to a specific eiffel event type.
def subscribe(self, meta_type, callback, can_nack=False): if not can_nack: subscriber_list = self.subscribers.setdefault(meta_type, []) else: subscriber_list = self.nackables.setdefault(meta_type, []) subscriber_list.append(callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(self, event_type: typing.Type[typing.Any], callback: CallbackT[typing.Any]) -> None:", "def add_subscriber(self, event_type, func, priority=None, once=False,\n **args):\n event_type = load_object(event_type)\n func = load_object(func)\n subscriber = Subscr...
[ "0.7461969", "0.71460533", "0.70492315", "0.699671", "0.6565379", "0.65089583", "0.6417478", "0.64099526", "0.6298392", "0.6241712", "0.62288064", "0.61624813", "0.606024", "0.59815407", "0.5978818", "0.588787", "0.5804578", "0.57900715", "0.57030725", "0.56583756", "0.564256...
0.5879905
16
Unsubscribe from an event.
def unsubscribe(self, meta_type, callback): try: self.subscribers.get(meta_type, []).remove(callback) except ValueError: pass try: self.nackables.get(meta_type, []).remove(callback) except ValueError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribeFromEvent(eventName,subscriber):", "def unsubscribe(self, event_handler):\n pass # pragma: no cover", "def unsubscribe(self, event_type: typing.Type[typing.Any], callback: CallbackT[typing.Any]) -> None:", "def unsubscribe(self, event, callback, args = None):\n if {\"event\": ev...
[ "0.82374287", "0.7904121", "0.78358036", "0.7760463", "0.77168953", "0.7711964", "0.75586313", "0.73891944", "0.73891944", "0.73891944", "0.73891944", "0.73891944", "0.73693776", "0.73693776", "0.7355536", "0.7162313", "0.7066857", "0.70597476", "0.7007281", "0.70011944", "0....
0.63051844
54
Follow a context. By following a context you will receive all messages sent through the event stream that have the context defined to the callback provided.
def follow(self, context, callback): followers_list = self.followers.setdefault(context, []) if callback not in followers_list: followers_list.append(callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _call_followers(self, event):\n context = self.get_context(event)\n if context is not None:\n for callback in self.followers.get(context, []):\n callback(event)", "def SetContextCallback(self, context):\n self._contextCallback = context", "def forward_context(...
[ "0.6020187", "0.58117324", "0.5564524", "0.5320402", "0.5157448", "0.50976217", "0.50734353", "0.5046295", "0.501335", "0.50041103", "0.4973527", "0.49559167", "0.4948715", "0.49457806", "0.4914835", "0.48882326", "0.4878829", "0.48594946", "0.48508334", "0.4830979", "0.48289...
0.65882254
0
Call all subscriber callback methods.
def _call_subscribers(self, meta_type, event): ack = False at_least_one = False for callback in self.subscribers.get(meta_type, []) + self.subscribers.get("*", []): callback(event, self.get_context(event)) for callback in self.nackables.get(meta_type, []) + self.nackables.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_subscribers(self, *args, **kwargs) -> None:\n for subscriber in self.get_subscribers():\n subscriber(*args, **kwargs)", "def notify(self) -> None:\n for s in self.subscribers:\n s()", "def subscribe_callbacks(self, *args):\n for arg in args:\n self...
[ "0.8082841", "0.74544543", "0.73795795", "0.69680995", "0.67672855", "0.6667072", "0.6562378", "0.6499882", "0.6494149", "0.64831495", "0.645891", "0.6449455", "0.6429144", "0.64284915", "0.6403757", "0.6363088", "0.6363088", "0.6363088", "0.6258445", "0.62457883", "0.6242415...
0.5945345
40
Get the context for an event. If not found return event_id.
def get_context(event): for link in event.links.links: if link.get("type") == "CONTEXT": context = link.get("target") break else: context = None return context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_id(self):\n return self._event_id", "def GetEventIdentifier(self):\n return self._event_identifier", "def get_event(self, eventid):\n return self.s.query(Event).get(eventid)", "def get_event_eid(eid):\n return EventModel.query.get_or_404(eid)", "def get_event(self, event_id):\...
[ "0.70538527", "0.68012685", "0.67689633", "0.65239763", "0.6434205", "0.638782", "0.63083977", "0.61937714", "0.6080787", "0.60558647", "0.6048353", "0.6039121", "0.60218024", "0.5984016", "0.59110355", "0.58831054", "0.58774924", "0.5834099", "0.5815435", "0.5803337", "0.577...
0.703927
1
Call all followers of a context callback methods.
def _call_followers(self, event): context = self.get_context(event) if context is not None: for callback in self.followers.get(context, []): callback(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow(self, context, callback):\n followers_list = self.followers.setdefault(context, [])\n if callback not in followers_list:\n followers_list.append(callback)", "def generateFollowers(self):\n for f in self._genericGenerator(self.getFollowers):\n yield f", "def...
[ "0.8054596", "0.64584273", "0.63695544", "0.6216068", "0.61616683", "0.6055616", "0.6054398", "0.60464066", "0.59246397", "0.5914625", "0.5909593", "0.58848095", "0.5847526", "0.5731443", "0.56934786", "0.5649177", "0.56334376", "0.56182736", "0.5604243", "0.5558574", "0.5558...
0.82580906
0
Rebuild event and call subscribers of that event with it as input.
def call(self, body): try: json_data = json.loads(body.decode('utf-8')) except (json.decoder.JSONDecodeError, UnicodeDecodeError) as err: raise Exception("Unable to deserialize message body (%s), " "rejecting: %r" % (err, body)) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_queue_proc(self,event):\r\n event()", "def process_event(self, event):\r\n pass", "def __call__(self, trigger, type, event):", "def __call__(self, event):\n if not self.events or event in self.events:\n super(EventHandler, self).__call__(event)", "def notify_subscr...
[ "0.6109811", "0.6066837", "0.5982562", "0.5974613", "0.5954385", "0.59165436", "0.5868701", "0.58642286", "0.586357", "0.58577317", "0.58460873", "0.58446175", "0.58339775", "0.5808516", "0.5788084", "0.5775105", "0.5723703", "0.5708209", "0.56808186", "0.5667945", "0.5658220...
0.0
-1
pretty print for confusion matrixes
def print_cm(cm, labels, hide_zeroes=False, hide_diagonal=False, hide_threshold=None): columnwidth = max([len(x) for x in labels] + [5]) # 5 is value length empty_cell = " " * columnwidth # Print header print " " + empty_cell, for label in labels: print "%{0}s".format(columnwidth) % labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printConfusion(self,conf):\n print \"y\\pred\\t \" + \"\\t\".join(map(str,range(self.param['numClasses'])))\n i = 0\n for row in conf:\n print str(i) + \"\\t\" + \"\\t\".join(map(str,row))\n i += 1", "def print_confusion_matrix(self) -> None:\n self.metric...
[ "0.75996476", "0.7586947", "0.7333224", "0.7281144", "0.71857506", "0.7182938", "0.6956312", "0.69454783", "0.6894899", "0.6858612", "0.68504804", "0.68362653", "0.6808695", "0.67682904", "0.6761043", "0.67409605", "0.6694831", "0.66370165", "0.6627503", "0.66026145", "0.6562...
0.63468975
56
Use DFS algorithm to check if this graph has a cycle If there is an adjacent vertex that has been already visited and this vertex is not previous(parent) then there is a cycle in graph.
def has_cycle(graph): stack = deque() visited_vertices = set() random_vertex = next(iter(graph.get_vertices().values())) prev_vertex = random_vertex vertex = random_vertex # prev_vertex let us to track "parent" vertex in undirected graph stack.append((prev_vertex, vertex)) while len(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasCycle(self, vertex, visited, parent):\n visited[vertex] = True\n for i in self.graph[vertex]:\n if not visited[i]:\n if self.hasCycle(i, visited, vertex):\n return True\n elif parent != i:\n return True\n return Fals...
[ "0.82323873", "0.79443675", "0.7737385", "0.7554951", "0.73702157", "0.7099687", "0.7016481", "0.7002315", "0.69940835", "0.698917", "0.6966552", "0.69619995", "0.68613493", "0.68317634", "0.6829453", "0.6783507", "0.67284894", "0.67235297", "0.6671271", "0.66381687", "0.6624...
0.78581995
2
Look at all files passed in on commandline for invalid CPRINTS calls.
def main(argv: Optional[List[str]] = None) -> Optional[int]: return_code = 0 parser = preupload.lib.argument_parser() args = parser.parse_args(argv) for filename in args.filename: lines = preupload.lib.cat_file(args, filename).splitlines() for linenum, line in enumerate(lines, start=1):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_listing_clashes(filename, argument):\n print((\"Clashes with {}:\").format(argument))\n process_if_clashing(filename, argument)", "def file_name_check(file_name):\n # Please print out which line of the above program contains an error. E.g. if the bug is on line 4 then print 4\n # END OF C...
[ "0.5992827", "0.588682", "0.5882276", "0.58433956", "0.5595384", "0.55929667", "0.5575312", "0.550234", "0.5325258", "0.5263228", "0.5227432", "0.52130693", "0.5191065", "0.5185855", "0.5170185", "0.51503795", "0.51392597", "0.5139163", "0.513815", "0.5137285", "0.5134748", ...
0.6742574
0
Test contract for user response
def test_user_responsse(user_response, client): resp = client.get_user() assert resp.keys() == user_response.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_successful_get_an_answer(self):\n self.is_authenticated(self.user1)\n response = self.get_answer()\n self.assertEqual(response.status_code, status.HTTP_200_OK)", "def test_user_information_request(self):\n pass", "def test_input_text_returned_in_response_data(self):\n ...
[ "0.6567083", "0.6469839", "0.64682263", "0.64176136", "0.63952804", "0.6338916", "0.63221055", "0.6294874", "0.62615865", "0.61474174", "0.6142984", "0.61378133", "0.61290914", "0.6113222", "0.61035395", "0.60872346", "0.607993", "0.6054024", "0.6052609", "0.60522634", "0.604...
0.70861113
0
Test contract for dataset response
def test_dataset_response(dataset_response, client): file = glob.glob('./**/test_areas.csv', recursive=True) with open(file[0], 'r') as fp: resp = client.create_dataset(fp) assert resp.keys() == dataset_response.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_fetch_filtered_dataset_call(self):\n pool = asynctest.CoroutineMock()\n db_response = {\"referenceBases\": '', \"alternateBases\": '', \"variantType\": \"\",\n \"referenceName\": 'Chr38',\n \"frequency\": 0, \"callCount\": 0, \"sampleCount\":...
[ "0.6962139", "0.67790437", "0.64499414", "0.64420074", "0.64087015", "0.6351015", "0.63364863", "0.63276124", "0.6324762", "0.63192767", "0.631299", "0.62950724", "0.6287609", "0.62160826", "0.6172362", "0.6163757", "0.61604667", "0.6160097", "0.6152593", "0.61364836", "0.613...
0.64247495
4
Test contract for match response
def test_match_response(match_response, client): file = glob.glob('./**/test_areas.csv', recursive=True) with open(file[0], 'r') as fp: ds = client.create_dataset(fp) resp = ds.match(source_prov_col='Province') assert resp.keys() == match_response.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rpc_match():", "def test_compound_match(self):\n query_string = f'{self.beer.name[:10]}+{self.beer.manufacturer.name[:5]}'\n tap = TapFactory(beer=self.beer)\n response = self.client.get(\n f'{self.url}?search={query_string.upper()}',\n )\n eq_(response.status_co...
[ "0.6926084", "0.6829542", "0.6555551", "0.6505434", "0.64389384", "0.6229258", "0.62027997", "0.61970174", "0.61369306", "0.61207587", "0.60978186", "0.609383", "0.606709", "0.6062986", "0.60380495", "0.6011411", "0.5987093", "0.59712166", "0.59704685", "0.5968973", "0.596866...
0.63459945
5
Assign labels to the image(s) passed as inputs.
def __call__(self, images: Union[str, List[str], "Image", List["Image"]], **kwargs): return super().__call__(images, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_imgsLabels(self, image_paths):\n \n# label = image_paths[-1]\n \n images = self.load_images(image_paths)\n \n images = self.resize_images(images)\n \n images_list = self.greyscale_images(images)\n\n return images_list", "def reset(self, images_names, labels_na...
[ "0.6917192", "0.6851857", "0.6850693", "0.68108314", "0.68021137", "0.67923194", "0.67851263", "0.675226", "0.6728577", "0.66475827", "0.66475827", "0.66475827", "0.66475827", "0.66475827", "0.65726453", "0.6545723", "0.65246284", "0.6485739", "0.64797026", "0.6455833", "0.64...
0.0
-1
Return the openscad representation of the indicated variable.
def __getattr__(self, name): if name in self: return name raise AttributeError(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.identity(default=self.nc_get_variable(\"\"))", "def s(self):\n index = self.var_index(s=True)\n return self.var_data(index)", "def __str__(self):\n out = self.san\n if self.comment != \"\":\n out += \" {\" + self.comment.replace('\\...
[ "0.5672744", "0.5533603", "0.550845", "0.5320441", "0.52568483", "0.5248358", "0.5244097", "0.52375346", "0.5220086", "0.5160305", "0.51522005", "0.51441216", "0.5121946", "0.51108104", "0.5097175", "0.5085031", "0.5080375", "0.5076901", "0.5072778", "0.5054045", "0.50309825"...
0.0
-1
Change the value of the named variable.
def __setattr__(self, name, value): if not self.__dict__.has_key('_initialised'): # this test allows attributes to be set in the __init__ method return dict.__setattr__(self, name, value) elif name in self: # any normal attributes are handled normally dict.__setattr__(self, name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_variable(self, name, value):\n self.send_to_backend('set', name=name, value=value)\n self.refresh_variable(name)", "def set_variable(self, name, value):\n if self._scalamagic and (not name.startswith(\"_i\")):\n self.scala_interpreter.bind(name, value)\n else:\n ...
[ "0.78243214", "0.7477352", "0.7199836", "0.6889669", "0.68856305", "0.68777066", "0.68777066", "0.68660533", "0.68522257", "0.6832714", "0.679907", "0.67978346", "0.6761734", "0.6755819", "0.67551285", "0.6732387", "0.67318934", "0.672242", "0.6675121", "0.6649382", "0.664432...
0.0
-1
Tests the path specification initialization.
def testInitialize(self): path_spec = tsk_path_spec.TSKPathSpec( location=u'/test', parent=self._path_spec) self.assertIsNotNone(path_spec) path_spec = tsk_path_spec.TSKPathSpec( data_stream=u'test', location=u'/test', parent=self._path_spec) self.assertIsNotNone(path_spec) path_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInitialize(self):\n path_spec = apm_path_spec.APMPathSpec(parent=self._path_spec)\n\n self.assertIsNotNone(path_spec)\n\n path_spec = apm_path_spec.APMPathSpec(\n location='/apm2', parent=self._path_spec)\n\n self.assertIsNotNone(path_spec)\n\n path_spec = apm_path_spec.APMPathSpec(\n...
[ "0.7828453", "0.65761775", "0.642966", "0.64142275", "0.62701917", "0.62537086", "0.62294465", "0.61993927", "0.61979413", "0.6130422", "0.60881066", "0.60683423", "0.60630363", "0.60392886", "0.6026892", "0.60242605", "0.6019086", "0.601817", "0.59985644", "0.599064", "0.597...
0.7610531
1
Tests the path specification comparable property.
def testComparable(self): path_spec = tsk_path_spec.TSKPathSpec( location=u'/test', parent=self._path_spec) self.assertIsNotNone(path_spec) expected_comparable = u'\n'.join([ u'type: TEST', u'type: TSK, location: /test', u'']) self.assertEqual(path_spec.comparable, exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testComparable(self):\n path_spec = apm_path_spec.APMPathSpec(parent=self._path_spec)\n\n self.assertIsNotNone(path_spec)\n\n expected_comparable = '\\n'.join([\n 'type: TEST',\n 'type: APM',\n ''])\n\n self.assertEqual(path_spec.comparable, expected_comparable)\n\n path_spe...
[ "0.7102935", "0.62669355", "0.6178851", "0.6173921", "0.6011653", "0.59915006", "0.59731394", "0.5943001", "0.5937971", "0.58659446", "0.5819007", "0.57998884", "0.5798577", "0.57919943", "0.5768742", "0.5763338", "0.57630247", "0.57592815", "0.5756416", "0.5743247", "0.57410...
0.683633
1
Destroy the DCGMMonitor. This function must be called in order to appropriately deallocate the resources.
def destroy(self): dcgm_agent.dcgmShutdown() self._thread_pool.terminate() self._thread_pool.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy(self):\n if self._ptr is not None:\n # run and remove destructor on c data\n _global_destroy(self._display, self._ptr)\n ffi.gc(self._ptr, None)\n self._ptr = None\n self._display = None", "def destroy(self):\r\n self.__destroy()", ...
[ "0.6654744", "0.6555072", "0.6414927", "0.6267235", "0.62573326", "0.6222781", "0.62087786", "0.6188092", "0.61494327", "0.6145454", "0.6137849", "0.61213255", "0.6115661", "0.6115661", "0.6098185", "0.6098185", "0.6098185", "0.6098185", "0.6057349", "0.60044384", "0.5931868"...
0.6799968
0
Create and save a User with the given email and password.
def _create_user(self, email, password, **extra_fields): if not email: raise ValueError("The given email must be set") email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save(using=self._db) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user", "def...
[ "0.85441065", "0.8511467", "0.85078454", "0.85021895", "0.85021806", "0.8489139", "0.8489139", "0.8488738", "0.8488738", "0.8488738", "0.84858716", "0.8475896", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0....
0.84768116
11
Create and save a regular User with the given email and password.
def create_user(self, email, password=None, **extra_fields): extra_fields.setdefault("is_staff", False) extra_fields.setdefault("is_superuser", False) return self._create_user(email, password, **extra_fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user", "def _create_user(self, email, password, **extra_fields):\...
[ "0.8603525", "0.8596859", "0.85848856", "0.85730714", "0.8555611", "0.85175407", "0.85175407", "0.85175407", "0.85132706", "0.8511211", "0.85077924", "0.85077924", "0.85062385", "0.84978193", "0.8493227", "0.8493227", "0.8493227", "0.8493227", "0.8493227", "0.8493227", "0.849...
0.0
-1
Create and save a SuperUser with the given email and password.
def create_superuser(self, email, password, **extra_fields): extra_fields.setdefault("is_staff", True) extra_fields.setdefault("is_superuser", True) if extra_fields.get("is_staff") is not True: raise ValueError("Superuser must have is_staff=True.") if extra_fields.get("is_su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createsuperuser():\n\n email = prompt('User E-Mail')\n email_confirm = prompt('Confirm E-Mail')\n\n if not email == email_confirm:\n sys.exit('\\nCould not create user: E-Mail did not match')\n\n if not EMAIL_REGEX.match(email):\n sys.exit('\\nCould not create user: Invalid E-Mail add...
[ "0.8235571", "0.79829866", "0.79802275", "0.7962145", "0.79594475", "0.79482776", "0.7940533", "0.7940533", "0.7940533", "0.7939378", "0.7932703", "0.79260355", "0.79149014", "0.7909266", "0.7907758", "0.79010326", "0.7898665", "0.78943175", "0.7853869", "0.7848883", "0.78450...
0.7795719
24
Get all projects that the user has the given permissions for.
def get_permitted_projects(self, permissions): user_permission_query = Q() group_permission_query = Q() for permission in permissions: user_permission_query = user_permission_query & Q( userpermission__permissions__key=permission ) group_permis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accessible_projects(user):\n query = Q(deprecated_files=False)\n\n query &= get_public_projects_query()\n\n if user.is_authenticated:\n query |= get_restricted_projects_query(user)\n\n if user.is_credentialed:\n query |= get_credentialed_projects_query(user)\n\n query |= get_pr...
[ "0.73993754", "0.7250303", "0.7147191", "0.70684075", "0.6964391", "0.69468164", "0.68801725", "0.6864998", "0.68316734", "0.6823821", "0.6821501", "0.6815403", "0.676973", "0.67580867", "0.6749198", "0.6742206", "0.6735226", "0.67151594", "0.67086357", "0.66790086", "0.66783...
0.78211063
0
Get all environments that the user has the given permissions for.
def get_permitted_environments(self, permissions): user_permission_query = Q() group_permission_query = Q() for permission in permissions: user_permission_query = user_permission_query & Q( userpermission__permissions__key=permission ) group_pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_environments():\n return ENVIRONMENTS", "def getEnvironments(request):\n environments = Environment.objects.all()\n serializer = environmentSerializer(environments, many=True)\n result = {'data':serializer.data, 'code':HTTP_200_OK, 'message':OK}\n return result", "def...
[ "0.7298775", "0.65951914", "0.62701565", "0.6123379", "0.6103944", "0.604619", "0.5883706", "0.58337605", "0.5818717", "0.581008", "0.5730958", "0.5720051", "0.5717791", "0.5707382", "0.5660213", "0.56505644", "0.5601639", "0.5545547", "0.5528961", "0.5511986", "0.55039203", ...
0.7017802
1
Generate consensus for POA groups.
def run_cudapoa(groups, msa, print_output): # Get avaialble memory information free, total = cuda.cuda_get_mem_info(cuda.cuda_get_device()) gpu_mem_per_batch = 0.9 * free # Calculate max bounds for sequence size and sequences per POA. max_sequences_per_poa = 0 max_seq_sz = 0 for group in gr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenConsensus(alignment):\n count = 0\n consensus = []\n FreqArray = GenFrequencies(alignment)\n for position in FreqArray:\n count +=1\n consensus.append(GenPositionConsensus(position))\n return consensus", "def consensus(*args):\n counts = map(Counter, zip_longest(*args))\n ...
[ "0.6169172", "0.58610356", "0.58474404", "0.58188766", "0.57977897", "0.5756299", "0.5567207", "0.54587144", "0.54573745", "0.5340643", "0.53144497", "0.5225035", "0.52141005", "0.51316375", "0.5064588", "0.5026943", "0.5016093", "0.49509108", "0.49299452", "0.49292362", "0.4...
0.57769316
5
Parse command line arguments.
def parse_args(): parser = argparse.ArgumentParser( description="CUDAPOA Python API sample program.") parser.add_argument('-m', help="Run MSA generation. By default consensusis generated.", action='store_true') parser.add_argument('-p', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_command_line(self, argv):\n from optparse import OptionParser\n usage = \"usage: %prog [options]\"\n parser = OptionParser(usage)\n\n (options, args) = parser.parse_args(argv)", "def parseArguments(self):\n iterator = iter(sys.argv[1:])...
[ "0.807208", "0.74767", "0.73985106", "0.73932225", "0.73173845", "0.72599804", "0.7232453", "0.7222555", "0.713585", "0.7102058", "0.71020466", "0.7096281", "0.7093058", "0.70890576", "0.7080071", "0.70745754", "0.70641047", "0.70633066", "0.70568484", "0.7051162", "0.7048470...
0.6947874
39
>>> date.get_timezones().keys() ['GMT 12', 'GMT 11', 'GMT 10', 'GMT 9', 'GMT 8', 'GMT 7', 'GMT 6', 'GMT 5', 'GMT 4', 'GMT 3', 'GMT 2', 'GMT 1', 'GMT +1', 'GMT +2', 'GMT +3', 'GMT +4', 'GMT +5', 'GMT +6', 'GMT +7', 'GMT +8', 'GMT +9', 'GMT +10', 'GMT +11', 'GMT +12', 'UTC']
def test():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Timezones():\n return sorted(list(PytzCache._zmap.values()))", "def get_timezone_list():\n return pytz.country_timezones('US')", "def get_timezones() -> set[str]:\n return available_timezones() - UNAVAILABLE_TIMEZONES", "def time_zones(self) -> localedata.LocaleDataDict:\n return self._da...
[ "0.78580105", "0.76333445", "0.75435144", "0.67664576", "0.6379932", "0.6363311", "0.6266665", "0.624392", "0.6241186", "0.6190708", "0.61735785", "0.6138003", "0.6076447", "0.60332847", "0.5950163", "0.590704", "0.5869401", "0.586882", "0.5856682", "0.5778913", "0.5778913", ...
0.0
-1
Minifies HTML in one shot.
def minify(input, remove_comments=False, remove_empty_space=False, remove_all_empty_space=False, reduce_empty_attributes=True, reduce_boolean_attributes=False, remove_optional_attribute_quotes=True, convert_charrefs=True, keep_pre=F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_minify(html, comments=False):\n log.info(\"Compressing HTML...\")\n html = remove_html_comments(html) if not comments else html\n html = condense_style(html)\n html = condense_script(html)\n html = clean_unneeded_html_tags(html)\n html = condense_html_whitespace(html)\n html = unquote...
[ "0.73459566", "0.682195", "0.64158505", "0.6395381", "0.62431574", "0.61202526", "0.60312724", "0.59586686", "0.5763621", "0.5704856", "0.5682469", "0.56645495", "0.56635654", "0.5642527", "0.5637009", "0.55821645", "0.5576894", "0.5550429", "0.5489711", "0.5484371", "0.54639...
0.6041132
6
Runs HTML through the minifier in one pass.
def minify(self, *input): self._parser.reset() self.input(*input) return self.finalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_single_html_file(html_file_path):\n log.info(\"Processing HTML file: {0}.\".format(html_file_path))\n try: # Python3\n with open(html_file_path, encoding=\"utf-8-sig\") as html_file:\n minified_html = html_minify(html_file.read(),\n commen...
[ "0.61215395", "0.6073274", "0.60218686", "0.59601444", "0.58416855", "0.5827823", "0.58107656", "0.5784621", "0.57334673", "0.5710153", "0.55754185", "0.55744916", "0.55514747", "0.5541531", "0.5500962", "0.5491819", "0.5470006", "0.546182", "0.54312915", "0.5428959", "0.5412...
0.5058725
55
Feed more HTML into the input stream
def input(self, *input): for i in input: self._parser.feed(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(self):\n HTMLParser.feed(self, self.dirty_html)", "def process_doc_html(self, doc_in):\n self.feed(doc_in) #SGMLParser call\n self.close() #SGMLParser call\n self.hand_off_temp_pieces('to_doc_pieces')\n self.all_pieces = self.all_pieces[:-16] # drop </body></html>...
[ "0.6731285", "0.5953955", "0.58752286", "0.5696137", "0.5630172", "0.56190234", "0.553047", "0.53564507", "0.5336403", "0.53323823", "0.53043175", "0.5289833", "0.52325726", "0.52237165", "0.5170556", "0.5160814", "0.5134574", "0.51269966", "0.5120946", "0.5114495", "0.511418...
0.0
-1
Retrieve the minified output generated thus far.
def output(self): return self._parser.result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js_minify(js):\n log.info(\"Compressing Javascript...\")\n ins, outs = StringIO(js), StringIO()\n JavascriptMinify(ins, outs).minify()\n return force_single_line_js(outs.getvalue())", "def write_minified(output_path, minified_result):\n with output_path.open('w') as out_file:\n last_cha...
[ "0.6143014", "0.60554135", "0.6052664", "0.5837117", "0.5837117", "0.5813492", "0.5813492", "0.5813492", "0.5806984", "0.5768665", "0.55227584", "0.54721683", "0.5414607", "0.54120636", "0.5400579", "0.5354504", "0.5346947", "0.5344406", "0.53166336", "0.5301093", "0.52374953...
0.505104
46
Finishes current input HTML and returns mininified result. This method flushes any remaining input HTML and returns the minified result. It resets the state of the internal parser in the process so that new HTML can be minified. Be sure to call this method before you reuse the ``Minifier`` instance on a new HTML docume...
def finalize(self): self._parser.close() result = self._parser.result self._parser.reset() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish(self):\r\n\r\n self.text += \"</html>\\n\"\r\n\r\n if self.filename != None:\r\n with open(self.filename, \"w\") as f:\r\n f.write(self.text)\r\n\r\n return self.text", "def cleaned_html(self):\n cleaner = Cleaner()\n cleaner.scripts = True\n cleaner.javascrip...
[ "0.58446306", "0.5489363", "0.5416011", "0.5239895", "0.520769", "0.5190396", "0.51881707", "0.51595265", "0.5154992", "0.51375127", "0.51109695", "0.50499785", "0.49499536", "0.48747963", "0.48388648", "0.48273447", "0.47829103", "0.4778408", "0.47230232", "0.47223958", "0.4...
0.52551144
3
Avoids a lot of annoying casts between int and str, and bytes and str. CHANGE AT YOUR OWN PERIL
def decode_dict(state): new_state = dict() for k, v in state.items(): if v.decode().isnumeric(): new_state[k.decode()] = int(v) else: new_state[k.decode()] = v.decode() return new_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_(s: Any, encoding: str = 'utf-8', errors: str = 'strict') -> Any:\n if isinstance(s, int):\n s = str(s)\n if isinstance(s, str):\n return s.encode(encoding, errors)\n return s", "def bytes_(s: Any, encoding: str = 'utf-8', errors: str = 'strict') -> Any:\n if isinstance(s, int...
[ "0.6968363", "0.6968363", "0.6689528", "0.6689528", "0.6583345", "0.6400848", "0.63992685", "0.6380121", "0.6329421", "0.63095134", "0.62881964", "0.6286587", "0.6272842", "0.6258581", "0.62580234", "0.6208159", "0.614194", "0.6131188", "0.61309123", "0.6114445", "0.61044925"...
0.0
-1
Return player and word state
def get_state(game_ID: str) -> dict: if r.exists("state:" + game_ID) == 0: raise exceptions.GameNotFoundError(message="Game not Found") state = { "playerState": decode_dict(r.hgetall("state:" + game_ID)), "wordsState": decode_dict(r.hgetall("words:" + game_ID)), } print(state["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_winner(state):\n\n if", "def show_current_game_state(num_of_tries, secret_word, old_letters_guessed):\n print_hangman(num_of_tries)\n # 4.\n print_show_hidden_word_box(secret_word, old_letters_guessed)\n\n return None", "def get_state(self):\n return {\n \"board\": self...
[ "0.6185246", "0.6150966", "0.6125174", "0.6049091", "0.6040838", "0.59739345", "0.58735585", "0.5858056", "0.58128685", "0.57818294", "0.5702244", "0.56755173", "0.5675262", "0.5669215", "0.5626145", "0.56222945", "0.5618476", "0.5606627", "0.5602254", "0.55636", "0.5550334",...
0.59683025
6
Make sure Only Valid Moves Work
def handle_turn(game_ID, team, action, payload): state = get_state(game_ID) if state["playerState"]["winner"] != "none": return ["playerState"] if state["playerState"]["turn"] != team or state["playerState"]["action"] != action: raise InvalidTurnError( f'{state["playerState"]["a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_valid(move):\n return True", "def is_valid(self, move):\r\n return move > 10 and move < 89", "def valid_move(self, player, move):\n return (True)", "def validate_move(self, move_from, move_to, board):\n\n pass", "def move_check(self):\r\n \r\n if not self.run:...
[ "0.79679424", "0.784702", "0.7758112", "0.77331674", "0.7499835", "0.7477712", "0.7418658", "0.7416915", "0.7390043", "0.7277894", "0.7215022", "0.71928453", "0.71661454", "0.7158739", "0.7150418", "0.71290207", "0.70898724", "0.70661914", "0.7037211", "0.7008785", "0.6957356...
0.0
-1
Takes a UUID and creates two hashes, one for the player state and a second for the words. Throws an exception if either table cannot be created. Returns the dict of words.
def create_game(game_ID): if r.exists("state:" + game_ID) == 1: raise Exception("Game exists already") new_game = { "winner": "none", "turn": "blue", "action": "spymaster", "hint": "", "attemptsLeft": 0, "redPoints": 0, "bluePoints": 0, } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _createWordsTable(self):\n\t\tcommand = \"\"\"CREATE TABLE words (ID INTEGER PRIMARY KEY,\n\t\t\tword TEXT,\n\t\t\ttranslation TEXT,\n\t\t\tlast_refresh INTEGER,\n\t\t\tlevel INTEGER,\n\t\t\tcourse INTEGER\n\t\t\t);\n\"\"\"\n\n\t\tself._run_command(command)", "def _gen_word_dict(words):\n\n # grab...
[ "0.55244195", "0.51943696", "0.51315194", "0.50802517", "0.5050461", "0.5006079", "0.4955824", "0.49215534", "0.49195713", "0.4913948", "0.4857076", "0.4835464", "0.48313388", "0.4811995", "0.48024142", "0.47622284", "0.47576067", "0.47289598", "0.47289598", "0.47243425", "0....
0.4987208
6
Return None or the winning team String
def finish_turn(game_ID): state = get_state(game_ID)["playerState"] if state["redPoints"] == NUM_RED_WORDS: return set_winner(game_ID, "red") elif state["bluePoints"] == NUM_BLUE_WORDS: return set_winner(game_ID, "blue") if state["attemptsLeft"] == 0 and state["action"] == "chooser": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner(self):\n return (\"None\")", "def yield_team(self) -> str: # pragma: no cover", "def get_team(team):\n if team == \"left\":\n return \"0\"\n elif team == \"right\":\n return \"1\"\n elif team == \"spec\":\n return \"-1\"", "def get_winn...
[ "0.7103255", "0.70691526", "0.7022093", "0.6992257", "0.6991379", "0.6921934", "0.67773324", "0.6763558", "0.6739403", "0.67262244", "0.6685351", "0.6666906", "0.6641405", "0.65495414", "0.6534887", "0.6492396", "0.6428692", "0.6401954", "0.63598895", "0.6322285", "0.63176453...
0.0
-1
Set Winner and if no exception, return winning team
def set_winner(game_ID, team): r.hset("state:" + game_ID, "winner", team) return team
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_winner(self):\n diff = self.home_score - self.away_score\n if diff > 0:\n return self.home_team\n elif diff < 0:\n return self.away_team\n else:\n return None", "def calc_winner(self):\n pass", "def winner(self):\n return (\"Non...
[ "0.7377407", "0.7148394", "0.7111746", "0.7074286", "0.7056888", "0.6938372", "0.6938372", "0.69210815", "0.6869209", "0.6844349", "0.6844349", "0.6840777", "0.68241185", "0.6816313", "0.6736115", "0.67078567", "0.6701166", "0.6694143", "0.6673979", "0.66438913", "0.6603614",...
0.7549486
0
Converts the given `s` into an ASCIIencoded string from a Unicodeencoded one.
def unicode_to_ascii(s: str) -> str: chars = [] for c in unicodedata.normalize('NFD', s): if unicodedata.category(c) != 'Mn' and c in ALLOWED_CHARS: chars.append(c) return "".join(chars)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode_to_ascii(s):\n ret = \"\"\n for ch in s:\n try:\n ach = str(ch)\n ret += ach\n except UnicodeEncodeError:\n ret += \"?\"\n return ret", "def unicodeToAscii(s):\n return ''.join(\n c for c in unicodedata.normalize('NFD', s)\n if ...
[ "0.80530214", "0.7639015", "0.75411695", "0.7500414", "0.7283374", "0.72818977", "0.7221033", "0.72080964", "0.70875305", "0.70871806", "0.70841277", "0.7066727", "0.7027619", "0.70116156", "0.69688123", "0.694573", "0.6916214", "0.6898315", "0.68660194", "0.68598235", "0.685...
0.7804846
1
Returns the JSON file locations as a list.
def json_fpaths() -> [str]: return glob.glob(f"{RECIPES_DIRPATH}/*.json")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations(self):\n return self.data.get(\"locations\", [])", "def locations(self):\n return [part.file for part in self.iterParts() if part]", "def locations(self):\n return [part.file for part in self.iterParts() if part]", "def locations(self):\n return [part.file for part i...
[ "0.7117035", "0.67887336", "0.67887336", "0.67887336", "0.67069376", "0.6670644", "0.6662277", "0.66217643", "0.6557245", "0.65487367", "0.65021336", "0.6481439", "0.6472302", "0.64608634", "0.64167076", "0.6407466", "0.6391989", "0.6311217", "0.6309606", "0.6303351", "0.6299...
0.694632
1
Fetches the data and places it in ROOT/recipes.
def fetch_the_data(): subprocess.run(["wget", "https://storage.googleapis.com/recipe-box/recipes_raw.zip"]) subprocess.run(["unzip", "recipes_raw.zip", "-d", RECIPES_DIRPATH]) subprocess.run(["rm", "recipes_raw.zip"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_zenodo(self):\n\n # full path to the stitches root directory where the example dir will be stored\n if self.data_dir is None:\n data_directory = pkg_resources.resource_filename('stitches', 'data')\n else:\n data_directory = self.data_dir\n\n # build neede...
[ "0.6245214", "0.6241662", "0.6241662", "0.6226766", "0.6198662", "0.6165738", "0.6121912", "0.5900479", "0.58915704", "0.5837386", "0.5733908", "0.5716107", "0.5688135", "0.5627597", "0.5602928", "0.5599404", "0.55957514", "0.55879015", "0.5540788", "0.5540788", "0.5540788", ...
0.7108394
0
Takes a block of text which may or may not have newlines in it and formats it so that it contains occasional, sensical newlines.
def _wrap_text(text: str, words_per_line=20) -> str: text = text.replace('\r', '') text = text.replace('\n', '') wordlist = text.split() result = [] for i, word in enumerate(wordlist): if i % words_per_line == 0 and i != 0: result.append('\n') result.append(word) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beautify(text):\n text = re.sub('\\n{3,}', '\\n\\n', text)\n text = re.sub('\\n+$', '\\n', text)\n return text", "def lines_to_blocks(text):\n n_sep = text.count('\\n\\n')\n n_lines = text.count('\\n')\n #approximate ratio of double newlines vs single newline: 40\n if int(n_sep/n_lines*1...
[ "0.7128342", "0.70625186", "0.69793695", "0.68582636", "0.6796243", "0.669664", "0.65374887", "0.6443344", "0.6226812", "0.6174901", "0.6114608", "0.61071527", "0.6104941", "0.607047", "0.60521924", "0.6045679", "0.60394853", "0.5994104", "0.5978971", "0.59592277", "0.5946332...
0.5634178
38
Attempt to reconstitute the recipe texts (.txt files) from the .json files in the data dump. Format for typical recipe in recipes_raw_nosource_ar.json
def reconstitute(): with open(TEXT_FPATH, 'w') as txt: for jfpath in json_fpaths(): with open(jfpath) as f: jstruct = json.load(f) for recipe in jstruct.keys(): _reconstitute_recipe(txt, jstruct[recipe])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_json_advanced(self):\n resources = get_test_resources()\n output, filename = make_json(commit=\"1245\", exclude=[\"tei:note\", \"tei:orig\"], credit=\"PerseusDL\", **resources)\n output = json.loads(output)\n self.assertEqual(\n output[\"text\"][\"0\"][\"0\"][\"...
[ "0.63832706", "0.6344451", "0.6266392", "0.6258279", "0.62190217", "0.61804116", "0.6039548", "0.6027089", "0.59477043", "0.5741175", "0.5722742", "0.5635411", "0.55661666", "0.55637896", "0.5558796", "0.55394006", "0.5533201", "0.552489", "0.5516686", "0.5515263", "0.5502386...
0.7741061
0
Functions that reads wave file and return sample rate and signal as np.array
def sigin(wavname: str) -> Tuple[int, np.ndarray]: return wavutils.read(wavname, mmap=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(filename):\n\n fileName, fileExtension = os.path.splitext(filename)\n wav_filename = filename\n rate, data = scipy.io.wavfile.read(str(wav_filename)) # the data is read in its native format\n if data.dtype =='int16':\n data = numpy.cast['float'](data)\n return [rate,data]", "def analyzeWAV(input...
[ "0.7637376", "0.74526507", "0.7325862", "0.7312433", "0.7103634", "0.70994335", "0.70074445", "0.69622993", "0.69132835", "0.6843838", "0.6817676", "0.67924684", "0.6766235", "0.67566276", "0.6723806", "0.6713958", "0.669472", "0.6693521", "0.6673996", "0.6656236", "0.6578448...
0.0
-1
Returns a Sawtooth wave of Sample rate Ss with Ns number of samples and Sample Frequency Fs
def sawtooth(fs: float, Ns: int, Ss: int) -> np.ndarray: Ss = np.linspace(0, 1, Ss) return sig.sawtooth(2 * np.pi * fs * Ss)[0:Ns]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectral(w, s=1.0):\n n_in, n_out = w.size()\n n = max(n_out, n_in)\n gain = s / math.sqrt(n)\n return w.normal_(0, 1).mul_(gain)", "def gen_square_wave(sample_rate=44100, frequency=440, duration=1000, amplitude=0.3):\n # Calculate the total number of samples required to produce a tone of\n ...
[ "0.70675087", "0.69157755", "0.6851375", "0.6797078", "0.66893816", "0.6640114", "0.63278276", "0.62240446", "0.62175643", "0.6156091", "0.61267036", "0.61228645", "0.6075052", "0.60575694", "0.6036729", "0.60245645", "0.60090667", "0.5987655", "0.5965741", "0.5961952", "0.59...
0.78252214
0
Returns a Triangle wave of Sample rate Ss with Ns number of samples and Sample Frequency Fs
def triangle(fs: float, Ns: int, Ss: int) -> np.ndarray: Ss = np.linspace(0, 1, Ss) return sig.sawtooth(2 * np.pi * fs * Ss, 0.5)[0:Ns]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tri(frequency, amplitude=0.3):\n wave_length = sampler_rate // frequency\n # range from -0.3 to 0.3\n def sampler(t):\n saw_wave = t / wave_length - floor(t / wave_length + 0.5)\n tri_wave = 2 * abs(2 * saw_wave) - 1\n return amplitude * tri_wave\n\n return sampler", "def tri...
[ "0.6694266", "0.66805387", "0.65939575", "0.65774953", "0.6506993", "0.6488529", "0.6342446", "0.634183", "0.62340295", "0.6142268", "0.60790604", "0.60547304", "0.60342395", "0.5972168", "0.59320486", "0.5772053", "0.5769285", "0.5768378", "0.5767567", "0.57552654", "0.57485...
0.7569804
0
Returns a Sine wave of Sample rate Ss with Ns number of samples and Sample Frequency Fs
def sin(fs: float, Ns: int, Ss: int) -> np.ndarray: t = np.arange(Ns) omega = 2 * np.pi * fs / Ss return np.sin(omega * t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samp_from_freq(n_samples):\n datapath = os.path.normpath(os.getcwd()+os.sep+os.pardir+os.sep+\"Dataset\"+os.sep+\"All_channels_500hz.npy\")\n data = np.load(datapath)\n fourier = np.fft.rfft(data,axis=0)\n fourier_mean = np.mean(fourier,axis=1)\n print(fourier.shape)\n ...
[ "0.7237247", "0.7015231", "0.6989364", "0.69638926", "0.69529295", "0.69250596", "0.6905394", "0.67694175", "0.6704618", "0.6662209", "0.66108966", "0.6567472", "0.6516256", "0.6491238", "0.6347568", "0.6320253", "0.63156074", "0.62709546", "0.62377214", "0.6236013", "0.62202...
0.6817768
7
Returns a Cosine wave of Sample rate Ss with Ns number of samples and Sample Frequency Fs
def cos(fs: float, Ns: int, Ss: int) -> np.ndarray: t = np.arange(Ns) omega = 2 * np.pi * fs / Ss return np.cos(omega * t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_freqs(Fs, n):\r\n\r\n return np.linspace(0, float(Fs) / 2, float(n) / 2 + 1)", "def samp_from_freq(n_samples):\n datapath = os.path.normpath(os.getcwd()+os.sep+os.pardir+os.sep+\"Dataset\"+os.sep+\"All_channels_500hz.npy\")\n data = np.load(datapath)\n fourier = np.fft.rfft(data,a...
[ "0.6720286", "0.6695193", "0.66337484", "0.65112084", "0.6426439", "0.6398528", "0.6379758", "0.6349647", "0.63196146", "0.62916994", "0.62803966", "0.62794083", "0.6249711", "0.6236641", "0.6223268", "0.622305", "0.6197544", "0.61473197", "0.6139644", "0.6107206", "0.6093398...
0.7322077
0