text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: patrickporto/fastlane path: /fastlane/worker/job.py
import calendar
import math
import time
from datetime import datetime, timedelta
from flask import current_app
from rq_scheduler import Scheduler
from fastlane.models.job import Job, JobExecution
from fastlane.worker import ExecutionResult
d... | code_fim | hard | {
"lang": "python",
"repo": "patrickporto/fastlane",
"path": "/fastlane/worker/job.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _members_of(self, full_path, include, exclude, should_include_private):
"""Return RST describing the members of the named class.
:arg full_path list: The unambiguous path of the class we're documenting
:arg include: List of names of members to include. If empty, include
... | code_fim | hard | {
"lang": "python",
"repo": "WimYedema/sphinx-js",
"path": "/sphinx_js/renderers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WimYedema/sphinx-js path: /sphinx_js/renderers.py
from collections import OrderedDict
from json import dumps
from re import sub
from docutils.parsers.rst import Parser as RstParser
from docutils.statemachine import StringList
from docutils.utils import new_document
from jinja2 import Environment... | code_fim | hard | {
"lang": "python",
"repo": "WimYedema/sphinx-js",
"path": "/sphinx_js/renderers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lnybrave/zzbook path: /scripts/sync_bookshelf.py
# -*- coding: utf-8 -*-
import re
import requests
from bs4 import BeautifulSoup
def getHTMLText(url):
try:
r = requests.get(url)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:... | code_fim | hard | {
"lang": "python",
"repo": "lnybrave/zzbook",
"path": "/scripts/sync_bookshelf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
stock_list_url = 'http://quote.eastmoney.com/stocklist.html'
stock_info_url = 'https://gupiao.baidu.com/stock/'
output_file = 'D:/BaiduStockInfo.txt'
slist = []
getStockList(slist, stock_list_url)
getStockInfo(slist, stock_info_url, output_file)
main()<|fim_prefix|># ... | code_fim | hard | {
"lang": "python",
"repo": "lnybrave/zzbook",
"path": "/scripts/sync_bookshelf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m-tian/msaf-copy path: /msaf/algorithms/qn/config.py
"""Config for the Quadratic novelty algorithm."""
<|fim_suffix|>algo_id = "qn"
is_boundary_type = True
is_label_type = False<|fim_middle|># Params
config = {
"alpha": 9.0, # Alpha norm
"delta": 0.0, # Adaptive thresholding delta
"rawSe... | code_fim | hard | {
"lang": "python",
"repo": "m-tian/msaf-copy",
"path": "/msaf/algorithms/qn/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>algo_id = "qn"
is_boundary_type = True
is_label_type = False<|fim_prefix|># repo: m-tian/msaf-copy path: /msaf/algorithms/qn/config.py
"""Config for the Quadratic novelty algorithm."""
<|fim_middle|># Params
config = {
"alpha": 9.0, # Alpha norm
"delta": 0.0, # Adaptive thresholding delta
"rawSe... | code_fim | hard | {
"lang": "python",
"repo": "m-tian/msaf-copy",
"path": "/msaf/algorithms/qn/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hthuwal/ARC-Challenge path: /arc_solvers/processing/add_retrieved_text.py
"""
Script to retrieve HITS for each answer choice and question
USAGE:
python scripts/add_retrieved_text.py qa_file output_file
JSONL format of files
1. qa_file:
{
"id":"Mercury_SC_415702",
"question": {
... | code_fim | hard | {
"lang": "python",
"repo": "hthuwal/ARC-Challenge",
"path": "/arc_solvers/processing/add_retrieved_text.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Create the output json dictionary from the QA file json, answer choice json and retrieved HIT
def create_output_dict(qa_json: JsonDict, choice_json: JsonDict, hit: EsHit):
output_dict = {
"id": qa_json["id"],
"question": {
"stem": qa_json["question"]["stem"],
... | code_fim | hard | {
"lang": "python",
"repo": "hthuwal/ARC-Challenge",
"path": "/arc_solvers/processing/add_retrieved_text.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if urlparse(uri_value).scheme == "tcp":
# pylint: disable-next=no-value-for-parameter
return cast(str, vol.Schema(vol.Url())(uri_value))
raise vol.Invalid("invalid Wyoming Protocol URI")
SCHEMA = vol.Schema({vol.Required(ATTR_URI): validate_uri})<|fim_prefix|># repo: home-assist... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/supervisor",
"path": "/supervisor/discovery/services/wyoming.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/supervisor path: /supervisor/discovery/services/wyoming.py
"""Discovery service for the Wyoming Protocol integration."""
from typing import Any, cast
from urllib.parse import urlparse
import voluptuous as vol
from ..const import ATTR_URI
<|fim_suffix|> if urlparse(uri_value).... | code_fim | medium | {
"lang": "python",
"repo": "home-assistant/supervisor",
"path": "/supervisor/discovery/services/wyoming.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Currently accepts TCP URIs, can extended
to accept UNIX sockets in the future.
"""
uri_value = str(value)
if urlparse(uri_value).scheme == "tcp":
# pylint: disable-next=no-value-for-parameter
return cast(str, vol.Schema(vol.Url())(uri_value))
raise vol.Invalid("in... | code_fim | medium | {
"lang": "python",
"repo": "home-assistant/supervisor",
"path": "/supervisor/discovery/services/wyoming.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Andrew-Foote/odds-and-ends path: /reborn-encounters.py
# very niche tool: puts the encounters.txt PBS file for Pokemon Reborn into a more easily-readable form
# could probably be easily adapted other games made with Pokemon Essentials
from collections import defaultdict
from functools import par... | code_fim | hard | {
"lang": "python",
"repo": "Andrew-Foote/odds-and-ends",
"path": "/reborn-encounters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> simplified_groups = []
for pokemon, group in levelgrouped_groups.items():
level_lines = []
for min_level, max_level, rate in group:
level_lines.append([min_level, max_level, rate])
level_... | code_fim | hard | {
"lang": "python",
"repo": "Andrew-Foote/odds-and-ends",
"path": "/reborn-encounters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(dict(levelgrouped_groups))
# input()
simplified_groups = []
for pokemon, group in levelgrouped_groups.items():
level_lines = []
for min_level, max_level, rate in group:
... | code_fim | hard | {
"lang": "python",
"repo": "Andrew-Foote/odds-and-ends",
"path": "/reborn-encounters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = build_normalisation_equation(rank, attn_axes)
assert np.all(result==expected)
@pytest.mark.parametrize('rank, expected', kernel_equation)
def test_get_einsum_equation(rank, expected):
result = build_kernel_equation(rank)
assert result == expected<|fim_prefix|># repo: LuCeHe/perf... | code_fim | hard | {
"lang": "python",
"repo": "LuCeHe/performer",
"path": "/test/test_build_attention.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuCeHe/performer path: /test/test_build_attention.py
import numpy as np
import pytest
import tensorflow as tf
from performer.networks.build_attention import build_linear_attention_equation
from performer.networks.build_attention import build_quadratic_attention_equation
from performer.networks.b... | code_fim | hard | {
"lang": "python",
"repo": "LuCeHe/performer",
"path": "/test/test_build_attention.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = build_linear_attention_equation(rank, attn_axes)
assert np.all(result==expected)
@pytest.mark.parametrize('rank, attn_axes, expected', normalisation_equation)
def test_build_normalisation_equation(rank, attn_axes, expected):
result = build_normalisation_equation(rank, attn_axes)
... | code_fim | hard | {
"lang": "python",
"repo": "LuCeHe/performer",
"path": "/test/test_build_attention.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
# Dictionary for the broad categories
color_dict = {"Area": "#D64139", "Mean elevation": "#D64139", "Mean slope": "#D64139",
"Fraction of precipitation\nfalling as snow": "royalblue", "Aridity": "royalblue", "Frequency of high\nprecipitation events": "r... | code_fim | hard | {
"lang": "python",
"repo": "florianjehn/Catchment-Classification",
"path": "/Hydrological Clusters/regression.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# Dictionary for the broad categories
color_dict = {"Area": "#D64139", "Mean elevation": "#D64139", "Mean slope": "#D64139",
"Fraction of precipitation\nfalling as snow": "royalblue", "Aridity": "royalblue", "Frequency of high\nprecipitation events": "... | code_fim | hard | {
"lang": "python",
"repo": "florianjehn/Catchment-Classification",
"path": "/Hydrological Clusters/regression.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: florianjehn/Catchment-Classification path: /Hydrological Clusters/regression.py
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 23 13:43:02 2018
@author: Florian Ulrich Jehn
"""
import matplotlib.pylab as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import Poly... | code_fim | hard | {
"lang": "python",
"repo": "florianjehn/Catchment-Classification",
"path": "/Hydrological Clusters/regression.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def evaluate(restaurants, logic):
for restaurant in restaurants: #loop through each restaurant object
if eval(logic): #use parameter logic as a logical expression.
output(restaurant.name)
nl()
def main():
restaurants = parseCSV('Restaurants.csv') #open and parse Re... | code_fim | hard | {
"lang": "python",
"repo": "Korasi/COSC-1336",
"path": "/Lab6/Lab6.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Korasi/COSC-1336 path: /Lab6/Lab6.py
'''
This program prints parameters from restaurant data
Nigel Myers
Fundamentals of Programming
ACC FALL 2018
Lab6.py
Prof Onabajo
'''
class Restaurant:
def __init__(self, data):
#convert dict data into an object
self.name = da... | code_fim | hard | {
"lang": "python",
"repo": "Korasi/COSC-1336",
"path": "/Lab6/Lab6.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parseCSV(filename, delimiter=','):
# Usage: parseCSV(filename[, delimiter])
with open(filename, 'r') as csv: #open file in read only
csv_data = [] #init empty list
header = csv.readline().strip('\n').split(delimiter) #split csv header by delim
while True: #infinite... | code_fim | medium | {
"lang": "python",
"repo": "Korasi/COSC-1336",
"path": "/Lab6/Lab6.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
registrate new theta, delta
:param p: probability
:return:
"""
current_steps = len(self) - 1
delta = np.zeros(shape=self.theta.shape) # [y, x, 4]
subdelta = np.zeros(shape=self.theta.shape)
ys, xs, _ = delta.shape
for ac... | code_fim | hard | {
"lang": "python",
"repo": "EadCat/Maze-Runner",
"path": "/agent/gradrunner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().arrival()
self.update(self.convert(self.theta))
self.clear()
def update(self, p):
"""
registrate new theta, delta
:param p: probability
:return:
"""
current_steps = len(self) - 1
delta = np.zeros(shape=self.theta.... | code_fim | hard | {
"lang": "python",
"repo": "EadCat/Maze-Runner",
"path": "/agent/gradrunner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EadCat/Maze-Runner path: /agent/gradrunner.py
import numpy as np
from agent.runner import Runner
class GradRunner(Runner):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.opt.lr is None:
self.lr = 1
else:
self.lr... | code_fim | hard | {
"lang": "python",
"repo": "EadCat/Maze-Runner",
"path": "/agent/gradrunner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: segrom/arnakoid path: /downbar.py
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
class Downbar():
<|fim_suffix|> self.w=wigth
def Print(self,frame):
line=["="*self.w]
inf="frime:"+str(frame)
empty=" "*(self.w-len(inf)-1)
print()
print (*line)
p... | code_fim | easy | {
"lang": "python",
"repo": "segrom/arnakoid",
"path": "/downbar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: segrom/arnakoid path: /downbar.py
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
<|fim_suffix|> def __init__(self,wigth):
self.w=wigth
def Print(self,frame):
line=["="*self.w]
inf="frime:"+str(frame)
empty=" "*(self.w-len(inf)-1)
print()
print (*li... | code_fim | easy | {
"lang": "python",
"repo": "segrom/arnakoid",
"path": "/downbar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.w=wigth
def Print(self,frame):
line=["="*self.w]
inf="frime:"+str(frame)
empty=" "*(self.w-len(inf)-1)
print()
print (*line)
print("|"+inf+empty+"|")
print(*line)<|fim_prefix|># repo: segrom/arnakoid path: /downbar.py
#-*-coding:utf... | code_fim | easy | {
"lang": "python",
"repo": "segrom/arnakoid",
"path": "/downbar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashishnitinpatil/dota2py path: /dota2py/proto/demo_pb2.py
name='CDemoFileInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
descriptor.FieldDescriptor(
name='playback_time', full_name='CDemoFileInfo.playback_time', index=0,
number=1, type=2, cpp_type=6, ... | code_fim | hard | {
"lang": "python",
"repo": "ashishnitinpatil/dota2py",
"path": "/dota2py/proto/demo_pb2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_CDEMOFILEINFO = descriptor.Descriptor(
name='CDemoFileInfo',
full_name='CDemoFileInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
descriptor.FieldDescriptor(
name='playback_time', full_name='CDemoFileInfo.playback_time', index=0,
number=1, type=2, cpp_typ... | code_fim | hard | {
"lang": "python",
"repo": "ashishnitinpatil/dota2py",
"path": "/dota2py/proto/demo_pb2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_CDEMOSTOP = descriptor.Descriptor(
name='CDemoStop',
full_name='CDemoStop',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=1647,
s... | code_fim | hard | {
"lang": "python",
"repo": "ashishnitinpatil/dota2py",
"path": "/dota2py/proto/demo_pb2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: snowdence/hcmus_ai_wumpus path: /src/tests/test_glu_agent.py
import utils
import unittest
# pylint: disable=import-error
from cores.kb_solve.kb import KB
from cores.kb_solve.glu_agent import *
from cores.layout.parser import Parser
<|fim_suffix|>
if __name__ == "__main__":
print("Gluagent")
... | code_fim | medium | {
"lang": "python",
"repo": "snowdence/hcmus_ai_wumpus",
"path": "/src/tests/test_glu_agent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
if __name__ == "__main__":
print("Gluagent")
p = Parser()
loaded_map = p.load_wumpus_env(gpath.PATH_MAP + 'map_10_10.txt')
glu_agent = GluAgent(loaded_map)
while glu_agent.finished != True and glu_agent.has_solved_safe_node():
move_pos = glu_agent.get_action()
... | code_fim | medium | {
"lang": "python",
"repo": "snowdence/hcmus_ai_wumpus",
"path": "/src/tests/test_glu_agent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("worker({0}) recv:{1}".format(pid, message))
class Poller(object):
def poll(self):
time.sleep(2)
return str(time.time())
pollworker.regist_worker(worker)
pollworker.regist_poller(Poller())
pollworker.start(stop... | code_fim | medium | {
"lang": "python",
"repo": "ipconfiger/pollworker",
"path": "/test/test_start.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Poller(object):
def poll(self):
time.sleep(2)
return str(time.time())
pollworker.regist_worker(worker)
pollworker.regist_poller(Poller())
pollworker.start(stopwaits=3)
self.assertTrue(True)<|fim_prefix|># repo: ipc... | code_fim | medium | {
"lang": "python",
"repo": "ipconfiger/pollworker",
"path": "/test/test_start.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ipconfiger/pollworker path: /test/test_start.py
# coding=utf8
from unittest import TestCase
import time
<|fim_suffix|> pollworker.regist_worker(worker)
pollworker.regist_poller(Poller())
pollworker.start(stopwaits=3)
self.assertTrue(True)<|fim_middle|>__author__ =... | code_fim | hard | {
"lang": "python",
"repo": "ipconfiger/pollworker",
"path": "/test/test_start.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alliedmodders/ambuild path: /tests/shaders/configure.py
# vim: set sts=2 ts=8 sw=2 tw=99 et:
API_VERSION = '2.1'
<|fim_suffix|>builder = run.BuildParser(sourcePath = sys.path[0], api = API_VERSION)
builder.Configure()<|fim_middle|>import sys
try:
from ambuild2 import run
if not ru... | code_fim | hard | {
"lang": "python",
"repo": "alliedmodders/ambuild",
"path": "/tests/shaders/configure.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>builder = run.BuildParser(sourcePath = sys.path[0], api = API_VERSION)
builder.Configure()<|fim_prefix|># repo: alliedmodders/ambuild path: /tests/shaders/configure.py
# vim: set sts=2 ts=8 sw=2 tw=99 et:
API_VERSION = '2.1'
<|fim_middle|>import sys
try:
from ambuild2 import run
if not ru... | code_fim | hard | {
"lang": "python",
"repo": "alliedmodders/ambuild",
"path": "/tests/shaders/configure.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pixeliko/concha path: /concha/test/connl_tree_test.py
# -*- coding: utf-8 -*-
import unittest
import connl_tree
a_tree_txt = '\
1 mi _ DET _ Number=Sing|Person=1|Poss=Yes|PronType=Prs|fPOS=DET++ 2 det _ _\n\
2 mamá _ NOUN _ Gender=Fem|Number=Sing|fPOS=NOUN++ 4 nsubj _ _\n\
3 me _ PRON _ Case=Acc... | code_fim | hard | {
"lang": "python",
"repo": "pixeliko/concha",
"path": "/concha/test/connl_tree_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_deep_replacement(self):
b_tree = connl_tree.ConnlTree()
b_tree.parse(b_tree_txt)
threshold = self.tree['ROOT']['nsubj'].max() + 1
delta = b_tree['ROOT'].len() - self.tree['ROOT']['nsubj'].len()
replaced_tree = self.tree.deep_replacement(self.tree['ROOT'... | code_fim | hard | {
"lang": "python",
"repo": "pixeliko/concha",
"path": "/concha/test/connl_tree_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mad-lab-fau/tpcp path: /tpcp/_pipeline.py
"""Base Classes for custom pipelines."""
from typing import Any, ClassVar, Dict, Generic, Tuple, TypeVar, Union
from typing_extensions import Self
from tpcp import NOTHING
from tpcp._algorithm import Algorithm
from tpcp._algorithm_utils import ACTION_ME... | code_fim | hard | {
"lang": "python",
"repo": "mad-lab-fau/tpcp",
"path": "/tpcp/_pipeline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Calculate performance of the pipeline on a datapoint with reference information.
This is an optional method and does not need to be implemented in many cases.
Usually stand-a-lone functions are better suited as scorer.
A typical score method will call `self.run(datapoi... | code_fim | hard | {
"lang": "python",
"repo": "mad-lab-fau/tpcp",
"path": "/tpcp/_pipeline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chrigl/python-flattr path: /flattrclient/things.py
import flattrclient
import flattrclient.flattrs
import flattrclient.resource
from flattrclient.validators import validate
from flattrclient.validators import isStr
from flattrclient.validators import isStrList
from flattrclient.validators import ... | code_fim | hard | {
"lang": "python",
"repo": "chrigl/python-flattr",
"path": "/flattrclient/things.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @tags.setter
@validate(isStrList)
def tags(self, v):
""" set tags
:param v: value
"""
self._tags = v
self._dirty = True
@property
def language(self):
""" Returns language """
return getattr(self, '_language', None)
@languag... | code_fim | hard | {
"lang": "python",
"repo": "chrigl/python-flattr",
"path": "/flattrclient/things.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Create thing, or update if existing. """
if not getattr(self, '_id', None):
return self._create()
res = self._update()
self._dirty = False
return res
@flattrclient.refresh_thing_id
@flattrclient.post('/')
def _create(self):
""" C... | code_fim | hard | {
"lang": "python",
"repo": "chrigl/python-flattr",
"path": "/flattrclient/things.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SURGroup/UQpy path: /src/UQpy/inference/evidence_methods/baseclass/EvidenceMethod.py
from abc import ABC, abstractmethod
from UQpy.utilities.ValidationTypes import NumpyFloatArray
from UQpy.inference.inference_models.baseclass import InferenceModel
<|fim_suffix|> :param inference_model:... | code_fim | hard | {
"lang": "python",
"repo": "SURGroup/UQpy",
"path": "/src/UQpy/inference/evidence_methods/baseclass/EvidenceMethod.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param inference_model: Probabilistic model used for inference.
:param posterior_samples: Samples drawn from the posterior distribution of the parameters using a
:class:`.BayesParameterEstimation` object.
:param log_posterior_values: Values of the ``log_pdf`` function gene... | code_fim | hard | {
"lang": "python",
"repo": "SURGroup/UQpy",
"path": "/src/UQpy/inference/evidence_methods/baseclass/EvidenceMethod.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # now, evaluate the model with the test set
valid_Y_hat = final_model.predict(valid_X)
accuracy = np.sum((valid_Y_hat == valid_Y))/300.0*100.0
print('final validation accuracy = ' + str(accuracy) + ' %')<|fim_prefix|># repo: ianwonilkim/gct634-ai613-2021 path: /hw1/train_test.py
# GCT634... | code_fim | hard | {
"lang": "python",
"repo": "ianwonilkim/gct634-ai613-2021",
"path": "/hw1/train_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ianwonilkim/gct634-ai613-2021 path: /hw1/train_test.py
# GCT634 (2018) HW1
#
# Mar-18-2018: initial version
#
# Juhan Nam
#
import sys
import os
import numpy as np
import librosa
from feature_summary import *
from sklearn.linear_model import SGDClassifier
def train_model(train_X, train_Y, vali... | code_fim | hard | {
"lang": "python",
"repo": "ianwonilkim/gct634-ai613-2021",
"path": "/hw1/train_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> valid_X = valid_X.T
valid_X = valid_X - train_X_mean
valid_X = valid_X/(train_X_std + 1e-5)
# training model
alphas = [0.0001, 0.001, 0.01, 0.1, 1, 10]
model = []
valid_acc = []
for a in alphas:
clf, acc = train_model(train_X, train_Y, valid_X, valid_Y, a)
... | code_fim | hard | {
"lang": "python",
"repo": "ianwonilkim/gct634-ai613-2021",
"path": "/hw1/train_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>m.start(start_point,goal_point)
g= ASearch()
g.tree=m.positions
g.cost=m.m_distances
g.a_search(start_point,goal_point)
m.path_setup(list(g.path),"Red")
m.path_setup(g.shortest_path,"yellow")
x=input("Press any key to continue....!")<|fim_prefix|># repo: ehabosaleh/heuristic-maze-traversing path: /A*/... | code_fim | hard | {
"lang": "python",
"repo": "ehabosaleh/heuristic-maze-traversing",
"path": "/A*/a_search_maze_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ehabosaleh/heuristic-maze-traversing path: /A*/a_search_maze_test.py
from maze import Maze
from a_search import ASearch
<|fim_suffix|>m.start(start_point,goal_point)
g= ASearch()
g.tree=m.positions
g.cost=m.m_distances
g.a_search(start_point,goal_point)
m.path_setup(list(g.path),"Red")
m.p... | code_fim | hard | {
"lang": "python",
"repo": "ehabosaleh/heuristic-maze-traversing",
"path": "/A*/a_search_maze_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>g.a_search(start_point,goal_point)
m.path_setup(list(g.path),"Red")
m.path_setup(g.shortest_path,"yellow")
x=input("Press any key to continue....!")<|fim_prefix|># repo: ehabosaleh/heuristic-maze-traversing path: /A*/a_search_maze_test.py
from maze import Maze
from a_search import ASearch
m=Maze(10,1... | code_fim | medium | {
"lang": "python",
"repo": "ehabosaleh/heuristic-maze-traversing",
"path": "/A*/a_search_maze_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._lock = threading.Lock()
self._releases = {}
@classmethod
def parse_resource_descr(cls, descr):
m = _RESOURCE_DESCR_RE.match(descr)
if not m:
raise MalformedResourceDescr()
groups = m.groups()
return cls.Request(
type=... | code_fim | hard | {
"lang": "python",
"repo": "cgorbit/rem",
"path": "/server/rem/sandbox_releases.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cgorbit/rem path: /server/rem/sandbox_releases.py
import time
import threading
import re
from collections import namedtuple
from rem_logging import logger as logging
from rem.future import Promise
import rem.delayed_executor as delayed_executor
_RESOURCE_DESCR_RE = re.compile('^(?:(re[sl]):)?(... | code_fim | hard | {
"lang": "python",
"repo": "cgorbit/rem",
"path": "/server/rem/sandbox_releases.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # FIXME Move 2-step logic to rem.sandbox?
def _do_do_resolve(self, rel):
request = rel.request
resource = self._client.get_latest_resource(
type=request.type,
owner=request.owner,
released=request.released
)
rel.resolve_time = t... | code_fim | hard | {
"lang": "python",
"repo": "cgorbit/rem",
"path": "/server/rem/sandbox_releases.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lekeno/edr path: /edr/edweapons.py
from math import log10
import re
import edrlog
EDRLOG = edrlog.EDRLog()
class EDDamageFractions(object):
def __init__(self, absolute=0.0, explosive=0.0, kinetic=0.0, thermal=0.0, caustic=0.0):
self.absolute = absolute
self.explosive = expl... | code_fim | hard | {
"lang": "python",
"repo": "lekeno/edr",
"path": "/edr/edweapons.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # just get rid of prefixes because sometimes int_ becomes ext_ depending on the event
if normalized.startswith((u"int_", u"ext_", u"hpt_")):
normalized = normalized[4:]
return normalized
@staticmethod
def from_internal_name(internal_name):
cname = EDWea... | code_fim | hard | {
"lang": "python",
"repo": "lekeno/edr",
"path": "/edr/edweapons.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>r_all_categories",
"get_final_metrics",
"summarize_metrics",
"f_beta",
"evaluate_all_models",
]<|fim_prefix|># repo: ttelfer/moda path: /moda/evaluators/__init__.py
from moda.evaluators.eval import eval_models, eval_models_CV
from moda.evaluators.metrics import (
get_met<|fim_middle|>... | code_fim | hard | {
"lang": "python",
"repo": "ttelfer/moda",
"path": "/moda/evaluators/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttelfer/moda path: /moda/evaluators/__init__.py
from moda.evaluators.eval import eval_models, eval_models_CV
from moda.evaluators.metrics import (
get_met<|fim_suffix|>r_all_categories",
"get_final_metrics",
"summarize_metrics",
"f_beta",
"evaluate_all_models",
]<|fim_middle|>... | code_fim | hard | {
"lang": "python",
"repo": "ttelfer/moda",
"path": "/moda/evaluators/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaulLafytskyi/Hackerrank-Tests path: /src/Algs/BinarySearchEtc.py
def binary_search(a, x):
l = -1
r = len(a)
wh<|fim_suffix|> if l >= 0 and a[l] == x:
return l
return -1<|fim_middle|>ile (r - l) > 1:
m = (l + r) // 2
if a[m] > x:
r = m
... | code_fim | medium | {
"lang": "python",
"repo": "PaulLafytskyi/Hackerrank-Tests",
"path": "/src/Algs/BinarySearchEtc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if l >= 0 and a[l] == x:
return l
return -1<|fim_prefix|># repo: PaulLafytskyi/Hackerrank-Tests path: /src/Algs/BinarySearchEtc.py
def binary_search(a, x):
l = -1
r = len(a)
wh<|fim_middle|>ile (r - l) > 1:
m = (l + r) // 2
if a[m] > x:
r = m
... | code_fim | medium | {
"lang": "python",
"repo": "PaulLafytskyi/Hackerrank-Tests",
"path": "/src/Algs/BinarySearchEtc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Seojiyoon/pydata_jy path: /pydata_jy/list.py
import requests
from bs4 import BeautifulSoup
class PyData:
@classmethod
def scraping(self):
target_url = 'https://www.meetup.com/ja-JP/pro/pydata/#meetups'
r = requests.get(target_url)
<|fim_suffix|> for t in group_ti... | code_fim | hard | {
"lang": "python",
"repo": "Seojiyoon/pydata_jy",
"path": "/pydata_jy/list.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> count = 1
title = []
for t in group_title:
if count % 2 != 0:
title.append(t.string)
if count % 3 == 0:
join_title = " ".join(title)
print(join_title)
title = []
... | code_fim | hard | {
"lang": "python",
"repo": "Seojiyoon/pydata_jy",
"path": "/pydata_jy/list.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X_train, y_train, X_test, y_test = measurement_table.train_test(data)
X_train_miss, y_train_miss = measurement_table.undersampling(X_train, y_train)
count2 = pd.DataFrame()
count2['quality'] = y_train_miss
count2['method'] = 'Random selection'
acc3, df3, train_df3, AUC3 = measureme... | code_fim | hard | {
"lang": "python",
"repo": "h851206/DS1",
"path": "/TingYu/Methods.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def RS_Kmean(data, n_clusters):
X_train, y_train, X_test, y_test = measurement_table.train_test(data)
X_train = measurement_table.clustering(X_train, n_clusters=n_clusters)
X_train['index'] = X_train.index
kmean_y_train = X_train['kmeans_label']
X_train_miss, y_train_miss = measurement... | code_fim | hard | {
"lang": "python",
"repo": "h851206/DS1",
"path": "/TingYu/Methods.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: h851206/DS1 path: /TingYu/Methods.py
from TingYu import measurement_table
import pandas as pd
def combine_raw_data(
data_red_dir: str, data_white_dir: str
) -> (pd.DataFrame, pd.DataFrame):
data_white = pd.read_csv(data_white_dir)
data_red = pd.read_csv(data_red_dir)
data_w... | code_fim | hard | {
"lang": "python",
"repo": "h851206/DS1",
"path": "/TingYu/Methods.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yqsang/cocotb-coverage path: /tests/test_coverage/coverage_unittest.py
'''Copyright (c) 2018, TDK Electronics
All rights reserved.
Author: Marek Cieplucha, https://github.com/mciepluc
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that ... | code_fim | hard | {
"lang": "python",
"repo": "yqsang/cocotb-coverage",
"path": "/tests/test_coverage/coverage_unittest.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Running test_coverpoint_in_class")
fb = self.FooBar()
self.assertTrue(coverage.coverage_db["t2.in_class"].size == 2)
self.assertTrue(coverage.coverage_db["t2.in_class"].coverage == 0)
self.assertTrue(coverage.coverage_db["t2.in_class"].detailed... | code_fim | hard | {
"lang": "python",
"repo": "yqsang/cocotb-coverage",
"path": "/tests/test_coverage/coverage_unittest.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # test xml merge - static example covering
# adding new elements and updating existing
def test_xml_merge(self):
import os.path
from xml.etree import ElementTree as et
print("Running test_xml_merge")
filename = 'test_xml_merge_output.xml'
coverage.XML_... | code_fim | hard | {
"lang": "python",
"repo": "yqsang/cocotb-coverage",
"path": "/tests/test_coverage/coverage_unittest.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Carayav/HackerRank-Contests path: /2014-06-02-Weekly/PalindromeIndex/pi.py
import sys
t = int(sys.stdin.readline())
<|fim_suffix|>for tix in range(t):
l = sys.stdin.readline()
if l[-1] == '\n':
l = l[:-1]
print f(l)<|fim_middle|>def f(xs):
n = len(xs)
m = n / 2
f... | code_fim | hard | {
"lang": "python",
"repo": "Carayav/HackerRank-Contests",
"path": "/2014-06-02-Weekly/PalindromeIndex/pi.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for tix in range(t):
l = sys.stdin.readline()
if l[-1] == '\n':
l = l[:-1]
print f(l)<|fim_prefix|># repo: Carayav/HackerRank-Contests path: /2014-06-02-Weekly/PalindromeIndex/pi.py
import sys
t = int(sys.stdin.readline())
<|fim_middle|>def f(xs):
n = len(xs)
m = n / 2
f... | code_fim | hard | {
"lang": "python",
"repo": "Carayav/HackerRank-Contests",
"path": "/2014-06-02-Weekly/PalindromeIndex/pi.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Video streaming generator function."""
try:
print("new thread try")
#_thread.start_new_thread(ask_for_numbers,())
#_thread.start_new_thread(flyDrone,())
thread.start_new_thread(getFrame,(camera,1))
except:
print("can't start new thread")
#print("h... | code_fim | hard | {
"lang": "python",
"repo": "traubas/autonomous-quadcopter-dualpizero",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: traubas/autonomous-quadcopter-dualpizero path: /app.py
from importlib import import_module
import os
#from ard import *
from time import sleep
import time
import _thread
import requests
from flask import Flask, render_template, Response, request
from flask_cors import CORS
from variables import s... | code_fim | hard | {
"lang": "python",
"repo": "traubas/autonomous-quadcopter-dualpizero",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/video_feed')
def video_feed():
"""Video streaming route. Put this in the src attribute of an img tag."""
return Response(gen(Camera()),
mimetype='multipart/x-mixed-replace; boundary=frame')
@app.route('/stop_video')
def stop_video():
flag = True
return ren... | code_fim | hard | {
"lang": "python",
"repo": "traubas/autonomous-quadcopter-dualpizero",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> SELECT ?ref ?refB
WHERE {
?ref a gl:Reference .
?conn a gl:ConnectionForRefOnly .
?refB a gl:Reference .
?conn gl:srcConnectionForRefOnly ?ref .
?conn gl:dstConnectionForRefOnly ?refB
}
... | code_fim | hard | {
"lang": "python",
"repo": "metamorph-inc/mgardf",
"path": "/tests/element_types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sparql_ref_connection = """
PREFIX gme: <https://forge.isis.vanderbilt.edu/gme/>
PREFIX gl: <http://www.metamorphsoftware.com/openmeta/>
SELECT ?ref ?refB
WHERE {
?ref a gl:Reference .
?conn a gl:ConnectionForRefOnly ... | code_fim | hard | {
"lang": "python",
"repo": "metamorph-inc/mgardf",
"path": "/tests/element_types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metamorph-inc/mgardf path: /tests/element_types.py
# -*- coding: utf-8 -*-
# from .context import mgardf
from mgardf.mgardfconverter import MgaRdfConverter
import unittest
import os
import udm
from mgardf.utilities import xme2mga
class ElementTypesTestSuite(unittest.TestCase):
"""Test cas... | code_fim | hard | {
"lang": "python",
"repo": "metamorph-inc/mgardf",
"path": "/tests/element_types.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Looks for the key in the context, raise an error if it doesn't exist
info = context.get_info(self._key)
if info is None:
return_message = "%s is not found in the context" % self._key
self._logger.error(return_message)
raise AcsConfigException(A... | code_fim | hard | {
"lang": "python",
"repo": "intel/test-framework-and-suites-for-android",
"path": "/acs_test_scripts/TestStep/Utilities/Checks/CheckContextInfoExists.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self, context):
"""
Runs the test step
:type context: TestStepContext
:param context: test case context
"""
TestStepBase.run(self, context)
# Looks for the key in the context, raise an error if it doesn't exist
info = context.ge... | code_fim | hard | {
"lang": "python",
"repo": "intel/test-framework-and-suites-for-android",
"path": "/acs_test_scripts/TestStep/Utilities/Checks/CheckContextInfoExists.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: intel/test-framework-and-suites-for-android path: /acs_test_scripts/TestStep/Utilities/Checks/CheckContextInfoExists.py
"""
Copyright (C) 2017 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ma... | code_fim | medium | {
"lang": "python",
"repo": "intel/test-framework-and-suites-for-android",
"path": "/acs_test_scripts/TestStep/Utilities/Checks/CheckContextInfoExists.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.is_ready
def __convert_servo(self, value):
return abs((value + 1)/2)
def __convert_duty_cycle(self, value):
return value * 0.1
def __convert_brake(self, value):
return abs((value + 1)*10)
def get_send_message(self):
self.is_ready = Fa... | code_fim | hard | {
"lang": "python",
"repo": "Taek-16/vesc_study",
"path": "/vesc_driver/src/joystick_control_node.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Taek-16/vesc_study path: /vesc_driver/src/joystick_control_node.py
#!/usr/bin/env python
from pygame.locals import *
import rospy
import os, sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
# ros message
#from vesc_msg.msg import VescInput
from std_msgs.msg impor... | code_fim | hard | {
"lang": "python",
"repo": "Taek-16/vesc_study",
"path": "/vesc_driver/src/joystick_control_node.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Daniel-Arbuckles-Mastering-Python path: /Chapter01/example_1_2_5.py
class Frood:
def __init__(self, age):
self.age = age
print("Frood initialized")
def anniversary(self):
<|fim_suffix|>f1 = Frood(12)
f2 = Frood(97)
f1.anniversary()
f2.anniversary()
f1.anni... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Daniel-Arbuckles-Mastering-Python",
"path": "/Chapter01/example_1_2_5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>f1 = Frood(12)
f2 = Frood(97)
f1.anniversary()
f2.anniversary()
f1.anniversary()
f2.anniversary()<|fim_prefix|># repo: PacktPublishing/Daniel-Arbuckles-Mastering-Python path: /Chapter01/example_1_2_5.py
class Frood:
def __init__(self, age):
self.age = age
print("Frood initialized")
... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Daniel-Arbuckles-Mastering-Python",
"path": "/Chapter01/example_1_2_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Officium/RL-Experiments path: /src/baselines/a2c/default.py
import math
import torch.nn as nn
from torch.optim import Adam
from common.util import Flatten
def atari(env, **kwargs):
in_dim = env.observation_space.shape
policy_dim = env.action_space.n
network = CNN(in_dim, policy_di... | code_fim | hard | {
"lang": "python",
"repo": "Officium/RL-Experiments",
"path": "/src/baselines/a2c/default.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.policy = nn.Linear(64, policy_dim)
nn.init.orthogonal_(self.policy.weight, 1e-2)
nn.init.constant_(self.policy.bias, 0)
self.value = nn.Linear(64, 1)
nn.init.orthogonal_(self.value.weight, 1)
nn.init.constant_(self.value.bias, 0)
def forward(self,... | code_fim | hard | {
"lang": "python",
"repo": "Officium/RL-Experiments",
"path": "/src/baselines/a2c/default.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 19-2-SKKU-OSS/free-python-games path: /freegames/baseball.py
"""Baseball, Guess N digit number.
Strike : Right number, right position. Ball : Right number in input
Exercises
1. How can we make it difficult?
2. How many digits are most difficult?
3. Change it to allow repeated numbers.
"""
impor... | code_fim | hard | {
"lang": "python",
"repo": "19-2-SKKU-OSS/free-python-games",
"path": "/freegames/baseball.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> check_result = {'strike': 0, 'ball': 0}
for pos in range(len(right_ans_)):
if user_ans_[pos] == right_ans_[pos]:
check_result['strike'] += 1
elif user_ans_[pos] in right_ans_:
check_result['ball'] += 1
return check_result
num_of_digits = get_num_digit(... | code_fim | hard | {
"lang": "python",
"repo": "19-2-SKKU-OSS/free-python-games",
"path": "/freegames/baseball.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test that a RuleBook is built correctly with a yaml file."""
rules_local_path = get_datafile_path(__file__,
'buckets_test_rules_1.yaml')
rules_engine = bre.BucketsRulesEngine(rules_file_path=rules_local_path)
rules_engine.buil... | code_fim | hard | {
"lang": "python",
"repo": "kevensen/forseti-security",
"path": "/tests/scanner/audit/buckets_rules_engine_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test that a RuleBook is built correctly with a mocked gcs file.
Setup:
* Create a mocked GCS object from a test yaml file.
* Get the yaml file content.
Expected results:
There are 4 resources that have rules, in the rule book.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "kevensen/forseti-security",
"path": "/tests/scanner/audit/buckets_rules_engine_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevensen/forseti-security path: /tests/scanner/audit/buckets_rules_engine_test.py
# Copyright 2017 The Forseti Security Authors. 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 ob... | code_fim | hard | {
"lang": "python",
"repo": "kevensen/forseti-security",
"path": "/tests/scanner/audit/buckets_rules_engine_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: koluku/atcoder path: /atcoder-beginner-contest/125/B.py
n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
<|fim_suffix|>result = 0
for profit in vc:
if profit <= 0:
break
result += profit
print(result)<|fim_middle|>vc = [(v[i] - c[i]) f... | code_fim | medium | {
"lang": "python",
"repo": "koluku/atcoder",
"path": "/atcoder-beginner-contest/125/B.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>result = 0
for profit in vc:
if profit <= 0:
break
result += profit
print(result)<|fim_prefix|># repo: koluku/atcoder path: /atcoder-beginner-contest/125/B.py
n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
<|fim_middle|>vc = [(v[i] - c[i]) f... | code_fim | medium | {
"lang": "python",
"repo": "koluku/atcoder",
"path": "/atcoder-beginner-contest/125/B.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexkassil/examtool path: /examtool/cli/download.py
import click
from examtool.cli.utils import exam_name_option, hidden_output_folder_option
import examtool.api.download
<|fim_suffix|> """
Download student submissions for an exam.
Exams are downloaded as PDFs into a target folder - ... | code_fim | hard | {
"lang": "python",
"repo": "alexkassil/examtool",
"path": "/examtool/cli/download.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Download student submissions for an exam.
Exams are downloaded as PDFs into a target folder - specify `out` to redirect the folder.
An `OUTLINE.pdf` is also generated for Gradescope, as is a `summary.csv` for analytics or autograding.
"""
exam_json, template_questions, email_to... | code_fim | hard | {
"lang": "python",
"repo": "alexkassil/examtool",
"path": "/examtool/cli/download.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='profile',
name='is_classrep',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='profile',
name='bio',
field=models.TextField(def... | code_fim | medium | {
"lang": "python",
"repo": "theenigmacodex/Enigmaforum",
"path": "/aceblog/users/migrations/0005_auto_20200525_1125.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theenigmacodex/Enigmaforum path: /aceblog/users/migrations/0005_auto_20200525_1125.py
# Generated by Django 3.0.6 on 2020-05-25 05:55
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AddField(
model_name='profile',
name='is_cl... | code_fim | medium | {
"lang": "python",
"repo": "theenigmacodex/Enigmaforum",
"path": "/aceblog/users/migrations/0005_auto_20200525_1125.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.