text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # pylint: disable=arguments-differ def set_value(self, on_level): """Set the value of the state from the handlers.""" if on_level in FanSpeedRange.OFF: fan_speed = FanSpeed.OFF elif on_level in FanSpeedRange.LOW: fan_speed = FanSpeed.LOW elif...
code_fim
hard
{ "lang": "python", "repo": "pyinsteon/pyinsteon", "path": "/pyinsteon/groups/fan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, name: str, address: Address, group: int = 0, default: FanSpeed = None ): """Init the FanOnLevel class.""" super().__init__(name, address, group, default, value_type=FanSpeed) # pylint: disable=arguments-differ def set_value(self, on_level): """Set the val...
code_fim
medium
{ "lang": "python", "repo": "pyinsteon/pyinsteon", "path": "/pyinsteon/groups/fan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_find_next_page() -> None: """Check if find_next_page method returns correct url""" html_doc = """ <html> <head><title>Example text</title></head> <body><a class="_za9j7e" href="/test">Text to extract</a></body> </html> ...
code_fim
hard
{ "lang": "python", "repo": "GQ21/airbnb-scraper", "path": "/tests/test_scraper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GQ21/airbnb-scraper path: /tests/test_scraper.py import os import sys from bs4 import BeautifulSoup sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from airbnb.scraper import Scraper scraper = Scraper() def get_status() -> None: """Check if webdriver is...
code_fim
hard
{ "lang": "python", "repo": "GQ21/airbnb-scraper", "path": "/tests/test_scraper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_write_dataframe() -> None: """Check if write_dataframe method writes .csv file""" scraper.write_dataframe() assert os.path.isfile("Airbnb.csv") == True scraper.quit()<|fim_prefix|># repo: GQ21/airbnb-scraper path: /tests/test_scraper.py import os import sys from bs4 import Beautifu...
code_fim
hard
{ "lang": "python", "repo": "GQ21/airbnb-scraper", "path": "/tests/test_scraper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ "PushRuntimeDecisionContext", "ReconfigurationRuntimeDecisionContext", "smart_cache_workload_generator_config_space", "smart_cache_workload_generator_default_config", ]<|fim_prefix|># repo: amueller/MLOS path: /source/Mlos.Python/mlos/Examples/SmartCache/MlosInterface/__i...
code_fim
hard
{ "lang": "python", "repo": "amueller/MLOS", "path": "/source/Mlos.Python/mlos/Examples/SmartCache/MlosInterface/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amueller/MLOS path: /source/Mlos.Python/mlos/Examples/SmartCache/MlosInterface/__init__.py # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # """ Contains all classes required for SmartCache to talk to Mlos """ <|fim_suffix|>__all__ = [ "PushRuntimeDecis...
code_fim
hard
{ "lang": "python", "repo": "amueller/MLOS", "path": "/source/Mlos.Python/mlos/Examples/SmartCache/MlosInterface/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: janelia-flyem/cluster-calclabels path: /CalcLabelOrchestration/orchestration/calclabels_cluster.py args.append(options.roi) if docomputeprob: # program will handle the fact that there is a uniform buffer in the prediction file args.append("--prediction-f...
code_fim
hard
{ "lang": "python", "repo": "janelia-flyem/cluster-calclabels", "path": "/CalcLabelOrchestration/orchestration/calclabels_cluster.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # wait for job completion wait_for_jobs(cluster_session, job_ids, message, "agglomerate") # write status: 'performed watershed' message.write_status("performed agglomeration") # launch reduce jobs and wait job_ids = [] job_num = 0 ...
code_fim
hard
{ "lang": "python", "repo": "janelia-flyem/cluster-calclabels", "path": "/CalcLabelOrchestration/orchestration/calclabels_cluster.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> config["offset"] = self.id_offset config["bbox1"] = [self.roi.x1, self.roi.y1, self.roi.z1] config["bbox2"] = [self.roi.x2, self.roi.y2, self.roi.z2] config["border"] = self.border config["labels"] = self.session_location + "/segmentation.h5" config["labelso...
code_fim
hard
{ "lang": "python", "repo": "janelia-flyem/cluster-calclabels", "path": "/CalcLabelOrchestration/orchestration/calclabels_cluster.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vnsai/python path: /DataScience/Python3/Level-2/AddofMatrix.py #addition of two matrix elements _author__ = "Dilipbobby" <|fim_suffix|>Result = [[0,0,0], [0,0,0], [0,0,0]] # iterate through rows for i in range(len(X)): # iterate through columns ...
code_fim
medium
{ "lang": "python", "repo": "vnsai/python", "path": "/DataScience/Python3/Level-2/AddofMatrix.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>Result = [[0,0,0], [0,0,0], [0,0,0]] # iterate through rows for i in range(len(X)): # iterate through columns for j in range(len(A[0])): #aadition of elements result[i][j] = A[i][j] + B[i][j] for r in result: print(r)<|fim_prefix|># repo: v...
code_fim
medium
{ "lang": "python", "repo": "vnsai/python", "path": "/DataScience/Python3/Level-2/AddofMatrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> A = [5, 9, 100, 9, 97, 6, 9, 98, 9] self.assertEqual(mmm(A), (38.0, 9, 9)) if __name__=="__main__": unittest.main()<|fim_prefix|># repo: JiniousChoi/encyclopedia-in-code path: /mooc/udacity/st101/my_avg.py #!/usr/bin/env python3 import unittest def mean(A): return sum(A)/len(A)...
code_fim
medium
{ "lang": "python", "repo": "JiniousChoi/encyclopedia-in-code", "path": "/mooc/udacity/st101/my_avg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def mmm(A): A.sort() return mean(A), median(A), mode(A) class MyAvgTest(unittest.TestCase): def test_method1(self): A = [5, 9, 100, 9, 97, 6, 9, 98, 9] self.assertEqual(mmm(A), (38.0, 9, 9)) if __name__=="__main__": unittest.main()<|fim_prefix|># repo: JiniousChoi/encyclo...
code_fim
medium
{ "lang": "python", "repo": "JiniousChoi/encyclopedia-in-code", "path": "/mooc/udacity/st101/my_avg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JiniousChoi/encyclopedia-in-code path: /mooc/udacity/st101/my_avg.py #!/usr/bin/env python3 import unittest def mean(A): return sum(A)/len(A) def median(A): <|fim_suffix|> A = [5, 9, 100, 9, 97, 6, 9, 98, 9] self.assertEqual(mmm(A), (38.0, 9, 9)) if __name__=="__main__": ...
code_fim
hard
{ "lang": "python", "repo": "JiniousChoi/encyclopedia-in-code", "path": "/mooc/udacity/st101/my_avg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from numpy import inf name = "sc_paracrystal" title = "Simple cubic lattice with paracrystalline distortion" description = """ P(q)=(scale/Vp)*V_lattice*P(q)*Z(q)+bkg where scale is the volume fraction of sphere, Vp = volume of the primary particle, V_lattice = volume corr...
code_fim
hard
{ "lang": "python", "repo": "SasView/sasmodels", "path": "/explore/sc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SasView/sasmodels path: /explore/sc.py r""" Calculates the scattering from a **simple cubic lattice** with paracrystalline distortion. Thermal vibrations are considered to be negligible, and the size of the paracrystal is infinitely large. Paracrystalline distortion is assumed to be isotropic and...
code_fim
hard
{ "lang": "python", "repo": "SasView/sasmodels", "path": "/explore/sc.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> CLONE = 'clone' BACKUPNOW = 'backupNow' FIELDMESSAGE = 'fieldMessage' BULKINSTALLAPP = 'bulkInstallApp' TIERING = 'tiering' ANALYSIS = 'analysis' AGENTUPGRADETASK = 'agentUpgradeTask'<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/mode...
code_fim
medium
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/task_type_enum.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ RESTORE = 'restore' CLONE = 'clone' BACKUPNOW = 'backupNow' FIELDMESSAGE = 'fieldMessage' BULKINSTALLAPP = 'bulkInstallApp' TIERING = 'tiering' ANALYSIS = 'analysis' AGENTUPGRADETASK = 'agentUpgradeTask'<|fim_prefix|># repo: cohesity/management-sdk-python p...
code_fim
hard
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/task_type_enum.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/task_type_enum.py # -*- coding: utf-8 -*- # Copyright 2023 Cohesity Inc. class TaskTypeEnum(object): """Implementation of the 'TaskType' enum. Task type denotes which type of task this notification is for. This param ...
code_fim
medium
{ "lang": "python", "repo": "cohesity/management-sdk-python", "path": "/cohesity_management_sdk/models/task_type_enum.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxoyed/CQU_2021_Spring_Python018 path: /题库/第2至3章练习/编程题/4.计算跑道长度/__main__.py name = input() a = float(input()) v = float(input()) leng<|fim_suffix|> the shortest take-off runway length is {length:.2f} M.")<|fim_middle|>th = v * v / (2 * a) print(f"The acceleration of {name} is {a:.2f} M / s, the ...
code_fim
medium
{ "lang": "python", "repo": "maxoyed/CQU_2021_Spring_Python018", "path": "/题库/第2至3章练习/编程题/4.计算跑道长度/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> the shortest take-off runway length is {length:.2f} M.")<|fim_prefix|># repo: maxoyed/CQU_2021_Spring_Python018 path: /题库/第2至3章练习/编程题/4.计算跑道长度/__main__.py name = input() a = float(input()) v = float(input()) leng<|fim_middle|>th = v * v / (2 * a) print(f"The acceleration of {name} is {a:.2f} M / s, the ...
code_fim
medium
{ "lang": "python", "repo": "maxoyed/CQU_2021_Spring_Python018", "path": "/题库/第2至3章练习/编程题/4.计算跑道长度/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sweattep/EditFrontMatter path: /examples/example1/example1.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ *Basic Front Matter Editing Example* ==================================== .. module:: example1 .. program:: example1 :Synopsis: Example program that performs the following actions:...
code_fim
hard
{ "lang": "python", "repo": "sweattep/EditFrontMatter", "path": "/examples/example1/example1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ # generic path - overridden by env var `TEST_DATA_DIR` DATA_PATH = "../data/" if "TEST_DATA_DIR" in os.environ: DATA_PATH = os.path.abspath(os.environ.get("TEST_DATA_DIR")) + "/" # set path to input file file_path = os.path.abspath(DATA_PATH + "example1.md") # i...
code_fim
hard
{ "lang": "python", "repo": "sweattep/EditFrontMatter", "path": "/examples/example1/example1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a, b, c = logit_probs.shape[0], logit_probs.shape[1], logit_probs.shape[2] logit_probs = self.logsoftmax(self.reshape(logit_probs, (-1, c))) logit_probs = self.reshape(logit_probs, (a, b, c)) log_probs = log_probs + logit_probs if self.reduce: return -s...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/audio/wavenet/wavenet_vocoder/mixture.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/models path: /research/audio/wavenet/wavenet_vocoder/mixture.py # Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License ...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/audio/wavenet/wavenet_vocoder/mixture.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.log_op(1 + self.exp_op(- self.abs_op(x))) + self.relu_op(x) class discretized_mix_logistic_loss(nn.Cell): """ Discretized_mix_logistic_loss Args: num_classes (int): Num_classes log_scale_min (float): Log scale minimum value """ def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/research/audio/wavenet/wavenet_vocoder/mixture.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not pid and not name: rc, out, err = j.sal.process.execute("ps ax") click.echo(out) elif name: click.echo(j.sal.process.psfind(name)) elif pid: click.echo(j.sal.process.getProcessPid(pid)) if __name__ == "__main__": list_processes()<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "AhmedSa-mir/cl-tools", "path": "/scripts/list-processes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AhmedSa-mir/cl-tools path: /scripts/list-processes.py #!/usr/bin/env python3 from Jumpscale import j import click @click.command() @click.option('--pid', '-p', help='Get PID of process with this name') @click.option('--name', '-n', help='Check whether a process with this name exists or not') de...
code_fim
medium
{ "lang": "python", "repo": "AhmedSa-mir/cl-tools", "path": "/scripts/list-processes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": acc_avg_steps = 100 SPL_avg_steps = 250 metrics_to_plot = ["train_acc", "valid_acc", "SPL"] # , "sparse_reward" parent_dir = os.path.join("rslts", "1022_log") if not os.path.exists("plots"): os.mkdir("plots") performance_dict = {} ...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/feedback-navigation", "path": "/feedback-robot-learning/simulation_and_analysis/husky_hf_loss_analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> array_to_avg = np.asarray(list_to_avg) array_to_avg = array_to_avg.reshape(array_to_avg.shape[0], -1) array_to_avg = np.where(np.isnan(array_to_avg), 0, array_to_avg) array_cum_sum = np.copy(array_to_avg) for i in range(1, array_to_avg.shape[1]): array_cum_sum[:, i] = arra...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/feedback-navigation", "path": "/feedback-robot-learning/simulation_and_analysis/husky_hf_loss_analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junyaoshi/feedback-navigation path: /feedback-robot-learning/simulation_and_analysis/husky_hf_loss_analysis.py import os import json import math import pickle import numpy as np import matplotlib.pyplot as plt def append_or_create_list_for_key(dict, key, ele): if key in dict: ...
code_fim
hard
{ "lang": "python", "repo": "junyaoshi/feedback-navigation", "path": "/feedback-robot-learning/simulation_and_analysis/husky_hf_loss_analysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param genomes: The list of genomes to evolve in some way. :param pool: The pool of processes to use for work. :param params: The dictionary of user-specified parameters. :return: A new list of modified genomes. """ pass<|fim_prefix|># repo: wbknez/evored-wa...
code_fim
hard
{ "lang": "python", "repo": "wbknez/evored-warrior", "path": "/evored/algorithm/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wbknez/evored-warrior path: /evored/algorithm/__init__.py """ Contains all classes and functions designed to make a uniform API for performing different evolutionary operations on a list of genomes. """ from abc import abstractmethod, ABCMeta class EvolvingAlgorithm(metaclass=ABCMeta): """ ...
code_fim
hard
{ "lang": "python", "repo": "wbknez/evored-warrior", "path": "/evored/algorithm/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>graph = [[(1, 10), (2, 7), (3, 3)], [(0, 10), (3, 5), (4, 20)], [(0, 7), (4, 11), (7, 8)], [(0, 3), (1, 5), (4, 14), (5, 5)], [(1, 20), (2, 11), (3, 14), (6, 8)], [(3, 5), (6, 9)], [(4, 8), (5, 9), (7, 13)], [(2, 8), (6, 13), (8, 10)], [(7, 10)]] t = 3 print(safe_flight(graph, t, 8))<|fi...
code_fim
hard
{ "lang": "python", "repo": "adam147g/ASD_exercises_solutions", "path": "/Exercises/Exercise_08/09_exercise.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adam147g/ASD_exercises_solutions path: /Exercises/Exercise_08/09_exercise.py # Dany jest graf G = (V, E), którego wierzchołki reprezentują punkty nawigacyjne nad Bajtocją, # a krawędzie reprezentują korytarze powietrzne między tymi punktami. Każdy korytarz powietrzny # e[i] ∈ E powiązany jest z o...
code_fim
hard
{ "lang": "python", "repo": "adam147g/ASD_exercises_solutions", "path": "/Exercises/Exercise_08/09_exercise.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (func_result): if not result: result = func_result else: result += func_result return result<|fim_prefix|># repo: DanPalmz/pyecwid path: /pyecwid/ecwidutils.py def get_attribute_json(attribute_id, value): return { "attrib...
code_fim
hard
{ "lang": "python", "repo": "DanPalmz/pyecwid", "path": "/pyecwid/ecwidutils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanPalmz/pyecwid path: /pyecwid/ecwidutils.py def get_attribute_json(attribute_id, value): return { "attributes": [ { "id": attribute_id, "value": value }, ] } <|fim_suffix|> result = False for item in items:...
code_fim
hard
{ "lang": "python", "repo": "DanPalmz/pyecwid", "path": "/pyecwid/ecwidutils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> root.startRendering() ## [ogre_to_np] mem = np.empty((win.getHeight(), win.getWidth(), 3), dtype=np.uint8) pb = Ogre.PixelBox(win.getWidth(), win.getHeight(), 1, Ogre.PF_BYTE_RGB, mem) win.copyContentsToMemory(pb, pb) ## [ogre_to_np] ## [zero_copy_view] pyplot.ims...
code_fim
hard
{ "lang": "python", "repo": "OGRECave/ogre", "path": "/Samples/Python/numpy_sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ## [ogre_to_np] mem = np.empty((win.getHeight(), win.getWidth(), 3), dtype=np.uint8) pb = Ogre.PixelBox(win.getWidth(), win.getHeight(), 1, Ogre.PF_BYTE_RGB, mem) win.copyContentsToMemory(pb, pb) ## [ogre_to_np] ## [zero_copy_view] pyplot.imsave("screenshot.png", mem) ...
code_fim
hard
{ "lang": "python", "repo": "OGRECave/ogre", "path": "/Samples/Python/numpy_sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OGRECave/ogre path: /Samples/Python/numpy_sample.py import Ogre import Ogre.Bites import Ogre.RTShader import numpy as np from matplotlib import pyplot def main(): app = Ogre.Bites.ApplicationContext("PySample") app.initApp() root = app.getRoot() scn_mgr = root.createSceneM...
code_fim
hard
{ "lang": "python", "repo": "OGRECave/ogre", "path": "/Samples/Python/numpy_sample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # for i in range(len(weights)): # if weights[i] > 1.0: # weights[i] = 1.0 # else: # continue total = np.sum(weights) return np.asarray(weights / total, order='C') def train_classify(self, clf, trans_data, trans_la...
code_fim
hard
{ "lang": "python", "repo": "holacola1985/tradaboost", "path": "/Fed_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train_classify(self, clf, trans_data, trans_label, test_data, P): # AdaBoost clf.fit(trans_data, trans_label, sample_weight=P[0:len(trans_label), ]) updated_model = clf # for clf, w in zip(clf.estimators_, clf.estimator_weights_): # updated_model.append(clf...
code_fim
hard
{ "lang": "python", "repo": "holacola1985/tradaboost", "path": "/Fed_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: holacola1985/tradaboost path: /Fed_main.py # -*- coding: UTF-8 -*- import numpy import numpy as np from sklearn.metrics import accuracy_score from sklearn import metrics import pickle from sklearn import tree from sklearn.linear_model import LogisticRegression from sklearn.ensemble import...
code_fim
hard
{ "lang": "python", "repo": "holacola1985/tradaboost", "path": "/Fed_main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># phi(m*n) = phi(m)*phi(n) if gcd(m,n) == 1 # prime phi(p) = p-1 def phi(number): root = math.floor(math.sqrt(number)) result = 1 i = 0 t = prime[i] while t <= root: count = 0 while number%t == 0: count += 1 number = number//t if count > ...
code_fim
medium
{ "lang": "python", "repo": "Adamssss/projectEuler", "path": "/Problem 001-150 Python/pb069.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Adamssss/projectEuler path: /Problem 001-150 Python/pb069.py import math import time t1 = time.time() prime = [2,3] b = 3 while True: if b > 1000: break while True: b = b+2 i = 0 t = True while (prime[i]*prime[i] < b): i=i+1 ...
code_fim
hard
{ "lang": "python", "repo": "Adamssss/projectEuler", "path": "/Problem 001-150 Python/pb069.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ps = [0,1] # phi(m*n) = phi(m)*phi(n) if gcd(m,n) == 1 # prime phi(p) = p-1 def phi(number): root = math.floor(math.sqrt(number)) result = 1 i = 0 t = prime[i] while t <= root: count = 0 while number%t == 0: count += 1 number = number//t ...
code_fim
medium
{ "lang": "python", "repo": "Adamssss/projectEuler", "path": "/Problem 001-150 Python/pb069.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> del01_prostori = forms.BooleanField(initial=False, required=False) # prostori = forms.BooleanField(initial=False, required=False)<|fim_prefix|># repo: vasjapavlovic/eda5 path: /eda5/import/forms/import_lokacija_forms.py from django import forms <|fim_middle|># potrditev ali žeiliš uvoziti ali ne...
code_fim
medium
{ "lang": "python", "repo": "vasjapavlovic/eda5", "path": "/eda5/import/forms/import_lokacija_forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vasjapavlovic/eda5 path: /eda5/import/forms/import_lokacija_forms.py from django import forms <|fim_suffix|> del01_prostori = forms.BooleanField(initial=False, required=False) # prostori = forms.BooleanField(initial=False, required=False)<|fim_middle|># potrditev ali žeiliš uvoziti ali ne...
code_fim
medium
{ "lang": "python", "repo": "vasjapavlovic/eda5", "path": "/eda5/import/forms/import_lokacija_forms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def initialize(self, opt): self.opt = opt # directories self.dataroot = opt.dataroot self.image_dir = os.path.join(opt.dataroot, 'images') self.uvs_dir = os.path.join(opt.dataroot, 'uvs') # debug print if opt.verbose: print('load se...
code_fim
hard
{ "lang": "python", "repo": "suzhenwang86/NeuralTexGen", "path": "/data/uv_dataset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> UV = transforms.ToTensor()(uv_numpy.astype(np.float32)) UV = torch.where(UV > 1.0, torch.zeros_like(UV), UV) UV = torch.where(UV < 0.0, torch.zeros_like(UV), UV) UV = 2.0 * UV - 1.0 ## img img_fname = os.path.join(self.image_dir, str(id) + '.jpg') i...
code_fim
hard
{ "lang": "python", "repo": "suzhenwang86/NeuralTexGen", "path": "/data/uv_dataset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: suzhenwang86/NeuralTexGen path: /data/uv_dataset.py import os.path import random import torchvision.transforms as transforms import torch import numpy as np from data.base_dataset import BaseDataset from PIL import Image from util import util from scipy.misc import imresize def make_dataset_exr_...
code_fim
hard
{ "lang": "python", "repo": "suzhenwang86/NeuralTexGen", "path": "/data/uv_dataset.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: david58/gradertools path: /gradertools/compilation/interface.py class CompilerInterface: def __init__(self, sourcepath): self.sourcepath = sourcepath self._binarypath = None self._status = None self._error = None def compile(self, isolator): ...
code_fim
easy
{ "lang": "python", "repo": "david58/gradertools", "path": "/gradertools/compilation/interface.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_status(self): return self._status def get_error(self): return self._error<|fim_prefix|># repo: david58/gradertools path: /gradertools/compilation/interface.py class CompilerInterface: def __init__(self, sourcepath): self.sourcepath = sourcepath se...
code_fim
medium
{ "lang": "python", "repo": "david58/gradertools", "path": "/gradertools/compilation/interface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_error(self): return self._error<|fim_prefix|># repo: david58/gradertools path: /gradertools/compilation/interface.py class CompilerInterface: def __init__(self, sourcepath): self.sourcepath = sourcepath self._binarypath = None self._status = None ...
code_fim
medium
{ "lang": "python", "repo": "david58/gradertools", "path": "/gradertools/compilation/interface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xz725/TFSecured path: /python/encrypt_model.py import base64 import hashlib import os import sys import string import random try: from Crypto import Random from Crypto.Cipher import AES except: raise Exception('Install Crypto! \n pip install pycrypto') try: import tensorflow as t...
code_fim
hard
{ "lang": "python", "repo": "xz725/TFSecured", "path": "/python/encrypt_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def read_arg(index, default=None, err_msg=None): def print_error(): if err_msg is not None: raise Exception(err_msg) else: raise Exception('Not found arg with index %s' % index) if len(sys.argv) <= index: if default is not None: return d...
code_fim
hard
{ "lang": "python", "repo": "xz725/TFSecured", "path": "/python/encrypt_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: laincloud/redis-libs path: /test/write_data.py import random import redis import logging import time REDIS_HOST = '127.0.0.1' REDIS_PORT = 7001 DEBUG = 1 TIMEOUT = 10 r = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT,socket_timeout=TIMEOUT) <|fim_suffix|> try: global key ...
code_fim
medium
{ "lang": "python", "repo": "laincloud/redis-libs", "path": "/test/write_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def write_data_with_redis_client(*args): try: global key key = random.randint(1,100000) value = random.randint(1,100000) res = str(r.set(key,value)) print 'redisclient set '+ str(key) + '\'s value: '+ str(value) + " : "+ str(res) except Exception as e: ...
code_fim
medium
{ "lang": "python", "repo": "laincloud/redis-libs", "path": "/test/write_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": while True: write_data_with_redis_client() time.sleep(1)<|fim_prefix|># repo: laincloud/redis-libs path: /test/write_data.py import random import redis import logging import time REDIS_HOST = '127.0.0.1' REDIS_PORT = 7001 DEBUG = 1 TIMEOUT = 10 r = redis.S...
code_fim
hard
{ "lang": "python", "repo": "laincloud/redis-libs", "path": "/test/write_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pos = parser.airdump_parser(ap_list, client_list, refresh_time=100, elast_time=99999999, save_file_name="aaaa", is_show=False) ''' for i in range(10): pos = monitor.airdump_parser(ap_list, client_list, pos) ''' print(pos)<|fim_prefix|># repo: lanfis/WiFi_Monitor path: /test.py #!/usr/bin/env pyt...
code_fim
hard
{ "lang": "python", "repo": "lanfis/WiFi_Monitor", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanfis/WiFi_Monitor path: /test.py #!/usr/bin/env python # license removed for brevity import os import sys current_folder = os.path.dirname(os.path.realpath(__file__)) sys.path.append(current_folder) import numpy as np from parser import PARSER parser = PARSER() ''' monitor.init() ...
code_fim
medium
{ "lang": "python", "repo": "lanfis/WiFi_Monitor", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ort Network from .optimizer import Optimizer<|fim_prefix|># repo: yubin1219/GAN path: /StyleGAN/dnnlib/tflib/__init__.py from . import autosummary from . import netw<|fim_middle|>ork from . import optimizer from . import tfutil from .tfutil import * from .network imp
code_fim
medium
{ "lang": "python", "repo": "yubin1219/GAN", "path": "/StyleGAN/dnnlib/tflib/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yubin1219/GAN path: /StyleGAN/dnnlib/tflib/__init__.py from . import autosummary from . import netw<|fim_suffix|>util from .tfutil import * from .network import Network from .optimizer import Optimizer<|fim_middle|>ork from . import optimizer from . import tf
code_fim
easy
{ "lang": "python", "repo": "yubin1219/GAN", "path": "/StyleGAN/dnnlib/tflib/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmoretz/Python-Playground path: /src/Classes/MSDS400/Module 7/drug_reaction.py from sympy import symbols, integrate, Rational, lambdify, sqrt import matplotlib.pyplot as plt import numpy as np <|fim_suffix|>t = symbols( 't', positive = True ) dR = ( 2 / ( t + 1 ) ) + ( 2 / sqrt( t + 1 ) ) # wh...
code_fim
medium
{ "lang": "python", "repo": "bmoretz/Python-Playground", "path": "/src/Classes/MSDS400/Module 7/drug_reaction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x_vals = np.linspace( g_xlim[0], g_xlim[1], 1000, endpoint=True ) y_vals = lam_p( x_vals ) plt.plot( x_vals, y_vals ) plt.show()<|fim_prefix|># repo: bmoretz/Python-Playground path: /src/Classes/MSDS400/Module 7/drug_reaction.py from sympy import symbols, integrate, Rational, lambdify, sqrt import matplo...
code_fim
hard
{ "lang": "python", "repo": "bmoretz/Python-Playground", "path": "/src/Classes/MSDS400/Module 7/drug_reaction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print cc = ca.code[:1] \ + [(LOAD_CONST, 4)] \ + ca.code[2:4] \ + [(LOAD_CONST, 2),(STORE_FAST, 'b'),(SetLineno, 4)] \ + ca.code[4:5] \ + [(LOAD_FAST, 'b'),(BINARY_ADD, None)] \ + ca.code[5:] print "before", a() ca.code = cc a.func_code = ca.to_code() print "after", a()<|fim_prefix|># repo: evandri...
code_fim
medium
{ "lang": "python", "repo": "evandrix/Splat", "path": "/doc/pycodeutils_using_byteplay.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: evandrix/Splat path: /doc/pycodeutils_using_byteplay.py #!/usr/bin/env python # -*- coding: utf-8 -*- from byteplay import * from pprint import pprint from simple import a, b ca = Code.from_code<|fim_suffix|> print cc = ca.code[:1] \ + [(LOAD_CONST, 4)] \ + ca.code[2:4] \ + [(LOAD_CONST, 2),(S...
code_fim
medium
{ "lang": "python", "repo": "evandrix/Splat", "path": "/doc/pycodeutils_using_byteplay.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> \ + [(LOAD_FAST, 'b'),(BINARY_ADD, None)] \ + ca.code[5:] print "before", a() ca.code = cc a.func_code = ca.to_code() print "after", a()<|fim_prefix|># repo: evandrix/Splat path: /doc/pycodeutils_using_byteplay.py #!/usr/bin/env python # -*- coding: utf-8 -*- from byteplay import * from pprint import ...
code_fim
hard
{ "lang": "python", "repo": "evandrix/Splat", "path": "/doc/pycodeutils_using_byteplay.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open(args.checkpoint, 'rb') as f: if args.cuda: model = torch.load(f) else: model = torch.load(f, map_location='cpu') model.eval() if args.model == 'QRNN': model.reset() if args.cuda: model.cuda() else: model.cpu() corpus = data.Corpus(args.data) ntokens = len(co...
code_fim
hard
{ "lang": "python", "repo": "zzsfornlp/misc", "path": "/ark/lmeval/lm_eval2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zzsfornlp/misc path: /ark/lmeval/lm_eval2.py # import argparse import torch from torch.autograd import Variable import data parser = argparse.ArgumentParser(description='PyTorch PTB Language Model') # Model parameters. parser.add_argument('--data', type=str, default='./data/penn', ...
code_fim
hard
{ "lang": "python", "repo": "zzsfornlp/misc", "path": "/ark/lmeval/lm_eval2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> txt.append( "{name:20} = {date:{DATE_FMT_DEFAULT}} {value:{value_fmt}}".format( name=name, date=m.date, DATE_FMT_DEFAULT=DATE_FMT_DEFAULT, value=value, value_fmt=value_fmt, ...
code_fim
hard
{ "lang": "python", "repo": "galactics/beyond", "path": "/beyond/io/ccsds/tdm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return header + "\n" + text def _dumps_xml(data, **kwargs): filtered = ((path, data.filter(path=path)) for path in data.paths) top = dump_xml_header(data, "TDM", version="1.0", **kwargs) body = ET.SubElement(top, "body") for path, measure_set in filtered: segment = ET.SubE...
code_fim
hard
{ "lang": "python", "repo": "galactics/beyond", "path": "/beyond/io/ccsds/tdm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: galactics/beyond path: /beyond/io/ccsds/tdm.py import numpy as np import lxml.etree as ET from ...constants import c from ...utils import units from ...utils.measures import MeasureSet, Range, Azimut, Elevation, Doppler from .commons import ( CcsdsError, parse_date, dump_kvn_header,...
code_fim
hard
{ "lang": "python", "repo": "galactics/beyond", "path": "/beyond/io/ccsds/tdm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RidhimaKohli/hostel-web-app path: /hostel_project/hostel_webapp/migrations/0007_auto_20201126_1135.py # Generated by Django 3.0.8 on 2020-11-26 11:35 <|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('hostel_webapp', '0006_remove_complaint_complaint_pic'), ]...
code_fim
easy
{ "lang": "python", "repo": "RidhimaKohli/hostel-web-app", "path": "/hostel_project/hostel_webapp/migrations/0007_auto_20201126_1135.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RenameField( model_name='complaint', old_name='author', new_name='student', ), ]<|fim_prefix|># repo: RidhimaKohli/hostel-web-app path: /hostel_project/hostel_webapp/migrations/0007_auto_20201126_1135.py # Generated by ...
code_fim
medium
{ "lang": "python", "repo": "RidhimaKohli/hostel-web-app", "path": "/hostel_project/hostel_webapp/migrations/0007_auto_20201126_1135.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrdegerholm/tracerobot path: /tracerobot/utils.py #pylint: disable=no-else-return from contextlib import contextmanager from datetime import datetime import traceback import os.path @contextmanager def catch_exc(): <|fim_suffix|> return datetime.now().strftime('%Y%m%d %H:%M:%S.%f')[0:-3] ...
code_fim
hard
{ "lang": "python", "repo": "mrdegerholm/tracerobot", "path": "/tracerobot/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def timestamp(): return datetime.now().strftime('%Y%m%d %H:%M:%S.%f')[0:-3] def format_args(*args, **kwargs): return ([repr(a) for a in args] + ['{!r}={!r}'.format(k, v) for k, v in kwargs.items()]) def format_exc(exc, value, tb): stack_summary = traceback.extract_tb(tb) fr...
code_fim
hard
{ "lang": "python", "repo": "mrdegerholm/tracerobot", "path": "/tracerobot/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: skbansal5642/Web-CLI path: /web-cli.py #!/usr/bin/python3 print("content-type:text/html \n") print(""" <html> <head> <title>Don't look at title</title> </head> <|fim_suffix|>opt = sp.getoutput("sudo " + cmd) if cmd == "date": full_date = list(opt.split()) print("<h1> Date </h1>") pri...
code_fim
hard
{ "lang": "python", "repo": "skbansal5642/Web-CLI", "path": "/web-cli.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("<h1> Date </h1>") print(f""" <h3><xmp> Day: {full_date[0]} Date: {full_date[2]} Month: {full_date[1]} Year: {full_date[5]} Time: {full_date[3]} Timezome: {full_date[4]} </xmp></h3> """) else: print(f"<h1> {cmd}: </h1>") print(f""" <h3><xmp> {op...
code_fim
medium
{ "lang": "python", "repo": "skbansal5642/Web-CLI", "path": "/web-cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>opt = sp.getoutput("sudo " + cmd) if cmd == "date": full_date = list(opt.split()) print("<h1> Date </h1>") print(f""" <h3><xmp> Day: {full_date[0]} Date: {full_date[2]} Month: {full_date[1]} Year: {full_date[5]} Time: {full_date[3]} Timezome: {full_date[4]} </xmp></h3> ""...
code_fim
hard
{ "lang": "python", "repo": "skbansal5642/Web-CLI", "path": "/web-cli.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NicolasMRSN/final_project_BC path: /frontend/views.py from django.shortcuts import render from blockchain_func.blockchain import Blockchain from authentication.models import FaceAuthUser from frontend.forms.transaction import Transaction from authentication.views import facial_auth <|fim_suffix...
code_fim
medium
{ "lang": "python", "repo": "NicolasMRSN/final_project_BC", "path": "/frontend/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Show all information stored about a single user. Args: pk (str): [description] Returns: render: show_user.html """ user = facial_auth.get_user() if user is None: return redirect('login_password') #user = FaceAuthUser.objects.get(pk=1) global cur...
code_fim
medium
{ "lang": "python", "repo": "NicolasMRSN/final_project_BC", "path": "/frontend/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0rbytal/pappy-proxy path: /pappyproxy/config.py import imp import json import os import shutil PAPPY_DIR = os.path.dirname(os.path.realpath(__file__)) DATA_DIR = os.path.join(os.path.expanduser('~'), '.pappy') CERT_DIR = os.path.join(DATA_DIR, 'certs') DATAFILE = 'data.db' DEBUG_DIR = None DEBU...
code_fim
hard
{ "lang": "python", "repo": "0rbytal/pappy-proxy", "path": "/pappyproxy/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make sure we have a config file if not os.path.isfile(fname): print "Copying default config to %s" % fname default_config_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default_user_config.json') shutil.copyfile(d...
code_fim
hard
{ "lang": "python", "repo": "0rbytal/pappy-proxy", "path": "/pappyproxy/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: naturalGAYms/TheGame path: /menu.py # coding=utf-8 """ EXAMPLE 2 Game menu with 3 difficulty options. Copyright (C) 2017-2018 Pablo Pizarro @ppizarror This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Fr...
code_fim
hard
{ "lang": "python", "repo": "naturalGAYms/TheGame", "path": "/menu.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for m in HELP: help_menu.add_line(m) help_menu.add_line(PYGAMEMENU_TEXT_NEWLINE) help_menu.add_option('Return to menu', PYGAME_MENU_BACK) main_menu = pygameMenu.Menu(surface, bgfun=main_background, color_selected=COLOR_WHITE, ...
code_fim
hard
{ "lang": "python", "repo": "naturalGAYms/TheGame", "path": "/menu.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 6e726d/monmob path: /tools/trxunpack.py #!/usr/bin/python from __future__ import with_statement import sys from struct import pack, unpack from zlib import crc32, adler32 <|fim_suffix|> if calcedcrc < 0: # crc32 should be unsigned... calcedcrc = (calcedcrc + 1) * (-1) if pack("<...
code_fim
hard
{ "lang": "python", "repo": "6e726d/monmob", "path": "/tools/trxunpack.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if calcedcrc < 0: # crc32 should be unsigned... calcedcrc = (calcedcrc + 1) * (-1) if pack("<l", calcedcrc) != headercrc: raise Exception("Checksum mismatch!") else: print "checksum ok" with open(dstfname, "wb") as f: f.write(firmdata[0x1c:]) if __name__ ...
code_fim
medium
{ "lang": "python", "repo": "6e726d/monmob", "path": "/tools/trxunpack.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: KRHS-GameProgramming-2014/the-temple-of-the-lobsterman-2 path: /Player.py import pygame from Bullet import Bullet class Player(pygame.sprite.Sprite): def __init__(self, pos): pygame.sprite.Sprite.__init__(self, self.containers) self.upImages = [pygame.image.load("Resour...
code_fim
hard
{ "lang": "python", "repo": "KRHS-GameProgramming-2014/the-temple-of-the-lobsterman-2", "path": "/Player.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if direction == "attack": self.changed = True self.speedx = 0 self.speedy = 0 self.attacking = True self.frame = 0 self.waitCount = 0 Bullet(self.rect.center, self.facing) if direction == "up": ...
code_fim
hard
{ "lang": "python", "repo": "KRHS-GameProgramming-2014/the-temple-of-the-lobsterman-2", "path": "/Player.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not self.is_new_parent: if len(self.slate_obj['document']['nodes']): last_node = self.slate_obj['document']['nodes'].pop() if last_node['type'] in ['paragraph', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']: last_node['nodes'].append(elem) ...
code_fim
hard
{ "lang": "python", "repo": "YosefMac/html-slate-parser", "path": "/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YosefMac/html-slate-parser path: /__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, print_function from html.parser import HTMLParser __all__ = ['slate_parser_loads', 'slate_parser_load'] class MyHTMLParser(HTMLParser, object):...
code_fim
hard
{ "lang": "python", "repo": "YosefMac/html-slate-parser", "path": "/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='logic', name='concs', ), migrations.RemoveField( model_name='logic', name='hyps', ), ]<|fim_prefix|># repo: rschwiebert/RingApp path: /ringapp/migrations/0062_remove_...
code_fim
medium
{ "lang": "python", "repo": "rschwiebert/RingApp", "path": "/ringapp/migrations/0062_remove_hyps_concs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rschwiebert/RingApp path: /ringapp/migrations/0062_remove_hyps_concs.py # Generated by Django 3.2.14 on 2022-08-12 15:46 <|fim_suffix|> dependencies = [ ('ringapp', '0061_migrate_to_souffle'), ] operations = [ migrations.RemoveField( model_name='logic', ...
code_fim
medium
{ "lang": "python", "repo": "rschwiebert/RingApp", "path": "/ringapp/migrations/0062_remove_hyps_concs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('ringapp', '0061_migrate_to_souffle'), ] operations = [ migrations.RemoveField( model_name='logic', name='concs', ), migrations.RemoveField( model_name='logic', ...
code_fim
easy
{ "lang": "python", "repo": "rschwiebert/RingApp", "path": "/ringapp/migrations/0062_remove_hyps_concs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adobe/lagrange path: /modules/core/python/tests/test_combine_meshes.py # # Copyright 2022 Adobe. All rights reserved. # This file is licensed to you under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. You may obtain a copy # of...
code_fim
hard
{ "lang": "python", "repo": "adobe/lagrange", "path": "/modules/core/python/tests/test_combine_meshes.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mesh = cube opt = lagrange.NormalOptions() lagrange.compute_normal(mesh) out = lagrange.combine_meshes([mesh, mesh], True) assert out.has_attribute(opt.output_attribute_name) assert out.is_attribute_indexed(opt.output_attribute_name)<|fim_prefix|># repo: ad...
code_fim
hard
{ "lang": "python", "repo": "adobe/lagrange", "path": "/modules/core/python/tests/test_combine_meshes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out = lagrange.combine_meshes([mesh1, mesh2], True) assert np.all(out.vertices[:8] == mesh1.vertices) assert np.all(out.vertices[8:] == mesh2.vertices) assert np.all(out.facets[:6] == mesh1.facets) assert np.all(out.facets[6:] == mesh2.facets + mesh1.num_vertices) ...
code_fim
hard
{ "lang": "python", "repo": "adobe/lagrange", "path": "/modules/core/python/tests/test_combine_meshes.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: druedaplata/app_gnss path: /utils/planet.py from PIL import Image import os import tempfile import numpy as np import cv2 from skimage.transform import warp def get_planet_image(image_path): """ Gets a panorama image path and returns a stereographic projection aka plante projection ...
code_fim
hard
{ "lang": "python", "repo": "druedaplata/app_gnss", "path": "/utils/planet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }