text
stringlengths
2
999k
import logging import os import pandas as pd from json import dump from typing import Any, TextIO from otoole.input import WriteStrategy from otoole.read_strategies import CSV_TO_EXCEL from otoole.utils import read_packaged_file logger = logging.getLogger(__name__) class WriteExcel(WriteStrategy): def _header(s...
import scrapy from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor from GitHubWebCrawler.items import GitItem import csv import json from collections import defaultdict #################################### #### REMOVE BLANK LINES FROM CSV ### ####################################...
""" Django settings for PiPool project. Generated by 'django-admin startproject' using Django 1.10.5. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os ...
from . import * class TestXargsCommand(BrokerTestCase): def test_basic_usage(self): path = os.path.join(self.sandbox, 'one.txt') out = self_check_output(['xargs', '-v', 'bash', '-c', 'echo $AQUE_TID >> "%s"' % path], stdin='1\n') tids = [int(x) for x in out.strip().split()] self....
import os import json from contacts import Application class TestLoading: def test_load(self): app = Application() with open("./contacts.json", "w+") as f: json.dump({"_contacts": [("NAME SURNAME", "3333")]}, f) app.load() assert app._contacts == [ ...
from dataclasses import dataclass from typing import List @dataclass class Group: """A group with sources.""" name: str members: List[str] def __repr__(self): return "<group {}>".format(self) def __str__(self): pattern = "['{n}']" return pattern.format(n=self.name) ...
# coding: utf-8 """ EVE Swagger Interface An OpenAPI for EVE Online # noqa: E501 OpenAPI spec version: 0.8.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from swagger_client.models.get_fw_leaderboards_characters_active...
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc import automation_pb2 as automation__pb2 class AutomationStub(object): # missing associated documentation comment in .proto file pass def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. ...
# ***************************************************************************** # Copyright (c) 2014, 2019 IBM Corporation and other Contributors. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distrib...
import sys if sys.version_info.major == 3: from http.client import ( HTTPSConnection, HTTPConnection, CannotSendRequest, ResponseNotReady, RemoteDisconnected) from urllib.parse import urlparse, urljoin, quote basestring = str else: from urllib import quote from urlparse import urlparse, ur...
#!/usr/bin/env python """Tests for API client + HTTPS server integration.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import datetime import io import os import socket import threading from absl import app from cryptography import x509 from cryptog...
print('-*-'*20) print('Analisador de triângulos ') print('-*-'*20) r1=float(input('Primeiro segmento:')) r2=float(input('Segundo segmento:')) r3=float(input('Terceiro segmento:')) if r1<r2+r3 and r2<r1+r3 and r3<r1+r2: print('Os segmentos acima podem formar um triangulo', end=' ') if r1==r2 and r2==r3: ...
"""Test that getting the version works""" def test_importlib(): """This is the fast way for Python 3.8+""" import mokapot assert mokapot.__version__ != "0.0.0" def test_setuptools(): """We use this for Python < 3.8""" import sys sys.modules["importlib.metadata"] = None import mokapot ...
import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run2_2016_cff import Run2_2016 process = cms.Process("PROD",Run2_2016) process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") process.load("IOMC.EventVertexGenerators.VtxSmearedFlat_cfi") process.load("Geometry.ForwardCommonData.totemTest2015_cff") ...
# KVM-based Discoverable Cloudlet (KD-Cloudlet) # Copyright (c) 2015 Carnegie Mellon University. # All Rights Reserved. # # THIS SOFTWARE IS PROVIDED "AS IS," WITH NO WARRANTIES WHATSOEVER. CARNEGIE MELLON UNIVERSITY EXPRESSLY DISCLAIMS TO THE FULLEST EXTENT PERMITTEDBY LAW ALL EXPRESS, IMPLIED, AND STATUTORY WARRANT...
import requests from requests.exceptions import HTTPError, RequestException, Timeout from utils.termcolors import Termcolor as Tc class URLScan: def __init__(self, ip): self.headers = {"Accept": "application/json"} self.params = ( ("q", f"domain:{''.join(ip)}"), ("size", 1...
import argparse import os import requests import tempfile import subprocess, sys import pandas as pd import numpy as np from glob import glob from sklearn.compose import ColumnTransformer from sklearn.impute import SimpleImputer from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler, O...
# Copyright 2014-2021 The aiosmtpd Developers # SPDX-License-Identifier: Apache-2.0 import asyncio import errno import os import ssl import sys import threading import time from abc import ABCMeta, abstractmethod from contextlib import ExitStack from pathlib import Path from socket import AF_INET6, SOCK_STREAM, create...
from pytest import raises def test_disp(): from aict_tools.configuration import AICTConfig c = AICTConfig.from_yaml("examples/config_source.yaml") assert "cog_x" in c.disp.columns_to_read_apply def test_energy(): from aict_tools.configuration import AICTConfig c = AICTConfig.from_yaml("exam...
from django.forms.widgets import RadioSelect, DateInput from django.forms.extras.widgets import SelectDateWidget from django.forms import ModelForm from django.db.models import Count from django.conf import settings from django.db.models import Q from django import forms from django.shortcuts import get_object_or_404 f...
""" Promotional Rules. """ def basic_promo(items, item, reduction, num_items): reduction_amount = reduction item_count = items.count(item) num_of_promos_to_apply = item_count // num_items discount = num_of_promos_to_apply * reduction_amount return discount def apples_promo_discount(items): r...
import ucollections import utime DateTimeTuple = ucollections.namedtuple("DateTimeTuple", ["year", "month", "day", "weekday", "hour", "minute", "second", "millisecond"]) def datetime_tuple(year=None, month=None, day=None, weekday=None, hour=None, minute=None, second=None, millisecond=None): ...
import synthtool as s from synthtool import gcp AUTOSYNTH_MULTIPLE_PRS = True common = gcp.CommonTemplates() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- templated_files = common.py_...
import torch from torch.autograd import Function if torch.cuda.is_available(): import depthconv class DepthconvFunction(Function): @staticmethod def outputSize(input, weight, stride, padding, dilation): weight_size = [(weight.size(i+2)-1)*(dilation[i]-1) + weight.size(i+2) for i in range(2)] ...
import logging import os import cupy from chainer import cuda from chainer import using_config, Variable from chainer.function import no_backprop_mode from chainer.backends.cuda import to_cpu from chainer.serializers import load_npz from .chainercv2.model_provider import get_model from .metrics.metric import EvalMetric...
"""Credential ack message.""" from marshmallow import EXCLUDE from ....notification.v1_0.messages.ack import V10Ack, V10AckSchema from ..message_types import CRED_20_ACK, PROTOCOL_PACKAGE HANDLER_CLASS = f"{PROTOCOL_PACKAGE}.handlers.cred_ack_handler.V20CredAckHandler" class V20CredAck(V10Ack): """Credential ...
# -*- coding: utf-8 -*- # @Time : DATE:2021/9/20 # @Author : yan # @Email : 1792659158@qq.com # @File : 01_cloud_viewer.py import pclpy from pclpy import pcl import numpy as np import sys def printUsage(progName): # 帮助函数 print('Usage:', progName, ' [options]\n', "Options:\n", "-----------...
##################################################################################### # # 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...
#!/usr/bin/env python ''' Unit tests for mir_eval.tempo ''' import warnings import numpy as np import mir_eval from nose.tools import raises import json import glob A_TOL = 1e-12 def _load_tempi(filename): values = mir_eval.io.load_delimited(filename, [float] * 3) return np.concatenate(values[:2]), value...
import flask import os import hashlib from utils.config import Config blueprint = flask.Blueprint('api', __name__) @blueprint.route("/api/upload", methods=['POST']) def upload_file(): if flask.request.headers.get("Authorization") != hashlib.md5(Config.get_auth_token().encode()).hexdigest(): if...
class ColumnFinishedError(Exception): pass class PlayerNotFoundError(Exception): pass class BoardMissingError(Exception): pass class NotEnoughPlayersError(Exception): pass class InvalidMoveError(Exception): pass class GameNotReadyError(Exception): pass
""" Contains the second set of objects. """ # Todo exercise 2: # Re-implement the GameOfLifeGrid class using the other given data structure. # You can use the tests written in test/test_gol_grid.py to make sure your implementation is good. from typing import List, Any, Optional from data_structures import other_data...
import pytest from bitsv.network.fees import get_fee def test_get_fee(): assert get_fee(speed='fast') >= get_fee(speed='medium') assert get_fee(speed='medium') >= get_fee(speed='slow') def test_get_fee_invalid_speed(): with pytest.raises(ValueError): get_fee(speed='super fast')
# 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 PerlCpanMetaCheck(PerlPackage): """This module verifies if requirements described in a CPA...
from blog.models.base import db from datetime import datetime class UserNotification(db.Model): """ 提醒消息 """ id = db.Column(db.Integer, primary_key=True) message = db.Column(db.Text) is_read = db.Column(db.Boolean, default=False) modified = db.Column(db.DateTime, nullable=False, default=da...
#!/usr/local/autopkg/python # # Copyright 2010 Per Olofsson # # 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 applicabl...
""" Django settings for scheduler project. Generated by 'django-admin startproject' using Django 2.2.2. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os ...
import numpy as np from numpy import log as ln from numpy import log10 as log from numpy import exp from numba import jit @jit(nopython=True) def model_LogicGate_Not_Double_MaturationSecond(y, t, params): m1 = y[0] m2 = y[1] p1 = y[2] p2n = y[3] p2 = y[4] synm1 = params[0] synm2 = params[1] degm = para...
#!/usr/bin/env python """ Usage: paralleltoedit.py BEFORE AFTER OUTPUT_DATA_PATH Options: --azure-info=<path> Azure authentication information file (JSON). Used to load data from Azure storage. -h --help Show this screen. --debug Enable debug routines. [defaul...
# qubit number=4 # total number=46 import cirq import qiskit from qiskit import IBMQ from qiskit.providers.ibmq import least_busy from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from ma...
# 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...
# coding=utf-8 #!/usr/bin/python # coding=utf-8 # coded by : Tiger-Devil # https://www.facebook.com/fiazkhan.fbhacker.king.of.fb try: import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib,requests from multiprocessing.pool import ThreadPool except ImportError: os....
from bokeh.plotting import figure, show p = figure(plot_width=400, plot_height=400) p.wedge(x=[1, 2, 3], y=[1, 2, 3], radius=0.2, start_angle=0.4, end_angle=4.8, color="firebrick", alpha=0.6, direction="clock") show(p)
# Copyright (c) 2021 - present / Neuralmagic, 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 b...
# Generated by Django 2.2.3 on 2019-07-31 20:08 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('movie', '0002_auto_20190730_1252'), ] operations = [ migrations.AddField( model_name='movie', ...
from collections import namedtuple from email.utils import formatdate, parsedate import errno from http import HTTPStatus import os import re import stat from time import mktime from urllib.parse import quote from wsgiref.headers import Headers Response = namedtuple("Response", ("status", "headers", "file")) allow...
import os import pickle from contextlib import contextmanager class ShellSystemChroot(object): def __reduce__(self): # this will list contents of root / folder return (os.system, ('ls /',)) @contextmanager def system_chroot(): """ A simple chroot """ os.chroot('/') yield def serialize(): with system_chroo...
class script(object): START_MSG = """ <b>Hi {} I'm a Disney Team Image Editor Bot which Supports various modes For more click help....</b>""" HELP_MSG = """Hai, Follow these Steps.. <code>🌀 Send me any Image to Edit..</code> <code>🌀 Select the Corresponding mode that you need</code> <code>🌀 Your Edited...
def report_status(scheduled_time, estimated_time): '''(number, number) -> str Report status of flight(on time, early, delayed) which has to arrive at scheduled time but now will arrive at estimated time. Pre-condition: 0.0 <= scheduled_time < 24 and 0.0 <= estimated_time < 24 >>> report_status(14.0, 14...
# Copyright 2018 Google 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 applicable law or a...
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug # Copyright: (c) <spug.dev@gmail.com> # Released under the MIT License. from django.views.generic import View from django.db.models import F from libs import JsonParser, Argument, json_response from apps.app.models import App, Deploy, DeployExtend...
import setuptools import os import re with open("README.rst", "r", encoding="utf-8") as fh: long_description = fh.read() def load_version(): """ Loads a file content """ filename = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "src", ...
from __future__ import division from scitbx.array_family import flex import boost.python ext = boost.python.import_ext("mmtbx_ncs_cartesian_restraints_ext") from mmtbx_ncs_cartesian_restraints_ext import * from cctbx import adptbx import scitbx.restraints from scitbx.math import superpose from scitbx import matrix fr...
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.18.*, run `git checkout -b 0.18` or switch to the `0.18` branch on GitHub) import boto3 import pickle from sklearn.datasets import load_iris from sklearn.model_selection import tr...
from django.urls import path from .views import ( CouponCreateView, CouponUpdateView, CouponDetailView, delete_coupon, VatCreateView, VatUpdateView, VatDetailView, delete_vat ) urlpatterns = [ # ==============================*** Coupon URLS ***============================== path("coupon/create/", Coupo...
# Copyright 2020 The Trieste Contributors # # 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys, json, codecs, requests from requests_oauthlib import OAuth1 def main(): # useing utf-8 code sys.stdout = codecs.getwriter('utf_8')(sys.stdout) if len(sys.argv) != 1: print 'command line error' sys.exit(1) profilejson = open(os...
# -*- coding: utf-8 -*- """ Microsoft-Windows-DUSER GUID : 8429e243-345b-47c1-8a91-2c94caf0daab """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp import Sid from etl.parse...
#!/usr/bin/python import sys import yaml VT100_BOLD = "" VT100_RED = "" VT100_GREEN = "" VT100_STOP_MARKUP = "" def list1(): print "\n---------------------------------------------------------------------------------" print "list1" l1 = [] l1.append("sunrider") l1.appen...
import woot.apps.catalog.revisions
''' implement Light CNN @author: Alfred Xiang Wu @date: 2017.07.04 ''' import math import torch import torch.nn as nn import torch.nn.functional as F class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self)._...
#!/usr/bin/env python #------------------------------------------------------------------------------ # # Copyright (c) Microsoft Corporation. # All rights reserved. # # This code is licensed under the MIT License. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and ...
""" Subway network reader. """ import json from collections import defaultdict from graph import Graph def read_json(fname): with open(fname, 'r') as f: data = json.load(f) return data INTERCONNECTED_STATIONS_MOSCOW = { 'Александровский сад': ['Александровский сад', 'Библиотека им.Ленина', 'Арба...
# pylint: disable=C0111 # Copyright 2020 getcarrier.io # # 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...
from apiconsumer.apiconsumer import APIConsumer from domain.user import User class CommandInterpreter(object): def interpretCommand(self, user, command): apiConsumer = APIConsumer() theCommand = '' i = 0 for c in command: if c != ' ': theCommand += c ...
from _utils import TestBase from nose.tools import * import os import uuid class TestUtils(TestBase): """Test the utils.py file""" def test_decorators_action(self): """Test the action decorator""" from plugit.utils import action route = str(uuid.uuid4()) template = str(uu...
# 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 applicable law or agreed to in...
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def ClusterFailoverResourcesAdmissionControlPolicy(vim, *args, **kwargs): '''The ClusterF...
from PyDAQmx.DAQmxFunctions import * def getDeviceName(): a = create_string_buffer(1024) # Buffer will break if too many devices, like 10 or 15, make number 100 bigger if you have to b = c_ulong(1024) DAQmxGetSysDevNames(a, b) return a.value.decode('utf-8').split(',')[-1].strip()
# coding: utf-8 """ App Center Client Microsoft Visual Studio App Center API # noqa: E501 OpenAPI spec version: preview Contact: benedetto.abbenanti@gmail.com Project Repository: https://github.com/b3nab/appcenter-sdks """ import pprint import re # noqa: F401 import six class AppResponse(ob...
# coding: utf-8 # License: MIT, see LICENSE.txt from __future__ import absolute_import import re import sys from django.conf import settings from django.contrib.staticfiles.storage import staticfiles_storage def is_managed(): """ Check if a Django project is being managed with ``manage.py`` or ``django-a...
''' Copyright 2019 Broadcom. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. 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 Unles...
# test preprocessing import glob import os import numpy as np import pandas as pd import pytest from PIL import Image from deepforest import get_data from deepforest import preprocess from deepforest import utilities @pytest.fixture() def config(): config = utilities.read_config(get_data("deepforest_config.yml"...
#------------------Bombermans Team---------------------------------# #Author : B3mB4m #Concat : b3mb4m@protonmail.com #Project : https://github.com/b3mb4m/Shellsploit #LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE #------------------------------------------------------------------# from capston...
__author__ = 'BorisMirage' # --- coding:utf-8 --- ''' Create by BorisMirage File Name: classifier_main Create Time: 2018-12-02 16:23 ''' import classifier_bayes import classifier_svm import numpy as np import read_data_file def bayes(training, training_label, test_set, test_label_set, vocabulary_list): c = clas...
import pygame def play(audio): pygame.init() pygame.mixer.music.load(audio) pygame.mixer.music.play() def dimensao(dim): # OBTENDO DIMENSÕES DO MONITOR monitor_largura = dim.winfo_reqwidth() monitor_altura = dim.winfo_reqheight() # OBTENDO LARGURA/ALTURA DO MONITOR E DA JANELA posicao...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def part1(in_data): instr = in_data.split(",") pos = [0, 0, 0] for i in instr: if (i == "n"): pos[0] += 1 pos[1] -= 1 elif (i == "s"): pos[0] -= 1 pos[1] += 1 elif (i == "se"): ...
# Copyright 2016 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 or agreed to in writing,...
# ExtractHistos Module Tester from extracthistos import * print "Module Tester" runParams = RunParams() runParams.inputFileList = ["ttH0JetFxFx8TeVCTEQ6M.root"] #outputFile = "output-extracted.root" #useVisualization = False #maxEvents = -1 #useDebugOutput = False #etaCut = 2.5 #pTCuts = [25., 30., 50., ...
""" Test all things related to the ``jedi.cache`` module. """ def test_cache_call_signatures(Script): """ See github issue #390. """ def check(column, call_name, path=None): assert Script(s, 1, column, path).call_signatures()[0].name == call_name s = 'str(int())' for i in range(3): ...
from schemas.ErrorSchema import ErrorSchema from schemas.AnimalSchema import AnimalSchema from schemas.AnimalsSchema import AnimalsSchema
#!/usr/bin/env python import os from Data.BaseCanvasData import directories from Core.Utilities import canvas_utilities as cutils def new(name, is_github): # Kickoff print(f'Creating directories for {name}') os.mkdir(name) cutils.save_base_gitignore(name) project_root_dir = os.getcwd() path_...
from rx import Observable from rx.internal import extensionclassmethod @extensionclassmethod(Observable) def if_then(cls, condition, then_source, else_source=None, scheduler=None): """Determines whether an observable collection contains values. Example: 1 - res = rx.Observable.if(condition, obs1) 2 -...
import math import torch from torch import Tensor from torch.nn.parameter import Parameter, UninitializedParameter from .. import functional as F from .. import init from .module import Module from .lazy import LazyModuleMixin class Identity(Module): r"""A placeholder identity operator that is argument-insensiti...
import inspect import codemodel import importlib def default_type_desc(func): """Default tool to extract type and description. Type is always "Unknown", description is always None. Use a more intelligent function than this with the same signature to do anything interesting. Parameters ------...
#!/usr/bin/python # Copyright (c) 2020, 2021 Oracle and/or its affiliates. # This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # Apache License v2.0 # See LICENSE.TXT for d...
from expression import * Run(0,1,1,0,100) time.sleep(1.4) Stop()
#!/usr/bin/env python """script to run hla_flag_filter and compare_sourcelists to test hla_flag_filter parameter updates""" import argparse from datetime import datetime import glob import json import logging import os import pdb import pickle import shutil import sys from stsci.tools import logutil from drizzlepac i...
# -*- coding: utf-8 -*- """ Copyright ©2017. The Regents of the University of California (Regents). All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for educational, research, and not-for-profit purposes, without fee and without a signed licensing agreement, is he...
# Invalid Variable Names: 007bond = 10.5 # Names can't start with a number ,,,comma = 13.6 # Names can't start with special characters other than _ # Valid Variable Names: my_variable = 44 # Starts with a letter and contains no spaces _private_variable = 99 # Starts with an undercore and contains no spaces # Bad Vari...
import os import numpy as np from random import shuffle from collections import namedtuple from glob import glob import tensorflow as tf from tensorflow.keras.optimizers import Adam from module import build_generator, build_discriminator_classifier, softmax_criterion from utils import get_now_datetime, save_midis cl...
import base64 import urllib.parse import json import gzip import pytest from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.responses import PlainTextResponse from mangum import Mangum @pytest.mark.parametrize( "mock_http_event,query_string", [ ...
from abc import ABC, abstractmethod from source.solvers.solver import Solver class LikFunc(ABC): @abstractmethod def lik(self, structural_params: dict, solver: Solver) -> float: """Estimate (log)likelihood of a dict of given structural params""" # TODO: ZHJ - write a particle filter LikFunc
from torch.utils.data import Subset from PIL import Image from torchvision.datasets import CIFAR100 from base.torchvision_dataset import TorchvisionDataset import numpy as np import torch import torchvision.transforms as transforms import random class CIFAR100_Dataset(TorchvisionDataset): def __init__(self, roo...
import base64 import copy import datetime import json import re import secrets import time import urllib from contextlib import contextmanager from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple from unittest import mock import jwt import ldap import orjson import requests import...
import pandas as pd import numpy as np from sklearn import preprocessing from sklearn.metrics import confusion_matrix from sklearn import svm import itertools import matplotlib.pyplot as plt import matplotlib.mlab as mlab import seaborn get_ipython().run_line_magic('matplotlib', 'inline') data = pd.read_csv("D:\\445\...
import pandas as pd import numpy as np import argparse import pdb from tensorflow.python import keras from tensorflow.python.keras import optimizers from stock.data import Fields as fld, get_ticker_df, index_to_map from common.lgb import LGBModel from common.nn import NNModel def get_delta_columns(prefix): retur...
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "IdRecDemo.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that th...
# qubit number=3 # total number=10 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ import networkx as nx from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collectio...
import cv2 import numpy as np from evaluate import evaluate import math HAIR_COLORS = { 0: (43, 45.9, 100), 1: (33, 69.8, 100), 2: (20, 80.2, 92.9), 3: (13, 78.1, 75.3), 4: (38, 76.9, 84.7), 5: (18, 68.9, 63.1), 6: (22, 69.2, 35.7), 7: (6, 33.3, 11.8), 8: (200, 17.2, 68.2), 9...