text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> predict_kwargs = {}
tags = {
"batch_id": batch_id,
}
predict_kwargs["meta"] = tags
predict_kwargs["headers"] = {SELDON_PUID_HEADER: seldon_puid}
try:
# Process raw input format
if data_type == "raw":
raw_data, payload_type, raw_input_tags = _ext... | code_fim | hard | {
"lang": "python",
"repo": "SeldonIO/seldon-core",
"path": "/python/seldon_core/batch_processor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Mark task as done in the queue to add space for new tasks
q_in.task_done()
def _extract_raw_data_multi_request(
loaded_data: List[Dict], tags: Dict
) -> Tuple[Dict, str, Dict]:
raw_input_tags = [d.get("meta", {}).get("tags", {}) for d in loaded_data]
first_input = loaded_da... | code_fim | hard | {
"lang": "python",
"repo": "SeldonIO/seldon-core",
"path": "/python/seldon_core/batch_processor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeldonIO/seldon-core path: /python/seldon_core/batch_processor.py
,
data_type,
sc,
retries,
batch_id,
)
q_out.put(str_output)
elif method == "feedback":
batch_idx, b... | code_fim | hard | {
"lang": "python",
"repo": "SeldonIO/seldon-core",
"path": "/python/seldon_core/batch_processor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jlm365/iceflow path: /iceflow/regression.py
import warnings
import argparse
import sys
import os
import glob
import datetime
import logging
import numpy
from osgeo import gdal
import pygeoprocessing
logging.basicConfig(level=logging.INFO)
LOGGER = logging.getLogger('iceflow.regression')
def _... | code_fim | hard | {
"lang": "python",
"repo": "jlm365/iceflow",
"path": "/iceflow/regression.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
``numpy.ndarray``, in 2 dimensions. This will contain the ``m``
parameter from the fitted line.
"""
stacked_array = numpy.dstack(blocks)
new_shape = (stacked_array.shape[0]*stacked_array.shape[1],
len(timesteps))
... | code_fim | hard | {
"lang": "python",
"repo": "jlm365/iceflow",
"path": "/iceflow/regression.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sympy/sympy path: /sympy/assumptions/tests/test_sathandlers.py
from sympy.assumptions.ask import Q
from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.mul import Mul
from sympy.core.symbol import symbols
from sympy.logic.boolalg import (And, Or)
from sympy.assumpt... | code_fim | medium | {
"lang": "python",
"repo": "sympy/sympy",
"path": "/sympy/assumptions/tests/test_sathandlers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_exactlyonearg():
assert exactlyonearg(x, Q.zero(x), x*y) == \
Or(Q.zero(x) & ~Q.zero(y), Q.zero(y) & ~Q.zero(x))
assert exactlyonearg(x, Q.zero(x), x*y*z) == \
Or(Q.zero(x) & ~Q.zero(y) & ~Q.zero(z), Q.zero(y)
& ~Q.zero(x) & ~Q.zero(z), Q.zero(z) & ~Q.zero(x) & ~Q... | code_fim | hard | {
"lang": "python",
"repo": "sympy/sympy",
"path": "/sympy/assumptions/tests/test_sathandlers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # The predicate doesn't matter here, so just pass
@my_handler_registry.register(Mul)
def fact1(expr):
pass
@my_handler_registry.multiregister(Expr)
def fact2(expr):
pass
assert my_handler_registry[Basic] == (frozenset(), frozenset())
assert my_handler_registry[... | code_fim | medium | {
"lang": "python",
"repo": "sympy/sympy",
"path": "/sympy/assumptions/tests/test_sathandlers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: packit/ogr path: /tests/integration/pagure/test_service.py
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import pytest
from requre.online_replacing import record_requests_for_all_methods
from tests.integration.pagure.base import PagureTests
from ogr.exceptions i... | code_fim | hard | {
"lang": "python",
"repo": "packit/ogr",
"path": "/tests/integration/pagure/test_service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = "new-ogr-testing-repo"
namespace = "fedora-magazine"
with pytest.raises(
OgrException, match=r".*Cannot create project in given namespace.*"
):
self.service.project_create(repo=name, namespace=namespace)
project = self.service.get_pro... | code_fim | hard | {
"lang": "python",
"repo": "packit/ogr",
"path": "/tests/integration/pagure/test_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> IS_OBJ_VALID = not (_zend_object_ptr.cast(zend_uintptr_t) & (1<<0))
# IS_OBJ_VALID = 1
if IS_OBJ_VALID:
IS_OBJ_DESTRUCTOR_CALLED = _zend_object_ptr.dereference()["gc"]["u"]["v"]["flags"] & (1<<3)
# IS_OBJ_DESTRUCTOR_CALLED = 0
if (not IS_OBJ_D... | code_fim | hard | {
"lang": "python",
"repo": "goghcrow/php-minimalism",
"path": "/src/tools/GDB_script/.gdbinit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goghcrow/php-minimalism path: /src/tools/GDB_script/.gdbinit.py
import operator
import gdb
def str_val(zend_string):
return str(gdb.inferiors()[0].read_memory(zend_string["val"], zend_string["len"]))
def zobjdump():
obj_count = {}
<|fim_suffix|> if IS_OBJ_VALID:
IS_... | code_fim | hard | {
"lang": "python",
"repo": "goghcrow/php-minimalism",
"path": "/src/tools/GDB_script/.gdbinit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # prepare chunks for processes
min_nucleotides = gv.MIN_COMPLEMENTARY_NUCLEOTIDES
overlapping_nts = min_nucleotides - 1
min_chunk_len = gv.MIN_CHUNK_LEN
gap = min_chunk_len - overlapping_nts
tot_site_len = len(threeutr_transcript)
n_proc = floor((tot_site_len - 2 * min_nucleo... | code_fim | hard | {
"lang": "python",
"repo": "simosini/deepmiRNA",
"path": "/src/deepmirna/candidate_site_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simosini/deepmiRNA path: /src/deepmirna/candidate_site_finder.py
#################################################################################################
# This file scans the 3'UTR of a given gene to find potential candidate sites to be passed to the
# neural network for evaluation. Whe... | code_fim | hard | {
"lang": "python",
"repo": "simosini/deepmiRNA",
"path": "/src/deepmirna/candidate_site_finder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
finds all candidate binding sites according to the CSSM provided by the config file.
The threeUTR is split between a certain number of processes according to its length.
The chunks created are overlapping to allow binding sites to be found
across 2 consecutive chunks.
:param ... | code_fim | hard | {
"lang": "python",
"repo": "simosini/deepmiRNA",
"path": "/src/deepmirna/candidate_site_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lassik/lookup-computer path: /chanmode.py
#! /usr/bin/env python3
import re
import yaml # pip3 install pyyaml
import util
GITHUB = "https://raw.githubusercontent.com/"
URL = GITHUB + "ircdocs/irc-defs/gh-pages/_data/chanmodes.yaml"
CACHE = "chanmodes.yaml"
COLUMNS = ["Char", "Name", "Origin... | code_fim | medium | {
"lang": "python",
"repo": "lassik/lookup-computer",
"path": "/chanmode.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>def scrape_all():
with open(util.get_cache_file(CACHE, URL), "r") as file:
data = yaml.safe_load(file)
for mode in data["values"]:
char = mode.get("char", "")
name = mode.get("name", "")
origin = mode.get("origin", "")
comment = mode.get(... | code_fim | medium | {
"lang": "python",
"repo": "lassik/lookup-computer",
"path": "/chanmode.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xinchungitHub/feng-python-apply path: /feng-ml-tf/src/data_helper.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: lionel
import collections
import tensorflow as tf
def load_data(filename, sep=' ', sep1=',', isCharacter=False):
label_list = []
features_list = []
with tf.g... | code_fim | hard | {
"lang": "python",
"repo": "xinchungitHub/feng-python-apply",
"path": "/feng-ml-tf/src/data_helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dataset = tf.data.Dataset.from_tensor_slices((label_list, features_list))
dataset = dataset.shuffle(shuffle_size).repeat().batch(batch_size)
return dataset
def build_table_from_text_file(filepath):
return tf.contrib.lookup.HashTable(
tf.contrib.lookup.TextFileInitializer(filepath... | code_fim | hard | {
"lang": "python",
"repo": "xinchungitHub/feng-python-apply",
"path": "/feng-ml-tf/src/data_helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: r-a-morrison/fe_alloy_sound_velocities path: /120_GruneisenParam/plotGruneisenParam.py
# Front matter
##############
import os
from os import fdopen, remove
from tempfile import mkstemp
from shutil import move
import glob
import re
import time
import pandas as pd
import numpy as np
from scipy imp... | code_fim | hard | {
"lang": "python",
"repo": "r-a-morrison/fe_alloy_sound_velocities",
"path": "/120_GruneisenParam/plotGruneisenParam.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>fit = 'Fe vib q=1.0'
h0, = ax0.plot(V_array,calcGruneisen(V_array,V0[fit],gamma0[fit],q[fit]), '-',
color = color,linewidth = 1.0,label=r'This study (Equation 17)')
ax0.fill_between(V_array,
calcGruneisen(V_array,V0[fit],gamma0[fit]-dgamma0[fit],q[fit]),
calcGruneisen(V_array,V0[fit],gamma0[fit]+dgamma... | code_fim | hard | {
"lang": "python",
"repo": "r-a-morrison/fe_alloy_sound_velocities",
"path": "/120_GruneisenParam/plotGruneisenParam.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Extracts the phase of each data point along the x axis. Before applying, the DC and low frequency components must be removed from the signal.
Performs an adjacent averaging on each point before doing a 1D Hilbert transform along x and returning the phase=arctan(Im/Re).
... | code_fim | hard | {
"lang": "python",
"repo": "MaximeLapointeMajor/QuantumDot-AutomatedTuning",
"path": "/SignalProcessing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaximeLapointeMajor/QuantumDot-AutomatedTuning path: /SignalProcessing.py
xNPoints-xmin_ind-xmax_ind]
cut.data = np.zeros((cut.nAcqChan, cut.yNPoints, cut.xNPoints-xmax_ind-xmin_ind))
for u, i in enumerate(self.data):
cut.data[u] = i.T[xmin_ind:][:cut.xN... | code_fim | hard | {
"lang": "python",
"repo": "MaximeLapointeMajor/QuantumDot-AutomatedTuning",
"path": "/SignalProcessing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaximeLapointeMajor/QuantumDot-AutomatedTuning path: /SignalProcessing.py
ind-xmin_ind))
for u, i in enumerate(self.data):
cut.data[u] = i.T[xmin_ind:][:cut.xNPoints-xmin_ind-xmax_ind].T
else:
xmax_ind = sum(1 for i in abs(cut.xData) if round(i,... | code_fim | hard | {
"lang": "python",
"repo": "MaximeLapointeMajor/QuantumDot-AutomatedTuning",
"path": "/SignalProcessing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ A Plato federated learning training session using the axiothea algorithm. """
client = axiothea_client.Client()
server = axiothea_server.Server()
edge_server = axiothea_server.Server
edge_client = axiothea_edge.Client
server.run(client, edge_server, edge_client)
if __name__ =... | code_fim | medium | {
"lang": "python",
"repo": "Yufei-Kang/plato",
"path": "/examples/axiothea/axiothea.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
""" A Plato federated learning training session using the axiothea algorithm. """
client = axiothea_client.Client()
server = axiothea_server.Server()
edge_server = axiothea_server.Server
edge_client = axiothea_edge.Client
server.run(client, edge_server, edge_client)
... | code_fim | medium | {
"lang": "python",
"repo": "Yufei-Kang/plato",
"path": "/examples/axiothea/axiothea.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yufei-Kang/plato path: /examples/axiothea/axiothea.py
"""
A federated learning training session using Axiothea.
"""
import os
import axiothea_server
import axiothea_client
import axiothea_edge
os.environ['config_file'] = 'axiothea_MNIST_lenet5.yml'
<|fim_suffix|> """ A Plato federated lear... | code_fim | medium | {
"lang": "python",
"repo": "Yufei-Kang/plato",
"path": "/examples/axiothea/axiothea.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fotavio16/PycharmProjects path: /MachineLearning/feedforward.py
# Machine Learning, Neural Netwoks
# Classification, prediction
# Exemplo : Função XOR
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropT... | code_fim | hard | {
"lang": "python",
"repo": "fotavio16/PycharmProjects",
"path": "/MachineLearning/feedforward.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Testes com a Rede 3 - FeedForward")
print("Entrada (1,0) - saída {}.".format(netFF.activate((1,0))))
print("Entrada (0,1) - saída {}.".format(netFF.activate((0,1))))
print("Entrada (0,0) - saída {}.".format(netFF.activate((0,0))))
print("Entrada (1,1) - saída {}.".format(netFF.activate((1,1))))
pri... | code_fim | hard | {
"lang": "python",
"repo": "fotavio16/PycharmProjects",
"path": "/MachineLearning/feedforward.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class SemanticSegmentationLoss(nn.Module):
def __init__(self, num_classes, jaccard_alpha=0.9):
super().__init__()
self.jaccard_alpha = jaccard_alpha
self.jaccard = SoftJaccardLoss(num_classes)
self.focal = FocalLoss(num_classes)
def forward(self, pred_logits, targ... | code_fim | hard | {
"lang": "python",
"repo": "PVSemk/segmentation_models.pytorch",
"path": "/utils/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, pred_logits, target):
loss = self.jaccard_alpha * self.jaccard(pred_logits, target)
loss = loss + self.focal(pred_logits, target)
return loss<|fim_prefix|># repo: PVSemk/segmentation_models.pytorch path: /utils/loss.py
import torch.nn as nn
import torch.nn.fu... | code_fim | hard | {
"lang": "python",
"repo": "PVSemk/segmentation_models.pytorch",
"path": "/utils/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PVSemk/segmentation_models.pytorch path: /utils/loss.py
import torch.nn as nn
import torch.nn.functional as F
class SoftJaccardLoss(nn.Module):
def __init__(self, num_classes, eps=1e-5):
super().__init__()
self.num_classes = num_classes
self.eps = eps
def forwar... | code_fim | hard | {
"lang": "python",
"repo": "PVSemk/segmentation_models.pytorch",
"path": "/utils/loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toucan-project/TOUCAN path: /toucan/canary_utils/tasks.py
from glob import glob
from os import remove
<|fim_suffix|> files = glob(f"{settings.MEDIA_ROOT}/docs/*")
for file in files:
remove(file)<|fim_middle|>from django.conf import settings
from django_rq import job
@job
def d... | code_fim | medium | {
"lang": "python",
"repo": "toucan-project/TOUCAN",
"path": "/toucan/canary_utils/tasks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> files = glob(f"{settings.MEDIA_ROOT}/docs/*")
for file in files:
remove(file)<|fim_prefix|># repo: toucan-project/TOUCAN path: /toucan/canary_utils/tasks.py
from glob import glob
from os import remove
<|fim_middle|>from django.conf import settings
from django_rq import job
@job
def d... | code_fim | medium | {
"lang": "python",
"repo": "toucan-project/TOUCAN",
"path": "/toucan/canary_utils/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikolskiy/python-grpc-mutual-tls-auth path: /codegen.py
"""Runs protoc with the gRPC plugin to generate messages and gRPC stubs."""
<|fim_suffix|>protoc.main((
'',
'-I./protos',
'--python_out=python_grpc_mutual_tls_auth',
'--grpc_python_out=python_grpc_mutual_tls_auth',
'./pr... | code_fim | easy | {
"lang": "python",
"repo": "nikolskiy/python-grpc-mutual-tls-auth",
"path": "/codegen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>protoc.main((
'',
'-I./protos',
'--python_out=python_grpc_mutual_tls_auth',
'--grpc_python_out=python_grpc_mutual_tls_auth',
'./protos/mutual_tls_auth.proto',
))<|fim_prefix|># repo: nikolskiy/python-grpc-mutual-tls-auth path: /codegen.py
"""Runs protoc with the gRPC plugin to generat... | code_fim | easy | {
"lang": "python",
"repo": "nikolskiy/python-grpc-mutual-tls-auth",
"path": "/codegen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>REDIS_SERVER = redis_config["host"]
REDIS_PORT = redis_config["port"]
REDIS_DB = redis_config["database"]
REDIS_STREAM_KEY = redis_config["stream_name"]
with open("config/logger.yml", 'rt') as f:
LOGGER_CONFIG = yaml.safe_load(f.read())
filename = LOGGER_CONFIG["handlers"]["file_handler"]["filename"]... | code_fim | medium | {
"lang": "python",
"repo": "ayushkalani/bitcoin-streamer",
"path": "/config/initializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if not os.path.isfile(filename):
cmd = "touch " + filename
proc_handle = subprocess.Popen(cmd, bufsize=0, shell=True)
proc_handle.communicate()<|fim_prefix|># repo: ayushkalani/bitcoin-streamer path: /config/initializers.py
import yaml
import os
import subprocess
with open("config/kafka.yml"... | code_fim | medium | {
"lang": "python",
"repo": "ayushkalani/bitcoin-streamer",
"path": "/config/initializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ayushkalani/bitcoin-streamer path: /config/initializers.py
import yaml
import os
import subprocess
with open("config/kafka.yml", 'rt') as f:
kafka_config = yaml.safe_load(f.read())
KAFKA_BROKER = kafka_config["brokers"][0]
KAFKA_TOPIC = kafka_config["topic"]
KAFKA_CONSUMER_GROUP_ID = kafka_c... | code_fim | hard | {
"lang": "python",
"repo": "ayushkalani/bitcoin-streamer",
"path": "/config/initializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adrs0049/AdhesionRandomWalk path: /python/event_test.py
import simulator as s
import numpy as np
EventCalled = False
def f(*args, **kwargs):
<|fim_suffix|>if __name__ == '__main__':
times = s.DVector([0.1,0.2,0.3])
print('times=', times)
domain = s.DVector([-5.0, 5.0])
p = s.Par... | code_fim | hard | {
"lang": "python",
"repo": "adrs0049/AdhesionRandomWalk",
"path": "/python/event_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sim = s.Simulator(p)
sim.registerPyListener(f)
sim.run()<|fim_prefix|># repo: adrs0049/AdhesionRandomWalk path: /python/event_test.py
import simulator as s
import numpy as np
EventCalled = False
def f(*args, **kwargs):
print('HELLO CALLBACK')
#print(args[0])
data = kwargs
p... | code_fim | hard | {
"lang": "python",
"repo": "adrs0049/AdhesionRandomWalk",
"path": "/python/event_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class BoolDelegate(QtGui.QStyledItemDelegate):
"""Render boolean data in a model.
By default, True will be rendered as "true" and False as "false." This
forces the intended capitalization.
"""
def displayText(self, value, locale=None):
text = str(value.toPyObject())
r... | code_fim | hard | {
"lang": "python",
"repo": "bworrell/cutiestix",
"path": "/cutiestix/delegates.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bworrell/cutiestix path: /cutiestix/delegates.py
"""
This module contains Qt Delegates which define how to render or present
View data.
"""
# external
from PyQt4 import QtGui
# internal
from . import utils
<|fim_suffix|> return super(ResultsDelegate, self).displayText(result, locale)
... | code_fim | hard | {
"lang": "python",
"repo": "bworrell/cutiestix",
"path": "/cutiestix/delegates.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def http_exception_handler(request, exc):
return hidove_exception_handler(request, HidoveException(status_code=exc.status_code, message=exc.detail))
def hidove_exception_handler(request, exc: HidoveException):
return JSONResponse(
status_code=200,
content={'code': exc.status_cod... | code_fim | medium | {
"lang": "python",
"repo": "copyit/CloudflarePanelPython",
"path": "/App/exception.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: copyit/CloudflarePanelPython path: /App/exception.py
from starlette.responses import JSONResponse
class HidoveException(Exception):
def __init__(self, status_code: int, message, data=None):
if data is None:
data = []
self.status_code = int(status_code)
se... | code_fim | medium | {
"lang": "python",
"repo": "copyit/CloudflarePanelPython",
"path": "/App/exception.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agoose77/hivesystem path: /dragonfly/canvas/update4.py
import bee
from bee.segments import *
import libcontext
from libcontext.socketclasses import *
class update4(bee.worker):
identifier = variable("id")
parameter(identifier)
@modifier
def do_update2(self):
for updater... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/dragonfly/canvas/update4.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.updaters2 = []
self.updaters3 = []
libcontext.socket(("canvas", "update2"), socket_container(self.add_updater2))
libcontext.socket(("canvas", "update3"), socket_container(self.add_updater3))<|fim_prefix|># repo: agoose77/hivesystem path: /dragonfly/canvas/update4.py
i... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/dragonfly/canvas/update4.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def place(self):
self.updaters2 = []
self.updaters3 = []
libcontext.socket(("canvas", "update2"), socket_container(self.add_updater2))
libcontext.socket(("canvas", "update3"), socket_container(self.add_updater3))<|fim_prefix|># repo: agoose77/hivesystem path: /dragonfl... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/dragonfly/canvas/update4.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = [
"ITERATIONS 15\n"
"PRINT 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n"
"PUNCH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n"
"BEGIN ITERATION 15 COMPLETED\n"
"END\n"
]
return "".join(s)
def main():
pass
if __name__ ==... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/vidmapy",
"path": "/vidmapy/kurucz/model_definition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _ending(self):
s = [
"ITERATIONS 15\n"
"PRINT 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n"
"PUNCH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n"
"BEGIN ITERATION 15 COMPLETED\n"
"END\n"
]
return "".join(s)
def main():
... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/vidmapy",
"path": "/vidmapy/kurucz/model_definition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RozanskiT/vidmapy path: /vidmapy/kurucz/model_definition.py
#!/usr/bin/env python3
"""
Create input string for ATLAS code, which defines model parameters:
eg.
p = Parameters()
md = ModelDefinition()
atlas_input = md(p)
"""
class ModelDefinition:
def __init__(self):
pa... | code_fim | hard | {
"lang": "python",
"repo": "RozanskiT/vidmapy",
"path": "/vidmapy/kurucz/model_definition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hpppereira/imageproc-wavescatter path: /main_drifters.py
"""
Main program to processing difters data
Henrique Pereira
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from glob import glob
plt.close('all')
if __name__ == "__main__":
# pathname do arquivo qualifica... | code_fim | medium | {
"lang": "python",
"repo": "hpppereira/imageproc-wavescatter",
"path": "/main_drifters.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ax1.plot(df.x, df.y)
ax1.set_title(nome)
ax1.set_xlabel('Posição X [metros]')
ax1.set_ylabel('Posição Y [metros]')
ax1.grid()
# ax1.plot(df.x, df.y, '.', color='r')
ax1.invert_yaxis()
fig.savefig(pathname2 + '... | code_fim | medium | {
"lang": "python",
"repo": "hpppereira/imageproc-wavescatter",
"path": "/main_drifters.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('--no-upload', dest='upload', action='store_false')
parser.add_argument('--store-file', dest='store_file', action='store_true')
parser.add_argument('--since', metavar='s', type=int, nargs='?', default=None, help="Dump all data since time s")
parser.set_defaults(upload=True)
parse... | code_fim | hard | {
"lang": "python",
"repo": "k9ert/cheesepi",
"path": "/cheesepi/tasks/Upload.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: k9ert/cheesepi path: /cheesepi/tasks/Upload.py
import time
import os
import tarfile
import tempfile
import StringIO
import requests
import sys
import argparse
import cheesepi as cp
import Task
logger = cp.config.get_logger(__name__)
class Upload(Task.Task):
"""Task to upload data to central ... | code_fim | hard | {
"lang": "python",
"repo": "k9ert/cheesepi",
"path": "/cheesepi/tasks/Upload.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zh-h/macro-blog path: /transwarp/task.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao'
'''
Task queue module for distributed async task.
A task statuses:
pending -> executing -> done -+-> notify
| | |
+-------- retry ? -> error +
'''
_... | code_fim | hard | {
"lang": "python",
"repo": "zh-h/macro-blog",
"path": "/transwarp/task.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def set_task_timeout(task_id):
pass
def delete_task(task_id):
db.update('delete from tasks where id=?', task_id)
def notify_task(task):
pass
if __name__=='__main__':
sys.path.append('.')
dbpath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'doc_test.sql... | code_fim | hard | {
"lang": "python",
"repo": "zh-h/macro-blog",
"path": "/transwarp/task.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def ranking_linear(self):
self.FitV = np.argsort(np.argsort(-self.Y))
return self.FitV<|fim_prefix|># repo: yangyangyang3701/GA path: /evolution/ranking.py
import numpy as np
def ranking(self):
<|fim_middle|> # GA select the biggest one, but we want to minimize func, so we put a negative he... | code_fim | medium | {
"lang": "python",
"repo": "yangyangyang3701/GA",
"path": "/evolution/ranking.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yangyangyang3701/GA path: /evolution/ranking.py
import numpy as np
def ranking(self):
# GA select the biggest one, but we want to minimize func, so we put a negative here
self.FitV = -self.Y
<|fim_suffix|> self.FitV = np.argsort(np.argsort(-self.Y))
return self.FitV<|fim_middle... | code_fim | easy | {
"lang": "python",
"repo": "yangyangyang3701/GA",
"path": "/evolution/ranking.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.FitV = np.argsort(np.argsort(-self.Y))
return self.FitV<|fim_prefix|># repo: yangyangyang3701/GA path: /evolution/ranking.py
import numpy as np
def ranking(self):
# GA select the biggest one, but we want to minimize func, so we put a negative here
self.FitV = -self.Y
<|fim_middle|... | code_fim | easy | {
"lang": "python",
"repo": "yangyangyang3701/GA",
"path": "/evolution/ranking.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cnheider/draugr path: /draugr/torch_utilities/sessions/cache_sessions.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
Created on 20/03/2020
"""
import torch
from draugr.torch_utilities.sessions.device_sessions impo... | code_fim | hard | {
"lang": "python",
"repo": "cnheider/draugr",
"path": "/draugr/torch_utilities/sessions/cache_sessions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __enter__(self):
if self.using_cuda:
torch.cuda.empty_cache()
return True
def __exit__(self, exc_type, exc_val, exc_tb):
if self.using_cuda:
torch.cuda.empty_cache()
if __name__ == "__main__":
def a() -> None:
"""
:rtype: ... | code_fim | hard | {
"lang": "python",
"repo": "cnheider/draugr",
"path": "/draugr/torch_utilities/sessions/cache_sessions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> output = image.copy()
minLineLength = 100 #200
maxLineGap = 10 # 25
lines = cv2.HoughLinesP(gray_image, 1, np.pi/180, 100, minLineLength, maxLineGap)
if lines is not None:
for x1, y1, x2, y2 in lines[0]:
cv2.line(output, (x1, y1), (x2, y2... | code_fim | hard | {
"lang": "python",
"repo": "tf2keras/image-computer-processing",
"path": "/project-2-hough/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray_image = cv2.Canny(gray_image, 50, 150, apertureSize=3)
cv2.imshow(WINDOW_NAME, gray_image)
cv2.waitKey(0)
output = image.copy()
minLineLength = 100 #200
maxLineGap = 10 # 25
lines = c... | code_fim | hard | {
"lang": "python",
"repo": "tf2keras/image-computer-processing",
"path": "/project-2-hough/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tf2keras/image-computer-processing path: /project-2-hough/run.py
import os
import cv2
import numpy as np
PATH = "3dwall"
WINDOW_NAME = "Window"
if __name__ == "__main__":
cv2.namedWindow(WINDOW_NAME, cv2.WINDOW_NORMAL)
cv2.moveWindow(WINDOW_NAME, 100, 100)
<|fim_suffix|> cv2.ims... | code_fim | hard | {
"lang": "python",
"repo": "tf2keras/image-computer-processing",
"path": "/project-2-hough/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CorradoTorino/BrainTrain path: /MyHashTable/MyHashTableTests.py
import unittest
from MyHashTable import MyHashTable
class MyHashTableTests(unittest.TestCase):
def test_when_keyValue_is_added_then_containsKey_return_true(self):
sut = MyHashTable()
sut.Add("myKey","myvalue")
... | code_fim | medium | {
"lang": "python",
"repo": "CorradoTorino/BrainTrain",
"path": "/MyHashTable/MyHashTableTests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sut = MyHashTable()
sut.Add(None,"myvalue")
self.assertEqual(sut.Get(None), "myvalue")
def test_when_key_collision_occurs_then_get_return_expected_values(self):
sut = MyHashTable(1)
sut.Add("my1stKey","aValue")
sut.Add("my2ndKey","anotherValue")
... | code_fim | medium | {
"lang": "python",
"repo": "CorradoTorino/BrainTrain",
"path": "/MyHashTable/MyHashTableTests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nik849/ct-tools path: /cttools/filtering.py
import scipy.signal as sig
import numpy as np
def ramp_kernel_real(cutoff, length):
"""Ramp filter kernel in real space defined by the cut-off frequency and the spatial dimension
Parameters
----------
cutoff : float
... | code_fim | hard | {
"lang": "python",
"repo": "nik849/ct-tools",
"path": "/cttools/filtering.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
projection : np.ndarray
The projection used in the reconstruction
settings : obj
The settings object containing all necessary settings for the reconstruction
Returns
-------
ndarray
The proje... | code_fim | hard | {
"lang": "python",
"repo": "nik849/ct-tools",
"path": "/cttools/filtering.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
audio_encoder: Tensor,
label_encoder: Tensor,
) -> Tensor:
if audio_encoder.dim() == 3 and label_encoder.dim() == 3: # Train
seq_lens = audio_encoder.size(1)
target_lens = label_encoder.size(1)
audio_encoder = audi... | code_fim | hard | {
"lang": "python",
"repo": "jinggaizi/Transformer-Transducer",
"path": "/transformer_transducer/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jinggaizi/Transformer-Transducer path: /transformer_transducer/model.py
# Copyright (c) 2021, Sangchun Ha. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lic... | code_fim | hard | {
"lang": "python",
"repo": "jinggaizi/Transformer-Transducer",
"path": "/transformer_transducer/model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Py-Contributors/AlgorithmsAndDataStructure path: /Python/Algorithms/Sieve Algorithms/Sieve of Eratosthenes.py
"""
Sieve of Eratosthenes :
Generate all the primes less than any integer nn
"""
from math import sqrt
<|fim_suffix|> m = n + 1
# numbers = [True for i in range(m)]
n... | code_fim | easy | {
"lang": "python",
"repo": "Py-Contributors/AlgorithmsAndDataStructure",
"path": "/Python/Algorithms/Sieve Algorithms/Sieve of Eratosthenes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> m = n + 1
# numbers = [True for i in range(m)]
numbers = [True] * m
for i in range(2, int(sqrt(n) + 1)):
if numbers[i]:
for j in range(i * i, m, i):
numbers[j] = False
primes = []
for i in range(2, m):
if numbers[i]:
primes.ap... | code_fim | easy | {
"lang": "python",
"repo": "Py-Contributors/AlgorithmsAndDataStructure",
"path": "/Python/Algorithms/Sieve Algorithms/Sieve of Eratosthenes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def setup(hass, config):
""" Track states and offer events for media_players. """
component = DeviceComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL,
DISCOVERY_PLATFORMS)
component.setup(config)
def media_player_service_handler(service):
""" Map... | code_fim | hard | {
"lang": "python",
"repo": "trainman419/home-assistant",
"path": "/homeassistant/components/media_player/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trainman419/home-assistant path: /homeassistant/components/media_player/__init__.py
"""
homeassistant.components.media_player
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with various media players
"""
import logging
from homeassistant.components import discovery
from homeassist... | code_fim | hard | {
"lang": "python",
"repo": "trainman419/home-assistant",
"path": "/homeassistant/components/media_player/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Note: if the string states a range, we just take the first type
Paramters
---------
spec : str
First char must be a letter from {O, B, A, F, G, A, K}
Next char(s) must be a numeric. Remaining chars are ignored
(T type stars are of order 0.01 solar masses and can ty... | code_fim | hard | {
"lang": "python",
"repo": "tcrundall/chronostar",
"path": "/scripts/retired/banyan_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Incorporate overlooked rvs compiled from the literature")
insertLitRVs(gt, banyan_data)
print("Adopt approximate masses from spectral types")
masses = np.array(
[getMassFromSpectralType(stype) for stype in gt['Spectral type']]
)
gt['approx_mass'] = masses
# exp... | code_fim | hard | {
"lang": "python",
"repo": "tcrundall/chronostar",
"path": "/scripts/retired/banyan_parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tcrundall/chronostar path: /scripts/retired/banyan_parser.py
from __future__ import division, print_function
"""
TODO: Come up with a neater way to handle missing data. Maybe fits
will permit blanks to be included, should explore this
"""
import numpy as np
import re
from astropy.table import T... | code_fim | hard | {
"lang": "python",
"repo": "tcrundall/chronostar",
"path": "/scripts/retired/banyan_parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datalad/datalad-crawler path: /datalad_crawler/tests/test_utils.py
from ..utils import (
flatten,
get_func_kwargs_doc,
)
from datalad.tests.utils_pytest import assert_equal
def test_flatten():
assert_equal(flatten([]), [])
assert_equal(flatten([1]), [1])
assert_equal(flatte... | code_fim | hard | {
"lang": "python",
"repo": "datalad/datalad-crawler",
"path": "/datalad_crawler/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def some_func(arg1, kwarg1=None, kwarg2="bu"):
return
assert_equal(get_func_kwargs_doc(some_func), ['arg1', 'kwarg1', 'kwarg2'])<|fim_prefix|># repo: datalad/datalad-crawler path: /datalad_crawler/tests/test_utils.py
from ..utils import (
flatten,
get_func_kwargs_doc,
)
from data... | code_fim | hard | {
"lang": "python",
"repo": "datalad/datalad-crawler",
"path": "/datalad_crawler/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # And now try "fancy" (original implementation target was list) types
assert_equal(flatten(((0,), (1, 2))), (0, 1, 2))
assert_equal(flatten(({0}, (1, 2)), types=(set, tuple)), (0, 1, 2))
assert_equal(flatten([(0,), {1: 2}], types=(list, tuple, dict), base_type=tuple),
(0, ... | code_fim | hard | {
"lang": "python",
"repo": "datalad/datalad-crawler",
"path": "/datalad_crawler/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrisc36/autobias path: /autobias/datasets/mnist.py
from collections import defaultdict
import matplotlib.pylab as plt
import numpy as np
from PIL import Image
from torchvision import datasets
from autobias import config
from autobias.datasets.dataset import Dataset
from autobias.datasets.image... | code_fim | hard | {
"lang": "python",
"repo": "chrisc36/autobias",
"path": "/autobias/datasets/mnist.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for y in range(28):
for x in range(28):
if gray_pixdata[x, y] < 100:
color_pixdata[x, y] = target_color
ex.image = colored
class MNISTPatches(AbstractMNISTWithBias):
def __init__(self, p, is_train, per_class_slice):
super().__init__(p, "patches", is_train, p... | code_fim | hard | {
"lang": "python",
"repo": "chrisc36/autobias",
"path": "/autobias/datasets/mnist.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def zip_info(zip):
for info in zip.infolist():
print info.filename
print '\tComment:\t', info.comment
print '\tModified:\t', datetime(*info.date_time)
print '\tSystem:\t\t', info.create_system, '(0 = Windows, 3 = Unix)'
print '\tZIP version:\t', info.create_ver... | code_fim | hard | {
"lang": "python",
"repo": "scw/geopublisher",
"path": "/geopublisher/geopublisher.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
archive_folder: Folder to store zip file
output_file: Feature class to be archived
Creates a zip file containing a shapefile representation of the
output_file.
If the output_file is not a shapefile, it creates a temporary shapefile to
add to the archive.
"""
output... | code_fim | hard | {
"lang": "python",
"repo": "scw/geopublisher",
"path": "/geopublisher/geopublisher.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scw/geopublisher path: /geopublisher/geopublisher.py
# -*- coding: utf-8 -*-
import os
import glob
import arcpy
from datetime import date, datetime
import zipfile
def publish_data(input_fc, output_location, output_fc, archive_folder=None):
"""
input_fc: Feature class to be exported
... | code_fim | hard | {
"lang": "python",
"repo": "scw/geopublisher",
"path": "/geopublisher/geopublisher.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Michael-F-Bryan/cheesecake_kwalitee_index path: /cheesecake_kwalitee_index/kwalitee/__init__.py
"""
Seeing as the `cheescake` package I was originally pl<|fim_suffix|>evelop my own version of module
to "Give a score to your Python package based on empirical 'kwalitee' factors".
"""<|fim_middle|>a... | code_fim | easy | {
"lang": "python",
"repo": "Michael-F-Bryan/cheesecake_kwalitee_index",
"path": "/cheesecake_kwalitee_index/kwalitee/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Python package based on empirical 'kwalitee' factors".
"""<|fim_prefix|># repo: Michael-F-Bryan/cheesecake_kwalitee_index path: /cheesecake_kwalitee_index/kwalitee/__init__.py
"""
Seeing as the `cheescake` package I was originally pl<|fim_middle|>anning to use was
designed for Python 2.x, I'm going to d... | code_fim | medium | {
"lang": "python",
"repo": "Michael-F-Bryan/cheesecake_kwalitee_index",
"path": "/cheesecake_kwalitee_index/kwalitee/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(fake.name())
print(fake.address())
print(fake.text())
fake = Faker('es_ES')
for _ in range(10):
print(fake.name())<|fim_prefix|># repo: carthage-college/django-djpersonnel path: /djpersonnel/bin/maquette.py
import django
django.setup()
from django.conf import settings
from django.core import ... | code_fim | medium | {
"lang": "python",
"repo": "carthage-college/django-djpersonnel",
"path": "/djpersonnel/bin/maquette.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carthage-college/django-djpersonnel path: /djpersonnel/bin/maquette.py
import django
django.setup()
from django.conf import settings
from django.core import serializers
from djpersonnel.transaction.models import Operation
import json
json_data = open(
'{}/fixtures/transaction_operation.j... | code_fim | medium | {
"lang": "python",
"repo": "carthage-college/django-djpersonnel",
"path": "/djpersonnel/bin/maquette.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Faker")
from faker import Faker
fake = Faker()
print(fake.name())
print(fake.address())
print(fake.text())
fake = Faker('es_ES')
for _ in range(10):
print(fake.name())<|fim_prefix|># repo: carthage-college/django-djpersonnel path: /djpersonnel/bin/maquette.py
import django
django.setup()
... | code_fim | hard | {
"lang": "python",
"repo": "carthage-college/django-djpersonnel",
"path": "/djpersonnel/bin/maquette.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in ibpsa_file:
if line.find("Conversion script for IBPSA library") > -1:
aixlib_file.write(line)
elif line.find("IBPSA") > - 1:
aixlib_file.write(line.replace("IBPSA", "AixLib"))
else:
aixlib_file.write(line)
ibpsa_file.close()
aixlib_file.close()
return file_new_conv, old_to_n... | code_fim | hard | {
"lang": "python",
"repo": "modelica-3rdparty/AixLib",
"path": "/bin/CITests/06_deploy/IBPSA_Merge/copy_conversion_script.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modelica-3rdparty/AixLib path: /bin/CITests/06_deploy/IBPSA_Merge/copy_conversion_script.py
import os
import sys
import shutil
import glob
import argparse
from natsort import natsorted
def copy_mos(ibpsa_dir, dst):
''' Copy the ConvertIBPSA mos Script '''
if os.path.isdir(dst):
pass
else:
... | code_fim | hard | {
"lang": "python",
"repo": "modelica-3rdparty/AixLib",
"path": "/bin/CITests/06_deploy/IBPSA_Merge/copy_conversion_script.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = True
with open(l_ibpsa_conv) as file_1:
file_1_text = file_1.readlines()
with open(l_aixlib_conv) as file_2:
file_2_text = file_2.readlines()
for line1, line2 in zip(file_1_text, file_2_text):
if line1 == line2.replace("AixLib", "IBPSA"):
continue
else:
#print(f'Different Conten... | code_fim | hard | {
"lang": "python",
"repo": "modelica-3rdparty/AixLib",
"path": "/bin/CITests/06_deploy/IBPSA_Merge/copy_conversion_script.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RuneHistory/pyrunehistory path: /tests/test_client.py
import json
from unittest.mock import patch
from pyrunehistory.auth import JwtAuth
from pyrunehistory.client import Client
from pyrunehistory.accounts import Accounts
from tests import IsInstance
<|fim_suffix|> assert client.hostname ==... | code_fim | medium | {
"lang": "python",
"repo": "RuneHistory/pyrunehistory",
"path": "/tests/test_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> method = 'GET'
url = 'some_url'
params = {'test_param': 123}
data = {'test_data': 456}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
merged_url = '{}/{}'.format(client.hostname, url)
with patch('requests.request') as request_... | code_fim | medium | {
"lang": "python",
"repo": "RuneHistory/pyrunehistory",
"path": "/tests/test_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rpt_file = os.path.join(self.stagedir, self.rpt)
reference_files = {
'7.7': {
'control': 'ref/mpit_control_vars_7.7.ref',
'categories': 'ref/mpit_categories_7.7.ref',
},
'8.1.4': {
'control': 'ref/mpit_cont... | code_fim | hard | {
"lang": "python",
"repo": "jgphpc/reframe",
"path": "/cscs-checks/prgenv/mpi_t.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jgphpc/reframe path: /cscs-checks/prgenv/mpi_t.py
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import os
import reframe as rfm
import reframe.utilit... | code_fim | hard | {
"lang": "python",
"repo": "jgphpc/reframe",
"path": "/cscs-checks/prgenv/mpi_t.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> mpich_version = mpich_version_major + mpich_version_minor
ref_ctrl_file = os.path.join(
self.stagedir,
reference_files[sn.evaluate(mpich_version)]['control'])
ref_catg_file = os.path.join(
self.stagedir,
reference_files[sn.evaluate(mp... | code_fim | hard | {
"lang": "python",
"repo": "jgphpc/reframe",
"path": "/cscs-checks/prgenv/mpi_t.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shaung/xlpy path: /xlpy/xlutils/cne.py
# -*- coding: utf-8 -*-
from xlpy.xlrd import open_workbook
from xlpy.xlwt import *
from copy import copy as copy_book
from utils import get_xlwt_style_list
import weakref
def create_copy(fpath):
wt = open_workbook(fpath, formatting_info=True)
w =... | code_fim | hard | {
"lang": "python",
"repo": "shaung/xlpy",
"path": "/xlpy/xlutils/cne.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.