text stringlengths 3.07k 22.1k |
|---|
import re
from datetime import datetime
from collections import namedtuple
def format_cef(
vendor, product, product_version, event_id, event_name, severity,
extensions):
"""Produces a CEF compliant message from the arguments.
:parameter str vendor: Vendor part of the product type identifier
... |
#!/usr/bin/python3
from __future__ import print_function
from Tkinter import *
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from PIL import Image, ImageTk
import datetime
import json
import locale
import time
import locale
import threading
import fe... |
# @ author: <NAME>
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
import time
import yaml
import argparse
import torch
import os.path as op
import numpy as np
from collections import OrderedDict
from tqdm import tqdm
import utils
import dataset
from net_rfda import RFDA
from skimage.metrics import peak_signal_nois... |
import json
from django.contrib import messages
from django.contrib.admin import register
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse, path
from django.utils.safestring import mark_safe
... |
from tvm import topi
from tvm.auto_scheduler import is_auto_scheduler_enabled
from tvm.contrib import nvcc
from tvm.contrib.thrust import can_use_thrust
from tvm.te import SpecializedCondition
from .. import op as _op
from .generic import *
@conv2d_strategy.register("cim")
def conv2d_strategy_cim(attrs, inputs, out_t... |
import argparse
import itertools
import multiprocessing
import stat
import time
import psutil
import os
import research_toolbox.tb_filesystem as tb_fs
import research_toolbox.tb_io as tb_io
import research_toolbox.tb_logging as tb_lg
import research_toolbox.tb_utils as tb_ut
import research_toolbox.tb_random as tb_ra
... |
# Copyright 2019-2022 Cambridge Quantum Computing
#
# 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 os
import numpy as np
class Transform(object):
'''
A standard affine transform. Typically holds a transform from anatomical
magnet space to epi file space.
'''
def __init__(self, xfm, reference):
self.xfm = xfm
self.reference = None
if isstr(reference):
... |
import torch
import torch.nn as nn
import numpy as np
import os
from PIL import Image
import matplotlib.pyplot as plt
from models.mlp import MLP
from models.resnet import ResNet18
from models.vgg import VGG
from models.densenet import densenet_cifar
from models.wideresnet import WideResNet
def infer_arch(model_path)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# sans titre.py
#
# Copyright 2016 belese <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or... |
from model.wgan_64 import Discriminator, Generator
import configuration as conf
from utils import build_dirs, time2str
from init import gaussian_weights_init
import torch
import torchvision
from torchvision import transforms
from torch.autograd import Variable
from torch.autograd import grad
import os
from os.path im... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: <NAME>
import torch
import torch.nn as nn
from Snowflake.utils import PointNet_SA_Module_KNN, MLP_Res, MLP_CONV, fps_subsample, Transformer
from Snowflake.skip_transformer import SkipTransformer
class FeatureExtractor(nn.Module):
def __init__(self, out_dim=1... |
import numpy as np
import matplotlib.pyplot as plt
from stylegan_layers import G_mapping,G_synthesis
from read_image import image_reader
import argparse
import torch
import torch.nn as nn
from collections import OrderedDict
import torch.nn.functional as F
from torchvision.utils import save_image
from perce... |
"""Provide common pytest fixtures."""
import asyncio
import json
from collections import deque
from typing import List, Tuple
from unittest.mock import AsyncMock, Mock, patch
import pytest
from aiohttp import ClientSession, ClientWebSocketResponse
from aiohttp.http_websocket import WSMessage, WSMsgType
from zwave_js_... |
from fonduer.models import ImplicitSpan
from fonduer.snorkel.models import TemporarySpan
from bs4 import BeautifulSoup
from fuzzywuzzy import fuzz
from fonduer import lf_helpers
import re
from tutorials.organic_synthesis_figures.regex_matcher import get_rgx_matcher
org_rgx = get_rgx_matcher()
prefix_list = ['cycl', '... |
from django.shortcuts import render
from random import randint
from rest_framework.views import APIView
from rest_framework.response import Response
from django.core.paginator import Paginator
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.contrib.auth.models import User
import dateti... |
# Copyright (c) 2015, Nordic Semiconductor
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions ... |
import discord
client = discord.Client()
cadOG = []
scobOG = []
gccisOG = []
kgcoeOG = []
cetOG= []
chstOG = []
colaOG = []
cosOG = []
ntidOG = []
OGlist = [cadOG, scobOG, gccisOG, kgcoeOG, cetOG, chstOG, colaOG, cosOG, ntidOG]
@client.event
async def on_ready():
await client.change_presence(activity=discord.A... |
#
# Copyright (C) 2015 <NAME>
#
# Full copyright notice can be found in LICENSE.
#
from abc import abstractmethod
from enum import Enum
from pyclick.click_models.ClickModel import ClickModel
from pyclick.click_models.Param import ParamEM
from pyclick.click_models.ParamContainer import QueryDocumentParamContainer, Ran... |
#!python3
# -*- coding: utf-8 -*-
# automationpy/webchat
# <NAME>
# created 21 Oktober 2020
import time
import os
import packagepy
import json
import dominate
from dominate.tags import *
import os
import io
import datetime
import difflib
import response
# value element search text contact name
ele_side = '//div[@id="... |
# bot modules
import bot.utils as utils
import bot.config as config
# general python
import pytest
import pickle
import os
data_dir = dict_name = dict_data = None
test_file = None
def setup_module(module):
global dict_name, dict_data, data_dir
dict_name = "test_dict"
dict_data = {"this": "is a test"}
... |
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Most of this work is copyright (C) 2013-2021 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if yo... |
"""Functions for reading/writing CircuitGraphs"""
import re
import os
from glob import glob
from pyeda.parsing import boolexpr
from circuitgraph import Circuit
class SequentialElement:
"""Defines a representation of a sequential element for reading/writing
sequential circuits."""
def __init__(self, na... |
import math
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from opacus import PrivacyEngine, utils, autograd_grad_sample
try:
from .dpctgan import DPCTGAN
from .patect... |
import py
import sys
import copy
from rpython.rlib.rerased import *
from rpython.annotator import model as annmodel
from rpython.annotator.annrpython import RPythonAnnotator
from rpython.rtyper.rclass import OBJECTPTR
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.rtyper.test.tool import BaseRt... |
#!/usr/bin/python
# Copyright (c) 2017, 2020 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import List, Optional
import re
import sys
import json
from urllib.request import urlopen
from .cmd import stream_output, collect_output
DBT_REPO = "<EMAIL>:fishtown-analytics/dbt.git"
HOMEBREW_DBT_REPO = "<EMAIL>:fishtown-a... |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Element OS Software Volume Manager"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
#!/usr/bin/env python3
"""[__doc__ is generated in generate_doc().]"""
import subprocess
import internals.schedule as schedule
import time
import re
import os
import os.path
import json
import hashlib
from internals.docopt import docopt
from itertools import chain
TIME_INTERVAL_RE = re.compile(
r'^\s*(\d+(?:\.\d... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 2 22:43:12 2021
@author: obnit
"""
import pandas as pd , matplotlib.pyplot as plt , numpy as np
df = pd.read_csv('Export/tested.csv')
df.Date = pd.to_datetime(df.Date)
df.set_index('Date', inplace=True)
df = df.resample('MS').sum()
df['Percent'] = ((df['P... |
########################################################################
# ___ _ _____________
# / | / | / /_ __/ ___/
# / /| | / |/ / / / \__ \
# / ___ |/ /| / / / ___/ /
# /_/ |_/_/ |_/ /_/ /____/... |
import logging
import json
import hashlib
import geohash
from shapely import geometry
from cassandra import query
from cassandra_io.base import Cassandra_Base
from cassandra_io.utils import bbox2hash, bboxes2hash
from cassandra_io.polygon_index import \
Polygon_File_Index
def hash_string(string):
h = hashl... |
from functools import update_wrapper
from collections import deque
from pytz import timezone
from datetime import datetime
import asyncio
import re
import xml.etree.ElementTree as et
import json
import logging
import itertools
from .exceptions import ParseError, ContentError, ConnectTimeout, DscraperError
_logger = l... |
#python分为可变结构与不可变结构,不可变结构基本等于复杂结构,包括list map等。复杂结构的赋值和传参都是传递的引用
# for it in list 中,it是只读的,修改它不会改变list值
import os
import datetime
import shutil
import configparser
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import subprocess
import time
import ... |
import math
import re
import os
import timeit
import numpy
import numpy as np
import pysmps.smps_loader as loader
from hips.models._mip_model import MIPModel
from hips.models._lp_model import HIPSArray
from hips.constants import VarTypes
def _bounds_set(path):
bounds_defined = False
with open(path, "r") as ... |
from math import pi
import numpy as np
import scipy
from spatialmath import SE3
from spatialmath.base import isvector, getvector
def mkgrid(n, s, pose=None):
"""
Create grid of points
:param n: number of points
:type n: int or array_like(2)
:param s: side length of the whole grid
:type s: floa... |
import os
from os import path
import sys
import argparse
import git
from shutil import copyfile
from shutil import which
import subprocess
import boto3
from random import randrange
import yaml
from github import Github
from jinja2 import Environment, FileSystemLoader
import base64
from botocore.exceptions import Client... |
# coding: utf-8
import optparse
import os
import sys
import tempfile
import json
from xml.etree import ElementTree
from distutils.version import LooseVersion
import requests
from acmd import tool, error, log
from acmd import OK, USER_ERROR, SERVER_ERROR
from acmd.tools import get_action, get_argument
SERVICE_PAT... |
import multiprocessing as mp
import time
from abc import ABC
import numpy as np
from benchml.logger import log
from benchml.pipeline import FitTransform, Transform
from benchml.plugins.plugin_check import check_gylmxx_available, gylm
from benchml.readwrite import write_xyz
class KernelSmoothMatch(FitTransform):
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CESNET.
#
# CESNET OA Publication Repository is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
from functools import partial
from elasticsearch_dsl import Q
from elasticsearch_dsl.query im... |
from __future__ import annotations
import os
import shlex
from typing import Iterator, MutableMapping
import anyio
from fastenv.utilities import logger
class DotEnv(MutableMapping):
__slots__ = "_data", "source"
def __init__(self, *args: str, **kwargs: str) -> None:
self._data: MutableMapping[str,... |
# -*- coding: utf-8 -*-
"""
pytests for TemporalStats
"""
from click.testing import CliRunner
import numpy as np
import os
import pandas as pd
import pytest
from scipy.stats import mode
import tempfile
import traceback
from rex.multi_year_resource import MultiYearWindResource
from rex.renewable_resource import WindRes... |
import time
from . import wxdisplay
from pathlib import Path
from typing import List, Optional
import wx # pip install wxPython
import wx.xrc
from .network import Networks
from .nodes.own import MasterNode
from .network.requests import MPP
from .utils import get_date_from_timestamp
from .messages imp... |
"""IR generator tool."""
from base64 import b64encode, b64decode, decode
from itertools import islice
from functools import wraps
import logging
from . import raw
LOG = logging.getLogger(__name__)
gen_raw_nec_protocols_standard = ['nec1',
'nec2',
'ne... |
import ssl
from dataclasses import dataclass
from functools import wraps
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union
from .. import BrokenResourceError, EndOfStream, aclose_forcefully
from .._core._typedattr import TypedAttributeSet, typed_attribute
from ..abc import AnyByteStream, By... |
#!/usr/bin/env python3
import re
import sys
import collections
import socket
import subprocess
import traceback
import time
TEAMS_NUM = 20
SERVICE_NUM = 20
CLIENT_TIMEOUT = 5
CHILD_WAIT_TIMEOUT = 5
JURY_NET_PREFIXES = ["10.10.10.", "127.0.0."]
CONNTRACK_ARGS = ["conntrack", "-L"]
LINE_RE = re.compile(r"""
^
... |
# Copyright 2020 <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, softw... |
import torch
from torch import nn
from torch.nn import functional as F
from disout import Disout,LinearScheduler
class Rs_GCN(nn.Module):
def __init__(self, in_channels, inter_channels, num_head=16, bn_layer=True, kernel_size=1, padding=0):
super(Rs_GCN, self).__init__()
self.in_channels = in_c... |
import logging
from time import sleep
from configparser import ConfigParser
from contextlib import contextmanager
from collections import namedtuple
import boto3
import coloredlogs
from botocore.exceptions import ClientError
from . import constants
AccessKey = namedtuple("AccessKey", "id,status")
class MaximumRetr... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and 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... |
# Copyright 2016 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... |
from django.contrib.auth.decorators import permission_required
from django.shortcuts import render_to_response, render, redirect
from django.db.models import Q
from planchas.models import Plancha
from django.template.context import RequestContext
import csv
from io import StringIO
from candidatos.models import Candida... |
import numpy as np
def hybrid_index(pcp, evapo, tau, lagmax, alpha, beta):
"""
c-----------------------------------------------------------------------
c
c Input variables and parameters:
c
c pcp: vector array of input precipitation time series.
c evapo: vector array of inpu... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import TensorDataset, DataLoader
from tqdm.notebook import tqdm
torch.manual_seed(2020)
try:
print(torch.cuda.get_device_name(torch.cuda.current_device()))
print(torch.cuda.is_available())
... |
"""
FileSystem related utilities:
find(path, filters=None):
recursively returns every file in path that passes given filters
filters is a list of callables that return True/False based on a path
glob_wildcards(template, constraints=None):
finds all paths that match given template
yields (path,... |
import numpy as np
import pygame
import math
from pygame import mixer
import random
ROW_COUNT = 8
COLUMN_COUNT = 8
SQUARESIZE = 80
DARK_GREEN = (123, 164, 40)
LIGHT_GREEN = (139, 185, 45)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
white_disc = pygame.image.load("white.png")
black_disc = pygame.image.loa... |
"""Tests for TileDB PyTorch model save and load."""
import inspect
import os
import platform
import sys
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optimizers
from tiledb.ml.models.pytorch import PyTorchTileDBModel
class Net(nn.Module):
def __init__(se... |
"""
User Commands cog for Talos
Holds all user specific commands, those things that alter a user's permissions, roles,
Talos' knowledge of them, so on.
Author: CraftSpider
"""
import discord
import discord.ext.commands as commands
import typing
import logging
import asyncio
import spidertools.common as... |
from typing import List, Dict
import simplejson as json
from flask import Flask, request, Response, redirect
from flask import render_template, url_for, session, flash
from flaskext.mysql import MySQL
from pymysql.cursors import DictCursor
from random import randint
from flask_mail import Mail, Message
from werkzeug.se... |
class Color:
"""
From:
https://stackoverflow.com/questions/8924173/how-do-i-print-bold-text-in-python
"""
bold = '\033[1m'
italic= '\033[3m'
underl= '\033[4m'
blink = '\033[5m'
end = '\033[0m'
inv = '\033[7m'
hid = '\033[8m'
default = "\033[39m"
b... |
import numpy as np
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import Variable, optimizers, initializer,cuda
import os
import matplotlib.pyplot as plt
import cupy as cp
from net import Net, Xavier
#Variational AutoEncoder model
class Encoder_Decoder(chainer.Chain):
... |
from __future__ import absolute_import
from plotly import exceptions, optional_imports
from plotly.graph_objs import graph_objs
pd = optional_imports.get_module("pandas")
def validate_table(table_text, font_colors):
"""
Table-specific validations
Check that font_colors is supplied correctly (1, 3, or l... |
#!/usr/bin/env python3
import asyncio
from mavsdk import System
import io
import time
import picamera
from PIL import Image
from detect_img import detect_img
from yolo import YOLO
import math
import json
from datetime import datetime
from mavsdk import (OffboardError, VelocityBodyYawspeed)
with open('/home/pi/Download... |
from __future__ import print_function
import pytest
import numpy as np
import random
from numpy.testing import assert_equal, assert_almost_equal
from choreo.interlock import compute_feasible_region_from_block_dir
from pybullet_planning import Euler, Pose, multiply, tform_point
from scipy.optimize import linear_sum_ass... |
import json
import optparse
import os
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from skimage import io
import torch
from torchvision import models, transforms
def create_log_path(opt):
unique_path = False
if opt.save_dir != "":
opt.log_path = os.path.join(op... |
# HTTP Server host
import threading
from flask import Flask, abort
# Data Retrieval
import redis
import json, sys, sqlite3
import re
import subprocess
import os
import csv
sensor_stream = 'sensor_stream'
sensor_fields = [
"Timestamp",
"PT_HE",
"PT_Pneu",
"PT_Purge",
"PT_FUEL_PV",
"PT_LOX_PV",
... |
#!/usr/bin/env python
import os
import math
import logging
import numpy as np
from pkg_resources import resource_filename
import h5py
from blimpy import Waterfall
from blimpy.io import sigproc
from blimpy.io.hdf_writer import __write_to_hdf5_heavy as write_to_h5
from .kernels import Kernels
logger = logging.getLog... |
from dataclasses import dataclass
from enum import IntEnum, auto
import json
import logging
import torch
from luafun.game.action import DraftAction
import luafun.game.constants as const
from luafun.utils.python_fix import asdict
from luafun.game.ipc_send import TEAM_RADIANT, TEAM_DIRE
log = logging.getLogger(__name... |
# -*- coding: utf-8 -*-
"""
This module holds functions to work with embeds in different ways.
"""
from itertools import islice
from typing import List, Optional, Union, Dict
import discord
from discord import Embed
from discord.ext.commands import Paginator
__all__ = (
'paginate_to_embeds',
'dict_to_fields'... |
import sqlite3, urllib.parse, json
from webapp.lib.evaluategrade import *
from contextlib import closing
from urllib.parse import urlparse
def get_unique_websites():
unique_list = []
domain_list = []
with closing(sqlite3.connect("results.db")) as connection:
with closing(connection.cursor()) as cu... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 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
#
#... |
import pytest
import os
import json
import time
import tempfile
import warnings
HERE = os.path.dirname(os.path.abspath(__file__))
PARENT = os.path.dirname(HERE)
from datacatalog.linkedstores.fixity import FixityStore, RateLimitExceeded
from datacatalog.linkedstores.file import FileStore
from datacatalog.linkedstores.... |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_import, division, print_function, unicode_literals
from difflib import... |
"""
Routines to read in association file between genes and GO terms.
"""
__copyright__ = "Copyright (C) 2010-2016, <NAME> al. All rights reserved."
__author__ = "various"
from collections import defaultdict
import os
import sys
def read_associations(assoc_fn, no_top=False):
"""
Reads a gene id go term associ... |
"""
MIT License
(C) Copyright [2021] Hewlett Packard Enterprise Development LP
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,... |
from typing import Dict, Generator, List, Optional, Tuple, TypeVar
import os
from shutil import rmtree
from . import guardian_api
from . import mediator_api
from .data import test_data
NUMBER_OF_GUARDIANS = 3
QUORUM = 2
key_name = "key_ceremony_1"
guardian_ids = ["guardian_1", "guardian_2", "guardian_3"]
def cle... |
"""Optimization/metrics utility module.
This module contains utility functions and tools used by the other modules of this package.
"""
import copy
import logging
import numpy as np
import torch
import thelper.optim.metrics
import thelper.utils
logger = logging.getLogger(__name__)
def create_loss_fn(config, model... |
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.regularizers import l2
from keras.optimizers import SGD ,Adagrad
from scipy.io import loadmat, savemat
from keras.models import model_from_json
import theano.tensor as T
import theano
import csv
import configparser
import... |
# -*- coding: utf-8 -*-
# pylint: disable=no-member,access-member-before-definition
# Copyright (c) 2020, Libermatic and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import operator
import frappe
from frappe.model.document import Document
from toolz.curried imp... |
"""
Main script
"""
import argparse
import os
import random
import sys
import numpy as np
import dynet
from constants import TASK_NAMES, LANGUAGES, EMBEDS, BALANCED, IMBALANCED, SGD, ADAM
from sluice_net import SluiceNetwork, load
import utils
def check_activation_function(arg):
"""Checks allowed argument for ... |
#
# Copyright 2019 Delphix
#
# 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, so... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from itertools import groupby, cycle
from typing import Optional, List
import plotly.graph_objects as go
from matplotlib import pyplot as plt
from pydefect.corrections.efnv_correction import \
ExtendedFnvCorrection, Pote... |
"""
“Commons Clause” License Condition v1.0
Copyright doener 2020
The Software is provided to you by the Licensor under the
License, as defined below, subject to the following condition.
Without limiting other conditions in the License, the grant
of rights under the License will not include, and the License
does not ... |
"""A linter for docstrings following the google docstring format."""
import ast
from collections import deque
import sys
from typing import (
Callable,
Iterator,
List,
Set,
Tuple,
Optional,
Union,
)
from .config import get_logger
logger = get_logger()
FunctionDef = ast.FunctionDef
if ha... |
# ---------------------------------------------------------------------------------------------------------------------
# Aufgabe 15: Branching DQN with soft copy of weights (weighted update)
# 19.02.2022, <NAME>
#
# Implementation changes:
# - New class StateDictHelper for the state_dict calculations
# - New methode B... |
# Copyright (c) 2019 <NAME> <<EMAIL>>,
#
from __future__ import print_function
import subprocess
import math
import re
from pprint import pprint
from collections import namedtuple, OrderedDict
from datetime import timedelta, datetime
from ..utils.time import date_range
from ..utils.string import to_snake_case
from .... |
""" PIPA data I/O
"""
import os
import numpy as np
from PIL import Image
import cPickle as pickle
SUBSET_LEFT = 0
SUBSET_TRAIN = 1
SUBSET_VAL = 2
SUBSET_TEST = 3
class HumanDetection:
def __init__(self, head_bbox, identity_id, photo):
self.head_bbox = [int(item) for item in head_bbox]
self.ident... |
import gym
import torch
import random
import numpy as np
from abc import ABC
from copy import deepcopy
from typing import Dict, Optional
from simrl.utils.modules import DiscreteQ
from simrl.utils.dists import DiagnalNormal, Onehot
class Actor(ABC):
''' Actor class is used to interact with the environment '''
... |
import re
import os
from shlex import quote
from ..compiler import compiler
from ..cmd import Cmd, LongOpt
# for support glob in file parameters
class ShellPath(object):
__sots__ = '_path'
def __init__(self, path):
self._path = path
@compiler.when(ShellPath)
def compile_shell_path(compiler, cmd, ... |
import hail as hl
from .base_mt_schema import BaseMTSchema, row_annotation, RowAnnotationOmit
from hail_scripts.v02.utils.computed_fields import variant_id
from hail_scripts.v02.utils.computed_fields import vep
class SeqrSchema(BaseMTSchema):
def __init__(self, *args, ref_data, clinvar_data, hgmd_data=None, **kw... |
# Implementation of the plotting step of the analysis
#
# The plotting combines the histograms to plots which allow us to study the
# inital dataset based on observables motivated through physics.
import ROOT
ROOT.gROOT.SetBatch(True)
# Declare a human-readable label for each variable
labels = {
"pt_1": "Mu... |
import os
import time
import numpy as np
from scipy import sparse as spsp
import dgl
import backend as F
import unittest, pytest
from dgl.graph_index import create_graph_index
from numpy.testing import assert_array_equal
def create_random_graph(n):
arr = (spsp.random(n, n, density=0.001, format='coo') != 0).astyp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Display the dex entry for a given pokemon on an inky display.
Todo:
Implement clean dex display for PHAT and WHAT displays.
Implement command line arguments to use as an individual script.
Port remaining code necessary from display-test.
The textual ou... |
# pylint: disable=not-callable, no-member, invalid-name, line-too-long, wildcard-import, unused-wildcard-import, missing-docstring, protected-access
from functools import partial
import pytest
import torch
from e3nn import o3, rs
from e3nn.non_linearities.norm import Norm
def test_convention():
Rs = [0]
ass... |
#!/usr/bin/env python
class HostType:
GPCHECK_HOSTTYPE_UNDEFINED = 0
GPCHECK_HOSTTYPE_APPLIANCE = 1
GPCHECK_HOSTTYPE_GENERIC_LINUX = 2
def hosttype_str(type):
if type == HostType.GPCHECK_HOSTTYPE_APPLIANCE:
return "GPDB Appliance"
elif type == HostType.GPCHECK_HOSTTYPE_GENERIC_LINUX:
... |
__author__ = 'root'
import sys
import urllib2
sys.path.append("..")
# -*- coding:utf8 -*-
# encoding = utf-8
from app.functions import get_remote, get_config, convert
from app.log import log
import json
from admin_mgr import admin_manager
from flask import session
from flask_login import logout_user
class LoginBase(... |
"""New syntax test file"""
from pathlib import Path
from pytest_bdd import given, parsers
import tests.functional.util as util
@given(parsers.parse("repo at {directory} is on {start_branch}"))
@given(parsers.parse("project at {directory} is on {start_branch}"))
@given("project at <directory> is on <start_branch>")... |
"""
Utility functions to fit and apply coordinates transformation from FVC to FP
"""
import json
from pkg_resources import resource_filename
import numpy as np
from scipy.interpolate import interp1d
from desimeter.transform.zhaoburge import getZhaoBurgeXY, transform, fitZhaoBurge
from desimeter.trig import average_an... |
"""STIX2 Core Objects and Methods."""
import copy
import importlib
import pkgutil
import re
import stix2
from .base import _STIXBase
from .exceptions import CustomContentError, ParseError
from .markings import _MarkingsMixin
from .utils import _get_dict
STIX2_OBJ_MAPS = {}
class STIXDomainObject(_STIXBase, _Marki... |
# Copyright 2020 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.