text stringlengths 1 927k |
|---|
"""Default tags used by the template system, available to all templates."""
from __future__ import unicode_literals
import re
import sys
import warnings
from collections import namedtuple
from datetime import datetime
from itertools import cycle as itertools_cycle, groupby
from django.conf import settings
from django... |
import numpy as np
import tensorflow as tf
import time
import datetime
import os
import sys
import h5py
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import evidential_deep_learning as edl
from .util import normalize, gallery
class Evidential:
def __init__(self, model, opts, dataset... |
import numpy as np
from collections import Counter
class BaseRegression():
"""
abstract class parent of linear and logistic regression
"""
def __init__(self, learning_rate=0.001, n_iters=1000):
self.lr = learning_rate
self.n_iters = n_iters
self.weights = None
self.bia... |
__version_info__ = {
'major': 0,
'minor': 2,
'micro': 5,
'releaselevel': 'beta',
'serial': 1
}
def get_version(short=False):
assert __version_info__['releaselevel'] in ('alpha', 'beta', 'final')
vers = ["%(major)i.%(minor)i.%(micro)i" % __version_info__]
if __version_info__['releaselev... |
"""Utilities for measuring frame rate, and reading frames in a separate thread.
This code was mostly taken from:
http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
"""
import cv2
import datetime
import time
from threading import Thread
class FPS:
"""Helper class to track numb... |
from game2048.game import Game
from game2048.displays import Display
import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
# import timer
def single_run(size, score_to_win, AgentClass, **kwargs):
game = Game(size, score_to_win)
agent = AgentClass(game, display = Display(), **kwargs)
agent.play(verbose=True)
... |
from __future__ import absolute_import, unicode_literals
from tox import reporter as report
def show_envs(config, all_envs=False, description=False):
env_conf = config.envconfigs # this contains all environments
default = config.envlist # this only the defaults
ignore = {config.isolated_build_env, conf... |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team, The Microsoft Research 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
#
# ... |
# -*- coding: utf-8 -*-
# ███╗ ███╗ █████╗ ███╗ ██╗██╗ ██████╗ ██████╗ ███╗ ███╗██╗ ██████╗
# ████╗ ████║██╔══██╗████╗ ██║██║██╔════╝██╔═══██╗████╗ ████║██║██╔═══██╗
# ██╔████╔██║███████║██╔██╗ ██║██║██║ ██║ ██║██╔████╔██║██║██║ ██║
# ██║╚██╔╝██║██╔══██║██║╚██╗██║██║██║ ██║ ██║██║╚██╔╝██║██║██║ █... |
__author__ = 'Nicolas Adenis-Lamarre' |
#!/usr/bin/env python3
from pycparser import c_parser, c_ast, parse_file
from json import dump
from glob import glob
from re import sub
from string import digits
ast = parse_file("../pokeruby/src/data/trainer_parties.h")
#ast = parse_file("trainer_parties_trimmed.h")
#ast.show()
map_script_paths = glob('../pokeruby/... |
from ruleta.exceptions import NoActionException
from collections import namedtuple
class Rule(namedtuple("Rule", ["if_", "then_"]) ):
__slots__ = []
def __call__(self, input_):
if ( self.if_(input_)):
return self.then_(input_)
else:
raise NoActionException() |
import numpy as np
from collections import defaultdict
class Agent:
def __init__(self, nA=6):
"""
Initialize agent.
Params
======
nA: number of actions available to the agent
"""
self.nA = nA
self.Q = defaultdict(lambda: np.zeros(self.nA))
def ... |
from django.conf import settings
from libs.services import LazyServiceWrapper
from stats.base import BaseStatsBackend
def get_stats_backend():
if settings.STATS_BACKEND == settings.STATS_BACKEND_NOOP:
return 'stats.noop.NoOpStatsBackend'
if settings.STATS_BACKEND == settings.STATS_BACKEND_DATADOG:
... |
from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
class ReturnDict(OrderedDict):
"""
Return object from `serializer.data` for the `Serializer` class.
Includes a backlink to the serializer instance for renderers
... |
__author__ = 'ziyasal'
from unittest import TestCase
import subprocess
import redis
from emitter import Emitter
class TestEmitter(TestCase):
@classmethod
def setUpClass(cls):
cls.redis_server = subprocess.Popen("redis-server", stdout=subprocess.PIPE, shell=True)
def setUp(self):
self.... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mosh(AutotoolsPackage):
"""Remote terminal application that allows roaming, supports inter... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mysqlx.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflec... |
#!/usr/bin/env python
import Tkinter as Tk
root=Tk.Tk()
Tk.Button(root,
text="ABC",
).grid(row=0, column=0)
Tk.Button(root,
text="ABC\nabc",
).grid(row=0, column=1)
Tk.Button(root,
text="ABCABC\nABCABC",
).grid(row=1, column=0)
Tk.Button(root,
text="ABCABC",
).grid(row=1, co... |
import visuals
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import vice
import sys
import warnings
warnings.filterwarnings("ignore")
if __name__ == "__main__":
axes = visuals.subplots(1, 3, figsize = (21, 7))
axes.insert(1, visuals.append_subplot_below(axes[0]))
axes[0]... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-05-18 07:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_auto_20180518_1221'),
]
operations = [
migrations.CreateModel(
... |
#!/usr/bin/python
# Copyright (c) 2013, 2014-2017 Oracle and/or its affiliates. All rights reserved.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = "Andrew Hopkinson (Oracle Cloud Solutions A-Team)"
__copyright__ = "Copyright (... |
from svgelements import *
class CutPlanner:
@staticmethod
def bounding_box(elements):
if isinstance(elements, SVGElement):
elements = [elements]
elif isinstance(elements, list):
try:
elements = [e.object for e in elements if isinstance(e.object, SVGElem... |
# Shortest
a,b=map(int,input().split());c=b-(a+1)//2;print([b*2-1,c*2][c>0]) |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from... |
from collections import deque
from typing import List, Optional
import numpy as np
from flatland.core.grid.grid4_utils import get_new_position
from flatland.core.transition_map import GridTransitionMap
from flatland.envs.agent_utils import EnvAgent
class DistanceMap:
def __init__(self, agents: List[EnvAgent], e... |
# This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import mock
from django.test.utils import override_settings
from allauth.socialaccount.models import SocialAccount
from allauth.socialaccount.providers import registry
from allauth.socialaccount.tests import create_oauth2_tests
from allaut... |
###############################################################
################# https://www.fardanesh.ir ####################
###############################################################
from openpyxl import load_workbook
from openpyxl.styles import Font
wb=load_workbook('lecture06-styles/list1.xlsx')
ws1=wb.... |
from flask import request
from lin.exception import ParameterException
from lin.forms import Form
from wtforms import Form as WTForm, IntegerField
from wtforms.validators import DataRequired, NumberRange, AnyOf
class OneProductOfOrder(WTForm):
product_id = IntegerField(validators=[DataRequired(message='商品ID不能为空')... |
from playwright.sync_api import Page
from pathlib import Path
def install_mouse_helper(page: Page) -> None:
page.add_init_script(path=Path(__file__).parent.joinpath("../js/mouseHelper.js")) |
import ccxt
class crypto(object):
watchlist = {"BTC":"", "ETH":"", "EOS":"", "ADA":"", "IOTA":"", "NULS":"", "NEO":"", "SKY":"", "PAL":""}
def __init__(self):
self.build_market()
def list_exchanges(self):
n = [print(x) for x in ccxt.exchanges]
def build_market(self):
self.binance = ccxt.binance()
self.c... |
# myParams.py
def init():
global myList
global myDict
myList = []
myDict = {} |
"""
Progress bars, health bars, etc
"""
import arcade
from ..core.utils import Rect, Position
from .iabstract import _AbstractInterfaceObject
class Bar(_AbstractInterfaceObject):
"""
Drawable bar
"""
MIDDLE_OUT = 'mi'
RIGHT_TO_LEFT = 'rtl'
def __init__(self,
geometry: Rect... |
# See bazel/README.md for details on how this system works.
EXTENSIONS = {
#
# Access loggers
#
"envoy.access_loggers.file": "//source/extensions/access_loggers/file:config",
"envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/http_grpc:con... |
import numpy as np
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
### --- Gather Dataset --- ###
n = 100
X, y = make_blobs(n_samples = n, centers = 2)
y = y[:, np.newaxis]
### --- Build Model --- ###
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
class LogisticRegression:
def ... |
# qubit number=4
# total number=42
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(3) # number=31
prog... |
"""
WSGI config for fullstackChallenge project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('D... |
from pathlib import Path
HERE = Path(__file__).parent
# K 线表头
EASTMONEY_KLINE_FIELDS = {
'f51': '日期',
'f52': '开盘',
'f53': '收盘',
'f54': '最高',
'f55': '最低',
'f56': '成交量',
'f57': '成交额',
'f58': '振幅',
'f59': '涨跌幅',
'f60': '涨跌额',
'f61': '换手率',
}
# 请求头
EASTMONEY_REQUEST_HEADERS = {
... |
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras import initializers, regularizers, constraints
from tensorflow.keras.layers import Dropout
from spektral.layers import ops
from spektral.layers.convolutional.conv import Conv
from spektral.layers.ops import modes
class GATConv(Co... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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
#
# Unless required by appl... |
import random
import numpy as np
import math, time
from gym import spaces
from draw2d import Viewer, Frame, Line, Polygon, Circle, Text
class TankTargetEnv(object):
FireRange = 0.1
Speed = 0.02
RotSpeed = math.pi*2/50
Width = 0.01
TimeHorizon = 100
GasReward = 0.0
IdleReward = 0.0
... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
def bindata(data, maxbins = 30, reduction = 0.1):
'''
data must be numeric list with a len above 20
This function counts the number of data points in a reduced array
'''
tole = 0.01
N = len(data)
assert N > 20
vmin = min(data)
vmax = max(data)
DV = vmax - vmin
tol = tole*DV
vmax += t... |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... |
# Import
import cv2
import sys
import random
import numpy as np
# Globals
WIDTH = 600 # Display Resolution Width
HEIGHT = 600 # Display Resolution Height
UNIT_BLOCK = 20 # Grid Size
PAUSE_TIME = 250 # Initial Pause Time
MIN_TIME = 125 # Minimum Wait Time
INC_LEVEL = 5 # Increment Level
SNAKE_LENGTH = 1... |
from empire.python.typings import *
from empire.deprecated_stuff.structs2.struct_base import StructBase
from empire.deprecated_stuff.structs2.struct_util import StringifierFormatter
class ReadOnlyStruct(StructBase):
# NOTE: to exclude struct attributes to be used by these functions (and other functions from othe... |
###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... |
# Auto-generated at 2021-09-27T17:01:22.744049+08:00
# from: Justice DsmController Service (2.4.0)
# Copyright (c) 2018 - 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
# pylint: disable=duplicate-code
... |
#
# Copyright 2021 Splunk Inc.
#
# 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 in writing, so... |
from antlr4 import *
from AbstractSyntaxTree import *
from Visitor import *
from TypeInfo import TYPES
import copy
class VisitorCodeGenerator(Visitor):
def __init__(self, symbolTable, outFile="out.p"):
self.symbolTable = symbolTable
self.current = 0
self._lvalue = []
self.backLabel... |
# Copyright 2012 SINA 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/LICENSE-2.0
#
# Unless required by app... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Defaults and overrides for envelope-related settings.
"""
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
DEFAULT_CONTACT_CHOICES = (
('', _("Choose")),
(10, _("A general question regarding the webs... |
# This file, and the fact that the other files here are in the subdirectory UnfoldUtils,
# exist only so that the line 'import UnfoldUtils' will work in other packages.
#
# See http://docs.python.org/2/tutorial/modules.html#packages if you're curious
# how this works.
# load the C++ objects and bind them into the name... |
# -*- coding: utf-8 -*-
"""
pygments.lexers._lasso_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Built-in Lasso types, traits, methods, and members.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
BUILTINS = {
'Types': (
'null'... |
"""day01 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based v... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... |
#!/home/adam/django/Accountant/accenv/bin/python3
"""PILdriver, an image-processing calculator using PIL.
An instance of class PILDriver is essentially a software stack machine
(Polish-notation interpreter) for sequencing PIL image
transformations. The state of the instance is the interpreter stack.
The only method ... |
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemoteExpeditedRegisters(
gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfDarwinEmbedded # <rdar://proble... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def add(self, data):
node = Node(data)
if not self.head:
self.head = node
else:
current = self.hea... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', 'BaxA'])
M... |
import json
from . models import *
def cookieCart(request):
try:
cart = json.loads(request.COOKIES['cart'])
except:
cart={}
print('Cart:',cart)
items=[]
order = {'get_cart_total': 0, 'get_cart_items': 0,'shipping': False}
cartItems = order['get_cart_items']
for i in car... |
from setuptools import setup
import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension
if torch.cuda.is_available():
print('Including CUDA code.')
setup(
name='trilinear',
ext_modules=[
CUDAExtension('trilinear', [
'src/trilinear_... |
# Copyright 2018 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 agreed to in writing, s... |
from flask_testing import LiveServerTestCase
from selenium import webdriver
from urllib.request import urlopen
from flask import url_for
from application import app, db
from application.models import Players, Items
class TestBase(LiveServerTestCase):
def create_app(self):
app.config["SQLALCHEMY_DATABASE_... |
#Jenny Steffens
from Analysis import *
import random, time
def main():
# This list and dictionary are now the default in the Analyzer. They
# do not need to be entered in a driver. However, if the dictionary is updated,
# either do so in Analysis.py or when initializing, set kD= name of new dicitonary
# dic... |
# -*- coding: utf-8 -*-
import random
from fake_useragent import UserAgent
ua = UserAgent()
PROXIES = ['http://116.209.54.2:9999', 'http://61.176.223.7:58822', 'http://183.148.146.206:9999',
'http://110.52.235.38:9999', 'http://110.52.235.44:9999', 'http://116.209.58.167:9999',
]
# Scrapy settin... |
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
# %% Load ... |
# static linked list
class StaticNode:
def __init__(self,value):
self.next = -1
self.value = value
class StaticLinkedList:
def __init__(self,numNodes):
self.head = -2
self.array = [Node(-1)]*numNodes
def push(self,node):
if self.head == -2:
self.head = 0
node.next = 1
else:
curr = head
whi... |
from slm_lab.agent import net
from slm_lab.agent.algorithm import policy_util
from slm_lab.agent.algorithm.sarsa import SARSA
from slm_lab.agent.net import net_util
from slm_lab.lib import logger, util
from slm_lab.lib.decorator import lab_api
import numpy as np
import pydash as ps
import torch
logger = logger.get_log... |
"""Simple Cython package setup."""
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
source_files = [
'lib.py',
'libc.pyx',
'libc.c',
]
extensions = [Extension("lib", source_files)]
setup(
ext_modules=cythonize(extensions),
version='0.0... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import io
import os
import re
setup_path = os.path.abspath(__file__)
setup_path_dir = os.path.dirname(setup_path)
exec(open(os.path.join(setup_path_dir, 'pyarchive', 'version.py')).read())
long_description = "coarse tool to mo... |
"""
Django settings for gameplan2 project.
Generated by 'django-admin startproject' using Django 1.8.18.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
# ----------------------------------------------------------------------------------------------------------------------
# this is the main application menu add/remove items as required
# ---------------------------... |
"""Nuki.io lock platform."""
from abc import ABC, abstractmethod
from datetime import timedelta
import logging
from pynuki import NukiBridge
from requests.exceptions import RequestException
import voluptuous as vol
from homeassistant.components.lock import PLATFORM_SCHEMA, SUPPORT_OPEN, LockEntity
from homeassistant.... |
# Copyright (c) 2013-2016 Molly White
#
# 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,
# di... |
import numpy as np
from bokeh.layouts import gridplot
from bokeh.plotting import figure, show, output_file
from bokeh.sampledata.stocks import AAPL, GOOG, IBM, MSFT
def datetime(x):
return np.array(x, dtype=np.datetime64)
p1 = figure(x_axis_type="datetime", title="Stock Closing Prices")
p1.grid.grid_line_alpha=0... |
from flask import current_app as app, url_for
from CTFd.utils import get_config, get_app_config
from CTFd.utils.config import get_mail_provider, mailserver
from CTFd.utils.email import mailgun, smtp
from CTFd.utils.security.signing import serialize
import re
EMAIL_REGEX = r"(^[^@\s]+@[^@\s]+\.[^@\s]+$)"
def sendmai... |
#1 - Função que retorna uma variável:
"""
Escreva uma função de potenciação
"""
def potência(base, exp):
pot = base**exp
return pot
a = potência(2,3)
print(a) |
import enum
import time
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient
from pymodbus.client.sync import ModbusSerialClient
from pymodbus.payload import BinaryPayloadBuilder
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.register_read_message import ReadInputRegi... |
import numpy as np
from scipy.optimize import minimize, Bounds
from functools import partial
from scipy.stats import gaussian_kde as KDE
from pyapprox.configure_plots import *
import scipy.stats as ss
from pyapprox.utilities import get_all_sample_combinations
def approx_jacobian(func, x, *args, epsilon=np.sqrt(np.finf... |
"""JUNN, the Jülich U-Net Neural Network Segmentation Toolkit - prediction module."""
__project__ = 'JUNN'
__version__ = '1.0.0'
__author__ = 'Christian C. Sachs'
__copyright__ = '2021, Christian C. Sachs, Forschungszentrum Jülich GmbH'
__citation__ = ''
__banner__ = '' |
import copy
import inspect
from importlib import import_module
from djmodels.db import router
from djmodels.db.models.query import QuerySet
class BaseManager:
# To retain order, track each time a Manager instance is created.
creation_counter = 0
# Set to True for the 'objects' managers that are automati... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
import re
USE_TWOPHASE = False
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context... |
from __future__ import unicode_literals
__version__ = "20.4.4" |
"""
Useful for:
* users learning xarray
* building tutorials in the documentation.
"""
import os
import pathlib
import numpy as np
from .backends.api import open_dataset as _open_dataset
from .backends.rasterio_ import open_rasterio as _open_rasterio
from .core.dataarray import DataArray
from .core.dataset import D... |
# emacs: at the end of the file
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
"""
Stub file for a guaranteed safe import of duecredit constructs: if duecredit
is not available.
To use it, place it into your project codebase to be imported, e.g. copy as
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import rasa_core
import pytest
import responses
from rasa_core.agent import Agent
from rasa_core.interpreter import INTENT_MESSAGE_PREFIX
from rasa_core.polic... |
"""
ID lookups from data files
Thanks to Lazze for the item list:
http://dev.dota2.com/showthread.php?t=47115&page=16&p=296787#post296787
"""
import os.path
import json
HEROES_CACHE = {}
ITEMS_CACHE = {}
GAME_MODES = {
"dota_game_mode_0": "-",
"dota_game_mode_1": "All Pick",
"dota_game_mode_2": "Captain... |
from time import sleep
from picamera import PiCamera
camera = PiCamera()
camera.resolution = (1024, 768)
camera.start_preview()
sleep(2)
camera.capture('output.jpg')
exit() |
from VisualVenv.run import main
main() |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
from setuptools import setup
setup(name='dpd_info_client_api',
version='0.4',
description='Client for DPD WSDL API.',
url='https://github.com/haloween/dpd-client-info-service-api-python',
keywords = "dpd, courier, api, service, info , parcel, shipping label, wsdl, api",
classifiers=[
... |
# Mortgagea share of income by population density
import pandas as pd
import numpy as np
import array
file = pd.read_csv('county_rent_mort_inc_units_5yr.csv')
yrs_dict = {}
for year in range(2008, 2017):
print(year)
yr_df = file[file.Year == year].dropna(subset=['Housing_Den'])
yr_df.Total_Owned = yr_df.T... |
"""Utility functions and classes for the STIX2 library."""
import datetime as dt
import enum
import json
import re
import pytz
import six
import stix2
# Sentinel value for properties that should be set to the current time.
# We can't use the standard 'default' approach, since if there are multiple
# timestamps in a... |
import numpy as np
from pyHalo.Rendering.MassFunctions.mass_function_utilities import integrate_power_law_analytic
from pyHalo.Rendering.MassFunctions.mass_function_utilities import WDM_suppression
class GeneralPowerLaw(object):
"""
This class handles computations of a double power law mass function of the fo... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... |
import calendar
import math
import pandas as pd
import time
import twstock
import requests
from datetime import datetime, timedelta
from dateutil import relativedelta
from db.Connection import session
from enum import Enum
from model.StockHistory import StockHistory
from sys import float_info
from talib import abstract... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.