text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2019, <NAME>.
# Distributed under the MIT License. See LICENSE for more info.
"""Get precipitation data, using the Frost API."""
import datetime
import pathlib
import requests
import numpy as np
from numpy.linalg import norm
import pyproj
from common import (
read_json_file,
write_json_file,
... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019, <NAME> and the archviz-vr-tools contributors
# SPDX-License-Identifier: BSD 2-Clause "Simplified" License
#
# mkvrjpg.py assembles a stereoscopic jpeg image from left and right eye
# images. These images can be separate files, or a single image with
# both images, eith... |
"""
Starling has a precise repository structure in order to separate the
base classes of the framework, the simulation models and the simulation data.
You will find here the structure of different parts of the project.
**Data folder generation**
The :data:`~starling_sim.utils.paths.data_folder` and sub-folders are n... |
import asyncio
from enum import unique, Enum
from logging import getLogger
from typing import Callable, Any, Union, Awaitable
import aiormq
import aiormq.types
from .exchange import Exchange, ExchangeType
from .message import IncomingMessage
from .queue import Queue
from .transaction import Transaction
log = getLogg... |
import argparse
import csv
import logging
import os
import random
import gym
from matplotlib import pyplot as plt
import numpy as np
import seeding
import torch
from tqdm import tqdm
from .utils import Trial
from .agents import DQNAgent, DirectedQNet, ActionDQNAgent
from .gscore import plot_confusion_matrix, calc_g_s... |
import unittest
class GenericTree:
""" A tree in which each node can have any number of children.
Each node is linked to its parent and to its immediate sibling on the right
"""
def __init__(self, data):
self._data = data
self._child = None
self._sibling = None
... |
"""
Command-line interface for interacting with Luigi scheduler.
"""
import json
import requests
import datetime
import click
from fnmatch import fnmatch
import sys
from os.path import join
from collections import Counter
from babel.numbers import format_number
class TooManyTasksError(Exception):
def __init__(sel... |
# -*- coding: utf-8 -*-
""" conda_content_trust.signing
This module contains functions that sign data using ed25519 keys, via the
pyca/cryptography library. Functions that perform OpenPGP-compliant (e.g. GPG)
signing are provided instead in root_signing.
Function Manifest for this Module:
serialize_and_sign
... |
"""
Created on Dec 25 2017
@author: <NAME>
"""
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import str
from past.utils import old_div
import urllib.request, urllib.parse, urllib.error
import base64
import datetime as datetime_lib
import re
from... |
# -*- coding: utf-8 -*-
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Copyright 2016 Intel 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/lic... |
import argparse
import logging
import logging.config
import os
import shutil
import sys
from functools import partial
import tarpn.netrom.router
from tarpn.application import TransportMultiplexer, MultiplexingProtocol, ApplicationProtocol
from tarpn.application.command import NodeCommandProcessor
from tarpn.applicatio... |
#!/usr/bin/python3
import sys, os, re, json, yaml, signal
from jenkinsapi.jenkins import Jenkins
from jenkinsapi.utils.crumb_requester import CrumbRequester
# testfd=open('/tmp/test.txt', 'a+')
config = {
'server' : [{
'name': 'myServerName',
'url': 'http://127.0.0.1:8080/',
'user': 'test... |
"""
'AgentX Encodings' as described in https://tools.ietf.org/html/rfc2741#section-5
"""
import struct
from collections import namedtuple
from . import constants, util
class ObjectIdentifier(
namedtuple('_ObjectIdentifier', ('n_subid', 'prefix_', 'include', 'reserved', 'subids'))
):
"""
From https://too... |
import copy
import utils
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from torch import optim
from tqdm import tqdm as _tqdm
import random
from collections import defaultdict
import numpy as np
def make_epsilon_greedy_policy(Q, epsilon, nA):
"""
Creates an epsilon-gree... |
"""\
Query the user for all the input data needed for a design. This includes a
starting PDB file, the backbone regions that will be remodeled, the residues
that will be allowed to design, and more. A brief description of each field is
given below. This information is used to build a workspace for this design
th... |
print(f'Loading {__file__}')
from ophyd import EpicsMotor, EpicsSignal, Device, Component as C
import time as ttime # tea time
from datetime import datetime
from ophyd import (ProsilicaDetector, SingleTrigger, TIFFPlugin,
ImagePlugin, DetectorBase, HDF5Plugin,
AreaDetector, Epic... |
# -*- coding: utf-8 -*-
# Copyright 2020 ICON Foundation
#
# 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 ... |
#!/usr/bin/env python3
import configparser
import errno
import logging
import lzma
import sys
import zipfile
import mysql.connector
import numpy as np
import os
import re
from . import math_funcs
# =============================== set up logging ==============================
LOGDEFAULT = logging.INFO
logger = logg... |
#!/usr/bin/env python2
# 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 ... |
#!/usr/bin/env python
'''
Analyze the output from yamldriver.py
'''
import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import sys
from analytic_full_slab import (
get_parameters_for,
solution
)
MY_DIR = os.path.dirname(__file__)
sys.path.append(f'{MY_DIR}/..')
fr... |
# coding=utf-8
# Copyright 2020 The Trax 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 applicable law or a... |
import zipfile
import sys
import paradoxparser
import datetime
TECH_SCORE_MULTIPLIER = 10
ACCUMULATED_ENERGY_MULTIPLIER = 0.1
ACCUMULATED_MINERALS_MULTIPLIER = 0.05
ACCUMULATED_INFLUENCE_MULTIPLIER = 0.05
ENERGY_PRODUCTION_MULTIPLIER = 2
MINERAL_PRODUCTION_MULTIPLIER = 1.5
INFLUENCE_PRODUCTION_MULTIPLIER = 1
NUM_SUBJE... |
"""
Copyright 2017-2019 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca
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 numpy as np
from progressivis.core.utils import indices_len
from . import TableSelectedView
from . import Table
from ..core.slot import SlotDescriptor
from .module import TableModule
from ..core.bitmap import bitmap
from .mod_impl import ModuleImpl
from ..io import Variable
from ..stats import Min, Max
from .h... |
import astor
import z3
from .to_z3 import Z3Converter, get_minimum_dt_of_several_anonymous
from crestdsl import sourcehelper as SH
from .epsilon import Epsilon
import logging
logger = logging.getLogger(__name__)
def get_behaviour_change_dt_from_constraintset(solver, constraints, dt, ctx=z3.main_ctx()):
times = {c... |
# 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 writ... |
# Copyright 2019 ChangyuLiu Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import pandas as pd
import sys
from collections import defaultdict
from itertools import islice
import matplotlib.pyplot as plt
import time
def ReadRatings(file):
my_ratings_df = pd.read_csv(file)
return (my_ratings_df)
def ReadMovies(file):
my_movies_df = pd.read_csv(file)
return (my_movies_df)
d... |
print()
# Check core SDK version number
import azureml.core
from azureml.core import Environment, Experiment, ScriptRunConfig
from azureml.core.authentication import InteractiveLoginAuthentication
from azureml.core import Workspace,Datastore
print("SDK version:", azureml.core.VERSION)
REGISTER_MODEL = False
import... |
# coding: utf8
"""Create jobs in various configurations and run them.
The :class:`JobBuilder` class lets you build a combination of parameters easily.
It produces a list of :class:`Job` instances.
When running a job, you get a :class:`JobResult`.
"""
import itertools
class Job(object):
"""A concrete, runnable s... |
import asyncio
import discord
from cogs.utils import checks
from discord.ext import commands
from __main__ import send_cmd_help
import json
import os
from .utils.dataIO import dataIO
from .utils.chat_formatting import pagify, box
menu = {
"reply": "✅",
"delete": "❌"
}
class ModMail:
def __init__(self, ... |
import imgui
from .data import *
from .projects import Project
import glfw
def _annotation_screen(frame_data, img_render_id, allow_edit=True):
img_data = frame_data["imgs_to_render"][img_render_id]
img_info : ImageInfo = img_data["img_info"]
labeling = frame_data["labeling"]
project : Project = frame... |
import pandas as pd
from pprint import pprint
import time as time
import signal
import re
from tqdm import tqdm
import scipy
from scipy import sparse
from scipy import stats
import pubchempy as pcp
from chembl_webresource_client.new_client import new_client
import json
import requests
import copy
import sys
sys.p... |
"""
DIRBS CLI for cataloging data received by DIRBS. Installed by setuptools as a dirbs-classify console script.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the d... |
import json, logging
from functools import wraps
from flask import Blueprint, request, make_response, Response, jsonify
from flask.templating import render_template
from nlpipe.TaskManagers.DatabaseTaskManager import Task
from nlpipe.Tools.toolsInterface import UnknownModuleError, get_tool, known_tools
from nlpipe.Serv... |
"""
This file implements the Scipy solver and second order SQP
Author: <NAME>
Date : 11/06/2020
"""
import numpy as np
import math
import time
import gurobipy as gp
from gurobipy import GRB
from scipy.optimize import minimize
from scipy.optimize import NonlinearConstraint
import matplotlib.pyplot as p... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Ericsson AB
#
# libpaf.py - A Python API to the Pathfinder client library.
#
import sys
import os
import socket
import collections
import enum
from ctypes import *
paf_c = CDLL("libpaf.so.0", use_errno=True)
lib_c = CDLL("libc.so.6", use_errno=True)
paf_va... |
#!/usr/bin/python
# Copyright 2020 Red Hat, 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 ... |
'''
@author: <NAME>
'''
import torch
import torch.nn as nn
from torch.autograd import Function
class SVD_PI(nn.Module):
"""Forward Pass: SVD
Backward Pass: Power Iteration (PI) to approximate gradients
Args:
is_vec: whether the output is a vector or not
input_dim: the #channel of i... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import math
import warnings
from typing import Callable, List, Optional
import t... |
"""Implementation of Linear Regression using various fitting methods
Author: <NAME>
Created: May 23, 2020
"""
import numpy as np
from learning.base import LinearBase
from scipy.linalg import solve_triangular
from scipy.optimize import minimize
from typing import Dict, Union
import matplotlib.pyplot as plt
class Linear... |
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2016-2017, Rackspace Inc."
__email__ = "<EMAIL>"
from logging import getLogger
from collections import namedtuple
from datetime import datetime
from bson.json_util import loads
# initial load completed --init-load-save-ts ts, status=1
# init load... |
"""
This file is subject to the terms and conditions defined in the
LICENSE file, which is part of this source code package.
"""
from .DigitalObjectCache import DigitalObjectCache
from .EacCpf import EacCpf
from .HtmlPage import HtmlPage
import Cfg
import Timer
import Utils
import logging
import os
import re
class ... |
"""this module is to create sqlalchemy mapper for IRC database
to be created for Post-Processing"""
from sqlalchemy import Column, Integer, String, create_engine, Index
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from sqlalchemy.sql import and_
from sqlalchemy.sql import sel... |
# -*- coding: UTF-8 -*-
"""
:Script: sampling_grid.py
:Author: <EMAIL>
:Modified: 2018-01-28
:Purpose: tools for working with numpy arrays
:Source:
: http://www.arcgis.com/home/item.html?id=ddb2deec9b5e4a09affe60de68f5ff4e
:
:References:
:----------
:Phish_Nyet.py
: https://community.esri.com/blogs/da... |
from __future__ import print_function, division
import os
import time
import cv2
import numpy as np
import onnxruntime
import torch
from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision import models, transforms
from mnext import mnext
from utils import progress_bar
def softmax_np... |
import torch
import pickle
import pandas as pd
import torch
from torch.utils.data import TensorDataset, random_split, DataLoader
import numpy as np
import warnings
from tqdm import tqdm_notebook as tqdm
from typing import List, Tuple
NUM_MAX_POSITIONS = 256
BATCH_SIZE = 32
class TextProcessor:
# special tok... |
import argparse
import json
import math
import os
import pdb
import shutil
import time
from functools import partial
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
fro... |
"""
dist_qsub_diagnostic.py
This script can be used as a tool to diagnose dist_qsub runs:
- What's missing completely?
- What's finished?
- What's not finished?
- What's not finished but also no longer managed by dist_qsub?
Additionally, this script can be used to patch holes in dist_qsub runs.
NOTES:
- Contents o... |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import types
from datetime import timedelta
from timeit import default_timer as timer
from typing import Any
from typing import cast
from typing import Collection
from typing import Container
from typing import Optional
from vdk.interna... |
"""
Finds usage of API in project. (Done in ALPPipelineCombProjectForAPIUsageGraphBuilder.java)
"""
# print('importing')
import networkx as nx
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_selection import mutual_info_classif
import sys
import ne... |
#! /usr/bin/env python
# pylint: disable=line-too-long
"""
All APIS and regural expresions for url requests.
Code style example:
===== Function
_request_re = re.compile(r'^/*([-_A-Za-z0-9]+)/?$')
def request(environ, start_response):
status = '200 OK' # HTTP Status
headers = [('Content-type', 'text/html'),
... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.1'
# jupytext_version: 0.8.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# cod... |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# ... |
from __future__ import unicode_literals, print_function
import sys
import logging
import re
from libraries.aws_tools.s3_handler import S3Handler
from libraries.aws_tools.dynamodb_handler import DynamoDBHandler
from libraries.aws_tools.lambda_handler import LambdaHandler
from libraries.gogs_tools.gogs_handler import Gog... |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import os
import json
import pickle
import numpy as np
from Bio import SeqIO
from sklearn import svm
from pubscripts import *
from descnucleotide import *
# To get the common OG which have dN/dS and conservation score
def common_OG() :
OG1 = list()
... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... |
import pyspark
import pyspark.sql.functions as F
import pyspark.sql.types as T
from pyspark.sql import Window
import re
from datetime import datetime
import pytz
import pandas as pd
import dateutil.parser as dp
def repartition(df, repartition=None):
assert isinstance(df, pyspark.sql.dataframe.DataFrame)
ret... |
import matplotlib
matplotlib.use('Agg')
import os, sys
import yaml
from argparse import ArgumentParser
from tqdm import tqdm
import imageio
import numpy as np
from skimage.transform import resize
from skimage import img_as_ubyte
import torch
from modules.generator import OcclusionAwareGenerator
from modules.keypoint_... |
# Lint as: python3
"""Tests for improve_nas.
Copyright 2019 The AdaNet 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
https://www.apache.org/licenses/LICENSE-2.0... |
import pagefetch
import pagechecker
from pprint import pprint
from testutils import filterBenign, filterMalicious, loadExpectedResults, generateCsvReport, writeResultToFile
def staticHeuristicsDatabaseTest(connectionString, databaseName, collectionName, numberOfPages, offset = 0, expectedResultsPath = None):
page... |
from flask import render_template, Blueprint, g, redirect, request, current_app, abort, url_for, jsonify
from flask_babel import gettext
from datetime import datetime, date
from app import app
from .data_loader import get_assistant_list, get_doctor_list, get_frontpage_entry_list, get_job_list, get_location_list, get_... |
#!/usr/bin/env python3
import click
import os
import random
import numpy as np
import torch
from torch import nn
from emtgan.common import *
from emtgan.datasets import *
from emtgan.models import *
from emtgan.utils import *
random.seed(1234)
np.random.seed(1234)
# set hyperparameters
discriminator_lr = 0.001
ge... |
from MagniPy.Workflow.grism_lenses.he0435 import Lens0435
# from MagniPy.Workflow.grism_lenses.he0435_satellite_convention_phys import Lens0435 as
from MagniPy.Workflow.grism_lenses.lens2033 import WFI2033
from MagniPy.Workflow.grism_lenses.rxj1131 import Lens1131
from MagniPy.Workflow.radio_lenses.lens1115 import Lens... |
"""MNE inverse solution."""
# Created on Mon May 2 17:24:00 2016
# @author: pasca
import os.path as op
import sys
import glob
from nipype.utils.filemanip import split_filename as split_f
from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec
from nipype.interfaces.base import traits, File, Traited... |
# -*- coding: utf-8 -*-
"""Base and helper classess for capturing adapters.
"""
from EasyVision.base import *
from collections import namedtuple
from datetime import datetime
import cv2
try:
import cPickle as pickle
except:
import pickle
class Image(NamedTupleExtendHelper, namedtuple('_Image', ['source', '... |
import filecmp
import os
import shutil
import stat
import subprocess
from pathlib import Path
import pytest
from cleo import CommandTester
from ruamel.yaml import YAML
from autojail.main import AutojailApp
project_folder = os.path.join(os.path.dirname(__file__), "test_data")
autojail_root_folder = Path(__file__).par... |
# coding: utf-8
import time
import logging
import asyncio
import threading
import functools
import common.tools as tools
from common.service import *
logger = logging.getLogger(__name__)
import twitchio
from twitchio.ext import commands
@tools.decorate_all_methods(tools.catch_exception(logger=logger))
class Main(Servi... |
# encoding : utf-8
import sys
import codecs
import logging
import functools
from pathlib import Path
import tensorflow as tf
# tf.enable_eager_execution()
from tf_metrics import precision, recall, f1
"""Setup logging"""
# excellent way to create directory
Path('results').mkdir(exist_ok=True)
# set the priority of th... |
import unittest
import random
import time
import base64
import json
import requests
from flask import Flask, jsonify, make_response, request, redirect
from multiprocessing import Process
import jose
from backend.czi_hosted.common.config.app_config import AppConfig
from backend.test.test_czi_hosted.unit import test_se... |
import numpy as np
import pylab as pl
import os
from lib_predict_io import dist_mod2pi, load_simulation_data, load_experiment_data, cfgfname
tr, inv, log, det, pi, sqrt = np.trace, np.linalg.inv, np.log, np.linalg.det, np.pi, np.sqrt
from scipy.stats import multivariate_normal as mvn
import pandas as pd
# # # # PARAME... |
#!/usr/bin/env python
"""
Copyright (c) 2015 <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, merge, publi... |
import os #, traceback, ipdb
#os.environ["CUDA_VISIBLE_DEVICES"]="0"
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as distrib
import numpy as np
import matplotlib.pyplot as plt
from omnibelt import get_printer
import omnifig as fig
prt = get_printer(__name__)
try:
... |
import unittest
import os
import torch
import torch.distributed as dist
import torch.optim as optim
import torch.multiprocessing as mp
import logging
from pytorch_metric_learning.utils import distributed, common_functions as c_f
from pytorch_metric_learning import losses, miners
from torch.nn.parallel import Distribute... |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "<NAME>" at 10:21, 17/03/2020 %
# ... |
from torch.utils.data.dataset import Dataset
import torch
import os
import pickle
from liegroups.torch import SO3
class KAISTDataset(Dataset):
def __init__(self, args):
self.name = args.dataset_name
self.path_data_save = args.path_data_save
self.path_results = args.path_results
self.path_temp = args.path_temp... |
# built-in
import torch
import numpy as np
from collections import defaultdict
import matplotlib.pyplot as plt
import cv2
import pickle
import os
from torch.utils import data
from torchvision import transforms
from retinanet.dataloader import IL_dataset, Normalizer, Resizer, Augmenter
THRESOLD = 0.25
# TODO 下面的cat_id... |
import logging
import django
import decimal
import datetime
import copy
from packaging import version
logger = logging.getLogger(__name__)
DJANGO_VER = version.parse(django.get_version())
if DJANGO_VER < version.parse('1.9'):
MANY_TO_ONE_REL_TYPE = 'django.db.models.fields.related.ManyToOneRel'
RELATED_MGR_T... |
#!/usr/bin/env python3
import atexit
import os
import textwrap
import threading
import time
import urllib.parse
from pathlib import Path
from subprocess import call
from urllib.request import urlretrieve
import dbus.mainloop.glib
import dbus.service
import ueberzug.lib.v0 as ueberzug
from gi.repository import GLib
i... |
""" Github API wrapper"""
import logging
from base64 import b64decode
from dataclasses import dataclass
from typing import Iterator, List, Optional
from urllib.parse import urlparse
import yaml
from django.conf import settings
from django.db.models import F, Q
from github import ContentFile, Github, GithubException, I... |
import sys
import os
import pandas as pd
import numpy as np
import sys
import random
from trackml.dataset import load_event
from trackml.dataset import load_dataset
from trackml.randomize import shuffle_hits
from trackml.score import score_event
import multiprocessing
from multiprocessing import Process, Value, Lock... |
import pandas as pd
import os
import numpy as np
import random
from string import ascii_uppercase as GROUPNAMES
GROUPNAMES=list(GROUPNAMES)
class person:
def __init__(self, id='0', name='example', event=[], newbie=True, inner_id=0):
self.id=id
self.name=name
self.event=event
self.n... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Imported from https://github.com/dong-x16/PortraitNet
"""
import cv2
import math
import random
import json
import base64
import zlib
import numpy as np
from PIL import ImageEnhance
from pycocotools import mask as maskUtils
# global parameter
set_ratio = 0.5
def load_... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use AWS Identity and Access Management (IAM) accounts.
"""
# snippet-start:[python.example_code.iam.account_wrapper.imports]
import logging
import pprint
import sys
import time
import b... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 25 09:35:33 2017
@author: galad-loth
"""
import numpy as npy
import mxnet as mx
from custom_layers import DeepCompareLossLayer
def GetSharedConvNet(data,conv_weight, conv_bias):
shared_net = mx.sym.Convolution(data=data, kernel=(7, 7), stride=(3,3),
... |
# Copyright (c) 2020, NVIDIA CORPORATION. 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... |
import numpy as np
import pandas as pd
from plot import plot_bin, plot_curve, plot_int, plot_net
def load_prob(args, ind, plot_set, params):
plot_data = {}
for clf in args.clf:
if plot_set == 'valid':
file_path = args.ssc_path[clf] + 'valid_prob.csv' if not ind else args.ssc_path[clf] + '... |
"""Utilities for checking that internal ir is valid and consistent."""
from typing import List, Union, Set, Tuple
from mypyc.ir.pprint import format_func
from mypyc.ir.ops import (
OpVisitor, BasicBlock, Op, ControlOp, Goto, Branch, Return, Unreachable,
Assign, AssignMulti, LoadErrorValue, LoadLiteral, Get... |
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. T... |
from flask import (
Markup,
abort,
flash,
redirect,
render_template,
request,
url_for,
)
from flask_login import current_user, login_required
from app import (
api_key_api_client,
current_service,
notification_api_client,
service_api_client,
)
from app.main import main
from ... |
# from:
# http://crockford.com/javascript/tdop/tdop.html
# https://github.com/douglascrockford/TDOP
# <NAME>
# 2021-05-04
# Public Domain
import sys # stderr
import readline # enable editing in input()
# Produce simple token objects from a string.
# A simple token object contains ... |
import numpy as np
import pytest
from pydrobert.speech import post
@pytest.fixture(
params=[np.float64, np.float32, np.int32, np.int16],
ids=["f64", "f32", "i32", "i16"],
scope="module",
)
def dtype(request):
return request.param
@pytest.mark.parametrize("norm_var", [True, False])
@pytest.mark.para... |
import numpy as np
from math import pi, e
from sympy import Symbol, lambdify, exp, sin, cos, sinh, cosh, diff, sqrt,atan
from scipy.integrate import odeint
from matplotlib import pyplot as plt
class Free_1DoF_Vibrational_System:
mass = 50
k = 10
c = 0.001
delta = 0.0001
initial_position = 1
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module to detect flashing infrastructure and flash ap firmware.
This script automatically detects the f... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""S (voltage controled switch) Device.
Copyright 2014 <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 a... |
#!/bin/sh
# Copyright (c) 2019-2020, Lawrence Livermore National Security, LLC and
# other Serac Project Developers. See the top-level LICENSE file for
# details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
"exec" "python3" "-u" "-B" "$0" "$@"
# Python wrapper script for generating the correct cmake line with the op... |
import pandas as pd
from deprecated.df_utility import *
def get_feature(i,df):
pw1_key = 'features.' + str(i) + '.conv.0.0'
dw_key = 'features.' + str(i) + '.conv.1.0'
pw2_key = 'features.' + str(i) + '.conv.2'
pw1_row = df.loc[df['name'] == pw1_key]
dw_row = df.loc[df['name'] == dw_key]
pw2... |
from datetime import datetime, timedelta
from django.db import models
from django.db.models import F
from django.core import signing
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.auth.models import User
from theme.models import UserProfile
from utils impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.