text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: djfurman/serverless-suspense path: /serverless_suspense/base.py
class ServerlessSuspense:
def __init__(self):
pass
<|fim_suffix|> raise NotImplementedError("Must implement method to fetch status")
def is_suspended(self):
raise NotImplementedError("Must implement s... | code_fim | easy | {
"lang": "python",
"repo": "djfurman/serverless-suspense",
"path": "/serverless_suspense/base.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validation_test(self):
self.assertFalse(valid_iso8601("1547138099"))
self.assertTrue(valid_iso8601("2019-01-10T16:34:59Z"))<|fim_prefix|># repo: crazyrex/conan path: /conans/test/unittests/client/util/time_test.py
import datetime
import unittest
from conans.util.dates import from... | code_fim | hard | {
"lang": "python",
"repo": "crazyrex/conan",
"path": "/conans/test/unittests/client/util/time_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crazyrex/conan path: /conans/test/unittests/client/util/time_test.py
import datetime
import unittest
from conans.util.dates import from_timestamp_to_iso8601, from_iso8601_to_datetime, valid_iso8601
class TimeTest(unittest.TestCase):
def time_conversions_test(self):
<|fim_suffix|> a... | code_fim | hard | {
"lang": "python",
"repo": "crazyrex/conan",
"path": "/conans/test/unittests/client/util/time_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_encryption_info(self):
return {'method': self._encryption_method} if self._encryption_method != 'no encryption' else {}
def extract_cover_internal(self, working_dir):
tmp_dir = mkdtemp(dir=working_dir)
BookMobi(self.file).unpackMobi(tmp_dir + '/bookmobi')
t... | code_fim | medium | {
"lang": "python",
"repo": "Aladex/sopds-fb2sax-sqlalchemy",
"path": "/book_tools/format/mobi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aladex/sopds-fb2sax-sqlalchemy path: /book_tools/format/mobi.py
import os, shutil
from tempfile import mkdtemp
from book_tools.pymobi.mobi import BookMobi
from book_tools.format.bookfile import BookFile
from book_tools.format.mimetype import Mimetype
class Mobipocket(BookFile):
def __init_... | code_fim | medium | {
"lang": "python",
"repo": "Aladex/sopds-fb2sax-sqlalchemy",
"path": "/book_tools/format/mobi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ge="preds", summarize=10)
# Add these preds to the inputs
decoder_inputs = tf.concat([decoder_inputs, preds], axis=1)
decoder_outputs = tf.concat([decoder_outputs, output], axis=1)
i = tf.add(i, 1)
return i, decoder_inputs, decoder_outputs<|fim_prefix|># repo: fenshion/instacorrect path: /Model/test.py
#... | code_fim | hard | {
"lang": "python",
"repo": "fenshion/instacorrect",
"path": "/Model/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fenshion/instacorrect path: /Model/test.py
# Embed the characters
decoder_inputs = tf.Print(decoder_inputs, [decoder_inputs], message="decoder_inputs")
decoder_outputs = tf.Print(decoder_outputs, [decoder_outputs], message="decoder_outputs")
inputs = tf.nn.embedding_lookup(embeddin<|fim_suffix|>e... | code_fim | hard | {
"lang": "python",
"repo": "fenshion/instacorrect",
"path": "/Model/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brianchiang-tw/Code-wars path: /Human Readable Time/human_readable_time.py
'''
Description:
Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS)
HH = hours, padded to 2 digits, range: 00 - 99
MM = minutes, padded to ... | code_fim | hard | {
"lang": "python",
"repo": "brianchiang-tw/Code-wars",
"path": "/Human Readable Time/human_readable_time.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # formatted output as specified in description
return f'{h:02}:{m:02}:{s:02}'
def test_bench():
test_data = [ 5, 61, 121, 3599, 3601, 7201]
# expected output:
'''
00:00:05
00:01:01
00:02:01
00:59:59
01:00:01
02:00:01
'''
for second_string in test_... | code_fim | hard | {
"lang": "python",
"repo": "brianchiang-tw/Code-wars",
"path": "/Human Readable Time/human_readable_time.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eyadgaran/SimpleML path: /simpleml/save_patterns/locations/__init__.py
"""
Persistence Locations
These are the primary classes responsible for tra<|fim_suffix|>thon objects into the system
temp folder first and then call a location transporter to copy to the final
storage place
"""
__author__ =... | code_fim | medium | {
"lang": "python",
"repo": "eyadgaran/SimpleML",
"path": "/simpleml/save_patterns/locations/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>thon objects into the system
temp folder first and then call a location transporter to copy to the final
storage place
"""
__author__ = "Elisha Yadgaran"<|fim_prefix|># repo: eyadgaran/SimpleML path: /simpleml/save_patterns/locations/__init__.py
"""
Persistence Locations
These are the primary classes r... | code_fim | medium | {
"lang": "python",
"repo": "eyadgaran/SimpleML",
"path": "/simpleml/save_patterns/locations/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: epigos/AutoML_Alex path: /automl_alex/automl_alex.py
gpu=self._gpu,
random_state=self._random_state,
type_of_estimator=self.type_of_estimator
)
return(model)
def _opt_model(self, trial):
'''
now we can choose models in optimizat... | code_fim | hard | {
"lang": "python",
"repo": "epigos/AutoML_Alex",
"path": "/automl_alex/automl_alex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: epigos/AutoML_Alex path: /automl_alex/automl_alex.py
e_opt=self._combined_score_opt,
metric_round=self._metric_round,
model_param=model_param,
wrapper_params=wrapper_params,
gpu=self._gpu,
random_state=self._random_state,
t... | code_fim | hard | {
"lang": "python",
"repo": "epigos/AutoML_Alex",
"path": "/automl_alex/automl_alex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class StackingClassifier(Stacking):
type_of_estimator='classifier'
__name__ = 'StackingClassifier'
class StackingRegressor(Stacking):
type_of_estimator='regression'
__name__ = 'StackingRegressor'
##################################### AutoML #########################################
... | code_fim | hard | {
"lang": "python",
"repo": "epigos/AutoML_Alex",
"path": "/automl_alex/automl_alex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># format list of events
print(f"{len(events)} matching events")
for event in events:
props = event.properties
time = props.time.date().isoformat()
print(f"{time} - M{props.mag:.1f} {props.place}")<|fim_prefix|># repo: jmfee-usgs/python-typing-pydantic-oop path: /examples/using_pydantic/exampl... | code_fim | hard | {
"lang": "python",
"repo": "jmfee-usgs/python-typing-pydantic-oop",
"path": "/examples/using_pydantic/example.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmfee-usgs/python-typing-pydantic-oop path: /examples/using_pydantic/example.py
from dateutil.parser import isoparse
from .get_catalog import get_catalog
<|fim_suffix|># format list of events
print(f"{len(events)} matching events")
for event in events:
props = event.properties
time = p... | code_fim | hard | {
"lang": "python",
"repo": "jmfee-usgs/python-typing-pydantic-oop",
"path": "/examples/using_pydantic/example.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>x1 = ParticleA.pCM.dot(N.x)
y1 = ParticleA.pCM.dot(N.y)
KE = system.KE
PE = system.getPEGravity(pNA)-system.getPESprings()
pynamics.tic()
print('solving dynamics...')
f,ma = system.getdynamics()
print('creating second order function...')
func1 = system.state_space_post_invert(f,ma)
print('integrating... | code_fim | hard | {
"lang": "python",
"repo": "rkhodambashi/code_pynamics",
"path": "/python/pynamics/examples/single_dof_bouncer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rkhodambashi/code_pynamics path: /python/pynamics/examples/single_dof_bouncer.py
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes
Email: danaukes<at>gmail.com
Please see LICENSE for full license.
"""
import pynamics
from pynamics.frame import Frame
from pynamics.variable_types import Diff... | code_fim | hard | {
"lang": "python",
"repo": "rkhodambashi/code_pynamics",
"path": "/python/pynamics/examples/single_dof_bouncer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>initialvalues = {}
initialvalues[x]=0
initialvalues[x_d]=.1
initialvalues[y]=.1
initialvalues[y_d]=0
statevariables = system.get_q(0)+system.get_q(1)
ini = [initialvalues[item] for item in statevariables]
N = Frame('N')
system.set_newtonian(N)
pNA=0*N.x
pAcm=pNA+x*N.x+y*N.y
vAcm = pAcm.time_derivativ... | code_fim | hard | {
"lang": "python",
"repo": "rkhodambashi/code_pynamics",
"path": "/python/pynamics/examples/single_dof_bouncer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mingxiaoh/chainercv path: /chainercv/utils/testing/generate_random_bbox.py
import numpy as np
def generate_random_bbox(n, img_size, min_length, max_length):
"""Generate valid bounding boxes with random position and shape.
Args:
n (int): The number of bounding boxes.
img... | code_fim | hard | {
"lang": "python",
"repo": "mingxiaoh/chainercv",
"path": "/chainercv/utils/testing/generate_random_bbox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
H, W = img_size
y_min = np.random.uniform(0, H - max_length, size=(n,))
x_min = np.random.uniform(0, W - max_length, size=(n,))
y_max = y_min + np.random.uniform(min_length, max_length, size=(n,))
x_max = x_min + np.random.uniform(min_length, max_length, size=(n,))
bbox = n... | code_fim | hard | {
"lang": "python",
"repo": "mingxiaoh/chainercv",
"path": "/chainercv/utils/testing/generate_random_bbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ose_name='Title', blank=True),
),
migrations.AddField(
model_name='homepage',
name='photo_album',
field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.PROTECT, blank=True, to='album.Album', null=True),
),
migratio... | code_fim | hard | {
"lang": "python",
"repo": "PARINetwork/pari",
"path": "/core/migrations/0012_auto_20170417_1303.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PARINetwork/pari path: /core/migrations/0012_auto_20170417_1303.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.images.models
import wagtail.core.fields
import wagtail.core.blocks
class ... | code_fim | hard | {
"lang": "python",
"repo": "PARINetwork/pari",
"path": "/core/migrations/0012_auto_20170417_1303.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@click.command()
@add_common_options(COMMON_GEN_FEATURE_OPTIONS)
def generate_feature(dataset_path, output_path, num_threads):
"""Extract the feature of the whole dataset for training."""
settings = BeatSettings()
if output_path is not None:
settings.dataset.feature_save_path = outpu... | code_fim | medium | {
"lang": "python",
"repo": "Music-and-Culture-Technology-Lab/omnizart",
"path": "/omnizart/cli/beat/generate_feature.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Music-and-Culture-Technology-Lab/omnizart path: /omnizart/cli/beat/generate_feature.py
import click
from omnizart.cli.common_options import add_common_options, COMMON_GEN_FEATURE_OPTIONS
from omnizart.setting_loaders import BeatSettings
from omnizart.utils import LazyLoader
<|fim_suffix|> if... | code_fim | hard | {
"lang": "python",
"repo": "Music-and-Culture-Technology-Lab/omnizart",
"path": "/omnizart/cli/beat/generate_feature.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Extract the feature of the whole dataset for training."""
settings = BeatSettings()
if output_path is not None:
settings.dataset.feature_save_path = output_path
beat.app.generate_feature(dataset_path, beat_settings=settings, num_threads=num_threads)<|fim_prefix|># repo: Music-... | code_fim | medium | {
"lang": "python",
"repo": "Music-and-Culture-Technology-Lab/omnizart",
"path": "/omnizart/cli/beat/generate_feature.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@ap</warning>
def prop(self):
pass
import abc as foo
class D(metaclass=abc.ABCMeta):
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use '... | code_fim | medium | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/testData/deprecation/abcDeprecatedAbstracts.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JetBrains/intellij-community path: /python/testData/deprecation/abcDeprecatedAbstracts.py
import abc
class A(metaclass=abc.ABCMeta):
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@abc.abstractproperty</warning>
d... | code_fim | medium | {
"lang": "python",
"repo": "JetBrains/intellij-community",
"path": "/python/testData/deprecation/abcDeprecatedAbstracts.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getById(self, id_goals):
"""
Get Goals Object By it id
:param id_goals: id of Goals Object
:return: Goals Object
"""
lparam = [id_goals]
rep = AbstractDAO._read(self, R_READBYID, lparam)
return self.__fetch_to_object(rep, True)
d... | code_fim | hard | {
"lang": "python",
"repo": "ChatNoir76/Championnat",
"path": "/model/dao/sqlite/dao_goals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChatNoir76/Championnat path: /model/dao/sqlite/dao_goals.py
from model.dao.abstractdao import AbstractDAO
from model.dao.daoexception import DAOException
from model.goals import Goals
R_INSERT = """
INSERT INTO But
VALUES (null, ?, ?, ?, ?, ?)"""
R_UPDATE = """
UPDATE But
SET
commentaire_b... | code_fim | hard | {
"lang": "python",
"repo": "ChatNoir76/Championnat",
"path": "/model/dao/sqlite/dao_goals.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdvala/pipgrip path: /tests/test_pipper.py
import os
import subprocess
import pytest
import pipgrip.pipper
from pipgrip.pipper import _download_wheel, _get_available_versions
@pytest.mark.parametrize(
"package, pip_output, expected",
[
(
".[all]",
"""
... | code_fim | hard | {
"lang": "python",
"repo": "jdvala/pipgrip",
"path": "/tests/test_pipper.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> monkeypatch.setattr(
pipgrip.pipper.os, "walk", patch_os_walk,
)
monkeypatch.setattr(
pipgrip.pipper.os.path, "getmtime", patch_getmtime,
)
monkeypatch.setattr(
pipgrip.pipper, "stream_bash_command", patch_pip_output,
)
assert _download_wheel(
p... | code_fim | hard | {
"lang": "python",
"repo": "jdvala/pipgrip",
"path": "/tests/test_pipper.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> NL = NormalizedLevenshtein()
vectors = pd.DataFrame([[NL.distance(i, j) for j in arr2] for i in arr1])
clusters = 5
agg = AgglomerativeClustering(affinity='euclidean', compute_full_tree='auto',
connectivity=None, linkage='ward', memory=None, n_clusters=clusters,
pooling_func='deprec... | code_fim | hard | {
"lang": "python",
"repo": "lucky7-capstone/Lucky7-Capstone",
"path": "/ML/Agglomerative.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(clusters):
print("Cluster " + str(i) + ":")
print(pd.Series(arr1[agg.labels_==i]))
print('\n')
if __name__ == "__main__":
main()<|fim_prefix|># repo: lucky7-capstone/Lucky7-Capstone path: /ML/Agglomerative.py
import sys
import numpy as np
import pandas as pd
from si... | code_fim | hard | {
"lang": "python",
"repo": "lucky7-capstone/Lucky7-Capstone",
"path": "/ML/Agglomerative.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucky7-capstone/Lucky7-Capstone path: /ML/Agglomerative.py
import sys
import numpy as np
import pandas as pd
from similarity.normalized_levenshtein import NormalizedLevenshtein
from sklearn.cluster import AgglomerativeClustering
from sklearn.cluster import KMeans
def main():
<|fim_suffix|> df =... | code_fim | medium | {
"lang": "python",
"repo": "lucky7-capstone/Lucky7-Capstone",
"path": "/ML/Agglomerative.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: warppoint42/Mahjong221 path: /stats.py
import csv
stats = dict()
with open('unifiedroundlog.csv', 'r') as csvfile:
reader = csv.DictReader(csvfile, ('AI', 'gameID', 'end', 'win', 'feed', 'riichi'))
for row in reader:
if row['AI'] not in stats:
stats[row['AI']] = dict... | code_fim | medium | {
"lang": "python",
"repo": "warppoint42/Mahjong221",
"path": "/stats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for row in reader:
stats[row['AI']].setdefault('1', 0)
stats[row['AI']].setdefault('2', 0)
stats[row['AI']].setdefault('3', 0)
stats[row['AI']].setdefault('4', 0)
stats[row['AI']].setdefault('totp', 0)
stats[row['AI']].setdefault('totn', 0)
stats... | code_fim | medium | {
"lang": "python",
"repo": "warppoint42/Mahjong221",
"path": "/stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kucars/semantic_victim_localization path: /script/victim_detection_using_ssd_keras.py
#! /usr/bin/python
import rospy
import std_msgs.msg
import cv2
import keras
import tensorflow as tf
from keras.applications.imagenet_utils import preprocess_input
from keras.backend.tensorflow_backend import se... | code_fim | hard | {
"lang": "python",
"repo": "kucars/semantic_victim_localization",
"path": "/script/victim_detection_using_ssd_keras.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> top_conf = det_conf[top_indices]
top_label_indices = det_label[top_indices].tolist()
top_xmin = det_xmin[top_indices]
top_ymin = det_ymin[top_indices]
top_xmax = det_xmax[top_indices]
top_ymax = det_ymax[top_indices]
p... | code_fim | hard | {
"lang": "python",
"repo": "kucars/semantic_victim_localization",
"path": "/script/victim_detection_using_ssd_keras.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> top_label_indices = det_label[top_indices].tolist()
top_xmin = det_xmin[top_indices]
top_ymin = det_ymin[top_indices]
top_xmax = det_xmax[top_indices]
top_ymax = det_ymax[top_indices]
print(conf)
for i in range(top_conf.... | code_fim | hard | {
"lang": "python",
"repo": "kucars/semantic_victim_localization",
"path": "/script/victim_detection_using_ssd_keras.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if addl_env_vars is not None:
addl_env_vars.update(dict(os.environ))
for command in tools.get(args.tool).get("commands"):
# run all commands required to install the tool
# print each command being run
self.async_aler... | code_fim | hard | {
"lang": "python",
"repo": "hellor00t/recon-pipeline",
"path": "/recon-pipeline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hellor00t/recon-pipeline path: /recon-pipeline.py
#!/usr/bin/env python
# stdlib imports
import os
import sys
import shlex
import pickle
import selectors
import threading
import subprocess
import webbrowser
from pathlib import Path
# fix up the PYTHONPATH so we can simply execute the shell from ... | code_fim | hard | {
"lang": "python",
"repo": "hellor00t/recon-pipeline",
"path": "/recon-pipeline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _to_ranks_by_group(dat, group, formula, exclude_cols=[]):
"""
Covert predictors to ranks separately for each group for use in rank Lmer. Any columns not in the model formula or in exclude_cols will not be converted to ranks. Used by models.Lmer
Args:
dat (pd.DataFrame): dataframe... | code_fim | hard | {
"lang": "python",
"repo": "turbach/pymer4",
"path": "/pymer4/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: turbach/pymer4 path: /pymer4/utils.py
# Degrees of freedom adjustment to HC0
V = V * X.shape[0] / (X.shape[0] - X.shape[1])
elif robust_estimator == "hc2":
# Rather than dof correction, weight residuals by reciprocal of "leverage values" in the hat-matrix
... | code_fim | hard | {
"lang": "python",
"repo": "turbach/pymer4",
"path": "/pymer4/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return columns, index
def pandas2R(df):
"""Local conversion of pandas dataframe to R dataframe as recommended by rpy2"""
with localconverter(robjects.default_converter + pandas2ri.converter):
data = robjects.conversion.py2rpy(df)
return data
def result_to_table(
model,
... | code_fim | hard | {
"lang": "python",
"repo": "turbach/pymer4",
"path": "/pymer4/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async_describe_event(
DOMAIN, EVENT_AUTOMATION_TRIGGERED, async_describe_logbook_event
)<|fim_prefix|># repo: tchellomello/home-assistant path: /homeassistant/components/automation/logbook.py
"""Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME
from hom... | code_fim | hard | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/automation/logbook.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tchellomello/home-assistant path: /homeassistant/components/automation/logbook.py
"""Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME
from homeassistant.core import callback
<|fim_suffix|> @callback
def async_describe_logbook_event(event): # type: ign... | code_fim | medium | {
"lang": "python",
"repo": "tchellomello/home-assistant",
"path": "/homeassistant/components/automation/logbook.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kriztoper/deep-koalarization path: /colorization/training_utils.py
import pickle
import time
from os.path import join
import matplotlib
import numpy as np
import cv2
from skimage import color
from PIL import Image, ImageChops
import tensorboard
from tensorboard import summary as summary_lib
fr... | code_fim | hard | {
"lang": "python",
"repo": "Kriztoper/deep-koalarization",
"path": "/colorization/training_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def image_colorfulness(image):
# split the image into its respective RGB components
(B, G, R) = cv2.split(image.astype("float"))
# compute rg = R - G
rg = np.absolute(R - G)
# compute yb = 0.5 * (R + G) - B
yb = np.absolute(0.5 * (R + G) - B)
# compute the mean and standard ... | code_fim | hard | {
"lang": "python",
"repo": "Kriztoper/deep-koalarization",
"path": "/colorization/training_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rpranav22/Chatbot_Flask path: /TestCode.py
# Code that can be used for custom payload quick replies
response = {}
response["payload"] = {
"google": {
"expectUserResponse": "true",
"richResponse": {
"items": [
... | code_fim | hard | {
"lang": "python",
"repo": "rpranav22/Chatbot_Flask",
"path": "/TestCode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Using card in fulfillmentMessages
card = {
"card": {
"title": "card title",
"subtitle": "card text",
"imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
"buttons": [... | code_fim | hard | {
"lang": "python",
"repo": "rpranav22/Chatbot_Flask",
"path": "/TestCode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>UPLOAD_FOLDER = IMAGES_DIR
SECRET_KEY = os.environ.get("SECRET_KEY", "dev")<|fim_prefix|># repo: prajwalcr/AutoCompose path: /src/config.py
from dotenv import load_dotenv
import os
load_dotenv(".env")
<|fim_middle|>IMAGES_DIR = os.path.join('../static', 'images')
| code_fim | easy | {
"lang": "python",
"repo": "prajwalcr/AutoCompose",
"path": "/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prajwalcr/AutoCompose path: /src/config.py
from dotenv import load_dotenv
import os
load_dotenv(".env")
<|fim_suffix|>UPLOAD_FOLDER = IMAGES_DIR
SECRET_KEY = os.environ.get("SECRET_KEY", "dev")<|fim_middle|>IMAGES_DIR = os.path.join('../static', 'images')
| code_fim | easy | {
"lang": "python",
"repo": "prajwalcr/AutoCompose",
"path": "/src/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>IMAGES_DIR = os.path.join('../static', 'images')
UPLOAD_FOLDER = IMAGES_DIR
SECRET_KEY = os.environ.get("SECRET_KEY", "dev")<|fim_prefix|># repo: prajwalcr/AutoCompose path: /src/config.py
from dotenv import load_dotenv
import os
<|fim_middle|>load_dotenv(".env")
| code_fim | easy | {
"lang": "python",
"repo": "prajwalcr/AutoCompose",
"path": "/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for key in self.pre_conf_dict.keys():
if self.pre_conf_dict[key][0] == 'tenant':
for tenant in self.post_conf_dict.keys():
if len(tenant) == 32:
for vm in self.post_conf_dict[tenant]:
index = self._... | code_fim | hard | {
"lang": "python",
"repo": "abochkarev/CloudFerry",
"path": "/devlab/tests/test_group_verification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abochkarev/CloudFerry path: /devlab/tests/test_group_verification.py
# Copyright (c) 2015 Mirantis Inc.
#
# 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.apa... | code_fim | hard | {
"lang": "python",
"repo": "abochkarev/CloudFerry",
"path": "/devlab/tests/test_group_verification.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def network_verification_scenario(self, verify_vm_state=False):
neutron = self.src_cloud.neutronclient
for key in self.pre_conf_dict.keys():
if self.pre_conf_dict[key][0] == 'network':
user_defined_groups_list = self.pre_conf_dict.keys()
for ... | code_fim | hard | {
"lang": "python",
"repo": "abochkarev/CloudFerry",
"path": "/devlab/tests/test_group_verification.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _set_client(self, client):
self.client = client
def onConnect(self, *args, **kw):
d = self.factory.store.create_client(self.on_publish)
return d.addCallback(self._set_client)
def onClose(self, wasClea, code, reason):
if self.client is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "praekelt/echidna",
"path": "/echidna/server.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: praekelt/echidna path: /echidna/server.py
"""hedley marker"""
import json
import datetime
from twisted.web.resource import Resource
from twisted.web import server
from twisted.internet import defer, reactor
from twisted.python import log
from autobahn.twisted.websocket import (WebSocketServerFa... | code_fim | hard | {
"lang": "python",
"repo": "praekelt/echidna",
"path": "/echidna/server.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class SubscriptionProtocol(WebSocketServerProtocol):
def __init__(self):
# WebSocketServerProtocol.__init__(self)
self.client = None
def _set_client(self, client):
self.client = client
def onConnect(self, *args, **kw):
d = self.factory.store.create_client(se... | code_fim | hard | {
"lang": "python",
"repo": "praekelt/echidna",
"path": "/echidna/server.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.c += 1
return tuple_[0] + self.v,
@spl.map()
class M2(object):
def __init__(self, v):
self.c = 0
self.v = v
def __call__(self, *tuple_):
self.c += 1
return tuple_[0] + self.v,
def __getstate__(self):
return {'c': ... | code_fim | medium | {
"lang": "python",
"repo": "IBMStreams/streamsx.topology",
"path": "/test/python/spl/tests/ops_dill.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IBMStreams/streamsx.topology path: /test/python/spl/tests/ops_dill.py
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2018
from streamsx.spl import spl
@spl.filter()
class F1(object):
def __init__(self, v):
self.c = 0
self.v = v
def __call__(s... | code_fim | hard | {
"lang": "python",
"repo": "IBMStreams/streamsx.topology",
"path": "/test/python/spl/tests/ops_dill.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Inverse check; succeeds only if the given check fails.
"""
def __init__(self, name, check, with_error=None):
Service.__init__(self, name)
self._check = check
self._with_error = set()
for error in with_error:
if isinstance(error, basestring):
... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/timyd",
"path": "/timyd/checks/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pombredanne/timyd path: /timyd/checks/utils.py
from timyd import Service, CheckFailure
class InvertedCheckPassed(CheckFailure):
pass
class InvertedCheckUnexpectedError(CheckFailure):
def __init__(self, error):
self._error = error
def __str__(self):
return str(self... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/timyd",
"path": "/timyd/checks/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Service.__init__(self, name)
self._check = check
self._with_error = set()
for error in with_error:
if isinstance(error, basestring):
self._with_error.add(error)
elif isinstance(error, type) and issubclass(error, Exception):
... | code_fim | hard | {
"lang": "python",
"repo": "pombredanne/timyd",
"path": "/timyd/checks/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gusibi/py-realtime-sdk path: /realtime/bind.py
#! -*- coding: utf-8 -*-
import re
import hmac
import six
from six.moves.urllib.parse import quote
from .oauth2 import OAuth2Request
from .json_import import json
re_path_template = re.compile('{\w+}')
def encode_string(value):
return valu... | code_fim | hard | {
"lang": "python",
"repo": "gusibi/py-realtime-sdk",
"path": "/realtime/bind.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.api = api
self.return_json = kwargs.pop('return_json', True)
self.parameters = {}
self._build_parameters(args, kwargs)
self._build_path()
def _build_parameters(self, args, kwargs):
for index, value in enumerate(args):
... | code_fim | hard | {
"lang": "python",
"repo": "gusibi/py-realtime-sdk",
"path": "/realtime/bind.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dcragusa/LeetCode path: /100-199/140-149/145.py
"""
Given the root of a binary tree, return the postorder traversal of its nodes' values.
Example 1:
Input: root = [1, None, 2, 3], Output: [3, 2, 1]
1
\
2
/
3
Example 2:
Input: root = [], Output: []
Example 3:
Input: root = [... | code_fim | hard | {
"lang": "python",
"repo": "dcragusa/LeetCode",
"path": "/100-199/140-149/145.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
assert postorder_traversal(list_to_tree([1, None, 2, 3])) == [3, 2, 1]
assert postorder_traversal(list_to_tree([])) == []
assert postorder_traversal(list_to_tree([1])) == [1]
assert postorder_traversal(list_to_tree([1, 2])) == [2, 1]
assert postorder_traversal(list_to_tree([1, None, 2])) == [2, 1]<|fim_p... | code_fim | medium | {
"lang": "python",
"repo": "dcragusa/LeetCode",
"path": "/100-199/140-149/145.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> helper(root)
return results
assert postorder_traversal(list_to_tree([1, None, 2, 3])) == [3, 2, 1]
assert postorder_traversal(list_to_tree([])) == []
assert postorder_traversal(list_to_tree([1])) == [1]
assert postorder_traversal(list_to_tree([1, 2])) == [2, 1]
assert postorder_traversal(list_to... | code_fim | hard | {
"lang": "python",
"repo": "dcragusa/LeetCode",
"path": "/100-199/140-149/145.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.name
class Interview(models.Model):
"""
Model for uploading interviews with experts or students.
The interview model only has fields for interviewee, date, and interviewer.
Responses are stored in the Excerpt model which has a many-to-one relationship
with the Inte... | code_fim | hard | {
"lang": "python",
"repo": "kevincwebb/conceptum",
"path": "/conceptum/interviews/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = models.TextField()
#Concept Tag (doesn't exist, entered by interviewer) +
#Text Justification(response) + ability level ranking + importance ranking +
#Interviewee + topic tag (can be multiple)
class ConceptExcerpt(models.Model):
interview = models.ForeignKey(Interview)
re... | code_fim | hard | {
"lang": "python",
"repo": "kevincwebb/conceptum",
"path": "/conceptum/interviews/models.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevincwebb/conceptum path: /conceptum/interviews/models.py
from django.conf import settings
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
class DummyConcept(mode... | code_fim | hard | {
"lang": "python",
"repo": "kevincwebb/conceptum",
"path": "/conceptum/interviews/models.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.score.difference
@property
def score_ratio(self) -> float:
return self.score.ratio
def __eq__(self, other: object) -> bool:
if not isinstance(other, StandingsEntry):
return False
if self.points != other.points:
ret... | code_fim | hard | {
"lang": "python",
"repo": "Jardo72/AWS-Sandbox",
"path": "/S3-Notifications-Lambda/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jardo72/AWS-Sandbox path: /S3-Notifications-Lambda/model.py
#
# Copyright 2021 Jaroslav Chmurny
#
# This file is part of AWS Sandbox.
#
# AWS Sandbox is free software developed for educational purposes. It
# is licensed under the Apache License, Version 2.0 (the "License");
# you may not u... | code_fim | hard | {
"lang": "python",
"repo": "Jardo72/AWS-Sandbox",
"path": "/S3-Notifications-Lambda/model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def score_ratio(self) -> float:
return self.score.ratio
def __eq__(self, other: object) -> bool:
if not isinstance(other, StandingsEntry):
return False
if self.points != other.points:
return False
if self.score_differe... | code_fim | hard | {
"lang": "python",
"repo": "Jardo72/AWS-Sandbox",
"path": "/S3-Notifications-Lambda/model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._ssh_quiet(self.rsync_to_command(flags, src_dir, dest_dir))
def create_file(self, path, contents):
tmp = tempfile.NamedTemporaryFile(delete=False)
local_name = tmp.name
tmp.write(contents)
tmp.close()
self.scp_to(local_name, path)
os... | code_fim | hard | {
"lang": "python",
"repo": "xvrl/ducktape",
"path": "/ducktape/cluster/remoteaccount.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Check if output is available and possibly wait until the availability is known.
1) If there is output available, return true
2) If there is no output available (i.e. EOF), return false
3) If it is unknown whether output is available
- If timeout_sec is not spe... | code_fim | hard | {
"lang": "python",
"repo": "xvrl/ducktape",
"path": "/ducktape/cluster/remoteaccount.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xvrl/ducktape path: /ducktape/cluster/remoteaccount.py
# Copyright 2014 Confluent Inc.
#
# 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/license... | code_fim | hard | {
"lang": "python",
"repo": "xvrl/ducktape",
"path": "/ducktape/cluster/remoteaccount.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # promethues metrics
global rateReq
global rateLat
global e2eRateLat
# update req counter
rateReq.inc()
# parse request
data = json.loads(request.text())
video_id = data['video']
user_id = data['user']
comment = data['comment']
score = data['score']
send... | code_fim | hard | {
"lang": "python",
"repo": "delimitrou/DeathStarBench",
"path": "/daprApps_v1/video-sharing/video-frontend/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: delimitrou/DeathStarBench path: /daprApps_v1/video-sharing/video-frontend/server.py
buckets=pyutil.latBuckets()
)
rateLat = prometheus_client.Histogram(
'video_frontend_rate_lat_hist',
'Latency (ms) histogram of video-frontend rate requests',
buckets=pyutil.latBuckets()
)
getRateLat ... | code_fim | hard | {
"lang": "python",
"repo": "delimitrou/DeathStarBench",
"path": "/daprApps_v1/video-sharing/video-frontend/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: delimitrou/DeathStarBench path: /daprApps_v1/video-sharing/video-frontend/server.py
str(util_path))
import pyutil
warnings.filterwarnings("ignore")
# global variables
serviceAddress = int(os.getenv('ADDRESS', '5005'))
promAddress = int(os.getenv('PROM_ADDRESS', '8084'))
videoPubsub = os.ge... | code_fim | hard | {
"lang": "python",
"repo": "delimitrou/DeathStarBench",
"path": "/daprApps_v1/video-sharing/video-frontend/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linkml/schema-automator path: /schema_automator/generalizers/generalizer.py
from abc import ABC
from collections.abc import Collection, Set
from dataclasses import dataclass, field
from typing import List
import inflect
from linkml_runtime.linkml_model import SchemaDefinition, Prefix
DEFAULT_CL... | code_fim | hard | {
"lang": "python",
"repo": "linkml/schema-automator",
"path": "/schema_automator/generalizers/generalizer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_additional_info(self, schema: SchemaDefinition) -> None:
for s in self.identifier_slots:
schema.slots[s].identifier = True<|fim_prefix|># repo: linkml/schema-automator path: /schema_automator/generalizers/generalizer.py
from abc import ABC
from collections.abc import Colle... | code_fim | hard | {
"lang": "python",
"repo": "linkml/schema-automator",
"path": "/schema_automator/generalizers/generalizer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dquail/GVFMinecraft path: /python/CreateModel.py
from builtins import range
import MalmoPython
import os
import sys
import time
import numpy as np
import json
import pickle
import cv2
from PIL import ImageTk
from PIL import Image
from constants import *
from simpleMission import *
if sys.versio... | code_fim | hard | {
"lang": "python",
"repo": "dquail/GVFMinecraft",
"path": "/python/CreateModel.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def updateStateDictionaryWithState(self, state):
print("Creating grid object from state.")
#Get the object from dictionary for given x,y
if state.number_of_observations_since_last_state > 0:
for observation in state.observations:
msg = observation.text
obs = json.loads... | code_fim | hard | {
"lang": "python",
"repo": "dquail/GVFMinecraft",
"path": "/python/CreateModel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ltiao/bore-experiments path: /bin/drivers/sequential/run_tpe.py
import sys
import click
import yaml
from hyperopt import fmin, tpe, STATUS_OK, Trials
from pathlib import Path
from bore_experiments.benchmarks import make_benchmark
from bore_experiments.utils import make_name, HyperOptLogs
@cli... | code_fim | hard | {
"lang": "python",
"repo": "ltiao/bore-experiments",
"path": "/bin/drivers/sequential/run_tpe.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> trials = Trials()
best = fmin(objective,
space=space,
algo=tpe.suggest,
max_evals=num_iterations,
trials=trials)
data = HyperOptLogs(trials).to_frame()
data.to_csv(output_path.joinpath(f"{run_i... | code_fim | medium | {
"lang": "python",
"repo": "ltiao/bore-experiments",
"path": "/bin/drivers/sequential/run_tpe.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Simple decorator to show whether or not a user is a
valid member of Online.
"""
def check_membership(request, *args, **kwargs):
if request.user.is_member:
return view_func(request, *args, **kwargs)
# Raise 403 error if user does not have access
... | code_fim | easy | {
"lang": "python",
"repo": "frecar/onlineweb4",
"path": "/apps/authentication/decorators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frecar/onlineweb4 path: /apps/authentication/decorators.py
# -*- coding: utf-8 -*-
from middleware.http import Http403
<|fim_suffix|> """
Simple decorator to show whether or not a user is a
valid member of Online.
"""
def check_membership(request, *args, **kwargs):
i... | code_fim | easy | {
"lang": "python",
"repo": "frecar/onlineweb4",
"path": "/apps/authentication/decorators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.name = "WASHTUBS"
self.definitions = washtub
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['washtub']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_washtubs.py
#calss header
class _WASHTUBS():
<|fim_middle|> def... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_washtubs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_washtubs.py
#calss header
class _WASHTUBS():
<|fim_suffix|> self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['washtub']<|fim_middle|> def __init__(self,):
self.name = "WASHTUBS"
self.defi... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_washtubs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>mple.midi", tempo=100, beats_per_chord=2, instrument=4))
prog.to_pdf(filename="example.pdf")<|fim_prefix|># repo: jonathangjertsen/jchord path: /examples/basic.py
# fmt: off
from jchord import ChordProgression, MidiConversionSettings
prog = ChordProgression.from_string("C -- Fm7 -- C -- G7 -- C -- E... | code_fim | medium | {
"lang": "python",
"repo": "jonathangjertsen/jchord",
"path": "/examples/basic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>og.transpose(+2)
print(prog.to_string())
prog.to_midi(MidiConversionSettings(filename="example.midi", tempo=100, beats_per_chord=2, instrument=4))
prog.to_pdf(filename="example.pdf")<|fim_prefix|># repo: jonathangjertsen/jchord path: /examples/basic.py
# fmt: off
from jchord import ChordProgression, ... | code_fim | medium | {
"lang": "python",
"repo": "jonathangjertsen/jchord",
"path": "/examples/basic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jonathangjertsen/jchord path: /examples/basic.py
# fmt: off
from jchord import ChordProgression, MidiConversionSettings
prog = ChordProgr<|fim_suffix|>mple.midi", tempo=100, beats_per_chord=2, instrument=4))
prog.to_pdf(filename="example.pdf")<|fim_middle|>ession.from_string("C -- Fm7 -- C -... | code_fim | medium | {
"lang": "python",
"repo": "jonathangjertsen/jchord",
"path": "/examples/basic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = dao_get_user_by_id(user_id)
return jsonify(user.serialize()), 200
@user_blueprint.errorhandler(IntegrityError)
def handle_integrity_error(exc):
"""
Handle integrity errors caused by the unique constraint on users_email_key
"""
if 'users_email_key' in str(exc):
ret... | code_fim | hard | {
"lang": "python",
"repo": "NewAcropolis/api",
"path": "/app/routes/users/rest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NewAcropolis/api path: /app/routes/users/rest.py
import werkzeug
werkzeug.cached_property = werkzeug.utils.cached_property
from flask import (
Blueprint,
current_app,
jsonify,
request
)
from flask_jwt_extended import jwt_required
from sqlalchemy.exc import IntegrityError
from ap... | code_fim | hard | {
"lang": "python",
"repo": "NewAcropolis/api",
"path": "/app/routes/users/rest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liaoweixia/SimpleChinese2 path: /simplechinese/__init__.py
from . import preprocessing
from .preprocessing import *
<|fim_suffix|># from . import synonyms
# from .synonyms import *
__version__ = "0.2.11"<|fim_middle|>from . import representation
from .representation import *
from . import visu... | code_fim | hard | {
"lang": "python",
"repo": "liaoweixia/SimpleChinese2",
"path": "/simplechinese/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from . import conversion
from .conversion import *
from . import pinyin
from .pinyin import *
# from . import synonyms
# from .synonyms import *
__version__ = "0.2.11"<|fim_prefix|># repo: liaoweixia/SimpleChinese2 path: /simplechinese/__init__.py
from . import preprocessing
from .preprocessing import... | code_fim | easy | {
"lang": "python",
"repo": "liaoweixia/SimpleChinese2",
"path": "/simplechinese/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from . import pinyin
from .pinyin import *
# from . import synonyms
# from .synonyms import *
__version__ = "0.2.11"<|fim_prefix|># repo: liaoweixia/SimpleChinese2 path: /simplechinese/__init__.py
from . import preprocessing
from .preprocessing import *
from . import representation
from .representatio... | code_fim | easy | {
"lang": "python",
"repo": "liaoweixia/SimpleChinese2",
"path": "/simplechinese/__init__.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.