text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> migrations.AlterField( model_name='salary', name='id', field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), migrations.AlterField( model_name='staff', name='id', ...
code_fim
hard
{ "lang": "python", "repo": "TestuUser123/smart-english", "path": "/settings/migrations/0004_auto_20211110_0936.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gongyuchenshidage/color_preview path: /resource_rc.py d\x11\xb9\x4d\xf4\x12\xde\x4f\x88\xe0\xc4\x83\ \x03\xa2\x00\x00\x00\x01\x62\x4b\x47\x44\x2b\x24\xb9\xe4\x08\x00\ \x00\x00\x07\x74\x49\x4d\x45\x07\xe4\x09\x04\x02\x0c\x2c\x5e\x9a\ \xf1\x93\x00\x00\x00\x89\x49\x44\x41\x54\x18\xd3\x55\xcf\xd9\x12...
code_fim
hard
{ "lang": "python", "repo": "gongyuchenshidage/color_preview", "path": "/resource_rc.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>d\ \xc3\xbd\xb0\x4a\xd3\xf4\x1f\xcb\x5e\x55\xf1\x50\x42\x63\x0c\x41\ \x10\x8c\x32\x17\xc5\x5a\x87\x73\x0e\x1b\x4d\x52\x39\x75\x06\x7d\ \x78\x9b\xf6\xd6\x06\x3b\xff\xb8\x89\x35\x16\x51\x21\x2a\x4d\x50\ \x89\x27\xa8\x86\xc2\x7a\xf5\x34\x13\xfd\x9c\x1b\x31\x34\xb2\xce\ \xa3\xcc\x0f\xfb\x10\x5a\x6b\xb1\xc6\x6...
code_fim
hard
{ "lang": "python", "repo": "gongyuchenshidage/color_preview", "path": "/resource_rc.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gongyuchenshidage/color_preview path: /resource_rc.py \x37\x39\x32\x37\x39\ \x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\ \x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\ \x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\x32\x37\x39\ \x32\x37\x39\x32\x37\x3...
code_fim
hard
{ "lang": "python", "repo": "gongyuchenshidage/color_preview", "path": "/resource_rc.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_column_strength(self): #随意修改测试 b = 1200 h = 1200 l0 = 5 a = 90 a_ = 90 Ec = 3.45E4 #MPa As = 12316 As_ = 12316 n = 10 M = 2800 #kN N = 14000 r = column_strength.solve_stress(b,h,l0,a,a_,Ec,As,As_,n...
code_fim
hard
{ "lang": "python", "repo": "warmwaver/calla", "path": "/test/verification/TB.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: warmwaver/calla path: /test/verification/TB.py import unittest import calla.test TestCase = calla.test.TestCase from math import pi from calla.TB.RC_strength import * class test(TestCase): def test1(self): """ 标准验证:铁路混凝土结构设计原理(容许应力计算法).ppt 例1 """ b = 200 ...
code_fim
hard
{ "lang": "python", "repo": "warmwaver/calla", "path": "/test/verification/TB.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> b = 1200 h = 1200 l0 = 5 a = 90 a_ = 90 Ec = 3.45E4 #MPa As = 12316 As_ = 12316 n = 10 M = 2800 #kN N = 14000 r = column_strength.solve_stress(b,h,l0,a,a_,Ec,As,As_,n,M,N,0) print('σc,σs,σs\'\n',r) if ...
code_fim
hard
{ "lang": "python", "repo": "warmwaver/calla", "path": "/test/verification/TB.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # true if rec2 is below rec1 c = rec2[3] <= rec1[1] # true if rec2 is above rec1 d = rec1[3] <= rec2[1] return not (a or b or c or d)<|fim_prefix|># repo: jschnab/leetcode path: /overlapping_rectangles.py # leetcode 836 # determine if two rectangles overlap # input is two lists [x1,...
code_fim
hard
{ "lang": "python", "repo": "jschnab/leetcode", "path": "/overlapping_rectangles.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jschnab/leetcode path: /overlapping_rectangles.py # leetcode 836 # determine if two rectangles overlap # input is two lists [x1,y1,x2,y2] coordinates # where x1,y1 are coordinates of bottom left corner # and x2,y2 are coordinates of top right corner <|fim_suffix|> """Determine if rectangles o...
code_fim
medium
{ "lang": "python", "repo": "jschnab/leetcode", "path": "/overlapping_rectangles.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> network, data, labels, verbose=True ): '''A Function that tests a neural network''' return network.evaluate( x=data, y=labels, verbose=verbose )<|fim_prefix|># repo: YosriGFX/holbertonschool-machine_learning path: /supervised_learning/0x06-keras/12-test.py #!/u...
code_fim
easy
{ "lang": "python", "repo": "YosriGFX/holbertonschool-machine_learning", "path": "/supervised_learning/0x06-keras/12-test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YosriGFX/holbertonschool-machine_learning path: /supervised_learning/0x06-keras/12-test.py #!/usr/bin/env python3 '''Testing File''' import tensorflow.keras as K <|fim_suffix|> network, data, labels, verbose=True ): '''A Function that tests a neural network''' return network.evalu...
code_fim
easy
{ "lang": "python", "repo": "YosriGFX/holbertonschool-machine_learning", "path": "/supervised_learning/0x06-keras/12-test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rsocnam/sta211 path: /train.py from os import path from sklearn.model_selection import StratifiedShuffleSplit from sklearn.pipeline import Pipeline from sta211.datasets import load_train_dataset, load_test_dataset, find_best_train_dataset from sklearn.model_selection import GridSearchCV from sta2...
code_fim
hard
{ "lang": "python", "repo": "rsocnam/sta211", "path": "/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># pipes, search_grid = get_svm() # pipe = Pipeline(pipes) cv = StratifiedShuffleSplit(test_size=test_size, random_state=0, n_splits=5) grid = GridSearchCV(pipe, search_grid, cv=cv, n_jobs=n_jobs, return_train_score=True, refit=True, scoring="accuracy") grid.fit(X, y) parameters = get_best_hyper_paramete...
code_fim
medium
{ "lang": "python", "repo": "rsocnam/sta211", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sankar77/OOAD_Project2 path: /Project2/Project2/OOAD_Project2_p1c/ZooAnnouncer.py import ZooAnnouncerInterface class ZooAnnouncer(ZooAnnouncerInterface): <|fim_suffix|> print("ZooAnnouncer :" + annoucement)<|fim_middle|> def updateZoo(self,annoucement):
code_fim
easy
{ "lang": "python", "repo": "sankar77/OOAD_Project2", "path": "/Project2/Project2/OOAD_Project2_p1c/ZooAnnouncer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print("ZooAnnouncer :" + annoucement)<|fim_prefix|># repo: sankar77/OOAD_Project2 path: /Project2/Project2/OOAD_Project2_p1c/ZooAnnouncer.py import ZooAnnouncerInterface <|fim_middle|>class ZooAnnouncer(ZooAnnouncerInterface): def updateZoo(self,annoucement):
code_fim
medium
{ "lang": "python", "repo": "sankar77/OOAD_Project2", "path": "/Project2/Project2/OOAD_Project2_p1c/ZooAnnouncer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: momentum-cohort-2019-09/BugBytes path: /config/urls.py """config URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views ...
code_fim
medium
{ "lang": "python", "repo": "momentum-cohort-2019-09/BugBytes", "path": "/config/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eng-Ahmad-Almohammad/math-series path: /tests/test_series.py import math_series.series as func """ Testing for fibonacci function """ def test_fibonacci_zero(): actual = func.fibonacci(0) expected = 0 assert actual == expected def test_fibonacci_one(): actual = func.fibonacci...
code_fim
medium
{ "lang": "python", "repo": "Eng-Ahmad-Almohammad/math-series", "path": "/tests/test_series.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_non_fibonacci_lucas_negative(): actual = func.non_fibonacci_lucas(-5,2,4) expected = "Negative values are not allowable" assert actual == expected def test_non_fibonacci_lucas_else(): actual = func.non_fibonacci_lucas(3,2,4) expected = 10 assert actual == expected<...
code_fim
hard
{ "lang": "python", "repo": "Eng-Ahmad-Almohammad/math-series", "path": "/tests/test_series.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.shuffle: random.shuffle(self.image_names) def __len__(self): return self.n_samples def __getitem__(self, index): assert index <= len(self), 'index range error' img_name = self.image_names[index] # Read image and normalize its pixels to ...
code_fim
hard
{ "lang": "python", "repo": "PanPapag/Context-Aware-Crowd-Counting", "path": "/dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PanPapag/Context-Aware-Crowd-Counting path: /dataset.py import cv2 import random import os import numpy as np import matplotlib.pyplot as plt import torch from torch.utils.data import Dataset from torchvision import transforms class ShanghaiTechPartA(Dataset): def __init__(self, root, shu...
code_fim
hard
{ "lang": "python", "repo": "PanPapag/Context-Aware-Crowd-Counting", "path": "/dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@implementer(IForm) class Form(Container): """A Form."""<|fim_prefix|># repo: BriefyHQ/briefy.plone path: /src/briefy/plone/content/form.py # -*- coding: utf-8 -*- """Form content type.""" from briefy.plone.content.interfaces import IBriefyContent from plone.dexterity.content import Container from zo...
code_fim
medium
{ "lang": "python", "repo": "BriefyHQ/briefy.plone", "path": "/src/briefy/plone/content/form.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BriefyHQ/briefy.plone path: /src/briefy/plone/content/form.py # -*- coding: utf-8 -*- """Form content type.""" from briefy.plone.content.interfaces import IBriefyContent from plone.dexterity.content import Container from zope.interface import implementer class IForm(IBriefyContent): <|fim_suffi...
code_fim
easy
{ "lang": "python", "repo": "BriefyHQ/briefy.plone", "path": "/src/briefy/plone/content/form.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> color = random.randrange(0,9) mc.setBlock(x,y,z-1,38,color) time.sleep(0.01)<|fim_prefix|># repo: wuyoujau/-PYPHOONMINECRAFT20210127 path: /practice 1.py from mcpi.minecraft import Minecraft <|fim_middle|> import random,time while True: x,y,z = mc.player.getTilePos()
code_fim
medium
{ "lang": "python", "repo": "wuyoujau/-PYPHOONMINECRAFT20210127", "path": "/practice 1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuyoujau/-PYPHOONMINECRAFT20210127 path: /practice 1.py from mcpi.minecraft import Minecraft <|fim_suffix|> color = random.randrange(0,9) mc.setBlock(x,y,z-1,38,color) time.sleep(0.01)<|fim_middle|>import random,time while True: x,y,z = mc.player.getTilePos()
code_fim
medium
{ "lang": "python", "repo": "wuyoujau/-PYPHOONMINECRAFT20210127", "path": "/practice 1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jessierliu/advent-of-code-2020 path: /2/day2.py """ Day 2 """ with open('input.txt', 'r') as f: lines = f.read() lines = lines.split('\n')[:-1] lines = [l.split(' ') for l in lines] valid = 0 new_valid = 0 for cur_pw in lines: <|fim_suffix|> occurences = cur_pw[2][rule[0] - 1] + cur_pw...
code_fim
hard
{ "lang": "python", "repo": "jessierliu/advent-of-code-2020", "path": "/2/day2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> letter = cur_pw[1].strip(':') amount = cur_pw[2].count(letter) rule = cur_pw[0].split('-') rule = [int(r) for r in rule] if amount >= rule[0] and amount <= rule[1]: valid += 1 occurences = cur_pw[2][rule[0] - 1] + cur_pw[2][rule[1] - 1] if occurences.count(letter) == ...
code_fim
medium
{ "lang": "python", "repo": "jessierliu/advent-of-code-2020", "path": "/2/day2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def find_data(): global country_name global city_name global general_info global weather_description global formatted_general_info city_name = str(data['name']) country_name = str(data['sys']['country']) #weather_description = data['weather']['description'] for key, val...
code_fim
hard
{ "lang": "python", "repo": "Xetera/ThiccBot.py", "path": "/musicbot/APIPractice.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xetera/ThiccBot.py path: /musicbot/APIPractice.py # name: Ali # date: 7/12/2016 # description: uses openweathermap.org's api to get weather data about # the city that is inputted # unbreakable? = idk import json import urllib2 from collections import OrderedDict from pprint import pprint api_key...
code_fim
medium
{ "lang": "python", "repo": "Xetera/ThiccBot.py", "path": "/musicbot/APIPractice.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> connectapi() if "name" in data: find_data() print "\n%r in %r:\n"% (city_name, country_name) print """General info:""" pprint(general_info) print "\nWeather Description:\n\tidk why it doesn't let me take this data so annoying\n" else: print "Some...
code_fim
hard
{ "lang": "python", "repo": "Xetera/ThiccBot.py", "path": "/musicbot/APIPractice.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: # subprocess.call(['curl', '-o', path , bug.get_src()]) subprocess.call(['wget', '-t', '1', '-q', '-T', '3', '-O', path , bug.get_src()]) subpr_out = subprocess.check_output(['file', '-b', path]).strip() except Exception as e : LOG.debug('Exception captured %s\n\n' % ...
code_fim
hard
{ "lang": "python", "repo": "keeshen/info-manip", "path": "/adwords_expt/lib/ad_grabber_util.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: keeshen/info-manip path: /adwords_expt/lib/ad_grabber_util.py hin this current session # Global location, added when an ad is matched with existing ads in DB fwtr.write('#UID, Ad-Company, Ad-Filetype, Height, Width, Rel-Location, src\n') for bug in ads.keys(): height, width = bug.get...
code_fim
hard
{ "lang": "python", "repo": "keeshen/info-manip", "path": "/adwords_expt/lib/ad_grabber_util.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: keeshen/info-manip path: /adwords_expt/lib/ad_grabber_util.py cPickle import logging LOG = logging.getLogger("logAdGrabber") ADREGEX = AdRegEx() def check_duplicate(fp1, fp2): """takes two files, does a diff on them, returns True if same""" try: subprocess.check_output(['diff', fp1, fp2...
code_fim
hard
{ "lang": "python", "repo": "keeshen/info-manip", "path": "/adwords_expt/lib/ad_grabber_util.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: owenonline/MARL-Behavior-Research-Project path: /experiment results/python/regression_training/correlation_assessment_agent3_2.py import tensorflow as tf import csv from tensorflow.keras import layers from tensorflow.keras.layers.experimental import preprocessing import pandas as pd import numpy ...
code_fim
hard
{ "lang": "python", "repo": "owenonline/MARL-Behavior-Research-Project", "path": "/experiment results/python/regression_training/correlation_assessment_agent3_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>test_features=np.array(test_features) test_labels=np.array(test_labels) #make model #message=tf.keras.Input(shape=(1,100)) #predictor_layer=tf.keras.layers.Dense(6,activation='relu',use_bias=True)(message) #linear_model=tf.keras.Model(inputs=message,outputs=predictor_layer) normalizer=preprocessing.Nor...
code_fim
hard
{ "lang": "python", "repo": "owenonline/MARL-Behavior-Research-Project", "path": "/experiment results/python/regression_training/correlation_assessment_agent3_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kireevys/operation_and_article path: /app/logick/catalogs_logick.py from app.models.tables import Warehouse, Contractor, Articles class ContractorTools(Contractor): """ Работа со справочником КА """ @staticmethod def add_contractor(**kwargs): ca = Contractor(**kwarg...
code_fim
hard
{ "lang": "python", "repo": "kireevys/operation_and_article", "path": "/app/logick/catalogs_logick.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def delete_warehouse(self, id_ws, name): ws = super().select_expression(id_ws=id_ws)[0] for child in super().select_expression(id_higher=id_ws): for child_child in super().select_expression(id_higher=child.id_ws.value): child_child.delete_data() ...
code_fim
hard
{ "lang": "python", "repo": "kireevys/operation_and_article", "path": "/app/logick/catalogs_logick.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Работа со справочником МХ """ def set_new_name(self, id_ws, name): """ Переименовывает переданный МХ """ ws = super().select_expression(id_ws=id_ws)[0] ws.name.set_value(name) ws.update_data() return True def delete_warehous...
code_fim
hard
{ "lang": "python", "repo": "kireevys/operation_and_article", "path": "/app/logick/catalogs_logick.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Auction(models.Model): title = models.CharField(max_length=20) current_price = models.DecimalField(max_digits=10, decimal_places=2, default=0, null=True, blank=True, verbose_name="current bid") updated_time = models.DateTimeField(auto_now_add=Fals...
code_fim
hard
{ "lang": "python", "repo": "dawitnida/Pythonidae", "path": "/YAAS/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dawitnida/Pythonidae path: /YAAS/models.py from django.db import models from django.contrib.auth.models import User from django.utils.encoding import smart_unicode from django.core.validators import MinValueValidator from django.utils import timezone from concurrency.fields import IntegerVersionF...
code_fim
hard
{ "lang": "python", "repo": "dawitnida/Pythonidae", "path": "/YAAS/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>int("Your total score is: " + str(total_crew_none) + ".") if inp_crew == "one": inp_crew_one = input("Which die do you want to keep? ") roll1_crew_one = random.randint(1, 6) print(roll1_crew_one) ...
code_fim
hard
{ "lang": "python", "repo": "conuma/Python-Coursework", "path": "/INST326/onumajuru_catherine_hw3_ex3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: conuma/Python-Coursework path: /INST326/onumajuru_catherine_hw3_ex3.py import random def multi(): scc = [6, 5, 4] sc = [6, 5] cc = [5, 4] crew = [4] captain = [5] ship = [6] n = 0 while n <= 2: inp = input("Hit enter to roll") if inp == "": ...
code_fim
hard
{ "lang": "python", "repo": "conuma/Python-Coursework", "path": "/INST326/onumajuru_catherine_hw3_ex3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>df_filtro.groupby('Dia')['Quantidade de pessoas'].mean().plot(x='Dia', y= 'Quantidade de pessoas')<|fim_prefix|># repo: fabiohmoreira/shalenne path: /Ler_dados_Mongo.py import pandas as pd from pymongo import MongoClient import numpy as np <|fim_middle|>mongo_client = MongoClient('localhost', 27018) mon...
code_fim
hard
{ "lang": "python", "repo": "fabiohmoreira/shalenne", "path": "/Ler_dados_Mongo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabiohmoreira/shalenne path: /Ler_dados_Mongo.py import pandas as pd from pymongo import MongoClient import numpy as np mongo_client = MongoClient('localhost', 27018) mongo_db = mongo_client['ProjetoIN242'] mongo_collection = mongo_db['contadorpessoas'] <|fim_suffix|>df = pd.DataFrame.from_reco...
code_fim
easy
{ "lang": "python", "repo": "fabiohmoreira/shalenne", "path": "/Ler_dados_Mongo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>df_filtro = df[['Entrada','Dia', 'Quantidade de pessoas']] ##seleção de colunas df_filtro.groupby('Dia')['Quantidade de pessoas'].mean().plot(x='Dia', y= 'Quantidade de pessoas')<|fim_prefix|># repo: fabiohmoreira/shalenne path: /Ler_dados_Mongo.py import pandas as pd from pymongo import MongoClient im...
code_fim
medium
{ "lang": "python", "repo": "fabiohmoreira/shalenne", "path": "/Ler_dados_Mongo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> r = requests.post("{0}/indicators/".format(self.url), data=data, verify=self.verify, proxies=self.proxies) if r.status_code == 200: log.debug("Indicator uploaded successfully - {}".format(value)) ind = json.loads(r.text) return ...
code_fim
hard
{ "lang": "python", "repo": "IntegralDefense/ptauto", "path": "/lib/critsapi/critsapi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dic = corpora.Dictionary(docs) corp = [dic.doc2bow(text) for text in docs] tfidf = models.TfidfModel(corp) corpus_tfidf = tfidf[corp] model = models.ldamodel.LdaModel(corpus_tfidf, num_topics=num_topics, id2word=dic, update_every=1, passes=100) print("LDA model") topics_f...
code_fim
hard
{ "lang": "python", "repo": "dhanashriOstwal/electionSentimentAnalysis", "path": "/Python Scripts/postElection.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> num_topics=3 num_top_words=10 clf = decomposition.NMF(n_components=num_topics, random_state=1) doctopic = clf.fit_transform(dtm) print num_topics, clf.reconstruction_err_ topic_words = [] for topic in clf.components_: word_idx = np.argsort(topic)[::-1][0:nu...
code_fim
hard
{ "lang": "python", "repo": "dhanashriOstwal/electionSentimentAnalysis", "path": "/Python Scripts/postElection.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhanashriOstwal/electionSentimentAnalysis path: /Python Scripts/postElection.py # -*- coding: utf-8 -*- from sklearn.feature_extraction.text import TfidfVectorizer import sentimentAnalysis as sA import sys import os import numpy as np from sklearn import decomposition from gensim import ...
code_fim
hard
{ "lang": "python", "repo": "dhanashriOstwal/electionSentimentAnalysis", "path": "/Python Scripts/postElection.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>bikerawdata = BikeRawData() bikerawdata.add_system(city_label='taipei', bikesharesystem_data=taipei_system) bikerawdata.add_parser(city_label='taipei', parser_func=parse_taipei_file) bikerawdata.add_system(city_label='helsinki', bikesharesystem_data=helsinki_system) bikerawdata.add_parser(city_label='hels...
code_fim
hard
{ "lang": "python", "repo": "anderzzz/viral-bikers", "path": "/dataset_creators/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def compile_data(city_labels=None): '''Compile all data into common structure ''' pass def compile_and_save_data(f_out, city_labels=None): '''Compile and save all data ''' pass<|fim_prefix|># repo: anderzzz/viral-bikers path: /dataset_creators/__init__.py '''Instantiate data pa...
code_fim
hard
{ "lang": "python", "repo": "anderzzz/viral-bikers", "path": "/dataset_creators/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: anderzzz/viral-bikers path: /dataset_creators/__init__.py '''Instantiate data parsers for all cities. If additional city parsers are added, the `bikerrawdata` instance in this file should be updated. <|fim_suffix|> '''Compile all data into common structure ''' pass def compile_and_...
code_fim
hard
{ "lang": "python", "repo": "anderzzz/viral-bikers", "path": "/dataset_creators/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: susanbruce707/hexatrigesimal-to-decimal-calculator path: /base_36.py # -*- coding: utf-8 -*- """ Created on Wed Dec 19 09:41:08 2018 hexatrigesimal to decimal calculator, base 36 encoding; use of letters with digits. @author: susan """ ## create a dictionary as reference for BASE 36 calcul...
code_fim
hard
{ "lang": "python", "repo": "susanbruce707/hexatrigesimal-to-decimal-calculator", "path": "/base_36.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ process valid user input or terminate program on failed input. """ num = enter_num() if num is not None: num_lst = mk_num_lst(num) dec = convert(num_lst) print("decimal value of BASE 36 number", num, "is", dec) else: print("user ter...
code_fim
hard
{ "lang": "python", "repo": "susanbruce707/hexatrigesimal-to-decimal-calculator", "path": "/base_36.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sirfragles/iotsite path: /external_api/urls.py from rest_framework.urlpatterns import format_suffix_patterns from django.urls import path from external_api import views <|fim_suffix|>urlpatterns = format_suffix_patterns(urlpatterns)<|fim_middle|>urlpatterns = [ path('darksky/', views.DarkSky...
code_fim
medium
{ "lang": "python", "repo": "sirfragles/iotsite", "path": "/external_api/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = format_suffix_patterns(urlpatterns)<|fim_prefix|># repo: sirfragles/iotsite path: /external_api/urls.py from rest_framework.urlpatterns import format_suffix_patterns from django.urls import path from external_api import views <|fim_middle|>urlpatterns = [ path('darksky/', views.DarkSky...
code_fim
medium
{ "lang": "python", "repo": "sirfragles/iotsite", "path": "/external_api/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leeexing/Time-2016.11.30 path: /py/basics/scope.py """ 作用域 在Python中,当引用一个变量的时候,对这个【变量的搜索】是按照 本地作用域(Local)、 嵌套作用域(Enclosing function locals)、 全局作用域(Global)、 内置作用域(builtins模块) 的顺序来进行的, 即所谓的LEGB规则。 然而当在一个【函数内部为一个变量赋值】时,并不是按照上面所说LEGB规则来首先找到变量,之后为该变量赋值。在Python中,在函数中为一个变量赋值时,有下面这样一条规则 “当在函数中给一个变量名赋值...
code_fim
medium
{ "lang": "python", "repo": "leeexing/Time-2016.11.30", "path": "/py/basics/scope.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>y = 100 def func_y(): global y y = 101 func_y() print(y) def func_z(): z = 520 def foo(): z = 521 foo() print(z) func_z() def func_e(): count = 0 def foo(): nonlocal count count = 12 foo() print(count) func_e() """ 使用global关键字修饰的变量之前可以并不存在...
code_fim
medium
{ "lang": "python", "repo": "leeexing/Time-2016.11.30", "path": "/py/basics/scope.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: liukai234/python_course_record path: /流程控制/常用迭代工具函数.py # zip(),可以压缩 N 个列表成为一个zip对象(可迭代对象)。 a =['a', 'b', 'c'] b =[1, 2, 3] [x for x in zip(a, b)] # [('a', 1), ('b', 2), ('c', 3)] <|fim_suffix|># sorted() 接受一个可迭代对象,返回其升序。可传参数,reverse=True,key=?(排序关键字) for book in sorted(books, reverse=True, key=...
code_fim
hard
{ "lang": "python", "repo": "liukai234/python_course_record", "path": "/流程控制/常用迭代工具函数.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># sorted() 接受一个可迭代对象,返回其升序。可传参数,reverse=True,key=?(排序关键字) for book in sorted(books, reverse=True, key=len): print(book)<|fim_prefix|># repo: liukai234/python_course_record path: /流程控制/常用迭代工具函数.py # zip(),可以压缩 N 个列表成为一个zip对象(可迭代对象)。 a =['a', 'b', 'c'] b =[1, 2, 3] [x for x in zip(a, b)] # [('a', 1), ...
code_fim
medium
{ "lang": "python", "repo": "liukai234/python_course_record", "path": "/流程控制/常用迭代工具函数.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># reversed() 实现反向遍历,参数可以是各种序列 [y for y in reversed(b)] # [3, 2, 1] # sorted() 接受一个可迭代对象,返回其升序。可传参数,reverse=True,key=?(排序关键字) for book in sorted(books, reverse=True, key=len): print(book)<|fim_prefix|># repo: liukai234/python_course_record path: /流程控制/常用迭代工具函数.py # zip(),可以压缩 N 个列表成为一个zip对象(可迭代对象)。 ...
code_fim
hard
{ "lang": "python", "repo": "liukai234/python_course_record", "path": "/流程控制/常用迭代工具函数.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: WeiS49/Python-Crash-Course path: /python_work/ch6/6.2 alien2.py alien_0 = {} # 声明一个空字典 alien_0['color'] = 'green' # 向空字典中添加值 alien_0['points'] = 5 print(alien_0) <|fim_suffix|>print(f"The alien is now {alien_0['color']}")<|fim_middle|>x = alien_0['color'] print(f"\nThe alien is {alien_0['co...
code_fim
medium
{ "lang": "python", "repo": "WeiS49/Python-Crash-Course", "path": "/python_work/ch6/6.2 alien2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(f"The alien is now {alien_0['color']}")<|fim_prefix|># repo: WeiS49/Python-Crash-Course path: /python_work/ch6/6.2 alien2.py alien_0 = {} # 声明一个空字典 alien_0['color'] = 'green' # 向空字典中添加值 alien_0['points'] = 5 print(alien_0) x = alien_0['color'] <|fim_middle|>print(f"\nThe alien is {alien_0['co...
code_fim
medium
{ "lang": "python", "repo": "WeiS49/Python-Crash-Course", "path": "/python_work/ch6/6.2 alien2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cool-Cooler/CoolInference path: /app/app.py #coding: utf-8 from flask import Flask, redirect, url_for, request from werkzeug.utils import secure_filename import torch, torchvision # Setup detectron2 logger import detectron2 from detectron2.utils.logger import setup_logger setup_logger() # imp...
code_fim
hard
{ "lang": "python", "repo": "Cool-Cooler/CoolInference", "path": "/app/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return response @app.route("/infer", methods=['POST']) def infer(): file = request.files['fimg'] if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) return detect_object(file...
code_fim
hard
{ "lang": "python", "repo": "Cool-Cooler/CoolInference", "path": "/app/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # filterout bana and orage data_set = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]) # print(data_set.thing_classes) pred_inst = outputs["instances"].to("cpu") show_inst = [] pred_res = [] for tc in app.config['THING_CLASSES']: if tc not in data_set.thing_classes: ...
code_fim
hard
{ "lang": "python", "repo": "Cool-Cooler/CoolInference", "path": "/app/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: luisalourenco/AdventOfCode2019 path: /03/part2.py import sys filepath = 'input.txt' def intersection(list1, list2): return set(list1).intersection(list2) def computeSteps(x, y, step, steps): # build dictionary with steps for each point curr = 0 if (x,y) in steps: ...
code_fim
hard
{ "lang": "python", "repo": "luisalourenco/AdventOfCode2019", "path": "/03/part2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> commonPoints = intersection(point1, point2) min = sys.maxsize for k in commonPoints: val = steps.get(k) if val < min: min = val print(min)<|fim_prefix|># repo: luisalourenco/AdventOfCode2019 path: /03/part2.py import sys filepath = 'input.txt' ...
code_fim
hard
{ "lang": "python", "repo": "luisalourenco/AdventOfCode2019", "path": "/03/part2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mpi_size = MPI.COMM_WORLD.Get_size() # Log stats. # XXX shouldn't call np.mean on variable length lists duration = time.time() - start_time if nb_epochs and nb_epoch_cycles and nb_train_steps > 0: #stats = agent.get_stats() ...
code_fim
hard
{ "lang": "python", "repo": "jramak/prosthetic-ddpg", "path": "/baselines/ddpg/training.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if worth_keeping and rank == 0 and nb_epochs and nb_epoch_cycles and nb_train_steps and nb_rollout_steps: logger.info('Saving model to', saved_model_dir + saved_model_basename + '-' + str(epoch)) saver.save(sess, saved_model_path, global_step=epoch, write_meta_g...
code_fim
hard
{ "lang": "python", "repo": "jramak/prosthetic-ddpg", "path": "/baselines/ddpg/training.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jramak/prosthetic-ddpg path: /baselines/ddpg/training.py reward_scale=reward_scale) logger.info('Using agent with the following configuration:') logger.info(str(agent.__dict__.items())) # Set up logging stuff only for a single worker. saved_model_dir = 'saved-models/' ...
code_fim
hard
{ "lang": "python", "repo": "jramak/prosthetic-ddpg", "path": "/baselines/ddpg/training.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: philipdongfei/Violent-Python-A-Cookbook-for-Hackers path: /interceptThread.py #!/usr/bin/env python3 class interceptThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.curPkt = None self.seq = 0 self.foundUAV = False def run(...
code_fim
medium
{ "lang": "python", "repo": "philipdongfei/Violent-Python-A-Cookbook-for-Hackers", "path": "/interceptThread.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> radio = dup.dupRadio(self.curPkt) dot11 = dup.dupDot11(self.curPkt) snap = dup.dupSNAP(self.curPkt) llc = dup.dupLLC(self.curPkt) ip = dup.dupIP(self.curPkt) udp = dup.dupUDP(self.curPkt) raw = Raw(load=cmd) injectPkt = radio / dot11 / llc / ...
code_fim
hard
{ "lang": "python", "repo": "philipdongfei/Violent-Python-A-Cookbook-for-Hackers", "path": "/interceptThread.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jesserowan/ajax_notes path: /apps/notes/views.py from django.shortcuts import render, redirect from django.contrib import messages from .models import * from django.views.decorators.csrf import csrf_exempt def index(request): notes = Note.objects.all().order_by('-created_at') context = {...
code_fim
hard
{ "lang": "python", "repo": "jesserowan/ajax_notes", "path": "/apps/notes/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == "POST": note = Note.objects.get(id=id) note.description = request.POST['edit_description'] note.save() context = { "notes": Note.objects.all().order_by('-created_at') } return render(request, 'notes/notes_index.html', context)<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "jesserowan/ajax_notes", "path": "/apps/notes/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': note = Note.objects.get(id=id) note.delete() context = { "notes": Note.objects.all().order_by('-created_at') } return render(request, 'notes/notes_index.html', context) def edit(request, id): if request.method == "POST": not...
code_fim
hard
{ "lang": "python", "repo": "jesserowan/ajax_notes", "path": "/apps/notes/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: llgeek/leetcode path: /907_SumOfSubarrayMinimums/solution_1.py class Solution: def sumSubarrayMins(self, A: List[int]) -> int: stack = [] prev = [None] * len(A) for i in range(len(A)): <|fim_suffix|> nex = [None] * len(A) for i in range(len(A...
code_fim
hard
{ "lang": "python", "repo": "llgeek/leetcode", "path": "/907_SumOfSubarrayMinimums/solution_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nex[i] = stack[-1] if stack else len(A) stack.append(i) return sum((i - prev[i]) * (nex[i] - i) * A[i] for i in range(len(A))) % (10 ** 9 + 7)<|fim_prefix|># repo: llgeek/leetcode path: /907_SumOfSubarrayMinimums/solution_1.py class Solution: def sumSubarrayMins(self, A: List[int]...
code_fim
hard
{ "lang": "python", "repo": "llgeek/leetcode", "path": "/907_SumOfSubarrayMinimums/solution_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '''accesseur qui retourne la largeur de la grille''' return self.largeur def get_hauteur(self): '''accesseur qui permet de récupérer la valeur de la hauteur de la grille''' return self.hauteur @staticmethod def est_voisins(i,j,x,y,instance): ...
code_fim
hard
{ "lang": "python", "repo": "elias-blm/jeudelavie", "path": "/jeuVie_Belloumi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: elias-blm/jeudelavie path: /jeuVie_Belloumi.py but ordonnée et un autre abscisse). En effet, ce sont les deux éléments du jeu. Q2) On pourrait donner une méthode pour changer l’état de la cellule, une autre pour obtenir son état. Une autre pour définir les voisins et encore une pour les obteni...
code_fim
hard
{ "lang": "python", "repo": "elias-blm/jeudelavie", "path": "/jeuVie_Belloumi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '''constructeur qui initialise les variables''' self.__actuel= False self.__futur= False self.__voisins= None def est_vivant(self): '''accesseur qui retourne l'état actuel de la cellule''' return self.__actuel def set_voisins(self,...
code_fim
hard
{ "lang": "python", "repo": "elias-blm/jeudelavie", "path": "/jeuVie_Belloumi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Normalise dataset print("Normalising dataset") cats = pre_process.normalise(cats) print(""" Cats dataset {0} """.format(cats.head())) # PREDICTION print("Prediction Starting") cats_pred = Classifier.predict(export_model_dir, cats) # EXPORTING pr...
code_fim
hard
{ "lang": "python", "repo": "Lee-SL/machineLearningCodeChallenge", "path": "/predict.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # process date to keep year only print("Processing date column to keep year only") pre_process.strip_year(cats, date_column) # Storing numerical columns in the background pre_process.get_numerical_cols(cats) # Convert all columns to float data type print("Convert all columns ...
code_fim
hard
{ "lang": "python", "repo": "Lee-SL/machineLearningCodeChallenge", "path": "/predict.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lee-SL/machineLearningCodeChallenge path: /predict.py from import_.Import import Import from classifier.Classifier import Classifier from export.Export import Export from preprocessing.PreProcess import PreProcess def main(): date_column = "date of last vet visit" target = "age at deat...
code_fim
hard
{ "lang": "python", "repo": "Lee-SL/machineLearningCodeChallenge", "path": "/predict.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 221810306002/Problem-solving-and-programming-june-2019 path: /Untitled.py #!/usr/bin/env python # coding: utf-8 # In[5]: import re def phonenumbervalidate(phone): pattern ='^[6-9][0-9]{9}$' phone =str(phone) if re.match(pattern,phone): return True return False print(ph...
code_fim
hard
{ "lang": "python", "repo": "221810306002/Problem-solving-and-programming-june-2019", "path": "/Untitled.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> number =str(number) pattern ="^[1][5][2][u][1][A][0][1-9][0-6][0-9]" if re.match(pattern,number): return True return False print(phonenumbervalidate("152u1A0555")) print(phonenumbervalidate("152u1A0485")) # In[ ]:<|fim_prefix|># repo: 221810306002/Problem-solving-and-pr...
code_fim
medium
{ "lang": "python", "repo": "221810306002/Problem-solving-and-programming-june-2019", "path": "/Untitled.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>uwkhk", "emodbyb", "ztahsya", "ieiqm", "lfoquh", "emznnq", "pnhlgut", "pgvads", "cqsjx", "lxnjei", "zpque", "rdjbiyb", "sxedpu", "potnqva", "iirkn", "rjmnrxd", "ksgcd", "waeymnh", "tizdz", "kproa", "wpttygd", "lvyze", "peewvgm", "fwtyzbw", "zitkk", "gfgqr", "udgvlz", "swqspo", "...
code_fim
hard
{ "lang": "python", "repo": "forrest0402/leetcode", "path": "/python/820. Short Encoding of Words.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: forrest0402/leetcode path: /python/820. Short Encoding of Words.py , "vtsqk", "ipkld", "yfhim", "ebaegdc", "ubhrh", "ldejv", "mtflwy", "ocpyj", "yopgqs", "fkjxxd", "njnnwr", "nylkeb", "taymdqv", "ekpznq", "cbzobmg", "bucdds", "qjozu", "uvpghor", "obhnu", "ljkxbg", "uqrxjtf", "xw...
code_fim
hard
{ "lang": "python", "repo": "forrest0402/leetcode", "path": "/python/820. Short Encoding of Words.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: forrest0402/leetcode path: /python/820. Short Encoding of Words.py "upphc", "agydg", "cjmwk", "rhxbqh", "tpgozdd", "qyqoy", "zjqutw", "qoohqny", "nsiacwz", "xupin", "criuvs", "eswjeft", "pdmevn", "zvogq", "lrrvo", "qhfqqpw", "ktudfg", "ijvmi", "neyjjdx", "rllpi", "vllvaa", "ese...
code_fim
hard
{ "lang": "python", "repo": "forrest0402/leetcode", "path": "/python/820. Short Encoding of Words.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> maybe_download('https://s3.amazonaws.com/text-datasets/babi_tasks_1-20_v1-2.tar.gz', 'datasets', 11745123) file = tarfile.open("datasets/babi_tasks_1-20_v1-2.tar.gz", "r:gz") file.extractall("datasets") file.close() print("Some housekeeping...") if not os.path.exists("datasets/babi...
code_fim
medium
{ "lang": "python", "repo": "alexvlis/memN2N", "path": "/memn2n/babi_utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexvlis/memN2N path: /memn2n/babi_utils.py # Get Facebook's bAbi dataset from utils import maybe_download from shutil import rmtree import os import tarfile <|fim_suffix|> maybe_download('https://s3.amazonaws.com/text-datasets/babi_tasks_1-20_v1-2.tar.gz', 'datasets', 11745123) file = ta...
code_fim
medium
{ "lang": "python", "repo": "alexvlis/memN2N", "path": "/memn2n/babi_utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def execute(event, context): print(event) pass # payload = {'Bucket': BUCKET_GLOBAL, 'Key': 'EEVC.TXT'} # process(bucket=payload['Bucket'], key=payload['Key']) # # payload = {'Bucket': BUCKET_GLOBAL, 'Key': 'EEVD.TXT'} # process(bucket=payload['Bucket'], key=payload['Key']) ...
code_fim
hard
{ "lang": "python", "repo": "BrunoIstvan/localstack-aws-lambda-s3-sqs", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrunoIstvan/localstack-aws-lambda-s3-sqs path: /main.py from os import environ from process import process from s3Service import put_object environ['ACCESS_KEY'] = '1234567890' environ['SECRET_KEY'] = '1234567890' environ['ENDPOINT_URL'] = 'http://localhost:4566' environ['REGION'] = 'us-east-1' ...
code_fim
medium
{ "lang": "python", "repo": "BrunoIstvan/localstack-aws-lambda-s3-sqs", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # payload = {'Bucket': BUCKET_GLOBAL, 'Key': 'EEVC.TXT'} # process(bucket=payload['Bucket'], key=payload['Key']) # # payload = {'Bucket': BUCKET_GLOBAL, 'Key': 'EEVD.TXT'} # process(bucket=payload['Bucket'], key=payload['Key']) # # payload = {'Bucket': BUCKET_GLOBAL, 'Key': 'EE...
code_fim
medium
{ "lang": "python", "repo": "BrunoIstvan/localstack-aws-lambda-s3-sqs", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #new_js_line = json.dumps(js) + "\n" #new_json_file.write(new_js_line) #continue imgName = js["image_key"] select_class = getRegionClass(done_root_dir, base_file_id, imgName) if select_class == None: new_json_file.write(line + '\n') # #print('Not ...
code_fim
hard
{ "lang": "python", "repo": "katerinahan/script", "path": "/phone_smoke_zhenghua/smoke_check/add_common_box_smoke_region.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: katerinahan/script path: /phone_smoke_zhenghua/smoke_check/add_common_box_smoke_region.py import os import sys import glob import shutil import json import codecs from collections import OrderedDict def getRegionClass(image_path, data_id, imgName): region_class = ['nosmoke_background', 'nosmok...
code_fim
hard
{ "lang": "python", "repo": "katerinahan/script", "path": "/phone_smoke_zhenghua/smoke_check/add_common_box_smoke_region.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> imgName = js["image_key"] select_class = getRegionClass(done_root_dir, base_file_id, imgName) if select_class == None: new_json_file.write(line + '\n') # #print('Not Found: ', done_root_dir, base_file_id, imgName) continue #print select_class new_commo...
code_fim
hard
{ "lang": "python", "repo": "katerinahan/script", "path": "/phone_smoke_zhenghua/smoke_check/add_common_box_smoke_region.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gregsab/Multiflashcards path: /fcset.py import urllib, json from PyQt4.QtCore import QRectF, Qt from PyQt4.Qt import QPrinter, QPainter, QFont, QBrush, QColor, QPen, QImage from PyQt4.QtGui import QApplication # bkgimg = QImage() # bkgimg.load("KosyMost.jpg", format = "jpg") # # print bkgimg ...
code_fim
hard
{ "lang": "python", "repo": "gregsab/Multiflashcards", "path": "/fcset.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> background(painter, bkgimg) painter.setPen(penHText); painter.setFont(QFont("Arial", 24, QFont.Bold)); painter.drawText(q, Qt.AlignCenter | Qt.TextWordWrap, qa['q']) painter.drawText(a, Qt.AlignCenter | Qt.TextWordWrap, qa['a'][0]) printer.newPage() painter.end()<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "gregsab/Multiflashcards", "path": "/fcset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for qa in data['flashcards']: print "%s -> %s" % (qa['q'], qa['a'][0]) # painter.drawText(painter.device().width()/2, 500, qa['q']) background(painter, bkgimg) painter.setPen(penHText); painter.setFont(QFont("Arial", 24, QFont.Bold)); painter.drawText(q, Qt.AlignCenter, qa['q']) ...
code_fim
hard
{ "lang": "python", "repo": "gregsab/Multiflashcards", "path": "/fcset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aaronspurgeon/hashtables-flex path: /applications/word_count/word_count.py def word_count(s): # Your code here cache = {} ignore = '":;,.-+=/\\|[]{}()*^&' lower = s.lower() <|fim_suffix|>if __name__ == "__main__": print(word_count("")) print(word_count("Hello")) print...
code_fim
hard
{ "lang": "python", "repo": "aaronspurgeon/hashtables-flex", "path": "/applications/word_count/word_count.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }