text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: kitchell/WMmorphology path: /ML_WM_shapeDNA.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 7 13:46:24 2017
@author: lindseykitchell
"""
from parse_ev_files import parse_ev
from sklearn.cross_validation import KFold
from sklearn.model_selection import train_test_split
from sklearn.tree impor... | code_fim | hard | {
"lang": "python",
"repo": "kitchell/WMmorphology",
"path": "/ML_WM_shapeDNA.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>clf = DecisionTreeClassifier()
clf.fit(data_train, labels_train)
clf.predict(data_test)
clf.score(data_test, labels_test)
clf = RandomForestClassifier()
clf.fit(data_train, labels_train)
clf.predict(data_test)
clf.score(data_test, labels_test)
clf = AdaBoostClassifier()
clf.fit(data_train, labels... | code_fim | hard | {
"lang": "python",
"repo": "kitchell/WMmorphology",
"path": "/ML_WM_shapeDNA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for x in self.newdata['COLOR']:
threading.Thread(target=self.download_color, args=(x,)).start()
for x in range(len(self.newdata['DETAIL'])):
threading.Thread(target=self.download_detail, args=(self.newdata['DETAIL'][x], x)).start()
return
... | code_fim | hard | {
"lang": "python",
"repo": "lwqwo888/TaoBao_Spider",
"path": "/taobao2/csdntaobao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> except:
print(sys.exc_info())
return
if img.ok:
if not os.path.exists(self.name + "/color"):
try:
os.makedirs(self.name + "/color")
except:
pass
if "/" in list(url.keys()... | code_fim | hard | {
"lang": "python",
"repo": "lwqwo888/TaoBao_Spider",
"path": "/taobao2/csdntaobao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lwqwo888/TaoBao_Spider path: /taobao2/csdntaobao.py
# coding=utf-8
import requests
import re, sys, os
import json
import threading
import pprint
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class spider:
def __init__(self, sid, name):
self.id = sid
self.headers =... | code_fim | hard | {
"lang": "python",
"repo": "lwqwo888/TaoBao_Spider",
"path": "/taobao2/csdntaobao.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # write train_config to text file
with open(os.path.join(ckpts_dir, 'config.txt'), mode='w') as f:
f.write('train_config: ' + str(train_config) + '\n')
f.write('\n')
f.write('EmbMLP_hyperparams: ' + str(EmbMLP_hyperparams) + '\n')
# collect list... | code_fim | hard | {
"lang": "python",
"repo": "haolun-wu/ASMG",
"path": "/Tmall/ASMGgru_full/train_tmall.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if i >= train_config['test_start_date']:
test_aucs.append(next_auc)
test_loglosses.append(next_logloss)
if i < train_config['test_start_date'] or not train_config['test_stop_train']:
train_start_time = time.time()
for epoch_id in range(1, train_config['meta_num_e... | code_fim | hard | {
"lang": "python",
"repo": "haolun-wu/ASMG",
"path": "/Tmall/ASMGgru_full/train_tmall.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haolun-wu/ASMG path: /Tmall/ASMGgru_full/train_tmall.py
from __future__ import division
from __future__ import print_function
import os
import pickle
from engine import *
from model import *
from utils import *
np.random.seed(1234)
tf.set_random_seed(123)
# load data to df
start_time = time.tim... | code_fim | hard | {
"lang": "python",
"repo": "haolun-wu/ASMG",
"path": "/Tmall/ASMGgru_full/train_tmall.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#songs have a foreign key for playlist table, 1st add a row for playlist table (null id)
#use select statment to find row and primary key associated with song
# SELECT song id from playlist where == to playlist url
#playlist id is the foreign key to the song table
#select_country_id_sql = '''
... | code_fim | hard | {
"lang": "python",
"repo": "kthenning27/Python-Course-FinalProject",
"path": "/sql_commands.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kthenning27/Python-Course-FinalProject path: /sql_commands.py
import sqlite3
from track import Track
from playlist import Playlist
def create_database():
try:
sqliteConnection = sqlite3.connect('FinalProjectDatabase.db')
cursor = sqliteConnection.cursor()
cursor.e... | code_fim | hard | {
"lang": "python",
"repo": "kthenning27/Python-Course-FinalProject",
"path": "/sql_commands.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#playlist id: each song belongs to a playlist
#tweet table not needed
#create playlist table (each one has a unique id auto incrementing) add songs to the song table. foreign key = playlist id
#
#songs have a foreign key for playlist table, 1st add a row for playlist table (null id)
#use select st... | code_fim | hard | {
"lang": "python",
"repo": "kthenning27/Python-Course-FinalProject",
"path": "/sql_commands.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slbastin/firefly_game path: /laboratory/test1/apps/neurons_protocol/neurons_engine.py
a_num - 1
common_neurons_command_response_function_dict_list[int(line_elements[5],16)] = common_neurons_command_response_function_dict
common_neurons_command_response_block_dict["function... | code_fim | hard | {
"lang": "python",
"repo": "slbastin/firefly_game",
"path": "/laboratory/test1/apps/neurons_protocol/neurons_engine.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> global online_neurons_module_request_dict
global online_neurons_module_inactive_block_dict
str_block_type = type * 256 + subtype
if str_block_type in common_neurons_command_request_dict:
block_dict = common_neurons_command_request_dict[str_block_type]
block_name = block_d... | code_fim | hard | {
"lang": "python",
"repo": "slbastin/firefly_game",
"path": "/laboratory/test1/apps/neurons_protocol/neurons_engine.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type_str in common_neurons_command_response_dict:
common_neurons_command_default_function_result_list = []
pass
else:
common_neurons_command_response_function_dict_list = dict()
common_neurons_command_response_block... | code_fim | hard | {
"lang": "python",
"repo": "slbastin/firefly_game",
"path": "/laboratory/test1/apps/neurons_protocol/neurons_engine.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrathameshBhatkar/VirusSimulation path: /VirusSimulation/Colors.py
# Colour
COLOR_RED = (255, 0, 0)
COLOR_GREEN = (0, 255, 0)
COLOR_BLUE = (0, 0, 255)
<|fim_suffix|>COLOR_BLACK = (0, 0, 0)
COLOR_WHITE = (255, 255, 255)
COLOR_YELLOW = (255, 255, 0)
COLOR_PINK = (255, 0, 255)
COLOR_PURP... | code_fim | medium | {
"lang": "python",
"repo": "PrathameshBhatkar/VirusSimulation",
"path": "/VirusSimulation/Colors.py",
"mode": "psm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|>COLOR_BLACK = (0, 0, 0)
COLOR_WHITE = (255, 255, 255)
COLOR_YELLOW = (255, 255, 0)
COLOR_PINK = (255, 0, 255)
COLOR_PURPLE = (110, 0, 255)
color_infected = COLOR_RED
color_recovered = COLOR_GREEN
color_normal = COLOR_WHITE
color_protected = COLOR_PURPLE
color_ded = COLOR_DARK_GRAY<|fim_prefix... | code_fim | medium | {
"lang": "python",
"repo": "PrathameshBhatkar/VirusSimulation",
"path": "/VirusSimulation/Colors.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_suffix|>COLOR_YELLOW = (255, 255, 0)
COLOR_PINK = (255, 0, 255)
COLOR_PURPLE = (110, 0, 255)
color_infected = COLOR_RED
color_recovered = COLOR_GREEN
color_normal = COLOR_WHITE
color_protected = COLOR_PURPLE
color_ded = COLOR_DARK_GRAY<|fim_prefix|># repo: PrathameshBhatkar/VirusSimulation path: /VirusS... | code_fim | easy | {
"lang": "python",
"repo": "PrathameshBhatkar/VirusSimulation",
"path": "/VirusSimulation/Colors.py",
"mode": "spm",
"license": "LicenseRef-scancode-public-domain",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RomelHernandez/Programacion-Orientada-a-Objetos path: /herencia.py
class Persona:
def __init__(self, edad, nombre):
self.edad = edad
self.nombre = nombre
print("Se ha creado a",self.nombre,"de",self.edad)
def hablar (self,*palabras):
for frase in palab... | code_fim | medium | {
"lang": "python",
"repo": "RomelHernandez/Programacion-Orientada-a-Objetos",
"path": "/herencia.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(self.nombre,": Voy a practicar")
Juan = Persona(18,"Juan")
Juan.hablar("Hola estoy hablando", "Este soy yo")
Luis = Deportista(20,"Luis")
Luis.hablar("Hola estoy hablando", "Este soy yo")
Luis.practicarDeporte()<|fim_prefix|># repo: RomelHernandez/Programacion-Orientada-a-Objetos path: /he... | code_fim | medium | {
"lang": "python",
"repo": "RomelHernandez/Programacion-Orientada-a-Objetos",
"path": "/herencia.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sray0309/SI-507-final-project path: /schools/michigan.py
import requests
import sqlite3
from bs4 import BeautifulSoup
import json
import time
SCHOOL = 'michigan'
ECE_URL = 'https://ece.engin.umich.edu/people/directory/faculty/'
CSE_URL = 'https://cse.engin.umich.edu/people/faculty/'
headers = {... | code_fim | hard | {
"lang": "python",
"repo": "sray0309/SI-507-final-project",
"path": "/schools/michigan.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (faculty['cache_time'][:7] != time_now[:7] or faculty['total_number'] == 0):
print('University of Michigan: Fetching from website...')
faculty['cache_time'] = time_now
ece_response = requests.get(ECE_URL, headers=headers)
cse_response = requests.get(CSE_URL, headers=... | code_fim | hard | {
"lang": "python",
"repo": "sray0309/SI-507-final-project",
"path": "/schools/michigan.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Updating database...')
connection = sqlite3.connect('faculty.sqlite')
cursor = connection.cursor()
delete_old_data = '''
DELETE FROM faculty
WHERE SchoolId in (SELECT Id from school WHERE name = "michigan")'''
cursor.execute(delete_old... | code_fim | hard | {
"lang": "python",
"repo": "sray0309/SI-507-final-project",
"path": "/schools/michigan.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021-night path: /week1/lecture/reshape-the-matrix/reshape-the-matrix.py
#
# @lc app=leetcode id=566 lang=python3
#
# [566] Reshape the Matrix
#
# @lc code=start
from typing import List
class Solution:
<|fim_suffix|> m, n = len(mat), l... | code_fim | medium | {
"lang": "python",
"repo": "CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021-night",
"path": "/week1/lecture/reshape-the-matrix/reshape-the-matrix.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>mat = [[1,2],[3,4]]
r = 1
c = 4
mat = [[1,2],[3,4]]
r = 2
c = 4
mat = [[1,2]]
r = 1
c = 1
Sol = Solution()
ans = Sol.matrixReshape(mat, r, c)
print(f'ans: {ans}')<|fim_prefix|># repo: CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021-night path: /week1/lecture/reshape-the-matrix/reshape-the-matr... | code_fim | hard | {
"lang": "python",
"repo": "CUNY-TTP-Technical-Interview-Prep/cuny-ttp-algo-summer2021-night",
"path": "/week1/lecture/reshape-the-matrix/reshape-the-matrix.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>odels here.
admin.site.register(Address)
admin.site.register(Order)
admin.site.register(FoodSeeker)<|fim_prefix|># repo: AbhisiktaChakraborty/FoodProvidingService path: /OrderManager/raisemodifyorder/admin.py
from django.contrib import admin
from .models i<|fim_middle|>mport Address,Order,FoodSeeke... | code_fim | easy | {
"lang": "python",
"repo": "AbhisiktaChakraborty/FoodProvidingService",
"path": "/OrderManager/raisemodifyorder/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AbhisiktaChakraborty/FoodProvidingService path: /OrderManager/raisemodifyorder/admin.py
from django.contrib import admin
from .models i<|fim_suffix|>te.register(Order)
admin.site.register(FoodSeeker)<|fim_middle|>mport Address,Order,FoodSeeker
# Register your models here.
admin.site.regis... | code_fim | medium | {
"lang": "python",
"repo": "AbhisiktaChakraborty/FoodProvidingService",
"path": "/OrderManager/raisemodifyorder/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HHalva/hmnlica path: /main.py
import os
import argparse
import sys
import pickle
from pathlib import Path
from jax import random
from sklearn.decomposition import PCA
from generate_data import gen_source_data
from models import init_invertible_mlp_params, invertible_mlp_fwd
from train import t... | code_fim | hard | {
"lang": "python",
"repo": "HHalva/hmnlica",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # preprocessing
if args.whiten:
pca = PCA(whiten=True)
x_data = pca.fit_transform(x_data)
# create variable dicts for training
data_dict = {'x_data': x_data,
's_data': s_data,
'state_seq': state_seq}
train_dict = {'mix_depth': args.mi... | code_fim | hard | {
"lang": "python",
"repo": "HHalva/hmnlica",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adonnelly759/reveal path: /reveal/views.py
from django.shortcuts import render
from .models import Codes, Question, Answer
from django.contrib import messages
from datetime import datetime
# Create your views here.
def index(request):
<|fim_suffix|> if show < today:
c = Codes.objects.... | code_fim | hard | {
"lang": "python",
"repo": "adonnelly759/reveal",
"path": "/reveal/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if ans:
if request.method == "POST":
i = request.POST.get("answer")
if ans.title == i:
ans.correct = True
ans.save()
sub = c.sub
c.sub = sub+1
c.save()
... | code_fim | hard | {
"lang": "python",
"repo": "adonnelly759/reveal",
"path": "/reveal/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> allAns = len(Answer.objects.all())
corAns = len(Answer.objects.filter(correct=True))
try:
ans = Answer.objects.filter(correct=False)[:1].get()
except Answer.DoesNotExist:
ans = None
if ans:
if request.method == "POST":
... | code_fim | hard | {
"lang": "python",
"repo": "adonnelly759/reveal",
"path": "/reveal/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbsenvoillage/BsoupPG path: /logger.py
from os import error
from datetime import datetime
def format_error(e):
<|fim_suffix|>def log(e):
try:
with open('log.txt', 'a') as f:
f.write(format_error(e))
except IOError as e:
print(e)
except e:
print(e)... | code_fim | easy | {
"lang": "python",
"repo": "mbsenvoillage/BsoupPG",
"path": "/logger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
with open('log.txt', 'a') as f:
f.write(format_error(e))
except IOError as e:
print(e)
except e:
print(e)<|fim_prefix|># repo: mbsenvoillage/BsoupPG path: /logger.py
from os import error
from datetime import datetime
def format_error(e):
return f... | code_fim | easy | {
"lang": "python",
"repo": "mbsenvoillage/BsoupPG",
"path": "/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reidbaker/barracudaRacko path: /server.py
from SimpleXMLRPCServer import SimpleXMLRPCServer
from playground import *
import logging
# Set up logging
logging.basicConfig(level=logging.DEBUG)
server = SimpleXMLRPCServer(('172.16.89.213', 80), logRequests=False)
# Expose a function
def ping(messag... | code_fim | hard | {
"lang": "python",
"repo": "reidbaker/barracudaRacko",
"path": "/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_deck_exchange(xmlStruct):
response = get_racko_deck_exchange(xmlStruct['game_id'],xmlStruct['remaining_microseconds'],xmlStruct['rack'],xmlStruct['card'])
return response
def move_result(xmlStruct):
response = move_racko_result(xmlStruct['game_id'],xmlStruct['move'],xmlStruct)
ret... | code_fim | hard | {
"lang": "python",
"repo": "reidbaker/barracudaRacko",
"path": "/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return start_racko_game(xmlStruct['game_id'],xmlStruct['player_id'],xmlStruct['initial_discard'],xmlStruct['other_player_id'])
def get_move(xmlStruct):
response = get_racko_move(xmlStruct['game_id'],xmlStruct['rack'],xmlStruct['discard'],xmlStruct['remaining_microseconds'],xmlStruct['other_player... | code_fim | medium | {
"lang": "python",
"repo": "reidbaker/barracudaRacko",
"path": "/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig3 = plt.figure()
eigen3 = np.dot(X, U[:,2])
x = np.arange(eigen3.shape[0])
ax = fig3.add_subplot(111)
rects = ax.bar(x, eigen3.T, width)
plt.title('pca eigen vector 3')
plt.show()<|fim_prefix|># repo: Laurawly/ECS271 path: /hw3/pca.py
import numpy as np
import matplotlib.pyplot as plt
import pylab
fr... | code_fim | hard | {
"lang": "python",
"repo": "Laurawly/ECS271",
"path": "/hw3/pca.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Laurawly/ECS271 path: /hw3/pca.py
import numpy as np
import matplotlib.pyplot as plt
import pylab
from mpl_toolkits.mplot3d import Axes3D
from PIL import Image
import glob
X = np.array([np.array(Image.open(im)).flatten() for im in glob.glob('Images/*.pgm')], 'f')
n_samples, n_features = X.shape... | code_fim | hard | {
"lang": "python",
"repo": "Laurawly/ECS271",
"path": "/hw3/pca.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lanpa/tensorboardX path: /examples/global_1.py
# called by demo_global_writer
<|fim_suffix|>writer.add_text('my_log', 'greeting from global1')
for i in range(100):
writer.add_scalar('global1', i)
for i in range(100):
writer.add_scalar('common', i)<|fim_middle|>from tensorboardX import ... | code_fim | medium | {
"lang": "python",
"repo": "lanpa/tensorboardX",
"path": "/examples/global_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(100):
writer.add_scalar('common', i)<|fim_prefix|># repo: lanpa/tensorboardX path: /examples/global_1.py
# called by demo_global_writer
from tensorboardX import GlobalSummaryWriter
writer = GlobalSummaryWriter.getSummaryWriter()
writer.add_text('my_log', 'greeting from global1')
<|... | code_fim | easy | {
"lang": "python",
"repo": "lanpa/tensorboardX",
"path": "/examples/global_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>writer.add_text('my_log', 'greeting from global1')
for i in range(100):
writer.add_scalar('global1', i)
for i in range(100):
writer.add_scalar('common', i)<|fim_prefix|># repo: lanpa/tensorboardX path: /examples/global_1.py
# called by demo_global_writer
<|fim_middle|>from tensorboardX import ... | code_fim | medium | {
"lang": "python",
"repo": "lanpa/tensorboardX",
"path": "/examples/global_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jakubwlodarczyk/python-ccms-fork-in-eye path: /Common.py
import random
import string
from ui import *
import sqlite3
class Common:
@classmethod
def write_staff_to_file(cls, file_name, obj_list): # for staff
"""
Writes object list into a DB file.
Args:
... | code_fim | hard | {
"lang": "python",
"repo": "Jakubwlodarczyk/python-ccms-fork-in-eye",
"path": "/Common.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for team in teams_list:
c.execute("INSERT INTO teams_list (name) VALUES (?)", [team])
conn.commit()
conn.close()
@staticmethod
def error_integer_handling(chosen_option, value_of_possible_options):
"""
:param chosen_option: user's input.
... | code_fim | hard | {
"lang": "python",
"repo": "Jakubwlodarczyk/python-ccms-fork-in-eye",
"path": "/Common.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_url(self, url):
self.url = url<|fim_prefix|># repo: orenb/hpye path: /song.py
class Song:
def __init__(self, id, artist, title, key=''):
self.id = str(id.encode('utf-8'))
self.artist = str(artist.encode('utf-8'))
self.title = str(title.encode('utf-8'))
... | code_fim | medium | {
"lang": "python",
"repo": "orenb/hpye",
"path": "/song.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: orenb/hpye path: /song.py
class Song:
def __init__(self, id, artist, title, key=''):
<|fim_suffix|> return "%s - %s" % (self.artist, self.title)
def add_url(self, url):
self.url = url<|fim_middle|> self.id = str(id.encode('utf-8'))
self.artist = str(artist.e... | code_fim | hard | {
"lang": "python",
"repo": "orenb/hpye",
"path": "/song.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__=='__main__':
cmd ='telnet 10.245.3.17'
attr={'TIMEOUT': 10,'LOGIN': 'Calix,E7-SIT-S3-2960-2>,40\nenable,word:,40\nadmin,E7-SIT-S3-2960-2#,40','CMD':cmd, 'EXP':'.*'}
s = Cisco('sut_local',attr)
command='SendLine("abcddddddddddddd",AntiIdle=True)'
s.SendLine('command', True, ... | code_fim | hard | {
"lang": "python",
"repo": "try-dash-now/dash-ia",
"path": "/product/Cisco.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: try-dash-now/dash-ia path: /product/Cisco.py
#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#from pexpect import spawn, TIMEOUT
import time
import re as sre
import os
if os.name!='nt':
from Session import Session as CSession
else:
from WinSession import WinSession as CSession
reSession... | code_fim | hard | {
"lang": "python",
"repo": "try-dash-now/dash-ia",
"path": "/product/Cisco.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linxiao-zhang/json_project path: /publish_time.py
import json
import codecs
from gensim.models import LdaModel
from gensim.corpora import Dictionary
from gensim import corpora, models
import tomotopy as tp
<|fim_suffix|> numbers = []
for time_stap in time:
number_new = 0
f... | code_fim | hard | {
"lang": "python",
"repo": "linxiao-zhang/json_project",
"path": "/publish_time.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> numbers = []
for time_stap in time:
number_new = 0
for time_all in publish_time_all:
if time_all == time_stap:
number_new = number_new + 1
numbers.append(number_new)
final_result = list(zip(time, numbers))
title_file_name = r"D:/topic_6_t... | code_fim | hard | {
"lang": "python",
"repo": "linxiao-zhang/json_project",
"path": "/publish_time.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> template='csvupload.html'
context={
'msg':'Please upload valid file only'
}
if request.method=='GET':
return render(request,template,context)
csv_file=request.FILES['file']
if not csv_file.name.endswith('.csv'):
messages.error(request,"Please upload Valid CSV ... | code_fim | medium | {
"lang": "python",
"repo": "ganeshgaud/csv-upload",
"path": "/testapp/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ganeshgaud/csv-upload path: /testapp/views.py
from django.shortcuts import render
from .models import Student
from .forms import StudentForm
import csv,io
from django.contrib import messages
from django.http import HttpResponse
def file_upload(request):
template='csvupload.html'
context=... | code_fim | hard | {
"lang": "python",
"repo": "ganeshgaud/csv-upload",
"path": "/testapp/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print "Nr. of rows:", ratingsWithUserAndMovieDataDF.count()
ratingsWithUserAndMovieDataDF.sort(['MovieID','UserID']).show(3, truncate=50)
# In[22]:
ratingsByGenderAndGenreSF = (
ratingsWithUserAndMovieDataDF
.withColumn('Genre', F.explode(ratingsWithUserAndMovieDataDF.Genres))
.drop('Genres')
.gr... | code_fim | hard | {
"lang": "python",
"repo": "bpirvu/talks",
"path": "/2017-09-27_DataScienceWithPython/02_demo_spark_2.2.0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># In[18]:
split_udf = udf(lambda s: s.split("|"), T.ArrayType(T.StringType()))
moviesDF=moviesDF.withColumn("Genres", split_udf(moviesDF['Genres']))
# In[19]:
moviesDF.show(3, truncate=50)
# In[20]:
ratingsWithUserAndMovieDataDF = ratingsWithUserDataDF.join(moviesDF, how='inner', on='MovieID')
... | code_fim | hard | {
"lang": "python",
"repo": "bpirvu/talks",
"path": "/2017-09-27_DataScienceWithPython/02_demo_spark_2.2.0.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bpirvu/talks path: /2017-09-27_DataScienceWithPython/02_demo_spark_2.2.0.py
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
print "Spark version:",sc.version
print "Pandas version:",pd.__version__
from pandas import Series, DataFrame
from os import getenv
DATADIR = getenv("... | code_fim | hard | {
"lang": "python",
"repo": "bpirvu/talks",
"path": "/2017-09-27_DataScienceWithPython/02_demo_spark_2.2.0.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michellechowdc/CIS5Classwork path: /programControlMotorsTest_wNewCode2.py
# issues: servo spazzes and moves to other angles when DC going
# DC stops when press to go L/R
# DC one direction spins faster than other: set faster to forward
import RPi.GPIO as GPIO
import sys, tty, termios, time
GPIO.... | code_fim | hard | {
"lang": "python",
"repo": "michellechowdc/CIS5Classwork",
"path": "/programControlMotorsTest_wNewCode2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> GPIO.output(servoMotorIn, True)
servoMotor.ChangeDutyCycle(12.5)
GPIO.output(servoMotorSig, True)
# sleep(1)
# GPIO.output(servoMotorSig, False)
# servoMotor.ChangeDutyCycle(0)
# toggle steering
def toggleSteering(direction):
global wheelStatus
if(direction == "right"):
... | code_fim | hard | {
"lang": "python",
"repo": "michellechowdc/CIS5Classwork",
"path": "/programControlMotorsTest_wNewCode2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaulMcMillan/2014_ccc_talk path: /vis_results.py
from utils import read_data
import matplotlib.pyplot as plt
<|fim_suffix|>for key, val in data.items()[-4:]:
plt.plot([d[4] for d in val], [d[5]-d[4] for d in val],
'.', label=str(key), alpha=0.5)
# plt.plot(sorted([d[5]-d[4] ... | code_fim | easy | {
"lang": "python",
"repo": "PaulMcMillan/2014_ccc_talk",
"path": "/vis_results.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for key, val in data.items()[-4:]:
plt.plot([d[4] for d in val], [d[5]-d[4] for d in val],
'.', label=str(key), alpha=0.5)
# plt.plot(sorted([d[5]-d[4] for d in val]),
# #'.',
# label=str(key), alpha=0.5)
plt.legend()
plt.show()<|fim_prefix|># repo: PaulMcMi... | code_fim | easy | {
"lang": "python",
"repo": "PaulMcMillan/2014_ccc_talk",
"path": "/vis_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnbourg2001/LoL path: /LeagueOLegends-main/calc.py
from tkinter import *
import csv
root = Tk()
with open('champions.csv') as csvfile:
championsCSV = csv.reader(csvfile, delimiter=',')
for row in championsCSV:
print (row)
list = ("Morgana", "Perl", "one", "Two", "Thre... | code_fim | easy | {
"lang": "python",
"repo": "johnbourg2001/LoL",
"path": "/LeagueOLegends-main/calc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> myList.insert(j, i)
j = j + 1
myList.pack()
root.mainloop()<|fim_prefix|># repo: johnbourg2001/LoL path: /LeagueOLegends-main/calc.py
from tkinter import *
import csv
root = Tk()
<|fim_middle|>with open('champions.csv') as csvfile:
championsCSV = csv.reader(csvfile, delimiter=','... | code_fim | hard | {
"lang": "python",
"repo": "johnbourg2001/LoL",
"path": "/LeagueOLegends-main/calc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def lst_d(n):
n=n%10
return n
print("the first digit is: ",frst_d(n))
print("the last digit is: ",lst_d(n))
sum=frst_d(n)+lst_d(n)
print("the sum of first and last digit is: ",sum)<|fim_prefix|># repo: YOGESH-TECH/python-basic-problems path: /lastf.py
n=int(input("enter the no. here: "))
def frs... | code_fim | easy | {
"lang": "python",
"repo": "YOGESH-TECH/python-basic-problems",
"path": "/lastf.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YOGESH-TECH/python-basic-problems path: /lastf.py
n=int(input("enter the no. here: "))
def frst_d(n):
<|fim_suffix|>def lst_d(n):
n=n%10
return n
print("the first digit is: ",frst_d(n))
print("the last digit is: ",lst_d(n))
sum=frst_d(n)+lst_d(n)
print("the sum of first and last digit i... | code_fim | easy | {
"lang": "python",
"repo": "YOGESH-TECH/python-basic-problems",
"path": "/lastf.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #queryset,serializer_class 这个变量名是死的不能改
queryset = Course.objects.all()
serializer = CourseSerializer(queryset, many=True)
return Response(serializer.data)
def retrieve(self, request, pk=None):
queryset = Course.objects.all()
user = get_object_or_404(que... | code_fim | hard | {
"lang": "python",
"repo": "SJTU-LinCH/Project-SchoolPublicComment",
"path": "/web_service/Django1.6.11/database/course/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Course.objects.all()
serializer_class = CourseSerializer
class CourseDetail(generics.RetrieveAPIView):
queryset = Course.objects.all()
serializer_class = CourseSerializer<|fim_prefix|># repo: SJTU-LinCH/Project-SchoolPublicComment path: /web_service/Django1.6.11/database/co... | code_fim | hard | {
"lang": "python",
"repo": "SJTU-LinCH/Project-SchoolPublicComment",
"path": "/web_service/Django1.6.11/database/course/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SJTU-LinCH/Project-SchoolPublicComment path: /web_service/Django1.6.11/database/course/views.py
#coding=utf-8
#from django.shortcuts import render,render_to_response
#from django.http import HttpResponse,HttpResponseRedirect
#from django.template import RequestContext
#from django import forms
fr... | code_fim | hard | {
"lang": "python",
"repo": "SJTU-LinCH/Project-SchoolPublicComment",
"path": "/web_service/Django1.6.11/database/course/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miyamoto-kentaro/algorithm-python path: /1_sort/2_bubble_sort.py
# O(n**2)
import random
import time
from typing import List
def time_measurement(sort_func) -> float:
<|fim_suffix|> elapsed_time = 0
for _ in range(10):
start_time = time.time()
sort_func(... | code_fim | medium | {
"lang": "python",
"repo": "miyamoto-kentaro/algorithm-python",
"path": "/1_sort/2_bubble_sort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@time_measurement
def bubble_sort(numbers: List[int]) -> List[int]:
len_numbers = len(numbers)
for i in range(len_numbers):
for j in range(len_numbers - i - 1):
if numbers[j] > numbers[j + 1]:
numbers[j],numbers[j + 1] = numbers[j + 1], numbers[j]
retur... | code_fim | hard | {
"lang": "python",
"repo": "miyamoto-kentaro/algorithm-python",
"path": "/1_sort/2_bubble_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> len_numbers = len(numbers)
for i in range(len_numbers):
for j in range(len_numbers - i - 1):
if numbers[j] > numbers[j + 1]:
numbers[j],numbers[j + 1] = numbers[j + 1], numbers[j]
return numbers
if __name__=='__main__':
nums = [random.randint(0, 10... | code_fim | hard | {
"lang": "python",
"repo": "miyamoto-kentaro/algorithm-python",
"path": "/1_sort/2_bubble_sort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HedaYang28/Data_Skills_2_project path: /4pic.py
import os
import datetime as dt
import time
#from snownlp import SnowNLP
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
pd.set_option('display.width', 1000)
pd.set_option('display.max_columns', No... | code_fim | hard | {
"lang": "python",
"repo": "HedaYang28/Data_Skills_2_project",
"path": "/4pic.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> S1=[]
S2=[]
S3 = []
CN_up_all=0
CN_down_all=0
CN_normal_all=0
EN_up_all = 0
EN_down_all = 0
EN_normal_all = 0
for i,r, in df_CN.iterrows():
if r['sentiment']==-1:
CN_down_all=CN_down_all+1
elif r['sentiment']==1:
... | code_fim | hard | {
"lang": "python",
"repo": "HedaYang28/Data_Skills_2_project",
"path": "/4pic.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'Do Something'
try:
alarms = payload
if(len(alarms) < 1):
print("Alarm list empty")
for alarm in alarms:
someObjName = alarm.get("objectName")
alarmClass = alarm.get("criticality")
alarmText... | code_fim | hard | {
"lang": "python",
"repo": "aricent/secure-cloud-native-fabric",
"path": "/SCRM/notif/k8s_eventhandler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #@rpc
@event_handler("NatsEventSubscriberService", "Event_K8SEvent")
def processEvent(self, payload):
'Do Something'
#print("Reached K8s event handler")
sys.stdout.flush()
events = payload
for event in events:
"""----Add code to put Kubernete... | code_fim | hard | {
"lang": "python",
"repo": "aricent/secure-cloud-native-fabric",
"path": "/SCRM/notif/k8s_eventhandler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aricent/secure-cloud-native-fabric path: /SCRM/notif/k8s_eventhandler.py
#
# Copyright 2019 Altran. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lice... | code_fim | hard | {
"lang": "python",
"repo": "aricent/secure-cloud-native-fabric",
"path": "/SCRM/notif/k8s_eventhandler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#tmp files
connection = sqlite3.connect("./databases/" + str(self.__filepath) + ".db")
try:
connection.execute('''CREATE TABLE totalWorth (worth real, date timestamp)''')
except sqlite3.OperationalError:
pass #already exists
now = datetime... | code_fim | hard | {
"lang": "python",
"repo": "runyanjake/cryptogoochers-old",
"path": "/vectorspace/Portfolio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: runyanjake/cryptogoochers-old path: /vectorspace/Portfolio.py
# @author Jake Runyan
# @desc A hypothetical trader that unit tests a variety of VectorSpaces' new APIs to see if using those as margins to trade is worth it.
# ASSUMED FILE TYPES ARE ".PF"
import ccxt
import datetime
from JScraper i... | code_fim | hard | {
"lang": "python",
"repo": "runyanjake/cryptogoochers-old",
"path": "/vectorspace/Portfolio.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #TODO: checkout ccxt https://github.com/ccxt/ccxt for selling to a bunch of markets
#determine best market, connect to it
#CALCULATED BY MEDIAN AMOUNT
scpr = JScraper()
price_per_share = scpr.retrieveMedians(curr=ticker)[0]
#facilitate trade
if ticke... | code_fim | hard | {
"lang": "python",
"repo": "runyanjake/cryptogoochers-old",
"path": "/vectorspace/Portfolio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>USE_L10N = True
USE_TZ = True<|fim_prefix|># repo: shafikshaon/banquet_old path: /banquet/config/internationalization.py
from decouple import config
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
<|fim_middle|>LANGUAGE_CODE = 'en-us'
TIME_ZONE = config('TIME_ZONE', defaul... | code_fim | medium | {
"lang": "python",
"repo": "shafikshaon/banquet_old",
"path": "/banquet/config/internationalization.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shafikshaon/banquet_old path: /banquet/config/internationalization.py
from decouple import config
<|fim_suffix|>TIME_ZONE = config('TIME_ZONE', default='UTC')
USE_I18N = True
USE_L10N = True
USE_TZ = True<|fim_middle|># Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/... | code_fim | medium | {
"lang": "python",
"repo": "shafikshaon/banquet_old",
"path": "/banquet/config/internationalization.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-qi/python2.7_imooc path: /第三章对象迭代与反迭代技巧训练/如何对迭代器做切片操作/test.py
#coding:utf-8
from itertools import islice
<|fim_suffix|># for x in i:
# print x
# for x in range(6):
# print i.next()
l=[x for x in range(20)]
t=iter(l)
#会接着原来的位置进行迭代
for x in islice(t,5,10):
print x
for x in t:
... | code_fim | medium | {
"lang": "python",
"repo": "python-qi/python2.7_imooc",
"path": "/第三章对象迭代与反迭代技巧训练/如何对迭代器做切片操作/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># for x in i:
# print x
# for x in range(6):
# print i.next()
l=[x for x in range(20)]
t=iter(l)
#会接着原来的位置进行迭代
for x in islice(t,5,10):
print x
for x in t:
print x<|fim_prefix|># repo: python-qi/python2.7_imooc path: /第三章对象迭代与反迭代技巧训练/如何对迭代器做切片操作/test.py
#coding:utf-8
from itertools impor... | code_fim | medium | {
"lang": "python",
"repo": "python-qi/python2.7_imooc",
"path": "/第三章对象迭代与反迭代技巧训练/如何对迭代器做切片操作/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yukkyo/ResearchSource path: /27_12_25_Nico4/06_RemoveSymbol.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cPickle
import re
# 形態素解析した結果から、記号や数字のみの単語を削除する
after_mecab_file = "../../ResearchData/Experiment4/after_mecab/after_mecab"
f_docs_without_symbols = "../../ResearchData/Experimen... | code_fim | hard | {
"lang": "python",
"repo": "yukkyo/ResearchSource",
"path": "/27_12_25_Nico4/06_RemoveSymbol.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'convert unicode to str (encode)'
docs_encoded = [[w.encode('utf-8') for w in doc] for doc in docs_without_symbols]
docs_without_symbols = None
print "len(docs_encoded):" + str(len(docs_encoded))
with open(f_docs_without_symbols + name, 'wb') as f_save:
print "open for saving: " + f_do... | code_fim | hard | {
"lang": "python",
"repo": "yukkyo/ResearchSource",
"path": "/27_12_25_Nico4/06_RemoveSymbol.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuliGonzalez/CalculatorLibrary path: /calculator.py
"""
Calculator library contianing basic math operations
"""
<|fim_suffix|>
def substract(first_term, second_term):
return second_term - first_term<|fim_middle|>def add(first_term, second_term):
return first_term + second_term
| code_fim | medium | {
"lang": "python",
"repo": "JuliGonzalez/CalculatorLibrary",
"path": "/calculator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def substract(first_term, second_term):
return second_term - first_term<|fim_prefix|># repo: JuliGonzalez/CalculatorLibrary path: /calculator.py
"""
Calculator library contianing basic math operations
"""
<|fim_middle|>def add(first_term, second_term):
return first_term + second_term
| code_fim | medium | {
"lang": "python",
"repo": "JuliGonzalez/CalculatorLibrary",
"path": "/calculator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def substract(first_term, second_term):
return second_term - first_term<|fim_prefix|># repo: JuliGonzalez/CalculatorLibrary path: /calculator.py
"""
Calculator library contianing basic math operations
"""
def add(first_term, second_term):
<|fim_middle|> return first_term + second_term
| code_fim | easy | {
"lang": "python",
"repo": "JuliGonzalez/CalculatorLibrary",
"path": "/calculator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Uhmier/CSCI-110 path: /taxcalc9-29-14.py
#Tennesse Tax calculator
#Request amount of items from user
#set up while loop to accomodate this amount
#Use variable named total in while loop to keep a running total of items
#use variable named subtotal to keep running subtotal
def is_number(s):
<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "Uhmier/CSCI-110",
"path": "/taxcalc9-29-14.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>TN_TAX = 1.09
counter = 1
total = 0
subtotal = 0
num_items= raw_input('How many items do you plan to check out?')
while not is_number(num_items) :
num_items= raw_input('How many items do you plan to check out?')
if is_number(num_items) :
num_items = float(num_items)
while counter <= num_items :
... | code_fim | medium | {
"lang": "python",
"repo": "Uhmier/CSCI-110",
"path": "/taxcalc9-29-14.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>num_items= raw_input('How many items do you plan to check out?')
while not is_number(num_items) :
num_items= raw_input('How many items do you plan to check out?')
if is_number(num_items) :
num_items = float(num_items)
while counter <= num_items :
item_price = raw_input('What is the price of th... | code_fim | medium | {
"lang": "python",
"repo": "Uhmier/CSCI-110",
"path": "/taxcalc9-29-14.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nicolaei/master path: /wifi_scanner/__main__.py
import json
import logging
from os import path
from json.decoder import JSONDecodeError
from functools import partial
from sys import argv
from datetime import timedelta, datetime
from wifi_scanner.algorithms import smooth_scan, full_scan, selectiv... | code_fim | hard | {
"lang": "python",
"repo": "nicolaei/master",
"path": "/wifi_scanner/__main__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # This could use Argparse, but that's really overcomplicating this simple
# usecase.
if len(argv) < 3:
print(f"Not enough arguments! "
f"Usage: {argv[0]} <scanning algorithm> <scheduler>")
exit(1)
elif argv[1] not in algorithms.keys():
print(f"Invalid ... | code_fim | hard | {
"lang": "python",
"repo": "nicolaei/master",
"path": "/wifi_scanner/__main__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jufei/BtsShell path: /BtsShell/network_lib/__init__.py
from BtsShell import connections
import re, os
import time
# try:
# from network_config import *
# except Exception, e:
# print 'import network_config failed: %s' % e
# pass
#from TcpIp import TcpIps
from Pinger imp... | code_fim | hard | {
"lang": "python",
"repo": "jufei/BtsShell",
"path": "/BtsShell/network_lib/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # remove units which is already ping successfully
for ready_unit in ready_units:
try:
not_ready_units.remove(ready_unit)
except ValueError:
pass
ready_units = [] # empty the ready_units
end_ping_time = time.ti... | code_fim | hard | {
"lang": "python",
"repo": "jufei/BtsShell",
"path": "/BtsShell/network_lib/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print lib_p.planet_info(src_planet,nu_obs,beam_solid_str)<|fim_prefix|># repo: tmatsumu/LBInflightPlanetBeamCalib path: /test_v04.py
import numpy as np
import lib_planetcal as lib_p
<|fim_middle|>src_planet = 'Jupiter'
nu_obs = 40.e9
beam_solid_str = 2.481e-4
| code_fim | medium | {
"lang": "python",
"repo": "tmatsumu/LBInflightPlanetBeamCalib",
"path": "/test_v04.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmatsumu/LBInflightPlanetBeamCalib path: /test_v04.py
import numpy as np
import lib_planetcal as lib_p
<|fim_suffix|>print lib_p.planet_info(src_planet,nu_obs,beam_solid_str)<|fim_middle|>src_planet = 'Jupiter'
nu_obs = 40.e9
beam_solid_str = 2.481e-4
| code_fim | medium | {
"lang": "python",
"repo": "tmatsumu/LBInflightPlanetBeamCalib",
"path": "/test_v04.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mingz2013/spider.collections path: /spider.58/spider/mongo.py
# -*- coding:utf-8 -*-
__author__ = 'zhaojm'
import pymongo
import logging
import random
# MONGO
# MONGO_URI = "localhost:27017"
# mongo_client = pymongo.MongoClient(MONGO_URI)
mongo_client = pymongo.MongoClient()
job_58_db = mongo_c... | code_fim | hard | {
"lang": "python",
"repo": "mingz2013/spider.collections",
"path": "/spider.58/spider/mongo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
# @staticmethod
# def upsert_company(item):
# logging.info("<MONGO> %s" % item)
# job_58_db.company_info.update({'company_url': item['company_url']}, {'$set': item}, True, True)
#
# @staticmethod
# def check_have(company_url):
# if job_58_db.compan... | code_fim | medium | {
"lang": "python",
"repo": "mingz2013/spider.collections",
"path": "/spider.58/spider/mongo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lantunes/deepdab path: /deepdab/util/helper_functions.py
from deepdab import *
def print_info(board_size, policy, num_episodes=None, num_iterations=None, learning_rate=None, min_learning_rate=None, epsilon=None,
min_epsilon=None, temperature=None, min_temperature=None, mode='self... | code_fim | hard | {
"lang": "python",
"repo": "lantunes/deepdab",
"path": "/deepdab/util/helper_functions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> symmetries = []
for sym in all_possible:
if not contains(symmetries, sym):
symmetries.append([convert_edge_matrix_to_board_state(sym[0], edge_length),
convert_edge_matrix_to_board_state(sym[1], edge_length)])
return symmetries
def append_tr... | code_fim | hard | {
"lang": "python",
"repo": "lantunes/deepdab",
"path": "/deepdab/util/helper_functions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jluizmonte/django-livraria path: /apps/author/migrations/0002_auto_20191215_2358.py
# Generated by Django 3.0 on 2019-12-15 23:58
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('genre', '0001_initial'),
('author', '0001_initial'),
]
operati... | code_fim | medium | {
"lang": "python",
"repo": "jluizmonte/django-livraria",
"path": "/apps/author/migrations/0002_auto_20191215_2358.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='author',
name='genre',
),
migrations.AddField(
model_name='author',
name='genre',
field=models.ManyToManyField(to='genre.Genre', verbose_name='Gênero'),
),
... | code_fim | medium | {
"lang": "python",
"repo": "jluizmonte/django-livraria",
"path": "/apps/author/migrations/0002_auto_20191215_2358.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.