text stringlengths 3.07k 12.6k |
|---|
# ----------------------------------------------------------------------
# |
# | Lexer.py
# |
# | <NAME> <<EMAIL>>
# | 2021-09-27 22:46:32
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2021
# | Distributed under the Boost Software License, Versi... |
# encoding: utf-8
# visualize.py
# TODO documentation
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
import scipy.stats as st
from matplotlib.ticker import LogFormatterMathtext, MaxNLocator, \
ScalarFormatter
from os.path import... |
from abc import ABC, abstractmethod
from typing import Dict, Generic, List, Optional, TypeVar
from .element import Element, Id
__all__ = ["ElementSupplyException", "ElementSupply", "InMemorySupply"]
class ElementSupplyException(Exception):
pass
E = TypeVar("E", bound=Element)
class ElementSupply(ABC, Generic[E... |
# Copyright (c) 2016 Huawei Technologies India Pvt.Limited.
# 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-... |
import json
import ProjectOverlayDataProcess as data
import pandas as pd
import utility_funcs as uf
import code
import numpy as np
"""
This is the big boy.
"""
def import_data():
return (data.import_dataframe("relevantgroups"),
data.import_dataframe("mandates"),
data.import_dataframe("top_c... |
# File generator script code is under MIT License
# Copyright (c) 2020 <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
# t... |
from .Signals import signal
from .Range import Range, Position
from .Logger import *
import builtins, re
class BufferBoundsException(IndexError): pass
class LineBoundsException(IndexError): pass
class RangeExeption(IndexError): pass
class LastLinebreakLostExecption(Exception): pass
class Buffer:
"""
All range... |
import requests
from requests_ntlm import HttpNtlmAuth
import json
import csv
import random
import string
import datetime
requests.packages.urllib3.disable_warnings()
def set_xrf():
characters = string.ascii_letters + string.digits
return ''.join(random.sample(characters, 16))
xrf = set_xrf()
... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Python 3.7
#
# @Author: Jxtopher
# @License: CC-BY-NC-SA
# @Date: 2019-04
# @Version: 1
# @Purpose:
# https://en.wikipedia.org/wiki/Hamming_distance
# see https://packages.debian.org/jessie/wordlist
# see /usr/share/dict/
#
import numpy as ... |
# -*- coding: utf-8 -*-
import argparse
import pdb
import traceback
from dataclasses import dataclass
from enum import Enum
from typing import Dict, List, Tuple
Object_Type = Enum("Object_Type", ["UNKNOWN", "BOT", "OUTPUT"])
@dataclass
class Bot:
low: int = -1
high: int = -1
@dataclass
class Chip_Bot:
... |
#!/usr/bin/env python3
import cv2
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
from get_ground_truth import *
from get_yolo_results import *
from calc_iou import bb_intersection_over_union
# IOU_THRESHOLD = 0.5
def draw_box(image_path, image_name, truth, prediction, iou):
image = c... |
#router ARP table scraper - to find if android device is on device list
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from time import sleep
from subprocess import check_output as cmdout
from subprocess import CalledProcessError
import subproces... |
import logging
# from .cma import parse,
def find_seq_rec(block, name, case_sensitive=True):
"""Given part of a sequence ID, find the first matching record."""
if case_sensitive:
def test(name, rec):
return name in rec['id']
else:
def test(name, rec):
return name.... |
from flask import Blueprint, render_template, session, redirect, url_for, request, flash, abort, current_app
from .model import Issue, db, Category
from .forms import CategoryForm, ContactForm, IssueForm
from flask import g
from flask_mail import Message, Mail
from app.opc import login_required
import math
import markd... |
from module.other.Printer import BaseScreen
from module.other.Printer import Color
from random import choice
from module.other.Table import BTable
class Screen(BaseScreen):
def __init__(self):
super().__init__()
self.color = Color
self.result = {}
def print_banner(self):
"""
... |
#author m.jin, 2018-03
#package for reseeding from iterative MCMC runs
import numpy as np
#compute new starting seeds table selected by WIMP sensitivity
def WIMP(chain,lnprobability,E_band, bin_number, F_table,C_table,starting_energy,interval):
epoch_starting_points = np.zeros(24)
table... |
#!/usr/bin/env python
# system modules
import asyncio, sys, json, time, subprocess, os, os.path, glob, signal, re
try:
import aiohttp
except ImportError:
print('The new seedhelper script uses aiohttp. Run "pip install aiohttp" in an admin command prompt')
currentversion = "3.0"
enableupdater = False
baseurl ... |
from collections import namedtuple
GlickoRating = namedtuple("GlickoRating", ["r", "RD", "σ"])
Glicko2Rating = namedtuple("Glicko2Rating", ["μ", "φ", "σ"])
deltaE = 10.0**-5
conversion_factor = 173.7178
def convert_Glicko_to_Glicko2(gr):
return Glicko2Rating(μ=(gr.r - 1500)/173.7178, φ=gr.RD/173.7178, σ=gr.σ)
... |
# -*- coding: utf-8 -*-
import numpy as np
import copy
# from operator import itemgetter
import datetime
class TreeNode(object):
"""A node in the MCTS tree. Each node keeps track of its own value Q,
prior probability P, and its visit-count-adjusted prior score u.
"""
def __init__(self, parent, prior_... |
# -*- coding:utf-8 -*-
#authour:ziank
import struct
import array
import json
class Index:
index = -1
def __init__(self, index):
self.index = index
class BPlist:
data = ""
offsetTable = ()
objectList = []
offsetLen = 0
@staticmethod
def isBinaryPlist(data):
if len(data)... |
from __future__ import print_function
import argparse
from datetime import datetime, timedelta
import os
import pytsk3
import pyewf
import struct
import sys
import unicodecsv as csv
from utility.pytskutil import TSKUtil
"""
MIT License
Copyright (c) 2017 <NAME>, <NAME>
Please share comments and questions at:
htt... |
import os
from pilot.search import (update_metadata, scrape_metadata,
get_files, prune_files, get_subdir_paths,
carryover_old_file_metadata)
from tests.unit.mocks import ANALYSIS_FILE_BASE_DIR, MULTI_FILE_DIR
MIXED_FILE = os.path.join(ANALYSIS_FILE_BASE_DIR, 'mixed.t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Base lib of VauxooTools
'''
from configglue import glue, schema, app, parser
from optparse import OptionParser
import logging
class VxConfig(schema.Schema):
'''
This class is to instanciate the `configglue`_ options to manage the
configuration file and optp... |
from functools import wraps
import itertools
import logging
from ipywidgets import VBox, Box
import ipywidgets as widgets
import matplotlib.pyplot as plt
from IPython.display import display
from math_signals.math_relation import Relation
from math_signals.defaults.base_structures import Spectrogram
from io... |
import os
import cv2
from PIL import Image
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib as mpl
from copy import deepcopy
from scipy.spatial.transform import Rotation as rot
import torch
import h5py
import json
import math
import copy
from random import ran... |
import codecs
import math
import os
import random
import sys
from itertools import product
from PIL import Image
# heading hint, pointing to using zip (smallest thing, most information)
# Excerpts from The Tao of Programming
# ~the smallest thing may hold the most information~
# keyed caeser, key = rickastley. but wi... |
# Copyright 2020 ZTE 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... |
# Copyright 2021 Sony Group 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 to ... |
# The custom implementation of Robust PCA
import numpy as np
import numpy as np
import torch
import torch.nn.functional as F
__all__ = ['RPCA_gpu', 'RPCA']
class RPCA:
"""Robust PCA using principal component pursuit (PCP) algorithm.
Referenced from https://github.com/dganguli/robust-pca/blob/master/r_pca.py... |
"""
Module to create charts.
"""
from __future__ import absolute_import
from .kmlInterface import KMLdata, Placemark, Polygon
from math import cos, pi, sin
from .colorBars import jet
from kmlChart.kmlInterface import PolyStyle, LineStyle, Folder
def diff(aList):
"""Helper function to compute the differ... |
import random
import torch
from torch import nn
import torch.nn.functional as F
class Attention(nn.Module):
"""Implements additive attention and return the attention vector used to weight the values.
Additive attention consists in concatenating key and query and then passing them trough a linear layer.""... |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file ex... |
# Reference for loading vgg_face.t7: https://www.programcreek.com/python/?code=prlz77%2Fvgg-face.pytorch%2Fvgg-face.pytorch-master%2Fmodels%2Fvgg_face.py
import torch
import torch.nn as nn
import torchfile
from torchvision.models import vgg19
import cv2
class VGG_19(nn.Module):
def __init__(self, feature_idx=[1,... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Book, Student, Borrower
import re
from django.db.models import Q
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
from django.contrib.auth.mixins import LoginRequiredMixin
fro... |
from __future__ import unicode_literals
from copy import copy
import pytest
import six
from rnginline.regexbuilder import (Literal, Set, OneOrMore, ZeroOrMore,
Choice, Capture, Sequence, Repeat,
Optional, Start, End, SetRange, Whitespace)
clas... |
# -*- coding: utf-8 -*-
import random
import math
import numpy as np
import matplotlib.pyplot as plt
from generate_dbmoon_dataset import moon_data_class
def rand(a,b):
return (b-a)* random.random()+a
def make_matrix(m, n, fill=0.0): # 创造一个指定大小的矩阵
mat = []
for i in range(m):
mat.append([fill] * n)
... |
# Copyright 2020 The TensorFlow Probability 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 o... |
# coding: utf-8
# # Demo of a Jupyter notebook
# - Let's see which day was the sunnier in 2017 on our campus
# - With Python and weather data from https://darksky.net/dev/
# ## Dependencies
# In[1]:
get_ipython().run_line_magic('load_ext', 'watermark')
get_ipython().run_line_magic('watermark', '-a "<NAME> (Naere... |
from ..util.functions import weights_check
import torch
from torch import nn
def make_model(model_weights):
available_weights = ["SHB"]
if model_weights not in available_weights:
raise ValueError("Weights {} not available for CSRNet. Available weights: {}".format(model_weights,
... |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from six import Iterator
from sqlalchemy import create_engine, text
from sqlalchemy.orm import sessionmaker, object_mapper
from sqlalchemy.sql.elements import TextClause
class DB(object):
"""Manager the DB connection."""
def __init__(self, wri... |
#! /usr/bin/env PYTHONIOENCODING=utf8 PYTHONUNBUFFERED=1 /usr/local/bin/python3
# <bitbar.title>Thruk</bitbar.title>
# <bitbar.author><NAME></bitbar.author>
# <bitbar.author.github>tresni</bitbar.author.github>
# <bitbar.version>1.0</bitbar.version>
# <bitbar.image>https://monosnap.com/file/nFJPVlGURwBi7b8bU3ZFG8SVma7... |
from __future__ import division
from probability import normal_cdf, inverse_normal_cdf
import random
import math
import logging
logging.basicConfig(level=logging.INFO, format="%(lineno)d\t%(message)s")
def normal_approximation_to_binomial(n, p):
"""finds mu and sigma corresponding to a Binomial(n, p)"""
mu ... |
import common_helpers
def get_grpc_type_from_ivi(type, is_array, driver_name_pascal):
add_repeated = is_array
if 'ViSession' in type:
type = 'nidevice_grpc.Session'
if 'ViBoolean' in type:
type = 'bool'
if 'ViReal64' in type:
type = 'double'
if 'ViInt32' in type:
type = 'sint32'
if 'ViConst... |
#!/usr/bin/env python3
# Import the random package
import random
# Import the matplotlib pyplot package
import matplotlib.pyplot as pyplot
# A function to generate two random numbers within the range 1 <= i <= 6 and add them together
def rollTwoDice():
return random.randint(1,6) + random.randint(1,6)
#---------... |
""" Conceptual representation of a media """
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from enum import Enum
from pathlib import Path
from re import compile as reg_compile
from re import search as reg_search
from typing import Callable, Generic, List, Optional, TypeVar
from mar... |
import pytest
import yaml
import numpy as np
from sklearn.model_selection import StratifiedKFold, KFold, RepeatedStratifiedKFold
import pandas as pd
pd.set_option('display.max_columns',999)
pd.set_option('display.max_rows',999)
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import... |
"""
Create growing degree days (GDD) and freeze-thaw cycle counts from weather station
data and save pickled dataframe with daily counts of both.
author: <NAME>
date: 2021-02-19
Usage: src/create_GDD_frthw.py [--gdd_tbase=<gdd_tbase>] [--ft_threshold=<ft_threshold>] [--verbose =<verbose>]
Options:
--gdd_tbase=<gdd_t... |
from django.shortcuts import render, redirect
from django.http.response import JsonResponse
from utils.SearchMusic import *
from utils.BaseFunction import *
from utils.MailUtils import *
from django.core.cache import cache
from .models import *
# Create your views here.
def home(request):
"""
推荐
:param re... |
# -*- coding: UTF-8 -*-
from __future__ import print_function
import yaml
import pickle
import os.path
import inspect
import json
import jsonpickle
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
#lülitan välja automa... |
#! /usr/bin/python3
import binascii
import socket
import struct
import sys
from utility import get_mac_address, get_gateway_ip, get_localhost_ip
ARPOP_REQUEST = 1
ARPOP_REPLY = 2
class EthernetPacket:
def __init__(self, src='0', dst='0', proto=0x800, data=''):
self.dst = dst
self.src = src
... |
import re
from pathlib import Path
from lovpy.logic.properties import RuleSet, add_global_rule_set
from lovpy.monitor.monitored_predicate import MonitoredPredicate, add_predicate_to_monitor
from lovpy.graphs.timed_property_graph import *
from lovpy.graphs.timestamps import RelativeTimestamp, LesserThanRelativeTimestam... |
"""
This module provides parsers to create ColouredText objects from embedded control strings.
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import re
from future.utils import with_metaclass
from abc import ABCMe... |
import os
from distutils.version import LooseVersion, StrictVersion
from enum import Enum
from subprocess import STDOUT, CalledProcessError, check_output
from tempfile import TemporaryDirectory
from typing import Optional
import kubernetes
import yaml
from kubernetes import client, config
from pydantic import validato... |
# Snake
# by KidsCanCode 2014, 2017
# A Pygame snake clone
# For educational purposes only
# Modified from http://inventwithpython.com/
import pygame
import sys
from os import path
import random
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
DARKGREEN = (0, 155, 0)
DARKGRAY = (40, 40, ... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from cgum.basic import *
from cgum.utility import FNULL
from pprint import pprint
import cgum.statement as statement
import cgum.expression as expression
import cgum.preprocessor as preprocessor
import cgum.typs as typs
from subprocess import Popen, CalledProcessError
import os.path
import json
import tempfile
import ... |
'''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: MIT License
*
*****
*
* MIT License
*
* Copyright (c) Microsoft Corporation.
*
* 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... |
import re
from room import Room
from lineparser import LineParser
'''
Author: <NAME>
Contact e-mail: <EMAIL>
Github: https://github.com/Adrianval96
'''
'''
This first part of the code will include the regex patterns used
throughout the code to identify the different elements of the map.
ChairPattern does not cons... |
# Copyright 2018: Intel 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 requir... |
import json
import os
import csv
import pandas as pd
import re
import pickle
import collections
import subprocess
import spacy
import sdi_utils.gensolution as gs
import sdi_utils.set_logging as slog
import sdi_utils.textfield_parser as tfp
import sdi_utils.tprogress as tp
supported_languages = ['DE', 'EN', 'ES', 'F... |
#coding=utf-8
import os
from collections import OrderedDict
import numpy as np
import pandas as pd
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from gensim.corpora import Dictionary
from gensim.models.wrappers import LdaMallet
from gensim.mo... |
''' Basic script to retreive a count of OTUs from all studies in synthesis'''
import requests
import json
import time
import os.path
import argparse
# Overview:
# Grabs the files via API
# Parses the adding OTUS to lists
# Keeps a unique set
# Counts and returns those values in JSON file
# <NAME> 2014,... |
import collections.abc as abc
from collections import namedtuple
from pathlib import Path
ModuleRef = namedtuple('ModuleRef', ['module', 'name'])
def resolve_path(baselist, name):
subpath = Path(name)
if subpath.is_absolute():
return None
for base in baselist:
path = base / subpath
if path.is_file(... |
'''
Sample script for the generation of disease heatmaps using
Gaussian process ordinal regression.
Requires the GPOR code:
http://www.gatsby.ucl.ac.uk/~chuwei/code/gpor.tar
to be unpacked to this directory:
cropsurveillance/3rdparty/gpor/
'''
import pylab
import subprocess
import numpy
import csv
import os
def wri... |
import posixpath
from collections import namedtuple
from py42.exceptions import Py42ArchiveFileNotFoundError
# Data for initiating a web or push restore.
FileSelection = namedtuple(u"FileSelection", u"file, num_files, num_dirs, num_bytes")
class FileType(object):
"""The different file-types in an archive."""
... |
from lib import util
from lib import configurations as conf
import scrython as sc
import pickle
import os
import requests
import time
import unicodedata
import string
# convert a string to be filename friendly
# this code is copied from https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8
# courtesy of w... |
"""Evaluation functions for LatticeRNN."""
import matplotlib
matplotlib.use('Agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
from sklearn.metrics import roc_curve, precision_recall_curve, auc
def log(array):
"""Clip the elements of arrays before taking log."... |
#!/usr/bin/env python
import renderapi
import argparse
import numpy as np
import os
from PIL import Image
from glob import glob
def gen_matches(flow_dir, match_name, n, stack, render_connect_params):
render = renderapi.connect(**render_connect_params)
tilespecs = renderapi.tilespec.get_tile_specs_from_stack(... |
"""
Python module for RESTful resource representation using MIME Media-Types
This is a Flask port from the excellent mimerender v0.2.3 by <NAME>
(http://code.google.com/p/mimerender/)
"""
__version__ = '0.1.3'
__author__ = '<NAME> <<EMAIL>>'
__license__ = 'MIT'
__copyright__ = '2013 <NAME>'
from flask import request,... |
import re
# the observation output is in the form of
# [('obj_label', confidence, (bounding_box_x_px, bounding_box_y_px, bounding_box_width_px, bounding_box_height_px))]
def parse_yolo_output(output) -> []:
"""
when showImage is True:
input: {'detections: [obj1, obj2, obj3, ...], 'image': ..., 'capti... |
#!/usr/bin/env python3
# test_chip_printer.py
import pkg_resources
import pytest
from PIL import Image
from PIL import ImageChops
from chiplabel import chip
from chiplabel.chip_printer import ChipPrinter
CREATE_REFERENCES = False
FONT_DIR = pkg_resources.resource_filename('chiplabel', 'fonts')
DEFAULT_FONT = f'{FONT_... |
# coding=utf-8
import math
import torch
from torch.nn.modules import Module
from torch.nn.modules.utils import _single, _pair, _triple
from torch.nn import init
from torch.nn import Parameter
class ConvNd(Module):
__constants__ = ['stride', 'padding', 'dilation', 'groups', 'bias',
'padding_m... |
from pulp import *
from openpyxl import Workbook
from munkres import *
import time
import random
import os
import copy
#Type a instaces to resolve
folder = 'instb'
os.chdir(f'{folder}/')
excelFile = Workbook()
sheet1 = excelFile.active
sheet1.title = f"{folder}_results"
sheet1.append(("Arquivo","Tamanho","Tempo de re... |
#!/bin/python
# Ported from https://github.com/pystruct/pystruct/blob/master/pystruct/learners/structured_perceptron.py
#
# <NAME>, <NAME>
# PyStruct - Structured prediction in Python
# Journal of machine learning, 2014
#
#
# This code has the following license
# Copyright (c) 2013, <NAME>
# All rights rese... |
import sys
import uio
import utime
CRITICAL = 50
ERROR = 40
WARNING = 30
INFO = 20
DEBUG = 10
NOTSET = 0
_level_dict = {
CRITICAL: "CRITICAL",
ERROR: "ERROR",
WARNING: "WARNING",
INFO: "INFO",
DEBUG: "DEBUG",
}
def addLevelName(level, name):
_level_dict[level] = name
class Logger:
le... |
# 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
# "License"); you may not u... |
from __future__ import print_function
import numpy as np
import sys
import sqaod
from sqaod import algorithm as algo
from . import formulas
from sqaod.common import checkers, symmetrize
class DenseGraphBFSearcher :
""" Dense graph brute-force searcher"""
def __init__(self, W, optimize, prefdict) :
if ... |
""" Specific utilities for image classification
(i.e. RGB images i.e. tensors of the form NxCxHxW )
"""
from __future__ import print_function
from . import pytorch_utils as utils
import torch
import numpy as np
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
import random
def nhwc255_xf... |
# Copyright 2016 Quora, 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, so... |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... |
#!/usr/bin/env python
from flask import (Flask, jsonify, render_template,
request)
import pymongo
app = Flask(__name__)
DB_NAME = 'zcashdb'
DB_PREFIX = 'zec'
client = pymongo.MongoClient()
db = client[DB_NAME]
AddressTransaction = db[DB_PREFIX + 'addresstransactions']
Blocks = db[DB_PREFIX + 'bloc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import slackwrapper
import sys
import os
import random
import configparser
import argparse
import json
from requests_oauthlib import OAuth1Session
from datetime import datetime, timezone, timedelta
version = '%(prog)s 20171116'
## Django Setup
import django
import pymys... |
# Lint as: python3
# Copyright 2019 DeepMind Technologies Limited and 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... |
# Copyright 2020 Stanford University, Los Alamos National Laboratory
#
# 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 ... |
from .config import (
SUCCESS_COLOR,
ERROR_COLOR,
CHECKMARK_EMOJI,
DISAPPOINTING_EMOJI,
SPARKLES_EMOJI,
)
import os
import shutil
import time
import subprocess
import glob
import click
abs_path_to_templates = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "templates"
)
abs_path_to_... |
"""
Created on Jul 16, 2018
@author: dwrigley
get a list of all custom attributes in EDC - returning the Name and Id
the id would be used for any search/custom import activiies
output printed to the console
"""
import requests
from requests.auth import HTTPBasicAuth
import time
import sys
import os
import urllib3
im... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... |
import math
import numpy as np
import random as rn
import tensorflow as tf
class DNN(object):
"""
初始化参数
"""
def __init__(self, learning_rate, feature_length, batch_size, hidden_layer):
self.learning_rate = learning_rate
self.feature_length = feature_length
self.batch_size = bat... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
import asyncio
from concurrent.futures import ThreadPoolExecutor
from functools import partial
import logging
import sys
import traceback
from autobahn.wamp.types import SubscribeOptions
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp.auth import compute_wcs
from autobahn.wam... |
import pymc3 as pm
import numpy as np
import numpy.testing as npt
from scipy import stats
import theano.tensor as tt
from .helpers import SeededTest
class KnownMean(object):
def test_mean(self):
for varname, expected in self.means.items():
samples = self.samples[varname]
npt.asser... |
import asyncio
from tornado.testing import gen_test
from toshieth.test.base import EthServiceBaseTest, requires_full_stack
from toshi.test.ethereum.parity import FAUCET_PRIVATE_KEY, ParityServer
from toshi.test.ethereum.ethminer import EthMiner
from toshi.ethereum.tx import decode_transaction
from toshi.ethereum.utils... |
import timeit
import numpy as np
from psyneulink import *
from gym_forager.envs.forager_env import ForagerEnv
# Runtime Switches:
RENDER = False
PNL_COMPILE = False
RUN = True
SHOW_GRAPH = False
# *********************************************************************************************************************
... |
from dataclasses import dataclass
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from deepself.models.nn_models.stft import Spectrogram, LogmelFilterBank
from deepself.utils.nn_config import NNModelConfig
@dataclass
class PANNsConfig(NNModelConfig): # PANNs model argu... |
"""This module contains classes for an asynchronous thread
The thread periodically checks the database for unfinished tasks
If an unfinished task is encountered the slurm frontend of the cluster
is checked for the jobs state.
Unfinished tasks are defined as tasks which have executed
a slurm job whi... |
"""LFFD Demo."""
import os, sys
import argparse
import cv2
import time
import mxnet as mx
import numpy as np
sys.path.append("..")
from accuracy_evaluation import predict
def parse_args():
parser = argparse.ArgumentParser(description='LFFD Demo.')
parser.add_argument('--version', type=str, defa... |
import transformers
import torch
from jiant.ext.radam import RAdam
class OptimizerScheduler:
def __init__(self, optimizer, scheduler):
super().__init__()
self.optimizer = optimizer
self.scheduler = scheduler
def step(self):
self.optimizer.step()
self.scheduler.step()
... |
from tkinter import font
import pydirectinput
import tkinter
import twitch
import threading
import time
# configuration
channel_name = "jotslo"
bot_nickname = "botslo"
oauth_value = "oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# max chars in each window
move_len = 19
chat_len = 25
# contents of feed windows
move_feed = [... |
from datetime import timedelta
import secrets
from flask import Flask, render_template, session, redirect, url_for, request
import sqlalchemy
import hashlib
app = Flask(__name__)
sql_engine = sqlalchemy.create_engine('sqlite:///app.sqlite')
sql_metadata = sqlalchemy.MetaData()
users_table = sqlalchemy.Table('use... |
import os
import math
import numpy as np
import torch
import traceback
from .assets import Binarymetrics
from .eval import validate
from .architecture import get_SLOCountNet
from torch.nn.parallel.data_parallel import DataParallel
from tqdm import tqdm
def train(args, pt_dir, chkpt_path, trainloader, devloader, writ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.