text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: cmeng94/dog-breed-classifier path: /app/dog_classifier.py
import sys
import cv2
import numpy as np
from tqdm import tqdm
from keras.models import Sequential
from keras.layers import Dropout, Flatten, Dense
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D, GlobalMaxPooling2D
... | code_fim | hard | {
"lang": "python",
"repo": "cmeng94/dog-breed-classifier",
"path": "/app/dog_classifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Attributes
ATTR_IDENTIFIERS = "identifiers"
ATTR_MANUFACTURER = "manufacturer"
ATTR_MODEL = "model"
ATTR_ON = "on"
ATTR_SOFTWARE_VERSION = "sw_version"
ATTR_TEMPERATURE = "temperature"
CONF_SERIAL_NUMBER = "serial_number"<|fim_prefix|># repo: tchellomello/home-assistant path: /homeassistant/components... | code_fim | medium | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/elgato/const.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tchellomello/home-assistant path: /homeassistant/components/elgato/const.py
"""Constants for the Elgato Key Light integration."""
<|fim_suffix|># Attributes
ATTR_IDENTIFIERS = "identifiers"
ATTR_MANUFACTURER = "manufacturer"
ATTR_MODEL = "model"
ATTR_ON = "on"
ATTR_SOFTWARE_VERSION = "sw_version... | code_fim | medium | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/elgato/const.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Home Assistant data keys
DATA_ELGATO_CLIENT = "elgato_client"
# Attributes
ATTR_IDENTIFIERS = "identifiers"
ATTR_MANUFACTURER = "manufacturer"
ATTR_MODEL = "model"
ATTR_ON = "on"
ATTR_SOFTWARE_VERSION = "sw_version"
ATTR_TEMPERATURE = "temperature"
CONF_SERIAL_NUMBER = "serial_number"<|fim_prefix|># r... | code_fim | easy | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/elgato/const.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juancsosap/yangtraining path: /tools/ydk-py-master/cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sdr_invmgr_oper.py
**default value**\: 0
"""
_prefix = 'sdr-invmgr-oper'
... | code_fim | hard | {
"lang": "python",
"repo": "juancsosap/yangtraining",
"path": "/tools/ydk-py-master/cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sdr_invmgr_oper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_segment_path(self):
path_buffer = ""
path_buffer = "attributes" + path_buffer
return path_buffer
def get_entity_path(self, ancestor):
pa... | code_fim | hard | {
"lang": "python",
"repo": "juancsosap/yangtraining",
"path": "/tools/ydk-py-master/cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sdr_invmgr_oper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aveek22/tutorialspoint path: /apache-airflow/materials/data-pipelines-with-apache-airflow-master/chapters/chapter11/images/movielens-api/app.py
import datetime as dt
import os
import time
import numpy as np
import pandas as pd
from flask import Flask, jsonify, request
from flask_httpauth import... | code_fim | hard | {
"lang": "python",
"repo": "aveek22/tutorialspoint",
"path": "/apache-airflow/materials/data-pipelines-with-apache-airflow-master/chapters/chapter11/images/movielens-api/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ratings_df = app.config.get("ratings")
if start_date_ts:
ratings_df = ratings_df.loc[ratings_df["timestamp"] >= start_date_ts]
if end_date_ts:
ratings_df = ratings_df.loc[ratings_df["timestamp"] < end_date_ts]
subset = ratings_df.iloc[offset : offset + limit]
return... | code_fim | hard | {
"lang": "python",
"repo": "aveek22/tutorialspoint",
"path": "/apache-airflow/materials/data-pipelines-with-apache-airflow-master/chapters/chapter11/images/movielens-api/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
'<(EXTERNS_GYP):file_manager_private',
'volume_manager_wrapper',
],
'includes': ['../../../compile_js2.gypi'],
},
{
'target_name': 'quick_view_controller',
'dependencies': [
... | code_fim | hard | {
"lang": "python",
"repo": "vade/chromium",
"path": "/ui/file_manager/file_manager/foreground/js/compiled_resources2.gyp",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vade/chromium path: /ui/file_manager/file_manager/foreground/js/compiled_resources2.gyp
_model',
'file_selection',
'launch_param',
'metadata/compiled_resources2.gyp:metadata_model',
'naming_controller',
'ui/compiled_resources2.gyp:dialog_footer',
'v... | code_fim | hard | {
"lang": "python",
"repo": "vade/chromium",
"path": "/ui/file_manager/file_manager/foreground/js/compiled_resources2.gyp",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>:list_selection_model',
'dialog_type',
'file_selection',
'metadata/compiled_resources2.gyp:metadata_model',
'metadata_box_controller',
'quick_view_model',
'quick_view_uma',
'task_controller',
'ui/compiled_resources2.gyp:list_container',
... | code_fim | hard | {
"lang": "python",
"repo": "vade/chromium",
"path": "/ui/file_manager/file_manager/foreground/js/compiled_resources2.gyp",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: athenarc/EOSCF-UserProfile path: /api/user/crud/user_info.py
import logging
from api.utils import form_mongo_url
from pymongo import MongoClient
<|fim_suffix|>
def update_user_information(record):
client = MongoClient(form_mongo_url())
_ = client['user_profile']['user'].update_one(
... | code_fim | easy | {
"lang": "python",
"repo": "athenarc/EOSCF-UserProfile",
"path": "/api/user/crud/user_info.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def update_user_information(record):
client = MongoClient(form_mongo_url())
_ = client['user_profile']['user'].update_one(
{"user_id": record['id']},
{'$push': {
'scientific_domains': record['scientific_domains'],
'categories': record['categories']
... | code_fim | easy | {
"lang": "python",
"repo": "athenarc/EOSCF-UserProfile",
"path": "/api/user/crud/user_info.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, user_id, app_key, permission):
self.user_id = user_id
self.app_key = app_key
self.permission = permission<|fim_prefix|># repo: nrudenko/anarcho path: /anarchoApp/anarcho/models/user_app.py
from anarcho import db
from sqlalchemy import Column, Integer, String... | code_fim | hard | {
"lang": "python",
"repo": "nrudenko/anarcho",
"path": "/anarchoApp/anarcho/models/user_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nrudenko/anarcho path: /anarchoApp/anarcho/models/user_app.py
from anarcho import db
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship, backref
<|fim_suffix|> self.user_id = user_id
self.app_key = app_key
self.permission = p... | code_fim | hard | {
"lang": "python",
"repo": "nrudenko/anarcho",
"path": "/anarchoApp/anarcho/models/user_app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.user_id = user_id
self.app_key = app_key
self.permission = permission<|fim_prefix|># repo: nrudenko/anarcho path: /anarchoApp/anarcho/models/user_app.py
from anarcho import db
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship, ... | code_fim | hard | {
"lang": "python",
"repo": "nrudenko/anarcho",
"path": "/anarchoApp/anarcho/models/user_app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karlvr/Serrano path: /scripts/coverage_process.py
"""
Process coverage data path
"""
BUILD_DIR = ""
with open('.cov/build-settings.txt', 'r') as in_file:
for line in in_file:
<|fim_suffix|>ip('\n').split('=')[-1].strip()
print(raw_dir)
BUILD_DIR =<|fim_middle|> if 'PROJECT_TEMP_ROOT =' i... | code_fim | medium | {
"lang": "python",
"repo": "karlvr/Serrano",
"path": "/scripts/coverage_process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'PROJECT_TEMP_ROOT =' in line:
raw_dir = line.strip().strip('\n').split('=')[-1].strip()
print(raw_dir)
BUILD_DIR =<|fim_prefix|># repo: karlvr/Serrano path: /scripts/coverage_process.py
"""
Process coverage data path
"""
BUILD_DIR = ""
with open('.c<|fim_middle|>ov/build-settings.txt', 'r'... | code_fim | medium | {
"lang": "python",
"repo": "karlvr/Serrano",
"path": "/scripts/coverage_process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for x in range(11):
limit = 2**x # less than this.
g = getRange(x)
# initial("projects", g)
# this is wrong.
g0 = [(x, a, b, 0) for a, b in g]
initial("projects", g0)
g1 = [(x, a, b, 1) for a, b in g if a+1 < limit]
initial("projects", g1)
g2 = [(x, a, b, 2) for a, b i... | code_fim | medium | {
"lang": "python",
"repo": "Trixter9994/lazero",
"path": "/bootstrap/legacy/concentration/old_toys/internet_maps/configure2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Trixter9994/lazero path: /bootstrap/legacy/concentration/old_toys/internet_maps/configure2.py
from dbM2 import createMain, initial
from basepak import getRange
# format is png.
createMain()
<|fim_suffix|>for x in range(11):
limit = 2**x # less than this.
g = getRange(x)
# initial(... | code_fim | medium | {
"lang": "python",
"repo": "Trixter9994/lazero",
"path": "/bootstrap/legacy/concentration/old_toys/internet_maps/configure2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mathieulagrange/censeConfy path: /utils.py
import numpy as np
import os
import csv
from pyproj import Proj, transform
import math
import dateutil.parser
from datetime import datetime
def gps2merc(lat, lon):
r_major = 6378137.000
x = r_major * math.radians(lon)
scale = x/lon
y = 1... | code_fim | hard | {
"lang": "python",
"repo": "mathieulagrange/censeConfy",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_simple(X, batch_size=1):
model = ActPredCNN()
model = torch.load('model_2019-02-21_16-12-30.pt')
nEx = int(np.floor(X.shape[0]/8))
# TODO Batches
Xb = torch.zeros((batch_size, 1, 8, 29))
T
for iEx in range(nEx):
Xb[0, 0, :, :] = torch.from_numpy(X[iEx*8:(iEx+1)... | code_fim | hard | {
"lang": "python",
"repo": "mathieulagrange/censeConfy",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> event: models.ForeignKey = models.ForeignKey("Event", on_delete=models.CASCADE, null=True, blank=True)
order: models.IntegerField = models.IntegerField(null=True, blank=True)
group: models.ForeignKey = models.ForeignKey("ElementGroup", on_delete=models.CASCADE, null=True, blank=True)<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "abhijitghate/posthog",
"path": "/posthog/models/element.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abhijitghate/posthog path: /posthog/models/element.py
from django.contrib.postgres.fields import ArrayField
from django.db import models
class Element(models.Model):
USEFUL_ELEMENTS = ["a", "button", "input", "select", "textarea", "label"]
text: models.CharField = models.CharField(max_l... | code_fim | hard | {
"lang": "python",
"repo": "abhijitghate/posthog",
"path": "/posthog/models/element.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kose-y/dist-primal-dual path: /examples/latent_group_lasso_run.py
import os
import dist_pd.losses
import dist_pd.penalties
import dist_pd.split_22
import dist_pd.distmat
import dist_pd.utils
import dist_pd.partitioners
import numpy as np
from scipy.sparse import dia_matrix
import scipy.io
import... | code_fim | hard | {
"lang": "python",
"repo": "kose-y/dist-primal-dual",
"path": "/examples/latent_group_lasso_run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess:
for param, kappa, expr_name in zip(params, kappas, expr_names):
tau, sigma, rho = param
prob = dist_pd.split_22.BaseKappa(loss, penalty1, penalty2, At, D_dist, b, aggregate=not args.nonergodic,
t... | code_fim | hard | {
"lang": "python",
"repo": "kose-y/dist-primal-dual",
"path": "/examples/latent_group_lasso_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> time.sleep(0.025) # adjust to change scrolling speed
x = display.width
def Score(text, color, ring_color, repeat):
"""Show a scrolling text message and animated effects on the eye rings.
The messages scrolls left to right, then right to left while the eye rings
are animat... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_Learning_System_Guides",
"path": "/IS31FL3741_DisplayIO/sports_glasses/code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adafruit/Adafruit_Learning_System_Guides path: /IS31FL3741_DisplayIO/sports_glasses/code.py
# SPDX-FileCopyrightText: 2022 Mark Komus
#
# SPDX-License-Identifier: MIT
import random
import time
import board
import busio
import digitalio
import displayio
import framebufferio
import is31fl3741
from... | code_fim | hard | {
"lang": "python",
"repo": "adafruit/Adafruit_Learning_System_Guides",
"path": "/IS31FL3741_DisplayIO/sports_glasses/code.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def delete(self, element):
(index, bit) = getIndex(element)
self.vector[index] &= ~bit
def contains(self, element):
(index, bit) = getIndex(element)
return (self.vector[index] & bit) > 0
def errorAdd(self, element):
if (element > self.capacity):
raise IndexError(str(element) + ... | code_fim | medium | {
"lang": "python",
"repo": "HanielB/2021.1-lp",
"path": "/_lessons/09-adts/src/set.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HanielB/2021.1-lp path: /_lessons/09-adts/src/set.py
INT_BITS = 32
def getIndex(element):
index = int(element / INT_BITS)
offset = element % INT_BITS
bit = 1 << offset
return (index, bit)
class Set:
def __init__(self, capacity):
self.vector = [0] * (1 + int(capacity / INT_BITS))
... | code_fim | medium | {
"lang": "python",
"repo": "HanielB/2021.1-lp",
"path": "/_lessons/09-adts/src/set.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IliesChibane/H4ckT0b3rF3st-2k21 path: /projects/tic_tac_toe/src/base_game.py
from src.exceptions import AlreadySelectedError
class Board:
def __init__(self):
self.turn = "O"
self._board = {
(1,1) : None,
(1,2) : None,
(1,3) : None,
... | code_fim | hard | {
"lang": "python",
"repo": "IliesChibane/H4ckT0b3rF3st-2k21",
"path": "/projects/tic_tac_toe/src/base_game.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for combinaison in self._win_combinaisons:
value = self.check_combinaison(combinaison)
if value != False:
return value, combinaison
return False
def check_combinaison(self, combinaison):
if self._board[combinaison[0]] == None:
... | code_fim | hard | {
"lang": "python",
"repo": "IliesChibane/H4ckT0b3rF3st-2k21",
"path": "/projects/tic_tac_toe/src/base_game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._board[index]
def __setitem__(self, index, value):
if index[0] > 3 or index[1] > 3 or index[0] < 1 or index[1] < 1:
raise IndexError("")
if value != "O" and value != "X":
raise ValueError("")
if self._board[index] != None:
... | code_fim | hard | {
"lang": "python",
"repo": "IliesChibane/H4ckT0b3rF3st-2k21",
"path": "/projects/tic_tac_toe/src/base_game.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> updates = (
({'a':'a'}, {'a':'b'}),
({'a':'a'}, {'b':'a'}),
)
for dict_sequence in updates:
i = injective_dict()
try:
for d in dict_sequence:
for k, v in d.items():
i[k] = v... | code_fim | hard | {
"lang": "python",
"repo": "MCSZ/pyontutils",
"path": "/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for dict_sequence in updates:
i = injective_dict()
try:
for d in dict_sequence:
for k, v in d.items():
i[k] = v
else:
raise AssertionError(f'test for {bad} should have failed')
... | code_fim | hard | {
"lang": "python",
"repo": "MCSZ/pyontutils",
"path": "/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MCSZ/pyontutils path: /test/test_utils.py
import unittest
from pyontutils.utils import injective_dict, Async, deferred
class TestInjectiveDict(unittest.TestCase):
def setUp(self):
self.test_funcs = (
lambda d: injective_dict(d),
lambda d: injective_dict(**d),... | code_fim | hard | {
"lang": "python",
"repo": "MCSZ/pyontutils",
"path": "/test/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UnkL4b/aioquic path: /stubs/cryptography/hazmat/primitives/ciphers/__init__.pyi
from typing import Union
from cryptography.hazmat.backends.interfaces import CipherBackend
from cryptography.hazmat.primitives.ciphers.modes import Mode
<|fim_suffix|>
class Cipher:
def __init__(
self, a... | code_fim | hard | {
"lang": "python",
"repo": "UnkL4b/aioquic",
"path": "/stubs/cryptography/hazmat/primitives/ciphers/__init__.pyi",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Cipher:
def __init__(
self, algorithm: CipherAlgorithm, mode: Mode, backend: CipherBackend
): ...
def decryptor(self) -> CipherContext: ...
def encryptor(self) -> CipherContext: ...<|fim_prefix|># repo: UnkL4b/aioquic path: /stubs/cryptography/hazmat/primitives/ciphers/__in... | code_fim | medium | {
"lang": "python",
"repo": "UnkL4b/aioquic",
"path": "/stubs/cryptography/hazmat/primitives/ciphers/__init__.pyi",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> str_arr = ["%20s comm %10.6f" % (f,totalmpi)]
for time,fxn in maxd:
str_arr.append("%13s=%6.4f" % (fxn,time))
sys.std.out.write("%s\n" % " ".join(str_arr))
str_arr = ["%20s comp %10.6f" % (f,totalcomp)]
for time,fxn in maxc:
str_arr.append(" %25s=%6.4f" % (fxn,time))
sys.std.out.write... | code_fim | hard | {
"lang": "python",
"repo": "deanchester/sst-macro",
"path": "/bin/tools/dumpibreakdown",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deanchester/sst-macro path: /bin/tools/dumpibreakdown
#! /usr/bin/env python
import glob
import os
from configlib import getoutput
def run(f):
import re
import sys
text = getoutput("dumpi2ascii %s" % f)
<|fim_suffix|> str_arr = ["%20s comm %10.6f" % (f,totalmpi)]
for time,fxn in maxd... | code_fim | hard | {
"lang": "python",
"repo": "deanchester/sst-macro",
"path": "/bin/tools/dumpibreakdown",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> hypothesis_corpus = HypothesisSet.load_corpus(args.hypothesis_file, args.eos)
reference_corpus = ReferenceSet.load_json_corpus(args.reference_file)
score = compute_score_on_corpus(hypothesis_corpus, reference_corpus)
print('MaxBLEU: %f' % score.max_bleu)
print('MDS: %f' % score.mds)
... | code_fim | hard | {
"lang": "python",
"repo": "neural-dialogue-metrics/LSDSCC",
"path": "/bin/lsdscc_metrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neural-dialogue-metrics/LSDSCC path: /bin/lsdscc_metrics.py
# MIT License
#
# Copyright (c) 2019 Cong Feng.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without ... | code_fim | hard | {
"lang": "python",
"repo": "neural-dialogue-metrics/LSDSCC",
"path": "/bin/lsdscc_metrics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkgcore/pkgcheck path: /tests/test_cli.py
import textwrap
import pytest
from pkgcheck import cli
from snakeoil.cli import arghparse
class TestConfigFileParser:
@pytest.fixture(autouse=True)
def _create_argparser(self, tmp_path):
self.config_file = str(tmp_path / "config")
... | code_fim | hard | {
"lang": "python",
"repo": "pkgcore/pkgcheck",
"path": "/tests/test_cli.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # checksets section with entries including empty set
with open(self.config_file, "w") as f:
f.write(
textwrap.dedent(
"""
[CHECKSETS]
set1=keyword
set2=check,-keyword
... | code_fim | hard | {
"lang": "python",
"repo": "pkgcore/pkgcheck",
"path": "/tests/test_cli.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>**!!!!!!!!!!Important Notes!!!!!!!!!!**
To open the folder "hw4_test" or load other related files,
please use open('./necessary.file') instead of open('some/randomly/local/directory/necessary.file').
For instance, in the student Jupyter's local computer, he stores the source code like:
-... | code_fim | hard | {
"lang": "python",
"repo": "JiajunWan/cs165b_hw4_clothing_classification",
"path": "/prediction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JiajunWan/cs165b_hw4_clothing_classification path: /prediction.py
# Starter code for CS 165B HW4
"""
Implement the testing procedure here.
Inputs:
Unzip the hw4_test.zip and place the folder named "hw4_test" in the same directory of your "prediction.py" file, your "prediction.py" need to g... | code_fim | hard | {
"lang": "python",
"repo": "JiajunWan/cs165b_hw4_clothing_classification",
"path": "/prediction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> For instance, in the student Jupyter's local computer, he stores the source code like:
- /Jupyter/Desktop/cs165B/hw4/prediction.py
- /Jupyter/Desktop/cs165B/hw4/hw4_test
If he/she use os.chdir('/Jupyter/Desktop/cs165B/hw4/hw4_test'), this will cause an IO error
when the teaching staff... | code_fim | hard | {
"lang": "python",
"repo": "JiajunWan/cs165b_hw4_clothing_classification",
"path": "/prediction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> break
if is_found:
break
if not is_found:
print(f'{combinations} combinations - neither equals {magic_num}')<|fim_prefix|># repo: Shadjistefanov/python-fundamentals path: /Sum_of_Two_numbers.py
first_space = int(input())
end_space = int(input())
magic_num = int(input())
combinations = 0
... | code_fim | hard | {
"lang": "python",
"repo": "Shadjistefanov/python-fundamentals",
"path": "/Sum_of_Two_numbers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shadjistefanov/python-fundamentals path: /Sum_of_Two_numbers.py
first_space = int(input())
end_space = int(input())
magic_num = int(input())
combinations = 0
is_found = False
for a in range<|fim_suffix|> break
if is_found:
break
if not is_found:
print(f'{combinations} combinations... | code_fim | hard | {
"lang": "python",
"repo": "Shadjistefanov/python-fundamentals",
"path": "/Sum_of_Two_numbers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richin13/nxt-scripts path: /src/tests/test_robot.py
from nxt.sensor import *
from nxt.motor import *
from scripts.helpers.robot import *
from time import sleep
import unittest
class TestRobot(unittest.TestCase):
def setUp(self):
if self.robot is not None:
print('Robot w... | code_fim | hard | {
"lang": "python",
"repo": "richin13/nxt-scripts",
"path": "/src/tests/test_robot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_spin_without_motors(self):
self.assertRaises(RobotError, self.robot.spin, 360)
def test_spin_with_motors(self):
self.robot.init_synchronized_motors(PORT_A, PORT_C)
self.robot.spin(360)<|fim_prefix|># repo: richin13/nxt-scripts path: /src/tests/test_robot.py
from ... | code_fim | hard | {
"lang": "python",
"repo": "richin13/nxt-scripts",
"path": "/src/tests/test_robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ not finished,
"""
# self.psg_data_path = os.path.join(self.db_dir, "polysomnography", "edfs")
# self.ann_path = os.path.join(self.db_dir, "datasets")
# self.hrv_ann_path = os.path.join(self.db_dir, "hrv-analysis")
# self.eeg_ann_path = os.path.join(self... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/nsrr_databases/oya.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_subject_id(self, rec:str) -> int:
"""
Attach a `subject_id` to the record, in order to facilitate further uses
Parameters
----------
rec: str,
record name
Returns
-------
int, a `subject_id` attached to the record `... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/nsrr_databases/oya.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenh06/database_reader path: /database_reader/nsrr_databases/oya.py
# -*- coding: utf-8 -*-
"""
docstring, to write
"""
import os
from datetime import datetime
from typing import Union, Optional, Any, List, Dict, Iterable, Sequence, NoReturn
from numbers import Real
import numpy as np
np.set_pri... | code_fim | hard | {
"lang": "python",
"repo": "wenh06/database_reader",
"path": "/database_reader/nsrr_databases/oya.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: c1c4/chatRoom-Backend path: /server/configuration/config.py
from os import path, environ
from dotenv import load_dotenv
base_dir = path.abspath(path.dirname(__name__))
load_dotenv(path.join(base_dir, '.env'))
<|fim_suffix|> SECRET_KEY = environ.get('SECRET_KEY')
SQLALCHEMY_DAT... | code_fim | medium | {
"lang": "python",
"repo": "c1c4/chatRoom-Backend",
"path": "/server/configuration/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Config:
SECRET_KEY = environ.get('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = environ.get("SQLALCHEMY_DATABASE_URI")
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False<|fim_prefix|># repo: c1c4/chatRoom-Backend path: /server/configuration/config.py
from os import path, ... | code_fim | medium | {
"lang": "python",
"repo": "c1c4/chatRoom-Backend",
"path": "/server/configuration/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> SQLALCHEMY_DATABASE_URI = environ.get("SQLALCHEMY_DATABASE_URI")
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False<|fim_prefix|># repo: c1c4/chatRoom-Backend path: /server/configuration/config.py
from os import path, environ
from dotenv import load_dotenv
<|fim_middle|>ba... | code_fim | hard | {
"lang": "python",
"repo": "c1c4/chatRoom-Backend",
"path": "/server/configuration/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path("polls/answers/", PollAnswer.as_view(), name="poll_answer"),
path("polls/answers/report/", AnswerReportList.as_view(), name="answer_report"),
]<|fim_prefix|># repo: vowatchka/fabrique_test_task path: /polls/urls.py
from django.urls import path
from .views import PollList, PollDetail, Questi... | code_fim | hard | {
"lang": "python",
"repo": "vowatchka/fabrique_test_task",
"path": "/polls/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vowatchka/fabrique_test_task path: /polls/urls.py
from django.urls import path
from .views import PollList, PollDetail, QuestionList, QuestionDetail, ChoiceList, ChoiceDetail, PollAnswer, AnswerReportList
<|fim_suffix|> path("polls/answers/", PollAnswer.as_view(), name="poll_answer"),
p... | code_fim | hard | {
"lang": "python",
"repo": "vowatchka/fabrique_test_task",
"path": "/polls/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roman-kashitsyn/redmate path: /itest/__init__.py
import unittest
from mysqltest import MySqlMappingTest
<|fim_suffix|> test_cases = [MySqlMappingTest]
suite = unittest.TestSuite()
for test_case in test_cases:
suite.addTest(unittest.makeSuite(test_case))
return suite<|fim_m... | code_fim | easy | {
"lang": "python",
"repo": "roman-kashitsyn/redmate",
"path": "/itest/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> test_cases = [MySqlMappingTest]
suite = unittest.TestSuite()
for test_case in test_cases:
suite.addTest(unittest.makeSuite(test_case))
return suite<|fim_prefix|># repo: roman-kashitsyn/redmate path: /itest/__init__.py
import unittest
from mysqltest import MySqlMappingTest
<|fim_m... | code_fim | easy | {
"lang": "python",
"repo": "roman-kashitsyn/redmate",
"path": "/itest/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agurfinkel/brunch path: /brunch/new_db.py
#!/usr/bin/env python3
import sys
import sqlite3 as sql
class NewDb (object):
def __init__ (self):
self.name = 'new_db'
self.help = 'Create new sqlite database'
def create_num_table (self, db):
<|fim_suffix|> imp... | code_fim | hard | {
"lang": "python",
"repo": "agurfinkel/brunch",
"path": "/brunch/new_db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = ap.parse_args (argv)
return self.run (args)
def main ():
cmd = NewDb ()
return cmd.main (sys.argv[1:])
if __name__ == '__main__':
sys.exit (main ())<|fim_prefix|># repo: agurfinkel/brunch path: /brunch/new_db.py
#!/usr/bin/env python3
import sys
import sqlite3 as... | code_fim | medium | {
"lang": "python",
"repo": "agurfinkel/brunch",
"path": "/brunch/new_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def main (self, argv):
import argparse
ap = argparse.ArgumentParser (prog=self.name, description=self.help)
ap = self.mk_arg_parser (ap)
args = ap.parse_args (argv)
return self.run (args)
def main ():
cmd = NewDb ()
return cmd.main (sys.ar... | code_fim | hard | {
"lang": "python",
"repo": "agurfinkel/brunch",
"path": "/brunch/new_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pywirrarika/GPT-too-AMR2text path: /scripts/amr2txt/split_beams.py
import sys
import argparse
def argument_parsing():
# Argument hanlding
parser = argparse.ArgumentParser(
description='Splits output of beam decoding into individual files'
)
# jbinfo args
parser.add_... | code_fim | medium | {
"lang": "python",
"repo": "pywirrarika/GPT-too-AMR2text",
"path": "/scripts/amr2txt/split_beams.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # split into beam_size output files
out_files = [list() for _ in range(args.beam_size)]
for i, line in enumerate(text):
out_files[i % args.beam_size].append(line)
# write output files
for n, out_file in enumerate(out_files):
out_text = args.out_text.replace('%K', f'{n}... | code_fim | hard | {
"lang": "python",
"repo": "pywirrarika/GPT-too-AMR2text",
"path": "/scripts/amr2txt/split_beams.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: svn2github/pyquante path: /PyQuante/settings.py
'''
This module contains the settings related to PyQuante, useful to
selecting things as backends. In this way the settings can also be
modifed at runtime.
'''
import sys,logging
# Logging/verbosity
LoggingFilename = 'pyquante.log'
LoggingLevel = ... | code_fim | hard | {
"lang": "python",
"repo": "svn2github/pyquante",
"path": "/PyQuante/settings.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Density matrix purification stuff
DMPTolerance = 1e-7
DMPIterations = 100
DMPLanczosMinmaxIters = 8
# Math stuff
OrthogMethod = 'Chol'
NumericForceDx = 1e-6
NumericForceSym = True
SubspaceVirtualOrbs = 1
DavidsonEvecTolerance = 1e-6
DavidsonNormTolerance = 1e-10
JacobiSweeps = 100
JacobiTolerance = 1e-... | code_fim | hard | {
"lang": "python",
"repo": "svn2github/pyquante",
"path": "/PyQuante/settings.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nimadini/Teammate path: /handlers/about.py
__author__ = 'stanley'
import webapp2
from init import *
<|fim_suffix|> def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/about.html')
self.response.write(template.render())<|fim_middle|>class AboutHandler(webapp2... | code_fim | easy | {
"lang": "python",
"repo": "nimadini/Teammate",
"path": "/handlers/about.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nimadini/Teammate path: /handlers/about.py
__author__ = 'stanley'
import webapp2
<|fim_suffix|>
class AboutHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/about.html')
self.response.write(template.render())<|fim_middle|>fr... | code_fim | easy | {
"lang": "python",
"repo": "nimadini/Teammate",
"path": "/handlers/about.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AboutHandler(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('templates/about.html')
self.response.write(template.render())<|fim_prefix|># repo: nimadini/Teammate path: /handlers/about.py
__author__ = 'stanley'
import webapp2
<|fim_middle|>fr... | code_fim | easy | {
"lang": "python",
"repo": "nimadini/Teammate",
"path": "/handlers/about.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # -------------------------------------------------------------------------
# Preprocessing of label files
# -------------------------------------------------------------------------
# Get list of data and label files
images_list = sorted(glob.glob(args.images_regex))
# Setup outp... | code_fim | hard | {
"lang": "python",
"repo": "nasa-nccs-hpda/vhr-cloudmask",
"path": "/tools/validation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # open expected filename
label_filename = os.path.join(
args.labels_regex, f'{Path(image_filename).stem}_clouds.tif')
if not Path(label_filename).is_file():
label_filename = os.path.join(
args.labels_regex, f'{Path(image_filename).stem}.tif'... | code_fim | hard | {
"lang": "python",
"repo": "nasa-nccs-hpda/vhr-cloudmask",
"path": "/tools/validation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nasa-nccs-hpda/vhr-cloudmask path: /tools/validation.py
import os
import sys
import glob
import argparse
import numpy as np
import pandas as pd
import geopandas as gpd
import rasterio as rio
import rioxarray as rxr
from pathlib import Path
from sklearn.metrics import accuracy_score, jaccard_score... | code_fim | hard | {
"lang": "python",
"repo": "nasa-nccs-hpda/vhr-cloudmask",
"path": "/tools/validation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mapillary/OpenSfM path: /opensfm/test/test_matching.py
from typing import Any, Dict, List, Set, Tuple
import numpy as np
from opensfm import bow
from opensfm import config
from opensfm import matching
from opensfm import pairs_selection
from opensfm import pyfeatures
from opensfm.synthetic_data ... | code_fim | hard | {
"lang": "python",
"repo": "mapillary/OpenSfM",
"path": "/opensfm/test/test_matching.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_match_images(scene_synthetic) -> None:
reference = scene_synthetic.reconstruction
synthetic = synthetic_dataset.SyntheticDataSet(
reference,
scene_synthetic.exifs,
scene_synthetic.features,
scene_synthetic.tracks_manager,
)
# pyre-fixme[8]: Attribu... | code_fim | hard | {
"lang": "python",
"repo": "mapillary/OpenSfM",
"path": "/opensfm/test/test_matching.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def sparse_square_norm(A: SparseTensor, out: torch.Tensor) -> torch.Tensor:
"""Row-wise squared l2 norm of a sparse 2D matrix.
The operation is equivalent to squaring all elements of the matrix, and summing up the rows.
Parameters
----------
A : SparseTensor
The 2D matrix. S... | code_fim | hard | {
"lang": "python",
"repo": "Akatsuki96/falkon",
"path": "/falkon/sparse/sparse_ops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Akatsuki96/falkon path: /falkon/sparse/sparse_ops.py
from typing import Optional
import torch
from falkon.sparse.sparse_helpers import norm_sq, norm_
from falkon.sparse.sparse_tensor import SparseTensor
from falkon.utils.helpers import check_same_dtype
__all__ = ("sparse_matmul", "sparse_squar... | code_fim | hard | {
"lang": "python",
"repo": "Akatsuki96/falkon",
"path": "/falkon/sparse/sparse_ops.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Row-wise squared l2 norm of a sparse 2D matrix.
The operation is equivalent to squaring all elements of the matrix, and summing up the rows.
Parameters
----------
A : SparseTensor
The 2D matrix. Since we compute row-wise norms, the matrix must be in CSR format (for
... | code_fim | hard | {
"lang": "python",
"repo": "Akatsuki96/falkon",
"path": "/falkon/sparse/sparse_ops.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nautilus-audio/traumaDemo path: /test/test_traumaDemo.py
import unittest
import traumaDemo
class TestDemo(unittest.TestCase):
<|fim_suffix|> case1 = traumaDemo.readFiles(1)
self.assertEqual(case1, "Depression_male3_JB.wav")
def test_findFormants(self):
if __name__ == '... | code_fim | easy | {
"lang": "python",
"repo": "nautilus-audio/traumaDemo",
"path": "/test/test_traumaDemo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: nautilus-audio/traumaDemo path: /test/test_traumaDemo.py
import unittest
import traumaDemo
<|fim_middle|>class TestDemo(unittest.TestCase):
def test_readFiles(self):
case1 = traumaDemo.readFiles(1)
self.assertEqua... | code_fim | hard | {
"lang": "python",
"repo": "nautilus-audio/traumaDemo",
"path": "/test/test_traumaDemo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ssh-shashi/hyperparameter_hunter path: /hyperparameter_hunter/result_reader.py
##################################################
# Import Own Assets
##################################################
from hyperparameter_hunter.library_helpers.keras_helper import keras_callback_to_dict
from hyper... | code_fim | hard | {
"lang": "python",
"repo": "ssh-shashi/hyperparameter_hunter",
"path": "/hyperparameter_hunter/result_reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if location == ('model_init_params', 'compile_params', 'optimizer'):
from keras.optimizers import get as k_opt_get
update_location = ('model_init_params', 'compile_params', 'optimizer_params')
allowed_values = get_path(_model_params, location).bounds
... | code_fim | hard | {
"lang": "python",
"repo": "ssh-shashi/hyperparameter_hunter",
"path": "/hyperparameter_hunter/result_reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hail-is/hail path: /hail/python/hail/experimental/codec.py
from hail.utils.java import Env
stream_codec = '{"name":"StreamBufferSpec"}'
def encode(expression, codec=stream_codec):
<|fim_suffix|>
def decode(typ, bytes):
return typ._from_encoding(bytes)<|fim_middle|> jir = Env.backend()._... | code_fim | medium | {
"lang": "python",
"repo": "hail-is/hail",
"path": "/hail/python/hail/experimental/codec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def decode(typ, bytes):
return typ._from_encoding(bytes)<|fim_prefix|># repo: hail-is/hail path: /hail/python/hail/experimental/codec.py
from hail.utils.java import Env
<|fim_middle|>stream_codec = '{"name":"StreamBufferSpec"}'
def encode(expression, codec=stream_codec):
jir = Env.backend()._... | code_fim | hard | {
"lang": "python",
"repo": "hail-is/hail",
"path": "/hail/python/hail/experimental/codec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> background(204)
stroke(102)
line(mouseX, 0, mouseX, height) #Linha cinza
stroke(0)
mx = mouseX/2 + 60
line(mx, 0, mx, height) #Linha preta<|fim_prefix|># repo: Evaldo-comp/Processing path: /Mod_Python/funcao_map/funcao_map.pyde
#Utilizando a função map()
def setup():
<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "Evaldo-comp/Processing",
"path": "/Mod_Python/funcao_map/funcao_map.pyde",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Evaldo-comp/Processing path: /Mod_Python/funcao_map/funcao_map.pyde
#Utilizando a função map()
def setup():
<|fim_suffix|> background(204)
stroke(102)
line(mouseX, 0, mouseX, height) #Linha cinza
stroke(0)
mx = mouseX/2 + 60
line(mx, 0, mx, height) #Linha preta<|fim_middl... | code_fim | easy | {
"lang": "python",
"repo": "Evaldo-comp/Processing",
"path": "/Mod_Python/funcao_map/funcao_map.pyde",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def draw():
background(204)
stroke(102)
line(mouseX, 0, mouseX, height) #Linha cinza
stroke(0)
mx = mouseX/2 + 60
line(mx, 0, mx, height) #Linha preta<|fim_prefix|># repo: Evaldo-comp/Processing path: /Mod_Python/funcao_map/funcao_map.pyde
#Utilizando a função map()
def setup():... | code_fim | easy | {
"lang": "python",
"repo": "Evaldo-comp/Processing",
"path": "/Mod_Python/funcao_map/funcao_map.pyde",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bridder/factory path: /py/probe/functions/usb.py
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
from cros.factory.probe.functions import sysfs
from cros.fact... | code_fim | hard | {
"lang": "python",
"repo": "bridder/factory",
"path": "/py/probe/functions/usb.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> [
{
"bus_type": "usb",
"idVendor": "0123",
...
}
]
"""
GLOB_PATH = '/sys/bus/usb/devices/*'
@classmethod
def ProbeDevice(cls, dir_path):
# A valid usb device name is <roothub_num>-<addr>[.<addr2>[.<addr3>...]] or
# usb[0-9]+ for usb root hub.
... | code_fim | hard | {
"lang": "python",
"repo": "bridder/factory",
"path": "/py/probe/functions/usb.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert '1:1:C' in record.locus_allele_map
assert '1:1:T' in record.locus_allele_map
assert len(record.locus_allele_map) == 2
assert len(record.locus_allele_map['1:1:C']) == 2
assert len(record.locus_allele_map['1:1:T']) == 1
assert ('MuTect2', 'SNP') in record.caller_type_map \
... | code_fim | hard | {
"lang": "python",
"repo": "MarcSaric/aliquot-maf-tools",
"path": "/tests/merging/test_overlap_set.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarcSaric/aliquot-maf-tools path: /tests/merging/test_overlap_set.py
"""
Tests associated with the OverlapSet class.
"""
def test_overlap_set_basic_singleton(test_input_scheme, overlapped_records_generate):
"""
Test simple parsing of overlaps with singleton
"""
callers = ['MuTect... | code_fim | hard | {
"lang": "python",
"repo": "MarcSaric/aliquot-maf-tools",
"path": "/tests/merging/test_overlap_set.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """This function creates and returns the Wrapper for the Solver used for CoSimulation"""
return base_factory.Create(settings, [solver_name], "KratosMultiphysics.CoSimulationApplication")<|fim_prefix|># repo: pyfsi/Kratos path: /applications/CoSimulationApplication/python_scripts/factories/solver_... | code_fim | medium | {
"lang": "python",
"repo": "pyfsi/Kratos",
"path": "/applications/CoSimulationApplication/python_scripts/factories/solver_wrapper_factory.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyfsi/Kratos path: /applications/CoSimulationApplication/python_scripts/factories/solver_wrapper_factory.py
from __future__ import print_function, absolute_import, division # makes these scripts backward compatible with python 2.6 and 2.7
<|fim_suffix|>def CreateSolverWrapper(settings, solver_n... | code_fim | medium | {
"lang": "python",
"repo": "pyfsi/Kratos",
"path": "/applications/CoSimulationApplication/python_scripts/factories/solver_wrapper_factory.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Locale setting
if 'Darwin' in platform.system():
locale.setlocale(locale.LC_ALL, 'ko_KR.UTF-8')
elif 'Windows' in platform.system():
locale.setlocale(locale.LC_ALL, '')
# Settings on Logging
def get_today_str():
today = datetime.datetime.combine(datetime.date.today(), datetime.datetime.mi... | code_fim | hard | {
"lang": "python",
"repo": "kimkyeonghun/rltrader",
"path": "/AC/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kimkyeonghun/rltrader path: /AC/settings.py
import time
import datetime
import locale
import logging
import os
import platform
import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
# Strategy
# DEBUG = True
DEB... | code_fim | hard | {
"lang": "python",
"repo": "kimkyeonghun/rltrader",
"path": "/AC/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.message = "Initial Balance must be over 0"
def __str__(self):
return str(self.message)
class UndefinedModel(Exception):
def __init__(self):
self.message = "This stock code's h5 model file isn't here"
def __str__(self):
return str(self.message)<|fim_prefi... | code_fim | hard | {
"lang": "python",
"repo": "kimkyeonghun/rltrader",
"path": "/AC/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ian-Gabaraev/chevrons path: /build/lib/chevrons/text.py
import re
class Chevrons:
def __init__(self, original_string):
self.pattern = re.compile('[\"|\'][^\"\']+[\"|\']')
self.original_string = original_string
def __is_applicable(self, original_string: str) -> bool:
... | code_fim | hard | {
"lang": "python",
"repo": "Ian-Gabaraev/chevrons",
"path": "/build/lib/chevrons/text.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [
match.group(0) for match in re.finditer(
pattern=self.pattern, string=original_string
)
]
def __remove_unpaired_quotes(self, original_string: str) -> str:
return original_string.replace("\'", "").replace("\"", "")
def appl... | code_fim | hard | {
"lang": "python",
"repo": "Ian-Gabaraev/chevrons",
"path": "/build/lib/chevrons/text.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamk-uas/TavastiaEvents path: /tavastiaevents/urls.py
from django.urls import reverse
from django.conf.urls import url, include
from django.views.generic import View
<|fim_suffix|>app_name = 'tavastiaevents'
urlpatterns = [
url(r'report/', message_event, name='message-event'),
url(r'docu... | code_fim | medium | {
"lang": "python",
"repo": "hamk-uas/TavastiaEvents",
"path": "/tavastiaevents/urls.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.