text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>eval_toolkit.evaluate_model(args.test_file, model, vggvox.generator_test_batch_rgb_audio, args.save_path + '/test/', args.num_classes, 16)
# def main(argv):
# data_dir = argv[1]
# txt_dir = argv[2]
# out_dir = argv[3]
#
# names = [d for d in os.listdir(txt_dir) if d.endswith('.txt')]
... | code_fim | hard | {
"lang": "python",
"repo": "linto-project/linto-sp2",
"path": "/vision/laas/preprocessing/amicorpus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linto-project/linto-sp2 path: /vision/laas/preprocessing/amicorpus.py
# from splitterkit import readwave, writewave, split, merge, combine, slicewave_s
import glob, sys, os
import models.vggvox as vggvox
import models.resnet3d as resnet3d
import argparse
from keras.optimizers import SGD,Adam
from... | code_fim | hard | {
"lang": "python",
"repo": "linto-project/linto-sp2",
"path": "/vision/laas/preprocessing/amicorpus.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>MainWindow()
mainwindow.show()
sys.exit(app.exec_())<|fim_prefix|># repo: ShudaoWei/COCTRPG_replay_pptx_generator path: /run.py
import sys
from GUI import main as ui
from PyQt5.Qt<|fim_middle|>Widgets import QApplication
from PyQt5 import QtWidgets
app = QApplication(sys.argv)
mainwindow = ui. | code_fim | medium | {
"lang": "python",
"repo": "ShudaoWei/COCTRPG_replay_pptx_generator",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShudaoWei/COCTRPG_replay_pptx_generator path: /run.py
import sys
from GUI import main as ui
from PyQt5.QtWidgets import QApplication
from PyQt5 import QtWid<|fim_suffix|>MainWindow()
mainwindow.show()
sys.exit(app.exec_())<|fim_middle|>gets
app = QApplication(sys.argv)
mainwindow = ui. | code_fim | easy | {
"lang": "python",
"repo": "ShudaoWei/COCTRPG_replay_pptx_generator",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AbelRapha/Python-Exercicios-CeV path: /Mundo 1/ex011 Pintando a Parede.py
largura = float(input("Digite a Largura da parede "))
altura = float(input("Digite a altura da parede "))
<|fim_suffix|> return l*h
pintura = area(largura, altura)/2
print(f"A area da sua parede representa {area(largur... | code_fim | easy | {
"lang": "python",
"repo": "AbelRapha/Python-Exercicios-CeV",
"path": "/Mundo 1/ex011 Pintando a Parede.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"A area da sua parede representa {area(largura,altura):.2f} m² \nSendo assim, e preciso de {pintura:.2f} litros de tinta")<|fim_prefix|># repo: AbelRapha/Python-Exercicios-CeV path: /Mundo 1/ex011 Pintando a Parede.py
largura = float(input("Digite a Largura da parede "))
altura = float(input("Digi... | code_fim | easy | {
"lang": "python",
"repo": "AbelRapha/Python-Exercicios-CeV",
"path": "/Mundo 1/ex011 Pintando a Parede.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s0: underlying price
k: strike price
t: time to expiry (in fractional years)
sigma: implied volatility percentage (e.g. 30% = 0.30)
r: risk free return rate
"""
S_0 = torch.tensor([float(s0)], requires_grad=True)
K = torch.tensor([float(k)], requires_grad=False) # don't c... | code_fim | hard | {
"lang": "python",
"repo": "kiniamogh/pygreeks",
"path": "/pygreeks/pygreeks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kiniamogh/pygreeks path: /pygreeks/pygreeks.py
import torch
from dataclasses import dataclass
# for IV calculation via root finding/gradient methods
from scipy import optimize
# these two imports are only to fix errors with py_vollib warning and
# too verbose garbage debug printing hard coded i... | code_fim | hard | {
"lang": "python",
"repo": "kiniamogh/pygreeks",
"path": "/pygreeks/pygreeks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def optionGreeksFast(option, calculateNPV=True):
"""Calculate approximate (but accurate) greeks using trickery.
Note: other than 'npv' calculation, this uses py_vollib to caluclate
greeks using fancy math workarounds. It's an estimation,
but an accurate estimation."""
if ... | code_fim | hard | {
"lang": "python",
"repo": "kiniamogh/pygreeks",
"path": "/pygreeks/pygreeks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /AtCoder_Virtual_Contest/macle_20220614/a/main.py
# -*- coding: utf-8 -*-
def main():
import sys
input = sys.stdin.readline
o = input().rstrip()
t = input().rstrip()
n = len(o)
m = len(t)
an... | code_fim | easy | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/AtCoder_Virtual_Contest/macle_20220614/a/main.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KATO-Hiro/AtCoder path: /AtCoder_Virtual_Contest/macle_20220614/a/main.py
# -*- coding: utf-8 -*-
def main():
import sys
<|fim_suffix|> print(ans)
if __name__ == "__main__":
main()<|fim_middle|> input = sys.stdin.readline
o = input().rstrip()
t = input().rstrip()
n... | code_fim | hard | {
"lang": "python",
"repo": "KATO-Hiro/AtCoder",
"path": "/AtCoder_Virtual_Contest/macle_20220614/a/main.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self, query, limit=10):
return self.search_tickets(query, limit=limit)<|fim_prefix|># repo: StackStorm-Exchange/stackstorm-zendesk path: /actions/search_tickets.py
from lib.zendesk import ZendeskAction
__all__ = [
'SearchTicketsAction'
]
<|fim_middle|>class SearchTicketsAction(... | code_fim | easy | {
"lang": "python",
"repo": "StackStorm-Exchange/stackstorm-zendesk",
"path": "/actions/search_tickets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StackStorm-Exchange/stackstorm-zendesk path: /actions/search_tickets.py
from lib.zendesk import ZendeskAction
<|fim_suffix|>
class SearchTicketsAction(ZendeskAction):
def run(self, query, limit=10):
return self.search_tickets(query, limit=limit)<|fim_middle|>__all__ = [
'SearchTi... | code_fim | easy | {
"lang": "python",
"repo": "StackStorm-Exchange/stackstorm-zendesk",
"path": "/actions/search_tickets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SearchTicketsAction(ZendeskAction):
def run(self, query, limit=10):
return self.search_tickets(query, limit=limit)<|fim_prefix|># repo: StackStorm-Exchange/stackstorm-zendesk path: /actions/search_tickets.py
from lib.zendesk import ZendeskAction
<|fim_middle|>__all__ = [
'SearchTic... | code_fim | easy | {
"lang": "python",
"repo": "StackStorm-Exchange/stackstorm-zendesk",
"path": "/actions/search_tickets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # give the client time to connect
looper.runFor(3)
# a simple message
msg = {'life_answer': 42}
# submit the request to the pool
request, = client.submit_DEPRECATED(msg)
# allow time for the request to be executed
... | code_fim | hard | {
"lang": "python",
"repo": "sshyran/hyperledger-indy-plenum",
"path": "/examples/simple_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sshyran/hyperledger-indy-plenum path: /examples/simple_client.py
#! /usr/bin/env python3
"""
This is a simple script to demonstrate a client connecting to a running
consensus pool. To see it in action, run simple_node.py in four separate
terminals, and in a fifth one, run this script.
TODO: crea... | code_fim | hard | {
"lang": "python",
"repo": "sshyran/hyperledger-indy-plenum",
"path": "/examples/simple_client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # submit the request to the pool
request, = client.submit_DEPRECATED(msg)
# allow time for the request to be executed
looper.runFor(3)
reply, status = client.getReply(request.reqId)
print('')
print('Reply: {}\n'.format(r... | code_fim | hard | {
"lang": "python",
"repo": "sshyran/hyperledger-indy-plenum",
"path": "/examples/simple_client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nexB/Lawu path: /jawa/attributes/stack_map_table.py
from itertools import repeat
from jawa.attribute import Attribute
from jawa.util.verifier import VerificationTypes
# These types are followed by an additional u2.
TYPES_WITH_EXTRA = (
VerificationTypes.ITEM_Object,
VerificationTypes.IT... | code_fim | hard | {
"lang": "python",
"repo": "nexB/Lawu",
"path": "/jawa/attributes/stack_map_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> frame.frame_stack = list(
self._unpack_verification_type_info(info, 1)
)
self.frames.append(frame)
previous_frame = frame
continue
elif frame_type < 247:
# Reserved types, we ma... | code_fim | hard | {
"lang": "python",
"repo": "nexB/Lawu",
"path": "/jawa/attributes/stack_map_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#NetworkX
try:
nx_graph = nx.read_edgelist(DATASET, nodetype=np.int32, delimiter=' ', \
create_using=nx.DiGraph())
nx_ranks = nx.pagerank(nx_graph)
df2 = pd.DataFrame({ "node": nx_ranks.keys(),
"rank": [round(e, 7) for e in nx_ranks.val... | code_fim | hard | {
"lang": "python",
"repo": "frovedis/frovedis",
"path": "/src/foreign_if/python/UT/src/pagerank/test_001.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frovedis/frovedis path: /src/foreign_if/python/UT/src/pagerank/test_001.py
'''
directed graph - ranking order confirm >> "Passed"
'''
from frovedis.exrpc.server import FrovedisServer
import os
import sys
import time
import numpy as np
import pandas as pd
import networkx as nx
import frovedis.gra... | code_fim | hard | {
"lang": "python",
"repo": "frovedis/frovedis",
"path": "/src/foreign_if/python/UT/src/pagerank/test_001.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: napoler/Terry-toolkit path: /test/new_words.py
#encoding=utf-8
from __future__ import unicode_literals
import sys
sys.path.append("../")
from harvesttext import HarvestText
import Terry_toolkit as tkit
t= tkit.Text()
t.load_ht('ht_model')
terry_words=tkit.Resource().terry_words()
t.ht.add_typed... | code_fim | hard | {
"lang": "python",
"repo": "napoler/Terry-toolkit",
"path": "/test/new_words.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>街角有只猫
发布时间:18-06-2919:16
现在,很多人都有宠物,对于他们的宠物来说,大多数人把它们当成自己的孩子来养,很宠爱,而且大多数人都有各种各样的宠物,而且更多的人不会放慢它们。由于它的出现,它现在已经成为一种受欢迎的宠物,深受人们的喜爱。
现在,大多数养宠物的人都是城市里的人。他们不需要他们做任何事情。他们害怕他们有点受伤,尤其是猫。他们经常把他们关在家里,害怕他们跑掉。毕竟,很难确定城市的方向。猫仍然对外面的世界感到好奇,很难一回来就回来。
一个网友的家里跑的是一只猫,它很可能是别人的猫跑出来的,找不到回家的路,应该像它的家一样,跑进去,还不走。
刚打开门,那只流浪猫溜进了门,试... | code_fim | medium | {
"lang": "python",
"repo": "napoler/Terry-toolkit",
"path": "/test/new_words.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, args, workspaces):
for host in myhosts.get_hosts(enabled=False):
logging.debug("HC:CONS %s", host)
if util.is_localhost(host['name']):
logging.debug("HC:SKIP %s", host['name'])
continue
if myhosts.is_disable... | code_fim | medium | {
"lang": "python",
"repo": "gae123/sd2",
"path": "/src/lib/sd2/host_connections.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for host in myhosts.get_hosts(enabled=False):
logging.debug("HC:CONS %s", host)
if util.is_localhost(host['name']):
logging.debug("HC:SKIP %s", host['name'])
continue
if myhosts.is_disabled(host['name']):
cmd = hos... | code_fim | medium | {
"lang": "python",
"repo": "gae123/sd2",
"path": "/src/lib/sd2/host_connections.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gae123/sd2 path: /src/lib/sd2/host_connections.py
#!/usr/bin/env python
#############################################################################
# Copyright (c) 2017 SiteWare Corp. All right reserved
#############################################################################
'''In this mod... | code_fim | medium | {
"lang": "python",
"repo": "gae123/sd2",
"path": "/src/lib/sd2/host_connections.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># http://www.w3.org/TR/PNG/#D-CRCAppendix
class PNG_CHUNK(Structure):
type_name = 'PNG_CHUNK';
def __init__(self, stream, offset, max_size, parent, name):
import C;
from PNG_CRC32 import PNG_CRC32;
Structure.__init__(self, stream, offset, max_size, parent, name);
self._length ... | code_fim | hard | {
"lang": "python",
"repo": "SkyLined/headsup",
"path": "/decode/PNG_CHUNK.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._ancillary = None;
char1 = self._type.value[0];
if char1 >= 'A' and char1 <= 'Z':
self._type.notes.append('critical');
self._ancillary = True;
if self._type.value not in ['IHDR', 'PLTE', 'IDAT', 'IEND']:
self._type.warnings.append( \
'expected ... | code_fim | hard | {
"lang": "python",
"repo": "SkyLined/headsup",
"path": "/decode/PNG_CHUNK.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SkyLined/headsup path: /decode/PNG_CHUNK.py
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | code_fim | hard | {
"lang": "python",
"repo": "SkyLined/headsup",
"path": "/decode/PNG_CHUNK.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justlonger/lms path: /tests/unit/lms/views/admin_test.py
from unittest.mock import sentinel
import pytest
from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound
from lms.services import ApplicationInstanceNotFound
from lms.views.admin import AdminViews, logged_out, notfound
from tests.... | code_fim | hard | {
"lang": "python",
"repo": "justlonger/lms",
"path": "/tests/unit/lms/views/admin_test.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_update_instance_not_found(
self, pyramid_request, application_instance_service
):
application_instance_service.get.side_effect = ApplicationInstanceNotFound
pyramid_request.matchdict["consumer_key"] = sentinel.consumer_key
with pytest.raises(HTTPNotFound):... | code_fim | hard | {
"lang": "python",
"repo": "justlonger/lms",
"path": "/tests/unit/lms/views/admin_test.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # advance day from Monday, 1 Jan 1900 to 1 Jan 1901
start_year = 1900
leap_days = 1 if cal.is_leap_year(start_year) else 0
num_days = Day.MONDAY.value + cal.DAYS_IN_YEAR + leap_days
day = Day(num_days % cal.DAYS_IN_WEEK)
# count occurrences of DAY_OF_WEEK on the first of each mont... | code_fim | hard | {
"lang": "python",
"repo": "curtislb/ProjectEuler",
"path": "/py/problem_019.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def solve() -> int:
# advance day from Monday, 1 Jan 1900 to 1 Jan 1901
start_year = 1900
leap_days = 1 if cal.is_leap_year(start_year) else 0
num_days = Day.MONDAY.value + cal.DAYS_IN_YEAR + leap_days
day = Day(num_days % cal.DAYS_IN_WEEK)
# count occurrences of DAY_OF_WEEK on t... | code_fim | hard | {
"lang": "python",
"repo": "curtislb/ProjectEuler",
"path": "/py/problem_019.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: curtislb/ProjectEuler path: /py/problem_019.py
#!/usr/bin/env python3
"""problem_019.py
Problem 19: Counting Sundays
You are given the following information, but you may prefer to do some research
for yourself.
- 1 Jan 1900 was a Monday.
- Thirty days has September,
April, June and November... | code_fim | hard | {
"lang": "python",
"repo": "curtislb/ProjectEuler",
"path": "/py/problem_019.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>PERMISOS = [{'code_nombre': 'crea_solicitud_reparacion',
'nombre': 'Tiene permiso para crear una solicitud de reparación',
'menu': 'acceso_reparaciones'
},
{'code_nombre': 'borra_solicitud_reparacion',
'nombre': 'Tiene permiso para borrar cua... | code_fim | hard | {
"lang": "python",
"repo": "jjmartinr01/gauss3",
"path": "/reparaciones/configuration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjmartinr01/gauss3 path: /reparaciones/configuration.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
TIPO = 'selectable' # 'basic' or 'selectable'. 'basic': necesario para el funcionamiento del programa
# 'selectable': No necesario. Añade nuevas func... | code_fim | hard | {
"lang": "python",
"repo": "jjmartinr01/gauss3",
"path": "/reparaciones/configuration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask_in = 2**32 - 2**28
mask_lo = 2**28 - 2**14
mask_hi = 2**14 - 2**0
# retrieve the lo and hi data
lo = core.Operand((data & mask_lo) >> 14)
hi = core.Operand(data & mask_hi)
# retrieve the opcode
ins = (data & mask_in) >> 28
opco... | code_fim | hard | {
"lang": "python",
"repo": "jdowner/lrc",
"path": "/lrc/interpreter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @asyncio.coroutine
def tick():
try:
opcode = self.interpret(memory.read(memory.ptr))
logger.debug("@{}: {} {} {}".format(
memory.ptr,
opcode.mneumonic,
opcode.lo,
opc... | code_fim | hard | {
"lang": "python",
"repo": "jdowner/lrc",
"path": "/lrc/interpreter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdowner/lrc path: /lrc/interpreter.py
import asyncio
import logging
import traceback
from . import core
logger = logging.getLogger(__name__)
class UnrecognizedInstruction(Exception):
pass
class SegmentationFault(Exception):
pass
class Interpreter(object):
def __init__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "jdowner/lrc",
"path": "/lrc/interpreter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def s3_public_settings(act, credentials):
s3 = boto3.client('s3control',
aws_access_key_id=credentials['AccessKeyId'],
aws_secret_access_key=credentials['SecretAccessKey'],
aws_session_token=credentials['SessionToken'],
... | code_fim | hard | {
"lang": "python",
"repo": "teroahonen-vungle/aws-innovation-sandbox",
"path": "/source/Lambda/utils/innovation_sbx_helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: teroahonen-vungle/aws-innovation-sandbox path: /source/Lambda/utils/innovation_sbx_helpers.py
from __future__ import print_function
import boto3
import time
from boto3.session import Session
import sys, traceback
import json
import uuid
import requests
import botocore
from botocore.config import ... | code_fim | hard | {
"lang": "python",
"repo": "teroahonen-vungle/aws-innovation-sandbox",
"path": "/source/Lambda/utils/innovation_sbx_helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rom .auth.oauth import OAuthToken
from .auth.oauth import OAuthUserInfo<|fim_prefix|># repo: Thinkful/docusign-esign-python-client path: /docusign_esign/client/__init__.py
from __future__ import absolute_import
# import auth modules into client package
from .auth.oauth import Account
from .auth.oauth im... | code_fim | medium | {
"lang": "python",
"repo": "Thinkful/docusign-esign-python-client",
"path": "/docusign_esign/client/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Thinkful/docusign-esign-python-client path: /docusign_esign/client/__init__.py
from __future__ import absolute_import
# import auth modules into cli<|fim_suffix|>anization
from .auth.oauth import Link
from .auth.oauth import OAuth
from .auth.oauth import OAuthToken
from .auth.oauth import OAuthU... | code_fim | medium | {
"lang": "python",
"repo": "Thinkful/docusign-esign-python-client",
"path": "/docusign_esign/client/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lcsm29/project-euler path: /py/py_0457_a_polynomial_modulo_the_square_of_a_prime.py
# Solution of;
# Project Euler Problem 457: A polynomial modulo the square of a prime
# https://projecteuler.net/problem=457
#
# Let f(n) = n2 - 3n - 1. Let p be a prime. Let R(p) be the smallest positive
# inte... | code_fim | medium | {
"lang": "python",
"repo": "lcsm29/project-euler",
"path": "/py/py_0457_a_polynomial_modulo_the_square_of_a_prime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
n = 1000
i = 10000
prob_id = 457
timed.caller(dummy, n, i, prob_id)<|fim_prefix|># repo: lcsm29/project-euler path: /py/py_0457_a_polynomial_modulo_the_square_of_a_prime.py
# Solution of;
# Project Euler Problem 457: A polynomial modulo the square of a prime
# h... | code_fim | medium | {
"lang": "python",
"repo": "lcsm29/project-euler",
"path": "/py/py_0457_a_polynomial_modulo_the_square_of_a_prime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@register.filter
def url(id):
data = Story.objects.filter(story_id=id).first()
if data:
if data.types == 'comment':
datas = Story.objects.filter(story_id=data.id).first()
if datas:
return datas.get_absolute_url()
return data.get_absolute_url... | code_fim | hard | {
"lang": "python",
"repo": "damiso15/quickcheck",
"path": "/news/templatetags/custom_tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.filter
def url(id):
data = Story.objects.filter(story_id=id).first()
if data:
if data.types == 'comment':
datas = Story.objects.filter(story_id=data.id).first()
if datas:
return datas.get_absolute_url()
return data.get_absolute_url(... | code_fim | hard | {
"lang": "python",
"repo": "damiso15/quickcheck",
"path": "/news/templatetags/custom_tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: damiso15/quickcheck path: /news/templatetags/custom_tags.py
from news.models import Comment, Story
from django import template
register = template.Library()
@register.filter
def title(id):
<|fim_suffix|>
@register.filter
def url(id):
data = Story.objects.filter(story_id=id).first()
if ... | code_fim | hard | {
"lang": "python",
"repo": "damiso15/quickcheck",
"path": "/news/templatetags/custom_tags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>SCRIPTS.setdefault("all", []).append(_)
SCRIPTS.setdefault("bash", []).append(_)<|fim_prefix|># repo: steev/etest path: /etest_test/fixtures_test/scripts_test/7dacf8800b53497cbbfb13603c46fd64.py
"""For loop with unencapsulated word list."""
# pylint: disable=C0103
import textwrap
from etest_test.fixtur... | code_fim | hard | {
"lang": "python",
"repo": "steev/etest",
"path": "/etest_test/fixtures_test/scripts_test/7dacf8800b53497cbbfb13603c46fd64.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from etest_test.fixtures_test.scripts_test import SCRIPTS
_ = {
"uuid": "7dacf8800b53497cbbfb13603c46fd64",
"description": "for loop with unencapsulated word list",
"text": textwrap.dedent(
"""
for test in test.py selftest.py selftest2.py; do
echo foo
done
... | code_fim | medium | {
"lang": "python",
"repo": "steev/etest",
"path": "/etest_test/fixtures_test/scripts_test/7dacf8800b53497cbbfb13603c46fd64.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steev/etest path: /etest_test/fixtures_test/scripts_test/7dacf8800b53497cbbfb13603c46fd64.py
"""For loop with unencapsulated word list."""
# pylint: disable=C0103
<|fim_suffix|>from etest_test.fixtures_test.scripts_test import SCRIPTS
_ = {
"uuid": "7dacf8800b53497cbbfb13603c46fd64",
"d... | code_fim | medium | {
"lang": "python",
"repo": "steev/etest",
"path": "/etest_test/fixtures_test/scripts_test/7dacf8800b53497cbbfb13603c46fd64.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/AlipayOpenIotmbsOrderprintreceiptQueryModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenIotmbsOrderprintreceiptQueryModel(object):
def __init__(s... | code_fim | medium | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayOpenIotmbsOrderprintreceiptQueryModel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m3rryqold/sagefy path: /server/routes/set.py
from framework.routes import get, post, abort
from models.set import Set
from models.unit import Unit
from framework.session import get_current_user
from modules.sequencer.traversal import traverse, judge
from modules.sequencer.card_chooser import choo... | code_fim | hard | {
"lang": "python",
"repo": "m3rryqold/sagefy",
"path": "/server/routes/set.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> set_ = Set.get_latest_accepted(db_conn, set_id)
# Pull a list of up to 5 units to choose from based on priority.
buckets = traverse(db_conn, current_user, set_)
units = buckets['learn'][:5]
# TODO-3 Time estimates per unit for mastery.
return 200, {
'next': next_,
... | code_fim | hard | {
"lang": "python",
"repo": "m3rryqold/sagefy",
"path": "/server/routes/set.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@get('/s/sets/{set_id}/units')
def get_set_units_route(request, set_id):
"""
Present a small number of units the learner can choose from.
NEXT STATE
GET Choose Unit
-> POST Choose Unit
"""
db_conn = request['db_conn']
# TODO-3 simplify this method. should it be part ... | code_fim | hard | {
"lang": "python",
"repo": "m3rryqold/sagefy",
"path": "/server/routes/set.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michalbachowski/pygrapes path: /examples/_path.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
<|fim_suffix|> p = os.path.join(os.path.dirname(__file__), '../src/')
if p not in sys.path:
sys.path.insert(0, p)
if "__main__" == __name__:
fix()<|fim_middle|... | code_fim | easy | {
"lang": "python",
"repo": "michalbachowski/pygrapes",
"path": "/examples/_path.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if "__main__" == __name__:
fix()<|fim_prefix|># repo: michalbachowski/pygrapes path: /examples/_path.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
<|fim_middle|>def fix():
p = os.path.join(os.path.dirname(__file__), '../src/')
if p not in sys.path:
sys.path.in... | code_fim | medium | {
"lang": "python",
"repo": "michalbachowski/pygrapes",
"path": "/examples/_path.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update(self):
if not self.leagueid:
self._setup()
matches = self.getMatches()
current = [x for x in self.matches if x in matches]
current += [x for x in matches if x not in self.matches]
self.matches = current
if self.matches:
... | code_fim | hard | {
"lang": "python",
"repo": "elParaguayo/qtile-widget-livefootballscores",
"path": "/livefootballscores/footballscores/league.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elParaguayo/qtile-widget-livefootballscores path: /livefootballscores/footballscores/league.py
from datetime import datetime
import requests
from .base import matchcommon
from .footballmatch import FootballMatch
API_BASE = "http://push.api.bbci.co.uk"
class League(matchcommon):
leaguelin... | code_fim | hard | {
"lang": "python",
"repo": "elParaguayo/qtile-widget-livefootballscores",
"path": "/livefootballscores/footballscores/league.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = indexes.CharField(document=True, use_template=True)
string1_auto = indexes.NgramField(model_attr="string1")
string2_auto = indexes.NgramField(model_attr="string2")
string3_auto = indexes.NgramField(model_attr="string3")
string4_auto = indexes.NgramField(model_attr="string4")
... | code_fim | medium | {
"lang": "python",
"repo": "cdignam8304/django-gendata-scale",
"path": "/mysite/main/search_indexes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cdignam8304/django-gendata-scale path: /mysite/main/search_indexes.py
# import datetime
from haystack import indexes
from .models import Generic
# Check out this page for querying the whoosh_index!
# https://stackoverflow.com/questions/2395675/whoosh-index-viewer
# Elasticsearch installation an... | code_fim | medium | {
"lang": "python",
"repo": "cdignam8304/django-gendata-scale",
"path": "/mysite/main/search_indexes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Generic
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
# return self.get_model().objects.filter(hack_published__lte=datetime.datetime.now())
return self.get_model().objects.all()<|fim_prefix|># repo: cdignam8304/djan... | code_fim | hard | {
"lang": "python",
"repo": "cdignam8304/django-gendata-scale",
"path": "/mysite/main/search_indexes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get all cells under the rect"""
x_min = self.clampx((rect.left - self._origin.x) // self._cell_size[0])
x_max = self.clampx((rect.right - self._origin.x) // self._cell_size[0])
y_min = self.clampy((rect.top - self._origin.y) // self._cell_size[1])
y_max = self.cl... | code_fim | hard | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/SpacialHash.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Boris-Barboris/PySubs path: /engine/SpacialHash.py
# Copyright Alexander Baranin 2016
from sfml.graphics import *
from sfml.system import Vector2
import weakref
# 2D hash intended for GUI and overlay mouse lick handling
# works with static Rectangles. References objects weakly.
class Fixed2D... | code_fim | hard | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/SpacialHash.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return int(max(0, min(index, self._cell_count[0] - 1)))
def clampy(self, index):
return int(max(0, min(index, self._cell_count[1] - 1)))
def register(self, rect, obj):
x_min = self.clampx((rect.left - self._origin.x) // self._cell_size[0])
x_max = self.clampx((rec... | code_fim | hard | {
"lang": "python",
"repo": "Boris-Barboris/PySubs",
"path": "/engine/SpacialHash.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isabella232/pigweed path: /pw_bloat/py/pw_bloat/bloat.py
# Copyright 2019 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache... | code_fim | hard | {
"lang": "python",
"repo": "isabella232/pigweed",
"path": "/pw_bloat/py/pw_bloat/bloat.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_bloaty(
filename: str,
config: str,
base_file: Optional[str] = None,
data_sources: Iterable[str] = (),
extra_args: Iterable[str] = ()
) -> bytes:
"""Executes a Bloaty size report on some binary file(s).
Args:
filename: Path to the binary.
config: Path ... | code_fim | hard | {
"lang": "python",
"repo": "isabella232/pigweed",
"path": "/pw_bloat/py/pw_bloat/bloat.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enodr/whats_that_code path: /whats_that_code/extension_based.py
"""
Guess by extension
"""
import os
from typing import List
from whats_that_code.known_languages import FILE_EXTENSIONS
def guess_by_extension(file_name: str = "", text: str = "") -> List[str]:
<|fim_suffix|> for key, value in... | code_fim | hard | {
"lang": "python",
"repo": "enodr/whats_that_code",
"path": "/whats_that_code/extension_based.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not extension_part:
return []
guesses = set()
extensions = []
if file_name:
# TODO: use
extensions.append(extension_part)
if text:
words = [_ for _ in text.split(" ") if "." in _]
for word in words:
if word.endswith("."):
... | code_fim | medium | {
"lang": "python",
"repo": "enodr/whats_that_code",
"path": "/whats_that_code/extension_based.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: badgercl/scrappers-congreso-chile path: /diputados_votaciones.py
import requests
from bs4 import BeautifulSoup
import json
import re
import pprint
def get_name_and_id(diputado):
res = []
nombre = diputado.text.strip()
link = diputado.attrs['href']
dip_id = p.match(link).group(1)
return {
... | code_fim | hard | {
"lang": "python",
"repo": "badgercl/scrappers-congreso-chile",
"path": "/diputados_votaciones.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
n_boletin = soup.find_all('h2')[3].text.strip().replace('Boletín N° ','')
dia = soup.find_all('div','stress')[0].find_all('p')[0].text.split()[1]
mes = soup.find_all('div','stress')[0].find_all('p')[0].text.split()[3]
anno = soup.find_all('div','stress')[0].find_all('p')[0].text.split()[5]
hora = soup.fi... | code_fim | hard | {
"lang": "python",
"repo": "badgercl/scrappers-congreso-chile",
"path": "/diputados_votaciones.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yezhengli-Mr9/ExtremeNet path: /db/datasets.py
from db.coco import MSCOCO
from db.coco_extreme import MSCOCOExtreme
from db.medical_extreme import medicalExt<|fim_suffix|>me": MSCOCOExtreme,
"medicalExtreme":medicalExtreme
}<|fim_middle|>reme
datasets = {
"MSCOCO": MSCOCO,
"MSCOCOEx... | code_fim | easy | {
"lang": "python",
"repo": "yezhengli-Mr9/ExtremeNet",
"path": "/db/datasets.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>me": MSCOCOExtreme,
"medicalExtreme":medicalExtreme
}<|fim_prefix|># repo: yezhengli-Mr9/ExtremeNet path: /db/datasets.py
from db.coco import MSCOCO
from db.coco_extreme import <|fim_middle|>MSCOCOExtreme
from db.medical_extreme import medicalExtreme
datasets = {
"MSCOCO": MSCOCO,
"MSCOCOEx... | code_fim | medium | {
"lang": "python",
"repo": "yezhengli-Mr9/ExtremeNet",
"path": "/db/datasets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Generates the lists of positions for each motor during the 'grid_scan'.
Parameters
----------
args: list
list of arguments, same as the parameter `args` of the `grid_scan`
snake_axes: None, True, False or iterable
same meaning as `snake_axes` parameter of the `... | code_fim | hard | {
"lang": "python",
"repo": "ericdill/bluesky",
"path": "/bluesky/tests/test_plans.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert set(positions.keys()) == set(positions_expected.keys()), \
"Different set of motors in dictionaries of actual and expected positions"
# The dictionary of the initial postiions
motor_pos_shift = {_motor.name: _pos for (_motor, _pos) in zip(motors, motors_pos)}
for name in p... | code_fim | hard | {
"lang": "python",
"repo": "ericdill/bluesky",
"path": "/bluesky/tests/test_plans.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ericdill/bluesky path: /bluesky/tests/test_plans.py
p.pseudo2, -2, -1))
tb1 = db[rs].table().drop('time', 1)
assert p.position == base_pos
# this triggers this does not
rs, = RE(bp.relative_inner_product_scan([p],
... | code_fim | hard | {
"lang": "python",
"repo": "ericdill/bluesky",
"path": "/bluesky/tests/test_plans.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arthur-yatsun/apache_beam_snippets path: /windowing/batch_fixed_window.py
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from utils import GetElementTimestamp, PrettyPrint
from samples import samples
<|fim_suffix|> windowed_elements = (
... | code_fim | medium | {
"lang": "python",
"repo": "arthur-yatsun/apache_beam_snippets",
"path": "/windowing/batch_fixed_window.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> (
windowed_elements
| beam.combiners.Count.PerKey()
| beam.Map(lambda x: f'Count is {x[1]}')
| beam.ParDo(GetElementTimestamp())
| PrettyPrint()
)<|fim_prefix|># repo: arthur-yatsun/apache_beam_snippets path: /windowing/batch_fix... | code_fim | hard | {
"lang": "python",
"repo": "arthur-yatsun/apache_beam_snippets",
"path": "/windowing/batch_fixed_window.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kade-robertson/tone-deaf path: /tone_deaf/chords/d_chords.py
# D Chords are for string / list / set manipulation
import itertools
from random import shuffle
def reverse_str(stack):
s = stack.pop()
stack.push(s[::-1])
def shuffle_str(stack):
s = stack.pop()
if isinstance(s, str)... | code_fim | hard | {
"lang": "python",
"repo": "kade-robertson/tone-deaf",
"path": "/tone_deaf/chords/d_chords.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> z = stack.pop()
l = list()
if z <= 1:
return
while z > 0:
l.insert(0, stack.pop())
z -= 1
n = None
if all(isinstance(x, str) for x in l):
n = ''.join(''.join(x) for x in (list(itertools.zip_longest(*l, fillvalue = ''))))
else:
n = list(it... | code_fim | hard | {
"lang": "python",
"repo": "kade-robertson/tone-deaf",
"path": "/tone_deaf/chords/d_chords.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def interleave_n(stack):
z = stack.pop()
l = list()
if z <= 1:
return
while z > 0:
l.insert(0, stack.pop())
z -= 1
n = None
if all(isinstance(x, str) for x in l):
n = ''.join(''.join(x) for x in (list(itertools.zip_longest(*l, fillvalue = ''))))
... | code_fim | hard | {
"lang": "python",
"repo": "kade-robertson/tone-deaf",
"path": "/tone_deaf/chords/d_chords.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BlueQuartzSoftware/EasyBake path: /ht_widgets/deselectable_list_view.py
from PySide2.QtWidgets import QListView
from PySide2.QtCore import QObject, Signal
class DeselectableListView(QListView):
selectionCleared = Signal()
<|fim_suffix|> self.clearSelection()
QListVi... | code_fim | easy | {
"lang": "python",
"repo": "BlueQuartzSoftware/EasyBake",
"path": "/ht_widgets/deselectable_list_view.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def mousePressEvent(self, event):
self.clearSelection()
QListView.mousePressEvent(self, event)
self.selectionCleared.emit()<|fim_prefix|># repo: BlueQuartzSoftware/EasyBake path: /ht_widgets/deselectable_list_view.py
from PySide2.QtWidgets import QListView
from PySide2.QtCore... | code_fim | medium | {
"lang": "python",
"repo": "BlueQuartzSoftware/EasyBake",
"path": "/ht_widgets/deselectable_list_view.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> selectionCleared = Signal()
def mousePressEvent(self, event):
self.clearSelection()
QListView.mousePressEvent(self, event)
self.selectionCleared.emit()<|fim_prefix|># repo: BlueQuartzSoftware/EasyBake path: /ht_widgets/deselectable_list_view.py
from PySide2.QtWidgets imp... | code_fim | easy | {
"lang": "python",
"repo": "BlueQuartzSoftware/EasyBake",
"path": "/ht_widgets/deselectable_list_view.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @skin_id_list.setter
def skin_id_list(self, value):
if isinstance(value, list):
self._skin_id_list = list()
for i in value:
self._skin_id_list.append(i)
@property
def user_id(self):
return self._user_id
@user_id.setter
def us... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayCommerceSportsFacepayskinBatchqueryModel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/AlipayCommerceSportsFacepayskinBatchqueryModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceSportsFacepayskinBatchqueryModel(object):
def __in... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayCommerceSportsFacepayskinBatchqueryModel.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._open_id
@open_id.setter
def open_id(self, value):
self._open_id = value
@property
def skin_id_list(self):
return self._skin_id_list
@skin_id_list.setter
def skin_id_list(self, value):
if isinstance(value, list):
self._skin_... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/domain/AlipayCommerceSportsFacepayskinBatchqueryModel.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('base', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='Thumnail',
field=models.ImageField(blank=True, default='placeholder.png', null=True, upload_to='images'),
),
migrations... | code_fim | medium | {
"lang": "python",
"repo": "palawong12/ThanatipPort",
"path": "/base/migrations/0002_auto_20201013_0823.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: palawong12/ThanatipPort path: /base/migrations/0002_auto_20201013_0823.py
# Generated by Django 3.1.1 on 2020-10-13 01:23
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
model_name='post'... | code_fim | medium | {
"lang": "python",
"repo": "palawong12/ThanatipPort",
"path": "/base/migrations/0002_auto_20201013_0823.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='post',
name='Thumnail',
field=models.ImageField(blank=True, default='placeholder.png', null=True, upload_to='images'),
),
migrations.AlterField(
model_name='post',
name='... | code_fim | medium | {
"lang": "python",
"repo": "palawong12/ThanatipPort",
"path": "/base/migrations/0002_auto_20201013_0823.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmcbrayer/lambda_converters path: /app/pythonocc/lib/OCC/GccIter.py
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version... | code_fim | hard | {
"lang": "python",
"repo": "dmcbrayer/lambda_converters",
"path": "/app/pythonocc/lib/OCC/GccIter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def register_handle(handle, base_object):
"""
Inserts the handle into the base object to
prevent memory corruption in certain cases
"""
try:
if base_object.IsKind("Standard_Transient"):
base_object.thisHandle = handle
base_object.thisown = False
exce... | code_fim | hard | {
"lang": "python",
"repo": "dmcbrayer/lambda_converters",
"path": "/app/pythonocc/lib/OCC/GccIter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VedangJoshi/benchmark_harness path: /models/machines/aarch64_model.py
#!/usr/bin/env python3
from models.machines.MachineModel import MachineModel
class ModelImplementation(MachineModel):
def __init__(self):
super().__init__()
self.arch = 'aarch64'
<|fim_suffix|> elif... | code_fim | hard | {
"lang": "python",
"repo": "VedangJoshi/benchmark_harness",
"path": "/models/machines/aarch64_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif int(self.cpu_info['Core(s) per socket']) == 28 and \
int(self.cpu_info['NUMA node(s)']) == 2:
return "ThunderX2"<|fim_prefix|># repo: VedangJoshi/benchmark_harness path: /models/machines/aarch64_model.py
#!/usr/bin/env python3
from models.machines.MachineModel import... | code_fim | hard | {
"lang": "python",
"repo": "VedangJoshi/benchmark_harness",
"path": "/models/machines/aarch64_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
d=ds.DateTime()
date1=str(d[0])+"-"+str(d[1])+"-"+str(d[2])+" "+str(d[4])+":"+str(d[5])
lcd.putstr(date1)
time.sleep(1)
lcd.clear()
d=ds.DateTime()
date2=str(d[0])+"-"+str(d[1])+"-"+str(d[2])+" "+str(d[4])+" "+str(d[5])
lcd.putstr(date2)
time.sleep(1)
lc... | code_fim | medium | {
"lang": "python",
"repo": "maysrp/pico_micropython",
"path": "/DS1302/LCD1602_clock/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maysrp/pico_micropython path: /DS1302/LCD1602_clock/main.py
import DS1302
from machine import I2C, Pin
from esp8266_i2c_lcd import I2cLcd
import time
DEFAULT_I2C_ADDR = 0x27
i2c = I2C(0,sda=Pin(0),scl=Pin(1),freq=400000)
lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR, 2, 16)
<|fim_suffix|>while True:
d=... | code_fim | medium | {
"lang": "python",
"repo": "maysrp/pico_micropython",
"path": "/DS1302/LCD1602_clock/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biozz/papi-sdk-python path: /papi_sdk/tests/mocked_data/init_partners.py
init_partner_error_response = {
"debug":<|fim_suffix|>"debug": None, "error": None, "status": "ok"}<|fim_middle|> None,
"error": "invalid_cvc",
"status": "error",
}
init_partner_ok_response = { | code_fim | medium | {
"lang": "python",
"repo": "biozz/papi-sdk-python",
"path": "/papi_sdk/tests/mocked_data/init_partners.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"debug": None, "error": None, "status": "ok"}<|fim_prefix|># repo: biozz/papi-sdk-python path: /papi_sdk/tests/mocked_data/init_partners.py
init_partner_error_response = {
"debug": None,
"error": "invalid_cvc",
"stat<|fim_middle|>us": "error",
}
init_partner_ok_response = { | code_fim | easy | {
"lang": "python",
"repo": "biozz/papi-sdk-python",
"path": "/papi_sdk/tests/mocked_data/init_partners.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_comment_doesnt_escape() -> None:
assert render_html(comment_doesnt_escape()) == '<!-- <input> -->'<|fim_prefix|># repo: gvx/generate-html path: /tests/test_comments.py
from generate_html import comment, fragment, render_html, tag
from typing import Iterator
@fragment
def simple_comment() ... | code_fim | medium | {
"lang": "python",
"repo": "gvx/generate-html",
"path": "/tests/test_comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert render_html(comment_doesnt_escape()) == '<!-- <input> -->'<|fim_prefix|># repo: gvx/generate-html path: /tests/test_comments.py
from generate_html import comment, fragment, render_html, tag
from typing import Iterator
@fragment
def simple_comment() -> Iterator:
yield comment('hi')
@fra... | code_fim | medium | {
"lang": "python",
"repo": "gvx/generate-html",
"path": "/tests/test_comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.