text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if ss.get(s, False):
return s
ss[s] = True
return None
v = check(data)
print('after first pass:', s)
while v is None:
v = check(data)
print('first duplicate:', v)<|fim_prefix|># repo: jtrinklein/advent-of-code path: /2018/01-main.py
#!/usr/bin/env python3
data = No... | code_fim | medium | {
"lang": "python",
"repo": "jtrinklein/advent-of-code",
"path": "/2018/01-main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jtrinklein/advent-of-code path: /2018/01-main.py
#!/usr/bin/env python3
data = None
with open('./01-data.txt') as f:
data = f.read().splitlines()
ss = {}
s = 0
ss[s] = True
def check(data):
<|fim_suffix|> ss[s] = True
return None
v = check(data)
print('after first pass:', s)
... | code_fim | medium | {
"lang": "python",
"repo": "jtrinklein/advent-of-code",
"path": "/2018/01-main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohit-kumar-behera/rock-paper-scissor path: /play/migrations/0002_auto_20201216_2059.py
# Generated by Django 3.0.7 on 2020-12-16 15:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "mohit-kumar-behera/rock-paper-scissor",
"path": "/play/migrations/0002_auto_20201216_2059.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='playerA',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('playerA', models.CharField(max_length=15)),
('join_... | code_fim | hard | {
"lang": "python",
"repo": "mohit-kumar-behera/rock-paper-scissor",
"path": "/play/migrations/0002_auto_20201216_2059.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bankaboy/CodingPracticeAndChallenges path: /TCS_CodeVita/TCS_MockVita_1_2020/B_PrimeFibonnaci.py
'''
Problem Description
Given two numbers n1 and n2
1. Find prime numbers between n1 and n2, then
2. Make all possible unique combinations of numbers from the prime
numbers list you found in step 1... | code_fim | hard | {
"lang": "python",
"repo": "bankaboy/CodingPracticeAndChallenges",
"path": "/TCS_CodeVita/TCS_MockVita_1_2020/B_PrimeFibonnaci.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
def primeList(n1, n2):
l = []
for n in range(n1, n2+1):
if isPrime(n):
l.append(n)
return l
n1, n2 = map(int, input().split())
l... | code_fim | hard | {
"lang": "python",
"repo": "bankaboy/CodingPracticeAndChallenges",
"path": "/TCS_CodeVita/TCS_MockVita_1_2020/B_PrimeFibonnaci.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henrique93/Natural-Language path: /part 2/Code/exc2.py
from Smooth import smoothing
def n_grams(unigramsFile, bigramsFile, parameterization, sentences):
words = []
param = []
unigrams = []
bigrams = []
with open(parameterization) as p: #Parametrization file
data = p.... | code_fim | hard | {
"lang": "python",
"repo": "henrique93/Natural-Language",
"path": "/part 2/Code/exc2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for w in words:
bigram1 = 0
bigram2 = 0
option1 = w
print(w)
index = option1.index(word)
option1[index] = param[1]
option2 = w
index = option2.index(word)
option2[index] = param[2]
for unigram in unigrams:
if((... | code_fim | hard | {
"lang": "python",
"repo": "henrique93/Natural-Language",
"path": "/part 2/Code/exc2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhijmics/Mediclear-Admin path: /app/migrations/0001_initial.py
# Generated by Django 3.0.5 on 2020-05-12 13:26
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "abhijmics/Mediclear-Admin",
"path": "/app/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='idcard',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, null=True)),
('empl... | code_fim | hard | {
"lang": "python",
"repo": "abhijmics/Mediclear-Admin",
"path": "/app/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raikuma/project-euler path: /py/Euler69.py
def phi(n):
r = n
d = 2
p = n
while r > 1:
if r % d == 0:<|fim_suffix|>r/d)
d += 1
return p
m = (0, 1)
for n in range(2, 1000000):
p = phi(n)
m = max(m, (n/p, n))
if n % 10000 == 0:
print(n)
print... | code_fim | medium | {
"lang": "python",
"repo": "raikuma/project-euler",
"path": "/py/Euler69.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r/d)
d += 1
return p
m = (0, 1)
for n in range(2, 1000000):
p = phi(n)
m = max(m, (n/p, n))
if n % 10000 == 0:
print(n)
print(m)<|fim_prefix|># repo: raikuma/project-euler path: /py/Euler69.py
def phi(n):
r = n
d = 2
p = n
while r > 1:
if r % d ==... | code_fim | medium | {
"lang": "python",
"repo": "raikuma/project-euler",
"path": "/py/Euler69.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KaterynaKandziuba/ITStep-hws path: /HW_7/Kandziuba_hw7_task1.py
#Проверяем, является ли введенная пользователем строка полиндромом
<|fim_suffix|>if list_1 == list_1_rev:
print('You entered a polindrom!')
else: print('Your string is not a polindrom')<|fim_middle|>list_1 = input('Enter som... | code_fim | medium | {
"lang": "python",
"repo": "KaterynaKandziuba/ITStep-hws",
"path": "/HW_7/Kandziuba_hw7_task1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if list_1 == list_1_rev:
print('You entered a polindrom!')
else: print('Your string is not a polindrom')<|fim_prefix|># repo: KaterynaKandziuba/ITStep-hws path: /HW_7/Kandziuba_hw7_task1.py
#Проверяем, является ли введенная пользователем строка полиндромом
<|fim_middle|>list_1 = input('Enter som... | code_fim | medium | {
"lang": "python",
"repo": "KaterynaKandziuba/ITStep-hws",
"path": "/HW_7/Kandziuba_hw7_task1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willbill233/micromanager path: /src/service/tasks.py
import json
import webapp2
import requests
import requests_toolbelt.adapters.appengine
from . import mongodb
import datetime
from bson.json_util import dumps
class RestHandler(webapp2.RequestHandler):
def dispatch(self):
# time.sl... | code_fim | hard | {
"lang": "python",
"repo": "willbill233/micromanager",
"path": "/src/service/tasks.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = '61cf04749fda864dd404009216cbe106'
token = '2caecaa0245326fcc4b949a4780ad7fdcb8cd8d77b4394ad8590d244dbfa542f'
payload = json.loads(self.request.body)
params = { 'key': key, 'token': token }
requests_toolbelt.adapters.appengine.monkeypatch()
response = self.delete_trello_car... | code_fim | hard | {
"lang": "python",
"repo": "willbill233/micromanager",
"path": "/src/service/tasks.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> requests_toolbelt.adapters.appengine.monkeypatch()
response = self.delete_trello_card(payload['projectManagementTrelloId'], params)
if payload.get('teamTrelloId') is not None:
response = self.delete_trello_card(payload['teamTrelloId'], params)
mongodb.delete(payload['_id']['$oid'], ... | code_fim | hard | {
"lang": "python",
"repo": "willbill233/micromanager",
"path": "/src/service/tasks.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> img = cv2.imread(img_path)
mask = cv2.imread(mask_path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# apply augmentations
if self.augmentation:
sample = self.augmentation(image=img, mask=mask)
img, mask = sample['image'], sample['mask']
... | code_fim | hard | {
"lang": "python",
"repo": "ancy397031272/seg_pytorch",
"path": "/datalayer/datalayer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ancy397031272/seg_pytorch path: /datalayer/datalayer.py
import os
import cv2
import numpy as np
import torch
import torch.utils.data
import torchvision
from torchvision import transforms
from utils.utils import loadYaml
from .base_datalayer import BaseDataLayer
import albumentations as albu
cla... | code_fim | hard | {
"lang": "python",
"repo": "ancy397031272/seg_pytorch",
"path": "/datalayer/datalayer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __len__(self):
return len(self.bg_masks_path) + len(self.ng_masks_path)
def __getitem__(self, item):
# bg
if np.random.random() > 0.5 and len(self.bg_masks_path) > 0:
random_id_bg = np.random.randint(0, len(self.bg_imgs_path))
img_path, mask_pat... | code_fim | medium | {
"lang": "python",
"repo": "ancy397031272/seg_pytorch",
"path": "/datalayer/datalayer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return
def draw (self, window):
pygame.draw.rect (window, self.color, self.rect)
return<|fim_prefix|># repo: CSnackerman/pymunk_test path: /ground.py
import pygame
from pygame import Rect, Color
from pymunk import Body, Poly
from config import WIDTH, HEIGHT
cla... | code_fim | medium | {
"lang": "python",
"repo": "CSnackerman/pymunk_test",
"path": "/ground.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CSnackerman/pymunk_test path: /ground.py
import pygame
from pygame import Rect, Color
from pymunk import Body, Poly
from config import WIDTH, HEIGHT
class Ground:
def __init__ (self, space):
<|fim_suffix|> # position
self.x = 10
self.y = HEIGHT - self.h
# p... | code_fim | medium | {
"lang": "python",
"repo": "CSnackerman/pymunk_test",
"path": "/ground.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> space.add (self.rigidbody, self.hitbox)
def update (self, dt):
return
def draw (self, window):
pygame.draw.rect (window, self.color, self.rect)
return<|fim_prefix|># repo: CSnackerman/pymunk_test path: /ground.py
import pygame
from pygame import Rect... | code_fim | hard | {
"lang": "python",
"repo": "CSnackerman/pymunk_test",
"path": "/ground.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_bid(self, price):
self.bids.append(Bid(price))<|fim_prefix|># repo: artill/workshops-tdd-auction-reporter-python path: /auction.py
from auction_type import AuctionType
from bid import Bid
class Auction(object):
def __init__(self, name, type, status, start_price, buy_now_price):
... | code_fim | medium | {
"lang": "python",
"repo": "artill/workshops-tdd-auction-reporter-python",
"path": "/auction.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artill/workshops-tdd-auction-reporter-python path: /auction.py
from auction_type import AuctionType
from bid import Bid
class Auction(object):
def __init__(self, name, type, status, start_price, buy_now_price):
self.name = name
self.type = type
self.status = status
... | code_fim | medium | {
"lang": "python",
"repo": "artill/workshops-tdd-auction-reporter-python",
"path": "/auction.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> token_lookup = mango.SplTokenLookup.load(mango.SplTokenLookup.DefaultDataFilepath)
assert token_lookup.find_by_symbol("BTC").mint == PublicKey("9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E")
assert token_lookup.find_by_symbol("ETH").mint == PublicKey("2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6P... | code_fim | hard | {
"lang": "python",
"repo": "Investin-pro/mango-explorer",
"path": "/tests/test_tokenlookup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Investin-pro/mango-explorer path: /tests/test_tokenlookup.py
from .context import mango
from solana.publickey import PublicKey
def test_token_lookup():
data = {
"tokens": [
{
"address": "So11111111111111111111111111111111111111112",
"symb... | code_fim | hard | {
"lang": "python",
"repo": "Investin-pro/mango-explorer",
"path": "/tests/test_tokenlookup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert result.exit_code == 0<|fim_prefix|># repo: Rusoleman/TaskMaster path: /venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py
from click.testing import CliRunner
from apitest.actions.cli import cli
def test_sendto_cli_runs_ok():
<|fim_middle|> runner = CliRunner()
res... | code_fim | medium | {
"lang": "python",
"repo": "Rusoleman/TaskMaster",
"path": "/venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> runner = CliRunner()
result = runner.invoke(cli, ["sendto"])
assert result.exit_code == 0<|fim_prefix|># repo: Rusoleman/TaskMaster path: /venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py
from click.testing import CliRunner
from apitest.actions.cli import cli
<|fi... | code_fim | easy | {
"lang": "python",
"repo": "Rusoleman/TaskMaster",
"path": "/venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rusoleman/TaskMaster path: /venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py
from click.testing import CliRunner
from apitest.actions.cli import cli
def test_sendto_cli_runs_ok():
<|fim_suffix|> assert result.exit_code == 0<|fim_middle|> runner = CliRunner()
res... | code_fim | medium | {
"lang": "python",
"repo": "Rusoleman/TaskMaster",
"path": "/venv/Lib/site-packages/tests/unittesting/actions/sendto/cli/test_cli.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def end(self):
self.get_window().close()
class Menu(): #CHANGE TO SELF. WIDTH AND HIEGHT
def __init__(self,window):
self.window = window
skyBlue = color_rgb(135,206,250)
royalBlue = color_rgb(65,105,225)
self.menu = Rectangle(Point(.2*500,.15*500),Point(.... | code_fim | hard | {
"lang": "python",
"repo": "OhMesch/Connect-Four-AI",
"path": "/connect_board_renderer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.saveTxt = Text(Point(.50*500,.275*500), "SAVE")
self.saveTxt.setSize(30)
self.saveTxt.setFace("helvetica")
self.saveTxt.setStyle("bold")
self.load = Rectangle(Point(.25*500,.4*500),Point(.75*500,.55*500))
self.load.setOutline(royalBlue)
self.lo... | code_fim | hard | {
"lang": "python",
"repo": "OhMesch/Connect-Four-AI",
"path": "/connect_board_renderer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OhMesch/Connect-Four-AI path: /connect_board_renderer.py
import graphics
from graphics import *
class Renderer():
def __init__(self, engine, width=700, height=600):
self.width = width
self.height = height
self.engine = engine
self.win = GraphWin("Game Board",... | code_fim | hard | {
"lang": "python",
"repo": "OhMesch/Connect-Four-AI",
"path": "/connect_board_renderer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexYooDev/jsAlgorithmStudy path: /hIndex/hIndex.py
def solution(citations):
<|fim_suffix|>print(solution([3,0,6,1,5]))<|fim_middle|> # 사이테이션을 정렬
citations.sort()
#
for i in range(len(citations)):
if citations[i] >= len(citations) - i:
return len(citations)-i
| code_fim | medium | {
"lang": "python",
"repo": "alexYooDev/jsAlgorithmStudy",
"path": "/hIndex/hIndex.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexYooDev/jsAlgorithmStudy path: /hIndex/hIndex.py
def solution(citations):
<|fim_suffix|>
print(solution([3,0,6,1,5]))<|fim_middle|> # 사이테이션을 정렬
citations.sort()
#
for i in range(len(citations)):
if citations[i] >= len(citations) - i:
return len(citations)-i
| code_fim | medium | {
"lang": "python",
"repo": "alexYooDev/jsAlgorithmStudy",
"path": "/hIndex/hIndex.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print(solution([3,0,6,1,5]))<|fim_prefix|># repo: alexYooDev/jsAlgorithmStudy path: /hIndex/hIndex.py
def solution(citations):
<|fim_middle|> # 사이테이션을 정렬
citations.sort()
#
for i in range(len(citations)):
if citations[i] >= len(citations) - i:
return len(citations)-i
| code_fim | medium | {
"lang": "python",
"repo": "alexYooDev/jsAlgorithmStudy",
"path": "/hIndex/hIndex.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SurveyHistory(models.Model):
post = models.ForeignKey(to=Post, on_delete=models.CASCADE)
record = models.BooleanField()
recorded_date = models.DateTimeField(auto_now_add=timezone.now)
def __str__(self):
return self.post.title<|fim_prefix|># repo: functioncall/rescue-habit p... | code_fim | hard | {
"lang": "python",
"repo": "functioncall/rescue-habit",
"path": "/blog/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: functioncall/rescue-habit path: /blog/models.py
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse
<|fim_suffix|> def get_absolute_url(self):
return reverse('post-detail', kwargs={'pk': self.pk})
... | code_fim | hard | {
"lang": "python",
"repo": "functioncall/rescue-habit",
"path": "/blog/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leomen3/RPi_Home_Monitor path: /mqtt_monitor.py
#!/usr/bin/env python
###########################################################################
# 1) connect to the MQTT broker
# 2) subscribe to the available data streams
# 3) log to google sheets
# 4) notify on critical events on the telegram ... | code_fim | hard | {
"lang": "python",
"repo": "leomen3/RPi_Home_Monitor",
"path": "/mqtt_monitor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def number_of_entries(service):
result = service.spreadsheets().values().get(
spreadsheetId=SPREADSHEET_ID, range=NUM_ENTRIES_CELL).execute()
value = result.get('values', [])
return int(value[0][0])
def update_records(topic, value):
# Update InfluxDB
receiveTime = getUTC_TI... | code_fim | hard | {
"lang": "python",
"repo": "leomen3/RPi_Home_Monitor",
"path": "/mqtt_monitor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sverma1012/HackerRank-30-Days-of-Code path: /Day 6: Review.py
# Goal: Let's Review
# Enter your code here. Read input from STDIN. Print output to STDOUT
<|fim_suffix|>for i in range(T):
even = ''
odd = ''
s = str(input())
for i in range(len(s)):
if (i % 2 == 0):
... | code_fim | easy | {
"lang": "python",
"repo": "sverma1012/HackerRank-30-Days-of-Code",
"path": "/Day 6: Review.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Iterate through each inputted string
for i in range(T):
even = ''
odd = ''
s = str(input())
for i in range(len(s)):
if (i % 2 == 0):
even = even + s[i]
else:
odd = odd + s[i]
print(even, odd)<|fim_prefix|># repo: sverma1012/HackerRank-30-Day... | code_fim | easy | {
"lang": "python",
"repo": "sverma1012/HackerRank-30-Days-of-Code",
"path": "/Day 6: Review.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgfitch/maskAOIs path: /maskAOI.py
#!/usr/bin/env python
"""
maskAOI.py
Dan Fitch 20150618
"""
from __future__ import print_function
import sys, os, glob, shutil, fnmatch, math, re, numpy, csv
from PIL import Image, ImageFile, ImageDraw, ImageColor, ImageOps, ImageStat
ImageFile.MAXBLOCK = 10... | code_fim | hard | {
"lang": "python",
"repo": "dgfitch/maskAOIs",
"path": "/maskAOI.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> stats_orig = stat(original)
results = {
'image_name': pictureName,
'orig_lum': luminance(stats_orig.mean) / 256.0,
'orig_r': stats_orig.mean[0] / 256.0,
'orig_g': stats_orig.mean[1] / 256.0,
'orig_b': stats_orig.mean[2] / 256.0,
'orig_complexity': c... | code_fim | hard | {
"lang": "python",
"repo": "dgfitch/maskAOIs",
"path": "/maskAOI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azure/DataScienceVM path: /Tutorials/Webinar-10-26-2017/utils.py
from sklearn.datasets import fetch_mldata
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import train_test_split
import numpy as np
import os
import tarfile
import pickle
import subprocess
import sys
i... | code_fim | hard | {
"lang": "python",
"repo": "Azure/DataScienceVM",
"path": "/Tutorials/Webinar-10-26-2017/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def download_cifar(download_dir, src="http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"):
'''Load the training and testing data
'''
if not os.path.isfile("{}/cifar-10-python.tar.gz".format(download_dir)):
print ('Downloading ' + src)
fname, h = urlretrieve(src, '{}/cifar... | code_fim | hard | {
"lang": "python",
"repo": "Azure/DataScienceVM",
"path": "/Tutorials/Webinar-10-26-2017/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gxgarciat/Playground-GUI-Tkinter path: /6_images.py
from tkinter import *
from PIL import ImageTk,Image
import sys, os
# This will display images and icon
<|fim_suffix|># Adding a quit button
buttonquit = Button(root,text="Exit program",command=root.quit)
buttonquit.pack()
root.mainloop()<|fi... | code_fim | hard | {
"lang": "python",
"repo": "gxgarciat/Playground-GUI-Tkinter",
"path": "/6_images.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Adding a quit button
buttonquit = Button(root,text="Exit program",command=root.quit)
buttonquit.pack()
root.mainloop()<|fim_prefix|># repo: gxgarciat/Playground-GUI-Tkinter path: /6_images.py
from tkinter import *
from PIL import ImageTk,Image
import sys, os
# This will display images and icon
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "gxgarciat/Playground-GUI-Tkinter",
"path": "/6_images.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mertcanekiz/EulerCpp path: /run.py
#!/usr/bin/python3
import os
import sys
import subprocess
path = sys.argv[1]
name, ext = os.path.splitext(path)
options = ['g++',
'-O3',
<|fim_suffix|> '-lgmp']
subprocess.call(options)
subprocess.call([f'./bin/{name}'])<|fim_middle... | code_fim | medium | {
"lang": "python",
"repo": "mertcanekiz/EulerCpp",
"path": "/run.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '-lgmp']
subprocess.call(options)
subprocess.call([f'./bin/{name}'])<|fim_prefix|># repo: mertcanekiz/EulerCpp path: /run.py
#!/usr/bin/python3
import os
import sys
import subprocess
path = sys.argv[1]<|fim_middle|>
name, ext = os.path.splitext(path)
options = ['g++',
'-O3',
... | code_fim | medium | {
"lang": "python",
"repo": "mertcanekiz/EulerCpp",
"path": "/run.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_findOriginalArray(self):
solution = Solution()
self.assertEqual(solution.findOriginalArray([1, 3, 4, 2, 6, 8]), [1, 3, 4])
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: eselyavka/python path: /leetcode/solution_2007.py
import unittest
from collections ... | code_fim | hard | {
"lang": "python",
"repo": "eselyavka/python",
"path": "/leetcode/solution_2007.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ans = []
for num in changed:
if num in freq and freq[num] > 0:
freq[num] -= 1
double_num = 2 * num
if double_num in freq and freq[double_num] > 0:
ans.append(num)
freq[double_num] -= 1
... | code_fim | hard | {
"lang": "python",
"repo": "eselyavka/python",
"path": "/leetcode/solution_2007.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eselyavka/python path: /leetcode/solution_2007.py
import unittest
from collections import Counter
class Solution(object):
def findOriginalArray(self, changed):
<|fim_suffix|>
class TestSolution(unittest.TestCase):
def test_findOriginalArray(self):
solution = Solution()
s... | code_fim | hard | {
"lang": "python",
"repo": "eselyavka/python",
"path": "/leetcode/solution_2007.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: damageddolphin/readerboard path: /hourlyChime.py
"""
This is the hourly animation program. It displays a series of images across the board.
It is hard coded to work with the Sonic images. Adjustments would need to be made to
the y values which are distance traveled. Change sonicFrame < 8 value to... | code_fim | medium | {
"lang": "python",
"repo": "damageddolphin/readerboard",
"path": "/hourlyChime.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> matrix.Clear()
sonicRun = 0
sonicFrame = 0
y = 0
while y < 70:
sonicFrame = 0
if sonicRun >= 100:
sonicRun = 0
y = y + 15
while sonicFrame < 8:
animationFrame = 'animation/SonicRun-' + str(sonicFrame) + '.jpg'
imag... | code_fim | medium | {
"lang": "python",
"repo": "damageddolphin/readerboard",
"path": "/hourlyChime.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
https://leetcode.cn/submissions/detail/320442719/
执行用时:
36 ms
, 在所有 Python3 提交中击败了
73.39%
的用户
内存消耗:
15.2 MB
, 在所有 Python3 提交中击败了
62.74%
的用户
通过测试用例:
195 / 195
"""<|fim_prefix|># repo: BIAOXYZ/variousCodes path: /_CodeTopics/LeetCode/1-200/000033/interview/after_interview_000033.py3
class Solution:
... | code_fim | hard | {
"lang": "python",
"repo": "BIAOXYZ/variousCodes",
"path": "/_CodeTopics/LeetCode/1-200/000033/interview/after_interview_000033.py3",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BIAOXYZ/variousCodes path: /_CodeTopics/LeetCode/1-200/000033/interview/after_interview_000033.py3
class Solution:
def search(self, nums: List[int], target: int) -> int:
n = len(nums)
left, right = 0, n-1
found = False
res = None
<|fim_suffix|>"""
htt... | code_fim | hard | {
"lang": "python",
"repo": "BIAOXYZ/variousCodes",
"path": "/_CodeTopics/LeetCode/1-200/000033/interview/after_interview_000033.py3",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return any(list(map(lambda x: x is None, list_)))
def set_label_regression_model(self, model, label_name):
self._fit_model_table_dict[label_name] = model
def return_label_regression_model(self, label_name):
return self._fit_model_table_dict[label_name]
@classmethod
... | code_fim | hard | {
"lang": "python",
"repo": "migcaslas/ensemble_timeseries_forecast",
"path": "/model/_regression_model_table.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: migcaslas/ensemble_timeseries_forecast path: /model/_regression_model_table.py
import pandas
class _RegressionModelTable(object):
def __init__(self, regression_models, function_to_evaluate_model=None, function_to_select_model=None):
if not isinstance(regression_models, list):
... | code_fim | hard | {
"lang": "python",
"repo": "migcaslas/ensemble_timeseries_forecast",
"path": "/model/_regression_model_table.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_label_regression_model(self, model, label_name):
self._fit_model_table_dict[label_name] = model
def return_label_regression_model(self, label_name):
return self._fit_model_table_dict[label_name]
@classmethod
def _predict_func(cls, model, x_instance, n_samples):
... | code_fim | hard | {
"lang": "python",
"repo": "migcaslas/ensemble_timeseries_forecast",
"path": "/model/_regression_model_table.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: illorenzo7/rayleigh_utils path: /zz_legacy/dist/rossby_mer.py
import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from azavg_util import plot_azav
from binormalized_cbar import MidpointNormalize
from diagnostic_reading import ReferenceState
dirname = sys.argv[1]
datadir = di... | code_fim | hard | {
"lang": "python",
"repo": "illorenzo7/rayleigh_utils",
"path": "/zz_legacy/dist/rossby_mer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Total velocity
v2_p = vr2_p + vt2_p + vp2_p
v2_m = vr2_m + vt2_p + vp2_m
v2_t = vr2_t + vt2_p + vp2_t
Om = 7.8e-6
ro_p = np.sqrt(v2_p)/(2*Om*H_rho_2d)
ro_m = np.sqrt(v2_m)/(2*Om*H_rho_2d)
ro_t = np.sqrt(v2_t)/(2*Om*H_rho_2d)
# Plot radial angular momentum transport
fig, ax = plt.subplots()
plot_azav(... | code_fim | medium | {
"lang": "python",
"repo": "illorenzo7/rayleigh_utils",
"path": "/zz_legacy/dist/rossby_mer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>fig, ax = plt.subplots()
plot_azav(fig, ax, ro_m, rr, cost, sint,
contours=False, notfloat=False, units='')
plt.title(r'$({\rm{Ro}}_{\rm{c}})_+$',fontsize=16)
plt.tight_layout()
plt.show()
plt.savefig(plotdir + 'rossby_mer_p.png')
plt.close()<|fim_prefix|># repo: illorenzo7/rayleigh_utils path: /... | code_fim | hard | {
"lang": "python",
"repo": "illorenzo7/rayleigh_utils",
"path": "/zz_legacy/dist/rossby_mer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Recuerdos',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('titulo_evento', models.CharField(blank=True, max_length=100, null=Tr... | code_fim | hard | {
"lang": "python",
"repo": "edgardo28081/gomez",
"path": "/liceoweb/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edgardo28081/gomez path: /liceoweb/migrations/0001_initial.py
# Generated by Django 3.2 on 2021-05-22 06:54
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Recuerdos',
... | code_fim | hard | {
"lang": "python",
"repo": "edgardo28081/gomez",
"path": "/liceoweb/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_hit_chances(number_of_dice, enemy_modifications=[], friendly_modifications=[]):
return get_dice_chances(number_of_dice, roll_attack_dice, result.HIT | result.CRIT, enemy_modifications, friendly_modifications)
def get_evade_chances(number_of_dice, enemy_modifications=[], friendly_modifications... | code_fim | hard | {
"lang": "python",
"repo": "fescrb/pywing",
"path": "/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fescrb/pywing path: /__init__.py
# Imports
from __future__ import print_function
import numpy
from numpy.random import randint
from enum import Enum
__all__ = ["common", "plot"]
class result(Enum):
CRIT = 16
HIT = 8
EVADE = 4
FOCUS = 2
BLANK = 1
def result_str(res):
... | code_fim | hard | {
"lang": "python",
"repo": "fescrb/pywing",
"path": "/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> FOR_ALL = 7
ONCE = 1
class change:
def __init__(self, rule, from_result, to_result):
self.rule = rule
self.from_result = from_result
self.to_result = to_result
def modify_dice_list(self, dice_list):
for i in range(len(dice_list)):
if dice_list[i].equals(self.from_result):
di... | code_fim | hard | {
"lang": "python",
"repo": "fescrb/pywing",
"path": "/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 4hck/hit4mal path: /src/data/tools/download_samples.py
import requests
import os
from bs4 import BeautifulSoup
from urllib.parse import urljoin
CURRENT_DIR = os.getcwd()
DOWNLOAD_DIR = os.path.join(CURRENT_DIR, 'malware_album')
os.makedirs(DOWNLOAD_DIR, exist_ok=True)
url = 'http://old.vision.... | code_fim | hard | {
"lang": "python",
"repo": "4hck/hit4mal",
"path": "/src/data/tools/download_samples.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = requests.get(family_url)
if res.status_code == 200:
page_extractor = Extractor(res.text, family_url)
count = 1
print('Page ', count)
extract_image(res.text, family_url, family_folder) # Extract on first page
for page in page... | code_fim | hard | {
"lang": "python",
"repo": "4hck/hit4mal",
"path": "/src/data/tools/download_samples.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def fetch(image_url, image_name, folder):
r = requests.get(image_url, stream=True)
image_file = os.path.join(folder, image_name)
with open(image_file, 'wb') as f:
for chunk in r.iter_content(1024):
f.write(chunk)
del r
def extract_image(page_html, family_url, folder):... | code_fim | hard | {
"lang": "python",
"repo": "4hck/hit4mal",
"path": "/src/data/tools/download_samples.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jodaz/django-stock-checker path: /stocks/views.py
from .models import Stock
from .serializers import StockSerializer
from rest_framework import generics
<|fim_suffix|> queryset = Stock.objects.all()
serializer_class = StockSerializer<|fim_middle|>class StockListCreate(generics.ListCreateA... | code_fim | easy | {
"lang": "python",
"repo": "jodaz/django-stock-checker",
"path": "/stocks/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> queryset = Stock.objects.all()
serializer_class = StockSerializer<|fim_prefix|># repo: jodaz/django-stock-checker path: /stocks/views.py
from .models import Stock
from .serializers import StockSerializer
from rest_framework import generics
<|fim_middle|>class StockListCreate(generics.ListCreateA... | code_fim | easy | {
"lang": "python",
"repo": "jodaz/django-stock-checker",
"path": "/stocks/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"length", 4.216,
"width", 1.857, "max_speed", 177)
print sum(b[9:16:2])<|fim_prefix|># repo: karlittocute/Tasks path: /Python/2.4.py
# Кицела Каролина ИВТ 3 курс
# Вариант 6
# Найти сумму всех чисел с плавающей точкой
b = ("name", " DeLorean DMC-12", "motor_pos", "rear", "n<|fim_middle|>_of_wheels"... | code_fim | medium | {
"lang": "python",
"repo": "karlittocute/Tasks",
"path": "/Python/2.4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karlittocute/Tasks path: /Python/2.4.py
# Кицела Каролина ИВТ 3 курс
# Вариант 6
# Найти сумму всех чисел с плавающей точкой
b = ("name", " DeLorean DMC-12", "motor_pos", "rear", "n<|fim_suffix|>"length", 4.216,
"width", 1.857, "max_speed", 177)
print sum(b[9:16:2])<|fim_middle|>_of_wheels"... | code_fim | medium | {
"lang": "python",
"repo": "karlittocute/Tasks",
"path": "/Python/2.4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JaneHQ1/Predicting-Stroke-Severity-from-Computed-Tomography-Images path: /gui_final_code_190520/cap_0519_segmen.py
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 12:47:30 2019
Title: MP4-Medical Image Processing
@author: MP4 Team
"""
# Validate window controller
class ValidateWindow... | code_fim | hard | {
"lang": "python",
"repo": "JaneHQ1/Predicting-Stroke-Severity-from-Computed-Tomography-Images",
"path": "/gui_final_code_190520/cap_0519_segmen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Disable scrolling image
def fig_leave_event(self, event):
self.fig.canvas.mpl_disconnect(self.scroll_trans)
self.fig.canvas.mpl_disconnect(self.scroll_truth)
self.fig.canvas.mpl_disconnect(self.scroll_segmen)
# Scroll voxel image
def trans_subplot_... | code_fim | hard | {
"lang": "python",
"repo": "JaneHQ1/Predicting-Stroke-Severity-from-Computed-Tomography-Images",
"path": "/gui_final_code_190520/cap_0519_segmen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: finben/djattendance path: /ap/accounts/urls.py
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import SetPasswordForm
<|fim_suffix|>urlpatterns = [
url(regex=r'^(?P<pk>\d+)$', view=views.UserDetailView.as_view(), name='user_de... | code_fim | medium | {
"lang": "python",
"repo": "finben/djattendance",
"path": "/ap/accounts/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(regex=r'^(?P<pk>\d+)$', view=views.UserDetailView.as_view(), name='user_detail'),
url(regex=r'^update/(?P<pk>\d+)$', view=views.UserUpdateView.as_view(), name='user_update'),
url(regex=r'^email/update/(?P<pk>\d+)$', view=views.EmailUpdateView.as_view(), name='email_change'),
ur... | code_fim | medium | {
"lang": "python",
"repo": "finben/djattendance",
"path": "/ap/accounts/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.name = name
class ItemTable(Table):
name = Col('Name')
category_name = Col('Category', attr_list=['category', 'name'])
# Equivalently: Col('Category', attr='category.name')
# Both syntaxes are kept as the second is more readable, but
# doesn't cover all options. Such as ... | code_fim | medium | {
"lang": "python",
"repo": "plumdog/flask_table",
"path": "/examples/attr_list.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = Col('Name')
category_name = Col('Category', attr_list=['category', 'name'])
# Equivalently: Col('Category', attr='category.name')
# Both syntaxes are kept as the second is more readable, but
# doesn't cover all options. Such as if the items are dicts and
# the keys have dots... | code_fim | medium | {
"lang": "python",
"repo": "plumdog/flask_table",
"path": "/examples/attr_list.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plumdog/flask_table path: /examples/attr_list.py
from flask_table import Table, Col
"""Lets suppose that we have a class that we get an iterable of from
somewhere, such as a database. We can declare a table that pulls out
the relevant entries, escapes them and displays them.
<|fim_suffix|>
cla... | code_fim | hard | {
"lang": "python",
"repo": "plumdog/flask_table",
"path": "/examples/attr_list.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EHwooKim/Algorithms path: /SWEA/D1/2070.py
count = int(input())
for i in range(1, count + 1):
so<|fim_suffix|>um2:
something = '<'
print(f'#{i} {something}')<|fim_middle|>mething = '='
num1, num2 = map(int, input().split())
if num1 > num2:
something = '>'
elif... | code_fim | medium | {
"lang": "python",
"repo": "EHwooKim/Algorithms",
"path": "/SWEA/D1/2070.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>um2:
something = '<'
print(f'#{i} {something}')<|fim_prefix|># repo: EHwooKim/Algorithms path: /SWEA/D1/2070.py
count = int(input())
for i in range(1, count + 1):
something = '='
num1, num2 = map(int, input().split())
<|fim_middle|> if num1 > num2:
something = '>'
elif... | code_fim | easy | {
"lang": "python",
"repo": "EHwooKim/Algorithms",
"path": "/SWEA/D1/2070.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> J = mean_cross_entropy_costs(X, y, lambda_reg)
cost[0] = J(thetas[0])
for i in range(1, num_iters):
thetas.append(compute_new_theta(X, y, thetas[i - 1], learning_rate, lambda_reg))
cost[i] = J(thetas[i])
return cost, thetas
def mean_cross_entropy_costs(X, y, lambda_reg=0.... | code_fim | hard | {
"lang": "python",
"repo": "bf-malefiz/Beleg-WissensRep",
"path": "/logistische_regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># def cross_entropy(X, y):
# """
# Computes the cross-entropy for a single logit value and a given target class.
# Parameters
# ----------
# X : float64 or float32
# The logit
# y : int
# The target class
# Returns
# -------
# floatX
# The cross entropy value (negative ... | code_fim | hard | {
"lang": "python",
"repo": "bf-malefiz/Beleg-WissensRep",
"path": "/logistische_regression.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bf-malefiz/Beleg-WissensRep path: /logistische_regression.py
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(X):
""" Applies the logistic function to x, element-wise. """
return 1 / (1 + np.exp(-X))
def x_strich(X):
return np.column_stack((np.ones(len(X)), X))
de... | code_fim | hard | {
"lang": "python",
"repo": "bf-malefiz/Beleg-WissensRep",
"path": "/logistische_regression.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gurer-kensho/graphql-compiler path: /scripts/generate_test_sql/events.py
# Copyright 2018-present Kensho Technologies, LLC.
from .utils import create_vertex_statement, get_random_date, get_uuid
<|fim_suffix|> """Return a SQL statement to create a Event vertex."""
field_name_to_value = {'... | code_fim | medium | {
"lang": "python",
"repo": "gurer-kensho/graphql-compiler",
"path": "/scripts/generate_test_sql/events.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return a list of SQL statements to create all event vertices."""
command_list = []
for event_name in EVENT_NAMES_LIST:
command_list.append(_create_event_statement(event_name))
return command_list<|fim_prefix|># repo: gurer-kensho/graphql-compiler path: /scripts/generate_test_... | code_fim | hard | {
"lang": "python",
"repo": "gurer-kensho/graphql-compiler",
"path": "/scripts/generate_test_sql/events.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Constructionware/spylls path: /spylls/hunspell/algo/permutations.py
"""
Note: names of methods in this module, if seem weird, are the same as in Hunspell's ``suggest.cxx``
to keep track of them.
"""
from typing import Iterator, Union, List, Set
from spylls.hunspell.data import aff
MAX_CHAR_DI... | code_fim | hard | {
"lang": "python",
"repo": "Constructionware/spylls",
"path": "/spylls/hunspell/algo/permutations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for c in trystring:
for i in reversed(range(0, len(word))):
if word[i] == c:
continue
yield word[:i] + c + word[i+1:]
def doubletwochars(word: str) -> Iterator[str]:
"""
Produces permutations with accidental two-letter-doubling fixed (vacation ... | code_fim | hard | {
"lang": "python",
"repo": "Constructionware/spylls",
"path": "/spylls/hunspell/algo/permutations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.node1.PlotNode()
self.node1.PlotSupport()
self.node1.PlotForce()
self.node2.PlotNode()
self.node2.PlotSupport()
self.node2.PlotForce()
self.rod.PlotRod()
def SaveTrussFig(self):
plt.savefig('truss.png',dpi=600)
plt.show()
''... | code_fim | hard | {
"lang": "python",
"repo": "ChengTjOrg/TrussAnalyzer2018",
"path": "/PostProcess/Truss.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChengTjOrg/TrussAnalyzer2018 path: /PostProcess/Truss.py
# -*- coding: utf-8 -*-
"""
Created on Thu May 24 18:18:36 2018
@author: Nicole
"""
from __future__ import division
import Rod
import matplotlib.pyplot as plt
import math
<|fim_suffix|> self.node1.PlotNode()
self.node1.Pl... | code_fim | hard | {
"lang": "python",
"repo": "ChengTjOrg/TrussAnalyzer2018",
"path": "/PostProcess/Truss.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paralab/SymPyGR path: /GR/bssnDerivs.py
"""
Contains derivative computation for BSSN formulation of ET equations.
"""
# first derivative
import cog
D = ["alpha", "beta0", "beta1", "beta2",
"B0", "B1", "B2",
"chi", "Gt0", "Gt1", "Gt2", "K",
"gt0", "gt1", "gt2", "gt3", "gt4", "... | code_fim | hard | {
"lang": "python",
"repo": "paralab/SymPyGR",
"path": "/GR/bssnDerivs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for deriv in FUNC_D_I:
cog.outl("\t double* "+deriv+" = (double*)malloc(sizeof(double)*n);")
for deriv in FUNC_D_IJ:
cog.outl("\t double* "+deriv+" = (double*)malloc(sizeof(double)*n);")
for deriv in FUNC_AD_I:
cog.outl("\t double* "+deriv+" = (double*)malloc(sizeof(d... | code_fim | hard | {
"lang": "python",
"repo": "paralab/SymPyGR",
"path": "/GR/bssnDerivs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def process():
if len(sys.argv) > 1:
symbols = sys.argv[1:]
else:
symbols = []
for entry in os.listdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')):
symbols.append(entry.rsplit('.', 1)[0])
for symbol in symbols:
symbol = symbol.u... | code_fim | hard | {
"lang": "python",
"repo": "whiskybar/stocks",
"path": "/candidates.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whiskybar/stocks path: /candidates.py
import requests
import datetime
import collections
import csv
import sys
import os
import os.path
History = collections.namedtuple('History', ['open', 'high', 'low', 'close', 'volume', 'adjustment'])
def history(symbol, since, until):
response = reques... | code_fim | medium | {
"lang": "python",
"repo": "whiskybar/stocks",
"path": "/candidates.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kitestring/DetectorStressQuantification path: /Modules/PlotMaker.py
import pandas as pd #@UnusedImport
import matplotlib.pyplot as plt
import matplotlib #@UnusedImport
import numpy as np #@UnusedImport
class Plotter():
def __init__(self):
self.red_hex_code = '#ff0000'
def AlkDMIonS... | code_fim | hard | {
"lang": "python",
"repo": "kitestring/DetectorStressQuantification",
"path": "/Modules/PlotMaker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
plt.ylabel('Ave. Aera Per Ion')
plt.xlabel('Sample Injections')
plt.title('Tracking Area Per Ion via Detector Measurement\nOver ~48 Hours of Continuous Sample Acquisition')
legend_h_offset, legend_v_offset = 1... | code_fim | hard | {
"lang": "python",
"repo": "kitestring/DetectorStressQuantification",
"path": "/Modules/PlotMaker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> left_idx = 0
right_idx = len(people)-1
while left_idx <= right_idx:
if people[left_idx] + people[right_idx] <= limit:
cnt += 1
left_idx += 1
right_idx -= 1
else:
cnt += 1
right_idx -= 1
answer = cnt
return ans... | code_fim | easy | {
"lang": "python",
"repo": "Yetaeng/Problem-Solving",
"path": "/programmers/Python/구명보트.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.