text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: jieuhyl/Dash path: /social_dash/tabs_eg2.py #!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Tue Oct 9 11:12:18 2018 @author: Jie.Hu """ import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output app ...
code_fim
hard
{ "lang": "python", "repo": "jieuhyl/Dash", "path": "/social_dash/tabs_eg2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") def test_charge_success2(): m = openmoltools.openeye.smiles_to_oemol(smiles_fails_with_strictStereo) m = openmoltools.openeye.get_charges(m, strictStereo=False) @skipIf(not HAVE_OE, "Cannot test openeye module without Open...
code_fim
hard
{ "lang": "python", "repo": "choderalab/openmoltools", "path": "/openmoltools/tests/test_openeye.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("input", help="input file path string") parser.add_argument("output", help="output file path string") parser.add_argument("property", help="property name to look for") parser.add_argument("value", help="...
code_fim
medium
{ "lang": "python", "repo": "luftj/geocode_georef", "path": "/eval/extract_layer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: luftj/geocode_georef path: /eval/extract_layer.py #!/bin/python import argparse import json def extract(json, param, value): new_feature_list = [] for idx, feature in enumerate(json["features"]): if param in feature["properties"]: if str(feature["properties"][param])...
code_fim
hard
{ "lang": "python", "repo": "luftj/geocode_georef", "path": "/eval/extract_layer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print("extracting features from",args.input) jsondata = "" with open(args.input) as file: jsondata = json.load(file) jsondata = extract(jsondata, args.property, args.value) with open(args.output,"w") as outfile: outfile.write(json.dumps(jsondata))<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "luftj/geocode_georef", "path": "/eval/extract_layer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Name = models.CharField(max_length=20) Status = models.CharField(max_length=500) Size = models.FloatField() Latitude = models.FloatField() Longitude = models.FloatField()<|fim_prefix|># repo: rf-castle/dragon_rader path: /main/models.py from django.db import models # Create your mode...
code_fim
easy
{ "lang": "python", "repo": "rf-castle/dragon_rader", "path": "/main/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rf-castle/dragon_rader path: /main/models.py from django.db import models # Create your models here. <|fim_suffix|> Name = models.CharField(max_length=20) Status = models.CharField(max_length=500) Size = models.FloatField() Latitude = models.FloatField() Longitude = models.F...
code_fim
easy
{ "lang": "python", "repo": "rf-castle/dragon_rader", "path": "/main/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rf-castle/dragon_rader path: /main/models.py from django.db import models <|fim_suffix|> class User(models.Model): Name = models.CharField(max_length=20) Status = models.CharField(max_length=500) Size = models.FloatField() Latitude = models.FloatField() Longitude = models.Flo...
code_fim
easy
{ "lang": "python", "repo": "rf-castle/dragon_rader", "path": "/main/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pes2009/csv-django-parser path: /csvparser/django_parser/views.py import csv from django.shortcuts import render from .models import CsvList from .forms import UploadForm <|fim_suffix|> context = { "form": form, } return render(request, "django_parser/upload.html", context, ...
code_fim
hard
{ "lang": "python", "repo": "Pes2009/csv-django-parser", "path": "/csvparser/django_parser/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def list(request): queryset = CsvList.objects.order_by('id') context = { "queryset": queryset, } return render(request, "django_parser/list.html", context, )<|fim_prefix|># repo: Pes2009/csv-django-parser path: /csvparser/django_parser/views.py import csv from django.shortcuts im...
code_fim
hard
{ "lang": "python", "repo": "Pes2009/csv-django-parser", "path": "/csvparser/django_parser/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yueyoum/dianjing_editor path: /apps/resources/models.py # -*- coding: utf-8 -*- from django.db import models <|fim_suffix|> return self.name class Meta: db_table = 'resource' verbose_name = "资源" verbose_name_plural = "资源"<|fim_middle|>class Resource(models.Mo...
code_fim
hard
{ "lang": "python", "repo": "yueyoum/dianjing_editor", "path": "/apps/resources/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> db_table = 'resource' verbose_name = "资源" verbose_name_plural = "资源"<|fim_prefix|># repo: yueyoum/dianjing_editor path: /apps/resources/models.py # -*- coding: utf-8 -*- from django.db import models class Resource(models.Model): <|fim_middle|> id = models.CharField(max_length...
code_fim
hard
{ "lang": "python", "repo": "yueyoum/dianjing_editor", "path": "/apps/resources/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __unicode__(self): return self.name class Meta: db_table = 'resource' verbose_name = "资源" verbose_name_plural = "资源"<|fim_prefix|># repo: yueyoum/dianjing_editor path: /apps/resources/models.py # -*- coding: utf-8 -*- from django.db import models <|fim_middl...
code_fim
hard
{ "lang": "python", "repo": "yueyoum/dianjing_editor", "path": "/apps/resources/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def start(self): for i in range(0, len(self.threads)): self.threads[i].start() def post(self, task): self.lock.acquire() self.tasks.append(task) try: self.cv.notify(1) except RuntimeError: print("lock not aqquired") #sho...
code_fim
hard
{ "lang": "python", "repo": "ericyounger/vaccuBot", "path": "/worker_thread.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericyounger/vaccuBot path: /worker_thread.py import threading from random import randint import time class Worker(): def __init__(self, noOfThreads): self.noOfThreads = noOfThreads self.threads = [] self.tasks = [] self.lock = threading.Lock() self.cv...
code_fim
hard
{ "lang": "python", "repo": "ericyounger/vaccuBot", "path": "/worker_thread.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> conferenceid = Column (Integer, Sequence('conferences_conferenceid_seq'), primary_key=True) meeting = Column (String) location = Column (String) def __repr__(self): return "<Conference(meeting='%s', location='%s')>" % (self.meeting, self.location)<|fim_prefix|># repo: robotprogrammer...
code_fim
medium
{ "lang": "python", "repo": "robotprogrammer22/Astro-Budget-Site", "path": "/python/conferences.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return "<Conference(meeting='%s', location='%s')>" % (self.meeting, self.location)<|fim_prefix|># repo: robotprogrammer22/Astro-Budget-Site path: /python/conferences.py from sqlalchemy import Column, Integer, String, Sequence from sqlalchemy.ext.declarative import declarative_ba...
code_fim
hard
{ "lang": "python", "repo": "robotprogrammer22/Astro-Budget-Site", "path": "/python/conferences.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: robotprogrammer22/Astro-Budget-Site path: /python/conferences.py from sqlalchemy import Column, Integer, String, Sequence from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Conferences(Base): <|fim_suffix|> def __repr__(self): return "<Conference(meetin...
code_fim
medium
{ "lang": "python", "repo": "robotprogrammer22/Astro-Budget-Site", "path": "/python/conferences.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> return self.cell_name class Object(models.Model): object_name = models.CharField(max_length = 30) cell = models.ForeignKey(Cell) owner = models.CharField(max_length = 30, default = "admin") def __unicode__(self): return self.object_name<|fim_prefix|># repo: zamanov/Practice path: /serv/models....
code_fim
hard
{ "lang": "python", "repo": "zamanov/Practice", "path": "/serv/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Object(models.Model): object_name = models.CharField(max_length = 30) cell = models.ForeignKey(Cell) owner = models.CharField(max_length = 30, default = "admin") def __unicode__(self): return self.object_name<|fim_prefix|># repo: zamanov/Practice path: /serv/models.py from django.db import mo...
code_fim
medium
{ "lang": "python", "repo": "zamanov/Practice", "path": "/serv/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zamanov/Practice path: /serv/models.py from django.db import models # Create your models here. class Cell(models.Model): <|fim_suffix|>class Object(models.Model): object_name = models.CharField(max_length = 30) cell = models.ForeignKey(Cell) owner = models.CharField(max_length = 30, default =...
code_fim
hard
{ "lang": "python", "repo": "zamanov/Practice", "path": "/serv/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.db.execute('delete from dataset where word=?', (word,)) class MarkovBot: def __init__(self, database): self.db_driver = DatabaseDriver(database) def digest_text(self, text): words = text.split() for i in range(len(words)-1): self.db_driver.insert_...
code_fim
hard
{ "lang": "python", "repo": "eliaskickbush/markovbot", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> words = text.split() for i in range(len(words)-1): self.db_driver.insert_combination(words[i], words[i+1], 1) def build_intervals(self, word_info): total_elements = 0 probs = 0 intervals = [] for i in range(len(word_info)): this...
code_fim
hard
{ "lang": "python", "repo": "eliaskickbush/markovbot", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eliaskickbush/markovbot path: /main.py import sqlite3,random class DatabaseDriver: def __init__(self, name): self.db = sqlite3.connect(f'{name}.db') cur = self.db.cursor() cur.execute("create table if not exists dataset (word STRING, succesor STRING, times INT);") ...
code_fim
hard
{ "lang": "python", "repo": "eliaskickbush/markovbot", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": node5 = TreeNode(7) node4 = TreeNode(4) node3 = TreeNode(12) node2 = TreeNode(5, node4, node5) node1 = TreeNode(10, node2, node3) root = node1 find_path(root, 22)<|fim_prefix|># repo: VCloser/CodingInterviewChinese2-python path: /34_PathInTree.py cl...
code_fim
medium
{ "lang": "python", "repo": "VCloser/CodingInterviewChinese2-python", "path": "/34_PathInTree.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: VCloser/CodingInterviewChinese2-python path: /34_PathInTree.py class TreeNode(object): def __init__(self, value, left=None, right=None): self.value = value self.left = left self.right = right def find_path(root, sums): if not root: return [] path = []...
code_fim
hard
{ "lang": "python", "repo": "VCloser/CodingInterviewChinese2-python", "path": "/34_PathInTree.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasapluscom/PYTHON path: /JASAPLUS.COM TRAINING MATERIALS/tkinter/pack_manager.py #!/usr/bin/env python3 ''' pack_manager.py tkinter pack manager sample for python3 training at www.jasaplus.com ''' from tkinter import Tk,Button, Frame, LEFT, RIGHT, BOTTOM, TOP, RAISED, X, Y, BOTH master = Tk() ...
code_fim
hard
{ "lang": "python", "repo": "jasapluscom/PYTHON", "path": "/JASAPLUS.COM TRAINING MATERIALS/tkinter/pack_manager.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#fill option btn1x = Button(frame2, text="Button 1") btn1x.pack(fill=X) btn1x = Button(frame2, text="Button 1") btn1x.pack(fill=None) master.mainloop()<|fim_prefix|># repo: jasapluscom/PYTHON path: /JASAPLUS.COM TRAINING MATERIALS/tkinter/pack_manager.py #!/usr/bin/env python3 ''' pack_manager.py tkint...
code_fim
hard
{ "lang": "python", "repo": "jasapluscom/PYTHON", "path": "/JASAPLUS.COM TRAINING MATERIALS/tkinter/pack_manager.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mzj14/cs739-project-1 path: /process_performance.py import os out = open('performance.csv', 'w') for nserver in os.listdir("ptest"): wt = 0 rt = 0 wl = 0 rl = 0 correct = True for i, fname in enumerate(os.listdir("ptest/"+nserver+"/")): f = open("ptest/"+nserver+"/"+fna<|fim_suffix|>ens[...
code_fim
hard
{ "lang": "python", "repo": "mzj14/cs739-project-1", "path": "/process_performance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ens[1].split("ms")[0].strip()) elif "read" in tokens[1]: rl += float(tokens[1].split("ms")[0].strip()) rl = rl / float(i+1) wl = wl / float(i+1) out.write("%s,%.6f,%.6f,%.6f,%.6f\n"%(nserver,rt,wt,rl,wl)) out.close()<|fim_prefix|># repo: mzj14/cs739-project-1 path: /process_performance.py imp...
code_fim
hard
{ "lang": "python", "repo": "mzj14/cs739-project-1", "path": "/process_performance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ремя в формате ЧЧ:ММ:СС составляет {hours}:{minutes}:{seconds}")<|fim_prefix|># repo: svet-sham/python path: /HW01/02.py seconds = int(input("Введите количество секунд ")) hours = seconds // 3600 seconds = seconds - (hours * 3600) minutes = seconds <|fim_middle|>// 60 seconds = seconds - (minutes * 60) p...
code_fim
medium
{ "lang": "python", "repo": "svet-sham/python", "path": "/HW01/02.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: svet-sham/python path: /HW01/02.py seconds = int(input("Введите количество секунд ")) hours = seconds // 3600 seconds = seconds - (hours * 3600) minutes = seconds <|fim_suffix|>ремя в формате ЧЧ:ММ:СС составляет {hours}:{minutes}:{seconds}")<|fim_middle|>// 60 seconds = seconds - (minutes * 60) p...
code_fim
medium
{ "lang": "python", "repo": "svet-sham/python", "path": "/HW01/02.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// 60 seconds = seconds - (minutes * 60) print(f"Введеное вами время в формате ЧЧ:ММ:СС составляет {hours}:{minutes}:{seconds}")<|fim_prefix|># repo: svet-sham/python path: /HW01/02.py seconds = int(input("Введите количество секунд ")) hours = secon<|fim_middle|>ds // 3600 seconds = seconds - (hours * 36...
code_fim
medium
{ "lang": "python", "repo": "svet-sham/python", "path": "/HW01/02.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(binary_index, binary_time) linear_start = time.time() linear_index = linear_insert(array, item) linear_time = time.time() - linear_start print(linear_index, linear_time) bilinear_start = time.time() bilinear_index = bilinear_insert(array, item) bilinear_time = time.time() - bilinear_start print(...
code_fim
hard
{ "lang": "python", "repo": "rowbot-dev/rowbot.io", "path": "/test/sort/binary_insert_comparison.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>linear_start = time.time() linear_index = linear_insert(array, item) linear_time = time.time() - linear_start print(linear_index, linear_time) bilinear_start = time.time() bilinear_index = bilinear_insert(array, item) bilinear_time = time.time() - bilinear_start print(bilinear_index, bilinear_time)<|fi...
code_fim
hard
{ "lang": "python", "repo": "rowbot-dev/rowbot.io", "path": "/test/sort/binary_insert_comparison.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rowbot-dev/rowbot.io path: /test/sort/binary_insert_comparison.py import math import random import time d = 10000 array = [i for i in range(d)] item = random.randint(0, d) def binary_insert(array, item): previous = None search_length = math.floor(len(array) / 2) index = search_length ...
code_fim
hard
{ "lang": "python", "repo": "rowbot-dev/rowbot.io", "path": "/test/sort/binary_insert_comparison.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return dict( id=str(user.id), name=user.name, avatar_url=user.avatar_url, avatar_thumb=user.avatar_thumb, num_followers=user.num_followers, num_followings=user.num_followings, is_following=current_user.is_following(user) if current_user and curre...
code_fim
medium
{ "lang": "python", "repo": "FreeGodCode/e-commerce", "path": "/app/services/json_templ/user.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FreeGodCode/e-commerce path: /app/services/json_templ/user.py # -*- coding: utf-8 -*- # @Author: ty # @File name: user.py # @IDE: PyCharm # @Create time: 1/25/21 5:05 PM # @Description: from flask_login import current_user <|fim_suffix|>def get_user_info(user): """ :param user: :r...
code_fim
medium
{ "lang": "python", "repo": "FreeGodCode/e-commerce", "path": "/app/services/json_templ/user.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rinal-Dev02/VoilaCrawler3 path: /src/chameleon/security/identity/service_pb2.py eon.security.identity.ResetRoleRuleRequest\x1a\x16.google.protobuf.Empty\"N\x82\xd3\xe4\x93\x02)\"\'/security/identity/role/{id}/rule/reset\x82\x82\x87\x03\x1a\x08\x02\x12\x16security.identity.role\x12\xa2\x01\n\nDele...
code_fim
hard
{ "lang": "python", "repo": "Rinal-Dev02/VoilaCrawler3", "path": "/src/chameleon/security/identity/service_pb2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rinal-Dev02/VoilaCrawler3 path: /src/chameleon/security/identity/service_pb2.py r._internal_create_key, ), _descriptor.MethodDescriptor( name='AddRule', full_name='chameleon.security.identity.RoleManager.AddRule', index=4, containing_service=None, input_type=chameleon_dot_...
code_fim
hard
{ "lang": "python", "repo": "Rinal-Dev02/VoilaCrawler3", "path": "/src/chameleon/security/identity/service_pb2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_ROLEMANAGER = _descriptor.ServiceDescriptor( name='RoleManager', full_name='chameleon.security.identity.RoleManager', file=DESCRIPTOR, index=0, serialized_options=None, create_key=_descriptor._internal_create_key, serialized_start=262, serialized_end=1392, methods=[ _descriptor.Method...
code_fim
medium
{ "lang": "python", "repo": "Rinal-Dev02/VoilaCrawler3", "path": "/src/chameleon/security/identity/service_pb2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sleep(50 / 1000) print "(False) getting 10 from first: " + str(tokenBuckets.get_from_bucket('first', 10)) + "\n" print "(False) getting 10 from second: " + str(tokenBuckets.get_from_bucket('second', 10)) + "\n"<|fim_prefix|># repo: link108/code_snippets path: /python/token_buckets/TokenBucket...
code_fim
hard
{ "lang": "python", "repo": "link108/code_snippets", "path": "/python/token_buckets/TokenBuckets.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: link108/code_snippets path: /python/token_buckets/TokenBuckets.py __author__ = 'cmotevasselani' from time import sleep from TokenBucket import TokenBucket class TokenBuckets: def __init__(self): <|fim_suffix|> print "bucket has: " + str(self.buckets[bucket_name].token_count) ...
code_fim
hard
{ "lang": "python", "repo": "link108/code_snippets", "path": "/python/token_buckets/TokenBuckets.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='product', name='name', field=models.CharField(max_length=300), ), ]<|fim_prefix|># repo: jean-charles-gibier/mysandbox path: /pur_beurre/product/migrations/0004_auto_20200806_2336.py # Generated ...
code_fim
medium
{ "lang": "python", "repo": "jean-charles-gibier/mysandbox", "path": "/pur_beurre/product/migrations/0004_auto_20200806_2336.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jean-charles-gibier/mysandbox path: /pur_beurre/product/migrations/0004_auto_20200806_2336.py # Generated by Django 3.0.8 on 2020-08-06 21:36 <|fim_suffix|> dependencies = [ ('product', '0003_product_nutrition_grade'), ] operations = [ migrations.AlterField( ...
code_fim
medium
{ "lang": "python", "repo": "jean-charles-gibier/mysandbox", "path": "/pur_beurre/product/migrations/0004_auto_20200806_2336.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('product', '0003_product_nutrition_grade'), ] operations = [ migrations.AlterField( model_name='product', name='name', field=models.CharField(max_length=300), ), ]<|fim_prefix|># repo: jean-charles-gibier/mysan...
code_fim
medium
{ "lang": "python", "repo": "jean-charles-gibier/mysandbox", "path": "/pur_beurre/product/migrations/0004_auto_20200806_2336.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for alumno in alumnos: alumno = alumno + " IEST" print(alumno) for i in range(10,1001,4): print (i)<|fim_prefix|># repo: apad20/parcial2 path: /iterables.py #No es mutable tupla = ("Hola",7,7.928289,True, ("Tupla",2)) #Acceso a los elementos de una tupla #print(tupla[4][1]) #Si es mutable ...
code_fim
medium
{ "lang": "python", "repo": "apad20/parcial2", "path": "/iterables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: apad20/parcial2 path: /iterables.py #No es mutable tupla = ("Hola",7,7.928289,True, ("Tupla",2)) <|fim_suffix|>#Si es mutable lista = ["Hola",7,7.928289,True, ["Tupla",2]] #Acceso a los elementos de una lista #print(lista[4][1]) alumnos = ("Alejandro", "Ana Abigail", "Andrea", "Karime", "Eric"...
code_fim
easy
{ "lang": "python", "repo": "apad20/parcial2", "path": "/iterables.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>alumnos = ("Alejandro", "Ana Abigail", "Andrea", "Karime", "Eric", "Josue") for alumno in alumnos: alumno = alumno + " IEST" print(alumno) for i in range(10,1001,4): print (i)<|fim_prefix|># repo: apad20/parcial2 path: /iterables.py #No es mutable tupla = ("Hola",7,7.928289,True, ("Tupla",2...
code_fim
easy
{ "lang": "python", "repo": "apad20/parcial2", "path": "/iterables.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: twaun95/Algorithm path: /다이나믹프로그래밍/1로만들기.py x = int(input()) dp = [0]*30001 <|fim_suffix|>for i in range(2,x+1): dp[i] = dp[i-1] + 1 if i%2 == 0: dp[i] = min(dp[i],dp[i//2]+1) if i%3 == 0: dp[i] = min(dp[i],dp[i//3]+1) if i%5 == 0: dp[i] = min(dp[i],dp[i/...
code_fim
easy
{ "lang": "python", "repo": "twaun95/Algorithm", "path": "/다이나믹프로그래밍/1로만들기.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(2,x+1): dp[i] = dp[i-1] + 1 if i%2 == 0: dp[i] = min(dp[i],dp[i//2]+1) if i%3 == 0: dp[i] = min(dp[i],dp[i//3]+1) if i%5 == 0: dp[i] = min(dp[i],dp[i//5]+1) print(dp[x])<|fim_prefix|># repo: twaun95/Algorithm path: /다이나믹프로그래밍/1로만들기.py x = int(i...
code_fim
easy
{ "lang": "python", "repo": "twaun95/Algorithm", "path": "/다이나믹프로그래밍/1로만들기.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list_of_names = [str(c) for c in self.__list_of_contacts] joined_names = ', '.join(list_of_names) table = [[str(self._title)],["Date: "+str(self._date)],["Time: "+str(self._start)+" - "+str(self._end)],["Participants: "+str(joined_names)]] print(tabulate(table, tablefmt='gr...
code_fim
medium
{ "lang": "python", "repo": "sarwar1995/calendarCLI", "path": "/Meeting.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarwar1995/calendarCLI path: /Meeting.py #Sarwar Hussain from tabulate import tabulate from Event import Event from Contact import Contact class Meeting (Event): def __init__(self, title='default event', date='01-01-2020', start_time='00:00', end_time='24:00', list_of_contacts=None): <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "sarwar1995/calendarCLI", "path": "/Meeting.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('send', '0004_data_jid'), ] operations = [ migrations.AlterField( model_name='data', name='jid', field=models.CharField(default=0, max_length=20), ), ]<|fim_prefix|># repo: AakashKhatu/Road-Comfort-Level path:...
code_fim
medium
{ "lang": "python", "repo": "AakashKhatu/Road-Comfort-Level", "path": "/here/send/migrations/0005_auto_20190727_2145.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AakashKhatu/Road-Comfort-Level path: /here/send/migrations/0005_auto_20190727_2145.py # Generated by Django 2.1.7 on 2019-07-27 16:15 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='data', name='jid', ...
code_fim
medium
{ "lang": "python", "repo": "AakashKhatu/Road-Comfort-Level", "path": "/here/send/migrations/0005_auto_20190727_2145.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Phlix1/tensorflow-communication-analysis path: /opMgr.py from op import op import re import pickle import Constants from utils import * import os class opMgr: def __init__(self): self.op_dict = {} def add_from_graph(self, graph_def): comm_node_index = 0 for node in...
code_fim
hard
{ "lang": "python", "repo": "Phlix1/tensorflow-communication-analysis", "path": "/opMgr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with open(save_path,'rb') as f: save_list = pickle.load(f) for opinfo in save_list: opitem = op() opitem.deserialize_op(opinfo) self.op_dict[opitem.op_name] = opitem def ops_show(self): count = 0 for key in self.op_di...
code_fim
hard
{ "lang": "python", "repo": "Phlix1/tensorflow-communication-analysis", "path": "/opMgr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": vpp_data = read_vpp_file(sys.argv[1]) #time = [x['time'] for x in vpp_data] vec_rtt = get_time_series(vpp_data, 'vec') single_ts_rtt = get_time_series(vpp_data, 'single_ts') all_ts_rtt = get_time_series(vpp_data, 'all_ts') #print(vec_rtt) ## ##...
code_fim
hard
{ "lang": "python", "repo": "mami-project/three-bits-suffice", "path": "/tcp/scripts/analyze_vpp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mami-project/three-bits-suffice path: /tcp/scripts/analyze_vpp.py #!/usr/bin/python3 import sys import csv import math import collections import pickle import copy import functools import os import os.path import shutil import matplotlib.pyplot as plt def save_figure(figure, filename): pri...
code_fim
hard
{ "lang": "python", "repo": "mami-project/three-bits-suffice", "path": "/tcp/scripts/analyze_vpp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> errors = list() times = list() time_cursor = None current_error = None A_ready = False B_ready = False for row in vpp_data: ## skip forward to point where there is ## data for both analyzers if (not A_ready) or (not B_ready): if row[analyze...
code_fim
hard
{ "lang": "python", "repo": "mami-project/three-bits-suffice", "path": "/tcp/scripts/analyze_vpp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def getfactors(num): factors = [] fac = 2 while num > 1: if fac > 3: if (fac + 1) % 6 == 0 or (fac - 1) % 6 == 0: while num % fac == 0: factors.append(fac) num /= fac else: while num % fac == 0: ...
code_fim
hard
{ "lang": "python", "repo": "mathewspmani/projectEuler", "path": "/03largestPrimeFactor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathewspmani/projectEuler path: /03largestPrimeFactor.py # -*- coding: utf-8 -*- """ Created on Fri Aug 24 10:56:28 2018 @author: mathewspmani """ <|fim_suffix|> factors = [] fac = 2 while num > 1: while num % fac == 0: factors.append(fac) num /= fac ...
code_fim
medium
{ "lang": "python", "repo": "mathewspmani/projectEuler", "path": "/03largestPrimeFactor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hpcgam/dicomimport path: /doc-dcm/SAMPLEZ/albertca-NanScan-cd0decd/NanScan/TemporaryFile.py import tempfile import os ## @brief Simplify the task of creating and managing temporary files in a # secure manner. # # Although python already provides functions for creating temporary files # in nans...
code_fim
hard
{ "lang": "python", "repo": "hpcgam/dicomimport", "path": "/doc-dcm/SAMPLEZ/albertca-NanScan-cd0decd/NanScan/TemporaryFile.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if TemporaryFile.directory: shutils.rmtree( TemporaryFile.directory ) ## @brief Remove the given file @staticmethod def remove(path): os.unlink(path)<|fim_prefix|># repo: hpcgam/dicomimport path: /doc-dcm/SAMPLEZ/albertca-NanScan-cd0decd/NanScan/TemporaryFile.py import tempfile import os ## @...
code_fim
medium
{ "lang": "python", "repo": "hpcgam/dicomimport", "path": "/doc-dcm/SAMPLEZ/albertca-NanScan-cd0decd/NanScan/TemporaryFile.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>router = routers.DefaultRouter(trailing_slash=False) router.register(r'tasks', TaskView, base_name='tasks') router.register(r'sessions', SessionView, base_name='sessions') urlpatterns = router.urls<|fim_prefix|># repo: TannerBurns/factory path: /factory/urls.py from django.conf.urls import url from djang...
code_fim
easy
{ "lang": "python", "repo": "TannerBurns/factory", "path": "/factory/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TannerBurns/factory path: /factory/urls.py from django.conf.urls import url from django.urls import path <|fim_suffix|>router = routers.DefaultRouter(trailing_slash=False) router.register(r'tasks', TaskView, base_name='tasks') router.register(r'sessions', SessionView, base_name='sessions') urlpa...
code_fim
medium
{ "lang": "python", "repo": "TannerBurns/factory", "path": "/factory/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pgv123/Pi-Python-Controller path: /scoreboard.py #scoreboard #AusSport user defined functions import os import json import datetime from time import time, ctime, sleep import pigpio as GPIO import s_data from array import array #import pygame #from pygame.mixer import Sound, get_init, pre_init ...
code_fim
hard
{ "lang": "python", "repo": "pgv123/Pi-Python-Controller", "path": "/scoreboard.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i2c_settings = s1['i2c']['port_settings'] offset = s1['i2c']['offset'] colreg = s1['i2c']['col_reg'] for k,v in i2c_settings.items(): this_port = s_data.get_i2c_port(s1,k) #send all the values for this port for k, v in this_port.items(): p_val = v['i2c_port'] chan = i2c_settings[p_val]['ch...
code_fim
hard
{ "lang": "python", "repo": "pgv123/Pi-Python-Controller", "path": "/scoreboard.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #logging.debug("sending message %s" %msg) cls.lock.acquire() try: for conn in cls.connections: try: conn.write_message(msg) except: logging.error("Error sending message",exc_info=True) finally: cls....
code_fim
hard
{ "lang": "python", "repo": "y12studio/pi", "path": "/testonly/motion_pushover/motion_pushover.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def isMotion4(kl): return len(kl)==4 and kl[1]-kl[0] > 777 and kl[2] > 1000 and kl[3] > 1000 def handleMotion(k,q): if isMotion4(k): ediff = time.time() - lastEvtTime logging.debug("EvtTimeDiff=%d" % ediff) if ediff > 300: found(q) def startTornado(): http...
code_fim
hard
{ "lang": "python", "repo": "y12studio/pi", "path": "/testonly/motion_pushover/motion_pushover.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: y12studio/pi path: /testonly/motion_pushover/motion_pushover.py # coding=utf-8 ''' pi@raspberrypi ~ $ echo $LANG zh_TW.UTF-8 https://github.com/ashtons/picam url http://host:port/s/foo_webapp.html ''' import settings import picam import logging,threading import datetime,time import Image import...
code_fim
hard
{ "lang": "python", "repo": "y12studio/pi", "path": "/testonly/motion_pushover/motion_pushover.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vanstrn/Robot path: /launch/launch_controller.py import os import sys from typing import cast sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # noqa import launch from launch.actions import IncludeLaunchDescription, ExecuteProcess from launch.launch_description_sources import ...
code_fim
hard
{ "lang": "python", "repo": "vanstrn/Robot", "path": "/launch/launch_controller.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Disable tty emulation (on by default). ld.add_action(launch.actions.SetLaunchConfiguration('emulate_tty', 'false')) # Wire up stdout from processes def on_output(event: launch.Event) -> None: for line in event.text.decode().splitlines(): print('[{}] {}'.format( ...
code_fim
medium
{ "lang": "python", "repo": "vanstrn/Robot", "path": "/launch/launch_controller.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return response async def loop(self): # tasks will contain asynchronous tasks to be executed at once, asynchronously # in this case, they will contain the requests to the endpoints pages = [] # type: List[Page] tasks = [] # List[Coroutine] # create a ...
code_fim
hard
{ "lang": "python", "repo": "berton7/kek-monitors", "path": "/demo/footdistrict_scraper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: berton7/kek-monitors path: /demo/footdistrict_scraper.py import asyncio from typing import List from bs4 import BeautifulSoup from fake_headers import Headers from pyppeteer import launch from pyppeteer.network_manager import Response from pyppeteer.page import Page from kekmonitors.base_scrape...
code_fim
hard
{ "lang": "python", "repo": "berton7/kek-monitors", "path": "/demo/footdistrict_scraper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>{:<12} {:<12} {:<12} {:<12}".format(*my_var))<|fim_prefix|># repo: suchitrarajagopalan/pynet_test path: /str_ex2.py #!/usr/bin/env python from __future__ import print_function my_var = input("enter an IP <|fim_middle|>address") my_var = my_var.split(".") print("
code_fim
easy
{ "lang": "python", "repo": "suchitrarajagopalan/pynet_test", "path": "/str_ex2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: suchitrarajagopalan/pynet_test path: /str_ex2.py #!/usr/bin/env python from __future__ import<|fim_suffix|>address") my_var = my_var.split(".") print("{:<12} {:<12} {:<12} {:<12}".format(*my_var))<|fim_middle|> print_function my_var = input("enter an IP
code_fim
easy
{ "lang": "python", "repo": "suchitrarajagopalan/pynet_test", "path": "/str_ex2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gustavo-momente/text_classifcation path: /Features.py #!/usr/bin/env python # -*- coding: utf-8 -*- import datetime __author__ = 'Usuário' import gensim.matutils import numpy as np from Parser import * from Filter import * from Cleaner import * from Learners import * from stopwords import * im...
code_fim
hard
{ "lang": "python", "repo": "gustavo-momente/text_classifcation", "path": "/Features.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print "Getting features..." tf_idfer = SklearnTfIdf(cbow_corpus, idf=False, only_presence=False, norm=normalization) X = tf_idfer.get_features() print no_below, no_above, X.shape[-1] ...
code_fim
hard
{ "lang": "python", "repo": "gustavo-momente/text_classifcation", "path": "/Features.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zachgoins/PropaGator path: /control/path_planner/src/buoy_navigation.py #!/usr/bin/env python import roslib roslib.load_manifest('path_planner') import rospy import actionlib from uf_common.msg import MoveToAction, MoveToGoal from visualization_msgs.msg import Marker,MarkerArray from nav_msgs.m...
code_fim
hard
{ "lang": "python", "repo": "zachgoins/PropaGator", "path": "/control/path_planner/src/buoy_navigation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def send_waypoint_wait(point,orientation): waypoint.send_goal_and_wait(current_pose_editor.relative(numpy.array([point[0], point[1], 0])).as_MoveToGoal(speed = .2)) def send_waypoint(point,orientation): waypoint.send_goal(current_pose_editor.relative(numpy.array([point[0], point[1], 0])).as_MoveT...
code_fim
hard
{ "lang": "python", "repo": "zachgoins/PropaGator", "path": "/control/path_planner/src/buoy_navigation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global current_position,current_pose_editor current_pose_editor = PoseEditor.from_Odometry(msg) current_position = (msg.pose.pose.position.x,msg.pose.pose.position.y) rospy.Subscriber('/odom', Odometry, pose_callback) def ecef_callback(msg): global ecef_position ecef_position = [msg.p...
code_fim
hard
{ "lang": "python", "repo": "zachgoins/PropaGator", "path": "/control/path_planner/src/buoy_navigation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for r in range(1, 127): # exclude first and last row for c in range(8): cid = r * 8 + c # find id missing if cid + 1 in allid and cid - 1 in allid and cid not in allid: return cid print(solve(lines))<|fim_prefix|># repo: pickdani/aoc2020-pyt...
code_fim
hard
{ "lang": "python", "repo": "pickdani/aoc2020-python", "path": "/5/b.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pickdani/aoc2020-python path: /5/b.py lines = [x.strip() for x in open('input').read().splitlines()] def solve(lines): ids = {} # map (r,c) to id for line in lines: # find row lo = 0 hi = 127 for c in line[:7]: m = (lo + hi) // 2 ...
code_fim
hard
{ "lang": "python", "repo": "pickdani/aoc2020-python", "path": "/5/b.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # updating the roots array using index for num in range(n+1): self.find(num) ans = [] for a, b in queries: ans.append(self.roots[a] == self.roots[b]) return ans def find(self,x): if self.roots[x] == x: retur...
code_fim
hard
{ "lang": "python", "repo": "akimi-yano/algorithm-practice", "path": "/lc/1627.GraphConnectivityWithThreshol.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: akimi-yano/algorithm-practice path: /lc/1627.GraphConnectivityWithThreshol.py # 1627. Graph Connectivity With Threshold # Hard # 57 # 9 # Add to List # Share # We have n cities labeled from 1 to n. Two different cities with labels x and y are directly connected by a bidirectional road if and ...
code_fim
hard
{ "lang": "python", "repo": "akimi-yano/algorithm-practice", "path": "/lc/1627.GraphConnectivityWithThreshol.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavidCarricondo/Diamond-prices-ML-Kaggle-competition path: /src/Cleaning_functions.py import pandas as pd import numpy as np from scipy import stats from sklearn.preprocessing import StandardScaler def categorize(df, columns, values,remove=True, ordered=True): <|fim_suffix|> ''' Convert ...
code_fim
hard
{ "lang": "python", "repo": "DavidCarricondo/Diamond-prices-ML-Kaggle-competition", "path": "/src/Cleaning_functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> scaler = StandardScaler() scale_feat = scaler.fit_transform(df[columns]) new_df = pd.DataFrame(scale_feat, columns=[c+'_st' for c in columns]) if remove: df.drop(columns, axis=1, inplace=True) return pd.concat([df, new_df], axis=1, sort=False)<|fim_prefix|># repo: DavidCarricon...
code_fim
hard
{ "lang": "python", "repo": "DavidCarricondo/Diamond-prices-ML-Kaggle-competition", "path": "/src/Cleaning_functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: QuixoteSystems/py-cardano-explorer path: /tests/test_cnft_io.py #!/usr/bin/env python import os import unittest import pandas as pd from cardano_explorer import blockfrost_api from cardano_explorer.blockfrost import util from cardano_explorer import cnft_io # Check if the Blockfrost API Key is ...
code_fim
medium
{ "lang": "python", "repo": "QuixoteSystems/py-cardano-explorer", "path": "/tests/test_cnft_io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_policy(self): self.assertTrue(isinstance(cnft_io.verified_policies(), list)) self.assertTrue(isinstance(cnft_io.get_policy_id('Clay Nation by Clay Mates'), list)) self.assertTrue(cnft_io.check_policy_id(policy_id, 'Clay Nation by Clay Mates'), list) self.assert...
code_fim
medium
{ "lang": "python", "repo": "QuixoteSystems/py-cardano-explorer", "path": "/tests/test_cnft_io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if getattr(renderable, 'alert', ''): fmtmap['alert'] = renderable.alert else: fmtmap['alert'] = "; ".join(extras['errors'][renderable.bind]) else: fmtmap['alert'] = '' if "extra_classes" in fmtmap: fmtmap['e...
code_fim
hard
{ "lang": "python", "repo": "wyldebeast-wunderliebe/w20e.forms", "path": "/w20e/forms/rendering/baserenderer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if "extra_classes" in fmtmap: fmtmap['extra_classes'] = " ".join([fmtmap['extra_classes']] + \ [key for key in list(extra_classes.keys()) if ex...
code_fim
hard
{ "lang": "python", "repo": "wyldebeast-wunderliebe/w20e.forms", "path": "/w20e/forms/rendering/baserenderer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyldebeast-wunderliebe/w20e.forms path: /w20e/forms/rendering/baserenderer.py from builtins import str from builtins import object import re from w20e.forms.registry import Registry # Expression for variable subsitution in labels and hints VAREXP = re.compile('\$\{[^\}]+\}') def cache(func): ...
code_fim
hard
{ "lang": "python", "repo": "wyldebeast-wunderliebe/w20e.forms", "path": "/w20e/forms/rendering/baserenderer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 21eleven/leetcode-solutions path: /python/0022_generate_parentheses/bottomup.py """ 22. Generate Parentheses Medium Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","(...
code_fim
hard
{ "lang": "python", "repo": "21eleven/leetcode-solutions", "path": "/python/0022_generate_parentheses/bottomup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> chk = 0 for c in s: if c == ")": chk -= 1 else: chk += 1 if chk < 0: return False if chk == 0: return True else: retu...
code_fim
hard
{ "lang": "python", "repo": "21eleven/leetcode-solutions", "path": "/python/0022_generate_parentheses/bottomup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> max_size = max(max_size, dp_matrix[i][j]) return max_size size,contour = openfile("contour.txt") n = findsize(contour,size) print("file loaded!") print("Luas maksimum Krasti Krab yang dapat dibangun adalah", n*n)<|fim_prefix|># repo: prisilamichelle/Seleksi-1-Asisten-LabPro-2018 path: /...
code_fim
hard
{ "lang": "python", "repo": "prisilamichelle/Seleksi-1-Asisten-LabPro-2018", "path": "/src/5-Problem12.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prisilamichelle/Seleksi-1-Asisten-LabPro-2018 path: /src/5-Problem12.py #Prisila Michelle - 13516129 import sys,os def openfile(filename): #fungsi untuk membaca file with open(os.path.join(sys.path[0], filename), 'r') as file: size = int(file.readline()) matrix = [] for i in rang...
code_fim
medium
{ "lang": "python", "repo": "prisilamichelle/Seleksi-1-Asisten-LabPro-2018", "path": "/src/5-Problem12.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyrilvincent/DL path: /data/humanactivity/04_activity_lstm.py import numpy as np import pandas as pd import sklearn import sklearn.preprocessing import scipy import tensorflow.keras as keras df = pd.read_csv('WISDM_clean.csv') df_train = df[df['user_id'] <= 30] df_test = df[df['user_id'] > 30] ...
code_fim
hard
{ "lang": "python", "repo": "cyrilvincent/DL", "path": "/data/humanactivity/04_activity_lstm.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>enc = enc.fit(y_train) y_train = enc.transform(y_train) y_test = enc.transform(y_test) model = keras.Sequential() model.add( keras.layers.Bidirectional( keras.layers.LSTM( units=128, input_shape=[X_train.shape[1], X_train.shape[2]] ) ) ) model.add(keras.layers.Dro...
code_fim
hard
{ "lang": "python", "repo": "cyrilvincent/DL", "path": "/data/humanactivity/04_activity_lstm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bulmasen/learn-to-program path: /GB_LearnProgramming/Python_Programming/lesson-03/homeWork-lesson03-6.py # Реализовать функцию str_cap(), принимающую слово из маленьких латинских букв и возвращающую его же, но с прописной # первой буквой. Например, print(str_cap(‘text’)) -> Text. # Продолжить раб...
code_fim
hard
{ "lang": "python", "repo": "bulmasen/learn-to-program", "path": "/GB_LearnProgramming/Python_Programming/lesson-03/homeWork-lesson03-6.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }