text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ably/ably-python path: /ably/util/crypto.py
import base64
import logging
try:
from Crypto.Cipher import AES
from Crypto import Random
except ImportError:
from .nocrypto import AES, Random
from ably.types.typedbuffer import TypedBuffer
from ably.util.exceptions import AblyException
... | code_fim | hard | {
"lang": "python",
"repo": "ably/ably-python",
"path": "/ably/util/crypto.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(plaintext, bytearray):
plaintext = bytes(plaintext)
padded_plaintext = self.__pad(plaintext)
encrypted = self.__iv + self.__encryptor.encrypt(padded_plaintext)
self.__iv = encrypted[-self.__block_size:]
return encrypted
def decrypt(sel... | code_fim | hard | {
"lang": "python",
"repo": "ably/ably-python",
"path": "/ably/util/crypto.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lukegb/Jawa path: /jawa/attributes/code.py
# -*- coding: utf8 -*-
__all__ = ('CodeAttribute', 'CodeException')
from struct import unpack, pack
from itertools import repeat
from collections import namedtuple
from six import PY3
from jawa.attribute import Attribute, AttributeTable
from jawa.util.... | code_fim | hard | {
"lang": "python",
"repo": "lukegb/Jawa",
"path": "/jawa/attributes/code.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def max_stack(self):
return self._max_stack
@max_stack.setter
def max_stack(self, value):
self._max_stack = value
@property
def max_locals(self):
return self._max_locals
@max_locals.setter
def max_locals(self, value):
self._max_l... | code_fim | hard | {
"lang": "python",
"repo": "lukegb/Jawa",
"path": "/jawa/attributes/code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta(object):
if django.VERSION >= (1, 10):
base_manager_name = "objects"
default_manager_name = "objects"
class UncachedDummyModel(models.Model):
title = models.CharField(max_length=50)
summary = models.CharField(max_length=400)
objects = DummyMan... | code_fim | medium | {
"lang": "python",
"repo": "educreations/django-ormcache",
"path": "/tests/testapp/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class OtherCachedDummyModel(models.Model):
cache_enabled = True
objects = DummyManager()
class Meta(object):
if django.VERSION >= (1, 10):
base_manager_name = "objects"
default_manager_name = "objects"
class UncachedDummyModel(models.Model):
title = mo... | code_fim | medium | {
"lang": "python",
"repo": "educreations/django-ormcache",
"path": "/tests/testapp/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: educreations/django-ormcache path: /tests/testapp/models.py
import django
from django.db import models
from tests.testapp.managers import DummyManager
class CachedDummyModel(models.Model):
cache_enabled = True
title = models.CharField(max_length=50)
summary = models.CharField(max... | code_fim | hard | {
"lang": "python",
"repo": "educreations/django-ormcache",
"path": "/tests/testapp/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DamienNivault/i3status path: /micro.py
import sounddevice as sd
import numpy as np
<|fim_suffix|>def print_sound(indata, outdata, frames, time, status):
volume_norm = np.linalg.norm(indata)*10
print("|" * int(volume_norm))
with sd.Stream(callback=print_sound):
sd.sleep(duration * 10... | code_fim | easy | {
"lang": "python",
"repo": "DamienNivault/i3status",
"path": "/micro.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> volume_norm = np.linalg.norm(indata)*10
print("|" * int(volume_norm))
with sd.Stream(callback=print_sound):
sd.sleep(duration * 100)<|fim_prefix|># repo: DamienNivault/i3status path: /micro.py
import sounddevice as sd
import numpy as np
<|fim_middle|>duration = 10 # seconds
def print_soun... | code_fim | medium | {
"lang": "python",
"repo": "DamienNivault/i3status",
"path": "/micro.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WisdomWolf/kindle-weather-display path: /server/weather-script.py
#!/usr/bin/python2
# Kindle Weather Display
# Matthew Petroff (http://mpetroff.net/)
# September 2012
from xml.dom import minidom
import datetime
import time
import codecs
import os
from subprocess import *
try:
# Python 3
... | code_fim | hard | {
"lang": "python",
"repo": "WisdomWolf/kindle-weather-display",
"path": "/server/weather-script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
if time.strftime('%M', time.localtime()) == current:
continue
else:
create_png(True)
efficient_time_update()
break
def efficient_time_update():
while True:
time.sleep(56)
this_minute = time.strftime('%M', ... | code_fim | hard | {
"lang": "python",
"repo": "WisdomWolf/kindle-weather-display",
"path": "/server/weather-script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> xml_icons = dom.getElementsByTagName('icon-link')
icons = [None]*4
for i in range(len(xml_icons)):
icons[i] = xml_icons[i].firstChild.nodeValue.split('/')[-1].split('.')[0].rstrip('0123456789')
return icons
def parse_dates(dom):
xml_day_one = dom.getElementsByTagName(... | code_fim | hard | {
"lang": "python",
"repo": "WisdomWolf/kindle-weather-display",
"path": "/server/weather-script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ingram7/SourceCodeOfBook path: /第10章/program/example_taptap.py
import time
import redis
import threading
from uiautomator import Device
class PhoneThread(threading.Thread):
def __init__(self, serial):
threading.Thread.__init__(self)
self.serial = serial
self.device =... | code_fim | hard | {
"lang": "python",
"repo": "Ingram7/SourceCodeOfBook",
"path": "/第10章/program/example_taptap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> input_box = self.device(resourceId='com.taptap:id/input_box')
input_box.clear_text()
input_box.set_text(game_name)
self.device(resourceId="com.taptap:id/search_btn").click()
search_result = self.device(textContains=game_name, resourceId="com.taptap:id/app_title")
... | code_fim | hard | {
"lang": "python",
"repo": "Ingram7/SourceCodeOfBook",
"path": "/第10章/program/example_taptap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gistable/gistable path: /all-gists/858398/snippet.py
import time
class Timing(object):
def __init__(self):
self.timings = {}
self.col = self.__collector()
self.col.next() #coroutine syntax
def __collector(self):
while True:
(na... | code_fim | hard | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/all-gists/858398/snippet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
timings = Timing()
@timings
def add(x,y):
for i in range(10000):
c = x + y
return c
@timings
def multiply(x,y):
for i in range(10000):
c = x * y
return c
for i in range(100):
add(3.,... | code_fim | hard | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/all-gists/858398/snippet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sort(begin, end)
if visualise:
vis(item, 'Quick Sort')
if __name__=='__main__':
n = 100
item=[None]*n
for i in range(n):
item[i] = random.random()*100
quick_sort(item, 0, len(item)-1, visualise=True, condition=lambda first, second: first > second)
... | code_fim | hard | {
"lang": "python",
"repo": "jainrocky/LORD",
"path": "/ALGO/sorting/dc__quick_sort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jainrocky/LORD path: /ALGO/sorting/dc__quick_sort.py
import os, sys, warnings, random
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'utils'))
from sorting_visualise import vis
def quick_sort(item, begin, end, visualise=None, condition=None):
if visualise:
warnin... | code_fim | hard | {
"lang": "python",
"repo": "jainrocky/LORD",
"path": "/ALGO/sorting/dc__quick_sort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ksengine/pywebview path: /webview/util.py
# -*- coding: utf-8 -*-
"""
(C) 2014-2019 Roman Sirokov and contributors
Licensed under BSD license
http://github.com/r0x0r/pywebview/
"""
import inspect
import json
import logging
import os
import re
import sys
import traceback
from platform import ar... | code_fim | hard | {
"lang": "python",
"repo": "Ksengine/pywebview",
"path": "/webview/util.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return base_tag + content
def interop_dll_path(dll_name):
if dll_name == 'WebBrowserInterop.dll':
dll_name = 'WebBrowserInterop.x64.dll' if architecture()[0] == '64bit' else 'WebBrowserInterop.x86.dll'
# Unfrozen path
dll_path = os.path.join(os.path.dirname(os.path.realpath(__fi... | code_fim | hard | {
"lang": "python",
"repo": "Ksengine/pywebview",
"path": "/webview/util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def escape_string(string):
return string\
.replace('\\', '\\\\') \
.replace('"', r'\"') \
.replace('\n', r'\n')\
.replace('\r', r'\r')
def make_unicode(string):
"""
Python 2 and 3 compatibility function that converts a string to Unicode. In case of Unicode, th... | code_fim | hard | {
"lang": "python",
"repo": "Ksengine/pywebview",
"path": "/webview/util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hengma1001/pytorch-geometric-sandbox path: /mdgraph/data/preprocess.py
import MDAnalysis
import numpy as np
from sklearn import preprocessing
<|fim_suffix|>def aminoacid_int_to_onehot(labels):
total_aa = np.max(labels) + 1
onehot = np.zeros((len(labels), total_aa))
for i, label in e... | code_fim | hard | {
"lang": "python",
"repo": "hengma1001/pytorch-geometric-sandbox",
"path": "/mdgraph/data/preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def aminoacid_int_to_onehot(labels):
total_aa = np.max(labels) + 1
onehot = np.zeros((len(labels), total_aa))
for i, label in enumerate(labels):
onehot[i][label] = 1
return onehot<|fim_prefix|># repo: hengma1001/pytorch-geometric-sandbox path: /mdgraph/data/preprocess.py
import M... | code_fim | hard | {
"lang": "python",
"repo": "hengma1001/pytorch-geometric-sandbox",
"path": "/mdgraph/data/preprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def svhn_iid(dataset, num_users):
num_items = int(len(dataset)/num_users)
dict_users, all_idxs = {}, [i for i in range(len(dataset))]
for i in range(num_users):
dict_users[i] = set(np.random.choice(all_idxs, num_items, replace=False))
all_idxs = list(set(all_idxs) - dict_users[... | code_fim | hard | {
"lang": "python",
"repo": "PengchaoHan/EasyFL",
"path": "/util/sampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # divide and assign
for i in range(num_users):
rand_set = set(np.random.choice(idx_shard, 2, replace=False))
idx_shard = list(set(idx_shard) - rand_set)
for rand in rand_set:
dict_users[i] = np.concatenate((dict_users[i], idxs[rand*num_imgs:(rand+1)*num_imgs]), ... | code_fim | hard | {
"lang": "python",
"repo": "PengchaoHan/EasyFL",
"path": "/util/sampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PengchaoHan/EasyFL path: /util/sampling.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
import numpy as np
from torchvision import datasets, transforms
import math
def mnist_iid(dataset, num_users):
"""
Sample I.I.D. client data from MNIST dataset
:param data... | code_fim | hard | {
"lang": "python",
"repo": "PengchaoHan/EasyFL",
"path": "/util/sampling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def print_allowed_actions(self):
print()
print("Allowed actions:")
print("- getDeviceData")
print("- changeSettings")
print("- bulbulbul", end="")
def handle_action(self, action):
if action == "getDeviceData":
get_device_data(self)
... | code_fim | hard | {
"lang": "python",
"repo": "j-adamczyk/Distributed_systems",
"path": "/4_2_smart_home/Client/handlers/bulbulators/bulbulator_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print()
print("Allowed actions:")
print("- getDeviceData")
print("- changeSettings")
print("- bulbulbul", end="")
def handle_action(self, action):
if action == "getDeviceData":
get_device_data(self)
elif action == "changeSettings":
... | code_fim | hard | {
"lang": "python",
"repo": "j-adamczyk/Distributed_systems",
"path": "/4_2_smart_home/Client/handlers/bulbulators/bulbulator_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-adamczyk/Distributed_systems path: /4_2_smart_home/Client/handlers/bulbulators/bulbulator_handler.py
import Ice
from IoT import *
from ..utils import get_device_data, change_settings, test_connection
class BulbulatorInfo:
def __init__(self, name, communicator):
self.name = name
... | code_fim | hard | {
"lang": "python",
"repo": "j-adamczyk/Distributed_systems",
"path": "/4_2_smart_home/Client/handlers/bulbulators/bulbulator_handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EugeneFilippovich/Software_Testing_Selenium path: /task13_high/app/application.py
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from task13_high.pages.main_page import MainPage
from task13_high.pages.item_page import ItemPage
from t... | code_fim | hard | {
"lang": "python",
"repo": "EugeneFilippovich/Software_Testing_Selenium",
"path": "/task13_high/app/application.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.driver.quit()
return self
def main_page_load(self):
self.main_page.open()
return self
def item_select(self):
self.main_page.select_item()
return self
def item_to_cart(self):
self.item_page.add_item('Small')
self.item_page.... | code_fim | hard | {
"lang": "python",
"repo": "EugeneFilippovich/Software_Testing_Selenium",
"path": "/task13_high/app/application.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> A = sigmoid(np.dot(w.T,X) + b)
for i in range (A.shape[1]):
Y_prediction[0,i] = 1 if A[0,i]>0.5 else 0
assert(Y_prediction.shape == (1,m))
return Y_prediction
def model(X_train,Y_train,X_test,Y_test,num_iterations = 2000,learning_rate =0.005,print_cost = False):
w... | code_fim | hard | {
"lang": "python",
"repo": "18724799167/DeepLearning",
"path": "/1course week1/LR.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 18724799167/DeepLearning path: /1course week1/LR.py
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 17 10:18:52 2017
@author: Administrator
"""
import numpy as np
import matplotlib.pyplot as plt
import h5py
import scipy
from PIL import Image
from scipy import ndimage
from lr_utils import load_da... | code_fim | hard | {
"lang": "python",
"repo": "18724799167/DeepLearning",
"path": "/1course week1/LR.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> params = {'w':w,'b':b}
grads = {'dw':dw,'db':db}
return params,grads,costs
def predict(w,b,X):
m = X.shape[1]
Y_prediction = np.zeros((1,m))
w = w.reshape(X.shape[0],1)
A = sigmoid(np.dot(w.T,X) + b)
for i in range (A.shape[1]):
Y_prediction[0,i]... | code_fim | hard | {
"lang": "python",
"repo": "18724799167/DeepLearning",
"path": "/1course week1/LR.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: steinwurf/shuft path: /wscript
#! /usr/bin/env python
# encoding: utf-8
import os
import waflib
def options(opt):
opt.add_option(
'--run_tests', default=False, action='store_true',
help='Run all unit tests')
def configure(conf):
pass
def build(bld):
with bld.cr... | code_fim | medium | {
"lang": "python",
"repo": "steinwurf/shuft",
"path": "/wscript",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Run the unit-tests
if bld.options.run_tests:
venv.pip_install(packages=[
'pytest', 'pytest-testdirectory', 'cryptography'])
venv.run(cmd='python setup.py pytest', cwd=bld.path)<|fim_prefix|># repo: steinwurf/shuft path: /wscript
#! /usr/bin/env python
# encoding: utf... | code_fim | hard | {
"lang": "python",
"repo": "steinwurf/shuft",
"path": "/wscript",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EscuelaDeDatos/datal path: /core/lifecycle/resource.py
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from core.choices import StatusChoices
from core.daos.activity_stream import ActivityStreamDAO
from core.exceptions import IllegalStateException
from core.lib.datastore import ... | code_fim | hard | {
"lang": "python",
"repo": "EscuelaDeDatos/datal",
"path": "/core/lifecycle/resource.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._update_last_revisions()
self._log_activity(ActionStreams.DELETE)
self._delete_cache(cache_key='my_total_%s_%d' % (self.model_name_plural, self.resource.user.id) )
self._delete_cache(cache_key='account_total_%s_%d' % (self.model_name_plural, self.resource.user.account.... | code_fim | hard | {
"lang": "python",
"repo": "EscuelaDeDatos/datal",
"path": "/core/lifecycle/resource.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enriclluelles/troposphere_sugar path: /troposphere_sugar/runner.py
from __future__ import print_function
import boto3
import sys
import time
import botocore.exceptions
class Runner(object):
def __init__(self, template, stack_name, params=[], iam_capability=False, session=None):
self.... | code_fim | hard | {
"lang": "python",
"repo": "enriclluelles/troposphere_sugar",
"path": "/troposphere_sugar/runner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def create(self):
print(self.stack_operation_args())
self.client.create_stack(**self.stack_operation_args())
def update(self):
try:
self.client.update_stack(**self.stack_operation_args())
except botocore.exceptions.ClientError as e:
if "No u... | code_fim | hard | {
"lang": "python",
"repo": "enriclluelles/troposphere_sugar",
"path": "/troposphere_sugar/runner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanjeric/GrapheneDjangoAPI path: /project/schema.py
import graphene
import graphql_jwt
import project.sampleapp.schema
import project.users.schema
class Query(
project.users.schema.Query,
project.sampleapp.schema.Query,
graphene.ObjectType):
<|fim_suffix|> project.users.schema.M... | code_fim | medium | {
"lang": "python",
"repo": "ryanjeric/GrapheneDjangoAPI",
"path": "/project/schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Mutation(
project.users.schema.Mutation,
project.sampleapp.schema.Mutation,
graphene.ObjectType):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
schema = graphene.Schema(query=Query,m... | code_fim | medium | {
"lang": "python",
"repo": "ryanjeric/GrapheneDjangoAPI",
"path": "/project/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>schema = graphene.Schema(query=Query,mutation=Mutation)<|fim_prefix|># repo: ryanjeric/GrapheneDjangoAPI path: /project/schema.py
import graphene
import graphql_jwt
import project.sampleapp.schema
import project.users.schema
class Query(
project.users.schema.Query,
project.sampleapp.schema.Query... | code_fim | hard | {
"lang": "python",
"repo": "ryanjeric/GrapheneDjangoAPI",
"path": "/project/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vicalloy/django-lb-workflow path: /lbworkflow/core/transition.py
from django.utils import timezone
from lbworkflow.models import Event, Task
from .sendmsg import wf_send_msg
def create_event(instance, transition, **kwargs):
act_type = "transition" if transition.pk else transition.code
... | code_fim | hard | {
"lang": "python",
"repo": "vicalloy/django-lb-workflow",
"path": "/lbworkflow/core/transition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> last_event = self.last_event
if not last_event:
return
next_operators = last_event.next_operators.distinct()
need_notify_operators = []
for operator in next_operators:
new_task = Task(
instance=self.instance, node=self.to_n... | code_fim | hard | {
"lang": "python",
"repo": "vicalloy/django-lb-workflow",
"path": "/lbworkflow/core/transition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tencent/bk-base path: /src/api/datamanage/tests/demo/test_class_demo.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed u... | code_fim | hard | {
"lang": "python",
"repo": "Tencent/bk-base",
"path": "/src/api/datamanage/tests/demo/test_class_demo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
测试ViewSet中的函数
"""
mock_metaapi_result.return_value = {
'processing_type': 'stream',
'fields': [
{
'field_name': 'timestamp',
'field_type': 'timestamp',
},
{
... | code_fim | hard | {
"lang": "python",
"repo": "Tencent/bk-base",
"path": "/src/api/datamanage/tests/demo/test_class_demo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Generates pre-prepared 'JPK.csv' """
for plik in plikiKaper:
with open(plik[0], 'r') as in_text, open(plik[0] + '.csv', 'w', newline='') as out_csv:
in_reader = list(csv.reader(in_text, delimiter='|'))
out_writer = csv.writer(out_csv, delimiter=';', quoting=... | code_fim | medium | {
"lang": "python",
"repo": "pythonsway/JPKconverter",
"path": "/jpk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonsway/JPKconverter path: /jpk.py
import csv
import glob
import os
import re
import time
kaper = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'kaper'))
schemat = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'schemat'))
plikiKaper0 = glob.glob(k... | code_fim | medium | {
"lang": "python",
"repo": "pythonsway/JPKconverter",
"path": "/jpk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@classmethod
def sync(cls, mxd):
"""
Syncronize any Metadata for this `GXMXD <geosoft.gxapi.GXMXD>`
:param mxd: `GXMXD <geosoft.gxapi.GXMXD>` file name
:type mxd: str
.. versionadded:: 7.0
**License:** `Geosoft End-User License <https... | code_fim | hard | {
"lang": "python",
"repo": "GeosoftInc/gxpy",
"path": "/geosoft/gxapi/GXMXD.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeosoftInc/gxpy path: /geosoft/gxapi/GXMXD.py
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTIC... | code_fim | hard | {
"lang": "python",
"repo": "GeosoftInc/gxpy",
"path": "/geosoft/gxapi/GXMXD.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create metadata for this brand new `GXMXD <geosoft.gxapi.GXMXD>` (we are the creator)
:param mxd: `GXMXD <geosoft.gxapi.GXMXD>` file name
:type mxd: str
.. versionadded:: 7.0
**License:** `Geosoft End-User License <https://geosoftgxdev.atla... | code_fim | hard | {
"lang": "python",
"repo": "GeosoftInc/gxpy",
"path": "/geosoft/gxapi/GXMXD.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jackycct/deep_racer_guru path: /src/tracks/po_chun_super_speedway_track.py
ngle turn its short track counterpart. It is named in honor of the 2020 AWS DeepRacer League Champion from NCTU CGI Taiwan."
self._ui_length_in_m = 89.24 # metres
self._ui_width_in_cm = 107 # centimetres
... | code_fim | hard | {
"lang": "python",
"repo": "jackycct/deep_racer_guru",
"path": "/src/tracks/po_chun_super_speedway_track.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jackycct/deep_racer_guru path: /src/tracks/po_chun_super_speedway_track.py
peed right angle turn its short track counterpart. It is named in honor of the 2020 AWS DeepRacer League Champion from NCTU CGI Taiwan."
self._ui_length_in_m = 89.24 # metres
self._ui_width_in_cm = 107 # ... | code_fim | hard | {
"lang": "python",
"repo": "jackycct/deep_racer_guru",
"path": "/src/tracks/po_chun_super_speedway_track.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>6545939445496, 0.47524674236774445),
(-4.421532511711121, 0.7724817097187042), (-4.3914880752563485, 1.0715615153312634),
(-4.3853970766067505, 1.3720359802246094), (-4.406944632530212, 1.6718485355377197),
... | code_fim | hard | {
"lang": "python",
"repo": "jackycct/deep_racer_guru",
"path": "/src/tracks/po_chun_super_speedway_track.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_children(self) -> List[AstNode]:
return [x for c in (self.start_x, self.start_y, self.end_x, self.end_y, self.color) for x in c.flatten()]<|fim_prefix|># repo: Cloudxtreme/Turing path: /src/algo/stmts/GLineStmt.py
# -*- coding: utf-8 -*-
from .BaseStmt import *
class GLineStmt(Base... | code_fim | medium | {
"lang": "python",
"repo": "Cloudxtreme/Turing",
"path": "/src/algo/stmts/GLineStmt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cloudxtreme/Turing path: /src/algo/stmts/GLineStmt.py
# -*- coding: utf-8 -*-
from .BaseStmt import *
class GLineStmt(BaseStmt):
def __init__(self, start_x: AstNode, start_y: AstNode, end_x: AstNode, end_y: AstNode, color: AstNode):
super().__init__()
self.start_x = start_x... | code_fim | medium | {
"lang": "python",
"repo": "Cloudxtreme/Turing",
"path": "/src/algo/stmts/GLineStmt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ['BaseDataProvider', 'DataType', 'QiskitFinanceError',
'DataOnDemandProvider',
'ExchangeDataProvider',
'WikipediaDataProvider']<|fim_prefix|># repo: hopemogale/qiskit-aqua path: /qiskit/aqua/translators/data_providers/__init__.py
# -*- coding: utf-8 -*-
# Copy... | code_fim | hard | {
"lang": "python",
"repo": "hopemogale/qiskit-aqua",
"path": "/qiskit/aqua/translators/data_providers/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hopemogale/qiskit-aqua path: /qiskit/aqua/translators/data_providers/__init__.py
# -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 Lic... | code_fim | hard | {
"lang": "python",
"repo": "hopemogale/qiskit-aqua",
"path": "/qiskit/aqua/translators/data_providers/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ECP-WarpX/WarpX path: /Examples/Tests/pml/analysis_pml_psatd.py
#!/usr/bin/env python3
# Copyright 2019 Jean-Luc Vay, Maxence Thevenet, Remi Lehe
#
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
import os
import sys
import numpy as np
import scipy.constants as scc
import yt ; ... | code_fim | medium | {
"lang": "python",
"repo": "ECP-WarpX/WarpX",
"path": "/Examples/Tests/pml/analysis_pml_psatd.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Check consistency of field energy diagnostics with initial energy above
ds = yt.load('pml_x_psatd_plt000050')
all_data_level_0 = ds.covering_grid(level=0, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)
Bx = all_data_level_0['boxlib', 'Bx'].v.squeeze()
By = all_data_level_0['boxlib', 'By'].v.s... | code_fim | medium | {
"lang": "python",
"repo": "ECP-WarpX/WarpX",
"path": "/Examples/Tests/pml/analysis_pml_psatd.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>assert(reflectivity < reflectivity_max)
# Check restart data v. original data
sys.path.insert(0, '../../../../warpx/Examples/')
from analysis_default_restart import check_restart
check_restart(filename)
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)<|fim_pr... | code_fim | hard | {
"lang": "python",
"repo": "ECP-WarpX/WarpX",
"path": "/Examples/Tests/pml/analysis_pml_psatd.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_colic.py
#calss header
class _COLIC():
def __init__(self,):
self.name = "COLIC"
self.definitions = [u'a severe but not continuous pain in the bottom part of the stomach or bowels, especially in` babies']
self.parents = []
self.childen = [... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_colic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FISHMANPET/DasDeployer path: /dasdeployer/dasdeployer.py
#!/usr/bin/env python3
from gpiozero import LEDBoard, ButtonBoard, Button, CPUTemperature
from subprocess import check_call
from time import sleep, time
from lcd import LCD_HD44780_I2C
from rgb import Color, RGBButton
from pipelines import... | code_fim | hard | {
"lang": "python",
"repo": "FISHMANPET/DasDeployer",
"path": "/dasdeployer/dasdeployer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for button in switch:
if button.when_pressed:
button.when_pressed = None
switchLight.off()
toggle.dev.when_pressed = dev_deploy
toggle.test.when_pressed = test_deploy
toggle.stage.when_pressed = stage_deploy
toggle.prod.when_pressed = prod_deploy
toggle.de... | code_fim | hard | {
"lang": "python",
"repo": "FISHMANPET/DasDeployer",
"path": "/dasdeployer/dasdeployer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abeja-inc/abeja-platform-cli path: /tests/unit/version_test.py
from unittest import TestCase
import abejacli.version
<|fim_suffix|> def test_version(self):
self.assertIsInstance(abejacli.version.VERSION, str)<|fim_middle|>
class VersionTest(TestCase):
"""this is a sample test cas... | code_fim | medium | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/tests/unit/version_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_version(self):
self.assertIsInstance(abejacli.version.VERSION, str)<|fim_prefix|># repo: abeja-inc/abeja-platform-cli path: /tests/unit/version_test.py
from unittest import TestCase
import abejacli.version
<|fim_middle|>class VersionTest(TestCase):
"""this is a sample test cas... | code_fim | medium | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/tests/unit/version_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertIsInstance(abejacli.version.VERSION, str)<|fim_prefix|># repo: abeja-inc/abeja-platform-cli path: /tests/unit/version_test.py
from unittest import TestCase
import abejacli.version
<|fim_middle|>
class VersionTest(TestCase):
"""this is a sample test case to make coverate report
... | code_fim | medium | {
"lang": "python",
"repo": "abeja-inc/abeja-platform-cli",
"path": "/tests/unit/version_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
run()<|fim_prefix|># repo: jomilto/cursoPOOUber path: /Python/main.py
from car import Car
from account import Account
<|fim_middle|>def run():
car = Car("ASD1232", Account("Enrique Perez", "EP123"))
car.passengers = 4
print(vars(car))
print(vars(car.driver)... | code_fim | medium | {
"lang": "python",
"repo": "jomilto/cursoPOOUber",
"path": "/Python/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jomilto/cursoPOOUber path: /Python/main.py
from car import Car
from account import Account
<|fim_suffix|>if __name__ == "__main__":
run()<|fim_middle|>def run():
car = Car("ASD1232", Account("Enrique Perez", "EP123"))
car.passengers = 4
print(vars(car))
print(vars(car.driver)... | code_fim | medium | {
"lang": "python",
"repo": "jomilto/cursoPOOUber",
"path": "/Python/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> car = Car("ASD1232", Account("Enrique Perez", "EP123"))
car.passengers = 4
print(vars(car))
print(vars(car.driver))
if __name__ == "__main__":
run()<|fim_prefix|># repo: jomilto/cursoPOOUber path: /Python/main.py
from car import Car
from account import Account
<|fim_middle|>def run(... | code_fim | easy | {
"lang": "python",
"repo": "jomilto/cursoPOOUber",
"path": "/Python/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Johanvm318/crud-venta-libre path: /producto/views.py
# -*- coding: utf-8 -*-
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, TemplateView
from django.urls import reverse_lazy
from django.shortcuts import reverse
<|fim_suffix|> context = super(GraficaVentas, ... | code_fim | hard | {
"lang": "python",
"repo": "Johanvm318/crud-venta-libre",
"path": "/producto/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class VentasUpdateView(UpdateView):
"""
Autor: Johan Vasquez - Cristian Viveros
Descripción: Vista para editar ventas
"""
model = Ventas
form_class = VentasForm
success_url = reverse_lazy('producto:listar_ventas')
class VentasListView(ListView):
"""
Autor: Johan Vasqu... | code_fim | hard | {
"lang": "python",
"repo": "Johanvm318/crud-venta-libre",
"path": "/producto/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class GraficaVentas(TemplateView):
"""
Autor: Johan Vasquez - Cristian Viveros
Descripción: Vista para eliminar las ventas
"""
template_name = 'producto/estadistica.html'
def get_context_data(self, *args, **kwargs):
context = super(GraficaVentas, self).get_context_data(*a... | code_fim | hard | {
"lang": "python",
"repo": "Johanvm318/crud-venta-libre",
"path": "/producto/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LiuJunb/PythonStudy path: /Flask/Flask-Home4/manage.py
# coding:utf-8
from ihome import create_app, db
# 数据库管理命令
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app('develop')
# 导入要创建的表
from ihome import models
<|fim_suffix|>if __name__ == '__mai... | code_fim | medium | {
"lang": "python",
"repo": "LiuJunb/PythonStudy",
"path": "/Flask/Flask-Home4/manage.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>manager = Manager(app)
Migrate(app, db)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
# app.run(host='127.0.0.1', port=8000, debug=True)
manager.run() # python manage.py runserver<|fim_prefix|># repo: LiuJunb/PythonStudy path: /Flask/Flask-Home4/manage.py
# coding:utf-8
from ... | code_fim | medium | {
"lang": "python",
"repo": "LiuJunb/PythonStudy",
"path": "/Flask/Flask-Home4/manage.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> inputs = Input(shape=(Args.maxlen,), dtype='int32')
emb = Embedding(input_dim=len(id2token) + 1, output_dim=Args.emb_size,
mask_zero=False)(inputs)
enc = Bidirectional(LSTM(units=Args.units, return_sequences=True,
dropo... | code_fim | hard | {
"lang": "python",
"repo": "GZU-JK/BiLSTM-GCN-for-Sentiment-Analysis",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Model(inputs=[inputs, graph], outputs=outputs, name='bilstm_gcn')
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
def bilstm_gat_(self, id2token):
inputs = Input(shape=(Args.maxlen,), dtype='int32')
... | code_fim | hard | {
"lang": "python",
"repo": "GZU-JK/BiLSTM-GCN-for-Sentiment-Analysis",
"path": "/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GZU-JK/BiLSTM-GCN-for-Sentiment-Analysis path: /model.py
from keras.models import Input, Model
from keras.layers import Embedding, Bidirectional, LSTM, Dense, GlobalAveragePooling1D
from args import Args
from spektral.layers import GCNConv
class Models:
def bilstm_gat(self, matrix,... | code_fim | hard | {
"lang": "python",
"repo": "GZU-JK/BiLSTM-GCN-for-Sentiment-Analysis",
"path": "/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0, len(argv)):
if argv[i] == "-f":
self.folder = argv[i + 1]
# masks
self.mask1 = 0
self.mask2 = 0
for i in range(0, len(argv)):
if argv[i] == "-m1":
self.mask1 = argv[i + 1]
if argv... | code_fim | hard | {
"lang": "python",
"repo": "Gimba/AmberUtils",
"path": "/Occupancy/input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gimba/AmberUtils path: /Occupancy/input.py
import cpptraj_helper as cpp
class Input:
def __init__(self, argv):
self.argv = argv
if not isinstance(argv,list):
raise TypeError("Input has to be of type list. Given: %s" % type(argv))
if len(argv) < 4:
... | code_fim | hard | {
"lang": "python",
"repo": "Gimba/AmberUtils",
"path": "/Occupancy/input.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = mem[n-1]
print(x)
sevenish(6)<|fim_prefix|># repo: SVCE-ACM/A-December-of-Algorithms-2019 path: /December-01/python_kamali1511_sevenish-number.py
def sevenish(n):
last_power_index = 0
add_index = 0
mem = [1] * n
<|fim_middle|> for i in range(1, n):
if add_index == last_power_index:
... | code_fim | hard | {
"lang": "python",
"repo": "SVCE-ACM/A-December-of-Algorithms-2019",
"path": "/December-01/python_kamali1511_sevenish-number.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SVCE-ACM/A-December-of-Algorithms-2019 path: /December-01/python_kamali1511_sevenish-number.py
def sevenish(n):
last_power_index = 0
add_index = 0
mem = [1] * n
<|fim_suffix|> x = mem[n-1]
print(x)
sevenish(6)<|fim_middle|> for i in range(1, n):
if add_index == last_power_index:
... | code_fim | hard | {
"lang": "python",
"repo": "SVCE-ACM/A-December-of-Algorithms-2019",
"path": "/December-01/python_kamali1511_sevenish-number.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if fall_count > 10 and current_alt > ground_alt + 100 and current_alt - ground_alt < 650:
# turn servo
kit.servo[4].angle = 69
print('deploying payload')
# sleep for easy analysis during testing
time.sleep(.5)
except:
pass<|fim_prefi... | code_fim | hard | {
"lang": "python",
"repo": "JG3233/Top_Bay_Avionics",
"path": "/payload_release.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JG3233/Top_Bay_Avionics path: /payload_release.py
#!/usr/bin/python3
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Modified GPS module demonstration for 2021 NSLI
# Authored by Jacob Gilhaus of WURocketry
# Washington University in St. Louis
i... | code_fim | hard | {
"lang": "python",
"repo": "JG3233/Top_Bay_Avionics",
"path": "/payload_release.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>base_time = time.monotonic()
last_print = time.monotonic()
count = 0
fall_count = 0
ground_alt = -1
while ground_alt < 0 or ground_alt > 250:
try:
ground_alt = int(bmp.altitude)
except:
pass
#current_alt = ground_alt
print('ground alt', ground_alt)
#testing value
current_alt = 85... | code_fim | hard | {
"lang": "python",
"repo": "JG3233/Top_Bay_Avionics",
"path": "/payload_release.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: papamarkou/eeyore path: /eeyore/stats/cov.py
import torch
# https://discuss.pytorch.org/t/covariance-and-gradient-support/16217
<|fim_suffix|> return x_ctr.matmul(x_ctr.t()).squeeze() / (x.size(1) - 1)<|fim_middle|>def cov(x, rowvar=False):
if x.dim() > 2:
raise ValueError('x has... | code_fim | hard | {
"lang": "python",
"repo": "papamarkou/eeyore",
"path": "/eeyore/stats/cov.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x_ctr = x - torch.mean(x, dim=1, keepdim=True)
return x_ctr.matmul(x_ctr.t()).squeeze() / (x.size(1) - 1)<|fim_prefix|># repo: papamarkou/eeyore path: /eeyore/stats/cov.py
import torch
# https://discuss.pytorch.org/t/covariance-and-gradient-support/16217
<|fim_middle|>def cov(x, rowvar=False):... | code_fim | hard | {
"lang": "python",
"repo": "papamarkou/eeyore",
"path": "/eeyore/stats/cov.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vezzi/TACA path: /taca/server_status/cli.py
import click
import logging
import os
from taca.server_status import server_status as status
from taca.utils.config import CONFIG
from taca.server_status import cronjobs as cj # to avoid similar names with command, otherwise exception
@click.group()... | code_fim | hard | {
"lang": "python",
"repo": "vezzi/TACA",
"path": "/taca/server_status/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># must be run on uppmax, as no passwordless ssh to uppmax servers
@server_status.command()
@click.option('--disk-quota', is_flag=True, help="Check the available space on the disks")
@click.option('--cpu-hours', is_flag=True, help="Check the usage of CPU hours")
def uppmax(disk_quota, cpu_hours):
"""
... | code_fim | medium | {
"lang": "python",
"repo": "vezzi/TACA",
"path": "/taca/server_status/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sample(self, state, action):
if state._context != self.current_outcome.observation._context:
self._gym_env.set_state(state._context)
outcome = super().step(action)
observation = GymDomainStateProxy(state=normalize_and_round(outcome.observation), context=self._gy... | code_fim | hard | {
"lang": "python",
"repo": "walter-bd/scikit-decide",
"path": "/examples/gym_jsbsim_uct.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: walter-bd/scikit-decide path: /examples/gym_jsbsim_uct.py
# Copyright (c) AIRBUS and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import gym
import gym_jsbsim
import numpy as np
import folium
import js... | code_fim | hard | {
"lang": "python",
"repo": "walter-bd/scikit-decide",
"path": "/examples/gym_jsbsim_uct.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inner_span, producer_span, root_span = json.loads(obj)
assert root_span == {
"traceId": zipkin_attrs.trace_id,
"name": "test_span_name",
"parentId": zipkin_attrs.parent_span_id,
"id": zipkin_attrs.span_id,
"kind": "CLIENT",
"timestamp": us(ts),
... | code_fim | hard | {
"lang": "python",
"repo": "Vinta-IAAS-Labs/py_zipkin",
"path": "/tests/integration/encoding_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert producer_span == {
"traceId": zipkin_attrs.trace_id,
"name": "producer_span",
"parentId": zipkin_attrs.span_id,
"id": inner_span_id,
"kind": "PRODUCER",
"timestamp": us(ts),
"duration": us(10),
"localEndpoint": {
"ipv4"... | code_fim | hard | {
"lang": "python",
"repo": "Vinta-IAAS-Labs/py_zipkin",
"path": "/tests/integration/encoding_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vinta-IAAS-Labs/py_zipkin path: /tests/integration/encoding_test.py
import json
from collections import OrderedDict
from unittest import mock
import pytest
from thriftpy2.protocol.binary import read_list_begin
from thriftpy2.protocol.binary import TBinaryProtocol
from thriftpy2.transport import ... | code_fim | hard | {
"lang": "python",
"repo": "Vinta-IAAS-Labs/py_zipkin",
"path": "/tests/integration/encoding_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> "english-website",
"english-mobile-app",
"allowed-residents",
"free-accounts",
"free-worldwide-withdrawals",
"english-customer-service",
],
"key": "name",
"representation": ["name"],
},
"person": {
"attr... | code_fim | hard | {
"lang": "python",
"repo": "BrunoMRTZ/tutorial-knowledge-base",
"path": "/schema.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>first-name",
"gender",
"phone-number",
"city",
],
"key": "email",
"representation": ["first-name", "last-name"],
},
"card": {
"attributes": ["name-on-card", "expiry-date", "created-date", "card-number"],
"key": "card-numbe... | code_fim | hard | {
"lang": "python",
"repo": "BrunoMRTZ/tutorial-knowledge-base",
"path": "/schema.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BrunoMRTZ/tutorial-knowledge-base path: /schema.py
schema = {
"transaction": {
"attributes": ["category", "execution-date", "amount", "reference"],
"key": "identifier",
"representation": [
"execution-date",
"reference",
"account-of-r... | code_fim | hard | {
"lang": "python",
"repo": "BrunoMRTZ/tutorial-knowledge-base",
"path": "/schema.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for m in get_typ(typ, address):
stamp = calendar.timegm(m.time.utctimetuple())
workers.setdefault(m.worker, {})
workers[m.worker].setdefault(stamp, 0)
workers[m.worker][stamp] += m.value
step = typ.slice_seconds
end = ((int(time.time()) // step) * step) - (step ... | code_fim | hard | {
"lang": "python",
"repo": "palon7/simplemona",
"path": "/simplecoin/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: palon7/simplemona path: /simplecoin/views.py
import calendar
import time
import yaml
import datetime
from itsdangerous import TimedSerializer
from flask import (current_app, request, render_template, Blueprint, abort,
jsonify, g, session, Response)
from lever import get_joined... | code_fim | hard | {
"lang": "python",
"repo": "palon7/simplemona",
"path": "/simplecoin/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.