text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: teshomegit/botty-bot-bot-bot path: /utils/download-history.py
#!/usr/bin/env python3
import json, os, sys, logging, time, re
import urllib.request, shutil
from slackclient import SlackClient
if not 2 <= len(sys.argv) <= 3:
print("Usage: {} SLACK_API_TOKEN [SAVE_FOLDER]".format(sys.argv[0])... | code_fim | hard | {
"lang": "python",
"repo": "teshomegit/botty-bot-bot-bot",
"path": "/utils/download-history.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chenmengchieh2012/ESPCentralController path: /controller/databaseAPI.py
from flask import Flask, render_template, Blueprint, redirect, make_response, request, jsonify
from model.sqlite import SQliteBridge, getDB
from model.espData import *
from util.ResponseData import ResponseData
import json, a... | code_fim | medium | {
"lang": "python",
"repo": "chenmengchieh2012/ESPCentralController",
"path": "/controller/databaseAPI.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res.mimetype = 'application/json'
return res
@databaseAPI.route('/', methods=['DELETE'], strict_slashes=False)
def deleteMeasurements():
data = request.args
db = getDB()
espName = data.get('espName')
isDeleted = db.deletebyTableName('rssi_measurements', esp = espName)
resData = ResponseData()
if ... | code_fim | hard | {
"lang": "python",
"repo": "chenmengchieh2012/ESPCentralController",
"path": "/controller/databaseAPI.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JessicaHamilton/PHYS-3210 path: /Week 05/exercise08.py
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 16 10:07:36 2019
@author: hamil
"""
import numpy as np
import matplotlib.pyplot as plt
#Step one create two arrays for x values and the sin of those x values
sinx_array = []
cosx_array = []
x... | code_fim | hard | {
"lang": "python",
"repo": "JessicaHamilton/PHYS-3210",
"path": "/Week 05/exercise08.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Plot everything
plt.plot(x_array, value7, color = "purple", label = "Python's Gradient Function")
plt.plot(x_array, value5, color = 'blue', label = "Forward Difference")
plt.plot(x_array, negsinx_array, color= 'green', label= "Python's Neg. Sin Function")
plt.plot(x_array, cosx_array, linestyle = 'dashed... | code_fim | hard | {
"lang": "python",
"repo": "JessicaHamilton/PHYS-3210",
"path": "/Week 05/exercise08.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Compare with the numpy function for the gradient
plt.plot(x_array, value3, color = "purple", label = "Python's Gradient Function")
plt.plot(x_array, value1, color = 'blue', label = "Forward Difference")
plt.plot(x_array, sinx_array, linestyle= 'dashed', color= 'gray', label= "Sin Function")
plt.plot(x_ar... | code_fim | hard | {
"lang": "python",
"repo": "JessicaHamilton/PHYS-3210",
"path": "/Week 05/exercise08.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.name = type(self.__class__).__name__
self.functions = {"run_command": self.run_command}
self.workspace = GLOBAL_OBJECTS["WorkspaceManager"]
super().__init__(self.name, self.functions)
def run_command(self, query):
command = query["... | code_fim | medium | {
"lang": "python",
"repo": "hvuhsg/MultiSC",
"path": "/MultiSC/MultiServer/protocols/protocols_objects/admin_protocol.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hvuhsg/MultiSC path: /MultiSC/MultiServer/protocols/protocols_objects/admin_protocol.py
from __config__ import protocol_code_config as config
from ...global_objects import GLOBAL_OBJECTS
from ..protocol import Protocol
class AdminProtocol(Protocol):
<|fim_suffix|> command = query["comman... | code_fim | hard | {
"lang": "python",
"repo": "hvuhsg/MultiSC",
"path": "/MultiSC/MultiServer/protocols/protocols_objects/admin_protocol.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run_command(self, query):
command = query["command"]
admin = query.state["user"]
command_result, run_ok = self.workspace.run_command(command, admin["is_master"])
query.add_response(
{"result": command_result, "have error": not run_ok, "code": config.ok}
... | code_fim | medium | {
"lang": "python",
"repo": "hvuhsg/MultiSC",
"path": "/MultiSC/MultiServer/protocols/protocols_objects/admin_protocol.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Oscar-CM/Password path: /tester.py
import unittest
from password import Password, User
class Testing (unittest.TestCase):
def setUp(self):
self.new_person = Password("Oscar", "1234")
self.new_user = User ("Cheru", "123")
def test_init(self):
'''
Testing b... | code_fim | hard | {
"lang": "python",
"repo": "Oscar-CM/Password",
"path": "/tester.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_saveUser(self):
'''
Testing the User class
'''
self.new_user.saveUser()
self.assertEqual(len(User.user_list),1)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: Oscar-CM/Password path: /tester.py
import unittest
from password impor... | code_fim | hard | {
"lang": "python",
"repo": "Oscar-CM/Password",
"path": "/tester.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AMWA-TV/nmos-testing path: /nmostesting/mocks/Registry.py
ils.downgrade_resource(resource_type,
pre_resources[resource_id],
api_version)
if pos... | code_fim | hard | {
"lang": "python",
"repo": "AMWA-TV/nmos-testing",
"path": "/nmostesting/mocks/Registry.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AMWA-TV/nmos-testing path: /nmostesting/mocks/Registry.py
against concurrent subscription creation
self.subscription_lock.acquire()
subscription_ids = [id for id, subscription in self.get_resources()['subscription'].items()
if self._get_re... | code_fim | hard | {
"lang": "python",
"repo": "AMWA-TV/nmos-testing",
"path": "/nmostesting/mocks/Registry.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Only if until is after the start of the resource list
if len(sorted_list) > 0 and IS04Utils.compare_resource_version(until, sorted_list[0]['version']) > 0:
since_index = 0
until_index = 0
# find since index
for valu... | code_fim | hard | {
"lang": "python",
"repo": "AMWA-TV/nmos-testing",
"path": "/nmostesting/mocks/Registry.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fjiangAI/easykeras path: /easykeras/example/imdb_cnn.py
__author__ = 'jf'
from keras.layers import Dense, Dropout, Activation
from keras.layers import Embedding
from keras.layers import Conv1D, GlobalMaxPooling1D
import keras
from easykeras.example.imdb_util import get_train_test
from easykeras.e... | code_fim | hard | {
"lang": "python",
"repo": "fjiangAI/easykeras",
"path": "/easykeras/example/imdb_cnn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
# 主程序
x_train, y_train, x_test, y_test = get_train_test()
model_config = Config(get_config())
cnn_model = CnnModel(model_config)
# 设定编译参数
loss = 'binary_crossentropy'
optimizer = 'adam'
metrics = ['accuracy']
cnn_model.compile(loss=loss, opti... | code_fim | hard | {
"lang": "python",
"repo": "fjiangAI/easykeras",
"path": "/easykeras/example/imdb_cnn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def call(self, inputs):
"""
构建模型过程,使用函数式模型
:return:
"""
embedding_output = self.embedding_layer(inputs) # (?,400,50)
dropout_output = self.dropout_layer(embedding_output)
con_output = self.con_layer(dropout_output) # (?,398,250)
global_... | code_fim | hard | {
"lang": "python",
"repo": "fjiangAI/easykeras",
"path": "/easykeras/example/imdb_cnn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def repo_default_config():
ret = configparser.ConfigParser()
ret.add_section("core")
ret.set("core", "repositoryformatversion", "0")
ret.set("core", "filemode", "false")
ret.set("core", "bare", "false")
return ret<|fim_prefix|># repo: ShubhankarKG/VCS_learnings path: /vcs/utils... | code_fim | hard | {
"lang": "python",
"repo": "ShubhankarKG/VCS_learnings",
"path": "/vcs/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShubhankarKG/VCS_learnings path: /vcs/utils.py
import os
import configparser
def repo_path(repo, *path):
"""Compute path under repo's vcsdir"""
return os.path.join(repo.vcsdir, *path)
def repo_file(repo, *path, mkdir=False):
"""Same as repo_path, but create dirname(*path) if absen... | code_fim | hard | {
"lang": "python",
"repo": "ShubhankarKG/VCS_learnings",
"path": "/vcs/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ret.add_section("core")
ret.set("core", "repositoryformatversion", "0")
ret.set("core", "filemode", "false")
ret.set("core", "bare", "false")
return ret<|fim_prefix|># repo: ShubhankarKG/VCS_learnings path: /vcs/utils.py
import os
import configparser
def repo_path(repo, *path):
... | code_fim | hard | {
"lang": "python",
"repo": "ShubhankarKG/VCS_learnings",
"path": "/vcs/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._dateReader.ReadNextTimeStamp(), self._valueReader.ReadNextValue()
def ReadAll(self):
timearr = []
varr = []
while(self.HasMorePoints()):
t,v = self.ReadNext()
timearr.append(t)
varr.append(v)
return timearr, varr... | code_fim | medium | {
"lang": "python",
"repo": "kurakihx/py-tsz",
"path": "/bin/utils/tsc/timeseriesreader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kurakihx/py-tsz path: /bin/utils/tsc/timeseriesreader.py
import sys, numpy as np
sys.path.append('./')
from bin.utils.tsc.bitbuffer import BitBuffer
from bin.utils.tsc.timereader import TimeReader
from bin.utils.tsc.valuereader import ValueReader
class TimeSeriesReader(object):
def __init__(s... | code_fim | hard | {
"lang": "python",
"repo": "kurakihx/py-tsz",
"path": "/bin/utils/tsc/timeseriesreader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: recap-utr/arguebuf-python path: /arguebuf/model/typing.py
from typing import TypeVar
__all__ = ("TextType",)
TextType = TypeVar("TextType")
# AbstractNodeType = TypeVar("AbstractNodeType", bound=AbstractNode)
# AnalystType<|fim_suffix|>ceType = TypeVar("ResourceType", bound=Resource)
# SchemeNo... | code_fim | hard | {
"lang": "python",
"repo": "recap-utr/arguebuf-python",
"path": "/arguebuf/model/typing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ceType = TypeVar("ResourceType", bound=Resource)
# SchemeNodeType = TypeVar("SchemeNodeType", bound=SchemeNode)
# UserdataType = TypeVar("UserdataType", bound=Mapping)<|fim_prefix|># repo: recap-utr/arguebuf-python path: /arguebuf/model/typing.py
from typing import TypeVar
__all__ = ("TextType",)
TextT... | code_fim | medium | {
"lang": "python",
"repo": "recap-utr/arguebuf-python",
"path": "/arguebuf/model/typing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>("MetadataType", bound=Metadata)
# ParticipantType = TypeVar("ParticipantType", bound=Participant)
# ReferenceType = TypeVar("ReferenceType", bound=Reference)
# ResourceType = TypeVar("ResourceType", bound=Resource)
# SchemeNodeType = TypeVar("SchemeNodeType", bound=SchemeNode)
# UserdataType = TypeVar("U... | code_fim | medium | {
"lang": "python",
"repo": "recap-utr/arguebuf-python",
"path": "/arguebuf/model/typing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Sc.add(
Sphere(
material=blue_glass,
center=vec3(370.5, 165 / 2, -65 - 185 / 2),
radius=165 / 2,
shadow=False,
max_ray_depth=3,
),
importance_sampled=True,
)
# Render
img = Sc.render(samples_per_pixel=100,... | code_fim | hard | {
"lang": "python",
"repo": "lmondada/Python-Raytracer",
"path": "/example_cornellbox.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lmondada/Python-Raytracer path: /example_cornellbox.py
from sightpy import *
def main():
# Set Scene
Sc = Scene(ambient_color=rgb(0.00, 0.00, 0.00))
angle = -0
Sc.add_Camera(
screen_width=100,
screen_height=100,
look_from=vec3(278, 278, 800),
... | code_fim | hard | {
"lang": "python",
"repo": "lmondada/Python-Raytracer",
"path": "/example_cornellbox.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_art = 10000
emb_dimensions = 100
window_size = 3
iterations = 300
print("===================== PRE-PROCESSING =======================")
w2v = Word2VecTrainer(inFile="enwiki-latest-pages-articles.xml.bz2",
outFile=("emb_art_" + str(num_a... | code_fim | hard | {
"lang": "python",
"repo": "shubhvachher/THU--ACM_2019-2021",
"path": "/THU--NLP/ASSG1/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shubhvachher/THU--ACM_2019-2021 path: /THU--NLP/ASSG1/train.py
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
import numpy as np
from tqdm import tqdm
import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
from nltk.metrics.spearman import spe... | code_fim | hard | {
"lang": "python",
"repo": "shubhvachher/THU--ACM_2019-2021",
"path": "/THU--NLP/ASSG1/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> loss.backward()
optimizer.step()
running_loss = running_loss * 0.9 + loss.item() * 0.1
print("Loss: " + str(running_loss))
loss_history.append(running_loss)
new_spearman = self.test... | code_fim | hard | {
"lang": "python",
"repo": "shubhvachher/THU--ACM_2019-2021",
"path": "/THU--NLP/ASSG1/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> entry.save()
self.assertEqual(self.count_entries(self), 2)
entry.save()
self.assertEqual(self.count_entries(self), 2)
entry.delete()
self.assertEqual(self.count_entries(self), 0)
entry2.save()
self.assertEqual(self.count_entries(self), 0)
... | code_fim | hard | {
"lang": "python",
"repo": "uu-mofa/mofa",
"path": "/src/assistants/tests/test_models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uu-mofa/mofa path: /src/assistants/tests/test_models.py
# This program has been developed by students from the bachelor Computer Science at Utrecht University within the
# Software and Game project course
# ©Copyright Utrecht University Department of Information and Computing Sciences.
import dat... | code_fim | hard | {
"lang": "python",
"repo": "uu-mofa/mofa",
"path": "/src/assistants/tests/test_models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> python_35_dir = self.option('python-35-dir') or 'D:\\Tools\\Python35'
self.cmake_build('build', winbrew.cmake_args+(
'-DLIBDIR={0}'.format(winbrew.config.lib_path),
'-DPYTHON_INCLUDE_DIR={0}'.format(os.path.join(python_35_dir, 'include')),
))
def test(s... | code_fim | medium | {
"lang": "python",
"repo": "mfichman/winbrew",
"path": "/broken/blender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def install(self):
python_35_dir = self.option('python-35-dir') or 'D:\\Tools\\Python35'
self.cmake_build('build', winbrew.cmake_args+(
'-DLIBDIR={0}'.format(winbrew.config.lib_path),
'-DPYTHON_INCLUDE_DIR={0}'.format(os.path.join(python_35_dir, 'include')),
... | code_fim | medium | {
"lang": "python",
"repo": "mfichman/winbrew",
"path": "/broken/blender.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mfichman/winbrew path: /broken/blender.py
import winbrew
import sys
import os
class Blender(winbrew.Formula):
url = 'http://download.blender.org/source/blender-2.77a.tar.gz'
homepage = 'http://www.blender.org'
sha1 = '935793b3e9fd4d02c71f275aac3aca27cd58bdfb'
build_deps = ()
... | code_fim | medium | {
"lang": "python",
"repo": "mfichman/winbrew",
"path": "/broken/blender.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@job_cli_group.command()
@click.option(
"--address",
type=str,
default=None,
required=False,
help=(
"Address of the Ray cluster to connect to. Can also be specified "
"using the `RAY_ADDRESS` environment variable."
),
)
@click.argument("job-id", type=str)
@add_commo... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/job/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> address: Optional[str],
job_id: str,
headers: Optional[str],
verify: Union[bool, str],
):
"""Deletes a stopped job and its associated data from memory.
Only supported for jobs that are already in a terminal state.
Fails with exit code 1 if the job is not already stopped.
D... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/job/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ray-project/ray path: /dashboard/modules/job/cli.py
import json
import os
import sys
import pprint
import time
from subprocess import list2cmdline
from typing import Optional, Tuple, Union, Dict, Any
import click
import ray._private.ray_constants as ray_constants
from ray._private.storage impor... | code_fim | hard | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/job/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#Check if this is a form submission
handle_miner_post(flask.request.form)
#Get a list of currently configured miners
miners = bitHopper.Configuration.Miners.get_miners()
return flask.render_template('miner.html', miners=miners)
def handle_miner_post(post):
for item ... | code_fim | medium | {
"lang": "python",
"repo": "DavidVorick/bitHopper",
"path": "/bitHopper/Website/Miner_Page.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DavidVorick/bitHopper path: /bitHopper/Website/Miner_Page.py
from bitHopper.Website import app, flask
import btcnet_info
import bitHopper.Configuration.Miners
<|fim_suffix|> elif post['method'] == 'add':
bitHopper.Configuration.Miners.add(
post['username'], post['p... | code_fim | hard | {
"lang": "python",
"repo": "DavidVorick/bitHopper",
"path": "/bitHopper/Website/Miner_Page.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
con.execute("insert into public_table(c1, c2) values (1, 2)")
except sqlite3.DatabaseError, e:
print "DML command =>", e.args[0] # access ... prohibited<|fim_prefix|># repo: ghaering/pysqlite path: /doc/includes/sqlite3/authorizer.py
from pysqlite2 import dbapi2 as sqlite3
def authorize... | code_fim | medium | {
"lang": "python",
"repo": "ghaering/pysqlite",
"path": "/doc/includes/sqlite3/authorizer.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ghaering/pysqlite path: /doc/includes/sqlite3/authorizer.py
from pysqlite2 import dbapi2 as sqlite3
def authorizer_callback(action, arg1, arg2, dbname, source):
<|fim_suffix|>con = sqlite3.connect(":memory:")
con.executescript("""
create table public_table(c1, c2);
create table private_t... | code_fim | medium | {
"lang": "python",
"repo": "ghaering/pysqlite",
"path": "/doc/includes/sqlite3/authorizer.py",
"mode": "psm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
con.execute("select * from private_table")
except sqlite3.DatabaseError, e:
print "SELECT FROM private_table =>", e.args[0] # access ... prohibited
try:
con.execute("insert into public_table(c1, c2) values (1, 2)")
except sqlite3.DatabaseError, e:
print "DML command =>", e.args[0... | code_fim | medium | {
"lang": "python",
"repo": "ghaering/pysqlite",
"path": "/doc/includes/sqlite3/authorizer.py",
"mode": "spm",
"license": "Zlib",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# Parse the arguments and start the process
parser = argparse.ArgumentParser()
parser.add_argument("--only_cct",
help="optional argument for saving the fitness data.",
action='store_true')
parser.add_argument("--co... | code_fim | hard | {
"lang": "python",
"repo": "htaskiran/SPEA2-ICoptimizer",
"path": "/spea2/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not os.path.isdir(CIRCUIT_PROPERTIES["path_to_output"]):
raise SystemExit(f"There is no such direction "
f"{CIRCUIT_PROPERTIES['path_to_output']}")
# Create temp folder to perform simulations
file_handler = FileHandler(CIRCUIT_PROPERTIES['path_to_circuit'])... | code_fim | hard | {
"lang": "python",
"repo": "htaskiran/SPEA2-ICoptimizer",
"path": "/spea2/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: htaskiran/SPEA2-ICoptimizer path: /spea2/__main__.py
import argparse
import atexit
import logging
import time
import yaml
from .filehandler import FileHandler
from .IC import *
from .algorithm import EvolutionaryAlgorithm, Individual
def get_logger():
# Set logger configurations.
log_f... | code_fim | hard | {
"lang": "python",
"repo": "htaskiran/SPEA2-ICoptimizer",
"path": "/spea2/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: calvin-j/prune-ami-lambda path: /prune_ami.py
# Prune all AMIs older than X days that are not in use by a Launch Configuration provided a minimum of Y exists
import boto3
import logging
import os
from botocore.exceptions import ClientError
from datetime import datetime, timedelta
from dateutil.p... | code_fim | hard | {
"lang": "python",
"repo": "calvin-j/prune-ami-lambda",
"path": "/prune_ami.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def remove_image(image):
logger = logging.getLogger()
# Set log level to INFO
logger.setLevel(20)
# Remove the image and snapshots
snaps = []
for storage in image['BlockDeviceMappings']:
snaps.append(storage['Ebs']['SnapshotId'])
if dry_run == "false":
logger.... | code_fim | hard | {
"lang": "python",
"repo": "calvin-j/prune-ami-lambda",
"path": "/prune_ami.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ddervs/GreenGraph path: /greengraph/classes/Map.py
import numpy as np
import requests
from StringIO import StringIO
from matplotlib import image as img
class Map(object):
def __init__(self, latitude, longitude, satellite=True,
zoom=10, size=(400, 400), sensor=False):
... | code_fim | medium | {
"lang": "python",
"repo": "ddervs/GreenGraph",
"path": "/greengraph/classes/Map.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> green = self.green(threshold)
out = green[:, :, np.newaxis] * np.array([0, 1, 0])[np.newaxis, np.newaxis, :]
my_buffer = StringIO()
img.imsave(my_buffer, out, format='png')
return my_buffer.getvalue()<|fim_prefix|># repo: ddervs/GreenGraph path: /greengraph/classes... | code_fim | medium | {
"lang": "python",
"repo": "ddervs/GreenGraph",
"path": "/greengraph/classes/Map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def simulation(mode, arrival, service, network, fogTimeLimit, fogTimeToCloudTIme, time_end):
# [(arrival_time_at_fog, departure_time_from_system)]
whole_record = []
# fog={arrival_time_at_fog:service_time_remaining_in_fog, service_time_in_cloud, network_latency}
fog = {}
cloud_arr... | code_fim | hard | {
"lang": "python",
"repo": "MW-ZHOU/COMP9334_19T1",
"path": "/project/sim.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> # [(arrival_time_at_fog, departure_time_from_system)]
whole_record = []
# fog={arrival_time_at_fog:service_time_remaining_in_fog, service_time_in_cloud, network_latency}
fog = {}
cloud_arrival = {}
cloud = {}
fog_depart = []
net_depart = []
cloud_depart = []
... | code_fim | hard | {
"lang": "python",
"repo": "MW-ZHOU/COMP9334_19T1",
"path": "/project/sim.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MW-ZHOU/COMP9334_19T1 path: /project/sim.py
(1-beta)(t^(1-beta) - alpha_1^(1-beta)), use inverse transform method to generate random numbers
# with specific probability distribution.
_alpha_1 = service[0]
_alpha_2 = service[1]
_beta = service[2]
b_1 = ... | code_fim | hard | {
"lang": "python",
"repo": "MW-ZHOU/COMP9334_19T1",
"path": "/project/sim.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osbuild/osbuild path: /mounts/org.osbuild.xfs
#!/usr/bin/python3
"""
XFS mount service
Mount a XFS filesystem at the given location.
Host commands used: mount
"""
import sys
from typing import Dict
from osbuild import mounts
<|fim_suffix|>
def main():
service = XfsMount.from_args(sys.arg... | code_fim | hard | {
"lang": "python",
"repo": "osbuild/osbuild",
"path": "/mounts/org.osbuild.xfs",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def translate_options(self, options: Dict):
return ["-t", "xfs"] + super().translate_options(options)
def main():
service = XfsMount.from_args(sys.argv[1:])
service.main()
if __name__ == '__main__':
main()<|fim_prefix|># repo: osbuild/osbuild path: /mounts/org.osbuild.xfs
#!/... | code_fim | hard | {
"lang": "python",
"repo": "osbuild/osbuild",
"path": "/mounts/org.osbuild.xfs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
service = XfsMount.from_args(sys.argv[1:])
service.main()
if __name__ == '__main__':
main()<|fim_prefix|># repo: osbuild/osbuild path: /mounts/org.osbuild.xfs
#!/usr/bin/python3
"""
XFS mount service
Mount a XFS filesystem at the given location.
Host commands used: mount
"""
... | code_fim | medium | {
"lang": "python",
"repo": "osbuild/osbuild",
"path": "/mounts/org.osbuild.xfs",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> street = game_view.street()
# These values don't vary by street, so we cache them
if street in street_cache:
player_states.append(street_cache[street])
continue
if game_view.street() == Street.PREFLOP:
player_state = PlayerState(is_curr... | code_fim | hard | {
"lang": "python",
"repo": "hobbit19/Pokermon",
"path": "/pokermon/features/player_state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> win_odds_vs_worse: Optional[float] = None
tie_odds_vs_worse: Optional[float] = None
lose_odds_vs_worse: Optional[float] = None
def make_player_states(
player_index: int, game: GameView, hole_cards: HoleCards, board: Board
) -> List[PlayerState]:
player_states = []
street_cache: ... | code_fim | hard | {
"lang": "python",
"repo": "hobbit19/Pokermon",
"path": "/pokermon/features/player_state.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hobbit19/Pokermon path: /pokermon/features/player_state.py
# Features that describe the status of a single player
# Terminology:
# player: The selected player
# current_player: The player whose turn it is
from dataclasses import dataclass
from typing import Dict, List, Optional
import pyholdthem... | code_fim | hard | {
"lang": "python",
"repo": "hobbit19/Pokermon",
"path": "/pokermon/features/player_state.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fseasy/snakai path: /snakai/strategy/qlearning/state_encoder/state_encoder.py
# -*- coding: utf-8 -*-
"""state encoder
from GameState to index
"""
import logging
import itertools
from snakai import snake_state_machine as ssm
from snakai import snake_state_machine_util as ssm_util
from . import ... | code_fim | medium | {
"lang": "python",
"repo": "fseasy/snakai",
"path": "/snakai/strategy/qlearning/state_encoder/state_encoder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for e in self._encoders:
e.clear()
@property
def ids(self):
return self._state2id.values()
@property
def size(self):
"""get size
"""
return len(self._id2state)<|fim_prefix|># repo: fseasy/snakai path: /snakai/strategy/qlearning/state_e... | code_fim | hard | {
"lang": "python",
"repo": "fseasy/snakai",
"path": "/snakai/strategy/qlearning/state_encoder/state_encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def clear(self):
for e in self._encoders:
e.clear()
@property
def ids(self):
return self._state2id.values()
@property
def size(self):
"""get size
"""
return len(self._id2state)<|fim_prefix|># repo: fseasy/snakai path: /snakai/strat... | code_fim | medium | {
"lang": "python",
"repo": "fseasy/snakai",
"path": "/snakai/strategy/qlearning/state_encoder/state_encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_validate.aasert_called_once_with(request)
@mock.patch('openapi_core.shortcuts.RequestValidator.validate')
def test_request_factory(self, mock_validate):
spec = mock.sentinel.spec
request = mock.sentinel.request
body = mock.sentinel.body
mock_validate.r... | code_fim | hard | {
"lang": "python",
"repo": "srgkm/openapi-core",
"path": "/tests/unit/test_shortcuts.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: srgkm/openapi-core path: /tests/unit/test_shortcuts.py
import mock
import pytest
from openapi_core.shortcuts import (
validate_parameters, validate_body, validate_data,
)
class ResultMock(object):
def __init__(
self, body=None, parameters=None, data=None, error_to_raise=N... | code_fim | hard | {
"lang": "python",
"repo": "srgkm/openapi-core",
"path": "/tests/unit/test_shortcuts.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if max_amount is not None and val > max_amount:
raise Invalid('key: "{0}" contains invalid item "{1}": float is less then {2}'.format(key, val, max_amount))
return val
def list_validation(val, key=None, min_amount=None, max_amount=None):
if not isinstance(val, list):
raise I... | code_fim | hard | {
"lang": "python",
"repo": "Attumm/Maat",
"path": "/maat/maat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Attumm/Maat path: /maat/maat.py
import re
import sys
import json
import math
from uuid import UUID
from datetime import datetime
config = {
'depth_limit': (sys.getrecursionlimit() - 50)
}
special_arguments = ['nested', 'list', 'aso_array', 'skip_failed', 'null_able', 'optional', 'defa... | code_fim | hard | {
"lang": "python",
"repo": "Attumm/Maat",
"path": "/maat/maat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evilbluebeaver/erlport path: /examples/generator.py
import time
from erlport import Port, Protocol
from erlport import Atom
class EventGenerator(Protocol):
<|fim_suffix|>
if __name__ == "__main__":
proto = EventGenerator()
proto.run(Port(use_stdio=True))<|fim_middle|> def handle(se... | code_fim | medium | {
"lang": "python",
"repo": "evilbluebeaver/erlport",
"path": "/examples/generator.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
proto = EventGenerator()
proto.run(Port(use_stdio=True))<|fim_prefix|># repo: evilbluebeaver/erlport path: /examples/generator.py
import time
from erlport import Port, Protocol
from erlport import Atom
<|fim_middle|>
class EventGenerator(Protocol):
def handle(sel... | code_fim | medium | {
"lang": "python",
"repo": "evilbluebeaver/erlport",
"path": "/examples/generator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in mytimestr:
mye.drawDigit(int(i))
# mye.drawnum(i)
if __name__ == "__main__":
turtle.setup(1200, 1000, 200, 200)
turtle.penup()
turtle.backward(300)
turtle.pendown()
mytime(1,9,9,4,0,9,2,7)
turtle.pensize(6)
turtle.speed(8)
turtle.circle(-80,182)
turtle.forward(100)
turtle.left(30... | code_fim | easy | {
"lang": "python",
"repo": "python20180319howmework/homework",
"path": "/lifei1/20180329/4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python20180319howmework/homework path: /lifei1/20180329/4.py
import datetime
import l4 as mye
import turtle
<|fim_suffix|> for i in mytimestr:
mye.drawDigit(int(i))
# mye.drawnum(i)
if __name__ == "__main__":
turtle.setup(1200, 1000, 200, 200)
turtle.penup()
turtle.backward(300)
turtl... | code_fim | easy | {
"lang": "python",
"repo": "python20180319howmework/homework",
"path": "/lifei1/20180329/4.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maksimt/rri_nmf path: /src/rri_nmf/__init__.py
# from rri_nmf.nmf import * # now f() in nmf can be accessed by:
<|fim_suffix|>tion', 'optimization', 'matrixops',
'sklearn_interface']<|fim_middle|># import rri_nmf
# rri_nmf.f()
import rri_nmf.nmf
import rri_nmf.matrixops
import rri_nmf... | code_fim | medium | {
"lang": "python",
"repo": "maksimt/rri_nmf",
"path": "/src/rri_nmf/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tion', 'optimization', 'matrixops',
'sklearn_interface']<|fim_prefix|># repo: maksimt/rri_nmf path: /src/rri_nmf/__init__.py
# from rri_nmf.nmf import * # now f() in nmf can be accessed by:
<|fim_middle|># import rri_nmf
# rri_nmf.f()
import rri_nmf.nmf
import rri_nmf.matrixops
import rri_nmf... | code_fim | medium | {
"lang": "python",
"repo": "maksimt/rri_nmf",
"path": "/src/rri_nmf/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def nameChanged(self):
super().nameChanged()
name = self.ui.leName.text()
if self.validator["Name"] and len(name) != 2:
self.ui.leName.setToolTip("Attributsnamen müssen aus exakt zwei Zeichen bestehen.")
self.ui.leName.setStyleSheet("border: 1px solid re... | code_fim | hard | {
"lang": "python",
"repo": "Aeolitus/Sephrasto",
"path": "/src/Sephrasto/DatenbankEditAttributWrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aeolitus/Sephrasto path: /src/Sephrasto/DatenbankEditAttributWrapper.py
# -*- coding: utf-8 -*-
from Core.Attribut import AttributDefinition
import UI.DatenbankEditAttribut
from DatenbankElementEditorBase import DatenbankElementEditorBase, BeschreibungEditor
from PySide6 import QtWidgets, QtCore
... | code_fim | hard | {
"lang": "python",
"repo": "Aeolitus/Sephrasto",
"path": "/src/Sephrasto/DatenbankEditAttributWrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernardkkt/loguiado path: /lib/sensor/timestamp.py
import time
from . import SensorBase
from ..InterfaceResource import InterfaceResource, InterfaceSetting
class Timestamp(SensorBase.SensorBase):
"""
This sensor module generates timestamps
"""
def __init__(self):
name = ... | code_fim | hard | {
"lang": "python",
"repo": "bernardkkt/loguiado",
"path": "/lib/sensor/timestamp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read(self):
val = self._get_time() # Get time
if self.START_EPOCH is None:
self.START_EPOCH = val # Set offset
if self.parameters["type"] == "relative": # Return elapsed time since offset
if self.parameters["unit"] == "sec":
retur... | code_fim | hard | {
"lang": "python",
"repo": "bernardkkt/loguiado",
"path": "/lib/sensor/timestamp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.Message1_7 = Message(top)
self.Message1_7.place(relx=0.069, rely=0.689, relheight=0.222
, relwidth=0.348)
self.Message1_7.configure(background="#37474f")
self.Message1_7.configure(font=font14)
self.Message1_7.configure(foreground="#fff")
... | code_fim | hard | {
"lang": "python",
"repo": "priyamsahoo/Day-Zero-Diagnostics",
"path": "/test/Gateway.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: priyamsahoo/Day-Zero-Diagnostics path: /test/Gateway.py
import sys
from PIL import ImageTk
import PIL.Image
import subprocess
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
... | code_fim | hard | {
"lang": "python",
"repo": "priyamsahoo/Day-Zero-Diagnostics",
"path": "/test/Gateway.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andybalaam/pepper path: /old/pepper1/src/libpepper/builtins.py
# Copyright (C) 2011-2012 Andy Balaam and The Pepper Developers
# Released under the MIT License. See the file COPYING.txt for details.
from libpepper.vals.all_values import *
from libpepper.usererrorexception import PepUserErrorE... | code_fim | hard | {
"lang": "python",
"repo": "andybalaam/pepper",
"path": "/old/pepper1/src/libpepper/builtins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PepRuntimeLen( PepValue ):
def __init__( self, args ):
PepValue.__init__( self )
if( len( args ) != 1 ):
raise UserErrorException(
"There should only ever be one argument to len()" )
self.arg = args[0]
def construction_args( self ):
... | code_fim | hard | {
"lang": "python",
"repo": "andybalaam/pepper",
"path": "/old/pepper1/src/libpepper/builtins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SINTEF-Infosec/Incident-Information-Sharing-Tool path: /incidents/migrations/0008_notificationtype_subscriber.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
<|fim_suffix|> operations = [
migrations.AddField(
mod... | code_fim | medium | {
"lang": "python",
"repo": "SINTEF-Infosec/Incident-Information-Sharing-Tool",
"path": "/incidents/migrations/0008_notificationtype_subscriber.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('incidents', '0007_auto_20150320_1244'),
]
operations = [
migrations.AddField(
model_name='notificationtype',
name='subscriber',
field=models.ForeignKey(to='incidents.Subscriber', default='7e9fc912-1624-4d91-a7d4-4b536a41d... | code_fim | medium | {
"lang": "python",
"repo": "SINTEF-Infosec/Incident-Information-Sharing-Tool",
"path": "/incidents/migrations/0008_notificationtype_subscriber.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='notificationtype',
name='subscriber',
field=models.ForeignKey(to='incidents.Subscriber', default='7e9fc912-1624-4d91-a7d4-4b536a41dbf1'),
preserve_default=False,
),
]<|fim_prefix|># repo... | code_fim | medium | {
"lang": "python",
"repo": "SINTEF-Infosec/Incident-Information-Sharing-Tool",
"path": "/incidents/migrations/0008_notificationtype_subscriber.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robsonshockwave/mvc-academic-management-system-poo path: /grade.py
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import pickle
import os.path
import disciplina as disc
"""----------------------------------------------------------"""
# Possíveis erros que vão ser trat... | code_fim | hard | {
"lang": "python",
"repo": "robsonshockwave/mvc-academic-management-system-poo",
"path": "/grade.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Método getter para pegar o objeto grade
def getGradeObj(self, codigoGrade):
# Declara um objeto vazio
objGrade = None
# Se o código da grade passado como parâmetro é igual então ele retorna o objeto grade inteiro
for gra in self.gradesList:
if codigoGr... | code_fim | hard | {
"lang": "python",
"repo": "robsonshockwave/mvc-academic-management-system-poo",
"path": "/grade.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SimonBoothroyd/bayesiantesting path: /studies/mbar/gaussian.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 14:42:37 2019
@author: owenmadin
"""
import numpy
from bayesiantesting.kernels.bayes import MBARIntegration
from bayesiantesting.models.continuous import Cauc... | code_fim | hard | {
"lang": "python",
"repo": "SimonBoothroyd/bayesiantesting",
"path": "/studies/mbar/gaussian.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Draw the initial parameter values from the model priors.
initial_parameters = numpy.array([0.5])
# Set up log spaced lambda windows
lambda_values = numpy.geomspace(1.0, 2.0, 20) - 1.0
# Run the simulation
simulation = MBARIntegration(
lambda_values=lambda_values,
... | code_fim | hard | {
"lang": "python",
"repo": "SimonBoothroyd/bayesiantesting",
"path": "/studies/mbar/gaussian.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>1 <= s.length <= 5 * 10^5
s consists of 0's and 1's only.
1 <= k <= 20
"""
class Solution:
def hasAllCodes(self, s: str, k: int) -> bool:
def generate(l, i):
if i >= len(l):
yield ''.join(l)
else:
yield from generate(l, i + 1)
... | code_fim | hard | {
"lang": "python",
"repo": "franklingu/leetcode-solutions",
"path": "/questions/check-if-a-string-contains-all-binary-codes-of-size-k/Solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: franklingu/leetcode-solutions path: /questions/check-if-a-string-contains-all-binary-codes-of-size-k/Solution.py
"""
Given a binary string s and an integer k.
Return True if every binary code of length k is a substring of s. Otherwise, return False.
Example 1:
Input: s = "00110110", k = 2
Out... | code_fim | hard | {
"lang": "python",
"repo": "franklingu/leetcode-solutions",
"path": "/questions/check-if-a-string-contains-all-binary-codes-of-size-k/Solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hyped-247/rp path: /RP/views.py
from django.contrib.auth.models import User
from django.shortcuts import redirect
from django.views.generic import ListView
from Apt.models import Apt
from AptBuilding.models import AptBuilding
from Owner.models import Owner
from Renter.models import Renter
clas... | code_fim | hard | {
"lang": "python",
"repo": "Hyped-247/rp",
"path": "/RP/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = super(Home, self).get_context_data(**kwargs)
context['Apt'] = Apt.objects.all()
return context
def get_queryset(self):
return User.objects.all()<|fim_prefix|># repo: Hyped-247/rp path: /RP/views.py
from django.contrib.auth.models import User
from django.shor... | code_fim | hard | {
"lang": "python",
"repo": "Hyped-247/rp",
"path": "/RP/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['Apt'] = Apt.objects.all()
return context
def get_queryset(self):
return User.objects.all()<|fim_prefix|># repo: Hyped-247/rp path: /RP/views.py
from django.contri... | code_fim | hard | {
"lang": "python",
"repo": "Hyped-247/rp",
"path": "/RP/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kotcmm/clipboard-data path: /binding.gyp
{
"targets": [{
"target_name": "ClipboardData",
"dependencies" : [
"gyp/libpng.gyp:libpng"
],
"include_dirs" : [
"src",
"modules/clip",
"modules/lpng",
"modules/zlib",
"src/configs"
],
"sources"... | code_fim | hard | {
"lang": "python",
"repo": "kotcmm/clipboard-data",
"path": "/binding.gyp",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ["OS=='win'", {
"sources": [ "modules/clip/clip_win.cpp"],
'msvs_disabled_warnings': [
4244, # conversion from 'unsigned long' to 'uint8_t', possible loss of data
]
}]
]
}]
}<|fim_prefix|># repo: kotcmm/clipboard-data path: /binding... | code_fim | hard | {
"lang": "python",
"repo": "kotcmm/clipboard-data",
"path": "/binding.gyp",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dagster-io/dagster path: /python_modules/dagster/dagster_tests/execution_tests/test_input_values_from_intermediates.py
from dagster import In, List, Optional, job, op
def test_from_intermediates_from_multiple_outputs():
@op
def x():
return "x"
@op
def y():
retur... | code_fim | hard | {
"lang": "python",
"repo": "dagster-io/dagster",
"path": "/python_modules/dagster/dagster_tests/execution_tests/test_input_values_from_intermediates.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @job
def pipe():
x()
result = pipe.execute_in_process(run_config=run_config)
assert result
assert result.success
step_input_event = next(
(
evt
for evt in result.events_for_node("x")
if evt.event_type_value == "STEP_INPUT"
... | code_fim | hard | {
"lang": "python",
"repo": "dagster-io/dagster",
"path": "/python_modules/dagster/dagster_tests/execution_tests/test_input_values_from_intermediates.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hagryph/Auto-Matchmaking path: /AutoMM.pyw
ona": "89",
"Malzahar": "90", "Talon": "91", "Riven": "92", "KogMaw": "96", "Shen": "98", "Lux": "99", "Xerath": "101",
"Shyvana": "102", "Ahri": "103", "Graves": "104", "Fizz": "105", "Volibear": "106", "Rengar": "107",
... | code_fim | hard | {
"lang": "python",
"repo": "Hagryph/Auto-Matchmaking",
"path": "/AutoMM.pyw",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> layout = [[sg.Text('League Path'),
sg.Input(default_text=config["dir"], key='_INPUT_', justification="left")],
[sg.Text('Roles'),
sg.Drop(values=list(roleName.values()),
default_value=roleName[rolePriority[0].lower()], size=(10, 1)... | code_fim | hard | {
"lang": "python",
"repo": "Hagryph/Auto-Matchmaking",
"path": "/AutoMM.pyw",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> index_list = []
for champion in config['banPrio']['mid']:
index_list.append(championNames.index(champion))
window['_BANS_MIDLANE_'].Update(set_to_index=index_list)
index_list = []
for champion in con... | code_fim | hard | {
"lang": "python",
"repo": "Hagryph/Auto-Matchmaking",
"path": "/AutoMM.pyw",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: piccolo-orm/piccolo path: /tests/utils/test_encoding.py
from unittest import TestCase
from piccolo.utils.encoding import dump_json, load_json
<|fim_suffix|> """
Test dumping then loading an object.
"""
payload = {"a": [1, 2, 3]}
self.assertEqual(load_json(... | code_fim | medium | {
"lang": "python",
"repo": "piccolo-orm/piccolo",
"path": "/tests/utils/test_encoding.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.