text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>class TestHexMuZero(unittest.TestCase):
"""
Unit testing class to test whether the search engine exhibit well defined behaviour.
This includes scenarios where either the model or inputs are faulty (empty observations,
constant predictions, nans/ inf in observations).
"""
hex_board_... | code_fim | hard | {
"lang": "python",
"repo": "frankbryce/muzero",
"path": "/Testing/unit_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch = 128
dim = self.g.getDimensions()
latent_planes = np.random.uniform(size=(batch, dim[0], dim[1]))
actions = np.floor(np.random.uniform(size=batch) * dim[0] * dim[1])
actions = actions.astype(int)
recurrent_inputs = list(zip(latent_planes, actions))
... | code_fim | hard | {
"lang": "python",
"repo": "frankbryce/muzero",
"path": "/Testing/unit_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # polar_side_counter.py
CIRCLE_DERIV_RANGE = (0.90, 1.10)
NOISE_DERIV_RANGE = (0.80, 1.20)
CIRCLE_PATH = "../../../../targets_full_dataset/circle/6.png"<|fim_prefix|># repo: FlintHill/SUAS-Competition path: /UpdatedImageProcessing/UpdatedImageProcessing/ShapeDetection/settings.py
clas... | code_fim | hard | {
"lang": "python",
"repo": "FlintHill/SUAS-Competition",
"path": "/UpdatedImageProcessing/UpdatedImageProcessing/ShapeDetection/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FlintHill/SUAS-Competition path: /UpdatedImageProcessing/UpdatedImageProcessing/ShapeDetection/settings.py
class ShapeDetectionSettings(object):
# shape_classification.py
CIRCLE_SCORE_THRESHOLD = 0.6
NOISE_SCORE_THRESHOLD = 0.6
SQUARE_SIDE_LENGTH_THRESHOLD = 2
TRAPEZOID_ARE... | code_fim | hard | {
"lang": "python",
"repo": "FlintHill/SUAS-Competition",
"path": "/UpdatedImageProcessing/UpdatedImageProcessing/ShapeDetection/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cpu_dict[cpu_type] += 1
else:
cpu_dict[cpu_type] = 1
print ("cpu types: ", len(cpu_dict))
print ("nodes : ", counter)
cpu_dict_sorted = {k:v for k, v in sorted(cpu_dict.items(), key = lambda item: item[1], reverse=True)}
df = pd.DataFrame.from_dict(data=cpu_dict_sort... | code_fim | medium | {
"lang": "python",
"repo": "Heronalps/STOIC",
"path": "/jupyter/cpu_analysis.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Heronalps/STOIC path: /jupyter/cpu_analysis.py
import re
import pandas as pd
regex = re.compile("nautilus\.io\/processor: (.*)")
cpu_dict = dict()
counter = 0
with open("./nodes.txt", "r") as file:
for line in file:
result = regex.search(line)
if result != None:
c... | code_fim | medium | {
"lang": "python",
"repo": "Heronalps/STOIC",
"path": "/jupyter/cpu_analysis.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arcensoth/pymcutil path: /pymcutil/data_tag/data_tag.py
import abc
class DataTag(abc.ABC):
""" A generic data tag, to be used as an interface for all TAG types. """
<|fim_suffix|> """ Return a string serialization of the data tag, for example with quotes or a type suffix. """
d... | code_fim | medium | {
"lang": "python",
"repo": "Arcensoth/pymcutil",
"path": "/pymcutil/data_tag/data_tag.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Return a bytes representation of the data tag. """<|fim_prefix|># repo: Arcensoth/pymcutil path: /pymcutil/data_tag/data_tag.py
import abc
class DataTag(abc.ABC):
""" A generic data tag, to be used as an interface for all TAG types. """
def __str__(self):
return self.to_str... | code_fim | easy | {
"lang": "python",
"repo": "Arcensoth/pymcutil",
"path": "/pymcutil/data_tag/data_tag.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Return a string serialization of the data tag, for example with quotes or a type suffix. """
def to_bytes(self) -> bytes:
""" Return a bytes representation of the data tag. """<|fim_prefix|># repo: Arcensoth/pymcutil path: /pymcutil/data_tag/data_tag.py
import abc
class DataTag... | code_fim | medium | {
"lang": "python",
"repo": "Arcensoth/pymcutil",
"path": "/pymcutil/data_tag/data_tag.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MaryamAdnan3/Tester1 path: /PYTHON_GENERIC_LIB/tester/models/team_integer.py
# -*- coding: utf-8 -*-
"""
tester
This file was automatically generated for Stamplay by APIMATIC v3.0 (
https://www.apimatic.io ).
"""
<|fim_suffix|> """
CODEGEN = 1
CGAAS = 2
UX = 3
QA = 4<|... | code_fim | hard | {
"lang": "python",
"repo": "MaryamAdnan3/Tester1",
"path": "/PYTHON_GENERIC_LIB/tester/models/team_integer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Attributes:
CODEGEN: TODO: type description here.
CGAAS: TODO: type description here.
UX: TODO: type description here.
QA: TODO: type description here.
"""
CODEGEN = 1
CGAAS = 2
UX = 3
QA = 4<|fim_prefix|># repo: MaryamAdnan3/Tester1 path: /PYT... | code_fim | medium | {
"lang": "python",
"repo": "MaryamAdnan3/Tester1",
"path": "/PYTHON_GENERIC_LIB/tester/models/team_integer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kazuki0824/wrs path: /0000_book/pickplace_xarm_reuse_grasps.py
import visualization.panda.world as wd
import modeling.geometric_model as gm
import modeling.collision_model as cm
import grasping.planning.antipodal as gpa
import numpy as np
import robot_sim.robots.xarm7_shuidi_mobile.xarm7_shuidi_m... | code_fim | medium | {
"lang": "python",
"repo": "kazuki0824/wrs",
"path": "/0000_book/pickplace_xarm_reuse_grasps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>grasp_info_list = gpa.load_pickle_file('box', './', 'xarm_box.pickle')
component_name = "arm"
gripper_s = xag.XArmGripper()
for grasp_info in grasp_info_list:
jaw_width, jaw_center_pos, jaw_center_rotmat, hnd_pos, hnd_rotmat = grasp_info
gl_jaw_center_pos = object_box_gl_pos+object_box_gl_rotmat.... | code_fim | hard | {
"lang": "python",
"repo": "kazuki0824/wrs",
"path": "/0000_book/pickplace_xarm_reuse_grasps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: supervisely/supervisely path: /supervisely/nn/legacy/hosted/inference_batch_multiprocess.py
# coding: utf-8
import os
import queue
import time
from collections import namedtuple
from copy import deepcopy
from threading import Thread
import multiprocessing as mp
from supervisely import logger
f... | code_fim | hard | {
"lang": "python",
"repo": "supervisely/supervisely",
"path": "/supervisely/nn/legacy/hosted/inference_batch_multiprocess.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def populate_inference_requests_queue(in_project, inference_processes, request_queue):
for in_dataset in in_project:
for in_item_name in in_dataset:
logger.trace('Will process image',
extra={'dataset_name': in_dataset.name, 'image_name': in_item_name})
... | code_fim | hard | {
"lang": "python",
"repo": "supervisely/supervisely",
"path": "/supervisely/nn/legacy/hosted/inference_batch_multiprocess.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edges-collab/edges-io path: /tests/test_resistance_read.py
import pytest
import numpy as np
import shutil
from pathlib import Path
from edges_io.io import Resistance
def test_resistance_read_old_header(datadir: Path, tmpdir: Path):
header, nlines = Resistance.read_old_style_csv_header(
... | code_fim | hard | {
"lang": "python",
"repo": "edges-collab/edges-io",
"path": "/tests/test_resistance_read.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = Resistance(fl)
r.read()
assert len(r.resistance) == 9
assert len(r.resistance.dtype.names) == 12
assert len(r.ancillary) == 0
def test_resistance_read_old(datadir: Path):
fl = datadir / "old_resistance_file.csv"
r = Resistance(fl, check=False)
r.read()
assert len... | code_fim | hard | {
"lang": "python",
"repo": "edges-collab/edges-io",
"path": "/tests/test_resistance_read.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fl = datadir / "old_resistance_file.csv"
r = Resistance(fl, check=False)
r.read()
assert len(r.resistance) == 11
assert len(r.resistance.dtype.names) == 11
assert len(r.ancillary) == 0
assert not np.any(np.isnan(r.resistance["load_resistance"]))<|fim_prefix|># repo: edges-coll... | code_fim | hard | {
"lang": "python",
"repo": "edges-collab/edges-io",
"path": "/tests/test_resistance_read.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> im1, mask = check_image_mask_single_channel(im1, mask)
im2 = check_image_single_channel(im2)
if im1.shape != im2.shape: raise ValueError('im1 and im2 must be the same shape')
if im1.dtype != im2.dtype: raise ValueError('im1 and im2 must be the same dtype')
p = asarray(p if isinstance(p... | code_fim | hard | {
"lang": "python",
"repo": "coderforlife/histmatch",
"path": "/hist/metrics.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def ssim(im1, im2, mask=None, block_size=None, sigma=1.5, k1=0.01, k2=0.03, remove_edges=False): # pylint: disable=too-many-arguments, invalid-name
"""
Calculates the mean SSIM image as the average of all:
SSIM(x,y) = (2*mu_x*mu_y+C1)*(2*sig_xy+C2)/((mu_x^2+mu_y^2+C1)*(sig_x^2+sig_y^2+C2))... | code_fim | hard | {
"lang": "python",
"repo": "coderforlife/histmatch",
"path": "/hist/metrics.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coderforlife/histmatch path: /hist/metrics.py
th European
Signal Processing Conference (EUSIPCO), 2:861–864.
2. Nikolova M and Steidl G, 2014, "Fast Ordering Algorithm for Exact Histogram Specification"
IEEE Trans. on Image Processing, 23(12):5274-5283
"""
im1, mask =... | code_fim | hard | {
"lang": "python",
"repo": "coderforlife/histmatch",
"path": "/hist/metrics.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pegasus-01/DataCamp-works path: /10-DataManipulationWithPandas/06-SubsettingRowsByCategoricalVariables.py
#part1
# Subset for rows in South Atlantic or Mid-Atlantic regions
south_mid_atlantic = homelessness[(homelessness["region"] == "South Atlantic") | (homelessness["region"] == "Mid-Atlantic"... | code_fim | medium | {
"lang": "python",
"repo": "Pegasus-01/DataCamp-works",
"path": "/10-DataManipulationWithPandas/06-SubsettingRowsByCategoricalVariables.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Filter for rows in the Mojave Desert states
mojave_homelessness = homelessness[homelessness["state"].isin(canu)]
# See the result
print(mojave_homelessness)<|fim_prefix|># repo: Pegasus-01/DataCamp-works path: /10-DataManipulationWithPandas/06-SubsettingRowsByCategoricalVariables.py
#part1
# Subs... | code_fim | medium | {
"lang": "python",
"repo": "Pegasus-01/DataCamp-works",
"path": "/10-DataManipulationWithPandas/06-SubsettingRowsByCategoricalVariables.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
### check singleton
try:
sing = check_singleton()
except OSError as e:
root = tk.Tk()
root.title('Error')
message = "Only one instance of the NexusLIMS " + \
"Session Logger can be run at one time. " + \
"Please c... | code_fim | hard | {
"lang": "python",
"repo": "shashipoddar/NexusLIMS-Logger",
"path": "/src/nexuslims_logger/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shashipoddar/NexusLIMS-Logger path: /src/nexuslims_logger/main.py
import getpass
import json
import os
import pathlib
import sys
import tkinter as tk
from collections import UserDict
from .db_logger_gui import MainApp, ScreenRes, check_singleton
from .make_db_entry import DBSessionLogger
class... | code_fim | hard | {
"lang": "python",
"repo": "shashipoddar/NexusLIMS-Logger",
"path": "/src/nexuslims_logger/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linkhub-sdk/popbill.closedown.example.py path: /checkCorpNums.py
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import imp
import sys
imp.reload(sys)
try:
sys.setdefaultencoding("UTF8")
except Exception as E:
pass
<|fim_suffix|>"""
다수건의 사업자번호에 대한 휴폐업정보를... | code_fim | hard | {
"lang": "python",
"repo": "linkhub-sdk/popbill.closedown.example.py",
"path": "/checkCorpNums.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 조회할 사업자번호 배열, 최대 1000건
targetCorpNumList = []
targetCorpNumList.append("6798700433")
targetCorpNumList.append("123-45-67890")
CorpStateList = closedownService.checkCorpNums(CorpNum, targetCorpNumList)
print("=" * 15 + " 휴폐업조회 - 대량 " + "=" * 15)
print(
"taxType(사업자 과... | code_fim | medium | {
"lang": "python",
"repo": "linkhub-sdk/popbill.closedown.example.py",
"path": "/checkCorpNums.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/gan path: /tensorflow_gan/examples/progressive_gan/data_provider_test.py
# coding=utf-8
# Copyright 2023 The TensorFlow GAN Authors.
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/gan",
"path": "/tensorflow_gan/examples/progressive_gan/data_provider_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_normalize_image(self):
image_np = np.asarray([0, 255, 210], dtype=np.uint8)
normalized_image = data_provider.normalize_image(tf.constant(image_np))
# Static checks.
self.assertEqual(normalized_image.dtype, tf.float32)
self.assertEqual(normalized_image.shape.as_list(), [3])... | code_fim | medium | {
"lang": "python",
"repo": "tensorflow/gan",
"path": "/tensorflow_gan/examples/progressive_gan/data_provider_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saeidsafavi/OpenWindow path: /openwindow/evaluate.py
import argparse
import sys
from pathlib import Path
import cli
def evaluate_all(args):
import numpy as np
from core.openwindow import OpenWindow
def _statistics(scores):
sem = np.std(scores, ddof=1) / np.sqrt(len(scores... | code_fim | hard | {
"lang": "python",
"repo": "saeidsafavi/OpenWindow",
"path": "/openwindow/evaluate.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Print results (optional)
if verbose:
print('Confusion Matrix:\n', C, '\n')
pd.options.display.float_format = '{:,.3f}'.format
print(str(scores))
return scores
def parse_args():
config, conf_parser, remaining_args = cli.parse_config_args()
parser = argparse... | code_fim | hard | {
"lang": "python",
"repo": "saeidsafavi/OpenWindow",
"path": "/openwindow/evaluate.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdf3039/CarND-Capstone path: /ros/src/twist_controller/tl_detector.py
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose, TwistStamped
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from senso... | code_fim | hard | {
"lang": "python",
"repo": "mdf3039/CarND-Capstone",
"path": "/ros/src/twist_controller/tl_detector.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
stopping_waypoint_index = int(self.stopping_waypoint_index)
nearest_light = self.stopping_waypoint_distance
# the result of the image_cb function is in the equation below
traffic_light_value = self.last_state
#obtain the minimum stopping distance possibl... | code_fim | hard | {
"lang": "python",
"repo": "mdf3039/CarND-Capstone",
"path": "/ros/src/twist_controller/tl_detector.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petitnau/crypy path: /tests/test_pow.py
from crypy.utils.pow import proof_of_work
from hashlib import sha256, md5
import secrets
<|fim_suffix|> assert s.startswith(prefix) and s.endswith(postfix) and h.startswith(prehash) and h.endswith(posthash)
def test_pow_md5():
prefix = secrets.toke... | code_fim | hard | {
"lang": "python",
"repo": "petitnau/crypy",
"path": "/tests/test_pow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert s.startswith(prefix) and s.endswith(postfix) and h.startswith(prehash) and h.endswith(posthash)
def test_pow_md5():
prefix = secrets.token_bytes(nbytes=4)
postfix = secrets.token_bytes(nbytes=4)
prehash = secrets.token_bytes(nbytes=1)
posthash = secrets.token_bytes(nbytes=1)
... | code_fim | medium | {
"lang": "python",
"repo": "petitnau/crypy",
"path": "/tests/test_pow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prefix = secrets.token_bytes(nbytes=4)
postfix = secrets.token_bytes(nbytes=4)
prehash = secrets.token_bytes(nbytes=1)
posthash = secrets.token_bytes(nbytes=1)
s = proof_of_work(prefix, postfix, prehash, posthash, lambda x: md5(x).digest())
h = md5(s).digest()
assert s.starts... | code_fim | hard | {
"lang": "python",
"repo": "petitnau/crypy",
"path": "/tests/test_pow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gelo-zhukov/django-s3direct path: /s3direct/utils.py
# -*- coding: utf-8 -*-
import hashlib
import hmac
import json
import os
import urllib
import uuid
from base64 import b64encode
from datetime import datetime, timedelta
from django.conf import settings
from django.core.urlresolvers import reve... | code_fim | hard | {
"lang": "python",
"repo": "gelo-zhukov/django-s3direct",
"path": "/s3direct/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> access_key = settings.AWS_ACCESS_KEY_ID
secret_access_key = settings.AWS_SECRET_ACCESS_KEY
bucket = settings.AWS_STORAGE_BUCKET_NAME
endpoint = settings.S3DIRECT_ENDPOINT
expires_in = datetime.now() + timedelta(hours=24)
expires = expires_in.strftime('%Y-%m-%dT%H:%M:%S.000Z')
... | code_fim | hard | {
"lang": "python",
"repo": "gelo-zhukov/django-s3direct",
"path": "/s3direct/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErrorsAndGlitches/collection-day-lambda path: /cdl/cdl.py
from datetime import datetime
from pytz import timezone
from os import environ
import boto3
from cdl.collection_calendar import CollectionCalendar
from cdl.notifications import SnsNotification
def collection_day_lambda_handler(event, co... | code_fim | medium | {
"lang": "python",
"repo": "ErrorsAndGlitches/collection-day-lambda",
"path": "/cdl/cdl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> today_date = datetime.now(tz=timezone('America/Los_Angeles')).date()
notifications.send(str(CollectionCalendar(address, today_date).next_collection_msg()))<|fim_prefix|># repo: ErrorsAndGlitches/collection-day-lambda path: /cdl/cdl.py
from datetime import datetime
from pytz import timezone
from o... | code_fim | hard | {
"lang": "python",
"repo": "ErrorsAndGlitches/collection-day-lambda",
"path": "/cdl/cdl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srinivasreddy/allhub path: /tests/gists/test_gist.py
from tempfile import NamedTemporaryFile
from tests.utils import allhub
import pytest
named_file = NamedTemporaryFile(delete=False)
named_file.write(b"Hello world!!!")
named_file.close()
class TestGist:
def test_create_gist(self):
... | code_fim | hard | {
"lang": "python",
"repo": "srinivasreddy/allhub",
"path": "/tests/gists/test_gist.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_gist_forks(self):
forks = allhub.gist_forks("9620683")
assert len(forks) > 0
def test_fork_gist(self):
fork = allhub.fork_gist("9620683")
gist = allhub.gist(fork.id)
assert allhub.delete_gist(fork.id)
gist = allhub.gist(fork.id)
ass... | code_fim | hard | {
"lang": "python",
"repo": "srinivasreddy/allhub",
"path": "/tests/gists/test_gist.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> op.execute('''
DELETE FROM parser WHERE method = 'apertium_kaz_rus';
DELETE FROM parser WHERE method = 'apertium_tat_rus';
''')<|fim_prefix|># repo: ispras/lingvodoc path: /alembic/versions/71a35496d931_kaz_tat_parsers.py
"""Kazakh and Tatar parsers
Revision ID: 71a35496d931
Revises: d15... | code_fim | hard | {
"lang": "python",
"repo": "ispras/lingvodoc",
"path": "/alembic/versions/71a35496d931_kaz_tat_parsers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ispras/lingvodoc path: /alembic/versions/71a35496d931_kaz_tat_parsers.py
"""Kazakh and Tatar parsers
Revision ID: 71a35496d931
Revises: d15043d2cbd9
Create Date: 2021-10-05 04:34:20.845470
<|fim_suffix|> op.execute('''
DELETE FROM parser WHERE method = 'apertium_kaz_rus';
DELETE FROM... | code_fim | hard | {
"lang": "python",
"repo": "ispras/lingvodoc",
"path": "/alembic/versions/71a35496d931_kaz_tat_parsers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Assumes architecture directory is next to this file's parent directory
digest, size = make_tarfile(tar_name, arch_path, arch)
with open('platform_template.json', 'rt') as platform_template:
platform = json.load(platform_template)
with open('package_modmatic_index.json', 'r+') as index_file:
... | code_fim | hard | {
"lang": "python",
"repo": "modmatic/arduino-boards-index",
"path": "/update-index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>arch_path = os.path.join('..', 'ArduinoCore-' + arch)
platform_path = os.path.join(arch_path, 'platform.txt')
version = find_version(platform_path)
base_url = 'https://raw.githubusercontent.com/modmatic/arduino-boards-index/master'
tar_name = 'modmatic-' + arch + '-' + version + '.tar.gz'
# Assumes archi... | code_fim | medium | {
"lang": "python",
"repo": "modmatic/arduino-boards-index",
"path": "/update-index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modmatic/arduino-boards-index path: /update-index.py
import hashlib
import json
import os.path
import sys
import tarfile
def make_tarfile(output_filename, source_dir, top_dir):
with tarfile.open(output_filename, 'w:gz') as tar:
tar.add(source_dir, arcname=top_dir)
hasher = hash... | code_fim | hard | {
"lang": "python",
"repo": "modmatic/arduino-boards-index",
"path": "/update-index.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> src_sg = [True for sg in src_sg_list if sg is not None]
dst_sg = [True for sg in dst_sg_list if sg is not None]
if True in src_sg or True in dst_sg:
return (False, (400, 'Config Error: policy rule refering to'
' security g... | code_fim | hard | {
"lang": "python",
"repo": "tungstenfabric/tf-controller",
"path": "/src/config/api-server/vnc_cfg_api_server/resources/_policy_base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tungstenfabric/tf-controller path: /src/config/api-server/vnc_cfg_api_server/resources/_policy_base.py
#
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
from builtins import str
import itertools
import uuid
from cfgm_common import protocols
from netaddr import IPNetwork
def... | code_fim | hard | {
"lang": "python",
"repo": "tungstenfabric/tf-controller",
"path": "/src/config/api-server/vnc_cfg_api_server/resources/_policy_base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>capitalized)
file_name = os.path.join(out_dir, "%s.pdf" % base_name)
body = dict(dbId=db_id, pathwayName=pathway, fileName=file_name)
requests.post(get_fi_url('exportPathwayDiagram'), json=body)
print("Exported pathway '%s' to %s." % (pathway, file_name))
return file_name<|fim_prefix|>... | code_fim | hard | {
"lang": "python",
"repo": "FredLoney/fipy",
"path": "/reactome/fipy/diagram.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FredLoney/fipy path: /reactome/fipy/diagram.py
def export_diagram(db_id, pathway, genes, out_dir=None):
"""
Exports a diagram PDF for the given pathway. The PDF
is placed in the target output directory. The file name
capitalizes the pathway name and removes spaces and
punctuat... | code_fim | hard | {
"lang": "python",
"repo": "FredLoney/fipy",
"path": "/reactome/fipy/diagram.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__("clustername", scheduling, **kwargs)
@property
def region(self):
return "us-east-1"
@property
def partition(self):
return "aws"
@property
def vpc_id(self):
return "dummy_vpc_id"
def dummy_head_node(mocker):
"""Generate dummy... | code_fim | hard | {
"lang": "python",
"repo": "aws/aws-parallelcluster",
"path": "/cli/tests/pcluster/config/dummy_cluster_config.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aws/aws-parallelcluster path: /cli/tests/pcluster/config/dummy_cluster_config.py
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy ... | code_fim | hard | {
"lang": "python",
"repo": "aws/aws-parallelcluster",
"path": "/cli/tests/pcluster/config/dummy_cluster_config.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lene/style-scout path: /category.py
from typing import Dict, List, Tuple
from acquisition.shopping_api import ShoppingApi
DEFAULT_CATEGORIES = {
1: ('Kleidung',),
2: ('Damenmode', 'Damenschuhe'),
3: (
'Anzüge & Kombinationen', 'Blusen, Tops & Shirts',
'Jacken & Mänt... | code_fim | hard | {
"lang": "python",
"repo": "lene/style-scout",
"path": "/category.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cls, api: ShoppingApi, search_term_filter: Dict[int, Tuple[str, ...]]=DEFAULT_CATEGORIES,
root_category: int=-1
) -> List['Category']:
category_ids = [root_category]
leaf_categories = [] # type: List[Category]
for level in range(1, 5):
next_... | code_fim | medium | {
"lang": "python",
"repo": "lene/style-scout",
"path": "/category.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangyum/Anaconda path: /lib/python2.7/site-packages/astropy/nddata/mixins/tests/test_ndarithmetic.py
ncertainty_init_invalid_shape_1():
u = StdDevUncertainty(array=np.ones((6, 6)))
with pytest.raises(ValueError) as exc:
NDDataArray(np.ones((5, 5)), uncertainty=u)
assert exc.va... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/astropy/nddata/mixins/tests/test_ndarithmetic.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3)
u2 = StdDevUncertainty(array=np.ones((5, 5)))
d1 = NDDataArray(np.ones((5, 5)), uncertainty=u1)
d2 = NDDataArray(np.ones((5, 5)) * 2., uncertainty=u2)
d3 = d1.multiply(d2)
assert np.all(d3.data == 2.)
assert_array_equal(d3.uncer... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/astropy/nddata/mixins/tests/test_ndarithmetic.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if op1_mask is not None:
assert op1.mask[0] == (not result.mask[0])
if op2_mask is not None:
assert op2.mask[0] == (not result.mask[0])
def test_arithmetic_result_not_tied_to_operands_wcs():
# unit is no longer settable, so test that result unit is different object
# tha... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/astropy/nddata/mixins/tests/test_ndarithmetic.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> graph_data.append({'x': dates[252:], 'y': preds[252:,0], 'name': 'P10'})
graph_data.append({'x': dates[252:], 'y': preds[252:,1], 'name': 'P50'})
graph_data.append({'x': dates[252:], 'y': preds[252:,2], 'name': 'P90'})
graph_data.append({'x': dates[:252], 'y... | code_fim | hard | {
"lang": "python",
"repo": "KalleBylin/tft_webapp",
"path": "/website/app/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KalleBylin/tft_webapp path: /website/app/app.py
import time
import json
import io
import base64
import requests
import numpy as np
import pandas as pd
import dash
from dash import dcc
from dash import html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
... | code_fim | hard | {
"lang": "python",
"repo": "KalleBylin/tft_webapp",
"path": "/website/app/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>mosvgpe_model_from_config, parse_mixture_of_svgp_experts_model
from .toml_config_parsers.training_parsers import train_from_config_and_dataset, train_from_config_and_checkpoint<|fim_prefix|># repo: MoECollections/mogpe path: /mogpe/training/__init__.py
#!/usr/bin/env python3
from .training_loops import t... | code_fim | medium | {
"lang": "python",
"repo": "MoECollections/mogpe",
"path": "/mogpe/training/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MoECollections/mogpe path: /mogpe/training/__init__.py
#!/usr/bin/env python3
from .training_loops import training_tf_loop, monitored_training_<|fim_suffix|>mosvgpe_model_from_config, parse_mixture_of_svgp_experts_model
from .toml_config_parsers.training_parsers import train_from_config_and_datas... | code_fim | medium | {
"lang": "python",
"repo": "MoECollections/mogpe",
"path": "/mogpe/training/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prophile/jacquard path: /jacquard/buckets/__init__.py
"""System for partitioning users into buckets."""
<|fim_suffix|>__all__ = (
"user_bucket",
"NUM_BUCKETS",
"Bucket",
"release",
"close",
"NotEnoughBucketsException",
)<|fim_middle|>from jacquard.buckets.models import Bu... | code_fim | hard | {
"lang": "python",
"repo": "prophile/jacquard",
"path": "/jacquard/buckets/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = (
"user_bucket",
"NUM_BUCKETS",
"Bucket",
"release",
"close",
"NotEnoughBucketsException",
)<|fim_prefix|># repo: prophile/jacquard path: /jacquard/buckets/__init__.py
"""System for partitioning users into buckets."""
<|fim_middle|>from jacquard.buckets.models import Bu... | code_fim | hard | {
"lang": "python",
"repo": "prophile/jacquard",
"path": "/jacquard/buckets/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeotrekCE/Geotrek-admin path: /geotrek/trekking/migrations/0044_auto_20230406_1426.py
# Generated by Django 3.2.18 on 2023-04-06 14:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cirkwi', '0003... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/trekking/migrations/0044_auto_20230406_1426.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ls.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='trekking.ratingscale', verbose_name='Scale'),
),
migrations.AlterField(
model_name='ratingscale',
name='practice',
field=models.ForeignKey(on_delete=django.db.models.d... | code_fim | hard | {
"lang": "python",
"repo": "GeotrekCE/Geotrek-admin",
"path": "/geotrek/trekking/migrations/0044_auto_20230406_1426.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sainatarajan/deepquantiles path: /deepquantiles/regressors/multiquantile.py
import numpy as np
from keras.layers import Dense, Input
from keras.models import Model
from keras.optimizers import Adam
from sklearn.base import BaseEstimator
from .losses import keras_quantile_loss
class MultiQuanti... | code_fim | hard | {
"lang": "python",
"repo": "sainatarajan/deepquantiles",
"path": "/deepquantiles/regressors/multiquantile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._model_instance or self._init_model()
def fit(self, X, y, **kwargs):
self._init_model()
y = [y for _ in self.quantiles]
fit_kwargs = dict(
epochs=self.epochs,
batch_size=self.batch_size,
)
fit_kwargs.update(kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "sainatarajan/deepquantiles",
"path": "/deepquantiles/regressors/multiquantile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.hstack(self.model.predict(X, **predict_kwargs)).reshape(X.shape[0], -1)
def sample(self, X, num_samples=10, **kwargs):
predict_kwargs = dict(batch_size=self.batch_size, )
predict_kwargs.update(kwargs)
quantiles = self.quantiles
predictions = self.pre... | code_fim | hard | {
"lang": "python",
"repo": "sainatarajan/deepquantiles",
"path": "/deepquantiles/regressors/multiquantile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def grouped(self, keys, vals, groupFn):
'''Group input data by population
Args:
keys : IO object entity keys
vals : Predictions from the value network
groupFn : Entity key -> population hash... | code_fim | hard | {
"lang": "python",
"repo": "jarbus/neural-mmo",
"path": "/projekt/ann.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jarbus/neural-mmo path: /projekt/ann.py
'''Policy submodules and a baseline agent.'''
from pdb import set_trace as T
import time
import numpy as np
from collections import defaultdict
import torch
from torch import nn
from forge import trinity
from forge.ethyr.torch import policy
from forge.e... | code_fim | hard | {
"lang": "python",
"repo": "jarbus/neural-mmo",
"path": "/projekt/ann.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> values = torch.zeros(
(packet.obs.n, 1),
device=self.device)
#Per-population policies rearranged in input order
for pop in groups:
idxs, s = groups[pop]
h, v = self.policy[pop](s)
hidden[idxs] = h
values[idxs] = v
... | code_fim | hard | {
"lang": "python",
"repo": "jarbus/neural-mmo",
"path": "/projekt/ann.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: derekpowell/probjudge path: /model_helpers.py
import jax.numpy as jnp
import numpy as np
import arviz as az
### ------ Data processing
def make_model_data(data):
X_data = {
"trial": data.querytype,
"subj": jnp.array(data.ID, dtype="int32"),
"cond": jnp.array(data.con... | code_fim | hard | {
"lang": "python",
"repo": "derekpowell/probjudge",
"path": "/model_helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def count_divergences(model_data):
return np.sum(model_data.sample_stats.diverging.values)
### ---- plotting
def plot_model_preds(orig_data, model_data):
from matplotlib import pyplot as plt
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
axes[0].set_xlim(0,1)
axes[1].set_xlim(0,1... | code_fim | hard | {
"lang": "python",
"repo": "derekpowell/probjudge",
"path": "/model_helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def regplot():
text = """
<b>Regression plot</b>
`bioinfokit.visuz.stat.regplot(df, x, y, yhat, dim, colordot, colorline, r, ar, dotsize, markerdot, linewidth,
valphaline, valphadot)`
Parameters:
... | code_fim | hard | {
"lang": "python",
"repo": "reneshbedre/bioinfokit",
"path": "/bioinfokit/help.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reneshbedre/bioinfokit path: /bioinfokit/help.py
class format:
def __init__(self):
pass
@staticmethod
def fq_qual_var():
text = """
<b>FASTQ quality format detection</b>
`bioinfokit.analys.format.fq_qual_var(file)`
... | code_fim | hard | {
"lang": "python",
"repo": "reneshbedre/bioinfokit",
"path": "/bioinfokit/help.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('core', '0010_auto_20170728_0637'),
]
operations = [
migrations.RemoveField(
model_name='scout',
name='ano',
),
migrations.AddField(
model_name='scout',
name='partida',
field=models.... | code_fim | medium | {
"lang": "python",
"repo": "schiller/cartolafc",
"path": "/core/migrations/0011_auto_20170802_1157.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schiller/cartolafc path: /core/migrations/0011_auto_20170802_1157.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-02 11:57
from __future__ import unicode_literals
<|fim_suffix|>
dependencies = [
('core', '0010_auto_20170728_0637'),
]
operations = [
... | code_fim | medium | {
"lang": "python",
"repo": "schiller/cartolafc",
"path": "/core/migrations/0011_auto_20170802_1157.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheHalfling/Py3ArcadeGameClass path: /loopyLab.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 5 23:17:29 2018
@author: Sherry
Lab 6: Loopy Lab
"""
#Part 1
#Create a number pyramid
"""
for i in range(10, 55):
for j in range(10, i, 1 ):
print (j, end = "\t")... | code_fim | hard | {
"lang": "python",
"repo": "TheHalfling/Py3ArcadeGameClass",
"path": "/loopyLab.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #set width and height of the screen
size = (700, 500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Grid")
#loop until the user clicks the close button
done = False
#used to manage how fast the screen udpates
clock = pygame.time... | code_fim | hard | {
"lang": "python",
"repo": "TheHalfling/Py3ArcadeGameClass",
"path": "/loopyLab.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vehxianfish/Multi-Object-Tracking-for-Automotive-Systems-in-python path: /src/mot/utils/visualizer/common/plot_series.py
import logging
from functools import singledispatch
import colorcet
import numpy as np
from matplotlib.lines import Line2D
from mot.common.state import Gaussian
from mot.simu... | code_fim | hard | {
"lang": "python",
"repo": "vehxianfish/Multi-Object-Tracking-for-Automotive-Systems-in-python",
"path": "/src/mot/utils/visualizer/common/plot_series.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError
@plot_series.register(ObjectData)
def _plot_series(series: ObjectData, ax, *args, **kwargs):
for timestep in range(len(series)):
objects_in_scene = series[timestep]
for object_id in objects_in_scene.keys():
state = objects_in_scene[object_id]... | code_fim | hard | {
"lang": "python",
"repo": "vehxianfish/Multi-Object-Tracking-for-Automotive-Systems-in-python",
"path": "/src/mot/utils/visualizer/common/plot_series.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 没有中枢的情况
if first_central is None and last_central is None:
kind = "最强单边走势"
# 一个中枢的情况(平衡市)
elif (first_central is None and last_central) or (first_central and last_central is None):
max_p = max(data.iloc[:3, :]['high'])
min_p = min(data.iloc[:3, :]['low'])
... | code_fim | hard | {
"lang": "python",
"repo": "metaidme/chan",
"path": "/chan/a/daily_classfier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metaidme/chan path: /chan/a/daily_classfier.py
# coding: utf-8
from datetime import datetime, timedelta
import tushare as ts
def daily_classifier(ts_code, trade_date, asset='E', return_central=False):
""" A 股每日走势的分类
asset 交易资产类型,可选值 E股票 I沪深指数
使用该方法前,请仔细阅读:http://blog.sina.com.cn/... | code_fim | hard | {
"lang": "python",
"repo": "metaidme/chan",
"path": "/chan/a/daily_classfier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eroicaleo/LearningPython path: /ch30/iadd.py
#!/usr/bin/env python
class Number:
<|fim_suffix|>x = Number(5)
x += 1
x += 1
print(x.val)
y = Number([1])
y += [2]
y += [3]
print(y.val)<|fim_middle|> def __init__(self, val):
self.val = val
def __iadd__(self, other):
self.val... | code_fim | medium | {
"lang": "python",
"repo": "eroicaleo/LearningPython",
"path": "/ch30/iadd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = Number(5)
x += 1
x += 1
print(x.val)
y = Number([1])
y += [2]
y += [3]
print(y.val)<|fim_prefix|># repo: eroicaleo/LearningPython path: /ch30/iadd.py
#!/usr/bin/env python
class Number:
<|fim_middle|> def __init__(self, val):
self.val = val
def __iadd__(self, other):
self.val... | code_fim | medium | {
"lang": "python",
"repo": "eroicaleo/LearningPython",
"path": "/ch30/iadd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>y = Number([1])
y += [2]
y += [3]
print(y.val)<|fim_prefix|># repo: eroicaleo/LearningPython path: /ch30/iadd.py
#!/usr/bin/env python
class Number:
def __init__(self, val):
self.val = val
def __iadd__(self, other):
self.val += other
return self
<|fim_middle|>x = Number(... | code_fim | easy | {
"lang": "python",
"repo": "eroicaleo/LearningPython",
"path": "/ch30/iadd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_last_route_type() -> None:
assert isinstance(ROUTES[-1], Route)
def test_app() -> None:
assert isinstance(api_app, App)<|fim_prefix|># repo: vyahello/fake-vehicles-api path: /tests/unittest/test_app.py
from apistar import Route, App
from api.app import ROUTES, api_app
def test_count_... | code_fim | medium | {
"lang": "python",
"repo": "vyahello/fake-vehicles-api",
"path": "/tests/unittest/test_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert len(ROUTES) == 7
def test_first_route_type() -> None:
assert isinstance(ROUTES[0], Route)
def test_last_route_type() -> None:
assert isinstance(ROUTES[-1], Route)
def test_app() -> None:
assert isinstance(api_app, App)<|fim_prefix|># repo: vyahello/fake-vehicles-api path: /te... | code_fim | easy | {
"lang": "python",
"repo": "vyahello/fake-vehicles-api",
"path": "/tests/unittest/test_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vyahello/fake-vehicles-api path: /tests/unittest/test_app.py
from apistar import Route, App
from api.app import ROUTES, api_app
def test_count_routes() -> None:
assert len(ROUTES) == 7
<|fim_suffix|>def test_last_route_type() -> None:
assert isinstance(ROUTES[-1], Route)
def test_ap... | code_fim | medium | {
"lang": "python",
"repo": "vyahello/fake-vehicles-api",
"path": "/tests/unittest/test_app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Garinmckayl/researchhub-backend path: /src/discussion/migrations/0020_auto_20200224_2002.py
# Generated by Django 2.2.10 on 2020-02-24 20:02
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='thread',
name='title',
field=models.CharFie... | code_fim | medium | {
"lang": "python",
"repo": "Garinmckayl/researchhub-backend",
"path": "/src/discussion/migrations/0020_auto_20200224_2002.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('discussion', '0019_auto_20200213_2326'),
]
operations = [
migrations.AlterField(
model_name='thread',
name='title',
field=models.CharField(blank=True, max_length=255, null=True),
... | code_fim | easy | {
"lang": "python",
"repo": "Garinmckayl/researchhub-backend",
"path": "/src/discussion/migrations/0020_auto_20200224_2002.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sawarabhattarai5/lingomingo path: /lingomingo/application/django/mainapp/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('profile/<uuid:profile_uuid>/', views.profile, name='profile'),
path('profile/edit/', views.pro... | code_fim | medium | {
"lang": "python",
"repo": "sawarabhattarai5/lingomingo",
"path": "/lingomingo/application/django/mainapp/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>me='edit_profile'),
path('register/', views.register, name='register'),
path('settings/', views.settings, name='settings'),
path('friends/', views.friends, name='friends'),
path('setup/', views.setup, name='setup'),
]<|fim_prefix|># repo: sawarabhattarai5/lingomingo path: /lingomingo/appl... | code_fim | medium | {
"lang": "python",
"repo": "sawarabhattarai5/lingomingo",
"path": "/lingomingo/application/django/mainapp/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>me='settings'),
path('friends/', views.friends, name='friends'),
path('setup/', views.setup, name='setup'),
]<|fim_prefix|># repo: sawarabhattarai5/lingomingo path: /lingomingo/application/django/mainapp/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views... | code_fim | medium | {
"lang": "python",
"repo": "sawarabhattarai5/lingomingo",
"path": "/lingomingo/application/django/mainapp/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wups101/alss-dev path: /src/logs/api/views.py
import json
import logging
from django.http import JsonResponse
from django.contrib.contenttypes.models import ContentType
from rest_framework.response import Response
from rest_framework import (
viewsets,
status,
)
from rest_framework.generi... | code_fim | hard | {
"lang": "python",
"repo": "wups101/alss-dev",
"path": "/src/logs/api/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ReviewLogUpdateAPIView(UpdateAPIView):
queryset = ReviewLog.objects.all()
serializer_class = ReviewLogUpdateSerializer
permission_classes = [IsAuthenticated]
def get_object(self, user, object_id, content_type):
return ReviewLog.objects.filter(user=user, object_id=object_id, ... | code_fim | hard | {
"lang": "python",
"repo": "wups101/alss-dev",
"path": "/src/logs/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Push tags if enabled
if push_tags:
run('git push origin master --tags')
else:
print("Don't forget to push the tags (git push origin master --tags)!")
# Warn the user when not using virtualenv
if not hasattr(sys, 'real_prefix'):
print('YOU ARE NOT RUNNING INSIDE A VIRTUAL... | code_fim | hard | {
"lang": "python",
"repo": "raphiz/seriesbutler",
"path": "/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Are you sure to release?
try:
input("Is everything commited? Are you ready to release? "
"Press any key to continue - abort with Ctrl+C")
except KeyboardInterrupt as e:
print("Release aborted...")
exit()
run('bumpversion --message "Release version {... | code_fim | hard | {
"lang": "python",
"repo": "raphiz/seriesbutler",
"path": "/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raphiz/seriesbutler path: /tasks.py
#!/usr/bin/env python
# coding=utf-8
import sys
from invoke import run, task
from invoke.util import log
@task
def test(debug=False):
flags = ''
if debug:
flags = '-s -v'
<|fim_suffix|>@task
def clean():
run('find . -name *.pyc -not -pat... | code_fim | medium | {
"lang": "python",
"repo": "raphiz/seriesbutler",
"path": "/tasks.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.