text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> dependencies = [
('hmlvaraus', '0025_berth_reserving_staff_member'),
]
operations = [
migrations.AlterField(
model_name='hmlreservation',
name='state_updated_at',
field=models.DateTimeField(blank=True, null=True, verbose_name='Time of modifi... | code_fim | medium | {
"lang": "python",
"repo": "CityOfHameenlinna/hmlvaraus-backend",
"path": "/hmlvaraus/migrations/0026_auto_20180427_0925.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('hmlvaraus', '0025_berth_reserving_staff_member'),
]
operations = [
migrations.AlterField(
model_name='hmlreservation',
name='state_updated_at',
field=models.DateTimeField(blank=True,... | code_fim | medium | {
"lang": "python",
"repo": "CityOfHameenlinna/hmlvaraus-backend",
"path": "/hmlvaraus/migrations/0026_auto_20180427_0925.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CityOfHameenlinna/hmlvaraus-backend path: /hmlvaraus/migrations/0026_auto_20180427_0925.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2018-04-27 06:25
from __future__ import unicode_literals
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='hmlr... | code_fim | medium | {
"lang": "python",
"repo": "CityOfHameenlinna/hmlvaraus-backend",
"path": "/hmlvaraus/migrations/0026_auto_20180427_0925.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> CloseMessageWindow()
Sound(895, 0, 100, 0)
BeginChrThread(0x1F, 0, 0, 36)
PlayEffect(0x0, 0xFF, 0x1A, 0x3, 0, 400, -100, 0, 0, 0, 650, 650, 650, 0xFF, 0, 0, 0, 0)
PlayEffect(0x2, 0xFF, 0x1A, 0x3, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 0xFF, 0, 0, 0, 0)
Sleep(800)
NpcTalk(
... | code_fim | hard | {
"lang": "python",
"repo": "GeofrontTeam/EDDecompiler",
"path": "/Decompiler/p/scena/e3020.梅尔卡瓦.bin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Return()
# Function_33_A792 end
def Function_34_A7B5(): pass
label("Function_34_A7B5")
Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_A7D9")
OP_82(0xA, 0xA, 0xBB8, 0x1F4)
Sleep(500)
Jump("Function_34_A7B5")
label("loc_A7D9")
Return()... | code_fim | hard | {
"lang": "python",
"repo": "GeofrontTeam/EDDecompiler",
"path": "/Decompiler/p/scena/e3020.梅尔卡瓦.bin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeofrontTeam/EDDecompiler path: /Decompiler/p/scena/e3020.梅尔卡瓦.bin.py
scpstr(0x7, 0x5),
"出来迎接的芙兰\x01",
"冲上去抱住了诺艾尔,\x01",
"低声抽泣不止……\x02\x03",
"而诺艾尔在安抚妹妹的同时,\x01",
"双目也已湿润,泛出了泪水。\x07\x00\x02",
)
)
CloseMessageWind... | code_fim | hard | {
"lang": "python",
"repo": "GeofrontTeam/EDDecompiler",
"path": "/Decompiler/p/scena/e3020.梅尔卡瓦.bin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # This is the main loop.
while not rospy.is_shutdown():
if (math.isnan(self.scan.ranges[320]) or
self.scan.ranges[320] < self.TARGET):
twist.linear.x = -.1
twist.angular.z = 0
else:
twist.linear.x = .1... | code_fim | hard | {
"lang": "python",
"repo": "JMU-Robotics-Club/example_code",
"path": "/approach_oo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(self):
""" Move forward or backward to achieve the target distance. """
twist = Twist()
rate = rospy.Rate(10)
# Wait until the first scan message is available
while self.scan is None and not rospy.is_shutdown():
rospy.sleep(.1)
# ... | code_fim | hard | {
"lang": "python",
"repo": "JMU-Robotics-Club/example_code",
"path": "/approach_oo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JMU-Robotics-Club/example_code path: /approach_oo.py
#!/usr/bin/env python
"""
Simple example of subscribing to sensor messages and publishing
twist messages to the turtlebot. Object-oriented version.
Author: Nathan Sprague
Version: 2/29/2016
"""
import rospy
import math
# Twist is the messag... | code_fim | hard | {
"lang": "python",
"repo": "JMU-Robotics-Club/example_code",
"path": "/approach_oo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>heatmaps = {}
for lecture_id, counts in lectures.iteritems():
heatmaps[lecture_id] = [0] * lecture_mins[lecture_id]
for minute in sorted(lectures[lecture_id]):
heatmaps[lecture_id][minute] = lectures[lecture_id][minute]
print json.dumps(heatmaps)<|fim_prefix|># repo: kevinwang/moca path:... | code_fim | hard | {
"lang": "python",
"repo": "kevinwang/moca",
"path": "/gen_heatmaps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinwang/moca path: /gen_heatmaps.py
#!/usr/bin/env python
"""Generate play/pause/seeked event heatmaps from raw Coursera event data.
Usage: grep 'user\.video\.lecture\.action.*\(play\|pause\|seeked\)' *ClickStreamData_NonPII.csv | cut -d, -f3,10,13 | sed -E 's/https:\/\/class.coursera.org\/.*\... | code_fim | hard | {
"lang": "python",
"repo": "kevinwang/moca",
"path": "/gen_heatmaps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soxoj/telegram-bot-dumper path: /bot_test.py
import json
import shutil
import os
import pytest
from telethon.sync import TelegramClient
from dumper import *
bot = None
@pytest.mark.asyncio
async def test_dumper():
global bot
if os.path.exists('5080069482'):
shutil.rmtree('50... | code_fim | hard | {
"lang": "python",
"repo": "soxoj/telegram-bot-dumper",
"path": "/bot_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert chat_history == """[5][378410969][2021-12-05 14:01:23+00:00] MessageActionChatCreate(title='Soxoj & Test Dumper Serjfios34', users=[378410969, 5080069482])
[6][378410969][2021-12-05 14:01:23+00:00] Photo of chat was changed: media/5289906529388049862.jpg
[7][378410969][2021-12-05 14:01:37+00:00... | code_fim | hard | {
"lang": "python",
"repo": "soxoj/telegram-bot-dumper",
"path": "/bot_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> chat_history = open('5080069482/660191274/660191274_history.txt').read()
assert chat_history == """[5][378410969][2021-12-05 14:01:23+00:00] MessageActionChatCreate(title='Soxoj & Test Dumper Serjfios34', users=[378410969, 5080069482])
[6][378410969][2021-12-05 14:01:23+00:00] Photo of chat was c... | code_fim | hard | {
"lang": "python",
"repo": "soxoj/telegram-bot-dumper",
"path": "/bot_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if optim_args.lr_throttle:
# Reducing the lr here for the recurrent layers helps with stability,
# To date (July 21, 2021), we may only need this for maze models.
base_params = [p for n, p in net.named_parameters() if "recur" not in n]
recur_params = [p for n, p in net.... | code_fim | hard | {
"lang": "python",
"repo": "mcleish7/MLRC-deep-thinking",
"path": "/deepthinking/utils/tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcleish7/MLRC-deep-thinking path: /deepthinking/utils/tools.py
""" tools.py
Utility functions that are common to all tasks
Collaboratively developed
by Avi Schwarzschild, Eitan Borgnia,
Arpit Bansal, and Zeyad Emam.
Developed for DeepThinking project
October 2021
"""
imp... | code_fim | hard | {
"lang": "python",
"repo": "mcleish7/MLRC-deep-thinking",
"path": "/deepthinking/utils/tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UIUC-SULLIVAN/ThesisProject_Andrea_Mattera path: /Clustering Sensors with Hadoop/reduce_group_sensors.py
#!/usr/bin/env python2
from geopy.distance import vincenty
import sys
import datetime as dt
sens=0
l=[]
di={} #{number of sensor: ((lat,lon),captured time)}
fmt="%Y-%m-%d %H:%M:%S"
dist=No... | code_fim | hard | {
"lang": "python",
"repo": "UIUC-SULLIVAN/ThesisProject_Andrea_Mattera",
"path": "/Clustering Sensors with Hadoop/reduce_group_sensors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r=[(x[0],y) for x,y in zip(di.values(),di.keys()) if abs(x[1]-date).total_seconds()<time_threshold]
tmp=[vincenty(p,c[0]).meters for c in r]
try:
m=min(tmp)
except ValueError: #there are no measurements in "time_threshold" mins after the previous one
sens+=1 #another sens... | code_fim | hard | {
"lang": "python",
"repo": "UIUC-SULLIVAN/ThesisProject_Andrea_Mattera",
"path": "/Clustering Sensors with Hadoop/reduce_group_sensors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AgentShir/scout_apm_python path: /src/scout_apm/instruments/pymongo.py
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
# Used in the exec() call below.
from scout_apm.core.monkey import monkeypatch_method, unpatch_method # noqa: ... | code_fim | hard | {
"lang": "python",
"repo": "AgentShir/scout_apm_python",
"path": "/src/scout_apm/instruments/pymongo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def installable(self):
try:
from pymongo.collection import Collection # noqa: F401
except ImportError:
logger.info("Unable to import for PyMongo instruments")
return False
if self.installed:
logger.warning("PyMongo Instruments ar... | code_fim | hard | {
"lang": "python",
"repo": "AgentShir/scout_apm_python",
"path": "/src/scout_apm/instruments/pymongo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gregga/iot-sdks-e2e-fx path: /test-runner/docker_log_watcher.py
#!/usr/bin/env python
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
from multiprocessing import Process, Queue, Event
from threa... | code_fim | hard | {
"lang": "python",
"repo": "gregga/iot-sdks-e2e-fx",
"path": "/test-runner/docker_log_watcher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.queue.put(self.kill_marker)
def enable(self):
self.silent = False
def flush_and_disable(self):
self.flush_complete.clear()
self.queue.put(self.flush_marker)
self.flush_complete.wait()
def queue_reader(self):
while True:
line =... | code_fim | hard | {
"lang": "python",
"repo": "gregga/iot-sdks-e2e-fx",
"path": "/test-runner/docker_log_watcher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pantheon5100/fmcw-finetune-RKD path: /fine-tune/model/model_dense.py
import torch
import torch.nn as nn
from torchvision import models
from tensorboardX import SummaryWriter
import torch.nn.functional as F
class DenseNet(torch.nn.Module):
def __init__(self, pretrained=True, arc='121'):
<|fi... | code_fim | hard | {
"lang": "python",
"repo": "pantheon5100/fmcw-finetune-RKD",
"path": "/fine-tune/model/model_dense.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return out
class Dense(torch.nn.Module):
def __init__(self, pretrained=True, arc='121'):
super().__init__()
self.dense = DenseNet(pretrained=pretrained, arc=arc)
if arc == '121':
self.fc = torch.nn.Linear(1024, 6)
elif arc == '161':
sel... | code_fim | medium | {
"lang": "python",
"repo": "pantheon5100/fmcw-finetune-RKD",
"path": "/fine-tune/model/model_dense.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.dense(x)
x = self.fc(x)
return x
# if __name__ == '__main__':
# model = not
# print(model.state_dict())
#
# # writer = SummaryWriter(comment='distribution-o')
# # print(model.state_dict())
# # writer.add_histogram('distribution centers3', model.state_... | code_fim | hard | {
"lang": "python",
"repo": "pantheon5100/fmcw-finetune-RKD",
"path": "/fine-tune/model/model_dense.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> output = new_output(output_type='display_data', metadata={'papermill': {}})
nb = new_notebook(cells=[new_code_cell('test', outputs=[output])])
assert _get_notebook_outputs(nb) == {}
def test_no_outputs_with_markdown(self):
nb = new_notebook(cells=[new_markdown_cell('th... | code_fim | hard | {
"lang": "python",
"repo": "ctb/papermill",
"path": "/papermill/tests/test_api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ctb/papermill path: /papermill/tests/test_api.py
import unittest
import pytest
try:
from unittest.mock import patch
except ImportError:
from mock import patch
import pandas as pd
from pandas.util.testing import assert_frame_equal
from nbformat.v4 import new_notebook, new_code_cell, new... | code_fim | hard | {
"lang": "python",
"repo": "ctb/papermill",
"path": "/papermill/tests/test_api.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: withcat-net/sparc path: /utils.py
import logging
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S',
level=logging.INFO)
logger = logging.getLogger(__name__)
<|fim_suffix|> a_set = set([a for a in model_a.keys(... | code_fim | medium | {
"lang": "python",
"repo": "withcat-net/sparc",
"path": "/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a_set = set([a for a in model_a.keys()])
b_set = set([b for b in model_b.keys()])
if a_set != b_set:
logger.info('load with different params =>')
if len(a_set - b_set) > 0:
logger.info('Loaded weight does not have ' + str(a_set - b_set))
if len(b_set - a_set) > 0:
... | code_fim | medium | {
"lang": "python",
"repo": "withcat-net/sparc",
"path": "/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>dst = np.float32([[WIDTH, HEIGHT], # bottom right
[0, HEIGHT], # bottom left
[0, 0], # top left
[WIDTH, 0]]) # top right<|fim_prefix|># repo: abdullahsalah96/CarND-Advanced-Lane-Lines path: /config.py
impor... | code_fim | hard | {
"lang": "python",
"repo": "abdullahsalah96/CarND-Advanced-Lane-Lines",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abdullahsalah96/CarND-Advanced-Lane-Lines path: /config.py
import numpy as np
WIDTH = 1280 #width of the resized frame
HEIGHT = 720 #height of resized frame
ym_per_pix = 30 / 720 # meters per pixel in y dimension - should be changed according to setup of each camera
xm_per... | code_fim | hard | {
"lang": "python",
"repo": "abdullahsalah96/CarND-Advanced-Lane-Lines",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('')
return loss_eval
if __name__ == '__main__':
# parse args
args = parse_args()
# load data
args, data_val = load_data(args, dtype, 'val')
# setup loss object
loss_obj = Loss(args)
# initialize the model
assert(os.path.isfile(args.model))
print "Vali... | code_fim | hard | {
"lang": "python",
"repo": "yiyiliao/deep_marching_cubes",
"path": "/marching_cube/val.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yiyiliao/deep_marching_cubes path: /marching_cube/val.py
import numpy as np
import torch
from torch.autograd import Variable
import sys
import os
sys.path.append(os.path.join(os.getcwd(), 'model/cffi'))
import matplotlib as mpl
mpl.use('Agg')
from utils.visualize import save_occupancy_fig, save_m... | code_fim | hard | {
"lang": "python",
"repo": "yiyiliao/deep_marching_cubes",
"path": "/marching_cube/val.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # initialize the model
assert(os.path.isfile(args.model))
print "Validating with snapshotted model %s ..." % args.model
deep_marching_cubes = torch.load(args.model)
if torch.cuda.is_available():
deep_marching_cubes.cuda()
# validation
loss = run_val(deep_marching_cubes... | code_fim | hard | {
"lang": "python",
"repo": "yiyiliao/deep_marching_cubes",
"path": "/marching_cube/val.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cand_list: List[Union[CandidateEntry, Tuple[str, float]]],
query_info_obj_or_dict: Union[DataEntryFields, dict]) -> Dict[str, float]:
"""Score, but does not rank, a candidate list obtained from the candidate provider.
Note that this func... | code_fim | hard | {
"lang": "python",
"repo": "oaqa/FlexNeuART",
"path": "/flexneuart/ranker/bm25py.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oaqa/FlexNeuART path: /flexneuart/ranker/bm25py.py
#
# Copyright 2014+ Carnegie Mellon University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.ap... | code_fim | hard | {
"lang": "python",
"repo": "oaqa/FlexNeuART",
"path": "/flexneuart/ranker/bm25py.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.do_lower_case = not keep_case
self.query_field_name = query_field_name
self.fwd_indx = get_forward_index(resource_manager, index_field_name)
self.fwd_parsed_index = get_forward_index(resource_manager, idf_index_field_name)
assert self.fwd_parsed_index.indx.is... | code_fim | hard | {
"lang": "python",
"repo": "oaqa/FlexNeuART",
"path": "/flexneuart/ranker/bm25py.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: heidal/apollo path: /backend/apollo/elections/migrations/0007_election_keys.py
# Generated by Django 3.0.6 on 2020-05-13 21:06
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
("elections", "0006_frozen_to_closed"),
]
operations = [
migratio... | code_fim | medium | {
"lang": "python",
"repo": "heidal/apollo",
"path": "/backend/apollo/elections/migrations/0007_election_keys.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
("elections", "0006_frozen_to_closed"),
]
operations = [
migrations.AddField(
model_name="election",
name="public_key",
field=models.CharField(max_length=64, null=True),
),
migrations.AddField(
m... | code_fim | medium | {
"lang": "python",
"repo": "heidal/apollo",
"path": "/backend/apollo/elections/migrations/0007_election_keys.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fsspec/filesystem_spec path: /fsspec/implementations/webhdfs.py
# https://hadoop.apache.org/docs/r1.0.4/webhdfs.html
import logging
import os
import secrets
import shutil
import tempfile
import uuid
from contextlib import suppress
from urllib.parse import quote
import requests
from ..spec impo... | code_fim | hard | {
"lang": "python",
"repo": "fsspec/filesystem_spec",
"path": "/fsspec/implementations/webhdfs.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ls(self, path, detail=False):
out = self._call("LISTSTATUS", path=path)
infos = out.json()["FileStatuses"]["FileStatus"]
for info in infos:
self._process_info(info)
info["name"] = path.rstrip("/") + "/" + info["pathSuffix"]
if detail:
... | code_fim | hard | {
"lang": "python",
"repo": "fsspec/filesystem_spec",
"path": "/fsspec/implementations/webhdfs.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aarondettmann/modnar-ylgnizama path: /primes/prime.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import os
from pathlib import Path
PROG_NAME = 'prime'
HERE = os.path.abspath(os.path.dirname(__file__))
FILE_LAST_PRIME = os.path.join(HERE, '.last_prime')
LAST_PR... | code_fim | hard | {
"lang": "python",
"repo": "aarondettmann/modnar-ylgnizama",
"path": "/primes/prime.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if Path(FILE_LAST_PRIME).exists() and not args.reset:
with open(FILE_LAST_PRIME, 'r') as fp:
LAST_PRIME = int(fp.readline())
try:
print_primes()
except KeyboardInterrupt:
with open(FILE_LAST_PRIME, 'w') as fp:
fp.write(str(LAST_PRIME))
p... | code_fim | hard | {
"lang": "python",
"repo": "aarondettmann/modnar-ylgnizama",
"path": "/primes/prime.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser(prog=f'{PROG_NAME}')
parser.add_argument('--reset', '-r', action='store_true', help='reset count')
args = parser.parse_args()
if Path(FILE_LAST_PRIME).exists() and not args.reset:
with open(FILE_LAST_PRIME, 'r') as fp:
LAST_PRIME = int(... | code_fim | hard | {
"lang": "python",
"repo": "aarondettmann/modnar-ylgnizama",
"path": "/primes/prime.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>project = "simulai"
copyright = "2023, IBM"
author = "IBM"
version = "latest"
# -- General configuration
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.autosectionlabel",
]
autodoc_mock_imports = ["mpi4py"]
suppre... | code_fim | hard | {
"lang": "python",
"repo": "IBM/simulai",
"path": "/docs/conf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IBM/simulai path: /docs/conf.py
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup ----------------... | code_fim | hard | {
"lang": "python",
"repo": "IBM/simulai",
"path": "/docs/conf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> `%s`;
document.head.appendChild(Alert);
""" % (js)<|fim_prefix|># repo: mma1979/photongui path: /photongui/api/alert.py
js = """
window.alert = function(r){
window.customAlert(r, windowID)
}
"""
src = """
var Alert = d<|fim_middle|>ocument.createElement("script");
Alert.innerHTML = | code_fim | easy | {
"lang": "python",
"repo": "mma1979/photongui",
"path": "/photongui/api/alert.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mma1979/photongui path: /photongui/api/alert.py
js = """
window.alert = function(r){
window.custo<|fim_suffix|>ocument.createElement("script");
Alert.innerHTML = `%s`;
document.head.appendChild(Alert);
""" % (js)<|fim_middle|>mAlert(r, windowID)
}
"""
src = """
var Alert = d | code_fim | easy | {
"lang": "python",
"repo": "mma1979/photongui",
"path": "/photongui/api/alert.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiwon-choe/Brown-SMCSim path: /SMC/GEM5/utils/python/jsonparser/jsonparser.py
import json
import sys
# Convert json to txt
def print_recursive(prefix, d):
if isinstance(d, dict):
if ( "path" in d.keys() ):
prefix = d["path"]
for k in d.keys():
if ( p... | code_fim | medium | {
"lang": "python",
"repo": "jiwon-choe/Brown-SMCSim",
"path": "/SMC/GEM5/utils/python/jsonparser/jsonparser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(sys.argv) > 1:
s = sys.argv[1]
with open(s) as json_data:
d = json.load(json_data)
print_recursive("", d)<|fim_prefix|># repo: jiwon-choe/Brown-SMCSim path: /SMC/GEM5/utils/python/jsonparser/jsonparser.py
import json
import sys
# Convert json to txt
def print_recursive(pr... | code_fim | medium | {
"lang": "python",
"repo": "jiwon-choe/Brown-SMCSim",
"path": "/SMC/GEM5/utils/python/jsonparser/jsonparser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: therden/pytest path: /test_wallet.py
# test_wallet.py
import pytest
from wallet import Wallet, InsufficientAmount
<|fim_suffix|>@pytest.mark.parametrize("earned,spent,expected", [
(30, 10, 20),
(20, 2, 18),
])
def test_transactions(my_wallet, earned, spent, expected):
my_wallet.add_... | code_fim | medium | {
"lang": "python",
"repo": "therden/pytest",
"path": "/test_wallet.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture
def my_wallet():
'''Returns a Wallet instance with a zero balance'''
return Wallet()
@pytest.mark.parametrize("earned,spent,expected", [
(30, 10, 20),
(20, 2, 18),
])
def test_transactions(my_wallet, earned, spent, expected):
my_wallet.add_cash(earned)
my_wallet.sp... | code_fim | easy | {
"lang": "python",
"repo": "therden/pytest",
"path": "/test_wallet.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> my_wallet.add_cash(earned)
my_wallet.spend_cash(spent)
assert my_wallet.balance == expected<|fim_prefix|># repo: therden/pytest path: /test_wallet.py
# test_wallet.py
import pytest
from wallet import Wallet, InsufficientAmount
<|fim_middle|># test_wallet.py
@pytest.fixture
def my_wallet():... | code_fim | hard | {
"lang": "python",
"repo": "therden/pytest",
"path": "/test_wallet.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>def redraw_fn(f, ax):
img = imgs[f]
if not redraw_fn.initialized:
redraw_fn.img_handle = ax.imshow(img)
redraw_fn.last_time = time.time()
redraw_fn.text_handle = ax.text(0., 1 - 0.05,
'Resolution {}x{}, FPS: {:.2f}'.format(... | code_fim | medium | {
"lang": "python",
"repo": "puren/videofig",
"path": "/multiple_img.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: puren/videofig path: /multiple_img.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2020 bily Huazhong University of Science and Technology
#
# Distributed under terms of the MIT license.
from __future__ import absolute_import
from __future__ import division
from __... | code_fim | hard | {
"lang": "python",
"repo": "puren/videofig",
"path": "/multiple_img.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pisskidney/leetcode path: /medium/1302.py
from typing import List
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def __repr__(self):
return '{}'.format(self.val)
class Solution:
<|f... | code_fim | hard | {
"lang": "python",
"repo": "pisskidney/leetcode",
"path": "/medium/1302.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> q = [root]
res = 0
while q:
print(q)
res = sum([node.val for node in q])
newq = []
for node in q:
if node.left is not None:
newq.append(node.left)
if node.right is not None:
... | code_fim | medium | {
"lang": "python",
"repo": "pisskidney/leetcode",
"path": "/medium/1302.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ritksm/aliyun-openapi-python-sdk path: /aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/CreateExecutionPlanRequest.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional inform... | code_fim | hard | {
"lang": "python",
"repo": "ritksm/aliyun-openapi-python-sdk",
"path": "/aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/CreateExecutionPlanRequest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_TimeUnit(self):
return self.get_query_params().get('TimeUnit')
def set_TimeUnit(self,TimeUnit):
self.add_query_param('TimeUnit',TimeUnit)
def get_ClusterId(self):
return self.get_query_params().get('ClusterId')
def set_ClusterId(self,ClusterId):
self.add_query_param('Clust... | code_fim | hard | {
"lang": "python",
"repo": "ritksm/aliyun-openapi-python-sdk",
"path": "/aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/CreateExecutionPlanRequest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: streamlink/streamlink path: /src/streamlink/utils/path.py
from pathlib import Path
from shutil import which
from typing import List, Optional, Union
<|fim_suffix|> custom: Optional[Union[str, Path]] = None,
names: Optional[List[str]] = None,
fallbacks: Optional[List[Union[str, Path]]... | code_fim | easy | {
"lang": "python",
"repo": "streamlink/streamlink",
"path": "/src/streamlink/utils/path.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for item in (names or []) + (fallbacks or []):
executable = which(item)
if executable:
return executable
return None<|fim_prefix|># repo: streamlink/streamlink path: /src/streamlink/utils/path.py
from pathlib import Path
from shutil import which
from typing import Lis... | code_fim | hard | {
"lang": "python",
"repo": "streamlink/streamlink",
"path": "/src/streamlink/utils/path.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JmiXIII/ramstk path: /src/ramstk/dao/commondb/RAMSTKCondition.py
# * coding: utf8 *
#
# ramstk.dao.commondb.RAMSTKCondition.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 2017 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""RAMSTKCondition Table Module."... | code_fim | hard | {
"lang": "python",
"repo": "JmiXIII/ramstk",
"path": "/src/ramstk/dao/commondb/RAMSTKCondition.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
self.description = str(
none_to_default(attributes['description'],
'Condition Description'))
self.cond_type = str(
none_to_default(attributes['condition_type'], 'unknown'))
except KeyError as _err:... | code_fim | hard | {
"lang": "python",
"repo": "JmiXIII/ramstk",
"path": "/src/ramstk/dao/commondb/RAMSTKCondition.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Did we propagate properly?
mock_mod.get_files.assert_called_with(QueryDict('test=data'))
class DetectObjectsTest(TestCase):
@mock.patch('backend.views.object_detector')
def test_propagation(self, mock_mod):
'''
Tests propagation of the 'detect objects' request.... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-Bachelor-Project/mycroft",
"path": "/backend/test/test_unit/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Did we propagate properly?
mock_mod.export_filter.assert_called_with(42)
class ExportClipsTest(TestCase):
@mock.patch('backend.views.exporter')
def test_propagation(self, mock_mod):
'''
Tests propagation of the 'export clips' request.
:return: None
... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-Bachelor-Project/mycroft",
"path": "/backend/test/test_unit/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Software-Engineering-Bachelor-Project/mycroft path: /backend/test/test_unit/test_views.py
from django.test import TestCase
from django.http import QueryDict, HttpResponse
from rest_framework.test import APIRequestFactory
import unittest.mock as mock
import backend.views as views
class FilterCr... | code_fim | hard | {
"lang": "python",
"repo": "Software-Engineering-Bachelor-Project/mycroft",
"path": "/backend/test/test_unit/test_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^', include(router.urls)),
]<|fim_prefix|># repo: alexitosrv/ralph path: /src/ralph/data_center/urls/api.py
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from rest_framework import routers
from ralph.data_center.views.api import DataCenterAssetViewSet
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "alexitosrv/ralph",
"path": "/src/ralph/data_center/urls/api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexitosrv/ralph path: /src/ralph/data_center/urls/api.py
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from rest_framework import routers
<|fim_suffix|>router = routers.DefaultRouter()
router.register(r'data-center-assets', DataCenterAssetViewSet)
urlpatterns = [
url(r'... | code_fim | medium | {
"lang": "python",
"repo": "alexitosrv/ralph",
"path": "/src/ralph/data_center/urls/api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GustikS/PyNeuraLogic path: /neuralogic/utils/visualize/__init__.py
from typing import Optional
from neuralogic import get_neuralogic
from neuralogic.core.settings import Settings
from py4j.java_gateway import set_field
def get_drawing_settings(img_type="png"):
settings = Settings()
s... | code_fim | hard | {
"lang": "python",
"repo": "GustikS/PyNeuraLogic",
"path": "/neuralogic/utils/visualize/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if model.need_sync:
model.sync_template()
template = model.template
template_drawer = get_template_drawer(get_drawing_settings(img_type=img_type))
return draw(template_drawer, template, filename, draw_ipython, *args, **kwargs)
def draw_sample(sample, filename: Optional[str] = N... | code_fim | hard | {
"lang": "python",
"repo": "GustikS/PyNeuraLogic",
"path": "/neuralogic/utils/visualize/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangqianhui/Sparsely-Grouped-GAN path: /config/train_options.py
from .options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
parser.add_argument('--display_freq', type=int, default=100,... | code_fim | hard | {
"lang": "python",
"repo": "zhangqianhui/Sparsely-Grouped-GAN",
"path": "/config/train_options.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
parser.add_argument('--lam_c', type=float, default=1.0, help='weight for classification')
parser.add_argument('--n_critic', type=float, default=5, help='five dilabel_dirscriminator for every generator training')
parser.add_argument('--n_att', type=float, default=7, help='numbe... | code_fim | hard | {
"lang": "python",
"repo": "zhangqianhui/Sparsely-Grouped-GAN",
"path": "/config/train_options.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JucatL/MxPool path: /train.py
writer.add_image('graphs', data, epoch)
assignment = assign_tensor.cpu().data.numpy()
fig = plt.figure(figsize=(8,6), dpi=300)
num_clusters = assignment.shape[2]
all_colors = np.array(range(num_clusters))
for i in range(len(batch_idx)):
... | code_fim | hard | {
"lang": "python",
"repo": "JucatL/MxPool",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def arg_parse():
parser = argparse.ArgumentParser(description='GraphPool arguments.')
io_parser = parser.add_mutually_exclusive_group(required=False)
io_parser.add_argument('--dataset', dest='dataset',
help='Input dataset.')
benchmark_parser = io_parser.add_argu... | code_fim | hard | {
"lang": "python",
"repo": "JucatL/MxPool",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # log once per XX epochs
if epoch % 10 == 0 and batch_idx == len(dataset) // 2 and args.method == 'MxPool' and writer is not None:
log_assignment(model.assign_tensor, writer, epoch, writer_batch_idx)
if args.log_graph:
log_graph(a... | code_fim | hard | {
"lang": "python",
"repo": "JucatL/MxPool",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajax3101/trade_robot path: /trade_robot.py
import urllib, http.client
import time
import json
# ці модулі необхідні для генерації підпису API
import hmac, hashlib
# ввести ключі API, які надала біржа
API_KEY = 'YOUR API KEY'
# зверніть увагу, що, додана 'b' перед строкою
API_SECRET = ‘b'YOUR API ... | code_fim | hard | {
"lang": "python",
"repo": "ajax3101/trade_robot",
"path": "/trade_robot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
# Отримуємо список активних ордерів
try:
opened_orders = call_api('user_open_orders')[CURRENCY_1 + '_' + CURRENCY_2]
except KeyError:
if DEBUG:
print('Відкритих ордерів намає’)
opened_orders = []
sell_orders = []
... | code_fim | hard | {
"lang": "python",
"repo": "ajax3101/trade_robot",
"path": "/trade_robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
CURRENT_PAIR = CURRENCY_1 + '_' + CURRENCY_2
# всі звернення до API проходять через дану функцію
def call_api(api_method, http_method="POST", **kwargs):
payload = {'nonce': int(round(time.time()*1000))}
if kwargs:
payload.update(kwargs)
payload = urllib.parse.urlencode(payloa... | code_fim | hard | {
"lang": "python",
"repo": "ajax3101/trade_robot",
"path": "/trade_robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bcfriesen/BoxLib path: /Tools/F_scripts/write_probin.py
#!/usr/bin/env python
import sys
import string
import getopt
Header="""\
! DO NOT EDIT THIS FILE!!!
!
! This file is automatically generated by write_probin.py at
! compile-time.
!
! To add a runtime parameter, do so by editting the approp... | code_fim | hard | {
"lang": "python",
"repo": "bcfriesen/BoxLib",
"path": "/Tools/F_scripts/write_probin.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#=============================================================================
# write_probin will read through the list of parameter files and output
# the new outFile
#=============================================================================
def write_probin(probinTemplate, paramAFiles, paramBFile... | code_fim | hard | {
"lang": "python",
"repo": "bcfriesen/BoxLib",
"path": "/Tools/F_scripts/write_probin.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hanxiao/jina-app-store-example path: /backend/backend_config.py
# in executors.py
backend_model = "sentence-transformers/msmarco-distilbert-base-v3"
backend_top_k = 10
<|fim_suffix|># dataset
dataset_url = "https://github.com/alexcg1/ml-datasets/blob/master/nlp/strategy_games/appstore_games.csv?... | code_fim | hard | {
"lang": "python",
"repo": "hanxiao/jina-app-store-example",
"path": "/backend/backend_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># dataset
dataset_url = "https://github.com/alexcg1/ml-datasets/blob/master/nlp/strategy_games/appstore_games.csv?raw=true"
dataset_filename = 'appstore_games.csv'<|fim_prefix|># repo: hanxiao/jina-app-store-example path: /backend/backend_config.py
# in executors.py
backend_model = "sentence-transformer... | code_fim | hard | {
"lang": "python",
"repo": "hanxiao/jina-app-store-example",
"path": "/backend/backend_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scieloorg/Logger path: /tests/test_inspector.py
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from logger.inspector import Inspector
from unittest import TestCase
class MockCollection(object):
def __init__(self, website_id, collection_id, website_... | code_fim | medium | {
"lang": "python",
"repo": "scieloorg/Logger",
"path": "/tests/test_inspector.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> insp = Inspector('/var/www/scielo.br/2015-12-30_scielo.br.log.gz')
self.assertTrue(insp._is_valid_date())
def test_is_valid_date_in_filename_false(self):
insp = Inspector('/var/www/scielo.br/2015-31-12_scielo.br.log.gz')
self.assertFalse(insp._is_valid_date())
def... | code_fim | hard | {
"lang": "python",
"repo": "scieloorg/Logger",
"path": "/tests/test_inspector.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> normal_slice1 = content[:11]
smart_slice1 = diff.smart_slice(10)
assert smart_slice1[-1] == normal_slice1[-1]
assert len(smart_slice1) == len(normal_slice1) and len(smart_slice1) <= 15 # noqa
normal_slice2 = content[:31]
smart_slice2 = diff.smart_slice(30)... | code_fim | hard | {
"lang": "python",
"repo": "msdgwzhy6/code",
"path": "/tests/test_diff.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msdgwzhy6/code path: /tests/test_diff.py
# -*- coding: utf-8 -*-
import os
import shutil
from vilya.models.project import CodeDoubanProject
from vilya.models import git
from tests.base import TestCase
from vilya.libs import gyt
from vilya.libs.diff import rehunk, linehtml
from vilya.libs.perm... | code_fim | hard | {
"lang": "python",
"repo": "msdgwzhy6/code",
"path": "/tests/test_diff.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> repo = self._repo('test_diff_smart_slice.txt', bare=False)
content1 = 'a\n' * 100
content2 = 'a\n' * 5 + 'b\n' * 10 + 'a\n' * 20 + 'b\n' * 40
c1_sha = self._commit(repo, 'testfile', content1, 'msg1')
c2_sha = self._commit(repo, 'testfile', content2, 'msg2')
... | code_fim | hard | {
"lang": "python",
"repo": "msdgwzhy6/code",
"path": "/tests/test_diff.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mutalimov95/fastapi-mongodb-example path: /app/app/tests/conftest.py
import pytest
from app.core.config import settings
from app.db.mongodb import db
from app.tests.utils.user import authentication_token_from_email
from app.tests.utils.utils import get_server_api, get_superuser_token_headers
@... | code_fim | hard | {
"lang": "python",
"repo": "mutalimov95/fastapi-mongodb-example",
"path": "/app/app/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def db_teardown():
db.close_mongo_connection()
request.addfinalizer(db_teardown)<|fim_prefix|># repo: mutalimov95/fastapi-mongodb-example path: /app/app/tests/conftest.py
import pytest
from app.core.config import settings
from app.db.mongodb import db
from app.tests.utils.user import au... | code_fim | medium | {
"lang": "python",
"repo": "mutalimov95/fastapi-mongodb-example",
"path": "/app/app/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def logdir(self):
return(self.log_dir)
def advanced_search_file(self, my_file):
advanced_search_response_file = self.advanced_search_dir \
+ "/" + config['defaults']['OUTPUT'] + my_file
return(advanced_search_response_file)
def prop_id_search_file(self, my... | code_fim | hard | {
"lang": "python",
"repo": "jfrerich/getrealty",
"path": "/getrealty/mydirs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jfrerich/getrealty path: /getrealty/mydirs.py
import logging
import os
import pprint
import getrealty.settings
pp = pprint.PrettyPrinter(width=1)
config = getrealty.settings.config
logger = logging.getLogger(__name__)
class MyDirs(object):
"""Class for creating necessary directories fo... | code_fim | hard | {
"lang": "python",
"repo": "jfrerich/getrealty",
"path": "/getrealty/mydirs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def buildmydirs(self):
for dir in (self.cache_dir, self.advanced_search_dir, self.excel_dir):
print('dir = ', dir)
try:
os.makedirs(dir, exist_ok=True)
except Exception:
print("Creation of the directory %s failed" % dir)
... | code_fim | hard | {
"lang": "python",
"repo": "jfrerich/getrealty",
"path": "/getrealty/mydirs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamesabel/hello_briefcase path: /hello_briefcase/app.py
import os
import sysconfig
import _osx_support
import datetime
import site
import glob
import sys
from pprint import pprint
# TODO: THIS IS JUST A TEST FOR import ssl - DELETE THIS
#import ssl
#exit()
import hello_briefcase.spafit
for m ... | code_fim | hard | {
"lang": "python",
"repo": "jamesabel/hello_briefcase",
"path": "/hello_briefcase/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># this is the error I get:
#Traceback (most recent call last):
# File "/Users/james/projects/pycon_projects/hello_briefcase/hello_briefcase/macOS/hello_briefcase.app/Contents/Resources/python/lib/python3.5/runpy.py", line 193, in _run_module_as_main
# "__main__", mod_spec)
# File "/Users/james/projec... | code_fim | hard | {
"lang": "python",
"repo": "jamesabel/hello_briefcase",
"path": "/hello_briefcase/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def main_loop(self):
hello_message = 'hello briefcase!!!'
file_path = '/Users/james/projects/pycon_projects/hello_briefcase/hello_briefcase/hello_briefcase.txt'
out = [hello_message, str(datetime.datetime.now()), file_path]
with open(file_path, 'w') as f:
fo... | code_fim | medium | {
"lang": "python",
"repo": "jamesabel/hello_briefcase",
"path": "/hello_briefcase/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bennpham/ann-arbor path: /config/app.py
from os.path import dirname, realpath, <|fim_suffix|>DIR = path_join(PROJECT_ROOT, 'audits')<|fim_middle|>join as path_join
PROJECT_ROOT = dirname(dirname(realpath(__file__)))
AUDITS_ | code_fim | medium | {
"lang": "python",
"repo": "bennpham/ann-arbor",
"path": "/config/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bennpham/ann-arbor path: /config/app.py
from os.path import dirname, realpath, join as path_join
PROJECT_ROOT = dirna<|fim_suffix|>DIR = path_join(PROJECT_ROOT, 'audits')<|fim_middle|>me(dirname(realpath(__file__)))
AUDITS_ | code_fim | easy | {
"lang": "python",
"repo": "bennpham/ann-arbor",
"path": "/config/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>DIR = path_join(PROJECT_ROOT, 'audits')<|fim_prefix|># repo: bennpham/ann-arbor path: /config/app.py
from os.path import dirname, realpath, <|fim_middle|>join as path_join
PROJECT_ROOT = dirname(dirname(realpath(__file__)))
AUDITS_ | code_fim | medium | {
"lang": "python",
"repo": "bennpham/ann-arbor",
"path": "/config/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
self._validate.queue_listing(**kwargs)
results = self._queue_controller.list(
project=project_id, **kwargs)
except validation.ValidationFailed as ex:
LOG.debug(ex)
headers = {'status': 400}
return api_utils.er... | code_fim | hard | {
"lang": "python",
"repo": "Embedded4development/zaqar",
"path": "/zaqar/api/v1_1/endpoints.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Embedded4development/zaqar path: /zaqar/api/v1_1/endpoints.py
# Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apac... | code_fim | hard | {
"lang": "python",
"repo": "Embedded4development/zaqar",
"path": "/zaqar/api/v1_1/endpoints.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.