text stringlengths 3.07k 22.1k |
|---|
from __future__ import print_function
import numpy as np
import tensorflow as tf
from collections import namedtuple
import json
import pickle
HyperParams = namedtuple(
"HyperParams",
[
"max_seq_len",
"seq_width",
"h_size",
"batch_size",
"grad_clip",
"num_mixture"... |
import argparse
import os
import shutil
import subprocess
import scipy.misc as spm
import scipy.ndimage as spi
import scipy.sparse as sps
import numpy as np
def getlaplacian1(i_arr: np.ndarray, consts: np.ndarray, epsilon: float = 0.0000001, win_size: int = 1):
neb_size = (win_size * 2 + 1) ** 2
h, w, c = i_ar... |
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import enum
class PrivilegeValues(enum.Enum):
SE_CREATE_TOKEN = 2
SE_ASSIGNPRIMARYTOKEN = 3
SE_LOCK_MEMORY=4
SE_INCREASE_QUOTA=5
SE_UNSOLICITED_INPUT=6
SE_TCB=7
SE_SECURITY=8
SE_TAKE_OWNERSHIP=9
SE_LOAD_DRIVER=10
SE_SYSTEM_PROFILE=11
SE_SYSTEMTIME=1... |
"""CFFI-based Python binding for LZF stream compression.
The main API is ``lzf.open()``, which opens a compressed file for reading or
writing. It can also be used to wrap an existing file-like object.
To read a structure from an on-disk LZF-compressed JSON file, you could
write::
import lzf
import json
... |
r"""
Transfer learning deal Module.
Consist of the utils for transfer learning.
How to use the module to transfer weights as follows first, second, last.
"""
import torch
from collections import OrderedDict
from src.visual.utils.log import LOGGER
from src.visual.utils.general import delete_list_indices
def get_nam... |
from keyComputations import *
import sys
#from PyQt4.QtCore import pyqtSlot
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import numpy as np
import json
#TODO: (maybe) Add dropdown menu for selecting key blank
"""
json template for key specs:
,
"name":
{
... |
from os import stat
import numpy as np
import math
L2 = np.linalg.norm # defaults to L2
class Rotation:
@staticmethod
def _cross(u):
# cross product matrix
# https://stackoverflow.com/questions/66707295/
return np.cross(u, -np.identity(3))
def Rho(self, theta, u):
# Rot... |
from cv2 import (Sobel, Laplacian, Canny, CV_64F, normalize,
NORM_MINMAX, add, filter2D)
from numpy import array, abs
from PyQt5.QtWidgets import QDialog
from PyQt5.QtCore import QCoreApplication
from src.constants import BORDER_TYPES
from ..operation import Operation
from .edge_detection_ui import Ed... |
"""
Highly inspired by the work of Scotts Lab: https://arxiv.org/abs/2001.05022v1
https://github.com/ScottLabUCB/HTTEM/blob/master/pyNanoFind/bragg_filtering/bragg_filtering.ipynb
"""
import numpy as np
import scipy.fftpack as ftp
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from scipy.signal ... |
import os
import csv
import shutil
import logging
import glob
import datetime
from django.db import transaction
from django.core.files import File
from annoying.functions import get_object_or_None
from documents.models import Document
from documents.utils import save_document_forms
from transmittals.validation impor... |
# Copyright 2019 <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, sof... |
# -*- coding: utf-8 -*-
from enum import Enum
from typing import NamedTuple
from selenium.webdriver.common.by import By
class SelectorsEnum(Enum):
@property
def by(self):
return self.value.by
@property
def selector(self):
return self.value.selector
@property
def type(self):
... |
import datetime
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Set, Tuple
from django.contrib.auth.base_user import AbstractBaseUser
from django.db import models
from django.db.models import Q, QuerySet
from django.utils.timezone import now
from paikkala.excs imp... |
from xml.etree import ElementTree
from dimagi.utils.couch.database import get_db
from casexml.apps.case.models import CommCareCase
from corehq.apps.commtrack import const
from corehq.apps.commtrack.models import (
CommtrackConfig, CommtrackActionConfig, LocationType, RequisitionActions,
CommtrackRequisitionConf... |
# DES Algorithm
import random
message_len = 64
half_message_len = 32
string_len = 48
character_len = 8
rounds = 16
key_len = 56
sbox1 = [[14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],
[0, 15, 7, 4, 14,2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],
[4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0]... |
import csv
import sys
import warnings
from pprint import pprint
from statistics import mean, stdev
# Import the official evaluation scripts
sys.path.append('data/deft_corpus/evaluation/program')
from evaluation_sub1 import get_gold_and_pred_labels as task1_get_labels
from evaluation_sub1 import evaluate as task1_evalu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
from builtins import dict
from Bio import SeqIO
import os
import sys
import gzip
import pickle
import random
import logging
import numpy as np
from shutil import copyfileobj
def phred_to_prob(q):
"""Convert a phred score (Sanger or ... |
"""
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------------------------------... |
#!/bin/env python
# -----------------------------------------------------------------------------
# Name: xmldb.py
# Purpose: Wrapper interface for XML Database functionality:
# createContainer, createDocument, xquery, addIndex, etc.
# (First version only wraps single backend, Sleepycat d... |
# Copyright (c) 2021 AllSeeingEyeTolledEweSew
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERC... |
import argparse
UNK_IDX = 0
UNK_WORD = "UUUNKKK"
EVAL_YEAR = "2017"
BOS_IDX = 1
EOS_IDX = 2
MAX_GEN_LEN = 40
METEOR_JAR = 'evaluation/meteor-1.5.jar'
METEOR_DATA = 'evaluation/data/paraphrase-en.gz'
MULTI_BLEU_PERL = 'evaluation/multi-bleu.perl'
STANFORD_CORENLP = 'evaluation/stanford-corenlp-full-2018-10-05'
def st... |
import numpy as np
import cv2
import torch
import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import axes3d, Axes3D # <-- Note the capitalization!
from common.utility.visualization import cv_draw_joints, plot_3d_skeleton
from common.utility.augment import do_augmentation
from common.utility.utils import cal... |
import unittest
import Testing
import Zope2
Zope2.startup()
import os, sys
import time
from cStringIO import StringIO
from Acquisition import aq_base
from OFS.Application import Application
from OFS.SimpleItem import SimpleItem
from OFS.Cache import ZCM_MANAGERS
from OFS.Image import Pdata
from ZPublisher.HTTPReque... |
"""Configurations and utilities for model building and training."""
import json
import yaml
import torch
import wandb
import argparse
import numpy as np
from pathlib import Path
from pydantic import BaseSettings as _BaseSettings
from typing import TypeVar, Type, Union, Optional, Dict, Any
PathLike = Union[str, Path]
_... |
"""
================================================
Cosmology routines (:mod:`~cora.util.cosmology`)
================================================
A module for various cosmological calculations.
Classes
=======
The bulk of the work is within a class which stores a cosmology and can
calculate quantities like dist... |
from util.math import transpose
from util.decorators import type_check
TABLE_SEPERATOR = "\\\\\n "
# TABLE_TEXT%(<column_layout>, <num_columns>, <contents>)
TABLE_TEXT = """\\begin{table}
\centering
\\begin{tabular}{%s}
\hline
%s
\hline
\end{tabular}
\caption{}
\label{table:}
\end{table}"""
TA... |
# -*- coding: utf-8 -*-
from datetime import datetime, tzinfo
import email
from email.header import decode_header
from email.utils import parsedate_tz, mktime_tz
import re
from tempfile import TemporaryFile
import unicodedata
from trac.attachment import Attachment
from trac.db import Table, Column, Index
from trac.mi... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import ast
import os
import warnings
from dataclasses import asdict
from os import path
from path... |
import os
import json
import hashlib
from itertools import product, chain
from config import DataConfig, ExtractorConfig, ModelConfig, ExperimentConfig
PROBLEM_TYPE = 'multilabel'
CLASSIC_BATCH_SIZE = 500000
CLASSIC_EXTRACTOR_TYPES = ['bow', 'tfidf']
BERT_BATCH_SIZE = 64
FASTTEXT_BATCH_SIZE = 2048
CONFIG_ROOT = 'con... |
import numpy as np
import pyqtgraph as pg
from PyQt5 import QtCore
from acconeer_utils.clients.reg.client import RegClient, RegSPIClient
from acconeer_utils.clients.json.client import JSONClient
from acconeer_utils.clients import configs
from acconeer_utils import example_utils
from acconeer_utils.pg_process import PG... |
#!/usr/bin/env python
import numpy as np
from shogun import TableFactorType
# create the factor type with GT parameters
tid = 0
cards = np.array([2,2], np.int32)
w_gt = np.array([0.3,0.5,1.0,0.2,0.05,0.6,-0.2,0.75])
fac_type = TableFactorType(tid, cards, w_gt)
tid_u = 1
cards_u = np.array([2], np.int32)
w_gt_u = np.... |
import os
import json
import time
import mlflow
import shutil
import getpass
import platform
from typing import Any
from typing import Dict
from typing import Optional
from cftool.misc import lock_manager
from cftool.misc import fix_float_to_length
from mlflow.exceptions import MlflowException
from mlflow.utils.mlflow... |
#exec(open('.\\templates\\data_manipulation.py').read())
# TODO: pd.DataFrame.pivot
# TODO: pd.DataFrame.melt
# TODO: np.count_nonzero
# TODO: np.repeat
import subprocess as sp
import pandas as pd
import numpy as np
import random
import math
import itertools
def func(a: np.array):
return (2 * a[0]) + math.sin(a[1]... |
"""Tests for media.views."""
# pylint: disable=protected-access,maybe-no-member,invalid-name
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import Client, TestCase, RequestFactory
from django.test.utils import override_settings
from mock import patch
from op... |
# import python libraries
import numpy as np
from copy import deepcopy
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# import functions
import optimizer as O # stochastic gradient descent optimizer
from vi import value_iteration
from maxent_irl import *
from assembly_tasks import *
from vi... |
from django.db import models
from django.contrib.sites.models import Site
from django.core.validators import MaxValueValidator, MinValueValidator
class Config(models.Model):
site = models.OneToOneField(Site, on_delete=models.CASCADE)
school = models.BooleanField(
default=True, help_text="Demande de l'... |
import matplotlib.pyplot as plt
from matplotlib.patches import Arc
import matplotlib.cm as cm
import seaborn as sns
import numpy as np
import pandas as pd
from bokeh.plotting import figure
from bokeh.io import show
# import seaborn as sns
def plotpitch(display=False, size=(7,5)):
# Create figure
fig = plt.fi... |
# from https://github.com/XuhuiZhou/CATS/blob/master/making_sense.py
import torch
from torch.nn import CrossEntropyLoss
from transformers import *
import numpy as np
import math
# OPTIONAL: if you want to have more information on what's happening, activate the logger as follows
import logging
import os
import sys
logg... |
from __future__ import annotations
import disnake
from disnake.ext import commands
from typing import TYPE_CHECKING, Literal
from src.utils.utils import EmbedFactory, ExitButton, SaveButton, add_lines, get_info
if TYPE_CHECKING:
from src.utils import File
def clear_codeblock(content: str):
content.strip("... |
import glob
import logging
import os
import re
from functools import partial
from comet_ml import Experiment
import torch
from torch.utils.data import random_split
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
import ray
from ray.tune import CLIReporter
from ray.tune.schedulers impor... |
#!/usr/bin/python
def he_control_loop(dummy, state,timeState):
from time import sleep
from datetime import datetime, timedelta
import RPi.GPIO as GPIO
import config as conf
GPIO.setmode(GPIO.BCM)
GPIO.setup(conf.he_pin, GPIO.OUT)
GPIO.setup(conf.steam_pin,GPIO.IN)
GPIO.output(conf.he_p... |
#!--*-- coding:utf-8 --*--
# Deeplab Demo
# This file calculates the final result and outputs the soling coverage
import os
import tarfile
from matplotlib import gridspec
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import tempfile
from six.moves import urllib
import matplotlib.imag... |
import gzip
import struct
class IfoFileReader(object):
"""Read infomation from .ifo file and parse the infomation a dictionary.
The structure of the dictionary is shown below:
{key, value}
"""
def __init__(self, filename):
"""Constructor from filename.
Arguments:
- `filena... |
from __future__ import division
from builtins import str
from past.utils import old_div
from .pathway import Pathway
from .config import cofactorsList, kegg_compound, color_configs
import graphviz as gv
import os
import logging
import math
# ##################CONSTANTS######################
kegg_compound['C00009'] = '... |
# This script scrapes all html pages, pulls out the exercises
# and challenges, and copies them to the all_exercises_challenges.html
# page.
import os, sys, re
print("Building all_exercises_challenges.html...")
path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/'
# Work through noteb... |
#!/usr/bin/env python
'''
File name: sola.py
Author: tofubridge
Description: sola reads daemon data in from a json file and writes the data
to a csv file for easier data manipulation
Python Version: 3.6.4
'''
## ========================== Import libraries =================================
import json
import... |
#
# -*- coding: utf-8 -*-
# Extends unittest with support for pytest-style fixtures.
#
# Copyright (c) 2018 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
#
import argparse
import functools
import inspect
import sys
import unittest
_use_native_pytest = False
def enable_pytest():
global ... |
import os
import numpy as np
import tvm
import time
from tvm import te
from tvm import autotvm
from tvm import relay
import tvm.relay.testing
import lenet
import tvm.relay.testing.init as init
from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner
from tvm.contrib.util import tempdir
from tvm.t... |
import argparse
import torch
import lib
import numpy as np
import os
import datetime
parser = argparse.ArgumentParser()
parser.add_argument('--hidden_size', default=100, type=int) #Literature uses 100 / 1000 --> better is 100
parser.add_argument('--num_layers', default=3, type=int) #1 hidden layer
parser.add_argument(... |
import random
import urllib.parse
# noinspection PyPackageRequirements
import discord
# noinspection PyPackageRequirements
from discord.ext import commands
# noinspection PyPackageRequirements
import utils.errors
import asyncio
from collections import defaultdict
from cogs import common
"""
The MIT License (MIT)
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from __future__ import print_function
from typing import List, Optional
import torch
from torch import nn
from torch.nn import functional as F
import numpy as np
... |
#!/usr/bin/python
import json
import sys
import random
def generate_uuid ():
rand_uuid_start=''
for i in range(8):
r=random.choice('abcdef1234567890')
rand_uuid_start += r
uuid=rand_uuid_start + "-49e5-4c33-afab-9ec90d65faf3"
return uuid
# function that parses 'source' field of CWL, which contain... |
'''
@author: <NAME>
@copyright: Copyright 2016-2019, <NAME>.
@license: MIT
@contact: <EMAIL>
'''
## Extract features
import os
import numpy as np
from scipy import stats
import pandas as pd
from .sigproc import (mad, peakfreq_from_fft, spectralRollOff, spectralCentroidAndSpread, chromaFeatures, chromaFea... |
"""Base models and utilities used by the derived ones."""
import datetime
import functools
import logging
import urllib.parse as urlparse
from collections import OrderedDict
from dateutil import tz
from google.cloud import ndb
from truestory import settings
# Datastore default client settings.
PROJECT = settings.... |
import csv
import pymysql
import requests
import re
from lxml import html
import time
import urllib3
from requests.adapters import HTTPAdapter
# 请求头
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 "
"Safari/537.36 "
}
# 登... |
from impedance.models.circuits import BaseCircuit, CustomCircuit, Randles
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pytest
# get example data
data = np.genfromtxt(os.path.join("./data/", "exampleData.csv"), delimiter=",")
f = data[:, 0]
Z = data[:, 1] + 1j * data[:, 2]
def test... |
import time
import copy
import random
import json
import argparse
import datetime
import numpy as np
import torch
from torch.optim import AdamW
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from sklearn.model_selection import train_test_split
import pandas as pd
from tqdm import tqdm
im... |
#!/usr/bin/python
#
# Copyright 2018 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 ag... |
#!/usr/bin/env python3
# Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
"""arvados_docker.cleaner - Remove unused Docker images from compute nodes
Usage:
python3 -m arvados_docker.cleaner --quota 50G
"""
import argparse
import collections
import copy
import functools
... |
import json
import argparse
import math
import cv2
import numpy as np
parser = argparse.ArgumentParser(description='Splits COCO annotations file into training and test sets.')
parser.add_argument('--in_ann', dest='in_ann', type=str, required=True,
help="Path to read COCO annotations file.")
par... |
import data.model as model
import urllib.request
import os.path
import pickle
ingest_directory = os.path.join(os.path.dirname(__file__), 'ingest')
ingest_manifest = 'ingest_urls.csv'
class IngestDataFile:
def __init__(self, filename, url):
self.filename = filename
self.url = url
self.dat... |
"""
Synchronizes a mailchimp list with the students of a course.
"""
import itertools
import logging
import math
import random
from collections import namedtuple
from itertools import chain
from django.core.management.base import BaseCommand
from mailsnake import MailSnake
from opaque_keys.edx.keys import CourseKey
... |
# -*- coding: utf-8 -*-
import random, re
import numpy as np
import torch
import torch.utils.data
import nlpaug.augmenter.word as naw
import nlpaug.augmenter.char as nac
import nlpaug.flow as naf
from .custom_aug import CapitalizeAug, AbbrAug, RepeatCharAug
from tqdm import tqdm
def _tokenizer(text, token_pattern=r"... |
import os
from functools import wraps
from flask import render_template, jsonify, send_from_directory,\
request, redirect, abort, url_for, flash
from flask_login import current_user, login_user, logout_user, login_required
from app import app, db
from app.events import send_new_submission_event
from app.services ... |
# Copyright 2018 Google LLC. 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... |
# Code Author: <NAME>
# Uniform Preprocessing file for performing Out-painting for SML project
from segmentation_models import Unet, Nestnet, Xnet
import numpy as np
from keras import backend as K
from keras.models import Model
from keras.layers import Flatten, Dense, Dropout
from keras.layers import Conv2D
from ker... |
from pyexpat import features
from darts.models.forecasting.gradient_boosted_model import LightGBMModel
import wandb
from darts.models import TCNModel
import pandas as pd
from darts.metrics import mape, mae
from darts import TimeSeries
from darts.dataprocessing.transformers import Scaler
from copy import deepcopy
import... |
# coding=utf-8
from vector_solver import IqSolver
from numpy import array, zeros
from abc import abstractmethod
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
import re
import os
import json
def l(s):
... |
#!/usr/bin/env python3
"""
Gathers Vulnerability Information and outputs it in a fancy way :-)
"""
import os
import sys
import json
import requests
from tabulate import tabulate
import textwrap
import yaml
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--config", action="store", dest... |
import itertools
from collections import OrderedDict
from pytest import raises
from triad.utils.iter import (
EmptyAwareIterable,
Slicer,
make_empty_aware,
slice_iterable,
to_kv_iterable,
)
def test_empty_aware_iterable():
i = _get_iterable("1,2,3")
e = make_empty_aware(i)
assert not ... |
"""
git-x - a set of handy git extensions.
"""
__version__ = "0.3.3"
__author__ = "<NAME>"
__license__ = "MIT"
import click
from gitx import Gitx
CONTEXT_SETTINGS = dict(help_option_names=['-h'])
@click.command(short_help="Add file contents to the index")
@click.argument("pathspec", nargs=-1, metavar='<pathspec>... |
#!/usr/bin/python
import boto
from boto.sqs.message import Message
import boto.ec2
import os
import cPickle as pickle
import subprocess
import shlex
import time
import logging
import socket
HOSTNAME = str.join('_', socket.gethostname().split('.'))
FUSE_MOUNT = "/tmp/snowflake"
SERVER_DIR = "/tmp/snowflake_server"
l... |
# Copyright (C) ATHENA AUTHORS
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... |
import torch
from torch import nn
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
from ..utils.generic_utils import to_cuda
class EmbeddingConstructionBase(nn.Module):
"""
Base class for (initial) graph embedding construction.
...
Attributes
----------
feat : dict
... |
import functools
import os
from celery.utils.log import get_task_logger
from celery import shared_task
from django.conf import settings
from django.core.mail import mail_admins, send_mail
from django.db.models import signals
from django.db import transaction
from django.dispatch import receiver
from django.urls import... |
# Copyright 2018 Immuta, Inc. Licensed under the Immuta Software License
# Version 0.1 (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.immuta.com/licenses/Immuta_Software_License_0.1.txt
#
# Unless required by applicable law o... |
from __future__ import absolute_import, division, \
print_function, unicode_literals
import pandas as pd
import numpy as np
import openpyxl
import json
import sys
def show_func():
print("+-------------------------------+")
print("|model online tools |")
print("+----------------------------... |
# test functions available in expressions
import pathlib
import pytest
import sys
from neuro_sdk import Client
from re_assert import Matches
from typing import AbstractSet, Any, AsyncIterator, Callable, Mapping
from neuro_flow.context import FlowCtx, GitCtx, LiveContext, ProjectCtx, TagsCtx
from neuro_flow.expr import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 15:33:45 2020
@author: adonay
"""
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({'font.size': 20})
import numpy as np
import pandas as pd
import seaborn as sns
import utils_io as uio
from pypls import meancentered... |
import os, sys
import configparser
import serial
import logging
from LogReader import LogReader
from EncoderReader import EncoderReader
import math
import tkinter
import collections
import pandas
from matplotlib import pyplot
import numpy as np
import scipy.signal
logging.basicConfig(level=os.environ.get("LOGLEVEL", "... |
# Code Taken from https://github.com/LYH-YF/MWPToolkit
import re
import copy
from word2number import w2n
from utils.enum_type import NumMask,EPT
def trans_symbol_2_number(equ_list, num_list):
"""transfer mask symbol in equation to number.
Args:
equ_list (list): equation.
num_list (list): num... |
# -*- coding: utf-8 -*-
# Written in Python 2.7, but try to maintain Python 3+ compatibility
from __future__ import print_function
from __future__ import division
from replicationbase import ReplicationBase
from classic_heuristics.cmt_2phase import cmt_2phase_init
from os import path
import unittest
from util import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
UP TO DATE CURRENT VERSION AT https://github.com/thejoltjoker/camera-offload
---
camera_offload.py
A script for offloading files from a memory card etc.
"""
import os
import hashlib
import xxhash
import logging
import datetime
import shutil
import math
import argparse
i... |
"""Hill's method. This method is based on the method given by Deconinck,
Kiyak, Carter, and Kutz (University of Washington, Seattle University) in
their software package SpectrUW (pronounced spectrum).
This is a numerical method that determines the spectra of a linear operator.
For more information, see:
https://ww... |
import logging
import os
from typing import List, Sequence, Union
import eagerpy as ep
import foolbox as fb
import hydra
import torch
from omegaconf import OmegaConf
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
from tqdm import tqdm
from hiding_adversarial_attacks._neptune.uti... |
# -*- coding: utf-8 -*-
### required - do no delete
import sys
import os
import shutil
import gluon.contrib.simplejson
from datetime import datetime
sys.path.append(os.path.abspath('./../'))
from modules import fflock_globals
from modules import fflock_utility
master_color = "#317b80"
storage_color = "#609194"
warnin... |
import sys
import json
from datetime import datetime, timezone, timedelta
import boto3
from awsglue.utils import getResolvedOptions
def initiate_logger(now_ts, job_name, job_env):
logger = []
logger.append(f"Running job: {job_name}")
logger.append(f"Timestamp job start: {now_ts}")
logger.append(f"Env... |
"""PartialCube.py
Test whether a graph is an isometric subgraph of a hypercube.
<NAME>, September 2005, rewritten May 2007 per arxiv:0705.1025.
"""
import BFS
import Medium
from Bipartite import isBipartite
from UnionFind import UnionFind
from StrongConnectivity import StronglyConnectedComponents
from Graphs import ... |
#!/usr/bin/env python
#SETMODE 777
#----------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------ HEADER --#
"""
:author:
<NAME>
jmw150530
:synopsis:
Creates the Pipeline Context.
:description:
... |
import tensorflow as tf
import selfsup
import os
from .base import Method
from autocolorize.tensorflow.sparse_extractor import sparse_extractor
from autocolorize.extraction import calc_rgb_from_hue_chroma
import functools
from collections import OrderedDict
import numpy as np
def kl_divergence(labels, logits):
#re... |
"""
Chupbot phase 2: chup looks fine but must looks like shit
author: <NAME>
"""
import tweepy as tp
import json
from PIL import Image, ImageDraw
import numpy as np
from colormath.color_diff import delta_e_cie2000
from colormath.color_objects import LabColor, sRGBColor
from colormath.color_conversions import convert_c... |
#!/usr/bin/python3
# Learn more about how this works by visiting: https://github.com/SurpriseDog/EasyArgs
import os
import re
import sys
from argparse import ArgumentParser, SUPPRESS
from sd.common import list_get
from sd.columns import auto_cols
from sd.common import undent
def easy_parse(optionals_list, pos_list=... |
from enum import Enum
from functools import lru_cache, wraps
from typing import (
Any,
Callable,
Collection,
Mapping,
Optional,
Sequence,
Type,
Union,
cast,
overload,
)
from apischema.aliases import Aliaser
from apischema.cache import cache
from apischema.conversions.conversions... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import time
import math
from collections import OrderedDict
# In[2]:
def createGraph(depotNodes ,requiredEdges, numNodes, show=True):
G = nx.Graph()
edges = []
pos = {}
reqPos =... |
#!/usr/bin/env python
# coding: utf-8
# # # Identifying various features of customer Churn with XGBoost (Extreme Gradient Boosting)
# XGBoost is an optimized distributed gradient boosting library designed to be highly efficient, flexible and portable. It implements machine learning algorithms under the Gradient Boosti... |
# !/usr/bin/python3
# Controller.py
"""
Solar Powered Pool Controller.
This is the main module for this controller.
It runs using a dummy DataSource by detecting it is not on a Raspberry Pi
and setting the global constant REAL to False.
"""
from datetime import datetime, timedelta
from platform import machin... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import h5py as h5
from scipy.optimize import curve_fit
import scipy.constants as sc
import os
from scipy.integrate import simps
def gauss(x, a, x0, sigma, offset):
return a*np.exp(-(x-x0)**2/(2*sigma**2))+offset
def getData(fileName, senso... |
"""
The `nntm.model_selection._split` module includes classes and
functions to split the data based on a preset strategy.
"""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
# Autho... |
from __future__ import print_function
import time
import tensorflow as tf
from six.moves import xrange
def model(x, nlogits, train=False):
b = tf.shape(x)[0]
if args.infer_legacy:
window = tf.contrib.signal.hann_window(1024)
windows = []
for i in xrange(0, 16384, 128):
x_window = x[:, i:i+102... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.