text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>def add(request):
val1 = float(request.POST["num2"])
val2 = float(request.POST["num3"])
res = val1/(val2**2)
return render(request,"result.html",{'bmi':res})<|fim_prefix|># repo: Nayantara289/Code-Innovation-Series-ModelEngineeringCollege path: /Kinglet/proj dir/views (calc).py
from djang... | code_fim | medium | {
"lang": "python",
"repo": "Nayantara289/Code-Innovation-Series-ModelEngineeringCollege",
"path": "/Kinglet/proj dir/views (calc).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> val1 = float(request.POST["num2"])
val2 = float(request.POST["num3"])
res = val1/(val2**2)
return render(request,"result.html",{'bmi':res})<|fim_prefix|># repo: Nayantara289/Code-Innovation-Series-ModelEngineeringCollege path: /Kinglet/proj dir/views (calc).py
from django.shortcuts import... | code_fim | medium | {
"lang": "python",
"repo": "Nayantara289/Code-Innovation-Series-ModelEngineeringCollege",
"path": "/Kinglet/proj dir/views (calc).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def change_appearance_mode(self, mode_string):
if mode_string.lower() == "dark":
self.appearance_mode = 1
elif mode_string.lower() == "light":
self.appearance_mode = 0
if isinstance(self.master, CTkFrame):
self.bg_color = self.master.fg_colo... | code_fim | hard | {
"lang": "python",
"repo": "ra2003/CustomTkinter",
"path": "/customtkinter/customtkinter_entry.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ra2003/CustomTkinter path: /customtkinter/customtkinter_entry.py
import tkinter
from .customtkinter_frame import CTkFrame
from .appearance_mode_tracker import AppearanceModeTracker
from .customtkinter_color_manager import CTkColorManager
class CTkEntry(tkinter.Frame):
def __init__(self,
... | code_fim | hard | {
"lang": "python",
"repo": "ra2003/CustomTkinter",
"path": "/customtkinter/customtkinter_entry.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def draw(self):
self.canvas.delete("all")
self.fg_parts = []
# frame_border
self.fg_parts.append(self.canvas.create_oval(0, 0,
self.corner_radius*2, self.corner_radius*2))
self.fg_parts.append(self.canvas.cre... | code_fim | hard | {
"lang": "python",
"repo": "ra2003/CustomTkinter",
"path": "/customtkinter/customtkinter_entry.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aerialhedgehog/active_subspaces path: /active_subspaces/tests/test_utils.py
from unittest import TestCase
import unittest
class TestUtils(TestCase):
@unittest.skip('not implemented yet')
def test_process_inputs(self):
<|fim_suffix|> @unittest.skip('not implemented yet')
def test_q... | code_fim | medium | {
"lang": "python",
"repo": "aerialhedgehog/active_subspaces",
"path": "/active_subspaces/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.fail('not implemented yet')
@unittest.skip('not implemented yet')
def test_conditional_expectations(self):
self.fail('not implemented yet')<|fim_prefix|># repo: aerialhedgehog/active_subspaces path: /active_subspaces/tests/test_utils.py
from unittest import TestCase
import u... | code_fim | hard | {
"lang": "python",
"repo": "aerialhedgehog/active_subspaces",
"path": "/active_subspaces/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_run_detail_methods(self):
response = self.client.get(self.api_url)
assert response.status_code == 200
assert response.json() == {
"method_PIXE": self.run.method_PIXE,
"method_PIGE": self.run.method_PIGE,
"method_IBIL": self.run.meth... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/euphrosyne",
"path": "/lab/tests/api_views/test_run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: betagouv/euphrosyne path: /lab/tests/api_views/test_run.py
from django.test import Client, TestCase
from django.urls import reverse
from .. import factories
class TestRunView(TestCase):
def setUp(self):
self.run = run = factories.RunFactory()
self.client = client = Client()... | code_fim | hard | {
"lang": "python",
"repo": "betagouv/euphrosyne",
"path": "/lab/tests/api_views/test_run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cover-me/qtplot path: /qtplot/colormap.py
import numpy as np
import matplotlib as mpl
import os
class Colormap:
""" Represents a colormap to be used for plotting. """
def __init__(self, filename):
""" Construct from a spyview colormap. """
dir = os.path.dirname(os.path.r... | code_fim | medium | {
"lang": "python",
"repo": "cover-me/qtplot",
"path": "/qtplot/colormap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_mpl_colormap(self):
"""
Create a matplotlib colormap object that can be used in the cmap
argument of some matplotlib plotting functions.
"""
return mpl.colors.ListedColormap(self.get_colors().astype(float) / 255.0)<|fim_prefix|># repo: cover-me/qtplot p... | code_fim | hard | {
"lang": "python",
"repo": "cover-me/qtplot",
"path": "/qtplot/colormap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> This array can be uploaded to the GPU in vispy/opengl as a
1D texture to be used as a lookup table for coloring the data.
"""
x = np.linspace(0, 1, self.length)
y = x**self.gamma
value = np.linspace(0, 1, len(self.colors))
r = np.interp(y, value, se... | code_fim | hard | {
"lang": "python",
"repo": "cover-me/qtplot",
"path": "/qtplot/colormap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert empty.other_maps.get(a) is not None
assert empty.other_maps.get(a).other_maps.get(b) is not None
assert empty.other_maps.get(a).other_maps.get(b).other_maps.get(c) is not None
map_ = empty.add_attribute(b).add_attribute(a).add_attribute(c)
assert map_ is not map
assert map_... | code_fim | hard | {
"lang": "python",
"repo": "rjnw/pycket",
"path": "/pycket/test/test_hidden_classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rjnw/pycket path: /pycket/test/test_hidden_classes.py
import pytest
from pycket.hidden_classes import make_map_type
from pycket.impersonators.hidden_classes.base import W_ImpPropertyDescriptor
def test_map():
empty = make_map_type("__getitem__", int).EMPTY
maps = []
... | code_fim | hard | {
"lang": "python",
"repo": "rjnw/pycket",
"path": "/pycket/test/test_hidden_classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _OVERWORK.__init__(self)
self.name = "OVERWORKING"
self.specie = 'verbs'
self.basic = "overwork"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_overworking.py
from xai.brain.wordbase.verbs._overwork import _OVERWORK
#calss header
class _OVERWORKING(_OVE... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_overworking.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,):
_OVERWORK.__init__(self)
self.name = "OVERWORKING"
self.specie = 'verbs'
self.basic = "overwork"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_overworking.py
from xai.brain.wordbase.verbs._overwork import _OVERWORK
<|fim_middle|>... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_overworking.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_overworking.py
from xai.brain.wordbase.verbs._overwork import _OVERWORK
#calss header
class _OVERWORKING(_OVERWORK, ):
<|fim_suffix|> _OVERWORK.__init__(self)
self.name = "OVERWORKING"
self.specie = 'verbs'
self.basic = "overwork"
self.jso... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/verbs/_overworking.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pi_root, include('apps.channel.urls')),
path(api_root, include('apps.post.urls')),
]<|fim_prefix|># repo: therealjamesjung/sejongapi-v1 path: /sejongapi/urls.py
from django.urls import path, include
from django.contrib import admin
api_root = 'api<|fim_middle|>/v1/'
urlpatterns = [
path('admin/'... | code_fim | medium | {
"lang": "python",
"repo": "therealjamesjung/sejongapi-v1",
"path": "/sejongapi/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pps.authentication.urls')),
path(api_root, include('apps.profile.urls')),
path(api_root, include('apps.channel.urls')),
path(api_root, include('apps.post.urls')),
]<|fim_prefix|># repo: therealjamesjung/sejongapi-v1 path: /sejongapi/urls.py
from django.urls import path, include
from django.co... | code_fim | medium | {
"lang": "python",
"repo": "therealjamesjung/sejongapi-v1",
"path": "/sejongapi/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: therealjamesjung/sejongapi-v1 path: /sejongapi/urls.py
from django.urls import path, include
from django.contrib import admin
api_root = 'api/v1/'
urlpatterns = [
path('admin/', admin.site.urls),
path(api_root, include('a<|fim_suffix|>pi_root, include('apps.channel.urls')),
path(api_... | code_fim | medium | {
"lang": "python",
"repo": "therealjamesjung/sejongapi-v1",
"path": "/sejongapi/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
rds = boto3.client("rds")
""":type : pyboto3.rds"""
rds_data = boto3.client("rds-data")
""":type : pyboto3.rds_data"""
redshift = boto3.client("redshift")
""":type : pyboto3.redshift"""
rekognition = boto3.client("rekognition")
""":type : pyboto3.rekognition"""
resource_groups = boto3.client("resource-gr... | code_fim | hard | {
"lang": "python",
"repo": "Semc/pyboto3",
"path": "/pyboto3/clients.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Semc/pyboto3 path: /pyboto3/clients.py
import boto3
acm = boto3.client("acm")
""":type : pyboto3.acm"""
acm_pca = boto3.client("acm-pca")
""":type : pyboto3.acm_pca"""
alexaforbusiness = boto3.client("alexaforbusiness")
""":type : pyboto3.alexaforbusiness"""
amplify = boto3.client("amplify")
""":... | code_fim | hard | {
"lang": "python",
"repo": "Semc/pyboto3",
"path": "/pyboto3/clients.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>)
""":type : pyboto3.kinesis"""
kinesis_video_archived_media = boto3.client("kinesis-video-archived-media")
""":type : pyboto3.kinesis_video_archived_media"""
kinesis_video_media = boto3.client("kinesis-video-media")
""":type : pyboto3.kinesis_video_media"""
kinesisanalytics = boto3.client("kinesisanalyti... | code_fim | hard | {
"lang": "python",
"repo": "Semc/pyboto3",
"path": "/pyboto3/clients.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasonwee/asus-rt-n14uhp-mrtg path: /src/lesson_developer_tools/doctest_test_globals.py
class TestGlobals:
def one(self):
<|fim_suffix|> """
>>> 'var' in globals()
False
"""<|fim_middle|> """
>>> var = 'value'
>>> 'var' in globals()
... | code_fim | medium | {
"lang": "python",
"repo": "jasonwee/asus-rt-n14uhp-mrtg",
"path": "/src/lesson_developer_tools/doctest_test_globals.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
>>> 'var' in globals()
False
"""<|fim_prefix|># repo: jasonwee/asus-rt-n14uhp-mrtg path: /src/lesson_developer_tools/doctest_test_globals.py
class TestGlobals:
def one(self):
<|fim_middle|> """
>>> var = 'value'
>>> 'var' in globals()
... | code_fim | medium | {
"lang": "python",
"repo": "jasonwee/asus-rt-n14uhp-mrtg",
"path": "/src/lesson_developer_tools/doctest_test_globals.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>process.MessageLogger = cms.Service("MessageLogger",
cerr = cms.untracked.PSet(
enable = cms.untracked.bool(False)
),
files = cms.untracked.PSet(
output = cms.untracked.PSet(
)
),
noLineBreaks = cms.untracked.bool(True),
threshold = cms.untracked.string('WA... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/CalibTracker/SiPixelTools/test/prodfedfillerwords_cfg.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /CalibTracker/SiPixelTools/test/prodfedfillerwords_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("Demo")
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring ('file:/afs/cern.c... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/CalibTracker/SiPixelTools/test/prodfedfillerwords_cfg.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Blat
fields = ['text', 'via']
success_url = "/my/"
def form_valid(self, form):
form.instance.created_by = self.request.user
return super(NewBlatView, self).form_valid(form)
class EditBlatView(generic.edit.UpdateView):
model = Blat
fields = ['text', 'via']
success_url = "/my/"
def ge... | code_fim | hard | {
"lang": "python",
"repo": "philmui/blather",
"path": "/blat/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philmui/blather path: /blat/views.py
from django.shortcuts import render
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import Blat
#def home(request):
# return render(request, 'blat/ho... | code_fim | hard | {
"lang": "python",
"repo": "philmui/blather",
"path": "/blat/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RLeary/python-practice path: /list_comprehensions.py
# Suppose we want to separate the letters of the word "Hello" and add the letters as items of a list.
# using a for loop:
# hello_letters = []
# for letter in 'hello':
# hello_letters.append(letter)
# print(hello_letters)
... | code_fim | hard | {
"lang": "python",
"repo": "RLeary/python-practice",
"path": "/list_comprehensions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>squares = [x**2 for x in range(10)]
print(squares)
# combine elements of 2 lists that are not equal
# not_equal_combination = []
# for x in [1,2,3]:
# for y in [3,1,4]:
# if x != y:
# not_equal_combination.append((x, y))
not_equal_list = [(x,y) for x in [1,2,3] for y in [3,1,... | code_fim | hard | {
"lang": "python",
"repo": "RLeary/python-practice",
"path": "/list_comprehensions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# From python tutorials:
# List comprehensions provide a concise way to create lists. Common
# applications are to make new lists where each element is the result
# of some operations applied to each member of another sequence or iterable,
# or to create a subsequence of those elements that satis... | code_fim | hard | {
"lang": "python",
"repo": "RLeary/python-practice",
"path": "/list_comprehensions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO: Avoid calculating hamming distance twice
pockets = []
energies = OrderedDict()
union = dimod.concatenate(samplesets)
for data in union.data(sorted_by='energy'):
value = tuple(data.sample.values())
local = (scipy.spatial.distance.hamming(value,p)<=hamm_k for p in... | code_fim | hard | {
"lang": "python",
"repo": "jared-paul/embera",
"path": "/embera/benchmark/testbed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> report["valid"] = bool(embedding) # TODO: more elaborate, for incomplete embeddings
report['embedding_runtime'] = end-start
report['embedding_method'] = method.__name__
embedding_obj = embera.Embedding(embedding,**report)
return embedding_obj
def sample_and_report(method, bqm, embed... | code_fim | hard | {
"lang": "python",
"repo": "jared-paul/embera",
"path": "/embera/benchmark/testbed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jared-paul/embera path: /embera/benchmark/testbed.py
import time
import dimod
import scipy
import embera
import dwave.cloud
import dwave.embedding
import numpy as np
from collections import OrderedDict
class StructuredSASampler(dimod.SimulatedAnnealingSampler,dimod.Structured):
nodelist = ... | code_fim | hard | {
"lang": "python",
"repo": "jared-paul/embera",
"path": "/embera/benchmark/testbed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/ml-compiler-opt path: /compiler_opt/benchmark/gtest_executable_utils.py
# coding=utf-8
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | code_fim | hard | {
"lang": "python",
"repo": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/gtest_executable_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> formatted_test_data = []
for test_instance in test_data_output:
if test_instance:
test_info = {'name': test_instance[0], 'iterations': 1}
test_info.update(test_instance[1])
formatted_test_data.append(test_info)
return formatted_test_data
def get_gtest_testlist_raw(path_to_ex... | code_fim | hard | {
"lang": "python",
"repo": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/gtest_executable_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Loops through each line in the raw output obtained from the
get_gtest_testlist_raw functions and relies on the current output
structure in order to be able to parse the test names.
Args:
gtest_output_raw: A string containing the decoded
raw output from a gtest executable run with the
... | code_fim | hard | {
"lang": "python",
"repo": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/gtest_executable_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not network_queue:
return []
altered_networks = [network_queue[0].uuid]
while network_queue:
nex = network_queue.pop(0)
with self.networkLock(nex.uuid):
merge_uuid = self.findNetworkMatch(nex)
i... | code_fim | hard | {
"lang": "python",
"repo": "netSensTeam/netSens",
"path": "/center/app/networker/processors/process_packets_buffer/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netSensTeam/netSens path: /center/app/networker/processors/process_packets_buffer/__init__.py
import time
from entities.network import Network
from entities.packet import Packet
from processors import _processor as processor
@processor.register('packetsBuffer')
class PacketsBufferProcessor(proce... | code_fim | hard | {
"lang": "python",
"repo": "netSensTeam/netSens",
"path": "/center/app/networker/processors/process_packets_buffer/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getNetworkForOrigin(self, org_uuid):
pairs = self.dbClient.db.origins.find({})
for pair in pairs:
if pair['originUUID'] == org_uuid:
return pair['networkUUID']
return None
def addOriginNetwork(self, net_uuid, org_uuid):
self.dbClient... | code_fim | hard | {
"lang": "python",
"repo": "netSensTeam/netSens",
"path": "/center/app/networker/processors/process_packets_buffer/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hitergelei/ml_tools path: /ml_tools/base.py
from sklearn.base import BaseEstimator, RegressorMixin,TransformerMixin
try:
import autograd.numpy as np
import autograd.scipy as sp
except:
import numpy as np
import scipy as sp
class RegressorBase(BaseEstimator, RegressorMixin):
... | code_fim | hard | {
"lang": "python",
"repo": "hitergelei/ml_tools",
"path": "/ml_tools/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def fit(self):
pass
class KernelBase(BaseEstimator,TransformerMixin):
def __init__(self):
pass
def get_params(self):
pass
def set_params(self,**params):
pass
def __call__(self, X, Y=None, eval_gradient=False):
"""Evaluate the kerne... | code_fim | medium | {
"lang": "python",
"repo": "hitergelei/ml_tools",
"path": "/ml_tools/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [path("dragonfly/", include(DragonflyViewSet().get_urls()))]<|fim_prefix|># repo: davidthinh/django-beam path: /tests/testapp/urls.py
from django.urls import path, include
<|fim_middle|>from .views import DragonflyViewSet
| code_fim | easy | {
"lang": "python",
"repo": "davidthinh/django-beam",
"path": "/tests/testapp/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidthinh/django-beam path: /tests/testapp/urls.py
from django.urls import path, include
<|fim_suffix|>urlpatterns = [path("dragonfly/", include(DragonflyViewSet().get_urls()))]<|fim_middle|>from .views import DragonflyViewSet
| code_fim | easy | {
"lang": "python",
"repo": "davidthinh/django-beam",
"path": "/tests/testapp/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timrchavez/capomastro path: /jenkins/helpers.py
import logging
from jenkins.models import Job, Build, Artifact
from jenkins.utils import generate_job_name
def import_build_for_job(job_pk, build_number):
"""
Import a build for a job.
"""
job = Job.objects.get(pk=job_pk)
logg... | code_fim | hard | {
"lang": "python",
"repo": "timrchavez/capomastro",
"path": "/jenkins/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> jenkins_job = client.get_job(job.name)
good_build_numbers = list(jenkins_job.get_build_ids())
logging.info("%s\n" % good_build_numbers)
for build_number in good_build_numbers:
import_build_for_job(job.pk, build_number)<|fim_prefix|># repo: timrchavez/capomastro path: /jenkins/he... | code_fim | medium | {
"lang": "python",
"repo": "timrchavez/capomastro",
"path": "/jenkins/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dem4ply/chibi_dl path: /chibi_dl/site/tmofans/serie.py
import itertools
import logging
import time
from bs4 import BeautifulSoup
from chibi.file.temp import Chibi_temp_path
from .episode import Episode
from chibi_dl.site.base.site import Site
logger = logging.getLogger( "chibi_dl.sites.tmo_fa... | code_fim | hard | {
"lang": "python",
"repo": "dem4ply/chibi_dl",
"path": "/chibi_dl/site/tmofans/serie.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._episodes = []
if "one_shot" in self.url:
self.load_one_shot( soup )
return
else:
chapter_container = soup.find(
"div", { 'class': "card chapters" } )
chapter_container_hidden = chapter_container.find(
... | code_fim | hard | {
"lang": "python",
"repo": "dem4ply/chibi_dl",
"path": "/chibi_dl/site/tmofans/serie.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: castaneai/muse path: /tests/test_audio.py
# coding: utf-8
import unittest
import muse.audio
class AudioTest(unittest.TestCase):
def test_parse_m4a_tags(self):
<|fim_suffix|> def test_parse_mp3_tags(self):
path = r"C:\Users\phone\Desktop\01. きらめきっ!の日.mp3"
m = muse.audio.M... | code_fim | hard | {
"lang": "python",
"repo": "castaneai/muse",
"path": "/tests/test_audio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_parse_mp3_tags(self):
path = r"C:\Users\phone\Desktop\01. きらめきっ!の日.mp3"
m = muse.audio.Music(path)
self.assertTrue(m.tags.title == "きらめきっ!の日")
self.assertTrue(m.tags.artist == "情報処理部")
self.assertTrue(m.artwork.mime_type == "image/jpeg")<|fim_prefix|># ... | code_fim | hard | {
"lang": "python",
"repo": "castaneai/muse",
"path": "/tests/test_audio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get information about the file to save to / the music in general.
while True:
filename = _get_filename()
title = _get_title()
num = _get_numparts()
num_meas = _get_meas()
bpm = _get_bpm()
score_obj = score(title,num)
redo ... | code_fim | hard | {
"lang": "python",
"repo": "origamimantis/musicmaker",
"path": "/musicmaker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: origamimantis/musicmaker path: /musicmaker.py
import random
from collections import namedtuple
from math import ceil, sqrt
from _keysig import KeySig
import _xmlconstruct
import _notemaker
######### to-do: implement 'last accidental', although should work without. just looks weird.
######### ... | code_fim | hard | {
"lang": "python",
"repo": "origamimantis/musicmaker",
"path": "/musicmaker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _start_part(partnum, totalparts):
print()
print('----------------------------------------------------------')
print(f'Part {partnum} / {totalparts}:')
print()
def _confirmdet(fn,t,num, num_meas,bpm):
print()
print('--------------------FILE CONFIRMATION----------------------... | code_fim | hard | {
"lang": "python",
"repo": "origamimantis/musicmaker",
"path": "/musicmaker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def exchange():
try:
key = get_config()["key"]
secret = get_config()["secret"]
exchange = ccxt.binance(
{"apiKey": key, "secret": secret, "enableRateLimit": True}
)
return exchange
except ccxt.NetworkError as e:
if show_error == "YES":
... | code_fim | medium | {
"lang": "python",
"repo": "alex-bormotov/AXE-Bot",
"path": "/exchange.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alex-bormotov/AXE-Bot path: /exchange.py
import ccxt
from config import get_config
from notification import notificator
show_error = "YES"
<|fim_suffix|>
def api_requests_frequency():
return float(get_config()["requests_frequency"]) # sec<|fim_middle|>def exchange():
try:
key... | code_fim | hard | {
"lang": "python",
"repo": "alex-bormotov/AXE-Bot",
"path": "/exchange.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack-archive/deb-python-proliantutils path: /proliantutils/ipa_hw_manager/hardware_manager.py
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You ... | code_fim | hard | {
"lang": "python",
"repo": "openstack-archive/deb-python-proliantutils",
"path": "/proliantutils/ipa_hw_manager/hardware_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> This method creates the desired RAID configuration as read from
node['target_raid_config'].
:param node: A dictionary of the node object
:param ports: A list of dictionaries containing information of ports
for the node
:returns: The current RAID configu... | code_fim | hard | {
"lang": "python",
"repo": "openstack-archive/deb-python-proliantutils",
"path": "/proliantutils/ipa_hw_manager/hardware_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndreasMadsen/master-thesis path: /code/moses/multi_bleu.py
from typing import List
import tempfile
import subprocess
from code.moses.util.script_path import script_path
<|fim_suffix|> with tempfile.NamedTemporaryFile('w', encoding='utf-8') as fd:
for line in target:
pri... | code_fim | medium | {
"lang": "python",
"repo": "AndreasMadsen/master-thesis",
"path": "/code/moses/multi_bleu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tempfile.NamedTemporaryFile('w', encoding='utf-8') as fd:
for line in target:
print(line, file=fd, flush=True)
result = subprocess.run(
[
'perl', script_path('scripts/generic/multi-bleu.perl'),
fd.name
],
... | code_fim | medium | {
"lang": "python",
"repo": "AndreasMadsen/master-thesis",
"path": "/code/moses/multi_bleu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = subprocess.run(
[
'perl', script_path('scripts/generic/multi-bleu.perl'),
fd.name
],
encoding='utf-8',
input='\n'.join(translate) + '\n',
stderr=subprocess.STDOUT,
stdout=subprocess.PIP... | code_fim | medium | {
"lang": "python",
"repo": "AndreasMadsen/master-thesis",
"path": "/code/moses/multi_bleu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cpach/cryptopals-python3 path: /exercise_08
#!/usr/bin/env python3
# Copyright 2014 Carl Winbäck. See the COPYING file at the top-level directory
# of this distribution.
from binascii import hexlify
from operator import itemgetter
from libpals.util import ecb_or_cbc, divide, xor_find_singlechar... | code_fim | hard | {
"lang": "python",
"repo": "cpach/cryptopals-python3",
"path": "/exercise_08",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for winner in winner_list:
hex_string = str(object=hexlify(winner['ciphertext']),
encoding='utf-8')
print("""%""")
print("""Line number: {}""".format(winner['line_number']))
print("""Ciphertext (hex): {}""".format(hex_string))
indata = [line.r... | code_fim | medium | {
"lang": "python",
"repo": "cpach/cryptopals-python3",
"path": "/exercise_08",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ffpa path
self.FFPA_path = os.getcwd()+'/FFPA/ano_pred_cvpr2018/Codes/inference2.py'
self.save_path = ''
# GPU to use
self.gpu_id = 0
# 8 will be more than 1G, 4 will be less than 1G
self.batch_size = 8
self.dataset = 'mini'
se... | code_fim | hard | {
"lang": "python",
"repo": "callbarian/vidsurveil_application",
"path": "/FFPA/Codes/ffpa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #self.temp_dir_arr.append(save_path)
# if file already exist in save_path, continue
if os.path.exists(self.save_path):
continue
# copy each file to each new directory, after resizing it
command = 'ffmpeg -i ' + file ... | code_fim | hard | {
"lang": "python",
"repo": "callbarian/vidsurveil_application",
"path": "/FFPA/Codes/ffpa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: callbarian/vidsurveil_application path: /FFPA/Codes/ffpa.py
import os
import subprocess
class FFPA():
def __init__(self,path_name,temp_dir,save_dir,env_path_FFPA):
#input file path array(in full path)
self.path_name = path_name
# directory to process files t... | code_fim | hard | {
"lang": "python",
"repo": "callbarian/vidsurveil_application",
"path": "/FFPA/Codes/ffpa.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: conan-io/conan-center-index path: /recipes/glslang/all/conanfile.py
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchai... | code_fim | hard | {
"lang": "python",
"repo": "conan-io/conan-center-index",
"path": "/recipes/glslang/all/conanfile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def layout(self):
cmake_layout(self, src_folder="src")
@property
def _get_compatible_spirv_tools_version(self):
return {
"11.7.0": "2021.4",
"11.6.0": "2021.3",
"11.5.0": "2021.2",
"8.13.3559": "2020.5",
}.get(str(self.ve... | code_fim | hard | {
"lang": "python",
"repo": "conan-io/conan-center-index",
"path": "/recipes/glslang/all/conanfile.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = self._entries[index]
return result
def add_blog(self, obj):
self._entries.append(obj)
def list(self):
return self._entries<|fim_prefix|># repo: lanya16/layer-architecture path: /python/flask/ddd/infrastructure/repository/memrepo.py
from ddd.domain import... | code_fim | medium | {
"lang": "python",
"repo": "lanya16/layer-architecture",
"path": "/python/flask/ddd/infrastructure/repository/memrepo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lanya16/layer-architecture path: /python/flask/ddd/infrastructure/repository/memrepo.py
from ddd.domain import blog as sr
class MemRepo:
<|fim_suffix|> def list(self):
return self._entries<|fim_middle|>
def __init__(self, entries=None):
self._entries = []
if entri... | code_fim | hard | {
"lang": "python",
"repo": "lanya16/layer-architecture",
"path": "/python/flask/ddd/infrastructure/repository/memrepo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_blog_by_id(self, index):
result = self._entries[index]
return result
def add_blog(self, obj):
self._entries.append(obj)
def list(self):
return self._entries<|fim_prefix|># repo: lanya16/layer-architecture path: /python/flask/ddd/infrastructure/reposit... | code_fim | medium | {
"lang": "python",
"repo": "lanya16/layer-architecture",
"path": "/python/flask/ddd/infrastructure/repository/memrepo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_constructor_attributes(self):
class TestClass(object):
def __init__(self, a):
self.b = a
self.b.c = 1
node, _ = self._parse_and_analyze(TestClass)
init_node = node.body[0]
self.assertScopeIs(
anno.getanno(init_node, NodeAnno.BODY_SCOPE), ('self',... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/autograph/pyct/static_analysis/activity_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/autograph/pyct/static_analysis/activity_test.py
o(for_node, NodeAnno.ITERATE_SCOPE), (), ('_'))
self.assertScopeIs(
anno.getanno(for_node, NodeAnno.BODY_SCOPE), ('b',), ('b', 'c'))
self.assertScopeIs(
anno.getanno(for_node, No... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/autograph/pyct/static_analysis/activity_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/autograph/pyct/static_analysis/activity_test.py
ctx = transformer.Context(entity_info, namer, None)
node = activity.resolve(node, ctx)
return node, entity_info
def assertSymbolSetsAre(self, expected, actual, name):
expected = set(expec... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/autograph/pyct/static_analysis/activity_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@celery_app.task(**TASK_KWARGS)
def get_one_post(url, proxies):
response = get_url_response(url, proxies)
if response.status_code == 404:
del response, proxies, url
return 'No such page on website!'
assert response.status_code == 200
title = response.html.xpath('//h1')[... | code_fim | hard | {
"lang": "python",
"repo": "OleksandrShcherbinin/futureproof-technology-test-blog",
"path": "/web_app/blog/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for chunk in chunks:
for url in chunk:
run_task = get_one_post.delay(url, proxies)
tasks_set.add(run_task.id)
# wait for tasks of one chunk of urls to complete
while len(tasks_set) != 0:
for task_id in tasks_set.copy():
resul... | code_fim | hard | {
"lang": "python",
"repo": "OleksandrShcherbinin/futureproof-technology-test-blog",
"path": "/web_app/blog/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OleksandrShcherbinin/futureproof-technology-test-blog path: /web_app/blog/tasks.py
import os
import sys
import logging
from time import sleep
from datetime import datetime
from django.utils import timezone
from django.conf import settings
from futureproof import celery_app
from celery.result impo... | code_fim | hard | {
"lang": "python",
"repo": "OleksandrShcherbinin/futureproof-technology-test-blog",
"path": "/web_app/blog/tasks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Phomint/Upload_GSheets path: /model/google_model.py
import pickle
import os.path
from googleapiclient.http import MediaFileUpload
from googleapiclient import errors
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.reques... | code_fim | hard | {
"lang": "python",
"repo": "Phomint/Upload_GSheets",
"path": "/model/google_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Upload a new file's metadata and content.
Args:
service: Drive API service instance.
new_mime_type: New MIME type for the file.
new_filename: Filename of the new content to upload.
folder_name: Folder where is the file
Returns:
... | code_fim | hard | {
"lang": "python",
"repo": "Phomint/Upload_GSheets",
"path": "/model/google_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''run'''
if __name__ == '__main__':
resource_type = ['cpu', 'memory'][0]
if resource_type == 'cpu':
runcatCPU()
elif resource_type == 'memory':
runcatMemory()
else:
raise ValueError('Unknow resource_type <%s>...' % resource_type)<|fim_prefix|># repo: lng7936/Tools... | code_fim | hard | {
"lang": "python",
"repo": "lng7936/Tools",
"path": "/Runcat/runcat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lng7936/Tools path: /Runcat/runcat.py
'''
Function:
用奔跑的猫来代表电脑资源使用情况(CPU/内存)
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import sys
import time
import psutil
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon
'''奔跑的猫-CPU'''
def runcatCPU():
<|fim_suff... | code_fim | hard | {
"lang": "python",
"repo": "lng7936/Tools",
"path": "/Runcat/runcat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> use_kalman_smoothing=False,
with_orientation=False,
fps=120.0,
with_distortion=True):
D = setup_data( fps=fps,
with_water=with_water,
... | code_fim | hard | {
"lang": "python",
"repo": "liyi2017/flydra",
"path": "/flydra_analysis/flydra_analysis/test_reconstruction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dt = 1.0/fps
time.sleep(SPINUP_DURATION)
n_skipped = 0
if skip_frames is not None:
start_skip_frame = 20
if skip_frames =='some':
n_skipped = max_frames_skipped - 1
else:
assert skip_frames =='too many'
n_skipped = max_frames_ski... | code_fim | hard | {
"lang": "python",
"repo": "liyi2017/flydra",
"path": "/flydra_analysis/flydra_analysis/test_reconstruction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liyi2017/flydra path: /flydra_analysis/flydra_analysis/test_reconstruction.py
econstructor']
# generate fake trajectory
dt = 1/fps
t = np.arange(0.0, 1.0, dt)
x = 0.2*np.cos(t*0.9)
y = 0.3*np.sin(t*0.7)
z = 0.1*np.sin(t*0.13) - 0.12
pts = np.hstack( (x[:,np.newaxis]... | code_fim | hard | {
"lang": "python",
"repo": "liyi2017/flydra",
"path": "/flydra_analysis/flydra_analysis/test_reconstruction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GaoX2015/intro_ds path: /ch09-generative_models/gaussian_hmm/stock_analysis.py
# -*- coding: UTF-8 -*-
"""
此脚本用于展示如何使用HMM模型对股票数据进行分析
"""
import os
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick_ochl
from matplotlib.da... | code_fim | hard | {
"lang": "python",
"repo": "GaoX2015/intro_ds",
"path": "/ch09-generative_models/gaussian_hmm/stock_analysis.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def stockHMM(dataPath):
"""
程序入口
"""
data = readData(dataPath)
data = transFeature(data)
hiddenStates = getHiddenStatus(data)
visualize(data, hiddenStates)
if __name__ == "__main__":
# Windows下的存储路径与Linux并不相同
if os.name == "nt":
dataPath = "%s\\data\\stock_sh.... | code_fim | hard | {
"lang": "python",
"repo": "GaoX2015/intro_ds",
"path": "/ch09-generative_models/gaussian_hmm/stock_analysis.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Genesis81MbMPlugin(c4d.plugins.CommandData):
"""Tool to allow us to connect Genesis 8.1 To Facial Capture."""
PLUGIN_ID = 1057460
PLUGIN_NAME = "Connect Genesis 8.1 to Move By Maxon"
PLUGIN_HELP = "Import from DAZ Studio"
PLUGIN_INFO = c4d.PLUGINFLAG_HIDEPLUGINMENU
PLUGIN_I... | code_fim | hard | {
"lang": "python",
"repo": "richardbarkel/DazToC4D",
"path": "/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: richardbarkel/DazToC4D path: /Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp
"""
The MIT License (MIT)
Copyright (c) 2018 Niklas Rosenstein
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), t... | code_fim | hard | {
"lang": "python",
"repo": "richardbarkel/DazToC4D",
"path": "/Cinema 4D/appdir_common/plugins/DazToC4D/DazToC4D.pyp",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
x: Numpy ndarray with images.
y: Numpy ndarray with images.
size: Tuple with two integer values, (height, width) of the resulting patches.
num_part: Integer value; the number of resulting patches.
Returns:
x_imgs, y_imgs: Numpy ndarrays with the patch... | code_fim | hard | {
"lang": "python",
"repo": "gmagannaDevelop/segnet",
"path": "/segmed/utils/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gmagannaDevelop/segnet path: /segmed/utils/utils.py
from skimage import io
from sklearn.feature_extraction import image
import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator
def extract_data(train_path, label_path=None, rgb=False):
"""Load images to memory f... | code_fim | hard | {
"lang": "python",
"repo": "gmagannaDevelop/segnet",
"path": "/segmed/utils/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def reverse_words(text):
return ' '.join(word[::-1] for word in text.split(" "))<|fim_prefix|># repo: serembon/codewars-python-kata path: /7_kyu/Reverse words.py
"""
Complete the function that accepts a string parameter, and reverses each word in the string. All spaces in the
string should be retaine... | code_fim | easy | {
"lang": "python",
"repo": "serembon/codewars-python-kata",
"path": "/7_kyu/Reverse words.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: serembon/codewars-python-kata path: /7_kyu/Reverse words.py
"""
Complete the function that accepts a string parameter, and reverses each word in the string. All spaces in the
string should be retained.
```
"This is an example!" ==> "sihT si na !elpmaxe"
"double spaces" ==> "elbuod secaps"
... | code_fim | easy | {
"lang": "python",
"repo": "serembon/codewars-python-kata",
"path": "/7_kyu/Reverse words.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zalando-stups/piu path: /piu/cli.py
#!/usr/bin/env python3
"""
Helper script to request access to a certain host.
"""
import boto3
import click
import operator
import ipaddress
import os
import subprocess
import socket
import sys
import sshpubkeys
import yaml
import re
from clickclick import ... | code_fim | hard | {
"lang": "python",
"repo": "zalando-stups/piu",
"path": "/piu/cli.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def check_ssh_key(key_path: str) -> bool:
if key_path and os.path.exists(key_path):
with open(key_path) as key:
contents = key.read()
key = sshpubkeys.SSHKey(contents)
try:
key.parse()
except (sshpubkeys.InvalidKeyError, NotImplem... | code_fim | hard | {
"lang": "python",
"repo": "zalando-stups/piu",
"path": "/piu/cli.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloudmesh/client path: /cloudmesh_client/api/impl/openstack.py
from cloudmesh_client.cloud.network import Network
from cloudmesh_client.cloud.image import Image
from cloudmesh_client.cloud.vm import Vm
from cloudmesh_client import Console
from cloudmesh_client.api import Resource, Provider, No... | code_fim | hard | {
"lang": "python",
"repo": "cloudmesh/client",
"path": "/cloudmesh_client/api/impl/openstack.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return OpenstackNode(model=vm, provider=self)
def create_ip(self, node):
ip = Network.find_assign_floating_ip(
cloudname=self.cloud,
instance_id=node.name,
)
Vm.refresh(cloud=self.cloud)
Console.ok('Assigned ip to {}: {}'.format(node.... | code_fim | hard | {
"lang": "python",
"repo": "cloudmesh/client",
"path": "/cloudmesh_client/api/impl/openstack.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class OpenstackProvider(Provider):
# def __init__(self):
# super(OpenstackProvider, self).__init__()
#
# self.images = ImageResource()
# self._add_resource(self.images)
#
# self.keys = KeyResource()
# self._add_resource(self.keys)
#
# self.f... | code_fim | hard | {
"lang": "python",
"repo": "cloudmesh/client",
"path": "/cloudmesh_client/api/impl/openstack.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@region_silo_test
class ProjectGroupingConfigsTest(APITestCase):
endpoint = "sentry-api-0-project-grouping-configs"
def setUp(self):
super().setUp()
self.login_as(user=self.user)
@with_feature({"organizations:grouping-tree-ui": False})
@mock.patch("sentry.grouping.strate... | code_fim | medium | {
"lang": "python",
"repo": "nagyist/sentry",
"path": "/tests/sentry/api/endpoints/test_project_grouping_configs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
super().setUp()
self.login_as(user=self.user)
@with_feature({"organizations:grouping-tree-ui": False})
@mock.patch("sentry.grouping.strategies.base.projectoptions.LATEST_EPOCH", 7)
def test_feature_flag_off(self):
response = self.get_success_respon... | code_fim | hard | {
"lang": "python",
"repo": "nagyist/sentry",
"path": "/tests/sentry/api/endpoints/test_project_grouping_configs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nagyist/sentry path: /tests/sentry/api/endpoints/test_project_grouping_configs.py
from unittest import mock
from django.urls import reverse
from sentry.models import ApiToken
from sentry.testutils import APITestCase
from sentry.testutils.helpers import with_feature
from sentry.testutils.silo im... | code_fim | hard | {
"lang": "python",
"repo": "nagyist/sentry",
"path": "/tests/sentry/api/endpoints/test_project_grouping_configs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.