text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> Returns:
object: An instance of this structure class.
"""
if dictionary is None:
return None
# Extract variables from the dictionary
api_group = dictionary.get('apiGroup')
api_version = dictionary.get('apiVersion')
kind = di... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/object_reference.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cohesity/management-sdk-python path: /cohesity_management_sdk/models/object_reference.py
# -*- coding: utf-8 -*-
# Copyright 2023 Cohesity Inc.
class ObjectReference(object):
"""Implementation of the 'ObjectReference' model.
ObjectReference contains enough information to let you inspec... | code_fim | hard | {
"lang": "python",
"repo": "cohesity/management-sdk-python",
"path": "/cohesity_management_sdk/models/object_reference.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='cars',
name='accident',
field=models.CharField(default='无', max_length=128),
),
migrations.AddField(
model_name='cars',
name='commercial_insurance',
field=mod... | code_fim | hard | {
"lang": "python",
"repo": "peikaiy/SecondCar",
"path": "/Bo_yuan/migrations/0004_auto_20191023_0942.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peikaiy/SecondCar path: /Bo_yuan/migrations/0004_auto_20191023_0942.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-10-23 09:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations... | code_fim | hard | {
"lang": "python",
"repo": "peikaiy/SecondCar",
"path": "/Bo_yuan/migrations/0004_auto_20191023_0942.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.timer = Timer()
self.wintimer = Timer()
def loop(self):
if self.wintimer.millis() < 19600:
if self.timer.millis() > 100:
self.timer.reset()
print self.movement.distance()
# Intended behavior: bot will follow wall
... | code_fim | hard | {
"lang": "python",
"repo": "pravinas/et-maslab-2016",
"path": "/control/Test_Wall_Follow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pravinas/et-maslab-2016 path: /control/Test_Wall_Follow.py
# test_wall_Follow.py
#
# A test file for the control objects.
#When run returns no module named long_range_ir
from Wall_Follow import WallFollow
from tamproxy import SyncedSketch, Timer
from tamproxy.devices import Motor
from long_rang... | code_fim | hard | {
"lang": "python",
"repo": "pravinas/et-maslab-2016",
"path": "/control/Test_Wall_Follow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bhagyeshsoni/aws-quota-checker path: /setup.py
from setuptools import setup, find_packages
setup(
name='aws-quota-checker',
version='1.0.0',
packages=<|fim_suffix|>e={
'dev':{
'autopep8',
'pylint',
'keepachangelog',
'wheel'
... | code_fim | medium | {
"lang": "python",
"repo": "Bhagyeshsoni/aws-quota-checker",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e={
'dev':{
'autopep8',
'pylint',
'keepachangelog',
'wheel'
}
},
entry_points='''
[console_scripts]
aws-quota-checker=aws_quota.cli:cli
''',
)<|fim_prefix|># repo: Bhagyeshsoni/aws-quota-checker path: /setup.py
fr... | code_fim | medium | {
"lang": "python",
"repo": "Bhagyeshsoni/aws-quota-checker",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> }
},
entry_points='''
[console_scripts]
aws-quota-checker=aws_quota.cli:cli
''',
)<|fim_prefix|># repo: Bhagyeshsoni/aws-quota-checker path: /setup.py
from setuptools import setup, find_packages
setup(
name='aws-quota-checker',
version='1.0.0',
packages=<|f... | code_fim | hard | {
"lang": "python",
"repo": "Bhagyeshsoni/aws-quota-checker",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>text_utils = [
"to_str",
"to_bytes",
"Vocab",
"SentencePieceVocab",
"SentencePieceModel",
"SPieceTokenizerOutType",
"SPieceTokenizerLoadType"
]
common_trans = [
'Compose',
'Concatenate',
'Duplicate',
'Fill',
'Mask',
'OneHot',
'PadEnd',
'RandomAp... | code_fim | hard | {
"lang": "python",
"repo": "bravotty/tinyms",
"path": "/tinyms/text/_transform_ops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bravotty/tinyms path: /tinyms/text/_transform_ops.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | code_fim | hard | {
"lang": "python",
"repo": "bravotty/tinyms",
"path": "/tinyms/text/_transform_ops.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> net = tf.keras.layers.Conv2D(
filters=n,
kernel_size=conv_kernel,
strides=1,
padding='same',
activation='linear')(
net)
net = tf.keras.layers.BatchNormalization(
momentum=flags.bn_momentum,
center=flags.bn_center,
scale=fl... | code_fim | hard | {
"lang": "python",
"repo": "Ayoob7/google-research",
"path": "/kws_streaming/models/tc_resnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ayoob7/google-research path: /kws_streaming/models/tc_resnet.py
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licens... | code_fim | hard | {
"lang": "python",
"repo": "Ayoob7/google-research",
"path": "/kws_streaming/models/tc_resnet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> channels = channels[1:]
# residual blocks
for n in channels:
if n != net.shape[-1]:
stride = 2
layer_in = tf.keras.layers.Conv2D(
filters=n,
kernel_size=1,
strides=stride,
padding='same',
activation='linear')(
net)
... | code_fim | hard | {
"lang": "python",
"repo": "Ayoob7/google-research",
"path": "/kws_streaming/models/tc_resnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisdpa/rakolighting path: /setup.py
from setuptools import setup
setup(name='rakolighting',
version='0.1'<|fim_suffix|>risdpa/rakolighting',
author='chrisdpa',
author_email='unknown',
license='MIT',
packages=['rakolighting'],
zip_safe=False)<|fim_middle|>,
... | code_fim | medium | {
"lang": "python",
"repo": "chrisdpa/rakolighting",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
license='MIT',
packages=['rakolighting'],
zip_safe=False)<|fim_prefix|># repo: chrisdpa/rakolighting path: /setup.py
from setuptools import setup
setup(name='rakolighting',
version='0.1'<|fim_middle|>,
description='rakolighting library',
url='https://github.com/chris... | code_fim | medium | {
"lang": "python",
"repo": "chrisdpa/rakolighting",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LicciardiG/OPLS-AAM_for_Gromacs path: /GMX_TEST/DIP/R/test_OMM_GMX.py
#!/usr/bin/env python
from __future__ import division, print_function
from collections import defaultdict
import sys
# OpenMM Imports
import simtk.openmm as mm
import simtk.openmm.app as app
import parmed as pmd
# ParmEd Impo... | code_fim | hard | {
"lang": "python",
"repo": "LicciardiG/OPLS-AAM_for_Gromacs",
"path": "/GMX_TEST/DIP/R/test_OMM_GMX.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Define the platform to use; CUDA, OpenCL, CPU, or Reference. Or do not specify
# the platform to use the default (fastest) platform
platform = mm.Platform.getPlatformByName('Reference')
sim = app.Simulation(top.topology, system, integrator, platform)
sim.context.setPositions(top.positions)
# Minimize t... | code_fim | hard | {
"lang": "python",
"repo": "LicciardiG/OPLS-AAM_for_Gromacs",
"path": "/GMX_TEST/DIP/R/test_OMM_GMX.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Minimize the energy
print('Minimizing energy')
struct=pmd.load_file('GMX_R.pdb')
ecomps=(pmd.openmm.energy_decomposition_system(struct,system))
tot_ene=0.0
for i in range(0,len(ecomps)):
tot_ene+=ecomps[i][1]
print(ecomps[i][0],ecomps[i][1])
print('Total-energy %6.6f'%tot_ene)<|fim_prefi... | code_fim | hard | {
"lang": "python",
"repo": "LicciardiG/OPLS-AAM_for_Gromacs",
"path": "/GMX_TEST/DIP/R/test_OMM_GMX.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yskang/AlgorithmPractice path: /baekjoon/python/bother_16208.py
# Title: 귀찮음
# Link: https://www.acmicpc.net/problem/16208
import sys
sys.setrecursionlimit(10 ** 6)
read_single_int = lambda: int(sys.stdin.readline().strip())
read_list_int = lambda: list(map(int, sys.stdin.readline(... | code_fim | medium | {
"lang": "python",
"repo": "yskang/AlgorithmPractice",
"path": "/baekjoon/python/bother_16208.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ans
def main():
n = read_single_int()
sticks = read_list_int()
print(solution(n, sticks))
if __name__ == '__main__':
main()<|fim_prefix|># repo: yskang/AlgorithmPractice path: /baekjoon/python/bother_16208.py
# Title: 귀찮음
# Link: https://www.acmicpc.net/problem/1... | code_fim | hard | {
"lang": "python",
"repo": "yskang/AlgorithmPractice",
"path": "/baekjoon/python/bother_16208.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PythonT/Crawler path: /MultiCrawler.py
#!/usr/bin/env python
#coding:utf-8
#python logging:https://docs.python.org/3.1/library/logging.html
import logging
#import time
import threading
from time import ctime,sleep
<|fim_suffix|>
threads = []
t1 = threading.Thread(target=music,args=(u'爱情买卖',... | code_fim | hard | {
"lang": "python",
"repo": "PythonT/Crawler",
"path": "/MultiCrawler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
threads = []
t1 = threading.Thread(target=music,args=(u'爱情买卖',))
threads.append(t1)
t2 = threading.Thread(target=move,args=(u'阿凡达',))
threads.append(t2)
if __name__ == '__main__':
for t in threads:
t.setDaemon(True)
t.start()
logging.info("all over %s" %ctime() )<|... | code_fim | hard | {
"lang": "python",
"repo": "PythonT/Crawler",
"path": "/MultiCrawler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>threads = []
t1 = threading.Thread(target=music,args=(u'爱情买卖',))
threads.append(t1)
t2 = threading.Thread(target=move,args=(u'阿凡达',))
threads.append(t2)
if __name__ == '__main__':
for t in threads:
t.setDaemon(True)
t.start()
logging.info("all over %s" %ctime() )<|fim_pr... | code_fim | hard | {
"lang": "python",
"repo": "PythonT/Crawler",
"path": "/MultiCrawler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> params = {"handle": "Vicfred", "from": 1, "count": 10}
r = requests.get("https://codeforces.com/api/user.status", params=params)
assert r.status_code == 200
json = r.json()
assert json["status"] == "OK"
result = json["result"]
assert len(result) >= 1
for submission in resul... | code_fim | hard | {
"lang": "python",
"repo": "Vicfred/codeforcesapiwrapper",
"path": "/tests/test_objects.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vicfred/codeforcesapiwrapper path: /tests/test_objects.py
# -*- coding: utf-8 -*-
import requests
from codeforces.User import User
from codeforces.Contest import Contest
from codeforces.Problem import Problem
from codeforces.Submission import Submission
<|fim_suffix|>def test_contest():
par... | code_fim | hard | {
"lang": "python",
"repo": "Vicfred/codeforcesapiwrapper",
"path": "/tests/test_objects.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_submission():
params = {"handle": "Vicfred", "from": 1, "count": 10}
r = requests.get("https://codeforces.com/api/user.status", params=params)
assert r.status_code == 200
json = r.json()
assert json["status"] == "OK"
result = json["result"]
assert len(result) >= 1
... | code_fim | hard | {
"lang": "python",
"repo": "Vicfred/codeforcesapiwrapper",
"path": "/tests/test_objects.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuliu2016/knotbook path: /tools/kbpy/adapters/analysis18/scouts_overview.py
import pandas as pd
TITLE_NAME = "Scouts Overview"
SOURCE_NAME = "scouts_overview"
LABELS = ["Scout Name", "# Scouted"]
def compile_scouts(manager):
scouts = {}
for entry in manager.entries:
s = entry.n... | code_fim | medium | {
"lang": "python",
"repo": "yuliu2016/knotbook",
"path": "/tools/kbpy/adapters/analysis18/scouts_overview.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return scouts
def get_rows(manager):
for name, count in compile_scouts(manager).items():
yield {
"Scout Name": name,
"# Scouted": count
}
def compute_table(manager):
return pd.DataFrame(get_rows(manager))[LABELS]<|fim_prefix|># repo: yuliu2016/knotbo... | code_fim | hard | {
"lang": "python",
"repo": "yuliu2016/knotbook",
"path": "/tools/kbpy/adapters/analysis18/scouts_overview.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fetchai/ledger path: /scripts/end_to_end_test/smart_contract_tests/c2c_argument_passing_test.py
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/ledger",
"path": "/scripts/end_to_end_test/smart_contract_tests/c2c_argument_passing_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(options, benefactor):
entity1 = Entity()
# create the APIs
api = LedgerApi(options['host'], options['port'])
api.sync(api.tokens.transfer(benefactor, entity1, 1000000, 1000))
contract = Contract(CONTRACT_TEXT, entity1)
contract2 = Contract(CONTRACT_TEXT2, entity1)
... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/ledger",
"path": "/scripts/end_to_end_test/smart_contract_tests/c2c_argument_passing_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fzalkow/mtd-alignment-tool path: /02_use_updates.py
import os
import json
import glob
from itertools import chain
import pandas as pd
from tqdm import tqdm
from app.common import STATIC_DIR
def format_time(ss):
ss_check = ss
mm = ss // 60
ss = ss - (mm * 60)
assert ss_check == ... | code_fim | hard | {
"lang": "python",
"repo": "fzalkow/mtd-alignment-tool",
"path": "/02_use_updates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask = df_small['MTDID'] == cur_mtd_id
row = df_small[mask]
assert len(row) in [0, 1], cur_mtd_id
if len(row) == 1:
for key, val in updates.items():
df_small.loc[mask, key] = val
mask = df_medium['MTDID'] == cur_mtd_id
row = df_m... | code_fim | hard | {
"lang": "python",
"repo": "fzalkow/mtd-alignment-tool",
"path": "/02_use_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aashishyadavally/chomskIE path: /chomskIE/postprocess.py
from collections import namedtuple
import datefinder
from datefinder import DateFinder
ARGUMENT_ENTITY_TYPES = {
'born' : [
['PERSON', 'ORG'],
['DATE'],
['GPE'],
],
'acquire': [
['ORG'],
... | code_fim | hard | {
"lang": "python",
"repo": "aashishyadavally/chomskIE",
"path": "/chomskIE/postprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args = namedtuple("Arguments", ["arg1", "arg2", "arg3"])
ents = ARGUMENT_ENTITY_TYPES[triple_type]
for index, sent in enumerate(doc.sents):
templates = []
svotriples = sent[f'{triple_type}_svotriples']
for triple in svotriples:
arg1 = triple.subject[0]
... | code_fim | hard | {
"lang": "python",
"repo": "aashishyadavally/chomskIE",
"path": "/chomskIE/postprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not(arg2 is None and arg3 is None):
templates.append(Args(arg1, arg2, arg3))
doc.sents[index][f'{triple_type}_templates'] = templates
del doc.sents[index][f'{triple_type}_svotriples']
return doc
def post_process_part_tuples(doc):
"""... | code_fim | hard | {
"lang": "python",
"repo": "aashishyadavally/chomskIE",
"path": "/chomskIE/postprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sangwon9591/learningspoons-bootcamp-finance path: /python-exercise300/041_050.py
# 041
# ticker = "btc_krw"
# ticker = ticker.upper()
# print(ticker)
<|fim_suffix|># 043
# a = "hello"
# a = a.capitalize() # Hello
# print(a)
# 044
# file_name = "보고서.xlsx"
# print(file_name.endswith("xlsx"))
#... | code_fim | medium | {
"lang": "python",
"repo": "sangwon9591/learningspoons-bootcamp-finance",
"path": "/python-exercise300/041_050.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># 046
# file_name = "2020_보고서.xlsx"
# print(file_name.startswith("2020"))
# 047
# a = "hello world"
# print(a.split())
# 048
# ticker = "btc_krw"
# print(ticker.split('_'))
# 049
# date = "2020-05-01"
# print(date.split('-'))
# 050
# data = "039490 "
# print(data.rstrip())<|fim_prefix|># repo: sang... | code_fim | medium | {
"lang": "python",
"repo": "sangwon9591/learningspoons-bootcamp-finance",
"path": "/python-exercise300/041_050.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yang123vc/aft path: /aft.py
import os
import re
from lib.adb import AndroidDebugBridge
import string
from lib.read_db import *
adb = AndroidDebugBridge()
def main():
dir = raw_input("Enter the location at which the workspace is to be created: ")
if not os.path.exists(dir):
os.makedirs(dir)... | code_fim | hard | {
"lang": "python",
"repo": "yang123vc/aft",
"path": "/aft.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open("%s/list.txt" % photo,'r')
content = f.read()
fList = content.strip().split()
regex = r'\S[^\r\n\t]*\.jpg'
for x in range(0,len(fList)):
if re.search(regex,fList[x]):
adb.pull('/mnt/sdcard/DCIM/Camera/%s' % fList[x], photo)
read_account(db, report)
read_history(db, report)
read_mm... | code_fim | hard | {
"lang": "python",
"repo": "yang123vc/aft",
"path": "/aft.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return str(new_media.id), 200
@shelter_bp.route('/delete_picture/<int:picture_id>', methods=['GET','POST'])
@login_required
def delete_picture(picture_id=None):
picture = ShelterPicture.query.filter(ShelterPicture.id==picture_id).first()
if picture:
os.unlink(os.path.join(con... | code_fim | hard | {
"lang": "python",
"repo": "rodekruis/shelter-database",
"path": "/src/web/views/shelter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rodekruis/shelter-database path: /src/web/views/shelter.py
#! /usr/bin/env python
#-*- coding: utf-8 -*-
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Shelter Database.
# Copyright (c) 2016 Luxembourg Institute of Science and Technology.
# All rights reserved.
#
#
#
# ***** ... | code_fim | hard | {
"lang": "python",
"repo": "rodekruis/shelter-database",
"path": "/src/web/views/shelter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file_extension = os.path.splitext(request.files[f].filename)[1]
exist_main = db.session.query(ShelterPicture.is_main_picture).filter(ShelterPicture.is_main_picture==True,ShelterPicture.shelter_id==shelter.id).first()
if not exist_main:
fil... | code_fim | hard | {
"lang": "python",
"repo": "rodekruis/shelter-database",
"path": "/src/web/views/shelter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nolar/kopf path: /tests/k8s/test_errors.py
import aiohttp
import pytest
from kopf._cogs.clients.auth import APIContext, authenticated
from kopf._cogs.clients.errors import APIClientError, APIConflictError, APIError, \
APIForbiddenError, APINotFoundError, \
... | code_fim | hard | {
"lang": "python",
"repo": "nolar/kopf",
"path": "/tests/k8s/test_errors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with pytest.raises(APIError) as err:
await get_it(f"http://{hostname}/")
assert err.value.status == status
assert err.value.code is None
assert err.value.message is None
assert err.value.details is None
@pytest.mark.parametrize('status', [400, 500, 666])
async def test_error... | code_fim | hard | {
"lang": "python",
"repo": "nolar/kopf",
"path": "/tests/k8s/test_errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thinhnguyenuit/sombra path: /render.py
import multiprocessing as mp
import numpy as np
from progress.bar import Bar
from random import random
# Local Modules
import utils
from ray import Ray
from raytrace import raytrace
PERCENTAGE_STEP = 1
RGB_CHANNELS = 3
def raytrace_mp_wrapper(args):
... | code_fim | hard | {
"lang": "python",
"repo": "thinhnguyenuit/sombra",
"path": "/render.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def render_dof(scene, camera, HEIGHT=100, WIDTH=100, V_SAMPLES=6, H_SAMPLES=6):
"""
Render the image for the given scene and camera using raytracing with
depth of field.
Args:
scene(Scene): The scene that contains objects, cameras and lights.
camera(Camera): The camera th... | code_fim | hard | {
"lang": "python",
"repo": "thinhnguyenuit/sombra",
"path": "/render.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def render_aa_t(
scene, camera, func, HEIGHT=100, WIDTH=100, V_SAMPLES=4,
H_SAMPLES=4
):
"""
Render the image for the given scene and camera using a template function.
Args:
scene(Scene): The scene that contains objects, cameras and lights.
camera(Camera): The... | code_fim | hard | {
"lang": "python",
"repo": "thinhnguyenuit/sombra",
"path": "/render.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not issubclass(sender, Profile):
return
article_list = instance.user.articlesOfUser.all()
for article in article_list:
article.save()
@receiver(post_save)
def set_user_type(sender,instance , **kwargs):
if not issubclass(sender, Profile):
return
if isinstance... | code_fim | hard | {
"lang": "python",
"repo": "JoinCODED/NationalFundCommunity",
"path": "/NFproject/user_profiles/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoinCODED/NationalFundCommunity path: /NFproject/user_profiles/models.py
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.exceptions import ValidationError
from django.utils.text import slugify
from django.db.models.signals import pre_save, post_sa... | code_fim | hard | {
"lang": "python",
"repo": "JoinCODED/NationalFundCommunity",
"path": "/NFproject/user_profiles/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schmjdt/gw2craft path: /auto_gen/Leatherworker.py
19908: 1},
11734: {13216: 1, 13217: 1, 19879: 1},
11771: {13210: 1, 13211: 1, 19849: 1},
11772: {13210: 1, 13211: 1, 19877: 1},
11773: {13210: 1, 13211: 1, 19909: 1},
11774: {13210: 1, 13211: 1, 19907: 1},
11775: {13210: 1, 13211: 1, 1... | code_fim | hard | {
"lang": "python",
"repo": "schmjdt/gw2craft",
"path": "/auto_gen/Leatherworker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schmjdt/gw2craft path: /auto_gen/Leatherworker.py
1, 19797: 1},
11644: {13089: 1, 13090: 1, 19805: 1},
11718: {13089: 1, 13090: 1, 19870: 1},
13089: {19720: 1, 19792: 1},
13090: {19720: 1, 19738: 1},
19796: {19720: 1, 24346: 3},
19797: {19720: 1, 24284: 3},
19805: {19720: 1, 24296: ... | code_fim | hard | {
"lang": "python",
"repo": "schmjdt/gw2craft",
"path": "/auto_gen/Leatherworker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>15, 72752: 2},
19964: {24354: 15, 72752: 2},
19965: {24348: 15, 72752: 2},
19966: {24292: 15, 72752: 2},
19967: {24344: 15, 72752: 2},
19968: {24286: 15, 72752: 2},
24811: {19699: 1, 24323: 2, 89216: 1, 89271: 4},
24817: {24328: 2, 89216: 1, 89271: 4},
38256: {13064: 1, 13074: 1, 38163: 1}... | code_fim | hard | {
"lang": "python",
"repo": "schmjdt/gw2craft",
"path": "/auto_gen/Leatherworker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexanderSlav/Automatic-Soccer-Highlights-Generation path: /Celebration_Classification/soccer_summarizator/soccer_summarizator.py
import skvideo.io
from utils import test_transforms
import torch
from tqdm import tqdm
from loguru import logger
import numpy as np
import scipy.ndimage as nd
from .mo... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderSlav/Automatic-Soccer-Highlights-Generation",
"path": "/Celebration_Classification/soccer_summarizator/soccer_summarizator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> picks = np.asarray(picks, dtype=np.int32)
assert self.summary.shape == picks.shape
# Get original frame scores from downsampled sequence
user_summary = np.zeros(n_frames, dtype=np.float32)
for i in range(len(picks)):
pos_lo = picks[i]
pos_hi... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderSlav/Automatic-Soccer-Highlights-Generation",
"path": "/Celebration_Classification/soccer_summarizator/soccer_summarizator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rschildmeijer/elastica path: /elastica/gossip.py
import time
import random
from tornado import ioloop
from tornado.options import options
from tornado.ioloop import PeriodicCallback
class Gossiper(object):
""" This module is responsible for Gossiping cluster information. The abstraction
... | code_fim | hard | {
"lang": "python",
"repo": "rschildmeijer/elastica",
"path": "/elastica/gossip.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _notify_on_join(self, host):
print "on_join(%s)" % host
[listener.on_join(host) for listener in self._node_state_change_listeners]
def _notify_on_alive(self, host):
print "on_alive(%s)" % host
[listener.on_alive(host) for listener in self._node_state_change_lis... | code_fim | hard | {
"lang": "python",
"repo": "rschildmeijer/elastica",
"path": "/elastica/gossip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if name == "heartbeatstate":
self._fd.heartbeat(host)
self._node_states[host][name] = digest
if host in self._dead_nodes and name == "heartbeatstate":
self._dead_nodes.remove(host)
self._alive_nodes.append(host)
self._notify_on_alive(... | code_fim | hard | {
"lang": "python",
"repo": "rschildmeijer/elastica",
"path": "/elastica/gossip.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kwpolska/adventofcode path: /2016/day10b_is_this_so_simple.py
#!/usr/bin/env python3
# You got rank 449 on this star's leaderboard.
from collections import defaultdict
with open("input/10_setup.txt") as fh:
file_setup = fh.read().strip()
with open("input/10_moves.txt") as fh:
file_moves... | code_fim | hard | {
"lang": "python",
"repo": "Kwpolska/adventofcode",
"path": "/2016/day10b_is_this_so_simple.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(bots)
return output[0] * output[1] * output[2]
test_data = ['value 5 goes to bot 2\nvalue 3 goes to bot 1\nvalue 2 goes to bot 2',
'bot 2 gives low to bot 1 and high to bot 0\nbot 1 gives low to output 1 and high to bot 0\nbot 0 gives low to output 2 and high to output 0']
#... | code_fim | hard | {
"lang": "python",
"repo": "Kwpolska/adventofcode",
"path": "/2016/day10b_is_this_so_simple.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daka83/json_content_validator path: /json_content_validator/json_content_validator.py
import inspect
import itertools
from json_content_validator.validators import ValidationStop, ValidationError
default_messages = {
'required': 'Field is required',
'email': 'Invalid email value',
'... | code_fim | hard | {
"lang": "python",
"repo": "daka83/json_content_validator",
"path": "/json_content_validator/json_content_validator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return StringKind(name, validators, self._messages)
def integer(self, name, validators):
return IntegerKind(name, validators, self._messages)
def float(self, name, validators):
return FloatKind(name, validators, self._messages)
def any(self, name, validators):
... | code_fim | hard | {
"lang": "python",
"repo": "daka83/json_content_validator",
"path": "/json_content_validator/json_content_validator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ile (l):
f.write(l)
l = sc.recv(1024)
f.close()
s.close()<|fim_prefix|># repo: Lavabar/audream path: /audream_v0.9(for 2.7)/test_server/client.py
import socket
import sys
s = socket.socket()
s.connect(("localhost",9999))
i=1
f = open(str(i)+".jpg",'wb') #open in binary
i=i+1
while (True)... | code_fim | medium | {
"lang": "python",
"repo": "Lavabar/audream",
"path": "/audream_v0.9(for 2.7)/test_server/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lavabar/audream path: /audream_v0.9(for 2.7)/test_server/client.py
import socket
import sys
s = socket.socket()
s.connect(("localhost",9999<|fim_suffix|>
# recibimos y escribimos en el fichero
l = sc.recv(1024)
while (l):
f.write(l)
l = sc.recv(1024)
f.close()
s.clos... | code_fim | medium | {
"lang": "python",
"repo": "Lavabar/audream",
"path": "/audream_v0.9(for 2.7)/test_server/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 5l1v3r1/dtf path: /python-dtf/dtf/core/packagemanager.py
ore.item.is_valid_version(version):
item.version = version
else:
log.e(TAG, "Invalid version specified. Exiting.")
return None
else:
item.version = None
# Remove the compiled file... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/dtf",
"path": "/python-dtf/dtf/core/packagemanager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif item_type == dtf.core.item.TYPE_MODULE:
rtn |= __generic_install(item, force, new_only,
is_module_installed,
__do_zip_module_install,
(export_zip, item))
elif it... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/dtf",
"path": "/python-dtf/dtf/core/packagemanager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def __do_binary_delete(item):
"""Perform the binary removal"""
file_path = DTF_BINARIES_DIR + item.install_name
if utils.delete_file(file_path) != 0:
log.e(TAG, "Error removing binary file! Continuing.")
conn = sqlite3.connect(DTF_DB)
cur = conn.cursor()
# Remove the l... | code_fim | hard | {
"lang": "python",
"repo": "5l1v3r1/dtf",
"path": "/python-dtf/dtf/core/packagemanager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adafruit/Adafruit_Learning_System_Guides path: /Playing_Sounds_and_Using_Buttons_with_Raspberry_Pi/simple-jukebox.py
# SPDX-FileCopyrightText: 2018 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# This script requires a Raspberry Pi 2, 3 or Zero. Circuit Python must
# be in... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_Learning_System_Guides",
"path": "/Playing_Sounds_and_Using_Buttons_with_Raspberry_Pi/simple-jukebox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not len(mp3_files) > 0:
print("No mp3 files found!")
print('--- Available mp3 files ---')
print(mp3_files)
print('--- Press button #1 to select mp3, button #2 to play current. ---')
index = 0
while True:
if not button1.value:
index += 1
if index >= len(mp3_files):
... | code_fim | medium | {
"lang": "python",
"repo": "adafruit/Adafruit_Learning_System_Guides",
"path": "/Playing_Sounds_and_Using_Buttons_with_Raspberry_Pi/simple-jukebox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>index = 0
while True:
if not button1.value:
index += 1
if index >= len(mp3_files):
index = 0
print("--- " + mp3_files[index] + " ---")
if not button2.value:
subprocess.Popen(['omxplayer', mp3_files[index]])
print('--- Playing ' + mp3_files[index... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_Learning_System_Guides",
"path": "/Playing_Sounds_and_Using_Buttons_with_Raspberry_Pi/simple-jukebox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
filename = sys.argv[1]
s = open(filename, "rb")
r = s.read()
k1 = '\xbe\xba\xfe\xca'
output_filename = "dropped.dll.raw"
for c in [0, 1, 2, 3]:
rdata = xor(r[c:], k1)
if "MZ\x90" in rdata:
rindex = rdata.index("MZ\x90")
print "[+] Found MZ Header at offset 0x{:02X}".format(rindex)
o = open(out... | code_fim | medium | {
"lang": "python",
"repo": "ekmixon/public_tools",
"path": "/cmstar/extract_cmstar_rtf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for c in [0, 1, 2, 3]:
rdata = xor(r[c:], k1)
if "MZ\x90" in rdata:
rindex = rdata.index("MZ\x90")
print "[+] Found MZ Header at offset 0x{:02X}".format(rindex)
o = open(output_filename, 'wb')
o.write(rdata[rindex:])
o.close()
if os.path.isfile(output_filename):
pe = pefile.PE(output_filenam... | code_fim | medium | {
"lang": "python",
"repo": "ekmixon/public_tools",
"path": "/cmstar/extract_cmstar_rtf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ekmixon/public_tools path: /cmstar/extract_cmstar_rtf.py
import pefile
import sys
import os
from itertools import cycle, izip
'''
This script will take a RTF document, containing the recently reported CMSTAR
malware family, as an argument. It will parse through the file looking for a MZ
header t... | code_fim | hard | {
"lang": "python",
"repo": "ekmixon/public_tools",
"path": "/cmstar/extract_cmstar_rtf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # parse image list
image_list = [i.strip() for i in args.images.split(',')]
assert len(image_list) > 0, "No valid image specified to detect"
detector = get_detector(args.network, args.prefix, args.epoch,
args.data_shape,
mx.nd.array(... | code_fim | hard | {
"lang": "python",
"repo": "h2oai/mxnet",
"path": "/example/ssd/demo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
args = parse_args()
if args.cpu:
ctx = mx.cpu()
else:
ctx = mx.gpu(args.gpu_id)
# parse image list
image_list = [i.strip() for i in args.images.split(',')]
assert len(image_list) > 0, "No valid image specified to detect"
detector = g... | code_fim | hard | {
"lang": "python",
"repo": "h2oai/mxnet",
"path": "/example/ssd/demo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: h2oai/mxnet path: /example/ssd/demo.py
import argparse
import tools.find_mxnet
import mxnet as mx
import os
import importlib
import sys
from detect.detector import Detector
CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat',
'bottle', 'bus', 'car', 'cat', 'chair',
'cow', 'di... | code_fim | hard | {
"lang": "python",
"repo": "h2oai/mxnet",
"path": "/example/ssd/demo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hqtsky/wows_shell path: /src/Python/examples/compareOutputs.py
from wows_shell import *
import numpy as np
import matplotlib
#matplotlib.use('TkAgg',warn=False, force=True)
import matplotlib.pyplot as plt
<|fim_suffix|>c = shellCalc()
c.setDtMin(.01)
c.calcImpactForwardEuler(s)
impacts['Forward ... | code_fim | medium | {
"lang": "python",
"repo": "hqtsky/wows_shell",
"path": "/src/Python/examples/compareOutputs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>c.calcImpactRungeKutta2(s)
impacts['RungeKutta2 .0001'] = s.getImpact()
plt.plot(impacts['Forward Euler .01'][impactIndices.distance, :],
impacts['Forward Euler .01'][impactIndices.effectivePenetrationHorizontalNormalized, :])
plt.plot(impacts['Runge Kutta .01'][impactIndices.distance, :],
... | code_fim | medium | {
"lang": "python",
"repo": "hqtsky/wows_shell",
"path": "/src/Python/examples/compareOutputs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># part 2
idx = 0
steps = 0
values = list(int(i) for i in open("day05.txt").read().split())
while True:
if values[idx] < 3:
values[idx] += 1
idx += values[idx] - 1
else:
values[idx] -= 1
idx += values[idx] + 1
steps += 1
if idx >= len(values):
brea... | code_fim | medium | {
"lang": "python",
"repo": "binarygondola/adventofcode-2017",
"path": "/day05.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
if values[idx] < 3:
values[idx] += 1
idx += values[idx] - 1
else:
values[idx] -= 1
idx += values[idx] + 1
steps += 1
if idx >= len(values):
break
# print(values)
# print(idx, len(values))
print("steps part 2:", steps)<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "binarygondola/adventofcode-2017",
"path": "/day05.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: binarygondola/adventofcode-2017 path: /day05.py
idx = 0
steps = 0
values = list(int(i) for i in open("day05.txt").read().split())
# part 1
while True:
values[idx] += 1
idx += values[idx] - 1
steps += 1
if idx >= len(values):
break
print("steps part 1:", steps)
# part 2
... | code_fim | hard | {
"lang": "python",
"repo": "binarygondola/adventofcode-2017",
"path": "/day05.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(len(fpos)<>6):
print('Error in sender function [sendCirc1FramePos]')
print('Frame cooridnate is an array of 6 elements [x,y,z,alpha,beta,gamma] ')
return
num=10000
buff = StringIO.StringIO(2048)
buff.write('cArtixanPositionCirc1_')
... | code_fim | hard | {
"lang": "python",
"repo": "Modi1987/iiwaPy",
"path": "/python_client/Senders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(len(fpos)<>6):
print('Error in sender function [sendCirc2FramePos]')
print('Frame cooridnate is an array of 6 elements [x,y,z,alpha,beta,gamma] ')
return
num=10000
buff = StringIO.StringIO(2048)
buff.write('cArtixanPositionCirc2_')
... | code_fim | hard | {
"lang": "python",
"repo": "Modi1987/iiwaPy",
"path": "/python_client/Senders.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Modi1987/iiwaPy path: /python_client/Senders.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 27 17:36:18 2018
@author: Mohammad SAFEEA
"""
import StringIO
import math
from GeneralPurpose import getDoubleFromString
class Senders:
def __init__(self,mysoc):
self.mysoc=mysoc
... | code_fim | hard | {
"lang": "python",
"repo": "Modi1987/iiwaPy",
"path": "/python_client/Senders.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>args = parser.parse_args()
try:
service = keystone.services.find(name=args.name)
except NotFound:
service = keystone.services.create(name=args.name, service_type=args.type,
description=args.description)
print(service)<|fim_prefix|># repo: 2gis/whalestack p... | code_fim | hard | {
"lang": "python",
"repo": "2gis/whalestack",
"path": "/docker/openstack/base/ubuntu/root/opt/2gis/openstack/create_service.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 2gis/whalestack path: /docker/openstack/base/ubuntu/root/opt/2gis/openstack/create_service.py
import os
import argparse
from keystoneclient.v2_0 import client as keystone_client
from keystoneclient.exceptions import NotFound
endpoint = os.environ.get('KEYSTONE_ADMIN_URL',
... | code_fim | hard | {
"lang": "python",
"repo": "2gis/whalestack",
"path": "/docker/openstack/base/ubuntu/root/opt/2gis/openstack/create_service.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class vehicle:
def __init__(self,wheels=0,capacity=0,fuel='petrol'): #default function that will be called wheever object is created
self.w=wheels
self.c=capacity
self.f=fuel
def assign(self,wheels,capacity,fuel):
self.w=wheels
self.c=capacity
self.f=fuel
def display(... | code_fim | medium | {
"lang": "python",
"repo": "01coders/100-Days-Of-Code",
"path": "/python_AbhiMS99/day_24",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.w=wheels
self.c=capacity
self.f=fuel
def display(self):
print(self.w,self.c,self.f)
car = vehicle(4,15,'petrol')
car.display()
car.assign(4,5,'diesel')
car.display()
bike=vehicle(2,5,'petrol')
bike.display()
class vehicle:
def __init__(self,wheels=0,capacity=0,fu... | code_fim | medium | {
"lang": "python",
"repo": "01coders/100-Days-Of-Code",
"path": "/python_AbhiMS99/day_24",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 01coders/100-Days-Of-Code path: /python_AbhiMS99/day_24
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 11:33:53 2019
@author: abhishekms
"""
class vehicle:
def __init__(self,wheels,capacity,petrol): #default function that will be called wheever object is created
... | code_fim | hard | {
"lang": "python",
"repo": "01coders/100-Days-Of-Code",
"path": "/python_AbhiMS99/day_24",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.prog = "VM Roller"
self.add_argument("difficulty", default=6, nargs="?", type=int,
help="The threshold the roll must meet or exceed")
self.add_argument("mod", default=0, nargs="?", type=int,
help="N... | code_fim | hard | {
"lang": "python",
"repo": "ephreal/rollbot",
"path": "/utils/rolling/parsers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ephreal/rollbot path: /utils/rolling/parsers.py
# -*- coding: utf-8 -*-
"""
This software is licensed under the License (MIT) located at
https://github.com/ephreal/rollbot/Licence
Please see the license for any restrictions or rights granted to you by the
License.
"""
import argparse
class In... | code_fim | hard | {
"lang": "python",
"repo": "ephreal/rollbot",
"path": "/utils/rolling/parsers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.prog = "Sr3Roller"
self.add_argument("threshold", default=4, nargs="?", type=int,
help="The threshold the roll must meet or exceed")
self.add_argument('-m', "--mod", type=int, default=0,
help="modif... | code_fim | hard | {
"lang": "python",
"repo": "ephreal/rollbot",
"path": "/utils/rolling/parsers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if stroka == "TIE":
print ("Ойойой, перепутал немного... Гордись ничейкой, человечек")
elif stroka == human:
print ("Поздравляю (я поддавался) жалкое (я поддавался) пресмыкающееся (да я честно поддавался)")
else:
print ("О даааа, ну я играл одним пальцем, лёгкая по... | code_fim | hard | {
"lang": "python",
"repo": "stasvorosh/pythonintask",
"path": "/PINp/2015/DENISENKO_A_N/task_13_27.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> userVvod = None
while userVvod != "д" and userVvod != "н":
userVvod = input ("Берёшь первый ход (то бишь крестики)? (д/н) ")
userVvod.lower()
if userVvod == "д":
return "X","O"
else:
return "O", "X" #Выбор первого хода, первое, что возвращается - выбо... | code_fim | hard | {
"lang": "python",
"repo": "stasvorosh/pythonintask",
"path": "/PINp/2015/DENISENKO_A_N/task_13_27.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stasvorosh/pythonintask path: /PINp/2015/DENISENKO_A_N/task_13_27.py
# Задача 13
# Разработайте собственную стратегию ходов компьютера для игры "Крестики-
#нолики" (Задача 12). Перепишите функцию computer_move() в соответствии с этой
#стратегией.
# Denisenko A. N.
# 02.06.2016
import r... | code_fim | hard | {
"lang": "python",
"repo": "stasvorosh/pythonintask",
"path": "/PINp/2015/DENISENKO_A_N/task_13_27.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_allclose(x_est, x, rtol=1e-3, atol=1e-4)
for g_est,g in zip(gradients_forward_i2l,gradients_forward):
assert_allclose(g_est,g)
for g_est,g in zip(gradients_reverse_i2l,gradients_reverse):
assert_allclose(g_est,g)
with torch.enable_grad():
z.detach_().requi... | code_fim | hard | {
"lang": "python",
"repo": "fcaliva/FNAF-fastMRI",
"path": "/irim/external/invertible_rim/irim/test/test_irim.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fcaliva/FNAF-fastMRI path: /irim/external/invertible_rim/irim/test/test_irim.py
import torch
from torch.testing import assert_allclose
from irim import InvertibleUnet
from irim import IRIM, InvertibleGradUpdate
from irim.test.utils import create_model_and_i2l_copy, forward_reverse, model_gradien... | code_fim | hard | {
"lang": "python",
"repo": "fcaliva/FNAF-fastMRI",
"path": "/irim/external/invertible_rim/irim/test/test_irim.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for g_est,g in zip(gradients_reverse_i2l,gradients_reverse):
assert_allclose(g_est,g)
with torch.enable_grad():
z.detach_().requires_grad_(True)
y_est = model.forward(x, z)
loss = torch.nn.functional.mse_loss(y_est,y)
grad_z = torch.autograd.grad(loss, z)[0... | code_fim | hard | {
"lang": "python",
"repo": "fcaliva/FNAF-fastMRI",
"path": "/irim/external/invertible_rim/irim/test/test_irim.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mangpo/greenthumb path: /configure.py
import commands
# Create path.rtk
status, abs_path = commands.g<|fim_suffix|>cket\n")
f.write("(provide (all-defined-out))\n")
f.write("(define srcpath \"" + abs_path + "\")\n")
print "path.rkt is created."<|fim_middle|>etstatusoutput("pwd")
f = open("path.r... | code_fim | medium | {
"lang": "python",
"repo": "mangpo/greenthumb",
"path": "/configure.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>cket\n")
f.write("(provide (all-defined-out))\n")
f.write("(define srcpath \"" + abs_path + "\")\n")
print "path.rkt is created."<|fim_prefix|># repo: mangpo/greenthumb path: /configure.py
import commands
# Create path.rtk
status, abs_path = commands.g<|fim_middle|>etstatusoutput("pwd")
f = open("path.r... | code_fim | medium | {
"lang": "python",
"repo": "mangpo/greenthumb",
"path": "/configure.py",
"mode": "spm",
"license": "BSD-2-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.