text stringlengths 3.07k 22.1k |
|---|
import socket, threading, sys, ipaddress, time, os
from optparse import OptionParser
from scapy.all import *
class Port_Scanner:
def __init__(self, ip, ports):
self.ip = str(ip)
self.logfile = "squidmap.txt"
file = open(self.logfile,"w")
file.close()
self.isnetwork =... |
from prettytable import PrettyTable
import logging
class DefaultAlgorithmPolicy():
def __init__(self, default_algorithm_id):
self.default_algorithm_id = default_algorithm_id
def to_json(self):
return { 'class': 'DefaultAlgorithm', 'algorithmId': self.default_algorithm_id }
class WeightedAlgori... |
# -*- coding: utf-8 -*-
"""
Implementation of the Non Stationary Structured Coalescent (NSSC)
"""
import numpy as np
import bisect
class NSSC:
"""
Non Stationary Structured Coalescent
This class represents a generalization of the Structured Coalescent
Markov Chain for Non Stationary structured populati... |
#<NAME>
import time
import pygame
import random
pygame.init()
gameDisplay = pygame.display.set_mode((582,785))
clock = pygame.time.Clock()
#all spaces, 0=empty 1=filled 2=active
#in tuple: first is piece type, second is color
#rows should be a dictionary
rows = []
for i in range(18):
rows.append([])
for w in r... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2013, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redis... |
# encoding: utf-8
# Copyright 2011 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
'''PDS Registry Client: tests for information model classes.'''
import unittest
from pds.registry.model.classes import (
Association,
ExtrinsicObject,
Identifiable,
R... |
import os
import numpy as np
import pandas as pd
import numpy as np
import json
import time
from utils import dump_json, open_json
import pandas as pd
from multiprocessing import Pool
import argparse
question_map = {}
abcd_map = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
question_meta, subject_metadata, df, question_meta_1, que... |
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
from multi_ball_tracker import FrameProcessor
import math
import threading
import cv2
from collections import OrderedDict
class Frame:
"""
Starts the calculations done to locate the balls in the frame.
:param frame: numpy array... |
# -*- coding: utf-8 -*-
#
# FileIO of HMM Aligner
# Simon Fraser University
# NLP Lab
#
# Here are all of the functions used in HMM aligner to handle file operations.
# Which includes: reading text file, reading gold alignment files and export
# alignment to file. Exported alignment can also be read using the same
# f... |
from collections import deque
from numbers import Number
from functools import lru_cache
from pyluach.dates import HebrewDate
def fast_day(date):
"""Return name of fast day or None.
Parameters
----------
date : ``HebrewDate``, ``GregorianDate``, or ``JulianDay``
Any date that implements a ``to... |
"""Data augmentations as in Amin's (https://github.com/AminJun) inversion implementation
[See model-free inversion at https://arxiv.org/abs/2201.12961]
."""
import torch
import torch.nn.functional as F
from torch.nn.modules.utils import _pair, _quadruple
class Jitter(torch.nn.Module):
def __init__(self, lim=32, *... |
import codecs
import json
import mysql.connector as mariadb
import re
import pprint
import argparse
argpar = argparse.ArgumentParser(description='Extract titles and category hierarchy form Wikipedia dump.')
argpar.add_argument('-full', action='store_true')
args = argpar.parse_args()
extract_titles = args.full
mariad... |
#!/bin/env python
"""
This file is executed everytime before python interactive shell is run
to setup stuff. Remember to put export PYTHONSTARTUP=$HOME/.pythonrc.py
in .bashrc
"""
# pylint: disable=unused-import
# Import common modules
from datetime import datetime
from pprint import pprint as p
from code import Int... |
#! /usr/bin/python3 -u
# -*- coding: utf-8 -*-
"""
Based in:
http://stackoverflow.com/questions/15870619/python-webcam-http-streaming-and-image-capture
and
http://stackoverflow.com/questions/245447/how-do-i-draw-text-at-an-angle-using-pythons-pil
"""
HOMEDIR = "/home/pi"
import time
import sys
import os
# pip3 insta... |
import numpy as np
import sys
import os
class PROMPI_ransdat:
def __init__(self, filename, endianness, precision):
# find first occurence of dd due to header info stored either on 4 or 8 lines, computer arch dependent
lookup = "dd"
iterate = True
with open(filen... |
import torch
import torch.nn as nn
import models.common as common
import torchvision.ops.deform_conv as dc
class _down(nn.Module):
def __init__(self, nchannel):
super(_down, self).__init__()
self.prelu = nn.PReLU()
self.maxpool = nn.MaxPool2d(2)
self.conv = nn.Conv2d(i... |
import sys
import os, glob
import os.path as op
from mne import find_events, Epochs, EpochsArray
from mne.io import read_raw_brainvision,RawArray
from mne.channels import read_dig_montage
import numpy as np
from mne import create_info,events_from_annotations
from tqdm import tqdm
def get_events(raw):
''' with the ... |
#!/usr/bin/env python3
from typing import Dict, List, Tuple, Union
import numpy as np
from . import numpy_grid_sample as numpy_func
def cube_list2h(cube_list: List[np.ndarray]) -> np.ndarray:
assert len(cube_list) == 6
assert sum(face.shape == cube_list[0].shape for face in cube_list) == 6
return np.co... |
# -*- coding: utf-8 -*-
import os
import re
from re import Pattern
from io import BytesIO, StringIO
from tarfile import open as tar_open
from tarfile import TarInfo
from typing import List, Dict, Optional, Iterable, KeysView, ValuesView
from recc.package.package_utils import get_module_directory
from recc.file.permiss... |
"""Gstat
Summarize the status of the jobs (wrapper around "squeue") using (some of) the following fields:
+--------------+------------------------------------------------+
| Header | Description |
+--------------+-------------------------------------... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from accelerator.models import (
JUDGING_FEEDBACK_STATUS_COMPLETE,
JudgeApplicationFeedback,
JudgeRoundCommitment,
Scenario,
)
from collections import defaultdict
from django.db.models import (
F,
Sum,
)
from impact.v1.helpers.criterion_opt... |
#!/usr/bin/env python3
import os
import re
import sre_constants
import sys
from collections import deque
from natsort import natsorted, ns
from batchren import helper, StringSeq
issues = {
# issuecodes for rentable
0: "name is unchanged",
1: "name cannot be empty",
2: "name cannot start with '.'",
... |
import torch
import torch.nn as nn
import numpy as np
class Darknet(nn.Module):
"""
Darknet object detection module.
"""
def __init__(self, config_path, input_size=None):
"""
Initializes Darknet module with the configuration stored in 'config_path'.
:param config_path: YOLOv3 c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ********************************************************************************
# Copyright © 2018 jianglin
# File Name: markup.py
# Author: jianglin
# Email: <EMAIL>
# Created: 2018-11-06 11:29:39 (CST)
# Last Update: Thursday 2019-07-11 18:05:30 (CST)
# By:
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 22 15:13:56 2021
@author: hemerson
"""
"""
A prioritised replay buffer for storing data and preferentially sampling
trajectories where the predicted loss was significantly different from the
observed.
"""
from AgentRL.common.buffers import bas... |
#!/usr/bin/env python
import argparse
import os
from math import radians
from threading import Condition
from threading import Lock
from typing import (
Any,
Dict,
)
import message_filters
import numpy as np
import rospy
from cv_bridge import CvBridge
from geometry_msgs.msg import Twist
from habitat.sims.habit... |
from bs4 import BeautifulSoup
import requests
import pandas as pd
import streamlit as st
import time
import re
import plotly.express as px
import geocoder
import bs4
from selenium import webdriver
from datetime import date
from datetime import timedelta
from statistics import mean
def get_destinations(we... |
# <NAME>, 2015
# This module is a workspace to define the set of constraints that can
# be enforced while executing the optimization routine
# constraints are functions that restrict a parameter to a given bounds
# furthermore it is expected that the constraints should map violating values back to the required bounds
... |
# -*- coding: utf-8 -*-
"""
Creator: <NAME>.
Created on: Mon Sep 28 05:27:06 2020
"""
# Import Libraries
import numpy as np
import scipy.optimize as op
from scipy.io import loadmat
import matplotlib.pyplot as plt
# Ignore overflow and divide by zero of np.log() and np.exp()
# np.seterr(divide = 'ignore')
# np.seterr(... |
"""
Functions to compute features for ligand and protein backbone graphs.
"""
import numpy as np
from rdkit import Chem
from typing import List, Union, Set, Any
from Bio.PDB.Residue import Residue
from Bio.PDB.DSSP import dssp_dict_from_pdb_file
from typing import List, Tuple, Dict
from holoprot.feat import SECONDARY_... |
#!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: <EMAIL>
@file: urlparser.py
@time: 2020/3/18 15:46
@desc:
'''
import re
from urllib.parse import urlparse, parse_qs, urljoin
from web.spider.models import SubDomainList, UrlTable
from web.index.models import BanList
from utils.log import logger
... |
"""Some simple API functions and command-line tools for interaction with JIRA."""
from __future__ import print_function
from argparse import (
ArgumentParser,
ArgumentDefaultsHelpFormatter,
RawDescriptionHelpFormatter,
)
from .utils import load_config, DEFAULT_LINK_TYPE
from .helpers import list_from_conf... |
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import log_loss
from sklearn.linear_model import LogisticRegression
from sklearn.decomposition import PCA
from sklearn.decomposition import MiniBatchSparsePCA
from sklearn.preprocessing import MinMaxScaler
from sklearn.preproc... |
# NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify and create derivative works of the software or any portion of the software, and you may copy and distribute ... |
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
import random
from pygame.locals import *
import time
import cliCube
import _thread
from PiBasicRotation import IODevices
from Solve import Queue
from OpenGL.GL import *
from OpenGL.GLU import *
vertices = (
( 1, -1, -1),
... |
# Copyright 2017 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, ... |
# *********************************************************************************
# REopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions a... |
import os
import argparse
import json
import tensorflow as tf
import numpy as np
import gnn
from gnn.modules import mlp_layers
from gnn.data import load_data
def seq2seq(time_segs, params, pred_steps, training=False):
# timeseries shape [num_sims, time_seq_len, num_agents, ndims]
num_segs, time_seg_len, num... |
import torch
import torchvision
import torchvision.transforms as transforms
from ADV_ResNet import *
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader, Dataset, random_split
import coremltools as ct
# mean and st... |
"""
mobspy.modules.process_result_data.py
Handles rate_assignment to the reactions:
The passing of arguments to be executed by the user supplied rate function
The construction of mass action kinetics
Handles the different types of rates supplied by the user
"""
import mobspy.modules.me... |
# 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 ... |
# Copyright (c) 2018 Trail of Bits, 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 ... |
import numpy as np
from scipy.stats import boxcox
import torch
import torch.nn as nn
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
import matplotlib.pyplot as plt
import pandas as pd
import time
from lime import lime_tabular as ltb
class baselineRNN(nn.Module):
def __init__(self,inpu... |
import abc
import logging
import time
from datetime import datetime
from itertools import cycle
from threading import local
from six import with_metaclass
from typing import Dict, Generator, List, Optional, Tuple, Iterable, Any # noqa
import boto3
from botocore.exceptions import ClientError
from six import raise_from... |
#!/usr/bin/env python3
#
# The Device Nanny
# Hudl
#
# Created by <NAME> 2016
#
from datetime import datetime, timedelta
from db_actions import MyDB
import logging.config
import configparser
import subprocess
import logging
import slack
import time
import os
import re
def get_serial(port):
"""
Tries to retri... |
import tensorflow as tf
from tensorflow.python.saved_model import tag_constants
from PIL import ImageGrab
import cv2
import numpy as np
from scipy.spatial import distance
# Set option
threshold = 0.7
input_size = 416
left_top_x = 200
left_top_y = 200
detect_width = 1280
detect_height = 720
# Set path
model_path = 'mo... |
"""
Measure rotation periods using plots.
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import glob
import lightcurvestuff as lcs
import starspot as ss
from tqdm import trange
import starspot.rotation_tools as rt
import re
import starspot.stitch as sps
def extract_ticid(fn):
... |
import os
import numpy as np
import matplotlib.pyplot as plt
# no X forwarding on remote machine using ssh & screen & tmux
plt.switch_backend("agg")
from matplotlib import gridspec
from extension.utils_tlg import utils, io_utils
try:
import seaborn as sns
sns.set_style("whitegrid", {"axes.grid": False})
excep... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 23 22:24:44 2021
@author: PatCa
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from xgboost import XGBClassifier
import pickle
import tensorflow as tf
from tensorflow import keras
import tensorflow_hub as hub
from tensorflow.k... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 <NAME> and contributors
# See LICENSE.rst for details.
import re, time, argparse
from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
f... |
r"""
Matching Pursuit Trainers.
.. autosummary::
:toctree: toctree/nn
TrainMatchingPursuit
TrainLISTA
TestMatchingPursuit
TestMatchingPursuitParameters
"""
import torch
import torch.nn as nn
import torch.utils.data
from mighty.trainer import TrainerAutoencoder
from mighty.trainer.trainer import Tra... |
import logging
import argparse
from yolo import YOLO
from PIL import Image
import numpy as np
import os
import json
logging.basicConfig(filename='logger.txt', level=logging.INFO)
from pprint import pprint
root_path = '/home/xingnaili/Downloads/coco2017/2014/val2014/'
root_path2017 = '/home/xingnaili/Downloads/coco2017/... |
#!/usr/bin/python
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("seed", type=int, help="Set seed number here")
args = parser.parse_args()
import numpy as np
np.random.seed(args.seed)
from matplotlib import pyplot as plt
from IPython import display
import torch
import torch.nn as nn
torch.manu... |
import argparse
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import os
import json
import numpy as np
import seaborn as sns
sns.set_style("whitegrid")
import pandas as pd
from platforms.platform import get_platform
import csv
def get_best_acc_from_logger(f, es, epochs):
reader = csv.r... |
import sys, os, time, traceback, hashlib, zlib, threading, re, base64, gzip
from . import anyjson as json
from .cmd import run, CommandError # @UnresolvedImport
from .. import config, scheduler
from .error import InternalError
# in the init function, this is set to a number of commands to be run in order to collect ... |
## image processing shit
import math
from typing import Tuple, Union, List
from itertools import combinations, product
import cv2
# import easyocr
import pytesseract
import numpy as np
from PIL import Image
# import face_recognition
from deskew import determine_skew
## initialize reader
# def init_easyocr():
# gl... |
from model.specs import (
config, SLOTS_PER_EPOCH, MAX_VALIDATORS_PER_COMMITTEE,
Checkpoint, AttestationData, Attestation,
BeaconBlock, BeaconBlockBody, SignedBeaconBlock,
get_block_root_at_slot, compute_start_slot_at_epoch, process_slots,
get_current_epoch, get_epoch_signature, process_block, get_h... |
from __future__ import unicode_literals
from copy import deepcopy
from datetime import datetime
from moto.core import BaseBackend, BaseModel
from moto.core.exceptions import RESTError
from moto.ec2 import ec2_backends
from moto.sagemaker import validators
from moto.sts.models import ACCOUNT_ID
from .exceptions import... |
import pytest
from boolean.boolean import ParseError
from doctag import TagIndex
## test utilities
def no_tag(ti: TagIndex, tag: str):
assert tag not in ti.tag_to_docs
assert tag not in ti.tags
def yes_tag(ti: TagIndex, tag: str):
assert tag in ti.tag_to_docs
assert tag in ti.tags
def no_doc(ti: ... |
# -*- coding: utf-8 -*-
"""
"""
import json
import os
from datapackage import Package
import pandas as pd
from oemof.tabular.datapackage import building
from oemof.tools.economics import annuity
def greenfield(
datapackage_dir,
raw_data_path,
cost_scenario,
countries,
technologies,
scenario_... |
import matplotlib
matplotlib.use("Agg")
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import pandas as pd
import re
import misc
import datetime
from adjustText import adjust_text
import math
def select_hits(x, col = "Hit_len", which = 'first'):
'''
Given a blast results d... |
"""
@name: tree.py
@description:
Module for trakem2
Used to manipulate trakem2 file
@author: <NAME>
@email: "cabrittin"+ <at>+ "gmail"+ "."+ "com"
@date: 2019-12-05
"""
from lxml import etree
from tqdm import tqdm
import numpy as np
def fix_calibration(tree):
root = tree.getroot()
t2_layer_set = root.find('t... |
# The essentials
import pandas as pd
import numpy as np
# CLI & Logging
import click
import logging
# Gradient Boosting
from catboost import CatBoostRegressor
# Plotting
import matplotlib.pyplot as plt
# ML utils
from sklearn.model_selection import KFold
# Some fancy printing
from terminaltables import AsciiTable
... |
import time
import struct
import os
import sys
from mlx90632.hw_i2c_hal import HwI2cHalMlx90632
import platform
import mlx90632.pympt
DEFAULT_I2C_TCLOCK = 10.0
DEFAULT_I2C_TSTART = 10.0
DEFAULT_I2C_TSTOP = 10.0
DEFAULT_I2C_TWRDELAY = 10.0
DEFAULT_I2C_THOLDDATA = 0.05
class Evb90632Comman... |
#!/usr/bin/env python
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
patient_info={}
strain_score={
"Blue Cheese":750,
"Bubba Kush":425,
... |
from blabla.utils.global_params import *
import blabla.utils.settings as settings
import numpy as np
def const_pt_height(const_pt):
"""The height of the constituency parse tree
Args:
const_pt (NLTK): The constituency parse tree
Returns:
height (int): the height of the constituency parse tree
"""
... |
#!/usr/bin/python3
#<NAME> 2020
#<NAME> 2020
#https://realpython.com/python-sockets/
import socket
import time
from IPython import embed
import rubiks_utils
#######################################
def send(s,chaine):
s.sendall(chaine)
print('envoi: '+chaine.decode('utf-8'))
#######################################... |
"""
Calculate the differences between two YAML/JSON/Compatible documents.
Copyright 2020 <NAME>, Jr. MBA MSIS
"""
import sys
import argparse
from os import access, R_OK
from os.path import isfile
from yamlpath import __version__ as YAMLPATH_VERSION
from yamlpath.common import Parsers
from yamlpath.enums import PathSe... |
import numpy as np
import os
import sys
import math
import torch.nn as nn
import fast_functions as ff
####################################################################################################
# returning the binary label map by the organ ID (especially useful under overlapping cases)
# label: the label ma... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 11 18:37:17 2020
@author: yokoyama
"""
from IPython import get_ipython
from copy import deepcopy, copy
get_ipython().magic('reset -sf')
#get_ipython().magic('cls')
import os
current_path = os.path.dirname(__file__)
os.chdir(current_path)
simName = 'suppA'
fig_sav... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#import pdb
import sys
#import operator
import numpy as np
from random import choice
sys.path.append('./')
import re
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import argparse
class PuzzleN():
legalPlays = ['U','D','L','R']
legalPlays... |
'''
Contians convenience funcitons which are
(1) more related to the file name or paths rather than the contents or
(2) related to the non-FITS files.
'''
from pathlib import Path
import numpy as np
from astropy.table import Table
from astropy.nddata import CCDData
from astropy.io import fits
from warnings import war... |
#!/usr/bin/env python
##############################################################################
#
# xpdacq by Billinge Group
# <NAME> <EMAIL>
# (c) 2016 trustees of Columbia University in the City of
# New York.
# All rights re... |
#! python3
"""
File: dbcParser.py
Created: 03/29/2017
This Python script contains classes for describing the contents of a CAN
database file. Given a .dbc file, it will parse it into objects in memory
and generate a C header file for use by the Network Manager embedded
firmware applic... |
#!/usr/bin/env python3
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR CO... |
import numpy as np
import time
from gridlod import interp, lod
import build_coefficient, lod_periodic, indicator
def computeCSI_offline(world, NepsilonElement, k, boundaryConditions, model, correctors=False):
dim = np.size(world.NWorldFine)
if dim == 2:
middle = world.NWorldCoarse[1] // 2 * world.NWo... |
# -*- coding: utf-8 -*-
import librosa
import os
import datetime
import numpy as np
import tempfile
import logging
import pydub
l = logging.getLogger(__name__)
class Transitioner:
"""This is the base Transitioner class.
You should not use this class directly but should inherit from this class
if you wa... |
"""
This script is a simple one purpose script to visualise the segmented
individual eggs compare to user annotation. Generally it can serve as showing
two different eggs segmentation for the same image
Sample usage::
python run_export_user-annot-segm.py \
-imgs "~/Medical-drosophila/ovary_selected_slices... |
import math
import numpy as np
import torch
from project.utils.from_se3cnn.SO3 import torch_default_dtype, irr_repr
from project.utils.from_se3cnn.cache_file import cached_dirpklgz
from project.utils.from_se3cnn.representations import SphericalHarmonics
##############################################################... |
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import json
import os
import os.path as osp
import numpy as np
DIV_LINE_WIDTH = 50
# Global vars for tracking and labeling data at load time.
exp_idx = 0
units = dict()
def plot_data(data, xaxis='Epoch', value="AverageEpRet", condition="Condit... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
#
# Invenio-Cli is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio module to ease the creation and management of applications.""... |
# Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_round
class ReturnPickingLine(models.TransientModel):
_name = "stock.return.picking.line"
_... |
from __future__ import unicode_literals
import os
import re
import subprocess
import time
from .common import FileDownloader
from ..compat import compat_str
from ..utils import (
check_executable,
encodeFilename,
encodeArgument,
get_exe_version,
)
def rtmpdump_version():
return get_exe_version(
... |
# For data loading
from scipy.io import loadmat
# For splitting the data into test, train, validation splits
from sklearn.model_selection import train_test_split
# For manipulation of the arrays
import numpy as np
# For file manipulation and locating
import os
# For plotting
import json
# For showing progress
from tqdm... |
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
from tensorflow.contrib import layers
from fair_hmumu.utils import Saveable
class Model(Saveable):
def __init__(self, name, hps):
super().__init__(name)
self.hps = hps
def __str__(self):
... |
# Copyright 2015 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 applicable law or a... |
# 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... |
#! usr/bin/python3.8
import numpy as np
import os
import re
from PIL import Image
def normalize_rgba(value):
value = int(round(value))
val = 0
if 0 < value < 255:
val = value
if 255 < value:
val = 255
return val
def shaded(c, p):
"""
Returns the rgba value for the color ... |
import abc
import copy
import inspect
import warnings
class AutoSubRegistrationMeta(abc.ABCMeta):
def __new__(cls, clsname, bases, attrs):
new_class = super(AutoSubRegistrationMeta, cls).__new__(
cls, clsname, bases, attrs
)
new_class._register_subclass()
return new_cla... |
from typing import Union, Tuple, List, Optional, Generator, Iterable
from collections import deque
class AlgorithmsAssignment2:
@classmethod
def split(cls, s: str, t: str) -> Union[bool, Tuple[List[str], List[str]]]:
"""
Determines if two strings come from the composition of two root strings.... |
"""This component provides basic support for Dahua IP cameras."""
import logging
import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_platform
from homeassistant.components.camera import SUPPORT_STREAM, Camera
from custom_components.dahua import DahuaDataUpda... |
#!/usr/bin/python
# coding=utf-8
#
# This script takes as input a summary of IP address file produced
# by "cout_ip.py", and produces a summary of the results
# There are several potential criteria outlined by previous research:
# - Is this IP address mentioned or not in the frequently seen list or not.
# - Is this ad... |
#
# Copyright (c) 2021 <NAME>
#
# This file is part of ma2tl.
# Usage or distribution of this code is subject to the terms of the MIT License.
#
import datetime
import logging
import os
import re
from plugins.helpers.basic_info import MacAptDBType
from plugins.helpers.common import get_timedelta
PLUGIN_NAME... |
from datetime import datetime, timedelta
from enum import Enum
from time import sleep
from typing import Dict, List, Optional, Tuple
from github import Github
from github.GithubException import RateLimitExceededException
from github.Issue import Issue
from github.IssueEvent import IssueEvent
from github.Label import L... |
########################
# Create a 4-panel plot of photo-z quality for Paper 2
########################
import numpy as np, pylab, ldac, os
from readtxtfile import readtxtfile
########################
def makeHexbin(specz, photz, xlabel = 'Reference Redshift', ylabel = 'Photo-$z$', gridsize = 100, bins = None):
... |
import time
import os.path
import hashlib
import logging
import urllib.parse
from werkzeug.utils import cached_property
from piecrust import (
RESOURCES_DIR,
CACHE_DIR, TEMPLATES_DIR, ASSETS_DIR,
THEME_DIR,
CONFIG_PATH, THEME_CONFIG_PATH)
from piecrust.appconfig import PieCrustConfigurat... |
# engine/__init__.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""SQL connections, SQL execution and high-level DB-API interface.
The engine pack... |
from __future__ import division
__copyright__ = "Copyright (C) 2009 <NAME>"
__license__ = """
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.