text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>class RequestQueueQuotaControl(QuotaControl):
def __init__(self,
max_request_queue_size: int,
max_node_quota: Quota,
max_client_quota: Quota):
self._max_request_queue_size = max_request_queue_size
self._max_node_quota = max_node_quota
... | code_fim | hard | {
"lang": "python",
"repo": "hyperledger/indy-plenum",
"path": "/plenum/server/quota_control.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyperledger/indy-plenum path: /plenum/server/quota_control.py
from abc import ABC, abstractmethod
from stp_zmq.zstack import Quota
class QuotaControl(ABC):
@abstractmethod
def update_state(self, state: dict):
pass
@property
@abstractmethod
def node_quota(self) -> Q... | code_fim | hard | {
"lang": "python",
"repo": "hyperledger/indy-plenum",
"path": "/plenum/server/quota_control.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def conv3_block(input, k=1, reg=None):
init = input
x = Activation('swish')(input)
x = Convolution2D(64 * k, (3, 3), padding='same', kernel_initializer='he_normal',
kernel_regularizer=reg,
use_bias=False)(x)
x = Activation('swish')(x)
x = Con... | code_fim | hard | {
"lang": "python",
"repo": "pkulwj1994/TF2-Energy-Based-Models",
"path": "/wrn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkulwj1994/TF2-Energy-Based-Models path: /wrn.py
from tensorflow.keras.layers import Convolution2D, AveragePooling2D
from tensorflow.keras.layers import Input, Add, Activation, Flatten, Dense
from tensorflow.keras.models import Model
def initial_conv(input, reg=None):
x = Convolution2D(16, ... | code_fim | hard | {
"lang": "python",
"repo": "pkulwj1994/TF2-Energy-Based-Models",
"path": "/wrn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def conv2_block(input, k=1, reg=None):
init = input
x = Activation('swish')(input)
x = Convolution2D(32 * k, (3, 3), padding='same', kernel_initializer='he_normal',
kernel_regularizer=reg,
use_bias=False)(x)
x = Activation('swish')(x)
x = Co... | code_fim | hard | {
"lang": "python",
"repo": "pkulwj1994/TF2-Energy-Based-Models",
"path": "/wrn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while i < self.N:
self.tree[i] += v
i += self.__lsb(i)
# Set index i to be equal to v, O(long(n))
def set(self, i, v):
self.__add(i, v - self.sum(i, i))
def __repr__(self):
return self.tree
# Fenwick Tree range update and point query
class Fe... | code_fim | hard | {
"lang": "python",
"repo": "angshumanHalder/discord-bot",
"path": "/src/code/data-structures/FenwickTree/FenwickTree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: angshumanHalder/discord-bot path: /src/code/data-structures/FenwickTree/FenwickTree.py
from typing import Final
# Fenwick Tree range query and point update
class FenwickTreeRangeQueryAndPointUpdate:
# Construct a Fenwick Tree with an initial set of values.
# The values must be one based... | code_fim | hard | {
"lang": "python",
"repo": "angshumanHalder/discord-bot",
"path": "/src/code/data-structures/FenwickTree/FenwickTree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nonNoise/akilib path: /examples/raspberrypi/akilib/raspberrypi/AKI_SC1602BSLB.py
# -*- coding: utf-8 -*-
############################################################
#The MIT License (MIT)
#Copyright (c) 2015 Yuta KItagami
#Project: https://github.com/nonNoise/akilib
#########################... | code_fim | hard | {
"lang": "python",
"repo": "nonNoise/akilib",
"path": "/examples/raspberrypi/akilib/raspberrypi/AKI_SC1602BSLB.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # "Clear Display"
self.LCD_Write(0,0x01);
self.LCD_Write(0,0x02);
def WritePos(self,Row,Col):
if(Row == 0) :
Row = 0x00
elif(Row == 1) :
Row = 0x40
elif(Row == 2) :
Row = 0x14
elif(Row == 3) :
... | code_fim | hard | {
"lang": "python",
"repo": "nonNoise/akilib",
"path": "/examples/raspberrypi/akilib/raspberrypi/AKI_SC1602BSLB.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = name[len("Caffe2Detectron/COCO/") :]
url = ModelCatalog.C2_DETECTRON_MODELS[name]
if "keypoint_rcnn" in name:
dataset = ModelCatalog.C2_DATASET_COCO_KEYPOINTS
else:
dataset = ModelCatalog.C2_DATASET_COCO
if "35998355/rpn_R-50-C4_1x" i... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/dev/cv/image_classification/SlowFast_ID0646_for_PyTorch/detectron2/detectron2/checkpoint/catalog.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/dev/cv/image_classification/SlowFast_ID0646_for_PyTorch/detectron2/detectron2/checkpoint/catalog.py
#
# BSD 3-Clause License
#
# Copyright (c) 2017 xxxx
# All rights reserved.
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Redistribution and use in source... | code_fim | hard | {
"lang": "python",
"repo": "Ascend/ModelZoo-PyTorch",
"path": "/PyTorch/dev/cv/image_classification/SlowFast_ID0646_for_PyTorch/detectron2/detectron2/checkpoint/catalog.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aferaudo/mills-game path: /fuffa_team_mulino.py
import sys, getopt
from src.communication.mysocket import MySocket
from core.algorithm.aima_alg import *
from src.gameImplementations.evaluation import *
import time
GameState = namedtuple('GameState', 'to_move, utility, board, moves, w_board, b_bo... | code_fim | hard | {
"lang": "python",
"repo": "aferaudo/mills-game",
"path": "/fuffa_team_mulino.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Attendo lo stato iniziale")
state_board = python_socket.receive()
print(state_board)
if our_color == 'B':
# Attendo la mossa bianca
state_board = python_socket.receive()
current_state = string_to_state(state_board, our_color)
print(current_state)
... | code_fim | hard | {
"lang": "python",
"repo": "aferaudo/mills-game",
"path": "/fuffa_team_mulino.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # prendiamo in ingresso da terminale il colore del giocatore
depth = 12
depth_opponent = depth
time_depth = 58
colored = False
our_color = None
try:
opts, args = getopt.getopt(argv, "wbht:d:")
except getopt.GetoptError:
print('usage: fuffa_team_mulino.py -w... | code_fim | hard | {
"lang": "python",
"repo": "aferaudo/mills-game",
"path": "/fuffa_team_mulino.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> view = win.get_visible()
x, y = self.pos
if self.multiscale.atleast(4, .1, view=view):
if not self.shown or \
not self.multiscale.same_view(view):
self.shown = True
start = max(int(self.multiscale.worldx1 - x + sel... | code_fim | hard | {
"lang": "python",
"repo": "mdrasmus/compbio",
"path": "/rasmus/vis/genomebrowser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdrasmus/compbio path: /rasmus/vis/genomebrowser.py
mes.append(text_clip(reg.data['ID'],
reg.start-start, bot,
reg.end-start+1, top,
4,
... | code_fim | hard | {
"lang": "python",
"repo": "mdrasmus/compbio",
"path": "/rasmus/vis/genomebrowser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdrasmus/compbio path: /rasmus/vis/genomebrowser.py
reg.end-start+1, bot,
reg.end-start+1, top,
reg.start-start, top])
vis2.extend([reg.start-start, bot,
reg.start-start, to... | code_fim | hard | {
"lang": "python",
"repo": "mdrasmus/compbio",
"path": "/rasmus/vis/genomebrowser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if opts.nets:
print "\n--------------- From Networks (with subnets): ---------------------"
neutron_common.print_network_list('from')
if opts.Nets:
print "\n--------------- To Networks (with subnets): ------------------------"
neutron_common.print_network_list('to')... | code_fim | hard | {
"lang": "python",
"repo": "eglute/copystack",
"path": "/neutron_reports.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eglute/copystack path: /neutron_reports.py
#!/usr/bin/env python
# Copyright (c) 2019 Rackspace US, 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://... | code_fim | hard | {
"lang": "python",
"repo": "eglute/copystack",
"path": "/neutron_reports.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def parse_string(cls, s):
if not s.startswith(IMAGE_START):
raise ValueError(f"Not an RST image: {s!r}")
lines = s.splitlines(keepends=True)
href = lines[0][len(IMAGE_START) :].strip()
options = {
"target": None,
"alt... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/pyrepo-1",
"path": "/src/pyrepo/readme.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not s.startswith(IMAGE_START):
raise ValueError(f"Not an RST image: {s!r}")
lines = s.splitlines(keepends=True)
href = lines[0][len(IMAGE_START) :].strip()
options = {
"target": None,
"alt": None,
}
opt_name = None
... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/pyrepo-1",
"path": "/src/pyrepo/readme.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/pyrepo-1 path: /src/pyrepo/readme.py
from enum import Enum
import re
import attr
from linesep import read_paragraphs
ParserState = Enum("ParserState", "BADGES POST_LINKS POST_CONTENTS INTRO SECTIONS")
HEADER_LINK_RGX = r"`(?P<label>[^`<>]+) <(?P<url>[^>]+)>`_"
IMAGE_START = ".. ima... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/pyrepo-1",
"path": "/src/pyrepo/readme.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def parse_args():
parser = argparse.ArgumentParser(description="Eval baseline RLAgent")
parser.add_argument(
"--load_path",
default='./saved_files',
help="The path to the model [.h5]")
parser.add_argument(
"--logs_path",
required=False,
default=... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PARL",
"path": "/benchmark/torch/NeurIPS2020-Learning-to-Run-a-Power-Network-Challenge/track2/evaluate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PARL path: /benchmark/torch/NeurIPS2020-Learning-to-Run-a-Power-Network-Challenge/track2/evaluate.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PARL",
"path": "/benchmark/torch/NeurIPS2020-Learning-to-Run-a-Power-Network-Challenge/track2/evaluate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> except KeyError:
if name in self.get_duplicated_markers():
# The variant is a duplicated one, so we go through all the
# variants with the same name and the :dupx suffix
return [
self.get_varian... | code_fim | hard | {
"lang": "python",
"repo": "pgxcentre/geneparse",
"path": "/geneparse/readers/impute2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for name, row in self._impute2_index.iterrows():
# Seeking to the right place in the file
f = self._impute2_file
f.seek(int(row.seek))
chrom, name, pos, a1, a2 = f.read(1024).split(" ")[:5]
pos = int(pos)
yield Variant(name, ... | code_fim | hard | {
"lang": "python",
"repo": "pgxcentre/geneparse",
"path": "/geneparse/readers/impute2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pgxcentre/geneparse path: /geneparse/readers/impute2.py
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... | code_fim | hard | {
"lang": "python",
"repo": "pgxcentre/geneparse",
"path": "/geneparse/readers/impute2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: znuxor/adventofcode2017 path: /4b.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
from collections import defaultdict
with open('4a_data.txt', 'r') as problem_input:
data_input = problem_input.read().split('\n')[:-1]
<|fim_suffix|> if len(anagrams_list) == len(line.split('... | code_fim | hard | {
"lang": "python",
"repo": "znuxor/adventofcode2017",
"path": "/4b.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for line in data_input:
anagrams_list = list()
for word in line.split(' '):
word_anagram_list = list(word)
word_anagram_list.sort()
if word_anagram_list not in anagrams_list:
anagrams_list.append(word_anagram_list)
if len(anagrams_list) == len(line.split(' ... | code_fim | hard | {
"lang": "python",
"repo": "znuxor/adventofcode2017",
"path": "/4b.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nccgroup/SusanRTTI path: /classinformer.py
# ClassInformer python
# Nicolas Guigo / NCC Group
# Tyler Colgan / NCC Group
# 03/2017
<|fim_suffix|>idaapi.require("utils")
idaapi.require("msvc")
idaapi.require("gcc")
idaapi.require("classdiagram")
from idaapi import auto_is_ok
from msvc import run_... | code_fim | medium | {
"lang": "python",
"repo": "nccgroup/SusanRTTI",
"path": "/classinformer.py",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|> gcc_info = find_text(0x0, 0, 0, "N10__cxxabiv117__class_type_infoE", SEARCH_CASE|SEARCH_DOWN)
return gcc_info != BADADDR
def main():
print("Starting ClassInformerPython")
if auto_is_ok():
classes = run_gcc() if isGcc() else run_msvc()
print(classes)
show_classes(cl... | code_fim | medium | {
"lang": "python",
"repo": "nccgroup/SusanRTTI",
"path": "/classinformer.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|>_PARAMS_HEADER = "x-goog-request-params"
def topic_routing_metadata(topic: TopicPath, partition: Partition) -> Mapping[str, str]:
encoded = urlencode({"partition": str(partition.value), "topic": str(topic)})
return {_PARAMS_HEADER: encoded}
def subscription_routing_metadata(
subscription: ... | code_fim | medium | {
"lang": "python",
"repo": "hannahrogers-google/python-pubsublite",
"path": "/google/cloud/pubsublite/internal/routing_metadata.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def subscription_routing_metadata(
subscription: SubscriptionPath, partition: Partition
) -> Mapping[str, str]:
encoded = urlencode(
{"partition": str(partition.value), "subscription": str(subscription)}
)
return {_PARAMS_HEADER: encoded}<|fim_prefix|># repo: hannahrogers-google/p... | code_fim | medium | {
"lang": "python",
"repo": "hannahrogers-google/python-pubsublite",
"path": "/google/cloud/pubsublite/internal/routing_metadata.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hannahrogers-google/python-pubsublite path: /google/cloud/pubsublite/internal/routing_metadata.py
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licen... | code_fim | medium | {
"lang": "python",
"repo": "hannahrogers-google/python-pubsublite",
"path": "/google/cloud/pubsublite/internal/routing_metadata.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtesauro/gauntlt-demo path: /examples/webgoat/vuln-16/vuln-16.py
import requests
s = requests.Session()
r = s.post("http://localhost:8080/WebGoat/j_spring_security_check", data={"username": "webgoat", "password": "webgoat"})
#print r.headers
#print r.text
#print r
#print r.cookies
#print s.coo... | code_fim | hard | {
"lang": "python",
"repo": "mtesauro/gauntlt-demo",
"path": "/examples/webgoat/vuln-16/vuln-16.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#print inject
attack_loc = blah['link'] + "&stage=3"
#print attack_loc
s.get("http://localhost:8080/WebGoat/{}".format(attack_loc))
r2 = s.post("http://localhost:8080/WebGoat/{}".format(attack_loc), data={"employee_id": 112, "password": "smith' OR '1' = '1", "action": "Login"}, cookies = r.cookies)
#p... | code_fim | hard | {
"lang": "python",
"repo": "mtesauro/gauntlt-demo",
"path": "/examples/webgoat/vuln-16/vuln-16.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: telehash/plinth path: /plinth/core.py
# -*- coding: utf-8 -*-
import os
import gevent
from gevent.server import DatagramServer
from .log import log
from .identity import SwitchID
from . import packet
from . import crypto
from .dht import DHT
from .exceptions import *
class Switch(DatagramSer... | code_fim | hard | {
"lang": "python",
"repo": "telehash/plinth",
"path": "/plinth/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log.debug('Received %i bytes from %s' % (len(data), address[0]))
if len(data) <= 4:
#Empty / NAT-punching packets can be ignored
return
try:
wrapper, payload = packet.decode(data)
packet_type = packet.validate_wrapper(wrapper)
... | code_fim | hard | {
"lang": "python",
"repo": "telehash/plinth",
"path": "/plinth/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ch = gevent.spawn(self.dht.open_channel,
hn, cytpe, initial_data)
ch.get(timeout=5)
return ch
def ping(self, hn):
ch = gevent.spawn(self.dht.open_channel,
hn, 'seek', self.id.hash_name)
ch.get(timeout=5)
... | code_fim | hard | {
"lang": "python",
"repo": "telehash/plinth",
"path": "/plinth/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: concord-consortium/geocode path: /docs/tephra-code/Tephra_code_RC_Oct29_19/src/config.py
'''
Configuration file for pyTephra2 code with umbrella cloud geometry.
All units are in international system units (i.e. kilograms, meters, centimeters).
The user should input the simulation values for each ... | code_fim | hard | {
"lang": "python",
"repo": "concord-consortium/geocode",
"path": "/docs/tephra-code/Tephra_code_RC_Oct29_19/src/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>VENT_X = 0
VENT_Y = 0
# UMBRELLA CLOUD GEOMETRY PARAMETERS
DISK_RADIUS = 10000
DISK_GRID_STEP = 1000
# ERUPTION PARAMETERS
MASS = 5e+11 #mass of the total erupted tephra (i.e. mass of all phi classes)
PHI_MASS = 3.74E+09 #mass of the selected phi class if the user choses to simulate only one phi class
... | code_fim | hard | {
"lang": "python",
"repo": "concord-consortium/geocode",
"path": "/docs/tephra-code/Tephra_code_RC_Oct29_19/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># UMBRELLA CLOUD GEOMETRY PARAMETERS
DISK_RADIUS = 10000
DISK_GRID_STEP = 1000
# ERUPTION PARAMETERS
MASS = 5e+11 #mass of the total erupted tephra (i.e. mass of all phi classes)
PHI_MASS = 3.74E+09 #mass of the selected phi class if the user choses to simulate only one phi class
PHI_SETTLING_VELOCITY =... | code_fim | medium | {
"lang": "python",
"repo": "concord-consortium/geocode",
"path": "/docs/tephra-code/Tephra_code_RC_Oct29_19/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = os.path.join(IMAGES_PATH, fig_id + "." + fig_extension)
print("Saving figure", fig_id)
if tight_layout:
plt.tight_layout()
plt.savefig(path, format=fig_extension, dpi=resolution)
# Ignore useless warnings (see SciPy issue #5998)
import warnings
warnings.filterwarnings(actio... | code_fim | hard | {
"lang": "python",
"repo": "mikev6/UMBC_Data601",
"path": "/lectures/week-5/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikev6/UMBC_Data601 path: /lectures/week-5/setup.py
# Python ≥3.5 is required
import sys
from typing import Union
assert sys.version_info >= (3, 5)
# Scikit-Learn ≥0.20 is required
import sklearn
assert sklearn.__version__ >= "0.20"
<|fim_suffix|># Common imports
import os
# Where to save ... | code_fim | medium | {
"lang": "python",
"repo": "mikev6/UMBC_Data601",
"path": "/lectures/week-5/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> check_config('TOKEN')
def test_vk_id():
check_config('VK_ID')
def test_python_version():
assert sys.version_info[0] == 3<|fim_prefix|># repo: stleon/vk_music path: /tests/test_config.py
import os
import sys
import pytest
<|fim_middle|>def check_config(env_var):
__tracebackhide__ = ... | code_fim | medium | {
"lang": "python",
"repo": "stleon/vk_music",
"path": "/tests/test_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_python_version():
assert sys.version_info[0] == 3<|fim_prefix|># repo: stleon/vk_music path: /tests/test_config.py
import os
import sys
import pytest
<|fim_middle|>def check_config(env_var):
__tracebackhide__ = True
if not os.getenv(env_var):
pytest.fail("not configured e... | code_fim | hard | {
"lang": "python",
"repo": "stleon/vk_music",
"path": "/tests/test_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stleon/vk_music path: /tests/test_config.py
import os
import sys
import pytest
def check_config(env_var):
__tracebackhide__ = True
if not os.getenv(env_var):
pytest.fail("not configured environment variable: %s" % env_var)
<|fim_suffix|>def test_python_version():
assert sy... | code_fim | medium | {
"lang": "python",
"repo": "stleon/vk_music",
"path": "/tests/test_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Collection of options that are allowed for a specific property."""
return self._options
@options.setter
def options(self, options):
options = format_as_iterable(options)
if not isinstance(options, Sequence):
self._unordered_options = True
els... | code_fim | hard | {
"lang": "python",
"repo": "brocksam/pyproprop",
"path": "/pyproprop/options.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brocksam/pyproprop path: /pyproprop/options.py
"""A utility designed to work with processed properties with options.
Processed properties allow the specification of a group of options that a user
can then choose from. If an option from this group is chosen then an error is
raised. Processed prop... | code_fim | hard | {
"lang": "python",
"repo": "brocksam/pyproprop",
"path": "/pyproprop/options.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>homeDir = os.getenv("HOME")
requestedPath = os.path.join(homeDir, 'nipypeTestPath')
mydatadir = os.path.realpath(requestedPath)
if not os.path.exists(mydatadir):
os.makedirs(mydatadir)
print(mydatadir)
MyFileURLs = [
('http://slicer.kitware.com/midas3/download?bitstream=13121',
'01_T1_half.n... | code_fim | hard | {
"lang": "python",
"repo": "satra/nipype",
"path": "/examples/smri_ants_registration.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: satra/nipype path: /examples/smri_ants_registration.py
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
==================================
sMRI: Using ANTS for registration
=================================... | code_fim | hard | {
"lang": "python",
"repo": "satra/nipype",
"path": "/examples/smri_ants_registration.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> reg.inputs.output_transform_prefix = 'thisTransform'
reg.inputs.output_warped_image = 'INTERNAL_WARPED.nii.gz'
reg.inputs.output_transform_prefix = "output_"
reg.inputs.transforms = ['Translation', 'Rigid', 'Affine', 'SyN']
reg.inputs.transform_parameters = [(0.1,), (0.1,), (0.1,), (0.... | code_fim | hard | {
"lang": "python",
"repo": "satra/nipype",
"path": "/examples/smri_ants_registration.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># driver method
if __name__ == '__main__':
arr = [3,4,1,7,6,2,8]
print ("Given array: ", end="\n")
printList(arr)
selectionSort(arr)
print("Sorted array: ", end="\n")
printList(arr)<|fim_prefix|># repo: iankush-dev/basicalgorithms path: /basicsortings/SelectionSort.py
# sel... | code_fim | hard | {
"lang": "python",
"repo": "iankush-dev/basicalgorithms",
"path": "/basicsortings/SelectionSort.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iankush-dev/basicalgorithms path: /basicsortings/SelectionSort.py
# selectionsort() method
def selectionSort(arr):
arraySize = len(arr)
for i in range(arraySize):
min = i
for j in range(i+1, arraySize):
if arr[j] < arr[min]:
min = j
#swap values
arr[i], arr[m... | code_fim | medium | {
"lang": "python",
"repo": "iankush-dev/basicalgorithms",
"path": "/basicsortings/SelectionSort.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cued-ia-computing/flood-jdv24-ahw41 path: /test_stations_by_river.py
from testingData import getFakeData
from floodsystem.geo import stations_by_river
<|fim_suffix|> stations = getFakeData()
assert stations_by_river(stations) == {'Roanoke River': [stations[0]],
... | code_fim | easy | {
"lang": "python",
"repo": "cued-ia-computing/flood-jdv24-ahw41",
"path": "/test_stations_by_river.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> stations = getFakeData()
assert stations_by_river(stations) == {'Roanoke River': [stations[0]],
'Lago Nahuel Huapi': [stations[1]],
'River Cam': [stations[2], stations[3], stations[4]]}<|fim_prefix|># repo: cued-... | code_fim | easy | {
"lang": "python",
"repo": "cued-ia-computing/flood-jdv24-ahw41",
"path": "/test_stations_by_river.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RULCSoft/cloudroast path: /cloudroast/stacktach/smoke/negative_stacktach_db_api.py
"""
Copyright 2013 Rackspace
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... | code_fim | hard | {
"lang": "python",
"repo": "RULCSoft/cloudroast",
"path": "/cloudroast/stacktach/smoke/negative_stacktach_db_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_list_exists_for_invalid_uuid(self):
"""
@summary: Verify that List Exists by uuid fails
"""
response = (self.stacktach_db_behavior
.list_exists_for_uuid(instance="$#@!"))
self._verify_error_code_and_entity_none(response)
def _v... | code_fim | hard | {
"lang": "python",
"repo": "RULCSoft/cloudroast",
"path": "/cloudroast/stacktach/smoke/negative_stacktach_db_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
response = (self.stacktach_db_behavior
.list_deletes_for_uuid(instance="$#@!"))
self._verify_error_code_and_entity_none(response)
def test_list_exists_for_invalid_uuid(self):
"""
@summary: Verify that List Exists by uuid fails
"... | code_fim | hard | {
"lang": "python",
"repo": "RULCSoft/cloudroast",
"path": "/cloudroast/stacktach/smoke/negative_stacktach_db_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def special_attack(self, character):
if self.special:
damage = 20 * character.defense
print(f"{self.name} backstabbed {character.name} for {damage} damage")
return damage
return None
def is_dead(self):
return self.health ... | code_fim | hard | {
"lang": "python",
"repo": "Twurt/Adventure",
"path": "/Adventure/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def attack(self, character):
damage = self.attack_power * self.roll20() / character.defense
print(f"{self.name} stabbed {character.name} for {damage} damage")
return damage
def special_attack(self, character):
if self.special:
damage = 20... | code_fim | hard | {
"lang": "python",
"repo": "Twurt/Adventure",
"path": "/Adventure/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Twurt/Adventure path: /Adventure/classes.py
import random
class Character(object):
def __init__(self, health, attack_power, defense, name, special=False):
self.health = health
self.special = special
self.attack_power = attack_power
self.defense = defens... | code_fim | hard | {
"lang": "python",
"repo": "Twurt/Adventure",
"path": "/Adventure/classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rewind(current_file)
print "Let's print three lines:"
# print the first line
current_line = 1
print_a_line(current_line, current_file)
# print the second line
current_line = current_line + 1
print_a_line(current_line, current_file)
# print the third line
# notice that this is another method to increas... | code_fim | medium | {
"lang": "python",
"repo": "petervdb/eLearning",
"path": "/python/hardway/ex20.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># open the file
current_file = open(input_file)
print "First let's print the whole file:\n"
print_all(current_file)
print "Now let's rewind, kind of like a tape."
rewind(current_file)
print "Let's print three lines:"
# print the first line
current_line = 1
print_a_line(current_line, current_file)
#... | code_fim | medium | {
"lang": "python",
"repo": "petervdb/eLearning",
"path": "/python/hardway/ex20.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petervdb/eLearning path: /python/hardway/ex20.py
from sys import argv
# variable script is the name of the script
script, input_file = argv
def print_all(f):
print f.read()
def rewind(f):
# Go to byte 0 or to the beginning of the file
f.seek(0)
def print_a_line(line_count, f):
print line... | code_fim | medium | {
"lang": "python",
"repo": "petervdb/eLearning",
"path": "/python/hardway/ex20.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JustalK/JK-SHORTCUT path: /src/menu.py
# -*- coding: utf-8 -*-
import tkinter
import consts
class Menu():
count_menu = 0
<|fim_suffix|> button = tkinter.Button(
left,
text=text,
bd=0,
height=2,
highlightthickness=0,
... | code_fim | hard | {
"lang": "python",
"repo": "JustalK/JK-SHORTCUT",
"path": "/src/menu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> button = tkinter.Button(
left,
text=text,
bd=0,
height=2,
highlightthickness=0,
fg=consts.MENU_TEXT_COLOR,
activeforeground=consts.MENU_TEXT_COLOR,
activebackground=consts.MENU_TEXT_ACTIVE_COLOR,
... | code_fim | hard | {
"lang": "python",
"repo": "JustalK/JK-SHORTCUT",
"path": "/src/menu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def checkEqual1(iterator):
try:
iterator = iter(iterator)
first = next(iterator)
return all(first == rest for rest in iterator)
except StopIteration:
return True
x = itertools.ifilter(checkEqual1, itertools.product(*_all))
z = [y[0] for y in x]
print(z)<|fim_pre... | code_fim | medium | {
"lang": "python",
"repo": "shessuper/quilt",
"path": "/sweng/0.1/proto/iteration.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shessuper/quilt path: /sweng/0.1/proto/iteration.py
#!/usr/bin/env python
import sys
import itertools
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
b = [2, 4, 6, 8]
c = [4, 8]
_all = [a, b, c]
def checkEqual1(iterator):
<|fim_suffix|>
x = itertools.ifilter(checkEqual1, itertools.product(*_all))
z = [y[0] f... | code_fim | medium | {
"lang": "python",
"repo": "shessuper/quilt",
"path": "/sweng/0.1/proto/iteration.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("\nAl parecer la mesa que queria no podra llegar a tiempo, asi que solo puedo invitar a dos personas\n")
while(len(personas)>2):
i=len(personas)-1
print("Perdona",personas[i],"pero ahora solo puedo invitar a 2 personas asi que tengo que eliminarte de la lista de invitados")
personas.pop... | code_fim | medium | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ago-Dic-2019/Luis Llanes/Practica1/ejercicio3-7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jonathan-aguilar/DAS_Sistemas path: /Ago-Dic-2019/Luis Llanes/Practica1/ejercicio3-7.py
personas = ["Anita", "Andrea", "Ursula"]
print("un mensaje general")
print()
for i in range(0,len(personas)):
print("Me gustaria verte pronto", personas[i],"¿Que tal si salimos a cenar?")
print()
print(... | code_fim | medium | {
"lang": "python",
"repo": "Jonathan-aguilar/DAS_Sistemas",
"path": "/Ago-Dic-2019/Luis Llanes/Practica1/ejercicio3-7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scmmmh/the-old-joke-archive path: /toja/cli/actions.py
"""Single CLI action commands."""
import asyncio
import click
from ..actions import clean_old_user_tokens
<|fim_suffix|>
actions.add_command(clean_user_tokens)<|fim_middle|>@click.group()
def actions() -> None:
"""Run the TOJA backgrou... | code_fim | hard | {
"lang": "python",
"repo": "scmmmh/the-old-joke-archive",
"path": "/toja/cli/actions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
actions.add_command(clean_user_tokens)<|fim_prefix|># repo: scmmmh/the-old-joke-archive path: /toja/cli/actions.py
"""Single CLI action commands."""
import asyncio
import click
from ..actions import clean_old_user_tokens
@click.group()
def actions() -> None:
<|fim_middle|> """Run the TOJA backgrou... | code_fim | medium | {
"lang": "python",
"repo": "scmmmh/the-old-joke-archive",
"path": "/toja/cli/actions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@click.command()
def clean_user_tokens() -> None:
"""Clean old login tokens."""
asyncio.run(clean_old_user_tokens())
actions.add_command(clean_user_tokens)<|fim_prefix|># repo: scmmmh/the-old-joke-archive path: /toja/cli/actions.py
"""Single CLI action commands."""
import asyncio
import click
... | code_fim | medium | {
"lang": "python",
"repo": "scmmmh/the-old-joke-archive",
"path": "/toja/cli/actions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: supramolecular-toolkit/stk path: /tests/databases/constructed_molecule/mongo_db/test_constructed_molecule_caching.py
import numpy as np
import stk
def test_put_caching(mongo_client):
database_name = "_test_put_caching"
mongo_client.drop_database(database_name)
database = stk.Const... | code_fim | medium | {
"lang": "python",
"repo": "supramolecular-toolkit/stk",
"path": "/tests/databases/constructed_molecule/mongo_db/test_constructed_molecule_caching.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> database.put(
molecule=polymer.with_position_matrix(
position_matrix=np.zeros((polymer.get_num_atoms(), 3)),
),
)
cache_info = database._put.cache_info()
assert cache_info.hits == 1
assert cache_info.misses == 2
def test_get_caching(mongo_client):
data... | code_fim | medium | {
"lang": "python",
"repo": "supramolecular-toolkit/stk",
"path": "/tests/databases/constructed_molecule/mongo_db/test_constructed_molecule_caching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> database = stk.ConstructedMoleculeMongoDb(
mongo_client=mongo_client,
database=database_name,
)
molecule = stk.BuildingBlock("BrCCCBr", [stk.BromoFactory()])
polymer = stk.ConstructedMolecule(
topology_graph=stk.polymer.Linear(
building_blocks=(molecule,... | code_fim | medium | {
"lang": "python",
"repo": "supramolecular-toolkit/stk",
"path": "/tests/databases/constructed_molecule/mongo_db/test_constructed_molecule_caching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: biotep/Gemini path: /scripts/linreg.py
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Panel, Slope, PreText, Paragraph, Div
from bokeh.layouts import column, row
import numpy as np
import statsmodels.formula.api as sm
from statsmodels.tsa.stattools import coint
from ... | code_fim | hard | {
"lang": "python",
"repo": "biotep/Gemini",
"path": "/scripts/linreg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #self.h.quad(top='hist', bottom=0, left='left', right='right', fill_color="#036564", line_color="#033649", source = self.xcorrsouce)
self.h.line('lags', 'ccor', source=self.xcorrsouce2, line_width=2, color='red', alpha=0.4)
self.h.ygrid.band_fill_alpha = 0.1
self.h.ygrid.ba... | code_fim | hard | {
"lang": "python",
"repo": "biotep/Gemini",
"path": "/scripts/linreg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> npts = x.count()
lags = np.arange(-npts + 1, npts)
ccov = np.correlate(x - x.mean(), y - y.mean(), mode='full')
ccor = ccov / (npts * x.std() * y.std())
return lags, ccor
def update(self, data):
print("linreg updating...")
self.source.data = se... | code_fim | hard | {
"lang": "python",
"repo": "biotep/Gemini",
"path": "/scripts/linreg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krishnateja95/Quantization-Test_bed path: /Xception.py
dding=padding)
def avgpool_2d(x, k=2, s=1, padding='VALID'):
# AvgPool2D wrapper
return tf.nn.avg_pool(x, ksize=[1, k, k, 1], strides=[1, s, s,1],
padding=padding)
def get_bn_param(weights, layer_num):
... | code_fim | hard | {
"lang": "python",
"repo": "krishnateja95/Quantization-Test_bed",
"path": "/Xception.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krishnateja95/Quantization-Test_bed path: /Xception.py
.round(qweights)
qweights = qweights.astype(np.int8)
return qweights,scales
if conv_quant == 'per_layer':
abs_weights = np.abs(weights)
vmax = np.max(abs_weights)
s = vmax / 127.
qweig... | code_fim | hard | {
"lang": "python",
"repo": "krishnateja95/Quantization-Test_bed",
"path": "/Xception.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def conv_block(x, weights, conv_num, bn_num,x_max, x_min,layer, quant,calibrate,conv_quant,act_scale,strides=1,
padding='SAME',activation=True):
print("Inside Conv block")
conv_name = 'convolution2d_{}_W:0'.format(conv_num)
bias_name = 'convolution2d_{}_b:0'.format(conv_n... | code_fim | hard | {
"lang": "python",
"repo": "krishnateja95/Quantization-Test_bed",
"path": "/Xception.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Toblerity/fio-buffer path: /tests/test_cli.py
from click.testing import CliRunner
import fiona as fio
import fiona.fio.main
from fiona.transform import transform_geom
from shapely.geometry import mapping
from shapely.geometry import shape
import fio_buffer.core
def test_standard(tmpdir):
... | code_fim | hard | {
"lang": "python",
"repo": "Toblerity/fio-buffer",
"path": "/tests/test_cli.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Reproject, buffer, reroject to create an expected geometry
geom = transform_geom('EPSG:4326', 'EPSG:3857', pnt['geometry'])
buf_geom = mapping(shape(geom).buffer(100))
e_coords = transform_geom('EPSG:3857', 'EPSG:900913', buf_geom)['coordinates'][0]
... | code_fim | hard | {
"lang": "python",
"repo": "Toblerity/fio-buffer",
"path": "/tests/test_cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> outfile = str(tmpdir.mkdir('out').join('buf-field'))
result = CliRunner().invoke(fio_buffer.core.buffer, [
'tests/data/points.geojson',
outfile,
'--distance', 'distance',
])
assert result.exit_code == 0
with fio.open('tests/data/points.geojson') as src, fio.open... | code_fim | hard | {
"lang": "python",
"repo": "Toblerity/fio-buffer",
"path": "/tests/test_cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fly2fire/capsule path: /backtester.py
import argparse
import datetime
import decimal
import json
import os
import queue
import time
from dateutil.relativedelta import relativedelta
import boto3
from botocore.exceptions import ClientError
import ibapi.wrapper
from contracts import SecurityDefini... | code_fim | hard | {
"lang": "python",
"repo": "fly2fire/capsule",
"path": "/backtester.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.Logger.info("ReqId: " + str(reqId) + " HistoricalData. " + sym + " Date: " + bar.date + " Open: "
+ str(bar.open) + " High: " + str(bar.high) + " Low: " + str(bar.low) + " Close: "
+ str(bar.close) + " Volume: " + str(bar.volume) + " Count: " ... | code_fim | hard | {
"lang": "python",
"repo": "fly2fire/capsule",
"path": "/backtester.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.UpdateQuote(sym, bar.date, bar.open, bar.close, bar.high, bar.low, bar.volume, bar.barCount)
@iswrapper
def historicalDataEnd(self, reqId: int, start: str, end: str):
super(IbApp, self).historicalDataEnd(reqId, start, end)
self.Logger.info("HistoricalDataEnd " + str(r... | code_fim | hard | {
"lang": "python",
"repo": "fly2fire/capsule",
"path": "/backtester.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StichtingBorrelbeheerZilverling/sbzwebsite path: /apps/multivers/migrations/0007_auto_20170203_1408.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-03 13:08
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|> operations = [
... | code_fim | medium | {
"lang": "python",
"repo": "StichtingBorrelbeheerZilverling/sbzwebsite",
"path": "/apps/multivers/migrations/0007_auto_20170203_1408.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='location',
name='no_discount',
field=models.IntegerField(choices=[(0, 'No discount'), (1, 'Discount if exclusive'), (2, 'Always discount')], null=True),
),
]<|fim_prefix|># repo: StichtingBorrelbe... | code_fim | medium | {
"lang": "python",
"repo": "StichtingBorrelbeheerZilverling/sbzwebsite",
"path": "/apps/multivers/migrations/0007_auto_20170203_1408.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nandor1992/FogOfThings path: /Testing/Dev_Monitor.py
#!/usr/bin/env python
import couchdb
import pika
import ast
import time
import threading
import ctypes
class Listener():
def __init__(self,c_user,c_pass,user,passw,port,virt):
<|fim_suffix|>if __name__ == "__main__":
print("Starting Li... | code_fim | hard | {
"lang": "python",
"repo": "nandor1992/FogOfThings",
"path": "/Testing/Dev_Monitor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
print("Starting Listener")
try:
l=Listener("admin","hunter","admin","hunter",5672,"test")
l.start()
except KeyboardInterrupt:
l.stop()
print("Interrupt Keyboard - Stop!")<|fim_prefix|># repo: nandor1992/FogOfThings path: /Testing/Dev_... | code_fim | medium | {
"lang": "python",
"repo": "nandor1992/FogOfThings",
"path": "/Testing/Dev_Monitor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Started Listening!")
self.channel.start_consuming()
if __name__ == "__main__":
print("Starting Listener")
try:
l=Listener("admin","hunter","admin","hunter",5672,"test")
l.start()
except KeyboardInterrupt:
l.stop()
print("Interrupt Keyboar... | code_fim | hard | {
"lang": "python",
"repo": "nandor1992/FogOfThings",
"path": "/Testing/Dev_Monitor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sawich/havok-reflection path: /havok_classes/hkxMaterialEffect.py
from .hkReferencedObject import hkReferencedObject
from enum import Enum
from .enums import EffectType
from typing import List
from .common import get_array
class EffectType(Enum):
EFFECT_TYPE_INVALID = 0
EFFECT_TYPE_UNKN... | code_fim | medium | {
"lang": "python",
"repo": "sawich/havok-reflection",
"path": "/havok_classes/hkxMaterialEffect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "<{class_name} name=\"{name}\", type={type}, data=[{data}]>".format(**{
"class_name": self.__class__.__name__,
"name": self.name,
"type": self.type,
"data": self.data,
})<|fim_prefix|># repo: sawich/havok-reflection path: /havok_class... | code_fim | hard | {
"lang": "python",
"repo": "sawich/havok-reflection",
"path": "/havok_classes/hkxMaterialEffect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lhotse-speech/lhotse path: /lhotse/bin/modes/recipes/atcosim.py
import click
from lhotse.bin.modes import download, prepare
from lhotse.recipes.atcosim import download_atcosim, prepare_atcosim
from lhotse.utils import Pathlike
<|fim_suffix|> corpus_dir: Pathlike,
output_dir: Pathlike,
... | code_fim | hard | {
"lang": "python",
"repo": "lhotse-speech/lhotse",
"path": "/lhotse/bin/modes/recipes/atcosim.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@download.command(context_settings=dict(show_default=True))
@click.argument("target_dir", type=click.Path())
def atcosim(target_dir: Pathlike):
"""ATCOSIM download."""
download_atcosim(target_dir)
@prepare.command(context_settings=dict(show_default=True))
@click.argument("corpus_dir", type=clic... | code_fim | medium | {
"lang": "python",
"repo": "lhotse-speech/lhotse",
"path": "/lhotse/bin/modes/recipes/atcosim.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertRaises(IOError, ma.io.read, 'IDoNotExist.abc');<|fim_prefix|># repo: aaa34169/openma path: /modules/io/test/python/ioTest.py
import ma.io
import unittest
<|fim_middle|>class IOTest(unittest.TestCase):
def wrong_path(self):
| code_fim | easy | {
"lang": "python",
"repo": "aaa34169/openma",
"path": "/modules/io/test/python/ioTest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aaa34169/openma path: /modules/io/test/python/ioTest.py
import ma.io
import unittest
<|fim_suffix|> self.assertRaises(IOError, ma.io.read, 'IDoNotExist.abc');<|fim_middle|>class IOTest(unittest.TestCase):
def wrong_path(self):
| code_fim | easy | {
"lang": "python",
"repo": "aaa34169/openma",
"path": "/modules/io/test/python/ioTest.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.