text stringlengths 2 999k |
|---|
"""
WSGI config for whatsnew 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/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... |
import copy
import json
import math
import os
import random
import re
import socket
import string
import time
import traceback
import sys
from functools import cmp_to_key
from http.client import IncompleteRead
from multiprocessing import Process, Manager, Semaphore
from threading import Thread
import crc32
import logg... |
""" Defines helper functions for creating kernel entry points and process
launchers.
"""
# Standard library imports.
import atexit
import json
import os
import socket
from subprocess import Popen, PIPE
import sys
import tempfile
# System library imports
# IPython imports
from IPython.utils.localinterfaces import LOC... |
class Solution:
def dailyTemperatures(self, T: List[int]) -> List[int]:
l = len(T)
res = [0] * l
s = []
for i, v in enumerate(T):
while s and s[-1][0] < v:
tmp_v = s.pop()[1]
res[tmp_v] = i - tmp_v
s.append((v, i))
ret... |
config = {
"interfaces": {
"google.ads.googleads.v4.services.TopicConstantService": {
"retry_codes": {
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
],
"non_idempotent": []
},
"retry_params": {
"default": {
"initial_retry_delay_m... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: second/protos/voxel_generator.proto
import sys
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as ... |
# ext/asyncio/__init__.py
# Copyright (C) 2020-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from .engine import async_engine_from_config
from .engine import AsyncConne... |
import logging
import subprocess
import os.path
import time
from glob import glob
def CallSaWriter( inputFasta ):
saWriterCmd = ['sawriter', inputFasta]
logging.debug("Calling sawriter with command line '%s'", ' '.join(saWriterCmd))
proc = subprocess.Popen(saWriterCmd, stdout=subprocess.PIPE, stderr=su... |
"""pytest-allclose version information.
We use semantic versioning (see http://semver.org/).
and conform to PEP440 (see https://www.python.org/dev/peps/pep-0440/).
'.devN' will be added to the version unless the code base represents
a release version. Release versions are git tagged with the version.
"""
name = "pyte... |
"""Defines the templaters."""
import logging
from bisect import bisect_left
from collections import defaultdict
from typing import Dict, Iterator, List, Tuple, Optional, NamedTuple, Iterable
from cached_property import cached_property
# Instantiate the templater logger
templater_logger = logging.getLogger("sqlfluff.... |
# coding: utf-8
from rnns import gru, lstm, atr, sru, lrn
def get_cell(cell_name, hidden_size, ln=False, scope=None):
"""Convert the cell_name into cell instance."""
cell_name = cell_name.lower()
if cell_name == "gru":
return gru.gru(hidden_size, ln=ln, scope=scope or "gru")
elif cell_name =... |
from collections import namedtuple
import random
import jssp.types
import jssp.utility
Config = namedtuple('Config', [
'num_scouts',
'num_normal_sites',
'num_elite_sites',
'num_normal_bees',
'num_elite_bees',
'taboo'])
class Optimizer(object):
def __init__(self, config, problem):
... |
# In this file you can register your RNN cells and then you will be able to get the cell configuration from the cell you
# will choose in other files
# Importing all the cells that we need
from cells.BasicLSTMCell import BasicLSTMCell
from cells.GRUCell import GRUCell
from cells.MogrifierLSTMCell import MogrifierLSTMC... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Region... |
from __future__ import print_function, absolute_import
from io import BytesIO
import struct
s24 = 's24'
u16 = 'u16'
u8 = 'u8'
u30 = 'u30'
s32 = 's32'
u32 = 'u32'
d64 = 'd64'
class uint(int):
__slots__ = ()
def __init__(self, val):
assert self >= 0
class ABCStream(BytesIO):
def read_formatted(sel... |
"""
Written by DaehwaKim
>> daehwa.github.io
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from load_param import cap, cap2, frame_from, frame_to, rs_offset, opti_offset
plt.ion()
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111, projection='3d') # A... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/1/14 4:44 PM
# @Author : w8ay
# @File : log.py
import logging
import threading
from config import DEBUG as d1
from thirdpart.ansistrm import ColorizingStreamHandler
DEBUG, INFO, WARN, ERROR, SUCCESS = range(1, 6)
logging.addLevelName(DEBUG, '^')
lo... |
#!/usr/bin/env python
# coding: utf-8
import threading
import time
class Job(threading.Thread):
def __init__(self, *args, **kwargs):
super(Job, self).__init__(*args, **kwargs)
self.__flag = threading.Event() # 用于暂停线程的标识
self.__flag.set() # 设置为True
self.__running = threa... |
# -*- encoding: utf-8 -*-
# Copyright 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/LICENSE-2.0... |
from rest_framework import viewsets, mixins, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.decorators import action
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from core.models import Tag, Ingredient, Recipe
from recipe ... |
import sys, pygame
pygame.init()
size = width, height = 800, 600
speed = [2, 2]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
ball = pygame.image.load("intro_ball.gif")
ballrect = ball.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
ballrect = ... |
import pygame
import sys
from .background import slow_bg_obj
from models.icon_button import IconButton
from models.controls import audio_cfg, display_cfg
from utils.assets import Assets
from config import config
from constants import Image, Font, Colors, Text
def settings():
settings_title_font = pygame.font.Fon... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# 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, software
# distributed under th... |
import matplotlib.pyplot as plt
import numpy as np
from keras.models import Sequential
from keras.layers import LSTM, Dense, Activation
from keras.optimizers import Adam
from sklearn.preprocessing import MinMaxScaler
# Set random seed for reproducibility
np.random.seed(1000)
# Download the dataset fro... |
import logging
import warnings
import numpy as np
from pytplot import get_data, store_data, options
# use nanmean from bottleneck if it's installed, otherwise use the numpy one
# bottleneck nanmean is ~2.5x faster
try:
import bottleneck as bn
nanmean = bn.nanmean
except ImportError:
nanmean = np.nanmean
... |
# -*- coding: utf-8 -*-
"""
Test the main module
SPDX-FileCopyrightText: 2016-2021 Uwe Krien <krien@uni-bremen.de>
SPDX-License-Identifier: MIT
"""
__copyright__ = "Uwe Krien <krien@uni-bremen.de>"
__license__ = "MIT"
import os
import shutil
from unittest.mock import MagicMock
import pandas as pd
from reegis impor... |
from pl_bolts.models.detection.retinanet.backbones import create_retinanet_backbone
from pl_bolts.models.detection.retinanet.retinanet_module import RetinaNet
__all__ = ["create_retinanet_backbone", "RetinaNet"]
|
import warnings
import matplotlib
warnings.filterwarnings('ignore', category=matplotlib.MatplotlibDeprecationWarning)
warnings.filterwarnings('ignore', category=UserWarning)
import os
import acopy
import samepy
import tsplib95
import networkx as nx
import matplotlib.pyplot as plt
import copy
from acopy.plugins impor... |
import logging
from multiprocessing.context import Process
from airflow_monitor.shared.error_handler import capture_monitor_exception
from airflow_monitor.shared.runners.base_runner import BaseRunner
logger = logging.getLogger(__name__)
class MultiProcessRunner(BaseRunner):
JOIN_TIMEOUT = 60
def __init__... |
# -*- coding: utf-8 -*-
"""
utils.checks
~~~~~~~~~~~~
Custom, Sphinx-only flake8 plugins.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import sphinx
name_mail_re = r'[\w ]+(<.*?>)?'
copyright_re = re.compile(r'^ ... |
from sys import exit
from . import cmdline
exit(cmdline.main())
|
#!/usr/bin/env python3
# Copyright (c) 2021 CINN 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
import numpy as np
from .ksvm import ksvm_train, kernel
from .checks import _check_size, _check_labels
def one_vs_one_ksvm_inference(X, Xtrain, alpha, b, kfun, kparam):
"""Multiclass kernel SVM prediction of the class labels.
Parameters
----------
X : ndarray, shape (m, n)
input features (on... |
#
# (c) 2018 Extreme Networks Inc.
#
# This file is part of Ansible
#
# Ansible 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 version 3 of the License, or
# (at your option) any later version.
#
# Ans... |
from typing import Dict
from paragen.criteria import AbstractCriterion, create_criterion, register_criterion
@register_criterion
class MultiTaskCriterion(AbstractCriterion):
"""
Criterion is the base class for all the criterion within ParaGen.
"""
def __init__(self, criterions):
super().__in... |
# -*- coding: utf-8 -*-
# Based On:
# https://gist.github.com/chrisbolin/2e90bc492270802d00a6#file-serve-py
# Wrapper around python's SimpleHTTPServer
# If url path does not match a file on disk, redirect
# to index.html so that React can handle the routing.
# Useful for development / testing purposes.
import Simp... |
# coding: utf-8
"""
data.world API
# data.world in a nutshell data.world is a productive, secure platform for modern data teamwork. We bring together your data practitioners, subject matter experts, and other stakeholders by removing costly barriers to data discovery, comprehension, integration, and sharing... |
import flask
def clear_localstack(stack):
"""
Clear given werkzeug LocalStack instance.
:param ctx: local stack instance
:type ctx: werkzeug.local.LocalStack
"""
while stack.pop():
pass
def clear_flask_context():
"""
Clear flask current_app and request globals.
When usi... |
#!/usr/bin/env python
import os, time, collections, copy, json, multiprocessing
from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import *
from PhysicsTools.NanoAODTools.postprocessing.framework.crabhelper import inputFiles,runsAndLumis
from PhysicsTools.NanoAODTools.postprocessing.modules.common.p... |
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets
from labelme import QT5
from labelme.shape import Shape
import labelme.utils
# TODO(unknown):
# - [maybe] Find optimal epsilon value.
CURSOR_DEFAULT = QtCore.Qt.ArrowCursor
CURSOR_POINT = QtCore.Qt.PointingHandCursor
CURSOR_DRAW = QtCore.Qt.... |
import pdb
import mnist_loader
from network import load
from plotter import plot_mnist_digit
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
#for data in training_data:
# plot_mnist_digit(data[0])
# #pdb.set_trace()
training_data_2 = [data for data in training_data if data[1][4] == 1]
pdb.... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
import os
import math
import numpy as np
import matplotlib as matplot
import matplotlib.pyplot as plt
from netCDF4 import Dataset
import csv
from wrf import (to_np, getvar, smooth2d, get_cartopy, cartopy_xlim,
cartopy_ylim, latlon_coords)
# List the colors that will be used for tracing the track.
co... |
import os
import subprocess
class BaseDatabaseClient:
"""Encapsulate backend-specific methods for opening a client shell."""
# This should be a string representing the name of the executable
# (e.g., "psql"). Subclasses must override this.
executable_name = None
def __init__(self, connection):
... |
import random
import shutil
import os
import re
import signal
from pathlib import Path
from antlr4 import *
from src.modules.Solver import Solver, SolverQueryResult, SolverResult
from src.modules.Statistic import Statistic
from config.config import crash_list, duplicate_list, ignore_list
from src.utils import rando... |
"""
This is a very first draft idea of a module system.
The general idea is to NOT use Djangos ``django.setup()`` which inherently uses the ENV Variable to find the path
to a settings.py and loads it.
Instead we use the ``settings.configure()`` method INSTEAD of ``django.setup()`` where you can pass in arbitrary sett... |
class PongConfig:
def __init__(self):
self.graphics = PongGraphicsConfig()
self.fps_interval = 0.5
self.debug = DebugOnConfig()
self.win_screen_duration = 2
self.win_screen_times = (0.8, 1.6)
self.final_screen_duration = 2
self.final_screen_times = (1, 6)
... |
# -*- coding: utf-8 -*-
"""
This module provides the utilities used by the requester.
"""
def make_host(headers, dst_ip):
if "Host" in headers:
return headers["Host"]
elif "host" in headers:
return headers["host"]
else:
return dst_ip
def make_request_url(host, port, uri):
if... |
from pygments import token
from pygments.lexer import RegexLexer, words
KEYWORDS = [
"func",
"struct",
"namespace",
"end",
"call",
"ret",
"jmp",
"if",
"let",
"const",
"import",
"from",
"as",
"abs",
"rel",
"static_assert",
"local",
"tempvar",
"... |
"""
DQNAgent based on work by RLCode team - Copyright (c) 2017 RLCode (MIT Licence)
https://github.com/rlcode/reinforcement-learning
Tailored to the TUSP by Evertjan Peer
KBH example
30000_instances: we generated 30000 instances of a specific size for the Binckhorst.
Changes to V2:
- training on instances of ... |
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module is currently Py2.3 ... |
"""
Rings
"""
# ****************************************************************************
# Copyright (C) 2005 William Stein <wstein@gmail.com>
#
# 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 Fou... |
# 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 use ... |
# Copyright 2013-2022 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 PyPydispatcher(PythonPackage):
"""Multi-producer-multi-consumer signal dispatching mechani... |
import os
import logging
import contextlib
from kikimr.public.sdk.python import client as ydb
def make_driver_config(endpoint, database, path):
return ydb.DriverConfig(
endpoint, database, credentials=ydb.construct_credentials_from_environ(),
root_certificates=ydb.load_ydb_root_certificate(),
... |
# -*- coding: utf-8 -*-
"""This file contains the interface for analysis plugins."""
import abc
import calendar
import collections
import time
from plaso.analysis import definitions as analysis_definitions
from plaso.analysis import logger
from plaso.containers import events
from plaso.containers import reports
from ... |
# sqlalchemy/pool/events.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from .base import Pool
from .. import event
from ..engine.base import Engi... |
from mdsxray import open_mdsdataset
from gridops import MITgcmDataset
from regridding import regrid_vertical
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import hypothesis.strategies as st
import numpy as np
import numpy.testing as npt
import unittest
from hypothesis import given
import caffe2.python.hypothesis_test_util ... |
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
"""datapanel_ctrl.py - controller for the DataPanel element
Chris R. Coughlin (TRI/Austin, Inc.)
"""
__author__ = 'Chris R. Coughlin'
from models.datapanel_model import DataPanelModel
from controllers import pathfinder
import os.path
class DataPanelController(object):
"""Controller for the DataPanel"""
def... |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listsincelast RPC."""
from test_framework.test_framework import DigidinarTestFramework
from test_f... |
# Copyright (c) 2015-2018 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... |
import datetime
import importlib
import urllib.parse
from . import git_vcs
from ..error_state import HasErrorState
from ..reporter import ReportObserver, Reporter
from ...lib import utils
from ...lib.gravity import Dependency
__all__ = [
"GithubToken",
"GithubMainVcs"
]
github = None
def get_time():
re... |
from .ideal_user import IdealUser
from .logit_user import LogitUser
from .null_user import NullUser
from .ransam_multiple_prior_user import RanSamMultiplePriorUser
from .ransam_prior_user import RanSamPriorUser
from .ransam_smooth_user import RanSamSmoothUser
from .ransam_universal_user import RanSamUniversalUser
from ... |
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import tempfile
from tensorflow.python.ipu.config import IPUConfig
import numpy as np
from functools import partial
import tensorflow.compat.v1 as tf
from tensorflow.python import ipu
from ipu_sparse_ops import sparse, optimizers
import os
import logging
os.sys.... |
import os
import random
import anndata
import numpy as np
import pandas as pd
import pytest
import scipy.sparse as sparse
from scipy.sparse.csr import csr_matrix
import scvi
from scvi import _CONSTANTS
from scvi.data import (
register_tensor_from_anndata,
setup_anndata,
synthetic_iid,
transfer_anndata... |
# -*- coding: utf-8 -*-
# FLEDGE_BEGIN
# See: http://fledge.readthedocs.io/
# FLEDGE_END
from functools import lru_cache
from aiohttp import web
from fledge.common.service_record import ServiceRecord
from fledge.common.storage_client.payload_builder import PayloadBuilder
from fledge.services.core.service_registry.s... |
{
# Journey Page - map tab
"uidJourneyTabMapPanel": {
W3Const.w3PropType: W3Const.w3TypePanel,
W3Const.w3PropSubUI: [
"uidMapOperationPanel",
"uidMapPanel"
]
},
# Operation
"uidMapOperationPanel": {
W3Const.w3PropType: W3Const.w3Type... |
import json
import aiohttp
import discord
from aiocache.decorators import cached
from utils.context import BlooContext, PromptData
from utils.permissions.permissions import permissions
from utils.views.menu import Menu
class TweakMenu(Menu):
def __init__(self, *args, **kwargs):
super().__init__(*args, *... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Talos information
# Based on Vulners
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2017 Pieter-Jan Moreels - pieterjan.moreels@gmail.com
# Sources
SOURCE_NAME = 'talos'
SOURCE_FILE = "https://vulners.com/api/v3/archive/co... |
from pipe import select, where
import numpy as np
import functools as ft
with open("input4.txt") as f:
lines = f.read()
move = list(map(int,lines.split('\n\n')[0].split(",")))
board = lines.split('\n\n')[1:]
def string_to_matrix(m):
if m[-1]=="\n":
m=m[0:-1]
m=np.asmatrix(m.replace("\n",";"))
return... |
# Copyright 2018 The TensorFlow 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import numpy as np
from scipy.stats import norm
from sklearn.model_selection import train_test_split
from keras.callbacks import EarlyStopping
import warnings
import keras.backend as K
from keras.initializers import glorot_uniform
import tensorflow as tf
from sklearn.model_selection import KFold
from scipy.stats import... |
import jax
import jax_dataclasses
import numpy as onp
from jax import numpy as jnp
from overrides import overrides
from . import _base, hints
from .utils import get_epsilon, register_lie_group
@register_lie_group(
matrix_dim=3,
parameters_dim=4,
tangent_dim=3,
space_dim=3,
)
@jax_dataclasses.pytree_d... |
import datetime
from applications.models import db, ma
from marshmallow import fields
class Power(db.Model):
__tablename__ = 'admin_power'
id = db.Column(db.Integer, primary_key=True, comment='权限编号')
name = db.Column(db.String(255), comment='权限名称')
type = db.Column(db.String(1), comment='权限类型')
co... |
# pylint: disable=R0903
"""
False positive case of E1101:
The error is triggered when the attribute set in the base class is
modified with augmented assignment in a derived class.
http://www.logilab.org/ticket/9588
"""
__revision__ = 0
class BaseClass(object):
"The base class"
def __init__(self):
"Se... |
import dash_bootstrap_components as dbc
def Navbar():
navbar = dbc.NavbarSimple(
children=[
dbc.DropdownMenu(
nav=True,
in_navbar=True,
label="Models",
children=[
dbc.DropdownMenuItem("RF"... |
import unittest
from mock import patch
from tornwamp.messages import Code, ErrorMessage, PublishMessage, SubscribeMessage
from tornwamp.processors.pubsub import PublishProcessor, SubscribeProcessor, customize
from tornwamp.session import ClientConnection
class SubscribeProcessorTestCase(unittest.TestCase):
def ... |
#!/usr/bin/python
# This is statement is required by the build system to query build info
if __name__ == '__build__':
raise Exception
'''
lines.c from the Redbook examples.
Converted to Python by Jason L. Petrone 6/00
/*
* lines.c
* This program demonstrates geometric primitives and
* their attributes.
*/
... |
import binascii
from tokenservices.jsonrpc.handlers import JsonRPCBase, map_jsonrpc_arguments
from tokenservices.jsonrpc.errors import JsonRPCInvalidParamsError, JsonRPCInternalError, JsonRPCError
from tokenservices.database import DatabaseMixin
from tokenservices.ethereum.mixin import EthereumMixin
from tokenservices.... |
import warnings
from sklearn.model_selection import train_test_split
from Logging.logging import Logger
from Training_Clustering.clustering import Cluster
from Training_Preprocessing.preprocessor import Preprocessor
from Training_data_ingestion.data_loading_train import DataGetter
from model_methods.model_methods imp... |
import os
from PIL import Image
import base45
import zlib
import cbor2
import flynn
from pyzbar.pyzbar import decode
from datetime import date, datetime, time, timedelta, timezone
from cose.messages import CoseMessage
from cryptography import x509
from cose.keys import EC2Key
import cose.headers
import requests
from we... |
import os
WORKFLOW_MODE = True
if "domoticz_cmdlinemode" in os.environ:
WORKFLOW_MODE = False
BASE_WORKFLOW_FOLDER = os.path.dirname(__file__)
BASE_API_URL = "http://{serverPort}/json.htm".format(serverPort=os.environ['domoticz_address'])
BASE_WEB_URL = "http://{serverPort}/".format(serverPort=os.environ['domoticz... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
import os,sys
sourcePath = os.path.join("..","..","..","src","build","bin")
sys.path.append(sourcePath)
import numpy as np
import tqdm
## TEST PARAMETERS: ***************************************************
Ntest = 10000
a = 1000
b = 500
data = {'R0': np.zeros((Ntest,3)), 'V0': np.zeros((Ntest,3))}
## RUN TEST: ****... |
import functools
import os
import subprocess
import time
from typing import NamedTuple
import uuid
import anyio
from async_exit_stack import AsyncExitStack
from async_generator import asynccontextmanager
from p2pclient.libp2p_stubs.peer.id import ID
from multiaddr import Multiaddr, protocols
import multihash
import py... |
import time
import json
import copy
import logging
import functools
from typing import List, Tuple, Optional, Union, cast
from cephlib.wally_storage import WallyDB
from cephlib.node import NodeInfo, IRPCNode, get_hw_info, get_sw_info, get_hostname
from cephlib.ssh import parse_ssh_uri
from cephlib.node_impl import set... |
"""Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a c... |
# 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 may ... |
#!/usr/bin/env python
# Copyright 2016 IBM 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 appl... |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import re
import fnmatch
import sys
import subprocess
import datetime
import os
########################... |
import numpy as np
import cupy as cp
import cv2, time
import matplotlib.pyplot as plt
import scipy.stats as st
class Kuramoto:
def __init__(self, size, mean, std, coupling):
"""
mean: float
The mean frequency of oscillators in hertz
"""
self.internal_freq = cp.random.norma... |
# This example shows how to train an PPO agent on atari domain
# For complete experiments, please refer to
# experiments/ppo/run.py
# --- built in ---
import os
import time
import argparse
import functools
# --- 3rd party ---
import gym
# --- my module ---
import unstable_baselines as ub
from unstable_baselines.al... |
import argparse
import os
import tensorflow.keras as keras
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from tensorflow.keras.utils import multi_gpu_model
from config import patience, batch_size, epochs, num_train_samples, num_valid_samples
from data... |
import os
import shutil
import unittest
import docker
from .. import helpers
from docker.utils import kwargs_from_env
TEST_IMG = 'alpine:3.10'
TEST_API_VERSION = os.environ.get('DOCKER_TEST_API_VERSION')
class BaseIntegrationTest(unittest.TestCase):
"""
A base class for integration test cases. It cleans up ... |
name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
hist=dict()
for line in handle:
if line.startswith('From:'):
words=line.split()
if words[1] not in hist:
hist[words[1]]=1
else:
hist[words[1]]=hist[words[1]]+1
#print(hist)
n... |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
import torch.nn.functional as F
import math
from submodule import *
class hourglass(nn.Module):
def __init__(self, inplanes):
super(hourglass, self).__init__()
self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.