text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: alex-vegan/100daysofcode-with-python-course path: /days/day009/test_bite_089_Playing_with_lists_and_dicts_and_github.py
from bite_089_Playing_with_lists_and_dicts_and_github import (get_every_nth_state,
get_state_abbrev, get_longest_state, combine_state_names_and_abbreviations)
def test_get... | code_fim | easy | {
"lang": "python",
"repo": "alex-vegan/100daysofcode-with-python-course",
"path": "/days/day009/test_bite_089_Playing_with_lists_and_dicts_and_github.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KeeganZQJ/CoSOD-CoADNet path: /code/dataset.py
from common_packages import *
from misc import *
class List_Loader(data.Dataset):
def __init__(self, data_root, list_file, is_augment):
self.data_root = data_root
self.list_file = list_file
self.is_augment = is_augment
... | code_fim | hard | {
"lang": "python",
"repo": "KeeganZQJ/CoSOD-CoADNet",
"path": "/code/dataset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def Identity_Loader(load_path_list, Bg, Bs):
to_tensor = transforms.ToTensor()
horizontal_flip = transforms.RandomHorizontalFlip(p=1)
num_total = len(load_path_list)
indices_g = random.choice(num_total, Bg, replace=False)
# load CoSOD data
gi_loaded = []
gl_loaded = []
fo... | code_fim | hard | {
"lang": "python",
"repo": "KeeganZQJ/CoSOD-CoADNet",
"path": "/code/dataset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: temporalwaffle/adventofcode-1 path: /2019/Day05.py
from collections import deque, namedtuple
Instruction = namedtuple('Instruction', [
'opcode',
'parameter_1_mode',
'paramete... | code_fim | hard | {
"lang": "python",
"repo": "temporalwaffle/adventofcode-1",
"path": "/2019/Day05.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def p2solver(noun, verb):
intcode_program[1] = noun
intcode_program[2] = verb
cpu = IntcodeComputer(intcode_program)
cpu.run()
return cpu.intcodes[0]
def p2finder(target):
for noun in range(100):
for verb in range(100):
val = p2solver(noun,verb)
pr... | code_fim | hard | {
"lang": "python",
"repo": "temporalwaffle/adventofcode-1",
"path": "/2019/Day05.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def tests():
cpu = IntcodeComputer([1,0,0,0,99])
print(cpu.run())
cpu = IntcodeComputer([2,3,0,3,99])
print(cpu.run())
cpu = IntcodeComputer([1,9,10,3,2,3,11,0,99,30,40,50])
print(cpu.run())
cpu = IntcodeComputer([0])
print(cpu.parse_instruction(12345))
print(cpu.pa... | code_fim | hard | {
"lang": "python",
"repo": "temporalwaffle/adventofcode-1",
"path": "/2019/Day05.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # drive
speed = STOP
direction = 0
# states of keys: 0 indicates up, 1 is down.
k_up = k_down = k_left = k_right = 0
run = True
while run:
terminate = False
# stall here
clock.tick(FPS)
for event in pg.event.get():
if event.type == ... | code_fim | hard | {
"lang": "python",
"repo": "cyphyhouse/ROS-workspace-rally",
"path": "/src/week1tutorial/src/adjustable_keyboard.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cyphyhouse/ROS-workspace-rally path: /src/week1tutorial/src/adjustable_keyboard.py
#!/usr/bin/env python
# NOTE: To run, SSH in with -X flag so that pygame console can be run.
import pygame as pg
from pygame.locals import *
import sys
import subprocess
import os
import rospy
from race.msg import ... | code_fim | hard | {
"lang": "python",
"repo": "cyphyhouse/ROS-workspace-rally",
"path": "/src/week1tutorial/src/adjustable_keyboard.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kmdalton/reciprocalspaceship path: /tests/data/french_wilson/gen_mcmc_reference_data.py
#!/usr/bin/env python
import numpy as np
import pymc3 as pm
import pandas as pd
inFN = "fw_test_data.csv"
outFN = "fw_mcmc_data.csv"
nproc=7
chain_length = 30_000
burnin = 15_000
df = pd.read_csv(inFN)
I,... | code_fim | hard | {
"lang": "python",
"repo": "kmdalton/reciprocalspaceship",
"path": "/tests/data/french_wilson/gen_mcmc_reference_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with pm.Model() as model:
Wilson = pm.distributions.Gamma('Wilson', a, scale, shape=len(a))
likelihood = pm.distributions.Normal('Likelihood', mu=Wilson, sigma=SigI, observed=I)
trace = pm.sample(draws=chain_length, tune=burnin, cores=nproc)
samples = trace.get_values('Wilson')
mc_J = samples... | code_fim | hard | {
"lang": "python",
"repo": "kmdalton/reciprocalspaceship",
"path": "/tests/data/french_wilson/gen_mcmc_reference_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henrylin2008/Coding_Problems path: /Coding Patterns/In-place Reversal of a linked list/Rotate a LinkedList.py
# Problem Challenge 2: Rotate a LinkedList (medium)
# https://designgurus.org/path-player?courseid=grokking-the-coding-interview&unit=grokking-the-coding-interview_1628743812259_42Unit
#... | code_fim | hard | {
"lang": "python",
"repo": "henrylin2008/Coding_Problems",
"path": "/Coding Patterns/In-place Reversal of a linked list/Rotate a LinkedList.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> head = Node(1)
head.next = Node(2)
head.next.next = Node(3)
head.next.next.next = Node(4)
head.next.next.next.next = Node(5)
head.next.next.next.next.next = Node(6)
print("Nodes of original LinkedList are: ", end='')
head.print_list()
result = rotate(head, 3)
print... | code_fim | hard | {
"lang": "python",
"repo": "henrylin2008/Coding_Problems",
"path": "/Coding Patterns/In-place Reversal of a linked list/Rotate a LinkedList.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Nodes of original LinkedList are: ", end='')
head.print_list()
result = rotate(head, 3)
print("Nodes of rotated LinkedList are: ", end='')
result.print_list()
main()
# Time Complexity
# The time complexity of our algorithm will be O(N) where ‘N’ is the total number of nodes i... | code_fim | hard | {
"lang": "python",
"repo": "henrylin2008/Coding_Problems",
"path": "/Coding Patterns/In-place Reversal of a linked list/Rotate a LinkedList.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aprieels/3D-watermarking-spectral-decomposition path: /dependencies/PyMesh/python/pymesh/tests/test_material.py
try:
from pymesh import Material
from pymesh.TestCase import TestCase
import numpy as np
except:
pass;
else:
class MaterialTest(TestCase):
def assert_symme... | code_fim | hard | {
"lang": "python",
"repo": "aprieels/3D-watermarking-spectral-decomposition",
"path": "/dependencies/PyMesh/python/pymesh/tests/test_material.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> strain = np.array([ [1.0, 0.0], [0.0, 0.0] ]);
stress = mat.strain_to_stress(strain);
self.assertAlmostEqual(strain[0,0],
stress[0,0]/young - poisson*stress[1,1]/young );
self.assertAlmostEqual(strain[1,1],
stress[1,1]... | code_fim | hard | {
"lang": "python",
"repo": "aprieels/3D-watermarking-spectral-decomposition",
"path": "/dependencies/PyMesh/python/pymesh/tests/test_material.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> young = 1000.0;
poisson = 0.3;
iso_mat = Material.create_isotropic(3, 1.0, young, poisson);
ortho_mat = Material.create_orthotropic(1.0,
np.ones(3)*young,
np.ones(6)*poisson,
np.ones(3)*(0.5*young/... | code_fim | hard | {
"lang": "python",
"repo": "aprieels/3D-watermarking-spectral-decomposition",
"path": "/dependencies/PyMesh/python/pymesh/tests/test_material.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> score = 0
for i in xrange(0, len(input)):
score += ord(input[i]) - 64
return score
# tested parsing
input = raw_input()
input = input.split('\",\"')
input[0] = string.replace(input[0], '\"', '')
input[-1] = string.replace(input[-1], '\"', '')
# input = ['AAB', 'BBB']
indices = []
fo... | code_fim | medium | {
"lang": "python",
"repo": "patrickhop/tc",
"path": "/palantir_fdce_r2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># tested parsing
input = raw_input()
input = input.split('\",\"')
input[0] = string.replace(input[0], '\"', '')
input[-1] = string.replace(input[-1], '\"', '')
# input = ['AAB', 'BBB']
indices = []
for i in xrange(1, len(input) + 1):
indices.append(i)
inputsAndSubScores = map(lambda x: (x, stringTo... | code_fim | hard | {
"lang": "python",
"repo": "patrickhop/tc",
"path": "/palantir_fdce_r2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patrickhop/tc path: /palantir_fdce_r2.py
## This is the text editor interface.
## Anything you type or change here will be seen by the other person in real time.
## [... ("NAME",score) ... ] sorted alphabetically
## score = sum of letter scores * log(position in the the sorted list starting at... | code_fim | hard | {
"lang": "python",
"repo": "patrickhop/tc",
"path": "/palantir_fdce_r2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jaruwitteng/6230401856-oop-labs path: /jaruwit-6230401856-lab6/exercise2.py
numbers = (2, 123.4567, 10000, 12345.67)
print("file_{:03d}:".format(numbers[0]), "{:2.2f},"<|fim_suffix|>mbers[2]),
"{:3.2e}".format(numbers[3]))<|fim_middle|>.format(numbers[1]),
"{:3.2e}".format(nu | code_fim | easy | {
"lang": "python",
"repo": "jaruwitteng/6230401856-oop-labs",
"path": "/jaruwit-6230401856-lab6/exercise2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>mbers[2]),
"{:3.2e}".format(numbers[3]))<|fim_prefix|># repo: jaruwitteng/6230401856-oop-labs path: /jaruwit-6230401856-lab6/exercise2.py
numbers = (2, 123.4567, 10000, 12345.67)
print("file_{:03d}:".format(numbers[0]), "{:2.2f},"<|fim_middle|>.format(numbers[1]),
"{:3.2e}".format(nu | code_fim | easy | {
"lang": "python",
"repo": "jaruwitteng/6230401856-oop-labs",
"path": "/jaruwit-6230401856-lab6/exercise2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ((left, top), (right, bottom))
# Download the image from the url, so can display it in popup/browser
response = requests.get(image)
img = Image.open(BytesIO(response.content))
# For each face returned use the face rectangle and draw a red box.
print('Drawing rectangle ... | code_fim | hard | {
"lang": "python",
"repo": "Azure-Samples/cognitive-services-quickstart-code",
"path": "/python/Face/DetectFaceAttributes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Display the detected face with attributes and bounding box
'''
# Face IDs are used for comparison to faces (their IDs) detected in other images.
for face in detected_faces:
print()
print('Detected face ID from', os.path.basename(image), ':')
# ID of detected... | code_fim | hard | {
"lang": "python",
"repo": "Azure-Samples/cognitive-services-quickstart-code",
"path": "/python/Face/DetectFaceAttributes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def dfs_iter(matrix, startpoint, visited):
m = len(matrix)
n = len(matrix[0])
directions = [
(-1, 0), (0, 1), (1, 0), (0, -1)
]
stack = [startpoint]
while stack:
curr = stack.pop()
visited.add(curr)
x, y = curr
print(x*n+y, end=' ')
for dx, dy in directions:
nx, n... | code_fim | hard | {
"lang": "python",
"repo": "jiangyoudang/python3",
"path": "/algorithm/other/graph.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiangyoudang/python3 path: /algorithm/other/graph.py
from random import random, randrange
from collections import deque
def build_graph(vertices_num, edges):
graph = [['N'] * vertices_num for i in range(vertices_num)]
for edge in edges:
graph[edge[0]][edge[1]] = True
return graph
#... | code_fim | hard | {
"lang": "python",
"repo": "jiangyoudang/python3",
"path": "/algorithm/other/graph.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #�����E�R�[�p�X�쐬
topic.topic_corpus_maker(fileName,input_filePath,output_filePath)
print "Finished"<|fim_prefix|># repo: wajimax/Python-NLP path: /topic/make_gensim_files.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('../_library')
sys.path.append('../_simulationConf')
import gensim_lib
imp... | code_fim | medium | {
"lang": "python",
"repo": "wajimax/Python-NLP",
"path": "/topic/make_gensim_files.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wajimax/Python-NLP path: /topic/make_gensim_files.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('../_library')
sys.path.append('../_simulationConf')
import gensim_lib
import topic
import conf
<|fim_suffix|> #Input�t�@�C���p�X
input_filePath = "../_output/wakachi/"
#Output�t�@�C���p�X... | code_fim | medium | {
"lang": "python",
"repo": "wajimax/Python-NLP",
"path": "/topic/make_gensim_files.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: martinphellwig/pricesearcher path: /apps/api/tests/test_commands.py
"""
Test Cases for Commands
Just making sure they don't cause any errors when executing.
"""
import argparse
from unittest import mock
<|fim_suffix|> def test_3_check_path(self):
"Check if the checkpath throws an erro... | code_fim | hard | {
"lang": "python",
"repo": "martinphellwig/pricesearcher",
"path": "/apps/api/tests/test_commands.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @mock.patch(MOCK_CSVZ, mock.MagicMock(return_value=None))
def test_2_cmd_import_csvz(self):
"Does it not smoke."
call_command("import_csvz")
def test_3_check_path(self):
"Check if the checkpath throws an error."
with self.assertRaises(argparse.ArgumentTypeError... | code_fim | medium | {
"lang": "python",
"repo": "martinphellwig/pricesearcher",
"path": "/apps/api/tests/test_commands.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sachiniSam/ISTuneUP path: /ResultAnalyzer.py
import pandas as pd
import numpy as np
class ResultAnaylzer:
global optType
@staticmethod
# Step 2. Import the dataset
def importResultData():
global df
df = pd.read_csv('overallResult.csv')
return df
@st... | code_fim | hard | {
"lang": "python",
"repo": "sachiniSam/ISTuneUP",
"path": "/ResultAnalyzer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> global optType
#get the default optimization result
defaultLatency = ResultAnaylzer.getDefault("99%_Line")
optimizedVal = ResultAnaylzer.getOptimized("99%_Line")
improvement = round(-1*(float(float(optimizedVal - defaultLatency)/defaultLatency )*100),2)
retu... | code_fim | hard | {
"lang": "python",
"repo": "sachiniSam/ISTuneUP",
"path": "/ResultAnalyzer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@staticmethod
def latencyImprovement():
global optType
#get the default optimization result
defaultLatency = ResultAnaylzer.getDefault("99%_Line")
optimizedVal = ResultAnaylzer.getOptimized("99%_Line")
improvement = round(-1*(float(float(optimizedVal - defa... | code_fim | hard | {
"lang": "python",
"repo": "sachiniSam/ISTuneUP",
"path": "/ResultAnalyzer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wansang93/Python path: /How to use Python in Silicon Valley/08. File IO and System/96.py
import string
file_path = ('C:/Users/wansang/Desktop/Gitrep/Python/'
'How to use Python in Silicon Valley/08. File IO and System/test.txt')
s = """\
Hi $name.
<|fim_suffix|>with open(file_path, 'w+') a... | code_fim | easy | {
"lang": "python",
"repo": "wansang93/Python",
"path": "/How to use Python in Silicon Valley/08. File IO and System/96.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>contents = t.substitute(name='Wansang', contents='How are you?')
print(contents)<|fim_prefix|># repo: wansang93/Python path: /How to use Python in Silicon Valley/08. File IO and System/96.py
import string
file_path = ('C:/Users/wansang/Desktop/Gitrep/Python/'
'How to use Python in Silicon Valley/08.... | code_fim | medium | {
"lang": "python",
"repo": "wansang93/Python",
"path": "/How to use Python in Silicon Valley/08. File IO and System/96.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @json_view(content_type="application/json", permission='edit_tender', validators=(validate_lot_operation_for_stage2,))
def collection_post(self):
"""Add a lot """
@json_view(permission='edit_tender', validators=(validate_lot_operation_for_stage2,))
def delete(self):
"""Lot... | code_fim | hard | {
"lang": "python",
"repo": "openprocurement/openprocurement.tender.competitivedialogue",
"path": "/openprocurement/tender/competitivedialogue/views/stage2/lot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openprocurement/openprocurement.tender.competitivedialogue path: /openprocurement/tender/competitivedialogue/views/stage2/lot.py
# -*- coding: utf-8 -*-
from openprocurement.api.utils import json_view
from openprocurement.tender.core.utils import (
optendersresource
)
from openprocurement.te... | code_fim | hard | {
"lang": "python",
"repo": "openprocurement/openprocurement.tender.competitivedialogue",
"path": "/openprocurement/tender/competitivedialogue/views/stage2/lot.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vietnt/elliptics path: /bindings/python/routes.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
sys.path.append('bindings/python/')
import elliptics
import argparse
def percentage(routes):
percentages = routes.percentages()
for g in percentages:
print 'Group: {0}'.forma... | code_fim | hard | {
"lang": "python",
"repo": "vietnt/elliptics",
"path": "/bindings/python/routes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
for r in args.remotes:
n.add_remote(r)
except Exception as e:
print e
pass
routes = s.get_routes()
if args.percentage:
percentage(routes)
else:
print routes<|fim_prefix|># repo: vietnt/elliptics path: /bindings/python/routes.py... | code_fim | medium | {
"lang": "python",
"repo": "vietnt/elliptics",
"path": "/bindings/python/routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for client in config['clients']:
pushover(
config['token'],
client,
message
)
self.logger.success('message sent')
exc... | code_fim | hard | {
"lang": "python",
"repo": "catapult-deployer/catapult3",
"path": "/catapult/deploy/notifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-deployer/catapult3 path: /catapult/deploy/notifier.py
import time
from catapult.deploy.constants import TRANSPORT_PUSHOVER, TRANSPORT_SLACK, TRANSPORT_TELEGRAM
from catapult.library.renders import render_string
from catapult.library.transports import pushover, telegram, slack
class Not... | code_fim | hard | {
"lang": "python",
"repo": "catapult-deployer/catapult3",
"path": "/catapult/deploy/notifier.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.logger.success('message sent')
except Exception as error:
self.logger.error(error)
def get_message(self, is_success, success, fail):
self.request['time'] = round(int(time.time()) - self.request['time_start'], 2)
template = ... | code_fim | hard | {
"lang": "python",
"repo": "catapult-deployer/catapult3",
"path": "/catapult/deploy/notifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # colors
playerColors = gameColors[:(playerCount + 2)]
colormap = colors.ListedColormap(playerColors)
pyplot.imshow(board, cmap=colormap) # vizualization of the board
pyplot.title("DommeAI: " + gameColors[(state["you"] + 1)] + "\n" + "Seconds: " + str(round(timeToD... | code_fim | hard | {
"lang": "python",
"repo": "AlexH156/DommeAI",
"path": "/Spe_edGUI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexH156/DommeAI path: /Spe_edGUI.py
from matplotlib import pyplot, colors
def createGUI(state, counter, action, choices, depth, de, isDeadend, isSafeZone, timeToDeadline, gameName):
"""
Saves a *.jpg of the board with additional meta-data per Round in the previously created folder game... | code_fim | hard | {
"lang": "python",
"repo": "AlexH156/DommeAI",
"path": "/Spe_edGUI.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Calcule de la surface total et de chaque facette"""
V=(vecteurs[n][1][0]-vecteurs[n][0][0],vecteurs[n][1][1]-vecteurs[n][0][1],vecteurs[n][1][2]-vecteurs[n][0][2])
W=(vecteurs[n][2][0]-vecteurs[n][0][0],vecteurs[n][2][1]-vecteurs[n][0][1],vecteurs[n][2][2]-vecteurs[n... | code_fim | hard | {
"lang": "python",
"repo": "clementCharrier/A2-python",
"path": "/fichier_Stl-master/Partie_Gauche.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clementCharrier/A2-python path: /fichier_Stl-master/Partie_Gauche.py
from PySide2.QtWidgets import QMainWindow, QLabel, QPushButton, QVBoxLayout, QTableWidget, QApplication,QWidget, QHBoxLayout, QTextEdit,QHeaderView,QDialog,QDialogButtonBox,QBoxLayout,QDial,QGridLayout,QLineEdit,QFileDialog
impo... | code_fim | hard | {
"lang": "python",
"repo": "clementCharrier/A2-python",
"path": "/fichier_Stl-master/Partie_Gauche.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sonul16/ParkingLotWebApp path: /lotBackend/parkinglot/urls.py
from django.conf.urls import url, include
from parkinglot import views
app_name = 'api'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^api/customers/$', views.customers, name='customers'),
url(r'^api/custome... | code_fim | medium | {
"lang": "python",
"repo": "sonul16/ParkingLotWebApp",
"path": "/lotBackend/parkinglot/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
url('^api/parkingStatus/.*$', views.parkingStatus, name='parkingStatus'),
url('^api/createParkingLot/$', views.createParkingLot, name='createParkingLot'),
]<|fim_prefix|># repo: sonul16/ParkingLotWebApp path: /lotBackend/parkinglot/urls.py
from django.conf.urls import url, include
from parkingl... | code_fim | medium | {
"lang": "python",
"repo": "sonul16/ParkingLotWebApp",
"path": "/lotBackend/parkinglot/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Helbis/PBL2019-Raspberry path: /Cracking/crackGui.py
try:
from tkinter import *
from crack import crack
except ImportError:
print("ImportError in " + __file__)
exit(1)
<|fim_suffix|>sTemp = ""
label = Label(root, text="Enter text: ")
label2 = Label(root)
entry = Entry(root)
but... | code_fim | medium | {
"lang": "python",
"repo": "Helbis/PBL2019-Raspberry",
"path": "/Cracking/crackGui.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>root = Tk()
sTemp = ""
label = Label(root, text="Enter text: ")
label2 = Label(root)
entry = Entry(root)
button = Button(root, text="Confirm", command=getString)
label.grid(row=0, column=0)
entry.grid(row=0, column=1)
button.grid(row=1, column=0)
label2.grid(row=1, column=1)
root.mainloop()<|fim_prefi... | code_fim | medium | {
"lang": "python",
"repo": "Helbis/PBL2019-Raspberry",
"path": "/Cracking/crackGui.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.xticks(rotation=0)
ax1.set_ylabel('% successful tests')
ax2.set_ylabel('% successful tests')
# plt.ylim((0,1))
ax2.set_xlabel('Image size')
ax1.set_title('Afternoon test [N=5]')
ax2.set_title('Morning test [N=5]')
plt.tight_layout()
plt.show()<|fim_prefix|># repo: skohlbr/teach-repeat path: /script... | code_fim | hard | {
"lang": "python",
"repo": "skohlbr/teach-repeat",
"path": "/scripts/image_res_results2.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skohlbr/teach-repeat path: /scripts/image_res_results2.py
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import collections
# 29th June 12624aba95a52a0ada489526439c33fc21fa6126
# K = 0.01, K2 = 0.05
# Note: corrections weren't properly scaled with the im... | code_fim | hard | {
"lang": "python",
"repo": "skohlbr/teach-repeat",
"path": "/scripts/image_res_results2.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> OffsetFetchRequest =>
group_name => String
topics => [TopicRequest]
"""
api = "offset_fetch"
parts = (
("group_name", String),
("topics", Array.of(TopicRequest)),
)
class PartitionResponse(Part):
"""
::
PartitionResponse =>
pa... | code_fim | hard | {
"lang": "python",
"repo": "denissmirnov/kiel",
"path": "/kiel/protocol/offset_fetch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: denissmirnov/kiel path: /kiel/protocol/offset_fetch.py
from .part import Part
from .request import Request
from .response import Response
from .primitives import Array, String, Int16, Int32, Int64
api_name = "offset_fetch"
__all__ = [
"OffsetFetchRequest",
"TopicRequest",
"OffsetFe... | code_fim | hard | {
"lang": "python",
"repo": "denissmirnov/kiel",
"path": "/kiel/protocol/offset_fetch.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> OffsetFetchResponse =>
topics => [TopicResponse]
"""
api = "offset_fetch"
parts = (
("topics", Array.of(TopicResponse)),
)<|fim_prefix|># repo: denissmirnov/kiel path: /kiel/protocol/offset_fetch.py
from .part import Part
from .request import Request
from .response ... | code_fim | hard | {
"lang": "python",
"repo": "denissmirnov/kiel",
"path": "/kiel/protocol/offset_fetch.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.subplot(422)
plt.plot(domain, error_cubic,'r', label='cubic')
plt.plot(domain, error_order5, color='orange', label='monomial 5')
plt.plot(domain, error_order10, color='blue', label='monomial 10')
plt.legend(loc='upper right')
plt.title('Ramp function errors Chebychev nodes')
plt.subplots_adjus... | code_fim | hard | {
"lang": "python",
"repo": "rjsparkes/Quantitative-Macroeconomics-HWs",
"path": "/HW2script v2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rjsparkes/Quantitative-Macroeconomics-HWs path: /HW2script v2.py
import sympy as sy
import numpy as np
import matplotlib.pyplot as plt
import numpy.polynomial.polynomial as poly
from numpy import inf
plt.style.use("ggplot")
### Ex.1 Taylor approximations
## Ex1.1
x = sy.Symbol('x')
d... | code_fim | hard | {
"lang": "python",
"repo": "rjsparkes/Quantitative-Macroeconomics-HWs",
"path": "/HW2script v2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RameshSrivatsan/Python-Assignments path: /Homework_1.py
# coding: utf-8
# In[ ]:
#1 Compilers vs Interpreters
Generally Compilers and Interpreters are used for converting the code written by humans into a code which can be understood
by the machines. But there is a small difference in the way... | code_fim | hard | {
"lang": "python",
"repo": "RameshSrivatsan/Python-Assignments",
"path": "/Homework_1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# In[ ]:
#9 modulo 2
for x in range(1,10):
a=(3*x)%2
print(a)
# In[ ]:
#9 modulo 3
for x in range(1,10):
b=(3*x)%3
print(b)
# In[ ]:
#10 printing our favorite word one million times
print("Winter\n"*10000000)
# In[ ]:
#11 Decoding UTF-8 to string
b'\xf0\x9f\x8d\xa9 + \xf0\x9f\x... | code_fim | hard | {
"lang": "python",
"repo": "RameshSrivatsan/Python-Assignments",
"path": "/Homework_1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaoQi/icode path: /mypylib/simple_ws/server.py
# -*- coding: utf-8 -*-
# 简易http 与 websocket 服务端
import logging
import socket
import base64
import hashlib
import struct
import os
import binascii
import json
from select import select
logging.basicConfig(level=logging.DEBUG)
de... | code_fim | hard | {
"lang": "python",
"repo": "LaoQi/icode",
"path": "/mypylib/simple_ws/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.session[sesskey]['buffer'] += data
# 可能关闭连接,销毁session
while sesskey in self.session and self.session[sesskey]['buffer']:
if self.session[sesskey]['length'] == 0:
b = self.session[sesskey]['buffer']
if len(b) < 14:
... | code_fim | hard | {
"lang": "python",
"repo": "LaoQi/icode",
"path": "/mypylib/simple_ws/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
if self.check_cell_change:
row = self.csv_data_table.currentRow()
col = self.csv_data_table.currentColumn()
value = self.csv_data_table.item(row, col).text()
self.setBottomToolbarInfo()
except:
p... | code_fim | hard | {
"lang": "python",
"repo": "ShauryaChauhan/fsf_2019_screening_task2",
"path": "/init_final.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShauryaChauhan/fsf_2019_screening_task2 path: /init_final.py
windowui_file = os.path.join(abs_file_name, "ui/mainwindow.ui")
uic.loadUi(mainwindowui_file, self)
self.tableTab = self.main_document_tab
self.start_page_tab = self.start_tab
self.plot_page_tab = self.pl... | code_fim | hard | {
"lang": "python",
"repo": "ShauryaChauhan/fsf_2019_screening_task2",
"path": "/init_final.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShauryaChauhan/fsf_2019_screening_task2 path: /init_final.py
ine
class CsvEditor(QMainWindow):
def __init__(self):
super(CsvEditor, self).__init__()
abs_file_name = os.path.dirname(__file__)
mainwindowui_file = os.path.join(abs_file_name, "ui/mainwindow.ui")
ui... | code_fim | hard | {
"lang": "python",
"repo": "ShauryaChauhan/fsf_2019_screening_task2",
"path": "/init_final.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# personGroupIds = ['good', 'neutral', 'bad']
# for id in personGroupIds:
# createPersonGroup(id, id + ' people')
# print ('Person groups created')
# url = 'https://i.pinimg.com/736x/04/be/aa/04beaa2b9ac077e8f7d69bf53732ac09--corporate-photoshoot-group-corporate-team-photos.jpg'
run(... | code_fim | hard | {
"lang": "python",
"repo": "sunny8751/FaceDetection",
"path": "/old/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # personGroupIds = ['good', 'neutral', 'bad']
# for id in personGroupIds:
# createPersonGroup(id, id + ' people')
# print ('Person groups created')
# url = 'https://i.pinimg.com/736x/04/be/aa/04beaa2b9ac077e8f7d69bf53732ac09--corporate-photoshoot-group-corporate-team-photos.jpg'
run()... | code_fim | hard | {
"lang": "python",
"repo": "sunny8751/FaceDetection",
"path": "/old/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunny8751/FaceDetection path: /old/main.py
from faceLib import *
from configuration import *
from database import *
# format is personId:Person class
directory = {}
def run():
# deleteAllPeople()
# printPeople()
# printDatabase()
processVideo('video.mp4', directory, personGrou... | code_fim | hard | {
"lang": "python",
"repo": "sunny8751/FaceDetection",
"path": "/old/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>param_dist = {"max_depth": randint(1, 11),
"learning_rate": uniform(),
"max_features": ["auto", "sqrt", "log2"],
"min_samples_split": randint(2, 50),
"min_samples_leaf": randint(1, 11),
"n_estimators": randint(50,150),
"cr... | code_fim | hard | {
"lang": "python",
"repo": "Jerodsun/ca-elections-project",
"path": "/code/ca_code_archive/initial_exp_r2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jerodsun/ca-elections-project path: /code/ca_code_archive/initial_exp_r2.py
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 1 23:24:54 2019
@author: User
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#df = pd.read_csv('precinct_2018.csv', encoding="ansi")
#2.4 GB ... | code_fim | hard | {
"lang": "python",
"repo": "Jerodsun/ca-elections-project",
"path": "/code/ca_code_archive/initial_exp_r2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ovangle/TNC-admin-server path: /server/user/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-21 00:41
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migra... | code_fim | hard | {
"lang": "python",
"repo": "ovangle/TNC-admin-server",
"path": "/server/user/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>turncount = 0
casualties = 0
for rocket in rockets:
rocket.launch()
while len(rockets) > 1 and turncount < 300:
turncount += 1
print('Turn %d has started' % turncount)
for rocket in rockets:
rocket.move_random()
#print('%s is now at (%d,%d)' % (rocket.name, rocket.x, rock... | code_fim | medium | {
"lang": "python",
"repo": "kypan/rockets",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kypan/rockets path: /main.py
__author__ = 'kevinpan'
import random
from rocket import Rocket
launchpoints = random.sample(range(-5, 5), 5)
flagship = Rocket('Flagship', launchpoints[4], 0, 1, 1)
enterprise = Rocket('Enterprise', launchpoints[0], 0, 1, 50)
dreadnought = Rocket('Dreadnought', la... | code_fim | hard | {
"lang": "python",
"repo": "kypan/rockets",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while len(rockets) > 1 and turncount < 300:
turncount += 1
print('Turn %d has started' % turncount)
for rocket in rockets:
rocket.move_random()
#print('%s is now at (%d,%d)' % (rocket.name, rocket.x, rocket.y))
for i in range(len(rockets)):
if rockets[i].y == 0 and ... | code_fim | medium | {
"lang": "python",
"repo": "kypan/rockets",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return u'%s' % self.security_symbol
def __str__(self):
return self.security_symbol<|fim_prefix|># repo: JoeLiberi/website path: /optiontools/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
import datetime
<|fim_middle|># Create your models here.
class... | code_fim | hard | {
"lang": "python",
"repo": "JoeLiberi/website",
"path": "/optiontools/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoeLiberi/website path: /optiontools/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
import datetime
# Create your models here.
class Position(models.Model):
security_name = models.CharField(max_length=200)
security_symbol = models.CharField(max_l... | code_fim | medium | {
"lang": "python",
"repo": "JoeLiberi/website",
"path": "/optiontools/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chloeeekim/TIL path: /Algorithm/Leetcode/Codes/SummaryRanges.py
"""
228. Summary Ranges : https://leetcode.com/problems/summary-ranges/
정렬된 unique한 정수 리스트가 커버하는 범위를 찾는 문제
- 범위 [a, b]는 "a->b"로 표시하며, a는 b가 아니다
- 범위 [a, b]에서 a가 b와 동일한 경우, "a"로 표시한다
- 주어진 리스트는 오름차순으로 정렬되어 있다
<|fim_suffix|>
class S... | code_fim | hard | {
"lang": "python",
"repo": "chloeeekim/TIL",
"path": "/Algorithm/Leetcode/Codes/SummaryRanges.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Solution:
def summaryRanges(self, nums: List[int]) -> List[str]:
res, i, n = [], 0, len(nums)
if n == 1:
return [str(nums[0])]
while i < n-1:
start, end = nums[i], sys.maxsize
while i < n-1 and nums[i]+1 == nums[i+1]:
en... | code_fim | medium | {
"lang": "python",
"repo": "chloeeekim/TIL",
"path": "/Algorithm/Leetcode/Codes/SummaryRanges.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def show_trackedPoints(self):
img = self.frame.imgL.copy()
for pt in self.tracked_pts:
pt = pt.reshape(2,)
coord = (int(pt[0]), int(pt[1]))
img = cv2.circle(img,coord,radius=3,color=(33,72,244),thickness=2)
cv2.imshow('left_frame', img); cv2... | code_fim | hard | {
"lang": "python",
"repo": "lken01/stereo_visual_odometry_python",
"path": "/simple_stereo_VO/tracker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lken01/stereo_visual_odometry_python path: /simple_stereo_VO/tracker.py
import cv2
import numpy as np
class Track:
def __init__(self,frame,prev_imgL, prev_imgR, points2track):
self.frame = frame
self.prev_imgL = prev_imgL
self.prev_imgR = prev_imgR
self.poi... | code_fim | hard | {
"lang": "python",
"repo": "lken01/stereo_visual_odometry_python",
"path": "/simple_stereo_VO/tracker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> points2track = np.float32(np.array(self.points2track).reshape(-1,1,2))
return cv2.calcOpticalFlowPyrLK(self.prev_imgL, self.frame.imgL,\
points2track, None, **self.lk_params)
def show_trackedPoints(self):
img = self.frame.imgL.copy()
... | code_fim | hard | {
"lang": "python",
"repo": "lken01/stereo_visual_odometry_python",
"path": "/simple_stereo_VO/tracker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thumphries/python path: /tree.py
#!/usr/bin/env python
# tree.py
# very basic tree with traversals
import sys
class Tree(object):
def __init__(self):
self.root = None
def insert(self, value):
node = Node(value)
if (self.root == None):
self.root = no... | code_fim | hard | {
"lang": "python",
"repo": "thumphries/python",
"path": "/tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def inorder_nonrec(self, fun):
stack = [self]
visited = {}
while (stack):
t = stack.pop()
if (t not in visited):
if (t.right):
stack.append(t.right)
visited[t] = 1
stack.append(t)
... | code_fim | hard | {
"lang": "python",
"repo": "thumphries/python",
"path": "/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (self.left):
self.left.postorder(fun)
if (self.right):
self.right.postorder(fun)
fun(self.value)
def inorder_nonrec(self, fun):
stack = [self]
visited = {}
while (stack):
t = stack.pop()
if (t not in v... | code_fim | hard | {
"lang": "python",
"repo": "thumphries/python",
"path": "/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LRKG/EPP_Project_Laurenz_Guenther path: /src/analysis/wscript
#! python
def build(ctx):
# Illustrate use of run_py_script with automatic model specification.
<|fim_suffix|>x, 'OUT_DATA', 'all_articles.xlsx'),
ctx.path_to(ctx, 'OUT_DATA', 'training.xlsx')
]... | code_fim | medium | {
"lang": "python",
"repo": "LRKG/EPP_Project_Laurenz_Guenther",
"path": "/src/analysis/wscript",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ],
target= ctx.path_to(ctx, 'OUT_FIGURES', 'line_chart.pdf')
)<|fim_prefix|># repo: LRKG/EPP_Project_Laurenz_Guenther path: /src/analysis/wscript
#! python
def build(ctx):
# Illustrate use of run_py_script with automatic model specification.
ctx(
... | code_fim | medium | {
"lang": "python",
"repo": "LRKG/EPP_Project_Laurenz_Guenther",
"path": "/src/analysis/wscript",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def estimate_age(img):
# tensor = transforms.CenterCrop(224)(img)
# tensor = transforms.CenterCrop(224)(img)
h = img.size(2)
offset = (h - 224) // 2
tensor = img[:, :, offset:-offset, offset:-offset]
# print(tensor.shape)
with torch.no_grad():
output = age_model(tensor)... | code_fim | hard | {
"lang": "python",
"repo": "pobbyleesh/TransStyleGAN",
"path": "/utils/dex/api.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pobbyleesh/TransStyleGAN path: /utils/dex/api.py
import os
import torch
import torchvision.transforms as transforms
from .models import Age, Gender
device = 'cuda'
age_model = Age()
gender_model = Gender()
cwd = os.path.dirname(__file__)
age_model_path = os.path.join(cwd, 'pth/age_sd.pth')
g... | code_fim | hard | {
"lang": "python",
"repo": "pobbyleesh/TransStyleGAN",
"path": "/utils/dex/api.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> i_t = torch.sigmoid(x_t @ self.U_i + h_t @ self.V_i + self.b_i)
f_t = torch.sigmoid(x_t @ self.U_f + h_t @ self.V_f + self.b_f)
g_t = torch.tanh(x_t @ self.U_c + h_t @ self.V_c + self.b_c)
o_t = torch.sigmoid(x_t @ self.U_o + h_t @ self.V_o + self.b_o)
c_t = f_t * c_t + i_t * g_t
h_t = o... | code_fim | hard | {
"lang": "python",
"repo": "paulmorio/simpleRNN",
"path": "/pytorch_lstm_class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlbertDaYoungYT/PyPrompt path: /PyPromptV1.1/libs/installer.py
from zipfile import ZipFile
import shutil
import time
import glob
import wget
import os
global version
version = "1.1"
dir_path = os.path.dirname(os.path.realpath("__file__"))
<|fim_suffix|> os.system('cmd /c "pip inst... | code_fim | hard | {
"lang": "python",
"repo": "AlbertDaYoungYT/PyPrompt",
"path": "/PyPromptV1.1/libs/installer.py",
"mode": "psm",
"license": "LicenseRef-scancode-philippe-de-muyter",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.system('cmd /c "pip install gTTS"')
time.sleep(1)
os.system('cmd /c "pip install wget"')
time.sleep(1)
os.system('cmd /c "pip install opencv-python"')
print('done')<|fim_prefix|># repo: AlbertDaYoungYT/PyPrompt path: /PyPromptV1.1/libs/installer.py
from zipfile import ZipF... | code_fim | hard | {
"lang": "python",
"repo": "AlbertDaYoungYT/PyPrompt",
"path": "/PyPromptV1.1/libs/installer.py",
"mode": "spm",
"license": "LicenseRef-scancode-philippe-de-muyter",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DongShanHu/pythonpratice path: /crawer/Crawer1.py
import re
import urllib
<|fim_suffix|>fileout = file("01_blog.html","w")
fileout.write(html)
fileout.close()<|fim_middle|>request = urllib.Request("http://blog.marsw.tw")
response = urllib.urlopen(request)
html = response.read()
print(html)
| code_fim | medium | {
"lang": "python",
"repo": "DongShanHu/pythonpratice",
"path": "/crawer/Crawer1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fileout = file("01_blog.html","w")
fileout.write(html)
fileout.close()<|fim_prefix|># repo: DongShanHu/pythonpratice path: /crawer/Crawer1.py
import re
import urllib
<|fim_middle|>request = urllib.Request("http://blog.marsw.tw")
response = urllib.urlopen(request)
html = response.read()
print(html)
| code_fim | medium | {
"lang": "python",
"repo": "DongShanHu/pythonpratice",
"path": "/crawer/Crawer1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: siriusJinwooChoi/PythonExamples path: /컴넷(재용과제)/blackjack (1).py
# -*- coding: utf-8 -*-
from card import BJCard, Deck
class BJCards(list):
"""Blackjack Cards Class
Attributes:
possible_sums: all the possible sum of card
hand: -1 if bust
highest sum of pos... | code_fim | hard | {
"lang": "python",
"repo": "siriusJinwooChoi/PythonExamples",
"path": "/컴넷(재용과제)/blackjack (1).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.players = []
self.dealer = None
def join(self, player):
self.players.append(player)
def leave(self, player):
self.players.remove(player)
def dealer_join(self, dealer):
self.dealer = dealer
def dealer_leave(self, dealer):
self.dealer = No... | code_fim | hard | {
"lang": "python",
"repo": "siriusJinwooChoi/PythonExamples",
"path": "/컴넷(재용과제)/blackjack (1).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03013/s646522197.py
N, M = map(int,input().split())
oks = [True]*(N+1)
mod = 1e9+7
for i in <|fim_suffix|>f oks[1]:
dp[1]=1
else:
dp[1]=0
for i in range(2,N+1):
if oks[i]:
dp[i]=dp[i-1]+dp[i-2]
dp[i]%=mod
print(int(dp[N]))<|fi... | code_fim | medium | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03013/s646522197.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>f oks[1]:
dp[1]=1
else:
dp[1]=0
for i in range(2,N+1):
if oks[i]:
dp[i]=dp[i-1]+dp[i-2]
dp[i]%=mod
print(int(dp[N]))<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03013/s646522197.py
N, M = map(int,input().split())
oks = [True]*(N+1)
mod = 1e9+7
for i in <|fi... | code_fim | medium | {
"lang": "python",
"repo": "Aasthaengg/IBMdataset",
"path": "/Python_codes/p03013/s646522197.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TUIServerInfo(TUIServerList):
def __init__(self, args):
super(TUIServerInfo, self).__init__(args)
self.host = args.hostalias
def build_server_info(self):
result = []
_sys = self.collector[self.host]
result.append([['\n* System:']])
header =... | code_fim | hard | {
"lang": "python",
"repo": "pingcap/tidb-insight",
"path": "/explorer/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> role_list = list(roles)
role_list.sort()
row.append(','.join(role_list))
output.append(row)
output.sort()
output = [column_headers] + output
return output
def display(self):
for row in self.format_columns(self.build_ser... | code_fim | hard | {
"lang": "python",
"repo": "pingcap/tidb-insight",
"path": "/explorer/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pingcap/tidb-insight path: /explorer/server.py
# -*- coding: utf-8 -*-
# List servers in cluster
import logging
from datetime import datetime
from explorer import tui
from utils import util
class TUIServerList(tui.TUIBase):
def __init__(self, args):
# init file list and inventor... | code_fim | hard | {
"lang": "python",
"repo": "pingcap/tidb-insight",
"path": "/explorer/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> del self.pacientes[folio]
return "Paciente eliminado"<|fim_prefix|># repo: nahumsin/finalProyect path: /app/AltasBajas.py
from Paciente import Paciente
class AltasBajas:
pacientes = {}
folio = 100
<|fim_middle|> def alta(self, nombre, apellido, edad, email, direccion):
... | code_fim | hard | {
"lang": "python",
"repo": "nahumsin/finalProyect",
"path": "/app/AltasBajas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nahumsin/finalProyect path: /app/AltasBajas.py
from Paciente import Paciente
class AltasBajas:
pacientes = {}
folio = 100
<|fim_suffix|> del self.pacientes[folio]
return "Paciente eliminado"<|fim_middle|> def alta(self, nombre, apellido, edad, email, direccion):
... | code_fim | hard | {
"lang": "python",
"repo": "nahumsin/finalProyect",
"path": "/app/AltasBajas.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.