text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: sckobeleva/Autotests_privnote path: /test/tests.py
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import pytest
from time import sleep
import random
import string
def test_create_empty_note(app):
driver = app.driver
# открываем главную страни... | code_fim | hard | {
"lang": "python",
"repo": "sckobeleva/Autotests_privnote",
"path": "/test/tests.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def compute_angle(rotation_diff):
trace = np.trace(rotation_diff)
trace = trace if trace <= 3 else 3
angular_distance = np.rad2deg(np.arccos((trace - 1.) / 2.))
return angular_distance<|fim_prefix|># repo: SJamieson/GIFT path: /utils/match_utils.py
import cv2
from utils.base_utils ... | code_fim | hard | {
"lang": "python",
"repo": "SJamieson/GIFT",
"path": "/utils/match_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SJamieson/GIFT path: /utils/match_utils.py
import cv2
from utils.base_utils import perspective_transform
from utils.extend_utils.extend_utils_fn import find_nearest_point_idx
import numpy as np
<|fim_suffix|>def compute_angle(rotation_diff):
trace = np.trace(rotation_diff)
trace... | code_fim | hard | {
"lang": "python",
"repo": "SJamieson/GIFT",
"path": "/utils/match_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def compute_angle(rotation_diff):
trace = np.trace(rotation_diff)
trace = trace if trace <= 3 else 3
angular_distance = np.rad2deg(np.arccos((trace - 1.) / 2.))
return angular_distance<|fim_prefix|># repo: SJamieson/GIFT path: /utils/match_utils.py
import cv2
from utils.base_util... | code_fim | hard | {
"lang": "python",
"repo": "SJamieson/GIFT",
"path": "/utils/match_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #model = build_model(features)
model=model_set.model_set.nn_3layer_for_stacking(nb_input,22,88,44)
model.fit(train_stacked[train_idx], y_dummy[train_idx],batch_size=32, epochs=6, verbose=1 ,**{'validation_data': (train_stacked[val_idx], y_dummy[val_idx])})
# model.fit(tra... | code_fim | hard | {
"lang": "python",
"repo": "analysys/2018_Analysys_2nd_Algorithm_Competition",
"path": "/性别年龄预测/top3江湖交流团队文档和代码v2.0/code_fred/second_layer_traing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: analysys/2018_Analysys_2nd_Algorithm_Competition path: /性别年龄预测/top3江湖交流团队文档和代码v2.0/code_fred/second_layer_traing.py
import numpy as np
import pandas as pd
from sklearn.metrics import log_loss
from sklearn.model_selection import StratifiedKFold, train_test_split
from keras.models import Sequenti... | code_fim | hard | {
"lang": "python",
"repo": "analysys/2018_Analysys_2nd_Algorithm_Competition",
"path": "/性别年龄预测/top3江湖交流团队文档和代码v2.0/code_fred/second_layer_traing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Rechargement du modèle préalablement enregistré """
modelfile = path + '_model.pickle'
if isfile(modelfile):
with open(modelfile, 'rb') as f:
self.classifier = pickle.load(f)
print("Model reloaded from: " + modelfile)
return s... | code_fim | hard | {
"lang": "python",
"repo": "charlottetrupin/malaria",
"path": "/starting_kit/sample_code_submission/model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: charlottetrupin/malaria path: /starting_kit/sample_code_submission/model.py
##############################################################################################
# Fichier contenant 2 classes pour le projet Malaria (Mini-Projet) #
# ... | code_fim | hard | {
"lang": "python",
"repo": "charlottetrupin/malaria",
"path": "/starting_kit/sample_code_submission/model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Optimise le classifieur en cherchant les meilleurs hyperparamètres
Args:
X : jeu de données d'entraînement
y : labels correspondants
n_iter : nombre de combinaisons testées (default=100)
"""
# Paramètres à tester
#prin... | code_fim | hard | {
"lang": "python",
"repo": "charlottetrupin/malaria",
"path": "/starting_kit/sample_code_submission/model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save(self):
user = super(RegistrationForm, self).save(commit=False)
user.set_unusable_password()
user.save()
# Associate it with a Twitter account.
TwitterUser.objects.update_or_create(user=user,
access_token=self... | code_fim | hard | {
"lang": "python",
"repo": "KatherineJF/recipe-app-api",
"path": "/app/django-oauth-twitter-1.11/django_oauth_twitter/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
self.access_token = kwargs.pop('access_token', None)
self.userinfo = kwargs.pop('userinfo', None)
initial = kwargs.get('initial', None)
if initial is not None and 'username' in initial:
if User.objects.filter(username=ini... | code_fim | hard | {
"lang": "python",
"repo": "KatherineJF/recipe-app-api",
"path": "/app/django-oauth-twitter-1.11/django_oauth_twitter/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def subsets(self, nums):
sol = []
self.helper(nums, sol, [], 0)
return sol
def helper(self, nums, sol, curr, index):
sol.append(list(curr))
for i in range(index, len(nums)):
curr.append(nums[i])
self.helper(nums, sol, curr, i + 1)
... | code_fim | hard | {
"lang": "python",
"repo": "eldadmwangi/sifu",
"path": "/recursion/subsets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eldadmwangi/sifu path: /recursion/subsets.py
'''
78. Subsets
https://leetcode.com/problems/subsets/
Given an integer array nums, return all possible subsets (the power set).
The solution set must not contain duplicate subsets.
Example 1:
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3]... | code_fim | hard | {
"lang": "python",
"repo": "eldadmwangi/sifu",
"path": "/recursion/subsets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ilozuluchris/some-stuff path: /first.py
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from scipy.stats import skew
def scoring_csv():
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Ilozuluchris/some-stuff",
"path": "/first.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#creating target and feature variables
y = df_cleaned['Scores'].values.reshape(-1,1)#200 rows,1 coulmn
X = df_cleaned.drop(['Scores','S/N'],axis=1) #200 rows,22 columns
'''numeric_feats = X.dtypes[X.dtypes == "int64"].index
skewed_feats = X[numeric_feats].apply(lambda x: skew(x.dropna())) # compute ske... | code_fim | hard | {
"lang": "python",
"repo": "Ilozuluchris/some-stuff",
"path": "/first.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>nomes = []
tipos = []
for i, loc in enumerate(localidades):
if i == 0:
nomes = loc
elif i == 1:
tipos = loc
else:
break
pprint(zip(nomes, tipos))<|fim_prefix|># repo: oturing/django-ibge path: /data/dump_dbf_struct.py
from dbf_rw import dbfreader
from pprint import pp... | code_fim | medium | {
"lang": "python",
"repo": "oturing/django-ibge",
"path": "/data/dump_dbf_struct.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oturing/django-ibge path: /data/dump_dbf_struct.py
from dbf_rw import dbfreader
from pprint import pprint
from bz2 import BZ2File
<|fim_suffix|>nomes = []
tipos = []
for i, loc in enumerate(localidades):
if i == 0:
nomes = loc
elif i == 1:
tipos = loc
else:
br... | code_fim | medium | {
"lang": "python",
"repo": "oturing/django-ibge",
"path": "/data/dump_dbf_struct.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rd.image_record()
if self.model_used == 'CNN':
return start.cnn_predict(self.model, self.frame)
else:
self.frame = self.frame.reshape(1,64,64,3)
flat_map = self.network.predict(self.frame).reshape(1,2048)
pred_gen = self.model.predict... | code_fim | hard | {
"lang": "python",
"repo": "rosskantor/Capstone_2",
"path": "/src/image.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rosskantor/Capstone_2 path: /src/image.py
import cv2
from datetime import datetime, timedelta
import math
import matplotlib.pyplot as plt
from multiprocessing import Process
import starter as start
class recording_device():
def __init__(self, model_used):
self.model_used = model_used... | code_fim | hard | {
"lang": "python",
"repo": "rosskantor/Capstone_2",
"path": "/src/image.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Our operations on the frame come here
ret, jpeg = cv2.imencode('.jpg', frame)
# Display the resulting frame
cv2.imshow('',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture... | code_fim | hard | {
"lang": "python",
"repo": "rosskantor/Capstone_2",
"path": "/src/image.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def mainFunz():
# askGenereDaTitolo
print('1) Dato un titolo e un genere in input, la KB è in grado di dirti se il titolo corrisponde al genere indicato grazie alla funzione askGenereDaTitolo, rispondendo YES se effettivamente corrisponde, altrimenti NO \n')
# askStessoGenere
print('2... | code_fim | hard | {
"lang": "python",
"repo": "giorgiaiacobellis/Icon_2020-2021",
"path": "/src/knowledge_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giorgiaiacobellis/Icon_2020-2021 path: /src/knowledge_base.py
import pandas as pd
import numpy as np
# Inizio KB
# Lettura csv
movieDataString = pd.read_csv(r'..\datasets\categ_complete_dataset.csv', sep=',')
#Creazione delle liste per ogni singola colonna
type = movieDataString.loc[:,'type']
ti... | code_fim | hard | {
"lang": "python",
"repo": "giorgiaiacobellis/Icon_2020-2021",
"path": "/src/knowledge_base.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
if(rispostaUtente.lower() =="how 3"):
print("stessoGenere("+titolo1+","+titolo2+") <=> generiUguali("+primoGenere+","+secondoGenere+") <=>", risposte[3])
rispostaUtente=input("Digitare 'how i' specificando in i il numero dell'atomo per... | code_fim | hard | {
"lang": "python",
"repo": "giorgiaiacobellis/Icon_2020-2021",
"path": "/src/knowledge_base.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pan2za/ctrl path: /tools/packaging/tools/scripts/contrail-manipulate-manifest
#!/usr/bin/python
"""
Copyright (c) 2013, Juniper Networks, Inc.
All rights reserved.
Author : Michael Ganley
manipulate paths to xml files.
"""
import argparse
from operator import index
import os
import sys
import s... | code_fim | hard | {
"lang": "python",
"repo": "pan2za/ctrl",
"path": "/tools/packaging/tools/scripts/contrail-manipulate-manifest",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> subparsers = parser.add_subparsers(title='Fire off EC jobs based on the path to manifest file',
description='Select one command',
dest='command')
parser_parse = subparsers.add_parser('parse',
... | code_fim | hard | {
"lang": "python",
"repo": "pan2za/ctrl",
"path": "/tools/packaging/tools/scripts/contrail-manipulate-manifest",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_env_files.return_value = ({}, {})
heatclient = mock.MagicMock()
heatclient.resources.list.return_value = [
mock.MagicMock(
links=[{'rel': 'stack',
'href': 'http://192.0.2.1:8004/v1/'
'a959ac7d6... | code_fim | hard | {
"lang": "python",
"repo": "d0ugal/tripleo-common",
"path": "/tripleo_common/tests/actions/test_scale.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d0ugal/tripleo-common path: /tripleo_common/tests/actions/test_scale.py
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the Licen... | code_fim | hard | {
"lang": "python",
"repo": "d0ugal/tripleo-common",
"path": "/tripleo_common/tests/actions/test_scale.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> diff = torch.pow(diff, 2)
#dot_p = torch.pow(dot_p,2)
#diff= torch.exp(diff) # using exponent instead of square doesn't work
diff = diff.view(N_probe * N_gallery, -1)
diff = diff.contiguous()
bn_diff = self.bn(diff)
bn_diff = self.drop(bn_diff)
... | code_fim | hard | {
"lang": "python",
"repo": "eduardoandrade/DCDS",
"path": "/reid/models/embedding.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eduardoandrade/DCDS path: /reid/models/embedding.py
import math
import copy
from torch import nn
import torch
import torch.nn.functional as F
from torch import nn
class VNetEmbed(nn.Module):
def __init__(self, instances_num=4, feat_num=2048, num_classes=0, drop_ratio=0.5):
super(VNe... | code_fim | hard | {
"lang": "python",
"repo": "eduardoandrade/DCDS",
"path": "/reid/models/embedding.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nfiguration for cross validation test harness
seed = 7
# prepare models
models = []
models.append(('KNN', KNeighborsClassifier()))
models.append(('CART', DecisionTreeClassifier()))
models.append(('NB', GaussianNB()))
models.append(('SVM', SVC()))
# evaluate each model in turn
results = []
names = []
scori... | code_fim | hard | {
"lang": "python",
"repo": "Bensliman2/Machine-learning-easy-exampls-",
"path": "/Atelier2/part2/QU4/part2-4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>orithm Comparison(accuracy)')
for name, model in models:
kfold = model_selection.KFold(n_splits=10, random_state=None)
cv_results = model_selection.cross_val_score(model, X, Y, cv=kfold, scoring=scoring)
results.append(cv_results)
names.append(name)
msg = "%s: %f (%f)" % (name, cv_results.mean(), cv_... | code_fim | hard | {
"lang": "python",
"repo": "Bensliman2/Machine-learning-easy-exampls-",
"path": "/Atelier2/part2/QU4/part2-4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bensliman2/Machine-learning-easy-exampls- path: /Atelier2/part2/QU4/part2-4.py
import pandas
import matplotlib.pyplot as plt
from sklearn import model_selection
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeigh... | code_fim | hard | {
"lang": "python",
"repo": "Bensliman2/Machine-learning-easy-exampls-",
"path": "/Atelier2/part2/QU4/part2-4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JeongHanJun/BOJ path: /Python 3 PS Code/BOJ/2798.py
# 2798 블랙잭
# 1. 첫번쨰 풀이 직접 다 합산해서 비교해봐야 함 Brute Force
'''
from sys import stdin
n,m = map(int, stdin.readline().strip().split())
cards = list(map(int, stdin.readline().strip().split()))
sum_cards = []
for i in range(n-2):
for j in ran... | code_fim | hard | {
"lang": "python",
"repo": "JeongHanJun/BOJ",
"path": "/Python 3 PS Code/BOJ/2798.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 2. 두번쨰 풀이 1번풀이보다 조금 더 빠름 max 내장함수 쓰지않고 변수에 최댓값 받음
from sys import stdin
n,m = map(int, stdin.readline().strip().split())
cards = list(map(int, stdin.readline().strip().split()))
sum_cards = []
max_sum = 0
for i in range(n-2):
for j in range(1,n-1):
for k in range(2,n):
i... | code_fim | hard | {
"lang": "python",
"repo": "JeongHanJun/BOJ",
"path": "/Python 3 PS Code/BOJ/2798.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
decrypt()
encrypt()
print(Fore.BLUE+ "Welcome to the chat ")
sock()<|fim_prefix|># repo: saitharun051/AES-256bit-with-CTR-Mode path: /alice1.py
import pickle,socket,binascii
from pip._vendor.colorama import Fore
from counter.counter import encryption, decryption
msg... | code_fim | hard | {
"lang": "python",
"repo": "saitharun051/AES-256bit-with-CTR-Mode",
"path": "/alice1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saitharun051/AES-256bit-with-CTR-Mode path: /alice1.py
import pickle,socket,binascii
from pip._vendor.colorama import Fore
from counter.counter import encryption, decryption
msg=[]
m=[]
soc2 = socket.socket()
soc2.bind(('127.0.0.1',5001))
soc2.connect(('127.0.0.1',5000))
def sock():
<|fi... | code_fim | medium | {
"lang": "python",
"repo": "saitharun051/AES-256bit-with-CTR-Mode",
"path": "/alice1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> m.clear()
msg.clear()
response1 = soc2.recv(1024)
response2 = soc2.recv(1024)
resp2 = pickle.loads(response2)
message = decryption(response1, resp2[0], resp2[1])
print(Fore.WHITE+'Message from Bob : ', str(message, 'utf-8') ,"(decrypted text)")
def loop():
while Tru... | code_fim | hard | {
"lang": "python",
"repo": "saitharun051/AES-256bit-with-CTR-Mode",
"path": "/alice1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dentosal/python-sc2-bot-template path: /run_locally.py
import json
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
from bot import MyBot
def main():
<|fim_suffix|> run_game(maps.get("Abyssal Reef LE"), [
Bot(race, MyBot()),
Computer(Race... | code_fim | medium | {
"lang": "python",
"repo": "Dentosal/python-sc2-bot-template",
"path": "/run_locally.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> race = Race[info["race"]]
run_game(maps.get("Abyssal Reef LE"), [
Bot(race, MyBot()),
Computer(Race.Random, Difficulty.Medium)
], realtime=False, step_time_limit=2.0, game_time_limit=(60*20), save_replay_as="test.SC2Replay")
if __name__ == '__main__':
main()<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "Dentosal/python-sc2-bot-template",
"path": "/run_locally.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._infoDate
@infoDate.setter
def infoDate(self, value):
self._infoDate = value
@property
def infoTime(self):
return self._infoTime
@infoTime.setter
def infoTime(self, value):
self._infoTime = value
@property
def infoSourceName(s... | code_fim | hard | {
"lang": "python",
"repo": "yaniv-l/wind-bot",
"path": "/windInfo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yaniv-l/wind-bot path: /windInfo.py
import datetime
from enum import Enum
import re
import json
from utils import config
import consts
class WindSpdUnit(Enum):
KN = 'kn'
KH = 'kh'
MS = 'ms'
class windInfo:
def __init__(self, sourceName, sourceURL, speedUnit = None, strengt... | code_fim | hard | {
"lang": "python",
"repo": "yaniv-l/wind-bot",
"path": "/windInfo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def waterTemp(self):
return self._waterTemp
@waterTemp.setter
def waterTemp(self, value):
self._waterTemp = value
@property
def Temp(self):
return self._Temp
@Temp.setter
def Temp(self, value):
self._Temp = value
@property
... | code_fim | hard | {
"lang": "python",
"repo": "yaniv-l/wind-bot",
"path": "/windInfo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
print(coin_sum_combos(200))
#prints 73682<|fim_prefix|># repo: keolam/Project-Euler path: /p031.py
# This Python file uses the following encoding: utf-8
'''
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
<|fim... | code_fim | hard | {
"lang": "python",
"repo": "keolam/Project-Euler",
"path": "/p031.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
print(coin_sum_combos(200))
#prints 73682<|fim_prefix|># repo: keolam/Project-Euler path: /p031.py
# This Python file uses the following encoding: utf-8
'''
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
<|f... | code_fim | hard | {
"lang": "python",
"repo": "keolam/Project-Euler",
"path": "/p031.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keolam/Project-Euler path: /p031.py
# This Python file uses the following encoding: utf-8
'''
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
<|fim_suffix|> ways = [1] + [0] * pence
for coin in [1, 2, 5, 10, 20, 50, 100, 200]:
fo... | code_fim | hard | {
"lang": "python",
"repo": "keolam/Project-Euler",
"path": "/p031.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: handersonc/chatapi path: /app/loaders.py
from main import login_manager
from app.models.user import User as UserModel
from app.session.user import User
@login_manager.user_loader
def load_user(user_id):
<|fim_suffix|> return User(obj_user.email, obj_user.email)<|fim_middle|> obj_user = Use... | code_fim | medium | {
"lang": "python",
"repo": "handersonc/chatapi",
"path": "/app/loaders.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return User(obj_user.email, obj_user.email)<|fim_prefix|># repo: handersonc/chatapi path: /app/loaders.py
from main import login_manager
from app.models.user import User as UserModel
from app.session.user import User
<|fim_middle|>@login_manager.user_loader
def load_user(user_id):
obj_user = Use... | code_fim | medium | {
"lang": "python",
"repo": "handersonc/chatapi",
"path": "/app/loaders.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mhilmiasyrofi/CovTesting path: /Comparison of Attack Images/helper.py
import numpy as np
VERBOSE = True
DATA_DIR = "../data/"
MODEL_DIR = "../models/"
MNIST = "mnist"
CIFAR = "cifar"
SVHN = "svhn"
DATASET_NAMES = [MNIST, CIFAR, SVHN]
BIM = "bim"
CW = "cw"
FGSM = "fgsm"
JSMA = "jsma"
PGD = "p... | code_fim | hard | {
"lang": "python",
"repo": "mhilmiasyrofi/CovTesting",
"path": "/Comparison of Attack Images/helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# the data is in range(-.5, .5)
def load_data(dataset_name):
assert dataset_name in DATASET_NAMES
x_train = np.load(DATA_DIR + dataset_name + '/benign/x_train.npy')
y_train = np.load(DATA_DIR + dataset_name + '/benign/y_train.npy')
x_test = np.load(DATA_DIR + dataset_name + '/benign/x_tes... | code_fim | hard | {
"lang": "python",
"repo": "mhilmiasyrofi/CovTesting",
"path": "/Comparison of Attack Images/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # (6) The controller takes care of the time integration
controller = pyclaw.Controller()
controller.solution = solution
controller.solver = solver
controller.tfinal = 1.0
# (7) Run and visualize
controller.run()
pyclaw.plot.interactive_plot()
if __name__ == "__main__":
... | code_fim | hard | {
"lang": "python",
"repo": "Ceyron/machine-learning-and-simulation",
"path": "/english/pyclaw/pyclaw_advection_1d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: drewmalin/WodTag path: /Main/views/workout.py
import datetime
from ..util import db
from ..models import *
from flask.ext.login import login_required
import flask
import flask_login
import flask.views
## All Workouts
class Workouts(flask.views.MethodView):
@login_required
def get(self):... | code_fim | hard | {
"lang": "python",
"repo": "drewmalin/WodTag",
"path": "/Main/views/workout.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def delete_workout(workout_id):
pass
@staticmethod
def create_workout():
if WorkoutCRUD.validate_user_data() != 0:
return flask.redirect(flask.url_for('workout_create'))
else:
parts = WorkoutCRUD.collect_parts()
wo... | code_fim | hard | {
"lang": "python",
"repo": "drewmalin/WodTag",
"path": "/Main/views/workout.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = super()._prepare_default_values(move)
journal_id = move.journal_id.dedit_note_id.id or res.get('journal_id')
journal = self.env['account.journal'].browse(journal_id)
res.update({
'journal_id': journal.id,
'origin_doc_code': self.pe_debit_note_c... | code_fim | medium | {
"lang": "python",
"repo": "EnriqueDavid/Pcell-Repositori",
"path": "/l10n_pe_cpe/wizard/account_debit_note.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EnriqueDavid/Pcell-Repositori path: /l10n_pe_cpe/wizard/account_debit_note.py
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class AccountDebitNote(models.TransientModel):
_inherit = "account.debit.note"
pe_debit_note_code = fields.Selection(
selection="_get_pe... | code_fim | medium | {
"lang": "python",
"repo": "EnriqueDavid/Pcell-Repositori",
"path": "/l10n_pe_cpe/wizard/account_debit_note.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def CleanEustaticNumbersInImages(cropped_eustatic_images):
test_list = []
index_missing_numbers = []
for i, r in enumerate(cropped_eustatic_images):
try:
test_list.append(float(pytesseract.image_to_string(
r, config='--psm 6')))
except ValueError:
... | code_fim | hard | {
"lang": "python",
"repo": "periglacial/nuber_et_al_2022_land_ocean_ratio",
"path": "/land_ocean_ratio.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: periglacial/nuber_et_al_2022_land_ocean_ratio path: /land_ocean_ratio.py
7:35:24 2021
@author: huw
"""
import concurrent.futures
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pytesseract
from itertools import repeat
from PIL import Image
from osgeo impor... | code_fim | hard | {
"lang": "python",
"repo": "periglacial/nuber_et_al_2022_land_ocean_ratio",
"path": "/land_ocean_ratio.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: periglacial/nuber_et_al_2022_land_ocean_ratio path: /land_ocean_ratio.py
----------
input_raster : string
Directory to the raster which should be in tiff format.
Returns
-------
raster_extent : tuple
the top left righ and bottom left right corner coordinates of
... | code_fim | hard | {
"lang": "python",
"repo": "periglacial/nuber_et_al_2022_land_ocean_ratio",
"path": "/land_ocean_ratio.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: megabyte0/rexit_test path: /http_server.py
#from my_http_server import MyHTTPRequestHandler, run
import my_http_server
import re
class HTTPRequestHandler(my_http_server.MyHTTPRequestHandler):
def register_routes(self):
d = {
'category_id':r'\d+',
'firstname_lik... | code_fim | hard | {
"lang": "python",
"repo": "megabyte0/rexit_test",
"path": "/http_server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_dictionaries(self,match):
d = {
'gender':'select id,name from test.gender',
'category':'select id,name from test.category',
'age':'select distinct cast(%s as signed) from test.client'%(
sql_select_age('birthDate')
)
... | code_fim | hard | {
"lang": "python",
"repo": "megabyte0/rexit_test",
"path": "/http_server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#https://stackoverflow.com/a/2533913
sql_select_age = lambda date_field:(
r'''DATE_FORMAT(NOW(), '%Y') -
DATE_FORMAT('''+date_field+''', '%Y') -
(DATE_FORMAT(NOW(), '00-%m-%d') < DATE_FORMAT('''+date_field+''', '00-%m-%d'))'''
)
sql_select_all = r'''
SELECT
client.id as id,
category.name as categor... | code_fim | hard | {
"lang": "python",
"repo": "megabyte0/rexit_test",
"path": "/http_server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> index = gmi.current()
conn = db.connect()
c = conn.cursor()
c.execute("SELECT t.typename, t.volume, t.portionsize, "
" mt.typename, tm.quantity "
"FROM ccp.invtypematerials tm "
" INNER JOIN ccp.invtypes t ON tm.typeid = t.typeid "
... | code_fim | hard | {
"lang": "python",
"repo": "electusmatari/legacy",
"path": "/eveutil2/bin/profit-ore",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: electusmatari/legacy path: /eveutil2/bin/profit-ore
#!/usr/bin/env python
import evelib.newdb as db
import emcom.gmi as gmi
from emcom import humane
GROUP_TAG = {'Arkonor': "zero",
'Bistot': "zero",
'Crokite': "zero",
'Dark Ochre': "zero",
'Gn... | code_fim | hard | {
"lang": "python",
"repo": "electusmatari/legacy",
"path": "/eveutil2/bin/profit-ore",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'Prime'
for n in range(2, 10):
print 'N= ',n
for x in range(2, n):
print 'X= ',x
if n % x == 0:
print n, 'NOT PRIME'
break
else:
print n, 'PRIME NUMBER'
if __name__ == '__main__':
main()<|fim_pref... | code_fim | easy | {
"lang": "python",
"repo": "protocol10/python-tuts",
"path": "/fundamentals/prime.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: protocol10/python-tuts path: /fundamentals/prime.py
#! usr/bin/env python
import sys
<|fim_suffix|> print 'Prime'
for n in range(2, 10):
print 'N= ',n
for x in range(2, n):
print 'X= ',x
if n % x == 0:
print n, 'NOT PRIME'
... | code_fim | easy | {
"lang": "python",
"repo": "protocol10/python-tuts",
"path": "/fundamentals/prime.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _write_rendered_template(rendered_template, target_file):
try:
with open(target_file, 'w') as f:
f.write(rendered_template)
except OSError:
raise TemplateOSError<|fim_prefix|># repo: nokia/crl-doc path: /src/crl/doc/robotws_util.py
import os
import sys
import trace... | code_fim | medium | {
"lang": "python",
"repo": "nokia/crl-doc",
"path": "/src/crl/doc/robotws_util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nokia/crl-doc path: /src/crl/doc/robotws_util.py
import os
import sys
import traceback
import logging
from jinja2 import Template, TemplateError
__copyright__ = 'Copyright (C) 2019, Nokia'
LOGGER = logging.getLogger(__name__)
class TemplateOSError(OSError):
pass
def create_dir(filename)... | code_fim | medium | {
"lang": "python",
"repo": "nokia/crl-doc",
"path": "/src/crl/doc/robotws_util.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def submissionRevert(context, main=None, add=None, filterinfo=None, session=None, data=None):
formId = json.loads(data)['schema']['@formId']
formInstance = getFormInstance(context, formId)
formInstance.setContext(session, main, add, None)
cardData = formInstance.revert(XMLJSONConverter.js... | code_fim | hard | {
"lang": "python",
"repo": "inponomarev/lyragrid-demo",
"path": "/src/main/celesta/lyra/lyraplayer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: inponomarev/lyragrid-demo path: /src/main/celesta/lyra/lyraplayer.py
# coding: utf-8
try:
from ru.curs.showcase.core.jython import JythonDTO
from ru.curs.showcase.util import XMLJSONConverter
except:
from ru.curs.celesta.showcase import JythonDTO
from ru.curs.celesta.showcase.util... | code_fim | hard | {
"lang": "python",
"repo": "inponomarev/lyragrid-demo",
"path": "/src/main/celesta/lyra/lyraplayer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def submissionNext(context, main=None, add=None, filterinfo=None, session=None, data=None):
formId = json.loads(data)['schema']['@formId']
formInstance = getFormInstance(context, formId)
formInstance.setContext(session, main, add, None)
cardData = formInstance.move('>', XMLJSONConverter.j... | code_fim | hard | {
"lang": "python",
"repo": "inponomarev/lyragrid-demo",
"path": "/src/main/celesta/lyra/lyraplayer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uofthr/physicslab path: /resetstatus.py
import sqlite3
import sys
import paramiko
k = paramiko.RSAKey.from_private_key_file("/home/rein/.ssh/id_rsa")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
<|fim_suffix|>for hostd in range(1,45):
host = 'physics-... | code_fim | hard | {
"lang": "python",
"repo": "uofthr/physicslab",
"path": "/resetstatus.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>conn = sqlite3.connect('status.db')
c = conn.cursor()
c.execute("UPDATE status SET status=0 WHERE 1")
conn.commit()
conn.close()
for hostd in range(1,45):
host = 'physics-lab%02d.utsc-labs.utoronto.ca'%hostd
try:
ssh.connect(host, timeout=3, username='research', pkey=k)
command = ... | code_fim | medium | {
"lang": "python",
"repo": "uofthr/physicslab",
"path": "/resetstatus.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> correct_prediction = False
if sample_label == predicted_bird:
correct_prediction = True
print('True label: {}, predicted bird: {}.'.format(sample_label, predicted_bird))
print('confidence level: {}'.format(confidence_level))
if not correct_prediction:
... | code_fim | hard | {
"lang": "python",
"repo": "YingyingF/birdsong_recognition_v2",
"path": "/inference_all.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YingyingF/birdsong_recognition_v2 path: /inference_all.py
from birdsong_recognition.utils import add_channel_dim, get_sample_labels, get_spectrogram, load_mp3, preprocess_file, wrapper_split_file_by_window_size
import tensorflow as tf
import os
import numpy as np
from colorama import Style, Fore
... | code_fim | medium | {
"lang": "python",
"repo": "YingyingF/birdsong_recognition_v2",
"path": "/inference_all.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # data_resouce = [
# "gnc_login:1",
# "gnc_task_fill_query:1",
# "gnc_apply_allocation:2",
# "gnc_invoice_info_input:1",
# "gnc_cont_grp_insured_input:2",
# "gnc_apply_allocation_finish:1",
# "gnc_logout:1",
# "gnc_login:3",
# "gn... | code_fim | hard | {
"lang": "python",
"repo": "bopopescu/auto",
"path": "/aoto_demo_all/auto_demo_webUi/titanrun/model/Model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # data_resouce = [
# "uw_login:1",
# "uw_incept_entry:10",
# "uw_get_url:2",
# "uw_scanmock_vsc:2",
# "uw_get_url:1",
# "uw_batch_ending:1",
# "uw_form_task_assign:1",
# "uw_check_policy_info_ins_client_info:1",
# "uw_check_policy_info_app_client_inf... | code_fim | hard | {
"lang": "python",
"repo": "bopopescu/auto",
"path": "/aoto_demo_all/auto_demo_webUi/titanrun/model/Model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bopopescu/auto path: /aoto_demo_all/auto_demo_webUi/titanrun/model/Model.py
# -*- coding:utf-8 -*-
import os
import sys
from robot.api import logger
from robot.libraries import BuiltIn
from titanrun.common.Core import rh_replace_arg_dic, quit_driver, get_driver, split_input_arg, get_csv_by_no
cl... | code_fim | hard | {
"lang": "python",
"repo": "bopopescu/auto",
"path": "/aoto_demo_all/auto_demo_webUi/titanrun/model/Model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>00b1cc"
},
{
"name": "Ultramark U3541M Blau",
"label": "ultramark-u3541m-blau",
"hex": "#008dc3"
},
{
"name": "Ultramark U3543M Brillantblau",
"label": "ultramark-u354threem-brillantblau",
"hex": "#0075b9"
},
{
"name": "Ultram... | code_fim | hard | {
"lang": "python",
"repo": "qdv/Colorly",
"path": "/py/ultramark-serie3500-premium.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qdv/Colorly path: /py/ultramark-serie3500-premium.py
PALETTE = [
{
"name": "Ultramark U3501G Weiss",
"label": "ultramark-u3501g-weiss",
"hex": "#edf1f2"
},
{
"name": "Ultramark U3508G Schwarz",
"label": "ultramark-u3508g-schwarz",
"hex": "... | code_fim | hard | {
"lang": "python",
"repo": "qdv/Colorly",
"path": "/py/ultramark-serie3500-premium.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kasden45/wordcloud-from-messenger path: /copy_messages.py
import fnmatch
import os
from shutil import copyfile, copy
from tkinter import filedialog, Tk
if __name__ == '__main__':
window = Tk()
targetPath = filedialog.askdirectory(parent=window,
... | code_fim | hard | {
"lang": "python",
"repo": "Kasden45/wordcloud-from-messenger",
"path": "/copy_messages.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'/'+dir):
os.mkdir(targetPath+'/'+dir)
#for _,dirs2, filenames in os.walk("%s/%s"%(os.curdir,dir)):
print("listdir:", os.listdir(dir))
for filename in os.listdir(dir):
#for filename in filenames:
... | code_fim | hard | {
"lang": "python",
"repo": "Kasden45/wordcloud-from-messenger",
"path": "/copy_messages.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>me in filenames:
if fnmatch.fnmatch(filename, 'message*'):
print(os.curdir+'/'+dir+'/'+filename)
copy(os.curdir+'/'+dir+'/'+filename, targetPath+'/'+dir)
catch Exception as e:
print(e)<|fim_prefix|># repo: Kasden45/wordcl... | code_fim | hard | {
"lang": "python",
"repo": "Kasden45/wordcloud-from-messenger",
"path": "/copy_messages.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DecoPon/navi-on-air path: /Browser_Handling_bk.py
# conding:utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
class BrowserHandling:
<|fim_suffix|> # Maximize Browser option
options = webdriver.ChromeOptions()
opti... | code_fim | hard | {
"lang": "python",
"repo": "DecoPon/navi-on-air",
"path": "/Browser_Handling_bk.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def control_browser(self):
# Maximize Browser option
options = webdriver.ChromeOptions()
options.add_argument("--kiosk")
driver = webdriver.Chrome(executable_path = "driver/2.3.5/chromedriver_mac")
#chrome_options=opti... | code_fim | medium | {
"lang": "python",
"repo": "DecoPon/navi-on-air",
"path": "/Browser_Handling_bk.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
test = Test1(config_file_path)
test.setup()
test.execute()
test.cleanup()<|fim_prefix|># repo: faizasheraz/CEF path: /src/tests/test.py
"""
Unit test for cloud experimentation framework
"""
from lib import test_base
from lib import traffic
config_fil... | code_fim | medium | {
"lang": "python",
"repo": "faizasheraz/CEF",
"path": "/src/tests/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faizasheraz/CEF path: /src/tests/test.py
"""
Unit test for cloud experimentation framework
"""
from lib import test_base
from lib import traffic
config_file_path = "/home/faiza/workspace/CEF/config/test_config.json"
log_file = "/home/faiza/workspace/CEF/results/output_log.txt"
#Test to ping v... | code_fim | medium | {
"lang": "python",
"repo": "faizasheraz/CEF",
"path": "/src/tests/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># specify sheet name list will be tested, [] means all of sheet
SHEETS = ['lianxiang_test1'] # e.g. ['DDD', 'DDD']
def setTestcaseId_Range_Flag(param):
global TESTCASEID_RANGE_FLAG # Testcaseid_Range_Flag
TESTCASEID_RANGE_FLAG = param
def setTestcaseIdRange(begin, end):
global TESTCASEID_S... | code_fim | hard | {
"lang": "python",
"repo": "jun1028/httpautomation2",
"path": "/src/cfg/GlobalSetting.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jun1028/httpautomation2 path: /src/cfg/GlobalSetting.py
# runner.GlobalSetting
# for stress test
import os
import sys
ITERATION = 0 # integer type,0 means don't iterate
RUNTIME = 0 # integer type,total run time(seconds),default is 0 ,means don't limit
#==========================================... | code_fim | hard | {
"lang": "python",
"repo": "jun1028/httpautomation2",
"path": "/src/cfg/GlobalSetting.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> (_, _, shuffled_filepath) = \
util.default_paths(paysage_path)
# set up the reader to get minibatches
data = batch.Batch(shuffled_filepath,
'train/images',
batch_size,
transform=batch.binarize_color,
... | code_fim | hard | {
"lang": "python",
"repo": "jdonald/paysage",
"path": "/examples/example_mnist_tap_machine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdonald/paysage path: /examples/example_mnist_tap_machine.py
from paysage import batch
from paysage import layers
from paysage.models import tap_machine
from paysage import fit
from paysage import optimizers
from paysage import backends as be
be.set_seed(137) # for determinism
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "jdonald/paysage",
"path": "/examples/example_mnist_tap_machine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lybtt/spider_learning path: /maoyan_top100/config.py
# coding:utf-8
__author__ = 'lyb'
# Date:2018/8/6 11:50
<|fim_suffix|>MONGO_URI = 'ip'
MONGO_DB = 'movie'
MONGO_TABLE = 'maoyanmovie_top100'
PROXY_POOL_URL = 'http://localhost:5555/random'
PROXY = None<|fim_middle|>USER_AGENT = "Mozilla/5.0... | code_fim | medium | {
"lang": "python",
"repo": "lybtt/spider_learning",
"path": "/maoyan_top100/config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>MONGO_URI = 'ip'
MONGO_DB = 'movie'
MONGO_TABLE = 'maoyanmovie_top100'
PROXY_POOL_URL = 'http://localhost:5555/random'
PROXY = None<|fim_prefix|># repo: lybtt/spider_learning path: /maoyan_top100/config.py
# coding:utf-8
__author__ = 'lyb'
# Date:2018/8/6 11:50
<|fim_middle|>USER_AGENT = "Mozilla/5.0... | code_fim | medium | {
"lang": "python",
"repo": "lybtt/spider_learning",
"path": "/maoyan_top100/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for x in range(len(str_x)):
if str_x[x:x+len(str_y)] == str_y:
return 1
return 0
for tc in range(T):
str1 = input()
str2 = input()
print(f'#{tc+1} {find_str(str1, str2)}')<|fim_prefix|># repo: yooseungju/TIL path: /Algorithm_class/A6_문자열비교.py
import sys
sys.stdin... | code_fim | easy | {
"lang": "python",
"repo": "yooseungju/TIL",
"path": "/Algorithm_class/A6_문자열비교.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yooseungju/TIL path: /Algorithm_class/A6_문자열비교.py
import sys
sys.stdin = open("input.txt")
T = int(input())
<|fim_suffix|> for x in range(len(str_x)):
if str_x[x:x+len(str_y)] == str_y:
return 1
return 0
for tc in range(T):
str1 = input()
str2 = input()
pr... | code_fim | easy | {
"lang": "python",
"repo": "yooseungju/TIL",
"path": "/Algorithm_class/A6_문자열비교.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gfcarbonell/app_main path: /app_main/web_slides/views.py
# -*- encoding: utf-8 -*-
from django.shortcuts import render
from rest_framework import viewsets
from .models import WebSlide
from .serializers import WebSlideModelSerializer
<|fim_suffix|> model = WebSlide
serializer_c... | code_fim | easy | {
"lang": "python",
"repo": "gfcarbonell/app_main",
"path": "/app_main/web_slides/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = WebSlide
serializer_class = WebSlideModelSerializer
queryset = WebSlide.objects.all()<|fim_prefix|># repo: gfcarbonell/app_main path: /app_main/web_slides/views.py
# -*- encoding: utf-8 -*-
from django.shortcuts import render
from rest_framework import viewsets
from... | code_fim | easy | {
"lang": "python",
"repo": "gfcarbonell/app_main",
"path": "/app_main/web_slides/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeilShao/Moling path: /rune_judge.py
import re
class Rune(object):
def __init__(self, data):
self.info = data[:data.find("Set")]
self.level = 0
self.position = 1
self.start = 0
self.main_attr = ()
self.sub_attr = {}
self.init_rune()
... | code_fim | hard | {
"lang": "python",
"repo": "NeilShao/Moling",
"path": "/rune_judge.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key in level_map:
if key in self.info:
self.level = level_map[key]
def set_attr(self):
attribute = re.findall(r"((HP|DEF|ATK|SPD|CRI Rate|CRI Dmg|Resistance|Accuracy) ?\+\d+%?)", self.info)
for id, attr in enumerate(attribute):
cur_a... | code_fim | hard | {
"lang": "python",
"repo": "NeilShao/Moling",
"path": "/rune_judge.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 五星英雄以下直接卖
if self.start == 5 and self.level < 3:
return True
# 六星副属性至少两个百分比
if self.start == 6:
per_count = 0
for key in self.sub_attr:
if key == "SPD" or self.sub_attr[key].find("%") != -1:
per_coun... | code_fim | hard | {
"lang": "python",
"repo": "NeilShao/Moling",
"path": "/rune_judge.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> count = len(arr)
while idx < count:
if arr[idx][0] == 0:
N = N + 1
elif arr[idx][0] == 1:
M = M + 1
rank = rank + idx + 1
idx += 1
auc = (rank*1.0 - M*(M+1)/2.0) / ( M * N * 1.0 )
print auc
calc()<|fim_prefix|># ... | code_fim | medium | {
"lang": "python",
"repo": "ustcblue/mllib",
"path": "/LR/utils/calc_auc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ustcblue/mllib path: /LR/utils/calc_auc.py
import math
import sys
org_arr=[]
for line in open(sys.argv[1],"r"):
segs = line.strip().split("\t")
org_arr.append((int(segs[0]),float(segs[1])))
def calc():
global org_arr
idx = 0
rank = 0
M = 0
N = 0
arr = sorted(o... | code_fim | hard | {
"lang": "python",
"repo": "ustcblue/mllib",
"path": "/LR/utils/calc_auc.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.