text stringlengths 3.07k 12.6k |
|---|
#! /usr/bin/env python
"""Playing with hachoir to parse SQLite files
"""
import os
import sqlite3
from hachoir.field import Parser, CString, UInt8, UInt16, UInt32, String, Bytes,RawBytes,FieldSet
from hachoir.stream import StringInputStream, BIG_ENDIAN
class SQLite_page(Parser):
"""
Offset Size Descriptio... |
import math
from enum import Enum, auto
from diofant import *
from mora.core import Program, get_solution as get_expected
from mora.input import LOOP_GUARD_VAR
LOG_NOTHING = 0
LOG_ESSENTIAL = 10
LOG_VERBOSE = 20
LOG_LEVEL = LOG_ESSENTIAL
class Answer(Enum):
FALSE = auto()
TRUE = auto()
UNKNOWN = auto()
... |
import os
import sys
import re
import subprocess
from subprocess import *
import traceback
from Utils.DiskUtil import DiskUtil
STORAGE_DEVICE_PATH = '/sys/bus/vmbus/devices/'
GEN2_DEVICE_ID = 'f8b3781a-1e82-4818-a1c3-63d806ec15bb'
def read_file(filepath):
"""
Read and return contents of 'filepath'.
"""
mode = 'r... |
"""Functions for prompting the user for project info."""
import json
from collections import OrderedDict
import click
from cookiecutter.operator import parse_operator
from jinja2.exceptions import UndefinedError
from typing import Dict
from cookiecutter.render.environment import StrictEnvironment
from cookiecutter.e... |
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
def running_max_stats(scores):
maxscores = np.maximum.accumulate(scores, axis=1)
mean = np.mean(maxscores, axis=0)
std = np.std(maxscores, axis=0)
return (maxscores, mean, std)
def plot_searcher_comparison():
folder_path... |
import sys
import os
from shutil import copyfile
cwd = os.getcwd()
def write_init(skill_name, skill_path, level_name):
# If skills/<new_skill>/__init__.py doesn't exist, create a basic version
if not os.path.exists(os.path.join(skill_path, "__init__.py")):
copyfile("level_file_templates/__init__.py",... |
import responses
import requests
from django.core.cache import cache
from django.test import TestCase
from django.utils import timezone
from . import mocks as mk
from .. import api_rest as api
from ..api_rest import AutotaskAPIError, AutotaskAPIClientError, \
ApiConditionList
from ..api_rest import ApiCondition ... |
from pynq import DefaultIP
from pynq import DefaultHierarchy
from pynq import allocate
import numpy as np
class QPSKTx(DefaultHierarchy):
def __init__(self, description, pkt_sym=16, pkt_time=128, pkt_fft=1024):
"""Driver for our QPSK TX IP hierarchy
This encompasses the qpsk tx logic and the DMAs... |
import os
import numpy as np
import pandas as pd
import torch
from skimage import io
from torch.utils.data import Dataset
from torchvision import transforms
class TripletFaceDataset(Dataset):
def __init__(self, root_dir, csv_name, num_triplets, transform=None):
self.root_dir = root_dir
... |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from typing import List, Type
from pyVmomi import vim
from six import iteritems
from datadog_checks.base import to_string
from datadog_checks.vsphere.config import VSphereConfig
from datadog_checks.vsphere.con... |
import functools
import typing as t
import hikari
import tanjun
import yuyo
from ottbot.core.bot import OttBot
from ottbot.core.utils.funcs import build_loaders
component, load_component, unload_component = build_loaders()
@component.with_slash_command
@tanjun.as_slash_command("yuyo", "An example yuyo component pa... |
import warnings
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.cm import register_cmap
from ._colormap import _CMAP_QUAL
__all__ = [
"set_context",
"set_save_context",
"reset_defaults",
"set_image",
"set_scalebar",
]
# TODO implement a set() fuction for all underlying s... |
import flask
import flask_sqlalchemy as fsql
import enum
import re
import secrets
import sqlalchemy.dialects.mysql as sqldlc_mysql
import sqlalchemy.dialects.postgresql as sqldlc_psql
import sqlalchemy.dialects.sqlite as sqldlc_sqlite
import app.common.utils as utils
# We'll manage redis here too.
import redis
# ---... |
# Analitical (and also normal) geometry library for python
# (c) <NAME>, 2020
# Released under the MIT license.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ... |
#
# Copyright (c) 2019-2020, NVIDIA 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 ag... |
import sys
import pickle
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from model.hero2vec import *
from utils.evaluation import *
from utils.dataset import DataFrameIterator
from acc import *
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.optim as optim
fro... |
""" Test ext lvm """
import logging
import unittest
from tempfile import mkdtemp
from holland.lib.lvm.base import VolumeGroup, PhysicalVolume, LogicalVolume, Volume
from holland.lib.lvm.errors import LVMCommandError
from holland.lib.lvm.util import getdevice
from tests.constants import TEST_VG, TEST_LV
from . import ... |
# -*- coding: utf-8 -*-
''' Laplace Noise Component
This module contains the class for Laplace noise, or a noise term modeled
as a random variable drawn from a Laplace distribution. The Laplace distribution
has a tighter peak and fatter tails than a Gaussian distribution, and so is a
good model for a signal that is of... |
import os
import sys
from itertools import chain
WALL = '#'
SPACE = ' '
PASSED = '.'
PLAYER = '@'
VALID_ACTIONS = ['W', 'S', 'A', 'D', 'Q']
def new_game(level):
file_list = os.listdir("levels")
levels = sorted(file_list, key=name_without_extension)
# get the levels from the starting level onwards (not i... |
import csv
import sox
import os
marvdir = "/home/stuart/simple_audio_tensorflow/data/speech_commands_v0.02/marvin/"
heydir = "/home/stuart/Downloads/cv-corpus-6.1-singleword/en/Hey/"
heymarvindir ="/home/stuart/Downloads/heymarvin/"
def marvtrim(marvline, start, end):
# create transformer
tfm = sox.Transformer()... |
'''
yappi.py
Yet Another Python Profiler
<NAME> 2012
'''
import sys
import threading
import _yappi
__all__ = ['start', 'stop', 'enum_stats', 'enum_thread_stats', 'print_stats', 'clear_stats',
'is_running', 'get_stats', 'clock_type']
CRLF = '\n'
SORTTYPE_NAME = 0
SORTTYPE_NCALL = 1
SORTTY... |
import requests
import w3lib.url
import hashlib
from readability import Document
import html2text
import textacy
import textacy.lexicon_methods
import re
import logging
import time
import qreader.summarizer as summarizer
import qreader.cleantxt as textcleaner
import qreader.categorizer as categorizer
from qreader.mode... |
import board
import graphics
import pygame
import pygame.gfxdraw
import pyoneer.animation
import pyoneer.interpolation
import random
def render():
screen.fill((255, 255, 255))
draw_pieces()
draw_board()
draw_select_box()
draw_game_state()
draw_fps()
pygame.display.f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : Dec-03-21 23:49
# @Author : <NAME> (<EMAIL>)
import argparse
import os
import numpy as np
import torch
import torch.autograd as autograd
from torch.autograd import Variable
from torchvision import datasets
from torchvision.utils import save_image
from gan.w... |
#
# Wiki module - modeldb
#
"""
MIT License
Copyright (c) 2017-2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, c... |
from bonobo.errors import AbstractError
from bonobo.util import isoption, iscontextprocessor, sortedlist, get_name
__all__ = [
'Configurable',
]
get_creation_counter = lambda v: v._creation_counter
class ConfigurableMeta(type):
"""
Metaclass for Configurables that will add options to a special __options... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
from django.views.generic import TemplateView, FormView
from django.contrib.auth.mixins import PermissionRequiredMixin
from djan... |
#!usr/bin/env python3
"""
openlinter.py
Console entry point for the openlinter package.
Functions
---------
main
Main function of the linter--set up state and call checks.
get_current_script_dir
Inspect the stack to find the directory the current module is in.
parse_linter_args
Parse command-line argume... |
# provides API to run plugins
import abc
import argparse
import logging
import os
import yaml
from infrared.core import execute
from infrared.core.inspector.inspector import SpecParser
from infrared.core.services import CoreServices
from infrared.core.settings import VarsDictManager
from infrared.core.utils import lo... |
"""
The Everything SDK provides a DLL and Lib interface to Everything over IPC.
Everything is required to run in the background.
documentation : https://www.voidtools.com/support/everything/sdk/
dependency (SDK): https://www.voidtools.com/Everything-SDK.zip
"""
import os, ctypes
import datetime as dt
from typing imp... |
"""
Group Friends
Design a solution which can preform the following operations
Given two IDs, associate those IDs as friends, and any existing friends of those IDs also become friends (if 1 and 2 are friends, and 2 and 3 are friends, then 1 and 3 are also friends).
Given two IDs, return true if they are friends.
Ret... |
from django.db import models
from django.conf import settings
from django_countries.fields import CountryField
import time
import uuid
# for image manipulations
from django.core.files.base import ContentFile
from PIL import Image
from io import BytesIO
import os.path
from imgapiv1.settings import COVER_THUMBNAIL_SIZE
... |
from __future__ import print_function
import os
import cv2
import h5py
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--dataset_type", type=str, help="extra/train/val/test")
args = parser.parse_args()
#----------------------------Arguments------------------------------------... |
#!/usr/bin/env python3
import functools
import os
import string
import urllib
from blog import Blog
from bottle import route, run, template, jinja2_view, url, Jinja2Template, response
from utilities import Log
# ----- INITIALIZE THE BLOG ----- #
# I'm not sure I'm happy with this; but making it all static doesn'... |
import logging
import os
import re
from typing import Dict, Union
from urllib.parse import parse_qs, parse_qsl, urlencode, urlparse, urlunparse
import requests
from requests.models import CaseInsensitiveDict, Response
from localstack import config
from .strings import to_str
# chunk size for file downloads
DOWNLOAD... |
from __future__ import print_function, division
from math import radians, sin
import WalabotAPI
import paramiko
try:
input = raw_input
except NameError:
pass
class Walabot:
""" Designed to control the Walabot device.
"""
def __init__(self):
""" Set useful arena constants an... |
import os
import cv2
import torch
import numpy as np
import argparse
import torch.nn as nn
import torch.nn.functional as F
from DRL.actor import *
from Renderer.stroke_gen import *
from Renderer.model import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
width = 128
parser = argparse.Argumen... |
import json
from qds_sdk.qubole import Qubole
from qds_sdk.resource import Resource
from argparse import ArgumentParser
class RoleCmdLine:
"""
qds_sdk.RoleCmdLine is the interface used by qds.py.
"""
@staticmethod
def parsers():
argparser = ArgumentParser(prog="qds.py role",
... |
# 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... |
import io
import operator as op
import os
import re
from collections import deque
from fractions import Fraction
from typing import List, Optional
import lark
from PyQt5 import QtCore
from attr import Factory, attrib, attrs
from definitions import capture_exceptions
from simfile_parsing.basic_types import NoteObjects... |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
# The Colorlight i5 PCB and IOs have been documented by @wuxx
# https://github.com/wuxx/Colorlight-FPGA-Projects
from litex.build.generic_platform import *
from litex.build.lattice import LatticePlat... |
# Copyright (c) 2017, <NAME> [coldfusion]
#
# 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... |
"""Script to convert an old-format home-assistant.db to a new format one."""
import argparse
import os.path
import sqlite3
import sys
from datetime import datetime
from typing import Optional, List
import homeassistant.config as config_util
import homeassistant.util.dt as dt_util
# pylint: disable=unused-import
from... |
import os
import numpy as np
import re
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from math import radians, cos, sin, asin, sqrt
def cal_distance_meter(lat1, lng1, lat2, lng2):
lng1, lat1, lng2, lat2 = map(radians, [lng1, lat1, lng2, lat2])
d_lon = lng2-lng1
... |
#!/usr/bin/env python
import csv, time
import simplejson as json
from dateutil import parser
import numpy as np
import EventSender
from DataProcessingException import DataProcessingException
class DataProcessor:
"""Class for setting up the event sending client, for reading in data to send
to the sound en... |
from __future__ import print_function
from __future__ import division
from . import _C
import cProfile
import numpy as np
from fuzzytools.progress_bars import ProgressBar
from fuzzytools.files import filedir_exists, PFile
from fuzzytools.matplotlib.utils import IFile
from .plots.lc import plot_synthetic_samples
from .... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import traceback
from stack import Stack
class Label:
""" ラベルオブジェクト """
def __init__(self, name, location, filename, lineno):
self.name = name
self.location = location
self.filename = filename
self.lineno = lineno
def getLocation(self):
retur... |
from __future__ import annotations
from typing import Optional, Dict, List, Any
from types import ModuleType
import loguru
from importlib.machinery import ModuleSpec
from importlib.util import find_spec, module_from_spec
from shablbot.components.chat import Chat
from shablbot.settings.settings_model import Setting... |
from __future__ import print_function
import boto3
import botocore
from botocore.client import Config
from botocore.exceptions import ClientError
import json
import datetime
import traceback
import sys
import os
import logging
# ENV VARIABLES
TARGET_POLICY_NAME_PREFIX = os.environ["TARGET_POLICY_NAME_PREFIX"]
LOG_LE... |
"""
This file implements the solar_z built-in dataframe
"""
from __future__ import absolute_import
from ...._globals import _RECOGNIZED_ELEMENTS_
from ...._globals import _VERSION_ERROR_
from ...._globals import _DIRECTORY_
from .._elemental_settings import elemental_settings
import numbers
class solar_z(elemental_se... |
from collections import abc, defaultdict
import re
import typing as t
from unittest.mock import patch
import pytest
from uzi._common import ReadonlyDict
from uzi.containers import _ContainerRegistry, Container, Group
xfail = pytest.mark.xfail
parametrize = pytest.mark.parametrize
_T_FnNew = type[_ContainerRegist... |
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import h5py
from skimage.util import crop
import copy
import os
import numpy as np
seed_value = 42
os.environ['PYTHONHASHSEED'] = str(seed_value)
import random
random.seed(seed_value)
np.random.seed(seed_value)
torch.manual_seed(seed_va... |
from dataclasses import dataclass, field
from typing import Union, Dict, Iterator, List
import warnings
warning_message = """
▓█████▄ ▄▄▄ ███▄ █ ▄████ ▓█████ ██▀███
▒██▀ ██▌▒████▄ ██ ▀█ █ ██▒ ▀█▒▓█ ▀ ▓██ ▒ ██▒
░██ █▌▒██ ▀█▄ ▓██ ▀█ ██▒▒██░▄▄▄░▒███ ▓██ ░▄█ ▒
░▓█▄ ▌░██▄▄▄▄██ ▓██▒ ▐▌██▒░▓█... |
"""
========================
Cycle finding algorithms
========================
"""
# Copyright (C) 2010 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
from collections import defaultdict
__all__ = ['cycle_basis','simple_cycle... |
import re
from yt_dlp.postprocessor import FFmpegPostProcessor
from yt_dlp.utils import HEADRequest, determine_ext, int_or_none, traverse_obj
# pylint: disable=too-few-public-methods
class GLOBALS:
FFMPEG = FFmpegPostProcessor()
LAST_METADATA = {}
def codec_name(info):
formats = {"h264": "avc1", "aac":... |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Dense, BatchNormalization, Dropout, Multiply, Softmax, concatenate, LeakyReLU
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer
class LR(keras.Model):
def __init__(self, categories):
... |
# Very trivial, lightweight access handling. This isn't designed for use on a
# public server, only to have basic guest access and logins for local use.
# It stores login data in a text file to avoid the extra complexity of a database
# (this isn't multithreaded), and it doesn't use bcrypt since the extra dependancy
#... |
import torch
import torch.nn as nn
from torch.autograd import Variable
class ConvLSTMCell(nn.Module):
def __init__(self, input_channels, hidden_channels, kernel_size, cuda=False):
super(ConvLSTMCell, self).__init__()
assert hidden_channels % 2 == 0
self.input_channels = input_channels
self.hidden_channels... |
import argparse
import numpy as np
from link_prediction import *
from node_classification import *
data_folder, model_folder = '../Data', '../Model'
emb_file, record_file = 'emb.dat', 'record.dat'
link_test_file, label_test_file, label_file = 'link.dat.test', 'label.dat.test', 'label.dat'
def parse_args():
pars... |
from time import time
import os
import sys
import shutil
import click
from pathlib import Path
import config
from openslide import OpenSlide
import pandas as pd
from tqdm import tqdm
from skimage.morphology import remove_small_objects
from skimage.io import imread
from skimage.transform import rescale
import random
imp... |
#!/usr/bin/env python
from __future__ import print_function
"""
test_builtin.py
"""
import sys
from core import expr_eval
from core import util
from osh import bool_parse
from osh.meta import ast, Id, runtime
from osh import meta
log = util.log
_UNARY_LOOKUP = meta.TEST_UNARY_LOOKUP
_BINARY_LOOKUP = meta.TEST_BIN... |
import unittest
from wopsego import WhatsOpt, Optimization, ValidOptimumNotFoundError
import numpy as np
# Unconstrained Problem
# Objective
def f_obj(x):
"""
Function Six-Hump Camel Back
2 global optimum y_opt =-1.0316 located at x_opt = (0.089842, -0.712656) or (-0.089842, 0.712656)
https://www.sfu.... |
from jug import Task, TaskGenerator, CachedFunction
from jug.utils import jug_execute
from itertools import groupby
from safeout import safeout
from glob import glob
PSORT = '/g/bork3/home/coelho/work/MOCAT/public/bin/psort'
TEMPDIR = '/alpha/local/coelho/tmp/'
NCPUS = 24
REL_FILES = CachedFunction(glob, '../cluster-g... |
#!/usr/bin/python3
from music21 import *
from helpers.part_corrector import part_corrector
from helpers.chord_sheet import *
from helpers.melody_sheet import *
from helpers.MelodyAdjustor import *
class Harmony:
def __init__(self, start, steps):
self.one_chord = chord.Chord(chord_sheet['one'], quarterLe... |
import logging
from os import path
from pandas import read_excel
from sklearn.metrics import accuracy_score
from dashboard.logic.features_extraction.data_entry import DataEntry
from mysite.settings import HYPER_PARAMS_PATH, MODEL_PATH, TRAINED_MODEL_PATH, DATASET_PATH
from .cache import load_obj
from .machine_learnin... |
"""Test cases for the free energy contributions."""
import numpy as np
from jazzy.core import any_hydrogen_neighbors
from jazzy.core import calculate_delta_apolar
from jazzy.core import calculate_delta_interaction
from jazzy.core import calculate_delta_polar
from jazzy.core import calculate_polar_strength_map
from jaz... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
from io import BytesIO
import struct
import sys
import pytest
from pytest import raises, xfail
from msgpack import packb, unpackb, Unpacker, Packer, pack
def ... |
import pandas as pd
import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import sklearn.feature_selection as fs
from sklearn.model_selection import RepeatedStratifiedKFold
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score
from sklearn... |
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.linear_model import LogisticRegression
import os
from .user import make_features as _make_features
from time import clock
from random import random
_HERE = os.path.dirname(os.path.abspath(__file__))
_POSITIVE = os.path.join(_HERE, "positive.txt")
_NEGATIVE = os.p... |
#
# Modulo: cidades
#
# Implementacao de um dominio para planeamento de caminhos
# entre cidades usando para esse efeito o modulo tree_search
#
# (c) <NAME>, Introducao a Inteligencia Artificial, 2012/2013
#
from tree_search import *
import math
class Cidades(SearchDomain):
def __init__(self, con... |
# -*- coding: utf-8 -*-
"""
@inproceedings{DBLP:conf/iclr/BertinettoHTV19,
author = {<NAME> and
Jo{\\~{a}}<NAME> and
<NAME> and
<NAME>},
title = {Meta-learning with differentiable closed-form solvers},
booktitle = {7th International Conference on Learning Repres... |
'''
Created on Jul 10, 2016
@author: ssudholt
'''
import numpy as np
from scipy.spatial.distance import pdist, squareform, cdist
def map_from_feature_matrix(features, labels, metric, drop_first):
'''
Computes mAP and APs from a given matrix of feature vectors
Each sample is used as a query once and all th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# <NAME> (<EMAIL>)
# April 2017
import os, sys
BASE_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__))))
from global_variables import *
from dataset import Dataset
from mixture_density_network import MixtureDensityNetwork
from mixture_... |
import torch
from torch._C import INSERT_FOLD_PREPACK_OPS, Node
import torch.nn as nn
import torch.nn.functional as F
import random
import numpy as np
class HGCN(nn.Module):
def __init__(self, n_edges, in_feature, out_feature, n_agents):
super(HGCN, self).__init__()
print(n_edges)
self.W_li... |
import os
import copy
import datetime
import traceback
from bsm.env import Env
from bsm.handler import Handler
from bsm.handler import HandlerNotFoundError
from bsm.util import safe_mkdir
from bsm.logger import get_logger
_logger = get_logger()
class InstallExecutorError(Exception):
pass
class Executor(obje... |
import html
from urllib import parse
from django import template
from django.db.models import Count
from django.shortcuts import resolve_url
from django.template.defaultfilters import stringfilter
from django.utils.html import *
from django.utils.safestring import mark_safe
from ndiary1.models import Diary, Category
fr... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import warnings
import os
import tensorflow as tf
import cv2
from deepface import DeepFace
print("-----------------------------------------")
warnings.filterwarnings("ignore")
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
tf_major_version = int(tf.__version__.split(".")[0])
if tf_major_version == 2:
import logging
tf.... |
import os, sys, time
#Define path to Openeye and OE_LICENSE
from openeye import oechem, oeomega, oequacpac
def configure_omega():
""" Configure the OpenEye Omega conformer generator """
omega = oeomega.OEOmega()
#omega.SetIncludeInput(True)
#include geometry in input and output
omega.SetIncludeIn... |
"""This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: ... |
#!/usr/bin/env python3
import datetime
import os
from datetime import timedelta
from pathlib import Path
import progressbar
from gopro_overlay import timeseries_process
from gopro_overlay.arguments import gopro_dashboard_arguments
from gopro_overlay.common import temp_file_name
from gopro_overlay.dimensions import d... |
import csv
from DateTime.DateTime import DateTime
from bika.lims import bikaMessageFactory as _
from bika.lims.browser import BrowserView, ulocalized_time
from bika.lims.browser.bika_listing import BikaListingView
from bika.lims.content.analysisrequest import schema as ar_schema
from bika.lims.content.sample import sch... |
# -*- coding: utf-8 -*-
"""Insert Data component.
This module gets lists of Course and Department objects from ReadCourseData.py
and inserts those data into the desired database
"""
import json, os, sys, letslog
sys.path.append(os.path.dirname(os.path.abspath(__file__))+'\\pb2')
from google.protobuf.json_format impor... |
"""
Visualises weighted list of words wherein size of each word indicates frequency and implied importance
"""
#-------------------------------------------#
# Import dependencies #
#-------------------------------------------#
import time
import numpy as np
import pandas as pd
import matplotli... |
#!/usr/bin/python3
"""
creates an OVA from an ISO with Packer
"""
import json
import getopt
import sys
import os
import subprocess
def usage():
"""
prints module help
"""
print("""
KICKSTARTVM() KICKSTARTVM()
NAME
kickstartvm.py - build a Virtu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functions for downloading from ONDA Dias mirror.
"""
import getpass
import multiprocessing
import urllib.request
import requests
import tqdm
import logging
from pathlib import Path
from ost.helpers import helpers as h
logger = logging.getLogger(__name__)
def ask_cr... |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABC, abstractmethod
from textwrap import dedent
from typing import Any, Iterable, Optional, Type, Union
def get_docstring_summary(
cls: Type, *, fallback_to_ancestors... |
import os
import subprocess
import sys
import pandas as pd
# Load the summary:
def load_summary():
return pd.read_csv('./support_files/bins_available.csv')
def bin_names_to_coords_filepath(query_bin, ref_bin, results_dir):
"""
prepare a file path for results
:param query_bin: bin number 1 name/file... |
import usocket
MAX_READ_SIZE = 4*1024
def encode_basic_auth(user, password):
from ubinascii import b2a_base64
auth_encoded = b2a_base64(b"%s:%s" % (user, password)).rstrip(b'\n')
return {b'Authorization': b'Basic %s' % auth_encoded}
def head(url, **kw):
return request("HEAD", url, **kw)
def get(... |
import sys
class Seq:
def __init__(self, name, seq, no):
self.name = name
self.seq = seq.upper()
self.no = no
self.length = len(seq)
def __str__(self):
"""Output seq when 'print' method is called."""
return "%s\tNo:%s\tlength:%s\n%s" % (self.name, str(self.no),... |
#!/usr/bin/python
'''Plots graphs of the labeling results.'''
usage='PlotLabelingResults.py [options]'
from pylab import *
import numpy as np
from optparse import OptionParser
import re
import os.path
import os
import ImageSearchResults
def CalculateStraightAccuracy(correctLabels, humanLabels):
return np.sum(correc... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 <NAME> <<EMAIL>>
# Copyright (C) 2012-2013 <NAME> <<EMAIL>>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import shutil
import tempfile
import unittest
from String... |
# -*- coding: utf-8 -*-
# Copyright 2018 <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 agre... |
import os
import cv2
import torch
import time
import argparse
import numpy as np
from PIL import Image
from recognition.face.mtcnn.mtcnn import MTCNN
from recognition.face.faceModule import face_infer
# from recognition.face.model import *
import traceback
# from model import MobileFaceNet
from torchvision import t... |
"""
Entry point. CLI to run training and testing scripts
"""
import argparse
from hasu.train import main as training_routine
from hasu.run import main as testing_routine
from hasu.networks.AtariNet import AtariNet
class network_class_parser(argparse.Action):
def __call__(self, parser, args, network_name, option... |
import numpy as np
from ._skimage import *
from ._linalg import hessian_eigval
__all__ = ["binary_erosion",
"erosion"
"binary_dilation",
"dilation",
"binary_opening",
"opening",
"binary_closing",
"closing",
"gaussian... |
from mycroft import MycroftSkill, intent_file_handler
from mycroft.util.parse import extract_number
from collections import OrderedDict
class InitiativeTracker(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self, None, None, True)
self.reset()
def reset(self):
self.clear_ini... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
import os
import re
import chainer
import chainer.functions as F
import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
from chainer import backends
from chainer import dataset
from chainer import iterators
... |
# #!/usr/bin/env python3
# coding: utf-8
import argparse
import logging
import sys
class MultiLineFormatter(logging.Formatter):
def format(self, record):
str = logging.Formatter.format(self, record)
header, footer = str.split(record.message)
str = str.replace('\n', '\n' + ' '*len(header))
... |
import cv2
from cvzone.HandTrackingModule import HandDetector
from time import sleep
import numpy as np
import cvzone
from pynput.keyboard import Key,Controller
cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
detector = HandDetector(detectionCon=0.8)
keys = [["Q", "W", "E", "R", "T", "Y", "U", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.