text stringlengths 6.04k 39.5k |
|---|
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib import auth
from django.contrib import auth
from django.... |
import math
import time
import torch.autograd
import torch.nn as nn
import dcp.utils as utils
from dcp.mask_conv import MaskConv2d
from dcp.aux_classifier import AuxClassifier
from dcp.models.preresnet import PreBasicBlock
from dcp.models.resnet import BasicBlock, Bottleneck
class View(nn.Module):
"""
Resha... |
from __future__ import division
import sys
import math
import random
import time
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
TICKS_PER_SEC = 60
TAMANHO_SETOR = 16
CAMINHAR_VELOCIDADE = 5
VOAR_VELOCIDADE... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2021 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... |
import os
import asyncio
homedir = os.getcwd()
locallogdir = 'log'
plotdir = 'plots'
def print_now(string):
"""Takes a string and prints it, but appended with - {ISO Datetime of the time it was printed}"""
from datetime import datetime
print(f"{string} - {datetime.now().isoformat(' ')}")
async def chec... |
import copy
import numpy as np
import os
import collections
import time
import random
import tfg.alphaZeroConfig as config
from tfg.strategies import Strategy, MonteCarloTree
from tfg.alphaZeroNN import NeuralNetworkAZ
from tfg.util import play, get_games_per_worker
from tfg.games import BLACK, WHITE
from functools i... |
from geckopush import geckopush
import unittest
import json
# Declare initial dashboard widget and test values.
d = geckopush.Dashboard(api_key="api-key-123")
widget_key = "Widget-Key"
# Monkey patch urlopen method to append the url and headers to return dict.
def dummy_urlopen(url):
mock_api_return = {
... |
#!/usr/bin/python3
import numpy as np
import lmfit
import pickle
import matplotlib as mpl
mpl.rcParams['mathtext.fontset'] = 'cm'
import pylab as plt
def load_result_file(infile, w, h):
result = np.load(infile)
size, num_steps = result.shape
frames = []
for istep in range(num_st... |
#!/usr/bin/env python3
'''
NOTES
=====
* There are gaps in serial IDs. Does PyPI lose some events?
* changelog action journal entries
* 'add {role_name} {user_name}'
* 'add {pyversion} file {filename}'
* 'add url '
* 'create'
* 'docupdate'
* 'new release'
* 'remove'
* 'remove file {filename}'
* 're... |
#!/usr/bin/env python
'''
MIT License
Copyright (c) 2021 <NAME>, <NAME>, <NAME>, <NAME> and <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 limitati... |
"""
Raw radar RHIs processing.
@title: calibrate_rhi
@author: <NAME> <<EMAIL>>
@institution: Australian Bureau of Meteorology
@date: 07/10/2020
@version: 0.1
.. autosummary::
:toctree: generated/
mkdir
remove
extract_zip
get_radar_archive_file
get_metadata
get_calib_offset
get_zdr_off... |
import plexapi.server
import requests_cache
import trakt
from plex_trakt_sync.path import pytrakt_file, env_file, trakt_cache
trakt.core.CONFIG_PATH = pytrakt_file
import trakt.errors
import trakt.movies
import trakt.tv
import trakt.sync
import trakt.users
import trakt.core
from time import time, sleep
import datetime
... |
import cv2
import numpy as np
def plot_feature_map(features, channel=None):
"""Visualize the feature maps in neural network.
:param features: pytorch tensor, [C, H, W]
:param channel: select which channel to be visualized, default = None means all channels in avg
:return: None
"""
# Convert ... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.lines import Line2D
class Casino:
def __init__(self):
self.player = Player()
self.sum = np.array([0] * 10)
self.usable_ace = {"exist": False, "pos": -1, "flipped_pos": -1}
self.threshold = ... |
"""
Copyright (C) 2018 MuadDib
----------------------------------------------------------------------------
"THE BEER-WARE LICENSE" (Revision 42):
@tantrumdev wrote this file. As long as you retain this notice you can do
whatever you want with this stuff. Just Ask first when not released through... |
from xml.etree import ElementTree
from lxml import etree
from pathlib import Path
import argparse
from typing import Dict, Optional, List
from xsdata.formats.dataclass.context import XmlContext
from xsdata.formats.dataclass.parsers import XmlParser
from dataclasses import dataclass, field
from copy import deepcopy
xs ... |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
import torch.nn.functional as F
import math
from .submodule import *
import numpy as np
from scipy import interpolate
import cv2
from . import common
import pdb
import gc
class EDSR(nn.Mo... |
from selenium import webdriver
import time
import os
import pyautogui
from selenium.webdriver.common.keys import Keys
pyautogui.FAILSAFE = False
from fake_useragent import UserAgent
import random
import re
import pickle
# These are some global sleep variables, for each of the expected sleep times
# May need to be chang... |
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#
# @TAG(DATA61_BSD)
#
... |
import time
import datetime
from datetime import timedelta
from calendar import monthrange
from . import num_utils
from . import object_utils
import logging
log = logging.getLogger(__file__)
def ret_me(s):
return s
_ = ret_me
MORE = _('more')
TODAY = _('Today')
def get_local_time():
return time.localti... |
#!/usr/bin/env python
import time
from pprint import pprint
from talospider import Item, TextField, AttrField
class TestSpider(Item):
title = TextField(css_select='.book-info>h1>em')
author = TextField(css_select='a.writer')
cover = AttrField(css_select='a#bookImg>img', attr='src')
abstract = TextFie... |
"""
This module contains all of fbs's built-in commands. They are invoked when you
run `fbs <command>` on the command line. But you are also free to import them in
your Python build script and execute them there.
"""
from fbs import path, SETTINGS, activate_profile
from fbs.builtin_commands._util import prompt_for_valu... |
"""
Prof of Concept module to export data from Meerkat to DHIS2.
Configuration is read from country_config.dhis2_config dictionary.
IT NOT FULLY FUNCTIONAL MODULE YET. Will be transformed to a separate microservice.
"""
import json
import logging
from datetime import date
import requests
from api_background._populat... |
'''
Reproduce results in paper.
Table3 and Figure6
'''
import os
import argparse
import csv
import numpy as np
import matplotlib.pyplot as plt
import pickle
import random
from sklearn.metrics.pairwise import euclidean_distances
from matplotlib.ticker import FormatStrFormatter
from util import Test, plot, draw_CE_compar... |
"""
Copyright (C) 2007 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 agreed to in writing, softwa... |
from utils import detector_utils as detector_utils
from sklearn import svm
import cv2
import math
import time
import numpy as np
import tensorflow as tf
import datetime
import argparse
import keyboard
import open3d as o3d
import time
from transforms3d.axangles import axangle2mat
import config
import threading
from mul... |
"""
Utility functions to make infer work.
"""
import os
import json
import csv
import argparse
import logging
from tqdm import tqdm
from ast import literal_eval
import torch
import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
from KEMP.main import print_opts
from KEMP.kemp_src.dataloa... |
#!/usr/bin/python
#
#Copyright (c) 2020, Oracle and/or its affiliates.
#The Universal Permissive License (UPL), Version 1.0
#
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: oracle_rman_module
short_description: This is ... |
import asyncio.subprocess
import dataclasses
import datetime
import time
from typing import (
Any,
AsyncIterator,
Coroutine,
Dict,
Iterable,
Literal,
Optional,
Tuple,
cast,
)
import aiohttp
import requests
from .azure_exceptions import AzureRestApiError, raise_for_status, raise_for... |
import sys
import argparse
import glob
import math
import os
import copy
import pickle
from functools import partial
from itertools import filterfalse
from fractions import Fraction
import torch.multiprocessing as mp
from jazz_rnn.utils.music.vectorXmlConverter import *
from jazz_rnn.C_reward_induction.online_tagger_g... |
#!/usr/bin/env python3
from lxml import etree
import re, copy, sys
# LIMITATIONS
# Can't always infer tag order
# Loses variable initial values
# Anything with <concat> or <append> is likely to get messed up
# Completely ignores .t3x
# Some if statements might get slightly changed (dropped conditions may change outcom... |
from datetime import datetime
import itertools
import json
import re
from addict import Dict
import pytest
from pureapi import response
from pureapi.common import PureAPIInvalidCollectionError, PureAPIInvalidVersionError
uuid_regex = re.compile('^[a-z0-9-]+$')
def load_json(version, record_type, uuid):
with ope... |
# <EMAIL> 2017sep26 calculates stats for summary report
# <EMAIL> 2017sep27 addressed issue of division by zero
# <EMAIL> 2017Sep28 added exceptions
# <EMAIL> 2017Sep29 tried to fix nstar problem
# <EMAIL> 2017Oct02 tried to fix nstar problem again
# <EMAIL> 2017Oct03 FINALLY fixed nstar problem and SCE bug
# <EM... |
import webbrowser
from tkinter import *
import tkinter as tkinter
import random
from PIL import Image, ImageTk
LARGE_FONT= ("Verdana", 12)
class MyGUI(tkinter.Tk):
def __init__(self, *args, **kwargs):
tkinter.Tk.__init__(self, *args, **kwargs)
container = tkinter.Frame(self)
contain... |
from CTL.causal_tree.ctl.binary_ctl import *
# from CTL.causal_tree.util import *
import numpy as np
class TriggerNode(CTLearnNode):
def __init__(self, trigger=0.0, **kwargs):
# ----------------------------------------------------------------
# Causal tree node
# -------------------------... |
from django.db import IntegrityError
from rest_framework import status
from rest_framework.parsers import JSONParser, FileUploadParser
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from .models import Tags, Category, SoloEven... |
"""
Configuration definitions are classes, that desribes
the syntax of a configuration file, or its parts
(sections or configuration options)
They are able both to parse a file, which results in an
instance of (an instance of :py:class:`ase2sprkkr.common.BaseConfiguration`,
e.g. an :py:class:`Option<ase2sprkkr.common.... |
#!/usr/bin/env python3
import os
import os.path as osp
import time as system_time
import numpy as np
import numpy.linalg as npla
from scipy.spatial import transform as sptf
import rclpy
from rclpy.qos import QoSPresetProfiles
from rclpy.node import Node
from rclpy.time import Time
from rclpy.time_source import CLOCK_... |
import torch
from torch import autograd, nn
import torch.nn.functional as F
from .criterion import BaseCriterion, EqualizedConv1d # , # PredictionNetwork
class _SOFT_ALIGN(autograd.Function):
"""Soft-align a set of predictions to some vectors.
Args:
- log_probs: BS x Num_X x Num_Preds giving log(X|P) (... |
#
# Story Time App
# Main flask app configuration and website route definitions
#
import datetime
import json
import os
import random
import string
import httplib2
import requests
from flask import Flask, flash, jsonify, make_response, redirect, render_template, request, \
session as login_session, url_for
from f... |
import json
from itertools import chain
from typing import Optional
import qrcode
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm, Passwo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... |
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2021 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
import io
import logging
from datetime import datetime
from typing import Callable, List, MutableMapping, Optio... |
import numpy as np
import tensorflow as tf
from time import gmtime, strftime
import random
from common import *
from cloud import *
from dataset_params import *
from point_ops import *
from general_ops import *
os.system('nvidia-smi -q -d Memory |grep -A4 GPU|grep Free >tmp')
os.environ['CUDA_VISIBLE_DEVICES']=str(np... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Zapador es un pequeño script que se encarga de la logística de actualizar el KDM a su última versión y
generar archivos para una nueva misión"""
# imports
import urllib.request
import requests
import os
import sys
import zipfile
import time
import shutil
from pathli... |
# *****************************************************************
# Copyright 2013 MIT Lincoln Laboratory
# Project: SPAR
# Authors: SY, KH
# Description: LaTeX object classes, which can return LaTeX
# code for their representation
#
# Modifications:
# Date ... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# 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
... |
import os
from typing import Iterable, Dict, List, Callable
import logging
import re
import json
from ..common.file_util import loadJSONTypeFile
from ..asdl import asdl
from ..asdl.lang.py3 import py3_transition_system as py3_lang
from tqdm import tqdm
import sys
from pathlib import Path
from copy import deepcopy
from ... |
"""Draws a scene of a tree in front of grass on a starry night with low-lying clouds.
Notes:
line 59: setworldcoordinates - used to help me map out my space with the bottom-left corner being (0,0).
line 213: xcor - used to return the x-coordinate of where the turtle was so that the turtle could
come back to that... |
import os.path
import re
import numpy
import pytest
from grunnur import (
cuda_api_id, opencl_api_id, cuda_api_id,
Program, Queue, MultiQueue, Array, MultiArray, CompilationError, StaticKernel, API, Context,
)
from grunnur.template import Template, DefTemplate
from .mock_base import MockKernel, MockDefTe... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from uncertainties import ufloat
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
from pint import UnitRegistry
u = UnitRegistry()
Q_ = u.Quantity
def Polarisationsmess... |
import cv2
import numpy as np
import operator
import timeit
from openpyxl import Workbook, load_workbook
from openpyxl.styles import Border, Side, Alignment, named_styles, colors, Font
from openpyxl.utils.cell import coordinate_from_string, column_index_from_string
try:
from openpyxl.cell import get_column_letter
... |
import torch
import random
from itertools import permutations
from torch.utils.data import Dataset, DataLoader
from torchvision.datasets import ImageFolder
from torchvision.transforms import Compose, Grayscale, ToTensor
class Grid:
def __init__(self):
self.size = 4 # 4x4 grid (fixed)
# ... |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2009 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# This is the main of the glideinFrontend
#
# Arguments:
# $1 = work_dir
#
# Author:
# <NAME>
#
import fcntl
import logging
im... |
#* Software License Agreement (BSD License)
#*
#* Copyright (c) 2010, CSIRO Autonomous Systems Laboratory
#* All rights reserved.
#*
#* Redistribution and use in source and binary forms, with or without
#* modification, are permitted provided that the following conditions
#* are met:
#*
#* * Redistributions of s... |
#!/usr/bin/env python
# coding: utf-8
# # Importing Packages
# In[1]:
import pandas as pd
import os
from matplotlib import rcParams
import seaborn as sns
from sklearn.preprocessing import OneHotEncoder
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import sys
import json
import errno
import shutil
import logging
import argparse
import platform
from typing import Optional
from common import (
config as c,
pb,
get_cmd_or_die,
download_archive,
die,
est_parallel_link_jobs,
... |
__version__ = "0.2.0"
"""
Algorithms based on 'Mining of Massive Datasets'
"""
import re
import sys
import random
import collections
from math import log1p
from operator import itemgetter
from heapq import nsmallest
from logging import getLogger
from itertools import imap, izip, islice, chain, combinations
from abc i... |
'''
' __ __ ____ _____ _____ __ _____ __ __
' / // /__ ___ __ ____ __ / _/__ ___ / ___/__ / / (_)__/ /__ ____ / __(_)_ _ __ __/ /__ _/ /____ ____
' / _ / -_) _ `/ |/ / // / _/ // _ \/ _ \ / /__/ _ \/ / / / _ / -_) __/ _\ \/ / ' \/ ... |
#!/usr/bin/env python
"""
migration_scope.py
A tool to watch migration and/or to analyze its log files
This is designed to read from a file, if specified, or stdin.
Since migrate.py spits everything out through stdout, in addition to
writing log files, it is good to pipe migrate.py to this.
migrate.py <command> ....... |
"""
Class to take an array of bytes and parse it based on the RNET
message syntax.
"""
from enum import Enum
class RNET_MSG_TYPE(Enum):
UNKNOWN = 0
EVENT = 1
ALL_ZONE_STATE = 2
ALL_ZONE_INFO = 3
ZONE_STATE = 4
ZONE_SOURCE = 5
ZONE_VOLUME = 6
ZONE_BASS = 7
ZONE_TREBLE = 8
ZONE_... |
import cv2 # for reading and writing image data
import heapq # for heap data structure
import os # to work with files
import random # for randomisation
from AES import *
compTextRef = ""
side0Mode = 0
side1Mode = 0
side2Mode = 0
side3Mode = 0
embeddedBits = 0
retrievedBits = 0
retrievedTextRef = ""
r... |
#!/usr/bin/python3
# Copyright 2021 <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... |
import sys, os, json
import numpy as np
import cv2
from nbtlib import nbt
from nbtlib import tag
class poster:
def __init__(self, name):
self.schematic = nbt.load('original')
try:
self.read_img(name)
except:
sys.stderr.write('画像の取得に失敗\n')
s... |
import discord
from discord.ext import commands, menus
import datetime
from typing import Optional, Union
from bs4 import BeautifulSoup
from utilities import checks
from utilities.menu import Menu
def setup(bot):
bot.add_cog(Entertainment())
class Entertainment(commands.Cog):
def __init__(self):
self.menus ... |
from __future__ import division
import numpy
import math
import scipy.io.wavfile as wav
from copy import deepcopy
# get the data
def speech_wave(fileName_):
(fs , sig)= wav.read(fileName_)
if sig.dtype == 'int16':
nb = 16 # -> 16-bit wav files
elif sig.dtype == 'int32':
nb = 32 # -> 32-bi... |
import re
import os
import html
##############################
#/ \#
#| Serialization Outputs |#
#\ /#
##############################
def __soutf_html_before__(source, data):
data["tag"] = ''.join(source.tag).strip() or "div"
if data["tag"][-1] == '/':
data["... |
#!/usr/bin/env python
from __future__ import print_function, division
from threading import Thread
import serial
import random
import rospy
import tf2_ros
from cobs import cobs
from colorsys import hsv_to_rgb, rgb_to_hsv
from rospy import sleep
from std_msgs.msg import String, Bool
from sensor_msgs.msg import Imu
fr... |
import os
import typing
from copy import deepcopy
from itertools import cycle
from gym import logger
import drawSvg
import gym
from pogema.wrappers.multi_time_limit import MultiTimeLimit
from pydantic import BaseModel
from pogema import GridConfig
from pogema.grid import Grid
class AnimationSettings(BaseModel):
... |
# Board bios module for TWatch 2020 by <NAME> (OSi)
# See https://github.com/ondiiik/micropython-twatch-2020 for more
import axp202
import lvgl as lv
# import lvesp32
import st7789_lvgl as st7789
import ... |
"""
Mixin classes for inference.
Adding your own inference class:
- An inference class must contain the `self.infer()` method.
- Running `infer()` should append (samples, inference_name) to `self.all_bayes_samples`,
where `samples` is a (self.infer_nsamples, self.nweights) tensor of posterior samples
an... |
#!/usr/bin/python
# Copyright 2012 Google 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 by applic... |
#!/usr/local/lcls/package/python/current/bin/python -d
# encoding: utf-8
'''
Name: logbookForm.py
Author: <NAME>
Created: 2/01/2013
Purpose: Logbook entry form for use with canvas.py
'''
from PyQt4.QtCore import *
from PyQt4.QtGui import *
__all__ = ['logbookForm', 'sendToLogbook']
class logbookForm(QDialog):
... |
import blockchain
import mempool
import output
import modification
import random
from multiprocessing import Process
import encryption_module
import time
import PoET_server
# NON-MODIFIABLE PART:
num_of_consensus = 0
def choose_consensus():
while True:
output.choose_consensus(blockchain... |
import json
import time
from pathlib import Path
from typing import Optional, Union
import inspect
import numpy as np
import pandas as pd
from scipy import sparse
from scTenifold.core._networks import *
from scTenifold.core._QC import sc_QC
from scTenifold.core._norm import cpm_norm
from scTenifold.core._decompositio... |
"""
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license.
"""
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import ctypes
import binascii
import argparse
import manifest_types
import manifest_common
from Crypto.PublicKey import RS... |
import os
import torch, cv2
import random
import numpy as np
def tens2image(im):
if im.size()[0] == 1:
tmp = np.squeeze(im.numpy(), axis=0)
else:
tmp = im.numpy()
if tmp.ndim == 2:
return tmp
else:
return tmp.transpose((1, 2, 0))
def crop2fullmask(
crop_mask,
... |
# coding=utf-8
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import OneHotEncoder,LabelEncoder
from scipy import sparse
import os
import hashlib, csv, math, os, pickle, subprocess
import numpy as np
from ... |
import contextlib
import functools
import io
from abc import ABC, abstractmethod
import cvxpy as cvx
import numpy as np
import pandas as pd
import wrapt
from controllers.components.mld_evolution_matrices import MldEvoMatrices
from controllers.components.objective_atoms import ObjectiveAtoms
from controllers.component... |
import itertools
from django.contrib.auth.models import User
from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import TokenAuthentication
from rest_framework.views import APIView
from rest_framework.views import Response
from rest_framework.views import status
from rest_fr... |
# Copyright 2021 <NAME>
"""A library of generic test for the python built-in types."""
import collections
from functools import wraps
import fractions
import types
from hypothesis import assume
from .isclose import IsClose, isclose
from .core import ClassUnderTest
from .relations import EqualityTests, TotalOrdering... |
"""Validate the synapse input max rates found by check_max_synapse_rates
Bin the max rates into spike generator rates
Pair-by-pair check that synapses indeed satisfy the max rates predicted
"""
import os
from time import sleep
import argparse
import numpy as np
import matplotlib.pyplot as plt
from pystorm.hal import ... |
import math
from typing import Callable, Dict, List, Tuple, Union
import torch
from torch import nn
import torch.distributed as dist
import torch.nn.functional as F
from mcquic.modules.entropyCoder import EntropyCoder
from mcquic.nn.base import LowerBound
from mcquic.utils.specification import CodeSize
from mcquic im... |
import random
from math import exp
import itertools as it
from bisect import bisect
import numpy as np
def gene2bin(parameters, gene, geneType):
"""
geneBin = gene2bin(parameters, gene, geneType)
Turns genes into the binary-string form
gene:
integer
geneType:
string
geneBin:
... |
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
""" Transform nanopubs
"""
import gzip
import json
import os
import re
from time import sleep
from typing import Any, Iterator, MutableMapping
import bel.lang.migrate_1_2
import bel.nanopub.belscripts
import bel.nanopub.files
import bel.nanopub.nanopubs
import bel.nan... |
import os
import re
import string
import traceback
from typing import TextIO
from jinja2 import Template
from jinja2.exceptions import TemplateSyntaxError, TemplateError
from jinja2 import StrictUndefined, Undefined
from doxybook.node import Node, DummyNode
from doxybook.constants import Kind
from doxybook.templates.an... |
# coding: utf-8
# In[20]:
import logging
import requests
from time import sleep
from psycopg2.extensions import cursor
from psycopg2.extensions import connection
import pandas as pd
from src.shared.utils import configure_logging
# In[2]:
configure_logging()
logger = logging.getLogger("poll-ooni")
# In[40]:
... |
from __future__ import annotations
import asyncio
import collections
import concurrent.futures
import dataclasses
import enum
import logging
import types
import typing as t
from contextlib import suppress
from functools import wraps, partial
import ubii.proto as ub
from ubii.util import get_import_name
from . import... |
"""
Provide function for gridness score calculation.
"""
import numpy as np
from scipy.spatial.distance import cdist
from scipy.stats import pearsonr
from skimage import transform
import opexebo
import opexebo.defaults as default
import opexebo.errors as err
# This is included as the return result of an invalid aut... |
import random, sys
def build_board(boardsize):
'''
eg) for a 3x3 board, internal structure would be:
3 3 3 3 - top border
3 0 0 0 - first row
3 0 0 0 - second row
3 0 0 0 - third row
3 3 3 3 - bottom border
'''
# create empty board spaces
board = [0] * ((boardsize + 1)... |
from http.server import HTTPServer, BaseHTTPRequestHandler
import cgi
import os.path
import threading as thr
import codecs as cc
import FindRoute as fr
import Rules as r
code = "utf-8"
def request_css(self):
output = ""
path = self.path[1:]
if path == "main-css":
with cc.open("root/main.css","r",code) as file:
... |
# -*- coding: utf-8 -*-
# Copyright 2015 Yelp 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 ... |
# Interactive colorplot base class
# Drag bar user interface in didv.colorplot
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches
import matplotlib.colors
import numpy as np
import pandas as pd
class colorplot(object):
def __init__(self):
self.__draggables__ = []
self.__... |
"""Acquisition gateway controller"""
# coding:utf-8
"""采集网关控制器"""
from tkinter import ttk
import datetime
import json
import socket
import tkinter
import tkinter.filedialog
APP_WINDOW = '600x400+200+200'
APP_TITLE = 'Tarek采集网关控制器'
# APP_LOGO = 'cy-logo.ico'
COMMAND_LIST = ["设备启动", "设备停止", "设备重启", "模块启动", "模块停止", "模块重启... |
#!/usr/bin/env python3
"""
Simulate rolling dice, etc.
Requires:
https://github.com/filipeabperes/Py3ODE
Ode manual:
http://ode.org/wiki/index.php?title=Manual
Howto:
http://ode.org/wiki/index.php?title=HOWTO
"""
import sys, os, random, time
from math import *
from random import random, shuffle
from functools impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import simplejson as json
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QTableWidget, QTableWidgetItem,\
QAbstractScrollArea, QHeaderView, QLabel, QLineEdit, QFormLayout, QDoubleSpinBox, QMessageBox,\
QAppl... |
#!/usr/bin/env python
"""
MIT License
Copyright (c) 2021 <NAME> <<EMAIL>>
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, cop... |
import glob
import numpy as np
import pandas as pd
import h5py
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
from lalsimulation import SimInspiralNRWaveformGetSpinsFromHDF5File as get_spin
from . import config
from .exceptions import FileTypeError, LalsuiteError
from .waveform import NRWavefo... |
import yaml
import openpyxl
from openpyxl.utils.cell import coordinate_from_string, column_index_from_string
from openpyxl.styles import Color, PatternFill, Font, Border
from openpyxl.styles import colors
import time
import sys
from tqdm import tqdm
YELLOW_HIGHLIGHT = PatternFill(start_color='ffff00',
end_color=... |
from datetime import datetime, time
from typing import Type
from flask import request, jsonify, abort, current_app, Response
from permissive_dict import PermissiveDict
class FlaskSerializeNoDb(Exception):
def __init__(self):
super().__init__('FlaskSerializeMixin property "db" is not set')
class FlaskSe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.