text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/python3
# Author: DS, Synergy Information Solutions, Inc.
# Author: <NAME>, some schmuck who coded in haste
import time
import os
import threading
import logging
import yaml
import socket
import re
from hnmp import SNMP
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHand... |
"""Test cases for the helper methods."""
import numpy as np
import pytest
from jazzy.core import calculate_polar_strength_map
from jazzy.core import get_atom_and_nbrs_charges
from jazzy.core import get_atom_neighbours
from jazzy.core import get_charges_from_atom_list
from jazzy.core import get_charges_from_kallisto_mo... |
# coding: utf8
# copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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 requ... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import importlib
from pyhocon import ConfigFactory, ConfigTree
from typing import Any, Dict, Iterator, Optional
from databuilder.models.dashboard.dashboard_metadata import DashboardMetadata
from databuilder.models.dashboard.dashb... |
# Copyright 2020-present <NAME>
#
# 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 ... |
#
# See top-level LICENSE file for Copyright information
#
# -*- coding: utf-8 -*-
"""
This module contains code for collating multiple 1d spectra source object.
"""
import copy
import os.path
import numpy as np
from astropy.time import Time
import astropy.units as u
from astropy.coordinates import SkyCoord, Angle
f... |
#!/usr/bin/env python
#
# Indexes scans into csv file
# Run with ./index.py (or python index.py on Windows)
import argparse
import csv
import json
import re
import os
import sys
import logging
import util
import compute_timings as timings
from glob import glob
FORMAT = "%(asctime)-15s [%(levelname)s] %(message)s"
l... |
from yaferp.general import sparseFermions, fermions
#import commutator
#from commutator import multiplyPauli
#from commutator import multiplyPauliString
#from commutator import commutator
OPLIST_CUTOFF = 1e-12
from yaferp.orderings import directOrdering
'''
multiplyPauliLookup = { # try working this out when you're ... |
#! python3
"""
Tail implementation from https://github.com/tyz/slacktail
Discord.py library from https://github.com/Rapptz/discord.py
Basis for Discord communication from https://github.com/Rapptz/discord.py/blob/async/examples/background_task.py
"""
import argparse
import os
import discord
import asyncio
import re
i... |
# PyVision License
#
# Copyright (c) 2006-2008 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... |
#!/usr/bin/env python3
# coding=utf-8
# SPDX-FileCopyrightText: Copyright (c) 2022 <NAME> s-light.eu
#
# SPDX-License-Identifier: MIT
"""
`ansi_escape_code`
================================================================================
simple helper library for common ANSI escape codes
inspired / based on informat... |
#
# Copyright 2019 The FATE 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 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# -*- coding: utf-8 -*-
import numpy as np
import subprocess,os
def checkCEA(compiler='gfortran'):
"""
Check that all the fortran CEA codes have their
corresponding executables:
"""
cwd = os.getcwd()
os.chdir('CEA+FORTRAN')
if not os.path.exists('FCEA2'):
subprocess.Popen(compiler+... |
# Copyright 2022 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import os
import re
from colorama import Fore
from colorama import Back
from colorama import Style
def formatColor(string):
return(
string.replace("[GREEN]", Fore.GREEN)
.replace("[RED]", Fore.RED)
.replace("[DIM]", Style.DIM)
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from collections import defaultdict, deque
import os
import random
import sys
import gym
import numpy as np
import tensorflow as tf
from gym_puyopuyo.env import register
from gym_puyopuyo.util ... |
import os
import argparse
from utils import *
import torch.nn as nn
from tqdm import tqdm
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
from model_search import SuperNetwork
def get_args():
parser = argparse.ArgumentParser("MixPath")
parser.add_argument('--exp_name', type=str, requi... |
# Copyright (c) 2021, Technische Universität Kaiserslautern (TUK) & National University of Sciences and Technology (NUST).
# 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 __future__ import print_function
from __fut... |
# Copyright 2016 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 writing, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Ebuild function generator to migrate src_install into GN.
Default values follow the default values of e... |
from __future__ import unicode_literals
import logging
from django.contrib.auth import get_user_model
from django.test import TestCase
from mapstore2_adapter.utils import to_json
from mapstore2_adapter.converters import BaseMapStore2ConfigConverter
from mapstore2_adapter.plugins.geonode import GeoNodeMapSto... |
import itertools
import random
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from lcnn.config import M
### no line pre-featuress required
FEATURE_DIM = 0
class LineVectorizer(nn.Module):
def __init__(self, backbone):
... |
""" An extension of averager that supports common optimization use cases. """
from concurrent.futures import ThreadPoolExecutor
from contextlib import nullcontext
from itertools import chain
from threading import Event, Lock
from typing import Dict, Iterator, Optional, Sequence
import torch
from hivemind.averaging im... |
#!/usr/bin/env python3
# coding: utf-8
"""
.. module:: BuscoPlacer
:synopsis: BuscoPlacer implements methods required for automatically selecting the appropriate dataset
to be used during BUSCO analysis
.. versionadded:: 4.0.0
.. versionchanged:: 5.2.1
Copyright (c) 2016-2021, <NAME> (<EMAIL>)
Licensed under th... |
from textwrap import dedent
from unittest.mock import ANY
import pytest
from dnjs import parser as p
from dnjs import tokeniser as t
def parse(s: str) -> str:
statements = p.parse_statements(t.TokenStream.from_source(source=s))
return "\n".join(str(s) for s in statements)
def test_empty():
assert pars... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 2020
@author: <NAME> (@SergioMinuto90)
"""
from pandas.io.json import json_normalize
from abc import ABC, abstractmethod
import socceraction.vaep as vaep
import pandas as pd
import warnings
import os
warnings.simplefilter(action='ignore', cate... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
class SCNN(nn.Module):
def __init__(self, tom_size=32, in_chan=1, res=False, duse=False):
super(SCNN, self).__init__()
# encoder
self.e0_1 = nn.Conv3d(in_chan, 64, kernel_siz... |
# --------------------------------------------------------
# OpenVQA
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> https://github.com/nbgao
# --------------------------------------------------------
from openvqa.ops.fc import MLP
import torch
import torch.nn as nn
import torch.nn.funct... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 5 18:54:29 2019
@author: suvodeepmajumder
"""
import sys
sys.path.append("..")
from pygit2 import clone_repository
from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE,GIT_MERGE_ANALYSIS_UP_TO_DATE,GIT_MERGE_ANALYSIS_FASTFORWARD,GIT_MERGE_ANAL... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright ... |
import os
os.environ['KIVY_VIDEO'] = 'ffpyplayer'
os.environ['KIVY_AUDIO'] = 'sdl2'
import logging
import pyautogui
import pyautogui as pyautogui
import qrcode
import requests
import time
from datetime import datetime
from functools import partial
import kivy
from kivy.clock import Clock
from kivy.co... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright (c) 2021
#
# See the LICENSE file for details
# see the AUTHORS file for authors
# ----------------------------------------------------------------------
#--------------------
# System wide imports
# ----------... |
""" Python Character Mapping Codec generated from 'CP862.TXT' with gencodec.py.
Written by <NAME> (<EMAIL>).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 <NAME>.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return c... |
# Keypirinha: a fast launcher for Windows (keypirinha.com)
import keypirinha as kp
import socket
import urllib.parse
import urllib.request
import ssl
import socks
import sockshandler
class UrllibOpener:
"""
A replacement to :py:class:`urllib.request.OpenerDirector` to apply user's
global sett... |
"""
This is model implement densenet
"""
from __future__ import print_function
from __future__ import division
import tensorflow as tf
import numpy as np
import keras
import keras.backend as K
from keras.models import Model
import os
from keras.layers import Input, Conv2D, Dense, BatchNormalization, Activation, Add, M... |
# Copyright 2019 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 the "l... |
import copy
import datetime
import pprint
import sys
from collections import Counter, deque
import elasticsearch
from elasticsearch import helpers
from natsort import natsorted
from core.models import AttributeField, SearchLog
from core.utils import (BaseElasticSearchQueryDSL,
BaseElasticSearc... |
from __future__ import division, print_function
import numpy as np
import cupy
from graduateutil import divide_on_feature, train_test_split, standardize, mean_squared_error
from graduateutil import calculate_entropy, accuracy_score, calculate_variance
class DecisionNode():
"""Class that represents a decision nod... |
"""Provide BERT embeddings on a per sentence level.
"""
__author__ = '<NAME>'
from typing import Dict, Any, Type, Tuple
from dataclasses import dataclass, field, InitVar
import logging
import collections
from io import TextIOBase
from functools import reduce
from pathlib import Path
from torch import Tensor
from tran... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Created on 05.09.2010
@author: SIGIESEC
'''
from base.dependency.dependency_util import AggregateMapper
from commons.config_if import ConfigDependent
from commons.core_if import ContentMetric
from commons.core_util import StringTools, frozendict, call_and_return
from... |
import os
import numpy as np
import tensorflow as tf
from keras.datasets import cifar10
from sklearn import utils
from sklearn.model_selection import train_test_split
from keras.utils.np_utils import to_categorical
from keras.preprocessing.image import ImageDataGenerator
from cifar_data import batch_features_labels
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) <NAME> [~º/~] and Contributors
# All rights reserved.
#
# This is free software; you can do what the LICENCE file allows you to.
#
import logging
from collections import namedtuple, Mapp... |
#!/usr/bin/env python3.5
# encoding: utf-8
#
# ----------------------------------------------------------
# This file is part of TPARTY: http://tparty.readthedocs.org
# ----------------------------------------------------------
#
# Copyright (c) 2016, <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/o... |
import sys,re,math
def process_occ_energies(occ_energies):
processed_energies = []
for item in occ_energies:
if len(item) > 10:
gaussian_fup = item.split("-")
gaussian_fup = [_f for _f in gaussian_fup if _f]
for item_stick in gaussian_fuckup:
processe... |
# -*- coding: utf-8 -*-
# Standard Libraries
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
from multiprocessing import Pool
import cv2
from functools import partial
import traceback
import sys
import skvideo.io
if sys.version_info > (3, 4):
import importlib
if... |
# coding=utf-8
# Copyright 2021 Google LLC..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
#!/usr/bin/env python
# encoding: utf-8
'''
asreml.Gmatrix -- shortdesc
asreml.Gmatrix is a description
It defines classes_and_methods
@author: user_name
@copyright: 2020 organization_name. All rights reserved.
@license: license
@contact: user_email
@deffield updated: Updated
'''
import sys
import ... |
# Copyright 2017 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 the "license" file... |
import numpy as np
import scipy as sp
import scipy.linalg as spl
from collections import defaultdict
from sklearn.linear_model import LinearRegression
# Reference Marker Configuration (in m)
_THICKNESS = 0.002
_RADIUS = 0.006522 + _THICKNESS # Radius of tube
_CABLE_DRIVEN_RADIUS = 0.015
def rotate_point_around_point... |
#!/usr/bin/env python3
import numpy as np
import networkx as nx
import sys
from typing import Iterable, Tuple, List
def lin_polyene_n(n: int) -> np.ndarray:
"""
Returns the hamiltonian matrix for a linear poly-ene with n sites. The matrix entries are as per the Huckel
approximation, with alpha = 0 and b... |
import numpy as np
import bisect
from itertools import product
# ===============================
# OPERATIONS USED FOR VARIANCE-BASED SPLITTING
def increment_mean_and_var_sum(n, mean, var_sum, x, sign):
"""
Welford's online algorithm for incremental sum-of-variance computation,
adapted from https://fanf2.... |
import logging
from unicorn.arm_const import (UC_ARM_REG_R0, UC_ARM_REG_R1, UC_ARM_REG_R2, UC_ARM_REG_R3, UC_ARM_REG_R4,
UC_ARM_REG_R5, UC_ARM_REG_R6, UC_ARM_REG_R7, UC_ARM_REG_R8, UC_ARM_REG_R9,
UC_ARM_REG_R10, UC_ARM_REG_R11, UC_ARM_REG_R12, UC_ARM_REG_LR, UC_ARM_REG_PC,
UC_ARM_REG... |
import math
EARTH_RADIUS = 6370000.
MAG_LAT = 82.7
MAG_LON = -114.4
direction_names = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
directions_num = len(direction_names)
directions_step = 360. / directions_num
def xyz(lat, lon, r=EARTH_RADIUS):
""" Takes sp... |
import math
import logging
import torch
import torch.nn as nn
from prettytable import PrettyTable
from ..mask import Mask_s, Mask_c
__all__ = ['resdg20_cifar10', 'resdg32_cifar10', 'resdg56_cifar10',
'resdg110_cifar10']
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convol... |
"""Kistler force plate calibration."""
from __future__ import division, print_function
import numpy as np
__author__ = '<NAME>, https://github.com/demotu/BMC'
__version__ = 'kistler_fp_cal.py v.1 2014/12/12'
def kistler_fp_cal(data, S_matrix=None, fxfy_range=0, fz_range=0, origin=None,
fp_typ... |
import os
import time
import copy
from typing import DefaultDict
import torch
# import torchvision
# import pandas as pd
# import numpy as np
import torch.nn as nn
# import torch.optim as optim
# from torch.optim import lr_scheduler
# from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, ... |
# 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 appl... |
# -*- coding: utf-8 -*-
"""
@author unknowcry
@date 2020-4-12
@desc 彩票数据
@filename Lottery_data.py
tips:
数据来自:http://kaijiang.500.com
"""
import requests
import re
import random
import datetime
import threading
import time
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
from conc... |
# 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.
import abc
import typing
from math import gcd
from cryptography.hazmat.primitives import _serialization, hashes
from cryptography.hazmat.... |
'''
Spatial pyramid kernel implementation with Python.
Automates the process of reading the data and executes the SVM with the specified kernel parameters
through the terminal.
__authors__ = <NAME>, <NAME> and <NAME>
'''
###########################################################################################... |
from __future__ import annotations
import operator
from dataclasses import dataclass
import logging
from datetime import datetime
from typing import Dict, List, Union, Optional, Callable
from betfairlightweight.resources import MarketBook, RunnerBook, MarketDefinitionRunner
from betfairlightweight.resources.bettingreso... |
import re
from requests_html import HTMLSession
from .exceptions import (ScrapeReviewContentsError, ISBNError, PaginationError,
NoReviewError, BookStoreSaleError, StarImagesError, LastReviewError)
from .helper import (ReviewPagingHelper, not_exist_review_in)
from .review_info import (Naverbook... |
import torch
import torch.nn as nn
import torchvision.models as models
class AdversarialLoss(nn.Module):
r"""
Adversarial loss
https://arxiv.org/abs/1711.10337
"""
def __init__(self, type='nsgan', target_real_label=1.0, target_fake_label=0.0):
r"""
type = nsgan | lsgan | hinge
... |
import pytest
import krun.platform
import sys
from krun.tests import BaseKrunTest, subst_env_arg
from krun.util import run_shell_cmd, FatalKrunError
from krun.vm_defs import PythonVMDef
from krun.platform import OpenBSDPlatform
def make_dummy_get_apm_output_fn(output):
def _get_apm_output(self):
return ou... |
"""Color items in the directory tree based on their git status."""
from __future__ import annotations
import logging
import os
import subprocess
import sys
import time
from concurrent.futures import Future, ThreadPoolExecutor
from functools import partial
from pathlib import Path
from typing import Any
from porcupine... |
# -*- coding: utf-8 -*-
from openregistry.lots.core.utils import (
update_logging_context,
get_now,
error_handler,
raise_operation_error,
get_first_document,
check_document,
set_first_document_fields,
get_type,
update_document_url
)
from openregistry.lots.core.validation import (
... |
# encoding: utf-8
"""
Test data for relationship-related unit tests.
"""
from __future__ import absolute_import
from docxx.opc.constants import RELATIONSHIP_TYPE as RT
from docxx.opc.rel import Relationships
from docxx.opc.constants import NAMESPACE as NS
from docxx.opc.oxml import parse_xml
class BaseBuilder(obj... |
# Copyright 2020 <NAME>, <NAME>, <NAME>
#
# 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... |
"""
@author: <NAME>
@contact: yuhao.cheng[at]outlook.com
"""
#!!!!! ignore the warning messages
import warnings
warnings.filterwarnings('ignore')
import os
import pickle
import math
import torch
import time
import numpy as np
from PIL import Image
from collections import OrderedDict
import torchvision.t... |
import asyncio
import discord
import datetime
from main import Zeta
from typing import Union
from math import floor, sqrt
from discord.ext import commands, tasks
def is_me(ctx):
return ctx.author.id == 501451372147769355
QUERY_INTERVAL_MINUTES = 10
class LevelSystem(commands.Cog, name="Levelling"):
"""
... |
# -*- coding:utf-8 -*-
from saml2 import (
BINDING_HTTP_POST,
BINDING_HTTP_REDIRECT,
entity,
)
from saml2.client import Saml2Client
from saml2.config import Config as Saml2Config
from django import get_version
from pkg_resources import parse_version
from django.conf import settings
from django.contrib.aut... |
import math
import unittest
import logging
import re
import numpy as np
from imageio import imread
from scipy.ndimage.interpolation import rotate
from autocnet.examples import get_path
from autocnet.transformation import roi
from .. import ciratefi
import pytest
# Can be parameterized for more exhaustive tests
upsa... |
# The MIT License (MIT)
# Copyright (c) 2022 by the xcube development team and contributors
#
# 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 limit... |
# Copyright (c) Alibaba Group
import argparse
import os
import random
import shutil
import time
import warnings
import sys
import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.multiprocessing as mp... |
from enactment import *
def main():
params = get_command_line_params() # Collect parameters
if params['helpme']:
usage()
return
for enactment_name in params['enactments']: # Write an *.enactment file for each of the given enactments.
if params['imgw'] is not None and params['imgh'] is not None:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <EMAIL>
#
import logging
import numbers
import sys
from haystack.outputters import Outputter
from haystack import types
from haystack import basicmodel
log = logging.getLogger('python')
class PythonOutputter(Outputter):
""" Parse a s... |
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
import binascii
import code
import random
import string
import struct
import sys
from typing import Any, Dict, List, Optional, Tuple,... |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
import sys
import subprocess
import shlex
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
from powerline import genera... |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... |
import numpy as np
import matplotlib.pyplot as plt
import os.path
from rebin import rebin
import glob
from joblib import Parallel, delayed
import time
def nscrad_get_parameters(x, x_bg, x_nuisance):
# print(np.sum(x[0, :]))
# stop
# mean_bg = np.mean(x_bg, axis=0)
# bg_covariance = np.matmul(mean_bg... |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
"""Moran's I global spatial autocorrelation."""
from typing import Union, Optional
from functools import singledispatch
from anndata import AnnData
import numpy as np
from scipy import sparse
from numba import njit, prange
from scanpy.get import _get_obs_rep
from scanpy.metrics._gearys_c import _resolve_vals, _check_... |
# @Author: <NAME>
# @Email: <EMAIL>
# @Filename: artificial_datasets.py
# @Last modified by: <NAME>
# @Last modified time: 19-Jul-2018
import argparse
import bisect
import collections
import itertools
import json
import os
import random
import numpy
import plotly
import sklearn.neighbors
import download_png
INC... |
from data.optional import Result,NoResult
debug_pq = False
class Coobject(object):
def __init__(self, coobject):
self.coobject = coobject
def insert(self, value, obj):
if value is not None:
self.coobject.insert(value, obj)
return self
def delete(self, value, heapCalle... |
"""
Model tests
"""
from unittest.mock import patch
from io import BytesIO
from ddt import ddt, data, unpack
from django.core.files.uploadedfile import UploadedFile
from django.db.models.signals import post_save
from factory.django import mute_signals
from PIL import Image
from micromasters.utils import now_in_utc
fr... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
import functools
import time
from django import db
from django.core.management import base
from django.db import transaction
from django.utils import html, timezone
from geopy import geocoders
from ....base import models as base_models
from ... import models
def collect_cause_areas(
global_poverty,
animal_w... |
# coding: utf-8
###
# @file deploy.py
# @author <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# @section LICENSE
#
# Copyright © 2018-2019 <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and a... |
#! /usr/bin/python
"""
File name: tpColorChanger.py
Author: <NAME>
Description: Tool to change color of curve controls quickly
"""
try:
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from shiboken2 import wrapInstance
except:
from PySide.QtGui ... |
#! /usr/bin/env python2
import os
import shlex
import subprocess
from Queue import Queue
from multiprocessing.pool import ThreadPool
class GetOutput:
# Class that executes espeak commands and returns output and/or err
def __init__(self, cmd):
self.__cmd = cmd
args = shlex.split(self.__cmd)
... |
"""
Some code motivated by:
Hands-On Machine Learning with Scikit-Learn and TensorFlow by <NAME>
"""
import numpy as np
import numpy.random as rnd
import tensorflow as tf
from .utils import *
from .timeseries_datasets import *
def leaky_relu(z, name=None):
return tf.maximum(0.01 * z, z, name=name)
def dnn_... |
#
# Copyright (c) 2021 Seagate Technology LLC and/or its Affiliates
#
# 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 ap... |
import os
import random, json
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.http import HttpResponseRedirect, HttpResponseBadRequest, Http404
from djang... |
# outline.py
"""Program that computes a phylogenetic outline for a distance matrix, using neighbor-net
Given a distance matrix on a set of taxa, this program runs the neighbor-net algorithm
and then computes a phylogenetic outline. The outline is drawn in a graphics window
See: Bryant and Moulton (2004)
See: Huson et... |
"""
Copyright 2019 <NAME>.
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 distribut... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C5959810
# Test Case Title : Check that multiple forces in single force region create correct... |
import sqlite3, requests, os, urllib.parse
from py2neo.database import Graph, Node, Relationship
from sys import argv
def get_human_address_display_string(road, housenumber, city, region, country):
s = ''
if road is not None and road.strip() != '':
s += road.strip()
if housenumber is not None ... |
"""The parallel implemenation of the Archipelago
This module defines the Archipelago data structure that runs in parallel on
multiple processors.
"""
from copy import copy, deepcopy
import os
from datetime import datetime
import logging
import numpy as np
import dill
from mpi4py import MPI
from .archipelago import ... |
import math
# button constants
BUTTON_SCENE = 0x10
BUTTON_MESSAGE = 0x11
BUTTON_SETTING = 0x12
BUTTON_NOTE_CC = 0x13
BUTTON_MIDI_CH = 0x14
BUTTON_SW_TYPE = 0x15
BUTTON_REL_VAL = 0x16
BUTTON_VELOCITY = 0x17
BUTTON_PORT = 0x18
BUTTON_FIXED_VELOCITY = 0x19
BUTTON_PROG_CHANGE = 0x1A
BUTTON_X = 0x1B
BUTTON_Y = 0x1C
BUTTON... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.