text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if frac_bits < 0 or frac_bits > bit_size:
return -math.inf
if frac_bits not in store:
store[frac_bits] = calculate_qsnr(npa, bit_size, frac_bits)
return store[frac_bits]
qstats = {}
# Already quantized
if not np.issubdtype(npa.dtype, np.floatin... | code_fim | hard | {
"lang": "python",
"repo": "danieldennett/gap_sdk",
"path": "/tools/nntool/utils/stats_funcs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> frac_bits = max(bit_size - ideal_ibits, 0)
if force_ideal:
get_qsnr(npa, bit_size, frac_bits)
else:
while True:
t_low = get_qsnr(npa, bit_size, frac_bits - 1)
t_mid = get_qsnr(npa, bit_size, frac_bits)
t_high ... | code_fim | hard | {
"lang": "python",
"repo": "danieldennett/gap_sdk",
"path": "/tools/nntool/utils/stats_funcs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danieldennett/gap_sdk path: /tools/nntool/utils/stats_funcs.py
# Copyright 2019 GreenWaves Technologies, SAS
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://... | code_fim | hard | {
"lang": "python",
"repo": "danieldennett/gap_sdk",
"path": "/tools/nntool/utils/stats_funcs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ipl31/mr_market path: /src/mister_market/constants.py
class ConstantError(Exception):
def __init__(self, message="Can't redfine constants"):
self.message = message
super().__init__(self.message)
def constant(f):
def fset(self, value):
raise ConstantError
d... | code_fim | hard | {
"lang": "python",
"repo": "ipl31/mr_market",
"path": "/src/mister_market/constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ["GCUSD", "XAUUSD", "XAU"]
@constant
def BTC_ALIASES():
return ["BTC"]
@constant
def FMP_BTC_SYMBOL():
return "BTCUSD"
@constant
def STOCK():
return "stock"
@constant
def COMMODITY():
return "commodity"
@constant
d... | code_fim | hard | {
"lang": "python",
"repo": "ipl31/mr_market",
"path": "/src/mister_market/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "stock"
@constant
def COMMODITY():
return "commodity"
@constant
def CRYPTO():
return "crypto"
@constant
def FOREX():
return "forex"<|fim_prefix|># repo: ipl31/mr_market path: /src/mister_market/constants.py
class ConstantError(Exception):... | code_fim | hard | {
"lang": "python",
"repo": "ipl31/mr_market",
"path": "/src/mister_market/constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: serge-name/myansible path: /filter_plugins/smart_join.py
class FilterModule(object):
''' If input is string, just return the string; if array, merge elements '''
def filters(self):
return {
'smart_join': self.smart_join,
}
<|fim_suffix|> if type(input_... | code_fim | easy | {
"lang": "python",
"repo": "serge-name/myansible",
"path": "/filter_plugins/smart_join.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def smart_join(self,input_value):
if type(input_value) is str:
return input_value
elif type(input_value) is list:
return "\n".join(input_value)
else:
raise<|fim_prefix|># repo: serge-name/myansible path: /filter_plugins/smart_join.py
class F... | code_fim | medium | {
"lang": "python",
"repo": "serge-name/myansible",
"path": "/filter_plugins/smart_join.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if type(input_value) is str:
return input_value
elif type(input_value) is list:
return "\n".join(input_value)
else:
raise<|fim_prefix|># repo: serge-name/myansible path: /filter_plugins/smart_join.py
class FilterModule(object):
''' If input ... | code_fim | medium | {
"lang": "python",
"repo": "serge-name/myansible",
"path": "/filter_plugins/smart_join.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alikslee/Python-itheima-2019 path: /01-Python核心编程/代码/08-异常/hm_10_自定义异常.py
# 1. 自定义异常类, 继承Exception, 魔法方法有init和str(设置异常描述信息)
class ShortInputError(Exception):
def __init__(self, length, min_len):
# 用户输入的密码长度
self.length = length
# 系统要求的最少长度
self.min_len = min_le... | code_fim | medium | {
"lang": "python",
"repo": "alikslee/Python-itheima-2019",
"path": "/01-Python核心编程/代码/08-异常/hm_10_自定义异常.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
# 2. 抛出异常: 尝试执行:用户输入密码,如果长度小于3,抛出异常
try:
password = input('请输入密码:')
if len(password) < 3:
# 抛出异常类创建的对象
raise ShortInputError(len(password), 3)
# 3. 捕获该异常
except Exception as result:
print(result)
else:
print('没有异常,密码输入... | code_fim | hard | {
"lang": "python",
"repo": "alikslee/Python-itheima-2019",
"path": "/01-Python核心编程/代码/08-异常/hm_10_自定义异常.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
# 2. 抛出异常: 尝试执行:用户输入密码,如果长度小于3,抛出异常
try:
password = input('请输入密码:')
if len(password) < 3:
# 抛出异常类创建的对象
raise ShortInputError(len(password), 3)
# 3. 捕获该异常
except Exception as result:
print(result)
else:
print('没有异常,密码输... | code_fim | medium | {
"lang": "python",
"repo": "alikslee/Python-itheima-2019",
"path": "/01-Python核心编程/代码/08-异常/hm_10_自定义异常.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(Vendor._meta.get_field('modified').auto_now)
self.assertTrue(Vendor._meta.get_field('created').auto_now_add)
def test___unicode___method(self):
try:
Vendor.__unicode__(Vendor())
except AttributeError:
self.fail("No __unicode__ me... | code_fim | hard | {
"lang": "python",
"repo": "osu-cass/whats-fresh-api",
"path": "/whats_fresh/whats_fresh_api/tests/models/test_vendor_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osu-cass/whats-fresh-api path: /whats_fresh/whats_fresh_api/tests/models/test_vendor_model.py
from django.test import TestCase
from phonenumber_field.modelfields import PhoneNumberField
from whats_fresh.whats_fresh_api.models import Vendor
from django.contrib.gis.db import models
class VendorT... | code_fim | hard | {
"lang": "python",
"repo": "osu-cass/whats-fresh-api",
"path": "/whats_fresh/whats_fresh_api/tests/models/test_vendor_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_optional_fields(self):
models.get_model('whats_fresh_api', 'Vendor')
for field in self.optional_fields:
self.assertEqual(
Vendor._meta.get_field_by_name(field)[0].blank, True)
for field in self.null_fields:
self.assertEqual(
... | code_fim | hard | {
"lang": "python",
"repo": "osu-cass/whats-fresh-api",
"path": "/whats_fresh/whats_fresh_api/tests/models/test_vendor_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dapperfu/python_Rigol path: /tests/conftest.py
import sys
from time import sleep
from uuid import uuid4
import pytest
import rigol
import rigol.usbtmc
import rigol.rigol
import rigol.key
@pytest.yield_fixture(scope="module")
def module_uuid():
"""
Unit Test Module UUI... | code_fim | hard | {
"lang": "python",
"repo": "dapperfu/python_Rigol",
"path": "/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Unit Test Session UUID.
Yields:
uuid.uuid4()
"""
yield uuid.uuid4()
@pytest.yield_fixture(scope="function")
def function_uuid():
"""
Unit Test Function UUID.
Yields:
uuid.uuid4()
"""
yield uuid.uuid4()
def pytest_addoption... | code_fim | medium | {
"lang": "python",
"repo": "dapperfu/python_Rigol",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cdevin/objectattention path: /get_image_from_demo.py
import yaml
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('paramsfile', metavar='f', help='the yaml file')
args = parser.parse_args(... | code_fim | medium | {
"lang": "python",
"repo": "cdevin/objectattention",
"path": "/get_image_from_demo.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>, (-1,doc['data']['image_height'],doc['data']['image_width'], 3)).astype(np.uint8)
plt.imsave(demo_dir+'/myimage.png', all_img[0][:,:,::-1])<|fim_prefix|># repo: cdevin/objectattention path: /get_image_from_demo.py
import yaml
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = ar... | code_fim | medium | {
"lang": "python",
"repo": "cdevin/objectattention",
"path": "/get_image_from_demo.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Converts a set of SPH particles to a 1D stellar evolution model. If the SPH
model of the star included a (non-SPH) 'core' particle, supply it via the
optional core_particle keyword argument (Not yet supported).
SPH particles are sorted using the pressure.
Useful for cont... | code_fim | hard | {
"lang": "python",
"repo": "amusecode/amuse",
"path": "/src/amuse/ext/sph_to_star.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amusecode/amuse path: /src/amuse/ext/sph_to_star.py
import numpy
from amuse.units import constants, units
from amuse.datamodel import Grid
class SPH2StellarModel(object):
"""
Converts a set of SPH particles to a 1D stellar evolution model. If the SPH
model of the star included a (n... | code_fim | hard | {
"lang": "python",
"repo": "amusecode/amuse",
"path": "/src/amuse/ext/sph_to_star.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> attribute_names = self.sph_particles.get_attribute_names_defined_in_store()
for attribute, name in [("h1", "X_H"), ("he4", "X_He"), ("c12", "X_C"), ("n14", "X_N"),
("o16", "X_O"), ("ne20", "X_Ne"), ("mg24", "X_Mg"), ("si28", "X_Si"), ("fe56", "X_Fe")]:
if attri... | code_fim | hard | {
"lang": "python",
"repo": "amusecode/amuse",
"path": "/src/amuse/ext/sph_to_star.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pdf2 = utils.compute_pdf(da, bin_edges, dim='dim2')
assert np.all(pdf2.values == np.ones(100)/100)
# ===================================================================================================
def test_compute_cdf():
tile = np.linspace(1,100,100)
da_data = np.tile(tile,(100,1)... | code_fim | hard | {
"lang": "python",
"repo": "aaronspring/doppyo",
"path": "/doppyo/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aaronspring/doppyo path: /doppyo/test/test_utils.py
"""
Tests for functions in pyLatte utils module
Author: Dougie Squire
Date created: 05/04/2018
Python Version: 3.6
"""
# ===================================================================================================
# Packa... | code_fim | hard | {
"lang": "python",
"repo": "aaronspring/doppyo",
"path": "/doppyo/test/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tile = np.linspace(1,100,100)
da_data = np.tile(tile,(100,1))
da = xr.DataArray(da_data, coords =[tile, tile], dims=['dim1','dim2'])
bin_edges = utils.get_bin_edges(tile)
cdf1 = utils.compute_cdf(da, bin_edges, dim='dim1')
assert np.all(cdf1 == np.tril(np.ones((100,100)),k=0))<|f... | code_fim | hard | {
"lang": "python",
"repo": "aaronspring/doppyo",
"path": "/doppyo/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_jobs = n_skip = n_ok = 0
text_row_ids = models.OcrText.all_ids_for('proposal')
for sponsorship in models.Sponsorship.query:
if not force:
if sponsorship.match.data is not None:
n_ok += 1
continue
if sponsorship.proposal_id not in te... | code_fim | hard | {
"lang": "python",
"repo": "mgax/mptracker",
"path": "/mptracker/proposals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mgax/mptracker path: /mptracker/proposals.py
from time import sleep
import logging
import flask
from flask.ext.script import Manager
from flask.ext.rq import job
from mptracker import models
from mptracker.common import ocr_url, parse_date
from mptracker.nlp import match_text_for_mandate
logger ... | code_fim | hard | {
"lang": "python",
"repo": "mgax/mptracker",
"path": "/mptracker/proposals.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sponsorship = models.Sponsorship.query.get(sponsorship_id)
proposal = sponsorship.proposal
text = proposal.title + ' ' + proposal.text
result = match_text_for_mandate(sponsorship.mandate, text)
sponsorship.match.data = flask.json.dumps(result)
if not sponsorship.match.manual:
... | code_fim | hard | {
"lang": "python",
"repo": "mgax/mptracker",
"path": "/mptracker/proposals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robert871126/bk-user path: /src/api/bkuser_core/categories/management/commands/create_pluggable_category.py
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent compan... | code_fim | hard | {
"lang": "python",
"repo": "robert871126/bk-user",
"path": "/src/api/bkuser_core/categories/management/commands/create_pluggable_category.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle(self, *args, **options):
domain = options["domain"]
name = options["name"]
plugin = options["plugin"]
logger.info("creating SettingMeta %s", PLUGIN_NAME_SETTING_KEY)
meta, _ = SettingMeta.objects.get_or_create(
key=PLUGIN_NAME_SETTING_KEY... | code_fim | hard | {
"lang": "python",
"repo": "robert871126/bk-user",
"path": "/src/api/bkuser_core/categories/management/commands/create_pluggable_category.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Splufic-Automation-Systems-Ltd/Python-Training-Online-Cohort-Two path: /Week Two/Day 2/second.py
""" This is my python code
Another linbe to show some documentation.
<|fim_suffix|>print('This is my code using sublime text.')
print('This is my code using sublime text.')<|fim_middle|>"""
print... | code_fim | easy | {
"lang": "python",
"repo": "Splufic-Automation-Systems-Ltd/Python-Training-Online-Cohort-Two",
"path": "/Week Two/Day 2/second.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('This is my code using sublime text.')
print('This is my code using sublime text.')<|fim_prefix|># repo: Splufic-Automation-Systems-Ltd/Python-Training-Online-Cohort-Two path: /Week Two/Day 2/second.py
""" This is my python code
Another linbe to show some documentation.
<|fim_middle|>
"""
print... | code_fim | easy | {
"lang": "python",
"repo": "Splufic-Automation-Systems-Ltd/Python-Training-Online-Cohort-Two",
"path": "/Week Two/Day 2/second.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.ctr == self.refresh:
self.ctr = 0
graphics.DrawText(
self.canvas, self.fonts['change'], change_x, 9, change_color, f'{prefix}{priceChangePercent:.2f}'
)
graphics.DrawText(self.canvas, self.fonts['price'], 3, 20, graphics.Color(203, 243, 240)... | code_fim | hard | {
"lang": "python",
"repo": "hyp3rs0nik/binance-realtime-cryptocurrency-ticker",
"path": "/socket-multiple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyp3rs0nik/binance-realtime-cryptocurrency-ticker path: /socket-multiple.py
#!/usr/bin/env python3
import asyncio
import websockets
import json
import sys
import os
from decimal import Decimal
from dotenv import load_dotenv
from itertools import cycle
from frame import Frame
from setinterval imp... | code_fim | hard | {
"lang": "python",
"repo": "hyp3rs0nik/binance-realtime-cryptocurrency-ticker",
"path": "/socket-multiple.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> graphics.DrawText(
self.canvas, self.fonts['change'], change_x, 9, change_color, f'{prefix}{priceChangePercent:.2f}'
)
graphics.DrawText(self.canvas, self.fonts['price'], 3, 20, graphics.Color(203, 243, 240), vol_txt)
graphics.DrawText(self.canvas, self.fonts['... | code_fim | hard | {
"lang": "python",
"repo": "hyp3rs0nik/binance-realtime-cryptocurrency-ticker",
"path": "/socket-multiple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """*scale_to* defines the method of scaling.
If a number is given, group items are scaled to that.
Otherwise it is converted to a :class:`.Selector`,
which must return a unique item from the group.
Group items will be scaled to the scale of that item.
By de... | code_fim | hard | {
"lang": "python",
"repo": "ynikitenko/lena",
"path": "/lena/flow/group_scale.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Scale a group of data."""
def __init__(self, scale_to, allow_zero_scale=False, allow_unknown_scale=False):
"""*scale_to* defines the method of scaling.
If a number is given, group items are scaled to that.
Otherwise it is converted to a :class:`.Selector`,
which... | code_fim | hard | {
"lang": "python",
"repo": "ynikitenko/lena",
"path": "/lena/flow/group_scale.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ynikitenko/lena path: /lena/flow/group_scale.py
"""Scale a group of data."""
import numbers
import lena.core
import lena.flow
def scale_to(scale_to, group,
allow_zero_scale=False, allow_unknown_scale=False):
"""Scale each structure in a *group*.
The group is a sequence of... | code_fim | hard | {
"lang": "python",
"repo": "ynikitenko/lena",
"path": "/lena/flow/group_scale.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if rng.random() < 0.6:
return s
else:
return generate_random_string(rng)
def perturbate_json(obj, rng, max_depth=4, sets=False, hashable=False):
if rng.random() < 0.8:
if type(obj) is dict:
return {
pertubate_string(k, rng): perturbate_json... | code_fim | hard | {
"lang": "python",
"repo": "xlwings/jsondiff",
"path": "/tests/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def perturbate_json(obj, rng, max_depth=4, sets=False, hashable=False):
if rng.random() < 0.8:
if type(obj) is dict:
return {
pertubate_string(k, rng): perturbate_json(v, rng, max_depth-1, sets=sets, hashable=hashable)
for k, v in obj.items()
... | code_fim | hard | {
"lang": "python",
"repo": "xlwings/jsondiff",
"path": "/tests/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xlwings/jsondiff path: /tests/utils.py
def generate_random_string(rng):
return ''.join(rng.choice('abcdefg098765$&.()[]{}\n') for _ in range(rng.randint(0, 6)))
def generate_random_json(rng, max_depth=4, sets=False, hashable=False):
types = [None, bool, float, str]
if max_depth > 1:... | code_fim | hard | {
"lang": "python",
"repo": "xlwings/jsondiff",
"path": "/tests/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harlowja/notifier path: /notifier/_notifier.py
s: key-value pair arguments
:type kwargs: dictionary
:param weak: whether the callback provided is referenced via a
weak reference or a strong reference
:type weak: bool
"""
self._uuid = uu... | code_fim | hard | {
"lang": "python",
"repo": "harlowja/notifier",
"path": "/notifier/_notifier.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __getstate__(self):
dct = super(RestrictedNotifier, self).__getstate__()
dct['watchables'] = self._watchable_events
dct['allow_any'] = self._allow_any
return dct
def __setstate__(self, dct):
super(RestrictedNotifier, self).__setstate__(dct)
self... | code_fim | hard | {
"lang": "python",
"repo": "harlowja/notifier",
"path": "/notifier/_notifier.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harlowja/notifier path: /notifier/_notifier.py
eak
if not args:
self._args = ()
else:
if not isinstance(args, tuple):
self._args = tuple(args)
else:
self._args = args
if not kwargs:
self._kwarg... | code_fim | hard | {
"lang": "python",
"repo": "harlowja/notifier",
"path": "/notifier/_notifier.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kylingit/zmirror path: /zmirror/utils_complex.py
# coding=utf-8
import os
import re
import base64
import zlib
import importlib
import traceback
from fnmatch import fnmatch
from urllib.parse import urljoin, urlsplit, urlunsplit, quote_plus
try: # lru_cache的c语言实现, 比Python内置lru_cache更快
from fa... | code_fim | hard | {
"lang": "python",
"repo": "kylingit/zmirror",
"path": "/zmirror/utils_complex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> eg: https://cdn.domain.com/a.php_zm24_.cT1zb21ldGhpbmc=._zm24_.css
---> https://foo.com/a.php?q=something (assume it returns an css) (base64 only)
eg2: https://cdn.domain.com/a/b/_zm24_.bG92ZT1saXZl._zm24_.jpg
---> https://foo.com/a/b/?love=live (assume it returns an jpg) (base64 o... | code_fim | hard | {
"lang": "python",
"repo": "kylingit/zmirror",
"path": "/zmirror/utils_complex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OmarKimo/Web-Scraping-and-Data-Extraction-project path: /utils.py
from string import capwords
browser_headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": 'gzip, deflate, br',
"Accept-Language": 'en,ar;q=0.9... | code_fim | hard | {
"lang": "python",
"repo": "OmarKimo/Web-Scraping-and-Data-Extraction-project",
"path": "/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def split_name(name):
name = name.replace(",", " ")
num = len(name.split())
if num:
if num == 1:
return [name.strip(), "", ""]
elif num == 2:
l = name.split()
l.insert(1, "")
return l
elif num == 3:
l = name.s... | code_fim | hard | {
"lang": "python",
"repo": "OmarKimo/Web-Scraping-and-Data-Extraction-project",
"path": "/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>'''
print c.produit_direct(f)
print(c.produit_transpose(f))
f = Vecteur(55,c.nb_colonne)
print(f)
a = c.produit_direct(f)
'''
#print(a.somme_vecteur(b))
#<|fim_prefix|># repo: kevin556/MAAIN path: /tp1.py
#!/usr/bin/python2.7
from sys import argv
from matrice_new import Matrice
from vecteur import ... | code_fim | medium | {
"lang": "python",
"repo": "kevin556/MAAIN",
"path": "/tp1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevin556/MAAIN path: /tp1.py
#!/usr/bin/python2.7
from sys import argv
<|fim_suffix|>f = Vecteur(55,c.nb_colonne)
print(f)
a = c.produit_direct(f)
'''
#print(a.somme_vecteur(b))
#<|fim_middle|>from matrice_new import Matrice
from vecteur import Vecteur
c = Matrice(argv[1])
print c.tableau_l
p... | code_fim | hard | {
"lang": "python",
"repo": "kevin556/MAAIN",
"path": "/tp1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RichTextPage(Page):
__contenttype__ = "richtext_page"
__metadescription_column__ = "content"
id = db.Column(db.Integer, db.ForeignKey("page.id"), primary_key=True)
content = db.deferred(
db.Column(
db.UnicodeText,
nullable=False,
info=dict... | code_fim | medium | {
"lang": "python",
"repo": "leelu/oy-cms",
"path": "/oy/contrib/richtext_page/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leelu/oy-cms path: /oy/contrib/richtext_page/models.py
# -*- coding: utf-8 -*-
"""
oy.contrib.richtext_page.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<|fim_suffix|>from flask import current_app
from oy.models import Page, db
class RichTextPage(Page):
__contenttype__ = "richtex... | code_fim | medium | {
"lang": "python",
"repo": "leelu/oy-cms",
"path": "/oy/contrib/richtext_page/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IanSmith21/pyvisa-mock path: /visa_mock/test/base/test_high_level.py
from visa_mock.base.register import register_resources
from visa_mock.test.mock_instruments import instruments
from pyvisa import ResourceManager
<|fim_suffix|> register_resources(instruments.resources)
rc = ResourceM... | code_fim | easy | {
"lang": "python",
"repo": "IanSmith21/pyvisa-mock",
"path": "/visa_mock/test/base/test_high_level.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> register_resources(instruments.resources)
rc = ResourceManager(visa_library="@mock")
res = rc.open_resource("MOCK0::mock1::INSTR")
res.write(":INSTR:CHANNEL1:VOLT 2.3")
reply = res.query(":INSTR:CHANNEL1:VOLT?")
assert reply == '2.3'<|fim_prefix|># repo: IanSmith21/pyvisa-mock p... | code_fim | easy | {
"lang": "python",
"repo": "IanSmith21/pyvisa-mock",
"path": "/visa_mock/test/base/test_high_level.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
os.chdir(args.configpath)
ctx = WrapperContext(
WrapperContextImpl(args.wrappername,
wut,
trialargs,
wrapperargs,
... | code_fim | hard | {
"lang": "python",
"repo": "adjacentlink/python-etce",
"path": "/scripts/etce-wrapper",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser_run.add_argument('wrappername',
metavar='WRAPPERNAME',
help='''The name of the wrapper to load.''')
parser_run.add_argument('configpath',
metavar='CONFIGPATH',
help='''A path to ... | code_fim | hard | {
"lang": "python",
"repo": "adjacentlink/python-etce",
"path": "/scripts/etce-wrapper",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adjacentlink/python-etce path: /scripts/etce-wrapper
#!/usr/bin/env python
#
# Copyright (c) 2015-2019 - Adjacent Link LLC, Bridgewater, New Jersey
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followi... | code_fim | hard | {
"lang": "python",
"repo": "adjacentlink/python-etce",
"path": "/scripts/etce-wrapper",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(Arabic_normalization.normalize_token(u'مدرسة'), u'مدرسه')
self.assertEqual(Arabic_normalization.normalize_token(u'أحمد'), u'احمد')
self.assertEqual(Arabic_normalization.normalize_token(u'إبراهيم'), u'ابراهيم')
self.assertEqual(Arabic_normalization.normalize... | code_fim | medium | {
"lang": "python",
"repo": "EgyNut/ArabicProcessingCog",
"path": "/test/test_arabic_normalization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EgyNut/ArabicProcessingCog path: /test/test_arabic_normalization.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
'''
created on 2015 Apr 15
by disooqi
'''
from unittest import TestCase
from normalization import Arabic_normalization
__author__ = 'Mohamed_Eldesouki'
class TestArabic_normalization(Te... | code_fim | hard | {
"lang": "python",
"repo": "EgyNut/ArabicProcessingCog",
"path": "/test/test_arabic_normalization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_normalize_token(self):
self.assertEqual(Arabic_normalization.normalize_token(u'مدرسة'), u'مدرسه')
self.assertEqual(Arabic_normalization.normalize_token(u'أحمد'), u'احمد')
self.assertEqual(Arabic_normalization.normalize_token(u'إبراهيم'), u'ابراهيم')
self.assert... | code_fim | medium | {
"lang": "python",
"repo": "EgyNut/ArabicProcessingCog",
"path": "/test/test_arabic_normalization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' A simple tab completer for linux '''
def pathCompleter(self,text,state):
line = readline.get_line_buffer().split()
if '~' in text:
text = os.path.expanduser('~')
if os.path.isdir(text):
text += '/'
return [x for x in glob.glob(text+'*')][state]<|fim_prefix|># repo: Faisalsouz/PAN_OCR... | code_fim | easy | {
"lang": "python",
"repo": "Faisalsouz/PAN_OCR",
"path": "/utils/PythonCompleter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Faisalsouz/PAN_OCR path: /utils/PythonCompleter.py
import os
import sys
import readline
import glob
<|fim_suffix|> ''' A simple tab completer for linux '''
def pathCompleter(self,text,state):
line = readline.get_line_buffer().split()
if '~' in text:
text = os.path.expanduser('~')
if... | code_fim | easy | {
"lang": "python",
"repo": "Faisalsouz/PAN_OCR",
"path": "/utils/PythonCompleter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ConnectionMaster/acer path: /core.py
import gym
from gym.spaces import Discrete as DiscreteSpace
ENVIRONMENT_NAME = 'CartPole-v0'
# ENVIRONMENT_NAME = 'MountainCarContinuous-v0'
env = gym.make(ENVIRONMENT_NAME)
action_space = env.action_space
state_space = env.observation_space
env.close()
del ... | code_fim | hard | {
"lang": "python",
"repo": "ConnectionMaster/acer",
"path": "/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Parameters that work well for CartPole-v0
LEARNING_RATE = 1e-3
REPLAY_BUFFER_SIZE = 25
TRUNCATION_PARAMETER = 10
DISCOUNT_FACTOR = 0.99
REPLAY_RATIO = 4
MAX_EPISODES = 200
MAX_STEPS_BEFORE_UPDATE = 20
NUMBER_OF_AGENTS = 12
OFF_POLICY_MINIBATCH_SIZE = 16
TRUST_REGION_CONSTRAINT = 1.
TRUST_REGION_DECAY = ... | code_fim | hard | {
"lang": "python",
"repo": "ConnectionMaster/acer",
"path": "/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vanshikagarg17/StonePaperScissor-Game path: /Rock_Paper_Scissors v1.py
from random import randint
player = input("Player, make your move: ").lower()
rand_num = randint(0,2)
<|fim_suffix|>
if player == computer:
print("It's a tie!")
elif player == "rock":
if computer == "scissors":
pri... | code_fim | medium | {
"lang": "python",
"repo": "Vanshikagarg17/StonePaperScissor-Game",
"path": "/Rock_Paper_Scissors v1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("player wins!")
else:
print("computer wins!")
elif player == "scissors":
if computer == "paper":
print("player wins!")
else:
print("computer wins!")
else:
print("Please enter a valid move!")<|fim_prefix|># repo: Vanshikagarg17/StonePaperScissor-Game path: /Rock_Paper_Scissors v... | code_fim | medium | {
"lang": "python",
"repo": "Vanshikagarg17/StonePaperScissor-Game",
"path": "/Rock_Paper_Scissors v1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print("computer wins!")
else:
print("Please enter a valid move!")<|fim_prefix|># repo: Vanshikagarg17/StonePaperScissor-Game path: /Rock_Paper_Scissors v1.py
from random import randint
player = input("Player, make your move: ").lower()
rand_num = randint(0,2)
if rand_num == 0:
computer... | code_fim | medium | {
"lang": "python",
"repo": "Vanshikagarg17/StonePaperScissor-Game",
"path": "/Rock_Paper_Scissors v1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Re-awake/Machine_Learning_In_Action path: /chapter8/8_3.py
import regression
from numpy import *
abX, abY = regression.loadDataSet('abalone.txt')
yHat01 = regression.lwlrTest(abX[0:99], abX[0:99], abY[0:99], 0.1)
yHat1 = regression.lwlrTest(abX[0:99], abX[0:99], abY[0:99], 1)
yHat10 = regression... | code_fim | hard | {
"lang": "python",
"repo": "Re-awake/Machine_Learning_In_Action",
"path": "/chapter8/8_3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ws = regression.standRegres(abX[0:99], abY[0:99])
yHat = mat(abX[100:199]) * ws
print(regression.rssError(abY[100:199], yHat.T.A))<|fim_prefix|># repo: Re-awake/Machine_Learning_In_Action path: /chapter8/8_3.py
import regression
from numpy import *
abX, abY = regression.loadDataSet('abalone.txt')
yHat01... | code_fim | hard | {
"lang": "python",
"repo": "Re-awake/Machine_Learning_In_Action",
"path": "/chapter8/8_3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> np.testing.assert_equal(len(graph.outputs), 1)
np.testing.assert_equal(graph.outputs[0], graph.nodes[-1].outputs[0])
@staticmethod
def test_transform_inplace_ops_loop():
# The test graph is:
# graph(
# %x : Tensor[1],
# ):
# ... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/torch/test/test_passes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apple/coremltools path: /coremltools/converters/mil/frontend/torch/test/test_passes.py
# Copyright (c) 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/torch/test/test_passes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> flatten_graph_input_values(graph)
# The graph input tuple should have been flattened.
np.testing.assert_equal(len(graph.inputs.keys()), 3)
# Tuple flattening should introduce two new ops.
np.testing.assert_equal(len(graph.nodes), 6)
# The new ops at the beg... | code_fim | hard | {
"lang": "python",
"repo": "apple/coremltools",
"path": "/coremltools/converters/mil/frontend/torch/test/test_passes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: salesforce/django-declarative-apis path: /example/myapp/tests/test_models.py
from django.test import TestCase
from django_declarative_apis import models
from myapp.models import User
class ModelsTestCase(TestCase):
<|fim_suffix|> user = User(consumer=consumer, name="smith")
user... | code_fim | medium | {
"lang": "python",
"repo": "salesforce/django-declarative-apis",
"path": "/example/myapp/tests/test_models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = User(consumer=consumer, name="smith")
user.save()
self.assertEqual(user.consumer.content_type_id, consumer.content_type_id)
self.assertEqual(user.consumer.id, consumer.id)
self.assertEqual(user.consumer.key, consumer.key)
self.assertEqual(user.consum... | code_fim | medium | {
"lang": "python",
"repo": "salesforce/django-declarative-apis",
"path": "/example/myapp/tests/test_models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(user.consumer.content_type_id, consumer.content_type_id)
self.assertEqual(user.consumer.id, consumer.id)
self.assertEqual(user.consumer.key, consumer.key)
self.assertEqual(user.consumer.name, consumer.name)
self.assertEqual(user.consumer.object_id, ... | code_fim | hard | {
"lang": "python",
"repo": "salesforce/django-declarative-apis",
"path": "/example/myapp/tests/test_models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not graph.has_key(src):
raise AttributeError("The source '%s' is not in the graph" % src)
if not graph.has_key(tgt):
raise AttributeError("The target '%s' is not in the graph" % tgt)
parents = {src: None}
queue = deque([src])
while queue:
node = queue.poplef... | code_fim | hard | {
"lang": "python",
"repo": "nevesnunes/env",
"path": "/common/code/snippets/py/traversal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nevesnunes/env path: /common/code/snippets/py/traversal.py
#!/usr/bin/env python3
# Generators
# - [Breadth First and Depth First Search in Python · GitHub](https://gist.github.com/daveweber/99ea4da41f42ac92cdbf)
def bfs(self):
q = [self]
while q:
n = q.pop(0)
yield n
... | code_fim | hard | {
"lang": "python",
"repo": "nevesnunes/env",
"path": "/common/code/snippets/py/traversal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cheesinglee/bigmler path: /bigmler/dispatcher.py
from it.")
path = u.check_dir(output)
session_file = "%s%s%s" % (path, os.sep, SESSIONS_LOG)
csv_properties = {}
# If logging is required set the file for logging
log = None
if args.log_file:
u.check_dir(args.log_fi... | code_fim | hard | {
"lang": "python",
"repo": "cheesinglee/bigmler",
"path": "/bigmler/dispatcher.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def compute_output(api, args):
""" Creates one or more models using the `training_set` or uses the ids
of previously created BigML models to make predictions for the `test_set`.
"""
source = None
dataset = None
model = None
models = None
fields = None
other_label = OTH... | code_fim | hard | {
"lang": "python",
"repo": "cheesinglee/bigmler",
"path": "/bigmler/dispatcher.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dataset:
# retrieves max_categories data, if any
args.max_categories = get_metadata(dataset, 'max_categories',
args.max_categories)
other_label = get_metadata(dataset, 'other_label',
other_label)
... | code_fim | hard | {
"lang": "python",
"repo": "cheesinglee/bigmler",
"path": "/bigmler/dispatcher.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: psymen145/OVS-django-fe path: /ProjectSurveillance/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-11-02 15:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migra... | code_fim | hard | {
"lang": "python",
"repo": "psymen145/OVS-django-fe",
"path": "/ProjectSurveillance/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ForeignKey(blank=True, db_column='DataSetID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ProjectSurveillance.Dataset')),
('varid', models.ForeignKey(blank=True, db_column='VarID', null=True, on_delete=django.db.models.deletion.CASCADE, to='ProjectSurveillance.Variable')),... | code_fim | hard | {
"lang": "python",
"repo": "psymen145/OVS-django-fe",
"path": "/ProjectSurveillance/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_tests(*test_args):
with cover():
try:
from django import setup
except ImportError:
import traceback
traceback.print_exc()
msg = ("To fix this error, run: "
"pip install -r requirements_test.txt")
r... | code_fim | hard | {
"lang": "python",
"repo": "violuke/django-readonly-field",
"path": "/runtests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: violuke/django-readonly-field path: /runtests.py
#!/usr/bin/env python
import sys
import os
import contextlib
@contextlib.contextmanager
def cover():
do_coverage = "COVERAGE" in os.environ
if do_coverage:
import coverage
cov = coverage.Coverage(source=["django_readonly_... | code_fim | hard | {
"lang": "python",
"repo": "violuke/django-readonly-field",
"path": "/runtests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from django.core.management import execute_from_command_line
execute_from_command_line(["", "test", ] + sys.argv[1:])
if __name__ == '__main__':
run_tests(*sys.argv[1:])<|fim_prefix|># repo: violuke/django-readonly-field path: /runtests.py
#!/usr/bin/env python
import sys
import os
... | code_fim | medium | {
"lang": "python",
"repo": "violuke/django-readonly-field",
"path": "/runtests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: intel/dffml path: /dffml/df/memory.py
mplementation] = field(
"Operation implementations to load on initialization",
default_factory=lambda: {},
)
class MemoryOperationImplementationNetworkContext(
BaseOperationImplementationNetworkContext
):
def __init__(
se... | code_fim | hard | {
"lang": "python",
"repo": "intel/dffml",
"path": "/dffml/df/memory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> import asyncio
>>> from dffml import *
>>>
>>> async def main():
... async with MemoryOrchestrator() as orchestrator:
... async with orchestrator(DataFlow.auto()) as octx:
... await octx.ictx.sadd(StringInputSetContext("Hi... | code_fim | hard | {
"lang": "python",
"repo": "intel/dffml",
"path": "/dffml/df/memory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: intel/dffml path: /dffml/df/memory.py
need to call a method
# we have yet to write within the orchestrator context which will reach
# up to the parent of that orchestrator context and create a new
# orchestrator context, thus triggering this __aenter__ method for the
... | code_fim | hard | {
"lang": "python",
"repo": "intel/dffml",
"path": "/dffml/df/memory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MentenAI/menten_gcn path: /tests/test_menten_gcn.py
,
1., 0., 0., 0., 0.,
0., 0., 0., 0., 0.,
0., 0., 0., 0., 0.,
0., 0., 0., 0., 0.],
[0., -0.91330973, -0.4072656... | code_fim | hard | {
"lang": "python",
"repo": "MentenAI/menten_gcn",
"path": "/tests/test_menten_gcn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MentenAI/menten_gcn path: /tests/test_menten_gcn.py
e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00, 0.000... | code_fim | hard | {
"lang": "python",
"repo": "MentenAI/menten_gcn",
"path": "/tests/test_menten_gcn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_clustering():
pose = md.load_pdb("tests/6U07.atoms.pdb")
# pose = md.load_pdb("6U07.atoms.pdb")
wrapped_pose = MDTrajPoseWrapper(mdtraj_trajectory=pose)
CAclusters = cluster_all_resids(wrapped_pose, 10, False)
# print( repr( CAclusters ) )
assert CAclusters == [
[... | code_fim | hard | {
"lang": "python",
"repo": "MentenAI/menten_gcn",
"path": "/tests/test_menten_gcn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask_ns_tag = "{%s}%s" % (self.default_ns, mask.tag)
if source.tag not in [mask.tag, mask_ns_tag]:
return False
# If the mask includes text, compare it.
if mask.text and source.text and \
source.text.strip() != mask.text.strip():
return F... | code_fim | hard | {
"lang": "python",
"repo": "fritzy/SleekXMPP",
"path": "/sleekxmpp/xmlstream/matcher/xmlmask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fritzy/SleekXMPP path: /sleekxmpp/xmlstream/matcher/xmlmask.py
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from xml.parsers.expat import ExpatError
... | code_fim | hard | {
"lang": "python",
"repo": "fritzy/SleekXMPP",
"path": "/sleekxmpp/xmlstream/matcher/xmlmask.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param xml: The stanza object or XML object to compare against.
"""
if hasattr(xml, 'xml'):
xml = xml.xml
return self._mask_cmp(xml, self._criteria, True)
def _mask_cmp(self, source, mask, use_ns=False, default_ns='__no_ns__'):
"""Compare an XML obj... | code_fim | hard | {
"lang": "python",
"repo": "fritzy/SleekXMPP",
"path": "/sleekxmpp/xmlstream/matcher/xmlmask.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JasonK1561/profiles-rest-api path: /profiles_api/models.py
from django.db import models
#These are the base class when overiding/customizing the official django user model
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
#Importing th... | code_fim | hard | {
"lang": "python",
"repo": "JasonK1561/profiles-rest-api",
"path": "/profiles_api/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Overiding the pre-set username provided by django with our own as email
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['name']
def get_full_name(self):
"""Retrieve full name of user"""
return self.name
def get_short_name(self):
"""Retrive short name of user"""
... | code_fim | hard | {
"lang": "python",
"repo": "JasonK1561/profiles-rest-api",
"path": "/profiles_api/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Create and save a new superuser with given details"""
user = self.create_user(email, name, password)
user.is_superuser = True
user.is_staff = True
user.save(using=self._db)
return user
class UserProfile(AbstractBaseUser, PermissionsMixin):
##Good... | code_fim | hard | {
"lang": "python",
"repo": "JasonK1561/profiles-rest-api",
"path": "/profiles_api/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Python1803Super/HelloTeam path: /Hello.py
print("你真是一个小天才!")
print('Flask')
print("居然能站着睡觉")
print("优秀")
a = "666"
b = "合并代码真好玩"
for i in range(5):
print("*")
print("故意制造一些冲突,来练习如何坑队友")
print("掉网了")
print("你们居然说没掉,还说不动了")
print("python是最好的编程语言")
print("以后想学底层,还是要学C语言")
print("Pyt... | code_fim | medium | {
"lang": "python",
"repo": "Python1803Super/HelloTeam",
"path": "/Hello.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("人方为刀俎,你为鱼肉")
print("坐直,保持程序员最帅的姿势")
print("双手放在键盘上")
print("细思极恐")
print("你的闺蜜在减肥")
print("你的情敌在用功")
print("你的对手在磨刀")
print("隔壁老王在练腰")
print("it's impossible")<|fim_prefix|># repo: Python1803Super/HelloTeam path: /Hello.py
print("你真是一个小天才!")
print('Flask')
print("居然能站着睡觉")
print("优秀")
<|f... | code_fim | hard | {
"lang": "python",
"repo": "Python1803Super/HelloTeam",
"path": "/Hello.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError("Must implement suspense status boolean")<|fim_prefix|># repo: djfurman/serverless-suspense path: /serverless_suspense/base.py
class ServerlessSuspense:
def __init__(self):
pass
def _fetch_suspend_status(self):
<|fim_middle|> raise NotImplementedE... | code_fim | medium | {
"lang": "python",
"repo": "djfurman/serverless-suspense",
"path": "/serverless_suspense/base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.