text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if int(numbers[x][y])%5 == 0:
word = word + "Loza"
tampered = True
if int(numbers[x][y])%7 == 0:
word = word + "Woza"
tampered = True
if tampered:
numbers[x][y] = word
for x in range(len(numbers)):
print(*numbers[x])
''' 23.
Write code that will print out a t... | code_fim | hard | {
"lang": "python",
"repo": "JuliusC4esar/CS550",
"path": "/looppractice.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif x < 111:
numbers[9].append(x)
for x in range(len(numbers)):
for y in range(11):
word = ""
tampered = False
if int(numbers[x][y])%3 == 0:
word = word + "Coza"
tampered = True
if int(numbers[x][y])%5 == 0:
word = word + "Loza"
tampered = True
if int(n... | code_fim | hard | {
"lang": "python",
"repo": "JuliusC4esar/CS550",
"path": "/looppractice.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> TRANSLATE = {
"-lsb-": "[", "-rsb-": "]", "-lrb-": "(", "-rrb-": ")", "-lcb-": "{",
"-rcb-": "}", "-LSB-": "[", "-RSB-": "]", "-LRB-": "(", "-RRB-": ")",
"-LCB-": "{", "-RCB-": "}"
}
SPECIAL_TOKENS = ["<NULL>", "<UNK>", "<S>", "</S>"]
words = list(map(lambda x: x[0]... | code_fim | hard | {
"lang": "python",
"repo": "thusithaC/QGforQA",
"path": "/QG/ELMo_QG/preprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thusithaC/QGforQA path: /QG/ELMo_QG/preprocess.py
tles and title not in include_titles:
continue
if exclude_titles and title in exclude_titles:
continue
for para in article["paragraphs"]:
paragraphs, questions, answers, sents... | code_fim | hard | {
"lang": "python",
"repo": "thusithaC/QGforQA",
"path": "/QG/ELMo_QG/preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thusithaC/QGforQA path: /QG/ELMo_QG/preprocess.py
0, 0, 0
with open(json_file, "r") as fh, corenlp.CoreNLPClient(annotators="tokenize ssplit pos ner".split(),
endpoint="http://localhost:9099", timeout=50000) as client:
source... | code_fim | hard | {
"lang": "python",
"repo": "thusithaC/QGforQA",
"path": "/QG/ELMo_QG/preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bedanta1998/Spychat path: /venv/main.py
# THIS FILE WAS CREATED IN THIS DIRECTORY EARLIER, NOW MOIVED TO ROOT OF THE REPO
print "Hello buddy"
print "Let's get started"
spy_name = raw_input ("What is your spy name? ")
if len(spy_name) >3:
print "Welcome " + spy_name + ". Glad to have... | code_fim | hard | {
"lang": "python",
"repo": "bedanta1998/Spychat",
"path": "/venv/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rating ")
if spy_rating>=5.0:
print "Great spy"
elif 3.5<=spy_rating<5.0:
print "Good spy"
elif 2<=spy_rating<3.5:
print "Not bad."
else :
print "Not good. Need hardwork"
s... | code_fim | hard | {
"lang": "python",
"repo": "bedanta1998/Spychat",
"path": "/venv/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.name
eav.register(RiskType)<|fim_prefix|># repo: dgorobets/britecore_backend path: /app/models.py
from django.db import models
import eav
from django.utils import timezone
<|fim_middle|>class RiskType(models.Model):
"""A model class used for storing data
about risk types
... | code_fim | hard | {
"lang": "python",
"repo": "dgorobets/britecore_backend",
"path": "/app/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgorobets/britecore_backend path: /app/models.py
from django.db import models
import eav
from django.utils import timezone
class RiskType(models.Model):
"""A model class used for storing data
about risk types
"""
name = models.CharField(max_length=255)
created = models.DateT... | code_fim | easy | {
"lang": "python",
"repo": "dgorobets/britecore_backend",
"path": "/app/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> epd.sleep()
except:
print 'traceback.format_exc():\n%s' % traceback.format_exc()
exit()<|fim_prefix|># repo: lavirott/e-Paper path: /2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
import epd2in7
import time
from PIL impo... | code_fim | medium | {
"lang": "python",
"repo": "lavirott/e-Paper",
"path": "/2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>except:
print 'traceback.format_exc():\n%s' % traceback.format_exc()
exit()<|fim_prefix|># repo: lavirott/e-Paper path: /2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
import epd2in7
import time
from PIL import Image,ImageDraw,ImageF... | code_fim | medium | {
"lang": "python",
"repo": "lavirott/e-Paper",
"path": "/2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lavirott/e-Paper path: /2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
<|fim_suffix|> epd.sleep()
except:
print 'traceback.format_exc():\n%s' % traceback.format_exc()
exit()<|fim_middle|>import epd2in7
import time... | code_fim | medium | {
"lang": "python",
"repo": "lavirott/e-Paper",
"path": "/2.7inch_e-Paper-RaspberryPi/sample_code/RaspberryPi/python2/clear.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> distances = {}
print(duckie_boxes)
for box in duckie_boxes:
distances[box] = round(dist_half_screen*(1/2)*(camera_y_res/box[3]))
distances = [ (box, round(dist_half_screen*(1/2)*(camera_y_res/box[3]) ) ) for box in duckie_boxes] # NOTE: Y coordinate ... | code_fim | hard | {
"lang": "python",
"repo": "EyeofEnder/ELCA-Duck-Vision",
"path": "/polyhack.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EyeofEnder/ELCA-Duck-Vision path: /polyhack.py
import requests,cv2,numpy,time,imutils
class imageAnalyzer():
def __init__(self,
roverName="Rover03",
url="http://192.168.1.10:5000/api/",
temp_img_path = "./temp",
):
... | code_fim | hard | {
"lang": "python",
"repo": "EyeofEnder/ELCA-Duck-Vision",
"path": "/polyhack.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> str_time = "%d-%d-%d" % (year, month, day)
time_tuple = time.strptime(str_time, "%Y-%m-%d")
tuple_week = ("星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日")
return tuple_week[time_tuple[6]]
print(get_week(2020, 1, 16))<|fim_prefix|># repo: fsym-fs/Python_AID path: /month01/teacher/day14/e... | code_fim | easy | {
"lang": "python",
"repo": "fsym-fs/Python_AID",
"path": "/month01/teacher/day14/exercise03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fsym-fs/Python_AID path: /month01/teacher/day14/exercise03.py
"""
定义函数,根据年、月、日计算星期。
0 星期一
1 星期二
....
"""
import time
<|fim_suffix|> str_time = "%d-%d-%d" % (year, month, day)
time_tuple = time.strptime(str_time, "%Y-%m-%d")
tuple_week = ("星期一", "星期二", "星期三", "... | code_fim | easy | {
"lang": "python",
"repo": "fsym-fs/Python_AID",
"path": "/month01/teacher/day14/exercise03.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>today = datetime.date.today()
print("Today :: ", today, today.timetuple())
print("Difference Between Time :: ", timedelta(time_two.second) - timedelta(time_one.second))
print("Today :: ", datetime.date.today())
print("Time.asctime() :: ", time.asctime())
now = time.gmtime()
print("time.asctime(time.gmti... | code_fim | medium | {
"lang": "python",
"repo": "kwishna/Python_Random_Practice",
"path": "/learn_codes/Python_Libraries/datetime_one.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwishna/Python_Random_Practice path: /learn_codes/Python_Libraries/datetime_one.py
from datetime import *
import datetime
import time
time_one = datetime.time(1, 2, 3)
print("Time One :: ", time_one)
time_two = datetime.time(hour=23, minute=59, second=59, microsecond=99)
print("Time Two :: ", ti... | code_fim | hard | {
"lang": "python",
"repo": "kwishna/Python_Random_Practice",
"path": "/learn_codes/Python_Libraries/datetime_one.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
root = Tk()
app = MainWindow(root)
root.mainloop()<|fim_prefix|># repo: Catharina-vanVeen/Basic-Python-Projects path: /Web Page generator/WebPageGeneratorMain.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python version 3.8.5
#
# Author Maria Cathar... | code_fim | hard | {
"lang": "python",
"repo": "Catharina-vanVeen/Basic-Python-Projects",
"path": "/Web Page generator/WebPageGeneratorMain.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Catharina-vanVeen/Basic-Python-Projects path: /Web Page generator/WebPageGeneratorMain.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python version 3.8.5
#
# Author Maria Catharina van Veen
#
# Purpose To provide users with a tool to create
# or edit an... | code_fim | hard | {
"lang": "python",
"repo": "Catharina-vanVeen/Basic-Python-Projects",
"path": "/Web Page generator/WebPageGeneratorMain.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrahman1988/PythonSandbox path: /myControlFlow_while.py
'''
The while statement allows you to repeatedly execute a block of statements as long as a condition is true.
A while statement is an example of what is called a looping statement. A while statement can have an optional else clause.
'''
<|... | code_fim | medium | {
"lang": "python",
"repo": "jrahman1988/PythonSandbox",
"path": "/myControlFlow_while.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
guess = int(input('Enter an integer : ')) #input statement to enter data from console
if guess == number:
print('Congratulations, you guessed it.')
break
elif guess < number:
print('No, it is a little higher than that.')
continue
else:
pr... | code_fim | medium | {
"lang": "python",
"repo": "jrahman1988/PythonSandbox",
"path": "/myControlFlow_while.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Guessing game using while-else loop
number = 23
while True:
guess = int(input('Enter an integer : ')) #input statement to enter data from console
if guess == number:
print('Congratulations, you guessed it.')
break
elif guess < number:
print('No, it is a little higher ... | code_fim | hard | {
"lang": "python",
"repo": "jrahman1988/PythonSandbox",
"path": "/myControlFlow_while.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MIB-Lab/cisc_499_project path: /evolve.py
import numpy as np
import initialization as init
import evaluation as eval
import selection as sel
import recombination as rec
import mutation as mut
<|fim_suffix|>for gen in range(params['gens']):
parents = select(population, params['n_pars'])
... | code_fim | hard | {
"lang": "python",
"repo": "MIB-Lab/cisc_499_project",
"path": "/evolve.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>params = {'gens': 100,
'n_off': 50,
'n_pars': 100,
'n_objs': 1,
'pop_size': 150,
'len_gene': 100,
'mut_rate': 0.5}
population = initialize(params)
population = evaluate(params, population)
for gen in range(params['gens']):
parents = select(... | code_fim | medium | {
"lang": "python",
"repo": "MIB-Lab/cisc_499_project",
"path": "/evolve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jijoy/cf-apps path: /apps-monitor/instance-party.py
import os
import json
from threading import Thread
import time
from time import sleep
from flask import Flask, json, render_template, request
import redis
from collections import OrderedDict
import requests
from Queue import Queue
REGISTRAR_UR... | code_fim | hard | {
"lang": "python",
"repo": "jijoy/cf-apps",
"path": "/apps-monitor/instance-party.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This endpoint is for adding threads to the application.
Loadbalancer decids to go for which instances and based on that thread is added to it.
"""
instance_id = os.getenv("CF_INSTANCE_INDEX")
print 'Instance Id ****************%s'%instance_id
thread_count = int(db.... | code_fim | hard | {
"lang": "python",
"repo": "jijoy/cf-apps",
"path": "/apps-monitor/instance-party.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def addBlock(self, aBlock: gp.Block):
"""adds a block to the game board"""
if self.blocks[aBlock.y][aBlock.x] != None:
raise MovementError('game board space not empty')
self.blocks[aBlock.y][aBlock.x] = aBlock
self.groundSprites.append(aBlock.sprite)
d... | code_fim | hard | {
"lang": "python",
"repo": "mbrown2/mypytris",
"path": "/mypytris/Game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbrown2/mypytris path: /mypytris/Game.py
from arcade.sprite_list.sprite_list import SpriteList
import GamePiece as gp
from Errors import *
class GameConfig:
WINDOW_TITLE = "MyPyTris"
SCREEN_WIDTH = 450
SCREEN_HEIGHT = 900
BLOCK_PX = 45 # 45px blocks on screen
SPRITE_PX = 64 ... | code_fim | hard | {
"lang": "python",
"repo": "mbrown2/mypytris",
"path": "/mypytris/Game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.store.get_agent()
def set_task(self,task_id, state):
self.store.tasks[task_id].state = state<|fim_prefix|># repo: zj-myidea/MYIDEA path: /scheduler/service/cm.py
from .storage import Storage
class ConnectionManager:
def __init__(self):
self.store = Storage()... | code_fim | medium | {
"lang": "python",
"repo": "zj-myidea/MYIDEA",
"path": "/scheduler/service/cm.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zj-myidea/MYIDEA path: /scheduler/service/cm.py
from .storage import Storage
class ConnectionManager:
def __init__(self):
<|fim_suffix|> return self.store.get_task(agent_id)
sendmsg = handle
def get_agents(self):
return self.store.get_agent()
def set_task(self,t... | code_fim | hard | {
"lang": "python",
"repo": "zj-myidea/MYIDEA",
"path": "/scheduler/service/cm.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertopauletto/PyMOTW-it_3.0 path: /dumpscripts/socket_address_packing.py
# socket_address_packing.py
import binascii
import socket
import struct
import sys
f<|fim_suffix|>scii.hexlify(packed))
print('Spacchettato :', socket.inet_ntoa(packed))
print()<|fim_middle|>or string_address in ... | code_fim | medium | {
"lang": "python",
"repo": "robertopauletto/PyMOTW-it_3.0",
"path": "/dumpscripts/socket_address_packing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>scii.hexlify(packed))
print('Spacchettato :', socket.inet_ntoa(packed))
print()<|fim_prefix|># repo: robertopauletto/PyMOTW-it_3.0 path: /dumpscripts/socket_address_packing.py
# socket_address_packing.py
import binascii
import socket
import struct
import sys
for string_address in ['192.168.1.1'... | code_fim | medium | {
"lang": "python",
"repo": "robertopauletto/PyMOTW-it_3.0",
"path": "/dumpscripts/socket_address_packing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KnifestRapGameMurder/Pointers path: /AnnaPyton/ltss23/ltss23/ltss23.py
#dict1 = {"я":"i","люблю":"love","Питон":"Рython"}
#user_input = input("---->")
#print(dict1[user_input])
#list1 =[i for i in range(0,101) if i%7 ==0 if i%5 !=0]
#print(list1)
#stroka = "я обычная строка быть которая долж... | code_fim | hard | {
"lang": "python",
"repo": "KnifestRapGameMurder/Pointers",
"path": "/AnnaPyton/ltss23/ltss23/ltss23.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>##3.
##def arifm(*x):
## return(sum(x)/len(x))
##print(arifm(1,2,4,5,6))
##4.
##def dict2(x,y):
## return {x:y}
##dict1 = {}
##dict1.update(dict2("GB","London"))
##print(dict1)
##dict5 = {}
##dict5.update(dict2("Hungary","Budapest"))
##print(dict5)<|fim_prefix|># repo: KnifestRapGameMurder/Pointe... | code_fim | hard | {
"lang": "python",
"repo": "KnifestRapGameMurder/Pointers",
"path": "/AnnaPyton/ltss23/ltss23/ltss23.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for letter in input_string:
if letter in input_string:
# ALPHABET.index(letter) returns the index of that letter in the ALPHABET list
# then we can add the key to that index to get the letter
# then we take the mod of that so if the letter is x and 10 it cycle back to the begin... | code_fim | medium | {
"lang": "python",
"repo": "MrSupiri/PP1-CourseWork-1",
"path": "/part-2-a.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrSupiri/PP1-CourseWork-1 path: /part-2-a.py
ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
# Convert the ALPHABET to list
ALPHABET = [i for i in ALPHABET]
output_string = ''
input_string = input('Enter a String : ')
<|fim_suffix|>for letter in input_string:
if letter in input_string:
# ALP... | code_fim | medium | {
"lang": "python",
"repo": "MrSupiri/PP1-CourseWork-1",
"path": "/part-2-a.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)<|fim_prefix|># repo: mikebochenek/learning path: /python/regex_logs.py
import re
APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+\s[+\-]\d{4})\] "(\S+) (\S+)\s*(\S*)" (\d{3}) (\S+)'
pattern = re.com<|fim_middle|>pile(APACHE_A... | code_fim | medium | {
"lang": "python",
"repo": "mikebochenek/learning",
"path": "/python/regex_logs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikebochenek/learning path: /python/regex_logs.py
import re
APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+<|fim_suffix|>pile(APACHE_ACCESS_LOG_PATTERN)
print re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)<|fim_middle|>\s[+\-]\d{4})... | code_fim | medium | {
"lang": "python",
"repo": "mikebochenek/learning",
"path": "/python/regex_logs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>pile(APACHE_ACCESS_LOG_PATTERN)
print re.match('ix-sac6-20.ix.netcom.com - - [08/Aug/1995:14:43:39 -0400] "GET / HTTP/1.0 " 200 7131', 0)<|fim_prefix|># repo: mikebochenek/learning path: /python/regex_logs.py
import re
APACHE_ACCESS_LOG_PATTERN = '^(\S+) (\S+) (\S+) \[([\w:/]+<|fim_middle|>\s[+\-]\d{4})... | code_fim | medium | {
"lang": "python",
"repo": "mikebochenek/learning",
"path": "/python/regex_logs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def PrintAllocation(self):
allocationSum = 0
for i in xrange(self.now):
allocationSum += self.allocationRequest[i]
print str(i) + ',' + str(allocationSum)
def OutputResult(self):
allocationSum = 0
f = open(self.OUTPUT_NAME, 'w')
f.write('time,spent,allocation\n')
for i in xrange(self.... | code_fim | hard | {
"lang": "python",
"repo": "wlwkgus/AdAllocationControlSimulation",
"path": "/Simulator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def OutputResult(self):
allocationSum = 0
f = open(self.OUTPUT_NAME, 'w')
f.write('time,spent,allocation\n')
for i in xrange(self.now):
allocationSum += self.allocationRequest[i]
f.write(str(i) + ',' + str(self.timeSpent[i]) + ',' + str(allocationSum) + '\n')
f.close()<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "wlwkgus/AdAllocationControlSimulation",
"path": "/Simulator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wlwkgus/AdAllocationControlSimulation path: /Simulator.py
# -*- coding:utf-8 -*-
import time
import random
import numpy as np
from collections import defaultdict
class Simulator(object):
ALLOCATION_INTERVAL_MEAN = 150
ALLOCATION_INTERVAL_STDEV = 30
AFTER_ALLOCATION_INTERVAL_MEAN = 150
AFTER_... | code_fim | hard | {
"lang": "python",
"repo": "wlwkgus/AdAllocationControlSimulation",
"path": "/Simulator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chiaki64/Windless path: /core/task/celery.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from celery import Celery
app = Celery('task', include=['task.tasks'])
<|fim_suffix|>if __name__ == '__main__':
app.start()<|fim_middle|>app.config_from_object('task.config')
| code_fim | easy | {
"lang": "python",
"repo": "chiaki64/Windless",
"path": "/core/task/celery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app.config_from_object('task.config')
if __name__ == '__main__':
app.start()<|fim_prefix|># repo: chiaki64/Windless path: /core/task/celery.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from celery import Celery
<|fim_middle|>app = Celery('task', include=['task.tasks'])
| code_fim | easy | {
"lang": "python",
"repo": "chiaki64/Windless",
"path": "/core/task/celery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def OnCallback (self, bodyWithTreeCollision, body, vertices, vertexstrideInBytes, indexCount, indexArray):
if self.callbackFunc != None:
self.callbackFunc( bodyWithTreeCollision, body, vertices, vertexstrideInBytes, indexCount, indexArray)
pass
#material extensions
class Material ( pynewton.Mate... | code_fim | hard | {
"lang": "python",
"repo": "fathat/pynewton",
"path": "/dist/newton.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for body in self.bodyList:
function( body )
def RayCast( self, p0, p1, callback, userdata):
"""Casts a ray in the world defined by p0 and p1 and calls callback
with the body, normal, collision id, user data and intersection distance"""
self.raycastUserData = userdata
self.raycastCallback =... | code_fim | hard | {
"lang": "python",
"repo": "fathat/pynewton",
"path": "/dist/newton.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fathat/pynewton path: /dist/newton.py
# The purpose of this module is essentially to subclass the basic SWIG generated
# pynewton classes and add a bit of functionality to them (mostly callback related
# stuff). This could be done in the SWIG interface file, but it's easier to do it
# here since ... | code_fim | hard | {
"lang": "python",
"repo": "fathat/pynewton",
"path": "/dist/newton.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vbarrera/thesis path: /Odd_Methylated_CpG_Identification/Python/MethProfile.py
'''
@author: Victor Barrera Burgos
Created on 09 Feb 2014
Description: This script permits the obtention of the
methylation profile of a CpGRegion indicating the
methylation status of each CpG dinucleotide.
Addition ... | code_fim | hard | {
"lang": "python",
"repo": "vbarrera/thesis",
"path": "/Odd_Methylated_CpG_Identification/Python/MethProfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif (((cpgDin.firstPosMethCoef)==-1) & ((cpgDin.secondPosMethCoef)!=-1)):
cpgDin.meanMethCoef=cpgDin.secondPosMethCoef
else:
cpgDin.meanMethCoef=float(cpgDin.firstPosMethCoef+cpgDin.secondPosMethCoef)/2.0
# Post: The object is returned with its methylation Coefficients recalculat... | code_fim | hard | {
"lang": "python",
"repo": "vbarrera/thesis",
"path": "/Odd_Methylated_CpG_Identification/Python/MethProfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
cpgDin.meanMethCoef=float(cpgDin.firstPosMethCoef+cpgDin.secondPosMethCoef)/2.0
# Post: The object is returned with its methylation Coefficients recalculated according
# to the data present in the alignment file and using a minimum read filter.
####################
### Main #########... | code_fim | hard | {
"lang": "python",
"repo": "vbarrera/thesis",
"path": "/Odd_Methylated_CpG_Identification/Python/MethProfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(args):
"""
Creates the OpenLDAP and SMTP
objects and iterates over the .csv file.
Calls the create_user function and check the
result (if 'true' the count will be increased).
Returns the total count of users created.
"""
open_ldap = OpenLdap(args.user,
... | code_fim | hard | {
"lang": "python",
"repo": "alefeans/csv-to-ldap",
"path": "/csv_to_ldap/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run(args):
"""
Creates the OpenLDAP and SMTP
objects and iterates over the .csv file.
Calls the create_user function and check the
result (if 'true' the count will be increased).
Returns the total count of users created.
"""
open_ldap = OpenLdap(args.user,
... | code_fim | hard | {
"lang": "python",
"repo": "alefeans/csv-to-ldap",
"path": "/csv_to_ldap/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alefeans/csv-to-ldap path: /csv_to_ldap/main.py
import sys
from arguments_parser import parse_args
from open_ldap import OpenLdap
from csv_parser import parse_csv, random_password
from smtp_mail import SmtpServer
def create_user(open_ldap, smtp, entries):
<|fim_suffix|>
def run(args):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "alefeans/csv-to-ldap",
"path": "/csv_to_ldap/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kuhar-tarass/Xteams path: /module-2-tkuhar/wallet.py
#!/usr/bin/env python
# coding: utf-8
#%%:
import secrets
import hashlib
import base64
import ecdsa
from sys import byteorder
#%%:
class k_box:
def __init__(self, string = 0, file = 0):
if string != 0:
if not(len(stri... | code_fim | hard | {
"lang": "python",
"repo": "kuhar-tarass/Xteams",
"path": "/module-2-tkuhar/wallet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def f_import_private(filename):
file = open(filename, 'r')
wif_key = file.read()
file.close()
key = from_WIF(wif_key)
key_pair = k_box(string=key.hex())
return key_pair
#%%:
def from_WIF(wif_key):
if not(len(wif_key) == 51):
raise Exception("Bad len of WIF key")
... | code_fim | hard | {
"lang": "python",
"repo": "kuhar-tarass/Xteams",
"path": "/module-2-tkuhar/wallet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
with open(args.fixtures_location_file, 'w') as file:
file.write('namespace flutter {namespace testing {const char* GetFixturesPath() {return "%s";}}}'
% args.fixtures_location)
if __name__ == '__main__':
sys.exit(main())<|fim_prefix|># repo: greatpie/engine p... | code_fim | hard | {
"lang": "python",
"repo": "greatpie/engine",
"path": "/testing/build/gen_fixtures_location_symbol.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greatpie/engine path: /testing/build/gen_fixtures_location_symbol.py
#!/usr/bin/env python
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import subprocess
import sys... | code_fim | hard | {
"lang": "python",
"repo": "greatpie/engine",
"path": "/testing/build/gen_fixtures_location_symbol.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: javed2214/Marksheet path: /Marksheet/urls.py
from django.contrib import admin
from django.urls import path
from . import view
urlpattern<|fim_suffix|>MarkSheet', view.getMarks, name='MarkSheet'),
]<|fim_middle|>s = [
path('', view.enterMarks),
path(' | code_fim | easy | {
"lang": "python",
"repo": "javed2214/Marksheet",
"path": "/Marksheet/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = [
path('', view.enterMarks),
path('MarkSheet', view.getMarks, name='MarkSheet'),
]<|fim_prefix|># repo: javed2214/Marksheet path: /Marksheet/urls.py
from django.contrib import admin
from django.<|fim_middle|>urls import path
from . import view
urlpattern | code_fim | easy | {
"lang": "python",
"repo": "javed2214/Marksheet",
"path": "/Marksheet/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>MarkSheet', view.getMarks, name='MarkSheet'),
]<|fim_prefix|># repo: javed2214/Marksheet path: /Marksheet/urls.py
from django.contrib import admin
from django.urls import path
from . import view
urlpattern<|fim_middle|>s = [
path('', view.enterMarks),
path(' | code_fim | easy | {
"lang": "python",
"repo": "javed2214/Marksheet",
"path": "/Marksheet/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> row_count = ws.max_row
for h in range(2,row_count):
regi_number = ws.cell(row=h, column=2).value
Post_Code = ws.cell(row=h, column=4).value
main_link = 'https://www.allabolag.se/'+str(regi_number)+'/befattningar'
y... | code_fim | hard | {
"lang": "python",
"repo": "patilanup246/youtube",
"path": "/alllabola_script.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for h in range(2,row_count):
regi_number = ws.cell(row=h, column=2).value
Post_Code = ws.cell(row=h, column=4).value
main_link = 'https://www.allabolag.se/'+str(regi_number)+'/befattningar'
yield scrapy.FormRequest(main_link,call... | code_fim | hard | {
"lang": "python",
"repo": "patilanup246/youtube",
"path": "/alllabola_script.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patilanup246/youtube path: /alllabola_script.py
# -*- coding: utf-8 -*-
import scrapy
import MySQLdb
import openpyxl
from scrapy.crawler import CrawlerProcess
import sys
class AllabolaSpider(scrapy.Spider):
name = 'allabola'
allowed_domains = ['https://www.allabolag.se']
start_urls ... | code_fim | hard | {
"lang": "python",
"repo": "patilanup246/youtube",
"path": "/alllabola_script.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>value_list.sort(reverse=True) # 내림차순 정렬
answer = 0
value = 9
for s in value_list:
answer += value * s
value -= 1
# 출력
print(answer)<|fim_prefix|># repo: otu165/Algorithm path: /python/BOJ_1339.py
''' 단어 수학
시간 : 68ms (~2초), 메모리 : 29200KB (~256MB)
분류 : greedy
'''
import sys
input = sys.stdin.re... | code_fim | medium | {
"lang": "python",
"repo": "otu165/Algorithm",
"path": "/python/BOJ_1339.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: otu165/Algorithm path: /python/BOJ_1339.py
''' 단어 수학
시간 : 68ms (~2초), 메모리 : 29200KB (~256MB)
분류 : greedy
'''
import sys
input = sys.stdin.readline
# 입력
N = int(input()) # 단어의 개수
arr = [list(input().strip()) for _ in range(N)]
# 풀이
alphabet = []
for word in arr:
for a in word:
if a... | code_fim | medium | {
"lang": "python",
"repo": "otu165/Algorithm",
"path": "/python/BOJ_1339.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>answer = 0
value = 9
for s in value_list:
answer += value * s
value -= 1
# 출력
print(answer)<|fim_prefix|># repo: otu165/Algorithm path: /python/BOJ_1339.py
''' 단어 수학
시간 : 68ms (~2초), 메모리 : 29200KB (~256MB)
분류 : greedy
'''
import sys
input = sys.stdin.readline
<|fim_middle|># 입력
N = int(input()... | code_fim | hard | {
"lang": "python",
"repo": "otu165/Algorithm",
"path": "/python/BOJ_1339.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
c = self.conn.cursor()
c.execute(
'INSERT INTO product (`name`,customerId,is_enable) VALUES(%s,%s,%s)',
(product.name,product.customerId, product.is_enable))
return c.lastrowid
except Exception as e:
raise... | code_fim | medium | {
"lang": "python",
"repo": "softrebel/LevelUpTask1.5",
"path": "/db_upgrader/Repositories/productStore.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: softrebel/LevelUpTask1.5 path: /db_upgrader/Repositories/productStore.py
from db_upgrader.Repositories.store import Store, StoreException
from db_upgrader.Models.product import *
<|fim_suffix|> table = 'product'
def add_product(self, product):
try:
c = self.conn.cursor... | code_fim | medium | {
"lang": "python",
"repo": "softrebel/LevelUpTask1.5",
"path": "/db_upgrader/Repositories/productStore.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: julgachancipa/holbertonschool-higher_level_programming path: /0x03-python-data_structures/7-add_tuple.py
#!/usr/bin/python3
def add_tuple(tuple_a=(), tuple_b=()):
if len(tuple_a) < 1:
a_x = 0
else:
<|fim_suffix|> else:
b_y = tuple_b[1]
a = a_x + b_x
b = a_y + b_... | code_fim | hard | {
"lang": "python",
"repo": "julgachancipa/holbertonschool-higher_level_programming",
"path": "/0x03-python-data_structures/7-add_tuple.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
b_y = tuple_b[1]
a = a_x + b_x
b = a_y + b_y
tuple_c = (a, b)
return tuple_c<|fim_prefix|># repo: julgachancipa/holbertonschool-higher_level_programming path: /0x03-python-data_structures/7-add_tuple.py
#!/usr/bin/python3
def add_tuple(tuple_a=(), tuple_b=()):
if len... | code_fim | medium | {
"lang": "python",
"repo": "julgachancipa/holbertonschool-higher_level_programming",
"path": "/0x03-python-data_structures/7-add_tuple.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yongjhih/fh2py path: /game/plugins/NCOrifle.py
# -*- coding: iso-8859-15 -*-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | code_fim | hard | {
"lang": "python",
"repo": "yongjhih/fh2py",
"path": "/game/plugins/NCOrifle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getData(self, player):
map, gamemode, size = getCurrentRound()
if map in NCO_kits.keys():
def_kit1, def_kit2 = NCO_kits[map]
exec('def_kit = def_kit%d' % player.getTeam())
return def_kit
else:
print 'NCOrifle: Can\'t fi... | code_fim | hard | {
"lang": "python",
"repo": "yongjhih/fh2py",
"path": "/game/plugins/NCOrifle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goutamkota/E-commercial-Website-for-books path: /website/bookstore/migrations/0004_book_seller.py
# Generated by Django 3.1.3 on 2020-11-18 13:26
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
<|fim_suffix|... | code_fim | medium | {
"lang": "python",
"repo": "goutamkota/E-commercial-Website-for-books",
"path": "/website/bookstore/migrations/0004_book_seller.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('bookstore', '0003_auto_20201118_1325'),
]
operations = [
migrations.AddField(
model_name='book',
name='seller',
field=models.ForeignKey(default=1, on_delet... | code_fim | medium | {
"lang": "python",
"repo": "goutamkota/E-commercial-Website-for-books",
"path": "/website/bookstore/migrations/0004_book_seller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbae11/raven path: /framework/Metrics/Metric.py
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | code_fim | hard | {
"lang": "python",
"repo": "jbae11/raven",
"path": "/framework/Metrics/Metric.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Method that reads the portion of the xml input that belongs to this specialized class
and initialize internal parameters
@ In, xmlNode, xml.etree.Element, Xml element node
@ Out, None
"""
self._localReadMoreXML(xmlNode)
def distance(self,x,y,**kwargs):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "jbae11/raven",
"path": "/framework/Metrics/Metric.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zakame/nixpkgs-review path: /nixpkgs_review/__init__.py
import sys
from . import cli
<|fim_suffix|> try:
command = sys.argv[0]
args = sys.argv[1:]
cli.main(command, args)
except KeyboardInterrupt:
pass<|fim_middle|>def main() -> None:
| code_fim | easy | {
"lang": "python",
"repo": "zakame/nixpkgs-review",
"path": "/nixpkgs_review/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
command = sys.argv[0]
args = sys.argv[1:]
cli.main(command, args)
except KeyboardInterrupt:
pass<|fim_prefix|># repo: zakame/nixpkgs-review path: /nixpkgs_review/__init__.py
import sys
from . import cli
<|fim_middle|>def main() -> None:
| code_fim | easy | {
"lang": "python",
"repo": "zakame/nixpkgs-review",
"path": "/nixpkgs_review/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleCloudPlatform/training-data-analyst path: /courses/machine_learning/deepdive2/recommendation_systems/solutions/walsmodel/model.py
#!/usr/bin/env python
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/training-data-analyst",
"path": "/courses/machine_learning/deepdive2/recommendation_systems/solutions/walsmodel/model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def find_top_k(user, item_factors, k):
all_items = tf.matmul(a = tf.expand_dims(input = user, axis = 0), b = tf.transpose(a = item_factors))
topk = tf.nn.top_k(input = all_items, k = k)
return tf.cast(x = topk.indices, dtype = tf.int64)
def batch_predict(args):
import numpy as np
... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/training-data-analyst",
"path": "/courses/machine_learning/deepdive2/recommendation_systems/solutions/walsmodel/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> term_data = self.doc.get_term_data()
self.assertIsNotNone(term_data)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: kcl-ddh/bacalhau path: /tests/test_document.py
from bacalhau.tei_document import TEIDocument
import nltk
import unittest
class TestDocument(unittest.... | code_fim | medium | {
"lang": "python",
"repo": "kcl-ddh/bacalhau",
"path": "/tests/test_document.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kcl-ddh/bacalhau path: /tests/test_document.py
from bacalhau.tei_document import TEIDocument
import nltk
import unittest
class TestDocument(unittest.TestCase):
def setUp(self):
<|fim_suffix|> self.assertEqual(2, self.doc.get_text_count())
def test_get_texts(self):
texts... | code_fim | hard | {
"lang": "python",
"repo": "kcl-ddh/bacalhau",
"path": "/tests/test_document.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_term_data(self):
term_data = self.doc.get_term_data()
self.assertIsNotNone(term_data)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: kcl-ddh/bacalhau path: /tests/test_document.py
from bacalhau.tei_document import TEIDocument
import nltk
import unitt... | code_fim | medium | {
"lang": "python",
"repo": "kcl-ddh/bacalhau",
"path": "/tests/test_document.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
idxfile='cullpdb_pc90_res10_R1_inclNOTXRAY_inclCA_d161006_chains.txt'
idx=open(idxfile,"r")
idx.readline()
#idx.readline()
#idx.readline()
EC=""
i=0
for line in idx:
i=i+1
print(i)
try:
protein=line[0:4]
protein=protein.lower()
parser = PDB.PDBP... | code_fim | hard | {
"lang": "python",
"repo": "quagpwn/alternating-left-right",
"path": "/microfolds_organic_5.12.17.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quagpwn/alternating-left-right path: /microfolds_organic_5.12.17.py
import Bio
import os
import sys
from Bio import PDB
from Bio.PDB import PDBIO
from Bio.PDB.PDBParser import PDBParser
import math
import numpy
from collections import Counter
import random
from Bio.PDB import *
import... | code_fim | hard | {
"lang": "python",
"repo": "quagpwn/alternating-left-right",
"path": "/microfolds_organic_5.12.17.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> protein=line[0:4]
protein=protein.lower()
parser = PDB.PDBParser(PERMISSIVE=1)
curdir=os.getcwd()
pdbl.retrieve_pdb_file(protein,pdir=curdir+'/pdbs/')
#print (protein,'/home/hraanan/pdb_download/'+protein[1:3]+'/pdb'+protein+'.ent.gz')
#print ('unzipin... | code_fim | hard | {
"lang": "python",
"repo": "quagpwn/alternating-left-right",
"path": "/microfolds_organic_5.12.17.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> columnIndexPairs = columnIndexes(peaks)
ystart = 0
yend = img.shape[0]
for columnIndexPair in columnIndexPairs:
xstart = max(columnIndexPair[0]-PADDING, 0)
xend = min(columnIndexPair[1]+PADDING, img.shape[1])
if not os.path.exists(directory):
os.makedir... | code_fim | hard | {
"lang": "python",
"repo": "alihusain120/BPL-Liberator",
"path": "/ocr/column_extractor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test(img, basename):
#h, w, _ = img.shape
#test_img = cv2.imread('./ocr/data/8k71pf94q/2_commonwealth_8k71pf94q_accessFull.jpg')
test_img = convertToGrayscale(img)
#ret,test_img = cv2.threshold(test_img,25,255,0)
#cv2.imwrite('./ocr/test_images/contours/'+basename+'prepixelcrop.jp... | code_fim | hard | {
"lang": "python",
"repo": "alihusain120/BPL-Liberator",
"path": "/ocr/column_extractor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alihusain120/BPL-Liberator path: /ocr/column_extractor.py
# https://github.com/jscancella/NYTribuneOCRExperiments/blob/master/findText_usingSums.py
import os
import io
from pathlib import Path
import sys
os.environ['OPENCV_IO_ENABLE_JASPER']='True' # has to be set before importing cv2 otherwise ... | code_fim | hard | {
"lang": "python",
"repo": "alihusain120/BPL-Liberator",
"path": "/ocr/column_extractor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('group/',views.CreateGroup.as_view(), name='group_create'),
path('shift/',views.CreateShift.as_view(), name='shift_create'),
path('subject/',views.createSubject.as_view(), name='subject_create'),
]<|fim_prefix|># repo: Eshala/strack path: /group/urls.py
from django.urls impo... | code_fim | easy | {
"lang": "python",
"repo": "Eshala/strack",
"path": "/group/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Eshala/strack path: /group/urls.py
from django.urls import path
from group import views
<|fim_suffix|>urlpatterns = [
path('group/',views.CreateGroup.as_view(), name='group_create'),
path('shift/',views.CreateShift.as_view(), name='shift_create'),
path('subject/',views.createSubject.as_... | code_fim | easy | {
"lang": "python",
"repo": "Eshala/strack",
"path": "/group/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nxtra/H-rank path: /ProblemSolving/python/test/testHurdleRace.py
from HurdleRace import hurdleRace
from ddt import ddt, data, unpack
import unittest
<|fim_suffix|> def test_hurdleRace(self):
height = [1, 6, 3, 5, 2]
k = 4
sum_too_high = hurdleRace(k, height)
s... | code_fim | easy | {
"lang": "python",
"repo": "Nxtra/H-rank",
"path": "/ProblemSolving/python/test/testHurdleRace.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_hurdleRace(self):
height = [1, 6, 3, 5, 2]
k = 4
sum_too_high = hurdleRace(k, height)
self.assertEqual(2, sum_too_high)<|fim_prefix|># repo: Nxtra/H-rank path: /ProblemSolving/python/test/testHurdleRace.py
from HurdleRace import hurdleRace
from ddt import ddt,... | code_fim | easy | {
"lang": "python",
"repo": "Nxtra/H-rank",
"path": "/ProblemSolving/python/test/testHurdleRace.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_hurdleRace(self):
height = [1, 6, 3, 5, 2]
k = 4
sum_too_high = hurdleRace(k, height)
self.assertEqual(2, sum_too_high)<|fim_prefix|># repo: Nxtra/H-rank path: /ProblemSolving/python/test/testHurdleRace.py
from HurdleRace import hurdleRace
from ddt import ddt... | code_fim | easy | {
"lang": "python",
"repo": "Nxtra/H-rank",
"path": "/ProblemSolving/python/test/testHurdleRace.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> xml_attrs = {
(constants.XML_NAMESPACE_DATA_BINDING, 'attr2'): 'val'
}
e = BaseElement(xml_tag='tag', xml_attrs=xml_attrs)
xml = e.to_string(context={'val': 'example_value'}, indent=0).getvalue()
self.assertEqual(xml, '<tag attr2="example_value">\n</tag... | code_fim | hard | {
"lang": "python",
"repo": "doculabs/samon",
"path": "/tests/test_elements.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_if_and_for_precedence(self):
xml_attrs = {
(constants.XML_NAMESPACE_FLOW_CONTROL, 'if'): 'val > 7',
(constants.XML_NAMESPACE_FLOW_CONTROL, 'for'): 'val in val2',
(constants.XML_NAMESPACE_DATA_BINDING, 'attr1'): 'val',
}
e = BaseElem... | code_fim | hard | {
"lang": "python",
"repo": "doculabs/samon",
"path": "/tests/test_elements.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doculabs/samon path: /tests/test_elements.py
from io import StringIO
from pathlib import Path
from unittest import TestCase
from doculabs.samon import constants
from doculabs.samon.elements import BaseElement, AnonymusElement
from doculabs.samon.expressions import Condition, ForLoop, Bind
clas... | code_fim | hard | {
"lang": "python",
"repo": "doculabs/samon",
"path": "/tests/test_elements.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ter, to exit press q\n') != 'q':
idf.guess()<|fim_prefix|># repo: jdzejdzej/music_idf path: /app.py
from application.identifier import Identifier
if _<|fim_middle|>_name__ == '__main__':
idf = Identifier()
while raw_input('Hello!, to start listening press en | code_fim | medium | {
"lang": "python",
"repo": "jdzejdzej/music_idf",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdzejdzej/music_idf path: /app.py
from application.identifier import Identifier
if _<|fim_suffix|>hile raw_input('Hello!, to start listening press enter, to exit press q\n') != 'q':
idf.guess()<|fim_middle|>_name__ == '__main__':
idf = Identifier()
w | code_fim | easy | {
"lang": "python",
"repo": "jdzejdzej/music_idf",
"path": "/app.py",
"mode": "psm",
"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.