text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: libinjungle/LeetCode_Python path: /String/17.py class solution(object): ''' Given a digit string, return all possible letter combinations that the number could represent. ''' def letterCombinations(self, digits): ''' each element in the returned list represents the input digits. ...
code_fim
medium
{ "lang": "python", "repo": "libinjungle/LeetCode_Python", "path": "/String/17.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': sol = solution() digits = '234' print sol.letterCombinations(digits)<|fim_prefix|># repo: libinjungle/LeetCode_Python path: /String/17.py class solution(object): ''' Given a digit string, return all possible letter combinations that the number could represent. ''' ...
code_fim
hard
{ "lang": "python", "repo": "libinjungle/LeetCode_Python", "path": "/String/17.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Subhash8969/bobby path: /classes.py '''class Computer: def _init_(self,cpu,ram): self.cpu=cpu self.ram=ram def config(self,cpu,ram): print("config is", cpu, ram) <|fim_suffix|> b = Bankaccount("subbu") print(b.name) b.deposit() b.withdra...
code_fim
hard
{ "lang": "python", "repo": "Subhash8969/bobby", "path": "/classes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> b = Bankaccount("subbu") print(b.name) b.deposit() b.withdraw() b.balance() print("Thankyou sir/madam,Have a nice day:") #******************************************************** #class vendingmachine:<|fim_prefix|># repo: Subhash8969/bobby path: /classes.py '''class Computer: def _init_(se...
code_fim
hard
{ "lang": "python", "repo": "Subhash8969/bobby", "path": "/classes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data.nNodes = ask_number("Number of nodes ?") data.nColors = ask_number("Number of colors ?") nEdges = ask_number("Number of edges ?") data.edges = [random_edge() for _ in range(nEdges)] Compilation.string_data = "-" + "-".join(str(v) for v in (data.nNodes, data.nColors, nEdges))<|fim_prefix|># repo: xc...
code_fim
medium
{ "lang": "python", "repo": "xcsp3team/pycsp3", "path": "/problems/data/parsers/Coloring_Random.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>data.nNodes = ask_number("Number of nodes ?") data.nColors = ask_number("Number of colors ?") nEdges = ask_number("Number of edges ?") data.edges = [random_edge() for _ in range(nEdges)] Compilation.string_data = "-" + "-".join(str(v) for v in (data.nNodes, data.nColors, nEdges))<|fim_prefix|># repo: xcs...
code_fim
medium
{ "lang": "python", "repo": "xcsp3team/pycsp3", "path": "/problems/data/parsers/Coloring_Random.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xcsp3team/pycsp3 path: /problems/data/parsers/Coloring_Random.py from pycsp3.problems.data.parsing import * from pycsp3.compiler import Compilation import random def random_edge(): x, y = random.randint(0, data.nNodes - 1), random.randint(0, data.nNodes - 1) return (x, y) if x != y else...
code_fim
medium
{ "lang": "python", "repo": "xcsp3team/pycsp3", "path": "/problems/data/parsers/Coloring_Random.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uploadedImage = models.FileField(upload_to=settings.MEDIA_ROOT)<|fim_prefix|># repo: GustavoMonardez/python-django-cd-file-upload path: /apps/fileupload_app/models.py from django.db import models from django.conf import settings <|fim_middle|>class ModelWithFileField(models.Model):
code_fim
easy
{ "lang": "python", "repo": "GustavoMonardez/python-django-cd-file-upload", "path": "/apps/fileupload_app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GustavoMonardez/python-django-cd-file-upload path: /apps/fileupload_app/models.py from django.db import models from django.conf import settings <|fim_suffix|> uploadedImage = models.FileField(upload_to=settings.MEDIA_ROOT)<|fim_middle|>class ModelWithFileField(models.Model):
code_fim
easy
{ "lang": "python", "repo": "GustavoMonardez/python-django-cd-file-upload", "path": "/apps/fileupload_app/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pharce/jax-suite path: /chex/intro-chex.py import chex import jax import jax.numpy as jnp from chex import assert_shape, assert_rank, assert_type, assert_equal_shape, assert_tree_all_close, assert_tree_all_finite, assert_numerical_grads, assert_devices_available, assert_tpu_available from absl.te...
code_fim
hard
{ "lang": "python", "repo": "Pharce/jax-suite", "path": "/chex/intro-chex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fn_sub(x, y): return x - y # can be used with jax.pmap fn_sub_pmapped = jax.pmap(chex.assert_max_retraces(fn_sub), n = 10) ### Test Variants with and without jax def fn(x, y): return x + y class ExampleTest(chex.TestCase): @chex.variants(with_jit=True, without_jit=True)...
code_fim
hard
{ "lang": "python", "repo": "Pharce/jax-suite", "path": "/chex/intro-chex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> z = fn_sum_jitted(jnp.zeros(3), jnp.zeros(3)) t = fn_sum_jitted(jnp.zeros(6,7), jnp.zeros(6, 7)) # assertion error def fn_sub(x, y): return x - y # can be used with jax.pmap fn_sub_pmapped = jax.pmap(chex.assert_max_retraces(fn_sub), n = 10) ### Test Variants with and withou...
code_fim
hard
{ "lang": "python", "repo": "Pharce/jax-suite", "path": "/chex/intro-chex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sitelist = [] dburl = "http://chien.neuro.utah.edu/tol2kitwiki/index.php/Att_site_sequences" http = urllib2.urlopen(dburl).read() src = re.findall(r'gt;.*?([\w\d]+).*?([A-Z]{3,}.*?)[&<]', http,flags=re.DOTALL) for n in range (0,len(src),1): if '_' in...
code_fim
hard
{ "lang": "python", "repo": "hashemd/Advanced-Virtual-Digest", "path": "/libs/db/builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hashemd/Advanced-Virtual-Digest path: /libs/db/builder.py from bs4 import BeautifulSoup import urllib2 import sys import re import os sys.path.insert(0,'libs') from google.appengine.ext import ndb, deferred class VectorDatabase(): def __init__(self, database): self.database = databa...
code_fim
hard
{ "lang": "python", "repo": "hashemd/Advanced-Virtual-Digest", "path": "/libs/db/builder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def db_check(self): test_enz = self.database.query(self.database.name=='EcoRV').get() if test_enz is None: deferred.defer(self.dl_enzymes, _target='builder') def dl_enzymes(self): enzlist = [] dburl = "http://www.addgene.org/mol_bio_reference/rest...
code_fim
hard
{ "lang": "python", "repo": "hashemd/Advanced-Virtual-Digest", "path": "/libs/db/builder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # add handlers to logger logger.addHandler(ch) return logger<|fim_prefix|># repo: JohnSnowLabs/spark-nlp-workshop path: /tutorials/academic/LLMs_in_Healthcare/benchmarks/workbench/modules/log_module.py import logging def setup_logger(logger_name, level=logging.INFO): # create logger obj...
code_fim
medium
{ "lang": "python", "repo": "JohnSnowLabs/spark-nlp-workshop", "path": "/tutorials/academic/LLMs_in_Healthcare/benchmarks/workbench/modules/log_module.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # create formatter formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to handlers ch.setFormatter(formatter) # add handlers to logger logger.addHandler(ch) return logger<|fim_prefix|># repo: JohnSnowLabs/spark-nlp-workshop ...
code_fim
medium
{ "lang": "python", "repo": "JohnSnowLabs/spark-nlp-workshop", "path": "/tutorials/academic/LLMs_in_Healthcare/benchmarks/workbench/modules/log_module.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JohnSnowLabs/spark-nlp-workshop path: /tutorials/academic/LLMs_in_Healthcare/benchmarks/workbench/modules/log_module.py import logging def setup_logger(logger_name, level=logging.INFO): <|fim_suffix|> # create formatter formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s...
code_fim
hard
{ "lang": "python", "repo": "JohnSnowLabs/spark-nlp-workshop", "path": "/tutorials/academic/LLMs_in_Healthcare/benchmarks/workbench/modules/log_module.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jkootsher/LunarMission path: /lib/gnc/control/frames.py import numpy from lib.tools.conversions import unit_vector class Frames(object): ''' Local Navigation Frames ''' def inertial_to_lvlh(self, state_vector=None): ''' A genertic inertial frame to the LVLH (Hill) frame ''' ...
code_fim
hard
{ "lang": "python", "repo": "jkootsher/LunarMission", "path": "/lib/gnc/control/frames.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def lvlh_to_inertial(self, state_vector=None): ''' LVLH (Hill) frame to a generic inertial frame ''' BYI2LVH = self.lvlh_to_inertial(state_vector) return BYI2LVH.T<|fim_prefix|># repo: jkootsher/LunarMission path: /lib/gnc/control/frames.py import numpy from lib.tools.convers...
code_fim
hard
{ "lang": "python", "repo": "jkootsher/LunarMission", "path": "/lib/gnc/control/frames.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> BYI2LVH = numpy.zeros((3,3)) BYI2LVH[2,:] = unit_vector(r_vector.T) BYI2LVH[1,:] = unit_vector(w_vector.T) BYI2LVH[0,:] = numpy.cross(BYI2LVH[2,:], BYI2LVH[0,:]) return BYI2LVH def lvlh_to_inertial(self, state_vector=None): ''' LVLH (Hill) frame to a ge...
code_fim
hard
{ "lang": "python", "repo": "jkootsher/LunarMission", "path": "/lib/gnc/control/frames.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def main(): start_sec = timeTransform(opt.starttime) end_sec = timeTransform(opt.endtime) if start_sec > end_sec: print('出错:开始时间大于结束时间') return file_name = os.path.basename(opt.path) name, ext = file_name.split('.') print("开始剪辑:{}-{},共{}秒".format(opt.starttime,opt.endtime,end_sec-start...
code_fim
hard
{ "lang": "python", "repo": "kevincao91/Tools", "path": "/clip_video.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevincao91/Tools path: /clip_video.py from moviepy.editor import * import argparse import datetime import os parser = argparse.ArgumentParser(description='Clip video') parser.add_argument('--starttime',type=str,default='00:00:00') parser.add_argument('--endtime',type=str,default='00...
code_fim
hard
{ "lang": "python", "repo": "kevincao91/Tools", "path": "/clip_video.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.exists(out_full) or force: print("Loading {}".format(out_full)) era = proc.GrbData(grb_file=f, site="gold_coast") print("Formatting {}".format(out_full)) era.format() print("Saving {}".format(out_full)) era.create_df() era.df.to_cs...
code_fim
medium
{ "lang": "python", "repo": "robjameswall/global_metocean_data", "path": "/proc_gc_gwes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: robjameswall/global_metocean_data path: /proc_gc_gwes.py import grb_processing as proc import reanalysis as re import os site = "gold_coast" fn = re.get_all_filenames(directory="data") <|fim_suffix|> if not os.path.exists(out_full) or force: print("Loading {}".format(out_full)) ...
code_fim
hard
{ "lang": "python", "repo": "robjameswall/global_metocean_data", "path": "/proc_gc_gwes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> form = SubscribeForm(request.POST) data = { 'success': False, } if form.is_valid(): email = form.cleaned_data['email'] deleted_count = SubscribedEmail.objects.filter(email=email).delete()[0] data['success'] = True data['deleted'] = bool(deleted_count...
code_fim
hard
{ "lang": "python", "repo": "wtl0442/bwg_real", "path": "/beautiful/main/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thoas/django-metadata path: /metadata/mixins.py from .models import MetadataContainer from . import settings from .connection import client <|fim_suffix|> metadata = MetadataContainer(connection=client, key=lambda instance: instance.metadata_key) @proper...
code_fim
hard
{ "lang": "python", "repo": "thoas/django-metadata", "path": "/metadata/mixins.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @property def metadata_key(self): key = getattr(self, 'METADATA_KEY', settings.METADATA_KEY) if key: return key % { 'identifier': self.__class__.__name__.lower(), 'id': self.pk } return None<|fim_prefix|># repo: thoa...
code_fim
hard
{ "lang": "python", "repo": "thoas/django-metadata", "path": "/metadata/mixins.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>luster_centers_[2,1]) km_clf.predict(X) lable_hash = { 1:1, 2:2, 0:3 } lable_map = np.array([3,1,2]) predict = km_clf.predict(X) predict _y = lable_map[predict] _y np.sum(y == _y)/y.size<|fim_prefix|># repo: 280942919/gitTest path: /KMeans_System.py #jupyter-notebook %matplotlib inline import matplotl...
code_fim
medium
{ "lang": "python", "repo": "280942919/gitTest", "path": "/KMeans_System.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 280942919/gitTest path: /KMeans_System.py #jupyter-notebook %matplotlib inline import matplotlib.pyplot as plt import pandas as pd import numpy as np data = pd.read_csv('./data.csv',usecols=['F1','F2','Target‘]) data[:10] data_arr<|fim_suffix|>luster_centers_[2,1]) km_clf.predict(X) lable_hash = ...
code_fim
hard
{ "lang": "python", "repo": "280942919/gitTest", "path": "/KMeans_System.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Only extract the most important features, which are PVT data and 7-Param data for machine learning algorithm. Computational data for machine learning: type: ndarray. format: rows(instances) x columns(features), 2-D array. Return...
code_fim
hard
{ "lang": "python", "repo": "EMUNES/hust-mdb", "path": "/backend/ml/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: EMUNES/hust-mdb path: /backend/ml/views.py from django.http import JsonResponse from django.http.response import Http404 from django.views import View from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers import serialize import numpy as np from sklearn.preproces...
code_fim
hard
{ "lang": "python", "repo": "EMUNES/hust-mdb", "path": "/backend/ml/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mat_arrays = [] for mat in mats: # django queryset -> python list mat_features = [] # Add data # Some data are missing here. #TODO: Delete those if sentences after cleaning the data. mat_features.append(mat.pvt_b5 if ...
code_fim
hard
{ "lang": "python", "repo": "EMUNES/hust-mdb", "path": "/backend/ml/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.asm.pass_one() self.asm.pass_two() print("=======LITERALS========") for i, val in self.asm.LITERAL.items(): print(" {:7}\t{:04X}".format(i, val)) def test_record(self): self.asm.pass_one() self.asm.pass_two() print("======Object...
code_fim
hard
{ "lang": "python", "repo": "hane1818/SIC-XE-Assembler", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hane1818/SIC-XE-Assembler path: /test.py from SICXE import Assembler import unittest class TestAssembler(unittest.TestCase): def setUp(self): self.asm = Assembler() self.asm.load_file("SICXE.txt") def test_read_source(self): self.assertIsNotNone(self.asm.source,...
code_fim
hard
{ "lang": "python", "repo": "hane1818/SIC-XE-Assembler", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.asm.pass_one() self.asm.pass_two() print("======Object Program=====") print(self.asm.object_program) if __name__ == "__main__": unittest.main()<|fim_prefix|># repo: hane1818/SIC-XE-Assembler path: /test.py from SICXE import Assembler import unittest class TestA...
code_fim
hard
{ "lang": "python", "repo": "hane1818/SIC-XE-Assembler", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ["id", "area", "name", "byte", "bit", "tipo_dato",] # def get_value(self, obj: Fila): # return obj.read_value(obj.area.datos.first().dato) # get_value.short_description = "Last value" @admin.register(DatoProcesado) class DatoProcesadoAdmin(admin.ModelAdmin): list_...
code_fim
medium
{ "lang": "python", "repo": "lautarodapin/webserver-snap7", "path": "/app/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lautarodapin/webserver-snap7 path: /app/admin.py from django.contrib import admin from .models import * @admin.register(Plc) class PlcAdmin(admin.ModelAdmin): pass @admin.register(Area) class AreaAdmin(admin.ModelAdmin): pass <|fim_suffix|>@admin.register(DatoProcesado) class DatoProce...
code_fim
hard
{ "lang": "python", "repo": "lautarodapin/webserver-snap7", "path": "/app/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isfile(simplified_path): extractor = IconExtractor(app_path) extractor.export_icon(download_path) icon = Image.open(download_path).resize((ICON_SIZE, ICON_SIZE), Image.Resampling.LANCZOS) icon.quantize(MAX_COLOURS).save(simplified_path) return simpli...
code_fim
medium
{ "lang": "python", "repo": "BenAAndrew/VolumeController", "path": "/volume_controller/fetch_icon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_icon(app_path: str, name: str) -> str: download_path = os.path.join(ICONS_FOLDER, name + ".png") simplified_path = os.path.join(ICONS_FOLDER, name + "-simple.png") if not os.path.isfile(simplified_path): extractor = IconExtractor(app_path) extractor.export_icon(downloa...
code_fim
medium
{ "lang": "python", "repo": "BenAAndrew/VolumeController", "path": "/volume_controller/fetch_icon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BenAAndrew/VolumeController path: /volume_controller/fetch_icon.py import os from PIL import Image from icoextract import IconExtractor ICONS_FOLDER = "icons" os.makedirs(ICONS_FOLDER, exist_ok=True) ICON_SIZE = 60 MAX_COLOURS = 30 <|fim_suffix|> if not os.path.isfile(simplified_path): ...
code_fim
medium
{ "lang": "python", "repo": "BenAAndrew/VolumeController", "path": "/volume_controller/fetch_icon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>gits + string.punctuation password = [] for x in range(password_length): password.append(random.choice(password_characters)) print(''.join(password))<|fim_prefix|># repo: KJ-18/PythonProjects path: /Random_PG.py import random, string password_length = int(input("How long would does your p<|fim_m...
code_fim
medium
{ "lang": "python", "repo": "KJ-18/PythonProjects", "path": "/Random_PG.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KJ-18/PythonProjects path: /Random_PG.py import random, string password_length = int(input("How long would does your password need to be?")) password_characters =string.ascii_uppercase + string.di<|fim_suffix|> password.append(random.choice(password_characters)) print(''.join(password))<|fim_...
code_fim
medium
{ "lang": "python", "repo": "KJ-18/PythonProjects", "path": "/Random_PG.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> password.append(random.choice(password_characters)) print(''.join(password))<|fim_prefix|># repo: KJ-18/PythonProjects path: /Random_PG.py import random, string password_length = int(input("How long would does your p<|fim_middle|>assword need to be?")) password_characters =string.ascii_uppercase + s...
code_fim
medium
{ "lang": "python", "repo": "KJ-18/PythonProjects", "path": "/Random_PG.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sfu-cl-lab/our-papers path: /frequency-paper/table1.py """ Compute joint probabilities and pseudo-likelihood estimate for a Bayes Net according to random selection semantics from a database. Written in haste---bugs likely remain! It's also been eight months since I wrote real py...
code_fim
hard
{ "lang": "python", "repo": "sfu-cl-lab/our-papers", "path": "/frequency-paper/table1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def functorOtherValue(functor, val): """ For functors with a binary range, return the other element """ range = functorRange(functor) assert len(range) == 2 if val == range[0]: return range[1] else: return range[0] def atomList(joints): """ Return the atoms, derive...
code_fim
hard
{ "lang": "python", "repo": "sfu-cl-lab/our-papers", "path": "/frequency-paper/table1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self._fail_total def compute_stats(self): self._good_diff = list() self._good_duration = list() self._failed_diff = list() self._failed_duration = list() self._good_total = 0 self._fail_total = 0 for es in...
code_fim
hard
{ "lang": "python", "repo": "JBlaschke/cctbx_profiling", "path": "/debug/directory.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JBlaschke/cctbx_profiling path: /debug/directory.py #!/usr/bin/env python # -*- coding: utf-8 -*- #TODO: change name => "stream" is not appropriate class DirectoryStream(object): def __init__ (self, root): self._root = root self._event_streams = list() # g...
code_fim
hard
{ "lang": "python", "repo": "JBlaschke/cctbx_profiling", "path": "/debug/directory.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sevenler/hey path: /www/views/group/mine.py #!/usr/bin/env python # encoding=utf8 from views.base import BaseView from core.logic import Group <|fim_suffix|> my_group_list = Group.filter(created_user_id=me.id) group_map_list = [] for group in my_group_list: gr...
code_fim
medium
{ "lang": "python", "repo": "sevenler/hey", "path": "/www/views/group/mine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> me = self.get_current_user() my_group_list = Group.filter(created_user_id=me.id) group_map_list = [] for group in my_group_list: group_map_list.append(group.info()) self.render("group/mine.html", groups=group_map_list)<|fim_prefix|># repo: sevenler/hey ...
code_fim
easy
{ "lang": "python", "repo": "sevenler/hey", "path": "/www/views/group/mine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if sname is not None: nx.write_edgelist(g, sname) if __name__ == '__main__': """ sname = sys.argv[1] d = int(sys.argv[2]) n = int(sys.argv[3]) randomRegularGraph(n, d, sname) """ sname = sys.argv[1] n1 = int(sys.argv[2]) n2 = int(sys.argv[3]) n3 = int(...
code_fim
hard
{ "lang": "python", "repo": "jakir-sust/CoreProject", "path": "/src/data/generate_graph.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakir-sust/CoreProject path: /src/data/generate_graph.py import networkx as nx import sys import random from pprint import pprint def randomRegularGraph(n, d, sname=None): g = nx.random_regular_graph(d,n) if sname is not None: nx.write_edgelist(g, sname) def corePeriphery(n1, n2...
code_fim
hard
{ "lang": "python", "repo": "jakir-sust/CoreProject", "path": "/src/data/generate_graph.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KIT-CMS/shape-producer path: /shape_producer/channel.py ss EE(Channel): def __init__(self): self._name = "ee" self._cuts = Cuts( Cut("extraelec_veto<0.5", "extraelec_veto"), Cut("extramuon_veto<0.5", "extramuon_veto"), Cut("iso_1<0.1 && iso_...
code_fim
hard
{ "lang": "python", "repo": "KIT-CMS/shape-producer", "path": "/shape_producer/channel.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, **kvargs): super(EMSM2017, self).__init__(**kvargs) self._cuts.add( Cut("nbtag==0 && mTdileptonMET_puppi<60", "bveto_mTdileptonMET"), ) class MMSM2017(MM2017): def __init__(self, **kvargs): super(MMSM2017, self).__init__(**kvargs) ...
code_fim
hard
{ "lang": "python", "repo": "KIT-CMS/shape-producer", "path": "/shape_producer/channel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(TTSM2016, self).__init__(**kvargs) class EMSM2016(EM2016): def __init__(self, **kvargs): super(EMSM2016, self).__init__(**kvargs) self._cuts.add( Cut("nbtag==0 && mTdileptonMET_puppi<60", "bveto_mTdileptonMET"), ) class MMSM2016(MM2016): def __...
code_fim
hard
{ "lang": "python", "repo": "KIT-CMS/shape-producer", "path": "/shape_producer/channel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def get_score(cuisine_file, menu): return float(count_same_words(cuisine_file, menu))/len(menu) def to_JSON(meal, list_of_cuisines, list_of_menus): """ Writes a dictionary of cuisines, scores per dining hall menu to a JSON file meal: string describing name of meal - "breakfast", "lunch...
code_fim
hard
{ "lang": "python", "repo": "rracheva/Dine-squad", "path": "/menu_analysis.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rracheva/Dine-squad path: /menu_analysis.py """ MENU ANALYSIS PROGRAM get_score(cuisine_file, menu): returns the score for a given cuisine and menu to_JSON(meal, list_of_cuisines, list_of_menus): writes all of the cuisine and menu score dictionaries to a JSON file, entitled meal+"data.json" ...
code_fim
hard
{ "lang": "python", "repo": "rracheva/Dine-squad", "path": "/menu_analysis.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> all_words = [] new_word_list = [] for line in file: for char in line: if char.isalpha(): new_word_list.append(str(char).lower()) elif not char.isalpha() and len(new_word_list) > 0: ...
code_fim
hard
{ "lang": "python", "repo": "rracheva/Dine-squad", "path": "/menu_analysis.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HaydenInEdinburgh/LintCode path: /828_word_pattern.py class Solution: """ @param pattern: a string, denote pattern string @param teststr: a string, denote matching string @return: an boolean, denote whether the pattern string and the matching string match or not """ def wo...
code_fim
hard
{ "lang": "python", "repo": "HaydenInEdinburgh/LintCode", "path": "/828_word_pattern.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': s = Solution() word = "a dog dog a" pattern = "abba" print(s.wordPattern(pattern, word))<|fim_prefix|># repo: HaydenInEdinburgh/LintCode path: /828_word_pattern.py class Solution: """ @param pattern: a string, denote pattern string @param teststr: a ...
code_fim
hard
{ "lang": "python", "repo": "HaydenInEdinburgh/LintCode", "path": "/828_word_pattern.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jonathanjaimes/python path: /6.1_contarVector.py """ while True: num1 = int(input("Ingrese un número: ")) if num1 >= 10 and num1 <= 20: break while True: num2 = int(input("Ingrese un número: ")) if num2 >= 10 and num2 <= 20: break while True: num3 = int(input("Ingres...
code_fim
hard
{ "lang": "python", "repo": "jonathanjaimes/python", "path": "/6.1_contarVector.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>""" lista = [] while True: num1 = int(input("Ingrese un número: ")) if num1 >= 10 and num1 <= 20: break lista.append(num1) while True: num2 = int(input("Ingrese un número: ")) if num2 >= 10 and num2 <= 20: break lista.append(num2) while True: num3 = int(input("Ingrese un ...
code_fim
medium
{ "lang": "python", "repo": "jonathanjaimes/python", "path": "/6.1_contarVector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> name = models.CharField(verbose_name=_('Name'), max_length=190) def __str__(self): return self.name class Book(models.Model): title = I18nCharField(verbose_name='Book title', max_length=190) abstract = I18nTextField(verbose_name='Abstract') author = models.ForeignKey('Author...
code_fim
medium
{ "lang": "python", "repo": "raphaelm/django-i18nfield", "path": "/tests/testapp/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: raphaelm/django-i18nfield path: /tests/testapp/models.py from django.db import models from django.utils.translation import gettext_lazy as _ from i18nfield.fields import I18nCharField, I18nTextField <|fim_suffix|> return self.name class Book(models.Model): title = I18nCharField(ve...
code_fim
medium
{ "lang": "python", "repo": "raphaelm/django-i18nfield", "path": "/tests/testapp/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.name class Book(models.Model): title = I18nCharField(verbose_name='Book title', max_length=190) abstract = I18nTextField(verbose_name='Abstract') author = models.ForeignKey('Author', verbose_name='Author', on_delete=models.CASCADE) def __str__(self): return s...
code_fim
medium
{ "lang": "python", "repo": "raphaelm/django-i18nfield", "path": "/tests/testapp/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dfischer/ActorForth path: /src/tests/test_repl.py import unittest from repl import * class TestRepl(unittest.TestCase): <|fim_suffix|> code = afc("1 int 2 int +") assert do_repl("test", code) == 3<|fim_middle|> def test_simple_code(self) -> None:
code_fim
easy
{ "lang": "python", "repo": "dfischer/ActorForth", "path": "/src/tests/test_repl.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: HaThiMyChi/Django path: /djangoRestFramework/demoapi/course/serializers.py from rest_framework import serializers from .models import Course class GetAllCourseSerializer(serializers.ModelSerializer): <|fim_suffix|> title = serializers.CharField(max_length=12) content = serializers.CharField(max...
code_fim
medium
{ "lang": "python", "repo": "HaThiMyChi/Django", "path": "/djangoRestFramework/demoapi/course/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> title = serializers.CharField(max_length=12) content = serializers.CharField(max_length=12) price = serializers.IntegerField()<|fim_prefix|># repo: HaThiMyChi/Django path: /djangoRestFramework/demoapi/course/serializers.py from rest_framework import serializers from .models import Course class GetAll...
code_fim
medium
{ "lang": "python", "repo": "HaThiMyChi/Django", "path": "/djangoRestFramework/demoapi/course/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abijithmg/kraya path: /api/admin.py from django.contrib import admin from api.models import Item, Preference, \ Supplier, SupplierRating # @admin.register(Movie) # class MovieAdmin(admin.ModelAdmin): # fields = ('title', 'description') # list_display = ['title', 'description'] # ...
code_fim
hard
{ "lang": "python", "repo": "abijithmg/kraya", "path": "/api/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @admin.register(Preference) class PreferenceAdmin(admin.ModelAdmin): fields = ('item', 'delivery_address', 'note_to_buyer', 'emergency_contact') list_display = ['item', 'delivery_address', 'note_to_buyer', 'emergency_contact'] # search_fields = ('') @admin.register(Supplier) class SupplierA...
code_fim
hard
{ "lang": "python", "repo": "abijithmg/kraya", "path": "/api/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (alphabet not in vowels): return True else: return False # Filter Vowels filtered_vowels = filter(filter_vowels, alphabets) print(filtered_vowels) print(list(filtered_vowels)) # Filter Consonants filtered_consonants = filter(filter_consonants, alphabets) print(filtered_consona...
code_fim
medium
{ "lang": "python", "repo": "vikash-india/DeveloperNotes2Myself", "path": "/languages/python/src/concepts/P064_FilterFunction_Alphabets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vikash-india/DeveloperNotes2Myself path: /languages/python/src/concepts/P064_FilterFunction_Alphabets.py # Description: Filter Vowels and Consonants Using Vowels # Note # 1. If a function is already define, use it over a list using a map function. # List of alphabets alphabets = ['a', 'b', 'c',...
code_fim
medium
{ "lang": "python", "repo": "vikash-india/DeveloperNotes2Myself", "path": "/languages/python/src/concepts/P064_FilterFunction_Alphabets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0ne4rif/plotly-scatter-plots path: /demo.py import plotly import plotly.graph_objects as go import pandas as pd <|fim_suffix|>fig = go.Figure() fig.add_trace(go.Scatter(x=df['date'], y=df['confirmed'], mode='line+markers', name='Positive')) fig.add_trace(go.Scatter(x=df['date'], y=df['rele...
code_fim
medium
{ "lang": "python", "repo": "0ne4rif/plotly-scatter-plots", "path": "/demo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fig = go.Figure() fig.add_trace(go.Scatter(x=df['date'], y=df['confirmed'], mode='line+markers', name='Positive')) fig.add_trace(go.Scatter(x=df['date'], y=df['released'], mode='markers', name='Released')) fig.add_trace(go.Scatter(x=df['date'], y=df['deceased'], mode='line', name='Deceased')) fig.upda...
code_fim
medium
{ "lang": "python", "repo": "0ne4rif/plotly-scatter-plots", "path": "/demo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: NguyenHaiPhong/NguyenHaiHa---Fundamentals---C4E19 path: /WebModules/Web03/serious_exercises_8_9.py from flask import * river_app = Flask(__name__) import mlab from river import river <|fim_suffix|> all_rivers = river.objects(continent = "Africa") return render_template("ex-8.html", all_ri...
code_fim
medium
{ "lang": "python", "repo": "NguyenHaiPhong/NguyenHaiHa---Fundamentals---C4E19", "path": "/WebModules/Web03/serious_exercises_8_9.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@river_app.route("/ex-9") def all_rivers_in_south_america_continent_length_lt_1000(): all_rivers = river.objects(continent = "S. America", length__lt = 1000) return render_template("ex-9.html", all_rivers = all_rivers) if __name__ == '__main__': river_app.run(debug=True)<|fim_prefix|># repo: Ng...
code_fim
medium
{ "lang": "python", "repo": "NguyenHaiPhong/NguyenHaiHa---Fundamentals---C4E19", "path": "/WebModules/Web03/serious_exercises_8_9.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LoganHentschel/csp_python path: /CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py # a115_buggy_image.py import turtle as trtl ############## trtl_spider = trtl.Turtle() # trtl_spider.pensize(40) trtl_spider.circle(20) # # # <|fim_suffix|>trtl_spider.hideturtle() ...
code_fim
hard
{ "lang": "python", "repo": "LoganHentschel/csp_python", "path": "/CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>trtl_spider.hideturtle() # # # # wn = trtl.Screen() wn.mainloop()<|fim_prefix|># repo: LoganHentschel/csp_python path: /CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py # a115_buggy_image.py import turtle as trtl ############## trtl_spider = trtl.Turtle() # trtl_spider....
code_fim
hard
{ "lang": "python", "repo": "LoganHentschel/csp_python", "path": "/CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># # # trtl_spider.hideturtle() # # # # wn = trtl.Screen() wn.mainloop()<|fim_prefix|># repo: LoganHentschel/csp_python path: /CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py # a115_buggy_image.py import turtle as trtl ############## trtl_spider = trtl.Turtle() # trtl_...
code_fim
hard
{ "lang": "python", "repo": "LoganHentschel/csp_python", "path": "/CSP_Sem1/TURTLE/1.1 Unit/Bug Fix Assignment/FIXED_VARIABLES_a115_buggy_image.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for _ in string: str_1 = re.sub('[^A-Za-z0-9]', '', string.lower()) # str_1 = string.lower() # str_1 = string.strip(" !@#$%^&*()-_+={}[]|\:;'<>?,./\"") return str_1 def main(): '''main function''' string = input() print(clean_string(string)) if __name__ == '__main__':...
code_fim
medium
{ "lang": "python", "repo": "swapnika-20186045/CSPP1", "path": "/CSPP1-Practice/M22 (final exam)/assignment2/clean_input.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: swapnika-20186045/CSPP1 path: /CSPP1-Practice/M22 (final exam)/assignment2/clean_input.py ''' Write a function to clean up a given string by removing the special characters and retain alphabets in both upper and lower case and numbers. <|fim_suffix|>def main(): '''main function''' string...
code_fim
hard
{ "lang": "python", "repo": "swapnika-20186045/CSPP1", "path": "/CSPP1-Practice/M22 (final exam)/assignment2/clean_input.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(): '''main function''' string = input() print(clean_string(string)) if __name__ == '__main__': main()<|fim_prefix|># repo: swapnika-20186045/CSPP1 path: /CSPP1-Practice/M22 (final exam)/assignment2/clean_input.py ''' Write a function to clean up a given string by removing the sp...
code_fim
hard
{ "lang": "python", "repo": "swapnika-20186045/CSPP1", "path": "/CSPP1-Practice/M22 (final exam)/assignment2/clean_input.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kirjur/fotoforte path: /services/models.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class ServiceType(models.Model): class Meta(): db_tabl...
code_fim
medium
{ "lang": "python", "repo": "kirjur/fotoforte", "path": "/services/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta(): db_table = 'service' verbose_name = "Услуга" name = models.CharField(max_length=200, verbose_name="Наименование") description = models.TextField(verbose_name="Описание") created_date = models.DateTimeField(verbose_name="Дата создания") service_type = mod...
code_fim
hard
{ "lang": "python", "repo": "kirjur/fotoforte", "path": "/services/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: margueriteblair/Python-Algorithms path: /LoopsReview.py N = int(input()) for j in range(N): S = input() <|fim_suffix|>se: odd += S[i] print(even + " " + odd)<|fim_middle|> even = "" odd = "" for i in range(len(S)): if (i%2 == 0): even += S[i] ...
code_fim
medium
{ "lang": "python", "repo": "margueriteblair/Python-Algorithms", "path": "/LoopsReview.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>se: odd += S[i] print(even + " " + odd)<|fim_prefix|># repo: margueriteblair/Python-Algorithms path: /LoopsReview.py N = int(input()) for j in range(N): S = input() <|fim_middle|> even = "" odd = "" for i in range(len(S)): if (i%2 == 0): even += S[i] ...
code_fim
medium
{ "lang": "python", "repo": "margueriteblair/Python-Algorithms", "path": "/LoopsReview.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Visulaizing the regression results X_grid = np.arange(min(X), max(X), 0.1) X_grid = X_grid.reshape(len(X_grid), 1) plt.scatter(X, y, color='red') plt.plot(X_grid, regressor.predict(X_grid), color='blue') plt.title('Random Forest Regression') plt.xlabel('Position Label') plt.ylabel('Salary') plt.show()<|f...
code_fim
medium
{ "lang": "python", "repo": "Joseorina/machine_learning_regression", "path": "/RFR/random_forest_regression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Predicting a new result y_pred = regressor.predict([[6.5]]) #Visulaizing the regression results X_grid = np.arange(min(X), max(X), 0.1) X_grid = X_grid.reshape(len(X_grid), 1) plt.scatter(X, y, color='red') plt.plot(X_grid, regressor.predict(X_grid), color='blue') plt.title('Random Forest Regression') p...
code_fim
hard
{ "lang": "python", "repo": "Joseorina/machine_learning_regression", "path": "/RFR/random_forest_regression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Joseorina/machine_learning_regression path: /RFR/random_forest_regression.py #Random Forest Regression #Importing libraries import pandas as pd import matplotlib.pyplot as plt import numpy as np #Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].value...
code_fim
medium
{ "lang": "python", "repo": "Joseorina/machine_learning_regression", "path": "/RFR/random_forest_regression.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shivani2006/Number-Guessing-Game path: /c97Project.py import random print('The Number Guessing Game') <|fim_suffix|>print ('guess a number between 1 to 10') chances=0 while(chances<3): guess=int(input('enter your guess ')) if(guess==no): print('Congratulations! You won'...
code_fim
easy
{ "lang": "python", "repo": "Shivani2006/Number-Guessing-Game", "path": "/c97Project.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print ('guess a number between 1 to 10') chances=0 while(chances<3): guess=int(input('enter your guess ')) if(guess==no): print('Congratulations! You won') break elif(guess<no): print('Please guess a higher number! ', guess) else: print('Please g...
code_fim
easy
{ "lang": "python", "repo": "Shivani2006/Number-Guessing-Game", "path": "/c97Project.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>chances=0 while(chances<3): guess=int(input('enter your guess ')) if(guess==no): print('Congratulations! You won') break elif(guess<no): print('Please guess a higher number! ', guess) else: print('Please guess a lower number! ',guess) chances=c...
code_fim
easy
{ "lang": "python", "repo": "Shivani2006/Number-Guessing-Game", "path": "/c97Project.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>name = f'{employee.last_name} {employee.first_name} {employee.patronymic}' manager_post = employee.post manager = f'{manager_name}<div style="color:red; font-style:italic">{manager_post}</div><br>' base_string = (base_string + manager) if employ...
code_fim
hard
{ "lang": "python", "repo": "MrGreeny12/employee_tree", "path": "/company/services.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrGreeny12/employee_tree path: /company/services.py from company.models import Company, DepartmentRelations from employee.models import Employee def get_correct_format_department_list(): ''' Возвращает список формата: list = [ ['Название отдела, руководитель, сотрудники', 'К...
code_fim
hard
{ "lang": "python", "repo": "MrGreeny12/employee_tree", "path": "/company/services.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.batch_norm: conv_out = (conv_out - conv_out.mean(axis = (0,2,3), keepdims = True)) / (1.0 + conv_out.std(axis = (0,2,3), keepdims = True)) conv_out = conv_out + self.b.dimshuffle('x', 0, 'x', 'x') if self.activation == "relu": out = T.maximum(0.0, ...
code_fim
hard
{ "lang": "python", "repo": "alexmlamb/JSA", "path": "/lib/DeConvLayer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexmlamb/JSA path: /lib/DeConvLayer.py import theano import theano.tensor as T from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable, host_from_gpu, gpu_contiguous, HostFromGpu, ...
code_fim
hard
{ "lang": "python", "repo": "alexmlamb/JSA", "path": "/lib/DeConvLayer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # find which character the RHS belongs to cha_index = [] for j in range(RHS_len + 1): cha_index.append(min(np.where(points_cumsum > start + j)[0])) for j in range(RHS_len): x1_base = (cha_index[j] - 10 * int(cha_index[j] / 10)) * 550 y1_base = (9 - int(cha_index[j...
code_fim
hard
{ "lang": "python", "repo": "HELL-TO-HEAVEN/WriteId", "path": "/Code/data_process/visualize_attn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x2 = sample_points[j + 1][0] + x2_base y2 = 500 - sample_points[j + 1][1] + y2_base if attn[j] >= thres: if delta_S[start + j][2] == 1: line = 'r-' else: line = 'r--' else: if delta_S[start + j][2] == 1: ...
code_fim
hard
{ "lang": "python", "repo": "HELL-TO-HEAVEN/WriteId", "path": "/Code/data_process/visualize_attn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HELL-TO-HEAVEN/WriteId path: /Code/data_process/visualize_attn.py import matplotlib.pyplot as plt import numpy as np import glob import os import re def flag(i, x, p): t = data[i][x][p][:] t.append(0) if p == 0 else t.append(1) return t def trans(d1, d2): return [d2[0] - d1[0]...
code_fim
hard
{ "lang": "python", "repo": "HELL-TO-HEAVEN/WriteId", "path": "/Code/data_process/visualize_attn.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: levuhachi/levuhachi-web-c4e23 path: /Web1/homework/EX1-bmi-calculator-master/upgraded_ex1_bmi.py from flask import Flask, render_template, request app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def index(): bmi = '' if request.method == 'POST' and 'weight' in request.for...
code_fim
hard
{ "lang": "python", "repo": "levuhachi/levuhachi-web-c4e23", "path": "/Web1/homework/EX1-bmi-calculator-master/upgraded_ex1_bmi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }