text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> signals = [
LiftSignal(1),
LiftSignal(2),
LiftSignal(3),
LiftSignal(4)
]
blk = Filter()
self.configure_block(blk, {
'conditions': [
{'expr': '{{$val % 2 == 0}}'}
]
})
blk... | code_fim | hard | {
"lang": "python",
"repo": "dmsherr/niobeta",
"path": "/test_lift_block.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
else:
valor = 0.45 * dist
print('O valor da passagem é R$: {:.2f}'.format(valor))
print('Boa viagem!')<|fim_prefix|># repo: amandagsilveira/Exercicios_cursoemvideo_Python path: /ex031.py
#Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobra... | code_fim | hard | {
"lang": "python",
"repo": "amandagsilveira/Exercicios_cursoemvideo_Python",
"path": "/ex031.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amandagsilveira/Exercicios_cursoemvideo_Python path: /ex031.py
#Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 parta viagens mais longas.
dist = float(input('Digite a distância da via<|fi... | code_fim | medium | {
"lang": "python",
"repo": "amandagsilveira/Exercicios_cursoemvideo_Python",
"path": "/ex031.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>DATAPATH = os.path.expanduser("~/Dropbox/MPCounterfactual/src/etm/")
dataset = f"{MEETDATASAMPLE}"
data_path=f"{DATAPATH}/data/{MEETDATASAMPLE}"
emb_path=f"{DATAPATH}/embeddings/{EMBDATASET}_emb"
save_path=f"{DATAPATH}/results"
## Set Model Parameter
num_topics = 10
epochs = 5000
batch_size = 1000
... | code_fim | hard | {
"lang": "python",
"repo": "wph21cen/FOMCTextAnalysis",
"path": "/src/etm/choicemodel/manetm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wph21cen/FOMCTextAnalysis path: /src/etm/choicemodel/manetm.py
embeddings = m.rho.weight # Vocab_size x E
except:
embeddings = m.rho # Vocab_size x E
neighbors = []
for word in queries:
print('word: {} .... | code_fim | hard | {
"lang": "python",
"repo": "wph21cen/FOMCTextAnalysis",
"path": "/src/etm/choicemodel/manetm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wph21cen/FOMCTextAnalysis path: /src/etm/choicemodel/manetm.py
rgsort()[-args.num_words+1:][::-1])
topic_words = [vocab[a] for a in top_words]
topics_words.append(' '.join(topic_words))
print('Topic {}: {}'.format(k, topic_words))
if show_emb:
... | code_fim | hard | {
"lang": "python",
"repo": "wph21cen/FOMCTextAnalysis",
"path": "/src/etm/choicemodel/manetm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joshuarichard/ugh path: /test/ugh-test.py
import sys
import time
# example:
# python ugh-test.py ugh 34 .05
# word - the word to be printed
# times - the number of times you want to print the word (both down and across)
# sleep - how long to sleep for in between lines
<|fim_suffix|> # init
... | code_fim | medium | {
"lang": "python",
"repo": "joshuarichard/ugh",
"path": "/test/ugh-test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
# init
x = 0
y = 0
word_iter = word
# prime the pump, or something
print word
# sleep so it's funnier
time.sleep(sleep)
while (x < times): # go down
while (y < times): # go across
word_iter += " " + word
print word_iter
... | code_fim | medium | {
"lang": "python",
"repo": "joshuarichard/ugh",
"path": "/test/ugh-test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giovannigatto/gTTS path: /coffee_enit.py
# create an mp3 | added by Giovanni Gatto
from gTTSMulti import gTTS
import os
def tts2MP3(words,mp3name,language="en"):
global tts
'It creates an mp3 (default french) file thanks to google API'
tts=gTTS(text=words,lang=language)
tts.saveTmp("... | code_fim | hard | {
"lang": "python",
"repo": "giovannigatto/gTTS",
"path": "/coffee_enit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>enit("DOSING","Dosaggio")
enit("Put the coffee ground into a filter holder so that the coffee is evenly distributed","Metti il caffè in un portafiltro in modo che il caffè sia distribuito in modo uniforme.")
enit("You must use coffee ground specifically for the Espresso. You must use 7 grams for each es... | code_fim | medium | {
"lang": "python",
"repo": "giovannigatto/gTTS",
"path": "/coffee_enit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>enit("Now the filter holder is ready","Adesso il portafiltro è pronto")
enit("the coffee should be poured in the cups in 25 seconds","Il caffè dovrebbe essere versato nella tazzina in 25 secondi")
enit("Put the two coffee into a mixer and add 5 spoons of sugar","Metti i due caffè nel mixer e aggiungi ... | code_fim | hard | {
"lang": "python",
"repo": "giovannigatto/gTTS",
"path": "/coffee_enit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># +
df_jobs = get_df_jobs()
df_jobs_i = df_jobs
df_atoms_sorted_ind = get_df_atoms_sorted_ind()
# df_features_targets = get_df_features_targets()
df_features = get_df_features()
# -
df_features[df_features["data"]["orig_slab_good"] == False]
# #########################################################... | code_fim | hard | {
"lang": "python",
"repo": "raulf2012/PROJ_IrOx_OER",
"path": "/dft_workflow/job_analysis/systems_fully_ready/sys_fully_ready.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># + active=""
#
#
#
# +
# # #########################################################
# group_cols = ["compenv", "slab_id", "ads", "active_site", "att_num", ]
# grouped = df_jobs_i.groupby(group_cols)
# # #########################################################
# num_groups_processed = 0
# for i_cnt, (n... | code_fim | hard | {
"lang": "python",
"repo": "raulf2012/PROJ_IrOx_OER",
"path": "/dft_workflow/job_analysis/systems_fully_ready/sys_fully_ready.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raulf2012/PROJ_IrOx_OER path: /dft_workflow/job_analysis/systems_fully_ready/sys_fully_ready.py
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.5.0
#... | code_fim | hard | {
"lang": "python",
"repo": "raulf2012/PROJ_IrOx_OER",
"path": "/dft_workflow/job_analysis/systems_fully_ready/sys_fully_ready.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wkelton/abackup path: /lib/abackup/prepare/copy.py
import logging
import shutil
from pathlib import Path
from typing import List
def copy_most_recent_backup_file(
stored_path: bool, destinations: List[str], log: logging.Logger, overwrite: bool = True
) -> bool:
dir = Path(stored_path)
... | code_fim | hard | {
"lang": "python",
"repo": "wkelton/abackup",
"path": "/lib/abackup/prepare/copy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log.info("copying most recent backup {} -> {}".format(most_recent_backup, str(p)))
shutil.copyfile(most_recent_backup, str(p))
# TODO: handle error cases
return status<|fim_prefix|># repo: wkelton/abackup path: /lib/abackup/prepare/copy.py
import logging
import shutil
from p... | code_fim | hard | {
"lang": "python",
"repo": "wkelton/abackup",
"path": "/lib/abackup/prepare/copy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vikash84/MegaPath-Nano path: /db_preparation/genAssemblySummary.py
import argparse
import os
import pandas
FLAGS = None
def summary(refseqGenome, assemblySummary):
assembly_summary = pandas.read_csv(refseqGenome+'/archaea/assembly_summary.txt', dtype=str, sep='\t', header=1)
... | code_fim | hard | {
"lang": "python",
"repo": "Vikash84/MegaPath-Nano",
"path": "/db_preparation/genAssemblySummary.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Refseq assembly info update')
parser.add_argument('--db_dir', default="genomes/refseq/", required=False)
parser.add_argument('--assemblySummary', default=None, required=False)
FLAGS, UNPARSED = parser.parse_know... | code_fim | hard | {
"lang": "python",
"repo": "Vikash84/MegaPath-Nano",
"path": "/db_preparation/genAssemblySummary.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lvieirajr/mongorest path: /tests/resource/update_resource_mixin.py
# -*- encoding: UTF-8 -*-
from __future__ import absolute_import, unicode_literals
from mongorest.collection import Collection
from mongorest.resource import UpdateResourceMixin
from mongorest.testcase import TestCase
from mongor... | code_fim | hard | {
"lang": "python",
"repo": "lvieirajr/mongorest",
"path": "/tests/resource/update_resource_mixin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> class TestCollectionUpdate(UpdateResourceMixin):
collection = Test
self.update_client = self.client(
WSGIDispatcher(resources=[TestCollectionUpdate]),
Response
)
def test_update_mixin_rule(self):
rules = UpdateResourceMixin.rules
... | code_fim | hard | {
"lang": "python",
"repo": "lvieirajr/mongorest",
"path": "/tests/resource/update_resource_mixin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> start = datetime.datetime.now()
ans = [0, 0]
for k in xrange(1, 6):
method.generate_data_1m_with_rating(8, k)
method.generate_matrix(with_rating=True)
b = method.evaluate_with_rating()
for x in xrange(0, 2):
ans[x] += b[x]
for x in xrange(0, 2):
... | code_fim | hard | {
"lang": "python",
"repo": "SylvanHuang/RecSys",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SylvanHuang/RecSys path: /main.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import datetime
import method
def test100k():
start = datetime.datetime.now()
ans = [0, 0, 0, 0]
for k in xrange(1, 6):
method.generate_data_10... | code_fim | hard | {
"lang": "python",
"repo": "SylvanHuang/RecSys",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cfg_type = self.config.TASKS[task_id]['type']
if cfg_type == 'VL-classifier':
batch_score = compute_score_with_logits(vil_prediction, target).sum()
pred = vil_prediction
elif cfg_type == 'VL-logit':
vil_logit = vil_logit.view(batch_size, num_op... | code_fim | hard | {
"lang": "python",
"repo": "linxi1158/iMIX",
"path": "/imix/models/vqa_models/devlbert/devlbert_tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linxi1158/iMIX path: /imix/models/vqa_models/devlbert/devlbert_tasks.py
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
from io import open
from easydict im... | code_fim | hard | {
"lang": "python",
"repo": "linxi1158/iMIX",
"path": "/imix/models/vqa_models/devlbert/devlbert_tasks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> question = question.view(-1, question.size(2))
input_mask = input_mask.view(-1, input_mask.size(2))
segment_ids = segment_ids.view(-1, segment_ids.size(2))
co_attention_mask = co_attention_mask.view(-1, co_attention_mask.size(2), co_attention_mask.size(3))
... | code_fim | hard | {
"lang": "python",
"repo": "linxi1158/iMIX",
"path": "/imix/models/vqa_models/devlbert/devlbert_tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NehaJantre/15-AWS-Roboadvisors-Application path: /Lambda/lambda_function.py
### Required Libraries ###
from datetime import datetime
from dateutil.relativedelta import relativedelta
### Functionality Helper Functions ###
def parse_int(n):
"""
Securely converts a non-integer value to inte... | code_fim | hard | {
"lang": "python",
"repo": "NehaJantre/15-AWS-Roboadvisors-Application",
"path": "/Lambda/lambda_function.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Validate that the user is over greater than zero and less than 65
if age is not None:
age = parse_int(age)
if age < 1 or age >= 65:
return build_validation_result(
False,
"age",
"Your age should be between 0 and 65 years... | code_fim | hard | {
"lang": "python",
"repo": "NehaJantre/15-AWS-Roboadvisors-Application",
"path": "/Lambda/lambda_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Validate the investment amount, it should be >= 5000
if investment_amount is not None:
dollars = parse_int(investment_amount)
if dollars < 5000:
return build_validation_result(
False,
"investmentAmount",
"The amount to c... | code_fim | hard | {
"lang": "python",
"repo": "NehaJantre/15-AWS-Roboadvisors-Application",
"path": "/Lambda/lambda_function.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def merge_stories(self, group: StoriesRunGroup) -> ProbeResult:
merged_result_path = group.get_probe_results_file(self)
result_files = (g.results[self].file for g in group.repetitions_groups)
result_file = self.runner_platform.concat_files(
inputs=result_files, output=merged_result_p... | code_fim | hard | {
"lang": "python",
"repo": "iridium-browser/iridium-browser",
"path": "/third_party/crossbench/crossbench/probes/v8/builtins_pgo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def stop(self, run: Run) -> None:
with run.actions("Extract Builtins PGO DATA") as actions:
self._pgo_counters = actions.js(
"return %GetAndResetTurboProfilingData();")
def tear_down(self, run: Run) -> ProbeResult:
assert self._pgo_counters is not None and self._pg... | code_fim | medium | {
"lang": "python",
"repo": "iridium-browser/iridium-browser",
"path": "/third_party/crossbench/crossbench/probes/v8/builtins_pgo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iridium-browser/iridium-browser path: /third_party/crossbench/crossbench/probes/v8/builtins_pgo.py
# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import annotations
from typing import TY... | code_fim | hard | {
"lang": "python",
"repo": "iridium-browser/iridium-browser",
"path": "/third_party/crossbench/crossbench/probes/v8/builtins_pgo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amonmillner/playfulportfolio path: /totem/TotemController.py
# -*- coding: utf-8 -*-
"""
Created April 2019
@author: Amon Millner
This is a module that contains a class that serves as a controller
for the totem game, to evoke the Model-View-Controller (MVC) framework.
"""
import pygame
from py... | code_fim | medium | {
"lang": "python",
"repo": "amonmillner/playfulportfolio",
"path": "/totem/TotemController.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle_event(self,event):
""" Space key stops the moving faces """
if event.type != KEYDOWN:
return
if event.key == pygame.K_SPACE:
self.model.addFaceToFoundation()
# making the enter key only reset after a victory
if (self.model.new_... | code_fim | medium | {
"lang": "python",
"repo": "amonmillner/playfulportfolio",
"path": "/totem/TotemController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Space key stops the moving faces """
if event.type != KEYDOWN:
return
if event.key == pygame.K_SPACE:
self.model.addFaceToFoundation()
# making the enter key only reset after a victory
if (self.model.new_game == 1 and event.key == pygame.... | code_fim | medium | {
"lang": "python",
"repo": "amonmillner/playfulportfolio",
"path": "/totem/TotemController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Topology1225/benchmark_NN path: /classification/src/train.py
import os
from pathlib import Path
from argparse import ArgumentParser
import shutil
import datetime
from trainers import get_trainer
from dataset import get_dataset
from models import get_model
from utils import (
setup_logger... | code_fim | hard | {
"lang": "python",
"repo": "Topology1225/benchmark_NN",
"path": "/classification/src/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> root_dir = Path(increment_path(os.path.join(config.result_dir, "runs")))
Path(os.path.join(root_dir, "weights")).mkdir(parents=True, exist_ok=True)
config.result_dir = root_dir
log = setup_logger.setFileHandler(filename=os.path.join(root_dir, "log.txt"))
save_yaml(config)
save_host... | code_fim | hard | {
"lang": "python",
"repo": "Topology1225/benchmark_NN",
"path": "/classification/src/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nsport as CampaignFeedServiceGrpcTransport<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v12/services/services/campaign_feed_service/transports/__init__.pyi
from .base import CampaignFeedServiceTransport as CampaignFeedServiceTransport
fro<|fim_middle|>m .grpc import Ca... | code_fim | easy | {
"lang": "python",
"repo": "henribru/google-ads-stubs",
"path": "/google-stubs/ads/googleads/v12/services/services/campaign_feed_service/transports/__init__.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v12/services/services/campaign_feed_service/transports/__init__.pyi
from .base import CampaignFeedServiceTransport as CampaignFeedServiceTransport
fro<|fim_suffix|>nsport as CampaignFeedServiceGrpcTransport<|fim_middle|>m .grpc import Ca... | code_fim | easy | {
"lang": "python",
"repo": "henribru/google-ads-stubs",
"path": "/google-stubs/ads/googleads/v12/services/services/campaign_feed_service/transports/__init__.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Main2().start()
self.assertTrue(
os.path.isdir('log/yangsrunner_test-none'),
msg="Main2 Test App test"
)
def test_3_argument_is_empty(self):
Main3().start()
self.assertTrue(
os.path.isdir('log/yangsrunner_test-none'),
... | code_fim | hard | {
"lang": "python",
"repo": "yseiren87/yangsrunner",
"path": "/tests/simple_executor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_3_argument_is_empty(self):
Main3().start()
self.assertTrue(
os.path.isdir('log/yangsrunner_test-none'),
msg="Main3 Test App test"
)
@classmethod
def tearDownClass(cls):
shutil.rmtree('log')<|fim_prefix|># repo: yseiren87/yangsr... | code_fim | hard | {
"lang": "python",
"repo": "yseiren87/yangsrunner",
"path": "/tests/simple_executor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yseiren87/yangsrunner path: /tests/simple_executor.py
import unittest
import os
import shutil
import argparse
from yangsrunner import SimpleExecutor
class Main(SimpleExecutor):
def __init__(self):
SimpleExecutor.__init__(self, setting_file='tests/setting.yml')
def _arguments(s... | code_fim | hard | {
"lang": "python",
"repo": "yseiren87/yangsrunner",
"path": "/tests/simple_executor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gameboy86/matchbox-orm path: /matchbox/queries/__init__.py
from .queries import (
DeleteQuery,
<|fim_suffix|>erQuery,
InsertQuery,
UpdateQuery,
]<|fim_middle|> FilterQuery,
InsertQuery,
UpdateQuery,
)
__all__ = [
DeleteQuery,
Filt | code_fim | medium | {
"lang": "python",
"repo": "gameboy86/matchbox-orm",
"path": "/matchbox/queries/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>erQuery,
InsertQuery,
UpdateQuery,
]<|fim_prefix|># repo: gameboy86/matchbox-orm path: /matchbox/queries/__init__.py
from .queries import (
DeleteQuery,
FilterQuery,
InsertQuery,
UpdateQue<|fim_middle|>ry,
)
__all__ = [
DeleteQuery,
Filt | code_fim | easy | {
"lang": "python",
"repo": "gameboy86/matchbox-orm",
"path": "/matchbox/queries/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Affirm/RxPY path: /tests/test_concurrency/test_mainloopscheduler/test_ioloopscheduler.py
import unittest
from datetime import datetime, timedelta
from nose import SkipTest
try:
from tornado import ioloop
except ImportError:
raise SkipTest("Tornado not installed")
from rx.concurrency imp... | code_fim | hard | {
"lang": "python",
"repo": "Affirm/RxPY",
"path": "/tests/test_concurrency/test_mainloopscheduler/test_ioloopscheduler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> loop = ioloop.IOLoop.instance()
ran = [False]
scheduler = IOLoopScheduler(loop)
def action(scheduler, state):
ran[0] = True
d = scheduler.schedule_relative(10, action)
d.dispose()
def done():
assert(not ran[0])
... | code_fim | hard | {
"lang": "python",
"repo": "Affirm/RxPY",
"path": "/tests/test_concurrency/test_mainloopscheduler/test_ioloopscheduler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> loop.start()
def test_ioloop_schedule_action_due(self):
loop = ioloop.IOLoop.instance()
scheduler = IOLoopScheduler(loop)
starttime = loop.time()
endtime = [None]
def action(scheduler, state):
endtime[0] = loop.time()
scheduler.sc... | code_fim | hard | {
"lang": "python",
"repo": "Affirm/RxPY",
"path": "/tests/test_concurrency/test_mainloopscheduler/test_ioloopscheduler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>PROPERTY_TYPES = {
"name": "text",
"body": "text",
"completed": "boolean",
"completion date": "date",
"due date": "date",
"remind me date": "date",
"priority": "integer"
}<|fim_prefix|># repo: ohitssway/pyreminder path: /pyreminder/constants.py
DAYS... | code_fim | hard | {
"lang": "python",
"repo": "ohitssway/pyreminder",
"path": "/pyreminder/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ohitssway/pyreminder path: /pyreminder/constants.py
DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
"Sunday"]
WEEKDAYS = DAYS[:5]
WEEKENDS = DAYS[5:]
EVERY_OTHER_DAY = DAYS[::2]
EVERY_OTHER_DAY_STARTING_TUESDAY = DAYS[1::2]
<|fim_suffix|>PROPERTY_TYPES = {
... | code_fim | hard | {
"lang": "python",
"repo": "ohitssway/pyreminder",
"path": "/pyreminder/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tyler-Yates/pattern-web path: /application/routes/html_routes.py
from flask import Blueprint, current_app, redirect, render_template
from application.data.document_dao import TTL_SECONDS, DocumentDao
HTML_BLUEPRINT = Blueprint("routes_html", __name__)
<|fim_suffix|>
# HTML forms do not allow u... | code_fim | hard | {
"lang": "python",
"repo": "Tyler-Yates/pattern-web",
"path": "/application/routes/html_routes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> documents = _get_dao().get_documents()
return render_template("documents.html", documents=documents, collection_ttl=TTL_SECONDS)
@HTML_BLUEPRINT.route("/documents/<document_id>")
def document_page(document_id):
document = _get_dao().get_document(document_id)
return render_template("docum... | code_fim | medium | {
"lang": "python",
"repo": "Tyler-Yates/pattern-web",
"path": "/application/routes/html_routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tacyi/TornadoForum path: /Myforum/apps/utils/decorators.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:pyy
# datetime:2019/1/9 9:55
import functools
import jwt
from Myforum.Forum.settings import settings
from Myforum.apps.users.models import User
def authenticated_async(method):
<|f... | code_fim | hard | {
"lang": "python",
"repo": "tacyi/TornadoForum",
"path": "/Myforum/apps/utils/decorators.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> jwt, # type: str
key='', # type: str
verify=True, # type: bool
algorithms=None, # type: List[str]
options=None, # type: Dict
**kwargs):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "tacyi/TornadoForum",
"path": "/Myforum/apps/utils/decorators.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #此处很关键, 这里的method是一个协程方法,返回协程方法的时候不能使用return,要用await
await method(self, *args, **kwargs)
except User.DoesNotExist as e:
self.set_status(401)
except jwt.ExpiredSignatureError as e:
self.set_status(401)
... | code_fim | hard | {
"lang": "python",
"repo": "tacyi/TornadoForum",
"path": "/Myforum/apps/utils/decorators.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeffacce/ksp_gnc path: /python/plot_launch.py
from matplotlib.colors import ListedColormap
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import pandas as pd
import numpy as np
import krpc
# kRPC setup
conn = krpc.connect(name='Plotter', address='127.0.0.1')
... | code_fim | hard | {
"lang": "python",
"repo": "jeffacce/ksp_gnc",
"path": "/python/plot_launch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # elif parts != parts_i and booster_sep and MECO and not SECO:
# SECO = True
# event = pd.DataFrame([[this_downrange, altitude()/1000, "SECO"]],
# columns=["Horizontal distance", "Altitude", "Name"])
# happenings = happenings.append(event)
... | code_fim | hard | {
"lang": "python",
"repo": "jeffacce/ksp_gnc",
"path": "/python/plot_launch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def animate(_):
global ksc_coord, data, happenings, xlim, ylim, parts_i, booster_sep, MECO, SECO
position = np.array((latitude(), longitude()))
this_downrange = (np.linalg.norm(position - origin) * (2.*np.pi*planet_radius)/360.)/1000 # km
this_altitude = altitude()/1000.0
this_... | code_fim | hard | {
"lang": "python",
"repo": "jeffacce/ksp_gnc",
"path": "/python/plot_launch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># inference for loop
files = os.listdir(test_data_dir)
n = 10000
sample_submit = pd.read_csv('sample_submission.csv')
i = 0
for f in tqdm(files[:n]):
# load audio
samples,sample_rate = librosa.load(test_data_dir+f)
mel_spectrogram = sample2melspectrogram(samples,sample_rate)
shape... | code_fim | medium | {
"lang": "python",
"repo": "skywalker0803r/Tomofun-Dog-Voice-Recognition-AI-Million-Challenge",
"path": "/predict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skywalker0803r/Tomofun-Dog-Voice-Recognition-AI-Million-Challenge path: /predict.py
import torch
from torch import nn
import pandas as pd
import os
from tqdm import tqdm
import torchaudio
import librosa
import numpy as np
import gc
def sample2melspectrogram(samples,sample_rate):
<|fim... | code_fim | hard | {
"lang": "python",
"repo": "skywalker0803r/Tomofun-Dog-Voice-Recognition-AI-Million-Challenge",
"path": "/predict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> List = os.listdir(self.File)
print(List)
frames = []
Num = 0
for file in List:
Num += 1
self.Back_progreBar.value = Num
file = os.path.join(self.File, file)
print(file)
img = cv2.imread(file, 1)
... | code_fim | hard | {
"lang": "python",
"repo": "Karobben/Kivymd_toolbox",
"path": "/libs/img2video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Karobben/Kivymd_toolbox path: /libs/img2video.py
import cv2, os, imageio
class Main():
def run(self, File, FPS, SIZE, FORMAT, Back_progreBar, Back_Label):
self.FPS = float(FPS)
self.SIZE = [int(i) for i in SIZE.split("x")]
self.File = File
self.Back_progreB... | code_fim | hard | {
"lang": "python",
"repo": "Karobben/Kivymd_toolbox",
"path": "/libs/img2video.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> OUTPUT = "/".join(self.File.split("/")[:-1]) + "/OUT.avi"
List = os.listdir(self.File)
img = cv2.imread(self.File +"/"+List[0])
fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
print('1', OUTPUT)
videowriter = cv2.VideoWriter(OUTPUT,fourcc,self.FPS,self.SIZE... | code_fim | hard | {
"lang": "python",
"repo": "Karobben/Kivymd_toolbox",
"path": "/libs/img2video.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnjdailey/pandas-ta path: /pandas_ta/overlap/rma.py
# -*- coding: utf-8 -*-
from ..utils import get_offset, verify_series
def rma(close, length=None, offset=None, **kwargs):
"""Indicator: wildeR's Moving Average (RMA)"""
# Validate Arguments
close = verify_series(close)
length ... | code_fim | hard | {
"lang": "python",
"repo": "johnjdailey/pandas-ta",
"path": "/pandas_ta/overlap/rma.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Args:
close (pd.Series): Series of 'close's
length (int): It's period. Default: 10
offset (int): How many periods to offset the result. Default: 0
Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value)
fill_method (value, optional): Type of fill method
Returns:
pd.Series:... | code_fim | hard | {
"lang": "python",
"repo": "johnjdailey/pandas-ta",
"path": "/pandas_ta/overlap/rma.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ourresearch/openalex-elastic-api path: /scripts/export_location_urls.py
# -*- coding: utf-8 -*-
DESCRIPTION = """for all works in elasticsearch, export the work id and the url for the locations"""
import csv
import os
import sys
import time
from datetime import datetime
from pathlib import Path... | code_fim | hard | {
"lang": "python",
"repo": "ourresearch/openalex-elastic-api",
"path": "/scripts/export_location_urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(args):
connections.create_connection(hosts=[ES_URL], timeout=600)
logging.getLogger("elasticsearch").setLevel(logging.WARNING)
get_ids()
if __name__ == "__main__":
total_start = timer()
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter(
... | code_fim | hard | {
"lang": "python",
"repo": "ourresearch/openalex-elastic-api",
"path": "/scripts/export_location_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Returns a list of every line in a file
def list_file(fname):
words_list = list()
file = open(fname, "r", encoding="utf-8")
for line in file:
if line != "\n":
words_list.append(line.rstrip())
file.close()
return words_list<|fim_prefix|># repo: 0815Sailsman/FileToo... | code_fim | hard | {
"lang": "python",
"repo": "0815Sailsman/FileTools",
"path": "/file_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> words_list = list()
file = open(fname, "r", encoding="utf-8")
for line in file:
if line != "\n":
words_list.append(line.rstrip())
file.close()
return words_list<|fim_prefix|># repo: 0815Sailsman/FileTools path: /file_tools.py
from os import listdir
from os.path imp... | code_fim | hard | {
"lang": "python",
"repo": "0815Sailsman/FileTools",
"path": "/file_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0815Sailsman/FileTools path: /file_tools.py
from os import listdir
from os.path import isfile, join
# Returns a list of every file in a folder
def get_all_files(group):
return [f for f in listdir("dictionaries/" + group + "/") if isfile(join("dictionaries/" + group + "/", f))]
<|fim_suffi... | code_fim | hard | {
"lang": "python",
"repo": "0815Sailsman/FileTools",
"path": "/file_tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Quansight/pearu-sandbox path: /pygdf/pygdf/buffer.py
from __future__ import print_function, division
import numpy as np
from numba import cuda
from . import cudautils, utils
from .serialize import register_distributed_serializer
from .gpu_ipc_broker import serialize_gpu_data, rebuild_gpu_data, ... | code_fim | hard | {
"lang": "python",
"repo": "Quansight/pearu-sandbox",
"path": "/pygdf/pygdf/buffer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(arg, slice):
sliced = self.to_gpu_array()[arg]
return Buffer(sliced)
elif isinstance(arg, int):
arg = utils.normalize_index(arg, self.size)
return self.mem[arg]
else:
raise NotImplementedError(type(arg))
... | code_fim | hard | {
"lang": "python",
"repo": "Quansight/pearu-sandbox",
"path": "/pygdf/pygdf/buffer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
INPUT = open('../../data/example_output/solubility_predictions_cnn.csv', 'r')
for line in INPUT:
line = line.rstrip()
line_list = line.split(',')
smiles = line_list[0]
molecule_prediction = line_list[1]
atoms_list = line_list[2].split(':')
atom_predictions = line_list[3].split(':... | code_fim | hard | {
"lang": "python",
"repo": "highdxy/neural-fingerprint-theano",
"path": "/code/visualization/highlight_molecule_cnn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #get rid of SMILES characters taht will mess up saving the file
smiles_out = smiles.replace('/', '')
smiles_out = smiles_out.replace('\/','')
OUTPUT = open('cnn_molecules/'+smiles_out+'_pred.svg', 'w')
OUTPUT.write(mol_svg)
OUTPUT.close()
INPUT.close()<|fim_prefix|># repo: highdx... | code_fim | hard | {
"lang": "python",
"repo": "highdxy/neural-fingerprint-theano",
"path": "/code/visualization/highlight_molecule_cnn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: highdxy/neural-fingerprint-theano path: /code/visualization/highlight_molecule_cnn.py
from rdkit import Chem
#from rdkit.Chem.Draw import IPythonConsole
#from IPython.display import SVG
import time
from rdkit.Chem import rdDepictor
from rdkit.Chem.Draw import rdMolDraw2D
import numpy as np
import... | code_fim | hard | {
"lang": "python",
"repo": "highdxy/neural-fingerprint-theano",
"path": "/code/visualization/highlight_molecule_cnn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zinic/python-cfw path: /cfw/framework/discovery.py
import importlib
import os
import sys
import traceback
from typing import Callable, List, Any, Optional, TypeVar
from cfw.framework.args.model import ArgumentDefinition
from cfw.framework.command import CommandWrapper, CommandTrie, UserFuncType
... | code_fim | hard | {
"lang": "python",
"repo": "zinic/python-cfw",
"path": "/cfw/framework/discovery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add the root module since that's part of the scan
submodules.append(root_module)
# Load and scan the submodules for command components
command_components = list()
for submodule in submodules:
for component_name in dir(submodule):
component = getattr(submodule, co... | code_fim | hard | {
"lang": "python",
"repo": "zinic/python-cfw",
"path": "/cfw/framework/discovery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cixgnf/PythonChallenge path: /Level_02/Level_02.py
def gentable(start, end):
str_tmp = ''
for i in range(start, end +1):
str_tmp += chr(i)
retur<|fim_suffix|>print(str0.translate(trantab))
str1 = "map"
print(str1.translate(trantab))
str7 = "iqeylatu"
print(str7.transl... | code_fim | hard | {
"lang": "python",
"repo": "cixgnf/PythonChallenge",
"path": "/Level_02/Level_02.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(str0.translate(trantab))
str1 = "map"
print(str1.translate(trantab))
str7 = "iqeylatu"
print(str7.translate(trantab))<|fim_prefix|># repo: cixgnf/PythonChallenge path: /Level_02/Level_02.py
def gentable(start, end):
str_tmp = ''
for i in range(start, end +1):
str_tmp += chr(i)
... | code_fim | medium | {
"lang": "python",
"repo": "cixgnf/PythonChallenge",
"path": "/Level_02/Level_02.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> text.write(f'Line {y}: sample line in sample_text{x}.txt\n')<|fim_prefix|># repo: KFOAS/automate-the-boring-stuff path: /text_to_spreadsheet/sample_files/generate_text_files.py
# throwaway script used to generate sample files
import random
<|fim_middle|>for x in range(1, 6):
with open(f'sample_... | code_fim | medium | {
"lang": "python",
"repo": "KFOAS/automate-the-boring-stuff",
"path": "/text_to_spreadsheet/sample_files/generate_text_files.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KFOAS/automate-the-boring-stuff path: /text_to_spreadsheet/sample_files/generate_text_files.py
# throwaway script used to generate sample files
import random
for x in range(1, 6):
with open(f'sample_text{x}.txt', 'w') a<|fim_suffix|> text.write(f'Line {y}: sample line in sample_text{x}.t... | code_fim | medium | {
"lang": "python",
"repo": "KFOAS/automate-the-boring-stuff",
"path": "/text_to_spreadsheet/sample_files/generate_text_files.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def set_mode(service: ServiceDataType) -> None:
value = service.data.get(ATTR_ALWAYS_ON_NAME)
_LOGGER.debug("Set always on mode to %s", value)
if value:
bus.write_byte(I2C_ADDRESS, 254) # 0xfe - always on mode
else:
bus.write_byte(I2C_ADDR... | code_fim | hard | {
"lang": "python",
"repo": "richard920416/argon40",
"path": "/custom_components/argon40/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @callback
def event_detect_callback(channel):
if GPIO.input(shutdown_pin):
_LOGGER.debug("Rising edge detected on 4")
# hass.bus.async_fire("argon40_event", {"key": "pressed"})
else:
_LOGGER.debug("Falling edge detecte... | code_fim | hard | {
"lang": "python",
"repo": "richard920416/argon40",
"path": "/custom_components/argon40/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richard920416/argon40 path: /custom_components/argon40/__init__.py
"""Support for Argon 40 cases and Argon Fan HAT"""
import logging
from typing import Any
from RPi import GPIO # pylint: disable=import-error
from custom_components.argon40.const import (
ATTR_ALWAYS_ON_NAME,
ATTR_SPEED_N... | code_fim | hard | {
"lang": "python",
"repo": "richard920416/argon40",
"path": "/custom_components/argon40/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cy486/DomRead path: /hotword/test.py
#-*- encoding:utf-8 -*-
from __future__ import print_function
import codecs
from textrank4zh import TextRank4Keyword, TextRank4Sentence
<|fim_suffix|>print()
print('words_no_stop_words')
for words in tr4w.words_no_stop_words:
print('/'.join(word... | code_fim | hard | {
"lang": "python",
"repo": "cy486/DomRead",
"path": "/hotword/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print()
print('words_all_filters')
for words in tr4w.words_all_filters:
print('/'.join(words)) # py2中是unicode类型。py3中是str类型。<|fim_prefix|># repo: cy486/DomRead path: /hotword/test.py
#-*- encoding:utf-8 -*-
from __future__ import print_function
import codecs
from textrank4zh import TextRank4Ke... | code_fim | hard | {
"lang": "python",
"repo": "cy486/DomRead",
"path": "/hotword/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if ch_fich.upper()=="OUI":
nouv_fich.close()
# ----------------- Fonction SCAN d'@IP du réseau local
def ip_local():
aff_err="OUI" #Par défaut, variable aff_err en OUI pour afficher toutes les erreurs
port=14528 #port utilisé pou... | code_fim | hard | {
"lang": "python",
"repo": "Diissolution/sysscan-projet-python-s2-rt",
"path": "/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Diissolution/sysscan-projet-python-s2-rt path: /client.py
# !/usr/bin/python3
import socket #nécéssaire pour la connexion entre les machines
import sys #nécéssaire pour afficher les erreurs système
import psutil #nécéssaire pour trouver les interfaces réseau de la machine
import ipaddress #... | code_fim | hard | {
"lang": "python",
"repo": "Diissolution/sysscan-projet-python-s2-rt",
"path": "/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jermnelson/FRBR-Redis-Datastore path: /tests/test_frbr_rda_manifestation.py
'Parallel statement of responsibility relating to subseries (Manifestation)')
self.assertEquals(self.parallel_statement_of_responsibility_relating_to_subseries_key,
... | code_fim | hard | {
"lang": "python",
"repo": "jermnelson/FRBR-Redis-Datastore",
"path": "/tests/test_frbr_rda_manifestation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_layout_of_tactile_musical_notation(self):
layout_of_tactile_musical_notation_key = getattr(self.manifestation,
'Layout of tactile musical notation (Manifestation)')
self.assertEquals(self.layout_of_tactile_musical_notati... | code_fim | hard | {
"lang": "python",
"repo": "jermnelson/FRBR-Redis-Datastore",
"path": "/tests/test_frbr_rda_manifestation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEquals(getattr(self.manifestation,
'File size (Manifestation)'),
"300 MB")
def test_file_type(self):
file_type_key = getattr(self.manifestation,
'File type (Manifestation)')
... | code_fim | hard | {
"lang": "python",
"repo": "jermnelson/FRBR-Redis-Datastore",
"path": "/tests/test_frbr_rda_manifestation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@holobp.get("/channels")
@doc.summary("HoloLivers Channel Stats")
@doc.description(
"Fetch a list of channels stats, updated every 6 hours via cronjob."
)
@doc.produces(
{
"channels": doc.List(BiliChannelsModel),
"cached": doc.Boolean(
"Is the results cached or not?", T... | code_fim | hard | {
"lang": "python",
"repo": "JustHumanz/vtb-schedule",
"path": "/web/routes/hololive.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JustHumanz/vtb-schedule path: /web/routes/hololive.py
from sanic import Blueprint
from sanic.log import logger
from sanic.response import json
from sanic_openapi import doc
from utils import udumps
from utils.dbconn import (
fetch_channels,
fetch_data,
fetch_holobili,
hololive_ch... | code_fim | hard | {
"lang": "python",
"repo": "JustHumanz/vtb-schedule",
"path": "/web/routes/hololive.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># package imports
from .utils import color, rgb, colrgb
from .models import *
from .functions import *
from .levels import *
from .filters import *
from .xfilters import *
from .yfilters import *
from .ifilters import *
from .standard import *
from .compat import *
from .test import *<|fim_prefix|># re... | code_fim | medium | {
"lang": "python",
"repo": "adam-m-jcbs/xrb-sens-datashare",
"path": "/kepler_python_packages/python_scripts/color/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adam-m-jcbs/xrb-sens-datashare path: /kepler_python_packages/python_scripts/color/__init__.py
"""
Python module for color functions.
"""
import numpy as np
<|fim_suffix|>from .utils import color, rgb, colrgb
from .models import *
from .functions import *
from .levels import *
from .filters imp... | code_fim | medium | {
"lang": "python",
"repo": "adam-m-jcbs/xrb-sens-datashare",
"path": "/kepler_python_packages/python_scripts/color/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gsalgado/asyncio-run-in-process path: /tests/core/test_remote_exception.py
import logging
import os
import sys
import cloudpickle
from asyncio_run_in_process._utils import (
RemoteException,
)
def test_RemoteException(caplog):
logger = logging.getLogger('asyncio_run_in_process.testing... | code_fim | medium | {
"lang": "python",
"repo": "gsalgado/asyncio-run-in-process",
"path": "/tests/core/test_remote_exception.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inner_func()
def inner_func():
raise ValueError("Some Error")
with caplog.at_level(logging.DEBUG):
local_err = recorder_func()
assert isinstance(local_err, ValueError)
assert "Some Error" in caplog.text
assert "outer_func" in caplog.text
assert "inner_func... | code_fim | hard | {
"lang": "python",
"repo": "gsalgado/asyncio-run-in-process",
"path": "/tests/core/test_remote_exception.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeunginLyu/MannyTheMan path: /ServoTest.py
import RPi.GPIO as GPIO
import models
from time import sleep
# RaspberryPi Pin initialization
outPinA = 2
outPinB = 3
outPinC = 4
outPinD = 7
<|fim_suffix|>GPIO.setup(outPinA, GPIO.OUT)
GPIO.setup(outPinB, GPIO.OUT)
GPIO.setup(outPinC, GPIO.OUT)
GPIO.... | code_fim | medium | {
"lang": "python",
"repo": "SeunginLyu/MannyTheMan",
"path": "/ServoTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> GPIO.output(pin, False)
pwm.ChangeDutyCycle(0)
setServoAngle(90, outPinA)
setServoAngle(90, outPinB)
setServoAngle(90, outPinC)
setServoAngle(90, outPinD)
pwm.stop()
GPIO.cleanup()<|fim_prefix|># repo: SeunginLyu/MannyTheMan path: /ServoTest.py
import RPi.GPIO as GPIO
import models
from time ... | code_fim | hard | {
"lang": "python",
"repo": "SeunginLyu/MannyTheMan",
"path": "/ServoTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tRight = tempNode.right
tempNode.right = newNode
newNode.left = tRight
res.append(copiedTree)
moveCount += 1
if newNode.left == None and newNode.right == None:
break
return res
... | code_fim | hard | {
"lang": "python",
"repo": "trilliwon/LeetCode",
"path": "/medium/unique-binary-search-trees-ii.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trilliwon/LeetCode path: /medium/unique-binary-search-trees-ii.py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def copy(self, node) -> TreeNode:
n... | code_fim | hard | {
"lang": "python",
"repo": "trilliwon/LeetCode",
"path": "/medium/unique-binary-search-trees-ii.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generateTrees(self, n: int) -> List[TreeNode]:
bsts = [[], [TreeNode(1)]]
for x in range(2, n+1):
bst_with_node = self.createBSTs(x, bsts[x-1])
bsts.append(bst_with_node)
return bsts[n]<|fim_prefix|># repo: trilliwon/LeetCode path: /medium/unique... | code_fim | hard | {
"lang": "python",
"repo": "trilliwon/LeetCode",
"path": "/medium/unique-binary-search-trees-ii.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.