text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
dependencies = [
('genre', '0001_initial'),
('author', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='author',
name='genre',
),
migrations.AddField(
model_name='author',
name='genre... | code_fim | medium | {
"lang": "python",
"repo": "jluizmonte/django-livraria",
"path": "/apps/author/migrations/0002_auto_20191215_2358.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: feliposz/project-euler-solutions path: /python/euler145.py
"""Problem 145
16 March 2007
Some positive integers n have the property that the sum [ n +
reverse(n) ] consists entirely of odd (decimal) digits. For instance,
36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers
reversible; so ... | code_fim | medium | {
"lang": "python",
"repo": "feliposz/project-euler-solutions",
"path": "/python/euler145.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>This one finished in more than 1 hour. =/
"""
from eulerlib import reverseNum
# Added to eulerlib!
def isReversible(n):
"""Returns true if a number is reversible.
A number is reversible if the sum of n + reverseNum(n) produces a
number with only odd digits.
"""
if n % 10 == 0:
... | code_fim | medium | {
"lang": "python",
"repo": "feliposz/project-euler-solutions",
"path": "/python/euler145.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Added to eulerlib!
def isReversible(n):
"""Returns true if a number is reversible.
A number is reversible if the sum of n + reverseNum(n) produces a
number with only odd digits.
"""
if n % 10 == 0:
return False
s = n + reverseNum(n)
while s > 0:
digit = ... | code_fim | medium | {
"lang": "python",
"repo": "feliposz/project-euler-solutions",
"path": "/python/euler145.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toanphan19/tiny-sat path: /tinysat-python/base/dimacs_parser.py
from base.instance import Instance
"""
Parse Input/Output in DIMACS format.
"""
def __encode_literal(x):
return (x-1) * 2 if x > 0 else (-x - 1) * 2 + 1
def __parse_clause(line):
"""
Converting a clause to an array o... | code_fim | hard | {
"lang": "python",
"repo": "toanphan19/tiny-sat",
"path": "/tinysat-python/base/dimacs_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def decode_assignment(assignment):
result = [i + 1 if assignment[i] else -(i + 1) for i in range(len(assignment))]
return " ".join([str(x) for x in result])<|fim_prefix|># repo: toanphan19/tiny-sat path: /tinysat-python/base/dimacs_parser.py
from base.instance import Instance
"""
Parse Input/Ou... | code_fim | hard | {
"lang": "python",
"repo": "toanphan19/tiny-sat",
"path": "/tinysat-python/base/dimacs_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> var_count, clause_count = lines[0].split()[2:4]
var_count, clause_count = int(var_count), int(clause_count)
variables = list(range(var_count))
clauses = []
for i in range(1, clause_count + 1):
clauses.append(__parse_clause(lines[i]))
return Instance(variables, clauses)
... | code_fim | hard | {
"lang": "python",
"repo": "toanphan19/tiny-sat",
"path": "/tinysat-python/base/dimacs_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(reverse(123))<|fim_prefix|># repo: krysnuvadga/learning_portfolio path: /preps/reversenum.py
def reverse(number):
<|fim_middle|> rev = 0
while number > 0:
reminder = number % 10
rev = (rev*10) + reminder
number = number//10
return rev
| code_fim | medium | {
"lang": "python",
"repo": "krysnuvadga/learning_portfolio",
"path": "/preps/reversenum.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krysnuvadga/learning_portfolio path: /preps/reversenum.py
def reverse(number):
<|fim_suffix|>print(reverse(123))<|fim_middle|> rev = 0
while number > 0:
reminder = number % 10
rev = (rev*10) + reminder
number = number//10
return rev
| code_fim | medium | {
"lang": "python",
"repo": "krysnuvadga/learning_portfolio",
"path": "/preps/reversenum.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> product = 1
for i in num_list:
product *= i
return product
def binomial_coeficient(n, k):
"""
n over k
:return:
"""
return int(factorial(n)/(factorial(k)*factorial(n-k)))<|fim_prefix|># repo: MatiasPineda/projecteuler path: /resources/utils.py
from typing import ... | code_fim | medium | {
"lang": "python",
"repo": "MatiasPineda/projecteuler",
"path": "/resources/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MatiasPineda/projecteuler path: /resources/utils.py
from typing import Union
from math import factorial
def prime_factors(number: int) -> dict:
"""
Takes an integer and returns every prime factor and their quantity
:param number: Integer
:return: dict of prime numbers as keys and... | code_fim | hard | {
"lang": "python",
"repo": "MatiasPineda/projecteuler",
"path": "/resources/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>GAIN = 1
clamp = lambda n, min_n, max_n: max(min(max_n, n), min_n)
import Slush
import spidev
increment = 5
motor_1 = stepper(port = 0, speed = 20, micro_steps = 128)
print("g")
motor_1.home(0)
home_pos_1 = 11.34
current_pos_x = home_pos_1
while True:
joy_val_x = (adc.read_adc(1, gain=GAIN)-9408)/1200... | code_fim | hard | {
"lang": "python",
"repo": "02ks/Light-Mixing-branch",
"path": "/gaff/g.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 02ks/Light-Mixing-branch path: /gaff/g.py
import board
import busio
import time
import sys
import RPi.GPIO as GPIO
sys.path.insert(0, "/home/pi/packages")
from RaspberryPiCommon.pidev import stepper, RPiMIB
sys.path.insert(0, "/home/pi/packages/Adafruit_16_Channel_PWM_Module_Easy_Library")
from A... | code_fim | medium | {
"lang": "python",
"repo": "02ks/Light-Mixing-branch",
"path": "/gaff/g.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhengnengjin/python_Learning path: /Day26/cmd_server.py
# __author: ZhengNengjin
# __date: 2018/10/14
import socket, subprocess
# family type
sk = socket.socket()
print(sk)
address = ('127.0.0.1', 8888) # IP地址和端口
sk.bind(address) # sk 的bind方法 后面跟元组,绑定ip地址和端口
sk.listen(3)
print("服务端启动...")
wh... | code_fim | hard | {
"lang": "python",
"repo": "zhengnengjin/python_Learning",
"path": "/Day26/cmd_server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result_len = bytes(str(len(cmd_result)),'utf8')
conn.sendall(result_len)
# inp = input(">>>") # ** 输入数据
conn.recv(1021) #解决粘包问题,隔断开两个send
conn.sendall(cmd_result) # **发送数据
sk.close()<|fim_prefix|># repo: zhengnengjin/python_Learning path: /Day26/cmd_server.py
# __author: ZhengNengjin
# _... | code_fim | hard | {
"lang": "python",
"repo": "zhengnengjin/python_Learning",
"path": "/Day26/cmd_server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> obj = subprocess.Popen(str(data,'utf8'), shell=True, stdout=subprocess.PIPE)
cmd_result = obj.stdout.read()
result_len = bytes(str(len(cmd_result)),'utf8')
conn.sendall(result_len)
# inp = input(">>>") # ** 输入数据
conn.recv(1021) #解决粘包问题,隔断开两个send
conn.sendall(cmd_result) # **发送数据
sk... | code_fim | hard | {
"lang": "python",
"repo": "zhengnengjin/python_Learning",
"path": "/Day26/cmd_server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greydongilmore/autofids-brainhack2020 path: /workflow/Snakefile
from os.path import join,basename
import pandas as pd
from snakemake.utils import validate
from glob import glob
from sklearn.model_selection import train_test_split
configfile: 'config/config.yml'
nifti_files=glob(os.path.join(co... | code_fim | hard | {
"lang": "python",
"repo": "greydongilmore/autofids-brainhack2020",
"path": "/workflow/Snakefile",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rule import_subj_train:
input:
train=expand('{train_fn}', train_fn=x_train),
output:
train_out=join(config['output_dir'], 'train_data', basename('{train_fn}')),
group: 'preproc'
shell: 'cp {input.train} {output.train_out}'
#rule modelTrain:
# input:
# touch=jo... | code_fim | hard | {
"lang": "python",
"repo": "greydongilmore/autofids-brainhack2020",
"path": "/workflow/Snakefile",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ckhui/todo-django path: /task/decorators.py
from rest_framework.response import Response
from rest_framework.views import status
def validate_create_data(fn):
def decorated(*args, **kwargs):
<|fim_suffix|> def decorated(*args, **kwargs):
title = args[0].request.data.get("title", "... | code_fim | hard | {
"lang": "python",
"repo": "ckhui/todo-django",
"path": "/task/decorators.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> title = args[0].request.data.get("title", "")
completed = args[0].request.data.get("completed", None)
if not title and completed is None:
return Response(
data={
"message": "'title' or 'completed' are required to add a task"
... | code_fim | hard | {
"lang": "python",
"repo": "ckhui/todo-django",
"path": "/task/decorators.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def decorated(*args, **kwargs):
title = args[0].request.data.get("title", "")
completed = args[0].request.data.get("completed", None)
if not title and completed is None:
return Response(
data={
"message": "'title' or 'completed' a... | code_fim | hard | {
"lang": "python",
"repo": "ckhui/todo-django",
"path": "/task/decorators.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ssong86/ColorMe_CMPE281_Project2 path: /s3objects/migrations/0005_s3objects_file.py
# Generated by Django 2.2.6 on 2019-10-09 18:02
<|fim_suffix|> dependencies = [
('s3objects', '0004_auto_20191009_1058'),
]
operations = [
migrations.AddField(
model_name='... | code_fim | medium | {
"lang": "python",
"repo": "ssong86/ColorMe_CMPE281_Project2",
"path": "/s3objects/migrations/0005_s3objects_file.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('s3objects', '0004_auto_20191009_1058'),
]
operations = [
migrations.AddField(
model_name='s3objects',
name='file',
field=models.FileField(default=None, upload_to=''),
pr... | code_fim | easy | {
"lang": "python",
"repo": "ssong86/ColorMe_CMPE281_Project2",
"path": "/s3objects/migrations/0005_s3objects_file.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='s3objects',
name='file',
field=models.FileField(default=None, upload_to=''),
preserve_default=False,
),
]<|fim_prefix|># repo: ssong86/ColorMe_CMPE281_Project2 path: /s3objects/migratio... | code_fim | medium | {
"lang": "python",
"repo": "ssong86/ColorMe_CMPE281_Project2",
"path": "/s3objects/migrations/0005_s3objects_file.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wbarbosa0/AluraPython3_1 path: /advinhacao.py
import random
def jogar():
print("*************************************")
print("* Bem vindo ao jogo de Adivinhação! *")
print("*************************************")
#numero_secreto = 42
#numero_secreto = int(random.random()*1... | code_fim | medium | {
"lang": "python",
"repo": "wbarbosa0/AluraPython3_1",
"path": "/advinhacao.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> nivel = int(input("Defina o nível: "))
if (nivel == 1):
total_de_tentativas = 20
elif (nivel == 2):
total_de_tentativas = 10
else:
total_de_tentativas = 5
#while (rodada_atual <= total_de_tentativas):
for rodada_atual in range(1, total_de_tentativas+1):
... | code_fim | hard | {
"lang": "python",
"repo": "wbarbosa0/AluraPython3_1",
"path": "/advinhacao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> DATASET_CLASS = i_naturalist2021.INaturalist2021
SPLITS = {
"mini": 2, # Number of fake mini examples
"test": 3, # Number of fake test examples
"train": 3, # Number of fake train examples
"val": 2, # Number of fake val examples
}
OVERLAPPING_SPLITS = ["mini", "train"]
... | code_fim | medium | {
"lang": "python",
"repo": "tensorflow/datasets",
"path": "/tensorflow_datasets/image_classification/i_naturalist2021/i_naturalist2021_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netman92/mobilem_cz path: /tests/__init__.py
import os.path
import sys
import unittest
<|fim_suffix|> start_dir = os.path.dirname(__file__)
return unittest.TestLoader().discover(".", pattern="test*.py")<|fim_middle|>os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
test_dir = os.pa... | code_fim | medium | {
"lang": "python",
"repo": "netman92/mobilem_cz",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_tests():
start_dir = os.path.dirname(__file__)
return unittest.TestLoader().discover(".", pattern="test*.py")<|fim_prefix|># repo: netman92/mobilem_cz path: /tests/__init__.py
import os.path
import sys
import unittest
<|fim_middle|>os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'... | code_fim | medium | {
"lang": "python",
"repo": "netman92/mobilem_cz",
"path": "/tests/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netman92/mobilem_cz path: /tests/__init__.py
import os.path
import sys
import unittest
<|fim_suffix|> start_dir = os.path.dirname(__file__)
return unittest.TestLoader().discover(".", pattern="test*.py")<|fim_middle|>
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
test_dir = os.pa... | code_fim | medium | {
"lang": "python",
"repo": "netman92/mobilem_cz",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robert871126/bk-iam-saas path: /saas/backend/api/initialization/views.py
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licens... | code_fim | medium | {
"lang": "python",
"repo": "robert871126/bk-iam-saas",
"path": "/saas/backend/api/initialization/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """首次部署初始化"""
# 1. 组织架构同步 - 单用户 admin
Syncer().sync_single_user("admin")
# 2. 将admin添加到超级管理员成员里,在部署migration里已经默认创建了分级管理员
self.biz.add_super_manager_member("admin", True)
# 3. 尽可能的初始化已存在系统的管理员
sync_system_manager()
# 4. 异步任务 - 全量同步组织架构
... | code_fim | hard | {
"lang": "python",
"repo": "robert871126/bk-iam-saas",
"path": "/saas/backend/api/initialization/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikealfare/advent-of-code-2020 path: /tests/test_day_02.py
import pytest
from tests.conftest import day_02
@pytest.mark.parametrize('rule,password,expected', [
('1-3 a', 'abcde', True),
('1-3 b', 'cdefg', False),
('2-9 c', 'ccccccccc', True),
])
def test_is_valid_by_count(rule: str,... | code_fim | medium | {
"lang": "python",
"repo": "mikealfare/advent-of-code-2020",
"path": "/tests/test_day_02.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.parametrize('rule,password,expected', [
('1-3 a', 'abcde', True),
('1-3 b', 'cdefg', False),
('2-9 c', 'ccccccccc', False),
('16-17 k', 'nphkpzqswcltkkbkk', False),
('8-11 l', 'qllllqllklhlvtl', True),
])
def test_is_valid_by_existence(rule: str, password: str, expected: ... | code_fim | medium | {
"lang": "python",
"repo": "mikealfare/advent-of-code-2020",
"path": "/tests/test_day_02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ekomissarov/edu path: /py-basics/uneex_homework/14_look_and_say_Conway.py
'''
Написать генератор цифр последовательности Конвея «Look and Say».
https://oeis.org/A005150
(Сама последовательность Конвея https://oeis.org/A034002).
Ввести N⩾0 и вывести N-ю цифру последовательности.
Input:
100500
Ou... | code_fim | hard | {
"lang": "python",
"repo": "ekomissarov/edu",
"path": "/py-basics/uneex_homework/14_look_and_say_Conway.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def generat_conoway2(seed):
yield seed
previous = str(seed)
seq = str(seed)
while True:
next = ''
idx = 0 # счетчик количества одинаковых цифр
l = len(previous) # длина строки p
while idx < l: # проход по строке p
start = idx
idx ... | code_fim | medium | {
"lang": "python",
"repo": "ekomissarov/edu",
"path": "/py-basics/uneex_homework/14_look_and_say_Conway.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#N = int(input("Введите N: "))
for N in range(100490, 100510):
# проход диапазона шагов: это вообще не оптимально т.к. на каждой итерации происходит
# новый пробег по всему генератору, но наглядно ))
step = 0
for i in generat_conoway1(9):
N -= 1
if N < 0:
print("шаг {}... | code_fim | hard | {
"lang": "python",
"repo": "ekomissarov/edu",
"path": "/py-basics/uneex_homework/14_look_and_say_Conway.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with tf.Session() as sess:
result = sess.run([product])
print result<|fim_prefix|># repo: awp4211/TensorFlowLearning path: /Udacity/test.py
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 21:16:37 2016
<|fim_middle|>@author: zc
"""
import tensorflow as tf
matrix1 = tf.constant([[3.,3.]])
ma... | code_fim | medium | {
"lang": "python",
"repo": "awp4211/TensorFlowLearning",
"path": "/Udacity/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>product = tf.matmul(matrix1,matrix2)
with tf.Session() as sess:
result = sess.run([product])
print result<|fim_prefix|># repo: awp4211/TensorFlowLearning path: /Udacity/test.py
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 21:16:37 2016
@author: zc
"""
import tensorflow as tf
matrix1 = tf... | code_fim | easy | {
"lang": "python",
"repo": "awp4211/TensorFlowLearning",
"path": "/Udacity/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awp4211/TensorFlowLearning path: /Udacity/test.py
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 21:16:37 2016
@author: zc
"""
<|fim_suffix|>matrix1 = tf.constant([[3.,3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1,matrix2)
with tf.Session() as sess:
result = ses... | code_fim | easy | {
"lang": "python",
"repo": "awp4211/TensorFlowLearning",
"path": "/Udacity/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class _test(unittest.TestCase):
def test_00(self):
self.assertTrue(checkio(["acb", "bd", "zwa"]) == "zwacbd")
def test_01(self):
self.assertTrue(checkio(["klm", "kadl", "lsm"]) == "kadlsm")
def test_02(self):
self.assertTrue(checkio(["a", "b", "c"]) == "abc")
de... | code_fim | hard | {
"lang": "python",
"repo": "nikitamarchenko/checkio",
"path": "/determine-the-order.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikitamarchenko/checkio path: /determine-the-order.py
__author__ = 'nmarchenko'
"""
http://www.checkio.org/mission/task/info/determine-the-order/python-27/
The Robots have found an encrypted message. We cannot decrypt it right now, but we can take the first steps.
Given a set of "words," (for ... | code_fim | hard | {
"lang": "python",
"repo": "nikitamarchenko/checkio",
"path": "/determine-the-order.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hasattr(self, 'y_infer'):
return self.y_infer
else:
return None
def get_loss(self):
if hasattr(self, 'loss'):
return self.loss
else:
return None
def inference(self, X, y):
with tf.variable_scope('conv1'):
... | code_fim | hard | {
"lang": "python",
"repo": "luchen828/3D_hand_pose_estimation_from_single_depth_image",
"path": "/src/model/deprecated/d_poseregmodel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luchen828/3D_hand_pose_estimation_from_single_depth_image path: /src/model/deprecated/d_poseregmodel.py
from model.model import Model
import tensorflow as tf
class PoseRegModel(Model):
def __init__(self, n_dim=30, cacheFile=None):
super(PoseRegModel, self).__init__(cacheFile)
... | code_fim | hard | {
"lang": "python",
"repo": "luchen828/3D_hand_pose_estimation_from_single_depth_image",
"path": "/src/model/deprecated/d_poseregmodel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hasattr(self, 'loss'):
return self.loss
else:
return None
def inference(self, X, y):
with tf.variable_scope('conv1'):
conv = self.lh.conv(X, filter_num=8, ksize=(5,5), stride=1, reg=True)
pool = self.lh.max_pool(conv, ksize=(4... | code_fim | hard | {
"lang": "python",
"repo": "luchen828/3D_hand_pose_estimation_from_single_depth_image",
"path": "/src/model/deprecated/d_poseregmodel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># 方法二:用 option 定位(循环)
lists = driver.find_element_by_tag_name("option")
# for list in lists:
# if list.get_attribute("value") == '9.03':
# list.click()
# 或
# lists[3].click()
time.sleep(5)
driver.quit()<|fim_prefix|># repo: latter-yu/200809 path: /drop_down.py
# coding=utf-8
from selenium im... | code_fim | medium | {
"lang": "python",
"repo": "latter-yu/200809",
"path": "/drop_down.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: latter-yu/200809 path: /drop_down.py
# coding=utf-8
from selenium import webdriver
import os
import time
driver = webdriver.Firefox()
file_path='File:///' + os.path.abspath("E://javatest//200808//selenium_html//drop_down.html")
driver.get(file_path)
driver.maximize_window()
<|fim_suffix|># 方法二:用... | code_fim | medium | {
"lang": "python",
"repo": "latter-yu/200809",
"path": "/drop_down.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ite1_fs128_000_spectra_with_Hz",
docPath,
)
# copy config
shutil.copy2("tutorialconfig.ini", docPath)
shutil.copy2("multiconfig.ini", docPath)
shutil.copy2("multiconfigSeparate.ini", docPath)
shutil.copy2("usingWindowSelector.txt", docPath)
# copy the project file
shutil.copy2(projectPath / "mtProj.pr... | code_fim | hard | {
"lang": "python",
"repo": "Nishikinor/resistics",
"path": "/examples/tutorial/docprepare.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nishikinor/resistics path: /examples/tutorial/docprepare.py
from datapaths import projectPath, imagePath, docPath
import shutil
# tutorial images
for image in imagePath.glob("*.png"):
shutil.copy2(image, docPath)
# spectra comments
shutil.copy2(
projectPath
/ "specData"
/ "site1"... | code_fim | hard | {
"lang": "python",
"repo": "Nishikinor/resistics",
"path": "/examples/tutorial/docprepare.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hamsik2rang/Python_Study path: /Day5/Sources/Day5_2(OOP_Coffee_Machine).py
from Menu import Menu, MenuItem
from Coffee_Maker import CoffeeMaker
from Money_Machine import MoneyMachine
class CoffeeMachine:
"""1. print report
2. check resources sufficient
3. process coins
4. check ... | code_fim | hard | {
"lang": "python",
"repo": "Hamsik2rang/Python_Study",
"path": "/Day5/Sources/Day5_2(OOP_Coffee_Machine).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
while self.is_on:
options = self.menu.get_items()
choice = input(f"What would you like? ({options}): ")
choice = choice.lower()
if choice == "off":
self.is_on = False
elif choice == "report":
self.coffee_m... | code_fim | hard | {
"lang": "python",
"repo": "Hamsik2rang/Python_Study",
"path": "/Day5/Sources/Day5_2(OOP_Coffee_Machine).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # update asset and state for all individuals accordingly
for i in range(0, len(negDeltaIndividuals), 1):
dbObject.reduceFreeAsset(negDeltaIndividuals[i], gv.unitQty)
dbObject.addNewState(negDeltaIndividuals[i], endDate, endTime, 0)
for i in range(0, len(posD... | code_fim | hard | {
"lang": "python",
"repo": "ciddhijain/QLearning",
"path": "/feedback_basic_mtm_parallel/Reallocation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ciddhijain/QLearning path: /feedback_basic_mtm_parallel/Reallocation.py
__author__ = 'Ciddhi'
from DBUtils import *
import GlobalVariables as gv
class Reallocation:
def reallocate(self, startDate, startTime, endDate, endTime, dbObject):
# get all individuals which are active in la... | code_fim | hard | {
"lang": "python",
"repo": "ciddhijain/QLearning",
"path": "/feedback_basic_mtm_parallel/Reallocation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EAkoma/individual-project-cs6440 path: /wsgi.py
from flask import Flask, render_template, request
import json
import datetime
from pyfunc import loginFunc, insertFunc, displayFunc, dashboardFunc
import configparser
import os
app = Flask(__name__)
@app.route("/")
def index():
return render_... | code_fim | hard | {
"lang": "python",
"repo": "EAkoma/individual-project-cs6440",
"path": "/wsgi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = request.get_json()
raw_data = displayFunc.getExercise_all(data)
return json.dumps(raw_data)
@app.route("/getDashboardSleepHours", methods=["GET", "POST"])
def getDashboardSleepHours():
data = request.get_json()
raw_data = dashboardFunc.getDashboard_sleep_hours(data)
return ... | code_fim | hard | {
"lang": "python",
"repo": "EAkoma/individual-project-cs6440",
"path": "/wsgi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/getDashboardSleepHours", methods=["GET", "POST"])
def getDashboardSleepHours():
data = request.get_json()
raw_data = dashboardFunc.getDashboard_sleep_hours(data)
return json.dumps(raw_data)
@app.route("/getDashboardExerciseHours", methods=["GET", "POST"])
def getDashboardExercise... | code_fim | hard | {
"lang": "python",
"repo": "EAkoma/individual-project-cs6440",
"path": "/wsgi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: broekm006/SmartGrid path: /Code/algoritmes/hill_climber_update.py
import random, csv, copy
from solution import Solution
class Hill_climber(object):
def __init__(self, houses, batteries, number_of_times, number_of_runs):
self.houses = copy.deepcopy(houses)
self.batteries = c... | code_fim | hard | {
"lang": "python",
"repo": "broekm006/SmartGrid",
"path": "/Code/algoritmes/hill_climber_update.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calc new distance
new_distance = solution.distance_calc(random_house_in_battery, random_battery2)
new_distance2 = solution.distance_calc(random_house_in_battery2, random_battery)
if old_distance + old_distance2 > new_distance + new_distanc... | code_fim | hard | {
"lang": "python",
"repo": "broekm006/SmartGrid",
"path": "/Code/algoritmes/hill_climber_update.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
#print("Swap does not reduce cable costs!")
pass
swap_counter += 1
print("Run: ", loopcounter, ", Iteration: ", swap_counter)
if swap_counter == self.number_of_times:
print(... | code_fim | hard | {
"lang": "python",
"repo": "broekm006/SmartGrid",
"path": "/Code/algoritmes/hill_climber_update.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wobutianl/Shoaly_DM path: /icon/helpIcon.py
# -×- coding:utf-8 -*-
from wx.lib.embeddedimage import PyEmbeddedImage
Apply = PyEmbeddedImage(
"Qk02DAAAAAAAADYAAAAoAAAAIAAAACAAAAABABgAAAAAAAAMAADEDgAAxA4AAAAAAAAAAAAA////"
"////////////////////////////////+/v77+/v0tPStLe0srKywsLC39/f9vb2/v7+///////... | code_fim | hard | {
"lang": "python",
"repo": "wobutianl/Shoaly_DM",
"path": "/icon/helpIcon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>//+Pr4H2YjPpBEN4o9DFkQprqn19/X+vr6")
Help = PyEmbeddedImage(
"Qk02DAAAAAAAADYAAAAoAAAAIAAAACAAAAABABgAAAAAAAAMAADEDgAAxA4AAAAAAAAAAAAA////"
"////////////////////////////////////9/f339/fwcHBoqKih4eHdXV1dHR0goKCmJiYtbW1"
"1tbW8vLy////////////////////////////////////////////////////////////////////"
"////8O... | code_fim | hard | {
"lang": "python",
"repo": "wobutianl/Shoaly_DM",
"path": "/icon/helpIcon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = LinearRegression()
model.fit(train_X[variables], train_y)
return model
def score_model2(model, variables):
return AIC_score(train_y, model.predict(train_X[variables]), model)
#ii
# df.corr().to_csv("../dataset/corr.csv") correlation matrix
print(df.corr())
#iii
print("-----------... | code_fim | hard | {
"lang": "python",
"repo": "lamte1234/Data-Mining",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#ii
# df.corr().to_csv("../dataset/corr.csv") correlation matrix
print(df.corr())
#iii
print("-------------------------------FORWARD-----------------------------")
best_model1, best_variables1 = forward_selection(train_X.columns, train_model1, score_model1, verbose=True)
print(best_variables1, len(best_va... | code_fim | hard | {
"lang": "python",
"repo": "lamte1234/Data-Mining",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lamte1234/Data-Mining path: /test.py
# bai 1
import pandas as pd
import matplotlib.pylab as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from dmba import regressionSummary, exhaustive_search
from dmba import backward_elimination, for... | code_fim | hard | {
"lang": "python",
"repo": "lamte1234/Data-Mining",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jonatanavila/test path: /3- libro.py
class libro:
def __init__(self,ibs,titulo,autor,cantidad_de_pagina,pagina_actual):
self.ibs=ibs
self.titulo=titulo
self.autor=autor
self.cantidad_de_pagina= cantidad_de_pagina
self.pagina_actual= 0
def de_quien_es(self... | code_fim | hard | {
"lang": "python",
"repo": "Jonatanavila/test",
"path": "/3- libro.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('titulo:',joni.nombre_del_titulo())
rambo
print(joni.de_quien_es())
jonatan
print(joni.caracteristicas())
11221432 rambo jonatan 100
joni.leer(50)
print('pagina_actual:',joni.en... | code_fim | medium | {
"lang": "python",
"repo": "Jonatanavila/test",
"path": "/3- libro.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fredrikmalmberg/DD2424_Deep_Learning_Project path: /external_classifier.py
import numpy as np
import tensorflow as tf
from tensorflow.keras.applications.inception_v3 import InceptionV3, decode_predictions, preprocess_input
from tensorflow.keras.preprocessing import image
"""
This files uses the ... | code_fim | hard | {
"lang": "python",
"repo": "fredrikmalmberg/DD2424_Deep_Learning_Project",
"path": "/external_classifier.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Load the desired image
img_path = 'dataset/colorize_images/n02085782_919.jpg'
img = image.load_img(img_path, target_size=(299, 299))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
model = InceptionV3(weights="imagenet")
preds = model.pr... | code_fim | hard | {
"lang": "python",
"repo": "fredrikmalmberg/DD2424_Deep_Learning_Project",
"path": "/external_classifier.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuliusVsi/HVDDPG_Project path: /DDPG_HER_VIME/Train.py
import gym
import os
from Arguments import get_args
from RL_Agent_Models import DDPGAgent
###########################################################################
# Name: get_env_params
# Function: get the parameters of the environment p... | code_fim | hard | {
"lang": "python",
"repo": "JuliusVsi/HVDDPG_Project",
"path": "/DDPG_HER_VIME/Train.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
# take the configuration for the HER
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['IN_MPI'] = '1'
# get the params
arguments = get_args()
launch(arguments)<|fim_prefix|># repo: JuliusVsi/HVDDPG_Project path: /DDP... | code_fim | hard | {
"lang": "python",
"repo": "JuliusVsi/HVDDPG_Project",
"path": "/DDPG_HER_VIME/Train.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ExternalIDUsedError(EpictellerError):
message = '外部帐号已被占用'
class EMailValidateError(EpictellerError):
message = '邮箱验证失败'
class InvalidValidateTokenError(EpictellerError):
message = '无效的邮箱验证凭据'
class InvalidExternalTypeError(EpictellerError):
message = '未知外部帐号类型'
class Invali... | code_fim | medium | {
"lang": "python",
"repo": "epicteller/epicteller",
"path": "/epicteller/web/error/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: epicteller/epicteller path: /epicteller/web/error/auth.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from starlette.status import HTTP_403_FORBIDDEN, HTTP_401_UNAUTHORIZED
from epicteller.core.error.base import EpictellerError
class IncorrectEMailPasswordError(EpictellerError):
message ... | code_fim | medium | {
"lang": "python",
"repo": "epicteller/epicteller",
"path": "/epicteller/web/error/auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = '无效的邮箱验证凭据'
class InvalidExternalTypeError(EpictellerError):
message = '未知外部帐号类型'
class InvalidExternalIDError(EpictellerError):
message = '无效的外部帐号格式'
class AlreadyBindExternalError(ExternalIDUsedError):
message = '已经绑定过外部帐号'<|fim_prefix|># repo: epicteller/epicteller path... | code_fim | hard | {
"lang": "python",
"repo": "epicteller/epicteller",
"path": "/epicteller/web/error/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = [
sys.executable,
'-m', 'cscore'
]
# TODO: Get accurate reporting data from the other cscore process. For
# now, just differentiate between users with a custom py file and those
# who do not. cs... | code_fim | hard | {
"lang": "python",
"repo": "fairviewrobotics/Python-Knight-Armor",
"path": "/env/lib/python3.6/site-packages/wpilib/cameraserver.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fairviewrobotics/Python-Knight-Armor path: /env/lib/python3.6/site-packages/wpilib/cameraserver.py
# notrack
import hal
import threading
import logging
logger = logging.getLogger('wpilib.cs')
__all__ = ['CameraServer']
class CameraServer:
'''
Provides a way to launch an out of pro... | code_fim | hard | {
"lang": "python",
"repo": "fairviewrobotics/Python-Knight-Armor",
"path": "/env/lib/python3.6/site-packages/wpilib/cameraserver.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if hal.isSimulation():
logger.info("Would launch CameraServer with vision_py=%s", vision_py)
cls._alive = True
else:
logger.info("Launching CameraServer process")
# Launch the cscore launcher in a separate process
... | code_fim | hard | {
"lang": "python",
"repo": "fairviewrobotics/Python-Knight-Armor",
"path": "/env/lib/python3.6/site-packages/wpilib/cameraserver.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_score_joseph(self):
self.assertEqual(m.calculer_score("Joseph", "16"), "66") #MODIFIE
def test_score_marie(self):
self.assertEqual(m.calculer_score("Marie", "33"), "50")
def test_score_marc(self):
self.assertEqual(m.calculer_score("Marc", "60"), "43")
... | code_fim | medium | {
"lang": "python",
"repo": "PierrickHunter/NewRep",
"path": "/mytest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PierrickHunter/NewRep path: /mytest.py
import unittest
import mycode as m
class mytest(unittest.TestCase):
<|fim_suffix|> def test_score_marie(self):
self.assertEqual(m.calculer_score("Marie", "33"), "50")
def test_score_marc(self):
self.assertEqual(m.calculer_score("Mar... | code_fim | medium | {
"lang": "python",
"repo": "PierrickHunter/NewRep",
"path": "/mytest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NSSAC/REDDIEGO path: /REDDIEGO/Configuration.py
# BEGIN: Copyright
# Copyright (C) 2020 - 2021 Rector and Visitors of the University of Virginia
# All rights reserved
# END: Copyright
<|fim_suffix|> self.configurationDirectory = os.path.abspath(configurationDirectory)
os.envir... | code_fim | hard | {
"lang": "python",
"repo": "NSSAC/REDDIEGO",
"path": "/REDDIEGO/Configuration.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
try:
jsonFile = open(os.path.join(self.configurationDirectory, fileName),"r")
except:
sys.exit("ERROR: File '" + os.path.join(self.configurationDirectory, fileName) + "' does not exist.")
dictionary = json.load(jsonFile)
... | code_fim | hard | {
"lang": "python",
"repo": "NSSAC/REDDIEGO",
"path": "/REDDIEGO/Configuration.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> NewCases = SmoothedNewCases
NewDeaths = SmoothedNewDeaths
print('Masking invalid values')
if mask_zero_deaths:
NewDeaths[NewDeaths < 1] = np.nan
else:
NewDeaths[NewDeaths < 0] = np.nan
if mask_zero_cases:
NewCases[NewCases < 1] = np.nan
else:
... | code_fim | hard | {
"lang": "python",
"repo": "epidemics/COVIDNPIs",
"path": "/epimodel/preprocessing/data_preprocessor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ActiveCMs[r_i, :, :] = df.loc[r].loc[Ds][CMs].values.T
# compute new (daily) cases, after using thresholds
Confirmed[Confirmed < min_confirmed] = np.nan
Deaths[Deaths < min_deaths] = np.nan
NewCases[:, 1:] = (Confirmed[:, 1:] - Confirmed[:, :-1])
NewDeaths[:, 1:] = (Deaths... | code_fim | hard | {
"lang": "python",
"repo": "epidemics/COVIDNPIs",
"path": "/epimodel/preprocessing/data_preprocessor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return int(stack[0]) # should only be 1 value left at the end
def part1(expressions):
ans = 0
for expression in expressions:
ans += calculate(expression, advance=False)
return ans
def part2(expressions):
ans = 0
for expression in expressions:
ans += calculate(e... | code_fim | hard | {
"lang": "python",
"repo": "BartlomiejRasztabiga/advent-of-code-2020",
"path": "/day18/day18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BartlomiejRasztabiga/advent-of-code-2020 path: /day18/day18.py
from typing import List
def perform_operation(stack: list, num: int) -> List[str]:
while stack:
if stack[-1] == '(':
break
operator, left_operand = stack[-1], stack[-2]
stack = stack[:-2]
... | code_fim | hard | {
"lang": "python",
"repo": "BartlomiejRasztabiga/advent-of-code-2020",
"path": "/day18/day18.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def part1(expressions):
ans = 0
for expression in expressions:
ans += calculate(expression, advance=False)
return ans
def part2(expressions):
ans = 0
for expression in expressions:
ans += calculate(expression, advance=True)
return ans
with open('input.txt') as ... | code_fim | hard | {
"lang": "python",
"repo": "BartlomiejRasztabiga/advent-of-code-2020",
"path": "/day18/day18.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sidv/Assignments path: /Govind_Gopal/week3_assignments_py/coma_seperated.py
lst2 = []
txt = (input("Enter a comma seperate<|fim_suffix|>rint (lst)
for i in lst:
lst2.append(int(i))
print (f"The sum of the numbers are {sum(lst2)}")<|fim_middle|>d sequence of numbers"))
lst = txt.split(",")
p | code_fim | easy | {
"lang": "python",
"repo": "sidv/Assignments",
"path": "/Govind_Gopal/week3_assignments_py/coma_seperated.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>rint (f"The sum of the numbers are {sum(lst2)}")<|fim_prefix|># repo: sidv/Assignments path: /Govind_Gopal/week3_assignments_py/coma_seperated.py
lst2 = []
txt = (input("Enter a comma seperated sequence of numbers"))
lst = txt.split(",")
p<|fim_middle|>rint (lst)
for i in lst:
lst2.append(int(i))
p | code_fim | easy | {
"lang": "python",
"repo": "sidv/Assignments",
"path": "/Govind_Gopal/week3_assignments_py/coma_seperated.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nithila114/slotMachine path: /SlotMachine.py
"index incremented to "+repr(index)+" in timerFunc"
return index
def load_images(path):
"""
Loads all images in directory. The directory must only contain images.
Args: path: The relative or absolute path to the directory to l... | code_fim | hard | {
"lang": "python",
"repo": "nithila114/slotMachine",
"path": "/SlotMachine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> final_cat1 = catagory_decoder[imageIndexs[0]]
final_cat2 = catagory_decoder[imageIndexs[1]]
final_cat3 = catagory_decoder[imageIndexs[2]]
#Make numpy arrays so we can do advanced searching/matching
final_reels = np.array([final_reel1,final_reel2,final_reel3])
fin... | code_fim | hard | {
"lang": "python",
"repo": "nithila114/slotMachine",
"path": "/SlotMachine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nithila114/slotMachine path: /SlotMachine.py
but we dont care about them anyways
try:
#if the key is a backspace
if key == K_BACKSPACE:
betStr = betStr[0:-1] #remove the last digit
#if key is a digit
elif (chr(key).isdigit()):
... | code_fim | hard | {
"lang": "python",
"repo": "nithila114/slotMachine",
"path": "/SlotMachine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> serializer.save(owner=self.request.user)
class DetailsView(generics.RetrieveUpdateDestroyAPIView):
"""This class handles the http GET, PUT and DELETE requests."""
queryset = Bucketlist.objects.all()
serializer_class = BucketlistSerializer
permission_classes = (permissions.IsAuthen... | code_fim | hard | {
"lang": "python",
"repo": "pramodskys/djangoRest",
"path": "/djangorest/api/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pramodskys/djangoRest path: /djangorest/api/views.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from rest_framework import generics
from .serializers import BucketlistSerializer
from .models import Bucketlist
from rest_framework import perm... | code_fim | hard | {
"lang": "python",
"repo": "pramodskys/djangoRest",
"path": "/djangorest/api/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Bucketlist.objects.all()
serializer_class = BucketlistSerializer
permission_classes = (permissions.IsAuthenticated, IsOwner)<|fim_prefix|># repo: pramodskys/djangoRest path: /djangorest/api/views.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcu... | code_fim | medium | {
"lang": "python",
"repo": "pramodskys/djangoRest",
"path": "/djangorest/api/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twetteml/ECE434-fall path: /hw03/tmp.sh
#!/usr/bin/env python
#temp= `i2cget -y 2 0x48`
<|fim_suffix|>i2cset -y -r 2 0x48 0x02 22
i2cset -y -r 2 0x4a 0x02 22
i2cset -y -r 2 0x4a 0x03 27
i2cset -y -r 2 0x4a 0x03 27<|fim_middle|>temp1=`i2cget -y 2 0x48`
temp2=`i2cget -y 2 0x4a`
echo -n "Temp... | code_fim | medium | {
"lang": "python",
"repo": "twetteml/ECE434-fall",
"path": "/hw03/tmp.sh",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>echo -n "Temp Sensor 1: "
echo $((temp1*18/10+32))
echo $(($temp1))
echo -n "Temp Sensor 2: "
echo $((temp2*18/10+32))
echo $(($temp2))
i2cset -y -r 2 0x48 0x02 22
i2cset -y -r 2 0x4a 0x02 22
i2cset -y -r 2 0x4a 0x03 27
i2cset -y -r 2 0x4a 0x03 27<|fim_prefix|># repo: twetteml/ECE434-fall path: /hw03... | code_fim | easy | {
"lang": "python",
"repo": "twetteml/ECE434-fall",
"path": "/hw03/tmp.sh",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twetteml/ECE434-fall path: /hw03/tmp.sh
#!/usr/bin/env python
#temp= `i2cget -y 2 0x48`
temp1=`i2cget -y 2 0x48`
temp2=`i2cget -y 2 0x4a`
echo -n "Temp Sensor 1: "
echo $((temp1*18/10+32))
echo $(($temp1))
echo -n "Temp Sensor 2: "
echo $((temp2*18/10+32))
echo $(($temp2))
<|fim_suffix|>... | code_fim | easy | {
"lang": "python",
"repo": "twetteml/ECE434-fall",
"path": "/hw03/tmp.sh",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.urm_train = None
self.ucm = None
self.recommenders = dict()
self.cluster_for_user = dict()
self.std_top_pop = None
self.clusters = None
self.std_top_pop = None
def fit(self, urm_train, clusters):
self.urm_tra... | code_fim | medium | {
"lang": "python",
"repo": "Alenichel/CodiglioniNichelini_recsys-polimi-2019",
"path": "/src/clusterized_top_pop.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alenichel/CodiglioniNichelini_recsys-polimi-2019 path: /src/clusterized_top_pop.py
#!/usr/bin/env python3
import numpy as np
from tqdm import trange
from run_utils import set_seed, build_all_matrices, clusterize, train_test_split, SplitType, export, evaluate
from basic_recommenders import TopPop... | code_fim | hard | {
"lang": "python",
"repo": "Alenichel/CodiglioniNichelini_recsys-polimi-2019",
"path": "/src/clusterized_top_pop.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
set_seed(42)
EXPORT = False
urm, icm, ucm, target_users = build_all_matrices()
if EXPORT:
urm_train = urm.tocsr()
urm_test = None
else:
urm_train, urm_test = train_test_split(urm, SplitType.PROBABILISTIC)
# TOP-POP
clusters = ... | code_fim | hard | {
"lang": "python",
"repo": "Alenichel/CodiglioniNichelini_recsys-polimi-2019",
"path": "/src/clusterized_top_pop.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZUCCBBQ/heart_web path: /heart/detetction/migrations/0001_initial.py
# Generated by Django 2.1.8 on 2020-12-09 09:16
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "ZUCCBBQ/heart_web",
"path": "/heart/detetction/migrations/0001_initial.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.