text
stringlengths
2
999k
"""Statistics helper for sensor.""" from __future__ import annotations import datetime import statistics from homeassistant.components.recorder import history from homeassistant.components.sensor import ATTR_STATE_CLASS, STATE_CLASS_MEASUREMENT from homeassistant.const import ATTR_DEVICE_CLASS from homeassistant.core...
import openpyxl def readExcelFile (path, sheetName): file = openpyxl.load_workbook (path, read_only=True) sheets = file.sheetnames return file.get_sheet_by_name (sheetName) def getValueCell (worksheet, row, col): cell = worksheet.cell (row, col) return cell.value def getRowValues (worksheet, star...
import tensorflow as tf from tensorflow.keras import losses import tensorflow.python.keras.backend as K class ImageGradientDifferenceLoss(losses.Loss): def __init__(self): super().__init__() def call(self, y_true, y_pred): # for 5D inputs gdl = 0 for i in range(y_true.shape[1])...
# 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 python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Class for bitcoinrd node under test""" import contextlib import decimal import errno from enum import ...
import pytest import cudf from cuxfilter.charts.core.non_aggregate.core_stacked_line import ( BaseStackedLine, ) from cuxfilter.layouts import chart_view import cuxfilter class TestBaseStackedLine: df = cudf.DataFrame( {"key": [0, 1, 2, 3, 4], "val": [float(i + 10) for i in range(5)]} ) cux_d...
import sys import argparse from PolTools.utils.verify_bed_file import verify_bed_files from PolTools.utils.get_region_length import determine_region_length from PolTools.utils.bedtools_utils.run_bedtools_getfasta import run_getfasta from PolTools.utils.make_random_filename import generate_random_filename from PolTools...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. __version__ = "0.6.0.dev" import os import re import sys import copy import yaml import logging import platform import subprocess from pathlib import Path from .utils import can_use_cache, init_instance_by_config, get_module_by_module_path fr...
"""Some special pupropse layers for SSD.""" import keras.backend as K from keras.engine.topology import InputSpec from keras.engine.topology import Layer import numpy as np import tensorflow as tf class Normalize(Layer): """Normalization layer as described in ParseNet paper. # Arguments scale: Defau...
# The code here is based on the code at # https://github.com/gpleiss/temperature_scaling/blob/master/temperature_scaling.py import torch from torch import nn, optim from torch.nn import functional as F from torch.autograd import Variable import numpy as np def logits_from_probs(prob_arr): return np.log(prob_arr) ...
#!/usr/bin/env python ###################################################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
# coding: utf-8 # Copyright (c) 2009-2021 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause # License. # Maintainer: joaander / All Developers are free to add commands for new # features from hoomd.md import _md import hoomd from hoomd.integrate...
# coding: utf-8 from __future__ import unicode_literals, print_function, division, absolute_import from subprocess import call import unittest from django.test import TestCase class TestStyle(TestCase): @unittest.skip('Fails under Django 1.6') def test_flake8(self): result = call(['flake8', '--exclu...
import os, sys sys.path.append(os.getcwd()) import time import tflib as lib import tflib.save_images import tflib.mnist import tflib.cifar10 import tflib.plot import tflib.inception_score import os import numpy as np import torch import torchvision from torch import nn from torch import autograd from torch import o...
""" pyubx2 performance benchmarking utility Created on 5 Nov 2021 @author: semuadmin """ from datetime import datetime from platform import version, python_version from pyubx2.ubxreader import UBXReader from pyubx2._version import __version__ as pyubx2ver CYCLES = 10000 UBXMESSAGES = [ b"\xb5b\x10\x02\x18\x00\x...
import unittest import os import pandas as pd from tadaqq.clus import Clusterer from collections import Counter from tadaqq.clus import Clusterer, PMap from tadaqq.slabmer import SLabMer def get_test_df(): dbp = "http://dbpedia.org/property/" df = pd.DataFrame( [ ['AAA', 'fnameaa1', 0, "1,...
# Given a string s, find the length of the longest substring without repeating characters. # #   # Example 1: # # # Input: s = "abcabcbb" # Output: 3 # Explanation: The answer is "abc", with the length of 3. # # # Example 2: # # # Input: s = "bbbbb" # Output: 1 # Explanation: The answer is "b", with the length of 1. # ...
"""Runs a parametric test over several of the linear solvers.""" import numpy as np import unittest from openmdao.core.group import Group from openmdao.core.problem import Problem from openmdao.core.implicitcomponent import ImplicitComponent from openmdao.utils.assert_utils import assert_near_equal from openmdao.solv...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'OrderDiscount.frequency' ...
import numpy as np import scipy.misc import tensorflow as tf import os import termcolor # compute projection from source to target def projection(Vs,Vt): VsN = tf.shape(Vs)[0] VtN = tf.shape(Vt)[0] Vt_rep = tf.tile(Vt[None,:,:],[VsN,1,1]) # [VsN,VtN,3] Vs_rep = tf.tile(Vs[:,None,:],[1,VtN,1]) # [VsN,VtN,3] diff =...
import argparse import webbrowser import octis.dashboard.frameworkScanner as fs import octis.configuration.defaults as defaults from multiprocessing import Process, Pool import json from flask import Flask, render_template, request, send_file import tkinter as tk import pandas as pd import numpy as np from tkinter impo...
# 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...
""" # -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup --------------------------------------------------------...
import os from flask import url_for EMPTY_EXTENSIONS_JSON = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'fixtures', 'empty.json') def test_extensions_json(client): response = client.get(url_for('extensions_json')) assert response.status_code == 200 def test_home(client): response = clien...
# -*- 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 numpy as np def read_gaussian_out(content, property='energy'): """Reads gaussian output file - quantity = 'structure' - final structure form output. - quantity = 'atomic_numbers' - atmoic numbers - quantity = 'energy' - final energy from output. - quantity = 'frequencies' - frequencies ...
import time import re import socket import sys import traceback import paho.mqtt.client as mqtt from threading import Thread class TemperatureLogger: config = None mqtt_client = None mqtt_connected = False worker = None # removed as not one of my requirements #temperatures = {} def __ini...
import os import requests from django.conf import settings from constance import config def check_access_token(): url = "https://id.twitch.tv/oauth2/validate" access_token = config.TWITCH_ACCESS_TOKEN headers = {"Authorization": f"OAuth {access_token}"} req = requests.get(url, headers=headers) d...
import json from pathlib import Path from typing import Optional class Config: user: str = "jmaralc" repo: str = "oop_rust" token: str = "fake_token" deployment_action_name: str = "Greetings" def __init__(self, config_file: Optional[Path] = None): if config_file is not None: w...
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Stream(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "box" _path_str = "box.stream" _valid_props = {"maxpoints", "token"} # maxpoints # -...
from classification_tools import * from PyQt5 import uic from PyQt5.QtWidgets import QFileDialog, QLineEdit, QAction, QFrame, QHBoxLayout, QLabel, QMainWindow, QApplication, QPushButton, QPlainTextEdit, QMessageBox from PyQt5.QtCore import pyqtSlot, Qt NORMAL_LABEL_STYLESHEET = "color: rgb(43, 62, 81); background-colo...
# Given array of integers, for each position i, search among the previous # positions for the last (from the left) position that contains a smaller # value. Store this value at position i in the answer. If no such value # can be found, store -1 instead. # # Example # # For items = [3, 5, 2, 4, 5], the output should be ...
"""An unofficial Python wrapper for the Binance exchange API v3 .. moduleauthor:: Sam McHardy """ __version__ = '1.0.1' from binance.client import Client, AsyncClient # noqa from binance.depthcache import DepthCacheManager, OptionsDepthCacheManager # noqa from binance.streams import BinanceSocketManager # noqa
# Copyright 1999-2020 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
#!/usr/bin/env python import unicodecsv import sys import codecs import json from decimal import Decimal, InvalidOperation FIELDNAMES = ['year', 'mandate_description_en', 'mandate_description_fr', 'operational_activities_kdollars', 'key_stakeholders_kdollars', 'training_kdollars', 'other_kdollars', 'internal_governan...
""" Django settings for week4_baemin project. Generated by 'django-admin startproject' using Django 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 validate # Test license numbers ESMA_NUMBER = "E142304" AHA_NUMBER = "195506016954" ARC_NUMBER = "10FMU9" DCA_NUMBER = "G 50925" DCA_LASTNAME = "DOEMENY" # Expected test results ESMA_EXPECTED_RESULT = """ FULL NAME: Benjamin Thales Lenington LICENSE STATUS: Active LICENSE TYPE: EMT ISSUE DATE: 9/...
# Copyright (c) 2018, NVIDIA CORPORATION. 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 appli...
import asyncio import random import async_timeout import pytest from async_generator import async_generator, yield_ from channels_redis.pubsub import RedisPubSubChannelLayer TEST_HOSTS = [("localhost", 6379)] @pytest.fixture() @async_generator async def channel_layer(): """ Channel layer fixture that flush...
"""Example of Bayesian confirmatory factor analysis in PyMC3 in which the latent variables are estimated. """ import numpy as np import pandas as pd import pymc3 as pm import theano.tensor as tt import matplotlib.pyplot as plt from os.path import exists from matplotlib import rcParams from pymc3.math import matrix_do...
#!/usr/bin/env python # This file contains functions for evaluating algorithms for the 2019 PhysioNet/ # CinC Challenge. You can run it as follows: # # python evaluate_sepsis_score.py labels predictions scores.psv # # where 'labels' is a directory containing files with labels, 'predictions' is a # directory containi...
#! /usr/bin/env python3 import aiohttp from typing import Any, Dict from asyncio_throttle import Throttler from ff14angler.exceptions.networkException import NetworkException class AiohttpWrapper: def __init__(self, rate_limit: int, duration: int): """The value `rate_limit` is max requests per durati...
######################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # SPDX-License-Identifier: MIT-0 # # ...
import requests headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36'} url = 'http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n02127808' response = requests.get(url,headers=headers) print(response.text) url = response.text.spl...
# Copyright 2017 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...
# -*- coding: utf-8 -*- from compare_list import compare import sys def main(): n = int(input()) list_a = list(map(int, input().split())) list_b = list(map(int, input().split())) assert len(list_a) == len(list_b) == n print(compare(list_a, list_b)) if __name__ == '__main__': ma...
# -*- coding: utf-8 -*- import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="data_parse", version="0.0.1", author="Changhai Wu", author_email="hailxl@gmail.com", description="data parse for csv etc.", long_description=long_description, ...
""" Internal tasks for redhat downstream builds """ import contextlib import logging import requests from tempfile import NamedTemporaryFile from teuthology.parallel import parallel from teuthology.orchestra import run from teuthology.task.install.redhat import set_deb_repo log = logging.getLogger(__name__) @contex...
import sys import os import getpass import xml.etree.ElementTree as ET import Alfred handler = Alfred.Handler(sys.argv, use_no_query_string=False) f = open("mountainduck_settings_folder.txt", "r") settings_folder = f.read() # remove the \n settings_folder = settings_folder[:-1] f.close() settings_folder = settings_...
import torch import misc.utils as utils import numpy as np from misc.rewards import init_scorer, get_self_critical_reward, get_arsk_loss_cuda class LossWrapper(torch.nn.Module): def __init__(self, model, opt): super(LossWrapper, self).__init__() self.opt = opt self.model = model if ...
from .utils import NamespacedClient, query_params, _make_path class CatClient(NamespacedClient): @query_params('h', 'help', 'local', 'master_timeout', 'v') def aliases(self, name=None, params=None): """ `<http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html>`_ :...
"""Test the bonus mode.""" import os import time from unittest.mock import mock_open, patch from mpf.file_interfaces.yaml_interface import YamlInterface from mpf.core.data_manager import DataManager from mpf.tests.MpfTestCase import MpfTestCase class TestDataManager(MpfTestCase): def getConfigFile(self): ...
import bpy from .... base_types import AnimationNode from .... algorithms.mesh_generation.cylinder import getCylinderMesh class CylinderMeshNode(bpy.types.Node, AnimationNode): bl_idname = "an_CylinderMeshNode" bl_label = "Cylinder Mesh" def create(self): self.newInput("Float", "Radius", "radius",...
import os import random import numpy as np import torch import matplotlib.pyplot as plt from PIL import Image, ImageDraw from scipy.spatial.transform import Rotation as R import copy import cv2 import io from matplotlib import cm import math from math import pi import imageio from skimage.morphology import convex_hul...
import json import os.path as osp import tempfile import torch from mmocr.datasets.ner_dataset import NerDataset from mmocr.models.ner.convertors.ner_convertor import NerConvertor def _create_dummy_ann_file(ann_file): data = { 'text': '彭小军认为,国内银行现在走的是台湾的发卡模式', 'label': { 'address': {...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2018 by ShabaniPy Authors, see AUTHORS for more details. # # Distributed under the terms of the MIT license. # # The full license is in the file LICENCE, distributed with this software. # ----------------...
# -*- coding=utf -*- from __future__ import absolute_import from ...server.logging import RequestLogHandler, REQUEST_LOG_ITEMS from sqlalchemy import create_engine, Table, MetaData, Column from sqlalchemy import Integer, Sequence, DateTime, String, Float from sqlalchemy.exc import NoSuchTableError from ...browser imp...
# -*- coding: utf-8 -*- ''' @Time : / @Author : Yanyuxiang @Email : yanyuxiangtoday@163.com @FileName: / @Software: PyCharm ''' import pickle import os def main_func(dir_path, dump_path): train_path = os.path.join(dir_path, 'train_split_0.pkl') test_path = os.path.join(dir_path, 'test_split_0.pkl') ...
import copy import json import logging import os import pathlib import typing as t import zlib import enforce import quantities as pq import requests import websocket import numpy as np from django.conf import settings from pygeppetto_gateway import helpers from pygeppetto_gateway.interpreters import core, helpers as...
from sklearn.decomposition import PCA from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.metrics import f1_score def PCA_train_predict_score(X, y, k, random_state=42): """ Function to perform PCA and generate model to check performanc...
#!/usr/bin/env python import yaml import re class MyDumper(yaml.Dumper): def increase_indent(self, flow=False, indentless=False): return super(MyDumper, self).increase_indent(flow, False) with open("environment.yml", "r") as stream: try: print(type(stream)) #print(yaml.saf...
from rename_to_project_and_finish.appliances.fridge import Fridge from rename_to_project_and_finish.appliances.laptop import Laptop from rename_to_project_and_finish.appliances.tv import TV from rename_to_project_and_finish.rooms.room import Room class YoungCoupleWithChildren(Room): def __init__(self, family_name...
import matplotlib import os if os.system != "nt": #pragma: no cover matplotlib.use("Agg")
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...
# https://www.hackerrank.com/challenges/ctci-ransom-note/problem #!/bin/python3 import math import os import random import re import sys from collections import defaultdict # # Complete the 'checkMagazine' function below. # # The function accepts following parameters: # 1. STRING_ARRAY magazine # 2. STRING_ARRAY n...
# coding: utf-8 import sys import os import numpy import cv2 # empty data batch class for dynamical properties class DataBatch: pass def NMS(boxes, overlap_threshold): ''' :param boxes: numpy nx5, n is the number of boxes, 0:4->x1, y1, x2, y2, 4->score :param overlap_threshold: :return: ''' ...
import PyPDF2 from os import path, listdir, getcwd from q1_create_n_gram import create_n_gram from q2_entropy import entropy from q3_conditional_entropy import conditional_entropy from q4_joint_entropy import joint_entropy from q5_mutual_information import mutual_information from q6_min_max_entropy import compute_min_...
import torch import torchvision.transforms as transforms import model from PIL import Image import sys DIR="data/models/" MODEL="model-100-epochs-adam-0003-lr-cpu.pth" def get_model(PATH, model): device = torch.device('cpu') model.load_state_dict(torch.load(PATH, map_location=device)) model.eval() re...
# -*- coding: utf-8 -*- """ sphinx.writers.texinfo ~~~~~~~~~~~~~~~~~~~~~~ Custom docutils writer for Texinfo. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import textwrap from os import path from docutils import nodes, wri...
import shutil import sys import os import subprocess import redis from includes import * from RLTest import Env ''' python -m RLTest --test tests_onnx.py --module path/to/redisai.so ''' def test_onnx_modelrun_mnist(env): if not TEST_ONNX: env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getfram...
# pylint: disable=W0611 # flake8: noqa from pandas.core.sparse.array import SparseArray from pandas.core.sparse.list import SparseList from pandas.core.sparse.series import SparseSeries from pandas.core.sparse.frame import SparseDataFrame
############################################################################### ## ## Copyright (C) 2011-2014 Tavendo GmbH ## ## 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 ## ## h...
# Copyright 2011-2014 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 wri...
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Continuum-normalization. """ from __future__ import (division, print_function, absolute_import, unicode_literals) __all__ = ["normalize", "sines_and_cosines"] import numpy as np import os from warnings import warn def _continuum_design_matr...
__author__ = 'luigolas' import sys import ast from PyQt4 import QtGui import os from package import feature_extractor from package.image import CS_HSV, CS_BGR, CS_IIP import package.execution as execution from package.dataset import Dataset from package.post_ranker import SAA, LabSP, SAL import package.feature_matcher...
# Copyright 2018 Stanford University # # 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 writi...
# -*- coding: utf-8 -*- """ Copyright 2005 Spike^ekipS <spikeekips@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 Foundation; either version 2 of the License, or (at your option) any later versi...
# https://www.codewars.com/kata/sum-of-positive/python def positive_sum(arr): return sum([x for x in arr if x > 0])
""" WSGI config for Gachon_Bus_Backend 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/2.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('D...
from resources import BaseResource from documentation.namespaces import user_ns from documentation.models import upload_parser, post_response from accessors import UserAccessor from resources.auth_resource import requires_auth @user_ns.doc(security='apiKey') @user_ns.route('/uploads') class UserUploads(BaseResource):...
#!/usr/bin/env python # -*- coding: utf-8 -*- # the above line is to avoid 'SyntaxError: Non-UTF-8 code starting with' error ''' Created on Course work: @author: raja Source: https://pypi.org/project/sqlphile/ ''' # Import necessary modules import sqlphile as sp def startpy(): with sp.sqlite3 (r"test.db"...
from .batchnorm import _BatchNorm from .. import functional as F class _InstanceNorm(_BatchNorm): def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=False, track_running_stats=False): super(_InstanceNorm, self).__init__( num_features, eps, momentum, affine, track_...
""" helloworld.py Author: kyDoleuc04 Credit: I did this all by myself. Assignment: Write and submit a Python program that prints the following: Hello, world! """ print("Hello, world!")
from numpy.core.arrayprint import printoptions import pygame import numpy as np class grid(): def __init__(self, screen): self.screen = screen self.column = 10 self.row = 10 self.rows_height = self.screen.get_height()/self.row self.rows_witdh = self.screen.get_height()/se...
import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'setCapabilities' try: caps = rrPython.setCapabilities('aaa') if str(caps) is not False: result = 'True' else: result = 'False' except: result = 'False' PythonTestResults = open('C:\\Road...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy from scrapy.item import Item, Field class TbpScraperItem(scrapy.Item): # define the fields for your item here like: year = Field() professor...
import numpy as np import numpy.testing as npt import dkmri SEED = 123 params = np.array( [ 7.90764792, 0.88660664, 0.82186469, 0.81741033, 0.25016042, 0.12341918, 0.28344717, 0.97744794, 0.64809536, 0.54047796, 0.09333558, ...
''' Created on Nov 16, 2016 @author: Drew ''' from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from direct.interval.IntervalGlobal import * from direct.task.Task import Task from otp.ai.MagicWordGlobal import * from panda3d.core import * from toontown.distributed import ToontownDis...
import geopandas as gpd import pandas as pd from shapely.geometry import Polygon,Point import math import numpy as np def rect_grids(bounds,accuracy = 500): ''' 生成研究范围内的方形栅格 输入 ------- bounds : List 生成范围的边界,[lon1,lat1,lon2,lat2] (WGS84坐标系) 其中,lon1,lat1是左下角坐标,lon2,lat2是右上角坐标 accuracy...
import subprocess import json import atexit import jsonschema import psutil import sys import random import time import datetime import os class Execution: """ This class represents a single execution of a model with a given set of hyper-parameters. It takes care of of managing the model process a...
""" This puzzle is based on: https://en.wikipedia.org/wiki/Chinese_remainder_theorem Reddit told me after I waited for a long long time burning my computer... """ import sys from typing import Tuple def find_bus_cadence(bus: int, cadence: int, start_time: int, offset: int) -> Tuple[int, int]: timestamp = star...
import io import pytest from django.core.management import call_command from django.core.management.base import CommandError prune_assignments = [ ('guest', "['owner', 'guest', 'author', 'manager']", [6]), ('author', "['owner', 'author', 'manager']", [6, 9]), ('manager', "['owner', 'manager']", [6, 8, 9])...
import spacy # Defina o componente customizado def length_component(doc): # Calcule o tamanho do doc doc_length = len(doc) print(f"This document is {doc_length} tokens long.") # Retorne o doc return doc # Carregue o modelo pequeno do idioma inglês nlp = spacy.load("en_core_web_sm") # Adicione o ...
def provider(repo_provider, repo_name, user_name, gitlab_addr=None, repo_branch='master'): """Interface for git providers Used to check which provider is being used Args: repo_provider: Repository provider (Github, GitLab) repo_name: Repo...
from django.shortcuts import render from django.http import HttpResponseRedirect from django.contrib.auth.models import User from django.contrib.auth import authenticate, login from .forms import LoginForm, RegistrationForm from django.contrib import messages from django.views.generic import TemplateView class IndexV...
""" __kiltera_backward2trace_MDL.py_____________________________________________________ Automatically generated AToM3 Model File (Do not modify directly) Author: levi Modified: Tue Jan 27 12:00:37 2015 ____________________________________________________________________________________ """ from stickylink import * fr...
from django.shortcuts import render, redirect from .forms import diarista_form from .models import Diarista # Create your views here. def cadastrar_diarista(request): if request.method == "POST": form_diarista = diarista_form.DiaristaForm(request.POST, request.FILES) if form_diarista.is_valid(): ...
import logging from newrelic.agent import (FunctionTrace, callable_name, function_wrapper, wrap_function_wrapper) from .util import retrieve_current_transaction, NoneProxy _logger = logging.getLogger(__name__) try: # sys._getframe is not part of the python spec and is not guaranteed to # exist in all pyt...
# neuronal network connection functions import numpy as np # def gid2pos (numc, startgid, gid): nrow = ncol = int(np.sqrt(numc)) y = int((gid - startgid) / nrow) x = (gid - startgid) % ncol return (x,y) def prob2conv (prob, npre): # probability to convergence; prob is connection probability, npre is number ...