text stringlengths 6.04k 39.5k |
|---|
import sys
from code.core.enumerations import *
class DefinitionSet:
# |, * and all brackets are BNF metasymbols: |()[]<>, but + is part of syntax:
EBNF = "((--<optionName>|-<shortOptionName>)[+|-|:<value>])*"
BNF = [
"<command-line-element> ::= <option> | <file>",
"<option> ::= <op... |
# coding: utf-8
# # Model
# In[551]:
get_ipython().run_line_magic('config', "InlineBackend.figure_format = 'retina'")
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
from itertools import groupby
from math import sqrt
# ### C... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Importing modules
import os
import sys
import tqdm
import gc
import argparse
import pathlib
import copy
# This function iterates over the file with matching barcodes and sequencing runs, and creates a dictionary with matched barcodes and sample names
# Input: Path to ... |
#!/usr/bin/env python3
import json
import math
import numpy as np
import re
import sys
from terminaltables import AsciiTable
from termcolor import colored
from scipy.stats import ttest_ind
p_value_significance_threshold = 0.001
min_iterations = 10
min_runtime_ns = 59 * 1000 * 1000 * 1000
min_iterations_disabling_min_... |
# This file is Copyright 2021 Volatility Foundation and licensed under the Volatility Software License 1.0
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
import logging
from typing import List, Iterator, Tuple, Generator
from abc import ABC, abstractmethod
from enum import Enum
from v... |
"""Functions related to reading and writing data."""
import logging
import io
# import argparse
from collections import Counter
from pathlib import Path
from sys import path as sys_path
import requests
from . import psize
from . import inputgen
from . import cif
from . import pdb
from . import definitions as defns
fro... |
# 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 to in writing, ... |
import unittest
import re
import pytest
import numpy as np
from scipy.optimize import check_grad
from six.moves import xrange
from sklearn.metrics import pairwise_distances
from sklearn.datasets import load_iris, make_classification, make_regression
from numpy.testing import assert_array_almost_equal, assert_array_equa... |
import numpy as np
from core.polymer_chain import Polymer
from core.polymer_chain import RandomChargePolymer
from pymatgen import Molecule
from utils import dihedral_tools
import unittest
__author__ = "<NAME>"
class TestPolymer(unittest.TestCase):
@classmethod
def setUpClass(cls):
# setup for polymer... |
"""a rewrite of cnn.py
this version is mostly inspired by
NIPS2017 (mask cnn).
see https://github.com/leelabcnbc/thesis-proposal-yimeng/blob/master/thesis_proposal/population_neuron_fitting/maskcnn/cnn.py
"""
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.nn import init as nn... |
import cv2
import glob, os
import numpy as np
import re
import fnmatch
import pickle
import random
from shutil import copy, copyfile
import json
def saveAnnotation(jointCamPath, positions):
fOut = open(jointCamPath, 'w')
fOut.write("F4_KNU1_A " + str(positions[0][0]) + " " + str(positions[0][1]) + "\n")
f... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from future.utils import python_2_unicode_compatible
import logging
import textwrap
import requests
from copy import deepcopy
from functools import lru_cache
from protmapper.api import ProtMapper, default_site_map
fr... |
import json
from PIL import Image
import torch
from torchvision.transforms import ToTensor
from codes.datasets.MVM3D import *
import warnings
from codes.EX_CONST import Const
warnings.filterwarnings("ignore")
class MVM3D_loader(VisionDataset):
def __init__(self, base, train=True, transform=ToTensor(), target_tra... |
from datetime import date, timedelta
from pathlib import Path
import string
import unittest
from hypothesis import given, example, assume
import hypothesis.strategies as st
import msutils
TEST_DIR = Path(__file__).parent
good_names_dir = Path(TEST_DIR, 'sample-names/pass')
bad_names_dir = Path(TEST_DIR, 'sample-nam... |
import asyncio
from datetime import datetime, timedelta
from random import choice, randint
from typing import Union
import aiosql
import discord
import psutil
from discord.ext import commands
from discord.ext.commands import errors
import bitbay
import dimond
import dimsecret
import missile
import tribe
from bruckser... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.dateparse import parse_date
from applications.academ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 14:50:14 2018
@author: Kaushik
"""
'''
# Known symmatric distances
locations = ["New York", "Los Angeles", "Chicago", "Minneapolis", "Denver", "Dallas", "Seattle",
"Boston", "San Francisco", "St. Louis", "Houston", "Phoenix", "Salt Lake City"]
dist_ma... |
#!/usr/bin/env python3
""" Bootloader for AVR-Boards connected via CAN bus
Format:
11-Bit Identifier
1. Board Identifier
2. Message Type
3. Message Number
4. Message Data Counter
5.-8. Data
"""
import time
import math
import Queue
import threading
import can
import message_filter as filter
from util import inte... |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
# Copyright 2020 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, ... |
import logging
from collections import defaultdict
from datetime import datetime
from math import isnan
from timeit import default_timer as timer
import gtfs_kit
from django.contrib.gis.db import models
from django.contrib.gis.geos import LineString, Point
from django.db import transaction
from django.utils import tim... |
"""
Simulation of the VPython camera geometry.
Version using wx widgets. <NAME>, England, 11 March 2014.
================================================================================"""
from __future__ import division, print_function
import visual as vs # for 3D panel
import wx # for widgets
# Draw window &... |
from .base import *
from .community_damage_sampling import *
from .downtime_logistics import *
def load_results(input_filenames, output_filename, i_analysis, options):
####
[i_damage, i_impeding_factors, i_cordons] = i_analysis
if input_filenames is None:
new_analysis = False
else:
ne... |
# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ
# SPDX-FileCopyrightText: 2021 <NAME>
# SPDX-License-Identifier: MIT
class StandardProperties:
"""
This class contains a listing of default parameters that can be used.
These values are sensible default values but are generally n... |
import os
import numpy as np
import json
import random
import jieba
import collections
from tqdm import tqdm
import config.args as args
from util.Logginger import init_logger
from pytorch_pretrained_bert.tokenization import BertTokenizer
logger = init_logger("QA", logging_path=args.log_path)
with open('TC/pybert/io/P... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_auc_score, roc_curve, classification_report
from xgboost import XGBClassifier
from time import time
idx = pd.IndexSlice
# COMMAND ----------
# MAGIC %md General
# COMMAND ----------
def coun... |
# Copyright (c) 2012-2016 Seafile Ltd.
# encoding: utf-8
import os
import logging
import json
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect, Http404, \
HttpResponseBadRequest
from django.utils.translation import ugettext as _, activate
from django.contrib import mes... |
# Implementation based on tf.keras.callbacks.py and tf.keras.utils.generic_utils.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/keras/callbacks.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/ker... |
#!/usr/bin/env python
import itertools
import optparse
from anytree import NodeMixin, RenderTree
from util_mm import createClauseList, createTempRel, readIntervalDict
class TableauBase(object):
test = 1
class TableauBranch(TableauBase):
def __init__(self):
self.closed = False
class TableauNode(TableauBase,... |
# Copyright 2019 Xilinx 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, ... |
# coding=utf-8
import os
import unittest
import pandas as pd
from sklearn.svm import SVC
from sklearn.naive_bayes import BernoulliNB
import gramex.ml
import gramex.cache
from nose.tools import eq_, ok_
from pandas.util.testing import assert_frame_equal as afe
from . import folder
class TestClassifier(unittest.TestCas... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
from tqdm import tqdm
from functools import reduce
import disk.funcs as dfn
import h5py
import os
import glob
import sys
from matplotlib import pyplot as plt
class binary_mbh(object):
def __init__(self, filename):
self.parse_file(filename)
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import torch
try:
import colossal_C
except:
print('Colossalai should be built with cuda extension to use the FP16 optimizer')
from torch.optim import Optimizer
from colossalai.context.parallel_mode import ParallelMode
from colossalai.core import global_context... |
import math
import os
import random
import time
import gc
import dgl
import dgl.function as fn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.decomposition import PCA
from dataset import load_dataset
from utils import compute_spectral_emb, entropy
def neighbor_ave... |
import os, sys, traceback
import re, time, datetime, inspect
import shutil, atexit
import subprocess,collections
import yaml
from awsRESv2 import *
#version 2: add command cli recording
def print_color(message, color="black", style="{}", newLine=True):
COLORS = {
"black": "\x1b[30m",
"red": "\x1b[... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
" Location Head."
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import kaiming_uniform, normal
from alphastarmini.lib.hyper_parameters import Arch_Hyper_Parameters as AHP
from alphastarmini.lib.hype... |
import os
import gzip
import logging
import tempfile
from pathlib import Path
import h5py
import numpy
import sunpy.map
from astropy import units as u
from astropy.io import fits
from astropy.time import Time
from sunpy.util.exceptions import warn_user
from sunkit_instruments.suvi._variables import (
COMPOSITE_M... |
import sqlite3
from tqdm import tqdm
import numpy as np
import array
import sys
import math
import os
import multiprocessing
import shutil
import pandas as pd
from scipy.signal import savgol_filter
class Reload:
def __init__(self, path_pri, path_tra, fold):
self.path_pri = path_pri
self.path_tra =... |
import unittest
from enum import Enum
from typing import List, Optional, Tuple, Union, Callable
import torch
import torch.nn as nn
from torch import Tensor
import alpa.torch.optim as torchoptim
from alpa.torch.trainer import train_torch_module
import alpa
# Copied from timm
# https://github.com/rwightman/pytorch-ima... |
"""
Signal processing.
"""
import collections.abc
import logging
from typing import Tuple
import numpy as np
from ridge_detection.helper import displayContours, save_to_disk
from ridge_detection.lineDetector import LineDetector
from ridge_detection.params import Params
from scipy import ndimage as ndi
from skimage.fil... |
import asyncio
import collections
import functools
import inspect
import traceback
from bdb import BdbQuit
from contextlib import ExitStack, closing, redirect_stderr, redirect_stdout
from dataclasses import dataclass, field
from enum import Enum, auto
from io import StringIO
from pathlib import Path
from typing import ... |
"""
The custom component for local network access to Midea appliances
"""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
from typing import Any, cast, final
from homeassistant import config_entries
from homeassistant.components.network import async_get_ipv4_broadcast_... |
"""String-based code generation utilities."""
import re
import cypy
## Code generator
class CG(object):
"""Provides a simple, flexible code generator."""
@cypy.autoinit
def __init__(self, processor=None,
code_builder=cypy.new[list],
convert=str,
... |
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
import os
import shutil
from tempfile import TemporaryDirectory
import sys
import re
import json
from widgets.textviewer import *
from urllib.parse import urlparse
import requests
import threading
import webbrowser
import platform... |
# Author: <NAME>(ICSRL)
# Created: 4/14/2020, 7:15 AM
# Email: <EMAIL>
import tensorflow as tf
import numpy as np
from network.loss_functions import huber_loss, mse_loss
from network.network import *
from numpy import linalg as LA
class initialize_network_DeepQLearning():
def __init__(self, cfg, name, vehicle_nam... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ts=2 sw=2 et ai
###############################################################################
# Copyright (c) 2012,2013 <NAME> <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation... |
# Copyright (c) 2017-present, Facebook, 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... |
"""
Tests for building models for parameter selection
"""
from collections import OrderedDict
import sympy
from pycalphad import variables as v
from espei.parameter_selection.model_building import build_feature_sets, build_candidate_models
from espei.sublattice_tools import generate_symmetric_group, sorted_interacti... |
"""Use EDIA to assess quality of model fitness to electron density."""
import numpy as np
from . import Structure, XMap, ElectronDensityRadiusTable
from . import ResolutionBins, BondLengthTable
import argparse
import logging
import os
import time
logger = logging.getLogger(__name__)
class ediaOptions:
def __init... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import contextlib
import re
import sys
# NOTE: this module doesn't import sublime module so we can mock view/region etc in tests
LIST_ENTRY_BEGIN_RE = re.compile(
r"""^(
\s+[*] |
\s*[-+] |
\s*[0-9]+[.] |
\s[a-zA-Z][.]
... |
import logging
import os
import datetime
import random
import string
from nhd.NHDCommon import NHDCommon
from enum import Enum
from colorlog import ColoredFormatter
from kubernetes import client, config, watch
from kubernetes.client.rest import ApiException
from nhd.Node import Node
from typing import Dict, List, Set, ... |
import argparse
import logging
import os
import copy
from collections import defaultdict
from typing import List
import numpy as np
import torch
from sklearn import metrics
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataloader import DataLoader
from training.models import RNNClassifier
from opera... |
from skimage import exposure
from scipy.misc import imread
from scipy import ndimage
import numpy as np
import random
import os
from data_augmentation import *
from AxonDeepSeg.patch_management_tools import apply_legacy_preprocess, apply_preprocess
import functools
import copy
def generate_list_transformations(transf... |
import requests
from bs4 import BeautifulSoup
from ..common_functions import common_functions
from ..oger.ctrl.router import Router, PipelineServer
import codecs
import math
import os
def get_arrays_equality(arr1, arr2):
# This functions returns an array containing 0s and 1s
# 0 when arr1[i] != arr2[i] and 1 ... |
import time
import torch
import torch.nn as nn
import torch.utils as utils
from torch.autograd import Variable
import torchvision.datasets as dset
import torchvision.transforms as transforms
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
# import matplotlib
# matplotlib.use('agg')
import ma... |
#!/usr/bin/python
# coding=utf-8
#
# This script reformats a list of leaked names produced by ithitools option "-E".
# The script takes three parameters:
# $1: the file produced by ithitools
# $2: the file on which the formatted list of leaked named will be written
# $3: the list of top names
import codecs
import sys
... |
"""
Django views for interacting with Build objects
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from django.views.generic import DetailView, ListView, UpdateView
from django.forms import Hidde... |
import streamlit as st
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import altair as alt
from requests import get
import re
import os
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
import datetime
import time
import matplotlib.pyplo... |
"""This module contains the general information for StorageScsiLun ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class StorageScsiLunConsts():
ADMIN_STATE_CLEAR_TRANSPORT_READY = "clear-transport-ready"
... |
from dataclasses import dataclass
import flowpost.wake.helpers.wake_stats as ws
from wake_config import WakeCaseParams
import flowpost.IO.pyTecIO.tecreader as tecreader
import os
import numpy as np
from ...calc.stats import VelocityStatistics, ReynoldsStresses
###########################################################... |
import re
from typing import Dict, List, Tuple
import h5py
import numpy as np
from logzero import logger
from trcdproc.core import (
H5File,
Dataset,
Group,
subgroups,
datasets,
)
from trcdproc.navigate.common import wavelength_set
from trcdproc.reorganize.common import recursive_copy
def is_wit... |
"""
This module provides functions to get the dimensionality of a structure.
A number of different algorithms are implemented. These are based on the
following publications:
get_dimensionality_larsen:
- <NAME>, <NAME>, <NAME>, <NAME>. Definition of a
scoring parameter to identify low-dimensional materials compo... |
"""
This script generates multiple learning curves for different training sets.
It launches a script (e.g. trn_lrn_crv.py) that train ML model(s) on various training set sizes.
"""
from __future__ import print_function, division
import warnings
warnings.filterwarnings('ignore')
import os
import sys
from pathlib impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
An attempt to create a generic input file generator for different waveform
solvers.
:copyright:
<NAME> (<EMAIL>), 2013
:license:
GNU General Public License, Version 3
(http://www.gnu.org/copyleft/gpl.html)
"""
from wfs_input_generator.station_xml_helper \
... |
"""
Knauer pump control.
"""
import asyncio
import warnings
from enum import Enum
from typing import List
from loguru import logger
from flowchem.components.devices.Knauer.Knauer_common import KnauerEthernetDevice
from flowchem.components.stdlib import Pump
from flowchem.exceptions import DeviceError
from flowchem.un... |
# -*- coding: utf-8 -*-
# Copyright 2020 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 o... |
# Author: karl
# Created: 2020-06-21, 9:34 a.m.
import os
import copy
import time
import logging
import numpy as np
from typing import *
from mg_general import Environment
from mg_io.general import mkdir_p, write_to_file, remove_p
from mg_general.general import get_value, run_shell_cmd
from mg_options.parallelizati... |
import argparse
from glob import glob
import importlib
import hashlib
import logging
import os
from typing import Optional
from pydantic import BaseModel
import re
from sqlalchemy import create_engine, text
import sqlalchemy
from sqlalchemy import exc
from sqlalchemy.exc import InternalError, OperationalError
from sqla... |
import torch as th
import torch.linalg as linalg
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
import time
global device
device = th.device("cuda:0" if th.cuda.is_available() else "cpu")
global zero
class tuner:
def __init__(self):
self.lanbda = None
self.n_iter = None
s... |
import pandas as pd
import numpy as np
# turn off pink warning boxes
import warnings
warnings.filterwarnings("ignore")
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
#-----------------------------------------------------------------------------
# A... |
from pytest_bdd import when, given, then
from jinja2 import Environment, FileSystemLoader
from ebu_tt_live.documents import EBUTT1Document, EBUTT3Document, \
EBUTT3DocumentSequence, EBUTTDDocument
from ebu_tt_live.bindings.converters.ebutt1_ebutt3 import EBUTT1EBUTT3Converter
from ebu_tt_live.documents.converters i... |
#!/usr/bin/env python
"""
ViperMonkey: core package - ViperMonkey class
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source code or documentation
Proje... |
""" PyTorch dataset classes for molecular data. """
import itertools
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
from rdkit import Chem
# noinspection PyUnresolvedReferences
from rdkit.Chem import AllChem, rdmolops, rdPartialCharges, rdForceFieldHelpers, rdchem
from scipy impor... |
import sys
import os
import cv2
import glob
import math
from time import sleep, time
import matplotlib
matplotlib.use('agg')
import numpy as np
from time import time
from nnlib import nnlib
import matplotlib.pyplot as plt
from facelib import S3FDExtractor, LandmarksExtractor
class SlimFace(object):
def __init__... |
#!/usr/bin/env python
"""Parser for 454 Flowgram files in native binary format."""
__author__ = '<NAME>'
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__license__ = 'GPL'
__version__ = "1.5.3"
__credits__ = ['<NAME>']
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__status__ = 'Prototype'
from cStringIO ... |
import json
import logging
import math
import os
import pathlib
import subprocess
import numpy as np
import shapely.geometry
import shapely.affinity
import venn7.bezier
ROOT = pathlib.Path(os.path.realpath(__file__)).parent
class VennDiagram:
"""A simple symmetric monotone Venn diagram. The diagram is encoded ... |
# Copyright (c) 2019-2020, <NAME>
# License: MIT-License
import math
import re
from typing import TYPE_CHECKING, List, Sequence, Iterable
from typing import Tuple, Optional
from xml.etree import ElementTree
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttributes, DefSubclass, DXFAttr, ... |
#!/usr/bin/env python3
import re
import os
import sys
import json
import yaml
import glob
import shutil
import random
import logging
from pathlib import Path
logger = logging.getLogger('apiLogger')
path_to_src = Path(__file__, '../..').resolve()
path_to_data = path_to_src.joinpath('../data').resolve()
def find_path... |
import os
import random
import numpy as np
import logging
import argparse
import collections
import open3d as o3d
import sys
print(os.path.abspath(__file__))
sys.path.append(".")
import torch
import torch.nn.parallel
import torch.optim
import torch.utils.data
from util import config
from util.common_util import Ave... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... |
# Training a Dueling Double DQN agent to play break-out
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import utils
import gym
import numpy as np
from gym.core import ObservationWrapper
from gym.spaces import Box
import cv2
import os
import atari_wrappers # adju... |
# coding: utf8
"""
weasyprint.text
---------------
Interface with Pango to decide where to do line breaks and to draw text.
:copyright: Copyright 2011-2012 <NAME> and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division
# XXX No unicode_literals,... |
#!/usr/bin/python
# todo: preview doesnt work
# TODO: new types: pixel (rgba)
# todo: legacy? e.g. compute image of points, computation illustration etc.
# todo: doesn't detect wrong number of args
# todo: set color
# todo: filled julia with the number of it
# todo: implement missing rect and arg and line complex
# to... |
import pytest
# from snovault.schema_utils import load_schema
pytestmark = [pytest.mark.setone, pytest.mark.working, pytest.mark.schema]
@pytest.fixture
def biosample_cc_w_diff(testapp, de_term, lab, award):
item = {
"culture_start_date": "2018-01-01",
"differentiation_state": "Differentiated to... |
import numpy as np
import os
import csv
import sys
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from keras.callbacks import EarlyStopping, Callback
from keras.models import Model, Sequential, load_model
from keras.layers import Input, Dense, Dropout, Fla... |
import math
from .settings import pi, PI_HALF, nearly_eq
from .point import Point
from .basic import GeometryEntity
class LinearEntity(GeometryEntity):
def __new__(cls, p1, p2=None, **kwargs):
if p1 == p2:
raise ValueError(
"%s.__new__ requires two unique Points." % cls.__nam... |
"""API maintains queries to neural machine translation servers.
https://github.com/TartuNLP/sauron
Examples:
To run as a standalone script:
$ python /path_to/sauron.py
To deploy with Gunicorn refer to WSGI callable from this module:
$ gunicorn [OPTIONS] sauron:app
Attributes:
app (flask.... |
import argparse
import errno
import fnmatch
import os
import sys
import xml.sax
HELP_DESCRIPTION = '''Parse junit xml result from provided result dir.'''
EPILOG_TEXT = '''
-----------------------------------------------
PARSE JUNIT XML RESULT FROM PROVIDED RESULT DIR
-----------------------------------------------
... |
#!/usr/bin/env python3
# note structure of code taken from poretools https://github.com/arq5x/poretools/blob/master/poretools/poretools_main.py
import os.path
import sys
import argparse
# AAFTF imports
from AAFTF.version import __version__
myversion = __version__
from AAFTF.utility import status
def run_subtool(par... |
from django.http.response import Http404
from django.views.generic import DetailView, ListView, UpdateView, CreateView,DeleteView
from .models import Invoice, InvoiceItem, Receipt,ReceiptLine,Month,Year
from contact.models import Customer
from .forms import (InvoiceForm, InvoiceItemForm, InvoiceItemFormSet,ReceiptForm,... |
# coding=utf-8
#
# pylint: disable = wildcard-import, unused-wildcard-import
# pylint: disable = missing-docstring, invalid-name, no-member
# pylint: disable = too-many-statements, unused-argument
"""
Copyright (c) 2019, <NAME>. All rights reserved.
license: BSD 3-Clause License, see LICENSE for more details.
"""
... |
""" Defines JSON-format encoding and decoding functions """
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Gove... |
import time
import os
import sys
from datetime import datetime
from utilities.log import root_folder_all_code
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_root = dir_path.split(root_folder_all_code, 1)[0]
code_path = os.path.join(dir_root, root_folder_all_code)
sys.path.insert(0, code_path)
from seleniu... |
import torch
import numpy as np
from PIL import Image
from torchvision import transforms
import h5py
import matplotlib.pyplot as plt
import random
from torch.utils.data import Dataset, DataLoader, random_split
import torch.nn as nn
import torch.optim as optim
import os
from tqdm import tqdm
import time
import pickle
i... |
import geopandas as gpd
import pandas as pd
import xarray as xr
import numpy as np
from pathlib import Path
import sys
import netCDF4
import datetime
import metpy.calc as mpcalc
from metpy.units import units
# prsr = 101.3 * (((293.0-0.0065*Hru_elev_meters(i))/293.0)**5.26)
def std_pres(elev):
return 101.325 * ((... |
from __future__ import absolute_import
from builtins import next
from builtins import range
import os
import math
import os.path as op
import re
import shutil
from nipype.interfaces.base import (
TraitedSpec, traits, BaseInterface, File,
Directory, CommandLineInputSpec, CommandLine, DynamicTraitedSpec,
Base... |
"""
Class :py:class:`CGWMain` is a QWidget for interactive image
============================================================
Usage ::
import sys
from PyQt5.QtWidgets import QApplication
from psdaq.control_gui.CGWMain import CGWMain
app = QApplication(sys.argv)
w = CGWMain(None, app)
w.show()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.