text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> else:
Domoticz.Error("Device with idx={} does not seem to be a DT !".format(idx))
# fool proof checking....
if len(PresenceDT) == 0:
Domoticz.Error("none of the devices in the 'dt' parameter is a dt... no action !... | code_fim | hard | {
"lang": "python",
"repo": "Erwanweb/SVT2",
"path": "/plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Build list of DT switches, with their current status
PresenceDT = {}
devicesAPI = DomoticzAPI("type=devices&filter=light&used=true&order=Name")
if devicesAPI:
for device in devicesAPI["result"]: # parse the presence/motion sensors (DT) de... | code_fim | hard | {
"lang": "python",
"repo": "Erwanweb/SVT2",
"path": "/plugin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Erwanweb/SVT2 path: /plugin.py
self.setpoint = (float(Devices[4].sValue) - ((self.reducjour) / 10))
Domoticz.Log("AUTOMode - used setpoint is reducted 1 : " + str(self.setpoint))
elif Devices[2].sValue == "20":
self.setpoint = float(Devices[5].sVal... | code_fim | hard | {
"lang": "python",
"repo": "Erwanweb/SVT2",
"path": "/plugin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, urls_file, depth=1, **kwargs):
urls = open(urls_file).read().splitlines()
for url in urls:
self.allowed_domains.append(urlparse(url).netloc)
self.urls.append(url)
self.depth = depth
super(FromUrlsSpider, self).__init__(**kwargs... | code_fim | medium | {
"lang": "python",
"repo": "Dronch/emailExtractor-bot",
"path": "/EmailExtractor/spiders/fromurls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class A(base):
def __init__(self):
print('A')
super(A, self).__init__()
class B(A):
def __init__(self):
print('B')
super(B, self).__init__()
B()<|fim_prefix|># repo: Dronch/emailExtractor-bot path: /EmailExtractor/spiders/fromurls.py
'''
from .fromurl import F... | code_fim | medium | {
"lang": "python",
"repo": "Dronch/emailExtractor-bot",
"path": "/EmailExtractor/spiders/fromurls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dronch/emailExtractor-bot path: /EmailExtractor/spiders/fromurls.py
'''
from .fromurl import FromUrlSpider
try:
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
except ImportError:
from urlparse import urlp... | code_fim | medium | {
"lang": "python",
"repo": "Dronch/emailExtractor-bot",
"path": "/EmailExtractor/spiders/fromurls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # === Gather task configs === #
# Build task_config_path_dict, either via
# 1. task_config_base_path: where all caches are contained within a given folder
# 2. task_config_dict: explicitly provided dictionary to cache paths, potentially in JSON
# Use dictionary ... | code_fim | hard | {
"lang": "python",
"repo": "nyu-mll/jiant",
"path": "/jiant/proj/main/scripts/configurator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> (Task config) Need one of:
task_config_base_path
task_config_path_dict
(Eval batch size) Need one of:
eval_batch_multiplier
eval_batch_size
(Task cache) Need one of:
task_cache_base_path
task_cache_config_dict
(Computing max steps) Need on... | code_fim | hard | {
"lang": "python",
"repo": "nyu-mll/jiant",
"path": "/jiant/proj/main/scripts/configurator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nyu-mll/jiant path: /jiant/proj/main/scripts/configurator.py
ert self.task_config_base_path is None
task_config_path = self.task_config_path
elif self.task_config_base_path is not None:
assert self.task_config_path is None
task_config_path = os.path.joi... | code_fim | hard | {
"lang": "python",
"repo": "nyu-mll/jiant",
"path": "/jiant/proj/main/scripts/configurator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Exopy/exopy path: /exopy/measurement/hooks/base_hooks.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full l... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/measurement/hooks/base_hooks.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Stop the execution of the hook.
This call should not block save if the force keyword is true. No signal
is emitted as the run method should return as a result of the stop.
"""
pass
def list_runtimes(self, workbench):
"""List the runtimes dependenci... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/measurement/hooks/base_hooks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """List the runtimes dependencies for this hook.
Parameters
----------
workbench :
Workbench of the application.
Returns
-------
runtime : RuntimeContainer | None
Runtime dependencies as returned by a call to the command
... | code_fim | hard | {
"lang": "python",
"repo": "Exopy/exopy",
"path": "/exopy/measurement/hooks/base_hooks.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing (kWh)'][i]*(0.1*0.887298+0.90))
if GTI_distribution['Mean'][i] == 0:
solar_scenario['low'].append(GTI[i])
solar_scenario['medium'].append(GTI[i])
solar_scenario['high'].append(GTI[i])
## If Solar GTI is normal: from Rice & Miller low = 0.1127... | code_fim | hard | {
"lang": "python",
"repo": "cxy2333355/Two_Stage_SP",
"path": "/Two_Stage_SP/scenario_generation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cxy2333355/Two_Stage_SP path: /Two_Stage_SP/scenario_generation.py
import numpy as np
import pandas as pd
import csv
from collections import defaultdict
from scipy import stats
import os
import sys
import Two_Stage_SP
from Two_Stage_SP.EGEF import EF,printinfo,fit_and_plot,EGEF_state,best... | code_fim | hard | {
"lang": "python",
"repo": "cxy2333355/Two_Stage_SP",
"path": "/Two_Stage_SP/scenario_generation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>1*sigma+mu)
## If Solar GTI is uniform: from Rice & Miller low = 0.112702 (i - loc)/scale
elif wind_speed_distribution['Best fit'][i] == 'uniform':
loc = wind_speed_distribution['Mean'][i]
scale = wind_speed_distribution['STD'][i]
wind_scenario['low... | code_fim | hard | {
"lang": "python",
"repo": "cxy2333355/Two_Stage_SP",
"path": "/Two_Stage_SP/scenario_generation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tpmp-inra/tpmp_bd path: /tpmp_db/dbms/migrations/0003_auto_20210907_1440.py
# Generated by Django 3.2.7 on 2021-09-07 12:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dbms', '0002_auto_2021090... | code_fim | hard | {
"lang": "python",
"repo": "tpmp-inra/tpmp_bd",
"path": "/tpmp_db/dbms/migrations/0003_auto_20210907_1440.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ('guid', models.UUIDField()),
('cam_settings', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dbms.cameraconfigurationfile')),
('camera', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion... | code_fim | hard | {
"lang": "python",
"repo": "tpmp-inra/tpmp_bd",
"path": "/tpmp_db/dbms/migrations/0003_auto_20210907_1440.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return result
# Example to call this program: python34 patternMatch.py <input_file> output_file
def main(args):
input_file = open(args[1], 'r')
output_file = open(args[2], 'w')
pattern_list = []
path_list = []
# Expects correct format in file: int N followed by pattern lines the... | code_fim | hard | {
"lang": "python",
"repo": "christieewen/Algorithms",
"path": "/TechInterviews/Python/patternMatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christieewen/Algorithms path: /TechInterviews/Python/patternMatch.py
import sys
import re
# Strip only the beginning and ending slashes
def stripSlashes(path):
if path.startswith('/'):
path = path[1:]
if path.endswith('/'):
path = path[:-1]
return path
def findBestWi... | code_fim | medium | {
"lang": "python",
"repo": "christieewen/Algorithms",
"path": "/TechInterviews/Python/patternMatch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IsaacW4/MMath-Project path: /Python examples/Perihelion example.py
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 22 15:45:01 2020
@author: Isaac
"""
## Perihelion
from einsteinpy.plotting import StaticGeodesicPlotter
from einsteinpy.examples import perihelion
import timeit
from nu... | code_fim | medium | {
"lang": "python",
"repo": "IsaacW4/MMath-Project",
"path": "/Python examples/Perihelion example.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>timeit.timeit("perihelion_procession()", number = 2, globals = globals())
timeit.timeit("perihelion_procession_jit()", number = 2, globals = globals())
#a = StaticGeodesicPlotter()
#a.animate(perihelion(), interval=2)
#a.show()<|fim_prefix|># repo: IsaacW4/MMath-Project path: /Python examples... | code_fim | medium | {
"lang": "python",
"repo": "IsaacW4/MMath-Project",
"path": "/Python examples/Perihelion example.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = StaticGeodesicPlotter()
a.animate(perihelion(), interval=2)
a.show()
@jit
def perihelion_procession_jit():
a = StaticGeodesicPlotter()
a.animate(perihelion(), interval=2)
a.show()
timeit.timeit("perihelion_procession()", number = 2, globals ... | code_fim | hard | {
"lang": "python",
"repo": "IsaacW4/MMath-Project",
"path": "/Python examples/Perihelion example.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maddigit/audio2video path: /audio2video/visual.py
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 9 10:28:05 2019
@author: xinzhu
"""
from subprocess import call
import numpy as np
import cv2
import os
vfps = 30
size = (1280, 720)
final_WH = (960, 539)
rsize = 300
start = (160... | code_fim | hard | {
"lang": "python",
"repo": "maddigit/audio2video",
"path": "/audio2video/visual.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from face import LandmarkFetcher
from composite import syn_frame
syndata = np.load(ipath)
cap = cv2.VideoCapture(tpath)
writer = cv2.VideoWriter(tmppath, cv2.VideoWriter_fourcc(*'DIVX'), vfps, size)
nfr = 300 if debug else int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
LF1 = Land... | code_fim | hard | {
"lang": "python",
"repo": "maddigit/audio2video",
"path": "/audio2video/visual.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(nfr):
print('%s: %04d/%04d' % (tmppath, i+1, nfr))
ret, tarfr = cap.read()
assert(ret)
syntxtr = syndata[i] if i < syndata.shape[0] else syndata[-1]
frame_ = syn_frame(tarfr, syntxtr, LF1, LF2, sq, padw)
frame_ = cv2.resi... | code_fim | hard | {
"lang": "python",
"repo": "maddigit/audio2video",
"path": "/audio2video/visual.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
root_dir : str
absolute path to the root characterization data directory.
constants : dict[string, any]
constants dictionary.
Returns
-------
fname : str
the simulation data file name.
... | code_fim | hard | {
"lang": "python",
"repo": "yaohuic/BAG_framework",
"path": "/bag/tech/mos.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yaohuic/BAG_framework path: /bag/tech/mos.py
# -*- coding: utf-8 -*-
"""This module contains transistor characterization and optimization related classes.
"""
import os
# import pyoptsparse
import numpy as np
from .core import CharDB
class MosCharDB(CharDB):
"""The mosfet characterizati... | code_fim | hard | {
"lang": "python",
"repo": "yaohuic/BAG_framework",
"path": "/bag/tech/mos.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> valid_objs = []
for obj in objs:
x, y, w, h = obj['bbox']
x1 = np.max((0, x))
y1 = np.max((0, y))
x2 = np.min((width - 1, x1 + np.max((0, w - 1))))
y2 = np.min((height - 1, y1 + np.max((0, h - 1))))
... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PaddleDetection",
"path": "/ppdet/data/source/keypoint_coco.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PaddleDetection path: /ppdet/data/source/keypoint_coco.py
_mode = test_mode
self.ann_info['num_joints'] = num_joints
self.img_ids = []
def parse_dataset(self):
pass
def __len__(self):
"""Get dataset length."""
return len(self.img_ids... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PaddleDetection",
"path": "/ppdet/data/source/keypoint_coco.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PaddleDetection path: /ppdet/data/source/keypoint_coco.py
idx)
if self.return_mask:
db_rec['mask'] = self._get_mask(anno, idx)
db_rec['im_id'] = img_id
db_rec['image_file'] = os.path.join(self.img_prefix,
... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PaddleDetection",
"path": "/ppdet/data/source/keypoint_coco.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> EntryFactory = BbtblEntry
MAGIC = 0x021D<|fim_prefix|># repo: fre-sch/mhw_armor_edit path: /src/mhw_armor_edit/ftypes/bbtbl.py
# coding: utf-8
from mhw_armor_edit import ftypes as ft
from mhw_armor_edit.ftypes import StructFile, Struct
<|fim_middle|>
class BbtblEntry(Struct):
STRUCT_SIZE = 6... | code_fim | hard | {
"lang": "python",
"repo": "fre-sch/mhw_armor_edit",
"path": "/src/mhw_armor_edit/ftypes/bbtbl.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Bbtbl(StructFile):
EntryFactory = BbtblEntry
MAGIC = 0x021D<|fim_prefix|># repo: fre-sch/mhw_armor_edit path: /src/mhw_armor_edit/ftypes/bbtbl.py
# coding: utf-8
from mhw_armor_edit import ftypes as ft
from mhw_armor_edit.ftypes import StructFile, Struct
<|fim_middle|>
class BbtblEntry(St... | code_fim | medium | {
"lang": "python",
"repo": "fre-sch/mhw_armor_edit",
"path": "/src/mhw_armor_edit/ftypes/bbtbl.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fre-sch/mhw_armor_edit path: /src/mhw_armor_edit/ftypes/bbtbl.py
# coding: utf-8
from mhw_armor_edit import ftypes as ft
from mhw_armor_edit.ftypes import StructFile, Struct
<|fim_suffix|> STRUCT_SIZE = 6
close_range: ft.ubyte()
power: ft.ubyte()
paralysis: ft.ubyte()
poison: ... | code_fim | easy | {
"lang": "python",
"repo": "fre-sch/mhw_armor_edit",
"path": "/src/mhw_armor_edit/ftypes/bbtbl.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dobesv/sqltap path: /sqltap/dec.py
import sqltap
import sqlalchemy.engine
def profile(engine = sqlalchemy.engine.Engine, user_context_fn = None):
""" Convenience decorator for profiling sqlalchemy queries.
<|fim_suffix|> for number in Session.query(Numbers).filter(Numbers.val... | code_fim | medium | {
"lang": "python",
"repo": "dobesv/sqltap",
"path": "/sqltap/dec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sqltap.start(engine, user_context_fn)
retval = fn(*args, **kwargs)
sqltap.stop(engine)
return retval
return dec
return inner_profile<|fim_prefix|># repo: dobesv/sqltap path: /sqltap/dec.py
import sqltap
import sqlalchemy.engine
def profile(engi... | code_fim | hard | {
"lang": "python",
"repo": "dobesv/sqltap",
"path": "/sqltap/dec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jschlyter/dnssec-keytools path: /src/kskm/ksr/verify_policy.py
"""Controls to verify KSR policy parameters."""
from datetime import datetime, timedelta, timezone
from logging import Logger
from typing import Optional
from kskm.common.config_misc import RequestPolicy
from kskm.common.data import ... | code_fim | hard | {
"lang": "python",
"repo": "jschlyter/dnssec-keytools",
"path": "/src/kskm/ksr/verify_policy.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> request: Request, policy: RequestPolicy, logger: Logger
) -> None:
"""Check that the bundles' intervals fall within expected limits."""
if not policy.check_bundle_intervals:
logger.warning(
"KSR-POLICY-BUNDLE-INTERVALS: Disabled by policy (check_bundle_intervals)"
)... | code_fim | hard | {
"lang": "python",
"repo": "jschlyter/dnssec-keytools",
"path": "/src/kskm/ksr/verify_policy.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonlearning2/micronet-1 path: /micronet/models/nin.py
import torch.nn as nn
class ConvBNReLU(nn.Module):
def __init__(
self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
groups=1,
bias=Tru... | code_fim | hard | {
"lang": "python",
"repo": "pythonlearning2/micronet-1",
"path": "/micronet/models/nin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.conv(x)
x = self.bn(x)
x = self.relu(x)
return x
class Net(nn.Module):
def __init__(self, cfg=None):
super(Net, self).__init__()
if cfg is None:
cfg = [192, 160, 96, 192, 192, 192, 192, 192]
self.model = nn.Sequential(
... | code_fim | hard | {
"lang": "python",
"repo": "pythonlearning2/micronet-1",
"path": "/micronet/models/nin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ilmosal/NorDB path: /nordb/nordic/nordicMain.py
teFloat
from nordb.core.validationTools import validateInteger
from nordb.core.validationTools import validateString
from nordb.core.validationTools import validateDate
from nordb.core.validationTools import validateTime
from nordb.nordic.nordicErr... | code_fim | hard | {
"lang": "python",
"repo": "Ilmosal/NorDB",
"path": "/nordb/nordic/nordicMain.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ilmosal/NorDB path: /nordb/nordic/nordicMain.py
event
:ivar str location_model: location model used for this main header or the quality indicator.
:ivar str distance_indicator: distance indicator of the event. L - Local, R - Regional, D - Distant
:ivar str event_desc_id: Event Descrip... | code_fim | hard | {
"lang": "python",
"repo": "Ilmosal/NorDB",
"path": "/nordb/nordic/nordicMain.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> val_magnitude_3 = validateFloat(val, "magnitude_3", -1.0, 9.9, self.header_type)
self._magnitude_3 = val_magnitude_3
type_of_magnitude_3 = property(operator.attrgetter('_type_of_magnitude_3'), doc="")
@type_of_magnitude_3.setter
def type_of_magnitude_3(self, val):
val... | code_fim | hard | {
"lang": "python",
"repo": "Ilmosal/NorDB",
"path": "/nordb/nordic/nordicMain.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # loop over dataset:
meter = AccuracyMeter()
for idx, sample in enumerate(dataset):
# preprocess sample:
image, target = sample
image = transform(image)
image.unsqueeze_(0)
target = torch.tensor([target], dtype=torch.long)
# perform inference u... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/CrypTen",
"path": "/examples/mpc_imagenet/mpc_imagenet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/CrypTen path: /examples/mpc_imagenet/mpc_imagenet.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. 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 logging
import tem... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/CrypTen",
"path": "/examples/mpc_imagenet/mpc_imagenet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # preprocess sample:
image, target = sample
image = transform(image)
image.unsqueeze_(0)
target = torch.tensor([target], dtype=torch.long)
# perform inference using encrypted model on encrypted sample:
encrypted_image = crypten.cryptensor(image)
... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/CrypTen",
"path": "/examples/mpc_imagenet/mpc_imagenet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> np.random.seed(42)
adata = scv.datasets.toy_data(n_obs=n_obs)
adata.obs_names_make_unique()
adata.var_names_make_unique()
scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=1000)
adata.var["symbol"] = adata.var_names.str.cat(["gs"] * adata.n_vars, sep=":")
r... | code_fim | hard | {
"lang": "python",
"repo": "gladelephant/cellrank_heatmap",
"path": "/tests/_helpers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gladelephant/cellrank_heatmap path: /tests/_helpers.py
from typing import Tuple, Union, Optional
import os
import pytest
from PIL import Image
from pathlib import Path
import scanpy as sc
import scvelo as scv
import cellrank as cr
from anndata import AnnData
from cellrank.tl.kernels import Velo... | code_fim | hard | {
"lang": "python",
"repo": "gladelephant/cellrank_heatmap",
"path": "/tests/_helpers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Like store, but never throws an exception.
'''
r = False
try:
r = self.store(handler, etype, clientid, **data)
except Exception as e:
LOG.error(f'safe_store: store failed with: {e}')
return r
def store(self, handler... | code_fim | hard | {
"lang": "python",
"repo": "e271828-/event-reporter",
"path": "/event_reporter/classes.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: e271828-/event-reporter path: /event_reporter/classes.py
import json
import logging
import os
import time
from typing import Dict
import google_measurement_protocol # event, pageview, report
import beeline
import requests
LOG = logging.getLogger("EventReporter")
TTL = os.getenv('EVENTREPORTE... | code_fim | hard | {
"lang": "python",
"repo": "e271828-/event-reporter",
"path": "/event_reporter/classes.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erincase/tictactoe path: /tictactoe.py
from copy import deepcopy
from typing import NamedTuple, Optional
import constants as c
def main():
"""
Runs a game of tic-tac-toe. Asks players "X" and "O" to alternate choosing squares of the
tic-tac-toe board to fill in. After each turn, wi... | code_fim | hard | {
"lang": "python",
"repo": "erincase/tictactoe",
"path": "/tictactoe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def print_board(board_values: dict[str, str]):
"""
Prints a diagram of the current tic-tac-toe board.
:param board_values: Map of current board values. Empty squares should map to their square
label. Filled squares should map to either "X" or "O".
"""
print(c... | code_fim | hard | {
"lang": "python",
"repo": "erincase/tictactoe",
"path": "/tictactoe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prashik-s/alexaConnectTheDots path: /gameplay.py
class team:
def __init__(self, name):
self.name = name
self.score = 0
self.moves = 0
def change_name(self, new_name):
<|fim_suffix|> def __init__(self, name1, name2):
self.team1 = name1
self.team2 = name2
# 0 - ... | code_fim | medium | {
"lang": "python",
"repo": "prashik-s/alexaConnectTheDots",
"path": "/gameplay.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.team1 = name1
self.team2 = name2
# 0 - Tie 1 - Team1 2 - Team2
self.status = 0
def createGame:
name1 = input()
name2 = input()
Game = Game(name1, name2)
return Game<|fim_prefix|># repo: prashik-s/alexaConnectTheDots path: /gameplay.py
class team:
def __init__(self, name):
self.... | code_fim | medium | {
"lang": "python",
"repo": "prashik-s/alexaConnectTheDots",
"path": "/gameplay.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def giveMoves(self):
return self.moves
class Game:
def __init__(self, name1, name2):
self.team1 = name1
self.team2 = name2
# 0 - Tie 1 - Team1 2 - Team2
self.status = 0
def createGame:
name1 = input()
name2 = input()
Game = Game(name1, name2)
return Game<|fim_prefix|># repo: prash... | code_fim | medium | {
"lang": "python",
"repo": "prashik-s/alexaConnectTheDots",
"path": "/gameplay.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: auth0/auth0-python path: /auth0/authentication/users.py
from __future__ import annotations
from typing import Any
from auth0.rest import RestClient, RestClientOptions
from auth0.types import TimeoutType
class Users:
"""Users client.
Args:
domain (str): The domain of your Auth... | code_fim | hard | {
"lang": "python",
"repo": "auth0/auth0-python",
"path": "/auth0/authentication/users.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
The user profile.
"""
data: dict[str, Any] = self.client.get(
url=f"{self.protocol}://{self.domain}/userinfo",
headers={"Authorization": f"Bearer {access_token}"},
)
return data<|fim_prefix|># repo: auth0/auth0-python pa... | code_fim | hard | {
"lang": "python",
"repo": "auth0/auth0-python",
"path": "/auth0/authentication/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
domain: str,
telemetry: bool = True,
timeout: TimeoutType = 5.0,
protocol: str = "https",
) -> None:
self.domain = domain
self.protocol = protocol
self.client = RestClient(
None,
options=RestClientOptions(tel... | code_fim | hard | {
"lang": "python",
"repo": "auth0/auth0-python",
"path": "/auth0/authentication/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_cell(self, row, col):
return self.cells[self.get_cell_index(row, col)]
def get_row_col(self, index):
row = math.floor(index / self.num_cols)
col = index % self.num_cols
return (row, col)
def check_win(self, cell_value):
cell_values = [cell.get_value() for cell in self... | code_fim | medium | {
"lang": "python",
"repo": "j-freddy/ultimate-tictactoe-2",
"path": "/board/board.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row = math.floor(index / self.num_cols)
col = index % self.num_cols
return (row, col)
def check_win(self, cell_value):
cell_values = [cell.get_value() for cell in self.cells]
for indices in self.winning_cases:
matches = [cell_values[i] == cell_value for i in indices]
if... | code_fim | hard | {
"lang": "python",
"repo": "j-freddy/ultimate-tictactoe-2",
"path": "/board/board.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: j-freddy/ultimate-tictactoe-2 path: /board/board.py
import math
from cell.cell_value import CellValue
class Board:
def __init__(self):
self.num_rows = 3
self.num_cols = 3
self.cells = []
self.winning_cases = [
# Horizontal
[0, 1, 2], [3, 4, 5], [6, 7, 8],
# Ve... | code_fim | medium | {
"lang": "python",
"repo": "j-freddy/ultimate-tictactoe-2",
"path": "/board/board.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmansilla-2014056/tytus path: /parser/fase2/team24/c3d.py
from datetime import date
from variables import tabla as ts
from variables import NombreDB
from variables import cont
import tablaDGA as TAS
import sql as sql
import mathtrig as mt
from reportTable import *
pila = []
for i in range(1... | code_fim | easy | {
"lang": "python",
"repo": "jmansilla-2014056/tytus",
"path": "/parser/fase2/team24/c3d.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> global cont
global ts
NombreDB = ts.nameDB
sql.execute("DROP INDEX idx_bodega;")
sql.execute("DROP INDEX x;")
graphTable(ts)
ejecutar()<|fim_prefix|># repo: jmansilla-2014056/tytus path: /parser/fase2/team24/c3d.py
from datetime import date
from variables import tabla as ts
from variables import... | code_fim | medium | {
"lang": "python",
"repo": "jmansilla-2014056/tytus",
"path": "/parser/fase2/team24/c3d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ammarhakim/gkyl path: /Lib/wscript
## -*- python -*-
# Build code in this directory
## _______ ___
## + 6 @ |||| # P ||| +
import os
<|fim_suffix|> bld.shlib(source = "gkyl_ipow.cpp whereami.c base64.cpp lfs.c",
use = "LUAJIT", includes = '. ../Cuda', target = 'lib', nam... | code_fim | easy | {
"lang": "python",
"repo": "ammarhakim/gkyl",
"path": "/Lib/wscript",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bld.shlib(source = "gkyl_ipow.cpp whereami.c base64.cpp lfs.c",
use = "LUAJIT", includes = '. ../Cuda', target = 'lib', name = 'lib', vnum = '1.0')<|fim_prefix|># repo: ammarhakim/gkyl path: /Lib/wscript
## -*- python -*-
# Build code in this directory
## _______ ___
## + 6 @ |||... | code_fim | easy | {
"lang": "python",
"repo": "ammarhakim/gkyl",
"path": "/Lib/wscript",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wmwv/snpy path: /get_osc.py
'''
Module for SNooPy to download/parse data from the Open Supernova Catalog.
'''
import json
import urllib
from astropy.coordinates import Angle
from snpy import sn
# telescope,band --> SNooPy filter database
# We do this by matching (band,system,telescope,observato... | code_fim | hard | {
"lang": "python",
"repo": "wmwv/snpy",
"path": "/get_osc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
try:
u = urllib.urlopen(url)
except:
retrun None,"Invalid URL"
try:
d = json.load(u)
except:
u.close()
return None,"Failed to decode JSON"
else:
u.close()
# We now have the JSON data. Get the info we need
d = d.values()[0]
name = d['name']
... | code_fim | hard | {
"lang": "python",
"repo": "wmwv/snpy",
"path": "/get_osc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HosseinMohammadii/django-rest-verification path: /verification/exceptions.py
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException, ValidationError, PermissionDenied
<|fim_suffix|>
class VerificationTypeNotVa... | code_fim | hard | {
"lang": "python",
"repo": "HosseinMohammadii/django-rest-verification",
"path": "/verification/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserHasActiveVerification(APIException):
status_code = status.HTTP_403_FORBIDDEN
default_detail = _('User has unexpired verification code')
default_code = 'permission_denied'<|fim_prefix|># repo: HosseinMohammadii/django-rest-verification path: /verification/exceptions.py
from django.ut... | code_fim | hard | {
"lang": "python",
"repo": "HosseinMohammadii/django-rest-verification",
"path": "/verification/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lordjack/oficina_introducao_programacao_python path: /exercicios/ex09.py
# Exercício 09 - Estrutura de repetição
# While
# Entrada de Dados
x = 0
# condicional de repetição
while x < 3:
# saída<|fim_suffix|> de Dados
x = x + 1
# saída de dados
print("Saiu do while")<|fim_middle|> de dado... | code_fim | medium | {
"lang": "python",
"repo": "lordjack/oficina_introducao_programacao_python",
"path": "/exercicios/ex09.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> de Dados
x = x + 1
# saída de dados
print("Saiu do while")<|fim_prefix|># repo: lordjack/oficina_introducao_programacao_python path: /exercicios/ex09.py
# Exercício 09 - Estrutura de repetição
# While
# Entrada de <|fim_middle|>Dados
x = 0
# condicional de repetição
while x < 3:
# saída de dado... | code_fim | medium | {
"lang": "python",
"repo": "lordjack/oficina_introducao_programacao_python",
"path": "/exercicios/ex09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: w4nd0/kanvas path: /activities/migrations/0005_alter_submissions_repo.py
# Generated by Django 3.2.8 on 2021-11-02 20:14
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AlterField(
model_name="subm... | code_fim | medium | {
"lang": "python",
"repo": "w4nd0/kanvas",
"path": "/activities/migrations/0005_alter_submissions_repo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name="submissions",
name="repo",
field=models.CharField(max_length=511, null=True),
),
]<|fim_prefix|># repo: w4nd0/kanvas path: /activities/migrations/0005_alter_submissions_repo.py
# Generated by Dja... | code_fim | medium | {
"lang": "python",
"repo": "w4nd0/kanvas",
"path": "/activities/migrations/0005_alter_submissions_repo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: craigtmoore/secret_code path: /main.py
import argparse
import os
import string
class EncodeDecode:
def __init__(self):
alphabet = string.printable + string.whitespace
self.encodeDict = dict()
self.decodeDict = dict()
for i, character in enumerate(... | code_fim | hard | {
"lang": "python",
"repo": "craigtmoore/secret_code",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tmp_file_name = "temporary_file"
with open(tmp_file_name, "w") as tmp_file:
with open(file_name, "r") as file:
for line in file.readlines():
for character in line:
value = self.encodeDict[character]
... | code_fim | hard | {
"lang": "python",
"repo": "craigtmoore/secret_code",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rolisz/walter_waiter path: /only_face.py
#! /usr/bin/python
from controllers.face_state import FaceState
from sensors.webcam import Webcam, FaceDetector
from event import EventLoop
from mock import Mock
class FakeIRobot(object):
<|fim_suffix|> e.register('webcam', Webcam(e, cam=1))
e.reg... | code_fim | hard | {
"lang": "python",
"repo": "rolisz/walter_waiter",
"path": "/only_face.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Events for face tracking and killing actions
e.register('f_s', f_s, 'cups_done')
e.register('f_s', f_s, 'face_pos')
e.register('f_s', f_s, 'face_gone')
e.register('f_s', f_s, 'no_cups_on_tray')
e.add_event('cups_done', None)
e.run()<|fim_prefix|># repo: rolisz/walter_waiter... | code_fim | hard | {
"lang": "python",
"repo": "rolisz/walter_waiter",
"path": "/only_face.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: strigazi/athena path: /Database/EventIndex/EventIndexProducer/scripts/RAW2EI.py
#!/usr/bin/env python
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#import pdb
import eformat
import sys
import os
import time
import logging
from libpyeformat import FullEventFragment, ... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/Database/EventIndex/EventIndexProducer/scripts/RAW2EI.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
eif['ProjName_{:d}'.format(nfile)] = dr.projectTag()
eif['TrigStream_{:d}'.format(nfile)] = dr.stream()
eif['AMITag_{:d}'.format(nfile)] = "" # no tag for RAW data
#input = eformat.istream([input_file])
input = istream2(input_file)
################... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/Database/EventIndex/EventIndexProducer/scripts/RAW2EI.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hz-heng/webspider path: /webspider/web/urls.py
# -*- coding: utf-8 -*-
from tornado.web import URLSpec
<|fim_suffix|>url_handlers = [
URLSpec(r"/", IndexHandler),
URLSpec(r"/statistics", StatisticsHandler),
]<|fim_middle|>from webspider.web.handlers import StatisticsHandler, IndexHandler... | code_fim | medium | {
"lang": "python",
"repo": "hz-heng/webspider",
"path": "/webspider/web/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>url_handlers = [
URLSpec(r"/", IndexHandler),
URLSpec(r"/statistics", StatisticsHandler),
]<|fim_prefix|># repo: hz-heng/webspider path: /webspider/web/urls.py
# -*- coding: utf-8 -*-
from tornado.web import URLSpec
<|fim_middle|>from webspider.web.handlers import StatisticsHandler, IndexHandler... | code_fim | medium | {
"lang": "python",
"repo": "hz-heng/webspider",
"path": "/webspider/web/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yirga-16/optimization-framework path: /swagger_server/test/test_control_controller.py
# coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from swagger_server.models.output_source import OutputSource # noqa: E501
from swagger_server.test import... | code_fim | hard | {
"lang": "python",
"repo": "Yirga-16/optimization-framework",
"path": "/swagger_server/test/test_control_controller.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Creates a new control setpoint as ouput
"""
Output_Source = OutputSource()
response = self.client.open(
'/v1/control/mqtt/{id}'.format(id='id_example'),
method='PUT',
data=json.dumps(Output_Source),
content_type='application/j... | code_fim | hard | {
"lang": "python",
"repo": "Yirga-16/optimization-framework",
"path": "/swagger_server/test/test_control_controller.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = ""
for (x,y) in lst:
res += "SI("
res += x
res += ";"+'"'+y+'";'
res += '""'
for i in range(len(lst)):
res += ")"
res = res.replace("note", note)
return "="+res
if __name__ == "__main__":
file_name = "conditions_1.txt"
... | code_fim | hard | {
"lang": "python",
"repo": "michaelguedj/prog__conditions_vers_tableur",
"path": "/conditions_vers_tableur.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaelguedj/prog__conditions_vers_tableur path: /conditions_vers_tableur.py
"""
##
## Name: conditions_vers_tableur.py
##
## Author: Dr Michael GUEDJ
##
## Description:
## Generation of a spreadsheet formula, based on a sequence of conditions,
## from a text file wrote under... | code_fim | hard | {
"lang": "python",
"repo": "michaelguedj/prog__conditions_vers_tableur",
"path": "/conditions_vers_tableur.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>""" return a list of the line of the file file_name """
def extract_lines(file_name):
lst_line = []
with open(file_name, "r") as f_in:
for line in f_in:
s = line.replace('\n', "")
lst_line.append(s)
# remove the empty word in the result
lst_line = [x... | code_fim | hard | {
"lang": "python",
"repo": "michaelguedj/prog__conditions_vers_tableur",
"path": "/conditions_vers_tableur.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cavenfish/autocp2k path: /autocp2k/geo2cell.py
from .config import *
def geo2cell(geofile, posfile):
<|fim_suffix|> geofile: string
This should be a string that points to the input file of an
already run geometry optimization file. (FULL DIRECTORY STRING REQUIRED)
posfile:... | code_fim | medium | {
"lang": "python",
"repo": "Cavenfish/autocp2k",
"path": "/autocp2k/geo2cell.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> geofile: string
This should be a string that points to the input file of an
already run geometry optimization file. (FULL DIRECTORY STRING REQUIRED)
posfile: string
This should be a string that points to the position trace file produced
by the geometry optimization ... | code_fim | medium | {
"lang": "python",
"repo": "Cavenfish/autocp2k",
"path": "/autocp2k/geo2cell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_dict(self):
original = {
'int32':
np.arange(4, dtype=np.int32).reshape([2, 2]),
'float64':
-np.arange(4, dtype=np.float64).reshape([1, 4]),
'bytes':
np.array([b'a', b'bc', b'def'], dtype=np.object).reshape([3, 1]),
}
outpu... | code_fim | medium | {
"lang": "python",
"repo": "Methimpact/fedjax",
"path": "/fedjax/experimental/serialization_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> original = [
np.arange(4, dtype=np.int32).reshape([2, 2]),
[
-np.arange(4, dtype=np.float64).reshape([1, 4]),
[
np.array([b'a', b'bc', b'def'],
dtype=np.object).reshape([3, 1]), []
]
]
]
output... | code_fim | hard | {
"lang": "python",
"repo": "Methimpact/fedjax",
"path": "/fedjax/experimental/serialization_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Methimpact/fedjax path: /fedjax/experimental/serialization_test.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | code_fim | hard | {
"lang": "python",
"repo": "Methimpact/fedjax",
"path": "/fedjax/experimental/serialization_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reconstruir/bes path: /lib/bes/fs/dir_combine_type.py
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
<|fim_suffix|>class dir_combine_type(checked_enum):
PREFIX = 'prefix'
MEDIA_TYPE = 'media_type'
dir_combine_type.register_check_class()<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "reconstruir/bes",
"path": "/lib/bes/fs/dir_combine_type.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> PREFIX = 'prefix'
MEDIA_TYPE = 'media_type'
dir_combine_type.register_check_class()<|fim_prefix|># repo: reconstruir/bes path: /lib/bes/fs/dir_combine_type.py
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from bes.enum_util.checked_enum import checked_en... | code_fim | easy | {
"lang": "python",
"repo": "reconstruir/bes",
"path": "/lib/bes/fs/dir_combine_type.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kyeongbkim/objxp path: /test/ObexKeepaliveTest.py
#!/usr/bin/env python
import pdb
from YTest.TestBase import skipIfNotRoot
from YTest.TestBase import TestBase
import objxp
from objxp import DynamicCast_ObexRemoteClientSession
from ObjXp import *
from pyroute2 import IPRoute
import logging
impor... | code_fim | hard | {
"lang": "python",
"repo": "kyeongbkim/objxp",
"path": "/test/ObexKeepaliveTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> session = self._oc.connect('keepalive', self._serverAddr, 3000, 0)
assert(session)
WaitUntil(self._ioSvc, lambda: self.getSockStatus(port) == "ESTABLISHED")
DynamicCast_ObexRemoteClientSession(session).setKeepalive(
self._idle, self._interval, self._probe)
... | code_fim | hard | {
"lang": "python",
"repo": "kyeongbkim/objxp",
"path": "/test/ObexKeepaliveTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CagriCatik/carla path: /Co-Simulation/Sumo/run_synchronization.py
#!/usr/bin/env python
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/lice... | code_fim | hard | {
"lang": "python",
"repo": "CagriCatik/carla",
"path": "/Co-Simulation/Sumo/run_synchronization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> carla_actor = self.carla.get_actor(carla_actor_id)
sumo_actor = self.sumo.get_actor(sumo_actor_id)
sumo_transform = BridgeHelper.get_sumo_transform(carla_actor.get_transform(),
carla_actor.bounding_box.extent... | code_fim | hard | {
"lang": "python",
"repo": "CagriCatik/carla",
"path": "/Co-Simulation/Sumo/run_synchronization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FierySwampshire/weeb2psp path: /sconutils.py
import subprocess
from sys import stderr as STDERR
from sys import exit
def eprint(errmsg):
"""Prints `errmsg` to STDERR."""
print(errmsg, file=STDERR)
def die(errmsg):
"""Prints message and exits Python with a status of one."""
epr... | code_fim | hard | {
"lang": "python",
"repo": "FierySwampshire/weeb2psp",
"path": "/sconutils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Error Handling
==============
If the spawned proccess returns a nonzero exit status, it will print the
program's ``STDERR`` to the running Python iterpreter's ``STDERR``, cause
Python to exit with a return status of 1.
"""
proc = subprocess.Popen(
args, shell=True, stdo... | code_fim | hard | {
"lang": "python",
"repo": "FierySwampshire/weeb2psp",
"path": "/sconutils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># ENUMERATION TYPE ifctendonconduittypeenum
ifctendonconduittypeenum = ENUMERATION('ifctendonconduittypeenum',
'notdefined userdefined grouting_duct trumpet duct diabolo coupler ')
# SELECT TYPE ifccurvefontorscaledcurvefontselect
ifccurvefontorscaledcurvefontselect ... | code_fim | hard | {
"lang": "python",
"repo": "mozman/steputils",
"path": "/docs/stepcode/ifc4x2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Mandatory argument
assert value != None, 'Argument "value" is mandatory and cannot be set to None'
if not check_type(value, ifccurve):
self._parentcurve = ifccurve(value)
else:
self._parentcurve = value
@property
def dim(self):
att... | code_fim | hard | {
"lang": "python",
"repo": "mozman/steputils",
"path": "/docs/stepcode/ifc4x2.py",
"mode": "spm",
"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.