text stringlengths 3.07k 22.1k |
|---|
# Copyright 2022 (c) Crown Copyright, GC.
#
# 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) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Collect stats regularly via app engine cron.
"""
import calendar
import datetime
import json
import logging
import numpy
import webapp2
from google... |
import sys
import json
import codecs
import re
from pprint import pprint
pattern_divinity = re.compile(r".*\(Divinity[\s]?([0-9]+)\)")
traits = {
"ruler": [],
"basic ruler": [],
"jruler": [],
"basic jruler": [],
"resonator": [],
"addition": [],
"chant": [],
"magicstone": [],
"speci... |
import sqlite3
from bottle import route, run, debug, template, request, error, static_file, get, post, Bottle
app = Bottle()
@app.route('/sss')
def hello():
return "<p>hello</p>"
@route('/admin')
def journal_list():
conn = sqlite3.connect('journal.sql')
c = conn.cursor()
c.execute("SELECT id, task FR... |
import numpy as np
import argparse
import csv
import os
import glob
import datetime
import time
import logging
import h5py
import librosa
from utilities import (create_folder, get_filename, create_logging,
float32_to_int16, pad_or_truncate, read_metadata)
import config
def split_unbalanced_csv_to_partial_csvs(a... |
import pytz
from datetime import (
datetime,
time,
timedelta,
)
from gbe.functions import (
get_conference_day,
make_warning_msg,
validate_perms,
)
from django.shortcuts import (
get_object_or_404,
)
from django.urls import reverse
from gbe.scheduling.forms import (
EventBookingForm,
... |
import itertools
from numba.core import types
from numba.core.typeconv.typeconv import TypeManager, TypeCastingRules
from numba.core.typeconv import rules
from numba.core.typeconv import castgraph, Conversion
import unittest
class CompatibilityTestMixin(unittest.TestCase):
def check_number_compatibility(self, c... |
import logging
logger = logging.getLogger(__name__)
import copy
from weakref import WeakValueDictionary
from nymms import registry
from nymms.utils import commands
from nymms.config import yaml_config
from nymms.exceptions import MissingCommandContext
from jinja2 import Template
from jinja2.runtime import StrictUnd... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... |
import numpy as np
import pandas as pd
import numpy as np
import re
import numpy as np
import pandas as pd
import re
def get_matching_column_names(data, pattern):
"""Returns a subset of the columns whose names match the pattern.
Matching columns are columns whose names start
with the given pattern a... |
import json
import requests
from config.redisconfig import redis
from utils.cloud_discovery import CloudDiscovery
from cloud_detect import provider as detect_provider
from utils.constants import CLOUD_AZURE, CLOUD_GCP, CLOUD_AWS, CLOUD_OBJECT_STORAGE, CLOUD_LB, CLOUD_DB, \
SCOPE_TOPOLOGY_COUNT, CLOUD_SERVERLESS, ... |
from typing import Union
import unittest
from unittest import TestCase
import numpy as np
from numpy.core.numeric import array_equal
from e2cnn.group import *
from e2cnn.diffops import *
from e2cnn.kernels import EmptyBasisException
from e2cnn.diffops.utils import eval_polys
def psi(theta: Union[np.ndarray, float],
... |
# Copyright <NAME> 2019-2021.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import re
from typing import Sequence, Tuple
import bs4
import numpy as np
import pandas as pd
from scripts._extr... |
from operator import itemgetter, attrgetter
from query.models import Video
from esper.prelude import collect
from rekall.interval_list import Interval, IntervalList
def iterable_to_intrvllists(iterable, accessor, groupby="video_id", schema=None):
"""
Convert an iterable collection of rows to a collection of i... |
import torch
import numpy as np
from lib.config import cfg
import torch.nn.functional as F
def rotate_pc_along_y_torch(pc, rot_angle):
"""
:param pc: (N, 3 + C)
:param rot_angle: (N)
:return:
"""
cosa = torch.cos(rot_angle).view(-1, 1)
sina = torch.sin(rot_angle).view(-1, 1)
raw_1 = to... |
from math import ceil
from sklearn.pipeline import Pipeline
from matplotlib.pyplot import plot
from sklearn.preprocessing import MinMaxScaler, FunctionTransformer
import numpy as np
import pandas as pd
from IPython.core.display import display
import matplotlib.pyplot as plt
from tensorflow.keras.utils import to_categor... |
from pathlib import Path
import math
import sys
import time
from PIL import Image
import numpy as np
import torch
from . import utils
from ..data_utils import (
to_coco, from_coco, get_image_path, SEG_FP, scale_boxes)
from ..utils import print_metrics
from ..viz import visualize_boxes
from ..metric import score_b... |
# Author: <NAME>
# Date started: 16/03/2020
# Last updated: <08/05/2020 09:52:57 (BrianM)>
import numpy as np
import time
def default_PSO_params(params):
"""
This is to set the default PSO parameters. Note by default constriction will be applied over inertia weighting.
To prevent this, specify the ... |
# Keystone Python bindings, by <NAME> <<EMAIL>>
import sys
_python2 = sys.version_info[0] < 3
if _python2:
range = xrange
from . import arm_const, arm64_const, mips_const, sparc_const, hexagon_const, ppc_const, systemz_const, x86_const, evm_const
from .keystone_const import *
from ctypes import *
from platform im... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope tha... |
########################################################
# FUNCTION TO COMMUNICATE WITH BACKEND - YOLO AND KG
#
########################################################
from typing import ChainMap
from py2neo.data import Record
from Neo4j import neo
from Conversation import Conversation
USERS = {}
def browse_randomd... |
"""Tests for receptive field module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tenso... |
from __future__ import absolute_import
from __future__ import unicode_literals
from unittest import TestCase
import json
from six.moves.urllib.parse import urlparse
from os import environ as env
import httmock
from httmock import urlmatch
from evesrp import create_app, db, init_app
from evesrp.auth import AuthMethod
fr... |
from django.shortcuts import render
from django.shortcuts import redirect
from django.http import Http404
from django.http import HttpResponse
from .models import Posts
from .models import Comments
from .models import UserData
from .models import PostImageCollection
from .forms import *
from django.contrib.auth imp... |
#!/usr/bin/env python3
# coding: utf-8
#from multiprocessing import Pool, Process, Value
import sys
import os
from time import sleep
import threading
from time import sleep
import argparse
from ev3dev2.motor import OUTPUT_A, OUTPUT_B, OUTPUT_C
from ev3dev2.sensor import INPUT_1, INPUT_3, INPUT_4
from ev3dev2.motor imp... |
from statistics import STATISTICS
from history import History
from simulator import Status, PHASE
from utils import Random, Infinity, LargeInteger
from node import VNode, QNode
from beliefstate import BeliefState
from testsimulator import TestSimulator
import numpy as np
class SearchParams:
Verbose = 0
MaxDep... |
import contextlib
import enum
import logging
import warnings
from collections import deque
from typing import Any
from typing import Callable
from typing import Deque
from typing import Dict
from typing import Generic
from typing import Iterator
from typing import Optional
from typing import Type
from typing import Typ... |
#
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in ... |
import sqlite3
import os
import disnake
from disnake import Option, OptionType
from disnake.ext import commands
from decouple import config, UndefinedValueError
import time
import datetime
from keep_alive import keep_alive
try:
tokens = {
'discord': config('DISCORD_API_TOKEN', cast=str),
'logs_channel': config('... |
from __future__ import absolute_import, division, print_function
import os, time
from libtbx import easy_run
from libtbx.test_utils import assert_lines_in_file
# QUESTION: if we try to change something that is not there shall we Sorry or
# do actualy change "nothing" with something that is provided?
# Depending on the... |
import argparse
import os
import sys
import time
import datetime
import logging
import json
import signal
from os.path import expanduser
from logging.handlers import *
from stat import *
import tornado.ioloop
import tornado.web
import tornado.websocket
from tornado import gen
SCRIPT_NAME = os.path.basename(__file__... |
########################################################################
##
## CS 101
## Program #7
## <NAME>
## <EMAIL>
##
## PROBLEM :
##
## 1. Simulate Orgeon Trail
## 2. Game ends when one of exit conditions met:
## a. All settlers dead
## b. Destination reached
## c. Run out of food
##
## ALGORITH... |
"""
Tests for Chandrasekhar recursions
Author: <NAME>
License: Simplified-BSD
"""
import numpy as np
import pandas as pd
from .results import results_varmax
from statsmodels.tsa.statespace import sarimax, varmax
from statsmodels.tsa.statespace.kalman_filter import (
MEMORY_CONSERVE, MEMORY_NO_LIKELIHOOD)
from num... |
# @Author: yican
# @Date: 2020-06-14 16:19:48
# @Last Modified by: yican
# @Last Modified time: 2020-06-30 10:11:22
# Standard libraries
import logging
import os
import pdb
import random
from argparse import ArgumentParser
from logging import Logger
from logging.handlers import TimedRotatingFileHandler
import shutil
... |
import torch
import torch.nn as nn
import math
class MatMul2D(nn.Module):
def __init__(self, transpose_b, name=None):
super(MatMul2D, self).__init__()
#PARAMS
self.transpose_b = transpose_b
self.name = name if name else 'mat_mul'
def forward(self, a, b):
if self.transpo... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
import os
import codecs
import uuid
import time
import logging
import shutil
from pathlib import Path
from threading import Thread
import docker
from docker.types import Mount
from docker.errors import ImageNotFound, BuildError, APIError, NotFound
from sandbox import settings
from sandbox.settings import LANG_CONFIG
... |
import os
import sys
import click
import subprocess
from pathlib import Path
from importlib import import_module
from .binding_generator import generate, write_api_pxd
HERE = Path(__file__).resolve(strict=True).parents[0]
ENVIRONMENT_VARIABLE = 'GODOPY_PROJECT_MODULE'
GODOT_EXE = 'godot.exe' if sys.platform == 'wi... |
"""
Functions:
1) _adc_spi_transform
2) _channel_transform
3) save
4) load
Classes:
1) _RegisterMap
2) _RegisterGroup
3) _GroupIterator
4) Registers
"""
from tes.base import VhdlEnum
from tes.maps import (
_Transport,
_map_str,
_to_onehot,
mca_map,
adc_map,
channel_map,
baseline_map,
... |
# Packet Test Framework imports
import logging
import ptf
import ptf.testutils as testutils
import scapy.layers.inet6 as inet6
import scapy.layers.l2 as l2
from ptf import config
from ptf.base_tests import BaseTest
from ptf.mask import Mask
Ether = l2.Ether
IPv6 = inet6.IPv6
RA = inet6.ICMPv6ND_RA
RS = inet6.ICMPv6ND... |
# Copyright (C) 2020 Intel Corporation
#
# 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... |
"""PLINK 1.9 reader implementation"""
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
import dask.array as da
import dask.dataframe as dd
import numpy as np
from bed_reader import open_bed
from dask.dataframe import DataFrame
from xarray import Dataset
from sgkit import create_genotype_c... |
import pystable
import pandas as pd
import numpy as np
from scipy import integrate
FILENAME = "data-1625069716_weth-usdc-twap"
FILEPATH = f"csv/{FILENAME}.csv" # datafile
T = 40 # 10m candle size on datafile
TC = 40 # 10 m compounding period
CP = 4 # 5x payoff cap
# uncertainties
ALPHAS = np.array([0.01, 0.025,... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
import itertools
from indra.statements import *
logger = logging.getLogger('graph_assembler')
try:
import pygraphviz
except ImportError:
logger.warning('Cannot use graph assembler because '
... |
from dcd.entities.thing import Thing
from dcd.entities.property import PropertyType, Property
from dotenv import load_dotenv
import os
import signal
from time import sleep
import datetime
import itchat
from googleplaces import GooglePlaces
import googlemaps
import sys
from imp import reload
reload(sys)
END_DATE1 = d... |
import numpy as np
from os.path import join
from joblib import Parallel, delayed
from struct import calcsize, unpack
import pandas as pd
template_types = {0: 'Noise', 1: 'SS', 2: 'SS_Contaminated', 3: 'SS_Putative', 4: 'MUA', 5: 'Unspesified_1',
6: 'Unspecified_2', 7: 'Unspecified_3'}
def load_ex... |
import json
import os
from rest_framework.views import APIView
from rest_framework.response import Response
from EDL import sensitivity_analysis, edl_data_mining, edl_db_loader
from auth_API.helpers import get_user_information
from EDL.models import EDLContextScorecards
from EDL.dialogue.dialogue_functions import crea... |
''' Text Generator '''
import random
import torch
from torch import nn
from .rnn import RNN, RNNStateAdaptor
from .attn import Attn
from ..utils import AttrDict
class ReviewHiRNN(nn.Module):
'''
Model review state as Hierarchical RNN
Inputs:
state: user-item vector used as the initial state for ... |
"""
Interpolation functions.
"""
import sys
import warnings
import numpy as np
import xarray as xr
import xgcm
import xroms
try:
import xesmf as xe
except ModuleNotFoundError:
warnings.warn("xESMF is not installed, so `interpll` will not run.")
def interpll(var, lons, lats, which="pairs"):
"""Interpo... |
"""Functions for writing project paths and potentially other
header files for various languages.
"""
import re
from waflib import Errors
from waflib import Node
from waflib import Task
from waflib import TaskGen
PROJECT_PATHS_PYTHON_DOCSTRING_IMPORTS = '''"""Define a dictionary *project_paths* with path
definitions... |
import logging
import os
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Max
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from djblets.db.... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 11:54:37 2020
@author: Xander
"""
import pandas as pd
import numpy as np
from os import listdir
#%%
def find_csv_filenames( path_to_dir, suffix=".csv" ):
filenames = listdir(path_to_dir)
return [ filename for filename in filenames if filename.... |
# -*- coding: utf-8 -*-
try:
import cups
except ImportError:
cups = None # CUPS is optional
import tempfile
import threading
import collections
import os.path as osp
import pygame
from PIL import Image
from xml.etree import ElementTree
try:
from http.server import HTTPServer, BaseHTTPRequestHandler
excep... |
from __future__ import division, print_function, absolute_import
import tensorflow as tf
import numpy as np
import timeit
from collections import deque
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
############################
# Neural Network Functions #
############################
#... |
"""Defines the `ExperimentConfig` abstract class used as the basis of all
experiments."""
import abc
import typing
from typing import Dict, Any, Optional, List, Union, Sequence, Tuple
import torch
import torch.nn as nn
from core.base_abstractions.preprocessor import ObservationSet
from core.base_abstractions.task im... |
import math
import numpy
import pytest
from mpmath import mp
import quadpy
from helpers import check_degree_1d
@pytest.mark.parametrize(
"scheme",
[quadpy.line_segment.midpoint()]
+ [quadpy.line_segment.trapezoidal()]
+ [quadpy.line_segment.clenshaw_curtis(k) for k in range(2, 10)]
+ [quadpy.lin... |
####################
# Import packages
####################
import matplotlib
import sys
from deap import base, creator, tools, algorithms
import pickle
import time as timeski
import os
import numpy as np
import matlab.engine
eng = matlab.engine.start_matlab() #start matlab engine
################################... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2017 - 2020, <NAME>, <<EMAIL>>, et al.
#
# This... |
def GetRoutes(area):
query = 'select distinct Route from [dimensions].[wells] WITH (NOLOCK) where [Area] = \'' + area + '\''
return query
def GetWells(area, route):
query = 'select distinct WellName from [dimensions].[wells] WITH (NOLOCK) where [Route] = \'' + route + '\' and [Area] = \'' + area ... |
import argparse
import logging
import os
from pathlib import Path
import cv2
import numpy as np
import torch
import pickle
from script_utils.common import common_setup
from tqdm import tqdm
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.demo.predictor import COCODemo
from maskrcnn_benchmark.utils.p... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<<EMAIL>>
# http://binux.me
# Created on 2014-12-08 22:23:10
import time
import logging
logger = logging.getLogger('bench')
from six.moves import queue as Queue
from pyspider.scheduler import Thread... |
## Features: Bert Word Embeddings
## ## Models: KD-Tree Search
import sys, os, io, time, string
from sklearn.neighbors import KDTree
from sklearn.metrics.pairwise import cosine_similarity
from sklearn import decomposition, ensemble, tree
from nltk.corpus import stopwords
from elasticsearch import Elasticsearch
imp... |
# %%
import glob
import shutil
from pathlib import Path
from subprocess import run
import configparser
# %%
def test():
# %%
p = '/cluster/home/sarambl/setup_case_py/case_inits/noresm2_pipd/LU2000/NF1850_aeroxid2014_LU2000_lospinup'
pa = Path(p)
print(pa.exists())
casename = pa.stem
path_folde... |
from __future__ import print_function, division
import os
import numpy as np
from astropy.io import fits
from .exceptions import TableException
from .helpers import smart_dtype, smart_mask
from .decorators import auto_download_to_file, auto_fileobj_to_file
standard_keys = ['XTENSION', 'NAXIS', 'NAXIS1', 'NAXIS2', ... |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... |
# SPDX-FileCopyrightText: 2020 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#!/usr/bin/env python3
from enum import Enum
import time
import tkinter
import adafruit_ble
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.device_info import D... |
'''An object-oriented wrapper around the DBS Interbank GIRO File Format.
Supports the `pickle` and `json` modules' loads()/dumps() interface.
The serialisation/deserialisation is based on the DBS Interbank GIRO File Format v1.7. This document is referred to later in the documentation as the 'specification'.
I am not... |
"""
Build ceph packages
Unit tests:
py.test -v -s tests/test_buildpackages.py
Integration tests:
teuthology-openstack --verbose --key-name myself --key-filename ~/Downloads/myself --ceph infernalis --suite teuthology/buildpackages
"""
import copy
import logging
import os
import types
from teuthology import packagi... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Author: <NAME> (<EMAIL>)
#
from __future__ import absolute_import, division, unicode_literals
... |
import re
# import xml.etree.ElementTree as ET
import pandas as pd
class AbstractedMetadata:
def __init__(self, metadata, product):
"""
Class for handling the abstracted metadata section of Sentinel-1 metadata
:param metadata: ElementTree object containing parsed .dim data
:para... |
from datetime import datetime, timedelta
import icalendar
import pytz
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrulestr
berlin_tz = pytz.timezone("Europe/Berlin")
gmt_tz = pytz.timezone("GMT")
def get_now():
return datetime.now(tz=berlin_tz)
def get_today():
now = get_no... |
# Copyright 2020 gRPC authors.
#
# 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... |
""" SINGAPORE GOV API FUNCTIONS """
import os
from datetime import datetime
from datetime import timedelta
import json
import requests
from haversine import haversine
import tweepy
consumer_key = str(os.environ.get('consumer_key'))
consumer_secret = str(os.environ.get('consumer_secret'))
access_token = str(os.environ... |
#@author: UgurHorasan
import random as rn
class Edge():
def __init__(self,s,t,weight):
self.s = s
self.t = t
self.weight = weight
self.phe = 1
def return_weight(self):
return self.weight
def __str__(self):
return "{} - {} = {}, phe = {}".for... |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
from mixbox.vendor import six
import cybox.bindings.cybox_common as common_binding
from cybox.common.attribute_groups import PatternFieldGroup
from cybox.common.... |
from .utils import differentiate_vec
from sklearn import linear_model
from scipy.linalg import expm
from numpy import array, concatenate, zeros, dot, linalg, eye, ones, std, where, divide, multiply, tile, argwhere, diag, copy, ones_like
from .basis_functions import BasisFunctions
from .learner import Learner
from .eki ... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import xarray as xr
import numpy as np
import warnings
import datetime
"""
Module for checking CF compliance of netcdf files or xarray Datasets.
The conventions are not coded in entirity, and are not coded perfectly. This may lead to both false positives and negatives.
e.g. 1: Only canonical units are coded, so ... |
import copy
import json
import logging
import os
import pickle
import random
import statistics
import sys
import time
import numpy as np
import torch
import yaml
from inclearn.lib import factory
from inclearn.lib import logger as logger_lib
from inclearn.lib import metrics, results_utils, utils
logger = logging.getL... |
"""user, purchase, store, sale, role, setting, product tables
Revision ID: 1d949b68b6d9
Revises:
Create Date: 2022-01-06 11:51:21.981915
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None
... |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
from layers import GlobalAttn
class Encoder(nn.Module):
"""Encoder.
Parameters
----------
num_categories: int
Number of num_categories to encoder.
embed_di... |
from google.appengine.ext import db, webapp
from google.appengine.api import mail, users
from datetime import datetime
import urllib
import re
from constants \
import EXTENSION_GALLERY, AUTHOR_EMAIL, \
BUG_DATABASE_NO_REPLY_EMAIL, ORIGIN
from util import render_template
class ExtensionsDatabase(db.Model):
name =... |
from __future__ import absolute_import
import psutil
import os
import datetime
import zlib
import json
import base64
import wmi
import win32evtlog
import win32con
import win32evtlogutil
import winerror
from time import sleep
import requests
import subprocess
import random
PROGRAM_DIR = "C:\\Program Files\\TacticalAgen... |
# Importar pacotes necessários
import numpy as np #Biblioteca de cálculos númericos do Python
import pandas as pd #Biblioteca de analise de dados
import matplotlib.pyplot as plt #Biblioteca de analise de dados e plotagem de gráficos
import seaborn as sns #Biblioteca auxiliar ou complementar de analise de dados e pl... |
# Copyright (c) 2019 PaddlePaddle 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 app... |
'''Unit tests for the datacube_zarr.zarr_io module.'''
import pytest
import numpy as np
import xarray as xr
from datacube_zarr.zarr_io import ZarrIO, replace_dataset_dim
from .utils import _check_zarr_files, _load_dataset, _save_dataset
@pytest.mark.parametrize("group", ["dataset1", "Dataset1"])
def test_save_data... |
from uuid import UUID
from pydantic import BaseModel
from typing import List, Optional
from fastapi import UploadFile,File
from datetime import date, datetime, time, timedelta
from .pydanticmodels import Create_PresMedicines, Create_Timings
from .models import AppointmentStatus, MedicineTypes, AddressCategory, Types
fr... |
from pip._internal.utils.misc import get_installed_distributions
if any(["cupy" in str(f) for f in get_installed_distributions()]):
import cupy as np
else:
import numpy as np
#import numpy as np
from poppy import zernike
from skimage import morphology
import logging
logger = logging.getLogger('aosat_logger')
... |
import argparse
import numpy as np
import sklearn
from parallelm.mlops import mlops as mlops
# use below import if user wants to user RegressionMetrics predefined metrics names.
from parallelm.mlops.metrics_constants import RegressionMetrics
from parallelm.mlops.stats.bar_graph import BarGraph
from sklearn.datasets im... |
import numpy as np
import shapely
from shapely.coords import CoordinateSequence
from shapely.geometry import LineString, Point, LinearRing
import pytest
def test_from_coordinate_sequence():
# From coordinate tuples
line = LineString(((1.0, 2.0), (3.0, 4.0)))
assert len(line.coords) == 2
assert line.... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2021 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... |
from common.contrail_fabric.ztp_base import ZtpBaseTest
from tcutils.wrappers import preposttest_wrapper
import time
class TestZtp(ZtpBaseTest):
def setUp(self):
for device, device_dict in list(self.inputs.physical_routers_data.items()):
if 'dc_gw' in (device_dict.get('rb_roles') or []):
... |
import os
import sys
import argparse
from tqdm import tqdm
import json
from sklearn.metrics import precision_score, recall_score, f1_score
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--mode', type=str, choices=['a', 'm'], default='a',
help='a - analysis... |
import exifread
import os
import datetime
from rtree import index
import pyproj
import csv
#converGPStoNYLISP
#converts GPS DMS coordinates to coordinates
#in the New York - Long Island State Plane Projection Coordinates
def convertGPStoNYLISPC (GPSLong,GPSLat):
degLong,degLat = convertGPStoDegLongLat(GPSLon... |
#!/usr/bin/env python3
#
# Copyright 2021 The Bazel 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 ... |
COPYRIGHT = """\
/*
* Copyright 2017 Intel Corporation
*
* 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, mod... |
#==============================
# Quantum Random Walk
#------------------------------
# Autore: <NAME>
#==============================
import math
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
#------------------------------
# 1: Quantum Random walk
#----------... |
# -*- coding: utf-8 -*-
"""
This module pre-processes the selected UCI dataset and then trains a TensorFlow or sklearn model
"""
import os
import numpy as np
import pandas as pd
import sklearn
import sklearn.ensemble
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Act... |
import ast
from ast import *
class JsOut:
def __init__(self):
self.buf = ""
self.ident = ""
def add(self, item):
for line in item.splitlines():
self.buf += "{}{}\n".format(self.ident, line)
def more_ident(self):
self.ident += '\t'
def less_ident(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.