text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Cerisedw/Python_cours path: /test_tree.py
import random
tree_age = 1
state = "alive"
value = 1
age_display = "Your tree have an age of: {}".format(tree_age)
state_display = "Your tree is {}.".format(state)
def tree_state(x):
if x <= 19:
state = "alive"
retur... | code_fim | hard | {
"lang": "python",
"repo": "Cerisedw/Python_cours",
"path": "/test_tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if action == "2" :
value = 2
elif action == "1" :
tree_age += 1
#la fonction tree_state ne se lance pas je crois
tree_state(tree_age)
print(state)
if state == "dead":
... | code_fim | hard | {
"lang": "python",
"repo": "Cerisedw/Python_cours",
"path": "/test_tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: holzschu/Carnets path: /Library/lib/python3.7/site-packages/networkx/version.py
"""
Version information for NetworkX, created during installation.
<|fim_suffix|># Format: a 'datetime.datetime' instance
date_info = datetime.datetime(2019, 4, 11, 20, 57, 18)
# Format: (vcs, vcs_tuple)
vcs_info = ... | code_fim | hard | {
"lang": "python",
"repo": "holzschu/Carnets",
"path": "/Library/lib/python3.7/site-packages/networkx/version.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
import datetime
version = '2.3'
date = 'Thu Apr 11 20:57:18 2019'
# Was NetworkX built from a development version? If so, remember that the major
# and minor versions reference the "target" (rather than "current") release.
dev = False
# Format: (name, major, min, revision)
version_info = ('network... | code_fim | medium | {
"lang": "python",
"repo": "holzschu/Carnets",
"path": "/Library/lib/python3.7/site-packages/networkx/version.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Format: a 'datetime.datetime' instance
date_info = datetime.datetime(2019, 4, 11, 20, 57, 18)
# Format: (vcs, vcs_tuple)
vcs_info = (None, (None, None))<|fim_prefix|># repo: holzschu/Carnets path: /Library/lib/python3.7/site-packages/networkx/version.py
"""
Version information for NetworkX, created du... | code_fim | hard | {
"lang": "python",
"repo": "holzschu/Carnets",
"path": "/Library/lib/python3.7/site-packages/networkx/version.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tli37/cs50save path: /pset6/dna/dna.py
import csv
from sys import argv
import re
import sys
datasave=[]
if len(argv) is not 3: #stop usage if not correct input
print('Usage: python dna.py data.csv sequence.txt')
sys.exit()
#open CSV file and save
with open (argv[1],'r') as csv_file:
... | code_fim | hard | {
"lang": "python",
"repo": "tli37/cs50save",
"path": "/pset6/dna/dna.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(rowlength):
newcount= 0
STR1= STR(i)
while True:
Bfound = re.findall(STR1*newcount,seqfile2)
if re.findall(STR1*newcount, seqfile2) == [] :
countvector.append(newcount-1)
break
else:
newcount += 1
countve... | code_fim | medium | {
"lang": "python",
"repo": "tli37/cs50save",
"path": "/pset6/dna/dna.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
countvector= str(countvector)[1:-1] #some formatting lines, converting first integers to string
countvector1= countvector.replace(',','') #removing ,
search_list= countvector1.split(' ') #splitting into list cuz the database i saved as list
rowcount=0
rowplacement=0
for row in datasave:
indexcount... | code_fim | hard | {
"lang": "python",
"repo": "tli37/cs50save",
"path": "/pset6/dna/dna.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Adjective-Object/csc321 path: /a3/p4-obselete/get_data.py
from pylab import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import random
import time
from scipy.misc import imread
from scipy.misc import imresize
import matplotlib.image as mpimg
import os
from... | code_fim | hard | {
"lang": "python",
"repo": "Adjective-Object/csc321",
"path": "/a3/p4-obselete/get_data.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> img_thumb.save(".".join(local_file_out.split(".")[:-1]) + ".png", "png")
os.remove(local_file_in)
except Exception as e:
print("error processing %s -> %s %s" %
(local_file_in, local_file_out, face_coords))
traceback.print_exc(e)
print
pr... | code_fim | hard | {
"lang": "python",
"repo": "Adjective-Object/csc321",
"path": "/a3/p4-obselete/get_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
seen_actors = set()
bounds_ratio = 0.0
smallest_width = -1
for line in open(path):
spl = line.split("\t")
coords = map(lambda a: int(a), spl[4].split(","))
width = coords[2] - coords[0]
c_ratio = float(width) / (coords[3] - coords[1])
if c_ratio >... | code_fim | hard | {
"lang": "python",
"repo": "Adjective-Object/csc321",
"path": "/a3/p4-obselete/get_data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxmasli/Chat path: /server/server.py
from Socket import Socket
import threading
class Server(Socket):
def __init__(self):
super(Server, self).__init__()
print("server listening")
self.users = []
def set_up(self):
<|fim_suffix|> def accept_sockets(self):
... | code_fim | hard | {
"lang": "python",
"repo": "maxmasli/Chat",
"path": "/server/server.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def send_data(self, data):
for user in self.users:
try:
user.send(data)
except ConnectionResetError:
self.users.pop(self.users.index(user))
pass
def listen_socket(self, listened_socket=None):
countForDel = 0
... | code_fim | hard | {
"lang": "python",
"repo": "maxmasli/Chat",
"path": "/server/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
user_socket, address = self.accept()
print(f"User <{address[0]}> connected!")
self.users.append(user_socket) # добавляется юзер
print(len(self.users))
listen_accepted_user = threading.Thread(
target=self.list... | code_fim | hard | {
"lang": "python",
"repo": "maxmasli/Chat",
"path": "/server/server.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-contracting/kingfisher-collect path: /kingfisher_scrapy/spiders/france.py
import scrapy
from kingfisher_scrapy.base_spiders import BigFileSpider
from kingfisher_scrapy.util import components, handle_http_error
class France(BigFileSpider):
"""
Domain
France
Swagger API do... | code_fim | hard | {
"lang": "python",
"repo": "open-contracting/kingfisher-collect",
"path": "/kingfisher_scrapy/spiders/france.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @handle_http_error
def parse_list(self, response):
for resource in response.json()['resources']:
description = resource['description']
if description and 'ocds' in description.lower():
yield self.build_request(resource['url'], formatter=components(-2... | code_fim | hard | {
"lang": "python",
"repo": "open-contracting/kingfisher-collect",
"path": "/kingfisher_scrapy/spiders/france.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>app.register_blueprint(my_log_pb, url_prefix='/my_log')
if __name__ == '__main__':
app.run(debug=True)<|fim_prefix|># repo: haifeng201909/airflow-plugin path: /__init__.py
from airflow.plugins_manager import AirflowPlugin
from flask import Blueprint, Flask
from rest_api.log.views import views
from r... | code_fim | hard | {
"lang": "python",
"repo": "haifeng201909/airflow-plugin",
"path": "/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haifeng201909/airflow-plugin path: /__init__.py
from airflow.plugins_manager import AirflowPlugin
from flask import Blueprint, Flask
from rest_api.log.views import views
from rest_api.route.log_route import log
from rest_api.route.mylog_route import my_log_pb
from rest_api.route.native_log_route ... | code_fim | hard | {
"lang": "python",
"repo": "haifeng201909/airflow-plugin",
"path": "/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f"Expt {name}:\t{len(specifications)/num_seeds} specs to run, over {num_seeds} seeds")
for spec in specifications:
if spec["seed"] == 0:
print(spec)
runner = ExperimentRunner()
map_memory(base_specs["file"], base_specs["state_space_dimensionality"])
DEBUG = F... | code_fim | hard | {
"lang": "python",
"repo": "uscresl/AdaptiveSamplingPOMCP",
"path": "/launch_combo_expt.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uscresl/AdaptiveSamplingPOMCP path: /launch_combo_expt.py
import logging
import os
from os.path import exists, abspath, join, dirname
from os import mkdir
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["MP_NUM_THREADS"] = "1"
from smallab.runner_implementations.multiprocessing_runner import Mult... | code_fim | hard | {
"lang": "python",
"repo": "uscresl/AdaptiveSamplingPOMCP",
"path": "/launch_combo_expt.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> specifications = []
specifications += specs_baseline
specifications += specs_our_best
print(f"Expt {name}:\t{len(specifications)/num_seeds} specs to run, over {num_seeds} seeds")
for spec in specifications:
if spec["seed"] == 0:
print(spec)
runner = Experiment... | code_fim | hard | {
"lang": "python",
"repo": "uscresl/AdaptiveSamplingPOMCP",
"path": "/launch_combo_expt.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RaumbelegungSerializer(serializers.ModelSerializer):
class Meta:
model = models.Raumbelegung
fields = [
"Belegt",
"Belegungsgrund",
]<|fim_prefix|># repo: janmolter/Raumplanung path: /room/serializers.py
from rest_framework import serializers
fr... | code_fim | hard | {
"lang": "python",
"repo": "janmolter/Raumplanung",
"path": "/room/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janmolter/Raumplanung path: /room/serializers.py
from rest_framework import serializers
from . import models
class RaumSerializer(serializers.ModelSerializer):
class Meta:
model = models.Raum
fields = [
"Raumnummer",
"Anzahl_Sitzplaetze",
... | code_fim | medium | {
"lang": "python",
"repo": "janmolter/Raumplanung",
"path": "/room/serializers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = models.Raumbelegung
fields = [
"Belegt",
"Belegungsgrund",
]<|fim_prefix|># repo: janmolter/Raumplanung path: /room/serializers.py
from rest_framework import serializers
from . import models
class RaumSerializer(serializers.ModelS... | code_fim | hard | {
"lang": "python",
"repo": "janmolter/Raumplanung",
"path": "/room/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmhuer/specCNN_sound_classification path: /Model/__init__.py
from .models import CNNClassifier, load_weights, <|fim_suffix|>orms import image_transforms, tensor_transform
from .utils import newest_model, Dataset, load_data<|fim_middle|>LastLayer_Alexnet, classes, MyResNet
from .transf | code_fim | easy | {
"lang": "python",
"repo": "jmhuer/specCNN_sound_classification",
"path": "/Model/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>orms import image_transforms, tensor_transform
from .utils import newest_model, Dataset, load_data<|fim_prefix|># repo: jmhuer/specCNN_sound_classification path: /Model/__init__.py
from .models import CNNClassifier, load_weights, <|fim_middle|>LastLayer_Alexnet, classes, MyResNet
from .transf | code_fim | easy | {
"lang": "python",
"repo": "jmhuer/specCNN_sound_classification",
"path": "/Model/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>om .utils import newest_model, Dataset, load_data<|fim_prefix|># repo: jmhuer/specCNN_sound_classification path: /Model/__init__.py
from .models import CNNClassifier, load_weights, LastLayer_Alexnet, classes, MyResNet
from .transf<|fim_middle|>orms import image_transforms, tensor_transform
fr | code_fim | easy | {
"lang": "python",
"repo": "jmhuer/specCNN_sound_classification",
"path": "/Model/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("class C")
obj1 = C()
obj1.m()
print(C.mro()) # Method Resolution Order based on convention of "OBJECT" super class<|fim_prefix|># repo: VenkatDundi/Snippets path: /Inherit_3.py
class A():
def m(self):
print("Class A")
class B():
def m(self):
print("C... | code_fim | easy | {
"lang": "python",
"repo": "VenkatDundi/Snippets",
"path": "/Inherit_3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VenkatDundi/Snippets path: /Inherit_3.py
class A():
def m(self):
print("Class A")
<|fim_suffix|>obj1 = C()
obj1.m()
print(C.mro()) # Method Resolution Order based on convention of "OBJECT" super class<|fim_middle|>class B():
def m(self):
print("Class B")... | code_fim | medium | {
"lang": "python",
"repo": "VenkatDundi/Snippets",
"path": "/Inherit_3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VenkatDundi/Snippets path: /Inherit_3.py
class A():
def m(self):
print("Class A")
class B():
def m(self):
<|fim_suffix|>class C(B, A):
print("class C")
obj1 = C()
obj1.m()
print(C.mro()) # Method Resolution Order based on convention of "OBJECT" super class<... | code_fim | easy | {
"lang": "python",
"repo": "VenkatDundi/Snippets",
"path": "/Inherit_3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: penguinarmy94/rose path: /robot_code/build/logger.py
import datetime, time, threading, os
from . import queues
logLevels = ["none", "info", "debug"]
level = "none"
def write(message):
queues.logger_queue.put(message)
def runLogger():
while True:
# The log path should be read fr... | code_fim | medium | {
"lang": "python",
"repo": "penguinarmy94/rose",
"path": "/robot_code/build/logger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if index >= lvlIndex:
if not file_name is None and not message is None:
with open(file_name + ".txt", "a") as fileObj:
fileObj.write(message)
fileObj.write("\n")
def writeEnd():
queues.logger_queue.put("turn off")<|fim_prefix|># repo: pe... | code_fim | hard | {
"lang": "python",
"repo": "penguinarmy94/rose",
"path": "/robot_code/build/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if lvl in logLevels:
lvlIndex = logLevels.index(lvl)
else:
lvlIndex = 0
if index >= lvlIndex:
if not file_name is None and not message is None:
with open(file_name + ".txt", "a") as fileObj:
fileObj.write(message)
fil... | code_fim | hard | {
"lang": "python",
"repo": "penguinarmy94/rose",
"path": "/robot_code/build/logger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SunicYosen/spider path: /pingxiaobao/load_json.py
"""""""""""""""
Write Data
"""""""""""""""
<|fim_suffix|> with open(file_name, 'r') as json_fp:
json_data = json_fp.read()
data_arr = json.loads(json_data)
return data_arr
if __name__ == '__main__':
json_file = 'd... | code_fim | medium | {
"lang": "python",
"repo": "SunicYosen/spider",
"path": "/pingxiaobao/load_json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kastnerkyle/dask path: /dask/bag/__init__.py
from __future__ import absolute_import, division, print_function
from .core im<|fim_suffix|>enames
from ..context import set_options<|fim_middle|>port Bag, Item, from_sequence, from_fil | code_fim | easy | {
"lang": "python",
"repo": "kastnerkyle/dask",
"path": "/dask/bag/__init__.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|>enames
from ..context import set_options<|fim_prefix|># repo: kastnerkyle/dask path: /dask/bag/__init__.py
from __future__ import absolute_import,<|fim_middle|> division, print_function
from .core import Bag, Item, from_sequence, from_fil | code_fim | medium | {
"lang": "python",
"repo": "kastnerkyle/dask",
"path": "/dask/bag/__init__.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yuchen413/MI-Attacks path: /nonMemberGenerator.py
import random
import tqdm
from keras.models import load_model
from ModelUtil import precision, recall, f1
from tqdm import tqdm
import cv2 as cv
import numpy as np
import os
import pandas as pd
from PIL import Image
os.environ['CUDA_VISIBLE_DEV... | code_fim | hard | {
"lang": "python",
"repo": "Yuchen413/MI-Attacks",
"path": "/nonMemberGenerator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def gasuss_noise(img_set, mean=0, var=0.01):
ret = np.empty(img_set.shape)
for m, image in enumerate(tqdm(img_set)):
image = np.array(image/255, dtype=float)
noise = np.random.normal(mean, var ** 0.5, image.shape)
out = image + noise
if out.min() < 0:
lo... | code_fim | hard | {
"lang": "python",
"repo": "Yuchen413/MI-Attacks",
"path": "/nonMemberGenerator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
githubName = request.form.get("githubname")
responseUser = requests.get("{}{}".format(base_url, githubName))
responseRepos = requests.get("{}{}/repos".format(base_url, githubName))
userInfo = responseUser.json()
userRepos = response... | code_fim | medium | {
"lang": "python",
"repo": "hercules261188/flask-gitHub-finder",
"path": "/githubApi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hercules261188/flask-gitHub-finder path: /githubApi.py
from flask import (
Flask,
render_template,
request
)
import requests
app = Flask(__name__)
base_url = "https://api.github.com/users/"
<|fim_suffix|> userInfo = responseUser.json()
userRepos = responseRepos.json()... | code_fim | hard | {
"lang": "python",
"repo": "hercules261188/flask-gitHub-finder",
"path": "/githubApi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krzjoa/bace path: /setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
#if sys.argv[-1] == 'publish':
# os.system('python setup.py sdist upload')
# sys.exit()
<|fim_suffix|>readme = open('README.md').read()
doclink = """
Documentation
-------------
The full document... | code_fim | hard | {
"lang": "python",
"repo": "krzjoa/bace",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>setup(
name='bace',
version=VERSION,
description='bace',
long_description=readme + '\n\n' + doclink + '\n\n',
author='Krzysztof Joachimiak',
url='https://github.com/krzjoa/bace',
packages=find_packages(where='.', exclude=('tests')),
package_dir={'bace': 'bace'},
include... | code_fim | hard | {
"lang": "python",
"repo": "krzjoa/bace",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dbaroli/holbertonschool-machine_learning path: /pipeline/0x03-data_augmentation/4-brightness.py
#!/usr/bin/env python3
""" brightness an image"""
import tensorflow as tf
<|fim_suffix|> """brightness an image"""
img = tf.image.adjust_brightness(image, max_delta)
return img<|fim_middle|... | code_fim | easy | {
"lang": "python",
"repo": "dbaroli/holbertonschool-machine_learning",
"path": "/pipeline/0x03-data_augmentation/4-brightness.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """brightness an image"""
img = tf.image.adjust_brightness(image, max_delta)
return img<|fim_prefix|># repo: dbaroli/holbertonschool-machine_learning path: /pipeline/0x03-data_augmentation/4-brightness.py
#!/usr/bin/env python3
""" brightness an image"""
import tensorflow as tf
<|fim_middle... | code_fim | easy | {
"lang": "python",
"repo": "dbaroli/holbertonschool-machine_learning",
"path": "/pipeline/0x03-data_augmentation/4-brightness.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renweiya/PGddpg-conference path: /result/all-preys-date/draw_rate_prey0-9-all_in_one_2.py
port pickle
from numpy import *
import math
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation
from math import factorial
def savitzky_golay(y, window_size, order, deriv=0, ... | code_fim | hard | {
"lang": "python",
"repo": "renweiya/PGddpg-conference",
"path": "/result/all-preys-date/draw_rate_prey0-9-all_in_one_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renweiya/PGddpg-conference path: /result/all-preys-date/draw_rate_prey0-9-all_in_one_2.py
1:-1][::-1] - y[-1])
y = np.concatenate((firstvals, y, lastvals))
return np.convolve( m[::-1], y, mode='valid')
#pgddpg
with open("3v1_/learning_curves/model-prey-s/seed_pgddpg_0.8/pre_trained_prey_2... | code_fim | hard | {
"lang": "python",
"repo": "renweiya/PGddpg-conference",
"path": "/result/all-preys-date/draw_rate_prey0-9-all_in_one_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>zz = range(0, end-start)
zz=np.multiply(100, zz)
#ax1 = plt.subplot(2,1,1)
plt.figure()
#pgmaddpg
plt.plot(zz, pgddpg_vs_prey00, label='pgddpg_vs_prey00', linewidth=1, linestyle = "dashed",#prey-s
color='r', marker='o', markerfacecolor='red', markersize=2)
#ddpg
plt.plot(zz, ddpg_vs_prey00, lab... | code_fim | hard | {
"lang": "python",
"repo": "renweiya/PGddpg-conference",
"path": "/result/all-preys-date/draw_rate_prey0-9-all_in_one_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dallaszkorben/diy-floor.lamp.v2 path: /Software/Raspberry.Version/python/wgadget/endpoints/ep_info_light.py
import logging
from exceptions.invalid_api_usage import InvalidAPIUsage
from wgadget.endpoints.ep import EP
class EPInfoLight(EP):
NAME = 'info_light'
URL = '/info'
URL_ROUT... | code_fim | hard | {
"lang": "python",
"repo": "dallaszkorben/diy-floor.lamp.v2",
"path": "/Software/Raspberry.Version/python/wgadget/endpoints/ep_info_light.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> payload = {}
payload[EPInfoLight.ATTR_ACTUATOR_ID] = int(actuatorId)
return self.executeByPayload(payload)
def executeByPayload(self, payload) -> dict:
actuatorId = int(payload[EPInfoLight.ATTR_ACTUATOR_ID])
if actuatorId == self.web_gadget.getLightId():
... | code_fim | hard | {
"lang": "python",
"repo": "dallaszkorben/diy-floor.lamp.v2",
"path": "/Software/Raspberry.Version/python/wgadget/endpoints/ep_info_light.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {"value": actualValue, "thread": self.web_gadget.getThreadControllerStatus()}
# return {"value": actualValue, "thread": {"inProgress": False, "id":1}}
else:
raise InvalidAPIUsage("No such actuator: {0} or value: {1}".format(actuatorId, value), error_code=... | code_fim | hard | {
"lang": "python",
"repo": "dallaszkorben/diy-floor.lamp.v2",
"path": "/Software/Raspberry.Version/python/wgadget/endpoints/ep_info_light.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def showProducts_all():
conn = sqlite3.connect('SuperMarket.db')
cur = conn.cursor()
data = cur.execute("SELECT * FROM products").fetchall()
return True, data
def added_to_cart(prod_id, qry):
if prod_id == '':
return False, " Please Enter Product Id ",1
else:
conn... | code_fim | hard | {
"lang": "python",
"repo": "nileshhadalgi016/SQLite3-Tutorial",
"path": "/superMarketApp/database.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nileshhadalgi016/SQLite3-Tutorial path: /superMarketApp/database.py
import sqlite3
# cur.execute('CREATE TABLE admin(username TEXT,password TEXT)')
# conn.commit()
# cur.execute("INSERT INTO admin VALUES('nilesh','nilesh')")
# conn.commit()
def verif_admin(username, password):
try:
... | code_fim | hard | {
"lang": "python",
"repo": "nileshhadalgi016/SQLite3-Tutorial",
"path": "/superMarketApp/database.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = cur.execute(f"""SELECT * FROM products WHERE id = '{prod_id}'""").fetchall()
cart_check = cur.execute(f"""SELECT * FROM cart WHERE id = '{prod_id}' """).fetchall()
if len(cart_check) == 0:
cur.execute(f"""INSERT INTO cart VALUES('{data[0][0]}','{d... | code_fim | hard | {
"lang": "python",
"repo": "nileshhadalgi016/SQLite3-Tutorial",
"path": "/superMarketApp/database.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>QVI/1', 273, 'qui', 'who, which (rel. pronoun); what? which? (inter. adj.) ', '', '1_14', 2), ('RVBER', 274, 'ruber', 'red', '', '1_14', 1), ('SANGVIS', 275, 'sanguis', 'blood', '', '1_14', 1), ('SEPARO/2', 276, 'separo', 'to separate, divide', '', '1_14', 1), ('TANGO', 277, 'tango', 'to touch', '', '1_14... | code_fim | hard | {
"lang": "python",
"repo": "HCDigitalScholarship/FastBridge",
"path": "/FastBridgeApp/data/Latin/latin_for_the_new_millennium_vols_1_and_2_tunberg-minkova.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HCDigitalScholarship/FastBridge path: /FastBridgeApp/data/Latin/latin_for_the_new_millennium_vols_1_and_2_tunberg-minkova.py
(w/ inf.)', '', '1_6', 1), ('TENEBRAE', 113, 'tenebrae', 'shadows, darkness (pl.)', '', '1_6', 1), ('VITA', 114, 'vita', 'life', '', '1_6', 1), ('AESTIMO', 115, 'aestimo', ... | code_fim | hard | {
"lang": "python",
"repo": "HCDigitalScholarship/FastBridge",
"path": "/FastBridgeApp/data/Latin/latin_for_the_new_millennium_vols_1_and_2_tunberg-minkova.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Preparing execution time and suite results from the terminalreporter (where all the data collected)
execution_time = round(time.time() - terminalreporter._sessionstarttime)
suite_results_dict = DataManager().get_results_dict(terminalreporter.stats)
# Setting the values to... | code_fim | hard | {
"lang": "python",
"repo": "dehimmi/OptusTest",
"path": "/venv/Lib/site-packages/pytest_influxdb/suite_result_dto.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dehimmi/OptusTest path: /venv/Lib/site-packages/pytest_influxdb/suite_result_dto.py
import json
import time
from pytest_influxdb.data_manager import DataManager
class SuiteResultDTO:
__run = 'UNDEFINED'
__project = 'UNDEFINED'
__version = 'UNDEFINED'
__passed = None
__faile... | code_fim | hard | {
"lang": "python",
"repo": "dehimmi/OptusTest",
"path": "/venv/Lib/site-packages/pytest_influxdb/suite_result_dto.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Brida-Developer/IntelNeg-2021 path: /Semana01 - Ejem1.py
import pandas as pd
import numpy
dato=pd.read_csv('medallero_Panamericanos_Lima2019.csv')
print(dato)
def calculo_suma():
print("---Funcion con Python---")
print("la sumatoria de los valores: ", dato['Bronce'].sum())
print("--... | code_fim | hard | {
"lang": "python",
"repo": "Brida-Developer/IntelNeg-2021",
"path": "/Semana01 - Ejem1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tramos =[20, 50, 75]
percentiles=numpy.percentile(dato['Bronce'], tramos)
print('Percentiles', percentiles)
def grafico_percentil():
import matplotlib.pylab as plt
import seaborn as sb
sb.boxplot(y="Bronce", data=dato)
plt.show()
def calculo_varianza():
vari=numpy.var(dat... | code_fim | hard | {
"lang": "python",
"repo": "Brida-Developer/IntelNeg-2021",
"path": "/Semana01 - Ejem1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def calculo_moda():
moda=dato.Bronce.mode()
return moda
def calculo_mediana():
nro_item=numpy.size(dato.Bronce)
pos_mediana=round(nro_item/2)
print('Posicion mediana: ', pos_mediana)
mediana=dato.Bronce[pos_mediana-1]
return mediana
def calculo_percentiles():
tramos =[20, ... | code_fim | medium | {
"lang": "python",
"repo": "Brida-Developer/IntelNeg-2021",
"path": "/Semana01 - Ejem1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Change lines to tuples and store to array for sorting
for line in f:
line = line.rstrip('\n')
line = line.replace('[','')
splitted = line.split(']')
stringTime = splitted[0]
stringTask = splitted[1]
datetimeTime = datetime.strptime(stringTime, '%Y-%m-%d %H:%M')
lineTuple = (datetimeTime, s... | code_fim | medium | {
"lang": "python",
"repo": "Veli-V/adventofcode",
"path": "/2018/day4/task1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Veli-V/adventofcode path: /2018/day4/task1.py
import os
import sys
import string
from array import *
from datetime import datetime
#f = open('input_test.txt', 'r')
f = open('input_task.txt', 'r')
width = 60
height = 5000
sleepingMinutes = [[0 for x in range(width)] for y in range(height)]
info... | code_fim | hard | {
"lang": "python",
"repo": "Veli-V/adventofcode",
"path": "/2018/day4/task1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skaplanhex/DiphotonAnalysis path: /python/ADDdiPhoton_sherpa_13TeV_KK1_NED4_MS3000_MGG750-2000_cfi.py
import FWCore.ParameterSet.Config as cms
source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'/store/user/skaplan/noreplica/ADDdiPhoton/sherpa/mgg750-2000_Ms3000/she... | code_fim | hard | {
"lang": "python",
"repo": "skaplanhex/DiphotonAnalysis",
"path": "/python/ADDdiPhoton_sherpa_13TeV_KK1_NED4_MS3000_MGG750-2000_cfi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r/hn99/noreplica/ADDdiPhoton/sherpa_morestats/mgg750-2000_Ms3000/sherpaevents_25_1_QNK.root',
'/store/user/hn99/noreplica/ADDdiPhoton/sherpa_morestats/mgg750-2000_Ms3000/sherpaevents_2_1_kmn.root',
'/store/user/hn99/noreplica/ADDdiPhoton/sherpa_morestats/mgg750-2000_Ms3000/sherpaevents_3_1... | code_fim | hard | {
"lang": "python",
"repo": "skaplanhex/DiphotonAnalysis",
"path": "/python/ADDdiPhoton_sherpa_13TeV_KK1_NED4_MS3000_MGG750-2000_cfi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> year%100!=0 or year%400==0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("Invalid input")<|fim_prefix|># repo: OSUsatoru/cs362_hw3 path: /satoru_yamamoto_hw3.1.py
print("This program calculates whether the year is a leap ... | code_fim | medium | {
"lang": "python",
"repo": "OSUsatoru/cs362_hw3",
"path": "/satoru_yamamoto_hw3.1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OSUsatoru/cs362_hw3 path: /satoru_yamamoto_hw3.1.py
print("This program calculates whether the year is a leap year or not")
year = input("<|fim_suffix|> year%100!=0 or year%400==0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else... | code_fim | medium | {
"lang": "python",
"repo": "OSUsatoru/cs362_hw3",
"path": "/satoru_yamamoto_hw3.1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def threeSum(self, nums: List[int]) -> List[List[int]]:
res = []
nums.sort()
for k in range(len(nums) - 2):
if k > 0 and nums[k] == nums[k-1]:
continuere
if nums[k] > 0:
break
L, R = k+1, len(nums) - 1
... | code_fim | medium | {
"lang": "python",
"repo": "anonymous-shy/Leetcode-Training",
"path": "/Python/Array/15.三数之和.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anonymous-shy/Leetcode-Training path: /Python/Array/15.三数之和.py
#
# @lc app=leetcode.cn id=15 lang=python3
#
# [15] 三数之和
#
# https://leetcode-cn.com/problems/3sum/description/
#
# algorithms
# Medium (25.76%)
# Likes: 1904
# Dislikes: 0
# Total Accepted: 176.6K
# Total Submissions: 679K
# Te... | code_fim | medium | {
"lang": "python",
"repo": "anonymous-shy/Leetcode-Training",
"path": "/Python/Array/15.三数之和.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dinaAbdelrahman/MicrosoftML-ProjectShowcasing path: /project/Aleem Juma/app/quotes.py
## Author: Aleem Juma
import os
from app import app
import pandas as pd
# read in the quotes database
q = pd.read_csv(os.path.join('app','data','quotes_all.csv'), sep=';', skiprows=1, header=0)
# there are a ... | code_fim | hard | {
"lang": "python",
"repo": "dinaAbdelrahman/MicrosoftML-ProjectShowcasing",
"path": "/project/Aleem Juma/app/quotes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Returns a matching quote and up to 5 of the most similar genres with similarity measures
Paramters:
genre genre to match
Returns:
(str) Quote
(str) Author
(list) List of tuples in the form (word (str), simliarity (float))
'''
# find closest matches
mat... | code_fim | hard | {
"lang": "python",
"repo": "dinaAbdelrahman/MicrosoftML-ProjectShowcasing",
"path": "/project/Aleem Juma/app/quotes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Batch IPFS file uploading')
parser.add_argument('-i', '--input', help='Path to directory containing media to upload', required=True)
args = vars(parser.parse_args())
files_to_upload = get_files(args['input'])
in... | code_fim | hard | {
"lang": "python",
"repo": "thedickjones/automint",
"path": "/media-hosting/batch_ipfs_upload.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># c0 c1 c2 c3 c4
# 0 1 4 7 10 13
# 1 2 5 8 11 14
# 2 3 6 9 12 15<|fim_prefix|># repo: MinWooPark-dotcom/learn-pandas path: /Part1/1.4_dict_to_dataframe.py
import pandas as pd
dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [
7, 8, 9], 'c3': [10, 11, 12], 'c4': [13... | code_fim | medium | {
"lang": "python",
"repo": "MinWooPark-dotcom/learn-pandas",
"path": "/Part1/1.4_dict_to_dataframe.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># <class 'pandas.core.frame.DataFrame'>
# c0 c1 c2 c3 c4
# 0 1 4 7 10 13
# 1 2 5 8 11 14
# 2 3 6 9 12 15<|fim_prefix|># repo: MinWooPark-dotcom/learn-pandas path: /Part1/1.4_dict_to_dataframe.py
import pandas as pd
dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [
... | code_fim | easy | {
"lang": "python",
"repo": "MinWooPark-dotcom/learn-pandas",
"path": "/Part1/1.4_dict_to_dataframe.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MinWooPark-dotcom/learn-pandas path: /Part1/1.4_dict_to_dataframe.py
import pandas as pd
dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [
7, 8, 9], 'c3': [10, 11, 12], 'c4': [13, 14, 15]}
<|fim_suffix|>
# c0 c1 c2 c3 c4
# 0 1 4 7 10 13
# 1 2 5 8 11 14
# 2 3 ... | code_fim | medium | {
"lang": "python",
"repo": "MinWooPark-dotcom/learn-pandas",
"path": "/Part1/1.4_dict_to_dataframe.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _saveState(self):
"""
Saves the state of the playback control
:return:
"""
assertMainThread()
self._defineProperties()
propertyCollection = self._config.guiState()
try:
propertyCollection.setProperty("RecordingControl_dir... | code_fim | hard | {
"lang": "python",
"repo": "ifm/nexxT",
"path": "/nexxT/services/gui/RecordingControl.py",
"mode": "spm",
"license": "LicenseRef-scancode-free-unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ifm/nexxT path: /nexxT/services/gui/RecordingControl.py
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020 ifm electronic gmbh
#
# THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
#
"""
This module provides the recording control GUI service for the nexxT framework.
"""
impo... | code_fim | hard | {
"lang": "python",
"repo": "ifm/nexxT",
"path": "/nexxT/services/gui/RecordingControl.py",
"mode": "psm",
"license": "LicenseRef-scancode-free-unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def feed_forward(self, inputs: list) -> np.ndarray:
cu_inputs = np.array([inputs], dtype=np.double).T
hidden_values = self.calculate_layer_values(cu_inputs, 'i-h', 'h-b')
return self.calculate_layer_values(hidden_values, 'h-o', 'o-b')
def train(self, inputs: list, labels: ... | code_fim | hard | {
"lang": "python",
"repo": "Wason1797/Nn-Learn-Lib",
"path": "/nn_lib/main_lib/layers/two_layer_nn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Wason1797/Nn-Learn-Lib path: /nn_lib/main_lib/layers/two_layer_nn.py
from functools import partial
import utils.functions as fn
import random as rd
import numpy as np
import time
class NeuralNetwork:
def __init__(self, input_size, hidden_size, output_size):
self.input_size = input... | code_fim | hard | {
"lang": "python",
"repo": "Wason1797/Nn-Learn-Lib",
"path": "/nn_lib/main_lib/layers/two_layer_nn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> hidden_layer_values = self.calculate_layer_values(cu_inputs, 'i-h', 'h-b')
output_layer_values = self.calculate_layer_values(hidden_layer_values, 'h-o', 'o-b')
output_errors = np.subtract(cu_labels, output_layer_values)
hidden_output_gradient, hidden_output_delta = self.ca... | code_fim | hard | {
"lang": "python",
"repo": "Wason1797/Nn-Learn-Lib",
"path": "/nn_lib/main_lib/layers/two_layer_nn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(self.str1.upper())
str1 = IOString()
str1.get_String()
str1.print_String()<|fim_prefix|># repo: mccallkaley/Day-4-Homework-OOP-Shopping-Cart path: /Question_2.py
#Exercise 2 - Write a Python class which has two methods get_String and print_String. get_String accept a string
#from t... | code_fim | medium | {
"lang": "python",
"repo": "mccallkaley/Day-4-Homework-OOP-Shopping-Cart",
"path": "/Question_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mccallkaley/Day-4-Homework-OOP-Shopping-Cart path: /Question_2.py
#Exercise 2 - Write a Python class which has two methods get_String and print_String. get_String accept a string
#from the user and print_String print the string in upper case
#string will be an input to a get_string method and wha... | code_fim | medium | {
"lang": "python",
"repo": "mccallkaley/Day-4-Homework-OOP-Shopping-Cart",
"path": "/Question_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XwAdmin/CodeTest path: /Python_QT/PyQt4练习/拖放/简单的获取拖放数据.py
import sys
from PyQt4 import QtGui,QtCore
class Button(QtGui.QPushButton):
def __init__(self,*__args):
super().__init__(*__args)
self.setAcceptDrops(True) # 设置可以接受拖入事件
def dragEnterEvent(self, e):
"设置接受的类型... | code_fim | hard | {
"lang": "python",
"repo": "XwAdmin/CodeTest",
"path": "/Python_QT/PyQt4练习/拖放/简单的获取拖放数据.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
super().__init__()
self.setWindowTitle("简单的获取拖放数据")
self.label = QtGui.QLabel("拖动编辑框内的数据移动到按钮上,触发拖动事件")
self.edit = QtGui.QLineEdit('初始文本',self)
self.edit.setDragEnabled(True)
self.button = Button("等待接受",self)
vLayout = QtG... | code_fim | medium | {
"lang": "python",
"repo": "XwAdmin/CodeTest",
"path": "/Python_QT/PyQt4练习/拖放/简单的获取拖放数据.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ellenfb/EE381 path: /Prj_5_HypothesisTesting/Project5_Part2_EllenBurger.py
#header
import matplotlib.pyplot as pmf
import random
p = 0.5 # Probablility of success for original system
n = 18 # Number of trials
Y = [] # Contains binomial RVs
b = [0] * (n+1) # List of n + 1 zeroes
N = 100 # Number... | code_fim | medium | {
"lang": "python",
"repo": "ellenfb/EE381",
"path": "/Prj_5_HypothesisTesting/Project5_Part2_EllenBurger.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = random.uniform(0,1)
if r < p:
x = 1
else:
x = 0
Y.append(x)
outcome = sum(Y) # Number of successes from 0 to n
b[outcome] = b[outcome] + 1 # Record of successes for bar plot
Y.clear()
for i in range(n+1):
b[i] = b[i]/N #... | code_fim | medium | {
"lang": "python",
"repo": "ellenfb/EE381",
"path": "/Prj_5_HypothesisTesting/Project5_Part2_EllenBurger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('For a critical value of', cv, 'the probability of rejecting the old system in favor of a new system that is no better than is', p,'.')
#cv = 13, 1/20 or the 5% rule<|fim_prefix|># repo: ellenfb/EE381 path: /Prj_5_HypothesisTesting/Project5_Part2_EllenBurger.py
#header
import matplotlib.pyplot as ... | code_fim | medium | {
"lang": "python",
"repo": "ellenfb/EE381",
"path": "/Prj_5_HypothesisTesting/Project5_Part2_EllenBurger.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.pi=pigpio.pi()
self.s=DHT22.sensor(self.pi, 4)
self.tempF=0
self.humidity=0<|fim_prefix|># repo: jswrigh/MagicBox path: /MagicBoxDHT22.py
import time
import DHT22
import pigpio
import Sensor
class MagicBoxDHT22(object):
def DHT22(self):
<... | code_fim | medium | {
"lang": "python",
"repo": "jswrigh/MagicBox",
"path": "/MagicBoxDHT22.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jswrigh/MagicBox path: /MagicBoxDHT22.py
import time
import DHT22
import pigpio
import Sensor
<|fim_suffix|> self.pi=pigpio.pi()
self.s=DHT22.sensor(self.pi, 4)
self.tempF=0
self.humidity=0<|fim_middle|>class MagicBoxDHT22(object):
def DHT22(self):
sel... | code_fim | hard | {
"lang": "python",
"repo": "jswrigh/MagicBox",
"path": "/MagicBoxDHT22.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def put(self, name):
# data = Modell.requested.parse_args()
item = StoreModel.find_by_name(name)
item.save_to_db()
return item.json()
def delete(self, name):
item=StoreModel.find_by_name(name)
if item:
item.delete_from_... | code_fim | hard | {
"lang": "python",
"repo": "shilash-m/pythonapi",
"path": "/resources/model_resourcde.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shilash-m/pythonapi path: /resources/model_resourcde.py
from flask_restful import Resource, reqparse
import sqlite3
from flask_jwt import jwt_required
from models.item_model import ItemModel
from flask_sqlalchemy import SQLAlchemy
from d import db
from models.store_model import StoreModel
... | code_fim | hard | {
"lang": "python",
"repo": "shilash-m/pythonapi",
"path": "/resources/model_resourcde.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vitalk/flask-api-stub path: /flask_api_stub/_compat.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
PY2 = sys.version_info[0] == 2
if PY2:
text_type = unicode
string_types = basestring,
else:
text_type = str
string_types = str,
<|fim_suffix|> # This requires a bit o... | code_fim | medium | {
"lang": "python",
"repo": "vitalk/flask-api-stub",
"path": "/flask_api_stub/_compat.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
return type.__new__(metaclass, 'temporary_class', (), {})<|fim_prefix|># repo: vitalk/flask-api-stub path: /flask_api_stub/_compat.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
PY2 = sys.version_info[0] ... | code_fim | hard | {
"lang": "python",
"repo": "vitalk/flask-api-stub",
"path": "/flask_api_stub/_compat.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Train the network on a single stochastic batch.
can_train_either = self.step > self.nb_steps_warmup_critic or self.step > self.nb_steps_warmup_actor
if can_train_either and self.step % self.train_interval == 0:
experiences = self.memory.sample(self.batch_size)
... | code_fim | hard | {
"lang": "python",
"repo": "mihrab/rl-exploration",
"path": "/ucb/ub_ddpg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mihrab/rl-exploration path: /ucb/ub_ddpg.py
ass UBDDPGAgent(Agent):
"""Write me
"""
def __init__(self, nb_actions, actor, critic, nb_players, critic_action_inputs, memory,
gamma=.99, batch_size=32, nb_steps_warmup_critic=1000, nb_steps_warmup_actor=1000,
... | code_fim | hard | {
"lang": "python",
"repo": "mihrab/rl-exploration",
"path": "/ucb/ub_ddpg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.target_critic.set_weights(self.critic.get_weights())
self.target_actor.set_weights(self.actor.get_weights())
# TODO: implement pickle
def reset_states(self):
if self.random_process is not None:
self.random_process.reset_states()
self.recent_action... | code_fim | hard | {
"lang": "python",
"repo": "mihrab/rl-exploration",
"path": "/ucb/ub_ddpg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> height, width = img.shape
height -= 60
width -= 10
#Reducing the image size to "focus" more on the center of the frame (region of interest)
#These dimensions are later used in the generation of the mask
#The reduction in height enables us to ignore the part of the image correspondi... | code_fim | hard | {
"lang": "python",
"repo": "sreeharshaparuchur1/lane_detector_opencv",
"path": "/lane_detector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> slope, intercept = line_slope_int
y1 = img.shape[0]
#Line starts from the bottom left
y2 = int(y1 * (4/5))
# The line goes 1 fifth of the way up
x1 = int((y1 - intercept) / slope)
x2 = int((y2 - intercept) / slope)
#from y = mx + c
#print(img.shape)
height, width, _... | code_fim | hard | {
"lang": "python",
"repo": "sreeharshaparuchur1/lane_detector_opencv",
"path": "/lane_detector.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sreeharshaparuchur1/lane_detector_opencv path: /lane_detector.py
import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
def diff_of_gaussians(img):
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
blur_img_grey = cv2.GaussianBlur... | code_fim | hard | {
"lang": "python",
"repo": "sreeharshaparuchur1/lane_detector_opencv",
"path": "/lane_detector.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frikcio/Allmost_Trello path: /desk/API/rest_urls.py
from django.urls import path
from .authentication import GetToken, RegisterUserAPIView
from .resurses import *
urlpatterns = [
path('register/', RegisterUserA<|fim_suffix|>w()),
path('card/<int:pk>/status/raise/', RaiseStatusAPIView.as... | code_fim | medium | {
"lang": "python",
"repo": "frikcio/Allmost_Trello",
"path": "/desk/API/rest_urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>w()),
path('card/<int:pk>/status/raise/', RaiseStatusAPIView.as_view()),
path('card/<int:pk>/status/omit/', OmitStatusAPIView.as_view()),
path('card/<int:pk>/delete/', DeleteCardAPIView.as_view()),
path('card/<int:pk>/update/', UpdateCardAPIView.as_view()),
path('card/get/', GetCardSLi... | code_fim | medium | {
"lang": "python",
"repo": "frikcio/Allmost_Trello",
"path": "/desk/API/rest_urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.