text stringlengths 3.07k 22.1k |
|---|
"""
Extract data from Knack database and publish to Socrata, ArcGIS Online,
or CSV.
By default, destination data is incrementally updated based on a
modified date field defined in the configuration file. Alternatively use
--replace to truncate/replace the entire dataset. CSV output is always handled
with --replace.
... |
"""graphics tools on top of glumpy"""
import sys, logging, re
import itertools as it
import datetime as dt
from queue import Queue
import numpy as np
import torch
from glumpy import gloo, gl, library
from glumpy.graphics.collections import PathCollection
from . utils import *
from . pattern import Var
class GLSLSou... |
#
# Copyright (c) 2017, <NAME> and <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 of conditions a... |
class Monomial(object):
def __init__(self, scalar, monomial, power=None):
self.scalar = scalar
self.monomial = monomial
if power:
self.power = power
else:
self.power = len(monomial)*[1]
def __getitem__(self, index):
if type(index) == slice:
... |
import pygame, random
WIDTH = 800
HEIGHT = 600
BLACK = (0, 0, 0)
WHITE = ( 255, 255, 255)
GREEN = (0, 255, 0)
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Star Wars")
clock = pygame.time.Clock()
def draw_text(surface, text, size, x, y)... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from django.test import TestCase
try:
from django.test import override_settings
except ImportError:
from django.test.utils import override_settings
from mock import MagicMock, patch
from django_pluggableappsettings import AppSettin... |
# startstop - API for the 'github.com/zoltuz/dna_assembler' automated assmembly package (Start-Stop standard)
# v0.1.0, 31.5.21
"""
Make the following changes to assembly.py:
(Here, the indents are used to aid legibility; appropriate formatting after inserting is required)
- After all import statements, insert (if dn... |
#!/usr/bin/python3
# Copyright (C) 2017 The Android Open Source Project
#
# 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... |
#!/usr/bin/env python
"""
Parameter scan
"""
from __future__ import absolute_import
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from os.path import expanduser, expandvars, isfile
import sys
import numpy as np
from pisa import ureg
from pisa.analysis.analysis import Analysis
from pisa.core.de... |
"""Windows registry monitor module.
This module contains a description of classes that implement methods for
monitoring events in the Windows registry.
Example with RegistryMonitorAPI class use:
from threading import Thread
import keyboard
import pywinwatcher
class Monitor(Thread):
def __in... |
# encoding: utf-8
from contextlib import contextmanager
import cStringIO
import os
import random
from subprocess import Popen, PIPE, call
import sys
import threading
# ======================= GENERAL UTILILITIES =======================
def extract_column(text, column, start=0, sep=None):
""" Extracts columns fr... |
"""
Default PyScaffold's actions and functions to manipulate them.
When generating a project, PyScaffold uses a pipeline of functions (each function will
receive as arguments the values returned by the previous function). These functions
have an specific purpose and are called **actions**. Please follow the :obj:`Acti... |
# -*- coding: utf-8 -*-
"""多线程自瞄+保存图像
Author:
"""
import autoaim
import app
import cv2
import time
import threading
import sys
from toolz import curry, pipe
import os
# Global var
new_img = None
new_packet = None
aim = True
ww = 1280
hh = 720
# ww = 640
# hh = 360
def miao(val, minval, maxval):
return min(max(... |
"""
Segmentation Algorithm
Example of segmentation of images consisting of one object to be differentiated from a
simple background. Running the script in its state retrieves a image of a brazilian coin
and crops the original image to better focus on the coin.
The image used as example is from a Kaggle competition fo... |
#!/usr/bin/env python3
"""Dove v0.0.1
Dove is a tool for quickly managing projects in a shell like an IDE.
Usage:
`dove [options] <command> [argument(s)]`
Commands:
build, -b, --build compile packages and dependencies
analyse, -a, --analyse checks for any errors or warnings in file(s)
clean,... |
'''
@author: <NAME>
@version: 2.0.0
Copyright (c) 2020 Earthquake alert
'''
import datetime
import glob
import multiprocessing
import os
import shutil
import sqlite3
from typing import Any, Dict, List
try:
from image_generation import create_image, create_image_report # pyright: reportMissingImports=false
fr... |
import pygame, sys, random
class Ball():
def __init__(self):
self.ball = pygame.Rect(screenWidth/2-15, screenHeight/2-15, 30,30) #so ball is in the middle of the scrren
self.ballSpeedX = 7 * random.choice((1,-1))
self.ballSpeedY = 7 * random.choice((1,-1))
def ball_restart(self)... |
import numpy as np
import torch
import os
import os.path
import random
from PIL import Image
import torchvision.transforms as transforms
import torch.utils.data as data
import torchvision.transforms.functional as F
from options.train_options import TrainOptions
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... |
# -*- coding: utf-8 -*-
"""Qt dock window."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
try: # pragma: no cover
from collections.abc import Mapping # noqa
except ImportError: # prag... |
"""
Plugin is the definition of the plugin interface class as well as extensible utility interfaces
that can be used to create Plugins quickly and easily.
Plugin is designed to be similar to Command and Reaction interface classes while being more versatile.
@author: NGnius
"""
import asyncio, time, traceback
from mu... |
# coding: utf-8
# pylint: disable=too-many-locals, too-many-arguments, invalid-name
# pylint: disable=too-many-branches, too-many-statements
"""AutoML Library containing useful routines."""
from __future__ import absolute_import
import warnings
class ParamError(Exception):
"""
Excetion raised for errors in h... |
import random
import numpy as np
import pickle
import scipy.special
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.preprocessing import normalize
from sinkhorn import SinkhornSolver
from sinkhorn_utils import *
label_names = [
'airplane',
'automobile',
'b... |
#!/usr/bin/env python3
'''
Collect scan results created by Q_scan.py (see ../01_scanning_coordinates)
and store in SQLite database.
Very ugly code full of leftovers from previous versions, works but needs some love.
Example:
$ sort_and_store.py -o data.sqlite -m 30 -n 10 scans/q14q13
'''
import os
import glob
impo... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import subprocess
import sys
import tempfile
import time
from telemetry.core import exceptions
from telemetry.core.chrome impor... |
# standard libraries
import copy, json, logging
from typing import Any, Dict, Sequence, Tuple
from json.decoder import JSONDecodeError
# third-party libraries
import pandas as pd
from requests_futures.sessions import FuturesSession
from concurrent.futures import as_completed, Future
logger = logging.getLogger(__name... |
# Copyright 2018 <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
# ... |
import datetime
import json
import logging
import os
import requests
import tempfile
from google.cloud import datastore
from google.cloud import storage
from espn_api.football import League
from mako.template import Template
import plotly.graph_objects as go
logging.getLogger().setLevel(logging.INFO)
SLEEPER_TOKEN = ... |
import torch
from ..utils.stochastic import GaussianSample
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from ..utils.distributions import log_gaussian2, log_standard_gaussian
from ..utils.flow import NormalizingFlows, IAF, HouseholderFlow, ccLinIAF, SylvesterFlows
from ..uti... |
# Copyright (c) 2018-2022, <NAME>
# 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 and the following disclaimer.
# * ... |
import math
import os
import sys
import numpy as np
from util import load_result
from itertools import combinations
from itertools import product
from ontology import Ontology
def get_max_tree_distance(ontology, tags, debug=False):
"""
Description:
Return max tree distance which can be derived with g... |
import torch
import torch.nn.functional as F
import numpy as np
from .base.core import BaseAgent
from .utils import n_step_boostrap, soft_update
class A2CAgent(BaseAgent):
"""
Advantage Actor Critic (A2C) Agent
"""
def __init__(self, config_file, noise):
"""
Initialize an Advantage A... |
from itertools import product
import gym
import numpy
__all__ = [
"get_gym_environs",
"get_gym_stats",
"is_tuple",
"is_continuous",
"is_multidimensional",
"obs_stats",
"action_stats",
"env_stats",
]
def get_gym_environs():
""" List all valid OpenAI ``gym`` environment ids. """
... |
import argparse
import sys
import hunspell
import itertools
import multiprocessing
from multiprocessing import Pool
dict = hunspell.HunSpell('Spelling/nl_NL.dic', 'Spelling/nl_NL.aff')
f= open("vigenere.txt","a")
success = []
cipher = ''
print("Number of cpu : ", multiprocessing.cpu_count())
## based on https://g... |
# -*- coding: utf-8 -*-
"""
Solving the Knapsack problem using cover inequalities
Created on Tue Jun 8 07:44:14 2021
@author: <NAME>
"""
import numpy as np
from gurobipy import *
import time
def generateData(n):
np.random.seed(600)
a = np.random.randint(1000, size=(n))
w = np.random.randint(1000, siz... |
from .var import Var
from collections import OrderedDict
import inspect
from .datawriter import DataWriter, BytesIODataWriter, ClobberDataWriter
from .decoder import JSONDecoder, Decoder, GreedyTextDecoder, DecoderNode, \
BZ2Decoder, PickleDecoder
from .encoder import IdentityEncoder, JSONEncoder, TextEncoder, BZ2E... |
#!/usr/bin/env python3
import audio2text_ICP as ICP
import data_parser as dp
import argparse
from sklearn.decomposition import PCA
import numpy as np
import math
FLAG = None
def find_pair(x, Y):
'''
Args:
x is a vector
Y is a bunch of vectors
Return:
The indice of the closest Y to the... |
# The label files contain the following information, which can be read and
# written using the matlab tools (readLabels.m) provided within this devkit.
# All values (numerical or strings) are separated via spaces, each row
# corresponds to one object. The 17 columns represent:
# #Values Name Description
# --... |
#encoding: utf-8
import pandas as pd
import pymongo
import jieba
from wordcloud import WordCloud
from matplotlib import pyplot as plt
import random
import re
client = pymongo.MongoClient() # 链接pymongo数据库
collection = client['51Job']['Scrapy']
print("数据表名称:",collection.name)
data = collection.find()
df = ... |
"""
Created on Mon Oct 25 12:03:05 2021
@author: cbadenes
Training Data Set: https://cogcomp.seas.upenn.edu/Data/QA/QC/
"""
import os
import sys
import logging
import pandas
import csv
import spacy
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import LinearSVC
import joblib
from scipy.sparse import c... |
from django.core.exceptions import ValidationError
from ievv_opensource.utils import choices_with_meta
class ChoiceSetupError(Exception):
"""
Raised by :meth:`.SerializableChoicesWithMeta.validate_setup`.
"""
class AbstractChoiceConstants:
"""
Base class used to define constants for some set of ... |
# 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 ... |
import math
code = "prereq"
name = "Pre"
descr = "prerequisite test"
def readable(x):
if abs(x) >= 100:
return f'{x:.0f}'
if abs(x) >= 10:
return f'{x:.1f}'
i = 0
while x != 0 and float(f'{x:.{i}f}') == 0:
i += 1
i += 2
return f'{x:.{i}f}'
def isnum(v):
return v ... |
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
#
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
"""
Manager and Serializer for Users.
"""
import sqlalchemy
from galaxy import model
from galaxy import exceptions
from galaxy import util
from galaxy.managers import base
from galaxy.managers import deletable
from galaxy.managers import api_keys
from galaxy.security import validate_user_input
import logging
log = ... |
# Example showing how to define stream for Tagged Packet Grouping and how to parse the data.
import stl_path
from trex.stl.api import *
import argparse
from pprint import pformat
MIN_VLAN, MAX_VLAN = 1, (1 << 12) - 1
QINQ_INNER_VLAN, QINQ_OUTTER_VLAN = 1, 100
LINE_LENGTH = 35
def get_tpg_tags(qinq):
"""
G... |
# -*- encoding: utf-8
"""
Platform-specific logic for our Slack alarms.
"""
import re
from cloudwatch_alarms import ThresholdMessage
def guess_cloudwatch_log_group(alarm_name):
"""
Guess the name of the CloudWatch log group most likely to contain
logs about the error.
"""
if alarm_name.startswit... |
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, NRC tools"
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Release"
"""Contains general utility code in support of nrc_tools python scripts.
Code included in ... |
# Copyright (c) 2018 <NAME> <<EMAIL>>
# -*- coding: utf-8 -*-
import inspect
import six
import pytz
from .exceptions import (QueryEmpty,
QueryExpressionError,
QueryMissingField,
QueryMultipleExpressions,
QueryTypeErro... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from torch.utils.data import Dataset, DataLoader
import os
import torch
import numpy as np
#import h5py
import random
import os.path as osp
import sys
from six.moves import xrange
import math
import scipy.misc
import pandas as... |
#!/usr/bin/python3
import os
import sys
import json
import hashlib
# Checking for colorama existence
try:
from colorama import Fore, Style
except:
print("Error: >colorama< module not found.")
sys.exit(1)
# Checking for prettytable existence
try:
from prettytable import PrettyTable
except:
print("... |
import socket
import enum
import os
import asyncio
from collections import deque # for using stacks
from time import time
from async_timeout import timeout
from .tls_definitions import (
Contents,
Handshakes,
Protocols,
ProtocolCiphers,
EcPointFormats,
SupportedGroups,
TLS_EMPTY_RENEGOTIAT... |
from pyhpp.node import Node
from pyhpp.model import Model
dimension_2D1 = {"x": 10, "y": 10}
dimension_2D2 = {"x": 10, "y": 10, "z": 0}
dimension_2D3 = {"x": 10, "y": 10, "z": -5}
dimension_3D = {"x": 10, "y": 10, "z": 10}
def test_is_2d():
assert Model.is_two_dimensional(dimension_2D1) is True
assert Model.... |
#!/usr/bin/env python3
#
# OBS_TQ_MD_to_TSV7.py
#
# Copyright (c) 2020-2021 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# <NAME> <<EMAIL>>
#
# Written Aug 2020 by RJH
# Last modified: 2021-12-22 by RJH
#
"""
Quick script to copy OBS-TQ from markdown fil... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/11/5 下午4:53
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/lanenet-lane-detection
# @File : freeze_lanenet_model.py.py
# @IDE: PyCharm
"""
Freeze Lanenet model into frozen pb file
"""
from __future__ import absolute_import... |
"""
functions for image segmentation and splitting of training/test
dataset
"""
import time
import numpy as np
import matplotlib.colors as colors
import matplotlib as mpl
# my modules
import chmap.utilities.datatypes.datatypes as datatypes
# machine learning modules
import tensorflow as tf
import matplotlib.pyplot a... |
'''
Copyright 2020 Flexera Software LLC
See LICENSE.TXT for full license text
SPDX-License-Identifier: MIT
Author : sgeary
Created On : Fri Aug 07 2020
File : report_data.py
'''
import logging
from collections import OrderedDict
import CodeInsight_RESTAPIs.project.get_project_inventory
import CodeInsight_RESTAPIs.p... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... |
# 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
#
# Unless required by appli... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 10:33:25 2019
copied from: https://aaronschlegel.me/black-scholes-formula-python.html
@author: shirui
"""
import numpy as np
import scipy.stats as si
import math
import matplotlib.pyplot as plt
import operator
import torch
from tqdm import tqdm
"""
... |
# The MIT License (MIT)
#
# Copyright (c) 2018 <NAME>
#
# 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, me... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
from nltk.corpus import wordnet as wn
from nltk.corpus import brown as bn
from nltk.corpus import stopwords as sw
from nltk.stem.snowball import SnowballStemmer
from nltk import FreqDist
from copy import deepcopy
import math
import json
import numpy as np
from heapq import heappush, heappushpop, heappop
import re
XWOR... |
#!/usr/bin/python
# Copyright: (c) 2020, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: bms_vmi
short_descri... |
# Copyright 2019 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, ... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2017-2018 - <NAME> - MIT License
"""
https://raw.githubusercontent.com/cdgriffith/Box/master/box.py
"""
import string
import sys
import json
import re
import copy
from keyword import kwlist
import warnings
import logging
logger = logging.getLogger("BOX")
... |
import hashlib
import json
import os
import warnings
from mednorm.pmt_helpers import import_pymedtermino
pymedtermino = import_pymedtermino()
import requests
from enum import Enum
from mednorm.utils import makedirs_file
try:
from pymedtermino.meddra import MEDDRA
except:
MEDDRA = None
try:
from pymedter... |
# routes related to the boba run monitor
import os
import time
import pandas as pd
import numpy as np
from flask import jsonify, request
from .util import read_csv, read_json, write_json
from bobaserver import app, socketio, scheduler
from bobaserver.bobastats import sampling, sensitivity
import bobaserver.common as c... |
# GDB autoload file
import gdb.printing
import sys
# We want to work with both Python 2 and 3
if sys.version_info[0] > 2:
long = int
## Copied from gdb.printing because, having an initial underscore,
## it's probably not a stable interface...
# A helper class for printing enum types. This class is instantiated
#... |
import RPi.GPIO as GPIO
import sys
import os
import math
import threading
import requests
import time
sys.path.insert(0, os.path.abspath("../client"))
import client
hand_motor = [5, 6, 13, 19]
bottom_motor = [12, 16, 20, 21]
motor3 = [4, 17, 27, 22]
motor4 = [24, 25, 8, 7]
DEGREES_PER_STEP = 0.7031... |
# -*- coding: utf-8 -*-
# Copyright 2019 The Aerospace Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
import youtube_dl
from mopidy import httpclient
# import os
from unittest import mock
import pytest
import vcr
from mopidy_youtube import Extension, backend, youtube
from mopidy_youtube.apis import youtube_api, youtube_bs4api, youtube_scrapi
proxy = None # httpclient.format_proxy(config['proxy'])
youtube.Video.proxy... |
from __future__ import annotations
from typing import Mapping, List, Optional, Any, Dict, Callable, Tuple, TypeVar, Type, Set
from dataclasses import dataclass, field
import schema # type: ignore
from ml.kore import ast as kore
from ml.kore.parser import parse_pattern
from ml.kore.utils import KoreUtils
from .temp... |
# coding=utf-8
# Copyright 2019 The Google Research 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 applicab... |
import s3fs
import os
from os.path import dirname
import json
import logging
from collections.abc import MutableMapping
from contextlib import contextmanager
from retrying import retry
from urllib.parse import urlparse
from sklearn.externals import joblib
import wrapt
class ProxyObjectWithStorage(wrapt.ObjectProxy):... |
from bs4 import BeautifulSoup
import cloudscraper
from fp.fp import FreeProxy
import json
import requests
from selenium import webdriver
import time
from tinydb import TinyDB, Query
from webdriver_manager.chrome import ChromeDriverManager
collection_trait_dict = {}
def validate_params(db_name, name, count):
if n... |
import os
import numpy as np
import time
import sys
import paddle.v2 as paddle
import paddle.fluid as fluid
import reader
def conv_bn_layer(input, num_filters, filter_size, stride=1, groups=1,
act=None):
conv = fluid.layers.conv2d(
input=input,
num_filters=num_filters,
fi... |
# -*- coding: utf-8 -*-
import os
import csv
from bs4 import BeautifulSoup
INFO = {'download_path': 'download/docs',
'doc_base_url':
'https://facebook.github.io/react-native/releases/0.40/docs{}',
'out_file': 'output.txt'}
HOME_LINK= 'http://facebook.github.io/react-native/docs/getting-started.ht... |
from django import forms
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
import pytz
from rest_framework import fields, permissions, relations, serializers
from rest_framework.authentication import SessionAuthentication, CSRFCheck
... |
#!/usr/bin/env python
from __future__ import print_function
"""
Output a list of active residues surrounding active residues given as input
usage: passive_from_active.py <pdb> <active-residues> [-c CHAIN_ID] [-s SURFACE_RES_LIST]
"""
import argparse
import os
import sys
import contextlib
try:
from Bio.PDB imp... |
import pyrebase, json, threading, telegram, os, time
from telegram.ext.updater import Updater
from telegram.update import Update
from telegram.ext.callbackcontext import CallbackContext
from telegram.ext.commandhandler import CommandHandler
from telegram.ext.messagehandler import MessageHandler
from telegram.ext.filter... |
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2015 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... |
# Copyright 2021 Softwerks 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... |
from __future__ import division
import datetime
import pytest
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose
from pyamps.sh_utils import SHkeys, nterms, legendre, getG0, get_ground_field_G0
@pytest.mark.incremental
@pytest.mark.parametrize("N, M, idx", ([5, 3, 13],
... |
import itertools
from collections import OrderedDict
import pytest
import pytorch_testing_utils as ptu
import torch
import pystiche
from pystiche.misc import build_complex_obj_repr
from tests.utils import skip_if_cuda_not_available
class TestComplexObject:
def test_repr_smoke(self):
class TestObject(p... |
"""Core Configuration and MLAB objects."""
from __future__ import annotations
import warnings
from copy import deepcopy
from dataclasses import dataclass
import numpy as np
@dataclass
class Configuration:
"""
A single ab initio calculation.
Parameters
----------
name : str
The name of ... |
import boltons.fileutils
import copy
import datetime
import glob
import json
import logging
import logging.config
import numpy as np
import os
import pandas as pd
import pytest
import hcnn.common.config as C
import hcnn.data.cqt
import hcnn.driver
logger = logging.getLogger(__name__)
logging.config.dictConfig({
... |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... |
import csv
import h5py
import numpy as np
import os
import random
from abc import ABCMeta, abstractmethod
class Callback(metaclass=ABCMeta):
"""Callbacks can be used to listen to events during RL loop execution."""
def on_loop_start(self):
"""Event when loop starts.
Note:
You ca... |
#!/usr/bin/python3
import time, subprocess, json, random, os, signal, sys, importlib, importlib.util, os.path, traceback, atexit, datetime, hashlib
import multiprocessing.dummy as multiprocessing
from functools import partial
import requests
from flask import Flask, request, abort
from flask_apscheduler import APSched... |
import scipy.io
import numpy as np
import re
import glob
import os
import pandas as pd
def importJRCLUST(filepath, annotation='single', depth=250):
"""
Imports the features of the JrClust output I use most.
inputs:
filepath - str with path to S0 filename
annotation - str that indicates whi... |
from collections import Counter, defaultdict
from itertools import islice
from logging import getLogger
from random import sample
from rdflib import Literal, RDF, RDFS
from six.moves.urllib.parse import urldefrag, urlparse
from toposort import toposort
from ontology_alchemy.base import RDFS_Class, RDF_Property
from o... |
from blackmagic import raise_on
from blackmagic import segaux
from blackmagic import skip_on_empty
from blackmagic import skip_on_exception
from blackmagic import workers
from blackmagic.data import ceph
from cytoolz import assoc
from cytoolz import count
from cytoolz import dissoc
from cytoolz import do
from cytoolz i... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
'''
Coded by <NAME> (University of Science and Technology of China) in 06/2019
and checked by <NAME>(University of Science and Technology of China).
This program is free: you can redistribute it and/or modify it under the terms of
the Apache License Version 2.0, Janua... |
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision.utils as vutils
import torchvision.transforms as transforms
from torch.nn import init
import models.networks as networks
from models.networks.encoder import ShapeEncoder, PriorEncoder, GaussianEncoder
from models.networks.... |
#!/usr/bin/env python3
"""LevelStratux reads messages from a Stratus box using the GDL 90 protocol and
outputs dump978 format data (without the time).
Given a port number (supplied in :mod:`fisb.levelStratux.levelStratuxConfig`),
we create an UDP server (not client) that Stratus will connect to (assuming
we have a DH... |
import torch.nn as nn
import torch
import numpy as np
import torch.nn.functional as F
from utils import flatten, set_weights
from subspaces import Subspace
Tensor = torch.cuda.FloatTensor if torch.cuda.is_available() else torch.Tensor
def log_gaussian_loss(output, target, sigma, no_dim):
exponent = -0.5 * (targe... |
from __future__ import absolute_import, division, print_function, unicode_literals
import operator_benchmark as op_bench
import torch
import torch.nn.quantized as nnq
"""
Microbenchmarks for qConv operators.
"""
# Configs for qconv1d
qconv_1d_configs = op_bench.config_list(
attrs=[
# Shape matching the... |
"""
Simulation of Blackjack.
This is a simplified version of blackjack with the following features:
- Cards are picked from a french deck of size 52. The deck is refreshed at each
episode.
- At the first hand the player is given two cards and the dealer one
- At each step the player chooses whether to ``stay``, ``h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.