text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> sequence_key (str): If ``input`` is a list of Sequence objects or dicts, this key will be
used to find the sequence. Default is ``vdj_nt``.
timepoints (str): Path to a Tab-delimited file, of the following format (one per line)::
TimepointName TimepointOrder... | code_fim | hard | {
"lang": "python",
"repo": "menis/abtools",
"path": "/abtools/_phylogeny.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tate, self.params["cutset_masks"])
#
# system_states_owner_only.append(p_sys_state)
#
# # chosen_owner_state = self.filter_chosen_owner_state(o_state, self.params["s_groups"], self.params["s_idx_by_c"])
# # ab.append(sys_state and not np.all(chosen_owner_state))
# ... | code_fim | hard | {
"lang": "python",
"repo": "tkieras/iscram",
"path": "/iscram/domain/metrics/simulation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tkieras/iscram path: /iscram/domain/metrics/simulation.py
## Placeholder code, copied from old version
# import numpy as np
# from multiprocessing import Pool
#
# def simulate(choice_problem, system_model, report, threads, trials):
# pool = Pool(threads)
#
# params = setup_simulation(cho... | code_fim | hard | {
"lang": "python",
"repo": "tkieras/iscram",
"path": "/iscram/domain/metrics/simulation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googleapis/python-aiplatform path: /google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py
rate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pas... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/python-aiplatform",
"path": "/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Updates the parameters of a single EntityType.
Returns:
Callable[[~.UpdateEntityTypeRequest],
Awaitable[~.EntityType]]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate ... | code_fim | hard | {
"lang": "python",
"repo": "googleapis/python-aiplatform",
"path": "/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('contacts', '0044_auto_20200414_0458'),
]
operations = [
migrations.AddField(
model_name='client',
name='initial_approach_date',
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "hanztura/hrsalespipes",
"path": "/hrsalespipes/contacts/migrations/0045_auto_20200430_0400.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hanztura/hrsalespipes path: /hrsalespipes/contacts/migrations/0045_auto_20200430_0400.py
# Generated by Django 2.2.10 on 2020-04-30 04:00
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('contacts', '0044_auto_20200414_0458'),
]
operations = [
... | code_fim | medium | {
"lang": "python",
"repo": "hanztura/hrsalespipes",
"path": "/hrsalespipes/contacts/migrations/0045_auto_20200430_0400.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ryanwersal/crosswind path: /fixer_suites/three_to_two/fixes/fix_methodattrs.py
"""
Fixer for method.__X__ -> method.im_X
"""
from crosswind import fixer_base
from crosswind.fixer_util import Name
MAP = {
"__func__": "im_func",
"__self__": "im_self"
# Fortunately, im_self.__class__ ... | code_fim | medium | {
"lang": "python",
"repo": "ryanwersal/crosswind",
"path": "/fixer_suites/three_to_two/fixes/fix_methodattrs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def transform(self, node, results):
attr = results["attr"][0]
new = str(MAP[attr.value])
attr.replace(Name(new, prefix=attr.prefix))<|fim_prefix|># repo: ryanwersal/crosswind path: /fixer_suites/three_to_two/fixes/fix_methodattrs.py
"""
Fixer for method.__X__ -> method.im_X
""... | code_fim | hard | {
"lang": "python",
"repo": "ryanwersal/crosswind",
"path": "/fixer_suites/three_to_two/fixes/fix_methodattrs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sympy/sympy path: /sympy/codegen/numpy_nodes.py
from sympy.core.function import Add, ArgumentIndexError, Function
from sympy.core.power import Pow
from sympy.core.singleton import S
from sympy.core.sorting import default_sort_key
from sympy.functions.elementary.exponential import exp, log
def _... | code_fim | hard | {
"lang": "python",
"repo": "sympy/sympy",
"path": "/sympy/codegen/numpy_nodes.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _eval_evalf(self, *args, **kwargs):
return self.rewrite(log).evalf(*args, **kwargs)
def _eval_simplify(self, *args, **kwargs):
a, b = (x.simplify(**kwargs).factor() for x in self.args)
candidate = _logaddexp2(a, b)
if candidate != _logaddexp2(a, b, evaluate=Fal... | code_fim | hard | {
"lang": "python",
"repo": "sympy/sympy",
"path": "/sympy/codegen/numpy_nodes.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.seteuid(self._preserved_uid)
os.setegid(self._preserved_gid)<|fim_prefix|># repo: simhaonline/cloud path: /api/v1/utilities/su.py
import os
class Guard:
_preserved_uid: int
_preserved_gid: int
_uid: int
_gid: int
def __init__(self, uid: int, gid: int):
#... | code_fim | medium | {
"lang": "python",
"repo": "simhaonline/cloud",
"path": "/api/v1/utilities/su.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _preserve_ids(self):
self._preserved_uid = os.geteuid()
self._preserved_gid = os.getegid()
def __enter__(self):
self._preserve_ids()
os.setegid(self._gid)
os.seteuid(self._uid)
def __exit__(self ,type, value, traceback):
os.seteuid(self._pr... | code_fim | medium | {
"lang": "python",
"repo": "simhaonline/cloud",
"path": "/api/v1/utilities/su.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simhaonline/cloud path: /api/v1/utilities/su.py
import os
class Guard:
_preserved_uid: int
_preserved_gid: int
_uid: int
_gid: int
<|fim_suffix|> os.seteuid(self._preserved_uid)
os.setegid(self._preserved_gid)<|fim_middle|>
def __init__(self, uid: int, gid: i... | code_fim | hard | {
"lang": "python",
"repo": "simhaonline/cloud",
"path": "/api/v1/utilities/su.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: katomaso/django-market path: /market/core/urls.py
# coding: utf-8
import re
from django.utils.translation import gettext as _
from market.core import menu
from market.core.views import base, admin
from urljects import U, end, slug, url
apis = []
def api(regex, view, kwargs=None, name=None):
... | code_fim | hard | {
"lang": "python",
"repo": "katomaso/django-market",
"path": "/market/core/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ManufacturersMenu(menu.MenuItem):
title = _("Manufacturers")
url_name = 'manufacturers'
url_kwargs = {'format': 'html'}
def is_selected(self, name):
return re.match(name, 'manufacturer.*') is not None
def is_active(self, name):
return True
menu.private.add_it... | code_fim | hard | {
"lang": "python",
"repo": "katomaso/django-market",
"path": "/market/core/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: salaun-urennes1/emmanuel-benoit-libPythonBssApi path: /lib_Partage_BSS/services/GlobalService.py
# -*-coding:utf-8 -*
"""
Module général regroupant les méthodes communes des différents services
"""
from lib_Partage_BSS import utils
from lib_Partage_BSS.exceptions import NameException
from lib_Par... | code_fim | medium | {
"lang": "python",
"repo": "salaun-urennes1/emmanuel-benoit-libPythonBssApi",
"path": "/lib_Partage_BSS/services/GlobalService.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Méthode permettant d'appeler une méthode de l'API BSS
:param domain: le nom de domaine
:param methodName: le nom de la méthode à appeler
:param data: le body de la requête
:return: la réponse reçue de l'API BSS
:raises ServiceException: Exception levée si la requête vers l... | code_fim | hard | {
"lang": "python",
"repo": "salaun-urennes1/emmanuel-benoit-libPythonBssApi",
"path": "/lib_Partage_BSS/services/GlobalService.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kshahnazari1998/SociaGrow-Public path: /2_Scraper-Scripts/CookieCreator.py
import itertools
from selenium import webdriver
from explicit import waiter, XPATH
import time
import random
import pickle
import re
import requests
import traceback
<|fim_suffix|>driver=webdriver.Chrome("chrome... | code_fim | medium | {
"lang": "python",
"repo": "kshahnazari1998/SociaGrow-Public",
"path": "/2_Scraper-Scripts/CookieCreator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
inp = input()
if inp.strip().lower() == 'done':
pickle.dump(driver.get_cookies(), open(cookiename + ".txt", "wb"))
break<|fim_prefix|># repo: kshahnazari1998/SociaGrow-Public path: /2_Scraper-Scripts/CookieCreator.py
import itertools
from selenium import webdriver... | code_fim | medium | {
"lang": "python",
"repo": "kshahnazari1998/SociaGrow-Public",
"path": "/2_Scraper-Scripts/CookieCreator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Find the output shape
if ary.ndim == 1:
shape = []
else:
shape = tuple(s for i, s in enumerate(ary.shape) if i != axis)
if out is not None and out.shape != shape:
raise ValueError("output dimension mi... | code_fim | hard | {
"lang": "python",
"repo": "bh107/bohrium",
"path": "/bridge/npbackend/bohrium/ufuncs.pyx",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bh107/bohrium path: /bridge/npbackend/bohrium/ufuncs.pyx
= None
if len(args) == self.info['nop']:
out = args.pop()
if out_shape != out.shape:
raise ValueError("non-broadcastable output operand with shape %s "
"doesn'... | code_fim | hard | {
"lang": "python",
"repo": "bh107/bohrium",
"path": "/bridge/npbackend/bohrium/ufuncs.pyx",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bh107/bohrium path: /bridge/npbackend/bohrium/ufuncs.pyx
the inputs.
:param Mixed out: Array in the role of being written to.
:param Mixed inputs: Arrays in the role being read from.
:returns: True in case of conflict.
:rtype: bool
"""
from . import _bh
for i in in... | code_fim | hard | {
"lang": "python",
"repo": "bh107/bohrium",
"path": "/bridge/npbackend/bohrium/ufuncs.pyx",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apoorvkk/LeetCodeSolutions path: /problems/long_pressed_name.py
class Solution:
def isLongPressedName(self, name, typed):
"""
:type name: str
:type typed: str
:rtype: bool
<|fim_suffix|> for j in range(len(typed)):
if typed[j] == nam... | code_fim | hard | {
"lang": "python",
"repo": "apoorvkk/LeetCodeSolutions",
"path": "/problems/long_pressed_name.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for j in range(len(typed)):
if typed[j] == name[next_letter]:
next_letter += 1
if next_letter == len(name):
break
return not next_letter < len(name)<|fim_prefix|># repo: apoorvkk/LeetCodeSolutions path: /pro... | code_fim | hard | {
"lang": "python",
"repo": "apoorvkk/LeetCodeSolutions",
"path": "/problems/long_pressed_name.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create a KNN and test the accuracy
knclassifier = KNeighborsClassifier(n_neighbors=5, weights='distance')
knclassifier.fit(X_train, y_train)
predicted = knclassifier.predict(X_test)
f1score = f1_score(y_test, predicted)
accuracy = accuracy_score(y_test, predicted)
print(f"f1 ... | code_fim | hard | {
"lang": "python",
"repo": "bhattacharjee/mtu-sem1-assignments",
"path": "/lab/TreeBasedFeatureSelection/prog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhattacharjee/mtu-sem1-assignments path: /lab/TreeBasedFeatureSelection/prog.py
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighbors... | code_fim | medium | {
"lang": "python",
"repo": "bhattacharjee/mtu-sem1-assignments",
"path": "/lab/TreeBasedFeatureSelection/prog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def Yfuncs(labels):
def getFeature(data, f):
d = [x[labels[f]] for x in data]
prev = None
out = []
for x in d:
if prev is not None:
out.append(x - prev)
prev = x
re... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/deprecated/learning/deltas/features.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmarNathH/software path: /deprecated/learning/deltas/features.py
from learning import features
class Features(features.Features):
def Xfeatures(self, data):
<|fim_suffix|> @staticmethod
def Yfuncs(labels):
def getFeature(data, f):
d = [x[labels[f]] for x in data]
... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/deprecated/learning/deltas/features.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return data[:-1]
@staticmethod
def Yfuncs(labels):
def getFeature(data, f):
d = [x[labels[f]] for x in data]
prev = None
out = []
for x in d:
if prev is not None:
out.append(x - prev)
... | code_fim | hard | {
"lang": "python",
"repo": "AmarNathH/software",
"path": "/deprecated/learning/deltas/features.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rushilsrivastava/flask-react-spa path: /backend/blog/models/series_tag.py
from backend.database import (
BaseModel,
foreign_key,
relationship,
)
<|fim_suffix|> """Join table between Series and Tag"""
series_id = foreign_key('Series', primary_key=True)
series = relationshi... | code_fim | medium | {
"lang": "python",
"repo": "rushilsrivastava/flask-react-spa",
"path": "/backend/blog/models/series_tag.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(**kwargs)
if series:
self.series = series
if tag:
self.tag = tag<|fim_prefix|># repo: rushilsrivastava/flask-react-spa path: /backend/blog/models/series_tag.py
from backend.database import (
BaseModel,
foreign_key,
relationship,... | code_fim | medium | {
"lang": "python",
"repo": "rushilsrivastava/flask-react-spa",
"path": "/backend/blog/models/series_tag.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JorgeCupi/CNTKSamples path: /python/CNTK101/02_ComparingTensors/app.py
import cntk
A = [1, 3, 4]
B = [4, 3, 2]
print("less(A,B):")
less = cntk.less(A,B).eval()
print("{}\n".format(less))
print("equal(A,B):")
equal = cntk.equal(A,B).eval()
print("{}\n".format(equal))
<|fim_suffix|>print("not_eq... | code_fim | hard | {
"lang": "python",
"repo": "JorgeCupi/CNTKSamples",
"path": "/python/CNTK101/02_ComparingTensors/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("not_equal(A,B):")
not_equal = cntk.not_equal(A,B).eval()
print("{}\n".format(not_equal))
print("less_equal(A,B):")
less_equal = cntk.less_equal(A,B).eval()
print("{}\n".format(less_equal))<|fim_prefix|># repo: JorgeCupi/CNTKSamples path: /python/CNTK101/02_ComparingTensors/app.py
import cntk
A = ... | code_fim | hard | {
"lang": "python",
"repo": "JorgeCupi/CNTKSamples",
"path": "/python/CNTK101/02_ComparingTensors/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrCsabaToth/coderpad path: /cci_1_7.py
def rotate_m(m):
if not m:
return m
n = len(m)
if len(m[0]) != n:
return None
print(m)
for i in range((n + 1) // 2):
for j in range(i, n - i - 1):
tmp = m[j][n - i - 1]
m[j][n - i - 1] = m... | code_fim | hard | {
"lang": "python",
"repo": "MrCsabaToth/coderpad",
"path": "/cci_1_7.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> rotate_m(matrix)
n = len(matrix)
for i in range(n):
for j in range(n):
print(i, j)
assert matrix[i][j] == expected[i][j]
pytest.main()<|fim_prefix|># repo: MrCsabaToth/coderpad path: /cci_1_7.py
def rotate_m(m):
if not m:
return m
n = len(m)
... | code_fim | medium | {
"lang": "python",
"repo": "MrCsabaToth/coderpad",
"path": "/cci_1_7.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: t2kasa/ml_miscs path: /examples/svm/smo_scratch/svc_smo_example.py
from argparse import ArgumentParser
import matplotlib.pyplot as plt
from examples.svm.smo_scratch.get_toy_data import get_toy_data
from svm.svc import SVC
from svm.vis_decision_boundary_2d import vis_decision_boundary_2d
<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "t2kasa/ml_miscs",
"path": "/examples/svm/smo_scratch/svc_smo_example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x_train, y_train = get_toy_data(
n_features=args.n_features,
n_samples_per_label=args.n_samples_per_label,
seed=args.seed)
clf = SVC(args.C, args.kernel, args.gamma)
clf.fit(x_train, y_train)
if args.n_features == 2:
ax = vis_decision_boundary_2d(clf)
... | code_fim | hard | {
"lang": "python",
"repo": "t2kasa/ml_miscs",
"path": "/examples/svm/smo_scratch/svc_smo_example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_setup_ipmi, mock_fork_serve, mock_parse):
mock_logs.return_value = 'LOG'
mock_callback.return_value = {'ipmi_setup_credentials': True}
main.main()
mock_discover.assert_called_once_with(FAKE_ARGS, mock.ANY, mock.ANY)
mock_logs.assert_ca... | code_fim | hard | {
"lang": "python",
"repo": "rdo-management/ironic-discoverd",
"path": "/ironic_discoverd_ramdisk/test/test_main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdo-management/ironic-discoverd path: /ironic_discoverd_ramdisk/test/test_main.py
# 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/LI... | code_fim | hard | {
"lang": "python",
"repo": "rdo-management/ironic-discoverd",
"path": "/ironic_discoverd_ramdisk/test/test_main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jaimersoncorreia/python_zumbi path: /01-basico/04-imprimindo.py
a = 42
print('O número é ', a)
print('O número', a, 'é muito lega<|fim_suffix|>
c = 3.1415
print('Pi é %f' %c)
print('Pi com duas casas %.2f' %c)<|fim_middle|>l')
print('O número %d é muito legal' %a)#mardadores
b = 'abacate'
print('... | code_fim | medium | {
"lang": "python",
"repo": "jaimersoncorreia/python_zumbi",
"path": "/01-basico/04-imprimindo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
c = 3.1415
print('Pi é %f' %c)
print('Pi com duas casas %.2f' %c)<|fim_prefix|># repo: jaimersoncorreia/python_zumbi path: /01-basico/04-imprimindo.py
a = 42
print('O número é ', a)
print('O número', a, 'é muito legal')
print('O número %d é muito legal' %a)#mardadores
b = 'abacate'<|fim_middle|>
print('... | code_fim | medium | {
"lang": "python",
"repo": "jaimersoncorreia/python_zumbi",
"path": "/01-basico/04-imprimindo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: susanow/ssnpy path: /susanow/vnf.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# MIT License
# Copyright (c) 2017 Susanow
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the... | code_fim | hard | {
"lang": "python",
"repo": "susanow/ssnpy",
"path": "/susanow/vnf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sync(self):
res = self._nfvi._get('/vnfs/' + self._vnfname)
if (res['result']['success']):
self._this = res['vnf']['blocks'][str(self._vnf_bid)]
else:
raise Exception('block not found {}'.format(self._name))
def name (self): return self._this... | code_fim | hard | {
"lang": "python",
"repo": "susanow/ssnpy",
"path": "/susanow/vnf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vvpwork/goit-python path: /lesson_8/hw_9.py
from datetime import datetime, timedelta
test_dict = [{
'name': 'John',
'birthday': datetime(year=2021, month=3, day=19)
}, {
'name': 'Greg',
'birthday': datetime(year=2021, month=3, day=17)
}, {
'name': 'Red',
'birthday': date... | code_fim | hard | {
"lang": "python",
"repo": "vvpwork/goit-python",
"path": "/lesson_8/hw_9.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def congratulate(users):
result = {}
for i in week_days:
result[i] = []
gap = find_date_gap()
for i in users:
name = i['name']
birthsday = i['birthday']
isNext = isNextWeek(birthsday, gap)
index = int(isNext)
if isNext:
result[wee... | code_fim | hard | {
"lang": "python",
"repo": "vvpwork/goit-python",
"path": "/lesson_8/hw_9.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> LOGGER.info("Goodbye.")
await self.client.logout()
def handle_signal(self) -> None:
asyncio.ensure_future(self.shutdown(), loop=self.client.loop)
def register_signals(self) -> None:
self.client.loop.add_signal_handler(signal.SIGTERM, self.handle_signal)
s... | code_fim | hard | {
"lang": "python",
"repo": "PJB3005/MoMMI",
"path": "/MoMMI/master.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PJB3005/MoMMI path: /MoMMI/master.py
# it gets temporarily stored in here,
# to prevent race conditions related to load order.
self.temp_module_handlers: List[MHandler] = []
# True if we're reloading modules right now.
self.reloading_modules = False
self... | code_fim | hard | {
"lang": "python",
"repo": "PJB3005/MoMMI",
"path": "/MoMMI/master.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PJB3005/MoMMI path: /MoMMI/master.py
ing.Logger = logging.getLogger("chat")
T = TypeVar("T")
# TODO: Reorganize this.
# All of it.
# Dear god.
class MoMMI(object):
if TYPE_CHECKING:
from MoMMI.handler import MHandler
from MoMMI.server import MServer
from MoMMI.chan... | code_fim | hard | {
"lang": "python",
"repo": "PJB3005/MoMMI",
"path": "/MoMMI/master.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = self.get_response(request)
return response<|fim_prefix|># repo: hackerspace-ntnu/website path: /website/middleware/remove_accept_language.py
class RemoveAcceptLanguageMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __c... | code_fim | medium | {
"lang": "python",
"repo": "hackerspace-ntnu/website",
"path": "/website/middleware/remove_accept_language.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hackerspace-ntnu/website path: /website/middleware/remove_accept_language.py
class RemoveAcceptLanguageMiddleware(object):
<|fim_suffix|> def __call__(self, request):
if "HTTP_ACCEPT_LANGUAGE" in request.META:
del request.META["HTTP_ACCEPT_LANGUAGE"]
response = sel... | code_fim | medium | {
"lang": "python",
"repo": "hackerspace-ntnu/website",
"path": "/website/middleware/remove_accept_language.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: divakar-lakhera/Certi-Automation path: /barLoader.py
import sys
sys.path.append(".")
import config as cfg
from PIL import Image
imp<|fim_suffix|>treepoem.generate_barcode(barcode_type='qrcode',data=dat,)
image = image.resize((260, 260))
image.convert('1').save(userConfig.outputFolder+"/"+... | code_fim | medium | {
"lang": "python",
"repo": "divakar-lakhera/Certi-Automation",
"path": "/barLoader.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>esize((260, 260))
image.convert('1').save(userConfig.outputFolder+"/"+fout)<|fim_prefix|># repo: divakar-lakhera/Certi-Automation path: /barLoader.py
import sys
sys.path.append(".")
import config as cfg
from PIL import Image
imp<|fim_middle|>ort treepoem
def buildQR(dat,fout):
userConfig = cfg.co... | code_fim | medium | {
"lang": "python",
"repo": "divakar-lakhera/Certi-Automation",
"path": "/barLoader.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'Înregistrare nouă',
'new record inserted': 'înregistrare nouă adăugată',
'New simple application': 'O nouă aplicație simplă',
'next': 'next',
'next %s rows': 'next %s rows',
'NO': 'NU',
'no changes': 'no changes',
'No databases in this application': 'Aplicație fără bază de date',
'No Interaction yet': '... | code_fim | hard | {
"lang": "python",
"repo": "operepo/smc",
"path": "/web2py/applications/admin/languages/ro.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>o your cloud instance. This assumes that you've already created the application instance using the web2py skeleton and have that repo somewhere on a filesystem that this web2py instance can access. This functionality requires GitPython installed and on the python path of the runtime that web2py is operati... | code_fim | hard | {
"lang": "python",
"repo": "operepo/smc",
"path": "/web2py/applications/admin/languages/ro.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: operepo/smc path: /web2py/applications/admin/languages/ro.py
cuting the controller, before any attempt to execute the doctests. This is usually due to an indentation error or an error outside function code.\nA green title indicates that all tests (if defined) passed. In this case test results are... | code_fim | hard | {
"lang": "python",
"repo": "operepo/smc",
"path": "/web2py/applications/admin/languages/ro.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for aluno in lista:
if aluno["idade"] > 13:
adolescentes.append(aluno)
totalAltura += aluno["altura"]
mediaAltura = totalAltura/len(lista)
abaixoMedia = 0
for aluno in adolescentes:
if aluno["altura"] < mediaAltura:
abaixoMedia += 1
print(f"{abaixoMedia} aluno(s) maior(es) de 13 anos tem altur... | code_fim | medium | {
"lang": "python",
"repo": "luan-gomes/python-basic-exercises",
"path": "/list/12.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"{abaixoMedia} aluno(s) maior(es) de 13 anos tem altura menor do que {mediaAltura:.2f}")<|fim_prefix|># repo: luan-gomes/python-basic-exercises path: /list/12.py
"""
Foram anotadas as idades e alturas de 30 alunos.
Faça um Programa que determine quantos alunos com mais de 13 anos
possuem altura ... | code_fim | medium | {
"lang": "python",
"repo": "luan-gomes/python-basic-exercises",
"path": "/list/12.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luan-gomes/python-basic-exercises path: /list/12.py
"""
Foram anotadas as idades e alturas de 30 alunos.
Faça um Programa que determine quantos alunos com mais de 13 anos
possuem altura inferior à média de altura desses alunos
"""
lista = [{"idade":13, "altura":1.6},{"idade":18, "altura":1.90}... | code_fim | medium | {
"lang": "python",
"repo": "luan-gomes/python-basic-exercises",
"path": "/list/12.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def escrever(idade=False):
print()
if idade is False:
meucursor.execute("SELECT * FROM registrados;")
rows = meucursor.fetchall()
for row in rows:
print(" -", end="")
for num, item in enumerate(row):
if num == 0:
... | code_fim | hard | {
"lang": "python",
"repo": "AthosFB/Exercicios-Python",
"path": "/ExercícioDoCurso/Ex115/meusql.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AthosFB/Exercicios-Python path: /ExercícioDoCurso/Ex115/meusql.py
import mysql.connector
cnx = mysql.connector.connect(user="root", password="", host="127.0.0.1")
meucursor = cnx.cursor()
from Ex113 import Leituras
def db():
meucursor.execute("create database if not exists cadastrados;")
... | code_fim | medium | {
"lang": "python",
"repo": "AthosFB/Exercicios-Python",
"path": "/ExercícioDoCurso/Ex115/meusql.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print()
if idade is False:
meucursor.execute("SELECT * FROM registrados;")
rows = meucursor.fetchall()
for row in rows:
print(" -", end="")
for num, item in enumerate(row):
if num == 0:
print(f"{item:<22}", end=" ... | code_fim | hard | {
"lang": "python",
"repo": "AthosFB/Exercicios-Python",
"path": "/ExercícioDoCurso/Ex115/meusql.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print('just right')
# expected output:
'''
just right
'''<|fim_prefix|># repo: brianchiang-tw/Introducing_Python path: /Ch_4_Py Crust_Code Structure/4_1.py
guess_me = 7
if guess_me < 7:
print('too low')
<|fim_middle|>elif guess_me > 7:
print('too high')
| code_fim | easy | {
"lang": "python",
"repo": "brianchiang-tw/Introducing_Python",
"path": "/Ch_4_Py Crust_Code Structure/4_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brianchiang-tw/Introducing_Python path: /Ch_4_Py Crust_Code Structure/4_1.py
guess_me = 7
if guess_me < 7:
print('too low')
elif guess_me > 7:
print('too high')
<|fim_suffix|># expected output:
'''
just right
'''<|fim_middle|>else:
print('just right')
| code_fim | easy | {
"lang": "python",
"repo": "brianchiang-tw/Introducing_Python",
"path": "/Ch_4_Py Crust_Code Structure/4_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># expected output:
'''
just right
'''<|fim_prefix|># repo: brianchiang-tw/Introducing_Python path: /Ch_4_Py Crust_Code Structure/4_1.py
guess_me = 7
if guess_me < 7:
print('too low')
elif guess_me > 7:
print('too high')
<|fim_middle|>else:
print('just right')
| code_fim | easy | {
"lang": "python",
"repo": "brianchiang-tw/Introducing_Python",
"path": "/Ch_4_Py Crust_Code Structure/4_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cunningr/yanccm path: /ncservice/configDb/configdb.py
import pymongo
import os
import logging
from lxml import etree
from difflib import context_diff
from ncservice.ncDeviceOps import helpers
MONGO_DB = os.environ['MONGO_DB']
logger = logging.getLogger('main.{}'.format(__name__))
extra = {'signa... | code_fim | hard | {
"lang": "python",
"repo": "cunningr/yanccm",
"path": "/ncservice/configDb/configdb.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> client = pymongo.MongoClient(MONGO_DB)
_diffs = {}
for device, config in device_configs.items():
result = client.configs.configs.find_one({"device": device})
if result is None:
print('No device config history found for {}. Try running with -... | code_fim | hard | {
"lang": "python",
"repo": "cunningr/yanccm",
"path": "/ncservice/configDb/configdb.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Read the config file
with open('config.json') as json_config_file:
confg = json.load(json_config_file)
stocks = confg["stocks"]
alert = confg["alerts"]
stockNames = '%22' + '%22,%22'.join(stocks) + '%22'
# Request stock prices for those stock symbols specified in the con... | code_fim | hard | {
"lang": "python",
"repo": "vibinash/stock_alerts",
"path": "/stock_alerts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vibinash/stock_alerts path: /stock_alerts.py
import json
from urllib2 import urlopen
import re
import smtplib
from email.mime.text import MIMEText
from datetime import datetime
confg = None
# Sends an email to alert for the requested stock symbol
def send_alert(symbol, price):
print 'Alert... | code_fim | medium | {
"lang": "python",
"repo": "vibinash/stock_alerts",
"path": "/stock_alerts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(self.data)
off = self.data['off']
on = self.data['on']
if(off==True):
return "offline"
elif(on==True):
return "online"
else:
return None
def close_window(self):
self.window.close()<|fim_prefix|>... | code_fim | medium | {
"lang": "python",
"repo": "lucasrennok/Tic_Tac_Toe",
"path": "/v2_with_GUI/menu_view.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucasrennok/Tic_Tac_Toe path: /v2_with_GUI/menu_view.py
#Imports
import PySimpleGUI as sg
class MenuScreen:
def __init__(self):
#layout
layout = [
[sg.Text('Tic Tac Toe Game')],
[sg.Radio('Offline', 'multiplayer', key='off', default=True), sg.Radio('On... | code_fim | medium | {
"lang": "python",
"repo": "lucasrennok/Tic_Tac_Toe",
"path": "/v2_with_GUI/menu_view.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yao-zl/python-deltasigma path: /deltasigma/_evalTF.py
# -*- coding: utf-8 -*-
# _evalTF.py
# This module provides the evalTF function.
# Copyright 2013 Giuseppe Venturini
# This file is part of python-deltasigma.
#
# python-deltasigma is a 1:1 Python replacement of Richard Schreier's
# MATLAB de... | code_fim | hard | {
"lang": "python",
"repo": "yao-zl/python-deltasigma",
"path": "/deltasigma/_evalTF.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> tf(z) : scalar or 1d-ndarray
The result.
"""
# Original comment in deltasig:
# In Matlab 5, the ss/freqresp() function does nearly the same thing.
# in our case a transfer function is a scipy LTI object
if (hasattr(tf, 'inputs') and not tf.inputs == 1) or \
(hasatt... | code_fim | hard | {
"lang": "python",
"repo": "yao-zl/python-deltasigma",
"path": "/deltasigma/_evalTF.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renauddahou/bip_utils path: /bip_utils/bip44/__init__.py
from bip_utils.bip44.bip44_base_ex import Bip44DepthError, Bip44CoinNotAllowedError
fro<|fim_suffix|>rt Bip44
from bip_utils.bip44.bip49 import Bip49
from bip_utils.bip44.bip84 import Bip84<|fim_middle|>m bip_utils.bip44.bip44_base import B... | code_fim | medium | {
"lang": "python",
"repo": "renauddahou/bip_utils",
"path": "/bip_utils/bip44/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rt Bip44
from bip_utils.bip44.bip49 import Bip49
from bip_utils.bip44.bip84 import Bip84<|fim_prefix|># repo: renauddahou/bip_utils path: /bip_utils/bip44/__init__.py
from bip_utils.bip44.bip44_base_ex import Bip44DepthError, Bip44CoinNotAllowedError
fro<|fim_middle|>m bip_utils.bip44.bip44_base import B... | code_fim | medium | {
"lang": "python",
"repo": "renauddahou/bip_utils",
"path": "/bip_utils/bip44/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except MySQLdb.Error, e:
yield e
def issue_insert(self, query):
try:
self.cursor.execute(query)
self.connect.commit()
except MySQLdb.Error, e:
# Duplicate entry
if e[0] == 1062:
pass
else:
... | code_fim | hard | {
"lang": "python",
"repo": "yamaguchiyuto/location_inference",
"path": "/lib/db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yamaguchiyuto/location_inference path: /lib/db.py
# -*- coding: utf-8 -*-
import MySQLdb
from low_level_cursor import LowLevelCursor
class DB:
def __init__(self, user, passwd, db, host='localhost'):
self.connect = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
s... | code_fim | hard | {
"lang": "python",
"repo": "yamaguchiyuto/location_inference",
"path": "/lib/db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0MazaHacka0/qctf-starter-2018 path: /tasks/email-confirmations/flask/email_confirmations/migrations/versions/cba1420943e0_.py
"""empty message
Revision ID: cba1420943e0
Revises: 19f723fdc1e0
Create Date: 2018-02-13 05:28:54.268882
"""
from alembic import op
import sqlalchemy as sa
# revision ... | code_fim | hard | {
"lang": "python",
"repo": "0MazaHacka0/qctf-starter-2018",
"path": "/tasks/email-confirmations/flask/email_confirmations/migrations/versions/cba1420943e0_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.create_table('notes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=200), nullable=False),
sa.Column('content', sa.String(length=5000), nullable=False),
sa.Column('author_id', sa.I... | code_fim | hard | {
"lang": "python",
"repo": "0MazaHacka0/qctf-starter-2018",
"path": "/tasks/email-confirmations/flask/email_confirmations/migrations/versions/cba1420943e0_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_core_args(self):
self.parser.add_argument_group("Core Arguments")
# TODO: Add Help flag here describing MMF Configuration
# and point to configuration documentation
self.parser.add_argument(
"-co",
"--config_override",
type=st... | code_fim | hard | {
"lang": "python",
"repo": "fdsig/Transformer-MM-Explainability",
"path": "/VisualBERT/mmf/utils/flags.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fdsig/Transformer-MM-Explainability path: /VisualBERT/mmf/utils/flags.py
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
class Flags:
def __init__(self):
self.parser = argparse.ArgumentParser()
self.add_core_args()
def get_parser(self):
<|fim_suffix|>... | code_fim | hard | {
"lang": "python",
"repo": "fdsig/Transformer-MM-Explainability",
"path": "/VisualBERT/mmf/utils/flags.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: giulio-zhou/mmcv path: /examples/custom_datasets.py
import numpy as np
import pickle
import torch
from torch.utils import data
# For now, CustomDataset is a wrapper class that implements additional
# features (subsampling, logits parsing, etc.) on top.
class CustomDataset(data.Dataset):
def... | code_fim | medium | {
"lang": "python",
"repo": "giulio-zhou/mmcv",
"path": "/examples/custom_datasets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.dataset = dataset
self.times = times
self._ori_len = len(self.dataset)
def __getitem__(self, idx):
return self.dataset[idx % self._ori_len]
def __len__(self):
return self.times * self._ori_len<|fim_prefix|># repo: giulio-zhou/mmcv path: /examples/cus... | code_fim | medium | {
"lang": "python",
"repo": "giulio-zhou/mmcv",
"path": "/examples/custom_datasets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self.valid_idx)
class RepeatDataset(object):
def __init__(self, dataset, times):
self.dataset = dataset
self.times = times
self._ori_len = len(self.dataset)
def __getitem__(self, idx):
return self.dataset[idx % self._ori_len]
def __len__(s... | code_fim | hard | {
"lang": "python",
"repo": "giulio-zhou/mmcv",
"path": "/examples/custom_datasets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EckoTan0804/talent-worth path: /tabs/job_trend_tab.py
import utils
import dash_core_components as dcc
import dash_html_components as html
from html_utils import generate_section_banner
def build_job_trend_tab():
return html.Div(
className="status-container",
children=[
... | code_fim | hard | {
"lang": "python",
"repo": "EckoTan0804/talent-worth",
"path": "/tabs/job_trend_tab.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return html.Div(
id="top-section-container",
className="row",
children=[
html.Div(
id="metric-summary-session",
className="eight columns",
children=[
generate_section_banner(
... | code_fim | hard | {
"lang": "python",
"repo": "EckoTan0804/talent-worth",
"path": "/tabs/job_trend_tab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netravnen/peering-manager path: /extras/migrations/0005_configcontext_configcontextassignment.py
# Generated by Django 4.0.4 on 2022-06-25 11:41
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("conte... | code_fim | hard | {
"lang": "python",
"repo": "netravnen/peering-manager",
"path": "/extras/migrations/0005_configcontext_configcontextassignment.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("created", models.DateTimeField(auto_now_add=True, null=True)),
("updated", models.DateTimeField(auto_now=... | code_fim | hard | {
"lang": "python",
"repo": "netravnen/peering-manager",
"path": "/extras/migrations/0005_configcontext_configcontextassignment.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> children = inspector.children(sourcepath)
assert children == set([
os.path.join(settings.sample_path, '_empty.scss'),
os.path.join(settings.lib1_path, 'settings/_sample.scss'),
os.path.join(settings.sample_path, '_vendor.scss'),
os.path.join(settings.lib2_path, 'add... | code_fim | hard | {
"lang": "python",
"repo": "sveetch/boussole",
"path": "/tests/010_inspector/006_libs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sveetch/boussole path: /tests/010_inspector/006_libs.py
# -*- coding: utf-8 -*-
import os
import pytest
from boussole.exceptions import UnresolvablePath
def test_empty(settings, inspector):
"""inspector.ScssInspector: Some lib components used but no given library"""
sourcepath = os.pa... | code_fim | medium | {
"lang": "python",
"repo": "sveetch/boussole",
"path": "/tests/010_inspector/006_libs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_children(settings, inspector):
"""inspector.ScssInspector: Children with some lib components used"""
sourcepath = os.path.join(settings.sample_path, 'main_using_libs.scss')
sources = [
sourcepath,
]
inspector.inspect(*sources, library_paths=settings.libraries_fixture... | code_fim | medium | {
"lang": "python",
"repo": "sveetch/boussole",
"path": "/tests/010_inspector/006_libs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dalphi/service-ner_iterate path: /lib/tagger_training.py
# this code follows the blog post from
# https://datascience.blog.wzb.eu/2016/07/13/accurate-part-of-speech-tagging-of-german-texts-with-nltk/
# visited 24-01-2017
import nltk
import pickle
import random
from ClassifierBasedGermanTagger.Cl... | code_fim | hard | {
"lang": "python",
"repo": "Dalphi/service-ner_iterate",
"path": "/lib/tagger_training.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># save tagger to pickle
with open('nltk_german_pos_classifier_data.pickle', 'wb') as f:
pickle.dump(tagger, f, protocol=2)<|fim_prefix|># repo: Dalphi/service-ner_iterate path: /lib/tagger_training.py
# this code follows the blog post from
# https://datascience.blog.wzb.eu/2016/07/13/accurate-part-of... | code_fim | hard | {
"lang": "python",
"repo": "Dalphi/service-ner_iterate",
"path": "/lib/tagger_training.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> i = promise.Input('name', primitives.Integer, help="blah", default=None)
assert i.name == 'name'
assert i.sdk_default is None
assert i.default == base_sdk_types.Void()
assert i.sdk_required is False
assert i.help == "blah"
assert i.var.description == "blah"
assert i.sdk_typ... | code_fim | medium | {
"lang": "python",
"repo": "jbrambleDC/flytekit",
"path": "/tests/flytekit/unit/common_tests/test_promise.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbrambleDC/flytekit path: /tests/flytekit/unit/common_tests/test_promise.py
from __future__ import absolute_import
from flytekit.common import promise
from flytekit.common.types import primitives, base_sdk_types
from flytekit.common.exceptions import user as _user_exceptions
import pytest
<|fim_... | code_fim | hard | {
"lang": "python",
"repo": "jbrambleDC/flytekit",
"path": "/tests/flytekit/unit/common_tests/test_promise.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TracingOptions(ctypes.Union):
_anonymous_ = ("bit",)
_fields_ = [("bit", TracingOptions_bits), ("asByte", ctypes.c_uint8)]
def __init__(self, **kwargs):
super(TracingOptions, self).__init__()
for k, v in kwargs.items():
setattr(self, k, v)
def trace_parent_... | code_fim | hard | {
"lang": "python",
"repo": "zukatechnologies/zuqa-agent-python",
"path": "/zuqa/utils/disttracing.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zukatechnologies/zuqa-agent-python path: /zuqa/utils/disttracing.py
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | code_fim | hard | {
"lang": "python",
"repo": "zukatechnologies/zuqa-agent-python",
"path": "/zuqa/utils/disttracing.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rouzbeh-afrasiabi/BertFineTuning_MLOPS path: /BertFineTuning/model_config.py
model_config={
'model_name':'BertFineTuning',
'num_classes':2,
'dropout_prob':0.1,
'in_features':768,
'learning_rate_PT'<|fim_suffix|>ochs':4,
... | code_fim | hard | {
"lang": "python",
"repo": "rouzbeh-afrasiabi/BertFineTuning_MLOPS",
"path": "/BertFineTuning/model_config.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ochs':4,
'print_every':100,
'validate_at_epoch':0
}<|fim_prefix|># repo: rouzbeh-afrasiabi/BertFineTuning_MLOPS path: /BertFineTuning/model_config.py
model_config={
'model_name':'BertFineTuning',
'num_classes':2<|fim_middle|>,
... | code_fim | hard | {
"lang": "python",
"repo": "rouzbeh-afrasiabi/BertFineTuning_MLOPS",
"path": "/BertFineTuning/model_config.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyinsteon/pyinsteon path: /pyinsteon/groups/fan.py
"""Fan On Level state."""
from ..address import Address
from ..constants import FanSpeed, FanSpeedRange
from .group_base import GroupBase
<|fim_suffix|> """Set the value of the state from the handlers."""
if on_level in FanSpeedR... | code_fim | hard | {
"lang": "python",
"repo": "pyinsteon/pyinsteon",
"path": "/pyinsteon/groups/fan.py",
"mode": "psm",
"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.