text stringlengths 2 999k |
|---|
#!/usr/bin/env python
# encoding: utf-8
"""Routines for extracting data from the images."""
from __future__ import division, print_function
import cv2 as cv
import numpy as np
from itertools import izip
from skimage.measure import label, regionprops
import conf
import dataio as io
try:
from tools.helpers import ... |
import grovepi
import grove_rgb_lcd
import time
import math
grovepi.set_bus('RPI_1')
print('running on grovepi', grovepi.version())
grove_rgb_lcd.setText('Meteostation')
grove_rgb_lcd.setRGB(255, 128, 0)
pin = 4
color = 0
running = True
while running:
try:
[temp, humidity] = grovepi.dht(pin, color)
... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
#from hxntools.handlers import register
#import filestore
from metadatastore.mds import MDS
from databroker import Broker
from filestore.fs import FileStore
# database #1
_mds_config = {'host': 'xf03id-ca1',
'port': 27017,
'database': 'datastore-new',
'timezone': 'US/Easter... |
"""Error definitions."""
class VictimsDBError(Exception):
"""Generic VictimsDB error."""
class ParseError(VictimsDBError):
"""Error parsing YAML files."""
|
'''
Date: 2021.04.24 23:34
Description: Omit
LastEditors: Rustle Karl
LastEditTime: 2021.04.24 23:34
'''
from .constants import H264_CUVID, H264_NVENC
CUDA_ENABLE = True
DEFAULT_ENCODER = H264_NVENC
DEFAULT_DECODER = H264_CUVID
|
default_app_config = 'waldur_vmware.apps.VMwareConfig'
|
import numpy as np
import pytest
from nengo.exceptions import ValidationError
from nengo.utils.least_squares_solvers import (
SVD,
BlockConjgrad,
Cholesky,
Conjgrad,
ConjgradScipy,
LSMRScipy,
RandomizedSVD,
)
def run_solver(solver, m=30, n=20, d=1, cond=10, sys_rng=np.random, **kwargs):
... |
from aiogram import Dispatcher
from aiogram.types import BotCommand
commands = {
'start': 'Запустить рассылку',
'end': 'Завершить инцидент',
'del': 'Удалить сообщения по последней рассылке',
'edit_recipients': 'Отредактировать список получателей',
'edit_providers': 'Отредактировать список провайдер... |
import numpy as np
import sys
import skimage.io as sio
import os
#from gen_poses import GetPoses,WavePose
import shutil
from objloader import LoadTextureOBJ
import render
import objloader
input_obj = sys.argv[1]
V, F, VT, FT, VN, FN, face_mat, kdmap = objloader.LoadTextureOBJ(input_obj)
# set up camera information
i... |
# Webhooks for teamcity integration
import logging
from typing import Any, Dict, List, Optional
import ujson
from django.db.models import Q
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_private_message, \
check_s... |
import json
import os
import socket
import urllib.request
from urllib.error import HTTPError, URLError
_KAGGLE_DEFAULT_URL_BASE = "https://www.kaggle.com"
_KAGGLE_URL_BASE_ENV_VAR_NAME = "KAGGLE_URL_BASE"
_KAGGLE_USER_SECRETS_TOKEN_ENV_VAR_NAME = "KAGGLE_USER_SECRETS_TOKEN"
_KAGGLE_IAP_TOKEN_ENV_VAR_NAME = "KAGGLE_IAP... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101,W0612
from operator import methodcaller
import nose
import numpy as np
from numpy import nan
import pandas as pd
from pandas.types.common import is_scalar
from pandas import (Index, Series, DataFrame, Panel, isnull,
date_range, period_range, Pane... |
# coding: utf-8
import pprint
import re
import six
class BatchDeleteUsersRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the ... |
# Copyright 2009-2010 10gen, 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,... |
"""Data loading components for neighbor sampling"""
from .dataloader import BlockSampler
from .. import sampling, distributed
from .. import ndarray as nd
from .. import backend as F
from ..base import ETYPE
class NeighborSamplingMixin(object):
"""Mixin object containing common optimizing routines that caches fano... |
import FWCore.ParameterSet.Config as cms
from L1Trigger.L1CaloTrigger.l1tS2PFJetInputPatternWriter_cfi import *
l1tS2PFJetInputPatternWriter = L1TS2PFJetInputPatternWriter.clone()
|
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
from __future__ import division
import numpy as np
import warnings
try:
import matplotlib.pyplot as pl
import matplotlib
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from ._labels import labels
from . import colors
from ..utils import convert_name, approximate_interactions
... |
__author__ = 'tester'
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author:knktc
@contact:me@knktc.com
@create:2018-07-14 17:17
"""
__author__ = 'knktc'
__version__ = '0.1'
def main():
"""
main process
"""
if __name__ == '__main__':
main()
|
import os
import configparser
from .operations import DryOperations, RealOperations
from .log import *
class Context:
SUPER_PATH = os.path.join("build", "modorganizer_super")
class ValidationFailed(Exception):
pass
def __init__(self, opts):
self.ops_ = None
self.options = opts
... |
from .lsun import LSUN, LSUNClass
from .folder import ImageFolder, DatasetFolder
from .coco import CocoCaptions, CocoDetection
from .cifar import CIFAR10, CIFAR100
from .stl10 import STL10
from .mnist import MNIST, EMNIST, FashionMNIST, KMNIST, QMNIST
from .svhn import SVHN
from .phototour import PhotoTour
from .fakeda... |
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
'''Function to load and merge data from 2 input datasets that contain messages and categories.
Args:
messages_filepath: path to dataset that contains messages
categories_f... |
from datetime import date
from rest_framework import mixins, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from django.http import HttpResponse
from django.db.models import Sum
from django.utils.decorators import method_decorator
from auditable.views import Auditabl... |
from sortedcontainers import *
from bisect import *
from collections import *
from functools import *
from heapq import *
import itertools
from string import whitespace, ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits, octdigits, punctuation, printable
from util import *
"""
echo "=== sample ===" ... |
from bc4py import __chain_version__
from bc4py.config import C, BlockChainError
from bc4py_extension import poc_hash, poc_work, scope_index
from bc4py.chain.utils import GompertzCurve
from bc4py.chain.checking.utils import stake_coin_check, is_mature_input
from bc4py.database.tools import get_output_from_input
def ch... |
# Copyright 2013-2019 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 Libtiff(AutotoolsPackage):
"""LibTIFF - Tag Image File Format (TIFF) Library and Utilities... |
#!/usr/bin/env python
# Quick hack to dump billing information for the
# currently set account and resource group
#
# (C) 2018, Henrik Loeser, hloeser@de.ibm.com
import json
from os.path import expanduser
import requests
import datetime
import argparse
# Define parameters that we want to catch and some basic comman... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..registry import LOSSES
from .utils import weight_reduce_loss
from icecream import ic
def cross_entropy(pred, label, weight=None, reduction='mean', avg_factor=None):
# element-wise losses
loss = F.cross_entropy(pred, label, reduction='no... |
import copy
import functools
from fate_arch.session import computing_session as session
from federatedml.util import LOGGER
from federatedml.ensemble.basic_algorithms.decision_tree.tree_core.decision_tree import DecisionTree
from federatedml.ensemble.basic_algorithms.decision_tree.tree_core.node import Node
from federa... |
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is 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/
#
# This f... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI']= 'sqlite:////Users/divyamadhuri/Documents/Python/ppty_mgmnt/SQLAlchemy_work/sqlalchemyDB.db'
db = SQLAlchemy(app)
class Family(db.Model):
id = db.Column('personid', db.Integer, primary_key=... |
"""
MQTT wrapper for hackeriet
Uses MQTT_URL environment variable or default test channel
Start subscribe, with QoS level 0
>>> mqtt.subscribe("hello/world", 0)
Act on messages by setting a on_message callback.
Publish
>>> mqtt("hello/world", "alarm!!!")
"""
import paho.mqtt.client as paho
from urllib.parse import... |
"""
Print basic stats for CLDF dataset <DATASET>, where <DATASET> may be the path to
- a CLDF metadata file
- a CLDF core data file
"""
from clldutils.clilib import Table, add_format
from pycldf.cli_util import add_dataset, get_dataset
def register(parser):
add_dataset(parser)
add_format(parser, default=None... |
import unittest
from rest_api.serializers import GithubSearchRepoSerializer
import json
"""
Here we will test the rest_api/github_search.py
"""
"""
To run the tests
pytest
pytest -rP
pytest -rP --junitxml=test-reports/junit.xml --html=test-reports/pytest_report.html --self-contained-html
"""
class GithubSearchRep... |
# Global variables
app = None
# Config variables
BACKGROUND_COLOR = [1, 1, 1, 1]
|
__author__ = 'fahadadeel'
import jpype
import os.path
from WorkingWithPages import ConcatenatePdfFiles
asposeapispath = os.path.join(os.path.abspath("../../../"), "lib")
print "You need to put your Aspose.Words for Java APIs .jars in this folder:\n"+asposeapispath
jpype.startJVM(jpype.getDefaultJVMPath(), "... |
# Copyright 2019 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 a... |
### IMPORTS ###
from __future__ import annotations
import tkstrap.__imports__ as _
### IMPORTS ###
### DOCUMENTATION ###
"""
"""
### DOCUMENTATION ###
### ARBITRARY CONSTANTS ###
StandardTkOpts = dict
Sta... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
ext_modules=[
Extension("gray_conv_cy",
sources=["gray_conv_cy.pyx"],
include_dirs=[np.get_include()]
)
]
setup(
name = "find_close_cy",
ext_modu... |
def login():
return "https://api.robinhood.com/oauth2/token/"
def logout():
return "https://api.robinhood.com/api-token-logout/"
def investment_profile():
return "https://api.robinhood.com/user/investment_profile/"
def accounts():
return "https://api.robinhood.com/accounts/"
def ach(option):
'''... |
import logging
from tempfile import NamedTemporaryFile
from airflow.hooks import HiveCliHook, S3Hook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class S3ToHiveTransfer(BaseOperator):
"""
Moves data from S3 to Hive. The operator downloads a file from S3,
stores the fil... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
# -*- coding: utf-8 -*-
from datetime import timedelta
from openprocurement.auctions.core.adapters import AuctionConfigurator, AuctionManagerAdapter
from openprocurement.auctions.lease.models import (
propertyLease,
)
from openprocurement.auctions.core.plugins.awarding.v2_1.adapters import (
AwardingV2_1Configu... |
#!/usr/bin/python3
# -*- encoding: utf-8 -*-
from django.http import HttpResponse
from django.shortcuts import render
from web_json import WebJson
from json_conf import JsonConf
from util import Util
from django.conf import settings
import json
from user_logbook import user_log as logger
def index(reque... |
import logging
from reconcile import queries
from reconcile.slack_base import slackapi_from_slack_workspace
from reconcile.utils.unleash import get_feature_toggles
from reconcile.utils.slack_api import SlackApi
from reconcile.utils.secret_reader import SecretReader
from reconcile.utils.state import State
QONTRACT_IN... |
#!/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.
import os
import re
import sys
from setuptools import find_namespace_packages, find_packages, setup
if __name__ == ... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Spotify AB
#
# 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 a... |
#
# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRAN... |
# Copyright DataStax, 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, softwa... |
"""
All encompassing solution to generating the OpenAPI schema
"""
import ast
from ast import Call, ClassDef, FunctionDef, Module
from itertools import chain, groupby
from operator import itemgetter
from cdd import emit, parse
from cdd.ast_utils import get_value
from cdd.parser_utils import infer
from cdd.pure_utils ... |
#!/usr/bin/env python
"""
A progress bar that displays a formatted title above the progress bar and has a
colored label.
"""
from __future__ import unicode_literals
from prompt_toolkit.shortcuts import ProgressBar
from prompt_toolkit.formatted_text import HTML
import time
def main():
title = HTML('Downloading <st... |
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
n = len(A)
count = 0
layers = [0]*n
current_layer = 0
for i in range(n):
b_r = i + A[i]
b_l = i - A[i]
if b_r >= n or b_r < i:
b_r = n-1
if b_l < 0:... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from functools import reduce
import gc
import io
import locale # system locale module, not tornado.locale
import logging
import operator
import textwrap
import sys
import unittest
from tornado.httpclient import AsyncHTTPClient
from tornado.httpserver import HTTPServer
from tornado.netutil import Resolver
from tornado... |
#!/usr/bin/python3
import hashlib
import time
def computeMD5(str):
hasher = hashlib.md5()
hasher.update(str.encode('utf-8'))
return hasher.hexdigest()
def computeSHA512(str):
hasher = hashlib.sha512()
hasher.update(str.encode('utf-8'))
return hasher.hexdigest()
# 백만 개의 MD5 해시 생성 속도를 측정합니다... |
from collections import namedtuple
Genotype = namedtuple('Genotype', 'recurrent concat')
PRIMITIVES = [
'none',
'tanh',
'relu',
'sigmoid',
'identity'
]
STEPS = 8
CONCAT = 8
ENAS = Genotype(
recurrent = [
('tanh', 0),
('tanh', 1),
('relu', 1),
('tanh', 3),
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from scipy.ndimage import map_coordinates
from scipy.ndimage.interpolation import shift
from scipy.optimize import curve_fit, ... |
from dagster import Field, Int, ModeDefinition, execute_pipeline, pipeline, resource, solid
@resource(config=Field(Int, is_required=False))
def a_resource(context):
raise Exception("Bad Resource")
resources = {'BadResource': a_resource}
@solid(required_resource_keys={'BadResource'})
def one(_):
return 1
... |
import cv2
import numpy as np
# sigma = the standard deviation of the Gaussian function used in the Gabor filter.
# theta = the orientation of the normal to the parallel stripes of the Gabor function.
# lambda = the wavelength of the sinusoidal factor in the above equation.
# gamma = the spatial aspect ratio.
# psi = ... |
import _plotly_utils.basevalidators
class YanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="yanchor", parent_name="heatmapgl.colorbar", **kwargs
):
super(YanchorValidator, self).__init__(
plotly_name=plotly_name,
parent... |
#! /usr/bin/env python
# Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2002 McMillan Enterprises, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either v... |
import unittest #
from src.homework.i_dictionaries_sets.dictionary import add_inventory, get_p_distance, get_p_distance_matrix, remove_inventory_widget
class Test_config(unittest.TestCase):
# HW 7
def test_add_inventory(self):
inventory_dictionary = {}
widget_name = 'widget1'
quantity... |
# This file is part of the GBI project.
# Copyright (C) 2013 Omniscale GmbH & Co. KG <http://omniscale.com>
#
# 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/licens... |
"""Read and write varint-delimited proto files. The file format is
intended to be byte-for-byte identical to that produced by Java's
MessageLite.writeDelimitedTo() method.
"""
class ProtoStreamReader:
def __init__(self, stream):
self.stream = stream
def delimited_protos(self, proto_class):
"... |
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
domain_size = 2
Gravity_X = 0.0
Gravity_Y = -9.806
Gravity_Z = 0.0
max_x = 10.0
max_y = 10.0
max_z = 10.0
min_x = -1.0
min_y = -1.0
min_z = -1.0
use_oss = 0
dynamic_tau = 1
nsteps = 10... |
class A(object):
def __init__(self):
self._x = 1
@property
def foo(self):
return self._x
@foo.setter
def foo(self, x):
self._x = x
@foo.deleter
def foo(self):
pass
@property
def boo(self):
return self._x
@boo.setter # name mismatch
def boo1(self, x):
self._x = x
@bo... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.16.14
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
f... |
from sqlalchemy import create_engine,Column, Integer, String
from sqlalchemy.dialects.postgresql import UUID,JSON
from sqlalchemy.orm import mapper
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.url import URL
import uuid
import sqlalchemy.types as types
import settings
DeclarativeBas... |
'''define the config file for cityscapes and resnet50os8'''
import os
from .base_cfg import *
# modify dataset config
DATASET_CFG = DATASET_CFG.copy()
DATASET_CFG.update({
'type': 'cityscapes',
'rootdir': os.path.join(os.getcwd(), 'CityScapes'),
})
DATASET_CFG['train']['aug_opts'] = [
('Resize', {'output_... |
from __future__ import print_function
# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
import numpy as np
import tensorflow as tf
# Network parameters
n_hidden_1 = 128 # 1st layer number of neurons
n_features = 784 # MNIST d... |
from pymatgen import Structure
import pymatgen
from pymatgen.io.vasp.inputs import Incar
from fireworks import FWorker, Workflow, LaunchPad
from fireworks.core.rocket_launcher import launch_rocket
from prlworkflows.prl_fireworks import PRLOptimizeFW
from prlworkflows.input_sets import PRLRelaxSet
from prlworkflows.prl_... |
from urllib.parse import urlencode
from datetime import datetime, timedelta
import colander
from cornice.validators import colander_validator
from pyramid import httpexceptions
from pyramid.security import IAuthorizationPolicy
from zope.interface import implementer
import kinto.core
from kinto.authorization import Ro... |
################################################################################
# Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
#
# 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 th... |
import sklearn.linear_model
from autosklearn.pipeline.components.regression.ridge_regression import \
RidgeRegression
from .test_base import BaseRegressionComponentTest
class RidgeComponentTest(BaseRegressionComponentTest):
__test__ = True
res = dict()
res["default_boston"] = 0.70337988575176991
... |
from pytezos.operation.forge import forge_operation
hard_gas_limit_per_operation = 1040000
hard_storage_limit_per_operation = 60000
minimal_fees = 100
minimal_nanotez_per_byte = 1
minimal_nanotez_per_gas_unit = .1
def calculate_fee(content, consumed_gas, extra_size, reserve=10):
size = len(forge_operation(conten... |
from dearpygui.dearpygui import *
# callback
def Update(sender, data):
uvmin = get_value("uv_min")
uvmax = get_value("uv_max")
uvminx = uvmin[0]
uvminy = uvmin[1]
uvmaxx = uvmax[0]
uvmaxy = uvmax[1]
add_data("TextureCoordinates", [uvminx, uvminy, uvmaxx, uvmaxy])
print(get_data("Textu... |
"""app 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-b... |
from bokeh.models import FreehandDrawTool
from bokeh.plotting import figure, output_file, show
output_file("tools_box_edit.html")
p = figure(x_range=(0, 10), y_range=(0, 10), width=400, height=400,
title='Freehand Draw Tool')
renderer = p.multi_line([[1, 9]], [[5, 5]], line_width=5, alpha=0.4, color='red'... |
# --------------
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
import warnings
warnings.filterwarnings('ignore')
# Path variable
df = pd.read_csv(path)
# First 5 columns
df.head(5)
df.drop('Unnamed: 0',1,inplac... |
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import scipy.linalg as sl
from odelab.scheme import Scheme
from newton import FSolve, Newton
class EulerMaruyama(Scheme):
def step(self,t,u,h):
system = self.system
noise = np.random.normal(size=[len(system.noise(t,u).T)])
def residual... |
# Copyright 2013-2021 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)
import re
import llnl.util.tty as tty
class Intel(IntelPackage):
"""Intel Compilers."""
homepage = "https://sof... |
# -*- coding: utf-8 -*-
"""
Created on 2017/9/19
@author: MG
"""
import win32gui
import re
# def _filter_trade_client(hwnd, hwnd_list, filter_func):
# if filter_func(hwnd):
# hwnd_list.append(hwnd)
def filter_confirm_win_func(hwnd):
# 找到classname = '#32770' 的窗体
re_classname_pattern = '#32770'
... |
import touchio
import board
import adafruit_dotstar
import time
import pulseio
# import alarm # alarm currently works only on the ESP32-S2 chip,
# e.g., AdaFruit's Metro ESP32-S2 and FeatherS2
sleep_time = 5 * 60 # in seconds
addl_time = 60 # in seconds
BLUE = (0, 0, 10)
GREEN = (0, 10, 0)
BRIGHT_GREEN = (0, 255, 0)... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Tours',
'category': 'Hidden',
'description': """
Odoo Web tours.
========================
""",
'version': '0.1',
'depends': ['web'],
'data': [
'security/ir.model.access.csv',
... |
from flask_restful import abort
from workshops_api.models.workshop import WorkshopModel
from workshops_api.models.registration import RegistrationModel
class RegistrationValidator:
""" Server side validation for user registrations """
def __init__(self, user, inputIds):
# Get all neccesary data for ... |
#!/usr/bin/env python3
from keras.callbacks import ModelCheckpoint
from keras.layers import Dense, Embedding, LSTM
from keras.models import Sequential, load_model
from keras.preprocessing.text import Tokenizer, text_to_word_sequence
from keras.utils import to_categorical
import numpy
import os
import re
import sys
wi... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
'''
CLASS for community detection in graphs, both spatial and temporal, functions necessary for the station-fault analysis
'''
class cluster_quality_metric():
def __init__(self):
self._l_reg_methods = ['Absolute','Average','minPoints','None']
se... |
# encoding: utf-8
# module PySide.QtGui
# from C:\Python27\lib\site-packages\PySide\QtGui.pyd
# by generator 1.147
# no doc
# imports
import PySide.QtCore as __PySide_QtCore
import Shiboken as __Shiboken
class QDirModel(__PySide_QtCore.QAbstractItemModel):
# no doc
def columnCount(self, *args, **kwargs): # r... |
# coding=utf-8
import re
import requests
import csv
import pymysql
import lxml.html
DOWNLOAD_URL = 'http://movie.douban.com/top250/'
def download_page(url): # 下载页面
return requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0'}).text
... |
# coding: utf-8
"""
Influx OSS API Service.
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class File(object):
... |
"""
Parameter optimization package for Python
=========================================
Paddy is a Python package developed as an extension of the
Paddy Field Algorithm, a geneteic, plant based, global
optimization algorithm proposed by Premaratne et al. (2009)
Paddy was developed with the intention of being used to
... |
"""
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | |: 1 |
|::.. ... |
# Copyright 2018-2019 QuantumBlack Visual Analytics 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
import numpy as np
from pathlib import Path
import sys
if __name__ == '__main__':
# constraint type
cons = sys.argv[1]
assert cons in ['kl', 'rec']
# epochs
epochs = 200
# absolute path
my_path = Path(__file__).parent.resolve().expanduser()
main_path = my_path.parent.par... |
from setuptools import setup, find_packages
import os
import re
def resolve_requirements(file):
requirements = []
with open(file) as f:
req = f.read().splitlines()
for r in req:
if r.startswith("-r"):
requirements += resolve_requirements(
os.path... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import astropy.units as u
import numpy as np
from numpy.testing import assert_allclose
from ...utils.testing import requires_data, requires_dependency
from ...utils.random import get_random_state
from ...irf import EffectiveAreaTable
from ...spectrum impor... |
def gen_mutants():
import tensorflow as tf
import pandas
import numpy as np
DATAFILE_TRAIN = 'mock_kaggle_edit_train.csv'
DATAFILE_VALIDATE = 'mock_kaggle_edit_... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.