text
stringlengths
3.07k
22.1k
from setuptools import setup import sys import os import imp from setuptools import Extension import platform use_skbuild = len(os.environ.get('VAEX_BUILD_SKBUILD', '')) > 0 if use_skbuild: from skbuild import setup import skbuild.command.build_ext on_rtd = os.environ.get('READTHEDOCS', None) == 'True' dirn...
''' ## config_enable What it does: Enables AWS Config. This DOES NOT create config rules. It only turns on the configuration recorders. Usage: AUTO: config_enable bucket_name=mybucketlogs bucket_region=us-west-1 include_global_resource_types_region=us-west-1 Limitations: none Variables (and their defaults): buc...
""" Created on Jun 11, 2013 @author: agross """ import pandas as pd import numpy as np def to_date(s): """ Pulls year, month, and day columns from clinical files and formats into proper date-time field. """ try: return pd.datetime(int(s['yearofformcompletion']), ...
import itertools import numpy as np # from collections import defaultdict """ What, Where. """ class DiscreteStateSpace: ''' Discrete State Space specification class Note: Designed to handle any dimensionality but dim > 2 is not tested. ''' def __init__(self, *args): self.n_dims = len(args) ...
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase class BytearrayTests(TranspileTestCase): def test_setattr(self): self.assertCodeExecution(""" x = bytearray([1,2,3]) try: x.attr = 42 except...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from bisect import bisect_right from torch.optim.lr_scheduler import _LRScheduler import numpy as np from torch.optim.optimizer import Optimizer class ConstantScheduler(_LRScheduler): def __init__(self, optimizer, last_epoch=-1): supe...
# coding=utf-8 # Copyright 2017-2020 The THUMT Authors from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import torch from collections import namedtuple from thumt.utils.nest import map_structure def _merge_first_two_dims(tensor): shape = l...
# Copyright 2019 The Cirq Developers # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
# This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
import pytest from sinergym.simulators.eplus import EnergyPlus import xml.etree.ElementTree as ET import subprocess import threading import pkg_resources import signal import os def test_reset(simulator): assert not simulator._episode_existed output = simulator.reset() # Checking output assert outp...
import json from urllib.parse import urlencode from django.test import TestCase from data.tests.util import ViewTestCase from django.conf import settings from django.shortcuts import reverse from . import views from .templatetags import slack class SlackAPITests(ViewTestCase): def test_interaction_handler(self): ...
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
# -*- coding: utf-8 -*- # Copyright (c) 2019, <NAME> and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe import throw from frappe.utils import nowdate, flt, now from frappe.utils import formatdate, encode from frappe....
# Imports import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf import zipfile import cv2 import numpy as np import csv import time from collections import defaultdict from io import StringIO from matplotlib import pyplot as plt from PIL import Image # Objec...
# ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following condi...
# Copyright © 2019 Splunk, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"): you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # [http://www.apache.org/licenses/LICENSE-2.0] # # Unless required by applicable law or agreed to in writing,...
#!/usr/bin/env import re def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("subject", help="text left.", type=str) parser.add_argument("status", help="text right.", type=str) parser.add_argument("color", help="color right.", type=str) parser.add_argument("--s...
import numpy as np import lsst.pex.config as pexConfig import lsst.afw.image as afwImage import lsst.afw.math as afwMath import lsst.pipe.base as pipeBase import lsst.pipe.base.connectionTypes as cT from .eoCalibBase import (EoAmpPairCalibTaskConfig, EoAmpPairCalibTaskConnections, EoAmpPair...
from django.core.exceptions import PermissionDenied from django.conf import settings from dojo.request_cache import cache_for_request from dojo.authorization.roles_permissions import Permissions, Roles, get_roles_with_permissions from dojo.models import Product_Type, Product_Type_Member, Product, Product_Member, Engage...
import pytest from unittest.mock import Mock, patch import os import numpy.testing as npt from paths_cli.compiling.core import * from paths_cli.compiling import compiler_for from paths_cli.tests.compiling.utils import mock_compiler class MockNamedObject: # used in the tests for CategoryCompiler._compile_dict an...
# 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 # d...
import matplotlib.pyplot as plt import numpy as np import scipy.constants as scpc def ev_to_lambda(ev): """Convert photon energies from eV to a wavelength in nm.""" wavelength = ((scpc.h * scpc.c) / (ev * scpc.electron_volt)) * 10e8 return wavelength def lambda_to_ev(lambda_float): """Convert photon...
import os from comet_ml import Experiment import tensorflow as tf import tensorflow_probability as tfp from tensorflow.keras.datasets import mnist from load_dataset import MNISTSequence import matplotlib matplotlib.use('Agg') # backend model from matplotlib import figure # pylint: disable=g-import-not-at-top from matp...
""" Implement -f aka looponfailing for pytest. NOTE that we try to avoid loading and depending on application modules within the controlling process (the one that starts repeatedly test processes) otherwise changes to source code can crash the controlling process which should best never happen. """...
import requests # 获取文件 from lxml import etree # 分析HTML import time # 用于暂停一段时间 import random # 随机数生成 import os # 调用系统功能 from selenium import webdriver # 自动操作工具webdriver root = os.getcwd() + '/' # 这里加上’/‘是为了后面方便 if not os.path.exists(root + 'bilibili/'): os.mkdir(root + 'bilibili/') if not os.path.exists(root...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Optional, Union, Set import warnings import numpy as np from scipy import stats from ..instrumentation...
#!/usr/bin/env python """ glob_.py """ try: import libc except ImportError: from benchmarks import fake_libc as libc from osh.meta import glob as glob_ast from core import util log = util.log glob_part_e = glob_ast.glob_part_e def LooksLikeGlob(s): """ TODO: Reference lib/glob / glob_pattern functions in...
import parseboard import unittest import AlphaGo.go as go from AlphaGo.go import GameState from AlphaGo.util import flatten_idx class TestKo(unittest.TestCase): def test_standard_ko(self): gs = GameState(size=9) gs.do_move((1, 0)) # B gs.do_move((2, 0)) # W gs.do_move((0, 1)) ...
import json import logging import typing from copy import copy from dataclasses import dataclass, field, replace from pathlib import Path from typing import Any, Dict, List, Optional @dataclass(frozen=True) class SelectedStrategy: name: str args: List[str] = field(default_factory=list) def with_args(self...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 0.5.0.5149 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2015-07-06. # 2015, SMART Health IT. from . import codeableconcept from . import domainresource from . import fhirdate from . import fhirelement from . import fhirreference fr...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# -*- coding: utf-8 -*- """ The Global type definition for CPHD 0.3. """ from typing import Union, List import numpy from sarpy.io.phase_history.cphd1_elements.base import DEFAULT_STRICT # noinspection PyProtectedMember from sarpy.io.complex.sicd_elements.base import Serializable, _FloatDescriptor, \ _DateTimeDe...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' To highlight occurences of the word "Assumptions" run this in your VIM :- :match Todo /Assumptions/ ''' # Dataset credits :- http://www3.dsi.uminho.pt/pcortez/Downloads.html # Dataset credits :- https://archive.ics.uci.edu/ml/datasets/Student+Performance ##########...
# Copyright (c) 2021 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 appli...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. import contextlib import sys import threading import ptvsd.log from ptvsd import wrapper, options, multiproc from ptvsd.socket import ( close_socket, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: set autoindent smartindent sts=4 ts=4 sw=4 noet: __author__ = "<NAME>" __copyright__ = "2015 <NAME> (assarbad.net), under Public Domain/CC0, or MIT/BSD license where PD is not applicable" __version__ = "0.1" import os, sys # Checking for compatibility with Python ve...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # 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/l...
import os import logging import pandas as pd import numpy as np import urllib.request import requests import re import io import zipfile import json from pyseir import OUTPUT_DIR DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data') def load_zip_get_file(url, file, decoder='utf-8'): ...
## This file is part of Scapy ## See http://www.secdev.org/projects/scapy for more informations ## Copyright (C) <NAME> <<EMAIL>> ## This program is published under a GPLv2 license """ Clone of Nmap's first generation OS fingerprinting. """ import os from scapy.data import KnowledgeBase from scapy.config import conf...
""" Find minimum of a function (in 2D) """ import numpy as np import random as rdm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter plt.rcParams['text.usetex']=True plt.rcParams['text.latex.preamble'...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2018, <NAME> <<EMAIL>> # Based on code: # (c) 2013, <NAME> <<EMAIL>> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {...
#!/usr/bin/python # -*- coding: utf-8 -*- # Hive Netius System # Copyright (c) 2008-2020 Hive Solutions Lda. # # This file is part of Hive Netius System. # # Hive Netius System is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by the Apache # Foun...
import os import shutil import tempfile from importlib.util import find_spec from pathlib import Path import matplotlib import pytest import yaml from packaging.version import Version from yt.config import ytcfg from yt.utilities.answer_testing.testing_utilities import ( _compare_raw_arrays, _hash_results, ...
# Copyright 2018-2019 <NAME>, <NAME>, <NAME> # <NAME> # # This file is part of WarpX. # # License: BSD-3-Clause-LBNL import os, shutil, re, copy import pandas as pd import numpy as np import git # import cori # import summit # Each instance of this class contains information for a single test. class test_element(): ...
# Copyright 2020 Huawei Technologies Co., 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 agreed to...
""" setup filters """ # Copyright (C) 2020 by UsergeTeam<EMAIL>, < https://github.com/UsergeTeam >. # # This file is part of < https://github.com/UsergeTeam/Userge > project, # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > # # All rights ...
from .name2idx import C, V class DifferentialEquation(object): """Kinetic equations""" def __init__(self, perturbation): super(DifferentialEquation, self).__init__() self.perturbation = perturbation def diffeq(self, t, y, *x): dydt = [0] * V.NUM dydt[V.MP] = ( ...
import logging from datetime import datetime from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Location, ChatAction, ParseMode from telegram.ext import (Updater, CommandHandler, MessageHandler, CallbackQueryHandler, TypeHandler, Filters, ConversationHandler) from bot.telegramcal...
# # SecretSharing.py : distribute a secret amongst a group of participants # # =================================================================== # # Copyright (c) 2014, Legrandin <<EMAIL>> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provi...
# ------------------------------------------------------------------------------ # Adapted from https://github.com/princeton-vl/pose-ae-train/ # Original licence: Copyright (c) 2017, umich-vl, under BSD 3-Clause License. # ------------------------------------------------------------------------------ import numpy as n...
import clr import time from System.Reflection import Assembly dynamoCore = Assembly.Load("DynamoCore") dynVersion = dynamoCore.GetName().Version.ToString() dynVersionInt = int(dynVersion[0])*10+int(dynVersion[2]) class WorksharingLog: def __init__(self, version, sessions): self.Version = version self.Sessions = ...
# 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 -*- """Installer script for Pywikibot 3.0 framework.""" # # (C) Pywikibot team, 2009-2019 # # Distributed under the terms of the MIT license. # from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys from setuptools import f...
import unittest from algorithms.linkedlist import ( reverse_list, reverse_list_recursive, is_sorted, remove_range, swap_pairs, rotate_right, is_cyclic, merge_two_list, merge_two_list_recur, is_palindrome, is_palindrome_stack, is_palindrome_dict, RandomListNode, copy_random_pointer_v...
""" The `compat` module provides support for backwards compatibility with older versions of Django/Python, and compatibility wrappers around optional packages. """ # flake8: noqa from __future__ import unicode_literals import inspect import django from django.apps import apps from django.conf import settings from dj...
""" MIT License Copyright (c) 2020 DashIO-Connect 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...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import datetime import logging import numpy as np import io import os import gzip import pickle import shutil import tempfile import time import uuid # Note: avoid introducing unnecessary librar...
import pandas as pd from typing import Callable, List, Union, Dict import plotly.graph_objects as go from .calculations._helper import * from .calculations._functional import _functionaldepth, _samplefunctionaldepth from .calculations._pointcloud import _pointwisedepth, _samplepointwisedepth from .abstract import Abs...
import argparse import os import shutil import time import torch import torch.nn.functional as F # Import from local helper file from helper import parse_cmdline_args from helper import compute_mae_and_rmse from helper import get_dataloaders_fireman # Argparse helper parser = argparse.ArgumentParser( formatter_...
from typing import MappingView import numpy as np import torch def display_metrics_name(metrics_name): if metrics_name == 'crps': return "QSm" elif metrics_name == 'logs': return "NLL" elif metrics_name == "mace": return "MACE" elif metrics_name == "is90": return "IS90" ...
import json from collections import defaultdict import requests from django.conf import settings from django.http import Http404, HttpResponse, JsonResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from django....
#!/usr/bin/env python # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import os import platform import subprocess import...
# Copyright 2014 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...
import copy import csv import tempfile from django.conf import settings from django.shortcuts import reverse from django.test import TestCase, override_settings from openpyxl import Workbook from rest_framework import status from rest_framework.test import APIClient from main.models import Dataset, Record from main.t...
# Some code in this file is from # https://github.com/ionelmc/python-remote-pdb/blob/07d563331c4ab9eb45731bb272b158816d98236e/src/remote_pdb.py # (BSD 2-Clause "Simplified" License) import errno import inspect import json import logging import os import re import socket import sys import uuid from pdb import Pdb impor...
#!/usr/bin/python import sys import argparse import os import math import bisect import cv2 import numpy as np import csv from csv import DictReader sys.path.insert(0, './markers') from detect import transform from detect import getKnownMarkers gShowReference = True gWaitTime = 1 gFrameSkipCount=120 gShowPupilLabsE...
# SPDX-License-Identifier: MIT # Copyright (C) 2018-present iced project and contributors import copy import pytest from iced_x86 import * from typing import Any, Callable @pytest.mark.parametrize("bitness", [16, 32, 64, 0, 15, 128]) def test_invalid_bitness(bitness: int) -> None: data = b"\x90" if bitness in (16, ...
# # Copyright (c) 2015-2021 <NAME> <tflorac AT ulthar.net> # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE...
""" Copyright 2020 The OneFlow 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 applicable law or agr...
"""Peachy Geometry Geometric shape representations. The majority of these shapes are for convenience, except for Rect which is used extensively throughout peachy (a primary example being peachy.Entity). """ import copy import enum import math class ShapeEnum(enum.IntEnum): CIRCLE = 1 LINE = 2 POINT = 3 ...
# -*- coding: utf-8 -*- # # Cipher/AES.py : AES # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # n...
# Lint as: python2, python3 # Copyright 2019 Google LLC. 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 req...
import jax import jax.numpy as jnp @jax.jit def get_drhodT(salt, temp, p): rho0 = 1024.0 z0 = 0.0 theta0 = 283.0 - 273.15 grav = 9.81 betaT = 1.67e-4 betaTs = 1e-5 gammas = 1.1e-8 zz = -p - z0 thetas = temp - theta0 return -(betaTs * thetas + betaT * (1 - gammas * grav * zz * ...
"""takes select soscillatorArray: "osc" instance from model.py and constructs plot """ import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import StrMethodFormatter from lib.plotformat import setup import re import numpy as np np.set_printoptions(precision=3, suppress=True) from scipy.int...
""" Baseline that use early stopping """ import pickle import dgl import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import scipy.sparse as sp import random from dgl.data import CoraGraphDataset, PubmedGraphDataset, CiteseerGraphDataset import dgl.data from argparse import ArgumentPa...
# Modified work: # ----------------------------------------------------------------------------- # Copyright (c) 2015 Preferred Infrastructure, Inc. # Copyright (c) 2015 Preferred Networks, Inc. # ----------------------------------------------------------------------------- # Original work of _roi_pooling_slice, forwa...
""" plot data from isingWorm2d.py """ from __future__ import division, print_function import cPickle as pickle # for reading/writing data to text files. import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider from matplotlib import rcParams # for turning off legend frame from scipy impo...
"""Tests for the roboto.datautil module.""" from dataclasses import dataclass, field from enum import Enum from typing import Any, List, NewType, Optional from pytest import raises from roboto.datautil import ( JSONConversionError, from_dict, from_json_like, from_list, renames, to_json_like, )...
# Copyright 2021 PCL & PKU # 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...
# encoding: utf-8 """lxml custom element classes for shape-tree-related XML elements.""" from __future__ import absolute_import, division, print_function, unicode_literals from pptx.enum.shapes import MSO_CONNECTOR_TYPE from pptx.oxml import parse_xml from pptx.oxml.ns import nsdecls, qn from pptx.oxml.shapes.autosh...
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import glob import os import shutil import sphinx_rtd_theme from sphinx_gallery.scrapers import figure_rst from sphinx_gallery.sorting import FileNameSortKey # -*- coding: utf-8 -*- # # NumPyro Tutorials documentation build configur...
# Copyright (C) 2012 Midokura Japan K.K. # Copyright (C) 2013 Midokura PTE LTD # 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.or...
# 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...
""" Platform for Ecobee Thermostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/climate.ecobee/ """ import logging import voluptuous as vol from homeassistant.components import ecobee from homeassistant.components.climate import ( DOMAIN, STATE...
import logging import operator import pytest import random from tests.common.mellanox_data import get_platform_data from tests.common.utilities import wait_until from tests.platform_tests.thermal_control_test_helper import * from mellanox_thermal_control_test_helper import MockerHelper, AbnormalFanMocker from tabulate ...
""" 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 use this ...
"""SLICY solver example. Example puzzle can be found at https://www.gmpuzzles.com/blog/2015/02/slicy-thomas-snyder/. """ from collections import defaultdict from z3 import And, If, Implies, Int, Or, PbEq import grilops import grilops.regions from grilops.geometry import Point, PointyToppedHexagonalLattice, Vector fr...
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Agents for handling the generation aspects of Wizard. """ from itertools import chain from functools import lru_cache...
""" Basic unit tests for axographio This module contains the tests (and doctest wrappers) for the axographio module. """ import doctest import inspect import unittest import numpy as np import os.path import pkg_resources import os import tempfile import copy import axographio example_files = { 'old_digitized_f...
import json import itertools from pathlib import Path from typing import List, TypeVar, Dict from datetime import datetime as dt Option = TypeVar('Option', str, int) class Bid(): def __init__(self, hash_id: str, user, options: Dict[str, Option], accepted: bool, created_at: float): self.hash_id = hash_id ...
import cv2 as cv,numpy as np, copy, time #from sklearn.cluster import KMeans from matplotlib import pyplot as plt import code_t as cd ############### blocksize =[8,8] Q_m=np.float32( [[ [16,11,10,16,24,40,51,61], [12,12,14,19,26,58,60,55], [14,13,16,24,40,57,69,56], [14,17,22,29,...
from typing import Callable, Sequence, Union, Tuple, List, Optional import os import time import numpy as np import matplotlib import matplotlib.pyplot as plt from qcodes.dataset.measurements import Measurement from qcodes.instrument.base import _BaseParameter from qcodes.dataset.plotting import plot_by_id from qcode...
import asyncio from collections import OrderedDict from functools import wraps from itertools import zip_longest import hashlib import logging import pickle import random import socket logger = logging.getLogger(__name__) def remote(func): ''' Indicates that this instance method defines a remote procedure c...
""" process.py Read the raw datafiles from the '/raw' folder, transform them to a shared suitable format and place them in the '/process' sub-folder. Decisions made - Foundation2 is not taken into account since it is only a very small dataset which varies a lot between samples. Hence it is not worth the tim...
import numpy as np import numba as nb from neutralocean.traj import _ntp_bottle_to_cast @nb.njit def bfs_conncomp1(G, A, r): """ Find the Connected Component containing 1 reference location using Breadth-first Search Parameters ---------- G : ndarray of bool A 1D array of logicals. ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict from dataclasses import dataclass from enum import Enum, auto from threading import E...
"""Tests for acme.crypto_util.""" import itertools import socket import threading import time import unittest import six from six.moves import socketserver #type: ignore # pylint: disable=import-error import josepy as jose import OpenSSL from acme import errors from acme import test_util from acme.magic_typing imp...
# 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) import os import socket import llnl.util.tty as tty from spack import * def cmake_cache_entry(name, value, vtype=None)...
''' * applies sigmoid by default ''' # %% import pandas as pd from nna import visutils import datetime from pathlib import Path import numpy as np # %% # %% def setup_configs(args): pathmap = pathMap(args) config = {} id2name = {} versiontag = args.versiontag id2name={'1-0-0': 'biophony', ...
from torch import nn import torch import torch.nn.functional as F from torch.nn.parameter import Parameter class Scale(nn.Module): def __init__(self, init_value=1e-3): super().__init__() self.scale = nn.Parameter(torch.FloatTensor([init_value])) def forward(self, input): return input * s...