text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: mostaphaRoudsari/queenbee path: /queenbee/cli/repository/__init__.py
from .index import index
from .serve import serve
from .init import init
from .manage import add, list_repos, remove
from .search import search, get_by_tag
try:
import click
except ImportError:
raise ImportError(
... | code_fim | hard | {
"lang": "python",
"repo": "mostaphaRoudsari/queenbee",
"path": "/queenbee/cli/repository/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dHonerkamp/ActiveClassifier path: /activeClassifier/modules/VAE/VAE_OLD.py
import tensorflow as tf
from tools.tf_tools import output_into_gaussian_params, create_MLP
class GlimpseEncoder:
def __init__(self, FLAGS, glimpse_size):
fc_specs_encode = ([FLAGS.num_hidden_fc, tf.nn.relu],
... | code_fim | hard | {
"lang": "python",
"repo": "dHonerkamp/ActiveClassifier",
"path": "/activeClassifier/modules/VAE/VAE_OLD.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.variable_scope(self.name, reuse=tf.AUTO_REUSE):
self._init_fc(FLAGS)
def _init_fc(self, FLAGS):
if FLAGS.gl_std == -1:
final_sz = 2 * self.size_glimpse_out
else:
final_sz = self.size_glimpse_out
self.layers = []
self... | code_fim | hard | {
"lang": "python",
"repo": "dHonerkamp/ActiveClassifier",
"path": "/activeClassifier/modules/VAE/VAE_OLD.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HongSungRae/Pytorch_tutorial path: /2.finetuning/evaluation.py
from numpy import datetime_data
import torch
from torch.utils.data import Dataset
from torchvision import datasets
from torchvision.transforms import ToTensor
from matplotlib import pyplot as plt
import os
from torchvision import tran... | code_fim | hard | {
"lang": "python",
"repo": "HongSungRae/Pytorch_tutorial",
"path": "/2.finetuning/evaluation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 시각화
label_dic = {
0 : 'airplane',
1 : 'automobile',
2 : 'bird',
3 : 'cat',
4 : 'deer',
5 : 'dog',
6 : 'frog',
7 : 'horse',
8 : 'ship',
9... | code_fim | hard | {
"lang": "python",
"repo": "HongSungRae/Pytorch_tutorial",
"path": "/2.finetuning/evaluation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
# 테스트 데이터셋
my_transform = torchvision.transforms.Compose([
transforms.Resize((256, 256)),
transforms.RandomCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
])
test_dataset = torchvision.datasets.CIFAR10(
... | code_fim | hard | {
"lang": "python",
"repo": "HongSungRae/Pytorch_tutorial",
"path": "/2.finetuning/evaluation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NB-Dragon/HWSR path: /SplitImage.py
import cv2
import numpy as np
class RectChar(object):
def __init__(self, no_line=False, cut=True, join=True, print=False, threshold_binary=120, threshold_ratio=0.3):
self.charList = []
self.no_line = no_line #Turn to True if you want to d... | code_fim | hard | {
"lang": "python",
"repo": "NB-Dragon/HWSR",
"path": "/SplitImage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> top = min(rect[1], rect_temp[1])
bottom = max(rect[3], rect_temp[3])
left = min(rect[0], rect_temp[0])
right = max(rect[2], rect_temp[2])
l_x = abs(right-left)
l_y = abs(bottom-top)
... | code_fim | hard | {
"lang": "python",
"repo": "NB-Dragon/HWSR",
"path": "/SplitImage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SNAP-SAPIENT/Collector-Reflector path: /src/controllers/StepTest1.py
#!/usr/bin/python
#import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_Stepper
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor
import picamera
import time
import atexit
import os
impor... | code_fim | hard | {
"lang": "python",
"repo": "SNAP-SAPIENT/Collector-Reflector",
"path": "/src/controllers/StepTest1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def makeFolder():
folder = read_in().rstrip()
folder = os.getcwd() + '/captures/' + folder + '/'
if not os.path.exists(folder):
os.makedirs(folder)
return folder
def pics(folder):
picCount = 1
while picCount <= 4:
myStepper.... | code_fim | hard | {
"lang": "python",
"repo": "SNAP-SAPIENT/Collector-Reflector",
"path": "/src/controllers/StepTest1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Take Pictures
picCount = 1
while picCount <= 4:
#rotate platform by 45 degrees and take a picture (repeat 3 more times)
myStepper.step(512, Adafruit_MotorHAT.FORWARD, Adafruit_MotorHAT.DOUBLE)
#take pic
camer... | code_fim | hard | {
"lang": "python",
"repo": "SNAP-SAPIENT/Collector-Reflector",
"path": "/src/controllers/StepTest1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: limbo018/DREAMPlace path: /dreamplace/EvalMetrics.py
##
# @file EvalMetrics.py
# @author Yibo Lin
# @date Sep 2018
# @brief Evaluation metrics
#
import time
import torch
import pdb
class EvalMetrics (object):
"""
@brief evaluation metrics at one step
"""
def __init__(self, ... | code_fim | hard | {
"lang": "python",
"repo": "limbo018/DREAMPlace",
"path": "/dreamplace/EvalMetrics.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return content
def __repr__(self):
"""
@brief print
"""
return self.__str__()
def evaluate(self, placedb, ops, var, data_collections=None):
"""
@brief evaluate metrics
@param placedb placement database
@param ops a list of o... | code_fim | hard | {
"lang": "python",
"repo": "limbo018/DREAMPlace",
"path": "/dreamplace/EvalMetrics.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(day7.determine_current('x', wires), 123)
self.assertEqual(day7.determine_current('y', wires), 456)
self.assertEqual(day7.determine_current('d', wires), 72)
self.assertEqual(day7.determine_current('e', wires), 507)
self.assertEqual(day7.determine_cur... | code_fim | hard | {
"lang": "python",
"repo": "fgahr/aoc2015",
"path": "/day7/test_day7.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fgahr/aoc2015 path: /day7/test_day7.py
#!/usr/bin/env python
import unittest
import day7
class TestDaySeven(unittest.TestCase):
def test_p1_example(self):
<|fim_suffix|> self.assertEqual(day7.determine_current('x', wires), 123)
self.assertEqual(day7.determine_current('y', wir... | code_fim | hard | {
"lang": "python",
"repo": "fgahr/aoc2015",
"path": "/day7/test_day7.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def place_triangle(xyzfi: StructXYZ, delta: float = 4.0, outname: str = "WATER_PROBE.xyz", center: int = 0,
flank1: int = 1, flank2: int = 2):
if center >= xyzfi.n_atoms or center < 0:
raise ValueError(f"Central atom index {center} out-of-bounds 0-{xyzfi.n_atoms}")
if ... | code_fim | hard | {
"lang": "python",
"repo": "jacob-litman/fittingScripts",
"path": "/EspFitting/ProbePlacers/Water.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jacob-litman/fittingScripts path: /EspFitting/ProbePlacers/Water.py
import sys
import numpy as np
import math
from JMLUtils import dist2, eprint
from StructureXYZ import StructXYZ
from typing import Sequence
TRIANGLE_TOL = 1E-4
Y_DENOM = 1.0 / math.sqrt(3)
<|fim_suffix|>def place_triangle(xyz... | code_fim | hard | {
"lang": "python",
"repo": "jacob-litman/fittingScripts",
"path": "/EspFitting/ProbePlacers/Water.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def place_triangle(xyzfi: StructXYZ, delta: float = 4.0, outname: str = "WATER_PROBE.xyz", center: int = 0,
flank1: int = 1, flank2: int = 2):
if center >= xyzfi.n_atoms or center < 0:
raise ValueError(f"Central atom index {center} out-of-bounds 0-{xyzfi.n_atoms}")
if f... | code_fim | hard | {
"lang": "python",
"repo": "jacob-litman/fittingScripts",
"path": "/EspFitting/ProbePlacers/Water.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conceptslearningmachine-FEIN-85-1759293/affiliates path: /affiliates/links/models.py
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils import timezon... | code_fim | hard | {
"lang": "python",
"repo": "conceptslearningmachine-FEIN-85-1759293/affiliates",
"path": "/affiliates/links/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def preview_html(self, href):
return self.banner.preview_html(href)
def get_referral_url(self):
return absolutify(reverse('links.referral', args=[self.pk]))
def get_absolute_url(self):
return reverse('links.detail', args=[self.pk])
class DataPoint(CachingMixin, mode... | code_fim | hard | {
"lang": "python",
"repo": "conceptslearningmachine-FEIN-85-1759293/affiliates",
"path": "/affiliates/links/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.banner.preview_html(href)
def get_referral_url(self):
return absolutify(reverse('links.referral', args=[self.pk]))
def get_absolute_url(self):
return reverse('links.detail', args=[self.pk])
class DataPoint(CachingMixin, models.Model):
"""Stores the metri... | code_fim | hard | {
"lang": "python",
"repo": "conceptslearningmachine-FEIN-85-1759293/affiliates",
"path": "/affiliates/links/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if is_valid_ngram(ngram):
yield ''.join(ngram)
def store_counts(storage, counter):
"""Store n-gram count in shelve."""
for ngram, count in counter.items():
try:
stored_count = storage[ngram]
except KeyError:
stored_count... | code_fim | hard | {
"lang": "python",
"repo": "olemb/ngram-test",
"path": "/count_ngrams.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> storage = shelve.open('ngram_count.shelve', flag='c', writeback=True)
try:
process_file('human_rights.text', storage=storage,
ngram_length=3, max_mem_ngrams=100)
finally:
storage.close()
return 0
if __name__ == '__main__':
sys.exit(main())<|fi... | code_fim | hard | {
"lang": "python",
"repo": "olemb/ngram-test",
"path": "/count_ngrams.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olemb/ngram-test path: /count_ngrams.py
#!/usr/bin/env python
"""
https://www.un.org/en/documents/udhr/
"""
import sys
import shelve
import string
from collections import Counter, deque
LETTERS = set(string.lowercase) | set("'-")
def is_valid_ngram(ngram):
"""Return True if the n-gram consi... | code_fim | hard | {
"lang": "python",
"repo": "olemb/ngram-test",
"path": "/count_ngrams.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name="wydawnictwo_ciagle_zewnetrzna_baza_danych",
options={
"verbose_name": "powiązanie wyd. ciągłego z zewn. bazą danych",
"verbose_name_plural": "powiązania wyd. ciągłych z zewn. bazami danyc... | code_fim | hard | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0313_meta_zewn_baza.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
("bpp", "0312_przypieta"),
]
operations = [
migrations.AlterModelOptions(
name="wydawnictwo_ciagle_zewnetrzna_baza_danych",
options={
"verbose_name": "powiązanie wyd. ciągłego z zewn. bazą danych",
"verbo... | code_fim | hard | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0313_meta_zewn_baza.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iplweb/bpp path: /src/bpp/migrations/0313_meta_zewn_baza.py
# Generated by Django 3.0.14 on 2022-02-27 20:42
from django.db import migrations
<|fim_suffix|> dependencies = [
("bpp", "0312_przypieta"),
]
operations = [
migrations.AlterModelOptions(
name="... | code_fim | hard | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0313_meta_zewn_baza.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while n:
n -= 1
if abs(nums[l]) > abs(nums[r]):
ans[n] = nums[l] * nums[l]
l += 1
else:
ans[n] = nums[r] * nums[r]
r -= 1
return ans<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/0977. Squares of a Sorted Array/0977.py
class Solution:
... | code_fim | medium | {
"lang": "python",
"repo": "walkccc/LeetCode",
"path": "/solutions/0977. Squares of a Sorted Array/0977.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/0977. Squares of a Sorted Array/0977.py
class Solution:
def sortedSquares(self, nums: List[int]) -> List[int]:
<|fim_suffix|> while n:
n -= 1
if abs(nums[l]) > abs(nums[r]):
ans[n] = nums[l] * nums[l]
l += 1
else:
an... | code_fim | medium | {
"lang": "python",
"repo": "walkccc/LeetCode",
"path": "/solutions/0977. Squares of a Sorted Array/0977.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print("Erreur WongLiuFLoorplanning")
deltaCost = self.AreaComputation(postfixExpression) - self.AreaComputation(previousExpression)
if (deltaCost <= 0 or random.randint(0,1) < math.e - deltaCost/temperature):
previousExpression = postfixExpression
if self... | code_fim | hard | {
"lang": "python",
"repo": "NightFury13/floorplanning",
"path": "/SlicingTree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
else:
print("Erreur WongLiuFLoorplanning")
deltaCost = self.AreaComputation(postfixExpression) - self.AreaComputation(previousExpression)
if (deltaCost <= 0 or random.randint(0,1) < math.e - deltaCost/temperature):
previousExpression = postfixExpression
... | code_fim | hard | {
"lang": "python",
"repo": "NightFury13/floorplanning",
"path": "/SlicingTree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NightFury13/floorplanning path: /SlicingTree.py
# encoding: utf-8
from Rectangle import Rectangle
from ArrayStack import ArrayStack
from collections import OrderedDict
import random
import math
operator = ["-", "|"]
class SlicingTree:
def __init__(self):
self._root = None
self._recta... | code_fim | hard | {
"lang": "python",
"repo": "NightFury13/floorplanning",
"path": "/SlicingTree.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ctokheim/deepDegron path: /deepDegron/degron_pred.py
import numpy as np
import scipy.stats as stats
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
import pickle
import deepDegron.utils as utils
# load keras
impo... | code_fim | hard | {
"lang": "python",
"repo": "ctokheim/deepDegron",
"path": "/deepDegron/degron_pred.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def delta_prob_wildtype(tx, clf1, clf2, model='cterm', seq=None):
"""Calculate the difference between a position specific
model and a "bag of words" model"""
if seq is None:
# fetch c-terminal sequence
wt_seq = utils.fetch_seq(tx.protein_sequence, model=model)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "ctokheim/deepDegron",
"path": "/deepDegron/degron_pred.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def delta_prob_raw(variants, tx, clf1, clf2, model='cterm', is_sum=True):
"""Calculate the difference between a position specific
model and a "bag of words" model"""
# fetch c-terminal sequence
term_seq = [] ; vars_considered = []
for v in variants:
if v.mutant_protein_sequence... | code_fim | hard | {
"lang": "python",
"repo": "ctokheim/deepDegron",
"path": "/deepDegron/degron_pred.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BradleyShaw/Eleos path: /utils/threads.py
from threading import Thread
import sys
<|fim_suffix|>def run(func, bot, *args, **kwargs):
args = (func, bot) + args
t = Thread(target=log_errors, args=args, kwargs=kwargs)
t.daemon = True
t.start()
return t<|fim_middle|>
def log_erro... | code_fim | medium | {
"lang": "python",
"repo": "BradleyShaw/Eleos",
"path": "/utils/threads.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BradleyShaw/Eleos path: /utils/threads.py
from threading import Thread
import sys
def log_errors(func, bot, *args, **kwargs):
try:
func(bot, *args, **kwargs)
except Exception:
bot.log.debug('Error:', exc_info=sys.exc_info())
<|fim_suffix|> args = (func, bot) + args
... | code_fim | easy | {
"lang": "python",
"repo": "BradleyShaw/Eleos",
"path": "/utils/threads.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run(func, bot, *args, **kwargs):
args = (func, bot) + args
t = Thread(target=log_errors, args=args, kwargs=kwargs)
t.daemon = True
t.start()
return t<|fim_prefix|># repo: BradleyShaw/Eleos path: /utils/threads.py
from threading import Thread
import sys
def log_errors(func, bot, ... | code_fim | medium | {
"lang": "python",
"repo": "BradleyShaw/Eleos",
"path": "/utils/threads.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def problem10(n):
i = 0
knownprimes = []
j = 2
acc = 0
while j < n:
if prime(j,knownprimes):
knownprimes.append(j)
acc = acc + j
j = j + 1
return acc<|fim_prefix|># repo: wy/ProjectEuler path: /solutions/problem10.py
# coding: ... | code_fim | medium | {
"lang": "python",
"repo": "wy/ProjectEuler",
"path": "/solutions/problem10.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wy/ProjectEuler path: /solutions/problem10.py
# coding: utf8
# Author: Wing Yung Chan (~wy)
# Date: 2017
<|fim_suffix|> for i in knownprimes:
if n % i == 0:
return False
else:
return True
def problem10(n):
i = 0
knownprimes = []
j = 2
acc = 0
... | code_fim | easy | {
"lang": "python",
"repo": "wy/ProjectEuler",
"path": "/solutions/problem10.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ycheng-aa/gated_launch_backend path: /apps/issue/serializers.py
# -*- coding: utf-8 -*-
import json
from django.db import transaction
import requests
from rest_framework import serializers, status
from apps.auth.models import User
from apps.common.fields import CreatableSlugField
from apps.common... | code_fim | hard | {
"lang": "python",
"repo": "ycheng-aa/gated_launch_backend",
"path": "/apps/issue/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate(self, data):
super().validate(data)
task = data.get('task')
if not task and self.instance:
task = self.instance.task
self._validate_extended_fields(task, data.get('extFields'))
return data
def _create_or_update_extended_fields(self,... | code_fim | hard | {
"lang": "python",
"repo": "ycheng-aa/gated_launch_backend",
"path": "/apps/issue/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> abc_counter = {abc: {"umis": list(), "reads": list()} for abc in abc_names.values()}
# Output file writing and
output_umis = list()
output_reads = list()
for bc in iter(result_dict):
output_umis_line = {'BC': bc}
output_reads_line = output_umis_line.copy()
for... | code_fim | hard | {
"lang": "python",
"repo": "AfshinLab/DBS-Pro",
"path": "/src/dbspro/cli/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AfshinLab/DBS-Pro path: /src/dbspro/cli/analyze.py
"""
Analyzes demultiplexed and error corrected data and output data files umi_count.tsv and read_count.tsv with
ABC umi and read counts for each DBS. Also output some statistics.
"""
import logging
import pandas as pd
import dnaio
from collectio... | code_fim | hard | {
"lang": "python",
"repo": "AfshinLab/DBS-Pro",
"path": "/src/dbspro/cli/analyze.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.info(f"Finished")
def make_df_from_dict(result_dict, abc_names, sum_filter=0):
abc_counter = {abc: {"umis": list(), "reads": list()} for abc in abc_names.values()}
# Output file writing and
output_umis = list()
output_reads = list()
for bc in iter(result_dict):
ou... | code_fim | hard | {
"lang": "python",
"repo": "AfshinLab/DBS-Pro",
"path": "/src/dbspro/cli/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shadofer/Pincer path: /pincer/objects/events/gateway_commands.py
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from dataclasses import dataclass
from enum import auto, Enum
from typing import List, Optional, Tuple, Union
from .presence import ... | code_fim | hard | {
"lang": "python",
"repo": "Shadofer/Pincer",
"path": "/pincer/objects/events/gateway_commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param channel_id:
id of the voice channel client
wants to join (null if disconnecting)
:param self_mute:
is the client muted
:param self_deaf:
is the client deafened
"""
guild_id: Snowflake
self_mute: bool
self_deaf: bool
channel_id: Opti... | code_fim | hard | {
"lang": "python",
"repo": "Shadofer/Pincer",
"path": "/pincer/objects/events/gateway_commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mital188/TwoRavens path: /tworaven_apps/ta2_interfaces/req_execute_pipeline.py
import json
from collections import OrderedDict
from django.conf import settings
from google.protobuf.json_format import MessageToJson,\
Parse, ParseError
import core_pb2
from tworaven_apps.ta2_interfaces.ta2_conn... | code_fim | hard | {
"lang": "python",
"repo": "Mital188/TwoRavens",
"path": "/tworaven_apps/ta2_interfaces/req_execute_pipeline.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # These next lines embed file uri content into the JSON
embed_util = FileEmbedUtil(template_str)
if embed_util.has_error:
return get_failed_precondition_response(embed_util.error_message)
test_note = ('Test. An actual result would be the test JSON with'
... | code_fim | hard | {
"lang": "python",
"repo": "Mital188/TwoRavens",
"path": "/tworaven_apps/ta2_interfaces/req_execute_pipeline.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lindseyeggleston/advent_of_code path: /2019/python/day1/test_day1.py
import unittest
from day1 eimport calculate_fuel_required
class TestAdventDayOne(unittest.TestCase):
def test_day_one(self):
<|fim_suffix|> received = calculate_fuel_required(14)
expected = 2
self.as... | code_fim | medium | {
"lang": "python",
"repo": "lindseyeggleston/advent_of_code",
"path": "/2019/python/day1/test_day1.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> received = calculate_fuel_required(1969)
expected = 654
self.assertTrue(received, expected)
received = calculate_fuel_required(100756)
expected = 33583
self.assertTrue(received, expected)<|fim_prefix|># repo: lindseyeggleston/advent_of_code path: /2019/pyt... | code_fim | hard | {
"lang": "python",
"repo": "lindseyeggleston/advent_of_code",
"path": "/2019/python/day1/test_day1.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
favorite_book('Alchemist')<|fim_prefix|># repo: akshaymoharir/PythonCrashCourse path: /chapter_8/ex_8-2.py
## Python Crash Course
# Exercise 8.2: Favorite Book:
# Write a function called favorite_book() that accepts one parameter, title.
# ... | code_fim | medium | {
"lang": "python",
"repo": "akshaymoharir/PythonCrashCourse",
"path": "/chapter_8/ex_8-2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akshaymoharir/PythonCrashCourse path: /chapter_8/ex_8-2.py
## Python Crash Course
# Exercise 8.2: Favorite Book:
# Write a function called favorite_book() that accepts one parameter, title.
# The function should print a message, such as One of my favorite books is... | code_fim | medium | {
"lang": "python",
"repo": "akshaymoharir/PythonCrashCourse",
"path": "/chapter_8/ex_8-2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("\n")
print("One of my favorite book is:", title)
print("\n")
if __name__ == '__main__':
favorite_book('Alchemist')<|fim_prefix|># repo: akshaymoharir/PythonCrashCourse path: /chapter_8/ex_8-2.py
## Python Crash Course
# Exercise 8.2: Favorite Book:
# Write ... | code_fim | medium | {
"lang": "python",
"repo": "akshaymoharir/PythonCrashCourse",
"path": "/chapter_8/ex_8-2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: The display_name of this Term.
:rtype: str
"""
return self._display_name
@display_name.setter
def display_name(self, display_name):
"""
Sets the display_name of this Term.
A user-friendly display name. Does not have to be unique, an... | code_fim | hard | {
"lang": "python",
"repo": "revnav/sandbox",
"path": "/darling_ansible/python_venv/lib/python3.7/site-packages/oci/data_catalog/models/term.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: revnav/sandbox path: /darling_ansible/python_venv/lib/python3.7/site-packages/oci/data_catalog/models/term.py
, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401
from oci.decorators import init_model_state_from_kwargs
@init_model_state_from_kwargs
class Term(object):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "revnav/sandbox",
"path": "/darling_ansible/python_venv/lib/python3.7/site-packages/oci/data_catalog/models/term.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: light-weaver/desdeo-emo path: /desdeo_emo/EAs/TournamentEA.py
from desdeo_emo.population.Population import Population
from desdeo_emo.EAs.BaseEA import BaseEA, eaError
from desdeo_emo.selection.TournamentSelection import TournamentSelection
import numpy as np
class TournamentEA(BaseEA):
def... | code_fim | hard | {
"lang": "python",
"repo": "light-weaver/desdeo-emo",
"path": "/desdeo_emo/EAs/TournamentEA.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Conducts non-dominated sorting at the end of the evolution process
Returns:
tuple: The first element is a 2-D array of the decision vectors of the non-dominated solutions.
The second element is a 2-D array of the corresponding objective values.
"""
... | code_fim | medium | {
"lang": "python",
"repo": "light-weaver/desdeo-emo",
"path": "/desdeo_emo/EAs/TournamentEA.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("blinking 10")
blink(10)
print("blinking 100")
blink(100)
print("done")<|fim_prefix|># repo: dedeibel/humtemp path: /minimal/minimal-app.py
import esp
import machine
from time import sleep
# copy with
# ampy --port /dev/ttyUSB0 put minimal/minimal-app.py hu... | code_fim | medium | {
"lang": "python",
"repo": "dedeibel/humtemp",
"path": "/minimal/minimal-app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dedeibel/humtemp path: /minimal/minimal-app.py
import esp
import machine
from time import sleep
# copy with
# ampy --port /dev/ttyUSB0 put minimal/minimal-app.py humtemp.py
#
# or
# mpy-cross -O2 -o minimal/humtemp.mpy minimal/minimal-app.py
# ampy --port /dev/ttyUSB0 put minimal/humtemp.mpy hu... | code_fim | hard | {
"lang": "python",
"repo": "dedeibel/humtemp",
"path": "/minimal/minimal-app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if(number1 < (number2+number3))and((number2 < (number1+number3))and
((number3 < (number2+number1))):
print("Accept")
else:
print("Denied!")<|fim_prefix|># repo: ramonvaleriano/python- path: /Livros/Introdução à Programação - 500 Algoritmos resolvidos/Capitulo 3/Exercicio 3a/Algoritmo122_se33.... | code_fim | medium | {
"lang": "python",
"repo": "ramonvaleriano/python-",
"path": "/Livros/Introdução à Programação - 500 Algoritmos resolvidos/Capitulo 3/Exercicio 3a/Algoritmo122_se33.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Verify directory generated by the test is deleted as part of tearDown cleanup
# if an assertion has not failed and verify no messages with log paths are printed
self.assertTrue(os.path.isdir(self.logs_directory))
self.assertEqual(len(mock_print.call_args_list), 0)
... | code_fim | hard | {
"lang": "python",
"repo": "Kami/scalyr-agent-2",
"path": "/tests/unit/test_util_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kami/scalyr-agent-2 path: /tests/unit/test_util_test.py
# Copyright 2014 Scalyr Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | code_fim | hard | {
"lang": "python",
"repo": "Kami/scalyr-agent-2",
"path": "/tests/unit/test_util_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Write some data to the file and verify assertLogFileContainsLineRegex works correctly
with open(self.agent_log_path, "w") as fp:
fp.write(six.text_type("line 1\nline 2\nline 3"))
# file_path argument explicitly provided
self.assertLogFileContainsLineRegex(r"l... | code_fim | hard | {
"lang": "python",
"repo": "Kami/scalyr-agent-2",
"path": "/tests/unit/test_util_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thunder123321/metax_bakeoff_2019 path: /rules/phylosift.smk
PHYLOSIFT = config.get('PHYLOSIFT')
def phylosift_input(wildcards):
if wildcards.seq in samples:
return expand('fastq/{}.{{pair}}.fastq'.format(wildcards.seq), pair=[1, 2])
else:
return 'fastq/{}.fastq'.format(w... | code_fim | medium | {
"lang": "python",
"repo": "thunder123321/metax_bakeoff_2019",
"path": "/rules/phylosift.smk",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rule phylosift:
input: phylosift_input
output: data='data/{seq}.phylosift.tsv.gz',
data_lineage='data/{seq}.phylosift_lineage.tsv.gz',
report='reports/{seq}.phylosift.tsv'
params: output_dir='tmp/phylosift/{seq}',
paired=phylosift_paired
shadow: 'shallow... | code_fim | medium | {
"lang": "python",
"repo": "thunder123321/metax_bakeoff_2019",
"path": "/rules/phylosift.smk",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>atHTMLRepository, LocalDirectoryRepository, SimpleRepository,
)
from .utils import guess_encoding, match_egg_info_version
__version__ = "0.3.0d1"<|fim_prefix|># repo: uranusjr/packaging-repositories path: /src/packaging_repositories/__init__.py
__all__ = [
"__version__",
"Endpoint", "Entry", "Fe... | code_fim | hard | {
"lang": "python",
"repo": "uranusjr/packaging-repositories",
"path": "/src/packaging_repositories/__init__.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uranusjr/packaging-repositories path: /src/packaging_repositories/__init__.py
__all__ = [
"__version__",
"Endpoint", "Entry", "Fetcher",
"Filter", "RequiresPythonFilter", "VersionFilter",
"FlatHTMLRepository<|fim_suffix|>atHTMLRepository, LocalDirectoryRepository, SimpleRepository... | code_fim | hard | {
"lang": "python",
"repo": "uranusjr/packaging-repositories",
"path": "/src/packaging_repositories/__init__.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tgruby/dungeon-hunt path: /game_play/game_won.py
from game_play import db, screen
<|fim_suffix|> return screen.paint_winning_screen(game.game_id)<|fim_middle|>def process(game, action):
# Update the Leaderboard
game.status = "Winner!!!"
game.game_over = True
lb = db.load_lea... | code_fim | medium | {
"lang": "python",
"repo": "tgruby/dungeon-hunt",
"path": "/game_play/game_won.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Update the Leaderboard
game.status = "Winner!!!"
game.game_over = True
lb = db.load_leaderboard()
lb.update_leader(game)
db.save_leaderboard(lb)
return screen.paint_winning_screen(game.game_id)<|fim_prefix|># repo: tgruby/dungeon-hunt path: /game_play/game_won.py
from game_... | code_fim | easy | {
"lang": "python",
"repo": "tgruby/dungeon-hunt",
"path": "/game_play/game_won.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return screen.paint_winning_screen(game.game_id)<|fim_prefix|># repo: tgruby/dungeon-hunt path: /game_play/game_won.py
from game_play import db, screen
<|fim_middle|>def process(game, action):
# Update the Leaderboard
game.status = "Winner!!!"
game.game_over = True
lb = db.load_lea... | code_fim | medium | {
"lang": "python",
"repo": "tgruby/dungeon-hunt",
"path": "/game_play/game_won.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ilieandrei98/labs path: /python/exercitii/reminder/executor.py
#!/usr/bin/env python
# *-* coding: UTF-8 *-*
"""Script-ul `executor` va primi o sarcină generată / pregătită de
către script-ul `scheduler` și va încerca să îndeplinească toate
cerințele ce sunt încapsulate în aceasta.
"""
def exec... | code_fim | medium | {
"lang": "python",
"repo": "ilieandrei98/labs",
"path": "/python/exercitii/reminder/executor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
executor()<|fim_prefix|># repo: ilieandrei98/labs path: /python/exercitii/reminder/executor.py
#!/usr/bin/env python
# *-* coding: UTF-8 *-*
"""Script-ul `executor` va primi o sarcină generată / pregătită de
către script-ul `scheduler` și va încerca să îndeplinească toate
... | code_fim | medium | {
"lang": "python",
"repo": "ilieandrei98/labs",
"path": "/python/exercitii/reminder/executor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kivy/kivy path: /examples/widgets/unicode_textinput.py
# -*- coding: utf-8 -*-
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty, ObjectProperty
from kivy.core.text import Label as CoreLabel
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.fl... | code_fim | hard | {
"lang": "python",
"repo": "kivy/kivy",
"path": "/examples/widgets/unicode_textinput.py",
"mode": "psm",
"license": "LGPL-2.1-only",
"source": "the-stack-v2"
} |
<|fim_suffix|> def load(self, _path, _fname):
self.txt_input.font_name = _fname[0]
_f_name = _fname[0][_fname[0].rfind(os.sep) + 1:]
self.spnr_fnt.text = _f_name[:_f_name.rfind('.')]
self._popup.dismiss()
def show_load(self):
content = LoadDialog(load=self.load, cancel=se... | code_fim | hard | {
"lang": "python",
"repo": "kivy/kivy",
"path": "/examples/widgets/unicode_textinput.py",
"mode": "spm",
"license": "LGPL-2.1-only",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: areelillmind/vfx_naming_utils path: /Name_Tests.py
#### Test
names=[
'SHOW_RL01_000_000_comp_v001_0001_brighter.nk',
'CRAP_EP03_020_090_comp_v027_9991.nk',
'TC2_EP09_179_44A_roto_v109_0023.nk',
'SB06_EP10_018_010_comp_v003.nk',
'bollocks',
'SB06_EP10_018_010_comp_.nk',
'SB06_EP10_018_010... | code_fim | hard | {
"lang": "python",
"repo": "areelillmind/vfx_naming_utils",
"path": "/Name_Tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## custom names
customRegex=r'''
([A-Z]+[0-9]+) # SHOW code, group 0
(CANTFINDME)? # ReeL or EPisode number, group 1
_([0-9]+[A-Z]?) # scene number, can include letters after the number, group 2
_([0-9]+[A-Z]?) # shot number, can include letters after... | code_fim | hard | {
"lang": "python",
"repo": "areelillmind/vfx_naming_utils",
"path": "/Name_Tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for name in names:
name=vfx_naming_utils.Shot_Name_Parser(name, customRegex)
if name.nameElements:
print name.nameElements
name.increment_subver()!={}
print 'incremented subversion', name.recompile_name()
name.increment_version()
print 'incremented version'... | code_fim | hard | {
"lang": "python",
"repo": "areelillmind/vfx_naming_utils",
"path": "/Name_Tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bspkrs/MCP-Mapping-Integration-Tests path: /get_json_value.py
import urllib2, json, sys
def getRemoteContents(url):
req = urllib2.Request(url)
r = urllib2.urlopen(req)
return r.read()
def getJsonValue(json_file, key):
value = json.loads(json_file)
splitted = key.split('/'... | code_fim | medium | {
"lang": "python",
"repo": "bspkrs/MCP-Mapping-Integration-Tests",
"path": "/get_json_value.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def getJsonValue(json_file, key):
value = json.loads(json_file)
splitted = key.split('/')
for subkey in splitted:
value = value[subkey]
return value
def main():
print getJsonValue(getRemoteContents('http://files.minecraftforge.net/maven/net/minecraftforge/%s/promotions_slim... | code_fim | medium | {
"lang": "python",
"repo": "bspkrs/MCP-Mapping-Integration-Tests",
"path": "/get_json_value.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
## SCORE
y_pred = md.predict_proba(X_test)[:,1]
print(metrics.confusion_matrix(y_test, y_pred>0.7))
print(metrics.roc_auc_score(y_test, y_pred))
## Method 2 - orig lightgbm API
dlgb_train = lgb.Dataset(X_train, label = y_train)
dlgb_test = lgb.Dataset(X_test)
## TRAIN
param = {'objective': 'binary... | code_fim | hard | {
"lang": "python",
"repo": "szilard/GBM-intro",
"path": "/5-more/3b-lightgbm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## SCORE
y_pred = md.predict_proba(X_test)[:,1]
print(metrics.confusion_matrix(y_test, y_pred>0.7))
print(metrics.roc_auc_score(y_test, y_pred))
## Method 2 - orig lightgbm API
dlgb_train = lgb.Dataset(X_train, label = y_train)
dlgb_test = lgb.Dataset(X_test)
## TRAIN
param = {'objective': 'binary'... | code_fim | hard | {
"lang": "python",
"repo": "szilard/GBM-intro",
"path": "/5-more/3b-lightgbm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: szilard/GBM-intro path: /5-more/3b-lightgbm.py
import pandas as pd
import numpy as np
from sklearn import preprocessing
from scipy import sparse
from sklearn import metrics
import lightgbm as lgb
## READ DATA
d_train = pd.read_csv("https://s3.amazonaws.com/benchm-ml--main/train-0.1m.csv")
d_... | code_fim | hard | {
"lang": "python",
"repo": "szilard/GBM-intro",
"path": "/5-more/3b-lightgbm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# convert some values of the specific types of the object into string
# e.g convert all the ObjectId to string
# convert all the datetime object to string
def stringify_object_values_by_types(obj, object_types=stringify_map.keys()):
for object_type in object_types:
stringify_object_values... | code_fim | hard | {
"lang": "python",
"repo": "korenlev/calipso-cvim",
"path": "/base/utils/string_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: korenlev/calipso-cvim path: /base/utils/string_utils.py
###############################################################################
# Copyright (c) 2017-2020 Koren Lev (Cisco Systems), #
# Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others #
#... | code_fim | hard | {
"lang": "python",
"repo": "korenlev/calipso-cvim",
"path": "/base/utils/string_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# stringify ObjectId
def stringify_object_id(object_id: ObjectId) -> str:
return str(object_id)
def convert_int64(int64: Int64) -> int:
return int(int64)
stringify_map = {
ObjectId: stringify_object_id,
datetime: stringify_datetime,
Int64: convert_int64
}
def stringify_object_va... | code_fim | hard | {
"lang": "python",
"repo": "korenlev/calipso-cvim",
"path": "/base/utils/string_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: curtislacy/counterblockd path: /lib/util.py
es/5
def is_valid_url(url, suffix='', allow_localhost=False, allow_no_protocol=False):
regex = re.compile(
r'^https?://' if not allow_no_protocol else r'^(https?://)?' # http:// or https://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9]... | code_fim | hard | {
"lang": "python",
"repo": "curtislacy/counterblockd",
"path": "/lib/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def decorate_message_for_feed(msg, msg_data=None):
"""This function takes a message from counterpartyd's message feed and mutates it a bit to be suitable to be
sent through the counterblockd message feed to an end-client"""
if not msg_data:
msg_data = json.loads(msg['bindings'])
... | code_fim | hard | {
"lang": "python",
"repo": "curtislacy/counterblockd",
"path": "/lib/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
image = Image.open(StringIO.StringIO(raw_image_data))
except Exception, e:
logging.error(e)
raise Exception("Unable to parse image data at: %s" % url)
if image.format.lower() not in formats: raise Exception("Image is not a PNG: %s (got %s)" ... | code_fim | hard | {
"lang": "python",
"repo": "curtislacy/counterblockd",
"path": "/lib/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Portal777/the-tale path: /src/the_tale/the_tale/finances/market/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from django.db import models, migrations
import rels.django
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependen... | code_fim | hard | {
"lang": "python",
"repo": "Portal777/the-tale",
"path": "/src/the_tale/the_tale/finances/market/migrations/0001_initial.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> models.TextField(default=b'{}')),
('buyer', models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, default=None, blank=True, to=settings.AUTH_USER_MODEL, null=True)),
('seller', models.ForeignKey(related_name='+', to=settings.AUTH_USER_MODEL)),
... | code_fim | hard | {
"lang": "python",
"repo": "Portal777/the-tale",
"path": "/src/the_tale/the_tale/finances/market/migrations/0001_initial.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|><p>As stated above, this is <i>not</i> an official, end-user release
of Subversion. It is a distribution intended for testing only. Please
do <i>not</i> package this distribution in any way. It should not be
made available to users who rely on their operating system distro's
packages.</p>
<p>If you want... | code_fim | hard | {
"lang": "python",
"repo": "RussellBauer/G5_Deps",
"path": "/subversion-1.6.13/tools/dist/gen_nightly_ann.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RussellBauer/G5_Deps path: /subversion-1.6.13/tools/dist/gen_nightly_ann.py
#!/usr/bin/env python
webpagetext = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Subversion 1.5.x nightly tarballs (r%d)</title>
</... | code_fim | hard | {
"lang": "python",
"repo": "RussellBauer/G5_Deps",
"path": "/subversion-1.6.13/tools/dist/gen_nightly_ann.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> h_x, h_xnobc, x_obs, x_err, x_lon, x_lat, x_time, \
x_channum, x_errorig, x_biaspred, x_use, x_qcmark, \
x_water_frac, x_land_frac, x_ice_frac, x_snow_frac = \
_readsatobs.get_satobs_data(
self.filename, self.nobs, self.npred, endian=self.endian... | code_fim | hard | {
"lang": "python",
"repo": "sreeds82/py-gsidiag",
"path": "/gsidiag/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sreeds82/py-gsidiag path: /gsidiag/__init__.py
import numpy as _np
import _readconvobs
import _readsatobs
__version__ = '0.0.2'
class diag_conv(object):
# read diag_conv file.
def __init__(self, filename, endian='native'):
nobs = _readconvobs.get_num_convobs(filename, endian=en... | code_fim | hard | {
"lang": "python",
"repo": "sreeds82/py-gsidiag",
"path": "/gsidiag/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> iterations=0 #
x=TransformJX(j) #translates array coordinates into complex numbers
y=TransformIY(i)
while (not Escaped(x,y) and not Exeeded(iterations)):
x,y = Iterate(x,y)
iterations+=1 # increment iterations counter
return iterations # output a... | code_fim | hard | {
"lang": "python",
"repo": "LukeStorry/JuliaSets",
"path": "/juliaset_2d_array.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LukeStorry/JuliaSets path: /juliaset_2d_array.py
#Global Variables. Can ask for input in later versions
juliaC=[-1,0] #Which Julia set to produce
xMin,yMin=-2.1,-2.1 #range of x coordinates for windows to contain
xMax,yMax=2,2 #range of y coordinates for windows to contain
xRes=20 #How ma... | code_fim | hard | {
"lang": "python",
"repo": "LukeStorry/JuliaSets",
"path": "/juliaset_2d_array.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.ca = CAAdapter()
self.secrets = SecretsAdapter()
def deploy(self, config, dependencies_changed=False, silent=False):
cert_secret = self.secrets.get_secret(config.cert_secret)
key_secret = self.secrets.get_secret(config.key_secret)
if key_secret and cert_se... | code_fim | hard | {
"lang": "python",
"repo": "edgarlanting/dcos-deploy",
"path": "/dcosdeploy/modules/certs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edgarlanting/dcos-deploy path: /dcosdeploy/modules/certs.py
from dcosdeploy.base import ConfigurationException
from dcosdeploy.util import print_if
from dcosdeploy.adapters.ca import CAAdapter
from dcosdeploy.adapters.secrets import SecretsAdapter
class Cert(object):
def __init__(self, name... | code_fim | hard | {
"lang": "python",
"repo": "edgarlanting/dcos-deploy",
"path": "/dcosdeploy/modules/certs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> train = res[:sep]
sep2 = int(round((l - sep)/2))
valid = res[sep:sep+sep2]
test = res[sep+sep2:]
np.savetxt("train.csv", train, fmt='%s', delimiter=',', header= head)
np.savetxt("valid.csv", valid, fmt='%s', delimiter=',', header= head)
np.savetxt("test.csv", test, fmt='%s', delimiter=',', header= ... | code_fim | medium | {
"lang": "python",
"repo": "nandini269/graph-hyperband",
"path": "/create_tv.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.