text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: IFRCGo/go-api path: /dref/migrations/0020_auto_20220725_1001.py
# Generated by Django 2.2.27 on 2022-07-25 10:01
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='RiskSecurity',
... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/dref/migrations/0020_auto_20220725_1001.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='RiskSecurity',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(choices=[('risk', 'Risk'), ('mitigation_act... | code_fim | hard | {
"lang": "python",
"repo": "IFRCGo/go-api",
"path": "/dref/migrations/0020_auto_20220725_1001.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dr-aryone/BiblioPixel path: /bibliopixel/animation/wrapper.py
from . indexed import Indexed
class Wrapper(Indexed):
"""
Wraps a single Animation.
<|fim_suffix|> @property
def animation(self):
return self.animations[0]<|fim_middle|> ``Wrapper`` is used as a base class ... | code_fim | hard | {
"lang": "python",
"repo": "dr-aryone/BiblioPixel",
"path": "/bibliopixel/animation/wrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def animation(self):
return self.animations[0]<|fim_prefix|># repo: dr-aryone/BiblioPixel path: /bibliopixel/animation/wrapper.py
from . indexed import Indexed
class Wrapper(Indexed):
"""
Wraps a single Animation.
``Wrapper`` is used as a base class for Pytho Anim... | code_fim | hard | {
"lang": "python",
"repo": "dr-aryone/BiblioPixel",
"path": "/bibliopixel/animation/wrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "\n".join(arr)
# COMPUTATION
# Run the simulation
previousArrangement = deepcopy(tileArrangement)
iteration = 1
while True:
print(f"=== Iteration {iteration} ===")
for i in range(len(previousArrangement)):
for j in range(len(previousArrangement[0])):
tile_type = g... | code_fim | hard | {
"lang": "python",
"repo": "PhotonicGluon/Advent-Of-Code-2020",
"path": "/Day 11: Seating System/day11-part2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PhotonicGluon/Advent-Of-Code-2020 path: /Day 11: Seating System/day11-part2.py
"""
day11-part2.py
Created on 2020-12-11
Updated on 2020-12-20
Copyright © Ryan Kan
"""
# IMPORTS
from copy import deepcopy
# INPUT
with open("input.txt", "r") as f:
lines = [line.strip() for line in f.readline... | code_fim | hard | {
"lang": "python",
"repo": "PhotonicGluon/Advent-Of-Code-2020",
"path": "/Day 11: Seating System/day11-part2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def print_arrangement(tile_arrangement):
"""
Prints the tile arrangement as a string.
Args:
tile_arrangement (List[List[str]])
Returns:
str:
String representation of the tiles.
"""
arr = []
for tile_row in tile_arrangement:
arr.append("".join... | code_fim | hard | {
"lang": "python",
"repo": "PhotonicGluon/Advent-Of-Code-2020",
"path": "/Day 11: Seating System/day11-part2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tinche/django-bower-cache path: /test_registry/test_api_views.py
from __future__ import absolute_import
import json
import tempfile
import envoy
from os import path
import shutil
from ._compat import mock
from registry.models import Package
from django.conf import settings
from django.test.ut... | code_fim | hard | {
"lang": "python",
"repo": "Tinche/django-bower-cache",
"path": "/test_registry/test_api_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Package.objects.create(name="ember", url="/foo")
url = reverse("search", kwargs={'name': 'wat'})
response = self.client.get(url)
self.assertEqual(200, response.status_code)
self.assertEqual('[]', response.content.decode())
def test_returns_list_of_packages_when... | code_fim | hard | {
"lang": "python",
"repo": "Tinche/django-bower-cache",
"path": "/test_registry/test_api_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def velocity_pid_gains(self):
return {'right_j0': {'p': 8.55378248e+01, 'i': 4.58211002e+00, 'd': 9.80858595e-02},
'right_j1': {'p': 7.72400386e+01, 'i': 2.57669899e+00, 'd': 4.23858218e-02},
'right_j2': {'p':5.35079700e+01, 'i':4.3095930... | code_fim | hard | {
"lang": "python",
"repo": "Lygggggg/sim2real_dynamics_simulation",
"path": "/robosuite-extra/robosuite_extra/models/robot/sawyer_robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lygggggg/sim2real_dynamics_simulation path: /robosuite-extra/robosuite_extra/models/robot/sawyer_robot.py
'''
Taken and modified from the original robosuite repository (version 0.1.0)
Our fork with version 0.1.0 : https://github.com/eugval/robosuite
Official Robosuite Repository : https://github... | code_fim | hard | {
"lang": "python",
"repo": "Lygggggg/sim2real_dynamics_simulation",
"path": "/robosuite-extra/robosuite_extra/models/robot/sawyer_robot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def actuators(self):
if (self.torque):
return ["torq_right_j{}".format(x) for x in range(7)]
else:
return ["vel_right_j{}".format(x) for x in range(7)]
@property
def init_qpos(self):
return np.array([0, -1.18, 0.00, 2.18, 0.00, 0.5... | code_fim | hard | {
"lang": "python",
"repo": "Lygggggg/sim2real_dynamics_simulation",
"path": "/robosuite-extra/robosuite_extra/models/robot/sawyer_robot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_fez.py
#calss header
class _FEZ():
def __init__(self,):
self.name = "FEZ"
self.definitions = [u'a high, cone-shaped hat with a flat top and no brim, usually made of red material and with threads hanging from the top, especially as worn in the ... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_fez.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Stampiamo la somma totale
print("La somma totale e' " + str(somma))<|fim_prefix|># repo: fablabws/coding-class-scratch-python path: /lezione1/python/esempio5_for.py
# Dichiariamo la somma uguale a 0
somma = 0
# Chiediamo il totale di numeri da sommare tra di loro e lo memorizziamo in n
print("Quanti n... | code_fim | hard | {
"lang": "python",
"repo": "fablabws/coding-class-scratch-python",
"path": "/lezione1/python/esempio5_for.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fablabws/coding-class-scratch-python path: /lezione1/python/esempio5_for.py
# Dichiariamo la somma uguale a 0
somma = 0
# Chiediamo il totale di numeri da sommare tra di loro e lo memorizziamo in n
print("Quanti numeri vuoi sommare?")
<|fim_suffix|># Chiediamo un nuovo numero tante volte quanto... | code_fim | medium | {
"lang": "python",
"repo": "fablabws/coding-class-scratch-python",
"path": "/lezione1/python/esempio5_for.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: savelov/nowcast path: /pysteps/tests/test_extrapolation_semilagrangian.py
# -*- coding: utf-8 -*-
import pytest
import pysteps
import numpy as np
from numpy.testing import assert_array_almost_equal
from pysteps.extrapolation.semilagrangian import extrapolate
<|fim_suffix|> """Tests semilagran... | code_fim | medium | {
"lang": "python",
"repo": "savelov/nowcast",
"path": "/pysteps/tests/test_extrapolation_semilagrangian.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Tests semilagrangian extrapolation."""
# inputs
precip = np.ones((8,8))
v = np.ones((8,8))
velocity = np.stack([v,v])
num_timesteps = 1
#expected
expected = np.ones((1,8,8))
expected[:,:,0] = np.nan
expected[:,0,:] = np.nan
#result
result = extrapolate(pr... | code_fim | medium | {
"lang": "python",
"repo": "savelov/nowcast",
"path": "/pysteps/tests/test_extrapolation_semilagrangian.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MPI-IS/tests-wo-splitting path: /tests_wo_split/methods/wald.py
"""
Module that implements the Wald test. To do this we use that
\sqrt(n) \Sigma^(-1/2) * MMD^2 ~ N(mu, 1)
"""
import numpy as np
from scipy.stats import chi
def preprocessing(tau, Sigma, max_condition=1e-6):
"""
Check if... | code_fim | medium | {
"lang": "python",
"repo": "MPI-IS/tests-wo-splitting",
"path": "/tests_wo_split/methods/wald.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # below quantity is asymptotically standard normal
t_obs = np.sqrt(tau @ Sigma_inv @ tau)
# compute the 1-alpha quantile of the chi distribution with d degrees of freedom
threshold = chi.ppf(q=1-alpha, df=d)
if not pval:
if t_obs > threshold:
return 1
else:... | code_fim | hard | {
"lang": "python",
"repo": "MPI-IS/tests-wo-splitting",
"path": "/tests_wo_split/methods/wald.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> query_input = html.Div(
[
dbc.Input(id="query-input", placeholder=placeholder, type="text"),
html.Br(),
html.P(id="output"),
]
)
return query_input<|fim_prefix|># repo: Juicob/ye-spirations path: /components/query_input.py
import dash_bootst... | code_fim | easy | {
"lang": "python",
"repo": "Juicob/ye-spirations",
"path": "/components/query_input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Juicob/ye-spirations path: /components/query_input.py
import dash_bootstrap_components as dbc
import dash_html_components as html
import random
<|fim_suffix|> query_input = html.Div(
[
dbc.Input(id="query-input", placeholder=placeholder, type="text"),
html.Br()... | code_fim | easy | {
"lang": "python",
"repo": "Juicob/ye-spirations",
"path": "/components/query_input.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Matches any html file
re_path(r'^.*\.*', views.pages, name='pages'),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()<|fim_prefix|># repo: Kowenjko/Kursova_Django_EM path: /apps/home/urls.py
# -*- encoding: utf-8 ... | code_fim | hard | {
"lang": "python",
"repo": "Kowenjko/Kursova_Django_EM",
"path": "/apps/home/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()<|fim_prefix|># repo: Kowenjko/Kursova_Django_EM path: /apps/home/urls.py
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.urls import path, re_path... | code_fim | medium | {
"lang": "python",
"repo": "Kowenjko/Kursova_Django_EM",
"path": "/apps/home/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kowenjko/Kursova_Django_EM path: /apps/home/urls.py
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
from django.urls import path, re_path
from apps.home import views
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfi... | code_fim | hard | {
"lang": "python",
"repo": "Kowenjko/Kursova_Django_EM",
"path": "/apps/home/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bcgov/wps-api path: /app/tests/test_get_hourlies.py
""" BDD tests for API /hourlies. """
import logging
from datetime import datetime, timezone
from pytest_bdd import scenario, given, then
from starlette.testclient import TestClient
from aiohttp import ClientSession
import app.main
from app.tests... | code_fim | medium | {
"lang": "python",
"repo": "bcgov/wps-api",
"path": "/app/tests/test_get_hourlies.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># pylint: disable=redefined-outer-name
@then('the response status code is <status>')
def assert_status_code(response, status):
""" Assert that we recieve the expected status code """
assert response.status_code == status
@then('there are <num_groups> groups of hourlies')
def assert_number_of_hou... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/wps-api",
"path": "/app/tests/test_get_hourlies.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> object_name = self.getTableName(uuid)
key_name = self.getKeyName(key, which)
table_insert = "INSERT INTO \"" + self.table_name + "\""
table_insert += " VALUES (?, ?, ?)"
value = "".join(self.charconvert(c) for c in value);
curs.execute(table_insert, (buffer(... | code_fim | hard | {
"lang": "python",
"repo": "danielrh/sirikata",
"path": "/tools/oh/csv_converter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danielrh/sirikata path: /tools/oh/csv_converter.py
""" csv_converter -- utility for converting csv to sqlite """
""" Sirikata utility scripts
* csv_converter.py
*
* Copyright (c) 2009, Patrick Reiter Horn
* All rights reserved.
*
* Redistribution and use in source and binary forms, wit... | code_fim | hard | {
"lang": "python",
"repo": "danielrh/sirikata",
"path": "/tools/oh/csv_converter.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YixingHuang/CyCNN path: /cycnn/utils.py
import os
def generate_fname(dataset, model, polar_transform, augmentation):
fname = dataset + '-' + model
if polar_transform is not None:
fname += '-' + polar_transform
if augmentation is not None:
fname += '-' + augmentation
... | code_fim | medium | {
"lang": "python",
"repo": "YixingHuang/CyCNN",
"path": "/cycnn/utils.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open(fname, 'r')
content = f.read()
return 'Training Done!' in content
def soft_validate(dataset, model, polar_transform, augmentation):
fname = 'saves/' + generate_fname(dataset, model, polar_transform, augmentation) + '.pt'
return os.path.isfile(fname)<|fim_prefix|># repo: Yi... | code_fim | medium | {
"lang": "python",
"repo": "YixingHuang/CyCNN",
"path": "/cycnn/utils.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> VERSION = 1
async def async_step_user(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle a flow initialized by the user."""
errors = {}
if user_input is not None:
try:
await self.async_set_unique_id(
... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/gios/config_flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/gios/config_flow.py
"""Adds config flow for GIOS."""
from __future__ import annotations
import asyncio
from typing import Any
from aiohttp.client_exceptions import ClientConnectorError
from gios import ApiError, Gios, InvalidSensorsDataError, ... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/gios/config_flow.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if user_input is not None:
try:
await self.async_set_unique_id(
str(user_input[CONF_STATION_ID]), raise_on_progress=False
)
self._abort_if_unique_id_configured()
websession = async_get_clientsession(se... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/homeassistant/components/gios/config_flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kawsar-ahmed/KeepWindowsAlive path: /keypress_on_idle.py
from ctypes import Structure, windll, c_uint, sizeof, byref
class LASTINPUTINFO(Structure):
_fields_ = [
('cbSize', c_uint),
('dwTime', c_uint),
]
def get_idle_duration():
lastInputInfo = LASTINPUTINFO... | code_fim | medium | {
"lang": "python",
"repo": "kawsar-ahmed/KeepWindowsAlive",
"path": "/keypress_on_idle.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
key_to_press = sys.argv[3]
key_name = key_to_press.upper()
except:
key_to_press = Key.up
key_name = key_to_press.name.upper()
print 'Key to Press: {}'.format(key_name)
start_time = datetime.datetime.now()
while True:
idle_seconds = get_idle_duration()
if idle_seconds ... | code_fim | medium | {
"lang": "python",
"repo": "kawsar-ahmed/KeepWindowsAlive",
"path": "/keypress_on_idle.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if topic == self.mqtt_topic.environment.date_time:
# send all override to server
meassage = self.gui.get_override()
if meassage != None:
message_to_send = '{}:{}'.format("override", meassage)
message_to_send = str(len(message_to_s... | code_fim | hard | {
"lang": "python",
"repo": "gnms/MyPerfectProject",
"path": "/panel_signal_mgr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.gui.update_date(topic.topic, topic.get_payload())
if topic == self.mqtt_topic.environment.date_time:
# send all override to server
meassage = self.gui.get_override()
if meassage != None:
message_to_send = '{}:{}'.format("override", ... | code_fim | medium | {
"lang": "python",
"repo": "gnms/MyPerfectProject",
"path": "/panel_signal_mgr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gnms/MyPerfectProject path: /panel_signal_mgr.py
from mqtt_client import mqtt_client
from panel_signal_mgr_gui import panel_signal_mgr_gui
class panel_signal_mgr(mqtt_client):
def __init__(self):
mqtt_client.__init__(self, "SIGNAL_MGR")
self.gui = panel_signal_mgr_gui()
<|... | code_fim | medium | {
"lang": "python",
"repo": "gnms/MyPerfectProject",
"path": "/panel_signal_mgr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MonsterRob/python_book path: /cookbook/9.22.py
# encoding=utf-8
# 定义上下文管理器
import time
from contextlib import contextmanager
<|fim_suffix|>
with timethis('Counting'):
n = 1000000
while n:
n -= 1<|fim_middle|>
@contextmanager
def timethis(label):
s = time.time()
print('bef... | code_fim | hard | {
"lang": "python",
"repo": "MonsterRob/python_book",
"path": "/cookbook/9.22.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = time.time()
print('before')
try:
yield # 执行分割线
finally:
e = time.time()
print('down')
print("{}:{}".format(label, e - s))
with timethis('Counting'):
n = 1000000
while n:
n -= 1<|fim_prefix|># repo: MonsterRob/python_book path: /cookbo... | code_fim | easy | {
"lang": "python",
"repo": "MonsterRob/python_book",
"path": "/cookbook/9.22.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with timethis('Counting'):
n = 1000000
while n:
n -= 1<|fim_prefix|># repo: MonsterRob/python_book path: /cookbook/9.22.py
# encoding=utf-8
# 定义上下文管理器
import time
from contextlib import contextmanager
@contextmanager
def timethis(label):
<|fim_middle|> s = time.time()
print('bef... | code_fim | medium | {
"lang": "python",
"repo": "MonsterRob/python_book",
"path": "/cookbook/9.22.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mutazag/ilab1 path: /vis-umap_18M.py
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # C33 UMAP Visualisation of 18M
#
# UMAP for 18M
# %% [markdown]
# ## Imports
# %%
import sys
import os
import pathlib
import time
print(sys.version)
... | code_fim | hard | {
"lang": "python",
"repo": "mutazag/ilab1",
"path": "/vis-umap_18M.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>n = df.shape[0]
neighbors_list = [30]
components = 2
filename_pattern = 'umap_18Mdf_{}_{}_{}_{}.csv'
# %%
for neighbors in neighbors_list:
time_start = time.time()
filename = filename_pattern.format('C33', n, neighbors, components)
print(f'prep for filename: {filename}')
plot_df = umap... | code_fim | hard | {
"lang": "python",
"repo": "mutazag/ilab1",
"path": "/vis-umap_18M.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Skip any excluded directories
if os.path.normpath(root) in exclude_dirs:
continue
for fname in files:
fpath = os.path.join(root, fname)
if os.path.splitext(fname)[1] in Project.extensions:
... | code_fim | hard | {
"lang": "python",
"repo": "marshallward/flint",
"path": "/flint/project.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marshallward/flint path: /flint/project.py
"""flint Project class
:copyright: Copyright 2021 Marshall Ward, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import os
import sys
from flint.source import Source
from flint.units import Module
class Pr... | code_fim | hard | {
"lang": "python",
"repo": "marshallward/flint",
"path": "/flint/project.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO: *paths is generally a bad idea for a public API. I am only using
# it here to get sensible output in my MOM6 tests.
def parse(self, *paths, excludes=None, followlinks=False):
# Set up the exclusion list
if excludes:
exclude_dirs = [os.path.normpath(p) for... | code_fim | hard | {
"lang": "python",
"repo": "marshallward/flint",
"path": "/flint/project.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: presicely/kalliope path: /core/__init__.py
from core.OrderAnalyser import OrderAnalyser
fro<|fim_suffix|>re.ShellGui import ShellGui
from core.FileManager import FileManager
from core.Utils import Utils<|fim_middle|>m core.OrderListener import OrderListener
from co | code_fim | easy | {
"lang": "python",
"repo": "presicely/kalliope",
"path": "/core/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>r import FileManager
from core.Utils import Utils<|fim_prefix|># repo: presicely/kalliope path: /core/__init__.py
from core.OrderAnalyser import OrderAnalyser
from core.OrderListener import OrderListener
from co<|fim_middle|>re.ShellGui import ShellGui
from core.FileManage | code_fim | easy | {
"lang": "python",
"repo": "presicely/kalliope",
"path": "/core/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MNCHr/Hyper4-Controller path: /hp4controller/virtualdevice/p4rule.py
class P4Rule():
def __init__(self, table, action, mparams, aparams, default=False):
<|fim_suffix|> ret = self.table
if self.default:
ret += '*'
ret += ' ' + self.action + ' '
for mparam in self.mparams:
... | code_fim | medium | {
"lang": "python",
"repo": "MNCHr/Hyper4-Controller",
"path": "/hp4controller/virtualdevice/p4rule.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ret = self.table
if self.default:
ret += '*'
ret += ' ' + self.action + ' '
for mparam in self.mparams:
ret += str(mparam) + ' '
ret += '=> '
for aparam in self.aparams:
ret += str(aparam) + ' '
return ret[0:-1]<|fim_prefix|># repo: MNCHr/Hyper4-Controller p... | code_fim | medium | {
"lang": "python",
"repo": "MNCHr/Hyper4-Controller",
"path": "/hp4controller/virtualdevice/p4rule.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> splash.setAttribute(Qt.WA_NoSystemBackground)
splash.move(x,y)
splash.show()
return splash
def create_box_with_image_score_classification(image_path, score, classification, x,y,width,height):
'''
Show an overlaybox with label
@Param score float
@Param classification strin... | code_fim | hard | {
"lang": "python",
"repo": "viracall/Realtime-Screen-Object-Detection",
"path": "/screen_overlay_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: viracall/Realtime-Screen-Object-Detection path: /screen_overlay_handler.py
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from ThreadPool import *
from tracking import Tracking
import threading
import sys
import time
'''
COPYRIGHT @ Grebtsew 2019
This file ... | code_fim | hard | {
"lang": "python",
"repo": "viracall/Realtime-Screen-Object-Detection",
"path": "/screen_overlay_handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.shared_variables.list.remove(self)
self.done = True
self.threadpool.cancel
def execute_this_fn(self, progress_callback):
if(not self.tracking.running):
if not self.done: # Remove ourself from gui list
self.shared_variables.list.remove(... | code_fim | hard | {
"lang": "python",
"repo": "viracall/Realtime-Screen-Object-Detection",
"path": "/screen_overlay_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dbeley/ypc path: /ypc/ydl_utils.py
from threading import Thread
import logging
from yt_dlp import YoutubeDL
from tqdm import tqdm
from ypc.tag_utils import get_metadata
logger = logging.getLogger(__name__)
class YdlDownloadThread(Thread):
def __init__(self, num, rows, only_audio=False):
... | code_fim | hard | {
"lang": "python",
"repo": "dbeley/ypc",
"path": "/ypc/ydl_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_youtube_url(search_term):
"""Extract an url for a song."""
position = 1
while True:
try:
info_dict = get_ydl_dict(search_term, position)
if dict_is_song(info_dict):
break
except Exception as e:
logger.error(
... | code_fim | hard | {
"lang": "python",
"repo": "dbeley/ypc",
"path": "/ypc/ydl_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlcommons/ck path: /cm-mlops/automation/experiment/module.py
"""
Test automation
Args:
(CM input dict):
(out) (str): if 'con', output to console
automation (str): automation as CM string object
parsed_automation (list): prepared in CM ... | code_fim | hard | {
"lang": "python",
"repo": "mlcommons/ck",
"path": "/cm-mlops/automation/experiment/module.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print ('')
x=input('Make your selection or press Enter for 0: ')
x=x.strip()
if x=='': x='0'
selection = int(x)
if selection < 0 or selection >= num:
selection = 0
dateti... | code_fim | hard | {
"lang": "python",
"repo": "mlcommons/ck",
"path": "/cm-mlops/automation/experiment/module.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mlcommons/ck path: /cm-mlops/automation/experiment/module.py
pression}}}
explore = i.get('explore', {})
j = 1
k = 0
while j>=0:
j = cmd.find('}}}', k)
if j>=0:
k = j+1
l = cmd.rfind('{{',0, j)
if... | code_fim | hard | {
"lang": "python",
"repo": "mlcommons/ck",
"path": "/cm-mlops/automation/experiment/module.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = self.device.sensors[0].key
value = self.next_value(key) + offset # make sure there's an entry in lv_cache
self.lv_cache[key] = value
return (key, value)<|fim_prefix|># repo: TempoIQ/tempoiq-tools path: /live-generator/generator/generator.py
from tempoiq.session imp... | code_fim | hard | {
"lang": "python",
"repo": "TempoIQ/tempoiq-tools",
"path": "/live-generator/generator/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TempoIQ/tempoiq-tools path: /live-generator/generator/generator.py
from tempoiq.session import get_session
from tempoiq.protocol import Device, Sensor
import random
class DataGenerator:
"""Class to generate realistic-looking sensor data for a single device"""
def __init__(self, device, ... | code_fim | medium | {
"lang": "python",
"repo": "TempoIQ/tempoiq-tools",
"path": "/live-generator/generator/generator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def next_value(self, key):
prob = random.random()
oldval = self.lv_cache.get(key, self.get_nominal(key))
# Stddev ranges from 0.1-0.6
stddev = ((hash(key) % 11) + 2.0) * 0.05
value = oldval + random.normalvariate(0, stddev)
self.lv_cache[key] = value
... | code_fim | hard | {
"lang": "python",
"repo": "TempoIQ/tempoiq-tools",
"path": "/live-generator/generator/generator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: clohr/data-portal path: /dat_core/views.py
# core/views.py
#################
#### imports ####
#################
from app import app
from flask import render_template, Blueprint
from logger import logger
################
#### config ####
################
dat_core_blueprint = Blueprint('dat... | code_fim | medium | {
"lang": "python",
"repo": "clohr/data-portal",
"path": "/dat_core/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_template('browse/browse_dat.html')<|fim_prefix|># repo: clohr/data-portal path: /dat_core/views.py
# core/views.py
#################
#### imports ####
#################
from app import app
from flask import render_template, Blueprint
from logger import logger
################
#### ... | code_fim | hard | {
"lang": "python",
"repo": "clohr/data-portal",
"path": "/dat_core/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_duped_instrument_field_id():
validator = CalculationSet(instrument=INSTRUMENT)
calculation = deepcopy(CALCULATION)
calculation['calculations'][0]['id'] = 'text_field'
try:
validator.deserialize(calculation)
except ValidationError as exc:
assert_validation_error... | code_fim | hard | {
"lang": "python",
"repo": "prometheusresearch/rios.core",
"path": "/tests/test_calculationset_validation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prometheusresearch/rios.core path: /tests/test_calculationset_validation.py
#
# Copyright (c) 2015, Prometheus Research, LLC
#
import json
import os
from copy import deepcopy
import pytest
from rios.core.validation.calculationset import CalculationSet, \
ValidationError
from utils impor... | code_fim | hard | {
"lang": "python",
"repo": "prometheusresearch/rios.core",
"path": "/tests/test_calculationset_validation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def is_read_only(self) -> bool:
return self.header.attribs & CabFile._A_RDONLY != 0
@property
def is_hidden(self) -> bool:
return self.header.attribs & CabFile._A_HIDDEN != 0
@property
def is_system(self) -> bool:
return self.header.attribs & Cab... | code_fim | hard | {
"lang": "python",
"repo": "xoriath/py-cab",
"path": "/src/cabfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def is_continued_from_previous_and_to_next(self) -> bool:
return self.folder_index == CabFile.ifoldCONTINUED_PREV_AND_NEXT
@property
def is_partial(self) -> bool:
return self.is_continued_from_previous or self.is_continued_to_next or self.is_continued_from_previo... | code_fim | hard | {
"lang": "python",
"repo": "xoriath/py-cab",
"path": "/src/cabfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xoriath/py-cab path: /src/cabfile.py
import collections
import datetime
import logging
import struct
class CabFile:
"""Each CFFILE entry contains information about one of the files stored (or at least partially stored) in this cabinet.
The first CFFILE entry in each cabinet is found at... | code_fim | hard | {
"lang": "python",
"repo": "xoriath/py-cab",
"path": "/src/cabfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khaledAltuwaijri/soccerpy path: /soccerpy/modules/Competition/competition.py
from soccerpy.modules.Competition.competition_fixtures import CompetitionFixtures
from soccerpy.modules.Competition.competition_specific import CompetitionSpecific
from soccerpy.modules.Competition.competition_league_tab... | code_fim | hard | {
"lang": "python",
"repo": "khaledAltuwaijri/soccerpy",
"path": "/soccerpy/modules/Competition/competition.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_fixtures(self, competition_id, matchday=None, time_frame=None):
data, headers = self.r.request('competition_fixtures', endpoint_format=competition_id,
payload={'matchday': matchday,
'timeFrame': time... | code_fim | hard | {
"lang": "python",
"repo": "khaledAltuwaijri/soccerpy",
"path": "/soccerpy/modules/Competition/competition.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucuma/solution path: /solution/__init__.py
# coding=utf-8
"""
=============================
Solution
=============================
<|fim_suffix|>"""
from .form import Form # noqa
from .formset import FormSet # noqa
from .fields import * # noqa
from .validators import * # noqa
fr... | code_fim | medium | {
"lang": "python",
"repo": "lucuma/solution",
"path": "/solution/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
from .form import Form # noqa
from .formset import FormSet # noqa
from .fields import * # noqa
from .validators import * # noqa
from .utils import Markup, get_html_attrs, to_unicode # noqa
__version__ = '5.4.0'<|fim_prefix|># repo: lucuma/solution path: /solution/__init__.py
# coding=utf-8
"""... | code_fim | medium | {
"lang": "python",
"repo": "lucuma/solution",
"path": "/solution/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Precision metric.
Only computes a batch-wise average of precision.
Computes the precision, a metric for multi-label classification of
how many selected items are relevant.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
predic... | code_fim | hard | {
"lang": "python",
"repo": "yihshe/CIL_Road_Segmentation",
"path": "/metrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yihshe/CIL_Road_Segmentation path: /metrics.py
#!/usr/bin/env python3
import tensorflow.keras.backend as K
# credits: https://stackoverflow.com/questions/43547402/how-to-calculate-f1-macro-in-keras
def f1(y_true, y_pred):
def recall(y_true, y_pred):
"""Recall metric.
<|fim_suffix|>... | code_fim | hard | {
"lang": "python",
"repo": "yihshe/CIL_Road_Segmentation",
"path": "/metrics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Computes the recall, a metric for multi-label classification of
how many relevant items are selected.
"""
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1)))
recall = true_positives / (poss... | code_fim | medium | {
"lang": "python",
"repo": "yihshe/CIL_Road_Segmentation",
"path": "/metrics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_decoder(attribute: str) -> typing.Callable:
"""
Gets the encoder for the given attribute
:param attribute: the attribute to get the encoder for
:return: Callable method for decoding the value of the given attribute
"""
attribute = attribute.lower()
if attribute in __att... | code_fim | hard | {
"lang": "python",
"repo": "dbracewell/pyHermes",
"path": "/hermes/core/attributes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Gets the encoder for the given attribute
:param attribute: the attribute to get the encoder for
:return: Callable method for decoding the value of the given attribute
"""
attribute = attribute.lower()
if attribute in __attribute_decoders and __attribute_decoders[attribute] ... | code_fim | hard | {
"lang": "python",
"repo": "dbracewell/pyHermes",
"path": "/hermes/core/attributes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dbracewell/pyHermes path: /hermes/core/attributes.py
import typing
"""
Copyright 2017 David B. Bracewell
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
h... | code_fim | hard | {
"lang": "python",
"repo": "dbracewell/pyHermes",
"path": "/hermes/core/attributes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_trounces.py
from xai.brain.wordbase.verbs._trounce import _TROUNCE
#calss header
class _TROUNCES(_TROUNCE, ):
<|fim_suffix|> _TROUNCE.__init__(self)
self.name = "TROUNCES"
self.specie = 'verbs'
self.basic = "trounce"
self.jsondata = {}<|fi... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_trounces.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _TROUNCE.__init__(self)
self.name = "TROUNCES"
self.specie = 'verbs'
self.basic = "trounce"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_trounces.py
from xai.brain.wordbase.verbs._trounce import _TROUNCE
<|fim_middle|>#calss header
class _TROUNCES(_TR... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_trounces.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sahilchinoy/django-irs-filings path: /irs/models.py
from django.db import models
class Committee(models.Model):
"""
A political committee that files disclosure reports with
the IRS under section 527 of the U.S. tax code.
"""
EIN = models.CharField(
primary_key=True,... | code_fim | hard | {
"lang": "python",
"repo": "sahilchinoy/django-irs-filings",
"path": "/irs/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Expenditure(models.Model):
"""
An itemization on Schedule B of a Form 8872 report.
"""
record_type = models.CharField(max_length=1)
form_id_number = models.CharField(max_length=38)
schedule_b_id = models.CharField(max_length=38)
organization_name = models.CharField(max_l... | code_fim | hard | {
"lang": "python",
"repo": "sahilchinoy/django-irs-filings",
"path": "/irs/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def main(self):
logging.basicConfig(level=logging.INFO)
prob_gen = ProblemGenerator(self.city_count, self.treasure_count, self.min_edges, self.max_edges, self.seed)
start = perf_counter()
problem = prob_gen.generate_problem(self.force_longest_paths)
end = perf_c... | code_fim | hard | {
"lang": "python",
"repo": "Spaqin/AAL-2017L",
"path": "/generator.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Spaqin/AAL-2017L path: /generator.py
from generators.problem_generator import ProblemGenerator
from parsing.problemparser import yaml_from_problem
from sys import stderr
from plumbum import cli
from time import perf_counter
import logging
class GeneratorApplication(cli.Application):
"""Cre... | code_fim | hard | {
"lang": "python",
"repo": "Spaqin/AAL-2017L",
"path": "/generator.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.basicConfig(level=logging.INFO)
prob_gen = ProblemGenerator(self.city_count, self.treasure_count, self.min_edges, self.max_edges, self.seed)
start = perf_counter()
problem = prob_gen.generate_problem(self.force_longest_paths)
end = perf_counter()
log... | code_fim | hard | {
"lang": "python",
"repo": "Spaqin/AAL-2017L",
"path": "/generator.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: capac/python-exercises path: /various/berude.py
import re
import time
import sys
import requests
from bs4 import BeautifulSoup
rude_words = [
"elf-skin",
"neat's-tongue",
"bull's-pizzle",
"stock-fish",
"three-inch fool",
"unable worm",
"lily-livered",
"tewkesbury... | code_fim | hard | {
"lang": "python",
"repo": "capac/python-exercises",
"path": "/various/berude.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
textiter = get_sonnets()
# print(re quests.get("https://api.datamuse.com/words", params={'rel_rhy': 'cat'}).json())
print("PRECACHING...")
cache = {}
for word in rude_words:
for rhyme in get_all_rhymes(word):
cache[rhyme] = word
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "capac/python-exercises",
"path": "/various/berude.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> actual = self.expression(
mock.sentinel.data,
super_root=mock.sentinel.super_root,
lut=lut,
context={'some': 'stuff'},
)
self.assertEqual(actual, 'hi there')
mock_hello.assert_called_once_with(
mock.sentinel.data,... | code_fim | hard | {
"lang": "python",
"repo": "dealertrack/simplepath",
"path": "/tests/test_expressions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dealertrack/simplepath path: /tests/test_expressions.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import mock
import six
from simplepath.constants import DEFAULT_FAIL_MODE, NONE, FailMode
from simplepath.exceptions import Skip
from simplepath.expressions im... | code_fim | hard | {
"lang": "python",
"repo": "dealertrack/simplepath",
"path": "/tests/test_expressions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in = 0
img1 = '/home/wan/wyyslam/Dynamic_Objects/rgbd_dataset_freiburg3_walking_xyz/rgb/'+str(images[i])+'.png'
depth_img_1 = '/home/wan/wyyslam/Dynamic_Objects/rgbd_dataset_freiburg3_walking_xyz/depth/'+str(depth[i])
print(img1)
yolo1 = main(img1)
topo_1 = yolo_topo_array(y... | code_fim | hard | {
"lang": "python",
"repo": "wenbeier/xishui",
"path": "/xishui/topo_similar.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wenbeier/xishui path: /xishui/topo_similar.py
import numpy as np
import gist_cossim
from darknet_images import main
from yolo_topo import yolo_topo_array
def vector_similar(vec1,vec2,t):
vec1_n = np.linalg.norm(vec1, ord=2)
vec2_n = np.linalg.norm(vec2, ord=2) # vector norm
t_n = np... | code_fim | hard | {
"lang": "python",
"repo": "wenbeier/xishui",
"path": "/xishui/topo_similar.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AuthUserView(APIView):
def get(self, request):
queryset = User.objects.all()
user = request.user
serializer = UserSerializer(user)
return Response(serializer.data)
class UserView(APIView):
def get(self, request, username):
queryset = User.objects.all... | code_fim | hard | {
"lang": "python",
"repo": "NishantTheProgrammer/ChatThings",
"path": "/backend/account/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NishantTheProgrammer/ChatThings path: /backend/account/views.py
from rest_framework import generics, status
from rest_framework.views import APIView
from rest_framework_simplejwt.views import TokenObtainPairView
from rest_framework_simplejwt.tokens import RefreshToken
from rest_framework.permissi... | code_fim | hard | {
"lang": "python",
"repo": "NishantTheProgrammer/ChatThings",
"path": "/backend/account/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserView(APIView):
def get(self, request, username):
queryset = User.objects.all()
user = User.objects.get(username=username)
serializer = UserSerializer(user)
return Response(serializer.data)<|fim_prefix|># repo: NishantTheProgrammer/ChatThings path: /backend... | code_fim | hard | {
"lang": "python",
"repo": "NishantTheProgrammer/ChatThings",
"path": "/backend/account/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Denisfench/openclean-core path: /openclean/engine/store/function.py
# This file is part of the Data Cleaning Library (openclean).
#
# Copyright (C) 2018-2021 New York University.
#
# openclean is released under the Revised BSD License. See file LICENSE for
# full license details.
"""Persistent r... | code_fim | hard | {
"lang": "python",
"repo": "Denisfench/openclean-core",
"path": "/openclean/engine/store/function.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class FunctionRepository(DefaultObjectStore):
"""Object store for library functions. Persists all user-defined functions
on disk using a file system data store. The files are stored under the
openclean home directory if no base directory is specififed.
"""
def __init__(
self, b... | code_fim | hard | {
"lang": "python",
"repo": "Denisfench/openclean-core",
"path": "/openclean/engine/store/function.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> import IsEqv
from value.primitives.lt import Lt
from value.primitives.lte import LtE
from value.primitives.mod import Mod
from value.primitives.mult import Mult
from value.primitives.newline import Newline
from value.primitives.or_ import Or
from value.primitives.random import Random
from value.primitive... | code_fim | hard | {
"lang": "python",
"repo": "choleraehyq/yuujins",
"path": "/value/primitives/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ine
from value.primitives.or_ import Or
from value.primitives.random import Random
from value.primitives.sleep import Sleep
from value.primitives.sub import Sub
from value.primitives.typeof import TypeOf<|fim_prefix|># repo: choleraehyq/yuujins path: /value/primitives/__init__.py
from value.primitives.ad... | code_fim | hard | {
"lang": "python",
"repo": "choleraehyq/yuujins",
"path": "/value/primitives/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: choleraehyq/yuujins path: /value/primitives/__init__.py
from value.primitives.add import Add
from value.primitives.and_ import And
from value.primitives.car import Car
from value.primitives.cdr import Cdr
from value.primitives.cons import Cons
from value.primitives.display import Display
from val... | code_fim | hard | {
"lang": "python",
"repo": "choleraehyq/yuujins",
"path": "/value/primitives/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crflynn/dephell path: /tests/test_commands/test_deps_convert.py
# built-in
from pathlib import Path
# project
from dephell.commands import DepsConvertCommand
from dephell.config import Config
<|fim_suffix|> assert result is True
captured = capsys.readouterr()
assert 'setup(' in captu... | code_fim | hard | {
"lang": "python",
"repo": "crflynn/dephell",
"path": "/tests/test_commands/test_deps_convert.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.