text stringlengths 3.07k 22.1k |
|---|
"""
"""
import sys
from pathlib import Path
print(Path(__file__).resolve().parents[1])
sys.path.append(Path(__file__).resolve().parents[1])
if __name__ == '__main__' and __package__ is None:
__package__ = 'kurosc'
#
# from lib.plotformat import setup
import numpy as np
np.set_printoptions(precision=2, suppress=Tr... |
import os
from random import uniform
import matplotlib
import pandas as pd
from geopy import Point
import uuid as IdGenerator
from geopy import distance
import multiprocessing as mp
from math import sin, cos, atan2, floor, sqrt, radians
def histogram(path, layers, show=True, max_x=None, save_log=True, **kwargs):
i... |
#encoding=utf-8
# 代码功能:
# 去掉文件夹内相似的图片
# 需定义的参数:
# 同一个摄像头分帧的二级根目录oneCameraFrame
# 提取出的box图像保存的二级根目录boxsOneCamera
# 检测特征的checkBox
# 截取区域的extraBox
#矩阵直接相减1.6秒一张
#cos距离3秒一张
##库
import os,shutil,math,glob
import numpy as np
import time
from tqdm import tqdm
from basicFun import FILES,IMG,XML,COCO
def get_iou... |
import torch, torchvision
import numpy as np
from torch import nn
import torch.nn.functional as F
from torch.nn.utils import spectral_norm
from tqdm.notebook import tqdm
from einops import rearrange
import matplotlib
# Self-Attention block
class Self_Att(nn.Module):
def __init__(self, in_dim):
super(Self... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['font.family'] = 'Helvetica'
import datetime
from model.seir_model import ModelParams, solve_model
def load_nyt_data():
nyt_url_counties = 'https://raw.githubusercontent.com/nytimes/covid-19-data/master/... |
try:
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import QIcon, QCursor
QtGui = QtWidgets
except:
from PyQt4 import QtGui, QtCore
QIcon = QtGui.QIcon
QCursor = QtGui.QCursor
import sys
import os
import logging
import threading
import time
import datetime
import webbrowser
def pretty_... |
from asyncio import sleep
from re import search
import discord
from discord.ext import commands
from discord.ext.commands import Cog, Greedy
from better_profanity import profanity
from discord import Embed, Member
from discord.ext.commands import CheckFailure
from discord.ext.commands import command, has_permissions, ... |
from collections import deque
import numpy as np
import os
import pygame
from pygame import Rect
from scipy.signal import convolve2d
from minesweeper import register_board
from minesweeper.board import Board, Grid
from minesweeper.seeders import Seeder
##############################################################... |
from urllib import request
from os.path import isfile, exists
from os import makedirs
import requests
from bs4 import BeautifulSoup
import time
import glob, os
search_url = "https://www.google.com/finance?q="
company_WSE = "WSE:"
historical_prices_url = "https://www.google.com/finance/historical?q="
start_date = "&st... |
"""
:mod:`redis_helpers` Call Number Helper Utilities
"""
__author__ = "<NAME>"
import pymarc,redis,re
import logging,sys
from app_settings import APP,SEED_RECORD_ID
import aristotle.settings as settings
from aristotle.settings import REDIS_DATASTORE
english_alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
... |
"""
MIT License
Copyright (c) 2021 SkippyAIC - TheGarfBot
Copyright (c) 2015-present Rapptz - discord.py
Copyright (c) 2020-2021 eunwoo1104 - discord-interactions
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), ... |
import logging
from typing import Optional, List, Union
import torch
import torchaudio
from torch.utils.data import Dataset, DataLoader
import json
import os
import pytorch_lightning as pl
import hydra
from omegaconf import DictConfig, OmegaConf, ListConfig
import random
import numpy as np
class MyAudioDataset(Datas... |
from __future__ import annotations
from matplotlib.figure import Figure
from sauronlab.core.core_imports import *
from sauronlab.model.metrics import *
from sauronlab.model.responses import *
from sauronlab.viz.accuracy_plots import *
class SummarizedSpindleFrame(BaseScoreFrame):
""""""
def to_dose_respons... |
import pandas as pd # version 1.0.1
# in pandas 1.1.4 dates for INTESA and BMG doesn't work after merge in "final"
from datetime import datetime
# TODO find repetitions and replace them with functions
# for example Santander and CITI files import and adjustment
# or date and amount formatting
pd.options.display.float... |
import logging
from datetime import datetime
import pandas as pd
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python import PythonOperator
from airflow.operators.subdag_operator import SubDagOperator
from airflow.providers.postgres.operators.postgres import ... |
from database.db2 import db2
import time
from .log import logger
import crcmod
import socket
import tornado
import requests
import json
from tornado import gen
from binascii import hexlify
from gevent import Greenlet
from tornado.httpclient import AsyncHTTPClient
# host, port = "testgeo.bolinparking.com", 12366
host, ... |
#!/usr/bin/env python3
"""
This script downloads the latest KeyForge card data from keyforgegame.com and processes
it to turn the highly-structured data there into a flat list of card names to descriptions
formatted to send down the chat.
"""
import common
common.FRAMEWORK_ONLY = True
import sys
import json
import re
... |
#
# Bridge between the Onkyo AVR EISCP remote control protocol and MQTT.
# Allows to remotely control networked Onkyo AVRs and get status
# information.
#
# Written and (C) 2015-16 by <NAME> <<EMAIL>>
# Portions copyright 2018 by <NAME> <<EMAIL>>
# Provided under the terms of the MIT license
#
# Requires:
# - onkyo-eis... |
"""
Support for interface with a AnthemAV Receiver.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player/
"""
import logging
import socket
import select
import time
import re
import voluptuous as vol
from homeassistant.components.media_player im... |
# encoding: utf-8
# module win32help
# from C:\Python27\lib\site-packages\win32\win32help.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
debug = 0
HHACT_BACK = 7
HHACT_CONTRACT = 6
HHACT_CUSTOMIZE = 16
HHACT_EXPAND = 5
HHACT_FORWARD = 8
HHACT_HIGHLIGHT = 15
HHACT_HOME = 11
HHACT_JUMP1 ... |
import pygame
import sys
import random
import time
FPS = 8
RED = (255, 0, 0)
BLACK = (0, 0, 0)
GREEN = (0, 128, 0)
LIGHT_GREEN = (0, 160, 0)
WHITE = (255, 255, 255)
WIDTH = 1090
HEIGHT = 790
SCORE = 0
FON = pygame.image.load('fon.jpg')
APPLE = pygame.image.load('apple.png')
GOLD_APPLE = pygame.image.lo... |
"""
`colorado_college_extras` Module provides Colorado College specific template
tags for White Whale-designned Discovery Layer
"""
__author__ = "<NAME>"
from django import template
from django.utils.safestring import mark_safe
from bibframe.models import Instance
from aristotle.settings import REDIS_DATASTORE, STAT... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2022, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "mit"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import re
from ..token.PDFComment import PDFComment
from ..token.PDFNumber import PDFNumber
from ..token.PDFCommand import PDFCommand
from ..token.PDFName import ... |
# @Time : 2020/7/7
# @Author : <NAME>
# @Email : <EMAIL>
# UPDATE
# @Time : 2020/9/9, 2020/9/29
# @Author : <NAME>, <NAME>
# @email : <EMAIL>, <EMAIL>
# UPDATE 2
# @Time :
# @email: <EMAIL>
"""
Wrap dataset into dataloader
################################################
"""
import math
import torch
import rand... |
import os
from collections import Counter
import torch
from tqdm import tqdm
class Dictionary:
"""A mapping from symbols to consecutive integers"""
def __init__(self, pad='<pad>', unk='<unk>', bos='<s>', eos='</s>'):
self.unk_word, self.pad_word, self.bos_word, self.eos_word = unk, pad, bos, eos
... |
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.models.stakeholder.stakeholder_unit_test.py is part of The RAMSTK
# Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for testing Stakeholder module algo... |
import math
from . import pytweening as tween
from panda3d import core as p3d
from panda3d import bullet
from bamboo import ecs
class TemplateFactory:
def __init__(self, ecsmanager):
self.ecsmanager = ecsmanager
def make_character(self, modelpath, parent=None, initial_position=None):
if par... |
import os, sys, glob, random
import torch, cv2
import numpy as np
from torch.utils.data import *
from imgaug import augmenters
#import torchvision.transforms as T
class LP_ReID_Dataset():
def __init__(self, args, dataset, common_rare_threshold=5, verbose=False):
self.root = os.path.join(args.path, datas... |
import numpy as np
import matplotlib.pyplot as plt
import time
import multiprocessing as mp
import datetime as dt
import pickle
import math
start_time = time.time()
""" This initializes a initial cell by either assigning each point on the grid
a random element of {-1,1} (uniform distribution) or a homogenous Matr... |
"""Authentication and Authorization module for Krake.
Access to the Krake API is controlled by two distinct mechanisms performed
after each other:
Authentication
verifies the identity of a user (Who is requesting?)
Authorization
decides if the user has permission to access a resource
Authentication
--------... |
import cPickle as cpkl
import sys, logging, os
from sklearn import metrics
slim_path = '/root/workspace/workspace/ROP_PAPER/slim'
if slim_path not in sys.path:
sys.path.append(slim_path)
from nets.inception_v2 import *
from nets.inception_utils import *
import tensorflow as tf
import numpy as np
import tensorflow... |
from datetime import timedelta
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils import timezone
fro... |
import json
import os
from typing import List, Tuple
import math
import numpy as np
from numpy import ma
from ..numpy.pose_body import NumPyPoseBody
from ..pose import Pose
from ..pose_header import PoseHeader, PoseHeaderDimensions, PoseHeaderComponent
BODY_POINTS = ["Nose", "Neck", "RShoulder", "RElbow", "RWrist", ... |
from subprocess import check_output
from urllib.parse import unquote
from urllib.request import urlopen
import hashlib
import json
import logging
import os
import re
import requests
import subprocess
import threading
import time
from ..cmd_config import room_status, config
from ..settings import CURRENT_USER_HOME_DIR
... |
# Copyright 2019 The FastEstimator 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 appl... |
from typing import Tuple
import numpy as np
import matplotlib.pyplot as plt
from highway_env.road.road import Road
from highway_env.types import Vector
from highway_env.vehicle.kinematics import Vehicle
from highway_env import utils
def corner_positions(v: "Vehicle" = None)->np.array:
"""
This method compute... |
from flask import redirect, render_template, render_template_string, Blueprint
from flask import request, url_for, flash, Response, jsonify
import time
from app.init_app.py import app
import random
import youtube_dl
import urllib.request
import untangle
import re
import sys
import SpeechRecognition as sr
from celery ... |
import torch
from torch import nn
from torch.nn import functional as F
import torchvision.transforms.functional as TF
from obj_model import ObjSlotAttentionModel
from obj_utils import build_mlps
class ObjAugSlotAttentionModel(nn.Module):
def __init__(
self,
model: ObjSlotAttentionModel,
... |
#!/usr/bin/env python3
"""Switchmap-NG ORM classes.
Manages connection pooling among other things.
"""
# Main python libraries
import sys
import os
import getpass
from pwd import getpwnam
import grp
import copy
import re
# Pip3 libraries
try:
import yaml
except ImportError:
import pip
_PACKAGES = ['PyYA... |
"""
Code here relates to the from-scratch creation of data which simulates
electrical recordings of neurons. Creating data from scratch is useful
because (1) you can generate your own ABFs to analyze without requiring
access to real recordings and, (2) generating data with known events allows you
to test your event de... |
from sets import Set
import argparse
import os
import pandas as pd
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import transaction
from gcutils.bigquery import Client
from common.utils import valid_date
from dmd.models import DMDProduct
from frontend.models imp... |
# -*- coding: utf-8 -*-
#
# --------------------------------------------------------------------
# Copyright (c) 2022 <NAME> <<EMAIL>>
#
# Licensed under the MIT License. See LICENSE file in root folder.
# --------------------------------------------------------------------
__author__ = "<NAME> <<EMAIL>>"
__vers... |
############################################################################
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################
"""Get content for testing"""
import urllib.request
import posixpath
import shutil
import hash... |
"""MIT License
Copyright (c) 2020 <NAME> A.K.A. Haloghen & <NAME> A.K.A.
matteob99
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 ... |
from collections import namedtuple
import datetime
from pathlib import Path
BLOCK_SIZE = 512
BLOCK_SIZE_UNICODE = 1024
NODE_BLOCK_SIZE = 3072
NODE_ENTRY_OFFSET = 32
HEADER_BLOCK = [4, 14, 2, 2, 4, 256, 4, 4]
HEADER_BLOCK_UNICODE = [4, 28, 8, 4, 4, 512, 4, 4]
SOURCE = ['.srd', '.srs', '.srw', '.sru', '.srf',
... |
from vispy import scene
from vispy.scene.cameras.turntable import TurntableCamera
import numpy as np
import xlwings as xw
from Noise.Space import Space
from Noise.Material import Material
# Make the source-materials
engine = Material('Engine', (1,0,0,1))
engine.make_source(0,80)
hvac = Material('HVAC', (0,0,1,1))... |
import tensorflow as tf
from tensorflow import keras
import tensorflow_addons as tfa
class Featrue_Extract(tf.keras.Model):
def __init__(self, padding="same"):
super(Featrue_Extract, self).__init__()
# 先试用
self.vgg19 = tf.keras.applications.VGG19(include_top=False, input_shape=(... |
#! /usr/bin/env python3
"""
Building apps
"""
from besspin.base.utils.misc import *
from besspin.fett.unix.ssl import gen_cert
from besspin.fett.freertos import freertos
import besspin.target.build
import os
""" The entry function
---------------------------------------
"""
@decorate.debugWrap
def buildApps ():
#... |
import argparse
import re
import traceback
import matplotlib
import pandas as pd
import numpy as np
import wandb
import matplotlib.pyplot as plt
from PIL import Image
import os
from vdvae.hps import Hyperparams
from vdvae.wandb_utils import _download, WANDB_USER, WANDB_DIR
from vdvae.constants import BASE_DIR
api = ... |
"""Tests for align module.
"""
from collections import OrderedDict
import tempfile
import logging
from os import unlink
import unittest
try:
import boto3
S3 = boto3.client()
resource = S3.list_buckets()
except:
cloud = False
else:
cloud = True
import random
from adapt.prepare import align
__a... |
#
#
# Test of convergence diagnostics
#
#
from __future__ import with_statement
from numpy.testing import assert_equal, assert_array_equal
from numpy.testing import assert_approx_equal, TestCase
import unittest
import nose
import numpy as np
import pymc
import pymc.examples.weibull_fit as model
import os
import warnin... |
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by <NAME>, <NAME>
# --------------------------------------------------------
from __future__ import print_function, division
import sys
import os
cur_... |
# -*- coding: utf-8 -*-
"This script was created by ParSeq."
import matplotlib.pyplot as plt
def readFile(saveType, fname):
h5file = None
if saveType.endswith('txt'):
import numpy as np
arrays = np.loadtxt(fname+'.txt.gz')
return arrays
elif saveType.endswith('json'):
impo... |
import sys
DICT_SIZE = 12
class TrieNode(object):
"""
Trie木の1ノードを表すクラス
"""
WORD_SIZE = 64 ## underbar + space + alphabets + number ##
def __init__(self, depth = 0, item = None):
self.item = item
self.depth = depth
# 子ノードのリストはとりあえずintリストとして保持 #
self.childr... |
import math
import numpy as np
import pandas as pd
import os.path
class Problem:
def __init__(self, name: str, data: np.ndarray = None, target: np.ndarray = None):
self.__name: str = name
self.__data = data
self.__target = target
@property
def name(self) -> str:
return se... |
#!/usr/bin/env python3
# -*- coding: iso-8859-15 -*-
# This software is Copyright (c) 2018, <NAME> <dhiru at openwall.com> and
# it is hereby released to the general public under the following terms:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
#
# Special thanks... |
#!/usr/bin/env python
import numpy as np
import pandas as pd
import os, sys, time
import dataRepresentation as datrep
import pmRecUtils as pmutils
import logUtils as lutils
from scipy.sparse import csc_matrix
from fastFM import als, sgd, mcmc
from sklearn.metrics import mean_squared_error
def setup(log_dir, column_d... |
# encoding=utf-8
# Copyright 2019 Google 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 agre... |
# Builtin
import logging
import os
import unittest
import time
# Internal
from nxt.session import Session
from nxt import nxt_path, nxt_io
from nxt.tokens import (register_token, get_token_content,
get_standalone_tokens, make_token_str, TOKENTYPE)
from nxt.nxt_layer import CompLayer, get_active... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, cv2
import argparse
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.colors as colors
import _init_paths
from utils.timer impo... |
#!/usr/bin/env python3
# All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2019
#
# Build an Ansible inventory from wp-veritas and/or the on-NFS state
#
# Example invocation:
# env WWP_INVENTORY_SOURCES=wpveritas,nfs WWP_NAMESPACES=wwp-test,wwp wordpress-instances.py
import sys
impo... |
# %%
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from dataclasses import dataclass
from typing import List, Literal, Optional
import itertools as it
@dataclass
class ShapeGraph:
L: Optional['ShapeGraph']
R: Optional['ShapeGraph']
T: Optional['ShapeGraph']
B: Optional... |
"""MIT License
Copyright (c) 2019 <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, publish, distrib... |
"""
Inheritance Diagram
-------------------
.. inheritance-diagram:: kotti.testing
"""
import os
from os.path import dirname
from os.path import join
from unittest import TestCase
from warnings import catch_warnings
import transaction
from pyramid import testing
from pyramid.events import NewResponse
from pyramid.int... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files... |
import time
import numpy as np
from __context__ import src
from src import distortion
from src import linearcalibrate
from src import jacobian
from src import mathutils as mu
class Calibrator:
_λinitial = 1e-3
_λmin = 1e-10
_λmax = 1e+10
_Pt_error_min = 1e-12
def __init__(self, distortionModel: ... |
import argparse
from collections import defaultdict
import pickle
import random
import torch
import numpy as np
from allennlp.data.vocabulary import Vocabulary
from allennlp.data.samplers import BucketBatchSampler
from allennlp.data import Batch
from allennlp.interpret.attackers import InputReduction, Attacker
fro... |
# NOT MY CODE, HERE FOR REFERENCE
import time
import smbus
import datetime
import math
# I2C address vary on the device
# Default are the Adafruit LSM9DS0
MAG_ADDRESS = 0x1D
ACC_ADDRESS = 0x1D
GYR_ADDRESS = 0x6B
#LSM9DS0 gyrometer registers
WHO_AM_I_G = 0x0F
CTRL_REG1_G = 0x20
CTRL_REG2_G = 0x21
CTRL... |
from types import FunctionType
import logging
import warnings
from datetime import datetime
from collections import deque
from scrapy.extensions.feedexport import BlockingFeedStorage as _BlockingFeedStorage, FeedExporter as _FeedExporter, \
feed_complete_default_values_from_settings as _feed_complete_default_values... |
import os
from cleverhans.attacks import FastGradientMethod
from io import BytesIO
import IPython.display
import numpy as np
import pandas as pd
from PIL import Image
from scipy.misc import imread
from scipy.misc import imsave
import tensorflow as tf
from tensorflow.contrib.slim.nets import inception
sli... |
# Copyright 2015 The TensorFlow 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... |
"""
Server to get Lutron Caseta certificate.
"""
import json
import os
import re
import requests
import socket
import ssl
from flask import (Flask, flash, redirect, render_template, request, session,
url_for)
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.... |
"""Stores routes for Flask web application for job result pages
Author: <NAME>
"""
# package imports
import copy
import json
from flask import Blueprint, request, url_for, send_file
# own project imports
from cagecat.routes.routes_helpers import format_size
from cagecat.const import execution_stages_front_end, exec... |
import os
import re
import numpy as np
from sklearn import linear_model
from scipy import sparse
import collections
import codecs
import random
class HMM(object):
"""
HMM Model
"""
def __init__(self, dic, decode_type):
"""
Initialize the model.
"""
self.num_words = le... |
import re
import datetime
import random
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MaxNLocator
import requests
from bs4 import BeautifulSoup
def start():
f = open("progress.txt","a")
f.writelines(["# Data:False\n"])
f.close()
url... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Citrix Systems, Inc.
#
# 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
# ... |
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
import pickle
import torch.utils.data as data
import torchvision.transforms as transforms
import os
from random import randint
from PIL import Image
import random
random.seed(9001)
from rasterize import *
import argparse
import numpy as... |
"""Schevo-specific exceptions."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
# ======================================================================
# Runtime errors
class Restricted(RuntimeError):
"""The attempted operation was restricted."""
class BackendConflictError(RuntimeErr... |
import asyncpg
import discord
from discord.ext import commands, menus
from clam.utils import colors, db, humantime
from clam.utils.menus import MenuPages
INCOMPLETE_EMOJI = "\N{BLACK LARGE SQUARE}"
COMPLETE_EMOJI = "\N{BALLOT BOX WITH CHECK}"
class TodoTaskSource(menus.ListPageSource):
def __init__(self, data... |
# these are mainly notes of what we tried to test the hdf5 detector priming
# issue
from ophyd.sim import motor1, motor2
RE.clear_suspenders()
# here is what we can use to reproduce the error
#changed the flyer device to be aware of fast vs slow axis in a 2D scan
#should abstract this method to use fast and slow axe... |
"""sqlite test"""
# -*- coding:utf-8 -*-
import threading
import time
import traceback
from commonbaby.mslog import MsFileLogConfig, MsLogLevels, MsLogManager
MsLogManager.static_initial(
dft_lvl=MsLogLevels.INFO, msficfg=MsFileLogConfig(fi_dir=r'./_serverlog'))
logger = MsLogManager.get_logger("idownserver")
f... |
#!/usr/bin/env python
# -0- coding: utf-8 -0-
"""
test_images
==================
Created by: hbldh <<EMAIL>>
Created on: 2016-01-28, 20:54
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import os
import sys
im... |
#!/Users/jcb/anaconda/bin/python3
import sys
import pprint
from pddl import PDDL_Parser
from action import Durative_Action
class VRP:
'''Represent a parsed Pandora PDDL file and output a VRP formatted
for input into the CP solver.
This is a domain specific implementation, assuming that we are
... |
import pandas as pd
import numpy as np
import os
import random
from nltk.tokenize import word_tokenize
from tqdm import tqdm
def process_behaviors(args):
random.seed(args.seed)
if args.train:
print('Preprocessing behaviors in training set...')
train_set = os.path.join(args.train_dir, 'behaviors... |
#!/usr/bin/env python3
#
# laaso/hydratorstats.py
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
'''
Stats implementation for the Hydrator.
'''
import datetime
import json
import os
import threading
import time
import yaml
from filelock import FileLock
from laaso.bl... |
"""
Tosca parser module
"""
import re
from os import path
import toscaparser
from toscaparser.prereq.csar import CSAR
from toscaparser.tosca_template import ToscaTemplate
from . import helper
from .graph.artifacts import (Dockerfile, DockerfileExecutable, DockerImage,
DockerImageExecutab... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from .. import cntk_py
from ..utils import typemap
from cntk.device import use_defa... |
# 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 th... |
import tensorflow as tf
import numpy as np
# Default hyperparameters
hparams = tf.contrib.training.HParams(
# Comma-separated list of cleaners to run on text prior to training and eval. For non-English
# text, you may want to use "basic_cleaners" or "transliteration_cleaners" or "korean_cleaners".
cleaner... |
import numpy as np
import networkx as nx
from mesa import Model
from mesa.time import RandomActivation, SimultaneousActivation
from mesa.datacollection import DataCollector
from scseirx.model_SEIRX import *
## data collection functions ##
def count_S_unistudent(model):
S = np.asarray([1 for a in model.schedule.... |
import logging
import numpy
import os
import cPickle
import theano
from collections import OrderedDict
from itertools import chain
from blocks.roles import add_role, PARAMETER
from theano import tensor
rng = numpy.random.RandomState(4321)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('multiCG_... |
import functools
import math
import torch
import typing
__all__ = ['AdamSRT', 'AdamS']
#NOTE: from https://github.com/ymontmarin/adamsrt/blob/master/adamsrt/optimizers/adam_srt.py
class AdamSRT(torch.optim.Optimizer):
"""Implements the AdamSRT algorithm.
- **Paper**: [Spherical Perspective on Learning with ... |
'''high-order FD solver for FN equation'''
# spatial diff: 4th order laplacian
# temporal diff: O(dt^5) due to RK4
import scipy.io
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(66)
def apply_laplacian(mat, dx = 1.0):
# dx is inversely proportional to N
"""This function applies a discretiz... |
"""rest.py
quantumML is
Handles the primary functions
"""
from urllib.request import urlopen
import json
import urllib
import os
import io
import math
from pymatgen.core.structure import Structure
from ase.io import vasp
from dscribe.descriptors import SOAP
from pymatgen.io.vasp import Xdatcar, Oszicar
from sklearn.c... |
# Author: <NAME> et al.
# This is the official implementation of the paper Self-Attention Meta-Learner for Continual Learning at AAMAS 2021
# if you use part of this code, please cite the following article
# @inproceedings{sokar2021selfattention,
# title={Self-Attention Meta-Learner for Continual Learning},
# aut... |
#!/usr/bin/env python
# file spectra.py
# author <NAME> <<EMAIL>>
# version 0.0
# date 01 juil. 2020
"""
Spectra
========
This submodule contains pattern spectra related functions.
Example
-------
>>> import sap
>>> import numpy as np
>>> from matplotlib import pyplot as plt
>>> image = np.arange(100 * 100).reshape... |
import torch
import torch.nn as nn
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import random
import os
import cv2
import numpy as np
from tqdm import tqdm
import sys
TrainDir = "/home/clt_dc/dataset/classification/cifar10/train/"
EvalDir = "/home/clt_dc/dataset/classificati... |
#!/usr/local/bin/python
from typing import List, Union
import re
import json
import xmltodict
from xml.parsers.expat import ExpatError
from impact_model import ImpactModel
def is_wildcard_term(term: str) -> bool:
"""
Determine if term is a wildcard term, e.g. starts or ends with an asterix ("*").
Wildcard... |
# ################################################
# todo application
# > Enter your Tasks
# > Save your Tasks
# > Delete your Tasks
# > Load your saved Tasks
# -------------------------------By: <NAME>
# ################################################
# Importing modules required in this project
# using --- PyQt6 --... |
import logging
import subprocess
import sys
from argparse import ArgumentParser
from datetime import datetime
from itertools import chain
from subprocess import CalledProcessError
from subprocess import check_output
from time import sleep
import yamlenv
from prometheus_client import Counter
from prometheus_client impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.