text
stringlengths
2
999k
from nose.tools import assert_equal, assert_raises_regexp from grama.grama import Instruction, Address, Parser class Test(object): @staticmethod def assert_instruction(expected_action, expected_addr1, expected_addr2, expected_addr3, expected_ofs, actual): assert_equal(expected_action, actual.action) ...
# -*- coding: utf-8 -*- """IdentityServicesEngineAPI mdm API fixtures and tests. Copyright (c) 2021 Cisco and/or its affiliates. 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 restrictio...
# claude_top_level_library import claude_low_level_library as low_level import numpy as np # laplacian of scalar field a def laplacian(a): output = np.zeros_like(a) if output.ndim == 2: for i in np.arange(1,nlat-1): for j in range(nlon): output[i,j] = (scalar_gradient_x_2D(a,i,(j+1)%nlon) - scalar_gradient...
import itertools from sympy import (Add, Pow, Symbol, exp, sqrt, symbols, sympify, cse, Matrix, S, cos, sin, Eq, Function, Tuple, CRootOf, IndexedBase, Idx, Piecewise, O, Mul) from sympy.simplify.cse_opts import sub_pre, sub_post from sympy.functions.special.hyper import meijerg f...
""" 338. 比特位计数 https://leetcode-cn.com/problems/counting-bits/ """ global res res = [] def countBits(num): global res n = len(res) if num < n: return res[:num+1] for v in range(n, num + 1): res.append(bin(v).count("1")) return res print(countBits(2)) print(countBits(5)) # 数的二进制有多...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isValidBST(self, root: Optional[TreeNode]) -> bool: ary = [] self.traverse(root, ary) ...
# coding: utf8 from __future__ import absolute_import import datetime import json import sys import traceback from bitcron.utils import get_now_str, to_str from bitcron.utils.path import join from .core.sync_utils import after_synced, make_sure_sync_log_path, after_sync_deleted from .core.detect import loop_local_files...
# Copyright 2016 by MPI-SWS and Data-Ken Research. # Licensed under the Apache 2.0 License. """Verify that we can set up timeout events """ import asyncio import unittest from thingflow.base import Scheduler, FunctionFilter import thingflow.filters.timeout import thingflow.filters.output from utils import make_test_out...
#!/usr/bin/env python # --------------------------------------*-python-*------------------------------------------------ # # file src/compton_tools/python/ultra_reader.py # author Andrew Till <till@lanl.gov> # date 14 May 2020 # brief This script has functions that parse an ULTRA file with Compton # data an...
import setuptools setuptools.setup(name="ulcarchetype", version=0.2, author="Miguel F. Astudillo", author_email="migferast@gmail.com", url="https://github.com/mfastudillo/ulcarchetype", packages=setuptools.find_packages(), license="LICENSE.txt", description="package t...
import mock import mayan from mayan.apps.testing.tests.base import BaseTestCase from ..utils import PyPIClient class PyPIClientTestCase(BaseTestCase): def test_method_get_server_proxy(self): PyPIClient().get_server_proxy() @mock.patch('mayan.apps.dependencies.utils.PyPIClient.get_versions', autosp...
# 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...
from __future__ import division, print_function def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('fft', parent_package, top_path) config.add_data_dir('tests') # Configure fftpack_lite config.add_extension('fftpack_lite...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** 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 from ... import _utilities, _tables __a...
# standard library import re # third party import mysql.connector # first party from .norostat_utils import * from delphi.utils.epidate import EpiDate import delphi.operations.secrets as secrets # Column names: # `release_date` :: release date as stated in the web page in the dateModified # span, displayed on th...
#!/usr/bin/python # LogicMonitor Ansible module for managing Collectors, Hosts and Hostgroups # Copyright (C) 2015 LogicMonitor # # 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 version...
"""open new maya instance and do stuff with it""" import sys, os, subprocess from pathlib import Path def createMayaProcess(exePath): """ command args for maya """ flags = subprocess.CREATE_NEW_CONSOLE DETACHED_PROCESS = 0x00000008 CREATE_NEW_PROCESS_GROUP = 0x00000200 flags = DETACHED_PROCESS | CREATE_NEW_PRO...
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # Copyright 2015 and onwards 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/license...
#!/usr/bin/python3 from webbot import Browser web = Browser() web.go_to('https://unidemo.webex.com/meet/jespinozaee') #web.go_to('https://unidemo.webex.com/webappng/sites/unidemo/dashboard/pmr/huaman1942?siteurl=unidemo') web.click("Entrar a la reunión") #web.go_to('https://unidemo.webex.com/webappng/sites/unidemo/meet...
""" Check to see if a single small molecule set of charges is convereged after a round of IPolQ charge derivation. This only works for a single restype in the library and resp output files. Parameters ---------- library : str sys.argv[1], the library file (OFF format) containing previous charges. resp_out : str ...
from luna.utils.enumFn import Enum class OppositeSide(Enum): l = "r" # noqa: E741 r = "l" class CharacterMembers(Enum): node = "character_grp" control_rig = "control_rig" geometry = "geometry_grp" deformation_rig = "deformation_rig" locators = "locators_grp" world_space = "c_world_s...
import pyrealsense2 as rs import numpy as np class DepthCamera: def __init__(self): # Configure depth and color streams self.pipeline = rs.pipeline() config = rs.config() # Get device product line for setting a supporting resolution pipeline_wrapper = rs.pipeline_wrapper(se...
from typing import Tuple, Optional, List from item import Item from storage_system_interface import StorageSystemInterface from my_exceptions import NoItemException, FullStorageException class Cupboard(StorageSystemInterface): def __init__(self, max_storage_item: int): self.__max_storage_item: int = max...
import os import json Province = { "01": "AL", "02": "AK", "04": "AZ", "05": "AR", "06": "CA", "08": "CO", "09": "CT", "10": "DE", "11": "DC", "12": "FL", "13": "GA", "15": "HI", "16": "ID", "17": "IL", "18": "IN", "19": "IA", "20": "KS", "21": "K...
# -*- coding: utf-8 -*- """ github3.auths ============= This module contains the Authorization object. """ from __future__ import unicode_literals from .decorators import requires_basic_auth from .models import GitHubCore class Authorization(GitHubCore): """The :class:`Authorization <Authorization>` object. ...
# Generated by Django 2.0 on 2018-01-28 17:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('raiseapp', '0002_reward_timeframe'), ] operations = [ migrations.AlterModelOptions( name='reward', options={'ordering'...
import pytest from six.moves import range from .utils import normalize_job_for_tests def _add_test_items(job, size=3): for i in range(size): job.items.write({'id': i, 'data': 'data' + str(i)}) job.items.flush() job.items.close() def test_items_iter(spider, json_and_msgpack): job = spider.jo...
# 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 ...
# -*- coding: utf-8 -*- # # Copyright (c) 2012 Björn Edström <be@bjrn.se> # See LICENSE for details. import re def unfix(num, fixes): """Converts string num with a size postfix, given in dict fixes, to an integer. unfix('4k', {'k': 1024, 'm': 1024**2}) == 4096 """ try: fix = None ...
def insertShiftArray(array, value): temp2 = 0 middle = len(array) // 2 temp = array[middle] array += [array[-1]] for i in range(middle, (len(array) - 1)): temp2 = array[i + 1] array[i + 1] = temp temp = temp2 array[middle] = value return array
from __future__ import annotations #for python3.8 or less from hashlib import sha256 from base64 import b64encode from collections.abc import Generator from structures import OBS, Scene, Source, Filter class Request: """Structure that represents a request to be sent to OBS.""" def __init__(self...
from __future__ import absolute_import, division, print_function, unicode_literals import remote.django_url_printer from remote.url_printer_base import getResultURLHandles class PrintResultURL(object): def __init__(self, args): self.args = args self.result_url_handles = getResultURLHandles() ...
from copy import copy from jsonschema import Draft7Validator from karapace.compatibility.jsonschema.types import BooleanSchema, Instance, Keyword, Subschema from typing import Any, List, Optional, Tuple, Type, TypeVar, Union import re T = TypeVar("T") JSONSCHEMA_TYPES = Union[Instance, Subschema, Keyword, Type[Boolea...
""" Parameters for lane finding with the project_video.mp4 """ ### LINE SMOOTHING ### # Number of previous lane lines used for # finding weighted average of lane lines WGTD_MVNG_AVG_LEN = 5 ### CAMERA CALIBRATION ### # Number of chessboard corners in x and y NX = 9 NY = 6 ### PIXEL TO METER CONVERSION ### # Convers...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Video models.""" import torch import torch.nn as nn import slowfast.utils.weight_init_helper as init_helper from . import head_helper, resnet_helper, stem_helper from .build import MODEL_REGISTRY # Number of blocks fo...
#!/usr/bin/env python # encoding: utf-8 from string import Template __template = Template(''' [ { "append_env_var": { "env_var" : "CXXFLAGS", "value_list": [ "-m32" ] } } ] ''') def configure(confCtx): return __template.substitute()
from __future__ import division from builtins import zip from past.utils import old_div import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import MaxNLocator import threeML.plugins.SpectrumLike import threeML.plugins.PhotometryLike from threeML.io.plotting.cmap_cycle import cmap_intervals from t...
# Download the Python helper library from twilio.com/docs/python/install import os from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account # To set up environmental variables, see http://twil.io/secure account_sid = os.environ['TWILIO_ACCOUNT_SID'] auth_token = os.environ['TWILIO_...
""" Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is 16 (= 8 + 7 + 1). −2 5 3 2 9 −6 5 1 3 2 7 3 −1 8 −4 8 Now, let us repeat the search, but on a much larger scale: First, generate four million p...
import datetime from backend import db, Base class User(Base): __tablename__ = 'user' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(250), unique=True) email = db.Column(db.String(250)) created_at = db.Column(db.DateTime, default=datetime.datetime.now()) updated_at = db...
#!/usr/bin/env python import fasta import argparse parser = argparse.ArgumentParser(description='converts fasta to bed by applying a criterion') parser.add_argument('-i', required= True, help='input') parser.add_argument('-o', required= True, help='output') parser.add_argument('-c', required= True, help='criterion (s...
""" Random walker segmentation algorithm from *Random walks for image segmentation*, Leo Grady, IEEE Trans Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83. Installing pyamg and using the 'cg_mg' mode of random_walker improves significantly the performance. """ import numpy as np from scipy import sparse, ndimage a...
# 请完成一个函数,输入一个二叉树,该函数输出它的镜像。 # # 例如输入: # #      4 #    /   \ #   2     7 #  / \   / \ # 1   3 6   9 # 镜像输出: # #      4 #    /   \ #   7     2 #  / \   / \ # 9   6 3   1 # #   # # 示例 1: # # 输入:root = [4,2,7,1,3,6,9] # 输出:[4,7,2,9,6,3,1] #   # # 限制: # # 0 <= 节点个数 <= 1000 # # 来源:力扣(LeetCode) # 链接:https://leetcode-cn.com/p...
def add(a,b): return a+b l = [(1,2),(2,3),(4,5)] m = [] for i in l: m.append(add(*i)) print(m)
from functools import update_wrapper from django.http import HttpResponseRedirect, Http404 from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.encoding import escape_uri_path, iri_to_uri from django.utils.translation import gettext_lazy as _ from django.template.loader impo...
def gauss(x, sig): """ Samples the value at a single point from the Gaussian Curve, parameterized using the sig value as its sigma. x - Relative positioning along the curve, which is centered at x = 0. sig - Sigma parameter. """ from math import pi as PI; from math import exp; return exp(-(x ** 2 / 2 * si...
#!/usr/bin/env python # -*- coding: utf-8 -*- __version__ = "0.0.5" __short_description__ = "Use IDLE autocomplete feature to manage large amount of constants." __license__ = "MIT" __author__ = "Sanhe Hu" try: from .tpl.class_def import gencode except: pass try: from .const import Constant except: pa...
import lusid import lusid.models as models from lusid.api import InstrumentsApi, SearchApi import numpy as np import time from lusidtools.cocoon.utilities import checkargs import pandas as pd import logging import re from lusidtools.cocoon.async_tools import run_in_executor import asyncio from typing import Callable ...
import _plotly_utils.basevalidators class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="colorbar", parent_name="bar.marker", **kwargs): super(ColorbarValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
from django.urls import path from . import views app_name = 'blog' urlpatterns = [ # path('', views.index, name='index'), path('signin', views.sign_in, name='signin'), path('', views.post_list, name='post_list'), path('<int:year>/<int:month>/<int:day>/<slug:post>/', views.post_detail, ...
from __future__ import print_function """ Contains an Op for convolving input images with a set of filters. This was developed especially for Convolutional Neural Networks. For related ops, including downsampling and subsampling, see tensor.signal and tensor.signal.downsample. See especially conv2d(). """ __docforma...
import os,sys import numpy as np import cv2 import caffe from sklearn.metrics import confusion_matrix def printRow(fs,record): for n in range(len(record)): fs.write('%f'%record[n]) if n<len(record)-1: fs.write(',') fs.write('\n') def preprocess(input,mode): output=[] if mod...
# # 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...
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # https://docs.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals class FacebookScraperSpiderMiddleware(object): # Not all methods need to be defined. If a method is not defined, ...
import os import sys from functools import partial from pretrainedmodels import inceptionresnetv2 from torch.nn import Dropout2d, UpsamplingBilinear2d, Sequential from torch.nn.functional import bilinear, upsample_bilinear from torch.utils import model_zoo from models import resnet from models.densenet import densene...
#!/usr/bin/env python ''' NOX GUI This file creates the main application window, sets up the layout and invokes the GUI's widgets. The left panel (log) is used for displaying context-specific information. The right panel (topology) is an interactive display of the topology The bottom right pane (console) is a frontend ...
# coding: utf-8 """Expose data to different interface ZMQStream explose to a ZeroMQ socket in a REQ/REP pattern. Copyright (c) 2017, European X-Ray Free-Electron Laser Facility GmbH All rights reserved. You should have received a copy of the 3-Clause BSD License along with this program. If not, see <https://opensour...
# Copyright (c) 2015, MapR Technologies # # 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...
""" Copyright (C) 2018 Expedia Group. 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 di...
# # encoders for various output formats # # the dumps() method will be called # import io import csv import dicttoxml from datetime import datetime import uuid import redmonty import simplejson as json import logging import logging dicttoxml.LOG.setLevel(logging.ERROR) def pow_json_serializer(obj): """JSON seria...
# Copyright 2015 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...
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt from viztracer import VizTracer from .base_tmpl import BaseTmpl class TestVizEvent(BaseTmpl): def test_basic(self): tracer = VizTracer() ...
LUCENE_PT_BR = 'pt-br.lucene' MICROSOFT_PT_BR = 'pt-br.microsoft'
import numbers import decimal import fractions import math import re as regex import sys from .containers import Tuple from .sympify import (SympifyError, converter, sympify, _convert_numpy_types, _sympify, _is_numpy_instance) from .singleton import S, Singleton from .expr import Expr, AtomicExpr...
#vim : tabstop=8 expandtab shiftwidth=4 softtabstop=4 from numpy import * import matplotlib.pyplot as plot import __builtin__ as std import sys import time n = 40 name = sys.argv[1] print name if len(sys.argv) > 2 : n = sys.argv[2] d = 2 grootte = n**d t = time.clock() beta = load(name+'_'+'beta'+'.npy') Ce = load(n...
'''tzinfo timezone information for America/Tijuana.''' from pytz.tzinfo import DstTzInfo from pytz.tzinfo import memorized_datetime as d from pytz.tzinfo import memorized_ttinfo as i class Tijuana(DstTzInfo): '''America/Tijuana timezone definition. See datetime.tzinfo for details''' zone = 'America/Tijuana' ...
from __future__ import absolute_import import functools import inspect import itertools import logging import threading import six from django.utils.functional import empty, LazyObject from sentry.utils import warnings, metrics from sentry.utils.concurrent import FutureSet, ThreadedExecutor from .imports import imp...
#!/usr/bin/env python3 # Copyright 2020 Tata Elxsi # # 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...
# python import sys;sys.path.append("/home/mmccoo/share");import stm32_prettyprint;stm32_prettyprint.register_printers(None) # test # python print(stm32_prettyprint.stm32_lookup_function(gdb.parse_and_eval("LED_GPIO_Port"))) # based largely on this webpage: # https://www.rethinkdb.com/blog/make-debugging-easier-w...
# coding: UTF-8 """Encapsulates a session with an nsrlsvr instance. Using it is pretty straightforward: create the object (specifying host and port if necessary), then use .add_file() to add filenames. It will compute MD5 hashes of the files and keep track of all files fed to it. Once you're done, call .run_query()...
# qubit number=3 # total number=11 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...
# 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...
description = 'setup for the status monitor' group = 'special' _expcolumn = [ Block('Experiment', [ BlockRow( Field(name='Proposal', key='exp/proposal', width=7), Field(name='Title', key='exp/title', width=30, istext=True, maxlen=40), Field(name='S...
""" player.py object classes representing players to be plugged into ttt engine """ import abc import collections import random class Player(metaclass=abc.ABCMeta): # all players must inherit from this class and implement its methods @abc.abstractmethod def __init__(self): self.wins = 0 self.draws = 0 @abc.a...
# -*- coding: utf-8 -*- from engine.helpers.application import Application import pytest def test_happy_flow_case(app): app.navigator.navigate_to_contacts_page() # fill in and submit the contact form app.form.fill_in_first_name() app.form.fill_in_surname() app.form.select_topic() app.form.fill...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2009-2019 Matthew Rankin. All rights reserved. # Project site: https://github.com/matthewrankin/dotfiles # Use of this source code is governed by a MIT-style license that # can be found in the LICENSE.txt file for the project. """Deploy dot-files """ import...
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
from math import hypot co = float(input('Comprimento do cateto oposto: ')) ca = float(input('Comprimento do cateto adjacente: ')) hi = hypot(co, ca) print('A hipotenusa vai medir {:.2f}'.format(hi))
import numpy as np import mapclassify.classifiers as mc class Equal_Area_Greedy(mc.MapClassifier): # y must be a list with elements of type {'area': a, 'value': v} def __init__(self, y, area=None, k=mc.K): if area is None: raise ValueError("area kwarg must be supplied") self.k = k ...
from discord.ext import commands from .clear import ClearCommand def setup(bot: commands.Bot): bot.add_cog(ClearCommand(bot))
""" An action is a way to take an arbitrary method and make it configurable and runnable within a Data Context. The only requirement from an action is for it to have a take_action method. """ import logging import warnings from great_expectations.data_context.util import instantiate_class_from_config from ..data_co...
""" Convert a image file to web save JPG """ from PIL import Image from generators.generator import Generator class JPG(Generator): async def run(self): self.start("Starting compression...") output = self.rename_extension(self.output_file, "jpg") if output.exists() and self.skip_existin...
#!/usr/bin/env python2.7 # -*- coding: utf8 -*- #import pip #pip.main(['-q', 'install', 'cymruwhois']) #pip.main(['-q', 'install', 'dpkt']) #pip.main(['-q', 'install', 'simplejson']) try: import dpkt except: print "Download dpkt" try: import cymruwhois except: print "Download cymruwhois" try: ...
# database connection config HOST = '127.0.0.1' PORT = '3306' DATABASE = 'PlrVehicleSys' USERNAME = 'your-db-name' PASSWORD = 'your-db-passwd' DB_URI = f"mysql+pymysql://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE}" \ f"?charset=utf8" SQLALCHEMY_DATABASE_URI = DB_URI SQLALCHEMY_TRACK_MODIFICATIONS = True S...
# Copyright 2015 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 # # Unless required by...
# pyGestalt Config Module """The config module is used as a storage container to pass global state within a pyGestalt session.""" def setGlobalVariable(name, value): """Sets a global variable. name -- the name of the global variable to be set value -- the value to which the global variable should be...
# -*- coding: utf-8 -*- # # Copyright 2012-2022 BigML # # 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 ...
from __future__ import division, print_function, absolute_import import os, sys from collections import OrderedDict import numpy as np import tensorflow as tf from tfutils import base, data, model, optimizer, utils import copy # toggle this to train or to validate at the end train_net = True # toggle this to train ...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
import pytest from cryptography import x509 from cryptography.hazmat.primitives import serialization from cryptography.x509 import Certificate from pyspiffe.spiffe_id.spiffe_id import SpiffeId from pyspiffe.utils.certificate_utils import ( parse_pem_certificates, parse_der_certificates, load_certificates_b...
import io import itertools from functools import partial from typing import List, Any import matplotlib import numpy as np from loguru import logger from matplotlib import pyplot as plt from omni_converter.solver.rules import RuleEdge def to_nrm_quiver_auto(nrm: "AutoData", auto_func) -> "AutoData": return to_n...
# encoding: utf-8 import re import pytest from six import text_type import ckan.lib.jobs as jobs import ckan.lib.search as search import ckan.lib.api_token as api_token import ckan.logic as logic import ckan.model as model import ckan.plugins as p import ckan.tests.factories as factories import ckan.tests.helpers as...
#-*- coding=utf-8 -*- import logging import time import traceback from django.conf import settings from cloud.celery import app from fabric import tasks from fabric.api import run from fabric.api import env from fabric.network import disconnect_all from biz.backup.models import Backup from biz.backup.settings impo...
import os import argparse from serial_manager import SerialManager import numpy as np import time import timeit import PID import pickle from scipy import interpolate import matplotlib.pylab as plt import random from scipy.optimize import leastsq SERIAL_PORT = 'COM4' BITSPERSECOND = 9600 numberOfCells = 12 numberOfSta...
""" Python Data Structures - A Game-Based Approach Stack class Robin Andrews - https://compucademy.net/ """ class Stack: def __init__(self): self.items = [] def is_empty(self): return not self.items def push(self, item): self.items.append(item) def pop(self)...
#!/usr/bin/env python3 """ extract reads from a bam file and a list write a fasta file useful benchmark: https://timoast.github.io/blog/2015-10-12-extractreads/ """ import pysam def extract_reads(options): with open(options.names, "r") as f: n = f.readlines() bamfile = pysam.AlignmentFile(optio...
# This file is part of Indico. # Copyright (C) 2002 - 2019 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from .base import RHManageEventBase __all__ = ('RHManageEventBa...
S=input() N=len(S) S1=S[0:(N-1)//2] S2=S[(N+3)//2-1:N+1] print("Yes" if S==S[::-1] and S1==S1[::-1] and S2==S2[::-1] else "No")
from __future__ import unicode_literals from django.db.transaction import atomic class Migration(object): """ The base class for all migrations. Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the follow...
import os import numpy as np import tensorflow as tf import uncertainty_wizard as uwiz from emp_uncertainty.case_studies.case_study import BASE_MODEL_SAVE_FOLDER, BASE_OUTPUTS_SAVE_FOLDER from emp_uncertainty.case_studies.plain_classifiers import cifar10 from emp_uncertainty.dropout_rate.utils import rate_from_model_...