text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
def load(db):
refgene_data = RefGene(db)
chromosome_data = Chromosome(db)
if refgene_data.count() > 0:
raise AlreadyLoadedError('RefGene is already loaded')
url = "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/database/refGene.txt.gz"
logging.info("Begin to download from %... | code_fim | hard | {
"lang": "python",
"repo": "xcoo/ngsv-tools",
"path": "/ngsvtools/refgeneloader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> c_name = cyto_chr
c_name = c_name.replace('Chr', '')
c_name = c_name.replace('chr', '')
c_name = c_name.replace('.', '')
c = chromosome_data.get_by_name(c_name)
if c is None:
chromosome_data.append(c_name)
c = chromosome_data.get_by... | code_fim | hard | {
"lang": "python",
"repo": "xcoo/ngsv-tools",
"path": "/ngsvtools/refgeneloader.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xcoo/ngsv-tools path: /ngsvtools/refgeneloader.py
# -*- coding: utf-8 -*-
#
# ngsv-console
# http://github.com/xcoo/ngsv-console
# Copyright (C) 2012, Xcoo, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | code_fim | hard | {
"lang": "python",
"repo": "xcoo/ngsv-tools",
"path": "/ngsvtools/refgeneloader.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ength4
__all__ = [
"NistschemaSvIvListLanguageMaxLength4",
]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/language/schema_instance/nistschema_sv_iv_list_language_max_length_4_xsd/__init__.py
from output.models.nist_data.list_pkg.language.schema_instance.nistsch... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/language/schema_instance/nistschema_sv_iv_list_language_max_length_4_xsd/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/list_pkg/language/schema_instance/nistschema_sv_iv_list_language_max_length_4_xsd/__init__.py
from output.models.nist_data.list_pkg.language.schema_instance.nistschema_sv_iv_list_language_max_length_4_xsd.nistschema_sv_iv_<|fim_suffix|>ength4
... | code_fim | medium | {
"lang": "python",
"repo": "tefra/xsdata-w3c-tests",
"path": "/output/models/nist_data/list_pkg/language/schema_instance/nistschema_sv_iv_list_language_max_length_4_xsd/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif len(name_parts) == 2:
v1_name = name_parts[0] + "." + name_parts[1]
v2_name = name_parts[0] + "@2x." + name_parts[1]
v1x_exists = os.path.exists(v1_name)
v2x_exists = os.path.exists(v2_name)
if not v1x_exists:
files_wo_2x_version.append(png_file)
if len(png_files) == 0:
print "HEY, TH... | code_fim | hard | {
"lang": "python",
"repo": "codeguru85/ios-png-check",
"path": "/contrib/ios-png-check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codeguru85/ios-png-check path: /contrib/ios-png-check.py
#!/opt/local/bin/python
# PYTHON PORT OF http://github.com/eploko/ios-png-check
# by Matt Galloway (http://iphone.galloway.me.uk/)
import os
import glob
import re
files_wo_1x_version = []
files_wo_2x_version = []
size_errors = []
png_fi... | code_fim | hard | {
"lang": "python",
"repo": "codeguru85/ios-png-check",
"path": "/contrib/ios-png-check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(png_files) == 0:
print "HEY, THERE'S NO PNG FILES IN THE CURRENT FOLDER."
is_all_okay = True
if len(files_wo_1x_version) != 0:
print "FILES WITHOUT @1x VERSION ============================================"
for i in files_wo_1x_version:
print i
print ""
is_all_okay = False
if len(files_w... | code_fim | hard | {
"lang": "python",
"repo": "codeguru85/ios-png-check",
"path": "/contrib/ios-png-check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skoczen/my-will path: /plugins/uptime.py
import requests
import time
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template
class UptimePlugin(WillPlugin):
def _verify_url(self, url):
try:
r = reques... | code_fim | hard | {
"lang": "python",
"repo": "skoczen/my-will",
"path": "/plugins/uptime.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @periodic(second='5')
def goodcloud_is_up(self):
self._verify_url("http://www.agoodcloud.com")
@periodic(second='5')
def changemonsters_is_up(self):
self._verify_url("http://thechangemonsters.com/")
@periodic(second='5')
def isenough_is_up(self):
self._ve... | code_fim | hard | {
"lang": "python",
"repo": "skoczen/my-will",
"path": "/plugins/uptime.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amigrave/chopsticks path: /chopsticks/helpers.py
import sys
import subprocess
PY2 = sys.version_info < (3,)
def check_output(*args, **kwargs):
<|fim_suffix|> """Return the lines of output from the given command args."""
return check_output(*args, **kwargs).splitlines()<|fim_middle|> t... | code_fim | hard | {
"lang": "python",
"repo": "amigrave/chopsticks",
"path": "/chopsticks/helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the lines of output from the given command args."""
return check_output(*args, **kwargs).splitlines()<|fim_prefix|># repo: amigrave/chopsticks path: /chopsticks/helpers.py
import sys
import subprocess
PY2 = sys.version_info < (3,)
def check_output(*args, **kwargs):
try:
_c... | code_fim | medium | {
"lang": "python",
"repo": "amigrave/chopsticks",
"path": "/chopsticks/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndyB31/EPICAR path: /src/test_motors.py
import RPi.GPIO as GPIO
from time import sleep
<|fim_suffix|>Motor1A = 16
Motor1B = 18
Motor1E = 22
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
GPIO.output(Motor1A,100)
GPIO.output(Motor1B,0)
GPIO.output(Motor1... | code_fim | easy | {
"lang": "python",
"repo": "AndyB31/EPICAR",
"path": "/src/test_motors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>GPIO.output(Motor1E,0)
GPIO.cleanup()<|fim_prefix|># repo: AndyB31/EPICAR path: /src/test_motors.py
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
Motor1A = 16
Motor1B = 18
Motor1E = 22
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
<|fi... | code_fim | medium | {
"lang": "python",
"repo": "AndyB31/EPICAR",
"path": "/src/test_motors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndyB31/EPICAR path: /src/test_motors.py
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
Motor1A = 16
Motor1B = 18
Motor1E = 22
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
<|fim_suffix|>sleep(2)
GPIO.output(Motor1E,0)
GPIO.cle... | code_fim | medium | {
"lang": "python",
"repo": "AndyB31/EPICAR",
"path": "/src/test_motors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AXErunners/dapi-grpc path: /clients/core/v0/python/core_pb2.py
fault_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
... | code_fim | hard | {
"lang": "python",
"repo": "AXErunners/dapi-grpc",
"path": "/clients/core/v0/python/core_pb2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AXErunners/dapi-grpc path: /clients/core/v0/python/core_pb2.py
,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='from_block_height', full_name='org.axe.platform.dapi.v0... | code_fim | hard | {
"lang": "python",
"repo": "AXErunners/dapi-grpc",
"path": "/clients/core/v0/python/core_pb2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_BLOCKHEADERS = _descriptor.Descriptor(
name='BlockHeaders',
full_name='org.axe.platform.dapi.v0.BlockHeaders',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='headers', full_name='org.axe.platform.dapi.v0.BlockHeaders.headers', inde... | code_fim | hard | {
"lang": "python",
"repo": "AXErunners/dapi-grpc",
"path": "/clients/core/v0/python/core_pb2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> scheduler.schedule_absolute(created, action1)
def action2(scheduler, state):
def on_next(group):
result = scheduler.create_observer()
inners[group.key] = group
results[group.key] = result
def action3(scheduler, s... | code_fim | hard | {
"lang": "python",
"repo": "ReactiveX/RxPY",
"path": "/tests/test_observable/test_groupby.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ReactiveX/RxPY path: /tests/test_observable/test_groupby.py
assert ele_invoked[0] == 12
def test_group_by_outer_error(self):
scheduler = TestScheduler()
key_invoked = [0]
ele_invoked = [0]
ex = "ex"
xs = scheduler.create_hot_observable(
on_... | code_fim | hard | {
"lang": "python",
"repo": "ReactiveX/RxPY",
"path": "/tests/test_observable/test_groupby.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> scheduler.schedule_absolute(disposed, action4)
scheduler.start()
assert len(inners) == 4
assert results["foo"].messages == [
on_next(470, " OOF"),
on_next(530, " oOf "),
on_error(570, ex),
]
assert results["bar"].me... | code_fim | hard | {
"lang": "python",
"repo": "ReactiveX/RxPY",
"path": "/tests/test_observable/test_groupby.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> collection = get_collection(config.log_service.db.name,
config.log_service.db.collection,
db_connection)
agent_log_service = AgentLogService(config.log_service.bind_address,
collection)
LO... | code_fim | hard | {
"lang": "python",
"repo": "jr0d/mercury",
"path": "/src/mercury/log_service/service.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> missing = self.validate_message(message)
if missing:
LOG.error("Missing required data from message: {}".format(missing))
LOG.debug("msg was: {}".format(message))
return {"message": "Invalid message", "error": True}
message.update({'time_created'... | code_fim | hard | {
"lang": "python",
"repo": "jr0d/mercury",
"path": "/src/mercury/log_service/service.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jr0d/mercury path: /src/mercury/log_service/service.py
import logging
import time
from mercury.common.configuration import MercuryConfiguration
from mercury.common.mongo import get_collection, get_connection
from mercury.common.transport import SimpleRouterReqService
LOG = logging.getLogger(__n... | code_fim | hard | {
"lang": "python",
"repo": "jr0d/mercury",
"path": "/src/mercury/log_service/service.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.info("checkJsonExist %s with %s" % (xpath, url))
value = xtractFromUrl(url, xpath)
return value is not None
def checkJsonContain(url, xpath, expectValue):
logging.info("checkJsonContain %s with %s" % (expectValue, url))
value = xtractFromUrl(url, xpath)
if value is None: r... | code_fim | hard | {
"lang": "python",
"repo": "nguyenminhthai/choinho",
"path": "/common/util_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nguyenminhthai/choinho path: /common/util_check.py
#!/usr/bin/env python
# encoding: utf-8
"""
util_check.py
Created by Toan Vinh Luu on 2014-08-02.
Copyright (c) 2014 __local.ch AG__. All rights reserved.
"""
import sys
import os
import requests
import json
from common.logger import logging
c... | code_fim | hard | {
"lang": "python",
"repo": "nguyenminhthai/choinho",
"path": "/common/util_check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.info("checkJsonGreater %s with %s" % (expectValue, url))
value = xtractFromUrl(url, xpath)
if value is None: return False
try:
return int(value) > expectValue
except:
logging.warn('%s is not int', value)
return False
def checkJsonExist(url, xpath):
... | code_fim | hard | {
"lang": "python",
"repo": "nguyenminhthai/choinho",
"path": "/common/util_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Helper function to count the number of nodes for a given BST
def count_bst_nodes(root, count):
if root is None:
return count
count_bst_nodes(root.left, count)
count += 1
count_bst_nodes(root.right, count)
# Some tests
sorted_array = [1, 2, 3, 4, 5, 6, 7]
bst = create_min_heigh... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/INTERVIEW-PREP-COMPLETE/Practice/BSTFromArray/model_solution/model_solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/INTERVIEW-PREP-COMPLETE/Practice/BSTFromArray/model_solution/model_solution.py
import math
def create_min_height_bst(sorted_array):
left = 0
right = len(sorted_array) - 1
return rec_helper(sorted_array, left, right)
def rec_helper(sort... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/INTERVIEW-PREP-COMPLETE/Practice/BSTFromArray/model_solution/model_solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ms = int(e[0] * 1000)
if (Options.nosleigh and len(e) == 3):
if e[2] == Show.Relays.GRINCH_SLEIGH_FAN:
e = (e[0], e[1], Show.Relays.GRINCH_FAN)
elif e[2] == Show.Relays.GRINCH_SLEIGH:
e = (e[0], e[1], Show.Relays.GRINCH)
# switch... oh yeah
if (e[1] == Show.Comm... | code_fim | hard | {
"lang": "python",
"repo": "brucelowekamp/christmaslights",
"path": "/Show.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brucelowekamp/christmaslights path: /Show.py
try:
from ola.ClientWrapper import ClientWrapper
except ImportError:
print("NO OLA INSTALLED!!! USING STUB OLA!!!")
from OLAStubClientWrapper import ClientWrapper
from Bicycle import Bicycle
from PixelDisplay import PixelDisplay
from PixelPatter... | code_fim | hard | {
"lang": "python",
"repo": "brucelowekamp/christmaslights",
"path": "/Show.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
self._wrapper = ClientWrapper()
self._patterns = PixelPatterns()
self._showcount = 0
self._loop_count = 0
self._relays = None
self._display = None
self._bicycle = None
self._target_time = time.time()
@staticmethod
def SetArgs(parser):
parser.... | code_fim | hard | {
"lang": "python",
"repo": "brucelowekamp/christmaslights",
"path": "/Show.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # remove ourselves from the list of items
gameGlobals.itemManager.remove_item(self)
gameGlobals.navGrid.remove_blocker(self)
def setup_gfx(self, tkCanvas):
x0 = self.x - self.radius
y0 = self.y - self.radius
x1 = self.x + self.radius
y1 = self.y... | code_fim | hard | {
"lang": "python",
"repo": "JamesAdey/zompy",
"path": "/example_item.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Note no draw or update functions in this object.
These functions are defined in our parent class (gameobject).
But we don't need to actually do anything every frame.
'''
def on_collision(self, gameGlobals, other):
print("Item collided with "+str(other))
... | code_fim | hard | {
"lang": "python",
"repo": "JamesAdey/zompy",
"path": "/example_item.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JamesAdey/zompy path: /example_item.py
from gameobject import *
class ExampleItem(GameObject):
radius = 10
colour = "#FFFF00"
char = 'i'
navCost = 5
m_ovalId = None
m_textId = None
def __init__(self,x=0,y=0,colour="#FFFF00",char='i'):
super().__init__()
... | code_fim | medium | {
"lang": "python",
"repo": "JamesAdey/zompy",
"path": "/example_item.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bank_client.transfer(self.user, target, zoobars, self.token)
def run_profile(pcode, profile_api_client):
globals = {'api': profile_api_client}
exec pcode in globals
class ProfileServer(rpclib.RpcServer):
def rpc_run(self, user, visitor):
uid = 61017
userdir = '/tmp/%... | code_fim | hard | {
"lang": "python",
"repo": "lxs137/MIT6.858",
"path": "/lab2/zoobar/profile-server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lxs137/MIT6.858 path: /lab2/zoobar/profile-server.py
#!/usr/bin/python
import rpclib
import sys
import os
import base64
import sandboxlib
import urllib
import hashlib
import socket
import bank_client
import auth_client
import pcode_client
import zoodb
from debug import *
## Cache packages that... | code_fim | hard | {
"lang": "python",
"repo": "lxs137/MIT6.858",
"path": "/lab2/zoobar/profile-server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justin/podscraper path: /podscraper/config.py
__all__ = ['Config', 'config']
from pathlib import Path
class Config(object):
"""Initialize a new instance of Config"""
def __init__(self):
<|fim_suffix|> """Update the config values with the passed in kwargs"""
for key, valu... | code_fim | medium | {
"lang": "python",
"repo": "justin/podscraper",
"path": "/podscraper/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Update the config values with the passed in kwargs"""
for key, value in sorted(kwargs.items()):
if value:
if hasattr(self, key):
setattr(self, key, value)
config = Config()<|fim_prefix|># repo: justin/podscraper path: /podscraper/config... | code_fim | medium | {
"lang": "python",
"repo": "justin/podscraper",
"path": "/podscraper/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False
def close(self):
"""
Commit the file and close the data stream.
"""
self.commit()
return self.data.close()
def __iter__(self):
return self.data.__iter__()
def seek(self, pos, mode=0):
return self.data.seek(pos, mod... | code_fim | hard | {
"lang": "python",
"repo": "SemaphoreSolutions/s4-clarity-lib",
"path": "/s4/clarity/file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SemaphoreSolutions/s4-clarity-lib path: /s4/clarity/file.py
# Copyright 2016 Semaphore Solutions, Inc.
# ---------------------------------------------------------------------------
from ._internal import ClarityElement
from six import BytesIO, StringIO, string_types
import logging
import os
f... | code_fim | hard | {
"lang": "python",
"repo": "SemaphoreSolutions/s4-clarity-lib",
"path": "/s4/clarity/file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def new_from_local(cls, attachment_point_element, local_file_path, mode="r+b"):
"""
Create a new :class:`File` from a local file.
:param attachment_point_element: An element to attach the file to.
:type attachment_point_element: ClarityElement
... | code_fim | hard | {
"lang": "python",
"repo": "SemaphoreSolutions/s4-clarity-lib",
"path": "/s4/clarity/file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MadanKrishnan97/ML-LAB path: /NodeWiseNN(incomplete).py
import random
from math import exp
class Node:
def __init__(self,input_shape = None ):
self.Weights = [random.uniform(-0.5,0.5) for _ in range(input_shape)] #np.random(input_shape)
self.c = 0 # bias (mx + "c")
def ac... | code_fim | medium | {
"lang": "python",
"repo": "MadanKrishnan97/ML-LAB",
"path": "/NodeWiseNN(incomplete).py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
Test :
input = 3
n Hidden layers = 4
hidden layer nodes: [3 , 3 , 2 , 2]
output shape = 1
"""
Input = [[random.randint(0,10) for _ in range(3)] for _ in range(1000)]
correctOutput = [random.randint(0,1) for _ in range(1000)]
# Just 2 lines of code for any type of network forward pass!!
layers... | code_fim | hard | {
"lang": "python",
"repo": "MadanKrishnan97/ML-LAB",
"path": "/NodeWiseNN(incomplete).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QAlexBall/Python_Module path: /Python_lxf/Python_Basic_Operation/Unsally_Module/datetime_moudle.py
# datetime是Python处理日期和时间的标准库
# 获取当前的日期和时间
from datetime import datetime
now = datetime.now() # 获取当前datetime
print(now)
print(type(now))
# 获取指定日期和时间
dt = datetime(2015, 4, 19, 12, 20) # 用指定日期时间创建da... | code_fim | hard | {
"lang": "python",
"repo": "QAlexBall/Python_Module",
"path": "/Python_lxf/Python_Basic_Operation/Unsally_Module/datetime_moudle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dt = datetime.strptime(dt_str, '%Y-%m-%d %H:%M:%S')
tz_str_2_int = re.split(r'[\+\:]', tz_str)
utc_dt = dt.astimezone(timezone(timedelta(hours=int(tz_str_2_int[1]))))
print('timezone:', tz_str_2_int[1])
result = utc_dt.timestamp()
return result
t1 = to_timestamp('2019-1-1 08:00:00', 'UTC+7:00')
... | code_fim | hard | {
"lang": "python",
"repo": "QAlexBall/Python_Module",
"path": "/Python_lxf/Python_Basic_Operation/Unsally_Module/datetime_moudle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.error_message = error_message # str
@staticmethod
def read(q: dict, *args) -> "StatisticalGraphError":
error_message = q.get('error_message')
return StatisticalGraphError(error_message)<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/types/statistical_graph... | code_fim | hard | {
"lang": "python",
"repo": "iTeam-co/pytglib",
"path": "/pytglib/api/types/statistical_graph_error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/types/statistical_graph_error.py
from ..utils import Object
class StatisticalGraphError(Object):
"""
An error message to be shown to the user instead of the graph
Attributes:
ID (:obj:`str`): ``StatisticalGraphError``
Args:
... | code_fim | medium | {
"lang": "python",
"repo": "iTeam-co/pytglib",
"path": "/pytglib/api/types/statistical_graph_error.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> error_message = q.get('error_message')
return StatisticalGraphError(error_message)<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/types/statistical_graph_error.py
from ..utils import Object
class StatisticalGraphError(Object):
"""
An error message to be shown to the ... | code_fim | hard | {
"lang": "python",
"repo": "iTeam-co/pytglib",
"path": "/pytglib/api/types/statistical_graph_error.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> resource_filename_mock.return_value = "entrypoint.sh"
check_output_mock.side_effect = [self.NET_LS, '']
popen_mock.return_value.stdout.readline.side_effect = ['aaa', 'bbb', 'ccc', '']
popen_mock.return_value.poll.return_value = -1
os_getuid_mock.return_value = USER_... | code_fim | hard | {
"lang": "python",
"repo": "RazRegev/skipper",
"path": "/tests/test_runner_podman.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RazRegev/skipper path: /tests/test_runner_podman.py
import mock
import os
import unittest
from skipper import utils
from skipper import runner
USER_ID = 1000
GROUP_ID = 2000
REGISTRY = 'registry.io:5000'
IMAGE = 'image'
TAG = '1234567'
FQDN_IMAGE = REGISTRY + '/' + IMAGE + ':' + TAG
WORKDIR =... | code_fim | hard | {
"lang": "python",
"repo": "RazRegev/skipper",
"path": "/tests/test_runner_podman.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_options(get_pdos_generator_inputs):
"""Test specifying ``options`` for the ``get_builder_from_protocol()`` method."""
queue_name = 'super-fast'
withmpi = False # The protocol default is ``True``
options = {'queue_name': queue_name, 'withmpi': withmpi}
builder = PdosWorkChai... | code_fim | hard | {
"lang": "python",
"repo": "aiidateam/aiida-quantumespresso",
"path": "/tests/workflows/protocols/test_pdos.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aiidateam/aiida-quantumespresso path: /tests/workflows/protocols/test_pdos.py
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
"""Tests for the ``PdosWorkChain.get_builder_from_protocol`` method."""
from aiida.engine import ProcessBuilder
from aiida.plugins import WorkflowFactory
im... | code_fim | hard | {
"lang": "python",
"repo": "aiidateam/aiida-quantumespresso",
"path": "/tests/workflows/protocols/test_pdos.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert isinstance(ro_rgc.get_genome_attributes(genome), Mapping)<|fim_prefix|># repo: vreuter/refgenconf path: /tests/test_utils.py
import pytest
from collections import Mapping
@pytest.mark.parametrize(["genome", "asset", "tag"], [("rCRSd", "fasta", "default")])
def test_is_asset_complete_returns_... | code_fim | medium | {
"lang": "python",
"repo": "vreuter/refgenconf",
"path": "/tests/test_utils.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vreuter/refgenconf path: /tests/test_utils.py
import pytest
from collections import Mapping
@pytest.mark.parametrize(["genome", "asset", "tag"], [("rCRSd", "fasta", "default")])
def test_is_asset_complete_returns_correct_result(genome, asset, tag, ro_rgc):
ro_rgc.pull(genome, asset, tag)
... | code_fim | medium | {
"lang": "python",
"repo": "vreuter/refgenconf",
"path": "/tests/test_utils.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TD22057/T-Home path: /conf/thermostat.py
#===========================================================================
#
# Radio thermostat device configuration
#
#===========================================================================
# Time in seconds to poll the thermostat
pollTime = 60
<|... | code_fim | hard | {
"lang": "python",
"repo": "TD22057/T-Home",
"path": "/conf/thermostat.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>#===========================================================================
#
# Logging configuration
#
#===========================================================================
logFile = '/var/log/tHome/thermostat.log'
logLevel = 40<|fim_prefix|># repo: TD22057/T-Home path: /conf/thermostat.py
#====... | code_fim | hard | {
"lang": "python",
"repo": "TD22057/T-Home",
"path": "/conf/thermostat.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jhawk1196/CS3250PythonProject path: /tests/testfontSelect.py
import unittest
from tkinter import *
import src.fontSelect as fontSelect
from tkinter import font
from mock import patch
class TestFontStyle(unittest.TestCase):
<|fim_suffix|> def test_fontColor(
self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Jhawk1196/CS3250PythonProject",
"path": "/tests/testfontSelect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_fontColor(
self):
"""
Test font_color method correctly changes fg attribute of Message
called label
"""
root = Tk()
label = Message(root, fg='Red')
label.pack()
self.assertEqual('Black', fontSelect.font_color(label,... | code_fim | hard | {
"lang": "python",
"repo": "Jhawk1196/CS3250PythonProject",
"path": "/tests/testfontSelect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EdwaRen/Competitve-Programming path: /Leetcode/689.maximum-sum-of-3-non-overlapping-subarrays.py
class Solution(object):
def maxSumOfThreeSubarrays(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
if nums == None or ... | code_fim | hard | {
"lang": "python",
"repo": "EdwaRen/Competitve-Programming",
"path": "/Leetcode/689.maximum-sum-of-3-non-overlapping-subarrays.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur_left = sum(nums[:k])
cur_right = sum(nums[-k:])
left_sums = [(0, sum(nums[:k]))]
right_sums = [(len(nums)-k, sum(nums[-k:]))]
for i in range(k, len(nums)):
cur_left = cur_left + nums[i] - nums[i-k]
if cur_left > left_sums[-1][1]:
... | code_fim | hard | {
"lang": "python",
"repo": "EdwaRen/Competitve-Programming",
"path": "/Leetcode/689.maximum-sum-of-3-non-overlapping-subarrays.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_SHAREDSTREETSWEEKLYSPEEDS = _descriptor.Descriptor(
name='SharedStreetsWeeklySpeeds',
full_name='SharedStreetsWeeklySpeeds',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='referenceId', full_name='SharedStreetsWeeklySpeeds.referenc... | code_fim | hard | {
"lang": "python",
"repo": "schnerd/sharedstreets-python",
"path": "/sharedstreets/speeds_pb2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: schnerd/sharedstreets-python path: /sharedstreets/speeds_pb2.py
x11\n\rThirtySeconds\x10\x04\x12\r\n\tOneMinute\x10\x05\x12\x0f\n\x0b\x46iveMinutes\x10\x06\x12\x0e\n\nTenMinutes\x10\x07\x12\x12\n\x0e\x46ifteenMinutes\x10\x08\x12\x11\n\rThirtyMinutes\x10\t\x12\x0b\n\x07OneHour\x10\n\x12\n\n\x06One... | code_fim | hard | {
"lang": "python",
"repo": "schnerd/sharedstreets-python",
"path": "/sharedstreets/speeds_pb2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
_SPEEDSUMMARYBYPERIOD = _descriptor.Descriptor(
name='SpeedSummaryByPeriod',
full_name='SpeedSummaryByPeriod',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='periodOffset', full_name='SpeedSummaryByPeriod.periodOffset', index=0,
... | code_fim | hard | {
"lang": "python",
"repo": "schnerd/sharedstreets-python",
"path": "/sharedstreets/speeds_pb2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WeelCJ/Vitis-AI path: /Vitis-AI-Quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/nn/modules/mean.py
import torch
from nndct_shared.quantization import maybe_get_quantizer, process_inputs_and_params, post_quant_process
import pytorch_nndct.utils as py_utils
__all__ = ['Mean']
class deephi_Me... | code_fim | hard | {
"lang": "python",
"repo": "WeelCJ/Vitis-AI",
"path": "/Vitis-AI-Quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/nn/modules/mean.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@py_utils.register_quant_op
def Mean(*args, **kwargs):
#quant_mode,_ = maybe_get_quantizer()
#if quant_mode==None:
# return
return deephi_Mean(*args, **kwargs)<|fim_prefix|># repo: WeelCJ/Vitis-AI path: /Vitis-AI-Quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/nn/modules/mean.py
impor... | code_fim | hard | {
"lang": "python",
"repo": "WeelCJ/Vitis-AI",
"path": "/Vitis-AI-Quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/nn/modules/mean.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, input, dim, keepdim):
input, _ = process_inputs_and_params(
self.node,
self.quant_mode,
self.quantizer,
inputs=input,
valid_inputs=self.valid_inputs)
output = torch.mean(input, dim, keepdim)
[output] = post_quant_process(self.node, se... | code_fim | hard | {
"lang": "python",
"repo": "WeelCJ/Vitis-AI",
"path": "/Vitis-AI-Quantizer/vai_q_pytorch/pytorch_binding/pytorch_nndct/nn/modules/mean.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sweetpea-org/sweetpea-py path: /sweetpea/_internal/core/generate/tools/unigen.py
"""This module provides functionality for calling the third-party Unigen tool.
`Unigen <https://github.com/meelgroup/unigen>`_ is a state-of-the-art,
almost-uniform SAT sampler that uses `CryptoMiniSAT
<https://gith... | code_fim | hard | {
"lang": "python",
"repo": "sweetpea-org/sweetpea-py",
"path": "/sweetpea/_internal/core/generate/tools/unigen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Calls Unigen in a Docker container, reading a given file as the input
problem.
"""
unigen_container = 'msoos/unigen'
input_bytes = input_file.read_bytes()
# args = shell_split("--rm -i -a stdin -a stdout --samples="+str(sample_count))
args = shell_split("--rm -i -a stdin -a ... | code_fim | hard | {
"lang": "python",
"repo": "sweetpea-org/sweetpea-py",
"path": "/sweetpea/_internal/core/generate/tools/unigen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
print(character(0))
print(character('Ai Haibara'))<|fim_prefix|># repo: lethargilistic/dcapi-wrap path: /dcapi/dcapi.py
import requests
from urllib.parse import urlparse
from os.path import join
#TODO: Break into separate standard settings module
ROOT_URL = 'http://pro... | code_fim | hard | {
"lang": "python",
"repo": "lethargilistic/dcapi-wrap",
"path": "/dcapi/dcapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lethargilistic/dcapi-wrap path: /dcapi/dcapi.py
import requests
from urllib.parse import urlparse
from os.path import join
#TODO: Break into separate standard settings module
ROOT_URL = 'http://progdisc.club/~lethargilistic/proxy'
HEADERS = {'User-Agent': 'dcapi-wrap (https://github.com/lethargi... | code_fim | medium | {
"lang": "python",
"repo": "lethargilistic/dcapi-wrap",
"path": "/dcapi/dcapi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zouzhen/simple-faster-rcnn path: /keras_frcnn/private_parser.py
import os
import numpy as np
import tensorflow as tf
def get_data(input_path):
all_imgs = []
classes_count = {}
class_mapping = {}
# 解析train_lable_rpn图片数据
print('Parsing train_lable_rpn.txt')
<... | code_fim | medium | {
"lang": "python",
"repo": "zouzhen/simple-faster-rcnn",
"path": "/keras_frcnn/private_parser.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 取取图片路径
pic_path = lineinfo[0]
# 取图片的类别
pic_class = lineinfo[1]
# 取图片的宽和高
pic_scale = lineinfo[2].split(",")
# 将图片信息存储在annotation_data中
annotation_data = {'filepath': pic_path, 'width': int(pic_scale[0]),
... | code_fim | medium | {
"lang": "python",
"repo": "zouzhen/simple-faster-rcnn",
"path": "/keras_frcnn/private_parser.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/ai4eutils path: /url_utils.py
#
# url_utils.py
#
# Frequently-used functions for downloading or manipulating URLs
#
#%% Imports
import re
import urllib
import os
import tempfile
from urllib.parse import urlparse
# pip install progressbar2
import progressbar
ai4e_utils_temp_dir = No... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/ai4eutils",
"path": "/url_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def download_url(url, destination_filename=None, progress_updater=None,
force_download=False, verbose=True):
"""
Download a URL to a file. If no file is specified, creates a temporary file,
with a semi-best-effort to avoid filename collisions.
Prints so... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/ai4eutils",
"path": "/url_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def download_relative_filename(url, output_base, verbose=False):
"""
Download a URL to output_base, preserving relative path
"""
p = urlparse(url)
# remove the leading '/'
assert p.path.startswith('/'); relative_filename = p.path[1:]
destination_filename = os.path.join(ou... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/ai4eutils",
"path": "/url_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: austenc/silo-framework path: /tests/test_console.py
import os
import unittest
from Silo.Console.Command import Command
from Silo.Console.Kernel import Kernel
from Silo.Console.Parser import Parser
from argparse import Namespace
class TestCommand(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "austenc/silo-framework",
"path": "/tests/test_console.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestConsoleParser(unittest.TestCase):
def test_parse_command_only(self):
command, args = Parser.parse('cmd:name ')
self.assertEqual(command, 'cmd:name')
def test_parse_description(self):
command, args = Parser.parse('cmd:name {example : Example desc }')
self.... | code_fim | hard | {
"lang": "python",
"repo": "austenc/silo-framework",
"path": "/tests/test_console.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.accepted = accept_list
self.filter_file = filter_file
f = open(self.filter_file, 'w')
for i in self.accepted:
f.write(i + '''
''')
f.close()
def GetPropertyFile(self):
return self.property_file<|fim_prefix|># repo: e-mayo/mscreen ... | code_fim | medium | {
"lang": "python",
"repo": "e-mayo/mscreen",
"path": "/mscreen/autodocktools_prepare_py3k/AutoDockTools/VisionInterface/Adt/LigandDB.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Ligand Library Object
"""
# def __init__(self, server_lib=None, url_lib=None, filter_file=None, accepted=None):
def __init__(self, server_lib=None, url_lib=None):
self.server_lib = server_lib
self.url_lib = url_lib
# self.accepted = accepted
self.accepted... | code_fim | medium | {
"lang": "python",
"repo": "e-mayo/mscreen",
"path": "/mscreen/autodocktools_prepare_py3k/AutoDockTools/VisionInterface/Adt/LigandDB.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: e-mayo/mscreen path: /mscreen/autodocktools_prepare_py3k/AutoDockTools/VisionInterface/Adt/LigandDB.py
#############################################################################
#
# Author: J. Ren
#
#############################################################################
"""
Ligand Libra... | code_fim | hard | {
"lang": "python",
"repo": "e-mayo/mscreen",
"path": "/mscreen/autodocktools_prepare_py3k/AutoDockTools/VisionInterface/Adt/LigandDB.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sebastiao-sousa-br/Extrator_SPEDFiscal path: /Application.py
# Form implementation generated from reading ui file 'QtApplication.ui'
#
# Created by: PyQt6 UI code generator 6.1.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unle... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Application.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # region Events
self.Close_Button.clicked.connect(lambda: MainWindow.close())
self.Input_Button.clicked.connect(self.click_selecionar_input)
self.Output_Button.clicked.connect(self.click_selecionar_output)
self.Registers_Checkbox.toggled.connect(self.selecionar_regi... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def selecionar_registros_is_checked(self):
"""
This function will enable or disable the manual input of REGs to be processed.
:return: None
"""
state = self.Registers_Checkbox.isChecked()
self.Registers_Field.setEnabled(state)
def processing_prereq... | code_fim | hard | {
"lang": "python",
"repo": "sebastiao-sousa-br/Extrator_SPEDFiscal",
"path": "/Application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# standard quick-sorting start here...
pivot = part[0]
lessPart = []
morePart = []
for x in part:
if x < pivot:
lessPart.append(x)
elif x > pivot:
morePart.append(x)
else:
# ignori... | code_fim | hard | {
"lang": "python",
"repo": "StormRoBoT/MyPythonEssentialsClass-2015",
"path": "/samples/quicksort/single-main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: StormRoBoT/MyPythonEssentialsClass-2015 path: /samples/quicksort/single-main.py
import random
def qsort(items, depth=0):
"""
Recursive quick-sort algorithm.
"""
indent = ' ' * depth
prefix = "{}".format(indent)
print(prefix, "sorting {}".format(items))
if len(items... | code_fim | hard | {
"lang": "python",
"repo": "StormRoBoT/MyPythonEssentialsClass-2015",
"path": "/samples/quicksort/single-main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 44hero/ml_tools path: /scripts/ml_puppet.py
t:
#if this function was added interactively already, don't do anything
return
#get the file name
filename = result.split('found in: ')[-1]
#globalize a proc which would otherwise fail
mm.eval('''global proc optionalDag... | code_fim | hard | {
"lang": "python",
"repo": "44hero/ml_tools",
"path": "/scripts/ml_puppet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data['baseChain'] = []
data['ikMatchTo'] = []
#get the fk chain
for i in range(mc.getAttr(element+'.'+fkAttr, size=True)):
con = mc.listConnections('%s.%s[%s]' % (element,fkAttr,i), source=True, destination=False)
if con:
data['fkChain'].append(con[0])
for... | code_fim | hard | {
"lang": "python",
"repo": "44hero/ml_tools",
"path": "/scripts/ml_puppet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 44hero/ml_tools path: /scripts/ml_puppet.py
- - - - - - - - - - - - - -
#
# Copyright 2018 Morgan Loomis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without... | code_fim | hard | {
"lang": "python",
"repo": "44hero/ml_tools",
"path": "/scripts/ml_puppet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DalavanCloud/systemml path: /src/main/python/tests/test_mllearn_df.py
#!/usr/bin/python
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with t... | code_fim | hard | {
"lang": "python",
"repo": "DalavanCloud/systemml",
"path": "/src/main/python/tests/test_mllearn_df.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> diabetes = datasets.load_diabetes()
diabetes_X = diabetes.data[:, np.newaxis, 2]
diabetes_X_train = diabetes_X[:-20]
diabetes_X_test = diabetes_X[-20:]
diabetes_y_train = diabetes.target[:-20]
diabetes_y_test = diabetes.target[-20:]
regr = LinearRegr... | code_fim | hard | {
"lang": "python",
"repo": "DalavanCloud/systemml",
"path": "/src/main/python/tests/test_mllearn_df.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jina-ai/jinad path: /jinad/models/pod.py
from typing import List, Optional
from pydantic import BaseModel
from jinad.models.custom import build_pydantic_model
<|fim_suffix|>class ParallelPodModel(BaseModel):
head: Optional[SinglePodModel] = None
tail: Optional[SinglePodModel] = None
... | code_fim | medium | {
"lang": "python",
"repo": "jina-ai/jinad",
"path": "/jinad/models/pod.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ParallelPodModel(BaseModel):
head: Optional[SinglePodModel] = None
tail: Optional[SinglePodModel] = None
peas: List[SinglePodModel] = [SinglePodModel()]<|fim_prefix|># repo: jina-ai/jinad path: /jinad/models/pod.py
from typing import List, Optional
from pydantic import BaseModel
<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "jina-ai/jinad",
"path": "/jinad/models/pod.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ParallelPodModel(BaseModel):
head: Optional[SinglePodModel] = None
tail: Optional[SinglePodModel] = None
peas: List[SinglePodModel] = [SinglePodModel()]<|fim_prefix|># repo: jina-ai/jinad path: /jinad/models/pod.py
from typing import List, Optional
from pydantic import BaseModel
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "jina-ai/jinad",
"path": "/jinad/models/pod.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO(wickman) Post-process coverage to elide $PEX_ROOT and make
# the report more useful/less noisy. #89
if pex_coverage_filename:
cov.save()
else:
cov.report(show_missing=False, ignore_errors=True, file=sys.stdout)
def _wrap_profiling(self, runner, *args):
... | code_fim | hard | {
"lang": "python",
"repo": "facebook/buck",
"path": "/third-party/py/pex/pex/pex.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebook/buck path: /third-party/py/pex/pex/pex.py
unction
import os
import subprocess
import sys
from contextlib import contextmanager
from distutils import sysconfig
from site import USER_SITE
import pkg_resources
from pkg_resources import EntryPoint, WorkingSet, find_distributions
from .com... | code_fim | hard | {
"lang": "python",
"repo": "facebook/buck",
"path": "/third-party/py/pex/pex/pex.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebook/buck path: /third-party/py/pex/pex/pex.py
s DevNull(object):
def __init__(self):
pass
def write(self, *args, **kw):
pass
def flush(self):
pass
class PEX(object): # noqa: T000
"""PEX, n. A self-contained python environment."""
class Error(Exception): pass
cla... | code_fim | hard | {
"lang": "python",
"repo": "facebook/buck",
"path": "/third-party/py/pex/pex/pex.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if auth:
if not self._access_id or not self._secret:
raise CoinExApiError('API keys not configured')
params.update(access_id=self._access_id)
params.update(tonce=int(time.time() * 1000))
params = collections.OrderedDict(sorted(params.it... | code_fim | hard | {
"lang": "python",
"repo": "chillalittle/coinex",
"path": "/coinex/coinex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chillalittle/coinex path: /coinex/coinex.py
import hashlib
import time
import requests
import collections
class CoinExApiError(Exception):
pass
class CoinEx:
_headers = {
'Content-Type': 'application/json; charset=utf-8',
'Accept': 'application/json',
'User-Agent... | code_fim | hard | {
"lang": "python",
"repo": "chillalittle/coinex",
"path": "/coinex/coinex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def order_mining_difficulty(self):
return self._v1('order/mining/difficulty', method='get', auth=True)
def _v1(self, path, method='get', auth=False, **params):
headers = dict(self._headers)
if auth:
if not self._access_id or not self._secret:
r... | code_fim | hard | {
"lang": "python",
"repo": "chillalittle/coinex",
"path": "/coinex/coinex.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.