text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: brainmorsel/python-dhcp-sprout path: /ds/dhcp/bench.py
import logging
import socket
import threading
import time
from .proto.packet import Packet
from .proto.opttypes import OptionType
from .proto.dhcpmsg import MessageType
def sync_worker(address, on_success, on_fail, oneshot=False, macaddr=... | code_fim | hard | {
"lang": "python",
"repo": "brainmorsel/python-dhcp-sprout",
"path": "/ds/dhcp/bench.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for _ in range(threads):
t = threading.Thread(target=sync_worker, args=((host, port), inc_success, inc_fail, False, macaddr, relay_ip), daemon=True)
t.start()
while True:
time.sleep(1.0)
print('requests success: %s fail: %s' % (success_count, fail_count))
s... | code_fim | medium | {
"lang": "python",
"repo": "brainmorsel/python-dhcp-sprout",
"path": "/ds/dhcp/bench.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jgrss/geowombat path: /tests/test_coreg.py
import unittest
import tempfile
from pathlib import Path
import geowombat as gw
from geowombat.data import l8_224077_20200518_B2
from geowombat.data import l8_224077_20200518_B4
import numpy as np
import xarray as xr
def shift(data: xr.Data... | code_fim | hard | {
"lang": "python",
"repo": "jgrss/geowombat",
"path": "/tests/test_coreg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Tests a 1-pixel shift."""
with gw.open(l8_224077_20200518_B2) as target, gw.open(
l8_224077_20200518_B4
) as reference:
with tempfile.TemporaryDirectory() as tmp:
# Shift by 1 pixel in each direction
target_shifted = ... | code_fim | hard | {
"lang": "python",
"repo": "jgrss/geowombat",
"path": "/tests/test_coreg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akleber/mqtt-connectors path: /tankstellen-connector.py
#!/usr/bin/env python
"""Fetches diesel prices"""
import paho.mqtt.client as paho # pip install paho-mqtt
import time
import logging
import sys
import requests
from pathlib import Path
from config import *
from secrets import *
FREQUEN... | code_fim | hard | {
"lang": "python",
"repo": "akleber/mqtt-connectors",
"path": "/tankstellen-connector.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
tankstellenlist = ','.join(tankstellen)
url = f"https://creativecommons.tankerkoenig.de/json/prices.php?ids={tankstellenlist}&apikey={TANKERKOENIG_API_KEY}" # noqa E501
r = requests.get(url, timeout=TIMEOUT)
r.raise_for_status()
data = r.json()
if... | code_fim | hard | {
"lang": "python",
"repo": "akleber/mqtt-connectors",
"path": "/tankstellen-connector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thanhtd91/proso-apps path: /proso_user/apps.py
from django.apps import AppConfig as OAppConfig
from proso.django.enrichment import register_object_type_enricher
class AppConfig(OAppConfig):
<|fim_suffix|> def ready(self):
register_object_type_enricher(['user_question'], 'proso_user.j... | code_fim | easy | {
"lang": "python",
"repo": "thanhtd91/proso-apps",
"path": "/proso_user/apps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ready(self):
register_object_type_enricher(['user_question'], 'proso_user.json_enrich.user_answers')<|fim_prefix|># repo: thanhtd91/proso-apps path: /proso_user/apps.py
from django.apps import AppConfig as OAppConfig
from proso.django.enrichment import register_object_type_enricher
clas... | code_fim | easy | {
"lang": "python",
"repo": "thanhtd91/proso-apps",
"path": "/proso_user/apps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gumo-py/gumo-core path: /tests/core/domain/entity_key_test.py
import pytest
from gumo.core.domain.entity_key import KeyPair
from gumo.core.domain.entity_key import NoneKey
from gumo.core.domain.entity_key import EntityKey
from gumo.core.domain.entity_key import EntityKeyFactory
from gumo.core.do... | code_fim | hard | {
"lang": "python",
"repo": "gumo-py/gumo-core",
"path": "/tests/core/domain/entity_key_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class TestEntityKeyWithStringName:
factory = EntityKeyFactory()
sample_key_pairs = [
('Book', 'name'),
('BookComment', 'comment'),
]
def test_zero_length_pairs(self):
with pytest.raises(ValueError):
self.factory.build_from_pairs(pairs=[])
def test... | code_fim | hard | {
"lang": "python",
"repo": "gumo-py/gumo-core",
"path": "/tests/core/domain/entity_key_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns the maximum allowed debug file size for this organization."""
if features.has('organizations:large-debug-files', organization):
return MAX_FILE_SIZE
else:
return options.get('system.maximum-file-size')<|fim_prefix|># repo: honorarac/sentry path: /src/sentry/utils/fi... | code_fim | hard | {
"lang": "python",
"repo": "honorarac/sentry",
"path": "/src/sentry/utils/files.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: honorarac/sentry path: /src/sentry/utils/files.py
"""
sentry.utils.files
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import zlib
<|fim_suffix|>def get_max_... | code_fim | hard | {
"lang": "python",
"repo": "honorarac/sentry",
"path": "/src/sentry/utils/files.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> global showoldlines
gAddMenu(self, "FA Demo", \
[["Init", self.initDemo], \
['button', "Show Old Line", showoldlines, 1, 0, None], \
["Resolution Higher", self.setResolutionHigher], \
["Resolution Lower", self.setResolu... | code_fim | hard | {
"lang": "python",
"repo": "ideaOwl/rltoolkit",
"path": "/RLtoolkit/fa/demo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ideaOwl/rltoolkit path: /RLtoolkit/fa/demo.py
### Routines for demonstrating 1D function learning programs.
from RLtoolkit.G.g import *
from RLtoolkit.Quickgraph.graph import *
from math import *
from .fa import *
from .tilecoder import *
window = None
black = gColorBlack(True)
flip = gColorFli... | code_fim | hard | {
"lang": "python",
"repo": "ideaOwl/rltoolkit",
"path": "/RLtoolkit/fa/demo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def check_for_protoproj(self):
items=os.listdir( self.path );
for item in items:
if item.endswith(".project-proto"):
self.has_project_proto=True;
self.proto_file=os.path.join(self.path,item);
break;<|fim_prefix|># repo: SherrodJmsGitHub/packages path: /Fancy Projects/fancyproje... | code_fim | medium | {
"lang": "python",
"repo": "SherrodJmsGitHub/packages",
"path": "/Fancy Projects/fancyprojects/project_structure.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.name
def check_for_protoproj(self):
items=os.listdir( self.path );
for item in items:
if item.endswith(".project-proto"):
self.has_project_proto=True;
self.proto_file=os.path.join(self.path,item);
break;<|fim_prefix|># repo: SherrodJmsGitHub/packages path: /Fanc... | code_fim | hard | {
"lang": "python",
"repo": "SherrodJmsGitHub/packages",
"path": "/Fancy Projects/fancyprojects/project_structure.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SherrodJmsGitHub/packages path: /Fancy Projects/fancyprojects/project_structure.py
# Copyright (C) 2013 Christopher "Kasoki" Kaster
#
# This file is part of "FancyProjects". <http://github.com/Kasoki/FancyProjects>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy ... | code_fim | medium | {
"lang": "python",
"repo": "SherrodJmsGitHub/packages",
"path": "/Fancy Projects/fancyprojects/project_structure.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.serial != None:
if self.serial.is_open:
self.configure_device()
else:
raise IOError("Could not open serial port")
elif self.bt_manager != None:
if self.bt_manager.connected:
... | code_fim | hard | {
"lang": "python",
"repo": "markqvist/Reticulum",
"path": "/RNS/Interfaces/Android/RNodeInterface.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> RNS.log("Configuring RNode interface...", RNS.LOG_VERBOSE)
self.initRadio()
if (self.validateRadioState()):
self.interface_ready = True
RNS.log(str(self)+" is configured and powered up")
sleep(0.3)
self.online = True
else:
... | code_fim | hard | {
"lang": "python",
"repo": "markqvist/Reticulum",
"path": "/RNS/Interfaces/Android/RNodeInterface.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: markqvist/Reticulum path: /RNS/Interfaces/Android/RNodeInterface.py
serial.is_open:
self.configure_device()
else:
raise IOError("Could not open serial port")
elif self.bt_manager != None:
if self.bt_manager.connec... | code_fim | hard | {
"lang": "python",
"repo": "markqvist/Reticulum",
"path": "/RNS/Interfaces/Android/RNodeInterface.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MFry/pyAlgoDataStructures path: /Top_Coder/Greedy/SRM169_GoldMine.py
"""
https://community.topcoder.com/stat?c=problem_statement&pm=2235&rd=5070
https://www.topcoder.com/community/data-science/data-science-tutorials/greedy-is-good/
"""
def GoldMine(mines, miners):
# sanitize input
... | code_fim | hard | {
"lang": "python",
"repo": "MFry/pyAlgoDataStructures",
"path": "/Top_Coder/Greedy/SRM169_GoldMine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
test_mines = ["000, 030, 030, 040, 000, 000, 000",
"020, 020, 020, 010, 010, 010, 010"]
test_miners = 4
result = GoldMine(test_mines, test_miners)
solution = [2, 2]
print('Test case result: ', result == solution)
test_mines = ["026, 012, 005, 013, 038, 002, 004",
"026, 012, 00... | code_fim | hard | {
"lang": "python",
"repo": "MFry/pyAlgoDataStructures",
"path": "/Top_Coder/Greedy/SRM169_GoldMine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xalien10/pyfortnox path: /fortnox/services/voucher_services.py
class VoucherService(object):
"""
:class:`fortnox.VoucherService` is used by :class:`fortnox.Client` to make
actions related to Voucher resource.
Normally you won't instantiate this class directly.
"""
"""
... | code_fim | hard | {
"lang": "python",
"repo": "xalien10/pyfortnox",
"path": "/fortnox/services/voucher_services.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns a single Voucher according to the unique Voucher ID provided
If the specified Voucher does not exist, this query returns an error
:calls: ``get /vouchers/sublist/{voucher_series}``
:param int id: Unique identifier of a Voucher.
:return: Dictionary that supp... | code_fim | hard | {
"lang": "python",
"repo": "xalien10/pyfortnox",
"path": "/fortnox/services/voucher_services.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: murageh/Formation path: /formation/tests/test_json.py
import unittest
from formation.formats import JSONFormat
class EqualityTestCase(unittest.TestCase):
def test_child_equality(self):
json1 = """
{
"type":"tag1",
"children": [
{"typ... | code_fim | hard | {
"lang": "python",
"repo": "murageh/Formation",
"path": "/formation/tests/test_json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> json2 = """
{
"type":"tag1",
"attrib": {
"name": "tag1"
},
"children": [
{
"type": "tag2",
"attrib": {
"attr": {
"heig... | code_fim | hard | {
"lang": "python",
"repo": "murageh/Formation",
"path": "/formation/tests/test_json.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def setUp(self) -> None:
self.node = JSONFormat(
data="""
{
"type": "tag1",
"attrib": {
"name": "tag1",
"attr": {
"background": "#ffffff",
"font": "A... | code_fim | hard | {
"lang": "python",
"repo": "murageh/Formation",
"path": "/formation/tests/test_json.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxprofs-llcio/basilisk_mag path: /dist/Basilisk/fswAlgorithms/ephem_nav_converter/ephem_nav_converter.py
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface fi... | code_fim | hard | {
"lang": "python",
"repo": "maxprofs-llcio/basilisk_mag",
"path": "/dist/Basilisk/fswAlgorithms/ephem_nav_converter/ephem_nav_converter.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
this = _ephem_nav_converter.new_EphemNavConverterData()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _ephem_nav_converter.delete_EphemNavConverterData
__del__ = lambda self: Non... | code_fim | hard | {
"lang": "python",
"repo": "maxprofs-llcio/basilisk_mag",
"path": "/dist/Basilisk/fswAlgorithms/ephem_nav_converter/ephem_nav_converter.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def protectSetAttr(self, name, value):
if(hasattr(self, name) or name == 'this'):
object.__setattr__(self, name, value)
else:
raise ValueError('You tried to add this variable: ' + name + '\n' +
'To this class: ' + str(self))
def protectAllClasses(moduleType):
imp... | code_fim | hard | {
"lang": "python",
"repo": "maxprofs-llcio/basilisk_mag",
"path": "/dist/Basilisk/fswAlgorithms/ephem_nav_converter/ephem_nav_converter.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> dataloader = DataLoader(seq_dataset, batch_size=batch_size, shuffle=True, pin_memory=True, num_workers=8)
log = 'dataset='+ str(args.dataset)
log = log + '_window_size=' + str(window_size) if args.slide == 0 else log + '_slide=' + str(args.slide)
log = log + '_hidden_size=' + str(hi... | code_fim | hard | {
"lang": "python",
"repo": "HankKung/LogPred",
"path": "/train_ae.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HankKung/LogPred path: /train_ae.py
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import TensorDataset, DataLoader
import argparse
from tqdm import tqdm
import os
... | code_fim | hard | {
"lang": "python",
"repo": "HankKung/LogPred",
"path": "/train_ae.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> label = torch.tensor(label).to(device)
if args.model =='vae':
loss, rec, kl = model.compute_loss(seq)
else:
output = model(seq)
if args.dataset == 'bgl_loss' or args.dataset == 'bgl_loss_full':
... | code_fim | hard | {
"lang": "python",
"repo": "HankKung/LogPred",
"path": "/train_ae.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Generates the given node. If node is invalid, empty or
non-existent, generates the entire website.
"""
if not node or not self.generated_once and not incremental:
return self.generate_all()
self.load_template_if_needed()
self.initial... | code_fim | hard | {
"lang": "python",
"repo": "vosskuhle/hyde",
"path": "/hyde/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.refresh_config()
if not resource.is_processable:
logger.debug("Skipping [%s]", resource)
return
if incremental and not self.has_resource_changed(resource):
logger.debug("No changes found. Skipping resource [%s]", resource)
return... | code_fim | hard | {
"lang": "python",
"repo": "vosskuhle/hyde",
"path": "/hyde/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vosskuhle/hyde path: /hyde/generator.py
# -*- coding: utf-8 -*-
"""
The generator class and related utility functions.
"""
from commando.util import getLoggerWithNullHandler
from fswrap import File, Folder
from hyde.exceptions import HydeException
from hyde.model import Context, Dependents
from ... | code_fim | hard | {
"lang": "python",
"repo": "vosskuhle/hyde",
"path": "/hyde/generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#divide into validation data
val_prec = 0.2
val_limits = int(val_prec * y.size)
x_val = data_features[:val_limits, :]
x_train = data_features[val_limits: , :]
y_val = y[:val_limits]
y_train = y[val_limits:]
# #test data
x_test = x_test/ 255.0
x_test = GetPredictedFeaturesFromMNIST(x_test, ... | code_fim | hard | {
"lang": "python",
"repo": "amirbawab/image_recognition",
"path": "/tools/python/CNN_second_portion_segregated_image_28.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> np.save('x_train',x_train)
np.save('y_train',y_train)
np.save('x_val',x_val)
np.save('y_val',y_val)
np.save('x_test',x_test)
def GetMappingTo40(mapping, labels):
y=[]
for i in labels:
y.append(mapping[i])
y_mappedto_40 = np.array(y).astype('int32')
return y_mappedto_40
de... | code_fim | hard | {
"lang": "python",
"repo": "amirbawab/image_recognition",
"path": "/tools/python/CNN_second_portion_segregated_image_28.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amirbawab/image_recognition path: /tools/python/CNN_second_portion_segregated_image_28.py
'''
Using 12X3 vectors from forst portion of CNN architecture
gets output 40 class classification
Input: 3 images with same labels (segregated image with 2 digits and 1 alphabet)
Output: 40 class class... | code_fim | hard | {
"lang": "python",
"repo": "amirbawab/image_recognition",
"path": "/tools/python/CNN_second_portion_segregated_image_28.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lothes[-1] <= rack_capacity:
curr_sum += clothes.pop()
else:
racks_count += 1
curr_sum = 0
print(racks_count)<|fim_prefix|># repo: elenaborisova/Python-Advanced path: /02. Lists as Stacks and Queues - Exercise/04_fashion_boutique.py
clothes = [int(x) for x in input().split()]... | code_fim | medium | {
"lang": "python",
"repo": "elenaborisova/Python-Advanced",
"path": "/02. Lists as Stacks and Queues - Exercise/04_fashion_boutique.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elenaborisova/Python-Advanced path: /02. Lists as Stacks and Queues - Exercise/04_fashion_boutique.py
clothes = [int(x) for x in input().split()]
rack_capacity = int(inpu<|fim_suffix|>se:
racks_count += 1
curr_sum = 0
print(racks_count)<|fim_middle|>t())
racks_count = 1
curr_sum... | code_fim | medium | {
"lang": "python",
"repo": "elenaborisova/Python-Advanced",
"path": "/02. Lists as Stacks and Queues - Exercise/04_fashion_boutique.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> width, height = video_dimensions(filename)
video_stream, _ = (
ffmpeg
.input(filename)
.output('pipe:', format='rawvideo', pix_fmt='rgb24')
.run(capture_stdout=True)
)
video = (
np
.frombuffer(video_stream, np.uint8)
.reshape([-1, h... | code_fim | hard | {
"lang": "python",
"repo": "saulocatharino/pyfx",
"path": "/pyfx/util/video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
in_bytes = process1.stdout.read(width * height * 3)
if not in_bytes:
break
in_frame = (
np
.frombuffer(in_bytes, np.uint8)
.reshape([height, width, 3])
)
out_frame = in_frame * 0.3
process2.stdin.write(
frame
.astype(np.ui... | code_fim | hard | {
"lang": "python",
"repo": "saulocatharino/pyfx",
"path": "/pyfx/util/video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saulocatharino/pyfx path: /pyfx/util/video.py
import pyfx
import numpy as np
import ffmpeg
def video_dimensions(filename):
"""
Get dimensions of frames in a video file.
"""
probe = ffmpeg.probe(filename)
video_stream = next((stream for stream in probe['streams']
... | code_fim | hard | {
"lang": "python",
"repo": "saulocatharino/pyfx",
"path": "/pyfx/util/video.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mit-aera/pyFlightGoggles path: /flightgoggles/controller.py
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import os, sys, time, copy, yaml
from .utils import *
# Controller base
class UAV_pid():
def __init__(self, *args, **kwargs):
# PID Controller Vehicle Parameters
... | code_fim | hard | {
"lang": "python",
"repo": "mit-aera/pyFlightGoggles",
"path": "/flightgoggles/controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# PID Controller Gains (roll / pitch / yaw)
if 'propGain' in kwargs:
self.propGain_ = kwargs['propGain']
else:
if self.flag_debug:
print("Did not get the PID ... | code_fim | hard | {
"lang": "python",
"repo": "mit-aera/pyFlightGoggles",
"path": "/flightgoggles/controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## Reduced COCOMO
def prune_cocomo(model, rows, row_count, column_ratio):
pruned_rows = shuffle(rows[:])[:row_count]
loc_column, rest = model.decisions[-1], model.decisions[:-1]
entropies = []
for decision in rest:
effort_map = get_column_vals(model, pruned_rows, decision)
entropy = 0
... | code_fim | hard | {
"lang": "python",
"repo": "ai-se/george",
"path": "/Technix/CoCoMo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ai-se/george path: /Technix/CoCoMo.py
from __future__ import division,print_function
import sys
sys.dont_write_bytecode = True
from lib import *
import numpy as np
_ = 0
Coc2tunings = {
# vl l nom h vh xh
# Scale Factors
'Flex' : [5.07, 4.05, 3.04, 2.03, 1.01, ... | code_fim | hard | {
"lang": "python",
"repo": "ai-se/george",
"path": "/Technix/CoCoMo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openalto/alto-swagger path: /unicorn_server/models/__init__.py
# coding: utf-8
from __future__ import absolute_import
# import models into model package
from .an<|fim_suffix|>or_meta import ErrorMeta
from .flow_spec import FlowSpec
from .path_query_response import PathQueryResponse
from .query_d... | code_fim | medium | {
"lang": "python",
"repo": "openalto/alto-swagger",
"path": "/unicorn_server/models/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>esponse
from .query_desc import QueryDesc
from .resource_query_response import ResourceQueryResponse<|fim_prefix|># repo: openalto/alto-swagger path: /unicorn_server/models/__init__.py
# coding: utf-8
from __future__ import absolute_import
# import models into model package
from .an<|fim_middle|>e impor... | code_fim | medium | {
"lang": "python",
"repo": "openalto/alto-swagger",
"path": "/unicorn_server/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Verbosity level to logging level."""
logLevels = {0: logging.WARNING, 1: logging.INFO}
if verbosity > 1:
return logging.DEBUG
else:
return logLevels.get(verbosity, logging.ERROR)<|fim_prefix|># repo: inetAnt/telegramtogo path: /telegramtogo/utils.py
"""
Utils
"""
import... | code_fim | easy | {
"lang": "python",
"repo": "inetAnt/telegramtogo",
"path": "/telegramtogo/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: inetAnt/telegramtogo path: /telegramtogo/utils.py
"""
Utils
"""
import logging
<|fim_suffix|> """Verbosity level to logging level."""
logLevels = {0: logging.WARNING, 1: logging.INFO}
if verbosity > 1:
return logging.DEBUG
else:
return logLevels.get(verbosity, logg... | code_fim | easy | {
"lang": "python",
"repo": "inetAnt/telegramtogo",
"path": "/telegramtogo/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
EFIDTrackingCuts = ConfiguredNewTrackingTrigCuts("Offline")
EFIDTrackingCutsCosmics = ConfiguredNewTrackingTrigCuts("Cosmics")
EFIDTrackingCutsBeamGas = ConfiguredNewTrackingTrigCuts("BeamGas")
EFIDTrackingCutsLowPt = ConfiguredNewTrackingTrigCuts("LowPt")
EFIDTrackingCutsTRT = ConfiguredNewTrackingTrigC... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags
self.__indetflags = InDetTrigFlags
EFIDTrackingCuts = ConfiguredNewTrackingTrigCuts("Offline")
EFIDTrackingCutsCosmics = ConfiguredNewTrackingTrigCuts("Cosmics")
EFIDTrackingCutsBeamGas = ConfiguredNewTrackingTrigCuts("BeamGas")
EFID... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: strigazi/athena path: /InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
""" Derive from the offline class and override InDetFlags
"""
__author__ = "J. Masik"
__version__= "$Revision: ... | code_fim | medium | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/InnerDetector/InDetExample/InDetTrigRecExample/python/ConfiguredNewTrackingTrigCuts.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> transition.add_predicate(lambda t: not self._reserved_predicate(t))
super(Cycle, self).add_outgoing_transition(transition)<|fim_prefix|># repo: gosion/pyPvm path: /pvm/activities/cycle.py
from uuid import UUID
from pvm.activities.activity import Activity
from pvm.transition import Transi... | code_fim | medium | {
"lang": "python",
"repo": "gosion/pyPvm",
"path": "/pvm/activities/cycle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gosion/pyPvm path: /pvm/activities/cycle.py
from uuid import UUID
from pvm.activities.activity import Activity
from pvm.transition import Transition
<|fim_suffix|> """设置自循环出口条件
"""
self._reserved_predicate = predicate
self._reserved_transition.add_predicate(pred... | code_fim | hard | {
"lang": "python",
"repo": "gosion/pyPvm",
"path": "/pvm/activities/cycle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrepifano/xai_is_fragile path: /IRIS/loo_synthetic.py
import os
import shap
import torch
import numpy as np
import simple_influence
from scipy.stats import pearsonr, spearmanr
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.prepro... | code_fim | hard | {
"lang": "python",
"repo": "jrepifano/xai_is_fragile",
"path": "/IRIS/loo_synthetic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
n_datasets = 10000
nodes = [100, 500, 1000, 2000, 5000]
epochs = [300, 300, 350, 350, 350]
accuracy_results = np.empty((n_datasets, len(nodes), 5))
spearman_stats = np.empty((n_datasets, len(nodes), 3))
spearman_pvalues = np.empty((n_datasets, len(nodes), 3))
pears... | code_fim | hard | {
"lang": "python",
"repo": "jrepifano/xai_is_fragile",
"path": "/IRIS/loo_synthetic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mruprich/leapp-repository path: /repos/system_upgrade/el7toel8/actors/initrdinclude/tests/test_initrdinclude.py
import pytest
from leapp.exceptions import StopActorExecutionError
from leapp.libraries.actor import initrdinclude
from leapp.libraries.stdlib import api, CalledProcessError
from leapp... | code_fim | hard | {
"lang": "python",
"repo": "mruprich/leapp-repository",
"path": "/repos/system_upgrade/el7toel8/actors/initrdinclude/tests/test_initrdinclude.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.called += 1
self.args = args
if self.raise_err:
raise_call_error(args)
def test_no_includes(monkeypatch):
run_mocked = RunMocked()
monkeypatch.setattr(api, 'current_actor', CurrentActorMocked(msgs=[]))
monkeypatch.setattr(api, 'current_logger', logger... | code_fim | hard | {
"lang": "python",
"repo": "mruprich/leapp-repository",
"path": "/repos/system_upgrade/el7toel8/actors/initrdinclude/tests/test_initrdinclude.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnsonm325/drift-backend path: /tests/test_inventory_service_interface.py
import requests
import responses
import string
import unittest
import mock
from drift import app, inventory_service_interface
from drift.exceptions import InventoryServiceError, SystemNotReturned
from . import fixtures
... | code_fim | hard | {
"lang": "python",
"repo": "johnsonm325/drift-backend",
"path": "/tests/test_inventory_service_interface.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _create_500_response_for_systems(self, service_hostname, system_uuids):
url_template = "http://%s/api/inventory/v1/hosts/%s"
responses.add(responses.GET, url_template % (service_hostname, system_uuids),
body="I am error", status=requests.codes.INTERNAL_SERVER_... | code_fim | hard | {
"lang": "python",
"repo": "johnsonm325/drift-backend",
"path": "/tests/test_inventory_service_interface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> systems = inventory_service_interface.fetch_systems_with_profiles(systems_to_fetch,
"my-auth-key",
self.mock_logger)
found_system_ids = {syste... | code_fim | hard | {
"lang": "python",
"repo": "johnsonm325/drift-backend",
"path": "/tests/test_inventory_service_interface.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> }
}
model_params = {
'func' : train.get_latent_models,
'cfg' : model_cfg,
'action_model_desc' : 'uncertainty_model'
}
one_obj_scene_info = [
{
'type' : 'SHAPENET',
'scale' : args['objsize'],
'mass' : 1.,
... | code_fim | hard | {
"lang": "python",
"repo": "neuroailab/curiosity_deprecated",
"path": "/scripts/uncertainty_scripts/train_um_morechoked.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neuroailab/curiosity_deprecated path: /scripts/uncertainty_scripts/train_um_morechoked.py
'''
A script for searching through various possibilities with uncertainty model online learning, assuming
that we are modeling the uncertainty of the action model.
'''
import sys
sys.path.append('curios... | code_fim | hard | {
"lang": "python",
"repo": "neuroailab/curiosity_deprecated",
"path": "/scripts/uncertainty_scripts/train_um_morechoked.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>train_params = {
'updater_func' : train.get_latent_updater,
'updater_kwargs' : {
'state_desc' : 'depths1'
}
}
model_params = {
'func' : train.get_latent_models,
'cfg' : model_cfg,
'action_model_desc' : 'uncertainty_model'
}
one_obj_scene_i... | code_fim | hard | {
"lang": "python",
"repo": "neuroailab/curiosity_deprecated",
"path": "/scripts/uncertainty_scripts/train_um_morechoked.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> 100))
print('O produto com desconto saiu de R${:.2f} por R${:.2f}.'.format(valor, desconto))<|fim_prefix|># repo: dudulacerdadl/prototipos path: /Curso Python/Exercícios/ex012.py
valor = float(input('Digite o valor do produto<|fim_middle|> desejado: '))
desconto = valor - (valor * (5 / | code_fim | easy | {
"lang": "python",
"repo": "dudulacerdadl/prototipos",
"path": "/Curso Python/Exercícios/ex012.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>${:.2f} por R${:.2f}.'.format(valor, desconto))<|fim_prefix|># repo: dudulacerdadl/prototipos path: /Curso Python/Exercícios/ex012.py
valor = float(input('Digite o valor do produto<|fim_middle|> desejado: '))
desconto = valor - (valor * (5 / 100))
print('O produto com desconto saiu de R | code_fim | medium | {
"lang": "python",
"repo": "dudulacerdadl/prototipos",
"path": "/Curso Python/Exercícios/ex012.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dudulacerdadl/prototipos path: /Curso Python/Exercícios/ex012.py
valor = float(input('Digite o valor do produto desejado: '))
desconto = valor - (valor * (5 /<|fim_suffix|>${:.2f} por R${:.2f}.'.format(valor, desconto))<|fim_middle|> 100))
print('O produto com desconto saiu de R | code_fim | easy | {
"lang": "python",
"repo": "dudulacerdadl/prototipos",
"path": "/Curso Python/Exercícios/ex012.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: macbury/SmartHouse path: /home-assistant/custom_components/smartthinq_sensors/wideq/dehumidifier.py
"""------------------for Dehumidifier"""
import enum
import logging
from typing import Optional
from .const import (
FEAT_HUMIDITY,
FEAT_TARGET_HUMIDITY,
FEAT_WATER_TANK_FULL,
)
from .... | code_fim | hard | {
"lang": "python",
"repo": "macbury/SmartHouse",
"path": "/home-assistant/custom_components/smartthinq_sensors/wideq/dehumidifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def operation(self):
op = self._get_operation()
if not op:
return None
return op.name
@property
def operation_mode(self):
key = self._get_state_key(STATE_OPERATION_MODE)
if (value := self.lookup_enum(key, True)) is None:
... | code_fim | hard | {
"lang": "python",
"repo": "macbury/SmartHouse",
"path": "/home-assistant/custom_components/smartthinq_sensors/wideq/dehumidifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def power(self, turn_on):
"""Turn on or off the device (according to a boolean)."""
op = DHumOp.ON if turn_on else DHumOp.OFF
keys = self._get_cmd_keys(CMD_STATE_OPERATION)
op_value = self.model_info.enum_value(keys[2], op.value)
if self._should_poll:
... | code_fim | hard | {
"lang": "python",
"repo": "macbury/SmartHouse",
"path": "/home-assistant/custom_components/smartthinq_sensors/wideq/dehumidifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Q = q_init(env)
print(Q.shape)
desc = [['S', 'F', 'F'], ['F', 'H', 'H'], ['F', 'F', 'G']]
env = load_frozen_lake(desc=desc)
Q = q_init(env)
print(Q.shape)
env = load_frozen_lake(map_name='4x4')
Q = q_init(env)
print(Q.shape)<|fim_prefix|># repo: ledbagholberton/holbertonschool-machine_learning pa... | code_fim | medium | {
"lang": "python",
"repo": "ledbagholberton/holbertonschool-machine_learning",
"path": "/reinforcement_learning/0x00-q_learning/1-main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ledbagholberton/holbertonschool-machine_learning path: /reinforcement_learning/0x00-q_learning/1-main.py
#!/usr/bin/env python3
load_frozen_lake = __import__('0-load_env').load_frozen_lake
q_init = __import__('1-q_in<|fim_suffix|>desc=desc)
Q = q_init(env)
print(Q.shape)
env = load_frozen_... | code_fim | hard | {
"lang": "python",
"repo": "ledbagholberton/holbertonschool-machine_learning",
"path": "/reinforcement_learning/0x00-q_learning/1-main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> q = cls.query.filter(cls.object_id == obj.id, cls.object_type == obj.__tablename__)
if access_type:
q = q.filter(AccessPermission.access_type == access_type)
if grantee:
q = q.filter(AccessPermission.grantee == grantee)
if grantor:
q =... | code_fim | hard | {
"lang": "python",
"repo": "getredash/redash",
"path": "/redash/models/users.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_dict(self):
return {
"id": self.id,
"name": self.name,
"permissions": self.permissions,
"type": self.type,
"created_at": self.created_at,
}
@classmethod
def all(cls, org):
return cls.query.filter(cls.or... | code_fim | hard | {
"lang": "python",
"repo": "getredash/redash",
"path": "/redash/models/users.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: getredash/redash path: /redash/models/users.py
import hashlib
import itertools
import logging
import time
from functools import reduce
from operator import or_
from flask import current_app as app
from flask import request_started, url_for
from flask_login import AnonymousUserMixin, UserMixin, c... | code_fim | hard | {
"lang": "python",
"repo": "getredash/redash",
"path": "/redash/models/users.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ppujol76/Lucas_Transformers path: /evaluate.py
import torch
import random
from nltk.translate.bleu_score import corpus_bleu
from model.visualization import Visualization
def evaluate(model, test_loader, vocab, device, epoch):
model.eval()
<|fim_suffix|> if idx % 10 == 0:
num_img=random.... | code_fim | hard | {
"lang": "python",
"repo": "ppujol76/Lucas_Transformers",
"path": "/evaluate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> total_loss += corpus_bleu(target_s,sentences,(1.0/1.0,))
if idx % 10 == 0:
num_img=random.randint(0,img.shape[0]-1)
example=' '.join(sentences[num_img])
reference=vocab.generate_caption(target[num_img,1:])
print(f'Evaluating batch {idx} / {len(test_loader)}...')
print(f'Gen ... | code_fim | hard | {
"lang": "python",
"repo": "ppujol76/Lucas_Transformers",
"path": "/evaluate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if idx % 10 == 0:
num_img=random.randint(0,img.shape[0]-1)
example=' '.join(sentences[num_img])
reference=vocab.generate_caption(target[num_img,1:])
print(f'Evaluating batch {idx} / {len(test_loader)}...')
print(f'Gen example: {example}')
print(f'Exp example: {reference}')
s... | code_fim | hard | {
"lang": "python",
"repo": "ppujol76/Lucas_Transformers",
"path": "/evaluate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not is_model_registered('accessgroup', 'AccessGroup'):
class AccessGroup(AbstractAccessGroup):
pass
__all__.append('AccessGroup')<|fim_prefix|># repo: lyoniionly/django-cobra path: /src/cobra/apps/accessgroup/models.py
# -*- coding: utf-8 -*-
from cobra.core.loading import is_model_re... | code_fim | easy | {
"lang": "python",
"repo": "lyoniionly/django-cobra",
"path": "/src/cobra/apps/accessgroup/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyoniionly/django-cobra path: /src/cobra/apps/accessgroup/models.py
# -*- coding: utf-8 -*-
from cobra.core.loading import is_model_registered
from .abstract_models import * # noqa
<|fim_suffix|>
if not is_model_registered('accessgroup', 'AccessGroup'):
class AccessGroup(AbstractAccessGrou... | code_fim | easy | {
"lang": "python",
"repo": "lyoniionly/django-cobra",
"path": "/src/cobra/apps/accessgroup/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
__all__.append('AccessGroup')<|fim_prefix|># repo: lyoniionly/django-cobra path: /src/cobra/apps/accessgroup/models.py
# -*- coding: utf-8 -*-
from cobra.core.loading import is_model_registered
from .abstract_models import * # noqa
__all__ = []
<|fim_middle|>
if not is_model_registe... | code_fim | medium | {
"lang": "python",
"repo": "lyoniionly/django-cobra",
"path": "/src/cobra/apps/accessgroup/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> as0 = np.array(ps.vectorDataAt(a0))
for val in as0:
assert val.tolist() == [2.0, 4.0, -1.0]
as1 = np.array(ps.vectorDataAt(a1))
for val in as1:
assert val.tolist() == [9.0, -2.0, 5.0]
def test_add_particles3():
ps = pyjet.ParticleSystemData3()
ps.resize(12)
... | code_fim | hard | {
"lang": "python",
"repo": "doyubkim/fluid-engine-dev",
"path": "/src/tests/python_tests/test_particle_system_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doyubkim/fluid-engine-dev path: /src/tests/python_tests/test_particle_system_data.py
"""
Copyright (c) 2018 Doyub Kim
I am making my contributions/submissions to this project solely in my personal
capacity and am not conveying any rights to any intellectual property of any
third parties.
"""
im... | code_fim | hard | {
"lang": "python",
"repo": "doyubkim/fluid-engine-dev",
"path": "/src/tests/python_tests/test_particle_system_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>metadict_class_proficiency = {
# Ключ словаря -- кортеж (класс, уровень).
('Any',1):{'proficiency_bonus':2},
('Any',2):{'proficiency_bonus':2},
('Any',3):{'proficiency_bonus':2},
('Any',4):{'proficiency_bonus':2},
('Any',5):{'proficiency_bonus':3},
(... | code_fim | hard | {
"lang": "python",
"repo": "wizard-of-void/dnd-mass-combat-simulation",
"path": "/data/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wizard-of-void/dnd-mass-combat-simulation path: /data/classes.py
('Wizard',15):{'1_lvl':4,'2_lvl':3,'3_lvl':3,'4_lvl':3,'5_lvl':2,
'6_lvl':1,'7_lvl':1,'8_lvl':1,'9_lvl':0},
('Wizard',16):{'1_lvl':4,'2_lvl':3,'3_lvl':3,'4_lvl':3,'5_lvl':2,
'6_lvl':1,'7_lvl... | code_fim | hard | {
"lang": "python",
"repo": "wizard-of-void/dnd-mass-combat-simulation",
"path": "/data/classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>metadict_class_spells = {
# Слоты заклинаний по уровням:
# https://www.dandwiki.com/wiki/5e_SRD:Bard#Table:_The_bard
# Барды, клерики, друиды, волшебники и чародеи -- по слотам одинаковы:
# TODO: сделай уже "any", если подходящего нет.
('Any',1):{},
('Any',2... | code_fim | hard | {
"lang": "python",
"repo": "wizard-of-void/dnd-mass-combat-simulation",
"path": "/data/classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parsed = request.urlparts
url = "%s://%s%s" % (parsed.scheme, parsed.netloc, request.script_name)
return url
@app.error(500)
def error(e):
response.content_type = "application/json"
return json.dumps({
"status": e.status,
"url": repr(request.url),
"exception":... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/tools/sandbox/c7n_sphere11/c7n_sphere11/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /tools/sandbox/c7n_sphere11/c7n_sphere11/app.py
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from bottle import Bottle, request, response, abort
import json
import logging
import os
from audit import init_audit
from control... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/tools/sandbox/c7n_sphere11/c7n_sphere11/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.error(500)
def error(e):
response.content_type = "application/json"
return json.dumps({
"status": e.status,
"url": repr(request.url),
"exception": repr(e.exception),
# "traceback": e.traceback and e.traceback.split('\n') or '',
"body": repr(e.body)
... | code_fim | hard | {
"lang": "python",
"repo": "cloud-custodian/cloud-custodian",
"path": "/tools/sandbox/c7n_sphere11/c7n_sphere11/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alanlujan91/DemARK path: /notebooks/DiamondOLG.py
# equation: Ctrl-E
# itemize: Ctrl-I
# labels_anchors: false
# latex_user_defs: false
# report_style_numbering: false
# user_envs_cfg: false
# widgets:
# application/vnd.jupyter.widget-state+json:
# state:
... | code_fim | hard | {
"lang": "python",
"repo": "alanlujan91/DemARK",
"path": "/notebooks/DiamondOLG.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alanlujan91/DemARK path: /notebooks/DiamondOLG.py
xjnf9HxMR/Ps2fPMnLkSPr27Rtp+Rw5cvDxxx+zdu1avvzyS6pWrcquXbt4+PAh7dq1I1OmTPHehxcdV3t7e0uyOnLkSGxsbFi3bl2c1m3uZ3Lu3DnSpk0b6XPUokULxowZw6JFi6hUqRLbt2/Hw8Mj0rC4IiIiKd3t27f55ptvWL16NQBly5bFzc2NsmXLWjewJKAO2K+xxo0b4+bmxjvvvMOmTZtYsGAB6dOnp3///pb+A59++imN... | code_fim | hard | {
"lang": "python",
"repo": "alanlujan91/DemARK",
"path": "/notebooks/DiamondOLG.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>TptBtSA8wG8vuR1Tt06RQaHDHzZ5Es+qPsBDpa0eVn2mjVr6NmzJ+fPnwegX79+jBkzJlGvYRYRERERSQoKqUJ4OCxYYN7u3du+tSQ2m2Fjwo4JDPtrGLG2WNxzuLOw7UJqF65t79KSxM2bNxk4cCA//PADAKVKlWLevHk0aNDAzpWJiIiIiDwehVRh6VK4fdvsoDZubO9qEs/NiJt0Xt6ZNcfWANCuQjvmvDKHHJly2LewJLJq1Sp69erFxYsXsVgsDBgwgNGjRyfYwkhEREREJKVTSBXmzTO/e3ub16SmBXsv7aX... | code_fim | hard | {
"lang": "python",
"repo": "alanlujan91/DemARK",
"path": "/notebooks/DiamondOLG.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if date not in session_start_dict:
return time
elif last_time == None:
return time
else:
hour_minute = time[0:5]
last_hour_minute = last_time[0:5]
if hour_minute < last_hour_minute:
hour = int(time[0:2])
hour += 1
new... | code_fim | hard | {
"lang": "python",
"repo": "emg/syllog",
"path": "/backend/Django/logsyllogsite/logapp/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emg/syllog path: /backend/Django/logsyllogsite/logapp/views.py
%s' % mydict['term_M'])
next_row.append('%s' % mydict['term_P'])
next_row.append('%s' % mydict['correctness'])
next_row.append('%s' % mydict['conclusion_truth_value'])
ne... | code_fim | hard | {
"lang": "python",
"repo": "emg/syllog",
"path": "/backend/Django/logsyllogsite/logapp/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emg/syllog path: /backend/Django/logsyllogsite/logapp/views.py
answercount += 1
next_row = []
next_row.append(date)
next_row.append('%d' % mydict['usernumber'])
usernumber = mydict['usernumber']
next_row.append... | code_fim | hard | {
"lang": "python",
"repo": "emg/syllog",
"path": "/backend/Django/logsyllogsite/logapp/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: urutva/mbed-tools-ci-scripts path: /mbed_tools_ci_scripts/license_files.py
#
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Apply copyright and licensing to all source files present in a project.
This is to comply with OpenChain certification;
http... | code_fim | hard | {
"lang": "python",
"repo": "urutva/mbed-tools-ci-scripts",
"path": "/mbed_tools_ci_scripts/license_files.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f"{current}" if current == start else f"{start}-{current}"
def get_tool_config(template_file: Path) -> dict:
"""Gets the configuration for licenseheaders."""
copyright_dates = _determines_copyright_dates()
return {
"owner": configuration.get_value(ConfigurationVariable.ORG... | code_fim | hard | {
"lang": "python",
"repo": "urutva/mbed-tools-ci-scripts",
"path": "/mbed_tools_ci_scripts/license_files.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.