text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
if self.viewer is not None:
self.viewer.close()
return _Hover._reset(self)
def render(self, mode='human'):
from gym_copter.rendering.twod import TwoDHoverRenderer
# Create viewer if not done yet
if self.viewer is None:
se... | code_fim | medium | {
"lang": "python",
"repo": "simondlevy/gym-copter",
"path": "/attic/gym_copter/envs/hover1d.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if updates['state'] == kubernetes.KUBE_UPGRADE_DOWNLOADING_IMAGES:
# Make sure upgrade is in the correct state to download images
if kube_upgrade_obj.state not in [
kubernetes.KUBE_UPGRADE_STARTED,
kubernetes.KUBE_UPGRADE_DOWNLOADING_... | code_fim | hard | {
"lang": "python",
"repo": "Wind-River/starlingx-config",
"path": "/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_upgrade.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wind-River/starlingx-config path: /sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_upgrade.py
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import pecan
from pecan import rest
import os
import six
import wsme
from wsme import types as wtypes
import... | code_fim | hard | {
"lang": "python",
"repo": "Wind-River/starlingx-config",
"path": "/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_upgrade.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """API representation of a collection of kubernetes upgrades."""
kube_upgrades = [KubeUpgrade]
"A list containing kubernetes upgrade objects"
def __init__(self, **kwargs):
self._type = 'kube_upgrades'
@classmethod
def convert_with_links(cls, rpc_kube_upgrade, expand=True... | code_fim | hard | {
"lang": "python",
"repo": "Wind-River/starlingx-config",
"path": "/sysinv/sysinv/sysinv/sysinv/api/controllers/v1/kube_upgrade.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>valuelist = re.compile(r'\<form\s+action=\x22\/goform\/RouterStatus\?id=(\d+)\x22\s+method=\x22post')
id = valuelist.search(r.text).group(1)
reboot_url = NETGEAR_RESET_URL + id
payload={'buttonSelect':'2','wantype':'dhcp','enable_apmode':'0'}
r = client.post(reboot_url, data=payload, auth=(USERNAME,PASSW... | code_fim | hard | {
"lang": "python",
"repo": "NateShoffner/netgear_cm700_status",
"path": "/ngcm700_reboot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NateShoffner/netgear_cm700_status path: /ngcm700_reboot.py
#!/usr/bin/env python
import requests
from requests.auth import HTTPBasicAuth
import sys
from config import *
import re
client = requests.Session()
r = client.get(NETGEAR_URL)
r = client.get(NETGEAR_ROUTER_STATUS_URL, auth=(USERNAME,PASS... | code_fim | medium | {
"lang": "python",
"repo": "NateShoffner/netgear_cm700_status",
"path": "/ngcm700_reboot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Find out how much property 64969892 is worth
zpid = '64969892'
URL = "http://www.zillow.com/webservice/GetZestimate.htm?zws-id=%s&zpid=%s" % (KEY,zpid)
print(URL)
response = requests.get(URL)
xmldata = response.text
xml = untangle.parse(xmldata)
print("URL", xml.Zestimate_zestimate.response.links.homed... | code_fim | medium | {
"lang": "python",
"repo": "Akramz/msds692",
"path": "/notes/code/zillow/zestimate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Akramz/msds692 path: /notes/code/zillow/zestimate.py
# REGISTER: https://www.zillow.com/user/Register.htm
# API REGISTER: https://www.zillow.com/webservice/Registration.htm
# API DOC: http://www.zillow.com/howto/api/APIOverview.htm
# This one does not get captcha Sept 2017
import sys
import unt... | code_fim | hard | {
"lang": "python",
"repo": "Akramz/msds692",
"path": "/notes/code/zillow/zestimate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>haloID = finddisk_135()
#a2>0.2 halos number
bar02 = 0
allhalo = 0
for i in haloID:
if allhalo%100 == 0:
print(allhalo)
try:
temp = np.load('/Raid0/zhouzb/A2_all/%d.npy'%i,'r')
except FileNotFoundError:
continue
else:
allhalo += 1
rlist ... | code_fim | hard | {
"lang": "python",
"repo": "Max-astro/A2Project",
"path": "/history/fraction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Max-astro/A2Project path: /history/fraction.py
import h5py
import numpy as np
import matplotlib.pyplot as plt
def finddisk_135():
'''Return a list of all Disk galaxies in this snapshot'''
with h5py.File('/Raid0/zhouzb/stellar_circs.hdf5','r') as cir:
return np.array(cir['S... | code_fim | hard | {
"lang": "python",
"repo": "Max-astro/A2Project",
"path": "/history/fraction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif data == 'half_r':
with h5py.File('/Raid1/Illustris/Illustris-1/Groupcat/groups_135.0.hdf5','r') as f:
half_r = np.array(f['Subhalo']['SubhaloHalfmassRadType'][:,4])
for n in range(1,8):
with h5py.File('/Raid1/Illustris/Illustris-1/Groupcat/groups_135.%d... | code_fim | hard | {
"lang": "python",
"repo": "Max-astro/A2Project",
"path": "/history/fraction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uli-ai/malt path: /malt/tests/test_point.py
import pytest
def test_import():
from malt import point
def test_build_point():
<|fim_suffix|> p = Point("C")
def test_featurize():
import dgl
from malt.point import Point
p = Point("C")
p.featurize()
assert p.is_featur... | code_fim | easy | {
"lang": "python",
"repo": "uli-ai/malt",
"path": "/malt/tests/test_point.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uli-ai/malt path: /malt/tests/test_point.py
import pytest
def test_import():
<|fim_suffix|> p = Point("C")
p.featurize()
assert p.is_featurized()
assert isinstance(
p.g,
dgl.DGLGraph,
)<|fim_middle|> from malt import point
def test_build_point():
from... | code_fim | medium | {
"lang": "python",
"repo": "uli-ai/malt",
"path": "/malt/tests/test_point.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_featurize():
import dgl
from malt.point import Point
p = Point("C")
p.featurize()
assert p.is_featurized()
assert isinstance(
p.g,
dgl.DGLGraph,
)<|fim_prefix|># repo: uli-ai/malt path: /malt/tests/test_point.py
import pytest
def test_import():
<|fi... | code_fim | medium | {
"lang": "python",
"repo": "uli-ai/malt",
"path": "/malt/tests/test_point.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osw4l/villas-de-san-pablo path: /apps/empleabilidad/models.py
from django.db import models
from django.urls import reverse_lazy
from . import constants
# Create your models here.
class Vacante(models.Model):
cargo = models.CharField(max_length=255)
salario = models.PositiveIntegerField(... | code_fim | hard | {
"lang": "python",
"repo": "osw4l/villas-de-san-pablo",
"path": "/apps/empleabilidad/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return '{} creado en {}'.format(
self.nombre_programa,
self.fecha_creacion
)
def get_update_url(self):
return reverse_lazy('empleabilidad:editar_formacion_trabajo',
kwargs={
... | code_fim | hard | {
"lang": "python",
"repo": "osw4l/villas-de-san-pablo",
"path": "/apps/empleabilidad/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keik/audiotrans-transform-istft path: /tests/tests.py
# -*- coding: utf-8 -*-
import pytest
import wave
import numpy as np
from audiotrans_transform_stft import STFTTransform
from audiotrans_transform_istft import ISTFTTransform
def test_accept_arg_of_verbose():
ISTFTTransform(['-v']) # n... | code_fim | hard | {
"lang": "python",
"repo": "keik/audiotrans-transform-istft",
"path": "/tests/tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> stft_matrix = np.concatenate((stft_matrix, stft_matrix[-2:0:-1].conj()), 0)
window_size, cols = stft_matrix.shape
win = np.hamming(window_size)
win_square = win ** 2
x = np.zeros(window_size + (cols - 1) * hop_size)
win_sum = np.zeros(window_size + (cols - 1) * hop_size)
for ... | code_fim | hard | {
"lang": "python",
"repo": "keik/audiotrans-transform-istft",
"path": "/tests/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ISTFT on batch
istft_wave = istft(stft_matrix, hop_size)
# assert equal between ISTFT on batch and stream
assert (transformed == istft_wave[:len(transformed)]).all()
def istft(stft_matrix, hop_size):
stft_matrix = np.concatenate((stft_matrix, stft_matrix[-2:0:-1].conj()), 0)
w... | code_fim | hard | {
"lang": "python",
"repo": "keik/audiotrans-transform-istft",
"path": "/tests/tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> in_file = open("development/TEST_N4333.kml", "rb")
data = in_file.read()
in_file.close()
self.dwd_weather.parse_kml(data)
self.assertEqual(self.dwd_weather.forecast_data, parsed_data)<|fim_prefix|># repo: franz-53/simple_dwd_weatherforecast path: /tests/test_parsek... | code_fim | medium | {
"lang": "python",
"repo": "franz-53/simple_dwd_weatherforecast",
"path": "/tests/test_parsekml.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: franz-53/simple_dwd_weatherforecast path: /tests/test_parsekml.py
import unittest
from simple_dwd_weatherforecast import dwdforecast
from tests.dummy_data import parsed_data
<|fim_suffix|> in_file = open("development/TEST_N4333.kml", "rb")
data = in_file.read()
in_file.cl... | code_fim | medium | {
"lang": "python",
"repo": "franz-53/simple_dwd_weatherforecast",
"path": "/tests/test_parsekml.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schwanberger/projectEuler path: /python/p35.py
# Circular primes
# Problem 35
# The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
#
# There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and... | code_fim | medium | {
"lang": "python",
"repo": "schwanberger/projectEuler",
"path": "/python/p35.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>limit = 1000000
primeSet = set(sieve(limit))
circularPrimeSet = set()
for prime in primeSet:
if prime in circularPrimeSet: continue
testPrimes = set(rotateNum(prime))
if testPrimes.issubset(primeSet):
for testPrime in testPrimes:
circularPrimeSet.add(testPrime)
print len(... | code_fim | hard | {
"lang": "python",
"repo": "schwanberger/projectEuler",
"path": "/python/p35.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(filepath, 'r') as f:
code = f.read()
code = re.sub(re.compile("/\*.*?\*/", re.DOTALL), "", code)
code = re.sub(r"(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*?$)", "", code, flags=re.MULTILINE)
self.tokens=set()
try:
for token i... | code_fim | medium | {
"lang": "python",
"repo": "iotempire/iotempower",
"path": "/bin/command_checker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: command_checker.py <file_to_check> <commands_file>")
sys.exit(1)
filepath = sys.argv[1]
commands_file = sys.argv[2]
commands = {}
with open(commands_file, 'r') as f:
for line in f:
w... | code_fim | hard | {
"lang": "python",
"repo": "iotempire/iotempower",
"path": "/bin/command_checker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iotempire/iotempower path: /bin/command_checker.py
#!/usr/bin/env python
# Do a rough tokenization of the given input source file and check which
# of the given commands are used in this code.
# Prints out the found commands as a list of defines to be included.
# The commands-input file must give... | code_fim | hard | {
"lang": "python",
"repo": "iotempire/iotempower",
"path": "/bin/command_checker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrZhang1994/mobile-federated-learning path: /src/utils/pg_pn.py
import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import copy
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import utils.Poi... | code_fim | hard | {
"lang": "python",
"repo": "MrZhang1994/mobile-federated-learning",
"path": "/src/utils/pg_pn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.device = torch.device("cuda:" + str(config.device_No) if torch.cuda.is_available() else "cpu")
self.embedding_dim = embedding_dim
self.hidden_dim = hidden_dim
self.lstm_layers = lstm_layers
self.Actor = ANetProb(embedding_dim, hidden_dim, lstm_layers)
... | code_fim | hard | {
"lang": "python",
"repo": "MrZhang1994/mobile-federated-learning",
"path": "/src/utils/pg_pn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> import numpy as np
from .utils import check_array, check_random_state, as_float_array
from .utils.extmath import safe_sparse_dot
from .utils.validation import check_is_fitted
check_is_fitted(self, 'random_weights_')
X =... | code_fim | hard | {
"lang": "python",
"repo": "bbdamodaran/PRFF",
"path": "/prff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from .utils import check_array, check_random_state, as_float_array
from .utils.extmath import safe_sparse_dot
from .utils.validation import check_is_fitted
check_is_fitted(self, 'random_weights_')
X = check_array(X, accept_sparse=... | code_fim | hard | {
"lang": "python",
"repo": "bbdamodaran/PRFF",
"path": "/prff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbdamodaran/PRFF path: /prff.py
import numpy
from sklearn.kernel_approximation import RBFSampler
from sklearn.metrics.pairwise import rbf_kernel
from sklearn.base import clone
import pylab
import time
__author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr'
class PRFF(RBFSampl... | code_fim | hard | {
"lang": "python",
"repo": "bbdamodaran/PRFF",
"path": "/prff.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hughperkins/pub-prototyping path: /cython/test1/run_hello.py
#!/usr/bin/python
from __future__ import print_function
#import hello
import array
#hello.say_hello('foo')
<|fim_suffix|>a = pymycpp.PyMyClass()
print(a.warpName('blah'))
b = pymycpp.PyMyClass(12)
print( pymycpp.addFloats(3.5,2.... | code_fim | hard | {
"lang": "python",
"repo": "hughperkins/pub-prototyping",
"path": "/cython/test1/run_hello.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#import pymyc
#print( pymyc.doSomething(5) )
import pymycpp
#print( type( 'foo') )
#print( isinstance( 'foo', str ) )
#print( isinstance( u'foo', str ) )
#print( isinstance( 'foo', unicode ) )
#print( isinstance( u'foo', unicode ) )
pymycpp.sayName('foo')
a = pymycpp.PyMyClass()
print(a.warpName('bla... | code_fim | medium | {
"lang": "python",
"repo": "hughperkins/pub-prototyping",
"path": "/cython/test1/run_hello.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MichaelBrunn3r/cdpy path: /cdpy/cdp/target.py
r of attached debugging session."""
def __repr__(self):
return f"SessionID({super().__repr__()})"
@dataclasses.dataclass
class TargetInfo:
"""
Attributes
----------
targetId: TargetID
type: str
title: str
url... | code_fim | hard | {
"lang": "python",
"repo": "MichaelBrunn3r/cdpy",
"path": "/cdpy/cdp/target.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MichaelBrunn3r/cdpy path: /cdpy/cdp/target.py
ss
class TargetInfo:
"""
Attributes
----------
targetId: TargetID
type: str
title: str
url: str
attached: bool
Whether the target has an attached client.
canAccessOpener: bool
Whether the tar... | code_fim | hard | {
"lang": "python",
"repo": "MichaelBrunn3r/cdpy",
"path": "/cdpy/cdp/target.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sessionId: SessionID
message: str
targetId: Optional[TargetID] = None
@classmethod
def from_json(cls, json: dict) -> ReceivedMessageFromTarget:
return cls(
SessionID(json["sessionId"]),
json["message"],
TargetID(json["targetId"]) if "targetI... | code_fim | hard | {
"lang": "python",
"repo": "MichaelBrunn3r/cdpy",
"path": "/cdpy/cdp/target.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onap/vnfsdk-pkgtools path: /tests/vnfreq/test_vnfreq.py
# Copyright (c) 2018 Intel Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# h... | code_fim | hard | {
"lang": "python",
"repo": "onap/vnfsdk-pkgtools",
"path": "/tests/vnfreq/test_vnfreq.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _do_check(self, reader, tosca):
return 'error'
def test_check_and_print(mocker):
mocker.patch('vnfsdk_pkgtools.vnfreq.get_vnfreq_tester', new=FakeTester)
ret = vnfreq.check_and_print(['fake'], mocker.Mock(), mocker.Mock())
assert ret == 1<|fim_prefix|># repo: onap/vnfsdk-pkgt... | code_fim | medium | {
"lang": "python",
"repo": "onap/vnfsdk-pkgtools",
"path": "/tests/vnfreq/test_vnfreq.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_wrong_json(self):
self.assertRaises(json.decoder.JSONDecodeError, model.ConfigManager, self.path3)
def test_sanitize_ok(self):
self.assertEqual(
model.ConfigManager(self.path1).sanitize(
{
"input": (1, (list, ("archive",), m... | code_fim | hard | {
"lang": "python",
"repo": "albanb/tribud",
"path": "/tests/model_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: albanb/tribud path: /tests/model_test.py
fig.py module.
"""
# pylint: disable=missing-function-docstring
# No need to add a docstring to each tests.
import os.path
import unittest
import shutil
import json
import sys
from context import model
class UtilsTest(unittest.TestCase):
"""
Thi... | code_fim | hard | {
"lang": "python",
"repo": "albanb/tribud",
"path": "/tests/model_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: albanb/tribud path: /tests/model_test.py
ction-docstring
# No need to add a docstring to each tests.
import os.path
import unittest
import shutil
import json
import sys
from context import model
class UtilsTest(unittest.TestCase):
"""
This class will test the model functions.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "albanb/tribud",
"path": "/tests/model_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pootle/pyweb path: /examples/piCamera/camRecorder.py
acktime' : 0, # target time for video to start before trigger
'vr_forwtime' : 3, # target time for video to carry on after trigger stops
'vr_record_limit':20, # max len... | code_fim | hard | {
"lang": "python",
"repo": "pootle/pyweb",
"path": "/examples/piCamera/camRecorder.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def processfiles(self, data):
print('processfiles requests', data)
if self.procthread is None:
self.procqueue=queue.Queue()
self.procthread=threading.Thread(name='video_record', target=self.fileprocessor, kwargs={'q': self.procqueue})
self.procthread... | code_fim | hard | {
"lang": "python",
"repo": "pootle/pyweb",
"path": "/examples/piCamera/camRecorder.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pootle/pyweb path: /examples/piCamera/camRecorder.py
mport threading, queue, time, pathlib, shutil
from subprocess import Popen, PIPE
from flask import jsonify
from flaskextras import Webpart
class VideoRecorder(Webpart):
"""
Records H264 on demand.
It uses triggers to start rec... | code_fim | hard | {
"lang": "python",
"repo": "pootle/pyweb",
"path": "/examples/piCamera/camRecorder.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: irff/summarizer path: /app.py
import random
import errno
import os
import sys
from summarizer import Summarizer
from googletrans import Translator
from settings import CHANNEL_SECRET, CHANNEL_ACCESS_TOKEN
from argparse import ArgumentParser
from flask import Flask, request, abort
from linebot imp... | code_fim | hard | {
"lang": "python",
"repo": "irff/summarizer",
"path": "/app.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# arg_parser = ArgumentParser(
# usage='Usage: python ' + __file__ + ' [--port <port>] [--help]'
# )
# arg_parser.add_argument('-p', '--port', default=8000, help='port')
# arg_parser.add_argument('-d', '--debug', default=False, help='debug')
# option... | code_fim | hard | {
"lang": "python",
"repo": "irff/summarizer",
"path": "/app.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'role' in metafunc.fixturenames:
metafunc.parametrize('role', get_roles())<|fim_prefix|># repo: bibliosansfrontieres/cdn-ideascube path: /tests/conftest.py
import os
def get_files(extension):
for root, dirnames, filenames in os.walk('.'):
for filename in filenames:
... | code_fim | hard | {
"lang": "python",
"repo": "bibliosansfrontieres/cdn-ideascube",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'jinja2_file' in metafunc.fixturenames:
metafunc.parametrize('jinja2_file', get_files('.j2'))
if 'json_file' in metafunc.fixturenames:
metafunc.parametrize('json_file', get_files('.fact'))
if 'role' in metafunc.fixturenames:
metafunc.parametrize('role', get_roles()... | code_fim | medium | {
"lang": "python",
"repo": "bibliosansfrontieres/cdn-ideascube",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bibliosansfrontieres/cdn-ideascube path: /tests/conftest.py
import os
def get_files(extension):
for root, dirnames, filenames in os.walk('.'):
for filename in filenames:
if filename.endswith(extension):
yield os.path.join(root, filename)
def get_roles()... | code_fim | medium | {
"lang": "python",
"repo": "bibliosansfrontieres/cdn-ideascube",
"path": "/tests/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while heap and A < l and B < l:
_, cost = heappop(heap)
if cost[0] <= cost[1]:
A += 1
ans += cost[0]
else:
B += 1
ans += cost[1]
# Remaining elements
index = 0 if A < B else... | code_fim | hard | {
"lang": "python",
"repo": "saisankargochhayat/algo_quest",
"path": "/leetcode/1029. Two City Scheduling/soln.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saisankargochhayat/algo_quest path: /leetcode/1029. Two City Scheduling/soln.py
# Plain old sorting by difference of A and B.
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
<|fim_suffix|> while heap and A < l and B < l:
_, cost = heappop(heap)
... | code_fim | hard | {
"lang": "python",
"repo": "saisankargochhayat/algo_quest",
"path": "/leetcode/1029. Two City Scheduling/soln.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def twoCitySchedCost(self, costs: List[List[int]]) -> int:
import heapq
A, B, l, ans = 0, 0, len(costs)/2, 0
heap = []
for cost in costs:
diff = abs(cost[1] - cost[0])
heappush(heap, (-diff, cost))
while heap and A < l and B < l:... | code_fim | hard | {
"lang": "python",
"repo": "saisankargochhayat/algo_quest",
"path": "/leetcode/1029. Two City Scheduling/soln.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kairoaraujo/PowerAdm path: /poweradm/mkosdeploy.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PowerAdm
mkosdeploy.py
Copyright (c) 2014-2016 Kairo Araujo.
It was created for personal use. There are no guarantees of the author.
Use at your own risk.
Permission to use, copy, modify, and d... | code_fim | hard | {
"lang": "python",
"repo": "kairoaraujo/PowerAdm",
"path": "/poweradm/mkosdeploy.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> f_nim_exe.write('\n\necho "Getting the Mac Address from %s-%s"\n'
% (self.lparprefix, self.lparname))
f_nim_exe.write('echo "This might take a few minutes..."\n')
f_nim_exe.write('\n\nmac_address=$(ssh -l poweradm %s '
... | code_fim | hard | {
"lang": "python",
"repo": "kairoaraujo/PowerAdm",
"path": "/poweradm/mkosdeploy.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lvchigo/keras_imagenet path: /predict_image.py
"""predict_image.py
This script is for testing a trained Keras ImageNet model.
Example usage:
$ python3 predict_image.py saves/googlenet_bn-model-final.h5 \
sample.jpg
"""
import argparse
import numpy as np
impor... | code_fim | medium | {
"lang": "python",
"repo": "lvchigo/keras_imagenet",
"path": "/predict_image.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from utils.utils import config_keras_backend, clear_keras_session
from models.adamw import AdamW
def parse_args():
"""Parse command-line arguments."""
parser = argparse.ArgumentParser()
parser.add_argument('model',
help='e.g. saves/googlenet_bn-model-final.h5')
pa... | code_fim | medium | {
"lang": "python",
"repo": "lvchigo/keras_imagenet",
"path": "/predict_image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parse_args()
# load the cls_list (index to class name)
with open('data/synset_words.txt') as f:
cls_list = sorted(f.read().splitlines())
config_keras_backend()
# load the trained model
net = tf.keras.models.load_model(
args.model,
compile=False,
... | code_fim | hard | {
"lang": "python",
"repo": "lvchigo/keras_imagenet",
"path": "/predict_image.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> game_engine = GameEngine(scene_stack)
game_engine.run()
if __name__ == "__main__":
main()<|fim_prefix|># repo: RippeR37/PyPong path: /PyPong.py
from Systems.Engine.GameEngine import GameEngine
from Systems.Engine.SceneStack import SceneStack
from Systems.Scenes.MenuScene import MenuScene
... | code_fim | medium | {
"lang": "python",
"repo": "RippeR37/PyPong",
"path": "/PyPong.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RippeR37/PyPong path: /PyPong.py
from Systems.Engine.GameEngine import GameEngine
from Systems.Engine.SceneStack import SceneStack
from Systems.Scenes.MenuScene import MenuScene
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_middle|>def main():
scene_stack = SceneStack()
scene... | code_fim | medium | {
"lang": "python",
"repo": "RippeR37/PyPong",
"path": "/PyPong.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: riag/easy-wrk path: /easywrk/common.py
#coding:utf8
import os
import sys
import attr
import logging
import base64
from pathlib import Path
from requests import Request
from dotenv import load_dotenv
from jinja2 import Environment, FileSystemLoader
import requests
from typing import List, Dict,... | code_fim | hard | {
"lang": "python",
"repo": "riag/easy-wrk",
"path": "/easywrk/common.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if name.startswith('/'):
raise BuildRequestException(f"field [{field.name}] cannot start with [/]")
if name.endswith('/'):
name = name[0:-1]
if name in finish_fields:
raise BuildRequestException(f"field [{field.name}] already in json data")
... | code_fim | hard | {
"lang": "python",
"repo": "riag/easy-wrk",
"path": "/easywrk/common.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: c-goldschmidt/FLShipMatrix path: /importer/importer/timer.py
import time
class Timer(object):
def __init__(self, logger_fnc):
<|fim_suffix|> def step(self, message):
self._format_message(message)
self.timers[self.level] = time.clock()
def stop(self, message):
... | code_fim | medium | {
"lang": "python",
"repo": "c-goldschmidt/FLShipMatrix",
"path": "/importer/importer/timer.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.step(message)
self.level -= 1
def _format_message(self, message):
delta = time.clock() - self.timers[self.level]
self.logger_fnc('[{:.3f}s] {}'.format(delta, message))<|fim_prefix|># repo: c-goldschmidt/FLShipMatrix path: /importer/importer/timer.py
import time
... | code_fim | medium | {
"lang": "python",
"repo": "c-goldschmidt/FLShipMatrix",
"path": "/importer/importer/timer.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: madcowfred/evething path: /import_masteries.py
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification... | code_fim | hard | {
"lang": "python",
"repo": "madcowfred/evething",
"path": "/import_masteries.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ship_masteries = {}
for row in self.cursor:
if row[1] > 0:
if row[3] not in ship_masteries:
ship_masteries[row[3]] = {
'typeID': row[3],
'name': row[4],
'masteries': {}
... | code_fim | hard | {
"lang": "python",
"repo": "madcowfred/evething",
"path": "/import_masteries.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.cursor.execute("""
SELECT s.skillID, s.skillLevel, m.masteryLevel, t.typeID, t.typeName
FROM certSkills AS s
JOIN certMasteries AS m ON s.certId = m.certID AND s.certLevelInt = m.masteryLevel
JOIN invTypes AS t on m.typeId = t.typeID
"""... | code_fim | hard | {
"lang": "python",
"repo": "madcowfred/evething",
"path": "/import_masteries.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ragoragino/py-hawkes path: /examples/pyhawkes_import.py
import sys
import os
# Appending directory above the current one to the sys.path
cur_dir = os.path.dirname(os.path.realpath<|fim_suffix|>oin(split_dir[:-1])
sys.path.append(above_dir)
import pyhawkes<|fim_middle|>(__file__))
split_dir = cur... | code_fim | medium | {
"lang": "python",
"repo": "ragoragino/py-hawkes",
"path": "/examples/pyhawkes_import.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>oin(split_dir[:-1])
sys.path.append(above_dir)
import pyhawkes<|fim_prefix|># repo: ragoragino/py-hawkes path: /examples/pyhawkes_import.py
import sys
import os
# Appending directory above the current <|fim_middle|>one to the sys.path
cur_dir = os.path.dirname(os.path.realpath(__file__))
split_dir = cur... | code_fim | medium | {
"lang": "python",
"repo": "ragoragino/py-hawkes",
"path": "/examples/pyhawkes_import.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sevdimali/fast-tools path: /tests/test_limit.py
import asyncio
import time
import aioredis # type: ignore
import pytest
from requests import Response # type: ignore
from starlette.testclient import TestClient
from example.limit import app
from fast_tools.base.redis_helper import RedisHelper
f... | code_fim | hard | {
"lang": "python",
"repo": "sevdimali/fast-tools",
"path": "/tests/test_limit.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = client.get("/decorator?user=user1")
assert response.json() == {"Hello": "World"}
response = client.get("/decorator?user=user1")
assert response.status_code == 429
for _ in range(2):
response = client.get("/decorator?us... | code_fim | hard | {
"lang": "python",
"repo": "sevdimali/fast-tools",
"path": "/tests/test_limit.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
'id': self.id,
'key': self.key,
'name': self.name,
'description': self.description,
'active': self.active,
}
def apply_dict(self, values):
self.id = values.get('id', None)
self.key = values.get('key',... | code_fim | hard | {
"lang": "python",
"repo": "Longi94/rl-loadout",
"path": "/backend/entity/api_key.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def apply_dict(self, values):
self.id = values.get('id', None)
self.key = values.get('key', None)
self.name = values.get('name', None)
self.description = values.get('description', None)
self.active = values.get('active', False)<|fim_prefix|># repo: Longi94/rl-lo... | code_fim | hard | {
"lang": "python",
"repo": "Longi94/rl-loadout",
"path": "/backend/entity/api_key.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Longi94/rl-loadout path: /backend/entity/api_key.py
from sqlalchemy import Column, String, Boolean, Integer
from .base import Base
class ApiKey(Base):
__tablename__ = 'api_key'
id = Column(Integer, primary_key=True)
key = Column(String(32), nullable=False, unique=True)
name = C... | code_fim | medium | {
"lang": "python",
"repo": "Longi94/rl-loadout",
"path": "/backend/entity/api_key.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Athenian-ComputerScience-Fall2020/tic-tac-toe-ChienT1993 path: /my_code.py
# Collaborators (including web sites where you got help: https://www.w3schools.com/python/default.asp
#
# A note on style: Dictionaries can be defined before or after functions.
import random
board = {'TL': ' ', 'TM': '... | code_fim | hard | {
"lang": "python",
"repo": "Athenian-ComputerScience-Fall2020/tic-tac-toe-ChienT1993",
"path": "/my_code.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def strike_X(strikes):#strike and win
print ("Here are the options for your strike's position:")
print (position)
x = input("Which position do you want to strike?: ")
position.remove(x)
board[x] = 'X'
strikes = strikes + 1
tictactoe(board)
if board['TL'] == 'X' and board['T... | code_fim | hard | {
"lang": "python",
"repo": "Athenian-ComputerScience-Fall2020/tic-tac-toe-ChienT1993",
"path": "/my_code.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> random_int = random.randint(1,2)
try:
turn = int(input(player_1 + " choose either 1 or 2: "))
if turn == random_int:
print (player_1, "(X) go first and " + player_2 + " (O) go second")
elif turn != random_int and turn < 3:#seems like any number other then 1 or 2... | code_fim | hard | {
"lang": "python",
"repo": "Athenian-ComputerScience-Fall2020/tic-tac-toe-ChienT1993",
"path": "/my_code.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bvbohnen/X4_Customizer path: /Plugins/Analyses/Print_Object_Stats.py
from collections import defaultdict, OrderedDict
from lxml import etree as ET
from Framework import Analysis_Wrapper
from Framework import File_System
from Framework import Settings
from Framework import Live_Editor
from Frame... | code_fim | hard | {
"lang": "python",
"repo": "bvbohnen/X4_Customizer",
"path": "/Plugins/Analyses/Print_Object_Stats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def Write_Tables(file_name, *tables):
'''
Writes one or more tables (list of lists) to output files.
'''
# Now pick a format to print to.
# TODO: move these into a support module.
# CSV initially.
with open(Settings.Get_Output_Folder() / (file_name+'.csv'), 'w') as file:
... | code_fim | hard | {
"lang": "python",
"repo": "bvbohnen/X4_Customizer",
"path": "/Plugins/Analyses/Print_Object_Stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def Write_Tables(file_name, *tables):
'''
Writes one or more tables (list of lists) to output files.
'''
# Now pick a format to print to.
# TODO: move these into a support module.
# CSV initially.
with open(Settings.Get_Output_Folder() / (file_name+'.csv'), 'w') as file:
... | code_fim | hard | {
"lang": "python",
"repo": "bvbohnen/X4_Customizer",
"path": "/Plugins/Analyses/Print_Object_Stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erjan/coding_exercises path: /maximum_sum_score_of_array.py
'''
You are given a 0-indexed integer array nums of length n.
The sum score of nums at an index i where 0 <= i < n is the maximum of:
The sum of the first i + 1 elements of nums.
The sum of the last n - i elements of nums.
Return the ... | code_fim | hard | {
"lang": "python",
"repo": "erjan/coding_exercises",
"path": "/maximum_sum_score_of_array.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> temp = max(pref[i], suf[i])
if temp > res:
res = temp
print('res', res)
return res
------------------------------------------------------
class Solution:
def maximumSumScore(self, nums: List[int]) -> int:
ans = -sys.maxsiz... | code_fim | hard | {
"lang": "python",
"repo": "erjan/coding_exercises",
"path": "/maximum_sum_score_of_array.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktatarnikov/time-series path: /preprocessing/preprocessing.py
import os
import sys
from datetime import date
from datetime import timedelta as td
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
class TimeSeriesPreprocessor... | code_fim | hard | {
"lang": "python",
"repo": "ktatarnikov/time-series",
"path": "/preprocessing/preprocessing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Ensure that there is one and only one point exists for the self.probe_period_seconds.
If the point does not exists then it creates the point with NaN value.
If there are multiple points exists it downsample the point with mean value.
Parameters
--------... | code_fim | hard | {
"lang": "python",
"repo": "ktatarnikov/time-series",
"path": "/preprocessing/preprocessing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Q3
for param in os.environ.keys():
if param == "HTTP_USER_AGENT":
print("<br><br><b>%20s<b>: %s<br>" % (param, os.environ[param]))<|fim_prefix|># repo: MPARASHA/CMPUT404Labs path: /Lab3/hello.py
#!/usr/bin/env python3
import os, json
import cgitb
cgitb.enable()
print("Content-type:text/ht... | code_fim | medium | {
"lang": "python",
"repo": "MPARASHA/CMPUT404Labs",
"path": "/Lab3/hello.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Q2
for param in os.environ.keys():
if param == "QUERY_STRING":
print("<br><br><b>%20s</b>: %s<b>" % (param, os.environ[param]))
# Q3
for param in os.environ.keys():
if param == "HTTP_USER_AGENT":
print("<br><br><b>%20s<b>: %s<br>" % (param, os.environ[param]))<|fim_prefix|># repo... | code_fim | medium | {
"lang": "python",
"repo": "MPARASHA/CMPUT404Labs",
"path": "/Lab3/hello.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MPARASHA/CMPUT404Labs path: /Lab3/hello.py
#!/usr/bin/env python3
import os, json
import cgitb
cgitb.enable()
print("Content-type:text/html\r\n\r\n")
print()
print("<title>Test CGI</title>")
print("<p>Hello World!</p>")
# Q1
json_object = json.dumps(dict(os.environ), indent=4)
print(json_objec... | code_fim | medium | {
"lang": "python",
"repo": "MPARASHA/CMPUT404Labs",
"path": "/Lab3/hello.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danjsouther/satisfactory-planning path: /satisfactory_planning/components/wire.py
from ..component import Component
from ..machine import Constructor
from .ingot import Copper
<|fim_suffix|> production = Constructor(
inputs = [Copper(1)],
output = 3,
rate = 45
)<|fim_middle|>class Wire(Co... | code_fim | easy | {
"lang": "python",
"repo": "danjsouther/satisfactory-planning",
"path": "/satisfactory_planning/components/wire.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> production = Constructor(
inputs = [Copper(1)],
output = 3,
rate = 45
)<|fim_prefix|># repo: danjsouther/satisfactory-planning path: /satisfactory_planning/components/wire.py
from ..component import Component
from ..machine import Constructor
from .ingot import Copper
<|fim_middle|>class Wire(Co... | code_fim | easy | {
"lang": "python",
"repo": "danjsouther/satisfactory-planning",
"path": "/satisfactory_planning/components/wire.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Exception wrapper class used by vars file parser
'''
class DeployConfigError(Exception):
'''
Exception wrapper class used for the deploy config
'''
def __init__(self, msg, line=None, path=None):
if line:
msg = 'line %d: %s' % (line, msg)
if p... | code_fim | hard | {
"lang": "python",
"repo": "ApplauseOSS/deploy-config-generator",
"path": "/deploy_config_generator/errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Exception wrapper class used when loading the site config
'''
class TemplateUndefinedError(Exception):
'''
Exception wrapper class used for undefined var errors when templating
'''<|fim_prefix|># repo: ApplauseOSS/deploy-config-generator path: /deploy_config_generator/error... | code_fim | hard | {
"lang": "python",
"repo": "ApplauseOSS/deploy-config-generator",
"path": "/deploy_config_generator/errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ApplauseOSS/deploy-config-generator path: /deploy_config_generator/errors.py
class VarsParseError(Exception):
'''
Exception wrapper class used by vars file parser
'''
def __init__(self, msg, line=None, path=None):
if line:
msg = 'line %d: %s' % (line, msg)
... | code_fim | hard | {
"lang": "python",
"repo": "ApplauseOSS/deploy-config-generator",
"path": "/deploy_config_generator/errors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rgamez/pcapi path: /src/lib/cobweb_parser.py
import html5lib, re, json, os
from bs4 import BeautifulSoup
class COBWEBFormParser:
def __init__(self, content):
self.content = content
def extract(self):
return json.dumps(self._get_dict_from_html())
def _get_dict_from_... | code_fim | hard | {
"lang": "python",
"repo": "rgamez/pcapi",
"path": "/src/lib/cobweb_parser.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_simple_input(self, tag, itype, vtype, q):
element = {}
element["input_type"] = itype
element["value_type"] = vtype
element["question"] = q
element["field-id"] = tag.get('id')
element["id"] = tag.get('id').split("-")[2]
element["children"... | code_fim | hard | {
"lang": "python",
"repo": "rgamez/pcapi",
"path": "/src/lib/cobweb_parser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> element = {}
element["input_type"] = itype
element["value_type"] = vtype
element["question"] = q
element["field-id"] = tag.get('id')
element["id"] = tag.get('id').split("-")[2]
element["children"] = {}
return element
if __name__ == "__main__... | code_fim | hard | {
"lang": "python",
"repo": "rgamez/pcapi",
"path": "/src/lib/cobweb_parser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Remit/autoscaling-simulator path: /autoscalingsim/scaling/policiesbuilder/metric/forecasting/models/arima/arima_base.py
import warnings
import pandas as pd
from autoscalingsim.scaling.policiesbuilder.metric.forecasting.forecasting_model import ForecastingModel
from autoscalingsim.utils.error_che... | code_fim | hard | {
"lang": "python",
"repo": "Remit/autoscaling-simulator",
"path": "/autoscalingsim/scaling/policiesbuilder/metric/forecasting/models/arima/arima_base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with warnings.catch_warnings():
warnings.simplefilter('ignore')
forecast_interval = self._construct_future_interval(cur_timestamp)
forecast = self._model_fitted.predict(start = min(forecast_interval), end = max(forecast_interval)) if not self._model_fitted is No... | code_fim | hard | {
"lang": "python",
"repo": "Remit/autoscaling-simulator",
"path": "/autoscalingsim/scaling/policiesbuilder/metric/forecasting/models/arima/arima_base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if exclude is not False:
to_remove = []
for op, pat in exclude.items():
pat = filtermaker(pat)
for tok in lks:
if op == 'g':
for l in deps.links:
... | code_fim | hard | {
"lang": "python",
"repo": "whrl/corpkit",
"path": "/corpkit/interrogator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whrl/corpkit path: /corpkit/interrogator.py
title_stripped.append(head)
output.append(title_stripped)
return output
def convert_spelling(list_of_matches, spelling = 'US'):
from dictionaries.word_transforms import usa_convert
if spelling == 'UK':
... | code_fim | hard | {
"lang": "python",
"repo": "whrl/corpkit",
"path": "/corpkit/interrogator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whrl/corpkit path: /corpkit/interrogator.py
ode_by_idx(lk.id)
if 'w' in show:
single_result['w'] = 'none'
if lemmatise:
single_result['w'] = lk.lemma
else:
single_result['w... | code_fim | hard | {
"lang": "python",
"repo": "whrl/corpkit",
"path": "/corpkit/interrogator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Enter number: "))
digit = 0
while digit < num:
print(digit+1, " - ", result[digit]['name'], result[digit]['market_cap'])
digit += 1<|fim_prefix|># repo: nazmurat/assignment1--master path: /src/src.py
from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI()
result = cg.<|fim_middle|>get_coins_mark... | code_fim | medium | {
"lang": "python",
"repo": "nazmurat/assignment1--master",
"path": "/src/src.py",
"mode": "spm",
"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.