text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Sukhrobjon/leetcode path: /mock_interview/publish_subscribe.py
"""
Question: Write a class contains three functions that will
register the callback with its id, unregister specific callback from
a signal id,and runs all the callback associated with specific signal id
Hint: Thi... | code_fim | medium | {
"lang": "python",
"repo": "Sukhrobjon/leetcode",
"path": "/mock_interview/publish_subscribe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def b():
print("It is b!")
def c():
print("It is c!")
def d():
print("It is d!")
sr = SignalRegister()
sr.register(2, a)
sr.register(2, b)
sr.register(3, c)
sr.register(2, d)
sr.register(3, d)
print(f"Registered signal 2 and 3")
sr.signal(2)
# sr.signal(3)
# sr.unregister(2, a)
# print(... | code_fim | medium | {
"lang": "python",
"repo": "Sukhrobjon/leetcode",
"path": "/mock_interview/publish_subscribe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("It is b!")
def c():
print("It is c!")
def d():
print("It is d!")
sr = SignalRegister()
sr.register(2, a)
sr.register(2, b)
sr.register(3, c)
sr.register(2, d)
sr.register(3, d)
print(f"Registered signal 2 and 3")
sr.signal(2)
# sr.signal(3)
# sr.unregister(2, a)
# print("After unr... | code_fim | hard | {
"lang": "python",
"repo": "Sukhrobjon/leetcode",
"path": "/mock_interview/publish_subscribe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Commas for the thousands separators, full stops for the decimal, two
decimal places. Commas are optional and controlled by the ``commas``
argument.
Adapted from https://docs.python.org/3.3/library/decimal.html#recipes
"""
sign, digits, exp = self.quantize(D... | code_fim | medium | {
"lang": "python",
"repo": "boweiliu/evesrp",
"path": "/evesrp/util/decimal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: boweiliu/evesrp path: /evesrp/util/decimal.py
from __future__ import absolute_import
from decimal import Decimal
import six
from sqlalchemy.types import TypeDecorator, Numeric
if six.PY3:
unicode = str
class PrettyDecimal(Decimal):
""":py:class:`~.Decimal` subclass that can pretty-pri... | code_fim | hard | {
"lang": "python",
"repo": "boweiliu/evesrp",
"path": "/evesrp/util/decimal.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """:py:class:`~.Decimal` subclass that can pretty-print itself."""
def currency(self, commas=True):
"""Format the Decimal as a currency number.
Commas for the thousands separators, full stops for the decimal, two
decimal places. Commas are optional and controlled by the `... | code_fim | medium | {
"lang": "python",
"repo": "boweiliu/evesrp",
"path": "/evesrp/util/decimal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> number = int(input('Enter a positive number for its factorial: '))
print(f'Factorial of {number} is {find_factorial(number)}')
if __name__ == "__main__":
main()<|fim_prefix|># repo: vishipayyallore/LearningPython_2019 path: /Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py
... | code_fim | easy | {
"lang": "python",
"repo": "vishipayyallore/LearningPython_2019",
"path": "/Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vishipayyallore/LearningPython_2019 path: /Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py
def find_factorial(number):
if(number == 1):
return number
else:
return number * find_factorial(number-1)
def main():
<|fim_suffix|> print(f'Factorial of {number} i... | code_fim | medium | {
"lang": "python",
"repo": "vishipayyallore/LearningPython_2019",
"path": "/Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_prefix|># repo: vishipayyallore/LearningPython_2019 path: /Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py
def find_factorial(number):
if(number == 1):
return number
else:
return number * find_factorial(number-1)
def main()... | code_fim | medium | {
"lang": "python",
"repo": "vishipayyallore/LearningPython_2019",
"path": "/Intermediate/Day6/2Recursionfunction_demos/factorialdemo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> w, h = image.size
image = image.resize((self.interpreter.width(),
self.interpreter.height()))
image = np.expand_dims(image, axis=0)
if self.interpreter.dtype() == np.float32:
image = (np.float32(image)-self.config['mean']) / self.c... | code_fim | hard | {
"lang": "python",
"repo": "tomo123-123/pyeiq",
"path": "/eiq/modules/detection/pose_detection.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomo123-123/pyeiq path: /eiq/modules/detection/pose_detection.py
# Copyright 2019 Google LLC
# Copyright 2020 NXP Semiconductors
#
# This file was copied from Google LLC respecting its rights. All the modified
# parts below are according to Google LLC's LICENSE terms.
#
# SPDX-License-Identifier:... | code_fim | hard | {
"lang": "python",
"repo": "tomo123-123/pyeiq",
"path": "/eiq/modules/detection/pose_detection.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _filter_non_country_code_languge(self, raw_lang_data):
"""
過濾掉 iso639-3 三碼,(如果有 _ 的格式之前是3碼也排除 e.g abq_UN)
同時過濾掉 iso639-1 二碼,但是沒有結合國家代碼的 ISO 6390-1,但需要包含有 _ 的 language tag e.g zh_TW, en_US, 但排除 en, zh
過濾掉 region 001
"""
meta_lang_codes = filter(self._filter_region_code, filter(self._filte... | code_fim | hard | {
"lang": "python",
"repo": "kokokuo/collect_countries_info",
"path": "/utils/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kokokuo/collect_countries_info path: /utils/__init__.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import babel
import itertools
import re
from babel import Locale
from phonenumbers import COUNTRY_CODE_TO_REGION_CODE, REGION_CODE_FOR_NON_GEO_ENTITY
from collections import namedtuple
# 紀錄每個語系所包含的國... | code_fim | hard | {
"lang": "python",
"repo": "kokokuo/collect_countries_info",
"path": "/utils/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gvom/botcity-framework-core-python path: /botcity/core/misc.py
import os
import time
def execute(file_path):
"""
Invoke the system handler to open the given file.
Args:
file_path (str): The path for the file to be executed
"""
os.startfile(file_path)
def wait(inte... | code_fim | medium | {
"lang": "python",
"repo": "gvom/botcity-framework-core-python",
"path": "/botcity/core/misc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Wait / Sleep for a given interval.
Args:
interval (int): Interval in milliseconds
"""
time.sleep(interval/1000.0)
# TODO: Check with Gabriel about this command.
# Why use Windows+R + Command instead of exec?
startRun = execute
sleep = wait<|fim_prefix|># repo: gvom/bot... | code_fim | medium | {
"lang": "python",
"repo": "gvom/botcity-framework-core-python",
"path": "/botcity/core/misc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class AssociationNotFound(Exception):
pass
class AssociationPreloadNotSupported(Exception):
pass
class RecordNotFound(Exception):
pass<|fim_prefix|># repo: jbgo/pyperry path: /pyperry/errors.py
class ConfigurationError(Exception):
pass
class ArgumentError(Exception):
pass... | code_fim | easy | {
"lang": "python",
"repo": "jbgo/pyperry",
"path": "/pyperry/errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbgo/pyperry path: /pyperry/errors.py
class ConfigurationError(Exception):
pass
class ArgumentError(Exception):
pass
<|fim_suffix|>class AssociationPreloadNotSupported(Exception):
pass
class RecordNotFound(Exception):
pass<|fim_middle|>class BrokenAdapterStack(Exception):
p... | code_fim | hard | {
"lang": "python",
"repo": "jbgo/pyperry",
"path": "/pyperry/errors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>summary_cal_holdout = calibration_and_holdout_data(transaction_data, 'id', 'date',
calibration_period_end='2014-09-01',
observation_period_end='2014-12-31' )
print(summary_cal_holdout.head())
# With this dataset, we can p... | code_fim | hard | {
"lang": "python",
"repo": "b-mckenna/CustomerLifetimeValue_Demo",
"path": "/original_lifetimes_tutorial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>bgf.fit(summary['frequency'], summary['recency'], summary['T'])
## More model fitting
# With transactional data, we can partition the dataset into a calibration period dataset and a holdout dataset. This is important as we want to test how our model performs on data not yet seen (think cross-validation i... | code_fim | hard | {
"lang": "python",
"repo": "b-mckenna/CustomerLifetimeValue_Demo",
"path": "/original_lifetimes_tutorial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: b-mckenna/CustomerLifetimeValue_Demo path: /original_lifetimes_tutorial.py
## Steve,
# I took the lifetimes library and made some modifications so it could be used on SE or customer provided datasets on a cluster. I tried to keep it aligned with the [Lifetimes docs](https://lifetimes.readthedocs... | code_fim | hard | {
"lang": "python",
"repo": "b-mckenna/CustomerLifetimeValue_Demo",
"path": "/original_lifetimes_tutorial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pypa/cibuildwheel path: /test/test_emulation.py
from __future__ import annotations
import subprocess
import pytest
from . import test_projects, utils
project_with_a_test = test_projects.new_c_project()
project_with_a_test.files[
"test/spam_test.py"
] = r"""
import spam
def test_spam():
... | code_fim | medium | {
"lang": "python",
"repo": "pypa/cibuildwheel",
"path": "/test/test_emulation.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if utils.platform == "linux":
pytest.skip("this test checks the behaviour on platforms other than linux")
project_dir = tmp_path / "project"
project_with_a_test.generate(project_dir)
# build and test the wheels
with pytest.raises(subprocess.CalledProcessError):
utils.... | code_fim | hard | {
"lang": "python",
"repo": "pypa/cibuildwheel",
"path": "/test/test_emulation.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RedHatInsights/insights-core path: /insights/parsers/crio_conf.py
"""
CrioConf - files ``/etc/crio/crio.conf`` and ``/etc/crio/crio.conf.d/*``
========================================================================
"""
from insights.core import IniConfigFile
from insights.core.plugins import pa... | code_fim | hard | {
"lang": "python",
"repo": "RedHatInsights/insights-core",
"path": "/insights/parsers/crio_conf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Examples:
>>> "crio" in crio_conf
True
>>> crio_conf.has_option('crio.runtime', 'selinux')
True
>>> crio_conf.get('crio.metrics', 'metrics_port')
'9537'
"""
pass<|fim_prefix|># repo: RedHatInsights/insights-core path: /insights/parsers/crio_conf... | code_fim | hard | {
"lang": "python",
"repo": "RedHatInsights/insights-core",
"path": "/insights/parsers/crio_conf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Syler1984/seismo-ml-phase-picker path: /utils/converter.py
import os
import sys
import obspy.io.nordic.core as nordic_reader
from obspy.core import read
from obspy.core import utcdatetime
import logging
def utcdatetime_from_string(string):
"""
Converts string of formats: YYYYM... | code_fim | hard | {
"lang": "python",
"repo": "Syler1984/seismo-ml-phase-picker",
"path": "/utils/converter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return path
def date_str(year, month, day, hour=0, minute=0, second=0., microsecond=None):
"""
Creates an ISO 8601 string.
"""
# Get microsecond if not provided
if microsecond is None:
if type(second) is float:
microsecond = int((second - int(second)... | code_fim | hard | {
"lang": "python",
"repo": "Syler1984/seismo-ml-phase-picker",
"path": "/utils/converter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fga-eps-mds/2018.1-Dr-Down path: /drdown/events/migrations/0001_initial.py
# Generated by Django 2.0.3 on 2018-05-27 14:42
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> dependencies = [
]
operations = [
migrations.CreateModel... | code_fim | hard | {
"lang": "python",
"repo": "fga-eps-mds/2018.1-Dr-Down",
"path": "/drdown/events/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Events',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField(help_text='Date of event', max_length=50, verbose_... | code_fim | hard | {
"lang": "python",
"repo": "fga-eps-mds/2018.1-Dr-Down",
"path": "/drdown/events/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ADEPT-Informatique/adeptbot path: /bot/db/services/configs_service.py
"""Service for dynamic bot configs."""
from ..models.bot_configs import GlobalConfig, SpamConfigs
from .base_service import BaseService
<|fim_suffix|> def find_or_create_spam_configs(self) -> SpamConfigs:
"""Find ... | code_fim | medium | {
"lang": "python",
"repo": "ADEPT-Informatique/adeptbot",
"path": "/bot/db/services/configs_service.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return spam_config
for attr in spam_config.__slots__:
setattr(spam_config, attr, data[attr])
return spam_config
def update_configs(self, config: GlobalConfig):
"""
Update the configs.
Parameters
----------
`config` : G... | code_fim | hard | {
"lang": "python",
"repo": "ADEPT-Informatique/adeptbot",
"path": "/bot/db/services/configs_service.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChampionApe/Abatement_project path: /InputDisplacingAbatement/ShockFunction.py
import os
from gams import *
from DB2Gams import *
import DataBase
from dreamtools.gamY import Precompiler
import pandas as pd
def IfInt(x):
try:
int(x)
return True
except ValueError:
return False
def return_... | code_fim | hard | {
"lang": "python",
"repo": "ChampionApe/Abatement_project",
"path": "/InputDisplacingAbatement/ShockFunction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def text(self):
"""
Return loop state with current state of attributes.
"""
return ' '.join([self.write_components[x] for x in self.write_components])
def write_sets(self):
"""
Write gams code for declaring loop-sets, and loading in values form database in self.shock_gm.database... | code_fim | hard | {
"lang": "python",
"repo": "ChampionApe/Abatement_project",
"path": "/InputDisplacingAbatement/ShockFunction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phfaist/phfnbutils path: /test/test_mp.py
import unittest
import tempfile
import os.path
import multiprocessing
import h5py
import logging
import numpy as np
import multiprocessing
from phfnbutils.mp import (
parallel_apply_func_on_input_combinations,
get_inputs_iterable
)
# ----... | code_fim | hard | {
"lang": "python",
"repo": "phfaist/phfnbutils",
"path": "/test/test_mp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> from phfnbutils.store import Hdf5StoreResultsAccessor, ComputeAndStore
with tempfile.TemporaryDirectory() as temp_dir_name:
storefn = os.path.join(temp_dir_name, 'tempstore.hdf5')
compute_something_and_store = ComputeAndStore(fn_helper, storefn)
paral... | code_fim | hard | {
"lang": "python",
"repo": "phfaist/phfnbutils",
"path": "/test/test_mp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: azurelysium/button path: /src/button/tasks.py
from abc import ABC, abstractmethod
from .utils import execute_shell_command, execute_shell_script
class Task(ABC):
def __init__(self, name, desc):
"""Init a task with a name and a description"""
self.name = name
self.de... | code_fim | hard | {
"lang": "python",
"repo": "azurelysium/button",
"path": "/src/button/tasks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if parsed.verbose:
print(f"Command: {self.command}")
retval, _ = execute_shell_command(self.command, self.shell)
return retval
class ExecuteScriptTask(Task):
def __init__(self, alias, desc, script, shell="bash"):
super().__init__(alias, desc)
self.... | code_fim | hard | {
"lang": "python",
"repo": "azurelysium/button",
"path": "/src/button/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ver in packet.VersionValues:
__log__.Info("Client reported version: {0}", ver.Value)<|fim_prefix|># repo: neowutran/alkahest path: /Alkahest.Plugins.Python/Python/example/__init__.py
from Alkahest.Core.Net.Protocol.Packets import *
# The special function __start__ is invoked on startup.... | code_fim | medium | {
"lang": "python",
"repo": "neowutran/alkahest",
"path": "/Alkahest.Plugins.Python/Python/example/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The special function __stop__ is invoked on shutdown and receives the same
# array that __start__ did.
def __stop__(proxies):
for proc in map(lambda x: x.Processor, proxies):
proc.RemoveHandler[CCheckVersionPacket](_handle_check_version)
__log__.Basic("Stopped example script")
def _han... | code_fim | hard | {
"lang": "python",
"repo": "neowutran/alkahest",
"path": "/Alkahest.Plugins.Python/Python/example/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neowutran/alkahest path: /Alkahest.Plugins.Python/Python/example/__init__.py
from Alkahest.Core.Net.Protocol.Packets import *
# The special function __start__ is invoked on startup. The proxies parameter
# is an array of Alkahest.Core.Net.GameProxy instances.
def __start__(proxies):
for pro... | code_fim | medium | {
"lang": "python",
"repo": "neowutran/alkahest",
"path": "/Alkahest.Plugins.Python/Python/example/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected.insert(0, "Running stage 'stage.dvc':")
assert caplog.messages == expected<|fim_prefix|># repo: iterative/dvc path: /tests/unit/stage/test_run.py
import logging
import pytest
from dvc.stage import Stage
from dvc.stage.run import run_stage
@pytest.mark.parametrize(
"cmd, expected"... | code_fim | medium | {
"lang": "python",
"repo": "iterative/dvc",
"path": "/tests/unit/stage/test_run.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iterative/dvc path: /tests/unit/stage/test_run.py
import logging
import pytest
from dvc.stage import Stage
from dvc.stage.run import run_stage
<|fim_suffix|> expected.insert(0, "Running stage 'stage.dvc':")
assert caplog.messages == expected<|fim_middle|>@pytest.mark.parametrize(
"... | code_fim | hard | {
"lang": "python",
"repo": "iterative/dvc",
"path": "/tests/unit/stage/test_run.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: quokkaproject/twill path: /twill/other_packages/_mechanize_dist/_gzip.py
import urllib.request, urllib.error, urllib.parse
from io import StringIO
from . import _response
# GzipConsumer was taken from Fredrik Lundh's effbot.org-0.1-20041009 library
class GzipConsumer:
def __init__(self, con... | code_fim | hard | {
"lang": "python",
"repo": "quokkaproject/twill",
"path": "/twill/other_packages/_mechanize_dist/_gzip.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class stupid_gzip_wrapper(_response.closeable_response):
def __init__(self, response):
self._response = response
c = stupid_gzip_consumer()
gzc = GzipConsumer(c)
gzc.feed(response.read())
self.__data = StringIO("".join(c.data))
def read(self, size=-1):
... | code_fim | hard | {
"lang": "python",
"repo": "quokkaproject/twill",
"path": "/twill/other_packages/_mechanize_dist/_gzip.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shapiromatron/bmds path: /bmds/bmds2/batch.py
import json
import os
import pandas as pd
from . import exports
from .reporter import Reporter
class SessionBatch(list):
"""
Export utilities for exporting a collection of multiple BMD sessions.
Example
-------
>>> datasets = ... | code_fim | hard | {
"lang": "python",
"repo": "shapiromatron/bmds",
"path": "/bmds/bmds2/batch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
rep = Reporter()
for model in self:
rep.add_session(
model,
input_dataset,
summary_table,
recommendation_details,
recommended_model,
all_models,
)
if... | code_fim | hard | {
"lang": "python",
"repo": "shapiromatron/bmds",
"path": "/bmds/bmds2/batch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: x-th-unicorn/domoticz-plugins-manager path: /plugins.py
import json
from manager import Plugin
<|fim_suffix|>for key, value in plugins_raw.items():
plugins[key] = Plugin(value)<|fim_middle|>f = open('./plugins/plugins-manager/plugins.json',)
plugins_raw = json.load(f)
plugins = {}
| code_fim | medium | {
"lang": "python",
"repo": "x-th-unicorn/domoticz-plugins-manager",
"path": "/plugins.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for key, value in plugins_raw.items():
plugins[key] = Plugin(value)<|fim_prefix|># repo: x-th-unicorn/domoticz-plugins-manager path: /plugins.py
import json
from manager import Plugin
<|fim_middle|>f = open('./plugins/plugins-manager/plugins.json',)
plugins_raw = json.load(f)
plugins = {}
| code_fim | medium | {
"lang": "python",
"repo": "x-th-unicorn/domoticz-plugins-manager",
"path": "/plugins.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sift_matches = cv2.drawMatches(reeses,kp1,cereals,kp2,good_matches,None,flags=2)
## FLAN (FAST LIBRARY)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm=FLANN_INDEX_KDTREE,trees=5)
search_params = dict(checks=50)
flann = cv2.FlannBasedMatcher(index_params,search_params)
matches = flann.knnMatch(de... | code_fim | hard | {
"lang": "python",
"repo": "MSathler/Computer_Vision_plus_DeepLearning_Course",
"path": "/Section6_Object_Detection/class6_feature_matching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for match1,match2 in matches:
# IF MATCH 1 DISTANCE is LESS THAN 75% of MATCH 2 DISTANCE
# THEN DESCRIPTOR WAS A GOOD MATCH, LETS KEEP IT !
if match1.distance < 0.75*match2.distance:
good_matches.append(match1)
sift_matches = cv2.drawMatches(reeses,kp1,cereals,kp2,good_matches,None,fl... | code_fim | hard | {
"lang": "python",
"repo": "MSathler/Computer_Vision_plus_DeepLearning_Course",
"path": "/Section6_Object_Detection/class6_feature_matching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MSathler/Computer_Vision_plus_DeepLearning_Course path: /Section6_Object_Detection/class6_feature_matching.py
import cv2
import numpy as np
import matplotlib.pyplot as plt
def display(img,cmap='gray'):
fig = plt.figure(figsize=(12,10))
ax = fig.add_subplot(111)
ax.imshow(img,cmap='gr... | code_fim | medium | {
"lang": "python",
"repo": "MSathler/Computer_Vision_plus_DeepLearning_Course",
"path": "/Section6_Object_Detection/class6_feature_matching.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sauriol/csh-quotefault-bot path: /ldap_utils.py
from app import _ldap
<|fim_suffix|> try:
member = _ldap.get_member(uid, uid=True)
return member.displayname
except:
return uid<|fim_middle|>def resolve_name(uid: str) -> str:
| code_fim | easy | {
"lang": "python",
"repo": "sauriol/csh-quotefault-bot",
"path": "/ldap_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
member = _ldap.get_member(uid, uid=True)
return member.displayname
except:
return uid<|fim_prefix|># repo: sauriol/csh-quotefault-bot path: /ldap_utils.py
from app import _ldap
<|fim_middle|>def resolve_name(uid: str) -> str:
| code_fim | easy | {
"lang": "python",
"repo": "sauriol/csh-quotefault-bot",
"path": "/ldap_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benwoo1110/A-List-of-Sorts-v2 path: /code_old/algorithm/quicksort.py
######################################
# Import and initialize the librarys #
######################################
import time
from code.algorithm.commonFunc import commonFunc
from code.pygame_objects import *
##############... | code_fim | medium | {
"lang": "python",
"repo": "benwoo1110/A-List-of-Sorts-v2",
"path": "/code_old/algorithm/quicksort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@staticmethod
def run(sort_screen, speed:int):
array = sort_screen.objects.sortbox.data
# Reset stats
sort_screen.objects.time_taken.data.startTimer(withReset=True)
sort_screen.objects.moves.data.reset()<|fim_prefix|># repo: benwoo1110/A-List-of-Sorts-v2 ... | code_fim | hard | {
"lang": "python",
"repo": "benwoo1110/A-List-of-Sorts-v2",
"path": "/code_old/algorithm/quicksort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Reset stats
sort_screen.objects.time_taken.data.startTimer(withReset=True)
sort_screen.objects.moves.data.reset()<|fim_prefix|># repo: benwoo1110/A-List-of-Sorts-v2 path: /code_old/algorithm/quicksort.py
######################################
# Import and initialize the librarys... | code_fim | medium | {
"lang": "python",
"repo": "benwoo1110/A-List-of-Sorts-v2",
"path": "/code_old/algorithm/quicksort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jokkebk/livecoding path: /Euler21-25/p24.py
from itertools import permutations
i<|fim_suffix|>t(''.join(p))
break
i += 1<|fim_middle|> = 1
for p in permutations("0123456789", 10):
if i==10**6:
prin | code_fim | medium | {
"lang": "python",
"repo": "jokkebk/livecoding",
"path": "/Euler21-25/p24.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jokkebk/livecoding path: /Euler21-25/p24.py
from itertools import permutations
i<|fim_suffix|>", 10):
if i==10**6:
print(''.join(p))
break
i += 1<|fim_middle|> = 1
for p in permutations("0123456789 | code_fim | easy | {
"lang": "python",
"repo": "jokkebk/livecoding",
"path": "/Euler21-25/p24.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>", 10):
if i==10**6:
print(''.join(p))
break
i += 1<|fim_prefix|># repo: jokkebk/livecoding path: /Euler21-25/p24.py
from itertools import permutations
i<|fim_middle|> = 1
for p in permutations("0123456789 | code_fim | easy | {
"lang": "python",
"repo": "jokkebk/livecoding",
"path": "/Euler21-25/p24.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.schema_factory.create_fixed_decimal_schema(16, 'foo', 4, 2)
def test_resolve_primitive_schema_with_unsupported_schemas(self, resolver):
self.resolve_unsupported_schemas(
self.primitive_schema,
self.enum_schema,
resolver.resolve_primitive... | code_fim | hard | {
"lang": "python",
"repo": "Elyunge/schematizer",
"path": "/tests/logic/schema_resolution_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Elyunge/schematizer path: /tests/logic/schema_resolution_test.py
, ['a', 'b'])
)
def test_resolve_enum_schema_with_diff_symbols(self, resolver):
assert not resolver.resolve_schema(
self.schema_factory.create_enum_schema('foo', ['a', 'b']),
self.schema_... | code_fim | hard | {
"lang": "python",
"repo": "Elyunge/schematizer",
"path": "/tests/logic/schema_resolution_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.schema_factory.create_field_schema(
'field3',
self.schema_factory.create_primitive_schema('string'),
has_default=True,
default_value='default_string'
)
def test_resolve_record_schema(self, resolver):
w_schema = self.s... | code_fim | hard | {
"lang": "python",
"repo": "Elyunge/schematizer",
"path": "/tests/logic/schema_resolution_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Return: list
Strings of comic script extracted from the image.
'''
tokens = self.tokenizer.tokenize(imagePath=imagePath)
scripts = []
for token in tokens:
# enlarge
token = cv2.resize(token, (0, 0), fx=2, fy=2)
# denoi... | code_fim | hard | {
"lang": "python",
"repo": "John-Oula/trans-ocr",
"path": "/comicsocr/src/reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
imagePath: string
Path to the comic page image.
Return: list
Strings of comic script extracted from the image.
'''
tokens = self.tokenizer.tokenize(imagePath=imagePath)
scripts = []
for token in tokens:
... | code_fim | medium | {
"lang": "python",
"repo": "John-Oula/trans-ocr",
"path": "/comicsocr/src/reader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: John-Oula/trans-ocr path: /comicsocr/src/reader.py
import pytesseract
import cv2
import numpy as np
from matplotlib import pyplot as plt
import logging
import sys
from comicsocr.src.config import Config
from comicsocr.src.tokenizer import Tokenizer
logger = logging.getLogger(__name__)
log_forma... | code_fim | hard | {
"lang": "python",
"repo": "John-Oula/trans-ocr",
"path": "/comicsocr/src/reader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KameniAlexNea/herbes-afrique path: /herbes/blog/urls.py
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
<|fim_suffix|>app_name = 'blog'
urlpatterns = [
path('admin/', admin.site.urls),
path('', bl... | code_fim | easy | {
"lang": "python",
"repo": "KameniAlexNea/herbes-afrique",
"path": "/herbes/blog/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app_name = 'blog'
urlpatterns = [
path('admin/', admin.site.urls),
path('', blog_view, name='blog'),
path('<int:id>/', detail_view, name='detail')
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: KameniAlexNea/herbes-afrique path: /herbes/blog/urls.py
fro... | code_fim | easy | {
"lang": "python",
"repo": "KameniAlexNea/herbes-afrique",
"path": "/herbes/blog/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lvqj2/dm_alchemy path: /dm_alchemy/types/unity_python_conversion_test.py
# Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | code_fim | hard | {
"lang": "python",
"repo": "lvqj2/dm_alchemy",
"path": "/dm_alchemy/types/unity_python_conversion_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Since some of the transforms to test take or return multiple arguments we
assume that all of them do. For functions which do not we use the post
processing functions to make them tuples.
Args:
items: Set of items to transform.
transform: Function which transforms them to unity... | code_fim | hard | {
"lang": "python",
"repo": "lvqj2/dm_alchemy",
"path": "/dm_alchemy/types/unity_python_conversion_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>quires='>3.7',
install_requires=[
"pyfakefs",
"pytest",
"hypothesis",
"click",
"python-crontab",
],
entry_points = """
[console_scripts]
dio=diocli:cli
""",
)<|fim_prefix|># repo: howonlee/d... | code_fim | hard | {
"lang": "python",
"repo": "howonlee/diogenes8",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: howonlee/diogenes8 path: /setup.py
from setuptools import setup
setup(
name="diogenes8",
version="1.0.0",
description="A scheduler to remind you to talk to your friends",
url="https://github.com/howonlee/diogenes8",
author="Howon Lee",
license="MIT... | code_fim | hard | {
"lang": "python",
"repo": "howonlee/diogenes8",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.COMPRESS_OUTPUT:
compress_vars = self.list_of_vars
if save_full and self.num_cross_covs != 0:
compress_vars = self.list_of_full_vars
encoding = {}
for var in compress_vars:
if not var in self.exclude_compress:
... | code_fim | hard | {
"lang": "python",
"repo": "MetOffice/ocean_error_covs",
"path": "/modules/datasets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ****** PARAMETERS *****
1. self2: dataset to be added
"""
if self.covs_ds["variable"] != self2.covs_ds["variable"]:
raise ValueError("Variable names in the two datasets are not the same")
self.covs_ds["num_times"] += self2.covs_ds["num_times"]
s... | code_fim | hard | {
"lang": "python",
"repo": "MetOffice/ocean_error_covs",
"path": "/modules/datasets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MetOffice/ocean_error_covs path: /modules/datasets.py
import shutil
import os
import warnings
import xarray as xr
warnings.simplefilter("ignore", category=RuntimeWarning)
import numpy as np
import tempfile
from timeit import default_timer as timer
from datetime import timedelta
from modules.error... | code_fim | hard | {
"lang": "python",
"repo": "MetOffice/ocean_error_covs",
"path": "/modules/datasets.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atomistic-machine-learning/schnetpack path: /src/scripts/spkdeploy
#!/usr/bin/env python3
import torch
import torch.nn as nn
from schnetpack.transform import CastTo64, CastTo32, AddOffsets
import argparse
def get_jit_model(model):
# fix invalid operations in postprocessing
jit_postproce... | code_fim | hard | {
"lang": "python",
"repo": "atomistic-machine-learning/schnetpack",
"path": "/src/scripts/spkdeploy",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = torch.load(args.model_path, map_location=args.device)
save_jit_model(model, args.deployed_model_path)
print(f"stored deployed model at {args.deployed_model_path}.")<|fim_prefix|># repo: atomistic-machine-learning/schnetpack path: /src/scripts/spkdeploy
#!/usr/bin/env python3
import t... | code_fim | hard | {
"lang": "python",
"repo": "atomistic-machine-learning/schnetpack",
"path": "/src/scripts/spkdeploy",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hammertoe/didactic-spork path: /examples/client.py
import urllib2
import json
import time
BASE = 'http://localhost:8080/v1'
# util function for sending data to API
def send(endpoint, data=None):
if data is not None:
data = json.dumps(data)
headers = {'Content-Type': 'applica... | code_fim | hard | {
"lang": "python",
"repo": "hammertoe/didactic-spork",
"path": "/examples/client.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "Run the game!"
print "Balance of my goal:"
while True:
send('/game/tick', {})
goal = send('/network/{}'.format(goal['id']))
print " {:.2f}".format(goal['balance'])
time.sleep(1)<|fim_prefix|># repo: hammertoe/didactic-spork path: /examples/client.py
import urllib2
import jso... | code_fim | hard | {
"lang": "python",
"repo": "hammertoe/didactic-spork",
"path": "/examples/client.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lightxu/15619_CC path: /Project1_1/aws/calc_total_request.py
import sys
filename = sys.argv[1]
total_request<|fim_suffix|>n fin:
items = line.split()
total_request = total_request + int(items[-2])
print total_request<|fim_middle|> = 0
with open(filename, "r") as fin:
for line i | code_fim | easy | {
"lang": "python",
"repo": "lightxu/15619_CC",
"path": "/Project1_1/aws/calc_total_request.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>n fin:
items = line.split()
total_request = total_request + int(items[-2])
print total_request<|fim_prefix|># repo: lightxu/15619_CC path: /Project1_1/aws/calc_total_request.py
import sys
filename = sys.argv[1]
total_request<|fim_middle|> = 0
with open(filename, "r") as fin:
for line i | code_fim | easy | {
"lang": "python",
"repo": "lightxu/15619_CC",
"path": "/Project1_1/aws/calc_total_request.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Generates pybind11 bindings code from CLIF ast.
Args:
ast: CLIF ast protobuf.
Yields:
Generated pybind11 bindings code.
"""
for s in self._generate_headlines():
yield s
yield f'PYBIND11_MODULE({self._module_name}, m) {{'
yield I+('m.doc() = "CLIF generate... | code_fim | medium | {
"lang": "python",
"repo": "ORG-MARS/clif",
"path": "/clif/pybind11/generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ORG-MARS/clif path: /clif/pybind11/generator.py
# Copyright 2020 Google LLC
#
# 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://www.apache.org/licenses/LICE... | code_fim | medium | {
"lang": "python",
"repo": "ORG-MARS/clif",
"path": "/clif/pybind11/generator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._ast = ast
self._module_name = module_name
def generate_from(self, ast: ast_pb2.AST):
"""Generates pybind11 bindings code from CLIF ast.
Args:
ast: CLIF ast protobuf.
Yields:
Generated pybind11 bindings code.
"""
for s in self._generate_headlines():
... | code_fim | hard | {
"lang": "python",
"repo": "ORG-MARS/clif",
"path": "/clif/pybind11/generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for x in xrange(len(s)):
if s[x].isalnum():
letterStack.append(s[x])
for x in xrange(len(letterStack)/2):
if (letterStack[x].lower() != letterStack[len(letterStack)-x-1].lower()):
return False
return True... | code_fim | hard | {
"lang": "python",
"repo": "Bunit73/leetcode",
"path": "/easy/validPalindrome.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bunit73/leetcode path: /easy/validPalindrome.py
# https://leetcode.com/submissions/detail/110316063/
class Solution(object):
<|fim_suffix|> if s == '':
return True
letterStack = []
for x in xrange(len(s)):
if s[x].isalnum():
... | code_fim | hard | {
"lang": "python",
"repo": "Bunit73/leetcode",
"path": "/easy/validPalindrome.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShahriyarR/gino-admin path: /examples/composite_csv_example/src/app.py
import os
from db import Address, Camp, City, Country, Education, Place, db
from sanic import Sanic, response
<|fim_suffix|># set os.environ["ADMIN_AUTH_DISABLE"] = "1" to disable auth
db.init_app(app)
@app.route("/")
asyn... | code_fim | hard | {
"lang": "python",
"repo": "ShahriyarR/gino-admin",
"path": "/examples/composite_csv_example/src/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>add_admin_panel(
app,
db,
[Place, City, Camp, Education, Address, Country],
composite_csv_settings={
"area": {"models": (Place, Education, Camp), "type_column": "type"}
},
presets_folder=os.path.join(current_path, "csv_to_upload"),
)
if __name__ == "__main__":
app.run(... | code_fim | hard | {
"lang": "python",
"repo": "ShahriyarR/gino-admin",
"path": "/examples/composite_csv_example/src/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> entrysets = EntrySettings(
id = 1,
name ='TimStoploss',
initial_entry_allocation = 30,
signal_distance = 1, # in %
)
exitsets = ExitSettings(
id=1,
name='TimLoss',
profit_target = 3, # in %
stop_loss_value = 10, #... | code_fim | hard | {
"lang": "python",
"repo": "7leekee7/pyjuque",
"path": "/pyjuque/Engine/Database.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 7leekee7/pyjuque path: /pyjuque/Engine/Database.py
from pyjuque.Engine.Models import Base, Bot, Order, Pair, EntrySettings, ExitSettings, getSession
def InitializeDatabase(session, symbols=[], bot_name='My first bot'):
""" Function that initializes the database
by creating a bot with two... | code_fim | medium | {
"lang": "python",
"repo": "7leekee7/pyjuque",
"path": "/pyjuque/Engine/Database.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mnemonics = []
fname = settings.PROJECT_DIR + '/mnemonics_' + lang_code + '.csv'
if os.path.isfile(fname):
with open(fname, 'rb') as csvfile:
mnemonics_reader = csv.reader(csvfile, delimiter='\t')
for row in mnemonics_reader:
... | code_fim | hard | {
"lang": "python",
"repo": "dilshan23/geography",
"path": "/proso_mnemonics/management/commands/update_mnemonics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_mnemonics(self, lang_code):
mnemonics = []
fname = settings.PROJECT_DIR + '/mnemonics_' + lang_code + '.csv'
if os.path.isfile(fname):
with open(fname, 'rb') as csvfile:
mnemonics_reader = csv.reader(csvfile, delimiter='\t')
f... | code_fim | hard | {
"lang": "python",
"repo": "dilshan23/geography",
"path": "/proso_mnemonics/management/commands/update_mnemonics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dilshan23/geography path: /proso_mnemonics/management/commands/update_mnemonics.py
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from proso_mnemonics.models import Mnemonic
from geography.models import Place
import csv
import settings
import os.path
class Command(B... | code_fim | hard | {
"lang": "python",
"repo": "dilshan23/geography",
"path": "/proso_mnemonics/management/commands/update_mnemonics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgruening/ngsutils path: /ngsutils/gtf/t/test_add_reflink.py
#!/usr/bin/env python
'''
Tests for gtfutils / add_reflink
'''
import os
import unittest
import StringIO
<|fim_suffix|>gtf = os.path.join(os.path.dirname(__file__), 'test-iso.gtf')
reflink = os.path.join(os.path.dirname(__file__), 'te... | code_fim | medium | {
"lang": "python",
"repo": "bgruening/ngsutils",
"path": "/ngsutils/gtf/t/test_add_reflink.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testAddReflink(self):
valid = '''\
chr1|test|gene|1001|1100|0|+|.|gene_id "foo1"; transcript_id "txpt1"; gene_name "gene1"; isoform_id "iso1";
chr1|test|gene|1051|1100|0|+|.|gene_id "foo1"; transcript_id "txpt2"; gene_name "gene1"; isoform_id "iso1";
chr1|test|gene|2001|2100|0|+|.|gene_id ... | code_fim | medium | {
"lang": "python",
"repo": "bgruening/ngsutils",
"path": "/ngsutils/gtf/t/test_add_reflink.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>gtf = os.path.join(os.path.dirname(__file__), 'test-iso.gtf')
reflink = os.path.join(os.path.dirname(__file__), 'test-reflink.txt')
class GTFAddReflinkTest(unittest.TestCase):
def testAddReflink(self):
valid = '''\
chr1|test|gene|1001|1100|0|+|.|gene_id "foo1"; transcript_id "txpt1"; gene_na... | code_fim | medium | {
"lang": "python",
"repo": "bgruening/ngsutils",
"path": "/ngsutils/gtf/t/test_add_reflink.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bernardocuteri/wasp path: /tests/asp/cautious/example.simplification.gus2.gringo.cautious.asp.test.py
input = """
3 6 2 3 4 5 6 7 0 0
1 8 1 0 2
1 9 2 0 6 7
1 10 2 0 6 7
1 11 1 0 5
1 12 1 0 4
1 13 1 0 3
1 8 1 0 13
1 13 1 0 12
1 12 1 0 11
1 11 1 0 10
<|fim_suffix|> a
7 ex6
12 c
3 ex2
13 b
4 ex3
9 f... | code_fim | medium | {
"lang": "python",
"repo": "bernardocuteri/wasp",
"path": "/tests/asp/cautious/example.simplification.gus2.gringo.cautious.asp.test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a
7 ex6
12 c
3 ex2
13 b
4 ex3
9 f
0
B+
0
B-
1
0
1
"""
output = """
{}
"""<|fim_prefix|># repo: bernardocuteri/wasp path: /tests/asp/cautious/example.simplification.gus2.gringo.cautious.asp.test.py
input = """
3 6 2 3 4 5 6 7 0 0
1 8 1 0 2
1 9 2 0 6 7
1 10 2 0 6 7
1 11 1 0 5
1 12 1 0 4
1 13 1 0 3
1 8 1 0... | code_fim | medium | {
"lang": "python",
"repo": "bernardocuteri/wasp",
"path": "/tests/asp/cautious/example.simplification.gus2.gringo.cautious.asp.test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param activity_id: (Optional) ID of the activity to refer to
:type activity_id: str
:param user: (Optional) User participating in this conversation
:type user: ~botframework.connector.models.ChannelAccount
:param bot: Bot participating in this conversation
:type bot: ~botframework... | code_fim | medium | {
"lang": "python",
"repo": "crazyrex/botbuilder-python",
"path": "/libraries/botbuilder-schema/botbuilder/schema/conversation_reference_py3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crazyrex/botbuilder-python path: /libraries/botbuilder-schema/botbuilder/schema/conversation_reference_py3.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. S... | code_fim | medium | {
"lang": "python",
"repo": "crazyrex/botbuilder-python",
"path": "/libraries/botbuilder-schema/botbuilder/schema/conversation_reference_py3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vivekkhimani/DataStructuresAndAlgorithmsPractice path: /StacksAndQueues/Applications_And_Interview/SymbolCheck.py
'''
Problem Description:
Checking opening and closing of symbols (,{,},) or syntax (programming languages often require proper opening and closing of brackets).
Solution:
a) Wheneve... | code_fim | hard | {
"lang": "python",
"repo": "vivekkhimani/DataStructuresAndAlgorithmsPractice",
"path": "/StacksAndQueues/Applications_And_Interview/SymbolCheck.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
openTag = str(myStack.returnTop())
if symbolDict.get(openTag) == characters:
newPop = myStack.pop()
#print(newPop)
if not myStack.isEmpty():
return "Invalid"
return "Valid"
if __name__ == "__main__":
print(checkValid(validSample))
print(checkValid(invalidSample))
print(... | code_fim | hard | {
"lang": "python",
"repo": "vivekkhimani/DataStructuresAndAlgorithmsPractice",
"path": "/StacksAndQueues/Applications_And_Interview/SymbolCheck.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.