text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> class LampViewSet(viewsets.ModelViewSet): serializer_class = LampSerializer queryset = Lamp.objects.all() router = routers.DefaultRouter() router.register(r'lamps', LampViewSet)<|fim_prefix|># repo: stevenpi/Link.Python.Django.LampControl path: /lamp_control/api.py from rest_framework import ...
code_fim
medium
{ "lang": "python", "repo": "stevenpi/Link.Python.Django.LampControl", "path": "/lamp_control/api.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevenpi/Link.Python.Django.LampControl path: /lamp_control/api.py from rest_framework import serializers, viewsets, routers <|fim_suffix|> router = routers.DefaultRouter() router.register(r'lamps', LampViewSet)<|fim_middle|>from lamp_control.models import Lamp class LampSerializer(serializers...
code_fim
hard
{ "lang": "python", "repo": "stevenpi/Link.Python.Django.LampControl", "path": "/lamp_control/api.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #We can also test our cat example: prediction = model.predict([prepare('cat.jpg')]) print(prediction) # will be a list in a list. print(CATEGORIES[int(prediction[0][0])]) ''' alpha. Also referred to as the learning rate or step size. The proportion that weights are updated (e.g. 0.001). Larger value...
code_fim
hard
{ "lang": "python", "repo": "Ramstein/PadIN", "path": "/Classifying dogs vs cats with our own data images.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pickle_upload = open('{}_pickle'.format(accIndex - 1), 'rb') p_upload = pickle.load(pickle_upload) print(p_upload) if history.history.get('val_loss')[-1] < min: min = history.history.get('val_loss')[-1] if lossIn...
code_fim
hard
{ "lang": "python", "repo": "Ramstein/PadIN", "path": "/Classifying dogs vs cats with our own data images.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ramstein/PadIN path: /Classifying dogs vs cats with our own data images.py ''' !pip install wget from zipfile import ZipFile import wget print('Beginning file downlaod with wget module') url = 'https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3...
code_fim
hard
{ "lang": "python", "repo": "Ramstein/PadIN", "path": "/Classifying dogs vs cats with our own data images.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>) print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))<|fim_prefix|># repo: syr9711/homework path: /2-16.py wage=5 print("%d시간에 %d%s 벌었습니다." %(1, wage*1, <|fim_middle|>"달러")) print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달러")) print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원")
code_fim
medium
{ "lang": "python", "repo": "syr9711/homework", "path": "/2-16.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: syr9711/homework path: /2-16.py wage=5 print("%d시간에 %d%s 벌었습니다." %(1, wage*1, "달러")) print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달<|fim_suffix|>) print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))<|fim_middle|>러")) print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원")
code_fim
easy
{ "lang": "python", "repo": "syr9711/homework", "path": "/2-16.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: syr9711/homework path: /2-16.py wage=5 print("%d시간에 %d%s 벌었습니다." %(1, wage*1, <|fim_suffix|>러")) print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원")) print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))<|fim_middle|>"달러")) print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달
code_fim
easy
{ "lang": "python", "repo": "syr9711/homework", "path": "/2-16.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>a.index(b'<b>')+3:data.index(b'</b>')] print(key.decode('ascii'))<|fim_prefix|># repo: benkatz-12/CSCI-4830---Computer-Security path: /Project_3/getkey-secure.py #!/usr/bin/python3 import requests import urllib3 urllib3.disab<|fim_middle|>le_warnings() response = requests.get('https://freeaeskey.xyz', v...
code_fim
medium
{ "lang": "python", "repo": "benkatz-12/CSCI-4830---Computer-Security", "path": "/Project_3/getkey-secure.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: benkatz-12/CSCI-4830---Computer-Security path: /Project_3/getkey-secure.py #!/usr/bin/python3 import requests import urllib3 urllib3.disab<|fim_suffix|>a.index(b'<b>')+3:data.index(b'</b>')] print(key.decode('ascii'))<|fim_middle|>le_warnings() response = requests.get('https://freeaeskey.xyz', v...
code_fim
medium
{ "lang": "python", "repo": "benkatz-12/CSCI-4830---Computer-Security", "path": "/Project_3/getkey-secure.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meeting(models.Model): id_meeting = models.AutoField(primary_key=True) start_date = models.DateField(max_length=100) start_time = models.TimeField(max_length=100) description = models.CharField(max_length=100, null=True, default='') duration = models.DurationField(default=0) ...
code_fim
hard
{ "lang": "python", "repo": "wertarts/APV_F", "path": "/firstapp/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wertarts/APV_F path: /firstapp/models.py from django.db import models class Location(models.Model): id_location = models.AutoField(primary_key=True) city = models.CharField(max_length=100, null=True) street_name = models.CharField(max_length=100, null=True) street_number = model...
code_fim
hard
{ "lang": "python", "repo": "wertarts/APV_F", "path": "/firstapp/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>open(to_file,'w').write(indata)#无需close print("done!")<|fim_prefix|># repo: raulpeter/lpthw path: /ex17.py from os.path import exists from_file = input('form_file') to_file = input('to_file') print(f"copying from {from_file} to {to_file}") indata = open(from_file).read()#这种方式读取文件后无需close print(f"the i...
code_fim
medium
{ "lang": "python", "repo": "raulpeter/lpthw", "path": "/ex17.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: raulpeter/lpthw path: /ex17.py from os.path import exists from_file = input('form_file') to_file = input('to_file') <|fim_suffix|>print(f"does the output file exist? {exists(to_file)}") print("return to continue, CTRL-C to abort") input('?') open(to_file,'w').write(indata)#无需close print("done...
code_fim
medium
{ "lang": "python", "repo": "raulpeter/lpthw", "path": "/ex17.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>) random_data = data.copy() for i in range(5): random_data["%d"%(i+1)] = np.random.permutation(random_data["%d"%(i+1)]) for k in range(len(post)): idx = np.random.permutation(range(1,5))[0] for i in range(5): if i == idx: ...
code_fim
hard
{ "lang": "python", "repo": "Doken-Tokuyama/gpt2_finetune", "path": "/data/gen_fake_st.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>d(line.strip()) with open("./roc.txt", "r") as fin: with open("./roc_replace.txt", "w") as fout: post, tmp = [], [] for k, line in enumerate(fin): i = k + 1 if i % 6 == 0: post.append(tmp) tmp = [] else: ...
code_fim
hard
{ "lang": "python", "repo": "Doken-Tokuyama/gpt2_finetune", "path": "/data/gen_fake_st.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Doken-Tokuyama/gpt2_finetune path: /data/gen_fake_st.py import numpy as np import random with open("./roc.txt", "r") as fin: with open("./roc_shuffle.txt", "w") as fout: tmp = [] for k, line in enumerate(fin): i = k + 1 if i % 6 == 0: i...
code_fim
hard
{ "lang": "python", "repo": "Doken-Tokuyama/gpt2_finetune", "path": "/data/gen_fake_st.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alanchristo/sorting path: /insertion sort.py a= input("Enter number") a= a.split() b=[] for x in a: b.append(int(x)) <|fim_suffix|> if b[s]<b[j]: c=b[s] b.pop(s) b.insert(b.index(b[j]),c) print(b,b[:i],b[s])<|fim_middle|>print(b) l=le...
code_fim
medium
{ "lang": "python", "repo": "alanchristo/sorting", "path": "/insertion sort.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if b[s]<b[j]: c=b[s] b.pop(s) b.insert(b.index(b[j]),c) print(b,b[:i],b[s])<|fim_prefix|># repo: alanchristo/sorting path: /insertion sort.py a= input("Enter number") a= a.split() b=[] for x in a: b.append(int(x)) <|fim_middle|>print(b) l=le...
code_fim
medium
{ "lang": "python", "repo": "alanchristo/sorting", "path": "/insertion sort.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: a19c97/csc148-code path: /Labs /BST/filter_pos_rec.py __author__ = 'AChen' from rec_linked_list import * def filter_pos_rec(lst): <|fim_suffix|> """ if lst.is_empty(): return lst else: pos_rec = LinkedListRec([]) if lst._first > 0: pos_rec._first =...
code_fim
medium
{ "lang": "python", "repo": "a19c97/csc148-code", "path": "/Labs /BST/filter_pos_rec.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ @type lst: LinkedListRec >>> lst = LinkedListRec([3, -10, 4, 0]) >>> pos = filter_pos_rec(lst) >>> str(pos) '3 -> 4' """ if lst.is_empty(): return lst else: pos_rec = LinkedListRec([]) if lst._first > 0: pos_rec._first = lst._fir...
code_fim
medium
{ "lang": "python", "repo": "a19c97/csc148-code", "path": "/Labs /BST/filter_pos_rec.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lostandlucky/RealtorAdvantage path: /BrokerageTable/models.py from django.db import models class Brokerage(models.Model): BrokerageName = models.CharField(max_length=500) #To-Do Fix additional settings for ImagesFields/FileFields #BrokerageLogo = ImageField ReviewLink = models.CharField(max_...
code_fim
hard
{ "lang": "python", "repo": "lostandlucky/RealtorAdvantage", "path": "/BrokerageTable/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ams_Hiring = models.BooleanField() Marketing = models.CharField(max_length=500) TotalListings = models.IntegerField() ConferenceRooms = models.BooleanField() OfficeLeaders = models.CharField (max_length=500) #OfficeLeaderPhoto = models.ImageField<|fim_prefix|># repo: lostandlucky/RealtorAdvantage pa...
code_fim
hard
{ "lang": "python", "repo": "lostandlucky/RealtorAdvantage", "path": "/BrokerageTable/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(gun.bullets)): try: gun.bullets[i].x = gun.bullets[i].x + 4 * math.cos(math.radians(gun.bullets[i].angle + 90)) gun.bullets[i].y = gun.bullets[i].y + 4 * math.sin(math.radians(gun.bullets[i].angle - 90)) if gun.bullets[i].x > 600: ...
code_fim
hard
{ "lang": "python", "repo": "heros1sport/ALLmyPythonCodes", "path": "/Ludum Dare 2000.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: heros1sport/ALLmyPythonCodes path: /Ludum Dare 2000.py import random import math import time import pygame pygame.init() scr = pygame.display.set_mode((700,700)) enemies = [] #music = pygame.mixer.music.load('ENERGETIC CHIPTUNE Thermal - Evan King.mp3') #pygame.mixer.music.play(-1) hit =...
code_fim
hard
{ "lang": "python", "repo": "heros1sport/ALLmyPythonCodes", "path": "/Ludum Dare 2000.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.bullets2.append(Bullet((255,255,0))) self.bullets2[-1].x = x self.bullets2[-1].y = y self.bullets2[-1].angle = angle class Enemy: def __init__(self): self.x = 100 self.y = 100 self.speed = 2 self.hearts = 3 self.ima...
code_fim
hard
{ "lang": "python", "repo": "heros1sport/ALLmyPythonCodes", "path": "/Ludum Dare 2000.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MUD-Django/MUD-Django-BE path: /adv_project/urls.py from django.contrib import admin from django.urls import path, include, re_path from django.conf.urls import include # from rest_framework import routers from rest_framework.authtoken import views # from adventure.api import PlayerViewSet, RoomV...
code_fim
medium
{ "lang": "python", "repo": "MUD-Django/MUD-Django-BE", "path": "/adv_project/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># router = routers.DefaultRouter() # router.register('rooms', RoomViewSet) # router.register('currentRoom', PlayerViewSet) urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('api.urls')), path('api/adv/', include('adventure.urls')), # path('api-token-auth', views.obt...
code_fim
medium
{ "lang": "python", "repo": "MUD-Django/MUD-Django-BE", "path": "/adv_project/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># making a list from an object and an int @micropython.viper def viper_list(x, y:int): return [x, y + 1] print(viper_list(1, 2)) # making a set from an object and an int @micropython.viper def viper_set(x, y:int): return {x, y + 1} print(sorted(list(viper_set(1, 2)))) # raising an ex...
code_fim
hard
{ "lang": "python", "repo": "jiapei100/Stereo", "path": "/micropython/tests/micropython/viper_misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return {x, y + 1} print(sorted(list(viper_set(1, 2)))) # raising an exception @micropython.viper def viper_raise(x:int): raise OSError(x) try: viper_raise(1) except OSError as e: print(repr(e)) # this doesn't work at the moment #@micropython.viper #def g() -> uint: # re...
code_fim
hard
{ "lang": "python", "repo": "jiapei100/Stereo", "path": "/micropython/tests/micropython/viper_misc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JohnHamm0nd/algorithm path: /codingdojang_LV2/최빈값 구하기.py """ 리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라. [12, 17, 19, 17, 23] = 17 [26, 37, 26, 37, 91] = 26, 37 [28, 30, 32, 34, 144] = 없다 최빈값 : 자료의 값 중에서 가장 많이 나타난 값 ① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다. ② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다. "...
code_fim
medium
{ "lang": "python", "repo": "JohnHamm0nd/algorithm", "path": "/codingdojang_LV2/최빈값 구하기.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for numbers in n_list: n_dict = {} for n in numbers: if n in n_dict: n_dict[n] += 1 else: n_dict[n] = 1 mode = [] if len(n_dict) == 1 or len(n_dict) == len(numbers): print(numbers, '= 없다') else: mode_count = max(n_dict.values()) ...
code_fim
hard
{ "lang": "python", "repo": "JohnHamm0nd/algorithm", "path": "/codingdojang_LV2/최빈값 구하기.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MakoLab/graphchain-indy-plugin path: /plenum/server/plugin/graphchain/stardog_graph_store.py import requests from SPARQLWrapper import SPARQLWrapper, JSON from rdflib import Graph from plenum.server.plugin.graphchain.graph_store import GraphStore from plenum.server.plugin.graphchain.logger impor...
code_fim
hard
{ "lang": "python", "repo": "MakoLab/graphchain-indy-plugin", "path": "/plenum/server/plugin/graphchain/stardog_graph_store.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> g = Graph() g.parse(data=raw_graph, format=graph_format) sparql_query = SPARQLWrapper( self._get_sparql_endpoint_for_query(), self._get_sparql_endpoint_for_update()) query = GraphStore.INSERT_GRAPH_QUERY_TEMPLATE.format(ihash, g.serialize(format='n...
code_fim
hard
{ "lang": "python", "repo": "MakoLab/graphchain-indy-plugin", "path": "/plenum/server/plugin/graphchain/stardog_graph_store.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_nouns(self, tokens): nouns = [] for word, pos in tokens: if pos == "NN": nouns.push(word)<|fim_prefix|># repo: vijaypandiyan/ChatBot path: /app/nlp_utility.py class NlpUtility(): """ Utility methods to get particular parts of speech from a token set """ def get_nouns(self, tokens...
code_fim
hard
{ "lang": "python", "repo": "vijaypandiyan/ChatBot", "path": "/app/nlp_utility.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vijaypandiyan/ChatBot path: /app/nlp_utility.py class NlpUtility(): """ Utility methods to get particular parts of speech from a token set """ def get_nouns(self, tokens): <|fim_suffix|> nouns = [] for word, pos in tokens: if pos == "NN": nouns.push(word)<|fim_middle|> nouns = [] ...
code_fim
hard
{ "lang": "python", "repo": "vijaypandiyan/ChatBot", "path": "/app/nlp_utility.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def listBuilder(): b = [] for x in range(5): b.append(10 * x) return b print "[done, for real]"<|fim_prefix|># repo: GoogleJump/AdvisorAnimals path: /code.py def helloWorld(): print "We are in DEMO land!" <|fim_middle|>for i in range(10): helloWorld() print listBuilder()
code_fim
easy
{ "lang": "python", "repo": "GoogleJump/AdvisorAnimals", "path": "/code.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoogleJump/AdvisorAnimals path: /code.py def helloWorld(): print "We are in DEMO land!" for i in range(10): helloWorld() print listBuilder() def listBuilder(): <|fim_suffix|>print "[done, for real]"<|fim_middle|> b = [] for x in range(5): b.append(10 * x) return b
code_fim
medium
{ "lang": "python", "repo": "GoogleJump/AdvisorAnimals", "path": "/code.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kunalnag/Django-REST-framework path: /DsfPro1/api1/views.py import django from rest_framework import serializers from django.shortcuts import render from .models import Student from .serializiers import StudentSerializer from rest_framework.renderers import JSONRenderer from django.http import Ht...
code_fim
hard
{ "lang": "python", "repo": "kunalnag/Django-REST-framework", "path": "/DsfPro1/api1/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #use simply to reduce the extra line of code return JsonResponse(serializers.data) def student_list(request): #Student model object stu = Student.objects.all() #Serializers convert student model object to python dictionary serializers = StudentSerializer(stu,many=True) #JSONR...
code_fim
hard
{ "lang": "python", "repo": "kunalnag/Django-REST-framework", "path": "/DsfPro1/api1/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def student_list(request): #Student model object stu = Student.objects.all() #Serializers convert student model object to python dictionary serializers = StudentSerializer(stu,many=True) #JSONRenderer convert student python dictionary to json object # json_data = JSONRenderer().re...
code_fim
medium
{ "lang": "python", "repo": "kunalnag/Django-REST-framework", "path": "/DsfPro1/api1/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: escramer/minecraft-bot path: /bot.py """Return whether or not the bot contains the block id.""" return block_ in self._inventory def _get_block(self, pos): """Get the block at the position.""" raise NotImplementedError def _place(self, loc, exclude=None, block...
code_fim
hard
{ "lang": "python", "repo": "escramer/minecraft-bot", "path": "/bot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Initialized the problem with an _ImaginaryBot. block is a block id.""" self._bot = imag_bot self._block = block_ self._player_loc = player_loc def get_player_loc(self): """Return the player location.""" return deepcopy(self._player_loc) ...
code_fim
hard
{ "lang": "python", "repo": "escramer/minecraft-bot", "path": "/bot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _move(self, pos): """Move there, and set the appropriate blocks.""" self._set_block(self._pos, _AIR) self._set_block(self._pos + _Vec3(0, 1, 0), _AIR) self._set_block(pos, self._BOT_BLOCK) self._set_block(pos + _Vec3(0, 1, 0), self._BOT_BLOCK) self._...
code_fim
hard
{ "lang": "python", "repo": "escramer/minecraft-bot", "path": "/bot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: knparikh/IK path: /LinkedLists/super_stack/stack.py #!/bin/python3 # Implement a stack with push, pop, inc(e, k) operations # inc (e,k) - Add k to each of bottom e elements import sys class Stack(object): def __init__(self): self.arr = [] def push(self, val): self.arr.a...
code_fim
hard
{ "lang": "python", "repo": "knparikh/IK", "path": "/LinkedLists/super_stack/stack.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": operations_cnt = 0 operations_cnt = int(input()) operations_i = 0 operations = [] while operations_i < operations_cnt: try: operations_item = str(input()) except: operations_item = None operations.append(operat...
code_fim
hard
{ "lang": "python", "repo": "knparikh/IK", "path": "/LinkedLists/super_stack/stack.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class GoogleArticleItem(scrapy.Item): title = scrapy.Field() date = scrapy.Field() snippet = scrapy.Field() source = scrapy.Field()<|fim_prefix|># repo: mzw4/MorningAssistant path: /news_crawler/news_crawler/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items...
code_fim
medium
{ "lang": "python", "repo": "mzw4/MorningAssistant", "path": "/news_crawler/news_crawler/items.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mzw4/MorningAssistant path: /news_crawler/news_crawler/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy <|fim_suffix|> title = scrapy.Field() date = scrapy.Field()...
code_fim
medium
{ "lang": "python", "repo": "mzw4/MorningAssistant", "path": "/news_crawler/news_crawler/items.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>f = df.head(100) print(df.head()) #print(list(data))<|fim_prefix|># repo: xgao0412/stock_price_app path: /aa.py import requests import json import pandas as pd n1 = 'ADS' api_url = 'https://www.quandl.com/api/v3/da<|fim_middle|>tasets/WIKI/%s.csv' % n1 df = pd.read_csv(api_url) d
code_fim
easy
{ "lang": "python", "repo": "xgao0412/stock_price_app", "path": "/aa.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tasets/WIKI/%s.csv' % n1 df = pd.read_csv(api_url) df = df.head(100) print(df.head()) #print(list(data))<|fim_prefix|># repo: xgao0412/stock_price_app path: /aa.py import requests import json import pandas as pd n1<|fim_middle|> = 'ADS' api_url = 'https://www.quandl.com/api/v3/da
code_fim
easy
{ "lang": "python", "repo": "xgao0412/stock_price_app", "path": "/aa.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xgao0412/stock_price_app path: /aa.py import requests import json import pandas as pd n1<|fim_suffix|>f = df.head(100) print(df.head()) #print(list(data))<|fim_middle|> = 'ADS' api_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1 df = pd.read_csv(api_url) d
code_fim
medium
{ "lang": "python", "repo": "xgao0412/stock_price_app", "path": "/aa.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for sentence in pb.progressbar(trainset.get_set(phase)): model.zero_grad() role_p = model(*sentence['inputs']) _, predict = torch.max(role_p, 1) loss = lossfunction(role_p, autograd.Variable(sentence['targets'][0])) ...
code_fim
hard
{ "lang": "python", "repo": "liu946/BiAffineSrl", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: liu946/BiAffineSrl path: /main.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import torch from torch import nn, autograd import config import time import copy import progressbar as pb from dataset import TrainDataSet from model import BiAffineSrlModel from fscore import FScore conf...
code_fim
hard
{ "lang": "python", "repo": "liu946/BiAffineSrl", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model.load_state_dict(best_model_wts) return model if __name__ == '__main__': config.parse_args() torch.manual_seed(config.get_option('seed')) mode = config.get_option('mode') if mode == 'train': train() else: NotImplementedError()<|fim_prefix|># repo: liu946/...
code_fim
hard
{ "lang": "python", "repo": "liu946/BiAffineSrl", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaelyhuang23/Stock-Prediction path: /test.py from StockDatabase import StockDatabase from RNNinner import RecurrentAnalyzer import torch import matplotlib.pyplot as plt import numpy as np database = StockDatabase() database.read_data() <|fim_suffix|>model.eval() with torch.no_grad(): preds ...
code_fim
hard
{ "lang": "python", "repo": "michaelyhuang23/Stock-Prediction", "path": "/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>prices = torch.tensor(database.normalize(database.get_stock_prices('AAPL',length=2000))) print(prices.shape) model = RecurrentAnalyzer(100,10).to('cpu') model.load_state_dict(torch.load('rnn_inner')) model.init_hidden() model.eval() with torch.no_grad(): preds = list(model(prices[:50,None,None])[:,0])...
code_fim
medium
{ "lang": "python", "repo": "michaelyhuang23/Stock-Prediction", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> num = eval(input('Enter number to count zeros in it\'s binary: ')) print('Assumung int is of 32 bits.') result = countOfZeros(num) print('Number of zero\'s in %d = %d'%(num,result)) if __name__ == '__main__': main()<|fim_prefix|># repo: kajaltingare/Python path: /Basics/UsingFu...
code_fim
easy
{ "lang": "python", "repo": "kajaltingare/Python", "path": "/Basics/UsingFunc/countOfZeros.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kajaltingare/Python path: /Basics/UsingFunc/countOfZeros.py # Write a program to accept a no & count number of zeros in it.(int=32bits) def countOfZeros(num): cnt = 0 while(num!=0): cnt+=1 num = num&(num-1) return (32-cnt) <|fim_suffix|> num = e...
code_fim
easy
{ "lang": "python", "repo": "kajaltingare/Python", "path": "/Basics/UsingFunc/countOfZeros.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>with open('testfile_short1.csv', 'r') as original: data = original.read() for i in range(2): with open('testfile_short3.csv', 'a') as modified: modified.write(data)<|fim_prefix|># repo: YaroslavGrushko/Spark path: /DoubleBigData/doubleBigData.py import pandas as pd from sqlalchemy import create_engin...
code_fim
easy
{ "lang": "python", "repo": "YaroslavGrushko/Spark", "path": "/DoubleBigData/doubleBigData.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YaroslavGrushko/Spark path: /DoubleBigData/doubleBigData.py import pandas as pd from sqlalchemy import create_engine # file = 'testfile.csv' <|fim_suffix|>with open('testfile_short1.csv', 'r') as original: data = original.read() for i in range(2): with open('testfile_short3.csv', 'a') as mod...
code_fim
easy
{ "lang": "python", "repo": "YaroslavGrushko/Spark", "path": "/DoubleBigData/doubleBigData.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for num in nums: if num != val: nums[last_position] = num last_position += 1 return last_position """ Complexity: Time : O(n) | Space: O(1) """<|fim_prefix|># repo: aroranubhav/DailyBit path: /RemoveElement.py """ Given an array nums a...
code_fim
hard
{ "lang": "python", "repo": "aroranubhav/DailyBit", "path": "/RemoveElement.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aroranubhav/DailyBit path: /RemoveElement.py """ Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memor...
code_fim
medium
{ "lang": "python", "repo": "aroranubhav/DailyBit", "path": "/RemoveElement.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cjames21082/Hackbright-Project--Soccer path: /alembic/versions/35f6815c3112_tables.py """tables Revision ID: 35f6815c3112 Revises: None Create Date: 2013-07-28 21:15:38.385006 """ # revision identifiers, used by Alembic. revision = '35f6815c3112' down_revision = None from alembic import op im...
code_fim
hard
{ "lang": "python", "repo": "Cjames21082/Hackbright-Project--Soccer", "path": "/alembic/versions/35f6815c3112_tables.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sa.PrimaryKeyConstraint('id') ) op.create_table('positions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('position_type', sa.String(length=64), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), ...
code_fim
hard
{ "lang": "python", "repo": "Cjames21082/Hackbright-Project--Soccer", "path": "/alembic/versions/35f6815c3112_tables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>and accuracy and precision to overcome do the import * from decimal from decimal import * x = .1 + .1 + .1 -.3 print("x is {}" .format(x)) print(type(x)) # =============>How to solve the above problem accuracy<=============== # And the type is class decimal.Decimal # When dealing with money use this metho...
code_fim
hard
{ "lang": "python", "repo": "gitlearn212/My-Python-Lab", "path": "/Python/linkedincourse/types2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitlearn212/My-Python-Lab path: /Python/linkedincourse/types2.py # =============>This is a Normal mathematical tasks<========== x = 7 x = 7 // 3 # rounds the number = 2 ans class int #x = 7 / 3 # gives the floating number = 2.33333335 ans class float #x = 7 % 3 # gives the reminder = 1 an<|fi...
code_fim
hard
{ "lang": "python", "repo": "gitlearn212/My-Python-Lab", "path": "/Python/linkedincourse/types2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>m1 = float(raw_input("nhap gia m1 :")) m2 = float(raw_input("nhap gia m2 :")) s = int (raw_input("nhap so dien da dung :")) TongTien(m1,m2,s)<|fim_prefix|># repo: sonkute96/hocPython path: /BaiTap2.py def TongTien(m1,m2,s): if s <=100: tong = m1 * s else: tong = m1 * 100 + m2 * (s-100) <|fim_...
code_fim
easy
{ "lang": "python", "repo": "sonkute96/hocPython", "path": "/BaiTap2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sonkute96/hocPython path: /BaiTap2.py def TongTien(m1,m2,s): if s <=100: tong = m1 * s else: tong = m1 * 100 + m2 * (s-100) print tong m1 = float(raw_input("nhap gia m1 :")) <|fim_suffix|>s = int (raw_input("nhap so dien da dung :")) TongTien(m1,m2,s)<|fim_middle|>m2 = float(raw_in...
code_fim
easy
{ "lang": "python", "repo": "sonkute96/hocPython", "path": "/BaiTap2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s = int (raw_input("nhap so dien da dung :")) TongTien(m1,m2,s)<|fim_prefix|># repo: sonkute96/hocPython path: /BaiTap2.py def TongTien(m1,m2,s): if s <=100: tong = m1 * s else: tong = m1 * 100 + m2 * (s-100) print tong m1 = float(raw_input("nhap gia m1 :")) <|fim_middle|>m2 = float(raw_in...
code_fim
easy
{ "lang": "python", "repo": "sonkute96/hocPython", "path": "/BaiTap2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: ret, frame = cap.read() cv2.imshow(frame)<|fim_prefix|># repo: gilbertfrancois/insta_camera path: /main2.py import cv2 import numpy as np if __name__ == "__main__": <|fim_middle|> cap = cv2.VideoCapture()
code_fim
easy
{ "lang": "python", "repo": "gilbertfrancois/insta_camera", "path": "/main2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gilbertfrancois/insta_camera path: /main2.py import cv2 import numpy as np <|fim_suffix|> cap = cv2.VideoCapture() while True: ret, frame = cap.read() cv2.imshow(frame)<|fim_middle|>if __name__ == "__main__":
code_fim
easy
{ "lang": "python", "repo": "gilbertfrancois/insta_camera", "path": "/main2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gilbertfrancois/insta_camera path: /main2.py import cv2 import numpy as np if __name__ == "__main__": <|fim_suffix|> while True: ret, frame = cap.read() cv2.imshow(frame)<|fim_middle|> cap = cv2.VideoCapture()
code_fim
easy
{ "lang": "python", "repo": "gilbertfrancois/insta_camera", "path": "/main2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- train : np.ndarray, shape=(n_samples,) The train indices test : np.ndarray, shape=(n_samples,) The test indices """ n_samples = frame.shape[0] n_train, n_test = _validate_shuffle_split(n_samples, ...
code_fim
hard
{ "lang": "python", "repo": "vedraiyani/skutil", "path": "/skutil/h2o/split.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vedraiyani/skutil path: /skutil/h2o/split.py frame = check_frame(frame, copy=False) indices = np.arange(frame.shape[0]) for test_index in self._iter_test_masks(frame, y): train_index = indices[np.logical_not(test_index)] test_index = indices[test_in...
code_fim
hard
{ "lang": "python", "repo": "vedraiyani/skutil", "path": "/skutil/h2o/split.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _iter_test_masks(self, frame, y=None): """Generates boolean masks corresponding to the tests set. Parameters ---------- frame : H2OFrame The h2o frame to split y : string, optional (default=None) The column to stratify. Re...
code_fim
hard
{ "lang": "python", "repo": "vedraiyani/skutil", "path": "/skutil/h2o/split.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Metadata(object): def __init__(self, num_groups, data_type, dimension): self.num_groups = num_groups self.data_type = data_type self.dimension = dimension self.groups = dict() def add_group(self, name, path, val_frac): print("group", name) sel...
code_fim
hard
{ "lang": "python", "repo": "liside/Kingpin", "path": "/groupml/process_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def check_hdfs_path(path): return path.startswith("hdfs") class Metadata(object): def __init__(self, num_groups, data_type, dimension): self.num_groups = num_groups self.data_type = data_type self.dimension = dimension self.groups = dict() def add_group(self...
code_fim
hard
{ "lang": "python", "repo": "liside/Kingpin", "path": "/groupml/process_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: liside/Kingpin path: /groupml/process_data.py #Copyright 2020 Side Li, Arun Kumar # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
code_fim
hard
{ "lang": "python", "repo": "liside/Kingpin", "path": "/groupml/process_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Abhijeetv007/Disaster_Pipeline_Project path: /data/data/process_data.py # import libraries import sys import pandas as pd import numpy as n from sqlalchemy import create_engine def load_data(messages_filepath, categories_filepath): """ This function loads the message and categories files...
code_fim
hard
{ "lang": "python", "repo": "Abhijeetv007/Disaster_Pipeline_Project", "path": "/data/data/process_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def main(): if len(sys.argv) == 4: messages_filepath, categories_filepath, database_filepath = sys.argv[1:] print('Loading data...\n MESSAGES: {}\n CATEGORIES: {}' .format(messages_filepath, categories_filepath)) dataframe = load_data(messages_filepath, c...
code_fim
hard
{ "lang": "python", "repo": "Abhijeetv007/Disaster_Pipeline_Project", "path": "/data/data/process_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rajatsharma369007/Stock-Forecast path: /Implementation/div_proj_2 - Modified.py #https://www.youtube.com/watch?v=CQ5kc_j4RjA import pandas as pd #import quandl import math, datetime import time import numpy as np from pandas.tools.plotting import scatter_matrix import matplotlib.pyplot a...
code_fim
hard
{ "lang": "python", "repo": "rajatsharma369007/Stock-Forecast", "path": "/Implementation/div_proj_2 - Modified.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Setting Date Set_Date() #Gap of 1 month in time #n = int(input("Enter the No. of Years in Months:")) start_date += datetime.timedelta(weeks=-100) #Creat a DataFrame Data_frame_Create() #Create Features - X Add_Features_x() #Forecast Forcast_Values() #Label - y Add_Features_y...
code_fim
hard
{ "lang": "python", "repo": "rajatsharma369007/Stock-Forecast", "path": "/Implementation/div_proj_2 - Modified.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hfujikawa/Keras_test path: /jpg2rename_bmp.py # -*- coding: utf-8 -*- """ Created on Sat Oct 20 07:48:47 2018 @author: hfuji """ import os from PIL import Image import glob import shutil src_jpg_dir = 'D:/Develop/data/VOCdevkit/VOC2007/JPEGImages/' dst_bmp_dir = 'D:/Temp/' <|fi...
code_fim
medium
{ "lang": "python", "repo": "hfujikawa/Keras_test", "path": "/jpg2rename_bmp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>cnt = 0 for jpg_file in jpg_files: basename = os.path.basename(jpg_file) if int(basename[:-4]) % 10 == 0: cnt += 1 dirname = os.path.dirname(jpg_file) dirs = dirname.split('/') new_fname = dirs[-2] + '_' + basename[:-4] + '.bmp' dst_bmp_path = dst_bm...
code_fim
medium
{ "lang": "python", "repo": "hfujikawa/Keras_test", "path": "/jpg2rename_bmp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lixiaofeng1993/UIAutomation path: /page/page_zaojiao.py def element_edition_btn(self): return self.find_element(self.edition_btn_loc) delete_small1_btn_loc = ('xpath', '//*[contains(@text, "拖动到此处删除")]') def element_delete_small1_btn(self): return self.find_element(...
code_fim
hard
{ "lang": "python", "repo": "lixiaofeng1993/UIAutomation", "path": "/page/page_zaojiao.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def element_my_home(self): return self.find_element(self.my_home_loc) switch_btn_loc = ('xpath', '//*[contains(@text, "切换")]') # 切换 def click_switch_btn(self): self.click(self.switch_btn_loc) baby_bri_loc = ('xpath', '//*[contains(@text, "宝宝生日:")]') # 宝宝生日: def cl...
code_fim
hard
{ "lang": "python", "repo": "lixiaofeng1993/UIAutomation", "path": "/page/page_zaojiao.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lixiaofeng1993/UIAutomation path: /page/page_zaojiao.py self.click(self.helper_loc) small_help_btn_loc = ('xpath', '//*[@resource-id="com.tencent.mm:id/cx" and @text="小程序助手"]') # 小程序助手 def click_small_help_btn(self): self.click(self.small_help_btn_loc) small_name_l...
code_fim
hard
{ "lang": "python", "repo": "lixiaofeng1993/UIAutomation", "path": "/page/page_zaojiao.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def update(request): totalListing = 0 totalSold = 0 form = SearchBosta() data = { 'totalListing': totalListing, 'totalSold': totalSold, 'countListing': 0, 'countSold': 0, 'form': form } if request.method == 'POST': form = SearchBosta(request.POST) if form.is_valid(): q = form.cleaned_dat...
code_fim
hard
{ "lang": "python", "repo": "osaatcioglu/booliwood", "path": "/main/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: osaatcioglu/booliwood path: /main/views.py from django.shortcuts import render from django.http import HttpResponseRedirect, HttpResponse, Http404, HttpResponseNotAllowed from booli import booliwood from models import add_bosta, get_all_bostas, Bosta from django import forms import time class Bo...
code_fim
hard
{ "lang": "python", "repo": "osaatcioglu/booliwood", "path": "/main/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#finsing the length of the 2 fragments firstFragmentLen = len(firstFragment) secondFragmentLen = len(secondFragment) #printing the original and the split DNA sequence print("the original DNA sequence is", dnaSequence) print("the first fragment is", firstFragment, "and is", firstFragmentLen ,"letters long...
code_fim
hard
{ "lang": "python", "repo": "18bmartin/HelloWorld", "path": "/Restriction fragment lengths.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 18bmartin/HelloWorld path: /Restriction fragment lengths.py #the initial DNA sequence dnaSequence = 'ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT' <|fim_suffix|>#finsing the length of the 2 fragments firstFragmentLen = len(firstFragment) secondFragmentLen = len(secondFragment) #print...
code_fim
hard
{ "lang": "python", "repo": "18bmartin/HelloWorld", "path": "/Restriction fragment lengths.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#printing the original and the split DNA sequence print("the original DNA sequence is", dnaSequence) print("the first fragment is", firstFragment, "and is", firstFragmentLen ,"letters long") print("the second fragment is", secondFragment, "and is", secondFragmentLen,"letters long")<|fim_prefix|># repo: 18...
code_fim
hard
{ "lang": "python", "repo": "18bmartin/HelloWorld", "path": "/Restriction fragment lengths.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: huyan0/lyricbreak path: /Song.py import json import jieba import util from pypinyin import pinyin, Style class Song: def __init__(self, songName, artistName, lyric): self.songName = songName self.artistName = artistName self.lyric = lyric self.phrasePinyinDict...
code_fim
medium
{ "lang": "python", "repo": "huyan0/lyricbreak", "path": "/Song.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> file = open(filename, ("w+","a+")[append],encoding="utf8") json.dump(self.__dict__, file, indent=4, ensure_ascii=False) file.close() def write(self): file = open(self.getSongName(), "w+") file.write(self.getLyric()) file.close()<|fim_prefix|># repo: huy...
code_fim
medium
{ "lang": "python", "repo": "huyan0/lyricbreak", "path": "/Song.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>We have daBcd and ABC. We perform the following operation: Capitalize the letters a and c in so that dABCd. Delete all the remaining lowercase letters in so that ABC. Because we were able to successfully convert to , we print YES on a new line. """ #!/bin/python3 import math import os import ra...
code_fim
hard
{ "lang": "python", "repo": "vitthalpadwal/Python_Program", "path": "/hackerrank/preparation_kit/dynamic_programming/abbrevation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vitthalpadwal/Python_Program path: /hackerrank/preparation_kit/dynamic_programming/abbrevation.py """ You can perform the following operations on the string, : Capitalize zero or more of 's lowercase letters. Delete all of the remaining lowercase letters in . Given two strings, and , determine ...
code_fim
hard
{ "lang": "python", "repo": "vitthalpadwal/Python_Program", "path": "/hackerrank/preparation_kit/dynamic_programming/abbrevation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') q = int(input()) for q_itr in range(q): a = input() b = input() result = abbreviation(a, b) fptr.write(result + '\n') fptr.close()<|fim_prefix|># repo: vitthalpadwal/Python_Program...
code_fim
hard
{ "lang": "python", "repo": "vitthalpadwal/Python_Program", "path": "/hackerrank/preparation_kit/dynamic_programming/abbrevation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>transform_data2(lambda data: data / 5, 10, 15, 22, 30)<|fim_prefix|># repo: sliverz6/Python_Blockchain_Project path: /assignment.py # 1 def transform_data(fn): print(fn(10)) # 2 transform_data(lambda data: data / 5) # 3 def transform_data2(fn, *args): <|fim_middle|> for arg in args: ...
code_fim
hard
{ "lang": "python", "repo": "sliverz6/Python_Blockchain_Project", "path": "/assignment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sliverz6/Python_Blockchain_Project path: /assignment.py # 1 def transform_data(fn): print(fn(10)) # 2 transform_data(lambda data: data / 5) # 3 def transform_data2(fn, *args): for arg in args: print(fn(arg)) <|fim_suffix|> for arg in args: print('Result:...
code_fim
medium
{ "lang": "python", "repo": "sliverz6/Python_Blockchain_Project", "path": "/assignment.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> thisFont = Glyphs.font # frontmost font masterIDs = [m.id for m in thisFont.masters] selectedGlyphs = [l.parent for l in thisFont.selectedLayers] for thisGlyph in selectedGlyphs: for masterID in masterIDs: masterLayer = thisGlyph.layers[masterID] print("Processing %s, layer '...
code_fim
hard
{ "lang": "python", "repo": "NaN-xyz/Glyphs-Scripts", "path": "/Components/Find and Replace Corner Components at Certain Angles.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }