text stringlengths 3.07k 22.1k |
|---|
# Copyright Contributors to the Pyro-Cov project.
# SPDX-License-Identifier: Apache-2.0
import base64
import filecmp
import hashlib
import logging
import math
import os
import pickle
import shutil
import subprocess
import warnings
from collections import Counter, defaultdict
from .usher import load_usher_clades, refi... |
import abc
import json
import re
import typing as t
from . import nodes
from .abc import Node
from .exceptions import ParserException
from .util import get, tokenize
class ParserType(metaclass=abc.ABCMeta):
@abc.abstractmethod
def parse(self, parts: t.Iterator[str]) -> Node:
raise NotImplementedErro... |
import os
import collections
import json
import types
import torch
import numpy as np
from tqdm import tqdm
from train import argument_parser, parse_args, configure
from train import get_validation_dataset, get_validation_iterator
from train import build_net
from diora.logging.configuration import get_logger
from d... |
from nose.tools import *
from parse_vcf import *
import subprocess
def test_exception_on_no_file():
assert_raises(TypeError, VcfReader)
def test_header_error():
assert_raises(HeaderError, VcfReader, 'test_data/invalid_header.vcf')
def test_column_error():
assert_raises(HeaderError, VcfReader, 'test_data/... |
from __future__ import print_function
import os
import numpy as np
import math
import tensorflow as tf
import random
from collections import deque
import sys, os
from tensorflow.contrib.layers import fully_connected,batch_norm
# from train.actor import Actor
# from train.critic import Critic
try:
import hfo
exce... |
import math
import random
import string
import copy
from datetime import datetime, timedelta
from anubis.models import (
db,
THEIA_DEFAULT_OPTIONS,
Assignment,
AssignmentQuestion,
AssignmentTest,
AssignmentRepo,
Submission,
User,
Course,
InCourse,
TheiaSession,
)
from anubis... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class DilateConv(nn.Module):
"""
d_rate: dilation rate
H_{out} = floor((H_{in} + 2 * padding[0] - dilation[0] * (kernel\_size[0] - 1) - 1) / stride[0] + 1)
set kernel size to 3, stride to 1, padding==d_rate ==> spat... |
# https://colab.research.google.com/github/pytorch/vision/blob/temp-tutorial/tutorials/torchvision_finetuning_instance_segmentation.ipynb
import os
import numpy as np
import torch
import torch.utils.data
import json
from PIL import Image, ImageDraw
import torchvision
from torchvision.models.detection.faster_rcnn import... |
"""
MIT License
Copyright (c) 2019 KGausel
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, distr... |
# coding: utf-8
# In[36]:
import numpy as np
import pandas as pd
import sys
import os
import pickle
from sklearn.metrics import mean_squared_error
# In[15]:
np.random.seed(1234)
train_epochs = 1
k = 1
num_hidden = 123
num_visible = 784
lr = 0.001
#num_hidden_setter = [400]
location_log_file = ""
training =... |
"""PhysicsCollide SpecialLumpClasses"""
# SourceIO/library/source1/phy/phy.py
from __future__ import annotations
import collections
import io
import struct
from typing import List
from . import base
# PhysicsCollide headers
ModelHeader = collections.namedtuple("dphysmodel_t", ["model", "data_size", "script_size", "s... |
# Python implementation of the MySQL client-server protocol
# https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_PROTOCOL.html
import sys
import struct
from cymysql.err import raise_mysql_exception, OperationalError
from cymysql.constants import SERVER_STATUS, FLAG
from cymysql.converters import convert_characte... |
from flask import abort, flash, redirect, render_template, url_for
from flask_login import current_user, login_required
from . import admin
from .forms import SubjectForm, ClassForm, RoomForm, SubjectAssignForm, RoomAssignForm, EmployeeAssignForm, InchargeAssignForm
from ..user.forms import EditProfileForm
from .. im... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import os
import six
import yaml
import tensorflow as tf
from tensorflow.python.training.basic_session_run_hooks import SecondOrStepTi... |
# pytru: a tru virtual machine implemented in python
# USAGE: python3 ./tru.py input_file_path
import sys
import os
TOK_PUSH_START = '('
TOK_PUSH_END = ')'
TOK_PRINT_UTF8 = '<><>><<'
TOK_PRINT_INT = '<><>><>'
TOK_INPUT_UTF8 = '<><>>>'
TOK_INPUT_INT = '<><><'
TOK_END = '>>><<'
TOK_POP_MOVE = '>>><>'
TOK_POP_DISCARD = ... |
from __future__ import absolute_import
from .primitives import PrimJSONEncoder
from .utils import deref
from pyswagger import errs
from uuid import uuid4
import six
import json
import io, codecs
import collections
import logging
logger = logging.getLogger(__name__)
class SwaggerRequest(object):
""" Request laye... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
#!/usr/bin/env python3
# Familyline terrain creator
#
# From an image, create a terrain, with appropriate terrain height and type, depending on the
# pixel color.
# Each pixel will be a point in the map, with the R and G channels being the height and B and A channels
# being the type. Since both channel and types are ... |
from typing import Optional
import discord
from discord.ext import commands
from discord.ext.commands import Context
import re
import os
import chess
from chess import svg
from cairosvg import svg2png
from LichessBot import LichessBot
class Puzzles(commands.Cog):
def __init__(self, client: LichessBot):
s... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 17 11:10:54 2017
@author: pickus
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
class LogisticRegression(object):
"""LogisticRegression
Parameters
------------
learningRate : float, option... |
# MIT License
#
# Copyright (c) 2020-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 30 11:08:57 2016
@author: raon
"""
import scipy.sparse as ss
import numpy as np
from sklearn.preprocessing import normalize
from sklearn.linear_model import Ridge
import numpy.random as nr
# THE FUNCTIONS BELOW RETURN VECTOR OF THE FORM
# a + A*a... |
#!/usr/bin/env python2.7
from __future__ import division
import json, os, glob, time, requests
from datetime import datetime
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import numpy as np
from numpy.polynomial import Polynomial as P
from numpy import matrix
credentials_in=open(os.getcwd() +'/Rpi4Fish/maste... |
#! /usr/bin/env python3
"""
Loads and preprocesses Wikipedia data.
This script is meant to be run as a module. However, it contains a main function that is created
to test the logic of processing textual data. This script designed to work with Wikipedia data.
In case the text comes from a different source, "get_gener... |
#!/usr/bin/env python3
import boto3
import base64
import os
from botocore.exceptions import ClientError
from jinja2 import Environment, FileSystemLoader
setupReplication = (os.getenv('SETUP_REPLICATION') == 'true')
setupHA = (os.getenv('SETUP_HA') == 'true')
setupMultiSite = (os.getenv('MULTISITE_ENABLED') == 'true')... |
import datetime
import json
import re
import pytz
import requests
from utils import config, error_code
from crawler import bus_encypt
# Bus url setting
BUS_URL = "http://bus.kuas.edu.tw"
BUS_SCRIPT_URL = "http://bus.kuas.edu.tw/API/Scripts/a1"
BUS_API_URL = "http://bus.kuas.edu.tw/API/"
BUS_LOGIN_URL = BUS_API_URL +... |
import os
import abc
import sys
from copy import deepcopy
from functools import reduce
import numpy as np
import torch
from torchvision import utils as vutils
from tqdm import tqdm
from autokeras.constant import Constant
from autokeras.utils import get_device
class ModelTrainerBase(abc.ABC):
""" A base class all ... |
import logging
import random
from django.db import transaction, IntegrityError
from django.views.generic import ListView
from django.shortcuts import render, redirect
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.contrib im... |
# coding=utf-8
#In[]
import cv2
import os
import numpy as np
code_patch_dir = '/data2/process_data/caojihua/data/code_patches/'
background_dir = '/data2/Public_Data/COCO/unzip_data/2017/train2017'
codes = os.listdir(code_patch_dir)
bgs = os.listdir(background_dir)
#In[]
def read_img(code_patch_dir, background_dir, ... |
"""
Functions for inspecting and interpreting the structure of an Xmrs.
"""
import warnings
from itertools import product
from delphin.mrs.components import nodes, links, var_id
from delphin.mrs.util import rargname_sortkey
from delphin.mrs.config import IVARG_ROLE
# query methods
def select_nodeids(xmrs, iv=None, l... |
import ctypes as ct
import resource
from typing import Any, Callable, Dict, List, Tuple, Type
class Libc:
libc = ct.CDLL("libc.so.6", use_errno=True)
MAP_FAILED = ct.c_void_p(-1)
PAGESIZE = resource.getpagesize()
syscall = libc.syscall
ioctl = libc.ioctl
class perf_event_header(ct.Structure):
... |
#!/usr/bin/env python3
"""
Tool for interacting with the Enphase Enlighten Systems API
This needs three values to access the Enphase API -- an API key, a user ID,
and (for some, but not all commands) a system ID.
These values can be obtained from a configuration (YAML) file, and the values
contained within this file... |
from random import choice, randint
from dataclasses import dataclass
@dataclass
class TemplateInfo:
template: str = "нет шаблона."
chars: str = "нет строки."
count: int = 0
class Study:
"""Организация записи ходов и анализа текущего хода."""
def __init__(self, field, setup):
self.field = ... |
# Imports here
import argparse
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
import os
import json
from torchvision import datasets, transforms, models
from PIL import Image
from torch.autograd import Variable
# Imports here
means = [0.485, 0.456, 0.406]
deviations = ... |
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pf
import scipy.signal as scs
import scipy.ndimage.filters as scf
from SLIT import transform as tr
# try:
# import pysap
# except ImportError:
# pysap_installed = False
# else:
# pysap_installed = True
pysap_installed = False
# ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Unbabel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# Analyze use of soft and in simplifying terms for conjunction
# Sample Lines:
# run-smirnov-m23+14-mode2-lim3500-file-v4.log:Elapsed time 1973.1. Delta 0.0. Soft_And. conj_new2old. cov = 0.952. size = 16308. Other size = 90533. Skipping
# run-smirnov-m23+14-mode2-lim3500-file-v4.log:Elapsed time 3418.0. Delt... |
from modular_rl import *
# ================================================================
# Trust Region Policy Optimization
# ================================================================
#from . import Agent, flatten, reshape, cg_via_np as CG, bls
from .new import TRPO, flatten, reshape, cg, bls, build_π_mode... |
"""
modreadergui.py - not actively maintained
reads a given module
shows the samples
offers a screen where you can associate letters with drum samples
creates a collection of files containing:
- the module name, samples list and patterns sequence
- the drumsamples together
- the other samples one-by-one
"""
import ... |
# Copyright (c) 2015 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... |
# coding=utf-8
import json
import logging
import os
from typing import List, Tuple
import torch
import transformers
from torch.utils.data import DataLoader, Dataset, TensorDataset
from utils import InputExample, InputFeatures
logger = logging.getLogger(__name__)
class KlueReProcessor:
def __init__(self, args, ... |
#!/opt/splunk/bin/python
'''
IBM Websphere MQ Modular Input for Splunk
<NAME> - 2015
This is a custom search command to fetch a payload
previously written to disk by a response handler.
DISCLAIMER
You are free to use this code in any way you like, subject to the
Python & IBM disclaimers & copyrights. I make no repre... |
import io
from os.path import join
from pathlib import Path
import dask.array as da
import dill
import imageio
import numpy as np
import pandas as pd
from cartopy import crs as ccrs
from cartopy import feature as cfeature
from cartopy.io import shapereader
from sklearn.metrics import r2_score
from torch import cuda
f... |
import os
import sys
# TODO: move commands to flask-script
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import click
# Imports needed for the tool
from database import db
# Import all structure classes
from structure.events import * # pylint: disable=unused-wildcard-import
from s... |
"""
Module developed to transform the cleaned data into a dimensional model, with
the tables in normal form
-----------------------------------
Created on Mon Mar 8 14:38:41 2021
@author: matthew.mcfahn
"""
import pandas as pd
import sqlite_helpers
db_file = f'{sqlite_helpers.outdir}/who_gho_cleaned.sqlite3'
... |
#! python
# coding:utf-8
"""
"""
import os
import re
import maya.cmds as cmds
import pymel.core as pm
import nnutil.core as nu
import nnutil.decorator as deco
import nnutil.ui as ui
import nnutil.display as nd
window_name = "NN_Camera"
window = None
def get_window():
return window
class NN_ToolWindow(objec... |
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import imageio
import os
import shutil
def generate(slope, intercept):
data_points, randomness = 200, 30
x_data = np.linspace(0, 400, data_points)
rand = np.random.randint(-randomness, randomness, siz... |
import argparse
import json
import os
import time
import numpy as np
import torch
import torch.optim as optim
import torch.nn.parallel
from torch.utils.data import DataLoader
from tqdm import tqdm
from dataset import BrainSegmentationDataset as Dataset
from logger import Logger
from loss import DiceLoss
from transfor... |
import csv
import pickle
import Augmentor
import cv2
import keras
import matplotlib.pyplot as plt
import numpy as np
import skimage.morphology as morp
from skimage.filters import rank
from keras.callbacks import EarlyStopping, ReduceLROnPlateau, ModelCheckpoint
from keras.layers import MaxPooling2D, Activation, BatchN... |
#!/usr/bin/env python
##
## @file createSampleModel.py
## @brief Creates a simple SBML model and prints it to stdout.
## @author <NAME>
##
## <!--------------------------------------------------------------------------
## This sample program is distributed under a different license than the rest
## of libSBML. T... |
from __future__ import print_function, division, absolute_import
from collections import deque, defaultdict
from functools import partial
import logging
from time import sleep
import threading
import warnings
from .client import Future
from .core import CommClosedError
from .utils import tokey, log_errors
logger = l... |
import pygame.draw as pgd
import math as m
'''
!!! TO DO !!!
a polygon with rounded vertexes
'''
def arc(screen, color, Rect, start_angle, stop_angle, width=0): #FIXME add rotation
'''
This function draws an arc better then pygame does.
Parameters
----------
screen : Surface
color... |
# -*- coding: utf8 -*-
import math
class Point2:
# 2D - Point
def __init__(self, x, y):
self.xCoor = x
self.yCoor = y
def getX(self):
return round(self.xCoor, 2)
def getY(self):
return round(self.yCoor, 2)
def setCoords(self, x, y):
self.xCoor = x
... |
# under the License.
import socket
import httplib2
import json
from sqlalchemy import orm
from sqlalchemy import sql
from neutron.db.models import external_net
from neutron.db.models import l3
from neutron.db import models_v2
from neutron.debug import debug_agent
from neutron_lib.api.definitions import portbindi... |
import datetime
import json
import math
import os
import random
import re
import shutil
import pandas as pd
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.db.models import Count
from django.http import HttpResponse
from django.shortcuts import render... |
# new_bot.py
# import asyncio
import os
import discord
from discord.ext import commands
import generate
from discord.commands import Option
from discord.commands import permissions
from dotenv import load_dotenv
from types import SimpleNamespace
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
bot = commands.Bot(
... |
import numpy as np
import sklearn.decomposition as decomp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
import yfinance as yf
import numpy as np
import pandas as pd
import scipy
import matplotlib.pyplot as plt
import bs4 as bs
import pickle
import requests
import lxml
im... |
import numpy as np
from sklearn.model_selection import KFold
X = ["a", "b", "c", "d"]
kf = KFold(n_splits=2)
for train, test in kf.split(X):
print("%s %s" % (train, test))
print("Now 2nd")
import numpy as np
from sklearn.model_selection import RepeatedKFold
X = np.array([[1, 2], [3, 4], [1, 2], [3, 4]])
random_st... |
import json
import requests
import time
from datetime import datetime
class AlreadyExistsException(Exception):
"""Raised when the object already exists"""
pass
class EntityNotFoundException(Exception):
"""Raised when the object not found"""
pass
class RedashAPIClient:
def __init__(self, api_key:... |
from __future__ import annotations
"""
Builders for the oas3 object types
These are completely internal, so can be refactored if desired without concern
for breaking user experience
"""
from collections import defaultdict
from typing import TYPE_CHECKING, Optional, Sequence, Union
from sanic_ext.extensions.openapi.c... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import torch
import torch.nn as nn
from typing import List
from argparse import ArgumentParser, Namespace
import torch
from torchlight import set_seed, initialize_exp, snapshot
from dgllife.utils import EarlyStopping, Meter
from data import DataModul... |
#
# -*- coding: utf-8 -*-
#
# This file is part of reclass
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import distutils.version
import errno
import fcntl
import fnmatch
import os
import time
# S... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Openstack, LLC
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 ... |
import sys
import time
import mock
REG_CONFIG = 0x00
REG_SERVO1 = 0x01
REG_SERVO2 = 0x03
REG_WS2812 = 0x05
REG_UPDATE = 0x4e
regs =[0 for x in range(79)]
class SMBus:
def __init__(self, bus_id):
global regs
regs[0] = 0 # 0x00: REG_CONFIG
regs[0] = 0 # 0x01: REG_SERVO1
regs[0] = ... |
"""
BuildProject
============
The BuildProject is an object which inherits of the Troposphere object properties
but uses wrapper methods in order to populate / assign values to these. Just because,
I am Lazy.
TriggerGroup
============
TriggerGroup is an object that builds the list of WebhookFilter for Codebuild Trig... |
#!/usr/bin/env python3
import requests
import ST7735
import time
from bme280 import BME280
from pms5003 import PMS5003, ReadTimeoutError, ChecksumMismatchError
from subprocess import PIPE, Popen, check_output
from PIL import Image, ImageDraw, ImageFont
from fonts.ttf import RobotoMedium as UserFont
try:
from smbu... |
# -*- coding: utf-8 -*-
"""
human VS AI models
Input your move in the format: 2,3
@author: <NAME>
"""
from __future__ import print_function
import pickle
from policy_value_net_numpy import PolicyValueNetNumpy
# from policy_value_net import PolicyValueNet # Theano and Lasagne
# from policy_value_net_pytorch import Po... |
import kindred
import argparse
import pickle
import json
from collections import defaultdict,Counter
import sys
import os
import time
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]
def doesLocationCapitalizationMatch(allEntities,e):
if e['ty... |
"""
Authors: <NAME>.
Copyright:
Copyright (c) 2020 Microsoft Research
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, mo... |
#coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import argparse
import shutil
import numpy as np
import PIL.Image as Image
import tensorflow as tf
import pandas as pd
import retrain as retrain
from count_ops import load_... |
import http.server
import socketserver
import importlib
import sys
import html
from functools import partial
from http.server import HTTPStatus
from pathlib import Path
from urllib.parse import unquote
from .core import MuMath
from .util import listify
# Most of this is copied from http.server:
# https://github.com/py... |
# Copyright (c) 2014 Evalf
#
# 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, distribute, s... |
import matplotlib
import sys
sys.path.extend(["../../", "../", "./"])
from common.base_utls import *
from common.data_utils import *
from models import MODELS, DISCRIMINATOR
import torch
from torch.cuda import empty_cache
import random
from driver.helper.DASEGHelper import DASEGHelper
from driver.Config import Configu... |
import os
import numpy as np
import pickle
from collections import Counter
from tqdm import tqdm
import tensorflow as tf
import torch
def flatten(elems):
return [e for elem in elems for e in elem]
def _get_unique(elems):
if type(elems[0]) == list:
corpus = flatten(elems)
else:
corpus = ele... |
#!/usr/bin/python
# Copyright (c) 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... |
#!/usr/bin/env python
# Terraform-Ansible dynamic inventory for IBM Cloud
# Copyright (c) 2018, IBM UK
# <EMAIL>
ti_version = '0.8'
#
# 01-10-2018 - 0.5 - Added support for Cloud Load Balancer
# 05-10-2018 - 0.6 - Added support for IBM Cloud Resource Instances and internet-svcs
# 03-11-2018 - 0.7 - Fixed failure wher... |
import spira.all as spira
from spira.yevon.geometry.line import *
from spira.yevon.geometry.vector import *
from spira.technologies.waterloo.process.database import RDD
class BoschVia(spira.Device):
__name_prefix__ = 'Bosch_Standard'
radius = spira.NumberParameter(default=RDD.B0.MIN_SIZE)
m0_radius =... |
from . import base
from .engine import Literal
from .iotools import save_map, load_map
from nbodykit.lab import FieldMesh
class Observable(base.Observable):
def __init__(self, map3d, d, s):
self.map3d = map3d
self.s = s
self.d = d
def save(self, path):
save_map(self.map3d, path... |
"""
Author: <NAME>
Python 3.8.3
This script will map the Hybrid check data where the percentage of BosTau_BisBis is larger than
the percentage of BisBis_BisBis on a heatmap
"""
import argparse
from pathlib import Path
import os
import numpy as np
import pandas as pd
import plotly
import plotly.graph_objects as go
de... |
# coding=utf-8
# Copyright (C) 2018 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is ... |
#!/usr/bin/python3
import os
import re
import shutil
import tarfile
import lzma as xz
import fileinput
from argparse import ArgumentParser
import json
from utils import Utils
import ovagenerator
def prepLoopDevice(loop_device_path, mount_path):
Utils.runshellcommand(
"mount -t ext4 {} {}".format(loop_... |
# A tree walker to interpret Cuppa4 programs
from cuppa4_symtab import symtab
from cuppa4_types import coerce, promote
#########################################################################
# Use the exception mechanism to return values from function calls
class ReturnValue(Exception):
def __init__(self, val... |
import os
import io
import json
from copy import deepcopy
from future.utils import string_types
import requests
from requests import Session
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from .config import auth
from sparcur.utils import log
def bind_agent_command(agent_module):
#... |
bl_info = {
"name": "distance_to_depth",
"author": "<NAME>",
"version": (1, 0, 0),
"blender": (2, 80, 0),
"location": "Compositor",
"description": "Provides a compositor node to convert distance images to depth images",
"category": "Compositor",
}
import bpy
from nodeitems_utils import Node... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 17:07:22 2012
@author: gira2403
"""
"""
###########################################################
# Modules
###########################################################
"""
# Numpy
import numpy as np
from numpy.linalg import norm
"""
#########... |
####################################################################################
# This script will generate decoy sequences based on your given native sequence
#
# Written by <NAME>, 06/10/2020
####################################################################################
import math
import subprocess
impor... |
'''
Created on Jun 5, 2013
@author: timmahrt
'''
import os
from os.path import join
import copy
from praatio import tgio
from praatio import praat_scripts
from praatio import dataio
from promo.morph_utils import utils
from promo.morph_utils import audio_scripts
from promo.morph_utils import plot_morphed_data
# Thi... |
from shournal_to_snakemake.abstract_class_helpers import SimpleEquality
class Token(SimpleEquality):
def __init__(self, string, isSplitter, startIdx, endIdx=-1):
"""
:param string: if a splitter, the raw splitting string, if a word, the unescaped unsubstituted string.
:param isSplitter: Tr... |
import glob
import os
import tqdm
import pandas
def readJSON2Dict(input_file):
"""
Read a JSON file. Will return a list or dict.
:param input_file: input JSON file path.
"""
import json
with open(input_file) as f:
data = json.load(f)
return data
def writeDict2JSON(data_dict, out... |
"""
Motion controller module.
"""
import asyncio
from dataclasses import dataclass
from enum import Enum
from highlevel.logger import LOGGER
from highlevel.robot.controller.motion.position import PositionController
from highlevel.robot.entity.configuration import Configuration
from highlevel.robot.gateway.motor import... |
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from .functions import calculate_stats
from .optimizer import OPTIMIZERS
from sklearn.utils import check_X_y
from sklearn.utils.multiclass import type_of_target
from warnings import warn
from typing import Union, Tuple, Dic... |
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
# Import the required libraries
# Import matplotlib for plotting
import matplotlib.pyplot as plt
# Import numpy for array functions
import numpy as np
# Import random to make random array
import random as rand
# Import imageio to make the gif
import imageio
# Global variable for tracking insertions
inserti... |
import torch
import time
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import numpy as np
from joblib import load
import matplotlib.cm as cm
import json
from datasets.datasets import Hdf5Dataset,CustomDataLoader
from matplotlib.lines import Line2D
import random
def load_data_loaders(parameters_p... |
import numpy as np
import xarray as xr
import matplotlib.figure
import matplotlib.pyplot as plt
from .tools import polygon_path
from . import DGGS
dg = DGGS()
class ReprWrapper(object):
""" Turns string into object such that `repr(ReprWrapper(s)) == s`
"""
def __init__(self, val):
self._val = va... |
import pprint as pp
import pickle
import io
import datetime
import random
import numpy as np
from sklearn import svm
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix
def kfold_test(svm_clf, k, b, data, target):
cm ... |
"""Hangman CLI game
Author: <NAME>
"""
import os
import random
import unicodedata
def clear():
os.system('clear')
class GameManager:
"""Holds all the business layer to make de game."""
def __init__(self):
self.strikes = 0
self.words = []
self.word_indexes_used = []
self... |
import torch
from torch import nn
from torchero.meters.base import BaseMeter
from torchero.meters.batch import BatchMeter
class BinaryAccuracy(BatchMeter):
""" Meter for accuracy on binary targets (assuming inputs in range (0,1))
"""
name = "acc"
DEFAULT_MODE = 'max'
INVALID_DIMENSION_MESSAGE = (... |
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np
import os
from flask import Flask,render_template
from flask import request
Path = os.getcwd()
df_movies_diract_orig = pd.read_csv(Path + "/diract.csv")
print("load... |
from typing import Optional, Dict, List, Tuple
from functools import partial
import jax
import jax.numpy as jnp
import haiku as hk
from .relational_model import relational_model
from .tree_crf import tree_crf
from .linear_crf import crf_layer
from src.globals import stable_config
def comp_prediction_loss(logits, le... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.