text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> self.GSOcalc()
return "e1 = "+self.MatBrkt(GSOExp.e1)
def E2(self):
self.GSOcalc()
return "e2 = "+self.MatBrkt(GSOExp.e2)
def E3(self):
self.GSOcalc()
return "e3 = "+self.MatBrkt(GSOExp.e3)
def E4(self):
self.GSOcalc()
r... | code_fim | hard | {
"lang": "python",
"repo": "JunHong-1998/Tkinter-MCG-Calculator",
"path": "/GSOExp.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ray-project/ray path: /dashboard/modules/metrics/grafana_dashboard_provisioning_template.py
DASHBOARD_PROVISIONING_TEMPLATE = """
apiVersion: 1<|fim_suffix|> options:
path: {dashboard_output_folder}
"""<|fim_middle|>
providers:
- name: Ray # Default dashboards provided by OSS ray
... | code_fim | medium | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/metrics/grafana_dashboard_provisioning_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> options:
path: {dashboard_output_folder}
"""<|fim_prefix|># repo: ray-project/ray path: /dashboard/modules/metrics/grafana_dashboard_provisioning_template.py
DASHBOARD_PROVISIONING_TEMPLATE = """
apiVersion: 1<|fim_middle|>
providers:
- name: Ray # Default dashboards provided by OSS ray
... | code_fim | medium | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/metrics/grafana_dashboard_provisioning_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rovided by OSS ray
folder: Ray
type: file
options:
path: {dashboard_output_folder}
"""<|fim_prefix|># repo: ray-project/ray path: /dashboard/modules/metrics/grafana_dashboard_provisioning_template.py
DASHBOARD_PROVISIONING_TEMPLATE = """
apiVersion: 1<|fim_middle|>
providers:
- name:... | code_fim | easy | {
"lang": "python",
"repo": "ray-project/ray",
"path": "/dashboard/modules/metrics/grafana_dashboard_provisioning_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> opt_par = cbpdn.ConvBPDN.Options({'FastSolve': True, 'Verbose': False, 'StatusHeader': False,
'MaxMainIter': 20, 'RelStopTol': 5e-5, 'AuxVarObj': True,
'RelaxParam': 1.515, 'AutoRho': {'Enabled': True}})
# Weight factor t... | code_fim | hard | {
"lang": "python",
"repo": "young-oct/OCT-sparse-estimation-with-CDL-framework",
"path": "/scripts/misc/processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: young-oct/OCT-sparse-estimation-with-CDL-framework path: /scripts/misc/processing.py
# -*- coding: utf-8 -*-
# @Time : 2021-04-26 3:54 p.m.
# @Author : young wang
# @FileName: processing.py
# @Software: PyCharm
from sporco import prox
from pathlib import Path
from skimage.morphology import d... | code_fim | hard | {
"lang": "python",
"repo": "young-oct/OCT-sparse-estimation-with-CDL-framework",
"path": "/scripts/misc/processing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def display_range(data, vmin, vmax):
return np.clip(data, vmin, vmax)
def to_l2_normed(s):
l2f = prox.norm_l2(s, axis=0).squeeze()
return (l2f, s / l2f)
def from_l2_normed(s, l2f):
return (s * l2f)
def load_data(dataset_name, decimation_factor, data_only=False):
# check if such file... | code_fim | hard | {
"lang": "python",
"repo": "young-oct/OCT-sparse-estimation-with-CDL-framework",
"path": "/scripts/misc/processing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>%s" % ret.group(2))
else:
print("%s不符合要求...." % _email)
if __name__ == "__main__":
main()<|fim_prefix|># repo: fenglihanxiao/Python path: /Module02/06-正则表达式/04-Match163Email.py
import re
def main():
while True:
_email = input("请输入一个邮箱地址:")
# 如果在正则表达式中需要用到了某些... | code_fim | medium | {
"lang": "python",
"repo": "fenglihanxiao/Python",
"path": "/Module02/06-正则表达式/04-Match163Email.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fenglihanxiao/Python path: /Module02/06-正则表达式/04-Match163Email.py
import re
def main():
while True:
_email = input("请输入一个邮箱地址:")
# 如果在正则表达式中需要用到了某些普通的字符,比如 . 比如? 等,仅仅需要在他们前面添加一个 反斜杠进行转义
ret = re.match(r"([a-zA-Z_0-9]{4,20})@(163|126)\.com$", _email)
if re<|fi... | code_fim | medium | {
"lang": "python",
"repo": "fenglihanxiao/Python",
"path": "/Module02/06-正则表达式/04-Match163Email.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conbench/conbench path: /conbench/app/__init__.py
from typing import Callable
import flask as f
app = f.Blueprint("app", __name__)
rule: Callable = app.add_url_rule
<|fim_suffix|># register routes
from .benchmarks import * # noqa
from .compare import * # noqa
from .hardware import * # noqa... | code_fim | medium | {
"lang": "python",
"repo": "conbench/conbench",
"path": "/conbench/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Note(JP): The asterisk globby import is difficult to work with. I think
# before this next line of code there is a module-global name User. Then `from
# .users import *` implicitly overwrites that module-global name with a
# different object. And that object has a different type of the other object.
# (... | code_fim | hard | {
"lang": "python",
"repo": "conbench/conbench",
"path": "/conbench/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PHI(GenericPHI):
@phi_constructor
def __init__(self, **kwargs):
self.ports = self.phi_cfg.get('port')
self.no_pullup = val_to_boolean(self.phi_cfg.get('no_pullup'))
self.devices = []
try:
self.gpiozero = importlib.import_module('gpiozero')
... | code_fim | hard | {
"lang": "python",
"repo": "alttch/eva-phi",
"path": "/phi/gpio/gpio_button.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alttch/eva-phi path: /phi/gpio/gpio_button.py
__author__ = "Altertech Group, https://www.altertech.com/"
__copyright__ = "Copyright (C) 2012-2018 Altertech Group"
__license__ = "Apache License 2.0"
__version__ = "1.1.2"
__description__ = "GPIO buttons"
__api__ = 4
__required__ = ['events']
__fea... | code_fim | hard | {
"lang": "python",
"repo": "alttch/eva-phi",
"path": "/phi/gpio/gpio_button.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for d in self.devices:
try:
d.close()
except:
log_traceback()
def test(self, cmd=None):
if cmd == 'self':
try:
if not os.path.isdir('/sys/bus/gpio'):
raise Exception('gpio bus not f... | code_fim | hard | {
"lang": "python",
"repo": "alttch/eva-phi",
"path": "/phi/gpio/gpio_button.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mangadventure/MangAdventure path: /users/admin.py
"""Admin models for the users app."""
from __future__ import annotations
from typing import TYPE_CHECKING, List, Tuple, Type
from django.contrib import admin
from django.contrib.auth import models
from django.db.models.expressions import Value ... | code_fim | hard | {
"lang": "python",
"repo": "mangadventure/MangAdventure",
"path": "/users/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserForm(ModelForm):
"""Admin form for :class:`User`."""
#: Scanlator status.
is_scanlator = BooleanField(
label='Scanlator status',
required=False, help_text=(
'Designates whether the user has '
'"groups" and "reader" permissions.'
)
)... | code_fim | hard | {
"lang": "python",
"repo": "mangadventure/MangAdventure",
"path": "/users/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rlivermorejr/morse-code path: /morse.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Morse Code Decoder
"Dot" – is 1 time unit long.
"Dash" – is 3 time units long.
Pause between dots and dashes in a character – is 1 time unit long.
Pause between characters inside a word – is 3 time units l... | code_fim | hard | {
"lang": "python",
"repo": "rlivermorejr/morse-code",
"path": "/morse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ui = input(
'Select 1 to decode a morse-code sequence\nor 2 to decode a binary-sequence to morse code: ')
try:
if ui == '1':
mor = input('Please enter the morse code to decode: ')
morse = decode_morse(mor)
print(morse)
if ui == '2':
... | code_fim | hard | {
"lang": "python",
"repo": "rlivermorejr/morse-code",
"path": "/morse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrsrinivas/diec path: /day1/kapua-python-client/test/test_streams_api.py
# coding: utf-8
"""
Eclipse Kapua REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: h... | code_fim | medium | {
"lang": "python",
"repo": "mrsrinivas/diec",
"path": "/day1/kapua-python-client/test/test_streams_api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test case for stream_publish
Publishes a fire-and-forget message # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: mrsrinivas/diec path: /day1/kapua-python-client/test/test_streams_api.py
# coding: utf-8
"""
Eclipse Kapua... | code_fim | medium | {
"lang": "python",
"repo": "mrsrinivas/diec",
"path": "/day1/kapua-python-client/test/test_streams_api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>iption_content_type="text/markdown",
url="https://github.com/0tt3r/QuaC-qiskit",
packages=['quac_qiskit', 'quac_qiskit.simulators', 'quac_qiskit.optimization', 'quac_qiskit.models',
'quac_qiskit.stat', 'quac_qiskit.format'],
install_requires=requirements,
classifiers=[
... | code_fim | hard | {
"lang": "python",
"repo": "maxaksel/QuaC-qiskit",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxaksel/QuaC-qiskit path: /setup.py
import setuptools
with open("README.md", "r") as desc_file:
long_description = desc_file.read()
with open("requirements.txt", "r") as req_file:
requirements = req_file.read().split("\n")[:-1] # by PEP-8, the last line is blank
setuptools.setup(
... | code_fim | hard | {
"lang": "python",
"repo": "maxaksel/QuaC-qiskit",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> verkey, sigkey = create_keypair(b'0000000000000000000000000000SEED')
assert bytes_to_b58(verkey) == 'GXhjv2jGf2oT1sqMyvJtgJxNYPMHmTsdZ3c2ZYQLJExj'
assert bytes_to_b58(sigkey) == 'xt19s1sp2UZCGhy9rNyb1FtxdKiDGZZPNFnc1KyoHNK9SDgzvPrapQPJVL9sh3e87ESLpJdwvFdxwHXagYjcaA7'
@pytest.mark.asyncio
def... | code_fim | hard | {
"lang": "python",
"repo": "GarlonHasham/sirius-sdk-python",
"path": "/tests/test_encryption.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GarlonHasham/sirius-sdk-python path: /tests/test_encryption.py
import json
import pytest
from sirius_sdk.encryption import create_keypair, pack_message, unpack_message, bytes_to_b58, P2PConnection
@pytest.mark.asyncio
def test_sane():
verkey, sigkey = create_keypair(b'00000000000000000000... | code_fim | hard | {
"lang": "python",
"repo": "GarlonHasham/sirius-sdk-python",
"path": "/tests/test_encryption.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: r-kells/prod-airflow path: /plugins/sensors/catchup_s3_key_sensor.py
import datetime
from airflow.operators.sensors import BaseSensorOperator
from airflow.plugins_manager import AirflowPlugin
from airflow.utils.decorators import apply_defaults
class CatchUpS3KeySensor(BaseSensorOperator):
... | code_fim | hard | {
"lang": "python",
"repo": "r-kells/prod-airflow",
"path": "/plugins/sensors/catchup_s3_key_sensor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if context['execution_date'] <= datetime.datetime.utcnow() - self.early_success_timedelta:
self.log.info(self.PASSED_WINDOW_LOG_TMPL
.format(self.bucket_key, context['execution_date'], self.early_success_timedelta))
return True
self.log.in... | code_fim | medium | {
"lang": "python",
"repo": "r-kells/prod-airflow",
"path": "/plugins/sensors/catchup_s3_key_sensor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # apply map operations on images
mnist_ds = mnist_ds.map(operations=type_cast_op, input_columns="label", num_parallel_workers=num_parallel_workers)
mnist_ds = mnist_ds.map(operations=resize_op, input_columns="image", num_parallel_workers=num_parallel_workers)
mnist_ds = mnist_ds.map(operat... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/ut/python/train/dataset.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return mnist_ds
class LeNet5(nn.Cell):
"""
Lenet network
Args:
num_class (int): Number of classes. Default: 10.
num_channel (int): Number of channels. Default: 1.
Returns:
Tensor, output tensor
Examples:
>>> LeNet(num_class=10)
"""
def ... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/ut/python/train/dataset.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/mindspore path: /tests/ut/python/train/dataset.py
# Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# 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
#
# ht... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindspore",
"path": "/tests/ut/python/train/dataset.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def init(self):
if idaapi.IDA_SDK_VERSION >= 700:
produce_desc = idaapi.action_desc_t(self.produce_action_name,
self.menu_name,
ProduceRizzoAction(),
... | code_fim | hard | {
"lang": "python",
"repo": "fuzzywalls/ida",
"path": "/plugins/rizzo/rizzo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return signatures
def match(self, extsigs):
fuzzy = {}
formal = {}
strings = {}
immediates = {}
# Match formal function signatures
start = time.time()
for (extsig, ext_func_ea) in extsigs.formal.iteritems():
if extsig in sel... | code_fim | hard | {
"lang": "python",
"repo": "fuzzywalls/ida",
"path": "/plugins/rizzo/rizzo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fuzzywalls/ida path: /plugins/rizzo/rizzo.py
gnature info is stored in dicts and tuples, which minimize pickle
storage space. This class provides more Pythonic (and sane) access to
values of interest for a given function.
"""
def __init__(self, signatures, functions, key):
... | code_fim | hard | {
"lang": "python",
"repo": "fuzzywalls/ida",
"path": "/plugins/rizzo/rizzo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CreeperBeatz/Python-101-Forever path: /C01-Python-Basics/23-C01P12/Solution01/solution.py
# Video - https://youtu.be/p9A5ySU8nWU
def to_digits(number):
digits = []
for x in str(number):
digits.append(int(x))
<|fim_suffix|> for index in range(digits_count - 1, -1, -1):
... | code_fim | hard | {
"lang": "python",
"repo": "CreeperBeatz/Python-101-Forever",
"path": "/C01-Python-Basics/23-C01P12/Solution01/solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return sum(result) % 10 == 0
tests = [
(79927398713, True),
(4417123456789113, True),
(4242424242424242, True),
(79927398715, False),
(79927398710, False),
(79927398711, False),
(79927398712, False),
(79927398714, False),
(79927398715, False),
(79927398716, Fa... | code_fim | medium | {
"lang": "python",
"repo": "CreeperBeatz/Python-101-Forever",
"path": "/C01-Python-Basics/23-C01P12/Solution01/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Motion()
schema = DefaultSchema(Motion()).get_update_schema(
required_properties=["all_derived_motion_ids"]
)<|fim_prefix|># repo: tsiegleauq/openslides-backend path: /openslides_backend/action/actions/motion/update_all_derived_motion_ids.py
from ....models.models import Motio... | code_fim | hard | {
"lang": "python",
"repo": "tsiegleauq/openslides-backend",
"path": "/openslides_backend/action/actions/motion/update_all_derived_motion_ids.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tsiegleauq/openslides-backend path: /openslides_backend/action/actions/motion/update_all_derived_motion_ids.py
from ....models.models import Motion
from ...generics.update import UpdateAction
from ...util.default_schema import DefaultSchema
from ...util.register import register_action
<|fim_suf... | code_fim | medium | {
"lang": "python",
"repo": "tsiegleauq/openslides-backend",
"path": "/openslides_backend/action/actions/motion/update_all_derived_motion_ids.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ndlib/marble-manifest-pipeline path: /aleph_export/test_harvest_aleph_marc.py
# test_harvest_aleph_marc
""" test harvest_aleph_marc """
import _set_path # noqa
import unittest
from datetime import datetime
from pathlib import Path
from harvest_aleph_marc import HarvestAlephMarc
from dependencies... | code_fim | hard | {
"lang": "python",
"repo": "ndlib/marble-manifest-pipeline",
"path": "/aleph_export/test_harvest_aleph_marc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Class for test fixtures """
def setUp(self):
self.event = {"local": True}
self.event['local-path'] = str(Path(__file__).parent.absolute()) + "/../example/"
self.config = setup_pipeline_config(self.event)
marc_records_url = "https://alephprod.library.nd.edu/aleph... | code_fim | medium | {
"lang": "python",
"repo": "ndlib/marble-manifest-pipeline",
"path": "/aleph_export/test_harvest_aleph_marc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def suite():
""" define test suite """
return unittest.TestLoader().loadTestsFromTestCase(Test)
if __name__ == '__main__':
suite()
unittest.main()<|fim_prefix|># repo: ndlib/marble-manifest-pipeline path: /aleph_export/test_harvest_aleph_marc.py
# test_harvest_aleph_marc
""" test harve... | code_fim | hard | {
"lang": "python",
"repo": "ndlib/marble-manifest-pipeline",
"path": "/aleph_export/test_harvest_aleph_marc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s[i]
ans.append(pack(s[lastpos], len(s) - lastpos))
return ''.join(ans)
print(rle("AAABBB"))<|fim_prefix|># repo: diable201/YandexAlgorithms path: /lec_02/8.py
def rle(s):
def pack(s, cnt):
if cnt > 1:
return s + str(cnt)
return s
lastsym = s[0]
lastpos ... | code_fim | medium | {
"lang": "python",
"repo": "diable201/YandexAlgorithms",
"path": "/lec_02/8.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diable201/YandexAlgorithms path: /lec_02/8.py
def rle(s):
def pack(s, cnt):
if cnt > 1:
return s + str(cnt)
return <|fim_suffix|> s[i]
ans.append(pack(s[lastpos], len(s) - lastpos))
return ''.join(ans)
print(rle("AAABBB"))<|fim_middle|>s
lastsym = s[0... | code_fim | hard | {
"lang": "python",
"repo": "diable201/YandexAlgorithms",
"path": "/lec_02/8.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>wrapped_myfunc:
object: <function myfunc at 0x000002534B527D08>
__name__: myfunc
__doc__ 'myfunc() is not complicated'
decorated: ('decorated defaults', 1)
myfunc: ('decorated defaults', 1)
decorated: ('args to wrapped', 4)
myfunc: ('args to wrapped', 4)
decorated_myfunc:
object: <... | code_fim | hard | {
"lang": "python",
"repo": "Nobodylesszb/python_module",
"path": "/Algorithms/functools/functools_wraps.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nobodylesszb/python_module path: /Algorithms/functools/functools_wraps.py
import functools
def show_details(name, f):
"Show details of a callable object."
print('{}:'.format(name))
print(' object:', f)
print(' __name__:', end=' ')
try:
print(f.__name__)
except ... | code_fim | hard | {
"lang": "python",
"repo": "Nobodylesszb/python_module",
"path": "/Algorithms/functools/functools_wraps.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: megaprojectske/megaprojects.co.ke-archive path: /megaprojects/blog/util.py
def get_image_path(instance, filename):
<|fim_suffix|> return '%s/%s' % (folder_name, filename)<|fim_middle|> import re
folder_name = '%s/%s' % ('posts', instance.post.id)
extension = re.search(r'\.[^.]+$', ... | code_fim | medium | {
"lang": "python",
"repo": "megaprojectske/megaprojects.co.ke-archive",
"path": "/megaprojects/blog/util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return '%s/%s' % (folder_name, filename)<|fim_prefix|># repo: megaprojectske/megaprojects.co.ke-archive path: /megaprojects/blog/util.py
def get_image_path(instance, filename):
<|fim_middle|> import re
folder_name = '%s/%s' % ('posts', instance.post.id)
extension = re.search(r'\.[^.]+$', ... | code_fim | medium | {
"lang": "python",
"repo": "megaprojectske/megaprojects.co.ke-archive",
"path": "/megaprojects/blog/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sailfish009/STRONG path: /SnakeNest/scripts/check_on_dependencies.py
#!/usr/bin/env python
from subprocess import Popen, PIPE
from os.path import dirname,realpath,abspath
from collections import defaultdict
import sys
def command_does_not_works(cmd,store_ans=False):
command = Popen([cmd], stdo... | code_fim | hard | {
"lang": "python",
"repo": "sailfish009/STRONG",
"path": "/SnakeNest/scripts/check_on_dependencies.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|># coloration is done with https://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal
if issues:
sys.exit("------------------------------------------------------------------------------\nFollowing issues where found :\n%s\n-------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "sailfish009/STRONG",
"path": "/SnakeNest/scripts/check_on_dependencies.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Buzzlogix/Buzzlogix-NLP-API-Python-SDK path: /BuzzlogixTextAnalysisAPILib/Controllers/SentimentController.py
# -*- coding: utf-8 -*-
"""
BuzzlogixTextAnalysisAPILib.Controllers.SentimentController
This file was automatically generated for buzzlogix by APIMATIC BETA v2.0 on 12/06/2015... | code_fim | hard | {
"lang": "python",
"repo": "Buzzlogix/Buzzlogix-NLP-API-Python-SDK",
"path": "/BuzzlogixTextAnalysisAPILib/Controllers/SentimentController.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Prepare query string for API call
query_builder += "/sentiment"
# Validate and preprocess url
query_url = APIHelper.clean_url(query_builder)
# Prepare headers
headers = {
"X-Mashape-Key": self.__x_mashape_key, "user-agent... | code_fim | hard | {
"lang": "python",
"repo": "Buzzlogix/Buzzlogix-NLP-API-Python-SDK",
"path": "/BuzzlogixTextAnalysisAPILib/Controllers/SentimentController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Error handling using HTTP status codes
if response.code < 200 or response.code > 206: # 200 = HTTP OK
raise APIException("HTTP Response Not OK", response.code, response.body)
return response.body
def create_return_english_general_sentiment_multipart_... | code_fim | hard | {
"lang": "python",
"repo": "Buzzlogix/Buzzlogix-NLP-API-Python-SDK",
"path": "/BuzzlogixTextAnalysisAPILib/Controllers/SentimentController.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rpetit3/BIGSI path: /bigsi/tests/storage/test_probabilistic_storage.py
from bigsi.tests.base import ST_KMER
from bigsi.tests.base import ST_SEQ
from bigsi.tests.base import ST_SAMPLE_NAME
from bigsi.tests.base import ST_GRAPH
from bigsi.tests.base import ST_BLOOM_FILTER_SIZE
from bigsi.tests.base... | code_fim | hard | {
"lang": "python",
"repo": "rpetit3/BIGSI",
"path": "/bigsi/tests/storage/test_probabilistic_storage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># storage.bloomfilter.update(elements, colour2)
# assert all([storage.bloomfilter.contains(element, colour1)
# for element in elements])
# assert all([storage.bloomfilter.contains(element, colour2)
# for element in elements])
# assert... | code_fim | hard | {
"lang": "python",
"repo": "rpetit3/BIGSI",
"path": "/bigsi/tests/storage/test_probabilistic_storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> storage.bloomfilter.update(elements, colour)
for k in elements:
assert storage.bloomfilter.contains(k, colour)
storage.delete_all()
# TODO fix this test. Not sure if we should allow updates without
# appending a new column
# @given(colour1=ST_SAMPLE_COLOUR, colour2=ST_SAMPLE_COLOUR,
... | code_fim | hard | {
"lang": "python",
"repo": "rpetit3/BIGSI",
"path": "/bigsi/tests/storage/test_probabilistic_storage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twanwalpot/mollie-api-python path: /tests/test_profile_payments.py
from mollie.api.objects.payment import Payment
from .utils import assert_list_object
<|fim_suffix|> payments = client.profile_payments.with_parent_id(PROFILE_ID).list()
assert_list_object(payments, Payment)<|fim_middle|>P... | code_fim | hard | {
"lang": "python",
"repo": "twanwalpot/mollie-api-python",
"path": "/tests/test_profile_payments.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Get payments relevant to profile by profile id."""
response.get(f"https://api.mollie.com/v2/payments?profileId={PROFILE_ID}", "payments_list")
payments = client.profile_payments.with_parent_id(PROFILE_ID).list()
assert_list_object(payments, Payment)<|fim_prefix|># repo: twanwalpot/moll... | code_fim | medium | {
"lang": "python",
"repo": "twanwalpot/mollie-api-python",
"path": "/tests/test_profile_payments.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def from_vector(cls, d: int, nsites: int, v: np.ndarray, tol: float = 0):
"""
Construct the MPS representation of the vector `v` via the TT-SVD algorithm,
for local dimension `d`.
All quantum numbers are set to zero for simplicity.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "cmendl/pytenet",
"path": "/pytenet/mps.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cmendl/pytenet path: /pytenet/mps.py
from typing import Sequence
import numpy as np
from .qnumber import qnumber_outer_sum, qnumber_flatten, is_qsparse
from .bond_ops import qr, retained_bond_indices, split_matrix_svd
__all__ = ['MPS', 'merge_mps_tensor_pair', 'split_mps_tensor']
class MPS:
... | code_fim | hard | {
"lang": "python",
"repo": "cmendl/pytenet",
"path": "/pytenet/mps.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuanzy97/steps path: /python/convert_stepspy_apis_to_markdown_glance.py
# program to converte API text file to markdown for wiki.
from api_separator import *
api_separator = load_api_separator()
all_apis = []
with open("stepspy_api.txt","rt") as fid_api:
api = []
line = fid_api.readline... | code_fim | hard | {
"lang": "python",
"repo": "yuanzy97/steps",
"path": "/python/convert_stepspy_apis_to_markdown_glance.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fid_md.write(api_number+api_name+"](https://github.com/changgang/steps/wiki/stepspy:-"+api_group_name+"#"+api_name+")\n")
current_cat = "description"
break<|fim_prefix|># repo: yuanzy97/steps path: /python/convert_stepspy_apis_to_markdown_glance.py
# progra... | code_fim | hard | {
"lang": "python",
"repo": "yuanzy97/steps",
"path": "/python/convert_stepspy_apis_to_markdown_glance.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> l = len(grid[0])
m = [c for r in grid for c in r]
shift = k % len(m)
s = m[-shift:] + m[:-shift]
return [s[i : i + l] for i in range(0, len(s), l)]<|fim_prefix|># repo: ferhatelmas/algo path: /leetcode/algorithms/easy/shift_2d_grid.py
from typing import List
clas... | code_fim | medium | {
"lang": "python",
"repo": "ferhatelmas/algo",
"path": "/leetcode/algorithms/easy/shift_2d_grid.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ferhatelmas/algo path: /leetcode/algorithms/easy/shift_2d_grid.py
from typing import List
class Solution:
<|fim_suffix|> l = len(grid[0])
m = [c for r in grid for c in r]
shift = k % len(m)
s = m[-shift:] + m[:-shift]
return [s[i : i + l] for i in range(0,... | code_fim | medium | {
"lang": "python",
"repo": "ferhatelmas/algo",
"path": "/leetcode/algorithms/easy/shift_2d_grid.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
url(r'^$', RedirectView.as_view(url='/test/1/')),
url(
regex=r'^(?P<script_pk>[0-9]+)/$',
view=views.ScriptView.as_view(),
name='test'
),
url(
regex=r'^(?P<script_pk>[0-9]+)/execute/$',
view=views.ExecuteView.as_view(),
name='... | code_fim | medium | {
"lang": "python",
"repo": "ToGoBananas/py_plots",
"path": "/py_plots/charts/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ToGoBananas/py_plots path: /py_plots/charts/urls.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
<|fim_suffix|>
urlpatterns = [
url(r'^$', RedirectView.as_view(url='/test/1/')),
url(
regex=r'^(?P<script_pk>[0-9]+)/$',
view=views.ScriptV... | code_fim | medium | {
"lang": "python",
"repo": "ToGoBananas/py_plots",
"path": "/py_plots/charts/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jpdrcarneiro/MonkeyJobCodes path: /PythonCodes/ClassifySchedule.py
#import dependecies
import sys,os
import pandas as pd
import numpy as np
import nltk as nl
import matplotlib.pyplot as plt
#data read
data = pd.read_csv("D:\Schedule\Schedule.csv", sep=",", skiprows=0, header=[1], encoding="utf-8... | code_fim | medium | {
"lang": "python",
"repo": "jpdrcarneiro/MonkeyJobCodes",
"path": "/PythonCodes/ClassifySchedule.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>words = np.concatenate(words)
words = list(words)
#Natural Lanquage Part
#Remove stop word
from nltk.corpus import stopwords
extra_words_clean = ['-', '1)', '2)', '\ufffd', '&', '/', "", ]
print(len(words))
sr = stopwords.words('english')
clean_tokens = words[:]
for token in words:
if token in sr o... | code_fim | hard | {
"lang": "python",
"repo": "jpdrcarneiro/MonkeyJobCodes",
"path": "/PythonCodes/ClassifySchedule.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>word_frqdst = word_frqdst.sort_values(by=['value'])
word_frqdst.to_csv("D:\Schedule\WordFrqDst.csv")
word_frqdst.tail(10).plot(kind='line', x='word', y='value', color='red')
plt.show()
if type(activity) is float:
continue<|fim_prefix|># repo: jpdrcarneiro/MonkeyJobCodes path: /PythonCodes/Classify... | code_fim | hard | {
"lang": "python",
"repo": "jpdrcarneiro/MonkeyJobCodes",
"path": "/PythonCodes/ClassifySchedule.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ejbaran/py-algorand-sdk path: /algosdk/template.py
cked Contract allows a user to recieve the Algo prior to a
deadline (in terms of a round) by proving knowledge of a special value
or to forfeit the ability to claim, returning it to the payer.
This contract is usually used to perform... | code_fim | hard | {
"lang": "python",
"repo": "ejbaran/py-algorand-sdk",
"path": "/algosdk/template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sign_dynamic_fee(self, private_key, gh):
"""
Return the main transaction and signed logic needed to complete the
transfer. These should be sent to the fee payer, who can use
get_transactions() to update fields and create the auxiliary
transaction.
A... | code_fim | hard | {
"lang": "python",
"repo": "ejbaran/py-algorand-sdk",
"path": "/algosdk/template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ejbaran/py-algorand-sdk path: /algosdk/template.py
min_pay:
raise error.TemplateInputError(
"the amount paid to receiver_1 must be greater than "
+ str(min_pay))
txn_1 = transaction.PaymentTxn(
address, fee, first_valid, last_valid... | code_fim | hard | {
"lang": "python",
"repo": "ejbaran/py-algorand-sdk",
"path": "/algosdk/template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: divisionblue/wur-python path: /geobuilder.py
from shapely.geometry import Point
from shapely.geometry import LineString
<|fim_suffix|> """Create a shapely line object from an array of points.
@param array points: array of shapely points.
@param string srs: spatial reference system a... | code_fim | hard | {
"lang": "python",
"repo": "divisionblue/wur-python",
"path": "/geobuilder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Create a shapely line object from an array of points.
@param array points: array of shapely points.
@param string srs: spatial reference system as EPSG code.
@returns: shapely line object.
"""
return LineString(points)<|fim_prefix|># repo: divisionblue/wur-python path: /geobui... | code_fim | medium | {
"lang": "python",
"repo": "divisionblue/wur-python",
"path": "/geobuilder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @param array points: array of shapely points.
@param string srs: spatial reference system as EPSG code.
@returns: shapely line object.
"""
return LineString(points)<|fim_prefix|># repo: divisionblue/wur-python path: /geobuilder.py
from shapely.geometry import Point
from shapely.geomet... | code_fim | medium | {
"lang": "python",
"repo": "divisionblue/wur-python",
"path": "/geobuilder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
bid = bitbank.BITBANK.xrp(0) # moduleから呼び出して現在の買い価格取得
bitbank_bid = bid['bid'].get('bitbank')
print(bitbank_bid)
ask = bitbank.BITBANK.xrp(0) # moduleから呼び出して現在の買い価格取得
bitbank_ask = ask['ask'].get('bitbank')
print... | code_fim | hard | {
"lang": "python",
"repo": "kamijiseiya/AbidoraKun",
"path": "/app/line_alert.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamijiseiya/AbidoraKun path: /app/line_alert.py
"""口座情報をユーザに通知する"""
import re # 正規表現を使用するため
import sqlite3
import time
import requests
from app.module.exchangess import bitbank
# DBの初期設定(接続開始)
DBPATH = 'config/sample_db.sqlite'
CONNECTION = sqlite3.connect(DBPATH)
CURSOR = CONNECTION.cursor()
C... | code_fim | hard | {
"lang": "python",
"repo": "kamijiseiya/AbidoraKun",
"path": "/app/line_alert.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> edit_vector = ['0'] * len(candidate_tok)
for key, edit in edits.iteritems():
edit_type, start_idx, end_idx, before, after, num = edit
if edit_type == 'noop' or num != 0 or len(before.split()) >= 2 or len(after.split()) >= 2:
continue
(src... | code_fim | hard | {
"lang": "python",
"repo": "shubhaguha/MSc",
"path": "/scripts/generate_edit_vectors.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shubhaguha/MSc path: /scripts/generate_edit_vectors.py
import sys
from levenshtein import *
fr_filename, en_filename = sys.argv[1:3]
edits_filename = fr_filename[:fr_filename.rfind('.')] + '.edits'
max_unchanged_words = 2
very_verbose = False
<|fim_suffix|> edit_vector = ['0'] * len(can... | code_fim | hard | {
"lang": "python",
"repo": "shubhaguha/MSc",
"path": "/scripts/generate_edit_vectors.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaogang00/Deep-learning-on-Tensorflow path: /GAN实验/pix2pix/src/model/train.py
import os
import sys
import time
import numpy as np
import models
from keras.utils import generic_utils
from keras.optimizers import Adam, SGD
# Utils
sys.path.append("../utils")
import general_utils
import data_utils
... | code_fim | hard | {
"lang": "python",
"repo": "xiaogang00/Deep-learning-on-Tensorflow",
"path": "/GAN实验/pix2pix/src/model/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Update the discriminator
disc_loss = discriminator_model.train_on_batch(X_disc, y_disc)
# Create a batch to feed the generator model
X_gen_target, X_gen = next(data_utils.gen_batch(X_full_train, X_sketch_train, batch_size))
... | code_fim | hard | {
"lang": "python",
"repo": "xiaogang00/Deep-learning-on-Tensorflow",
"path": "/GAN实验/pix2pix/src/model/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoseNoriegaa/pydottie path: /src/pydottie/exists.py
from typing import Dict
# Utilities
from .get import get
def exists(obj: Dict, path: str) -> bool:
"""
Check if a value exists in a dictionary.
Caution: If the value is None this function will return False even if the key exists.... | code_fim | easy | {
"lang": "python",
"repo": "JoseNoriegaa/pydottie",
"path": "/src/pydottie/exists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
obj: The dictionary to check.
path: The path to the value.
Returns:
bool: True if the value exists, False otherwise.
"""
return get(obj, path) is not None<|fim_prefix|># repo: JoseNoriegaa/pydottie path: /src/pydottie/exists.py
from typing import Dict
# Ut... | code_fim | hard | {
"lang": "python",
"repo": "JoseNoriegaa/pydottie",
"path": "/src/pydottie/exists.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.DeleteModel(
name='Announce',
),
migrations.RemoveField(
model_name='incident',
name='notify_groups',
),
migrations.RemoveField(
model_name='incident',
name='services',
... | code_fim | medium | {
"lang": "python",
"repo": "cavaliba/sirene",
"path": "/app_sirene/migrations/0031_auto_20191228_1547.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cavaliba/sirene path: /app_sirene/migrations/0031_auto_20191228_1547.py
# Generated by Django 3.0 on 2019-12-28 14:47
from django.db import migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.DeleteModel(
name='Announce',
),... | code_fim | medium | {
"lang": "python",
"repo": "cavaliba/sirene",
"path": "/app_sirene/migrations/0031_auto_20191228_1547.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('app_sirene', '0030_auto_20191228_1425'),
]
operations = [
migrations.DeleteModel(
name='Announce',
),
migrations.RemoveField(
model_name='incident',
name='notify_groups',
),
migrations.Remov... | code_fim | medium | {
"lang": "python",
"repo": "cavaliba/sirene",
"path": "/app_sirene/migrations/0031_auto_20191228_1547.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>define_keymap(None, {
K("RC-KEY_4"): K("F4"),
K("RC-KEY_5"): K("F5"),
K("RC-KEY_6"): K("F6"),
K("RC-KEY_7"): K("F7"),
K("RC-KEY_8"): K("F8"),
K("RC-KEY_9"): K("F9"),
K("RC-P"): K("MUTE"),
K("RC-LEFT_BRACE"): K("VOLUMEDOWN"),
K("RC-RIGHT_BRACE"): K("VOLUMEUP"),
K("RC... | code_fim | hard | {
"lang": "python",
"repo": "lyjdwh/dotfiles",
"path": "/xkeysnail.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyjdwh/dotfiles path: /xkeysnail.py
# -*- coding: utf-8 -*-
import re
import os
import shlex
from xkeysnail.transform import *
def cycle(app):
path = os.path.expanduser("~/dotfiles/scripts/cycle.sh ")
_cycle = "bash " + path
return shlex.split(_cycle+app)
def emacs_eval(command):
... | code_fim | hard | {
"lang": "python",
"repo": "lyjdwh/dotfiles",
"path": "/xkeysnail.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> K("RC-G"): launch(cycle("chromium")),
K("RC-E"): launch(cycle("emacs")),
K("RC-Y"): launch(cycle("yesplaymusic")),
K("RC-SEMICOLON"): launch(cycle("st-256color")),
K("RC-W"): launch(cycle("wine")),
K("RC-S"): launch(cycle("steam")),
K("F13"): K("C-space"),
K("PAUSECD") : ... | code_fim | hard | {
"lang": "python",
"repo": "lyjdwh/dotfiles",
"path": "/xkeysnail.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ynzhu/inf551 path: /fbt.py
from firebase import firebase
import json
firebase = firebase.FirebaseApplication('https://projectfor551.firebaseio.com/', None)
result = firebase.get('/users', None)
print result
with open ("yelpb.json", "r") as f:
dt = json.loads(f)
print dt['businesses'][0]
#x =... | code_fim | hard | {
"lang": "python",
"repo": "ynzhu/inf551",
"path": "/fbt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>wd-los-angeles", "is_closed": False, "location": {"city": "Los Angeles", "display_address": ["10140 Riverside Dr", "Los Angeles, CA 91602"], "country": "US", "address2": None, "address3": "", "state": "CA", "address1": "10140 Riverside Dr", "zip_code": "91602"}}
#firebase.post('/restaurants', x)
#firebase... | code_fim | hard | {
"lang": "python",
"repo": "ynzhu/inf551",
"path": "/fbt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def open_config():
if not os.path.exists(constants.CONF_DIR):
os.mkdir(constants.CONF_DIR)
if not os.path.exists(constants.CONF_FILE):
shutil.copyfile(
constants.DEFAULT_CONF,
constants.CONF_FILE)
return ConfigObject(filename=constants.CONF_FILE)<|fim_p... | code_fim | medium | {
"lang": "python",
"repo": "roaet/eh",
"path": "/eh/config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roaet/eh path: /eh/config.py
import os
import shutil
from ConfigObject import ConfigObject
<|fim_suffix|>
def open_config():
if not os.path.exists(constants.CONF_DIR):
os.mkdir(constants.CONF_DIR)
if not os.path.exists(constants.CONF_FILE):
shutil.copyfile(
c... | code_fim | medium | {
"lang": "python",
"repo": "roaet/eh",
"path": "/eh/config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jihene-ch/pygameweb path: /pygameweb/alembic/versions/c4e6d5863a94_removing_unused_tables_adding_tag_index.py
"""Removing unused tables. Adding tag index.
Revision ID: c4e6d5863a94
Revises: 47683b299022
Create Date: 2017-01-15 13:49:21.292205
"""
# revision identifiers, used by Alembic.
revisi... | code_fim | hard | {
"lang": "python",
"repo": "Jihene-ch/pygameweb",
"path": "/pygameweb/alembic/versions/c4e6d5863a94_removing_unused_tables_adding_tag_index.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ### commands auto generated by Alembic - please adjust! ###
# NOTE: Commented out due to issues #10 #38
# op.create_index('public_tags_value1_idx', 'tags', ['value'], unique=False)
# op.create_index('public_tags_project_id0_idx', 'tags', ['project_id'], unique=False)
op.drop_index(op.f... | code_fim | medium | {
"lang": "python",
"repo": "Jihene-ch/pygameweb",
"path": "/pygameweb/alembic/versions/c4e6d5863a94_removing_unused_tables_adding_tag_index.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HimmelStein/Kriya path: /src/Kriya-Decoder/settings.py
code", dest="one_nt_decode", default=False, action="store_true", help="Run decoder in 1NT mode (ignore 2NT rules)")
optparser.add_option("", "--shallow-hiero", dest="shallow_hiero", default=False, action="store_true", help="Flag for shall... | code_fim | hard | {
"lang": "python",
"repo": "HimmelStein/Kriya",
"path": "/src/Kriya-Decoder/settings.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
# Copy the phrase table - racing not possible
(ptable_path, ptable) = os.path.split(opts.ruleFile)
local_path = opts.local_path + os.path.basename(ptable_path)
createPath(local_path)
local_ptable = local_path + '/' + ptable
if not os.path.exists(local_ptable) or not sameSiz... | code_fim | hard | {
"lang": "python",
"repo": "HimmelStein/Kriya",
"path": "/src/Kriya-Decoder/settings.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def copyModels():
""" Copies the model files to the local path.
Specifically the translation and language models are copied.
"""
# Create the local path if it doesn't exist
createPath(opts.local_path)
if not opts.local_path.endswith('/'): opts.local_path = opts.local_path + '/... | code_fim | hard | {
"lang": "python",
"repo": "HimmelStein/Kriya",
"path": "/src/Kriya-Decoder/settings.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: project-travel-mate/server path: /api/modules/github/views.py
import datetime
import requests
import requests_cache
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.commonresponses import DOWNSTREAM_ERROR_RESP... | code_fim | hard | {
"lang": "python",
"repo": "project-travel-mate/server",
"path": "/api/modules/github/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Return list of issues
:param request:
:param project:
:return: 503 if github api fails
:return: 200 successful
"""
try:
api_response = requests.get(constants.GITHUB_API_GET_ISSUES_URL.format(project_name=project))
api_response_js... | code_fim | hard | {
"lang": "python",
"repo": "project-travel-mate/server",
"path": "/api/modules/github/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sagarnikam123/learnNPractice path: /youTube/codebasics/pythonTutorials/14_workingWithJSON.py
# 14_Working With JSON
import json
book = {}
book['tom'] = {
'name': 'tom',
'address': '1 red street, NY',
'phone': 98989898
}
book['bob'] = {
'name': 'bob',
'address': '1 green st... | code_fim | medium | {
"lang": "python",
"repo": "sagarnikam123/learnNPractice",
"path": "/youTube/codebasics/pythonTutorials/14_workingWithJSON.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(book_dict['bob'])
print(book_dict['bob']['phone'])
for person in book_dict:
print(book[person])<|fim_prefix|># repo: sagarnikam123/learnNPractice path: /youTube/codebasics/pythonTutorials/14_workingWithJSON.py
# 14_Working With JSON
import json
book = {}
book['tom'] = {
'name': 'tom',
... | code_fim | medium | {
"lang": "python",
"repo": "sagarnikam123/learnNPractice",
"path": "/youTube/codebasics/pythonTutorials/14_workingWithJSON.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from onion.manage import make_application
application = make_application(project_path=path)<|fim_prefix|># repo: damonchen/onion path: /onion/template_files/project/wsgi_handler.py
#coding=utf-8
import sys, os
<|fim_middle|>path = os.path.dirname(os.path.abspath(__file__))
if path not in sys.path:
... | code_fim | medium | {
"lang": "python",
"repo": "damonchen/onion",
"path": "/onion/template_files/project/wsgi_handler.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.