text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ChidinmaKO/Chobe-Py-Challenges path: /bites/bite123.py
from collections import defaultdict
names = 'bob julian tim martin rod sara joyce nick beverly kevin'.split()
ids = range(len(names))
users = dict(zip(ids, names)) # 0: bob, 1: julian, etc
friendships = [(0, 1), (0, 2), (1, 2), (1, 3), (2,... | code_fim | hard | {
"lang": "python",
"repo": "ChidinmaKO/Chobe-Py-Challenges",
"path": "/bites/bite123.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user, friends = get_friend_with_most_friends()
assert user == 'sara'
assert sorted(list(friends)) == ['joyce', 'kevin', 'nick', 'rod']
def test_get_friend_with_most_friends_different_friendship_data():
friendships = [(0, 1), (0, 2), (1, 2), (1, 6), (2, 3),
(3, 4), (4, ... | code_fim | hard | {
"lang": "python",
"repo": "ChidinmaKO/Chobe-Py-Challenges",
"path": "/bites/bite123.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> alpha = settings[LABELS['confint']]['alpha']
data = data['data']
nlags = min(LONG_MAX_LAGS, len(data)-1)
try:
values, confint = sm_pacf(data, nlags=nlags, alpha=alpha)
confint = [list(i) for i in confint]
except numpy.linalg.linalg.LinAlgError:
values = []
... | code_fim | medium | {
"lang": "python",
"repo": "tartopum/MPF",
"path": "/mpf/analysis/pacf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tartopum/MPF path: /mpf/analysis/pacf.py
"""Contain the tools for processing the partial autocorrelation function."""
import numpy
from statsmodels.tsa.stattools import pacf as sm_pacf
from mpf.analysis import cache
from mpf.settings import TYPES, LABELS, LONG_MAX_LAGS
<|fim_suffix|> try:
... | code_fim | hard | {
"lang": "python",
"repo": "tartopum/MPF",
"path": "/mpf/analysis/pacf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
LABELS['values']: list(values),
LABELS['confint']: confint,
}<|fim_prefix|># repo: tartopum/MPF path: /mpf/analysis/pacf.py
"""Contain the tools for processing the partial autocorrelation function."""
import numpy
from statsmodels.tsa.stattools import pacf as sm_pacf
fr... | code_fim | hard | {
"lang": "python",
"repo": "tartopum/MPF",
"path": "/mpf/analysis/pacf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> maxxdf = max(_extract_bounds(geom=df['geometry'], var='maxx'))
minxdf = min(_extract_bounds(geom=df['geometry'], var='minx'))
maxydf = max(_extract_bounds(geom=df['geometry'], var='maxy'))
minydf = min(_extract_bounds(geom=df['geometry'], var='miny'))
center = ((maxxdf + minxdf) / 2, (... | code_fim | medium | {
"lang": "python",
"repo": "pyr-opendatafr/geoapyfr",
"path": "/geoapyfr/admin/_rescale_geom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(df['geometry'])):
df.loc[i,'geometry'] = scale(
geom = df.loc[i, 'geometry'],
xfact=factor,
yfact=factor,
zfact=1.0,
origin=center)
return(df)<|fim_prefix|># repo: pyr-opendatafr/geoapyfr path: /geoapyfr... | code_fim | hard | {
"lang": "python",
"repo": "pyr-opendatafr/geoapyfr",
"path": "/geoapyfr/admin/_rescale_geom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyr-opendatafr/geoapyfr path: /geoapyfr/admin/_rescale_geom.py
# -*- coding: utf-8 -*-
from shapely.affinity import scale
from geoapyfr.admin._extract_bounds import _extract_bounds
<|fim_suffix|> maxxdf = max(_extract_bounds(geom=df['geometry'], var='maxx'))
minxdf = min(_extract_bounds(... | code_fim | medium | {
"lang": "python",
"repo": "pyr-opendatafr/geoapyfr",
"path": "/geoapyfr/admin/_rescale_geom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
async def handler_listen(request: web.Request) -> web.Response:
await check_permission(request, 'listen')
return web.Response(body="I can listen!")
async def handler_speak(request: web.Request) -> web.Response:
await check_permission(request, 'speak')
return web.Response(body="I can spe... | code_fim | hard | {
"lang": "python",
"repo": "aio-libs/aiohttp-security",
"path": "/demo/simple_example_auth.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aio-libs/aiohttp-security path: /demo/simple_example_auth.py
from enum import Enum
from typing import NoReturn, Optional, Union
from aiohttp import web
from aiohttp_session import SimpleCookieStorage, session_middleware
from aiohttp_security import (SessionIdentityPolicy, check_permission, forg... | code_fim | hard | {
"lang": "python",
"repo": "aio-libs/aiohttp-security",
"path": "/demo/simple_example_auth.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Verose/NLP_CLPSYCH path: /cosine_similarity/reddit_datasets/generate_flair_embeddings.py
import glob
import json
import logging
import optparse
import os
from multiprocessing.pool import Pool
from flair.embeddings import WordEmbeddings, DocumentPoolEmbeddings, Sentence, FlairEmbeddings
from com... | code_fim | hard | {
"lang": "python",
"repo": "Verose/NLP_CLPSYCH",
"path": "/cosine_similarity/reddit_datasets/generate_flair_embeddings.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_doc_embeddings():
# initialize the word embeddings
glove_embedding = WordEmbeddings('glove')
flair_embedding_forward = FlairEmbeddings('news-forward-fast')
flair_embedding_backward = FlairEmbeddings('news-backward-fast')
# initialize the document embeddings, mode = mean
r... | code_fim | hard | {
"lang": "python",
"repo": "Verose/NLP_CLPSYCH",
"path": "/cosine_similarity/reddit_datasets/generate_flair_embeddings.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>AUTHORITY_URL = "https://login.microsoftonline.com/common"
RESOURCE = "https://graph.microsoft.com"
# API_VERSION = "v1.0"
API_VERSION = "beta"<|fim_prefix|># repo: zadjii-msft/ms-cli path: /msgraph/config.py
"""Configuration settings for console app using device flow authentication
"""
<|fim_midd... | code_fim | medium | {
"lang": "python",
"repo": "zadjii-msft/ms-cli",
"path": "/msgraph/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zadjii-msft/ms-cli path: /msgraph/config.py
"""Configuration settings for console app using device flow authentication
"""
<|fim_suffix|>AUTHORITY_URL = "https://login.microsoftonline.com/common"
RESOURCE = "https://graph.microsoft.com"
# API_VERSION = "v1.0"
API_VERSION = "beta"<|fim_midd... | code_fim | medium | {
"lang": "python",
"repo": "zadjii-msft/ms-cli",
"path": "/msgraph/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ptor__pb2.EnumOptions.RegisterExtension(
enum_stringer
)
google_dot_protobuf_dot_descriptor__pb2.EnumOptions.RegisterExtension(
enum_customname
)
google_dot_protobuf_dot_descriptor__pb2.EnumOptions.RegisterExtension(
enumdecl
)
google_dot_protobuf_dot_descri... | code_fim | hard | {
"lang": "python",
"repo": "open-telemetry/opentelemetry-python-contrib",
"path": "/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-telemetry/opentelemetry-python-contrib path: /exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: opentelemetry/export... | code_fim | hard | {
"lang": "python",
"repo": "open-telemetry/opentelemetry-python-contrib",
"path": "/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo_pb2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ageOptions.RegisterExtension(
goproto_stringer
)
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(
verbose_equal
)
google_dot_protobuf_dot_descriptor__pb2.MessageOptions.RegisterExtension(
face
)
google_dot_protobuf_dot_descriptor__pb... | code_fim | hard | {
"lang": "python",
"repo": "open-telemetry/opentelemetry-python-contrib",
"path": "/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/gen/gogoproto/gogo_pb2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Base.__init__(self, test, test_client)
self.route = "/{bucket_name}/artifact/{path}/_meta/{item}"<|fim_prefix|># repo: bfilipov/shelf path: /tests/route_tester/metadata_item.py
from tests.route_tester.base import Base
<|fim_middle|>
class MetadataItem(Base):
def __init__(self, test, ... | code_fim | medium | {
"lang": "python",
"repo": "bfilipov/shelf",
"path": "/tests/route_tester/metadata_item.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bfilipov/shelf path: /tests/route_tester/metadata_item.py
from tests.route_tester.base import Base
<|fim_suffix|> def __init__(self, test, test_client):
Base.__init__(self, test, test_client)
self.route = "/{bucket_name}/artifact/{path}/_meta/{item}"<|fim_middle|>
class Metada... | code_fim | easy | {
"lang": "python",
"repo": "bfilipov/shelf",
"path": "/tests/route_tester/metadata_item.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cjbassi/pymath path: /pymath/number_theory/primes.py
from collections import defaultdict
from itertools import islice, takewhile
from math import log
from typing import Dict, Iterator, List, Optional
__all__ = [
'primes_generator', 'primes', 'primes_up_to_generator', 'primes_up_to',
'mer... | code_fim | hard | {
"lang": "python",
"repo": "cjbassi/pymath",
"path": "/pymath/number_theory/primes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """https://code.activestate.com/recipes/117119/"""
D: Dict[int, List[int]] = defaultdict(list)
q = 2
while True:
if q not in D:
yield q
D[q * q] = [q]
else:
for p in D[q]:
D[p + q].a... | code_fim | medium | {
"lang": "python",
"repo": "cjbassi/pymath",
"path": "/pymath/number_theory/primes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: otkaverappa/AdventureOfCode path: /FacebookHackerCup/SquareDetector_2014_Qualification_A/SquareDetector.py
import unittest
import itertools
class SquareDetector:
def __init__( self, size, layoutMap ):
self.size = size
self.layoutMap = layoutMap
self.whiteCellToken, self.blackCellToken = '... | code_fim | hard | {
"lang": "python",
"repo": "otkaverappa/AdventureOfCode",
"path": "/FacebookHackerCup/SquareDetector_2014_Qualification_A/SquareDetector.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open( 'tests/square' ) as inputFile:
testcaseCount = int( inputFile.readline().strip() )
for i in range( testcaseCount ):
N = int( inputFile.readline().strip() )
layoutMap = list()
for _ in range( N ):
layoutMap.append( inputFile.readline().strip() )
isSquare = solutionL... | code_fim | hard | {
"lang": "python",
"repo": "otkaverappa/AdventureOfCode",
"path": "/FacebookHackerCup/SquareDetector_2014_Qualification_A/SquareDetector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kabirsrivastava3/python-practice path: /BOOK/MAIN/06-recursion/chapter-6-examples/08-fibonacci-using-recursion.py
#fibonacci using recursion
def fibonacciSeries(limit):
if limit == 1:
return 0
elif limit == 2:
return 1
<|fim_suffix|> return value
print("Enter the last term requi... | code_fim | medium | {
"lang": "python",
"repo": "kabirsrivastava3/python-practice",
"path": "/BOOK/MAIN/06-recursion/chapter-6-examples/08-fibonacci-using-recursion.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Enter the last term required: ")
limit = int(input())
for index in range(1,limit+1):
print(fibonacciSeries(index),end = ', ')<|fim_prefix|># repo: kabirsrivastava3/python-practice path: /BOOK/MAIN/06-recursion/chapter-6-examples/08-fibonacci-using-recursion.py
#fibonacci using recursion
def f... | code_fim | medium | {
"lang": "python",
"repo": "kabirsrivastava3/python-practice",
"path": "/BOOK/MAIN/06-recursion/chapter-6-examples/08-fibonacci-using-recursion.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:type left: str
:type right: str
:rtype: int
"""
count = 0
list_range = np.arange(int(left),int(right)+1)
for i in list_range:
str_i = str(i)
start = len(str_i)/2 + 1 if len(str_i)%2 != 0 else len(str_i)/2
... | code_fim | medium | {
"lang": "python",
"repo": "MarkZXZX/leetcode",
"path": "/list/906. 超级回文数.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarkZXZX/leetcode path: /list/906. 超级回文数.py
'''
906. 超级回文数
如果一个正整数自身是回文数,而且它也是一个回文数的平方,那么我们称这个数为超级回文数。
现在,给定两个正整数 L 和 R (以字符串形式表示),返回包含在范围 [L, R] 中的超级回文数的数目。
输入:L = "4", R = "1000"
输出:4
解释:
4,9,121,以及 484 是超级回文数。
注意 676 不是一个超级回文数: 26 * 26 = 676,但是 26 不是回文数。
'''
'''
思路:
这个解法会出现内存不够的情况,但是是一个挺好的实现... | code_fim | medium | {
"lang": "python",
"repo": "MarkZXZX/leetcode",
"path": "/list/906. 超级回文数.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tlittrell/bootstrap_decorator path: /src/bootstrap_decorator.py
import functools
import numpy as np
from sklearn.utils import resample
def bootstrap(*, n=100, summarize=True):
def inner(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
samples = [func(*... | code_fim | medium | {
"lang": "python",
"repo": "tlittrell/bootstrap_decorator",
"path": "/src/bootstrap_decorator.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> vals = np.array(samples)
mean = vals.mean()
std = vals.std()
return mean, std<|fim_prefix|># repo: tlittrell/bootstrap_decorator path: /src/bootstrap_decorator.py
import functools
import numpy as np
from sklearn.utils import resample
def bootstrap(*, n=100, summarize=True):
def inne... | code_fim | medium | {
"lang": "python",
"repo": "tlittrell/bootstrap_decorator",
"path": "/src/bootstrap_decorator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def calc_summary_statistics(samples):
vals = np.array(samples)
mean = vals.mean()
std = vals.std()
return mean, std<|fim_prefix|># repo: tlittrell/bootstrap_decorator path: /src/bootstrap_decorator.py
import functools
import numpy as np
from sklearn.utils import resample
def bootstrap(*... | code_fim | hard | {
"lang": "python",
"repo": "tlittrell/bootstrap_decorator",
"path": "/src/bootstrap_decorator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NoPlagiarism/Vk-Melody-Guess path: /screens/auth.py
from kivy.uix.screenmanager import Screen
from kivy.uix.image import Image
from kivymd.uix.textfield import MDTextField
from kivymd.uix.button import MDRaisedButton
blockStart = 0.6
class AuthScreen(Screen):
def __init__(self, **... | code_fim | hard | {
"lang": "python",
"repo": "NoPlagiarism/Vk-Melody-Guess",
"path": "/screens/auth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.loginInput.pos_hint = {"center_x": 0.5, "center_y": blockStart}
self.passInput.pos_hint = {"center_x": 0.5, "center_y": blockStart - 0.07}
self.loginInput.size_hint_x = 0.8
self.passInput.size_hint_x = 0.8
self.enterButton = MDRaisedButton()
se... | code_fim | hard | {
"lang": "python",
"repo": "NoPlagiarism/Vk-Melody-Guess",
"path": "/screens/auth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stohrendorf/confckurator path: /server/confckurator.py
import yaml
from flask import Flask, redirect
from flask_login import LoginManager
from api import get_pack_api_blueprint, get_template_api_blueprint, get_environment_api_blueprint, \
get_instance_api_blueprint
from db import make_sessio... | code_fim | hard | {
"lang": "python",
"repo": "stohrendorf/confckurator",
"path": "/server/confckurator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def seed_data():
load_template('seeds/apache-vhost.template.yml')
with make_session() as session:
template = Template(name="test", text="whoa = {{xxx_var}};"
" template={{_meta.template}};"
" envi... | code_fim | hard | {
"lang": "python",
"repo": "stohrendorf/confckurator",
"path": "/server/confckurator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tpl = Template(name=template['name'], text=template['text'])
for varname, properties in template['variables'].items():
tpl.variables.append(Variable(name=varname, description=properties['description']))
with make_session() as session:
session.add(tpl)
def seed_data():
lo... | code_fim | hard | {
"lang": "python",
"repo": "stohrendorf/confckurator",
"path": "/server/confckurator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context['page_range'] = page_range
context['query'] = query
return context<|fim_prefix|># repo: gustavopinho/pmocgestao path: /core/templatetags/pagination.py
# coding=utf-8
from django.template import Library
register = Library()
@register.inclusion_tag('pagination.html')
def paginat... | code_fim | hard | {
"lang": "python",
"repo": "gustavopinho/pmocgestao",
"path": "/core/templatetags/pagination.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gustavopinho/pmocgestao path: /core/templatetags/pagination.py
# coding=utf-8
from django.template import Library
register = Library()
@register.inclusion_tag('pagination.html')
def pagination(request, paginator, page_obj, query=None):
context = {}
context['paginator'] = paginator
... | code_fim | medium | {
"lang": "python",
"repo": "gustavopinho/pmocgestao",
"path": "/core/templatetags/pagination.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joeedh/fairmotion path: /pyserver/pymysql3_2/py3k/pymysql/tests/thirdparty/test_MySQLdb/__init__.py
from test_MySQLdb_capabilities import test_MySQLdb as test_<|fim_suffix|>ame__ == "__main__":
import unittest
unittest.main()<|fim_middle|>capabilities
from test_MySQLdb_nonstandard import ... | code_fim | medium | {
"lang": "python",
"repo": "joeedh/fairmotion",
"path": "/pyserver/pymysql3_2/py3k/pymysql/tests/thirdparty/test_MySQLdb/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ame__ == "__main__":
import unittest
unittest.main()<|fim_prefix|># repo: joeedh/fairmotion path: /pyserver/pymysql3_2/py3k/pymysql/tests/thirdparty/test_MySQLdb/__init__.py
from test_MySQLdb_capabilities import test_MySQLdb as test_<|fim_middle|>capabilities
from test_MySQLdb_nonstandard import ... | code_fim | medium | {
"lang": "python",
"repo": "joeedh/fairmotion",
"path": "/pyserver/pymysql3_2/py3k/pymysql/tests/thirdparty/test_MySQLdb/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
url: mocked by local file path
"""
image = classifier_offline.load_image(url)
assert image.shape == (224, 224, 3)
assert np.all(image <= 1) # normalized
@pytest.mark.parametrize('image_url,exp_top_3_names', [
(f'{local_dir}/images/Phalacrocorax varius varius.jpg',
... | code_fim | hard | {
"lang": "python",
"repo": "datachord/veriff-mobile-bird-classification",
"path": "/test_classifier_offline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: datachord/veriff-mobile-bird-classification path: /test_classifier_offline.py
#!/usr/bin/env python3
import os
import tensorflow.compat.v2 as tf
import tensorflow_hub as hub
import cv2
import urllib.request
import pandas as pd
import numpy as np
import time
import pytest
import numpy.testing as ... | code_fim | hard | {
"lang": "python",
"repo": "datachord/veriff-mobile-bird-classification",
"path": "/test_classifier_offline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>local_dir = "file:///work/veriff-mobile-bird-classification" # repository directory – change /kaggle/working to suit local file system
@pytest.mark.parametrize('url', [
f"{local_dir}/images/Phalacrocorax varius varius.jpg",
f"{local_dir}/images/Galerida cristata.jpg",
f"{local_dir}/images/Eum... | code_fim | medium | {
"lang": "python",
"repo": "datachord/veriff-mobile-bird-classification",
"path": "/test_classifier_offline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skilkis/devops path: /setup.py
"""Entry point for setuptools, configuration is in setup.cfg."""
import re
from pathlib import Path
from typing import List
<|fim_suffix|>def semver_from(changelog: Path) -> Version:
"""Retrieve latest Semantic Version (SemVer) from ``changelog``."""
with ... | code_fim | medium | {
"lang": "python",
"repo": "skilkis/devops",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> versions.sort()
latest = versions[-1]
print(latest)
return latest.bump_prerelease() if is_unreleased else latest
if __name__ == "__main__":
setup(
use_scm_version={
"fallback_version": semver_from(ROOT_DIR / "CHANGELOG.md"),
}
)<|fim_pr... | code_fim | hard | {
"lang": "python",
"repo": "skilkis/devops",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fontobene/fontobene-converters path: /newstroke_hershey/convert.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NewStroke/Hershey to FontoBene conversion script.
"""
import os
from ctypes import *
HEADER = """\
# This font was automatically converted from NewStroke to FontoBene.
# - NewSt... | code_fim | hard | {
"lang": "python",
"repo": "fontobene/fontobene-converters",
"path": "/newstroke_hershey/convert.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # generate C file with hershey font
ret = os.system('awk -f fontconv.awk symbol.lib font.lib charlist.txt > newstroke_font.c')
assert(ret == 0)
# generate and load shared library
ret = os.system('gcc -shared -o newstroke_font.so newstroke_font.c')
assert (ret == 0)
lib = cdll.... | code_fim | hard | {
"lang": "python",
"repo": "fontobene/fontobene-converters",
"path": "/newstroke_hershey/convert.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> labels = ["See more", "See more", "See more", "See more"]
fmt = _("See more")
i18n_label_fmts = [fmt, fmt, fmt, fmt]
titles = [
"I lost my access card.",
"My access card has been damaged.",
"Can visitors enter the office?",
"I can’t remember my computer pa... | code_fim | hard | {
"lang": "python",
"repo": "KimKaffan1984/samplebot_faq_ask_bot",
"path": "/faq_bot/actions/query_security.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fmt = _("See more")
i18n_label_fmts = [fmt, fmt, fmt, fmt]
titles = [
"I lost my access card.",
"My access card has been damaged.",
"Can visitors enter the office?",
"I can’t remember my computer password."
]
i18n_title_fmts = [
_("I lost m... | code_fim | hard | {
"lang": "python",
"repo": "KimKaffan1984/samplebot_faq_ask_bot",
"path": "/faq_bot/actions/query_security.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KimKaffan1984/samplebot_faq_ask_bot path: /faq_bot/actions/query_security.py
# !/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2020-present Works Mobile Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
... | code_fim | hard | {
"lang": "python",
"repo": "KimKaffan1984/samplebot_faq_ask_bot",
"path": "/faq_bot/actions/query_security.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaichogami/machine_learning path: /linear_regression/tests/test_multi_variables.py
import numpy as np
from numpy.testing import (assert_array_equal)
from sklearn.preprocessing import StandardScaler
from ..multi_variables import MultiLinearRegression
from ...utils.scaling import standardize
<|f... | code_fim | medium | {
"lang": "python",
"repo": "kaichogami/machine_learning",
"path": "/linear_regression/tests/test_multi_variables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X = np.random.randint(1, 1000, (100, 10))
y = np.asarray([sum(X[i]) * int(np.random.random_integers(1, 1000, 1)) + 1000
for i in xrange(100)])
sc = StandardScaler().fit(X)
X = sc.transform(X)
mlr = MultiLinearRegression()
mlr.fit(X, y)
y_bar = mlr.trans... | code_fim | medium | {
"lang": "python",
"repo": "kaichogami/machine_learning",
"path": "/linear_regression/tests/test_multi_variables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create the CutFlowSvc instance
import AthenaCommon.CfgMgr as CfgMgr
if not hasattr(svcMgr,"CutFlowSvc"): svcMgr += CfgMgr.CutFlowSvc()
svcMgr.CutFlowSvc.InputStream = inputStreamName
# Make sure MetaDataSvc is ready
if not hasattr(svcMgr,'MetaDataSvc'):
from AthenaServic... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/Event/EventBookkeeperTools/python/CutFlowHelpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: strigazi/athena path: /Event/EventBookkeeperTools/python/CutFlowHelpers.py
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Creation: Karsten Koeneke
def GetCurrentStreamName( msg ):
""" Helper to decide where to get the input stream name from."""
# First, try ... | code_fim | hard | {
"lang": "python",
"repo": "strigazi/athena",
"path": "/Event/EventBookkeeperTools/python/CutFlowHelpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chanzuckerberg/miniwdl path: /tests/no_docker_services.py
#!/usr/bin/env python3
# verify there are no miniwdl-related docker services left behind from test suite
import sys
import docker
client = docker.from_env(version="auto")
info = client.info()
if (
"Swarm" in i<|fim_suffix|> in d and "... | code_fim | hard | {
"lang": "python",
"repo": "chanzuckerberg/miniwdl",
"path": "/tests/no_docker_services.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Docker swarm lists existing miniwdl-related services, suggesting miniwdl task runtime failed to clean up after itself. Debug this and/or `docker swarm leave --force` to clear.", file=sys.stderr)
sys.exit(1)<|fim_prefix|># repo: chanzuckerberg/miniwdl path: /tests/no_docker_services.py
#!/usr/bin/... | code_fim | hard | {
"lang": "python",
"repo": "chanzuckerberg/miniwdl",
"path": "/tests/no_docker_services.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for country in OPTI_REGIONS:
file_path_ = os.path.join('dumped_files', 'dumped_detection_percentiles_' + country + '.npy')
with open(file_path_, "rb") as f:
percentiles[country] = np.load(f)
n_panels = len(OPTI_REGIONS)
n_col = 3
n_row = int(n_panels // n_col)... | code_fim | hard | {
"lang": "python",
"repo": "malanchak/AuTuMN",
"path": "/apps/covid_19/mixing_optimisation/opti_plots/plot_param_posteriors.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: malanchak/AuTuMN path: /apps/covid_19/mixing_optimisation/opti_plots/plot_param_posteriors.py
import pandas as pd
from matplotlib import pyplot as plt
import os
from autumn.db.database import Database
from autumn.tool_kit.uncertainty import export_compartment_size, collect_iteration_weights, col... | code_fim | hard | {
"lang": "python",
"repo": "malanchak/AuTuMN",
"path": "/apps/covid_19/mixing_optimisation/opti_plots/plot_param_posteriors.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arnhoudt/Haldis path: /app/models/user.py
"Script for everything User related in the database"
from models import db
class User(db.Model):
"Class used for configuring the User model in the database"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), uni... | code_fim | hard | {
"lang": "python",
"repo": "Arnhoudt/Haldis",
"path": "/app/models/user.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def is_admin(self) -> bool:
return self.admin
def is_anonymous(self) -> bool:
return False
def get_id(self) -> str:
return str(self.id)
def __repr__(self) -> str:
return "%s" % self.username<|fim_prefix|># repo: Arnhoudt/Haldis path: /app/models/user.py
... | code_fim | medium | {
"lang": "python",
"repo": "Arnhoudt/Haldis",
"path": "/app/models/user.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/data/experimental/ops/batching.py
DITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===============================================================... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/data/experimental/ops/batching.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """A `Dataset` that batches ragged dense elements into `tf.sparse.SparseTensor`s."""
def __init__(self, input_dataset, batch_size, row_shape):
"""See `Dataset.dense_to_sparse_batch()` for more details."""
if not isinstance(
dataset_ops.get_legacy_output_types(input_dataset), dtypes.DT... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/data/experimental/ops/batching.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
A `Dataset` transformation function, which can be passed to
`tf.data.Dataset.apply`.
Raises:
ValueError: If both `num_parallel_batches` and `num_parallel_calls` are
specified.
"""
if num_parallel_batches is None and num_parallel_calls is None:
num_parallel_calls = ... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/data/experimental/ops/batching.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>onciler, NullOrderReconciler
from .reconciledorders import ReconciledOrders
from .toleranceorderreconciler import ToleranceOrderReconciler<|fim_prefix|># repo: Investin-pro/mango-explorer path: /mango/marketmaking/__init__.py
from .hedger import Hedger
from .marketmaker import MarketMaker
from .modelstat... | code_fim | hard | {
"lang": "python",
"repo": "Investin-pro/mango-explorer",
"path": "/mango/marketmaking/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Investin-pro/mango-explorer path: /mango/marketmaking/__init__.py
from .hedger import Hedger
from .marketmaker import MarketMaker
from .modelstate import ModelState
from .modelstatebuilder import ModelSt<|fim_suffix|>ModelStateBuilder
from .modelstatebuilderfactory import ModelUpdateMode, model_s... | code_fim | medium | {
"lang": "python",
"repo": "Investin-pro/mango-explorer",
"path": "/mango/marketmaking/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: camader/baseclasses path: /baseclasses/BaseSolver.py
from pprint import pprint as pp
#!/usr/local/bin/python
'''
BaseSolver
Holds a basic Python Analysis Classes (base and inherited).
Copyright (c) 2017 by Dr. Charles A. Mader
All rights reserved. Not to be used for commercial purposes.
Revisio... | code_fim | hard | {
"lang": "python",
"repo": "camader/baseclasses",
"path": "/baseclasses/BaseSolver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getOption(self, name):
"""
Default implementation of getOption()
Parameters
----------
name : str
Name of option to get. Not case sensitive
Returns
-------
value : varies
Return the current value of the option.... | code_fim | hard | {
"lang": "python",
"repo": "camader/baseclasses",
"path": "/baseclasses/BaseSolver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Default implementation of getOption()
Parameters
----------
name : str
Name of option to get. Not case sensitive
Returns
-------
value : varies
Return the current value of the option.
"""
if name.l... | code_fim | hard | {
"lang": "python",
"repo": "camader/baseclasses",
"path": "/baseclasses/BaseSolver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Gr��ina sur��iuot� s�ra�� �od�i�, � kuriuos i�siskleid�ia eilut�"""
input, output = os.popen2("ispell -e")
#import pdb; pdb.set_trace()
input.write(line)
input.flush()
input.close()
words = output.read()
output.close()
words = words.split()
words.sort()
retu... | code_fim | medium | {
"lang": "python",
"repo": "ispell-lt/ispell-lt",
"path": "/tools/utils/validator/ispell.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ispell-lt/ispell-lt path: /tools/utils/validator/ispell.py
#!/usr/bin/env python3
"""
Priemon�s kreiptis � ispell �odyn�.
$Id: ispell.py,v 1.1 2003/06/11 10:06:48 alga Exp $
"""
import os
<|fim_suffix|> input, output = os.popen2("ispell -e")
#import pdb; pdb.set_trace()
input.write(l... | code_fim | hard | {
"lang": "python",
"repo": "ispell-lt/ispell-lt",
"path": "/tools/utils/validator/ispell.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antallen/PythonMaterial path: /ch8/Destiny.py
import random
import csv
class Destiny:
__messages = []
__money = []
<|fim_suffix|> # 隨機抽取一張
nums = random.randint(0,len(self.__messages)-1)
return (self.__messages[nums],self.__money[nums])
if __name__ == "... | code_fim | hard | {
"lang": "python",
"repo": "antallen/PythonMaterial",
"path": "/ch8/Destiny.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
myDestiny = Destiny()
print(myDestiny.choice())<|fim_prefix|># repo: antallen/PythonMaterial path: /ch8/Destiny.py
import random
import csv
class Destiny:
__messages = []
__money = []
# 讀取 CSV 檔案
def choice(self):
with open('destiny.csv', ... | code_fim | medium | {
"lang": "python",
"repo": "antallen/PythonMaterial",
"path": "/ch8/Destiny.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 隨機抽取一張
nums = random.randint(0,len(self.__messages)-1)
return (self.__messages[nums],self.__money[nums])
if __name__ == "__main__":
myDestiny = Destiny()
print(myDestiny.choice())<|fim_prefix|># repo: antallen/PythonMaterial path: /ch8/Destiny.py
import random
impo... | code_fim | hard | {
"lang": "python",
"repo": "antallen/PythonMaterial",
"path": "/ch8/Destiny.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #将1x3的卷积变成3x3的卷积参数
def _pad_1x3_kernel(self,kernel):
if(kernel is None):
return 0
else:
return F.pad(kernel,[0,0,1,1])
#将3x1的卷积变成3x3的卷积参数
def _pad_3x1_kernel(self,kernel):
if(kernel is None):
return 0
... | code_fim | hard | {
"lang": "python",
"repo": "shinianzhihou/ChangeDetection",
"path": "/mmseg/models/backbones/fightingcv/rep/acnet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shinianzhihou/ChangeDetection path: /mmseg/models/backbones/fightingcv/rep/acnet.py
import torch
from torch import mean, nn
from collections import OrderedDict
from torch.nn import functional as F
import numpy as np
from numpy import random
def setup_seed(seed):
torch.manual_seed(seed)
... | code_fim | hard | {
"lang": "python",
"repo": "shinianzhihou/ChangeDetection",
"path": "/mmseg/models/backbones/fightingcv/rep/acnet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Type check and event and emit it if we are running have have observers.
Parameters
----------
event : Event
Some Event class
"""
self._check(event)
if self.has_observers() is True and self._running is True:
self.emit(event... | code_fim | hard | {
"lang": "python",
"repo": "esnet/pypond",
"path": "/pypond/io/input.py",
"mode": "spm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esnet/pypond path: /pypond/io/input.py
# Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt
# of any required approvals from the U.S. Dept. of Energy).
# All rights reserved.
#
# This source code is licensed un... | code_fim | hard | {
"lang": "python",
"repo": "esnet/pypond",
"path": "/pypond/io/input.py",
"mode": "psm",
"license": "BSD-3-Clause-LBNL",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return "Ray(origin = {0}, direction = {1})".format(self._origin, self._direction)<|fim_prefix|># repo: CCH852573130/3DPrinting10 path: /app/src/main/python/Ray.py
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from Vecto... | code_fim | hard | {
"lang": "python",
"repo": "CCH852573130/3DPrinting10",
"path": "/app/src/main/python/Ray.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._origin
@property
def direction(self):
return self._direction
@property
def inverseDirection(self):
return self._inverse_direction
def getPointAlongRay(self, distance):
return self._origin + (self._direction * distance)
def __repr__(s... | code_fim | medium | {
"lang": "python",
"repo": "CCH852573130/3DPrinting10",
"path": "/app/src/main/python/Ray.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CCH852573130/3DPrinting10 path: /app/src/main/python/Ray.py
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from Vector import Vector
class Ray:
def __init__(self, origin = Vector(), direction = Vector()):
self._origin = origin
... | code_fim | medium | {
"lang": "python",
"repo": "CCH852573130/3DPrinting10",
"path": "/app/src/main/python/Ray.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awslabs/aws-service-catalog-factory path: /servicecatalog_factory/waluigi/tasks.py
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import functools
import json
import os
import logging
import luigi
import traceback
from datetime im... | code_fim | hard | {
"lang": "python",
"repo": "awslabs/aws-service-catalog-factory",
"path": "/servicecatalog_factory/waluigi/tasks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_task_start(self):
task_name = self.__class__.__name__
logger.info(f"{task_name}:{self.task_reference} started")
record_event("start", self)
def on_task_success(self, duration):
record_event("success", self, dict(duration=duration))
def on_task_timeout(s... | code_fim | hard | {
"lang": "python",
"repo": "awslabs/aws-service-catalog-factory",
"path": "/servicecatalog_factory/waluigi/tasks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashigirl96/stable-baselines path: /stable_baselines/common/config.py
class Config:
def __init__(self) -> None:
# For type hints
# General information
self.name: str = None
self.parser = argparse.ArgumentParser()
self.optimizer_fn: Opt = None
self.actor_optimizer_fn: Op... | code_fim | hard | {
"lang": "python",
"repo": "ashigirl96/stable-baselines",
"path": "/stable_baselines/common/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def load(self, name):
if not Path(name).exists():
raise ValueError(f'The file {name} is not exist.')
with open(name, 'rb') as config:
config_dict = cloudpickle.load(config)
self._merge(config_dict)
def _merge(self, config_dict=None) -> None:
if config_dict is None:
a... | code_fim | hard | {
"lang": "python",
"repo": "ashigirl96/stable-baselines",
"path": "/stable_baselines/common/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if img_meta.get(k + '_gt', None) is None:
# img_meta does not have flow_bw_gt, so just check
# the forward predicted.
if k == 'flow_bw':
continue
elif k == 'flow_... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmflow",
"path": "/mmflow/core/evaluation/evaluation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmflow path: /mmflow/core/evaluation/evaluation.py
# Copyright (c) OpenMMLab. All rights reserved.
import sys
from collections import defaultdict
from typing import Any, Dict, Optional, Sequence, Union
import mmcv
import numpy as np
import torch
from mmcv.parallel import MMDistributed... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmflow",
"path": "/mmflow/core/evaluation/evaluation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i_metric in metrics:
if result_metrics.get(i_metric) is None:
raise KeyError(f'Model cannot compute {i_metric}')
result_metrics[i_metric] = np.array(result_metrics[i_metric]).mean()
return result_metrics
def multi_gpu_online_evaluation(
model: Module,
... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmflow",
"path": "/mmflow/core/evaluation/evaluation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marcmm4/crm_flask_test path: /migrations/versions/126cd1405b3c_.py
"""empty message
Revision ID: 126cd1405b3c
Revises: df8376ab2977
Create Date: 2018-12-08 17:30:54.596412
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '126cd1405b3c'
dow... | code_fim | medium | {
"lang": "python",
"repo": "marcmm4/crm_flask_test",
"path": "/migrations/versions/126cd1405b3c_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('User', 'test')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('User', sa.Column('test', sa.VARCHAR(), nullable=Tru... | code_fim | medium | {
"lang": "python",
"repo": "marcmm4/crm_flask_test",
"path": "/migrations/versions/126cd1405b3c_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('User', 'test')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('User', sa.Column('test', sa.VARCHAR(), nullable=Tr... | code_fim | medium | {
"lang": "python",
"repo": "marcmm4/crm_flask_test",
"path": "/migrations/versions/126cd1405b3c_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kingarturs/mercedez-crm path: /apps/comisiones/models.py
from apps.clientes.models import Empleado
from django.db import models
from datetime import date
from apps.ventas.models import Venta
from django.contrib.auth import get_user_model
Empleado = get_user_model()
<|fim_suffix|> fecha = mod... | code_fim | medium | {
"lang": "python",
"repo": "Kingarturs/mercedez-crm",
"path": "/apps/comisiones/models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> fecha = models.DateField(default=date.today)
total = models.DecimalField(max_digits=8, decimal_places=2, null=False)
venta = models.ForeignKey(Venta, on_delete=models.CASCADE)
empleado = models.ForeignKey(Empleado, on_delete=models.CASCADE)<|fim_prefix|># repo: Kingarturs/mercedez-crm pat... | code_fim | medium | {
"lang": "python",
"repo": "Kingarturs/mercedez-crm",
"path": "/apps/comisiones/models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test the ``iter_together`` command line interface."""
runner = CliRunner()
args = [F1_PATH, F2_PATH]
result = runner.invoke(cli.main, args)
self.assertEqual(0, result.exit_code)
expected_output = 'a,a_1,a_2\nb,b_1,b_2\nc,c_1,c_2\nd,d_1,d_2\n'
self... | code_fim | hard | {
"lang": "python",
"repo": "shreya-singh-tech/iter-together-FINISHED",
"path": "/tests/test_iter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shreya-singh-tech/iter-together-FINISHED path: /tests/test_iter.py
# -*- coding: utf-8 -*-
"""Tests for ``iter-together``."""
import unittest
from click.testing import CliRunner
<|fim_suffix|> """Test iterating files together."""
def test_iter_together(self):
"""Test ``iter_to... | code_fim | medium | {
"lang": "python",
"repo": "shreya-singh-tech/iter-together-FINISHED",
"path": "/tests/test_iter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_iter_together(self):
"""Test ``iter_together``."""
expected = [
('a', 'a_1', 'a_2'),
('b', 'b_1', 'b_2'),
('c', 'c_1', 'c_2'),
('d', 'd_1', 'd_2'),
]
actual = list(iter_together(F1_PATH, F2_PATH, sep=','))
... | code_fim | medium | {
"lang": "python",
"repo": "shreya-singh-tech/iter-together-FINISHED",
"path": "/tests/test_iter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print request.POST
icon = request.POST['icon']
title = request.POST['title']
description = request.POST['description']
package_name = request.POST['package_name']
package_link = request.POST['package_link']
package_ami = request.POST['package_ami']
package_vendor = request.POST['vendor']
... | code_fim | hard | {
"lang": "python",
"repo": "mecirt/cloudly",
"path": "/cloud_software/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mecirt/cloudly path: /cloud_software/views.py
# -*- coding: utf-8 -*-
import os
import time
import pickle
import logging
import datetime
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.http impo... | code_fim | hard | {
"lang": "python",
"repo": "mecirt/cloudly",
"path": "/cloud_software/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
list: list of dicts containing flexure results
Aligned with specobjs
Filled with a basically empty dict if the slit is skipped or there is no object
"""
sv_fdict = None
msgs.work("Consider doing 2 passes in flexure as in LowRedux")
# Load Archi... | code_fim | hard | {
"lang": "python",
"repo": "afloers/PypeIt",
"path": "/pypeit/core/flexure.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: afloers/PypeIt path: /pypeit/core/flexure.py
htest)
arx_keep = np.argsort(arx_amp[arx_w])[-5:]
obj_keep = np.argsort(obj_amp[obj_w])[-5:]
# Calculate wavelength (Angstrom per pixel)
arx_disp = np.append(arx_skyspec.wavelength.value[1]-arx_skyspec.wavelength.value[0],
... | code_fim | hard | {
"lang": "python",
"repo": "afloers/PypeIt",
"path": "/pypeit/core/flexure.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: afloers/PypeIt path: /pypeit/core/flexure.py
(obj_disp[obj_idx]*(2*np.sqrt(2*np.log(2)))*obj_wid[obj_w][obj_keep])
if not np.all(np.isfinite(obj_res)):
msgs.warn('Failed to measure the resolution of the object spectrum, likely due to error '
'in the waveleng... | code_fim | hard | {
"lang": "python",
"repo": "afloers/PypeIt",
"path": "/pypeit/core/flexure.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = self.add_prefix(key)
if self._cache:
value = self._cache.get(key)
if value is None:
self.autofill()
value = self._cache.get(key)
else:
value = None
if value is None:
try:
v... | code_fim | hard | {
"lang": "python",
"repo": "bulldoges/MemberMatters",
"path": "/memberportal/membermatters/constance_backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.