text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: JmfanBU/F1tenth_BU path: /racecar_simulator/racecar_control/scripts/keyboard_teleop.py #!/usr/bin/env python import rospy from racecar_control.msg import drive_param import curses forward = 0; left = 0; stdscr = curses.initscr() curses.cbreak() stdscr.keypad(1) rospy.init_node('keyop', anonym...
code_fim
medium
{ "lang": "python", "repo": "JmfanBU/F1tenth_BU", "path": "/racecar_simulator/racecar_control/scripts/keyboard_teleop.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> key = stdscr.getch() stdscr.refresh() if key == curses.KEY_UP: forward = forward + 1; if forward >= 40: forward = 40 elif forward < -40: forward = -40 stdscr.addstr(2, 20, "Up ") stdscr.addstr(2, 25, '%.2f' % forward) stdscr.addstr(5, 20, " ") elif key == curses.KEY_DOWN: for...
code_fim
medium
{ "lang": "python", "repo": "JmfanBU/F1tenth_BU", "path": "/racecar_simulator/racecar_control/scripts/keyboard_teleop.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mua2010/CS589 path: /_hw3/hw3/Submission/Code/Template_Stacking.py # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import ( StackingClassifier, RandomForestClassifier ) import pandas as pd from sklearn.metrics import f1_score # feel free ...
code_fim
medium
{ "lang": "python", "repo": "mua2010/CS589", "path": "/_hw3/hw3/Submission/Code/Template_Stacking.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> np.random.seed(0) train_X, train_y, test_X, test_y = load_data() # Stacking models: # Create your stacked model using StackingClassifier base_models = [ ('rfc', RandomForestClassifier()), ('svm', SVC()), ('gnb', GaussianNB()), ('knc', KNeighborsClas...
code_fim
medium
{ "lang": "python", "repo": "mua2010/CS589", "path": "/_hw3/hw3/Submission/Code/Template_Stacking.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return train_X, train_y, test_X, test_y def main(): np.random.seed(0) train_X, train_y, test_X, test_y = load_data() # Stacking models: # Create your stacked model using StackingClassifier base_models = [ ('rfc', RandomForestClassifier()), ('svm', SVC()), ...
code_fim
medium
{ "lang": "python", "repo": "mua2010/CS589", "path": "/_hw3/hw3/Submission/Code/Template_Stacking.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> re1 = "" re2 = "" for i in range(len(A)): if A[i] != B[i]: re1 += A[i] re2 += B[i] if len(re1) == len(re2) == 2 and re1 == re2[::-1]: return True return False<|fim_prefix|># repo: Ep...
code_fim
hard
{ "lang": "python", "repo": "EpsilonHF/Leetcode", "path": "/Python/859.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EpsilonHF/Leetcode path: /Python/859.py """ Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: <|fim_suffix|> if A == B and len(A) > len(set(A)): return True ...
code_fim
hard
{ "lang": "python", "repo": "EpsilonHF/Leetcode", "path": "/Python/859.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mindik/project1 path: /helpers.py #This is a file from CS50 Finance from functools import wraps from flask import redirect, render_template, session from threading import Thread from flask_mail import Message from application import app, mail ALLOWED_EXTENSIONS = {"png", "PNG", "jpg", "jpeg", "...
code_fim
hard
{ "lang": "python", "repo": "Mindik/project1", "path": "/helpers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def send_mail(subject, recipient, template, **kwargs): msg = Message(subject, recipients=[recipient]) msg.html = render_template(template, **kwargs) thr = Thread(target=async_send_mail, args=[app, msg]) thr.start() return thr<|fim_prefix|># repo: Mindik/project1 path: /helpers.py #Thi...
code_fim
hard
{ "lang": "python", "repo": "Mindik/project1", "path": "/helpers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Disabled = "disabled", Basic = "basic", Enhanced = "enhanced", UnknownFutureValue = "unknownFutureValue",<|fim_prefix|># repo: microsoftgraph/msgraph-sdk-python path: /msgraph/generated/models/image_tagging_choice.py from enum import Enum <|fim_middle|>class ImageTaggingChoice(str, Enum)...
code_fim
easy
{ "lang": "python", "repo": "microsoftgraph/msgraph-sdk-python", "path": "/msgraph/generated/models/image_tagging_choice.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoftgraph/msgraph-sdk-python path: /msgraph/generated/models/image_tagging_choice.py from enum import Enum <|fim_suffix|> Disabled = "disabled", Basic = "basic", Enhanced = "enhanced", UnknownFutureValue = "unknownFutureValue",<|fim_middle|>class ImageTaggingChoice(str, Enum)...
code_fim
easy
{ "lang": "python", "repo": "microsoftgraph/msgraph-sdk-python", "path": "/msgraph/generated/models/image_tagging_choice.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> verbose_name = _('cigarette') verbose_name_plural = _('cigarettes') def __unicode__(self): return u'%s' % ( self.pk) def get_cigarette_user_id(self): "Returns the user id who smoked the cigarette" return self.cigarette_user.pk def get_date(self): ...
code_fim
hard
{ "lang": "python", "repo": "d-t/quitbit", "path": "/quitbit/apps/qb_main/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "Returns the id of the parent comment" return self.parent_comment.pk def set_parent_comment(parent_comment): self.starting_comment = parent_comment # Entity Cigarette class Cigarette(models.Model): """ Cigarette smoked by a user """ # User - Foreign key ...
code_fim
hard
{ "lang": "python", "repo": "d-t/quitbit", "path": "/quitbit/apps/qb_main/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: d-t/quitbit path: /quitbit/apps/qb_main/models.py from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _ from model_utils.models import TimeStampedModel user = settings.AUTH_USER_MODEL commment_lenght = settings.COMMENT_LENGTH # En...
code_fim
hard
{ "lang": "python", "repo": "d-t/quitbit", "path": "/quitbit/apps/qb_main/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SlapOS/slapos.core path: /master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputeNode_reportComputeNodeConsumption.py from zExceptions import Unauthorized if REQUEST is not None: raise Unauthorized portal = context.getPortalObject() compute_node = context <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "SlapOS/slapos.core", "path": "/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputeNode_reportComputeNodeConsumption.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>reference = "TIOCONS-%s-%s" % (compute_node.getReference(), source_reference) version = "%s" % context.getPortalObject().portal_ids.generateNewId( id_group=('slap_tioxml_consumption_reference', reference), default=1) document = portal.consumption_document_module.newContent( portal_type="Computer Cons...
code_fim
medium
{ "lang": "python", "repo": "SlapOS/slapos.core", "path": "/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/ComputeNode_reportComputeNodeConsumption.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Robbie-Cook/cosc470Assignment2 path: /test_conflict-20180923-152216.py import numpy as np # Read in training data and labels # Some useful parsing functions # male/female -> 0/1 def parseSexLabel(string): if (string.startswith('male')): return 0 if (string.startswith('female'))...
code_fim
hard
{ "lang": "python", "repo": "Robbie-Cook/cosc470Assignment2", "path": "/test_conflict-20180923-152216.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' import tensorflow as tf from tensorflow import keras batch_size = 128 epochs = 12 x_train = trainingFaces y_...
code_fim
hard
{ "lang": "python", "repo": "Robbie-Cook/cosc470Assignment2", "path": "/test_conflict-20180923-152216.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: C-Wood4357/AdventOfCode2020 path: /10/10-2.py from functools import reduce with open("input.txt") as f: numbers = f.read().split("\n") n = sorted(list(map(lambda x: int(x), numbers))) n.insert(0, 0) n.append(n[-1] + 3) target = n[-1] memoize = {} <|fim_suffix|> if number == target: ...
code_fim
medium
{ "lang": "python", "repo": "C-Wood4357/AdventOfCode2020", "path": "/10/10-2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if number == target: return 1 if number in memoize.keys(): return memoize[number] paths = 0 if number + 1 in n: paths += part2(number + 1) if number + 2 in n: paths += part2(number + 2) if number + 3 in n: paths += part2(number + 3) memoi...
code_fim
medium
{ "lang": "python", "repo": "C-Wood4357/AdventOfCode2020", "path": "/10/10-2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': # 图像加载 image = Image.open('../datas/xiaoren.png') # 图像转换为numpy数组 img = np.asarray(image) print(img.shape) # 构建一个新的图像 imageNew = np.zeros((600,100,3)) imageNew = imageNew.astype(np.uint8) misc.imsave('m.png',imageNew)<|fim_prefix|># repo: zlwm...
code_fim
medium
{ "lang": "python", "repo": "zlwmzh/pythonLearn", "path": "/ai_sklearn/0626/01_压缩相关知识.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 构建一个新的图像 imageNew = np.zeros((600,100,3)) imageNew = imageNew.astype(np.uint8) misc.imsave('m.png',imageNew)<|fim_prefix|># repo: zlwmzh/pythonLearn path: /ai_sklearn/0626/01_压缩相关知识.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/6/26 16:11 # @Author : Micky # @Site ...
code_fim
hard
{ "lang": "python", "repo": "zlwmzh/pythonLearn", "path": "/ai_sklearn/0626/01_压缩相关知识.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zlwmzh/pythonLearn path: /ai_sklearn/0626/01_压缩相关知识.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/6/26 16:11 # @Author : Micky # @Site : # @File : 01_压缩相关知识.py # @Software: PyCharm <|fim_suffix|> # 构建一个新的图像 imageNew = np.zeros((600,100,3)) imageNew = image...
code_fim
hard
{ "lang": "python", "repo": "zlwmzh/pythonLearn", "path": "/ai_sklearn/0626/01_压缩相关知识.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='optionvoting', name='totalVotes', ), migrations.AddField( model_name='mcqoption', name='totalVotes', field=models.IntegerField(default=0), ), ]<|fim_prefix...
code_fim
medium
{ "lang": "python", "repo": "almahdiy/IT_PDP_Conference", "path": "/API/PDPAPI/migrations/0012_auto_20181105_1200.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: almahdiy/IT_PDP_Conference path: /API/PDPAPI/migrations/0012_auto_20181105_1200.py # Generated by Django 2.1.2 on 2018-11-05 12:00 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.RemoveField( model...
code_fim
medium
{ "lang": "python", "repo": "almahdiy/IT_PDP_Conference", "path": "/API/PDPAPI/migrations/0012_auto_20181105_1200.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chad-Mowbray/FAQ_Creator path: /components/bases/DataFrameCreatorBase.py import sys import pandas as pd from components.helpers.Logger import Logger class DataFrameCreatorBase: """ DataFrameCreatorBase """ START_DATE = "03/16/2020" def __init__(self, input_file): <|fim_su...
code_fim
medium
{ "lang": "python", "repo": "Chad-Mowbray/FAQ_Creator", "path": "/components/bases/DataFrameCreatorBase.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self._input_file = input_file self.df = self._read_raw_csv() self._clean_df() def __new__(cls, *args, **kwargs): if not hasattr(cls, 'instance'): cls.instance = super().__new__(cls) return cls.instance def _read_raw_csv(self): try: ...
code_fim
medium
{ "lang": "python", "repo": "Chad-Mowbray/FAQ_Creator", "path": "/components/bases/DataFrameCreatorBase.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if users.get_current_user(): url = users.create_logout_url(self.request.uri) linktext = 'Logout' user = users.get_current_user() else: url = users.create_login_url(self.request.uri) linktext = 'Login' user = "Anonymous...
code_fim
medium
{ "lang": "python", "repo": "osantana-archive/fisllive", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> content = self.request.get('content') if content: message = Message() if users.get_current_user(): message.author = users.get_current_user() message.content = self.request.get('content') message.put() self.redirect("/"...
code_fim
medium
{ "lang": "python", "repo": "osantana-archive/fisllive", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: osantana-archive/fisllive path: /main.py #!/usr/bin/env python # -*- encoding: utf-8 -*- # # FISL Live # ========= # Copyright (c) 2010, Triveos Tecnologia Ltda. # License: AGPLv3 from os.path import * from datetime import datetime from google.appengine.api import users from google.appengine.ex...
code_fim
hard
{ "lang": "python", "repo": "osantana-archive/fisllive", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>d model ...') # model = load_model(settings.MODEL_PATH) # model = Model(inputs=model.input, outputs=model.get_layer('dnsthree').output) # print('load done.')<|fim_prefix|># repo: Lionen/voiceprint-web path: /voiceprint/__init__.py import pymysql pymysql.install_as_MySQLdb() # from keras.models import l...
code_fim
medium
{ "lang": "python", "repo": "Lionen/voiceprint-web", "path": "/voiceprint/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lionen/voiceprint-web path: /voiceprint/__init__.py import pymysql pymysql.install_as_MySQLdb() # from keras.models import load_<|fim_suffix|>d model ...') # model = load_model(settings.MODEL_PATH) # model = Model(inputs=model.input, outputs=model.get_layer('dnsthree').output) # print('load don...
code_fim
medium
{ "lang": "python", "repo": "Lionen/voiceprint-web", "path": "/voiceprint/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>=model.input, outputs=model.get_layer('dnsthree').output) # print('load done.')<|fim_prefix|># repo: Lionen/voiceprint-web path: /voiceprint/__init__.py import pymysql pymysql.install_as_MySQLdb() # from keras.models import load_model # from keras.models import Model # from ai import settings # # print...
code_fim
medium
{ "lang": "python", "repo": "Lionen/voiceprint-web", "path": "/voiceprint/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ins = self.film_table.insert().values(item) try: self.conn.execute(ins) except Exception, e: pass return item def close_spider(self, spider): self.conn.close()<|fim_prefix|># repo: fentensoft/douban-film-spider path: /douban/pipelines....
code_fim
medium
{ "lang": "python", "repo": "fentensoft/douban-film-spider", "path": "/douban/pipelines.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fentensoft/douban-film-spider path: /douban/pipelines.py # -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from sqlalchemy import create_engine, MetaData, ...
code_fim
medium
{ "lang": "python", "repo": "fentensoft/douban-film-spider", "path": "/douban/pipelines.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def process_item(self, item, spider): ins = self.film_table.insert().values(item) try: self.conn.execute(ins) except Exception, e: pass return item def close_spider(self, spider): self.conn.close()<|fim_prefix|># repo: fentensoft/do...
code_fim
hard
{ "lang": "python", "repo": "fentensoft/douban-film-spider", "path": "/douban/pipelines.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> correspond = pd.read_csv(file_, sep=',', header='infer') mail = pd.merge(correspond, mailTypes, how='left', left_on=['correspondenceTypeId'], right_on=['typeId']) mail.drop('typeId', axis=1, inplace=True) mail.columns = ['projectId', 'correspondenceId', 'sentDate', 'fromOrganizationId', 'f...
code_fim
hard
{ "lang": "python", "repo": "lexxmachina/aconex-job-applicaton", "path": "/mailMerge.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lexxmachina/aconex-job-applicaton path: /mailMerge.py #!/usr/bin/python import glob import pandas as pd import numpy as np manifest = pd.read_csv('./manifest.csv', sep=',', names=['projectId','records'], skiprows=[0]) mailTypes = pd.read_csv('./mail_types.csv', sep=',', names=['typeId','typeNa...
code_fim
hard
{ "lang": "python", "repo": "lexxmachina/aconex-job-applicaton", "path": "/mailMerge.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>us = "/get_status" create_order = "/create_order" ask_store = "/ask_store" check = "/check" test = "/test"<|fim_prefix|># repo: VladPyzh/PythonClientServer path: /ServerClient2020/handlers.py class Handlers(): change_store = "/change_store" cha<|fim_middle|>nge_status = "/change_s...
code_fim
medium
{ "lang": "python", "repo": "VladPyzh/PythonClientServer", "path": "/ServerClient2020/handlers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: VladPyzh/PythonClientServer path: /ServerClient2020/handlers.py class Handlers(): change_store = "/change_store" cha<|fim_suffix|>_store = "/ask_store" check = "/check" test = "/test"<|fim_middle|>nge_status = "/change_status" mail = "/mail" get_status = "/get_status" ...
code_fim
medium
{ "lang": "python", "repo": "VladPyzh/PythonClientServer", "path": "/ServerClient2020/handlers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: NCAR/SoftFlow path: /lib/python/folding_findline.py # dg_kernel plots import os import re import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors import csv import sys NE_SIZE = 128 TITLE_SIZE = 35 TEXT_SIZE = 30 MARKER_SIZE = 10 LINE_WIDTH = 5 colors = { idx:cn...
code_fim
hard
{ "lang": "python", "repo": "NCAR/SoftFlow", "path": "/lib/python/folding_findline.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nonpeaks_avgsum = sum(nonpeak1['Average']) + sum(nonpeak2['Average']) nonpeaks_normavg = {} for i, line in enumerate(nonpeak1['Head']): if nonpeaks_normavg.has_key(line): nonpeaks_normavg[line] += nonpeak1['Average'][i] else: nonpeaks_normavg[line] = nonpeak1['Average'][i] for i,...
code_fim
hard
{ "lang": "python", "repo": "NCAR/SoftFlow", "path": "/lib/python/folding_findline.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nonpeak1 = read_histogram('%s/%s_low_linelevel%d_region0.csv'%(ROOT, eventname, callstacklevel)) nonpeak2 = read_histogram('%s/%s_low_linelevel%d_region1.csv'%(ROOT, eventname, callstacklevel)) nonpeaks_avgsum = sum(nonpeak1['Average']) + sum(nonpeak2['Average']) nonpeaks_normavg = {} for i, line in e...
code_fim
hard
{ "lang": "python", "repo": "NCAR/SoftFlow", "path": "/lib/python/folding_findline.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Compute IK solution goal_curr = blue.inverse_kinematics(target_position, target_orientation) # Send command to robot if goal_curr != []: goal = goal_curr print("goal: ", goal) blue.set_joint_positions(goal, d...
code_fim
hard
{ "lang": "python", "repo": "yusukeurakami/blue_soylent", "path": "/examples/leap_controller.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Pre-defined Initial position of the robot target_angles = target_angles_init.copy() # orientation target_angles[0] += (ori[0]*1 + target_position[1]*1.5) # shoulder dir target_angles[4] += ori[2] # arm twist target_angles[5] ...
code_fim
hard
{ "lang": "python", "repo": "yusukeurakami/blue_soylent", "path": "/examples/leap_controller.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yusukeurakami/blue_soylent path: /examples/leap_controller.py #!/usr/bin/env python2 # A basic example of sending Blue a command in cartesian space. from blue_interface import BlueInterface import numpy as np import time import sys import argparse import Leap from utils.rotations import quat2eu...
code_fim
hard
{ "lang": "python", "repo": "yusukeurakami/blue_soylent", "path": "/examples/leap_controller.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#comparison c=[2,3,4] print(a==b) print(a!=b) #slice a=[9,8,7,6,5,4] print(a[0:3]) print(a[:4]) print(a[1:]) print(a[:]) print(a[2:2]) print(a[0:6:2]) print(a[0:6:3]) '''#a.apppend(element) a=[1,2,3,4,5] b=int(input('Enter number to append:')) a.append(b) print(a) #insert(index,element) a.insert(0,0) p...
code_fim
medium
{ "lang": "python", "repo": "YSreylin/HTML", "path": "/1101901079/0012/list.example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YSreylin/HTML path: /1101901079/0012/list.example.py #create a list a = [2,3,4,5,6,7,8,9,10] print(a) #indexing b = int(input('Enter indexing value:')) print('The result is:',a[b]) print(a[8]) print(a[-1]) #slicing print(a[0:3]) print(a[0:]) #conconteation b=[20,30] print(a+b) #Repetition pri...
code_fim
medium
{ "lang": "python", "repo": "YSreylin/HTML", "path": "/1101901079/0012/list.example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>'''#a.apppend(element) a=[1,2,3,4,5] b=int(input('Enter number to append:')) a.append(b) print(a) #insert(index,element) a.insert(0,0) print(a) #a.extend(c) c=[6,7,8,9] a.extend(c) print(a) #one more'''<|fim_prefix|># repo: YSreylin/HTML path: /1101901079/0012/list.example.py #create a list a = [2,3,4,...
code_fim
medium
{ "lang": "python", "repo": "YSreylin/HTML", "path": "/1101901079/0012/list.example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: clovisdanielcosta/python-dio path: /aula8_lambda_contador_letras.py # As variáveis abaixo estão recebendo uma função <|fim_suffix|>, 'marreco'] print(contador_letras(lista_animais))<|fim_middle|>anônima contador_letras = lambda lista: [len(x) for x in lista] lista_animais = ['cachorro', 'pato'
code_fim
medium
{ "lang": "python", "repo": "clovisdanielcosta/python-dio", "path": "/aula8_lambda_contador_letras.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>r x in lista] lista_animais = ['cachorro', 'pato', 'marreco'] print(contador_letras(lista_animais))<|fim_prefix|># repo: clovisdanielcosta/python-dio path: /aula8_lambda_contador_letras.py # As variáveis abaixo estão recebendo uma função <|fim_middle|>anônima contador_letras = lambda lista: [len(x) fo
code_fim
easy
{ "lang": "python", "repo": "clovisdanielcosta/python-dio", "path": "/aula8_lambda_contador_letras.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>z = DisaggregationManager._overlap_average(np.array(list(w)), stride=128) print(z.shape) print(x.shape) assert z.shape == x.shape<|fim_prefix|># repo: dumorgan/projeto-progamacao-puc-rio path: /tests/test_overlap_average.py from disaggregation import DisaggregationManager import numpy as np from more_ite...
code_fim
medium
{ "lang": "python", "repo": "dumorgan/projeto-progamacao-puc-rio", "path": "/tests/test_overlap_average.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dumorgan/projeto-progamacao-puc-rio path: /tests/test_overlap_average.py from disaggregation import DisaggregationManager import numpy as np from more_itertools import windowed <|fim_suffix|>z = DisaggregationManager._overlap_average(np.array(list(w)), stride=128) print(z.shape) print(x.shape) a...
code_fim
medium
{ "lang": "python", "repo": "dumorgan/projeto-progamacao-puc-rio", "path": "/tests/test_overlap_average.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stephr3/drf-films-and-theaters path: /films/serializers.py from rest_framework import serializers from films.models import * from django.contrib.auth.models import User class UserSerializer(serializers.ModelSerializer): films = serializers.PrimaryKeyRelatedField(many=True, queryset=Film.obje...
code_fim
medium
{ "lang": "python", "repo": "stephr3/drf-films-and-theaters", "path": "/films/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Theater fields = ('id', 'name', 'city', 'films', 'owner') depth = 1 class TheaterWriteSerializer(serializers.ModelSerializer): class Meta: model = Theater fields = ('id', 'name', 'city')<|fim_prefix|># repo: stephr3/drf-films-and-theaters path: /films...
code_fim
hard
{ "lang": "python", "repo": "stephr3/drf-films-and-theaters", "path": "/films/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> owner = serializers.ReadOnlyField(source='owner.username') class Meta: model = Film fields = ('id', 'title', 'year_prod', 'genre', 'theater_set', 'owner') depth = 1 class FilmWriteSerializer(serializers.ModelSerializer): genre = serializers.PrimaryKeyRelatedField(quer...
code_fim
medium
{ "lang": "python", "repo": "stephr3/drf-films-and-theaters", "path": "/films/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hughshanahan/CS2900-Lab-1 path: /tester/utils/cp3.py def check_orthogonal(u, v): <|fim_suffix|> import inspect import re local_vars = inspect.currentframe().f_back.f_locals return len(re.findall("p\\s*=\\s*0", str(local_vars))) == 0<|fim_middle|> return u.dot(v) == 0 def check...
code_fim
easy
{ "lang": "python", "repo": "hughshanahan/CS2900-Lab-1", "path": "/tester/utils/cp3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> import inspect import re local_vars = inspect.currentframe().f_back.f_locals return len(re.findall("p\\s*=\\s*0", str(local_vars))) == 0<|fim_prefix|># repo: hughshanahan/CS2900-Lab-1 path: /tester/utils/cp3.py def check_orthogonal(u, v): <|fim_middle|> return u.dot(v) == 0 def check...
code_fim
easy
{ "lang": "python", "repo": "hughshanahan/CS2900-Lab-1", "path": "/tester/utils/cp3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hughshanahan/CS2900-Lab-1 path: /tester/utils/cp3.py def check_orthogonal(u, v): <|fim_suffix|>def check_p(): import inspect import re local_vars = inspect.currentframe().f_back.f_locals return len(re.findall("p\\s*=\\s*0", str(local_vars))) == 0<|fim_middle|> return u.dot(v) =...
code_fim
easy
{ "lang": "python", "repo": "hughshanahan/CS2900-Lab-1", "path": "/tester/utils/cp3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for a in LangsMediaWiki: #print a.shortName indexPageName = 'Indeks:{0}_-_Związki_frazeologiczne'.format(a.upperName) try: phraseList[a.shortName] = pywikibot.Page(site, indexPageName).get() except pywikibot.NoPage: phraseList['%s' % a.shortName] = ...
code_fim
hard
{ "lang": "python", "repo": "alkamid/wiktionary", "path": "/fraz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for a in lista_stron: try: word = Haslo(a) except notFromMainNamespace: continue except sectionsNotFound: continue except WrongHeader: continue else: if word.type == 3: for lang in word.listLangs: ...
code_fim
hard
{ "lang": "python", "repo": "alkamid/wiktionary", "path": "/fraz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alkamid/wiktionary path: /fraz.py #!/usr/bin/python # -*- coding: utf-8 -*- import pywikibot from pywikibot import pagegenerators import re from pywikibot import xmlreader import datetime import collections from klasa import * def fraz(data): data_slownie = data[6:8] + '.' + data[4:6] + '....
code_fim
hard
{ "lang": "python", "repo": "alkamid/wiktionary", "path": "/fraz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return {} def get_dialog(self): config: dict = self.read_config() if config.get("OS") == "Windows": return WindowsDialog() return WebDialog() def render(self): self.dialog.render() if __name__ == "__main__": app = Application() app.re...
code_fim
medium
{ "lang": "python", "repo": "duthaho/python-design-patterns", "path": "/creational/factory.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: duthaho/python-design-patterns path: /creational/factory.py from abc import abstractmethod class BaseButton: @abstractmethod def render(self): pass @abstractmethod def on_click(self): pass class WindowsButton(BaseButton): def render(self): print("R...
code_fim
medium
{ "lang": "python", "repo": "duthaho/python-design-patterns", "path": "/creational/factory.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def on_click(self): print("On click") class HtmlButton(BaseButton): def render(self): print("Render html button") def on_click(self): print("On click") class BaseDialog: @abstractmethod def create_button(self) -> BaseButton: pass def render(sel...
code_fim
medium
{ "lang": "python", "repo": "duthaho/python-design-patterns", "path": "/creational/factory.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>realistic_v14-v1/240000/E2F9F049-5912-EA11-80CE-0017A4771048.root', '/store/mc/RunIIFall17MiniAODv2/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/MINIAODSIM/PU2017_12Apr2018_rp_94X_mc2017_realistic_v14-v1/240000/34CB6C5F-5912-EA11-B919-0425C5DE7BF4.root', '/store/mc/RunIIFall...
code_fim
hard
{ "lang": "python", "repo": "nistefan/RandomizedParametersSeparator", "path": "/DarkMatterMap2017/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV_madgraph_mcatnlo_pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_Mchi-55_Mphi-100_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13...
<|fim_prefix|># repo: nistefan/RandomizedParametersSeparator path: /DarkMatterMap2017/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV_madgraph_mcatnlo_pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_Mchi-55_Mphi-100_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV_madgraph_mcat...
code_fim
hard
{ "lang": "python", "repo": "nistefan/RandomizedParametersSeparator", "path": "/DarkMatterMap2017/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13TeV_madgraph_mcatnlo_pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_Mchi-55_Mphi-100_TuneCP5_13TeV-madgraph-mcatnlo-pythia8/TTbarDMJets_Dilepton_pseudoscalar_LO_TuneCP5_13...
<|fim_suffix|>if __name__ == "__main__": print("1 Chỗ này hơi lâu bạn đợi tí") phobert = AutoModel.from_pretrained("vinai/phobert-base") print("2") tokenizer = AutoTokenizer.from_pretrained("vinai/phobert-base", use_fast=False) print("3") predict("tôi làm giấy X ở đâu", phobert, tokenizer) p...
code_fim
medium
{ "lang": "python", "repo": "mariorenger/pB-classification", "path": "/codepython/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mariorenger/pB-classification path: /codepython/test.py from utils import * from wordEmbedding import * print("bat dau") def predict(text, phobert, tokenizer): <|fim_suffix|> print(y_predict+1) if __name__ == "__main__": print("1 Chỗ này hơi lâu bạn đợi tí") phobert = AutoModel.from_...
code_fim
hard
{ "lang": "python", "repo": "mariorenger/pB-classification", "path": "/codepython/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(y_predict+1) if __name__ == "__main__": print("1 Chỗ này hơi lâu bạn đợi tí") phobert = AutoModel.from_pretrained("vinai/phobert-base") print("2") tokenizer = AutoTokenizer.from_pretrained("vinai/phobert-base", use_fast=False) print("3") predict("tôi làm giấy X ở đâu", p...
code_fim
medium
{ "lang": "python", "repo": "mariorenger/pB-classification", "path": "/codepython/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ct-17/myblog path: /search/apps.py from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_suffix|> name = 'search' verbose_name = _("Search")<|fim_middle|>class SearchConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "ct-17/myblog", "path": "/search/apps.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> name = 'search' verbose_name = _("Search")<|fim_prefix|># repo: ct-17/myblog path: /search/apps.py from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ <|fim_middle|>class SearchConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "ct-17/myblog", "path": "/search/apps.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gajasurve/fb-mosaic path: /fb-mosaic.py import os from PIL import Image import urllib import json import math def download_images(a,b): image_count = 0 k = a no_of_images = b baseURL='https://graph.facebook.com/v2.2/' imgURL='/picture?type=large' sil_check='/picture?redirect=false' while ...
code_fim
hard
{ "lang": "python", "repo": "Gajasurve/fb-mosaic", "path": "/fb-mosaic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a = int(raw_input('Enter the fb-id from where to begin:')) b = int(raw_input('Enter the number of images to download (a square):')) download_images(a,b) resize_images() create_mosaic(b)<|fim_prefix|># repo: Gajasurve/fb-mosaic path: /fb-mosaic.py import os from PIL import Image import urllib import json ...
code_fim
hard
{ "lang": "python", "repo": "Gajasurve/fb-mosaic", "path": "/fb-mosaic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.content df_list = pandas.read_html(html) # Pull relevant URLs<|fim_prefix|># repo: tdanzey/Ravine-Rumble path: /Build ELO Dataset/01a_Scrape League URLs from Yahoo.py # Import packages import pandas import requests import lxml # Get page content url = "https://archive.fantasysports.yahoo.com<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "tdanzey/Ravine-Rumble", "path": "/Build ELO Dataset/01a_Scrape League URLs from Yahoo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdanzey/Ravine-Rumble path: /Build ELO Dataset/01a_Scrape League URLs from Yahoo.py # Import packages import pandas import requests import lxml # <|fim_suffix|>/nfl/2017/189499?lhst=sched#lhstsched" html = requests.get(url).content df_list = pandas.read_html(html) # Pull relevant URLs<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "tdanzey/Ravine-Rumble", "path": "/Build ELO Dataset/01a_Scrape League URLs from Yahoo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Verifica que los valores de la columna rangoatrasohoras sean los indicados ''' def test_that_all_ranges_are_present(self): df = get_clean_data() RANGOS=['cancelled', '0-1.5', '1.5-3.5' ,'3.5-'] self.assertCategoricalLevelsEqual(list(df.toPandas()["rangoatrasohoras"].unique()),...
code_fim
medium
{ "lang": "python", "repo": "rluiseugenio/dpa_rita", "path": "/src/orquestadores/tasks/testing/test_clean_rangos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> df = get_clean_data() RANGOS=['cancelled', '0-1.5', '1.5-3.5' ,'3.5-'] self.assertCategoricalLevelsEqual(list(df.toPandas()["rangoatrasohoras"].unique()), RANGOS)<|fim_prefix|># repo: rluiseugenio/dpa_rita path: /src/orquestadores/tasks/testing/test_clean_rangos.py #python -m marbles test_clean_ran...
code_fim
medium
{ "lang": "python", "repo": "rluiseugenio/dpa_rita", "path": "/src/orquestadores/tasks/testing/test_clean_rangos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rluiseugenio/dpa_rita path: /src/orquestadores/tasks/testing/test_clean_rangos.py #python -m marbles test_clean_rangos.py import unittest from marbles.mixins import mixins import pandas as pd import requests from pyspark.sql import SparkSession import psycopg2 as pg import pandas as pd from pysp...
code_fim
medium
{ "lang": "python", "repo": "rluiseugenio/dpa_rita", "path": "/src/orquestadores/tasks/testing/test_clean_rangos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ollavrova/pdf_crawler_rest_api path: /pdf_crawler/tests.py from django.test import TestCase, Client from pdf_crawler.models import Document from rest_framework.reverse import reverse class TestCase(TestCase): client = Client() <|fim_suffix|> Document.objects.create(name='First').sa...
code_fim
medium
{ "lang": "python", "repo": "ollavrova/pdf_crawler_rest_api", "path": "/pdf_crawler/tests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_endpoints(self): """ test for endpoints """ self.assertEqual(self.client.get(reverse('pdf_crawler:document-list')).status_code, 200) self.assertEqual(self.client.get(reverse('pdf_crawler:document-detail', kwargs={'pk': 1})).status_code, 200) se...
code_fim
medium
{ "lang": "python", "repo": "ollavrova/pdf_crawler_rest_api", "path": "/pdf_crawler/tests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: betty29/code-1 path: /recipes/Python/578631_Extended_Euclidean_Algorithm/recipe-578631.py # Author: Sam Erickson # Date: 2/23/2016 # # Program Description: This program gives the integer coefficients x,y to the # equation ax+by=gcd(a,b) given by the extended Euclidean Algorithm. <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "betty29/code-1", "path": "/recipes/Python/578631_Extended_Euclidean_Algorithm/recipe-578631.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Preconditions - a and b are both positive integers. Posconditions - The equation for ax+by=gcd(a,b) has been returned where x and y are solved. Input - a : int, b : int Output - ax+by=gcd(a,b) : string """ b,a=max(a,b),min(a,b) # Format of euclidList...
code_fim
medium
{ "lang": "python", "repo": "betty29/code-1", "path": "/recipes/Python/578631_Extended_Euclidean_Algorithm/recipe-578631.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def _temp_attn(h, e_out_W, e_out, score_sum, time): score = tf.squeeze(tf.matmul(tf.expand_dims(h, 1), e_out_W, transpose_b=True), [1]) score = tf.cond(time > 0, lambda: tf.exp(score)/(score_sum+1e-12), lambda: tf.exp(score)) a = _simple_norm(score) ctx = tf.squeeze(tf.matmul(tf.expand_dim...
code_fim
hard
{ "lang": "python", "repo": "VD44/RNN-Components", "path": "/rnn_seq2seq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VD44/RNN-Components path: /rnn_seq2seq.py import tensorflow as tf from rnn_cells import gru_cell, lstm_cell from tensorflow.python.ops import rnn def shape_list(x): ps = x.get_shape().as_list() ts = tf.shape(x) return [ts[i] if ps[i] is None else ps[i] for i in range(len(ps))] def b...
code_fim
hard
{ "lang": "python", "repo": "VD44/RNN-Components", "path": "/rnn_seq2seq.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ws.logout, name='logout'), path('test_auth', views.test, name='test'), url(r'^activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', views.activate, name='activate'), path('change_user_status/<int:user_id>/<int:status>', views.change_user_status, name='...
code_fim
hard
{ "lang": "python", "repo": "ahmadalwareh/SurveysBuilder", "path": "/Accounts/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahmadalwareh/SurveysBuilder path: /Accounts/urls.py from django.conf.urls import url from django.urls import path from . import views app_name = 'Accounts' urlpatterns = [ path('update_info', views.update_info, name='update_info'), path('create_user', views.create_u<|fim_suffix|>'change...
code_fim
hard
{ "lang": "python", "repo": "ahmadalwareh/SurveysBuilder", "path": "/Accounts/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> src_port=int(UDP_header[0].hex(),16) print("src_port:",src_port) dst_port=int(UDP_header[1].hex(),16) print("dst_port:",dst_port) leng=int(UDP_header[2].hex(),16) print("leng:",leng) header_checksum=UDP_header[3].hex() print("header_checksum:0x",header_checksum) recv_...
code_fim
hard
{ "lang": "python", "repo": "cnu-cse-datacom/2-packetcapture-HyunSongKwon", "path": "/DC02_02_201701198_kwonhyunsong.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> seq_num=TCP_header[2] print("seq_num:",seq_num) ack_num=TCP_header[3] print("ack_num:",ack_num) header_len=(int(TCP_header[4].hex(),16)>>12)&0x000f print("header_len:",header_len) flags=int(TCP_header[4].hex(),16)&0x0fff print("flags:",flags) reserved=flags>>9 p...
code_fim
hard
{ "lang": "python", "repo": "cnu-cse-datacom/2-packetcapture-HyunSongKwon", "path": "/DC02_02_201701198_kwonhyunsong.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cnu-cse-datacom/2-packetcapture-HyunSongKwon path: /DC02_02_201701198_kwonhyunsong.py import socket import struct def parsing_ethernet_header(data): ethernet_header=struct.unpack("!6c6c2s",data) ether_dest = convert_ethernet_address(ethernet_header[0:6]) ether_src = convert_ethernet_...
code_fim
hard
{ "lang": "python", "repo": "cnu-cse-datacom/2-packetcapture-HyunSongKwon", "path": "/DC02_02_201701198_kwonhyunsong.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #USED TO DECODE MAPQUEST RESPONSE y = x.read().decode(encoding = 'utf-8') print(y) # USE decoded response string to check with pretty json #USED TO CONVERT DECODED STRING TO DICT/LISTS z = json.loads(y) #dictionary of mapquest response which also includes lists print(t...
code_fim
hard
{ "lang": "python", "repo": "dblam/Duy-s-Python-Projects", "path": "/PYTHON 32/Project 3/Module 3(sample).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': #USED TO GET USER INPUTS locationQ = tripQuantity() locationList = quantityToLocations(locationQ) #print to double check #CREATES A NEW SEARCH INSTANCE AND IT'S REQUEST URL newSearch = Module1.URL() newSearch.set_from_location(location...
code_fim
hard
{ "lang": "python", "repo": "dblam/Duy-s-Python-Projects", "path": "/PYTHON 32/Project 3/Module 3(sample).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dblam/Duy-s-Python-Projects path: /PYTHON 32/Project 3/Module 3(sample).py # Duy B. Lam # 61502602 # Project 3 # A module that reads the input and constructs the objects # that will generate the program's output. This is the only # module that should have an if __name__ == '__main__' block...
code_fim
hard
{ "lang": "python", "repo": "dblam/Duy-s-Python-Projects", "path": "/PYTHON 32/Project 3/Module 3(sample).py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> active_ids = context.get('active_ids',False) supplier_ids = self.pool['ebiz.supplier.account.line'].create_ebiz_supplier_account_line(cr, uid, active_ids, context=context) return { 'view_type': 'form', 'view_mode': 'tree', 'res_model'...
code_fim
medium
{ "lang": "python", "repo": "luohuayong/addons8", "path": "/bysun_supplier_account/wizard/ebiz_supplier_account_create.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: luohuayong/addons8 path: /bysun_supplier_account/wizard/ebiz_supplier_account_create.py # -*- coding: utf-8 -*- # import time from openerp.osv import osv, fields import logging import openerp.addons.decimal_precision as dp <|fim_suffix|>class ebiz_supplier_account_create(osv.osv_memory): _na...
code_fim
medium
{ "lang": "python", "repo": "luohuayong/addons8", "path": "/bysun_supplier_account/wizard/ebiz_supplier_account_create.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LouisNUST/HumanPose3D-Pytorch path: /apps/hpn/get_video_stream.py import sys, os import cv2 # set the video reader video_path = 0 # camera number index # video_path = "/home/pacific/Documents/Work/Projects/Workflows/server/PycharmProjects/Pacific_AvatarGame_Host/humanpose_2d/LiveCamera/test.mp4...
code_fim
hard
{ "lang": "python", "repo": "LouisNUST/HumanPose3D-Pytorch", "path": "/apps/hpn/get_video_stream.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # save the video frame videoWriter.write(frame) cv2.waitKey(20) # wait 20 ms for next frame of the live video # check whether manual exit command entered if cv2.waitKey(1) & 0xFF == ord('q'): break else: continue videoReader.release...
code_fim
hard
{ "lang": "python", "repo": "LouisNUST/HumanPose3D-Pytorch", "path": "/apps/hpn/get_video_stream.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thevindur/Python-Basics path: /w1790135 - ICT/Q3A.py x=input("Do you really want to run this program? (y/n) : ") x=x.upper() if x=="Y" or x=="N" or x=="Q": while x=="Y" or x=="N" or x=="Q": if x=="Q": print("Exiting the Program") import sys sys.exi...
code_fim
medium
{ "lang": "python", "repo": "thevindur/Python-Basics", "path": "/w1790135 - ICT/Q3A.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #You can run the program.Enter the code required to run the program else: print("Invalid selection is entered")<|fim_prefix|># repo: thevindur/Python-Basics path: /w1790135 - ICT/Q3A.py x=input("Do you really want to run this program? (y/n) : ") x=x.upper() if x=="Y" or x=="N" or x=="Q": ...
code_fim
hard
{ "lang": "python", "repo": "thevindur/Python-Basics", "path": "/w1790135 - ICT/Q3A.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuliusC4esar/CS550 path: /looppractice.py # Kai Joseph # Loop Practice # Since I worked on my own, I did not have to complete all 25 challenges (with Ms. Healey's permission). I completed a total of 14 challenges. import sys import random ''' 1. Write a for loop that will print out all th...
code_fim
hard
{ "lang": "python", "repo": "JuliusC4esar/CS550", "path": "/looppractice.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }