filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_21664 |
import os
from argparse import ArgumentParser
import tensorflow as tf
import tensorflow_addons as tfa
import tensorflow_datasets as tfds
from tensorflow.keras.callbacks import TensorBoard
from matplotlib import pyplot as plt
import attention as att
from tensorflow.keras.layers.experimental.preprocessing import Rescali... |
the-stack_106_21667 | from django.db.models import Q
from django.contrib.auth.models import User
from rest_framework import generics, serializers
from kitsune.gallery.models import Image
from kitsune.sumo.api_utils import (
LocaleNegotiationMixin, InequalityFilterBackend, DateTimeUTCField, ImageUrlField)
class ImageShortSerializer(s... |
the-stack_106_21668 | import asyncio
import json
import logging
import re
import uuid
from collections import defaultdict
from copy import deepcopy
from datetime import datetime, timezone
from enum import Enum
from importlib import import_module
import marshmallow as ma
from app.objects.c_adversary import AdversarySchema
from app.objects.... |
the-stack_106_21669 | '''
@queenjobo @ksamocha 04/03/2019
Script that prints commands to run enrichment test
Adapted from submit_DNE_test.py to make temporary files per gene for the
de novo mutations in that gene and then to submit a job to the farm (or
print out the python commands).
Version 1.1: Modified to account for changes in DNE_te... |
the-stack_106_21671 | # --*-- coding:utf-8 --*--
import numpy as np
import cv2
from scipy import signal
'''
helper function
'''
def filterItChopOff(f, r, sp):
f[np.isnan(f)] = 0
H, W, d = f.shape
B = np.ones([2 * r + 1, 2 * r + 1]) # 2r+1 * 2r+1 neighbourhood
minSP = cv2.erode(sp, B, iterations=1)
maxSP = cv2.dilat... |
the-stack_106_21674 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
import logging
import re
import os
import sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from agent impor... |
the-stack_106_21675 | # Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
the-stack_106_21676 | import sys
import dpkt
import socket
class MB():
UNIT_ID = 1
FNCODE_READ_DISCRETE_INPUTS = 2
FNCODE_READ_COILS = 1
FNCODE_WRITE_SINGLE_COIL = 5
FNCODE_WRITE_MULTIPLE_COILS = 15
FNCODE_READ_INPUT_REGISTERS = 4
FNCODE_READ_MULTIPLE_HOLDING_REGISTERS = 3
FNCODE_WRITE_SINGLE_HOLDING_RE... |
the-stack_106_21677 | from master.workflow.netconf.workflow_netconf import WorkFlowNetConf
from master import models
from common.utils import *
class WorkFlowNetConfWdnn(WorkFlowNetConf):
"""
"""
@property
def model_path(self):
"""
getter for preprocess
"""
return self.conf['model_path']
... |
the-stack_106_21680 | import asyncio
import uvicorn
import click
from click import formatting
from click_default_group import DefaultGroup
import json
import os
import pathlib
import shutil
from subprocess import call
import sys
from runpy import run_module
import webbrowser
from .app import Datasette, DEFAULT_CONFIG, CONFIG_OPTIONS, pm
fro... |
the-stack_106_21682 | """
arctictern.py
A little script that does a big migration
"""
import json
import os
import requests
import shutil
import subprocess
import sys
from os.path import exists
BASE_URL = "https://raw.githubusercontent.com/Code-Institute-Org/gitpod-full-template/master/"
BACKUP = True
MIGRATE = False
CURRENT_VERSION = 1.... |
the-stack_106_21685 | #!/bin/python
import math
import os
import random
import re
import sys
if __name__ == '__main__':
cases = int(input())
for caseNo in range(cases):
s = raw_input()
#reverse string
rs = s[::-1]
n = len(s)
#take the difference of ascii values
for i in range(1, n):
d1 = abs(ord(s[i])... |
the-stack_106_21686 | # Lint as: python3
# Copyright 2019 Deepmind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
the-stack_106_21688 | from rpython.rlib.rstacklet import StackletThread
from rpython.rlib import jit
from pypy.interpreter.error import OperationError, get_cleared_operation_error
from pypy.interpreter.executioncontext import ExecutionContext
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.typedef import TypeDef
from ... |
the-stack_106_21690 |
from flask import Flask, render_template, redirect, make_response, jsonify, request, send_from_directory
import flask
import requests
import argparse
import os
app = Flask(__name__)
method_requests_mapping = {
'GET': requests.get,
'HEAD': requests.head,
'POST': requests.post,
'PUT': requests.put,
... |
the-stack_106_21692 | from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem, QMessageBox
from PyQt5.QtGui import *
from PyQt5 import uic
from CuraCompareData import CuraDataMerge, CuraData, getAllKeys, findKeyInfo
from LoadGCodeSettings_3 import loadGCodeSettings_3
from LoadGCodeInjected... |
the-stack_106_21696 | import binascii
from qtwrapper import QtGui, QtCore, QtWidgets, Qt
class DisAsmModel(QtCore.QAbstractTableModel):
def __init__(self, debugger):
super().__init__()
self.debugger = debugger
self.debugger.stopped.connect(self.on_stopped)
self.instructions = []
self.headers = [... |
the-stack_106_21699 | """
FITSImageData Class
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------------... |
the-stack_106_21700 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... |
the-stack_106_21701 | # (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
import logging
import json
from pdpyras import APISession, PDClientError
PRIORITIES = 'priorities'
ESCALATION_POLICIES = 'escalation_policies'
SERVICES = 'services'
INCIDENT_FRAGMENT = 'incidents'
UPDATE_FRAGMENT = '/'.join((INCIDENT_FRAGMENT, '{}'))
NOTE_FRAG... |
the-stack_106_21706 | # Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
the-stack_106_21708 | import argparse
import logging
import random
import os
import glob
import tensorflow as tf
import scipy.io
from model.input_fn import input_fn
from utils.params import Param
parser = argparse.ArgumentParser()
parser.add_argument('--model_dir', default='./data/params/model', help='Location of model parameters json')
... |
the-stack_106_21710 | # day 02
def intcode_computer_v0(program_inp, settings=None):
program_int = program_inp.copy()
if settings is not None:
program_int[1] = settings[0]
program_int[2] = settings[1]
x = 0
while x < len(program_int) - 3:
opcode = program_int[x]
a = program_int[program_int[x ... |
the-stack_106_21711 | from django.db import models
from django.conf import settings
import stripe
STRIPE_SECRET_KEY = getattr(settings, 'STRIPE_SECRET_KEY')
stripe.api_key = STRIPE_SECRET_KEY
class CardManager(models.Manager):
def new(self, token, payment_profile):
if token and payment_profile.user.is_employer:
cus... |
the-stack_106_21712 | # -*- coding: utf-8 -*-
"""
Apache Libcloud DNS Management
==============================
Connection module for Apache Libcloud DNS management
.. versionadded:: 2016.11.0
:configuration:
This module uses a configuration profile for one or multiple DNS providers
.. code-block:: yaml
libcloud_dns:
... |
the-stack_106_21713 | # Drafts on server
# Check server socket is accepting connections:
import socket
import time
s = socket.create_server(("", 8080))
for _ in range(3):
try:
if s.getsockopt(socket.SOL_SOCKET, socket.SO_ACCEPTCONN):
break
except (OSError,): # maybe others like AttributeError if s has to be i... |
the-stack_106_21716 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
setuptools.setup(
name="docbarcodes",
version="1.0.9",
author="Arlind Nocaj",
author_email="nocaja.r@gmail.com",
descri... |
the-stack_106_21717 | """A model to create 10 agents which move around their environment,
altering its values as they go"""
# IMPORTS
import tkinter
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animate
import random
import requests
import bs4
import agentframework
import Environment
# MODEL PARAMETERS... |
the-stack_106_21719 | # coding=utf-8
# Copyright 2018 Google LLC & Hwalsuk Lee.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
the-stack_106_21720 | # -*- coding: utf-8 -*-
"""
@date: 2020/8/20 下午8:50
@file: test_visdrone_anno.py
@author: zj
@description:
"""
from pnno.config import cfg
from pnno.anno.visdrone_anno import VisDroneAnno
class TestVisdroneAnno(object):
def test_process(self):
config_file = 'tests/visdrone_anno_test/process_config.yam... |
the-stack_106_21721 | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from collections import namedtuple
VersionInfo = namedtuple('VersionInfo', [
'major',
'minor',
'micro',
'releaselevel',
'serial'
])
# DO NOT EDIT THIS DIRECTLY! It is managed by bump... |
the-stack_106_21723 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_106_21728 | # Copyright 2020-2021 The Regents of the University of California, through Lawrence
# Berkeley National Laboratory, and other Hatchet Project Developers. See the
# top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
import json
import pandas as pd
import os
import glob
from hatchet.graphframe import G... |
the-stack_106_21729 |
from builtins import object
import sys
from google.appengine._internal.django import http
from google.appengine._internal.django.core import signals
from google.appengine._internal.django.utils.encoding import force_unicode
from google.appengine._internal.django.utils.importlib import import_module
import six
class ... |
the-stack_106_21730 | import web
web.config.debug = False
urls = (
"/count", "count",
"/reset", "reset"
)
app = web.application(urls, locals())
store = web.session.DiskStore('sessions')
session = web.session.Session(app, store, initializer={'count': 0})
class count:
def GET(self):
session.count += 1
return str(session.count)
cl... |
the-stack_106_21731 | import torch
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SequentialSampler
import tools
from conf import WORKING_SHAPE, build_debug_model
from dataset import CarvanaDataset, TRAIN_INDEX
from train_utils import var, trycuda
dataset = CarvanaDataset(TRAIN_INDEX, WORKING_SHAPE)
loader = ... |
the-stack_106_21732 | from __future__ import unicode_literals
from django.db import migrations
from .loader import MigrationLoader
from .recorder import MigrationRecorder
class MigrationExecutor(object):
"""
End-to-end migration execution - loads migrations, and runs them
up or down to a specified set of targets.
"""
... |
the-stack_106_21733 | #!/usr/bin/env python3
# Copyright 2019 Christian Henning
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
the-stack_106_21739 | '''show_bfd.py
IOSXE parser for the following show command
* show bfd neighbors details
* show bfd neighbors client {client} details
'''
# Python
import re
import pprint
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, \
Optional,\
Any... |
the-stack_106_21740 | # Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/python/reconstruction_system/optimize_posegraph.py
import open3d as o3d
import sys
# sys.path.append("../utility")
from examples.python.utility.file import join
def run_posegraph_optimization(pose_gra... |
the-stack_106_21741 | import torch
import torch.nn as nn
import numpy as np
from utils.utils import bboxes_iou
class YOLOLayer(nn.Module):
"""
detection layer corresponding to yolo_layer.c of darknet
"""
def __init__(self, anch_mask, n_classes, stride, in_ch=1024, ignore_thre=0.7):
"""
Args:
anc... |
the-stack_106_21742 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="bertopic",
packages=["bertopic"],
version="0.1.2",
author="Maarten Grootendorst",
author_email="maartengrootendorst@gmail.com",
description="BERTopic performs topic Modeling with state... |
the-stack_106_21743 | ##
# Copyright 2021 IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
##
from lnn import Model, truth_table
def test_1(output=False):
"""decrease weights for contradictory facts
given And(A, B) - reduce the weight on B
training in the upward direction
"""
model = Model()
... |
the-stack_106_21745 | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... |
the-stack_106_21746 | # (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... |
the-stack_106_21747 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test Teachers.
A module for testing various teacher types in ParlAI
"""
import os
import unittest
from parlai.utils... |
the-stack_106_21749 | """Support for the Asterisk Voicemail interface."""
from __future__ import annotations
from functools import partial
import logging
from asterisk_mbox import ServerError
from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError
from homeassistant.core import HomeAssistant, callback
from ho... |
the-stack_106_21750 | import streamlit as st
from tensorflow import keras
import tensorflow as tf
import numpy as np
import pandas as pd
from PIL import Image
def load_model(path):
model = keras.models.load_model(path)
model.summary()
return model
def preProc(A):
A = np.array(A)
normalization_layer = tf.keras.layers.experimental.prep... |
the-stack_106_21751 | from __future__ import print_function
import numpy as np
import fsps
from astropy.cosmology import FlatLambdaCDM
cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
__all__ = ['fsps_source']
class fsps_source():
"""
Class for defining source objects. For the moment this just
wraps generating an FSPS spectrum with a... |
the-stack_106_21752 | import requests
import params
base_url = params.url
url = base_url+"v2/public/user/create"
user_email_domain = params.email_domain
# User Inputs
first_name = input("Type user's first name: ")
last_name = input("Type user's last name: ")
# Create user creds from inputs
full_name = first_name + " " + las... |
the-stack_106_21754 | # -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import uuid
from tests import utils
from tests.modules.annotations.resources import utils as annot_utils
from tests.modules.asset_groups.resources import utils as sub_utils
from tests.modules.encounters.resources import utils as enc_utils
def test_patch_ann... |
the-stack_106_21755 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The Index class can use several implementations as its
engine. Any implementation should implement the following:
__init__(data, row_index) : initialize index based on key/row list pairs
add(key, row) -> None : add (key, row) to existing data
remove(... |
the-stack_106_21757 | #!/usr/bin/env python
from datetime import datetime
import unittest
from pyvcs.backends import get_backend
from pyvcs.exceptions import FileDoesNotExist, FolderDoesNotExist
class BzrTest(unittest.TestCase):
def setUp(self):
bzr = get_backend('bzr')
self.repo = bzr.Repository('/home/andrew/junk/dja... |
the-stack_106_21760 | import numpy as np
from fireant import utils
from fireant.formats import (
INF_VALUE,
NULL_VALUE,
)
from fireant.slicer.totals import TOTALS_MARKERS
from ..references import reference_label
def extract_display_values(dimensions, data_frame):
"""
Retrieves the display values for each dimension.
F... |
the-stack_106_21762 | """Http views to control the config manager."""
import asyncio
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.http import HomeAssistantView
from homeassistant.helpers.data_entry_flow import (
FlowManagerIndexView, FlowManagerResourceView)
REQUIREMENTS = ['voluptuous-seria... |
the-stack_106_21763 | from __future__ import annotations
from functools import cached_property
from typing import Union
from app.data_models import QuestionnaireStore
from app.questionnaire import QuestionnaireSchema
from app.questionnaire.location import InvalidLocationException
from app.questionnaire.router import Router
from app.views.... |
the-stack_106_21764 | # coding=utf-8
# Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
the-stack_106_21765 | #!/usr/bin/env python3
# Copyright (c) 2021 Bitcoin Association
# Distributed under the Open BSV software license, see the accompanying file LICENSE.
"""
Test RPC function verifyscript
"""
from test_framework.blocktools import create_block, create_coinbase, create_transaction, create_tx
from test_framework.cdefs imp... |
the-stack_106_21766 | # coding=utf-8
# Copyright 2020-present Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... |
the-stack_106_21767 | from collections import defaultdict
from urllib import parse
import requests
from conf import config, constants
from data import full_wuxing_dict as fwd
from conf.config import MIN_SINGLE_NUM, MAX_SINGLE_NUM, SEX, THRESHOLD_SCORE
TESTED_FILE = 'result/name_tested.txt' # 已经在网站测试过的名字
RESULT_FILE = 'result/name.txt' # ... |
the-stack_106_21768 | import json
from unittest import mock
from unittest.mock import patch
import pytest
from averell.readers.plsdo import CommentedTreeBuilder
from averell.readers.plsdo import get_features
from averell.readers.plsdo import parse_xml
from tests.test_utils import TESTS_DIR
PLC_PATH = TESTS_DIR / "fixtures" / "plc"
@pyt... |
the-stack_106_21769 | # qubit number=2
# total number=7
import cirq
import qiskit
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as... |
the-stack_106_21771 | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
the-stack_106_21774 | # Copyright 2020 Zachary Frost
#
# 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 restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribut... |
the-stack_106_21778 | # -*- coding: utf-8 -*-
"""Request Service
The request service is responsible for:
* Validating requests
* Request completion notification
"""
import base64
import gzip
import json
import logging
import re
import threading
from builtins import str
from copy import deepcopy
from typing import Dict, List, Sequence, Un... |
the-stack_106_21780 | # ====================开始导入模块====================
# 导入标准库
import imp
import os
import sys
import codecs
import traceback
# 环境变量初始化
try:
print("==========脚本开始初始化==========")
except UnicodeEncodeError:
# 设置默认输出编码为utf-8, 但是会影响腾讯云函数日志输出。
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
print("==... |
the-stack_106_21781 | """ Sales Module """
# Imports
from asyncore import write
from itertools import product
from Essentials import *
from Products import *
from Accounts import *
# Variable Definitions
kind_of_sales = {1: "Cotización", 2: "Pedido", 3: "Factura", 4: "Nota de Crédito"}
kind_of_status = {1: "En Proceso", 2: "Terminado"... |
the-stack_106_21782 | import logging
import threading
import av
from ..config import Config
log = logging.getLogger("discodo.natives.AudioFifo")
class AudioFifo(av.AudioFifo):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.AUDIOBUFFERLIMITMS = Config.BUFFERLIMIT * 50 * 960
... |
the-stack_106_21784 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
the-stack_106_21785 | # qubit number=4
# total number=36
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
the-stack_106_21787 | #!/usr/bin/env python3
import os
from os import listdir
import codecs
#path = "../Snippets/"
dirs = sorted(os.listdir("."))
def main():
f= open("readTest.txt","w+")
for file in dirs:
if file.endswith(".html"):
f.write(file)
f.write("\r\n")
f.close()
if __name__== "__main__":
main()
# References
# https... |
the-stack_106_21789 | from decimal import Decimal
class Customer():
"""
A class that represents a customer (python docs follows Numpy/Scipy format)
...
Attributes
----------
name: str
customer name
account: str
customer's account
balance: decimal.Decimal
customer's balance
Met... |
the-stack_106_21791 | from elasticsearch import Elasticsearch
from elasticsearch import helpers
import json
es = Elasticsearch()
INDEX = 'sl-cricket'
TYPE = 'player'
converted = []
with open('D:\/1 E drive\Sem 7\DM & IR\IR\IR project\/final_sinhala.json', encoding='utf-8') as f:
data = json.load(f)
player_objs = []
for player in d... |
the-stack_106_21795 | """
This file resumes a previously ended scene.
"""
def resume_scene(args, scene_root, history_db):
"""resumes a scene"""
import os
from src.praxxis.sqlite import sqlite_scene
from src.praxxis.display import display_scene
from src.praxxis.scene import scene
from src.praxxis.util import error
... |
the-stack_106_21798 | # Copyright 2021 John Reese
# Licensed under the MIT license
"""
Run things on paths
"""
import multiprocessing
context: multiprocessing.context.BaseContext = multiprocessing.get_context("spawn")
__author__ = "John Reese"
from .__version__ import __version__
from .core import (
run,
walk,
walk_and_run,
... |
the-stack_106_21799 | #!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
the-stack_106_21801 | """Sphinx extension for injecting an unreleased changelog into docs."""
import subprocess # noqa: S404
import sys
from contextlib import suppress as suppress_exceptions
from functools import lru_cache
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple, Union
from sphinx.application import ... |
the-stack_106_21804 | import logging
import os
class Config:
class AppEnvType:
DEV = 'dev'
PRODUCTION = 'production'
TEST = 'test'
APP_NAME = '12306-ocr'
APP_ENV = AppEnvType.PRODUCTION
LOADED = False
PROJECT_DIR = os.path.abspath(__file__ + '/../') + '/'
CONFIG_FILE = PROJECT_DIR + 'confi... |
the-stack_106_21805 | # This function is used to aggregate 15 minutes to 1 hour
import re
import pandas as pd
import numpy as np
def col_types(df):
"""Decides column types to store for database
Arguments:
df {pandas dataframe} -- [pandas dataframe]
"""
cols = df.columns.tolist()
floattypes = re.compile(r"... |
the-stack_106_21809 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Openstack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... |
the-stack_106_21810 | #!/usr/bin/env python
"""
MagPy - Basic Runtime tests including durations
"""
from __future__ import print_function
# Define packges to be used (local refers to test environment)
# ------------------------------------------------------------
local = True
if local:
import sys
sys.path.insert(1,'/home/leon/So... |
the-stack_106_21811 | # Copyright (c) 2014 Quobyte Inc.
# Copyright (c) 2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... |
the-stack_106_21819 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_106_21820 | #!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the artifact stages."""
import argparse
import mox
import os
import sys
sys.path.insert(0, os.path.abspath('%s/..... |
the-stack_106_21823 | # -*- coding: utf-8 -*-
__all__ = [
"DiagQSM",
"StrictLowerTriQSM",
"StrictUpperTriQSM",
"LowerTriQSM",
"UpperTriQSM",
"SquareQSM",
"SymmQSM",
]
from abc import ABCMeta, abstractmethod
from functools import wraps
from typing import Any, Callable, Tuple
import jax
import jax.numpy as jnp
i... |
the-stack_106_21824 | import pyblish.api
import pype.api
class ValidateShotDuplicates(pyblish.api.ContextPlugin):
"""Validating no duplicate names are in context."""
label = "Validate Shot Duplicates"
hosts = ["standalonepublisher"]
order = pype.api.ValidateContentsOrder
def process(self, context):
shot_names... |
the-stack_106_21826 | import asyncio
from .base_request import BaseRequest
import inspect
from .item import Item
from ..utils import logger
from .exceptions import EngineError, IgnoreRequest, ItemError, DropItem
__all__ = ['Engine']
class Engine(object):
__slots__ = ['pipelines', 'spiders', 'middlewares', 'sched', 'loop']
def _... |
the-stack_106_21828 | #!flask/bin/python
from flask import render_template, flash, redirect, session, url_for, \
request, g, send_file, abort, jsonify
from flask_login import current_user
from flask_qrcode import QRcode
from app import app, db, lm
from datetime import datetime, timedelta
from config import STREAMLABS_CLIENT_ID, ST... |
the-stack_106_21829 | # -*- coding: utf-8 -*-
from setuptools import setup
import re
from pandoc_img_glob import __version__
REPOSITORY = 'https://github.com/shoeffner/pandoc-img-glob'
README = ''
with open('README.rst', 'r') as f:
README = f.read()
README = re.sub(r' _(.+): ([^(http)].+)', r' _\1: {}/blob/master/\2'
... |
the-stack_106_21830 | # -*- coding: utf-8 -*-
import os
from kikimr.public.sdk.python import client as ydb
from kikimr.public.sdk.python.client.issues import Aborted
from concurrent.futures import TimeoutError
import basic_example_data
from clj_l import loads
import edn_format
import time
StartAppendTransactionsBlock =\
"""
DECL... |
the-stack_106_21831 | import torch
import gemicai as gem
import pickle
import copy
from tabulate import tabulate
import os
from datetime import datetime
class ClassifierTree:
def __init__(self, default_classifier, labels, base_dataset, path, dataset_constraints={}, root=None):
# Retrieving ClassifierTree from a root node
... |
the-stack_106_21832 | import torch
from torch import nn
__all__ = ['iresnet18', 'iresnet34', 'iresnet50', 'iresnet100', 'iresnet200']
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes,
out_planes,
kernel_size=... |
the-stack_106_21833 | #Some imports relevant to this script
from datetime import datetime
import pyswmm
import numpy as np
import matplotlib.pyplot as plt
from pyswmm import Simulation, Nodes, Links, Subcatchments
with Simulation("C:/Users/Jiada/2019 Spring Semester/Documents/PyRTC/Modeling/.INP files/gamma.inp") as sim:
prin... |
the-stack_106_21835 | '''
Created on Sep 16, 2010
kNN: k Nearest Neighbors
Input: inX: vector to compare to existing dataset (1xN)
dataSet: size m data set of known vectors (NxM)
labels: data set labels (1xM vector)
k: number of neighbors to use for comparison (should be an odd number)
Output: ... |
the-stack_106_21836 | from cocciep.db import db
from datetime import datetime
class SchoolYear(db.Model):
__tablename__ = 'schoolyear'
id = db.Column(db.Integer(), primary_key=True)
name = db.Column(db.String(128), nullable=False)
start = db.Column(db.Date(), nullable=False)
end = db.Column(db.Date(), nullable=False)
picture = ... |
the-stack_106_21837 | """
===============
=== Purpose ===
===============
Takes uploaded DELPHI flu contest forecasts, and puts them in the database.
This makes them available through the Epidata API via method `delphi`.
See also:
- upload_forecast.php
- submission_loader.py
=======================
=== Data Dictionary ===
============... |
the-stack_106_21838 | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Wflscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Useful util functions for testing the wallet"""
from collections import namedtuple
from test_framewor... |
the-stack_106_21839 | """The Scheduler Integration."""
import logging
import voluptuous as vol
from datetime import timedelta
from homeassistant.helpers import config_validation as cv
from homeassistant.components.switch import DOMAIN as PLATFORM
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
EVE... |
the-stack_106_21840 | from radical.cm.planner import GAPlanner
import pandas as pd
import sys
from time import time
def df_to_lists(cmp, size):
tmp_workflows = list()
tmp_numoper = list()
for i in range(size):
point = cmp.loc[i]
workflow = {'description': None}
workflow['id'] = int(point['id'])
... |
the-stack_106_21842 | from vpython import *
from time import clock
# Hard-sphere gas.
# Bruce Sherwood
win = 500
Natoms = 200 # change this to have more or fewer atoms
# Typical values
L = 1 # container is a cube L on a side
gray = color.gray(0.7) # color of edges of container
mass = 4E-3/6E23 # helium mass
Ratom = 0.03 # wildly exagg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.