text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> assert c.get_value('synonimous', 'fizz') == mock['synonimous']['fizz']<|fim_prefix|># repo: guidiego/rasa-dataset-gen path: /tests/test_config.py
from src.config import Config
mock = {
"entities": {
"foo": [ "bar", "foobar" ]
},
"synonimous": {
"fizz": [ "fizzfuzz", "fuzz... | code_fim | medium | {
"lang": "python",
"repo": "guidiego/rasa-dataset-gen",
"path": "/tests/test_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guidiego/rasa-dataset-gen path: /tests/test_config.py
from src.config import Config
mock = {
"entities": {
"foo": [ "bar", "foobar" ]
},
"synonimous": {
"fizz": [ "fizzfuzz", "fuzz"]
},
"templates": [
{
"text": "{synonimous.fizz} and {entit... | code_fim | medium | {
"lang": "python",
"repo": "guidiego/rasa-dataset-gen",
"path": "/tests/test_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for demo in demoModules:
pid = os.fork()
filepath = './' + demo + '.py'
if pid == 0:
os.execvp('python3.5', (filepath, ))
root = Tk()
root.title('Progress')
Label(root, text='Multiple program demo: command lines', bg='white').pack()
root.mainloop()<|fim_prefix|># repo: skinkie/Scripts... | code_fim | medium | {
"lang": "python",
"repo": "skinkie/Scripts",
"path": "/PP4E/GUI/Tour/demoAll-prg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skinkie/Scripts path: /PP4E/GUI/Tour/demoAll-prg.py
# e.g. 8-34
from tkinter import *
from PP4E.launchmodes import PortableLauncher
import os, sys
<|fim_suffix|>for demo in demoModules:
pid = os.fork()
filepath = './' + demo + '.py'
if pid == 0:
os.execvp('python3.5', (filep... | code_fim | medium | {
"lang": "python",
"repo": "skinkie/Scripts",
"path": "/PP4E/GUI/Tour/demoAll-prg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MohamedBenSalha/Bachelor-Thesis-Towards-Automatically-Detecting-User-Experience-Smells-in-Web-Stores path: /UX_Smell_Detector/Python/cnn.py
import json
import os
import pickle
import random
import urllib.request
from pathlib import Path
import tensorflow as tf
from matplotlib import pyplot as pl... | code_fim | hard | {
"lang": "python",
"repo": "MohamedBenSalha/Bachelor-Thesis-Towards-Automatically-Detecting-User-Experience-Smells-in-Web-Stores",
"path": "/UX_Smell_Detector/Python/cnn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.load_weights()
self.load_last_training_history()
file_name = "image.jpg"
urllib.request.urlretrieve(file_url, file_name)
img = tf.keras.preprocessing.image.load_img(file_name, target_size=(150, 150),
color_mod... | code_fim | hard | {
"lang": "python",
"repo": "MohamedBenSalha/Bachelor-Thesis-Towards-Automatically-Detecting-User-Experience-Smells-in-Web-Stores",
"path": "/UX_Smell_Detector/Python/cnn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def nullHeuristic(state, problem=None):
"""
A heuristic function estimates the cost from the current state to the nearest
goal in the provided SearchProblem. This heuristic is trivial.
"""
return 0
def aStarSearch(problem, heuristic=nullHeuristic):
"Search the node that has the l... | code_fim | hard | {
"lang": "python",
"repo": "TheConMiz/berkeleyAI",
"path": "/Set 1/Solution/search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Format of each element: ((current coordinates, [path taken to get there]), heuristic function)
frontier.push((problem.getStartState(), []), heuristic(problem.getStartState(), problem))
# while there are still states to explore
while not frontier.isEmpty():
# store the current s... | code_fim | hard | {
"lang": "python",
"repo": "TheConMiz/berkeleyAI",
"path": "/Set 1/Solution/search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheConMiz/berkeleyAI path: /Set 1/Solution/search.py
"""
In search.py, you will implement generic search algorithms which are called
by Pacman agents (in searchAgents.py).
"""
import util
class SearchProblem:
"""
This class outlines the structure of a search problem, but doesn't impleme... | code_fim | hard | {
"lang": "python",
"repo": "TheConMiz/berkeleyAI",
"path": "/Set 1/Solution/search.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ofeist/CppBuildSystemReview path: /conan/Demo/conanfile.py
from conans import ConanFile, CMake, tools
import os
class Demo(ConanFile):
name = "Demo"
version = "0.1"
license = "<Put the package license here>"
url = "<Package recipe repository url here, for issues about the package... | code_fim | hard | {
"lang": "python",
"repo": "ofeist/CppBuildSystemReview",
"path": "/conan/Demo/conanfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')
def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)
def pa... | code_fim | medium | {
"lang": "python",
"repo": "ofeist/CppBuildSystemReview",
"path": "/conan/Demo/conanfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # number of rem flows on all links
link_weights = np.dot(routes.T, weights)
assert(rem_cap.shape == link_weights.shape)
try:
fair_shares = np.where(link_weights>0, rem_cap/link_weights, float('inf'))
except:
pass
... | code_fim | hard | {
"lang": "python",
"repo": "lavanyaj/numerical-simulations",
"path": "/waterfilling_hp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lavanyaj/numerical-simulations path: /waterfilling_hp.py
import sys
import random
#import matplotlib.pyplot as plt
import numpy as np
import time
class Waterfilling:
"""
initializes x and r with optimal flow allocations
and link fair share rates for traffic matrix routes and link
... | code_fim | hard | {
"lang": "python",
"repo": "lavanyaj/numerical-simulations",
"path": "/waterfilling_hp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.sat_flows = {}
self.unsat_flows = {}
# class Eps:
# def __init__(self):
# self.eps1 = 1e-7
# pass
# def main():
# for num_flows in [10, 100, 1000, 10000]:
# start = time.time()
# routes = np.ones((num_flows, 2))
# routes[:, 1] = 0
# ... | code_fim | hard | {
"lang": "python",
"repo": "lavanyaj/numerical-simulations",
"path": "/waterfilling_hp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashnasbot/AshnasBoy path: /mmu.py
from mbc import MBC
import random
import sys
from typing import Dict
from interface import Interface
from reg import Register, HandlerProxy
# I/O Registers
IE = 0xFFFF
DIV = 0xFF04
TIMA= 0xFF05
TMA = 0xFF06
TAC = 0xFF07
IF = 0xFF0F
LY = 0xFF44
class MMU(... | code_fim | hard | {
"lang": "python",
"repo": "ashnasbot/AshnasBoy",
"path": "/mmu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if key < 0x8000:
self.mbc[key] = val
elif key < 0xA000:
self._vram[key-0x8000] = val
elif key < 0xC000:
if self.mbc.ram_enabled:
# TODO: Read $0x149 and determine RAM Size
# TODO: Pass to MBC
self._era... | code_fim | hard | {
"lang": "python",
"repo": "ashnasbot/AshnasBoy",
"path": "/mmu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flysall/daily-code path: /python/py-lxf/myfile.py
import os
print(os.name)
#print(os.environ)
<|fim_suffix|>.'),'testdir')
os.mkdir(os.path.abspath('.'))<|fim_middle|>print(os.environ.get('PATH'))
print(os.path.abspath('.'))
os.path.join(os.path.abspath(' | code_fim | medium | {
"lang": "python",
"repo": "flysall/daily-code",
"path": "/python/py-lxf/myfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>abspath('.'))
os.path.join(os.path.abspath('.'),'testdir')
os.mkdir(os.path.abspath('.'))<|fim_prefix|># repo: flysall/daily-code path: /python/py-lxf/myfile.py
import os
print(os.name)
#print(os.environ)
<|fim_middle|>print(os.environ.get('PATH'))
print(os.path. | code_fim | easy | {
"lang": "python",
"repo": "flysall/daily-code",
"path": "/python/py-lxf/myfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>exp2 = "Good Morning"
ans2 = emphasize("GOOD MORNING")
assert ans2 == exp2, f"expected {exp2}, got {ans2}"
exp3 = "99 Red Balloons!"
ans3 = emphasize("99 red balloons!")
assert ans3 == exp3, f"expected {exp3}, got {ans3}"
print("everything okay")<|fim_prefix|># repo: chousemath/pygame_projects path: /s... | code_fim | medium | {
"lang": "python",
"repo": "chousemath/pygame_projects",
"path": "/snake/homework.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>exp3 = "99 Red Balloons!"
ans3 = emphasize("99 red balloons!")
assert ans3 == exp3, f"expected {exp3}, got {ans3}"
print("everything okay")<|fim_prefix|># repo: chousemath/pygame_projects path: /snake/homework.py
def emphasize(sentence):
words = sentence.split(" ")
for i, word in enumerate(words... | code_fim | hard | {
"lang": "python",
"repo": "chousemath/pygame_projects",
"path": "/snake/homework.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chousemath/pygame_projects path: /snake/homework.py
def emphasize(sentence):
words = sentence.split(" ")
for i, word in enumerate(words):
words[i] = word[0].upper() + word[1:].lower()
return " ".join(words)
<|fim_suffix|>exp2 = "Good Morning"
ans2 = emphasize("GOOD MORNING")... | code_fim | medium | {
"lang": "python",
"repo": "chousemath/pygame_projects",
"path": "/snake/homework.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Emoto13/BlackFriday-BackEnd path: /orders/migrations/0002_auto_20200909_1858.py
# Generated by Django 3.1 on 2020-09-09 15:58
from django.db import migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='orderpr... | code_fim | medium | {
"lang": "python",
"repo": "Emoto13/BlackFriday-BackEnd",
"path": "/orders/migrations/0002_auto_20200909_1858.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='orderproduct',
old_name='products',
new_name='product',
),
]<|fim_prefix|># repo: Emoto13/B... | code_fim | easy | {
"lang": "python",
"repo": "Emoto13/BlackFriday-BackEnd",
"path": "/orders/migrations/0002_auto_20200909_1858.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# setMotorSpeed (0-3) (0-100)
if cmd == "setMotorSpeed":
motorNum = int(args[0])
motorSpeed = int(args[1])
wilfredCommand.setMotorSpeed(motorNum, motorSpeed)
elif cmd == "playMeow":
goodMessage("wi... | code_fim | hard | {
"lang": "python",
"repo": "c0nrad/wilfred",
"path": "/wilfred.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: c0nrad/wilfred path: /wilfred.py
# wilfred.py
# Authors
# Stuart C. Larsen (SCL)
# Daryl W. Bennet (DWB)
# Set up three main modules (command, control, reconnaissance),
# and then enter main event loop.
#
# Command:
# Gather mission priorities and objectives, such as turn left, turn righ... | code_fim | medium | {
"lang": "python",
"repo": "c0nrad/wilfred",
"path": "/wilfred.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LESLYCADENA96/PICO_Y_PLACA path: /main_pp.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 10 17:48:19 2021
@author: LESLY
"""
from PICO_PLACA_class import PICO_PLACA
<|fim_suffix|> hora = input("Enter the time in the following format 00:00: ")
prog =PICO_PLAC... | code_fim | hard | {
"lang": "python",
"repo": "LESLYCADENA96/PICO_Y_PLACA",
"path": "/main_pp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if estado == "continue":
estado = prog.validar()
print("Your vehicle " + estado )
else:
print(estado)
if __name__ == '__main__':
main()<|fim_prefix|># repo: LESLYCADENA96/PICO_Y_PLACA path: /main_pp.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug ... | code_fim | hard | {
"lang": "python",
"repo": "LESLYCADENA96/PICO_Y_PLACA",
"path": "/main_pp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> hora = input("Enter the time in the following format 00:00: ")
prog =PICO_PLACA(placa,fecha,hora)
estado = prog.verificar()
if estado == "continue":
estado = prog.validar()
print("Your vehicle " + estado )
else:
print(estado)... | code_fim | hard | {
"lang": "python",
"repo": "LESLYCADENA96/PICO_Y_PLACA",
"path": "/main_pp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NathanLawrence/django-thermometer path: /thermometer/views.py
from django.shortcuts import render
from django.http import Http404
<|fim_suffix|> therms = Therm.objects.all()
return render(request, 'thermometer/index.html', {
'therms': therms,
})
def fetchsquare(request, id):
try:
therm =... | code_fim | easy | {
"lang": "python",
"repo": "NathanLawrence/django-thermometer",
"path": "/thermometer/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
therm = Therm.objects.get(id=id)
except Therm.DoesNotExist:
raise Http404('This item does not exist')
return render(request, 'thermometer/fetchsquare.html', {
'therm': therm,
})<|fim_prefix|># repo: NathanLawrence/django-thermometer path: /thermometer/views.py
from django.shortcuts import ... | code_fim | medium | {
"lang": "python",
"repo": "NathanLawrence/django-thermometer",
"path": "/thermometer/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.savefig(legend_label+'.jpg', format='jpg')
plt.show()
if __name__ == '__main__':
"""Saline Data"""
# vel_det(file='Saline_Ai14_OPRK1_C1_F0_side viewDLC_resnet50_SideViewNov1shuffle1_180000.h5',
# legend_label='Saline F0', line_color='yellowgreen')
# vel_det(file='... | code_fim | hard | {
"lang": "python",
"repo": "TheEmu001/GroomRear",
"path": "/y-val-groomrear.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> vel_det(file='U50_Ai14_OPRK1_C1_M1_side viewDLC_resnet50_SideViewNov1shuffle1_180000.h5',
legend_label='M1 5mgkg U50', line_color='blue')
vel_det(file='U50_Ai14_OPRK1_C1_M2_side viewDLC_resnet50_SideViewNov1shuffle1_180000.h5',
legend_label='M2 5mgkg U50', line_co... | code_fim | hard | {
"lang": "python",
"repo": "TheEmu001/GroomRear",
"path": "/y-val-groomrear.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheEmu001/GroomRear path: /y-val-groomrear.py
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
# prevent numpy exponential
# notation on print, default False
np.set_printoptions(suppress=True)
y_cord_df = pd.DataFrame(data=None, columns=[... | code_fim | hard | {
"lang": "python",
"repo": "TheEmu001/GroomRear",
"path": "/y-val-groomrear.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: se0siris/ssh-tunnel path: /ui/custom_widgets.py
from PyQt4.QtGui import QSystemTrayIcon, QApplication, QMenu, QIcon
class SystemTrayIcon(QSystemTrayIcon):
def __init__(self, parent=None):
super(SystemTrayIcon, self).__init__(parent)
self.set_icon_state(QIcon.Disabled)
... | code_fim | medium | {
"lang": "python",
"repo": "se0siris/ssh-tunnel",
"path": "/ui/custom_widgets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pixmap = QApplication.instance().windowIcon().pixmap(256, 256, state)
self.setIcon(QIcon(pixmap))<|fim_prefix|># repo: se0siris/ssh-tunnel path: /ui/custom_widgets.py
from PyQt4.QtGui import QSystemTrayIcon, QApplication, QMenu, QIcon
<|fim_middle|>class SystemTrayIcon(QSystemTrayIc... | code_fim | hard | {
"lang": "python",
"repo": "se0siris/ssh-tunnel",
"path": "/ui/custom_widgets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def read_file_list(path):
if os.path.isdir(path):
pathlist=os.listdir(path)
for file in pathlist:
read_video(path+'\\'+file)
# read_video('E:\\2.mp4')<|fim_prefix|># repo: sunkaiiii/generate_video_place path: /video_stitching.py
import cv2
import os
"""
视频场景拼接
"""
stich... | code_fim | hard | {
"lang": "python",
"repo": "sunkaiiii/generate_video_place",
"path": "/video_stitching.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunkaiiii/generate_video_place path: /video_stitching.py
import cv2
import os
"""
视频场景拼接
"""
stich_path="stichImage\\"
def read_video(filename):
'''
将视频每秒的内容提取出来
:param filename: 视频文件路径
:return: 视频文件名,用来拼接
'''
cap=cv2.VideoCapture(filename)
rate = cap.get(cv2.CAP_PROP... | code_fim | hard | {
"lang": "python",
"repo": "sunkaiiii/generate_video_place",
"path": "/video_stitching.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iakinsey/illume path: /illume/config/__init__.py
"""
Configuration management.
Environment must be set before use.
Call .get() to obtain configuration variable. If the variable does not exist
in the set environment, then
"""
CONFIG_KEY = "config_class"
ENV = {}
class EMPTY:
"""
Sig... | code_fim | hard | {
"lang": "python",
"repo": "iakinsey/illume",
"path": "/illume/config/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get config value"""
value = getattr(self.module, name, default)
if value != EMPTY:
return value
elif value == EMPTY and not self.fallback:
raise AttributeError(self.no_config_err.format(name))
elif value == EMPTY and self.fallback:
... | code_fim | hard | {
"lang": "python",
"repo": "iakinsey/illume",
"path": "/illume/config/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>hi = open("geneDictionary.pickle", "r")
hello = cPickle.load(hi)
print hello["MESTIT1"]<|fim_prefix|># repo: dbmi-pitt/PDDI-drug-target-interactions path: /jeremy-sandbox/Gene List/pickleReader.py
# Jeremy Jao
# University of Pittsburgh: DBMI
# 6/18/2013
#
# This is the thing that returns the d... | code_fim | medium | {
"lang": "python",
"repo": "dbmi-pitt/PDDI-drug-target-interactions",
"path": "/jeremy-sandbox/Gene List/pickleReader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dbmi-pitt/PDDI-drug-target-interactions path: /jeremy-sandbox/Gene List/pickleReader.py
# Jeremy Jao
# University of Pittsburgh: DBMI
# 6/18/2013
#
# This is the thing that returns the dictionary of the key. we can edit more code to return different values in the keys (gene) in each dictionar... | code_fim | medium | {
"lang": "python",
"repo": "dbmi-pitt/PDDI-drug-target-interactions",
"path": "/jeremy-sandbox/Gene List/pickleReader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: melehin/photocollage path: /apis/flickr.py
from __future__ import absolute_import
import re
import json
import requests
from apis.base import BaseAPI, APIException
# Flickr API: https://www.flickr.com/services/api/
class FlickrPhotoAPI(BaseAPI):
url_format = "https://farm{farm}.staticflickr... | code_fim | hard | {
"lang": "python",
"repo": "melehin/photocollage",
"path": "/apis/flickr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = requests.get("https://flickr.com/photos/")
if r.status_code == 200:
m = re.search(b'root.YUI_config.flickr.api.site_key = "(.+?)";', r.content)
if m:
self.api_key = m.group(1)
return
raise APIException("Can't get ... | code_fim | hard | {
"lang": "python",
"repo": "melehin/photocollage",
"path": "/apis/flickr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gustavoem/abc-sysbio path: /cudasim/solvers/cuda/Lsoda_mg.py
import os
import numpy as np
import pycuda
import pycuda.driver as driver
import cudasim.solvers.cuda.Simulator_mg as sim
import cudasim
class Lsoda(sim.SimulatorMG):
_param_tex = None
_step_code = None
_runtimeCompile =... | code_fim | hard | {
"lang": "python",
"repo": "gustavoem/abc-sysbio",
"path": "/cudasim/solvers/cuda/Lsoda_mg.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(total_threads):
neq[i] = neqn
t[i] = 0
itol[i] = 1
itask[i] = 1
istate[i] = 1
iopt[i] = 0
jt[i] = 2
atol[i] = in_atol
rtol[i] = in_rtol
liw[i] = isize
... | code_fim | hard | {
"lang": "python",
"repo": "gustavoem/abc-sysbio",
"path": "/cudasim/solvers/cuda/Lsoda_mg.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>del x
vocabsize = len(vocab_processor.vocabulary_)
print("Vocabulary Size: {:d}".format(vocabsize))
# Training
# ==================================================
with tf.Graph().as_default():
session_conf = tf.ConfigProto(
allow_soft_placement=FLAGS.allow_soft_placement,
log_device_pl... | code_fim | hard | {
"lang": "python",
"repo": "chandangope/w266-finalproject",
"path": "/rnn-text-classification-tf/rnn_train.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chandangope/w266-finalproject path: /rnn-text-classification-tf/rnn_train.py
#! /usr/bin/env python
import tensorflow as tf
import numpy as np
import os
import time
import datetime
import data_helpers
from text_rnn import TextRNN
from tensorflow.contrib import learn
# Parameters
# ============... | code_fim | hard | {
"lang": "python",
"repo": "chandangope/w266-finalproject",
"path": "/rnn-text-classification-tf/rnn_train.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: riceCao/website path: /article/views.py
from django.shortcuts import render
from django.shortcuts import redirect
from block.models import Block
from .models import Article
from .forms import ArticleForm
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_... | code_fim | hard | {
"lang": "python",
"repo": "riceCao/website",
"path": "/article/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> all_articles = Article.objects.filter(block=block, article_status=0).order_by("-id")
ARTICLE_CNT_1PAGE = 2
p = Paginator(all_articles, ARTICLE_CNT_1PAGE)
page_no = int(request.GET.get("page_no", "1"))
page = p.page(page_no)
articles_objs = page.object_list
page_links = [i
... | code_fim | medium | {
"lang": "python",
"repo": "riceCao/website",
"path": "/article/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def pdf_2_images(url, dest_path):
new_file, filename = download_pdf_to_temp(url)
save_pdf_image(filename, dest_path)
os.close(new_file)<|fim_prefix|># repo: Rykoua/ImageCollation path: /ManuscriptDownloader/utils/extract_images_from_pdf.py
import requests
from os.path import join, exists
imp... | code_fim | hard | {
"lang": "python",
"repo": "Rykoua/ImageCollation",
"path": "/ManuscriptDownloader/utils/extract_images_from_pdf.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def save_pdf_image(file_path, dest_path):
Path(dest_path).mkdir(parents=True, exist_ok=True)
doc = fitz.open(file_path)
i = 1
images_name = list()
xrefs = sorted([xref[0] for xref in doc.getPageImageList(0) if not(xref[0] in [10, 25, 26])])
maximum_digits = len(str(len(xrefs)*3))
... | code_fim | hard | {
"lang": "python",
"repo": "Rykoua/ImageCollation",
"path": "/ManuscriptDownloader/utils/extract_images_from_pdf.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rykoua/ImageCollation path: /ManuscriptDownloader/utils/extract_images_from_pdf.py
import requests
from os.path import join, exists
import os
import fitz
from tqdm import tqdm
from pathlib import Path
import tempfile
def download_pdf(url, folder, name):
r = requests.get(url, allow_redirects... | code_fim | hard | {
"lang": "python",
"repo": "Rykoua/ImageCollation",
"path": "/ManuscriptDownloader/utils/extract_images_from_pdf.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: couch-potahto/athlete_management_system_master path: /training_area/migrations/0003_auto_20190314_1527.py
# Generated by Django 2.1.7 on 2019-03-14 07:27
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies = [
('training_area', '000... | code_fim | medium | {
"lang": "python",
"repo": "couch-potahto/athlete_management_system_master",
"path": "/training_area/migrations/0003_auto_20190314_1527.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='event',
name='athlete',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='athlete_calendar', to='training_area.Athlete'),
),
migrations.Ad... | code_fim | medium | {
"lang": "python",
"repo": "couch-potahto/athlete_management_system_master",
"path": "/training_area/migrations/0003_auto_20190314_1527.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmitryelj/SDR-Waterfall2Img path: /rpi/SoapySDR.py
ty(_SoapySDR.ArgInfo_type_get, _SoapySDR.ArgInfo_type_set)
__swig_setmethods__["range"] = _SoapySDR.ArgInfo_range_set
__swig_getmethods__["range"] = _SoapySDR.ArgInfo_range_get
if _newclass:range = _swig_property(_SoapySDR.ArgInfo_ran... | code_fim | hard | {
"lang": "python",
"repo": "dmitryelj/SDR-Waterfall2Img",
"path": "/rpi/SoapySDR.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def writeStream(self, *args): return _SoapySDR.Device_writeStream(self, *args)
def readStreamStatus(self, *args): return _SoapySDR.Device_readStreamStatus(self, *args)
def getNumDirectAccessBuffers(self, *args): return _SoapySDR.Device_getNumDirectAccessBuffers(self, *args)
def getDirectAc... | code_fim | hard | {
"lang": "python",
"repo": "dmitryelj/SDR-Waterfall2Img",
"path": "/rpi/SoapySDR.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmitryelj/SDR-Waterfall2Img path: /rpi/SoapySDR.py
y(_SoapySDR.ArgInfo_type_get, _SoapySDR.ArgInfo_type_set)
__swig_setmethods__["range"] = _SoapySDR.ArgInfo_range_set
__swig_getmethods__["range"] = _SoapySDR.ArgInfo_range_get
if _newclass:range = _swig_property(_SoapySDR.ArgInfo_rang... | code_fim | hard | {
"lang": "python",
"repo": "dmitryelj/SDR-Waterfall2Img",
"path": "/rpi/SoapySDR.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param features: float32 tensor of size (bs x t x f x c)
:param features_lengths: int64 tensor of size (bs)
:param spkids: string id of speakers
:returns: A tuple with elements:
- encoded: float32 tensor of size (t x bs x d)
- encoded... | code_fim | hard | {
"lang": "python",
"repo": "chorowski-lab/pytorch-asr",
"path": "/att_speech/modules/encoders/base_encoder.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chorowski-lab/pytorch-asr path: /att_speech/modules/encoders/base_encoder.py
from torch import nn
from abc import ABCMeta, abstractmethod
class BaseEncoder(nn.Module):
__metaclass__ = ABCMeta
<|fim_suffix|> @abstractmethod
def forward(self, features, features_lengths, spkids):
... | code_fim | hard | {
"lang": "python",
"repo": "chorowski-lab/pytorch-asr",
"path": "/att_speech/modules/encoders/base_encoder.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(dist(counts))
counts = defaultdict(int)
with open("day11.input.txt") as f:
INPUT = f.read().strip()
dir_list = INPUT.split(",")
# print(dir_list)
max_d = -1
for dir in dir_list:
# Keep running counts and check for distance at every
... | code_fim | hard | {
"lang": "python",
"repo": "seweissman/advent_of_code_2017",
"path": "/day11_hex_ed.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seweissman/advent_of_code_2017 path: /day11_hex_ed.py
from collections import defaultdict
# The order of the steps doesn't matter, so the distance
# function is very simple
def dist(counts):
n = abs(counts["n"] - counts["s"])
nw = abs(counts["nw"] - counts["se"])
ne = abs(counts["ne"... | code_fim | hard | {
"lang": "python",
"repo": "seweissman/advent_of_code_2017",
"path": "/day11_hex_ed.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>DefaultGcloudSpec = {
'available_os': {
'CentOS7': {
'image': SpecValidator(type='string', default="centos-7"),
'ssh_user': SpecValidator(type='string', default='edbadm')
},
'RedHat7': {
'image': SpecValidator(type='string', default="rhel-7")... | code_fim | hard | {
"lang": "python",
"repo": "EnterpriseDB/postgres-deployment",
"path": "/edbdeploy/spec/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EnterpriseDB/postgres-deployment path: /edbdeploy/spec/__init__.py
# These are instance types to make available to all AWS EC2 systems, except the .
# PostgreSQL server, until the auto tuning playbook can tune for systems that
# small.
AWSGlobalInstanceChoices = [
't2.nano', 't2.micro',
... | code_fim | hard | {
"lang": "python",
"repo": "EnterpriseDB/postgres-deployment",
"path": "/edbdeploy/spec/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self,F,cb):
self.start = time.time()
print("Draw timer started")
self.name = F
self.cell = Cell(cb)
self.atoms = readEl(cb)
self.pos = readPos(cb)
c = self.cell
self.ftoc = self.get_fracti... | code_fim | hard | {
"lang": "python",
"repo": "JarritB/Thesis",
"path": "/Teksten/Scriptie/Bijlages/Bijlage_D.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JarritB/Thesis path: /Teksten/Scriptie/Bijlages/Bijlage_D.py
e = 2 # set the max distance between bound atoms
lattice_size = 0.03 # sets size of lattice borders
bond_radius = 0.05 # radius of bond
add_camera = True # render final image
atom... | code_fim | hard | {
"lang": "python",
"repo": "JarritB/Thesis",
"path": "/Teksten/Scriptie/Bijlages/Bijlage_D.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JarritB/Thesis path: /Teksten/Scriptie/Bijlages/Bijlage_D.py
"category": "Crystallography in Blender"
}
# Operator to open the file browser and select a file
class ScanFileOperator(bpy.types.Operator):
bl_idname = "error.scan_file"
bl_label = "Scan file for return"
filepath = bp... | code_fim | hard | {
"lang": "python",
"repo": "JarritB/Thesis",
"path": "/Teksten/Scriptie/Bijlages/Bijlage_D.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def unsafe_undefined(self, obj, attribute): ...
def call(__self, __context, __obj, *args, **kwargs): ...
class ImmutableSandboxedEnvironment(SandboxedEnvironment):
def is_safe_attribute(self, obj, attr, value): ...<|fim_prefix|># repo: sourcegraph/python-language-server path: /src/Analysis/E... | code_fim | hard | {
"lang": "python",
"repo": "sourcegraph/python-language-server",
"path": "/src/Analysis/Engine/Impl/Typeshed/third_party/2and3/jinja2/sandbox.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 1、新建QSqlTableModel实例
self.base_QSqlTableModel = QSqlTableModel()
self.base_QSqlTableModel.setTable(current_table_name) # 设置查询表的名称为下拉框选择的表
self.base_QSqlTableModel.setEditStrategy(QSqlTableModel.OnFieldChange) # 设置编辑策略为一改动马上提交数据库
self.base_QSqlTableModel.sele... | code_fim | hard | {
"lang": "python",
"repo": "dx9648ly/PrimeCostOrderManagement_new",
"path": "/CODE/DataMaintenance.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dx9648ly/PrimeCostOrderManagement_new path: /CODE/DataMaintenance.py
# -*- coding:utf-8 -*-
# project: PrimeCostOrderManagement
# @File : DataMaintenance.py
# @Time : 2021-07-06 08:58
# @Author: LongYuan
# @FUNC : 基础数据维护界面
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIntValidator
from... | code_fim | hard | {
"lang": "python",
"repo": "dx9648ly/PrimeCostOrderManagement_new",
"path": "/CODE/DataMaintenance.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 设置tableview表格填满窗口
self.tableView.horizontalHeader().setStretchLastSection(False) # 水平方向标签拓展剩下的窗口部分,填满表格
self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # 水平方向,表格大小拓展到适当的尺寸
# self.tableView.hideColumn(0) # 隐藏ID列
# 1、新建QSqlTabl... | code_fim | hard | {
"lang": "python",
"repo": "dx9648ly/PrimeCostOrderManagement_new",
"path": "/CODE/DataMaintenance.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if loadBalance:
print(color("INFO: Running ./setup.sh with load balance configuration...", fg="yellow"))
# Stream output based on option
if stream:
lowLevelClient = towerdev.common.apiClient()
calcRunContainer = len(clusterContainers) - 1
cr... | code_fim | hard | {
"lang": "python",
"repo": "demonpig/towerdev",
"path": "/towerdev/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Optional debug that prints a dict of options
if debug == True:
runOpts = dict(towerVersion=towerVersion, externalPort=externalPort, osVersion=osVersion, containerName=containerName)
print(runOpts)
# Determines what we do based on externalPort input
if not externalPort:
... | code_fim | hard | {
"lang": "python",
"repo": "demonpig/towerdev",
"path": "/towerdev/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: demonpig/towerdev path: /towerdev/run.py
#!/usr/bin/env python3
''' towerdev - Ansible Tower Testing Framework
MIT License
Copyright © 2021 falcon78921
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwa... | code_fim | hard | {
"lang": "python",
"repo": "demonpig/towerdev",
"path": "/towerdev/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> questions = result['questions']
self.assertIsInstance(questions, list)
self.assertEqual(len(questions), len(self.tickets))
def test_get_exam_questions_not_available(self):
self.session.start_time += self.session.duration
self.session.save()
result = se... | code_fim | hard | {
"lang": "python",
"repo": "pyrolynx/python-exam",
"path": "/exam_web/tests.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyrolynx/python-exam path: /exam_web/tests.py
__init__(self, path: str, student: Student = None, *args, **kwargs):
super().__init__(*args, **kwargs)
self.student = student
self.path = path
self.headers = {'content_type': 'application/json'}
if student:
... | code_fim | hard | {
"lang": "python",
"repo": "pyrolynx/python-exam",
"path": "/exam_web/tests.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyrolynx/python-exam path: /exam_web/tests.py
self.path = path
self.headers = {'content_type': 'application/json'}
if student:
self.cookies['student'] = student.id
def path_params(self, **params):
return ApiClient(self.path.format(**params), self.st... | code_fim | hard | {
"lang": "python",
"repo": "pyrolynx/python-exam",
"path": "/exam_web/tests.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justanewbieC/cc-leetcode path: /LeetCode 101-200/144-Binary-Tree-Preorder-Traversal.py
'''
����Ҫ�������������Ԫ�ز�������һ�����飬�������õ����ķ��������
��˿���ά��һ��treeStack�б����ڵ����ڵ�ջ���Ƚ����ڵ����ջ�С�
��ѭ���У��Ƚ�ջ��Ԫ�ص���������result�����У�Ȼ������ѹ���Һ��ӡ����ӡ�
����ʱ�临�Ӷ�ΪO(n)������ʱ��36ms���... | code_fim | medium | {
"lang": "python",
"repo": "justanewbieC/cc-leetcode",
"path": "/LeetCode 101-200/144-Binary-Tree-Preorder-Traversal.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type root: TreeNode
:rtype: List[int]
"""
treeStack , result = [] , []
if root : treeStack.append(root)
while treeStack:
root = treeStack.pop()
result.append(root.val)
if root.right: treeStack.append(... | code_fim | medium | {
"lang": "python",
"repo": "justanewbieC/cc-leetcode",
"path": "/LeetCode 101-200/144-Binary-Tree-Preorder-Traversal.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: psvr/ostov path: /projects/education/migrations/0006_auto_20180927_1340.py
# Generated by Django 2.0.7 on 2018-09-27 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='ed... | code_fim | medium | {
"lang": "python",
"repo": "psvr/ostov",
"path": "/projects/education/migrations/0006_auto_20180927_1340.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('education', '0005_auto_20180927_1041'),
]
operations = [
migrations.RemoveField(
model_name='educationgroup',
name='students',
),
migrations.AddField(
model_name='student',
name='education_grou... | code_fim | medium | {
"lang": "python",
"repo": "psvr/ostov",
"path": "/projects/education/migrations/0006_auto_20180927_1340.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='educationgroup',
name='students',
),
migrations.AddField(
model_name='student',
name='education_groups',
field=models.ManyToManyField(blank=True, to='education.Educati... | code_fim | medium | {
"lang": "python",
"repo": "psvr/ostov",
"path": "/projects/education/migrations/0006_auto_20180927_1340.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tingtzuchiu/wallyMart path: /User.py
import sqlite3
class User():
def __init__(self):
self.name = ''
self.password = ''
def Register(self):
konn = sqlite3.connect('User.db')
a = konn.cursor()
alllines = a.execut... | code_fim | hard | {
"lang": "python",
"repo": "tingtzuchiu/wallyMart",
"path": "/User.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> konn = sqlite3.connect('User.db')
a = konn.cursor()
alllines = a.execute("select * from UserList")
user_dict = {}
for i in alllines:
user_dict[i[0]] = i[1]
a.close()
return user_dict<|fim_prefix|># repo: tingtzuchiu/wallyMa... | code_fim | hard | {
"lang": "python",
"repo": "tingtzuchiu/wallyMart",
"path": "/User.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def Create_user(self):
konn = sqlite3.connect('User.db')
a = konn.cursor()
a.execute("create table if not exists UserList (username, password)")
konn.commit()
def Check_user(self):
konn = sqlite3.connect('User.db')
a = konn.cursor()
... | code_fim | hard | {
"lang": "python",
"repo": "tingtzuchiu/wallyMart",
"path": "/User.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>''
x=s.split()
d={}
for i in x:
if d.get(i):
d[i]=d.get(i)+1
else:
d[i]=1
print d<|fim_prefix|># repo: nagireddy96666/Interview_-python path: /COMPANIES/pracice.bangalur/sortingexmpls/string7.py
s="hello python this is python language"
'''expected<|fim_middle|> out put is
hello:1
... | code_fim | easy | {
"lang": "python",
"repo": "nagireddy96666/Interview_-python",
"path": "/COMPANIES/pracice.bangalur/sortingexmpls/string7.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nagireddy96666/Interview_-python path: /COMPANIES/pracice.bangalur/sortingexmpls/string7.py
s="hello python this is python language"
'''expected out put is
hello:1
python:2
this:1
is:1
language:1
'<|fim_suffix|> d[i]=d.get(i)+1
else:
d[i]=1
print d<|fim_middle|>''
x=s.split()
d={}... | code_fim | easy | {
"lang": "python",
"repo": "nagireddy96666/Interview_-python",
"path": "/COMPANIES/pracice.bangalur/sortingexmpls/string7.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tommyle128/leminhtu-fundamentals-c4e20 path: /Session02/homework/2_factorial.py
n = int(input("Enter a number: "))
<|fim_suffix|>print("The total factorial of", n, "is", f)<|fim_middle|>while n < 0:
print("Please enter a positive number starting from 0")
n = int(input("Enter a number: ")... | code_fim | medium | {
"lang": "python",
"repo": "tommyle128/leminhtu-fundamentals-c4e20",
"path": "/Session02/homework/2_factorial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("The total factorial of", n, "is", f)<|fim_prefix|># repo: tommyle128/leminhtu-fundamentals-c4e20 path: /Session02/homework/2_factorial.py
n = int(input("Enter a number: "))
<|fim_middle|>while n < 0:
print("Please enter a positive number starting from 0")
n = int(input("Enter a number: ")... | code_fim | medium | {
"lang": "python",
"repo": "tommyle128/leminhtu-fundamentals-c4e20",
"path": "/Session02/homework/2_factorial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdumm/spotify-gesture-controls path: /src/python/spotify_controls.py
import os
import spotipy
from spotipy.oauth2 import SpotifyOAuth
import pyautogui
import cv2
from datetime import datetime
from utils import *
class SpotifyControls:
"""
This class execute Spotify API commands bas... | code_fim | hard | {
"lang": "python",
"repo": "jdumm/spotify-gesture-controls",
"path": "/src/python/spotify_controls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_dev_idx = cur_dev_idx - 1 # Loop backwards
new_dev_id = devs[new_dev_idx]['id']
self.sp_client.transfer_playback(new_dev_id)
except spotipy.exceptions.SpotifyException as e:
print("Tried to change device to connect_speaker (... | code_fim | hard | {
"lang": "python",
"repo": "jdumm/spotify-gesture-controls",
"path": "/src/python/spotify_controls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Adoni/CSE505 path: /LTN/src/main.py
# coding: utf-8
# In[1]:
#coding:utf8
import matplotlib
import os
if 'DISPLAY' not in os.environ:
matplotlib.use('Agg')
else:
pass
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
from matplotlib imp... | code_fim | hard | {
"lang": "python",
"repo": "Adoni/CSE505",
"path": "/LTN/src/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
emb_dim_range=list(range(10,20,5))+list(range(20,101,20))
emb_dim_range=list(range(160,161,20))
# In[ ]:
for emb_dim in emb_dim_range:
test_model(
model=LTN(emb_dim,'abcdefghijklmn',[['S',1],['F',2],['C',1]], CLTN=True),
kb1=kb1.union(gkb3),
kb2=kb2.union(gkb4),
fi... | code_fim | hard | {
"lang": "python",
"repo": "Adoni/CSE505",
"path": "/LTN/src/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># In[ ]:
for emb_dim in emb_dim_range:
test_model(
model=LTN(emb_dim,'abcdefghijklmn',[['S',1],['F',2],['C',1]], CLTN=True),
kb1=kb1.union(gkb3),
kb2=kb2.union(gkb4),
filename='LTN_Learn_emb_dim=%d.pkl'%(emb_dim)
)
# In[80]:
accuracys1=[]
accuracys2=[]
for emb... | code_fim | hard | {
"lang": "python",
"repo": "Adoni/CSE505",
"path": "/LTN/src/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('event', '0009_auto_20211001_0406'),
]
operations = [
migrations.AlterField(
model_name='event',
name='map',
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='JPEG', help_text='Mapa del event... | code_fim | medium | {
"lang": "python",
"repo": "GMR027/social-events-platform-api",
"path": "/event/migrations/0010_auto_20211001_0643.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GMR027/social-events-platform-api path: /event/migrations/0010_auto_20211001_0643.py
# Generated by Django 3.2.7 on 2021-10-01 06:43
from django.db import migrations
import django_resized.forms
import event.models.event
import event.models.event_agenda
<|fim_suffix|> operations = [
m... | code_fim | medium | {
"lang": "python",
"repo": "GMR027/social-events-platform-api",
"path": "/event/migrations/0010_auto_20211001_0643.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Labgoo/PyBigQuery path: /bigquery/client.py
import os
from googleapiclient.discovery import build
import httplib2
from oauth2client import gce
from oauth2client.appengine import AppAssertionCredentials
from oauth2client.file import Storage
__author__ = 'ekampf'
import json
import logging
impo... | code_fim | hard | {
"lang": "python",
"repo": "Labgoo/PyBigQuery",
"path": "/bigquery/client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Streams data into BigQuery one record at a time without needing to run a load job.
:param application_id: Project ID of the destination table. (required)
:param dataset_id: Dataset ID of the destination table. (required)
:param table_id: Table ID of the destination tabl... | code_fim | hard | {
"lang": "python",
"repo": "Labgoo/PyBigQuery",
"path": "/bigquery/client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03230/s938269525.py
N = int(input())
def f(limit):
i = 1
j = 2
while True:
if i > limit:
break
yield i
i += j
j += 1
def h1(l, n):
s = 0
for i in range(n):
yield l[s:s+i+1]
... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03230/s938269525.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in t:
print(len(i), " ".join(str(j) for j in i))
else:
print("No")<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03230/s938269525.py
N = int(input())
def f(limit):
i = 1
j = 2
while True:
if i > limit:
break
yield i
... | code_fim | hard | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03230/s938269525.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> expRows = expLex.avgEntropyAtN(maxThresh)
controlRows = control.avgEntropyAtN(maxThresh)
if dataName:
fileName = 'entropy_%s' % dataName
else:
fileName = 'entropy'
plot(controlRows, expRows, "Avg. Entropy with Categories more Frequent than N", "N", "Entropy", fileName)
... | code_fim | hard | {
"lang": "python",
"repo": "honnibal/legacy_thesis_code",
"path": "/code/scripts/.svn/text-base/analyseLex.py.svn-base",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.