text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> self.reqparse = reqparse.RequestParser()
for argument in self.ARGUMENTS:
self.reqparse.add_argument(argument.name, **argument.properties)
# get username
self.reqparse.add_argument('username', type=str, required=True, location='authorization')
self.arg... | code_fim | hard | {
"lang": "python",
"repo": "sourlows/rating-cruncher",
"path": "/src/app/api/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self.reqparse = reqparse.RequestParser()
for argument in self.ARGUMENTS:
self.reqparse.add_argument(argument.name, **argument.properties)
# get username
self.reqparse.add_argument('username', type=str, required=True, location='authoriza... | code_fim | hard | {
"lang": "python",
"repo": "sourlows/rating-cruncher",
"path": "/src/app/api/base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sourlows/rating-cruncher path: /src/app/api/base.py
from google.appengine.datastore import datastore_query
from flask import jsonify, make_response, Blueprint
from flask_httpauth.flask_httpauth import HTTPBasicAuth
from app.user.models import UserModel
from flask_restful import Resource, reqparse... | code_fim | hard | {
"lang": "python",
"repo": "sourlows/rating-cruncher",
"path": "/src/app/api/base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oyorooms/hue path: /desktop/core/ext-py/cx_Oracle-5.2.1/test/test_dbapi20.py
"""Driver specific portion of the DB API test suite provided by Stuart Bishop
available at http://stuartbishop.net/Software/DBAPI20TestSuite/"""
import cx_Oracle
import dbapi20
import unittest
import TestEnv
class ... | code_fim | hard | {
"lang": "python",
"repo": "oyorooms/hue",
"path": "/desktop/core/ext-py/cx_Oracle-5.2.1/test/test_dbapi20.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # not implemented; see cx_Oracle specific test suite instead
def test_setinputsizes(self):
pass
# not implemented; see cx_Oracle specific test suite instead
def test_setoutputsize(self):
pass
if __name__ == "__main__":
print "Testing cx_Oracle version", cx_Oracle.ver... | code_fim | hard | {
"lang": "python",
"repo": "oyorooms/hue",
"path": "/desktop/core/ext-py/cx_Oracle-5.2.1/test/test_dbapi20.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if v != None:
if k in DATE_KEYS:
# Elasticsearch cannot handle null dates, emit None so the wrapper
# function `transform_dict` will omit it from its transformation
if not v: return None
v = arrow.get(v, 'YYYY/MM/DD HH:mm:ss').format('YYYY-MM-DD')
... | code_fim | hard | {
"lang": "python",
"repo": "hobochili/openfda",
"path": "/openfda/device_recall/pipeline.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hobochili/openfda path: /openfda/device_recall/pipeline.py
#!/usr/bin/python
''' Device pipeline for downloading, transforming to JSON and loading device
recall data into Elasticsearch.
'''
import csv
import glob
import os
from os.path import dirname, join
import arrow
import luigi
import ... | code_fim | hard | {
"lang": "python",
"repo": "hobochili/openfda",
"path": "/openfda/device_recall/pipeline.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> product_code = data['product_code']
fei_number = data['firm_fei_number']
k_numbers = data.get('k_numbers', [])
pma_numbers = data.get('pma_numbers', [])
pma_numbers = [d.split('/')[0] for d in pma_numbers]
harmonized = self.harmonized_db.get(product_code, None)
if harmonized:... | code_fim | hard | {
"lang": "python",
"repo": "hobochili/openfda",
"path": "/openfda/device_recall/pipeline.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haykkh/resultr-plot path: /resultr_plot/__init__.py
#!/usr/bin/env python3
"""
Makes UCL PHAS results better
"""
__author__ = "Hayk Khachatryan"
__version__ = "0.1.2"
__license__ = "MIT"
import sys
import itertools
import pathlib as pathlib
import pandas as pd
import matplotlib.pyplot as plt
i... | code_fim | hard | {
"lang": "python",
"repo": "haykkh/resultr-plot",
"path": "/resultr_plot/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def askSave():
'''Asks the user where they want the plots to be saved
Returns:
[str] -- output path
'''
return inquirer.prompt([
inquirer.Text(
'savePath', message="Where shall I save the plots (eg plots/)")
])['savePath']
def howPlotAsk(goodFormat):
'... | code_fim | hard | {
"lang": "python",
"repo": "haykkh/resultr-plot",
"path": "/resultr_plot/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uktrade/directory-tests path: /tests/periodic_tasks/content_diff/steps/steps_def.py
# -*- coding: utf-8 -*-
from behave import then, when
from behave.runner import Context
from tests.periodic_tasks.content_diff.steps.steps_impl import (
extract_page_content,
look_for_differences,
)
<|f... | code_fim | hard | {
"lang": "python",
"repo": "uktrade/directory-tests",
"path": "/tests/periodic_tasks/content_diff/steps/steps_def.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context: Context,
section: str,
endpoint: str,
service: str,
site_a: str,
site_b: str,
):
extract_page_content(context, section, endpoint, service, site_a, site_b)
@then("there should be no differences")
def there_should_be_no_differences(context: Context):
look_for_diffe... | code_fim | medium | {
"lang": "python",
"repo": "uktrade/directory-tests",
"path": "/tests/periodic_tasks/content_diff/steps/steps_def.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@then("there should be no differences")
def there_should_be_no_differences(context: Context):
look_for_differences(context)<|fim_prefix|># repo: uktrade/directory-tests path: /tests/periodic_tasks/content_diff/steps/steps_def.py
# -*- coding: utf-8 -*-
from behave import then, when
from behave.runner... | code_fim | hard | {
"lang": "python",
"repo": "uktrade/directory-tests",
"path": "/tests/periodic_tasks/content_diff/steps/steps_def.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.get_params().get('db')
def set_db(self, db):
self.add_param('db', db)
def get_endTime(self):
return self.get_params().get('endTime')
def set_endTime(self, endTime):
self.add_param('endTime', endTime)
def get_num(self):
return self.get... | code_fim | medium | {
"lang": "python",
"repo": "QcloudApi/qcloudcli",
"path": "/qcloudsdktdsql/CdbTdsqlGetSlowLogListRequest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QcloudApi/qcloudcli path: /qcloudsdktdsql/CdbTdsqlGetSlowLogListRequest.py
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class CdbTdsqlGetSlowLogListRequest(Request):
def __init__(self):
super(CdbTdsqlGetSlowLogListRequest, self).__init__(
'tdsql', '... | code_fim | hard | {
"lang": "python",
"repo": "QcloudApi/qcloudcli",
"path": "/qcloudsdktdsql/CdbTdsqlGetSlowLogListRequest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_orderBy(self, orderBy):
self.add_param('orderBy', orderBy)
def get_orderByType(self):
return self.get_params().get('orderByType')
def set_orderByType(self, orderByType):
self.add_param('orderByType', orderByType)
def get_start(self):
return self.g... | code_fim | hard | {
"lang": "python",
"repo": "QcloudApi/qcloudcli",
"path": "/qcloudsdktdsql/CdbTdsqlGetSlowLogListRequest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>t1.start()
t2.start()
t1.join()
t2.join()
print("done in : ", time.time() -to)
print("i am done with all of my work")<|fim_prefix|># repo: ankitgtron/python-tutorial-coding path: /multithreading.py
import time
import threading
def calc_square(numbers):
print("calculate square of numbe... | code_fim | medium | {
"lang": "python",
"repo": "ankitgtron/python-tutorial-coding",
"path": "/multithreading.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitgtron/python-tutorial-coding path: /multithreading.py
import time
import threading
def calc_square(numbers):
print("calculate square of numbers")
for n in numbers:
time.sleep(0.1)
print("square", n*n)
def calc_cube(numbers):
print('calculate cube of nu... | code_fim | medium | {
"lang": "python",
"repo": "ankitgtron/python-tutorial-coding",
"path": "/multithreading.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Start Scraping process'''
name = 'backup_comments'
allowed_domains = ['bitco.in']
start_urls = ['https://bitco.in/forum/']
custom_settings = {
'FEED_FORMAT': 'json',
'FEED_URI': 'data/backup_comments.json',
}
if check_run_count():
custom_settings['IT... | code_fim | hard | {
"lang": "python",
"repo": "patobrien/xenforo-backup",
"path": "/forumbackup/spiders/backup_comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Find post urls from category pages'''
for post in res.css('.discussionList .discussionListItems .discussionListItem'):
href = get_selector(post, '.main h3.title a::attr(href)')
if href:
yield res.follow(href, get_comments)
# follow paginat... | code_fim | hard | {
"lang": "python",
"repo": "patobrien/xenforo-backup",
"path": "/forumbackup/spiders/backup_comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patobrien/xenforo-backup path: /forumbackup/spiders/backup_comments.py
'''Backup Comments'''
import scrapy
from ..items import CommentItem
from ..helpers import get_images, clean_markup, get_selector, \
next_link, get_post_id, get_author_info, check_run_count
def get_comment_number(res):
'''... | code_fim | hard | {
"lang": "python",
"repo": "patobrien/xenforo-backup",
"path": "/forumbackup/spiders/backup_comments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cors = CORS(app, resources={r"/*": {"origins": "*"}})
app.run(host='0.0.0.0', port=5003, debug=True)<|fim_prefix|># repo: DigitalSlideArchive-Legacy/openseadragon-annotations path: /web_service/main.py
from flask import Flask
from flask.ext.cors import CORS
from routes import dsa
<|fim_middle|>app = Fl... | code_fim | easy | {
"lang": "python",
"repo": "DigitalSlideArchive-Legacy/openseadragon-annotations",
"path": "/web_service/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DigitalSlideArchive-Legacy/openseadragon-annotations path: /web_service/main.py
from flask import Flask
from flask.ext.cors import CORS
from routes import dsa
<|fim_suffix|>app.run(host='0.0.0.0', port=5003, debug=True)<|fim_middle|>app = Flask('dsa')
app.register_blueprint(dsa)
cors = CORS(app... | code_fim | medium | {
"lang": "python",
"repo": "DigitalSlideArchive-Legacy/openseadragon-annotations",
"path": "/web_service/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.storage_service.add_usage_data({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"ethereum_json_rpc_endpoint": "https://ropsten.infura.io",
"request_id": "bl5tuet35nkvoh9gt9q0",
"organization... | code_fim | hard | {
"lang": "python",
"repo": "prashantramangupta/snet-platform-usage",
"path": "/metering/tests/test_total_calls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @patch("services.APIUtilityService.get_user_address", return_value="0x123")
def test_success_usage_record(self, mock_boto):
self.storage_service.add_usage_data({
"type": "response",
"registry_address_key": "0x5156fde2ca71da4398f8c76763c41bc9633875e4",
"e... | code_fim | hard | {
"lang": "python",
"repo": "prashantramangupta/snet-platform-usage",
"path": "/metering/tests/test_total_calls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prashantramangupta/snet-platform-usage path: /metering/tests/test_total_calls.py
import json
import unittest
from datetime import datetime
from unittest.mock import patch
from handlers import usage_handler
from models import OrgServiceConfigModel, UsageModel, UserOrgGroupModel
from repository.or... | code_fim | hard | {
"lang": "python",
"repo": "prashantramangupta/snet-platform-usage",
"path": "/metering/tests/test_total_calls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bodleian/iiif_manifest_server path: /tests/test_server.py
t.get("/iiif/manifest/452d6b51-949c-447d-9880-1108ffdfd96e.json")
assert response.status == 200
# V2 manifests MUST be sent with a plain application/json response unless ld+json is specifically
# requested.
def test_v2_implicit_manif... | code_fim | hard | {
"lang": "python",
"repo": "bodleian/iiif_manifest_server",
"path": "/tests/test_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bodleian/iiif_manifest_server path: /tests/test_server.py
served on the root."""
request, response = app.test_client.get("/info.json")
assert response.status == 200
def test_no_manifest_id():
""" No manifest ID should raise a 404 Not Found. """
request, response = app.test_clien... | code_fim | hard | {
"lang": "python",
"repo": "bodleian/iiif_manifest_server",
"path": "/tests/test_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_invalid_collection_id_spaces():
request, response = app.test_client.get("/iiif/collection/oriental AND type:collection")
assert response.status == 404
def test_collection_id_single_word_hyphens():
request, response = app.test_client.get("/iiif/collection/early-modern-and-modern-manu... | code_fim | hard | {
"lang": "python",
"repo": "bodleian/iiif_manifest_server",
"path": "/tests/test_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: l-zheng24/google-molerat path: /google_search.py
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
from urllib.parse import quote_plus
import requests
import pandas as pd
def search(query, num_results=50, lang='en', timerange=None):
'''Return a dataframe containing G... | code_fim | hard | {
"lang": "python",
"repo": "l-zheng24/google-molerat",
"path": "/google_search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
result_block = soup.find_all('div', attrs={'class': 'g'})
df_dict = {
"title": [],
"description": [],
"link": []
}
for result in result_block:
if(len(result['class']) != 1):
continue
link = result.find('a', href=True)
titl... | code_fim | medium | {
"lang": "python",
"repo": "l-zheng24/google-molerat",
"path": "/google_search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PytLab/VASPy path: /scripts/plot_force.py
#!/usr/bin/env python
'''
Script to plot total force trend.
'''
import sys
import logging
import numpy as np
from matplotlib import animation
import matplotlib.pyplot as plt
from vaspy.iter import OutCar
outcar = OutCar()
# plot
fig = plt.figure(f... | code_fim | medium | {
"lang": "python",
"repo": "PytLab/VASPy",
"path": "/scripts/plot_force.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def animate(i):
logging.info('frame %d', i)
y_below = np.linspace(0, forces[i], 100)
x = np.array([1.0*i]*100)
y_above = np.linspace(forces[i], np.max(forces)+0.5, 100)
line_below.set_data(x, y_below)
line_above.set_data(x, y_above)
return line_... | code_fim | hard | {
"lang": "python",
"repo": "PytLab/VASPy",
"path": "/scripts/plot_force.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># initilize everything
curr_point = None
controller = MotorController(const.COM_PORT, const.ARDUINO_BPS)
controller.start()
sio = socketio.Client()
@sio.on(const.CON_ROUTE)
def on_connect():
print('connected')
# move handeler (TODO @rdiersing1: respond to the server)
@sio.on(const.MOVE_ROUTE)
def on... | code_fim | hard | {
"lang": "python",
"repo": "ecdeng/incuvision",
"path": "/linux_server/com_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ecdeng/incuvision path: /linux_server/com_handler.py
import socketio
import com_handler_constants as const
from motor_controller import MotorController
# (TODO @rdiersing1): Create a wrapper object for the server so you dont
# create the global variable curr_point
# Checks if the point string i... | code_fim | hard | {
"lang": "python",
"repo": "ecdeng/incuvision",
"path": "/linux_server/com_handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vas3k/vas3k.club path: /badges/models.py
import math
from datetime import timedelta
from uuid import uuid4
from django.db import models, transaction, IntegrityError
from django.db.models import F, Count
from club.exceptions import InsufficientFunds, BadRequest, ContentDuplicated
from comments.m... | code_fim | hard | {
"lang": "python",
"repo": "vas3k/vas3k.club",
"path": "/badges/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return UserBadge.objects.filter(to_user=user).select_related("badge").order_by("-created_at")
@classmethod
def user_badges_grouped(cls, user):
badges = {
badge.code: badge for badge in Badge.visible_objects()
}
badge_groups = UserBadge.objects\
... | code_fim | hard | {
"lang": "python",
"repo": "vas3k/vas3k.club",
"path": "/badges/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Prepare our context and sockets
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect("tcp://localhost:5559")
socket.setsockopt(zmq.SUBSCRIBE, b'')
# Do 10 requests, waiting each time for a response
for request in range(1,11):
message = socket.recv_multipart()
if message[0] ... | code_fim | medium | {
"lang": "python",
"repo": "benthomasson/zeromq_capnproto_test",
"path": "/collector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Do 10 requests, waiting each time for a response
for request in range(1,11):
message = socket.recv_multipart()
if message[0] == "Measurements":
samples = measurements_capnp.Measurements.read_multiple_bytes(message[1])
print("Received reply %s [%s]" % (request, samples.next()))<|... | code_fim | hard | {
"lang": "python",
"repo": "benthomasson/zeromq_capnproto_test",
"path": "/collector.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benthomasson/zeromq_capnproto_test path: /collector.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import capnp
import measurements_capnp
import zmq
<|fim_suffix|># Do 10 requests, waiting each time for a response
for request in range(1,11):
message ... | code_fim | medium | {
"lang": "python",
"repo": "benthomasson/zeromq_capnproto_test",
"path": "/collector.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for prop in one_of:
self.push_error_stack()
self.validate_required(self.get(x, fieldname), prop, schema, True)
errs = self.pop_error_stack()
if not errs:
return
self._error('none-of-required', one_of)<|fim_prefix|># repo: Home... | code_fim | hard | {
"lang": "python",
"repo": "Homeloc/validictory",
"path": "/validictory/extended.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate_maxProperties(self, x, fieldname, schema, max_properties=None):
''' Validate that the object has at most `max_properties` properties.
'''
value = self.get(x, fieldname)
if isinstance(value, dict) and len(value) < max_properties:
self._error('too... | code_fim | hard | {
"lang": "python",
"repo": "Homeloc/validictory",
"path": "/validictory/extended.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Homeloc/validictory path: /validictory/extended.py
'''
'''
from datetime import datetime
from validator import SchemaValidator
class ExtendedSchemaValidator(SchemaValidator):
'''
A JSON schema validator, with support for the date type, and a few other
validators either pre... | code_fim | hard | {
"lang": "python",
"repo": "Homeloc/validictory",
"path": "/validictory/extended.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Doug600/datum-modernisation path: /createBLs.py
#!/usr/bin/env python
'''
### NEED TO ADD ###
Craig
When you create the NGCA DynaNet stn and msr files would it be possible to
include the following elements for the GPS Baseline Cluster measurements.
<AtDate> - Start and end epo... | code_fim | hard | {
"lang": "python",
"repo": "Doug600/datum-modernisation",
"path": "/createBLs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Create an array of the stations minus the core station
nonCoreStns = []
for i in range(len(data)):
if i != csIndex:
nonCoreStns.append(data[i]['site'])
numCovar = len(nonCoreStns) - 1
if numCovar < 0:
print inputFile
# Loop over the non-core stations and writ... | code_fim | hard | {
"lang": "python",
"repo": "Doug600/datum-modernisation",
"path": "/createBLs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: werwolfby/monitorrent path: /monitorrent/engine.py
pics += self.tracker_topics_count
self.update_progress(100)
return True
class EngineTracker(EngineExecute):
def __init__(self, tracker, engine_trackers, notifier_manager_execute, engine):
"""
:type tracker: s... | code_fim | hard | {
"lang": "python",
"repo": "werwolfby/monitorrent",
"path": "/monitorrent/engine.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> __tablename__ = 'execute'
id = Column(Integer, primary_key=True)
start_time = Column(UTCDateTime, nullable=False)
finish_time = Column(UTCDateTime, nullable=False)
status = Column(Enum('finished', 'failed'), nullable=False)
failed_message = Column(Unicode, nullable=True)
class E... | code_fim | hard | {
"lang": "python",
"repo": "werwolfby/monitorrent",
"path": "/monitorrent/engine.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None:
self.failed("Exception while execute", exc_type, exc_val, exc_tb)
return True
class ExecuteSettings(Base):
__tablename__ = "settings_execute"
id ... | code_fim | hard | {
"lang": "python",
"repo": "werwolfby/monitorrent",
"path": "/monitorrent/engine.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|># Build Process Runner
def runBuild(fileInfo):
# Unpack
fileType, j = fileInfo
# Get Module
desired_module = importlib.import_module(f"src.python.{fileType}Builder")
# Run Module
desired_module.run(fileType, j)
# ----- Main -----
def main():
# Get the Template Files
fil... | code_fim | hard | {
"lang": "python",
"repo": "AlexShukhman/alexshukhman.github.io",
"path": "/build.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexShukhman/alexshukhman.github.io path: /build.py
#!/usr/bin/env python
'''
Welcome to my personal website!
As I was building this website, I realized that I wanted to handle updates scalably. To me, that meant having a sort of CMS (content management system) which I could easily update as I u... | code_fim | medium | {
"lang": "python",
"repo": "AlexShukhman/alexshukhman.github.io",
"path": "/build.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oshaikh13/openprescribing path: /openprescribing/frontend/migrations/0024_practicelist_pct.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('frontend', '0023_auto_20150529_1630'),
]
ope... | code_fim | easy | {
"lang": "python",
"repo": "oshaikh13/openprescribing",
"path": "/openprescribing/frontend/migrations/0024_practicelist_pct.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('frontend', '0023_auto_20150529_1630'),
]
operations = [
migrations.AddField(
model_name='practicelist',
name='pct',
field=models.ForeignKey(blank=True, to='frontend.PCT', null=True),
),
]<|fim_prefix|># repo: ... | code_fim | easy | {
"lang": "python",
"repo": "oshaikh13/openprescribing",
"path": "/openprescribing/frontend/migrations/0024_practicelist_pct.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> training_text_summary = {
"env_data": {
"env:": str(self.eval_env),
"run_name": self.run_name,
"obs_shape": self.eval_env.observation_space.shape,
"action_shace": self.eval_env.action_space.shape,
"aux_sh... | code_fim | hard | {
"lang": "python",
"repo": "JanMatas/baselines",
"path": "/baselines/asym_ddpg/distributed_train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JanMatas/baselines path: /baselines/asym_ddpg/distributed_train.py
,0), 1)
cv2.putText(frame,format(action[2], '.2f'), (5,35), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (255,0,0), 1)
cv2.putText(frame,format(action[3], '.2f'), (40,25), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (255,0,0), 1)
cv2... | code_fim | hard | {
"lang": "python",
"repo": "JanMatas/baselines",
"path": "/baselines/asym_ddpg/distributed_train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JanMatas/baselines path: /baselines/asym_ddpg/distributed_train.py
exec_rollouts(self):
with self.agent.sess.as_default():
env = gym.make(self.env_id)
env.seed(self.seed)
obs0, aux0, state0 = env.reset(), env.get_aux(), env.get_state()
episo... | code_fim | hard | {
"lang": "python",
"repo": "JanMatas/baselines",
"path": "/baselines/asym_ddpg/distributed_train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># todo tomorrow:
# write to csv
# remove prints
# goodreads oauth seems to be unreliable ... revoke access and try again
# why does flask need to be running to run the tests?<|fim_prefix|># repo: tmtaybah/bookoutlet_service path: /tests/test_bookoutlet.py
import time
from bookoutlet_service.core import b... | code_fim | hard | {
"lang": "python",
"repo": "tmtaybah/bookoutlet_service",
"path": "/tests/test_bookoutlet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmtaybah/bookoutlet_service path: /tests/test_bookoutlet.py
import time
from bookoutlet_service.core import bookoutlet, goodreads_api, goodreads_oauth
def test_bestsellers():
bestsellers = bookoutlet.get_bestsellers()
assert len(bestsellers) == 200
if __name__ == "__main__":
# s... | code_fim | hard | {
"lang": "python",
"repo": "tmtaybah/bookoutlet_service",
"path": "/tests/test_bookoutlet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# step 1. establish oauth session
session = goodreads_api.establish_session()
print("ran establish_session .. session is: ", session)
# step 2. get goodreads user
user = goodreads_api.get_user(session)
user_id = user[0]
username = user[1]
# st... | code_fim | medium | {
"lang": "python",
"repo": "tmtaybah/bookoutlet_service",
"path": "/tests/test_bookoutlet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> experiment = ExperimentFactory()
factory_session.commit()
experiment_hash = experiment.experiment_hash
run_id = initialize_tracking_and_get_run_id(
experiment_hash=experiment_hash,
experiment_class_path="mymodule.MyClassName",
random_seed=1234,
experiment_kw... | code_fim | hard | {
"lang": "python",
"repo": "dssg/triage",
"path": "/src/tests/test_tracking_experiments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dssg/triage path: /src/tests/test_tracking_experiments.py
from sqlalchemy.orm import Session
import pytest
import datetime
from unittest import mock
from triage.tracking import (
initialize_tracking_and_get_run_id,
get_run_for_update,
increment_field,
)
from triage.util.db import sco... | code_fim | hard | {
"lang": "python",
"repo": "dssg/triage",
"path": "/src/tests/test_tracking_experiments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmitss/mmitss-az path: /src/common/v2x-data-transfer/V2XDataTransfer.py
"""
**********************************************************************************
© 2021 Arizona Board of Regents on behalf of the University of Arizona with rights
granted for USDOT OSADP distribution with the ... | code_fim | hard | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/common/v2x-data-transfer/V2XDataTransfer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @abstractmethod
def transfer_data(self):
"""
this method will depend on the desired type of data transfer
"""
pass
if __name__=="__main__":
pass<|fim_prefix|># repo: mmitss/mmitss-az path: /src/common/v2x-data-transfer/V2XDataTransfer.py
"""
******************... | code_fim | hard | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/common/v2x-data-transfer/V2XDataTransfer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
an abstract class defining a structure for inherited classes, where each child class would be responsinble
for performing certain kind of data transfer
"""
def __init__(self, server:dict, intersectionList:list, logger:Logger):
self.logger = logger
self.serverDataDir... | code_fim | medium | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/common/v2x-data-transfer/V2XDataTransfer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aslamplr/an-experiment-with-keras-inception path: /tools/convert_keras_to_tensorflow_graph_frozen.py
from python.utils.tensorflow import export_graph
from keras.models import load_model
<|fim_suffix|> keras_model = load_model('../saved_models/inception_v3_full.h5')
export_graph(keras_mode... | code_fim | hard | {
"lang": "python",
"repo": "aslamplr/an-experiment-with-keras-inception",
"path": "/tools/convert_keras_to_tensorflow_graph_frozen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> keras_model = load_model('../saved_models/inception_v3_full.h5')
export_graph(keras_model,
num_output=1,
prefix_output_node_names_of_final_network='output_node',
output_dir='../tensorflow_model',
output_graph_filename='constant_gr... | code_fim | hard | {
"lang": "python",
"repo": "aslamplr/an-experiment-with-keras-inception",
"path": "/tools/convert_keras_to_tensorflow_graph_frozen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, filename):
return ("" if filename == "basic.py" # goes first
else super().__call__(filename))<|fim_prefix|># repo: anntzer/mplcursors path: /doc/source/_local_ext.py
from sphinx_gallery.sorting import ExampleTitleSortKey
<|fim_middle|>class CustomSortKey(... | code_fim | easy | {
"lang": "python",
"repo": "anntzer/mplcursors",
"path": "/doc/source/_local_ext.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anntzer/mplcursors path: /doc/source/_local_ext.py
from sphinx_gallery.sorting import ExampleTitleSortKey
<|fim_suffix|> return ("" if filename == "basic.py" # goes first
else super().__call__(filename))<|fim_middle|>
class CustomSortKey(ExampleTitleSortKey):
def __ca... | code_fim | medium | {
"lang": "python",
"repo": "anntzer/mplcursors",
"path": "/doc/source/_local_ext.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bareluz93/exam path: /ApproxiPong-master/pong/learning/value_iteration.py
from argparse import ArgumentParser
from pathlib import Path
from time import time, clock
import numpy as np
from ..mechanics.pong import Pong, S
from ..mechanics import constants as c
from ..utils import common
TRAIN_D... | code_fim | hard | {
"lang": "python",
"repo": "bareluz93/exam",
"path": "/ApproxiPong-master/pong/learning/value_iteration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#===============================================================================
# Main
#===============================================================================
def main(argv):
parser = ArgumentParser()
common.add_save_load_args(parser, "/tmp/Pong/ValueIteration/")
parser.add_argum... | code_fim | hard | {
"lang": "python",
"repo": "bareluz93/exam",
"path": "/ApproxiPong-master/pong/learning/value_iteration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bayesianbrad/pyfo path: /pyfo/pyppl/distributions.py
#
# This file is part of PyFOPPL, an implementation of a First Order Probabilistic Programming Language in Python.
#
# License: MIT (see LICENSE.txt)
#
# 17. Jan 2018, Tobias Kohn
# 28. Mar 2018, Tobias Kohn
#
from enum import *
##############... | code_fim | hard | {
"lang": "python",
"repo": "bayesianbrad/pyfo",
"path": "/pyfo/pyppl/distributions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def is_continuous(self):
return self.distribution_type == DistributionType.CONTINUOUS
@property
def is_discrete(self):
return self.distribution_type == DistributionType.DISCRETE
@property
def parameter_count(self):
return len(self.params)
####... | code_fim | hard | {
"lang": "python",
"repo": "bayesianbrad/pyfo",
"path": "/pyfo/pyppl/distributions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Allabakshu-shaik/Mercedes-POC path: /Replayer/FrameHandler.py
class idHandler:
__bytes=list()
__binaryBits=list()
def setData(self, id, bytes):
self.__binaryBits.clear()
self.__bytes = bytes
for byte in bytes:
bits = [int(n) for n in bin(byte)[2:].z... | code_fim | hard | {
"lang": "python",
"repo": "Allabakshu-shaik/Mercedes-POC",
"path": "/Replayer/FrameHandler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> gear=0
brake=False
def setData(self, id, bytes):
super().setData(id, bytes)
self.gear = self.getValueFromOffset(40, 3)
# 4 -> Drive (100)
# 1 -> Park (001)
# 2 -> Reverse (101)
brake = self.getValueFromOffset(6, 2)
if (brake > 0... | code_fim | hard | {
"lang": "python",
"repo": "Allabakshu-shaik/Mercedes-POC",
"path": "/Replayer/FrameHandler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lcosmin/boardgamegeek path: /boardgamegeek/cache.py
import requests
import requests_cache
from .exceptions import BGGValueError
class CacheBackend(object):
pass
<|fim_suffix|> self.cache = requests_cache.core.CachedSession(cache_name=path,
... | code_fim | hard | {
"lang": "python",
"repo": "lcosmin/boardgamegeek",
"path": "/boardgamegeek/cache.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class CacheBackendSqlite(CacheBackend):
def __init__(self, path, ttl, fast_save=True):
try:
int(ttl)
except ValueError:
raise BGGValueError
self.cache = requests_cache.core.CachedSession(cache_name=path,
... | code_fim | hard | {
"lang": "python",
"repo": "lcosmin/boardgamegeek",
"path": "/boardgamegeek/cache.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with tempfile.TemporaryDirectory() as temp_dir:
priors.make_priors(exceptions_filename, temp_dir, '19.43')
# make sure priors file has the required structure
inner_dirs = os.listdir(temp_dir)
assert os.path.isfile(os.path.join(temp_dir, inner_dirs[0], 'exceptions', '1... | code_fim | hard | {
"lang": "python",
"repo": "holarchy/Holon",
"path": "/priors/tests/test_priors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: holarchy/Holon path: /priors/tests/test_priors.py
import pytest
import priors
import common
import tempfile
import json
import os
priors_tests_dir = os.path.dirname(os.path.abspath(__file__))
priors_dir = os.path.dirname(priors_tests_dir)
project_dir = os.path.dirname(priors_dir)
test_data_dir ... | code_fim | medium | {
"lang": "python",
"repo": "holarchy/Holon",
"path": "/priors/tests/test_priors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_if_templates_dir_given_then_it_is_used(api: API):
other_dir = "my_recipe/templates"
numbers = Recipe("numbers", templates_dir=other_dir)
api.recipe(numbers)
assert numbers.templates_dir == other_dir != api.templates_dir
def test_render_template_in_recipe_route(
template_fil... | code_fim | medium | {
"lang": "python",
"repo": "schnitzelbub/bocadillo",
"path": "/tests/test_recipes_templates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schnitzelbub/bocadillo path: /tests/test_recipes_templates.py
from bocadillo import API, Recipe
from tests.conftest import TemplateWrapper
def test_use_template_string():
numbers = Recipe("numbers")
html = numbers.template_string("<h1>{{ title }}</h1>", title="Numbers")
assert html ... | code_fim | hard | {
"lang": "python",
"repo": "schnitzelbub/bocadillo",
"path": "/tests/test_recipes_templates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: indico/indico-plugins-attic path: /search/indico_search/util.py
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2020 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more ... | code_fim | medium | {
"lang": "python",
"repo": "indico/indico-plugins-attic",
"path": "/search/indico_search/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param template_name: name of the template
:param context: the variables that should be available in the
context of the template.
"""
from indico_search.plugin import SearchPlugin
assert current_plugin == SearchPlugin.instance
templates = ('{}:{}'.format(Search... | code_fim | hard | {
"lang": "python",
"repo": "indico/indico-plugins-attic",
"path": "/search/indico_search/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def state(self):
"""
Returns the last known robot state.
"""
return self._state
def enable(self):
"""
Enable all joints
"""
if self._state.stopped:
rospy.loginfo("Robot Stopped: Attempting Reset...")
self.rese... | code_fim | hard | {
"lang": "python",
"repo": "tauzhang/learning_ros_external_pkgs_noetic",
"path": "/baxter_interface/src/baxter_interface/robot_enable.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tauzhang/learning_ros_external_pkgs_noetic path: /baxter_interface/src/baxter_interface/robot_enable.py
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followi... | code_fim | hard | {
"lang": "python",
"repo": "tauzhang/learning_ros_external_pkgs_noetic",
"path": "/baxter_interface/src/baxter_interface/robot_enable.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._state = msg
def _toggle_enabled(self, status):
pub = rospy.Publisher('robot/set_super_enable', Bool,
queue_size=10)
baxter_dataflow.wait_for(
test=lambda: self._state.enabled == status,
timeout=2.0 if status else 5... | code_fim | hard | {
"lang": "python",
"repo": "tauzhang/learning_ros_external_pkgs_noetic",
"path": "/baxter_interface/src/baxter_interface/robot_enable.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Function for inserting new survey-records:
def newSurvey():
return render_template('new_survey.html', form=SurveyForm(request.form))
routes.append(dict(rule='/surveys/new',view_func=newSurvey,
options=dict(methods=['GET'])))
# Function for retrieving all the added surveys:
def su... | code_fim | hard | {
"lang": "python",
"repo": "Arvinje/pts_feedback",
"path": "/controllers/Surveys.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arvinje/pts_feedback path: /controllers/Surveys.py
import os, inspect
from flask import Flask, render_template, request, redirect, flash
from config.setup import session # for SQL-connection
from wtforms import Form, TextAreaField, BooleanField, StringField, DateField, validators
from wtforms.fie... | code_fim | hard | {
"lang": "python",
"repo": "Arvinje/pts_feedback",
"path": "/controllers/Surveys.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#list that includes function routes:
routes = []
# Function for inserting new survey-records:
def newSurvey():
return render_template('new_survey.html', form=SurveyForm(request.form))
routes.append(dict(rule='/surveys/new',view_func=newSurvey,
options=dict(methods=['GET'])))
# Fun... | code_fim | hard | {
"lang": "python",
"repo": "Arvinje/pts_feedback",
"path": "/controllers/Surveys.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestSuite(unittest.TestCase):
def setUp(self):
self.tree = bst()
self.tree.insert(9)
self.tree.insert(6)
self.tree.insert(12)
self.tree.insert(3)
self.tree.insert(8)
self.tree.insert(10)
self.tree.insert(15)
self.tree.insert... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/_MY_ORGS/Web-Dev-Collaborative/blog-research/Data-Structures/1-Python/tree/bst/height.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ndchristian/LowEarthOrbit path: /lowearthorbit/deploy.py
import logging
from lowearthorbit.resources.create import create_stack
from lowearthorbit.resources.update import update_stack
log = logging.getLogger(__name__)
def deploy_type(stack_name, cfn_client):
"""Checks if the CloudFormatio... | code_fim | hard | {
"lang": "python",
"repo": "ndchristian/LowEarthOrbit",
"path": "/lowearthorbit/deploy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> deploy_parameters = {}
if 'Tags' in kwargs:
deploy_parameters.update({'Tags': kwargs['Tags']})
if 'rollback_configuration' in kwargs:
deploy_parameters.update(
{'rollback_configuration': kwargs['rollback_configuration']})
if 'notification_arns' in kwargs:
... | code_fim | hard | {
"lang": "python",
"repo": "ndchristian/LowEarthOrbit",
"path": "/lowearthorbit/deploy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ret_val
# The main function for parsing a string.
# Loop over string running split_out_tag until we run out of string.
def process_ccml(s):
ret_val = []
remainder = s
while (remainder != ""):
temp = split_out_tag(remainder)
if len(temp) > 1:
for a in... | code_fim | hard | {
"lang": "python",
"repo": "owainkenwayucl/CargoCultML",
"path": "/ccml/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: owainkenwayucl/CargoCultML path: /ccml/__init__.py
# Global variables to control max recursion depth. This is intended to
# limit memory blow-up attacks
MAX_DEPTH=4096
UNLIMITED_DEPTH=False
TAG_NAME="CCML_TAG_NAME"
CONTENTS_NAME="CCML_TAG_CONTENTS"
# Check to see if current depth is OK.
def dep... | code_fim | hard | {
"lang": "python",
"repo": "owainkenwayucl/CargoCultML",
"path": "/ccml/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># The main function for parsing a string.
# Loop over string running split_out_tag until we run out of string.
def process_ccml(s):
ret_val = []
remainder = s
while (remainder != ""):
temp = split_out_tag(remainder)
if len(temp) > 1:
for a in temp[:-1]:
... | code_fim | hard | {
"lang": "python",
"repo": "owainkenwayucl/CargoCultML",
"path": "/ccml/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liquidiert/emuward path: /client.py
import keyboard
import websockets
import asyncio
<|fim_suffix|>if __name__=="__main__":
asyncio.run(send_keys())<|fim_middle|>async def send_keys():
uri = "ws://localhost:5387"
async with websockets.connect(uri) as websocket:
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "liquidiert/emuward",
"path": "/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__=="__main__":
asyncio.run(send_keys())<|fim_prefix|># repo: liquidiert/emuward path: /client.py
import keyboard
import websockets
import asyncio
<|fim_middle|>async def send_keys():
uri = "ws://localhost:5387"
async with websockets.connect(uri) as websocket:
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "liquidiert/emuward",
"path": "/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VladPerervenko/gama path: /gama/genetic_programming/compilers/scikitlearn.py
from datetime import datetime
import logging
import os
import pickle
import time
from typing import Iterable, Callable, Tuple, Optional, Dict
import uuid
import stopit
from sklearn.preprocessing import OneHotEncoder
fro... | code_fim | hard | {
"lang": "python",
"repo": "VladPerervenko/gama",
"path": "/gama/genetic_programming/compilers/scikitlearn.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def evaluate_pipeline(
pipeline,
X, y_train,
timeout: float,
metrics='accuracy',
cv=5,
logger=None,
subsample=None
) -> Tuple:
""" Score `pipeline` with k-fold CV according to `metrics` on (a subsample of) X, y
Returns
-------
Tuple... | code_fim | hard | {
"lang": "python",
"repo": "VladPerervenko/gama",
"path": "/gama/genetic_programming/compilers/scikitlearn.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thjashin/spectral-stein-grad path: /vae/vae_conv.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
from utils import dataset
import numpy as np
import tensorflow as... | code_fim | hard | {
"lang": "python",
"repo": "thjashin/spectral-stein-grad",
"path": "/vae/vae_conv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_particles = tf.placeholder(tf.int32, shape=[], name='n_particles')
x_input = tf.placeholder(tf.float32, shape=[None, n_x], name='x')
x = tf.to_int32(tf.random_uniform(tf.shape(x_input)) <= x_input)
n = tf.shape(x)[0]
qz = q_net(x, n_z, n_particles)
# log_qz = qz.log_prob(qz)
... | code_fim | hard | {
"lang": "python",
"repo": "thjashin/spectral-stein-grad",
"path": "/vae/vae_conv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with zs.BayesianNet() as variational:
lz_x = 2 * tf.to_float(x) - 1
lz_x = tf.reshape(lz_x, [-1, 28, 28, 1])
lz_x = layers.conv2d(lz_x, ngf, 3, stride=1)
lz_x = conv_res_block(lz_x, ngf)
lz_x = conv_res_block(lz_x, ngf * 2, resize=True)
lz_x = conv_res_b... | code_fim | hard | {
"lang": "python",
"repo": "thjashin/spectral-stein-grad",
"path": "/vae/vae_conv.py",
"mode": "spm",
"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.