content
stringlengths
5
1.05M
#!/usr/bin/python from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext import os import sys hidapi_topdir = os.path.join(os.getcwd(), 'hidapi') hidapi_include = os.path.join(hidapi_topdir, 'hidapi') def hidapi_src(platform): return os.path.join(hidapi_to...
#!/bin/python import csv import sys import struct filename_in = sys.argv[1] filename_out = sys.argv[2] with open(filename_in) as csv_file: csv_reader = csv.reader(csv_file, delimiter = ','); line_count = 0 fileout = open(filename_out, "wb") fileout.write(struct.pack('b', 0)) fileout.w...
# Copyright 2015-2021 SWIM.AI 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 ...
import torch import random from layers import SEAL from tqdm import trange from utils import hierarchical_graph_reader, GraphDatasetGenerator class SEALCITrainer(object): """ Semi-Supervised Graph Classification: A Hierarchical Graph Perspective Cautious Iteration model. """ def __init__(self,args): ...
# Copyright (c) 2017 NVIDIA Corporation import torch import argparse from reco_encoder.data import input_layer from reco_encoder.model import model import torch.optim as optim from torch.optim.lr_scheduler import MultiStepLR import torch.nn as nn from torch.autograd import Variable import copy import time from pathlib ...
# Copyright 2017 Become Corp. 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...
"""Module for all encryption""" # standard imports import hashlib import binascii from os import urandom, getenv from uuid import uuid4 # third party imports from authlib.specs.rfc7519 import jwt # local imports from api.utilities.constants import CHARSETS from api.utilities.constants import MESSAGES from api.utilit...
from common import * ## for debug def dummy_transform(image): print ('\tdummy_transform') return image # kaggle science bowl-2 : ################################################################ def resize_to_factor2(image, mask, factor=16): H,W = image.shape[:2] h = (H//factor)*factor w = (W //...
import wrapper as w import json outFile = open("data/tgt/linear/test.txt", "w") with open("data/tgt/giant_news0tgt0.txt", "r") as inFile: for line in inFile: serialized = json.loads(line[line.index("\t"):]) ex = w.GrapheneExtract(serialized) linear = ex.linearize() if linear != "": outFile.write(line[:lin...
""" Copyright(c) 2021 Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicen...
from clases.catastrofe import catastrofe from clases.catastrofe import AlDiaSiguiente from clases.yinyang import Yin from clases.yinyang import Yang from clases.herenciaMultiple import Pared from clases.herenciaMultiple import Ventana from clases.herenciaMultiple import Casa from clases.herenciaMultiple import ParedCor...
# Exercise 2.12 from math import * ballRadius = float(input("Please enter the radius: ")) ballVolume = 4 / 3 * pi * ballRadius ** 3 ballSpace = 4 * pi * ballRadius ** 2 print("The Volume of the ball is", ballVolume) print("The Superficial Area of the ball is", ballSpace)
#!/usr/bin/env python # -*- coding: utf-8 -*- # These imports are for python3 compatibility inside python2 from __future__ import absolute_import from __future__ import division from __future__ import print_function import threading import time import cachetools from apex.aprs import util as aprs_util from .util im...
# Copyright (C) 2013-2016 DNAnexus, Inc. # # This file is part of dx-toolkit (DNAnexus platform client libraries). # # 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.a...
from structural.composite.logic.order_calculator import OrderCalculator class Product(OrderCalculator): def __init__(self, name: str, value: float) -> None: self._name = name self._value = value @property def name(self) -> str: return self._name @property def value(self) ...
# Copyright (C) 2016-2021 Alibaba Group Holding 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 # # Unless required by applicable l...
#!/usr/bin/env python3 # Copyright 2019 Kohei Morita # # 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...
__author__ = 'marcos'
import pytest from kgx.config import get_biolink_model_schema def test_valid_biolink_version(): try: schema = get_biolink_model_schema("2.2.1") except TypeError as te: assert False, "test failure!" assert ( schema == "https://raw.githubusercontent.com/biolink/biolink-model...
import os import tensorflow as tf from tensorflow.python.client import device_lib from tensorflow.python.training.distribute import DistributionStrategy from tensorflow.contrib.distribute import MirroredStrategy, TPUStrategy from time import time from estimator import CustomEstimator from dataset import dataset_fn, da...
from .log import Code, warning, info, debug, debug_line, ModuleError from . import Config, Export from .stages import main from .utils import get_temp_folder from .checker import check, check_equality from .dsp import channel_count, size from .utils import random_file import soundfile as sf import numpy as np import o...
# generated by datamodel-codegen: # filename: openapi.yaml # timestamp: 2021-12-31T02:53:00+00:00 from __future__ import annotations from datetime import datetime from enum import Enum from typing import Annotated, Any, List, Optional from pydantic import BaseModel, Field class ServiceUpdateNotFoundFault(Base...
from typing import List, Union, Optional, Dict, MutableMapping, Any, Set import itertools import math import numbers import copy import operator import warnings import attr from .load_dump import dumps as demes_dumps Number = Union[int, float] Name = str Time = Number Size = Number Rate = float Proportion = float _...
import json import urllib3 http = urllib3.PoolManager() request = http.request('GET','https://booksbyptyadana.herokuapp.com/books') data = request.data print(request.status) if len(data) > 0: book_dict = dict() books = json.loads(data.decode('utf-8')) for book in books: book_dict[book['book_name'...
from abc import ABC from distutils.version import LooseVersion from typing import Union class Capabilities(ABC): """Represents capabilities of a connection / back end.""" def __init__(self, data): pass def version(self): """ Get openEO version. DEPRECATED: use api_version instead""" ...
#!../../../.env/bin/python import os import numpy as np import time a = np.array([ [1,0,3], [0,2,1], [0.1,0,0], ]) print a row = 1 col = 2 print a[row][col] assert a[row][col] == 1 expected_max_rows = [0, 1, 0] expected_max_values = [1, 2, 3] print 'expected_max_rows:', expected_max_rows print 'expected_...
from utils import overloadmethod, ApeInternalError from astpass import DeepAstPass import cstnodes as E class Sentinel: def __init__(self, value): self.value = value def __repr__(self): return f'Sentinel({self.value!r})' def is_sentinel(x): return isinstance(x, Sentinel) def is_iterable(...
import unittest import numpy as np from laika.raw_gnss import get_DOP, get_PDOP, get_HDOP, get_VDOP, get_TDOP from laika.lib.coordinates import geodetic2ecef class TestDOP(unittest.TestCase): def setUp(self): self.receiver = geodetic2ecef((0, 0, 0)) self.satellites = np.array([ [18935913, -3082759,...
# This utility should only be invoked via the itimUtil.sh wrapper script. # Support utility to submit ITIM object changes via the ITIM API. Changes are specified # through a text file. # Changes are submitted asynchronously and status is reported later in the output. # See usage information in the wrapper script. # ...
import random from careers.career_enums import GigResult from careers.career_gig import Gig, TELEMETRY_GIG_PROGRESS_TIMEOUT, TELEMETRY_GIG_PROGRESS_COMPLETE from sims4.localization import TunableLocalizedStringFactory from sims4.tuning.instances import lock_instance_tunables from sims4.tuning.tunable import TunableRefe...
"""Plugwise Switch component for HomeAssistant.""" from __future__ import annotations from typing import Any from plugwise.exceptions import PlugwiseException from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, ca...
# Copyright (c) 2020 Simons Observatory. # Full license can be found in the top level "LICENSE" file. import numpy as np from toast.timing import function_timer, Timer from toast.utils import Logger from ..sim_hwpss import OpSimHWPSS def add_sim_hwpss_args(parser): parser.add_argument( "--hwpss-file",...
import pandas as pd import numpy as np from pyam import utils def test_pattern_match_none(): data = pd.Series(['foo', 'bar']) values = ['baz'] obs = utils.pattern_match(data, values) exp = [False, False] assert (obs == exp).all() def test_pattern_match_nan(): data = pd.Series(['foo', np.n...
from __future__ import absolute_import, division, print_function from appr.models.kv.channel_kv_base import ChannelKvBase from appr.models.kv.etcd.models_index import ModelsIndexEtcd class Channel(ChannelKvBase): index_class = ModelsIndexEtcd
# coding: utf-8 """ RLSData.py The Clear BSD License Copyright (c) – 2016, NetApp, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redi...
# Generated by Django 3.1.2 on 2020-10-30 15:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pages', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='page', options={'ordering': ['order', ...
import csv import cv2 import pandas as pd import numpy as np import os import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.utils import shuffle import sklearn import tensorflow as tf import pickle import keras from sklearn.externals import joblib from keras.models import Se...
"""Auto-generated file, do not edit by hand. SA metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_SA = PhoneMetadata(id='SA', country_code=966, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='(?:[1-467]|92)\\d{7}|5\\d{8}|8\\d{9}', p...
from rest_framework.viewsets import ModelViewSet from exam.models import TblExamRecord as Model from exam.serializers import RecordSerializer as Serializer class RecordViewset(ModelViewSet): queryset = Model.objects.all().order_by('-id') serializer_class = Serializer
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class MybankCreditSupplychainCreditpayAmountQueryResponse(AlipayResponse): def __init__(self): super(MybankCreditSupplychainCreditpayAmountQueryResponse, self).__init__() s...
import string import numpy import copy from domrl.engine.agent import Agent """ class Agent(object): def choose(self, decision, state): return decision.moves[0] class StdinAgent(Agent): def choose(self, decision, state): # Autoplay if len(decision.moves) == 1: return [0]...
"""Functional tests for pylint."""
import time from wrf.cache import _get_cache from wrf import getvar from netCDF4 import Dataset as nc #a = nc("/Users/ladwig/Documents/wrf_files/wrf_vortex_single/wrfout_d02_2005-08-28_00:00:00") #b = nc("/Users/ladwig/Documents/wrf_files/wrf_vortex_single/wrfout_d02_2005-08-28_03:00:00") a = nc("/Users/ladwig/Documen...
# 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! *** from .. import _utilities import typing # Export this package's modules as members: from ._enums import * from .get_key import * from .get_managed_hsm ...
import datetime import json from flask_testing import TestCase from config import create_app from db import db from models import ParkModel from models.pay_type import PayType from tests.base import generate_token from tests.factories import AdminUserFactory from tests.helpers_for_tests import GenerateTarifeData cl...
# -*- coding: utf-8 -*- from django.http import HttpResponseRedirect from django.views.decorators.http import require_http_methods, require_GET from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.contrib.auth impo...
import re from datetime import datetime class HadoopSeriesParser: def __init__(self): self.attribute_count = 8 self.foundation_date_regex = r'^([^\t]*\t){1}"\d{4}"\^\^<http://www.w3.org/2001/XMLSchema#date>.*$' def parse(self, result_data): lines_attributes = [] ### Structure # <http://dbpedia.org/resour...
import sys import os import pytest import pandas as pd import arcus.ml.dataframes as adf import logging from unittest.mock import patch from collections import Counter logging.basicConfig(level=logging.DEBUG) mylogger = logging.getLogger() # initialize list of lists categorical_data = [['BE', 10], ['FR', 15], ['BE...
#/usr/bin/python # Copyright 2013 by Hartmut Goebel <h.goebel@crazy-compilers.com> # Licence: GNU Public Licence v3 (GPLv3), but not for military use import subprocess import argparse GRAPH_HEADER = ''' digraph "%s" { nodesep=0; sep=0; ranksep=0 ratio="compress" packmode="node"; pack=1 pad=0 splines=true ...
import os import pickle from tqdm import tqdm from config import data_file, thchs30_folder # split in ['train', 'test', 'dev'] def get_thchs30_data(split): print('loading {} samples...'.format(split)) data_dir = os.path.join(thchs30_folder, 'data') wave_dir = os.path.join(thchs30_folder, split) sa...
#!/bin/env python2 import cairo import os.path this = os.path.dirname(__file__) def millimeters_to_poscript_points(mm): inches = mm / 25.4 return inches * 72 def css_px_to_poscript_points(px): inches = px / 96. return inches * 72 cairo.PDFSurface(os.path.join(this, "A4_one_empty_page.pdf"), ...
import numpy as np from torch.utils.data import Subset from sklearn.model_selection import train_test_split def split_data(dataset,splits=(0.8,0.2),seed=None): assert np.sum(splits) == 1 assert (len(splits)==2) | (len(splits)==3) if len(splits) == 2: train_idx, test_idx, _, _ = train_test_split(ra...
from __future__ import print_function # ---------------------------------------------------------------- # Copyright 2016 Cisco Systems # # 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 # # ...
import torch import torch.nn as nn import torch.nn.functional as F class Matching(nn.Module): def __init__(self, vis_dim, lang_dim, jemb_dim, jemb_drop_out): super(Matching, self).__init__() self.vis_emb_fc = nn.Sequential(nn.Linear(vis_dim, jemb_dim), nn.B...
import torch import torch.nn as nn class LeNet(torch.nn.Module): """This is improved version of LeNet """ def __init__(self): super(LeNet, self).__init__() self.network = nn.Sequential(nn.Conv2d(1, 6, kernel_size=5, padding=2), nn.ReLU(), nn.MaxPool2d(...
# -*- test-case-name: twisted.positioning.test -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ The Twisted positioning framework. @since: 14.0 """
# 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.package import * class Libpam(AutotoolsPackage): """Example PAM module demonstrating two-factor authentic...
# Copyright 2020 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...
''' This code loads the results and prepares Fig8a. (c) Efrat Shimron, UC Berkeley, 2021 ''' import os import matplotlib.pyplot as plt import numpy as np R = 4 pad_ratio_vec = np.array([1, 2]) print('============================================================================== ') print(' ...
from django.core.urlresolvers import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.core.paginator import Paginator from go.base import utils from go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper from go.vumitools.api import VumiAp...
import py from pypy.translator.cli.test.runtest import compile_function from pypy.translator.oosupport.test_template.backendopt import BaseTestOptimizedSwitch class TestOptimizedSwitch(BaseTestOptimizedSwitch): def getcompiled(self, fn, annotation): return compile_function(fn, annotation, backendopt=True)
""" Low level *Skype for Linux* interface implemented using *XWindows messaging*. Uses direct *Xlib* calls through *ctypes* module. This module handles the options that you can pass to `Skype.__init__` for Linux machines when the transport is set to *X11*. No further options are currently supported. Warning PyGTK fr...
#! /usr/bin/env python3 # encoding: UTF-8 # # Python Workshop - Conditionals etc #2 # # We'll later cover learn what happens here import random # # Guess a number # Find a random number between 0 and 100 inclusive target = random.randint(0, 100) # TODO: # Write a while loop that repeatedly asks the user to guess th...
#! /usr/bin/env python import cyvcf2 import argparse import sys from collections import defaultdict, Counter import pandas as pd import signal import numpy as np from shutil import copyfile import pyfaidx from random import choice from pyliftover import LiftOver from Bio.Seq import reverse_complement from mutyper imp...
############################################################################### # $Id$ # $Author$ # # Routines to create the inquisitor plots. # ############################################################################### # system import import threading import string import os # enstore imports import Trace impor...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) import pytest from .. import Backend from . import AVAILABLE_BACKENDS @pytest.mark.parametrize('key', AVAILABLE_BACKENDS) def test_Dummy(key): be = Backend(key) d0 = be.Dummy() d1 = be.Dummy() assert d0 == d0 ...
# Copyright 2021 Xiaomi Corp. (authors: Fangjun Kuang # Mingshuang Luo) # # See ../../../../LICENSE for clarification regarding multiple authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licen...
import time import cv2 import numpy as np import tflite_runtime.interpreter as tflite def _inference(interpreter, input_details, input_data): '''Inference (internal function) TensorFlow Lite inference the inference result can be get to use interpreter.get_tensor Arguments: - interpreter: tflite...
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license import subprocess import sys import os.path as path from typing import List, Optional def run_python_command(local_path: str, args: List[str], python_binary: Optional[str] = None, notbash = True): """ run a python subprocess :param local_path:...
import numpy from numpy.testing import * from prettyplotting import * from algopy.utpm import * # STEP 0: setting parameters and general problem definition ############################################################ # Np = number of parameters p # Nq = number of control variables q # Nm = number of measurements # P ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Day 2 of AdventOfCode.com: iterating over arrays doing simple arithmetic""" import os from numpy import product def present_wrap_area(dimensions): """ :param dimensions: list of 3 floats: length, width and height :return: area of wrapping """ wrap_area...
# Copy from web_set_price.py of Trading Stock Thailand # Objective : Create Program to store financial data of company # From set.or.th # sk 2018-12-05 import urllib from bs4 import BeautifulSoup import numpy as np import pandas as pd from os.path import join, exists from os import remove, makedirs import urllib2 #s...
import nltk import json import argparse from collections import Counter def build_word2id(seq_path, min_word_count): """Creates word2id dictionary. Args: seq_path: String; text file path min_word_count: Integer; minimum word count threshold Returns: word2id: Dictionary; word-to-i...
# -*- coding:utf-8 -*- # Python 字典类型转换为JSON对象 data1 = { 'no': 1, 'name':'Runoob', 'url':'http://www.runoob.com' } # 对数据进行编码 import json json_str = json.dumps(data1) print("Python原始数据:", repr(data1)) print("JSON对象:", json_str) # 将JSON对象转换为Python字典 # 对数据进行解码 data2 = json.loads(json_str) print("data2...
import re def checkIP(IP): regex='^([2][0-5][0-5]|[1]{0,1}[0-9]{1,2})\.([2][0-5][0-5]|[1]{0,1}[0-9]{1,2})\.([2][0-5][0-5]|[1]{0,1}[0-9]{1,2})\.([2][0-5][0-5]|[1]{0,1}[0-9]{1,2}$)' return re.match(regex,IP) def checkIP2(n): return n<=255 a=['123.4.2.222', '0.0.0.0', '14.123.444.2', '1.1.1.1'] print "***** CHECK USI...
#!/usr/bin/env python import wx import pcbnew import os import time from .kifind_plugin_gui import kifind_gui from .kifind_plugin_action import FindAll, DoSelect, __version__ class KiFindDialog(kifind_gui): """Class that gathers all the Gui control""" def __ShowAll(self, do_tracks, do_mm): self.list...
from app import app from selenium import webdriver from selenium.webdriver.common.keys import Keys import pandas as pd import time import json from flask import jsonify @app.route('/') @app.route('/home', methods=['GET']) def home(): navegador = webdriver.Chrome() pessoas = ["Brain+Lag", "Why", "Dankpot7", "Ro...
# Copyright (c) 2019 Horizon Robotics. 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 applicab...
from profiles.models import * from django.contrib import admin admin.site.register(FriendGroup) admin.site.register(UserProfile)
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db.models.query import QuerySet class CategoryQuerySet(QuerySet): def by_author(self, user): return self.filter(author=user)
seq = input() a = [(int(seq[i]) + int(seq[i+1]))/2.0 for i in range(len(seq)-1)] print(a)
####################################################################### # Tests for applications.py module ####################################################################### from auto_process_ngs.applications import * import unittest try: from cStringIO import StringIO except ImportError: # cStringIO not a...
#!/usr/bin/env python # # This examples show how to use accessors to associate scalar data to mesh elements, # and how to read and write those data from/to mesh files using ViennaGrid's readers # and writers. from __future__ import print_function # In this example, we will illustrate how to read and write scalar dat...
########## Single softmax layer NN build for digit recognition ################### ############ Import modules ################# import mnistdata import tensorflow as tf tf.set_random_seed(0) # Download images and labels into mnist.test (10K images+labels) and mnist.train (60K images+labels) mnist = mnistdata.read...
import os os.environ['DJANGO_COLORS'] = 'nocolor' from django.core.management import call_command from django.db import connection from django.apps import apps from io import StringIO commands = StringIO() cursor = connection.cursor() for app in apps.get_app_configs(): call_command('sqlsequencereset', app.label...
import discord import os import keep_alive from discord.ext import commands client = commands.Bot(command_prefix=':', self_bot=True, help_command=None) @client.event async def on_ready(): # Playing # await client.change_presence(activity=discord.Game(name="a game")) # Streaming # await bot.change_pr...
""" globals.py File that holds some important static dictionary look-up tables, and some useful functions used repeatedly in the codebase. """ import numpy as np import pandas as pd from scipy.special import logit """ get_prec_df Reads in the precinct df given the state and the year. NOTE: also adds in no...
# Definition of dictionary europe = {'spain':'madrid', 'france':'paris', 'germany':'bonn', 'norway':'oslo', 'italy':'rome', 'poland':'warsaw', 'australia':'vienna' } # Update capital of germany europe['germany'] = 'berlin' # Remove australia del(europe['australia']) # Print europe pri...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"f1score": "00_utils.ipynb", "df_preproc": "00_utils.ipynb", "load_data": "00_utils.ipynb", "TestModel": "00_utils.ipynb", "transform": "00_utils.ipynb", "windows_...
from __future__ import absolute_import from collections import OrderedDict import logging from tabulate import tabulate from numpy import asarray from numpy import sqrt from numpy import ones from numpy_sugar.linalg import economic_svd from ...tool.kinship import gower_normalization from ...tool.normalize import ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Eric Winn # @Email : eng.eric.winn@gmail.com # @Time : 19-9-3 上午7:19 # @Version : 1.0 # @File : __init__.py # @Software : PyCharm
from typing import Optional from django.urls import reverse from django.views.generic import CreateView from django.http import Http404 from django.utils.functional import cached_property from task.forms import TaskCreateForm from ..models import Member from ..querysets import get_user_teams, get_team_with_members fr...
from PyQt5.QtCore import * from PyQt5.QtWidgets import * from common.config import Config, workstation_methods from panel.common.CommonWidgets import * class WorkstationConfiguration(QWidget): def __init__(self, workstation_name, workstation_type): super(WorkstationConfiguration, self).__init__() ...
""" Digital Communications Function Module Copyright (c) March 2017, Mark Wickert All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notic...
def validMountainArray(arr): N = len(arr) i = 0 while i + 1 < N and arr[i] < arr[i+1]: i += 1 if i == 0 or i == N-1: return False while i + 1 < N and arr[i] > arr [i+1]: i += 1 return i == N-1 arr = [2,1] x = validMountainArray(arr) print(x) arr1 = [3,5,5] x = v...
from django.http import HttpResponse from django.shortcuts import render from rest_framework.generics import ( CreateAPIView, DestroyAPIView, ListAPIView, UpdateAPIView, RetrieveAPIView ) from posts.models import Post from .serializers import ( PostCreateSerializer, PostListSerializer,...
import bayesnewton import objax import numpy as np import matplotlib.pyplot as plt import time # load graviational wave data data = np.loadtxt('../data/ligo.txt') # https://www.gw-openscience.org/events/GW150914/ np.random.seed(12345) x = data[:, 0] y = data[:, 1] x_test = x y_test = y x_plot = x var_f = 1.0 # G...
import numpy as np import tinkerbell.app.plot as tbapl import tinkerbell.app.rcparams as tbarc from matplotlib import pyplot as plt fname_img = 'img/time_stage_lstm.png' def xy_from_npy(fname): data = np.load(fname) return (data[0], data[1]) xmax = tbarc.rcparams['shale.lstm_stage.xmax'] y0 = tbarc.rcparams...
# ----------* CHALLENGE 74 *---------- # Enter a list of ten colours. Ask the user for a starting number between 0 and 4 # and an end number between 5 and 9. Display the list for those colours # between the start and end numbers the user input. list_colours = ["red", "blue", "green", "yellow", "orange", "purple"...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('auth', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...