text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: deep-droid/python path: /test4geeks/test4geeks01.py
with expression [as var]
#...BODY...
#object is the result of the expression and must have __enter__ and __exit__ methods
#result of the expression must be context manager - implements context management protocol
<|fim_suffix|># In this PEP, ... | code_fim | medium | {
"lang": "python",
"repo": "deep-droid/python",
"path": "/test4geeks/test4geeks01.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># In this PEP, context managers provide __enter__() and __exit__()
# methods that are invoked on entry to and exit from the body of the
# with statement.<|fim_prefix|># repo: deep-droid/python path: /test4geeks/test4geeks01.py
with expression [as var]
#...BODY...
#object is the result of the expression... | code_fim | medium | {
"lang": "python",
"repo": "deep-droid/python",
"path": "/test4geeks/test4geeks01.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __openPortCallback(self):
if self.run:
self.cancel()
self.widget.pushButton.setText("Verbinden")
else:
port = self.widget.comboBox.currentText()
if self.__openPort(port):
self.start()
self.widget.pushBu... | code_fim | hard | {
"lang": "python",
"repo": "Haschtl/RTOC-Plugins",
"path": "/HoldPeak VC820/HoldPeak VC820.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_data(self):
test = self._serial_port.read(1)
if len(test) != 1:
logging.error("recieved incomplete data, skipping...", file=sys.stderr)
return False, None, None
if MultimeterMessage.check_first_byte(test[0]):
data = test + self._seri... | code_fim | hard | {
"lang": "python",
"repo": "Haschtl/RTOC-Plugins",
"path": "/HoldPeak VC820/HoldPeak VC820.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Haschtl/RTOC-Plugins path: /HoldPeak VC820/HoldPeak VC820.py
try:
from LoggerPlugin import LoggerPlugin
except ImportError:
from RTOC.LoggerPlugin import LoggerPlugin
from .holdPeak_VC820.vc820py.vc820 import MultimeterMessage
import serial
import sys
import traceback
from PyQt5 import ... | code_fim | hard | {
"lang": "python",
"repo": "Haschtl/RTOC-Plugins",
"path": "/HoldPeak VC820/HoldPeak VC820.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#解压缩
z2 = zipfile.ZipFile("a.zip","r")
z2.extractall("电影")
z2.close()<|fim_prefix|># repo: eternaltc/test path: /Test/Os/os05_shutil.py
#coding=utf-8
import shutil
import zipfile
# shutil.copyfile("file03.txt","file05.txt") #拷贝
# shutil.copytree("movie/大陆","电影") #拷贝文件夹
#忽略不需要拷贝的文件
# shutil.copytre... | code_fim | medium | {
"lang": "python",
"repo": "eternaltc/test",
"path": "/Test/Os/os05_shutil.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eternaltc/test path: /Test/Os/os05_shutil.py
#coding=utf-8
import shutil
import zipfile
# shutil.copyfile("file03.txt","file05.txt") #拷贝
# shutil.copytree("movie/大陆","电影") #拷贝文件夹
#忽略不需要拷贝的文件
# shutil.copytree("movie/大陆","电影",ignore=shutil.ignore_patterns("*.txt","*.html"))
<|fim_suffix|>#... | code_fim | medium | {
"lang": "python",
"repo": "eternaltc/test",
"path": "/Test/Os/os05_shutil.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RiceElectricVehicle/maus-pump-control-examples path: /PyPumpControl/lib/encoder.py
# -*- coding: utf-8 -*-
"""MicroPython rotary encoder library."""
from machine import Pin
ENC_STATES = (0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0)
class Encoder(object):
def __init__(self, pin_x='... | code_fim | hard | {
"lang": "python",
"repo": "RiceElectricVehicle/maus-pump-control-examples",
"path": "/PyPumpControl/lib/encoder.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def position(self):
return self._pos * self.scale
def reset(self):
self._pos = 0
def setMax(self, Max):
self.max = Max
def setMin(self, Min):
self.min = Min
def setScale(self, Scale):
self.scale = Scale<|fim_prefix|># repo: RiceElectricVehicl... | code_fim | hard | {
"lang": "python",
"repo": "RiceElectricVehicle/maus-pump-control-examples",
"path": "/PyPumpControl/lib/encoder.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Candela-zz/WRP path: /MyCalProgram.py
#GUIcal.py
from tkinter import *
from tkinter import ttk
import math
GUI=Tk()
GUI.title('My Cal Program')
GUI.geometry('500x500')
<|fim_suffix|>L1=Label(text='Please input height',foreground='red',font=('Angsana New',15))
L1.pack()
E1=ttk.Entry(G... | code_fim | hard | {
"lang": "python",
"repo": "Candela-zz/WRP",
"path": "/MyCalProgram.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>v_result=StringVar()
v_result.set('----Result----')
Result=ttk.Label(GUI,textvariable=v_result,foreground='green',font=('Angsana New',15))
Result.pack()
GUI.mainloop()<|fim_prefix|># repo: Candela-zz/WRP path: /MyCalProgram.py
#GUIcal.py
from tkinter import *
from tkinter import ttk
import math
... | code_fim | hard | {
"lang": "python",
"repo": "Candela-zz/WRP",
"path": "/MyCalProgram.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vaelor/python-mattermost-driver path: /src/mattermostdriver/endpoints/files.py
from .base import Base
class Files(Base):
endpoint = "/files"
def upload_file(self, channel_id, files):
<|fim_suffix|> return self.client.get(
self.endpoint + "/" + file_id + "/link",
... | code_fim | hard | {
"lang": "python",
"repo": "Vaelor/python-mattermost-driver",
"path": "/src/mattermostdriver/endpoints/files.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.client.get(
self.endpoint + "/" + file_id + "/info",
)<|fim_prefix|># repo: Vaelor/python-mattermost-driver path: /src/mattermostdriver/endpoints/files.py
from .base import Base
class Files(Base):
endpoint = "/files"
def upload_file(self, channel_id, fil... | code_fim | hard | {
"lang": "python",
"repo": "Vaelor/python-mattermost-driver",
"path": "/src/mattermostdriver/endpoints/files.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 20jna/jayna-projects path: /intro-CS/connect4_JayNa.py
#connect4_JayNa.py
#Jay Na
#CS111 Spring 2018
#This file creates a version of the game Connect4, where the user plays against an AI
from graphics import *
import random
class ConnectWindow:
def __init__(self):
self.window = GraphWin("Co... | code_fim | hard | {
"lang": "python",
"repo": "20jna/jayna-projects",
"path": "/intro-CS/connect4_JayNa.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #checks to see if there is a winner vertically
for i in range(7):
for j in range(3):
self.square1 = self.grid[i][j]
self.square2 = self.grid[i][j+1]
self.square3 = self.grid[i][j+2]
self.square4 = self.grid[i][j+3]
if self.square1 == self.square2 and self.square2 == self.square3 ... | code_fim | hard | {
"lang": "python",
"repo": "20jna/jayna-projects",
"path": "/intro-CS/connect4_JayNa.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def drawCmove(self, x ,y):
'''This function adds the computer's move to the game board and adds it to the board count'''
piece = Circle(Point((x)*100+50, 600 - ((y)*100+50)),30)
piece.setFill('yellow')
piece.draw(self.window)
self.boardCount[x] += 1
self.grid[x][y] = -1
return
def compu... | code_fim | hard | {
"lang": "python",
"repo": "20jna/jayna-projects",
"path": "/intro-CS/connect4_JayNa.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Register a new datastore
try:
blob_datastore = blob_datastore = Datastore.get(ws, blob_datastore_name)
print("Found Blob Datastore with name: %s" % blob_datastore_name)
except HttpOperationError:
blob_datastore = Datastore.register_azure_blob_... | code_fim | hard | {
"lang": "python",
"repo": "yuvrajdomun/azureml",
"path": "/Datasets/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuvrajdomun/azureml path: /Datasets/__init__.py
from typing import Any, Dict, List
import numpy as np
from kedro.io import AbstractDataSet
from msrest.exceptions import HttpOperationError
from azureml.core import Workspace, Datastore
from azureml.data.data_reference import DataReference
class ... | code_fim | hard | {
"lang": "python",
"repo": "yuvrajdomun/azureml",
"path": "/Datasets/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> blob_datastore_name = self._credentials['storage_name']
account_name = self._credentials['storage_name'] # Storage account name
container_name = self._credentials['container_name'] # Name of Azure blob container
account_key = self._credentials['key'] ... | code_fim | hard | {
"lang": "python",
"repo": "yuvrajdomun/azureml",
"path": "/Datasets/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rayansostenes/blue_tech_test path: /django/urls.py
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from rest_framework_swagger.views import get_swagger_view
<|fim_suffix|>urlpatterns = [
path('django-admin/', admin.site.urls),
path... | code_fim | medium | {
"lang": "python",
"repo": "rayansostenes/blue_tech_test",
"path": "/django/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from django.contrib.auth import views as auth_views
urlpatterns = [
path('django-admin/', admin.site.urls),
path('', schema_view),
path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html')),
path('auth/logout/', auth_views.LogoutView.as_view()),
path('api/auth/... | code_fim | medium | {
"lang": "python",
"repo": "rayansostenes/blue_tech_test",
"path": "/django/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('django-admin/', admin.site.urls),
path('', schema_view),
path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html')),
path('auth/logout/', auth_views.LogoutView.as_view()),
path('api/auth/', include('apps.auth.urls')),
path('api/polls/',... | code_fim | medium | {
"lang": "python",
"repo": "rayansostenes/blue_tech_test",
"path": "/django/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NorthcoteHS/10MCOD-Jason-VU path: /user/Magic8Ball.py
import random
responses = ['Seems so','Never','Untrue','Always no matter what','You decide your fate','Not sure','Yep','Nope','Maybe','Nein','Qui','Ask the person next to you','That question is not for me']
<|fim_suffix|>else: ... | code_fim | hard | {
"lang": "python",
"repo": "NorthcoteHS/10MCOD-Jason-VU",
"path": "/user/Magic8Ball.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print('Thank you for asking the wise magic 8 ball')<|fim_prefix|># repo: NorthcoteHS/10MCOD-Jason-VU path: /user/Magic8Ball.py
import random
responses = ['Seems so','Never','Untrue','Always no matter what','You decide your fate','Not sure','Yep','N... | code_fim | hard | {
"lang": "python",
"repo": "NorthcoteHS/10MCOD-Jason-VU",
"path": "/user/Magic8Ball.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahul148/PythonTraining path: /perfect.py
n=int(input("enter the number\n"))
sum=0
for i in range(1,n-1):
rem=n%i
if(rem==0):
<|fim_suffix|>umber is perfect")
else:
print("not prime")<|fim_middle|> sum=sum+i
if(sum==n):
print("the n | code_fim | easy | {
"lang": "python",
"repo": "rahul148/PythonTraining",
"path": "/perfect.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahul148/PythonTraining path: /perfect.py
n=int(input("enter the number\n"))
sum=0
for i<|fim_suffix|>umber is perfect")
else:
print("not prime")<|fim_middle|> in range(1,n-1):
rem=n%i
if(rem==0):
sum=sum+i
if(sum==n):
print("the n | code_fim | medium | {
"lang": "python",
"repo": "rahul148/PythonTraining",
"path": "/perfect.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>umber is perfect")
else:
print("not prime")<|fim_prefix|># repo: rahul148/PythonTraining path: /perfect.py
n=int(input("enter the number\n"))
sum=0
for i<|fim_middle|> in range(1,n-1):
rem=n%i
if(rem==0):
sum=sum+i
if(sum==n):
print("the n | code_fim | medium | {
"lang": "python",
"repo": "rahul148/PythonTraining",
"path": "/perfect.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isinstance(port_name, str):
raise Exception("Port name must be a string.")
if not isinstance(baud_rate, int):
raise Exception("Baud rate must be an integer.")
if baud_rate not in BAUD_RATES:
raise Exception("%d is not a valid baud rate; ch... | code_fim | medium | {
"lang": "python",
"repo": "DpEpsilon/sprint",
"path": "/communication.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DpEpsilon/sprint path: /communication.py
from common import *
import serial
CMD_BAUD = chr(129)
BAUD_RATES = [300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200]
class Communication(Module):
def __init__(self, parent, port_name, baud_rate):
<|fim_suffix|> i... | code_fim | hard | {
"lang": "python",
"repo": "DpEpsilon/sprint",
"path": "/communication.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isinstance(length, int):
raise Exception("Receive length must be an integer.")
return self.port.read(length)
_port = None
@property
def port(self):
return self._port
@port.setter
def port(self, value):
self._port = value<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "DpEpsilon/sprint",
"path": "/communication.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># plt.show()
X=X.reshape(-1,1)
print X
clf = svm.SVR(kernel='linear').fit(X, y)
# clf = svm.SVC(kernel='poly',degree=5,gamma=1,coef0=0).fit(X, y)
# clf = svm.SVR(kernel='rbf',C=100,gamma=20).fit(X, y)
'''gamma越大,多项式项数越多,导致高方差'''
# print u'精准度为: %.2f' % clf.score(X, y)
X1=np.linspace(0,25,1... | code_fim | hard | {
"lang": "python",
"repo": "jiazd000/SVM",
"path": "/SVM_yuce.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiazd000/SVM path: /SVM_yuce.py
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
from sklearn import svm
data=np.loadtxt('yucedata1.txt')
X=data[:,0]
y=data[:,1]
plt.figure(1,f... | code_fim | medium | {
"lang": "python",
"repo": "jiazd000/SVM",
"path": "/SVM_yuce.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''gamma越大,多项式项数越多,导致高方差'''
# print u'精准度为: %.2f' % clf.score(X, y)
X1=np.linspace(0,25,100).reshape(-1,1)
y1=clf.predict(X1)
plt.plot(X1,y1,color="orange",label="Fitting Line",linewidth=2)
plt.show()<|fim_prefix|># repo: jiazd000/SVM path: /SVM_yuce.py
# -*- coding: utf-8 -*-
import... | code_fim | hard | {
"lang": "python",
"repo": "jiazd000/SVM",
"path": "/SVM_yuce.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for k, v in cnt.items():
if v > 1:
res.append(k)
return res
# O(n) TC and O(1) SC
class Solution:
def findDuplicates(self, nums: List[int]) -> List[int]:
res = []
for num in nums:
if nums[abs(num)-1] < 0:
... | code_fim | hard | {
"lang": "python",
"repo": "eric496/leetcode.py",
"path": "/array/442.find_all_duplicates_in_an_array.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eric496/leetcode.py path: /array/442.find_all_duplicates_in_an_array.py
"""
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
Could you do it without extra space and in O(n) runti... | code_fim | medium | {
"lang": "python",
"repo": "eric496/leetcode.py",
"path": "/array/442.find_all_duplicates_in_an_array.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while queue:
current = queue.pop(0)
if current == end:
break
for v in graph.neighbors(current):
if v not in visited:
queue.append(v)
visited.add(v)
parent[v] = current
return parent<|fim_prefix|># re... | code_fim | medium | {
"lang": "python",
"repo": "gabtoschi/ai-2021",
"path": "/bfs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for v in graph.neighbors(current):
if v not in visited:
queue.append(v)
visited.add(v)
parent[v] = current
return parent<|fim_prefix|># repo: gabtoschi/ai-2021 path: /bfs.py
import graph as Graph
def BFS(graph: Graph.Graph, start, ... | code_fim | hard | {
"lang": "python",
"repo": "gabtoschi/ai-2021",
"path": "/bfs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabtoschi/ai-2021 path: /bfs.py
import graph as Graph
def BFS(graph: Graph.Graph, start, end):
visited = set()
parent = dict()
parent[start] = None
<|fim_suffix|> while queue:
current = queue.pop(0)
if current == end:
break
for v in graph.ne... | code_fim | medium | {
"lang": "python",
"repo": "gabtoschi/ai-2021",
"path": "/bfs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/students', methods=["GET", "POST"])
def index():
if request.method == 'POST':
new_student = Student(request.form['first_name'],
request.form['last_name'])
db.session.add(new_student)
db.session.commit()
return redirect(url_for(... | code_fim | hard | {
"lang": "python",
"repo": "maxnawa31/excuses",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxnawa31/excuses path: /app.py
from flask import Flask, request, redirect, url_for, render_template
from flask_modus import Modus
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config[
'SQLALCHEMY_DATABASE_URI'] = "postgres://localhost/fl... | code_fim | hard | {
"lang": "python",
"repo": "maxnawa31/excuses",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GlitchBox/Simulation path: /Simpy Practice/process1.py
#processes are described by generator functions
#during the lifetime of a process, the process function(generator function)
#creates events and yields them
#when a process yields an event, it gets suspended
#Simpy resumes the process when t... | code_fim | medium | {
"lang": "python",
"repo": "GlitchBox/Simulation",
"path": "/Simpy Practice/process1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if i == 10:
# print("the car is done moving")
# yield env.timeout(1)
# i += 1
env = simpy.Environment()
env.process(car(env)) #the generator function creates the process called car
#env.run()
env.run(until=20)<|fim_prefix|># repo: GlitchBox/Simulation path: /Si... | code_fim | medium | {
"lang": "python",
"repo": "GlitchBox/Simulation",
"path": "/Simpy Practice/process1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NCBI-Hackathons/pheno_geno_ataxia path: /create_apriori_input.py
#!/usr/bin/env python3
import pandas as pd
import csv
def get_apriori_input(input_file,output_file,sample_col="Sample",gene_id_col="Gene_ID"):
<|fim_suffix|>if __name__ == "__main__":
import sys
program,input_file,output_fil... | code_fim | hard | {
"lang": "python",
"repo": "NCBI-Hackathons/pheno_geno_ataxia",
"path": "/create_apriori_input.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
import sys
program,input_file,output_file,sample_col,gene_id_col=sys.argv
get_apriori_input(input_file,output_file,sample_col,gene_id_col)<|fim_prefix|># repo: NCBI-Hackathons/pheno_geno_ataxia path: /create_apriori_input.py
#!/usr/bin/env python3
import pandas as ... | code_fim | hard | {
"lang": "python",
"repo": "NCBI-Hackathons/pheno_geno_ataxia",
"path": "/create_apriori_input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
import sys
program,input_file,output_file,sample_col,gene_id_col=sys.argv
get_apriori_input(input_file,output_file,sample_col,gene_id_col)<|fim_prefix|># repo: NCBI-Hackathons/pheno_geno_ataxia path: /create_apriori_input.py
#!/usr/bin/env python3
import pandas as p... | code_fim | hard | {
"lang": "python",
"repo": "NCBI-Hackathons/pheno_geno_ataxia",
"path": "/create_apriori_input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dyuri/djkeptar path: /keptar/utils.py
from django.core.urlresolvers import reverse
from keptar import settings
import os, os.path
import Image
try:
from collections import OrderedDict
except ImportError:
from keptar.odict import OrderedDict
class AccessDenied(Exception):
pass
class ... | code_fim | hard | {
"lang": "python",
"repo": "dyuri/djkeptar",
"path": "/keptar/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.isdir(abspath):
raise NotDirectory(abspath)
dirs = []
pictures = []
for fname in os.listdir(abspath):
file = os.path.join(abspath, fname)
if os.path.isdir(file) and (show_hidden or not fname.startswith('.')):
dirs.append(fname)
i... | code_fim | hard | {
"lang": "python",
"repo": "dyuri/djkeptar",
"path": "/keptar/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> basename = os.path.basename(file)
dirname = os.path.dirname(file)
thumbname = os.path.join(dirname, settings.KEPTAR_THUMBS[type]['dir'], basename)
if regenerate or not os.path.isfile(thumbname):
if not os.path.isdir(os.path.dirname(thumbname)):
os.mkdir(os.path.dirname(... | code_fim | hard | {
"lang": "python",
"repo": "dyuri/djkeptar",
"path": "/keptar/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: damik21/nlp_2019 path: /abstracts_parser.py
import os
import pubmed_parser as pp
nlpPath = "/Users/kapmayn/Desktop/nlp"
articlesFolderPath = nlpPath + "/articles"
abstractsFilePath = nlpPath + "/abstracts.txt"
<|fim_suffix|>for fileName in articlesFileNameList:
print(fileName)
dictOut = pp.pa... | code_fim | medium | {
"lang": "python",
"repo": "damik21/nlp_2019",
"path": "/abstracts_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for fileName in articlesFileNameList:
print(fileName)
dictOut = pp.parse_medline_xml(articlesFolderPath + "/" + fileName)
for item in dictOut:
resultFile.write((item['abstract'] + '\n'))<|fim_prefix|># repo: damik21/nlp_2019 path: /abstracts_parser.py
import os
import pubmed_parser as pp
nlpPath = ... | code_fim | medium | {
"lang": "python",
"repo": "damik21/nlp_2019",
"path": "/abstracts_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
fire.Fire(main)<|fim_prefix|># repo: geovedi/nmt-playground path: /scripts/convert-vocab.py
#!/usr/bin/env python3
import io
import json
import fire
from collections import OrderedDict
def main(input, output):
<|fim_middle|> vocab = OrderedDict({'</s>': 0, '<unk>': 1... | code_fim | hard | {
"lang": "python",
"repo": "geovedi/nmt-playground",
"path": "/scripts/convert-vocab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
self.modelzip.extractall(self.path)
except:
raise ValueError('Error while extracting zip file')
return {
'path': self.path,
'obj': join(self.path, obj)
}
def __exit__(self, type, value, tb):
rmtree(self.path... | code_fim | medium | {
"lang": "python",
"repo": "kartta-labs/reservoir",
"path": "/third_party/3dmr/mainapp/model_extractor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return total_size_uncompressed < MAX_UNCOMPRESSED_SIZE
def __get_obj_filename(self):
for info in self.modelzip.infolist():
if info.filename.endswith('.obj'):
return info.filename
return None<|fim_prefix|># repo: kartta-labs/reservoir path: /third_... | code_fim | hard | {
"lang": "python",
"repo": "kartta-labs/reservoir",
"path": "/third_party/3dmr/mainapp/model_extractor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: passal/WebDataFinal path: /geo_console.py
from const import BORN_KEY, PRESIDENT_KEY, CAPITAL_KEY, PRIME_KEY, MINISTER_KEY, POPULATION_KEY, \
GOVERNMENT_KEY,AREA_KEY, WHO_KEY, IS_KEY, THE_KEY, OF_KEY, WHAT_KEY, WHEN_KEY, WAS_KEY
from geq_queries import capital_of_country_query, area_of_countr... | code_fim | hard | {
"lang": "python",
"repo": "passal/WebDataFinal",
"path": "/geo_console.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> question_number = None
arg = None
words = string.lower().split(" ")
if len(words) == 0 or len(words) < 3 or words[len(words) - 1][-1] != '?':
return question_number, arg
if words[0] == WHO_KEY and words[1] == IS_KEY:
# can be only i, ii, ix
question_number, arg ... | code_fim | hard | {
"lang": "python",
"repo": "passal/WebDataFinal",
"path": "/geo_console.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def register_oauthhandlers(app):
"""Set up OAuth handlers based on configuration."""
blueprint = get_auth_blueprint(app)
if blueprint is not None:
app.register_blueprint(blueprint, url_prefix="/oauth")
def register_errorhandlers(app):
"""Register error handlers."""
def rende... | code_fim | hard | {
"lang": "python",
"repo": "loleg/dribdat",
"path": "/dribdat/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: loleg/dribdat path: /dribdat/app.py
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from flask_cors import CORS
from flask_misaka import Misaka
from flask_mailman import Mail
from flask_talisman import Talisman
from werk... | code_fim | hard | {
"lang": "python",
"repo": "loleg/dribdat",
"path": "/dribdat/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># print all other lines
for line in sys.stdin:
try:
print line,
except IOError, e:
if e.errno == errno.EPIPE:
exit(0)<|fim_prefix|># repo: zzahara/Summer-Project path: /flat_file/drop_first.py
#!/usr/bin/env python
import sys
import errno
<|fim_middle|># read first li... | code_fim | medium | {
"lang": "python",
"repo": "zzahara/Summer-Project",
"path": "/flat_file/drop_first.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zzahara/Summer-Project path: /flat_file/drop_first.py
#!/usr/bin/env python
import sys
import errno
<|fim_suffix|># print all other lines
for line in sys.stdin:
try:
print line,
except IOError, e:
if e.errno == errno.EPIPE:
exit(0)<|fim_middle|># read first li... | code_fim | medium | {
"lang": "python",
"repo": "zzahara/Summer-Project",
"path": "/flat_file/drop_first.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
train=get(trainl)
val=get(vall)
text_file = open("/home/debajit15/train.txt", "w")
n = text_file.write(train)
text_file.close()
text_file = open("/home/debajit15/dev.txt", "w")
n = text_file.write(val)
text_file.close()
# #print(df[['review_body']])<|fim_prefix|># repo: debajit15kgp/BERT-ABSA-E2E pat... | code_fim | hard | {
"lang": "python",
"repo": "debajit15kgp/BERT-ABSA-E2E",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: debajit15kgp/BERT-ABSA-E2E path: /test.py
import pandas as pd
import numpy as np
import csv
#import nltk
#nltk.download('punkt')
from nltk.tokenize import sent_tokenize
csv_file=open("/home/debajit15/train+dev.csv")
pd.set_option('display.max_colwidth', None)
df=pd.read_csv(csv_file,sep=',');
df ... | code_fim | hard | {
"lang": "python",
"repo": "debajit15kgp/BERT-ABSA-E2E",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prem-narain/file_converter path: /app.py
from flask import Flask, jsonify, request, render_template
from werkzeug import secure_filename
import os
from utils import allowed_file, convert_html_to_pdf, convert_doc_to_pdf
app = Flask(__name__)
@app.route('/', methods=['GET'])
def index():
""... | code_fim | hard | {
"lang": "python",
"repo": "prem-narain/file_converter",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Function Processing Steps:
Step-1 : Check uploaded file extension ,if accepted format process further
Step-2 : Save the files into uploads folder
Step-3 : Convert the html,doc and docx files into pdf file and stores into converted_files folder
Note : If file is already in pdf... | code_fim | hard | {
"lang": "python",
"repo": "prem-narain/file_converter",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 2. deleting dir
print("Deleting %s" % level1_path)
if not dry_run:
shutil.rmtree(level1_path)<|fim_prefix|># repo: ejoonie/dicom_extract path: /move_directories.py
import os
import shutil
# root_path = '../from_1691'
root_path = 'C:/Users/koyou/Desktop/test'
# 실수할 ... | code_fim | hard | {
"lang": "python",
"repo": "ejoonie/dicom_extract",
"path": "/move_directories.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ejoonie/dicom_extract path: /move_directories.py
import os
import shutil
# root_path = '../from_1691'
root_path = 'C:/Users/koyou/Desktop/test'
# 실수할 수도 있으므로 dry_run 을 설정해서 로그만 찍을 것인지
# 실제 작동도 진행할 것인지 결정한다.
# dry_run = True
dry_run = False
def move_directory(input_directory_path, output_direct... | code_fim | medium | {
"lang": "python",
"repo": "ejoonie/dicom_extract",
"path": "/move_directories.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yinshi2018/Nosea path: /chi/truncation/hetapsi/4chi.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# sphinx_gallery_thumbnail_number = 3
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import NullFormatter # useful for `logit` scale
import matplotlib.ticker as ticker... | code_fim | medium | {
"lang": "python",
"repo": "yinshi2018/Nosea",
"path": "/chi/truncation/hetapsi/4chi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Plot two
ax2=fig.add_subplot(122)
ax2.plot(chi4,color='k',linestyle='-',linewidth=2,markersize=5,label=r'$\chi^B_4$')
ax2.axis([0,300,-0.15,0.2])
ax2.set_xlabel('$T\,[\mathrm{MeV}]$', fontsize=15, color='black')
ax2.set_ylabel(r'$\chi_4$', fontsize=15, color='black')
ax2.legend(loc=0,fontsize=7.3,fra... | code_fim | medium | {
"lang": "python",
"repo": "yinshi2018/Nosea",
"path": "/chi/truncation/hetapsi/4chi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for label in ax1.xaxis.get_ticklabels():
label.set_fontsize(10)
for label in ax1.yaxis.get_ticklabels():
label.set_fontsize(10)
# Plot two
ax2=fig.add_subplot(122)
ax2.plot(chi4,color='k',linestyle='-',linewidth=2,markersize=5,label=r'$\chi^B_4$')
ax2.axis([0,300,-0.15,0.2])
ax2.set_xlabel('... | code_fim | hard | {
"lang": "python",
"repo": "yinshi2018/Nosea",
"path": "/chi/truncation/hetapsi/4chi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def data_to_extract(data, dict): # Otrzymane dane na podstawie slownika odczytuje do tekstu
begin = extract_start(data) # Szukamy początku tekstu
print(begin)
data = bytes_to_bits(data, begin)
dict = {y: x for x, y in dict.items()} # Zamiana kluczy z wartością w słowniku
text = ''
... | code_fim | hard | {
"lang": "python",
"repo": "maldo31/Huffman",
"path": "/recieve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def extract_start(data): # Poszukuje pącztka segmentu danych
i = 0
while True:
if data[i] == END[0] and data[i + 1] == END[0] and data[i + 2] == END[0]:
return i + 3
i += 1
def bytes_to_bits(data, begin): # Zamienia bajty na znakowy odpowiednik w bitach
bits = '... | code_fim | hard | {
"lang": "python",
"repo": "maldo31/Huffman",
"path": "/recieve.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maldo31/Huffman path: /recieve.py
import socket
END = bytearray()
END.append(255)
print(END[0])
def recvall(sock): # Odbiór danych
BUFF_SIZE = 4096 # 4 KiB
data = b''
while True: # odbieramy dane, pakiety 4KiB
part = sock.recv(BUFF_SIZE)
data += part
if l... | code_fim | hard | {
"lang": "python",
"repo": "maldo31/Huffman",
"path": "/recieve.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vic-1998/holbertonschool-higher_level_programming path: /0x07-python-test_driven_development/tests/6-max_integer_test.py
#!/usr/bin/python3
"""Unittest for max_integer([..])
"""
import unittest
max_integer = __import__('6-max_integer').max_integer
<|fim_suffix|> """Tests max_integer"""
... | code_fim | medium | {
"lang": "python",
"repo": "vic-1998/holbertonschool-higher_level_programming",
"path": "/0x07-python-test_driven_development/tests/6-max_integer_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Interactive tests """
def test_max(self):
"""Tests max_integer"""
self.assertEqual(max_integer([1, 2, 3]), 3)
self.assertEqual(max_integer([6, 2, 6]), 6)
self.assertEqual(max_integer([0, 0, 0]), 0)
self.assertEqual(max_integer([1, 5, 3]), 5)
self... | code_fim | medium | {
"lang": "python",
"repo": "vic-1998/holbertonschool-higher_level_programming",
"path": "/0x07-python-test_driven_development/tests/6-max_integer_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_body() -> None:
for func in (weight, shower, food, water):
assert ilen(func()) >= 1<|fim_prefix|># repo: tg-z/hpi path: /tests/test_body.py
from more_itertools import ilen
<|fim_middle|>from my.body import weight, shower, food, water
| code_fim | easy | {
"lang": "python",
"repo": "tg-z/hpi",
"path": "/tests/test_body.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tg-z/hpi path: /tests/test_body.py
from more_itertools import ilen
from my.body import weight, shower, food, water
<|fim_suffix|> for func in (weight, shower, food, water):
assert ilen(func()) >= 1<|fim_middle|>
def test_body() -> None:
| code_fim | easy | {
"lang": "python",
"repo": "tg-z/hpi",
"path": "/tests/test_body.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for func in (weight, shower, food, water):
assert ilen(func()) >= 1<|fim_prefix|># repo: tg-z/hpi path: /tests/test_body.py
from more_itertools import ilen
<|fim_middle|>from my.body import weight, shower, food, water
def test_body() -> None:
| code_fim | medium | {
"lang": "python",
"repo": "tg-z/hpi",
"path": "/tests/test_body.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_price(client_api):
initial_price = {}
tickers = [line.strip() for line in open(TICKERS_LIST)]
prices = client_api.get_ticker()
for coin in prices['ticker']:
for item in tickers:
if item + PAIR_WITH == coin['symbol'] and all(item + PAIR_WITH not in coin['symbol'] for item in EX_PAIRS):
... | code_fim | hard | {
"lang": "python",
"repo": "cryptobot118/Kucoin-Volatility-Bot",
"path": "/scoobie_signalbuy_thesnail_v2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cryptobot118/Kucoin-Volatility-Bot path: /scoobie_signalbuy_thesnail_v2.py
"""
The Snail v 2
"Buy the dips! ... then wait"
STRATEGY
1. Selects coins that are X% (percent_below) below their X day (LIMIT) maximum
2. ** NEW ** Finds movement (MOVEMENT) range over X Days
- if MOVEMENT* > TAKE_PROF... | code_fim | hard | {
"lang": "python",
"repo": "cryptobot118/Kucoin-Volatility-Bot",
"path": "/scoobie_signalbuy_thesnail_v2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_potential_list = []
held_coins_list = {}
if TEST_MODE:
coin_path = 'test_coins_bought.json'
elif BVT:
coin_path = 'coins_bought.json'
else:
coin_path = 'live_coins_bought.json'
if os.path.isfile(coin_path) and os.stat(coin_path).st_size != 0:
with open(coin_path) as file:
... | code_fim | hard | {
"lang": "python",
"repo": "cryptobot118/Kucoin-Volatility-Bot",
"path": "/scoobie_signalbuy_thesnail_v2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ongtm/CADeptOfEducation path: /main.py
import time
class DISTRICT:
def __init__(
self, cdcode, county, district, street, city, zipcode,
state, mailstreet, mailcity, mailzip, mailstate, phone, extphone,
faxnumber, email, admfname, admlname, admemail, lat,... | code_fim | hard | {
"lang": "python",
"repo": "ongtm/CADeptOfEducation",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(self.statustype)
def start_end_timer():
print(time.perf_counter())
def read_text_file(strfile):
f = open(strfile, "r")
f.read()
def print_text_file(strfile):
f = open(strfile, "r")
print(f.read(3))
def load_text_file_to_class(strfile):
t = open("/home/student/D... | code_fim | hard | {
"lang": "python",
"repo": "ongtm/CADeptOfEducation",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theclonedude/Scraping_BeautifulSoup_phantomjs path: /scrapers/hdmovie14_ag.py
# coding=utf-8
import base64
from sandcrawler.scraper import ScraperBase, SimpleScraperBase
class Hdmovie14Ag(SimpleScraperBase):
BASE_URL = 'http://www1.solarmovie.net'
OTHER_URLS = ['http://solarmovie.net', '... | code_fim | hard | {
"lang": "python",
"repo": "theclonedude/Scraping_BeautifulSoup_phantomjs",
"path": "/scrapers/hdmovie14_ag.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _parse_search_result_page(self, soup):
found=0
for result in soup.select('div.ml-item'):
link = result.select_one('a')
self.submit_search_result(
link_url=link.href,
link_title=link.text,
image=self.util.find_i... | code_fim | hard | {
"lang": "python",
"repo": "theclonedude/Scraping_BeautifulSoup_phantomjs",
"path": "/scrapers/hdmovie14_ag.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/cloudkitty path: /cloudkitty/tests/api/v1/test_summary.py
# -*- coding: utf-8 -*-
# Copyright 2017 Objectif Libre
#
# 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 th... | code_fim | medium | {
"lang": "python",
"repo": "openstack/cloudkitty",
"path": "/cloudkitty/tests/api/v1/test_summary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(TestSummary, self).setUp()
def test_nulls(self):
s = report.SummaryModel(begin=None,
end=None,
tenant_id=None,
res_type=None,
rate=None)
self.a... | code_fim | medium | {
"lang": "python",
"repo": "openstack/cloudkitty",
"path": "/cloudkitty/tests/api/v1/test_summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
super(TestSummary, self).setUp()
def test_nulls(self):
s = report.SummaryModel(begin=None,
end=None,
tenant_id=None,
res_type=None,
rate... | code_fim | medium | {
"lang": "python",
"repo": "openstack/cloudkitty",
"path": "/cloudkitty/tests/api/v1/test_summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qhuydtvt/C4E3 path: /Assignment_Submission/sondp/lab/lab_6.py
from turtle import *
while True:
n=inp<|fim_suffix|>
right(60)
forward(100)
elif n == 'left':
left(60)
forward(100)<|fim_middle|>ut("Right or left? ")
if n == 'right': | code_fim | easy | {
"lang": "python",
"repo": "qhuydtvt/C4E3",
"path": "/Assignment_Submission/sondp/lab/lab_6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>== 'left':
left(60)
forward(100)<|fim_prefix|># repo: qhuydtvt/C4E3 path: /Assignment_Submission/sondp/lab/lab_6.py
from turtle import *
while True:
n=input("Right or left? ")
if n == 'right':<|fim_middle|>
right(60)
forward(100)
elif n | code_fim | easy | {
"lang": "python",
"repo": "qhuydtvt/C4E3",
"path": "/Assignment_Submission/sondp/lab/lab_6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
right(60)
forward(100)
elif n == 'left':
left(60)
forward(100)<|fim_prefix|># repo: qhuydtvt/C4E3 path: /Assignment_Submission/sondp/lab/lab_6.py
from turtle import *
while True:
n=inp<|fim_middle|>ut("Right or left? ")
if n == 'right': | code_fim | easy | {
"lang": "python",
"repo": "qhuydtvt/C4E3",
"path": "/Assignment_Submission/sondp/lab/lab_6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kantale/corec_tools path: /corec.py
import json
def corec_set(parameter, value):
params_fn = "corec_parameters.json"
with open(params_fn) as f:
params = json.load(f)
params[parameter] = value
with open(params_fn, 'w') as f:
json.dump(params, f, indent=4)
def corec_get(parameter):
... | code_fim | hard | {
"lang": "python",
"repo": "kantale/corec_tools",
"path": "/corec.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(locks_fn, 'w') as f:
json.dump(locks, f, indent=4)
def corec_unlock(lock):
locks_fn = "corec_locks.json"
with open(locks_fn) as f:
locks = json.load(f)
locks[lock] = False
with open(locks_fn, 'w') as f:
json.dump(locks, f, in... | code_fim | hard | {
"lang": "python",
"repo": "kantale/corec_tools",
"path": "/corec.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def corec_lock(lock):
locks_fn = "corec_locks.json"
with open(locks_fn) as f:
locks = json.load(f)
locks[lock] = True
with open(locks_fn, 'w') as f:
json.dump(locks, f, indent=4)
def corec_unlock(lock):
locks_fn = "corec_locks.json"
with open(locks_fn) as f:
lo... | code_fim | medium | {
"lang": "python",
"repo": "kantale/corec_tools",
"path": "/corec.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mehdithreem/DHT-Torrent path: /_mininet_topo.py
# !/usr/bin/python
# sudo mn --custom _mininet_topo.py --topo mytopo,5
# sudo mn --custom _mininet_topo.py --topo mytopo,3 --test simpletest
# or just run this python file
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.... | code_fim | hard | {
"lang": "python",
"repo": "mehdithreem/DHT-Torrent",
"path": "/_mininet_topo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.addLink(h1, s1)
self.addLink(h2, s1)
self.addLink(h3, s1)
self.addLink(h4, s1)
self.addLink(h5, s1)
self.addLink(h6, s1)
#
def simpleTest():
"Create and test a simple network"
topo = SingleSwitchTopo()
net = Mininet(topo)
net.start()
... | code_fim | hard | {
"lang": "python",
"repo": "mehdithreem/DHT-Torrent",
"path": "/_mininet_topo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pratikpv/pyTicTacToe path: /player.py
class player:
def __init__(self, name: str, symbol: str):
self._name = name
self._symbol = symbol
def decide_next_move(self):
<|fim_suffix|> """
Asks user for next move
:return: board position
"""
... | code_fim | medium | {
"lang": "python",
"repo": "pratikpv/pyTicTacToe",
"path": "/player.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_next_move(self):
"""
Asks user for next move
:return: board position
"""
return int(input('Enter your move: '))<|fim_prefix|># repo: pratikpv/pyTicTacToe path: /player.py
class player:
def __init__(self, name: str, symbol: str):
self._name... | code_fim | medium | {
"lang": "python",
"repo": "pratikpv/pyTicTacToe",
"path": "/player.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Asks user for next move
:return: board position
"""
return int(input('Enter your move: '))<|fim_prefix|># repo: pratikpv/pyTicTacToe path: /player.py
class player:
def __init__(self, name: str, symbol: str):
self._name = name
self._symbol ... | code_fim | medium | {
"lang": "python",
"repo": "pratikpv/pyTicTacToe",
"path": "/player.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def clear(self):
element = self.driver.find_element_by_xpath(self.params['xpath'])
if self.params.get('clear', None):
element.clear()
return True
element.click()
space_num = self.params['space']if self.params.get('space', None) else 4
wh... | code_fim | medium | {
"lang": "python",
"repo": "dmf-code/titans",
"path": "/titan/components/input.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmf-code/titans path: /titan/components/input.py
# -*- coding: utf-8 -*-
from selenium.webdriver.common.keys import Keys
from titan.components import Base
<|fim_suffix|> def clear(self):
element = self.driver.find_element_by_xpath(self.params['xpath'])
if self.params.get('cle... | code_fim | medium | {
"lang": "python",
"repo": "dmf-code/titans",
"path": "/titan/components/input.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ridgerunner03/AI_project path: /AAAA.000.000.py
# -*- coding: utf-8 -*-
"""
This is the very first A.I. in this series.
The vision is to devlop 'protocol droid' to talk to, to help with tasks, and with whom to play games.
The droid will be able to translate langages and connect ppl.
""... | code_fim | hard | {
"lang": "python",
"repo": "ridgerunner03/AI_project",
"path": "/AAAA.000.000.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.