text stringlengths 3.07k 12.6k |
|---|
import json
import requests
import logging
from django.http import JsonResponse
from django.views.generic.base import View
from asset.models import Host
from architecture import models
from zabbix.zabbix_api import token_get
from common.views import ResponseInfo
from tabops_api.settings import DEFAULT_LOGGER, ZABBIX_A... |
import math
import numpy as np
import itertools
from matplotlib import colors, pyplot as plt
def ordinal(n):
"""Obtained from Stack overflow via user Gareth: https://codegolf.stackexchange.com/users/737/gareth"""
return "%d%s" % (n, "tsnrhtdd"[(math.floor(n / 10) % 10 != 1) * (n % 10 < 4) * n % 10::4])
def... |
import os.path
from PIL import Image
import torch
import numpy as np
import itertools
import torch.utils.data as data
from torch.utils.data.sampler import Sampler
from data.dataset_functions import get_params, get_transform
from util import keypoint_functions
import util.functions as functions
class KPDataset(data.D... |
import keras
import numpy as np
import os
from keras.utils import to_categorical
from keras.models import Model, load_model
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, Input
from sklearn.utils import shuffle
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
from tqdm im... |
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
import time
import re
import os
import sys
import cv2
import bdcn
from datasets.dataset import *
import argparse
import cfg
def sigmoid(x):
return 1./(1+np.exp(... |
"""
This script takes a paired alignment file and, assigns each end to two bins of two different
supplied sizes. For example, a read at position 10,000,100 could be assigned to the 1 Mb bin
spanning 10M-11M and the 1 kb bin spanning 10.000 to 10.001 Mb. The result is a file in which
each row represents a small bin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
import logging
import math
from dataclasses import dataclass
from math import radians, sin, cos, atan2, sqrt
import dateutil
import googlemaps
import pandas as pd
from munch import munchify, Munch
@dataclass
class LatLong:
lat: float
long: float
@classmethod
def from_g(cls, g: Munch):
return... |
#!/usr/bin/env python3
import argparse
import csv
import math
import sys
#####
parser = argparse.ArgumentParser(description="Apportion the U.S. House of Representatives according to the cube root rule")
parser.add_argument("DATASET", help="population dataset to use")
parser.add_argument("--exclude-ak", action="sto... |
import gzip
import os
from pathlib import Path
import numpy as np
import requests
import tqdm
if "USE_TORCH" in os.environ:
print("Using pytorch")
import torch as tor4
import torch.nn as nn
else:
print("Using tor4")
import tor4
import tor4.nn as nn
ROOT = Path(os.path.abspath(__file__)).pare... |
import argparse
import os
import pysam
import warnings
import timeit
from collections import namedtuple
from operator import itemgetter
import sys
sys.path.append('..')
from samstat.maps import RegionMap
from samstat.maps import AlignmentMap
true_dir_out_values = ['qname', 'rname', 'forward', 'reverse']
def calcul... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import collections
import jk_logging
import jk_utils
from .TestContext import TestContext
from .Annotations import *
from .EnumProcessingState import EnumProcessingState
from .EnumEnabledState import EnumEnabledState
class ExceptionMatcher(object):
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import scipy.misc
import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
from matplotlib import gridspec
from classifiers import *
from predict... |
import numpy as np
import matplotlib.pyplot as plt
import subprocess
def backtrace(backpointers, node, involved):
optimal = False
for P in backpointers[node]:
if backtrace(backpointers, (P[0], P[1]), involved):
P[2] = True
optimal = True
involved[node[0], node[1]] = ... |
import json
import pytest
import hashlib
import tarfile
from cosmo_tester.test_suites.cli import (
_install_linux_cli,
_prepare,
_test_cfy_logs,
get_linux_image_settings,
)
def test_cfy_logs_linux(linux_cli_tester, tmpdir, logger):
cli_host = linux_cli_tester['cli_host']
example = linux_cli_t... |
import rp2
import array
from uctypes import addressof
import micropython
bit_sample_freq = 3_072_000 # PDM clock frequency Hz
__steps = 8 # PIO clock steps per PDM clock cycle
# 8 word raw sample buffer matching size joined RX FIFO
__raw_sample_buf = array.array('I', [0 for _ in range(8)])
# sample buffers
buf_len =... |
"""
t.me/Princesa_AmandaBot
"""
import logging
import telegram.constants
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, ConversationHandler, CallbackQueryHandler,
CallbackContext)
apresentacao = 0
ro... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import matplotlib
matplotlib.use('nbagg')
import matplotlib.animation as anm
import matplotlib.pyplot as plt
import numpy as np
import math
import matplotlib.patches as patches
class World(object):
def __init__(self, time_span, time_interval, debug=False):
... |
"""Open API links support.
Based on https://swagger.io/docs/specification/links/
"""
from copy import deepcopy
from typing import Any, Dict, List, NoReturn, Optional, Sequence, Tuple
import attr
from ..._hypothesis import LOCATION_TO_CONTAINER
from ...models import Case, Endpoint
from ...stateful import ParsedData, ... |
# https://api-portal.tfl.gov.uk/docs
# Specifically, Arrival predictions (countdown/trackernet) for a stop
# Bus with TFL's web UI,
# https://tfl.gov.uk/bus/stop/490014129N/wales-avenue?lineId=154
import requests # For the TFL API invocations.
import json ... |
import sqlite3
from os import path
from database_functions import (add_service, add_user, check_data_from_service, create_database,
delete_service, delete_user, get_master_hashed, get_key,
get_user_id, get_usernames_list, list_saved_services,
... |
import os
import base64
import json
import pytest
from flask import session
from flask_sqlalchemy import SQLAlchemy
os.environ['TEST'] = '1'
from articler.main import app, api, db
from articler.models import User, Article
from articler.api import Users, Articles, UserArticles, ArticleResource
api.add_resource(User... |
from abc import ABCMeta, abstractmethod
from copy import copy
from typing import Dict, Iterable, List, Tuple
import re
import numpy as np
categorical_param_name_pattern = r"^(?P<propname>[^\[]+)\[T\.(?P<matchingval>[^\]]+)\]"
categorical_param_name_regex = re.compile(categorical_param_name_pattern)
class AbstractB... |
from typing import Any, Dict, Optional, cast, List, Type, Union
from itertools import chain
from functools import reduce
from importlib import import_module
import yaml
from kuddl.version import __version__
__version__ = __version__
AnyLoader = Union[yaml.BaseLoader, yaml.FullLoader, yaml.SafeLoader, yaml.Loader]
... |
from random import *
tests = ((-1, 0), #on défini les coodonnées de vecteurs, lesquels permettront d'effectuer des tests dans le plateau de jeu
( 1, 0),
( 0, -1),
( 0, 1),
(-1, -1),
(-1, +1),
( 1, -1),
( 1, 1)
)
def Jouer(grille, cases_possibles, joueur):
#association de case(coordonées) à so... |
#coding: utf8
import requests
import re
import time
import random
import numpy as np
class Questionnaire:
def __init__(self, url):
self.wj_url = url
self.post_url = None
self.header = None
self.cookie = None
self.data = None
def get_ktimes(self):
return random... |
from pysph.sph.equation import Equation
class InletInfo(object):
def __init__(self, pa_name, normal, refpoint, freesurface=False,
basenormal=None, equations=None):
"""Create object with information of inlets, all the others parameters
which are not passed here get evaluated by ... |
from tradingTest import technicalAnalisys as ta
class One():
window = 50
atrLen = 5
@classmethod
def open(cls, data, index):
sma = ta.singleSMA(data, cls.window, index)
atr = ta.singleATR(data, index=index)
if float(data[index][4]) > sma + atr * cls.atrLen:
return '... |
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
from typing import List, Union
from disentanglement_lib.data.ground_truth.ground_truth_data import GroundTruthData
from disentanglement_lib.visualize import visualize_util
def create_paired_factors(z: np.ndarray,
g... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 1 23:11:47 2017
@author: <NAME>
% 1. This is a simple demo of HLO [1]. It is just tested by sphere function
% which is adopted in CEC'05.
% 2.This code defines the population size in 'popSize', number of design
% generations in 'Gmax',current gener... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 10:42:39 2020
@author: rachelbosch
This is a simpliflied, streamlined scallop abrasion calculator to recreate
motivational simulation justifying the comparison of abrasion and dissolution
Based on darthabrader.py by <NAME>, based on Jupyter notebooks by <NAME>
"""
im... |
from __future__ import annotations
import importlib
import sys
import typing
import types
from .. import spec
from . import parsing
def run_cli(
raw_command: typing.Optional[spec.RawCommand] = None,
command_sequence: typing.Optional[spec.CommandSequence] = None,
command_index: typing.Optional[spec.Comma... |
#!/usr/bin/env python
"""Probe multilingual BERT on cross-lingual retrieval."""
import argparse
import logging
import sys
import joblib
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from sklearn.linear_model import LinearRegression
from utils import (
text_data_generator, bat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 14 16:10:10 2021
@author: andy
"""
import numpy as np
import tiff_areas
import re
import sys
import datetime
from pathlib import Path
import shutil
def get_time_window_index( datetime2, datetime1, time_delta ):
return int(np.floor( float(( da... |
#!/usr/bin/env python
import collections
import importlib
import json
import re
from pathlib import Path
from vtkmodules.vtkCommonCore import vtkVersion
def get_program_parameters(argv):
import argparse
description = 'Generate import statements for the VTK classes in your Python code.'
epilogue = '''
Th... |
import re
import bs4
import requests
from cruijff.constants import YEAR
from .utils import cache, legit_header
def _check_fmt(fmt):
if fmt not in {"sql", "pandas"}:
raise ValueError("'fmt' must be 'pandas' or 'sql'")
@cache
def get_comps(which="leagues", fmt="pandas"):
if which not in {"leagues", ... |
from ipaddress import IPv4Network, IPv6Network, ip_address, ip_network
import time
from typing import Optional, Union
from twisted.internet import defer
from twisted.internet.base import DelayedCall
from twisted.names.server import DNSServerFactory
from twisted.names import dns
from dnsagent import logger
from dnsage... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... |
# Project: LinuxLogForensics
# Author: <NAME>
# Date Started: July 12, 2021
# Copyright: (c) Copyright 2021 <NAME>
# Module: view/Menus.py
# Date Started: Imported from LinuxLogForensics project on March 18, 2022.
# Purpose: Programmable Main menu and programmable me... |
import matplotlib as ml
import itertools
ml.use("Agg")
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import numpy as np
from settings import *
import os
import pandas as pd
from textwrap import wrap
def get_cmap(n, name='tab20'):
'''Returns a function that maps each index in 0, 1, ..., n-1 to a distin... |
# #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: gdupuis & cberube
# @Date: 07-10-2019
# @Email: <EMAIL>
# @Last modified by: charles
# @Last modified time: 2020-12-21 21:12:42
import h5py
import numpy as np
import torch
try:
import imgaug.augmenters as iaa
except ImportError:
pr... |
"""cpi.py
scraper for Consumer Price Index.
Author : <NAME>
Create Date : 2021-12-05 17:00:02
Copyright (c) 2019- <NAME> <<EMAIL>>
"""
import csv
from datetime import datetime
from pathlib import Path
from typing import List
import bs4
import requests
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
... |
#!/usr/bin/env python3
# -*- coding: utf-8-*-
"""\
Submit CMIP6 Citation info of experiment granularity.
---
This script gets base (MIP-granularity) info from the citation service
or local JSON file, adds experiment informations, then puts it back to
the citaion service.
You have to specify MIP(`activity_id`), model... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NLP primitives.
"""
import logging
from copy import deepcopy
from collections import defaultdict
from itertools import chain
import heapq
from stanza.nlp import AnnotatedSentence, AnnotatedDependencyParseTree, CoreNLP_pb2
logger = logging.getLogger(__name__)
# Oper... |
import logging
import re
import webapp2 as webapp
import json
import urllib
from google.appengine.api import urlfetch
from google.appengine.ext.webapp.util import run_wsgi_app
from api import asynch
from api.v1 import api_utils
from stats_and_maps.stats import stathat
class MainHandler(webapp.RequestHandler):
d... |
import unittest
from kelvin.mp2 import MP2
from kelvin.fci import FCI
from kelvin.scf_system import SCFSystem
def compute_ft_mp2(m, T, mu):
sys = SCFSystem(m, T, mu)
mp2T = MP2(sys, T=T, mu=mu, iprint=0)
E0T, E1T, E2T = mp2T.run()
return (E0T, E1T, E2T)
def compute_zt_mp2(m):
sys = SCFSystem(m, ... |
import sqlite3
class Db(object):
def __init__(self):
self.db = sqlite3.connect('data/test.db')
def get_conn(self):
return self.db
class Model(object):
def __init__(self, conn):
self.conn = conn
self.validate()
self.create_table()
def validate(self):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# msf_kernel.py
#
# Copyright 2015 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copy... |
from .ImageGenerator import CanvasGenerator
from .ClipartImprinter import ClipartInserter
from .TextImprinter import FontEngine, TextImprinter
from .Artifacter import Artifacter
from .Stainer import Stainer
import lorem
import numpy
from pathlib import PurePath, Path
import progressbar
from PIL import Image
... |
"""Module containing the integration tests for the `tVGP` class."""
import gpflow
import numpy as np
import pytest
import tensorflow as tf
from gpflow.likelihoods import Bernoulli, Gaussian
from gpflow.optimizers import NaturalGradient
from src.models.tvgp import t_VGP
LENGTH_SCALE = 2.0
VARIANCE = 2.25
NUM_DATA = 8
... |
from multiprocessing import Pool
from os import listdir
from os.path import isfile, join
from scipy import ndimage
from texttable import Texttable
from tqdm import tqdm
import hill_climb
import multiprocessing
import numpy as np
import random
import time
import toolbox as tb
# Runs over the matrix and finds all zeros ... |
#python -m pip install pysimplegui
import PySimpleGUI as sg
import pyautogui
def runOrders():
ordersFile = open("orders.txt", "r")
currentTasks = ordersFile.read().split("\n")
ordersFile.close()
for row in currentTasks:
first_word = row.split(" ")[0]
if first_word == "move... |
import torch
from torch import nn
import torch.nn.functional as F
from .utils import PI, SQRT2, deg2rad, affine_grid, grid_sample
from .filters import RampFilter
class Radon(nn.Module):
def __init__(self, in_size=None, theta=None, circle=True, dtype=torch.float):
super(Radon, self).__init__()
self... |
from __future__ import absolute_import
import numpy as np
import io
import cv2
cv2.ocl.setUseOpenCL(False)
from PIL import Image
import random
def pil_loader(img_str):
# print(img_str)
buff = io.BytesIO(img_str)
with Image.open(buff) as img:
img = img.convert('RGB')
open_cv_image = np.array(im... |
import typing as T
from dataclasses import dataclass, field
from moonleap import Resource, Term, named
from moonleap.resource.rel import Rel
from moonleap.typespec.get_member_field_spec import get_member_field_spec
from moonleap.utils.fp import aperture
from moonleap.utils.join import join
from moonleap.verbs import u... |
#! /bin/env python
#
# Copyright 2019 <NAME> <<EMAIL>>
#
# This file is part of Salus
# (see https://github.com/SymbioticLab/Salus).
#
# 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
#
# ... |
#!/usr/bin/env python3
# pcap.py - writes libpcap dump files
# Copyright 2019 <NAME> <<EMAIL>>
#
# 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.... |
# ------------------------------------------------------------------------
# Copyright (c) 2021 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from BasicSR (https://github.com/xinntao/BasicSR)
# Copyright 2018-2020 BasicSR Authors
# -------------... |
#!/usr/bin/env python
import configparser
import requests
import sys
from argparse import ArgumentParser
from chopt import chopt
from pathlib import Path
from urllib3.exceptions import InsecureRequestWarning
# Suppress only the single warning from urllib3 needed.
requests.packages.urllib3.disable_warnings(category=In... |
# crop
import cv2
from distutils.version import StrictVersion
import imutils
import logging
import matplotlib as plt
import numpy as np
from PIL import Image
import re
# setup logger
logging.basicConfig(level=logging.DEBUG)
# parso shims
logging.getLogger('parso.python.diff').disabled = True
logging.getLogger('parso... |
# 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... |
'''
DUNE CVN model
Inspired by https://github.com/titu1994/keras-squeeze-excite-network/blob/master/se_resnet.py
References:
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
- [Squeeze-and-Excitation Networks](https://arxiv.org/abs/1709.01507)
'''
__version__ = '1.0'
__author... |
#!/usr/bin/env python3
"""
Walk through the dictionary: we're going to test all Nerdle
answers, with and record how many guesses each one took, whether we
solved the problem, for what fraction of words we managed to solve the
problem, median turns to solve, modal turns to solve, and mean turns
to solve the ones we mana... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import contextlib
import enum
import glob
import logging
import logging.config
import os
import re
import shutil
import sys
import six
import git
import gist
logger = logging.getLogger(__name__)
class SyncStatus(enum.Enum):
created = 'created'
... |
# %matplotlib inline
from __future__ import print_function, division
import argparse
import csv
import numpy as np
import os
from PIL import Image
import cv2
import torch
from torch.autograd import Variable
import torch.nn as nn
import torchvision.transforms as transforms
from face_model import FaceModel
from retinaf... |
# -*- coding: utf-8 -*-
"""
创建训练有用概率模型用的数据集
"""
import datetime
import pickle
from random import choices
import matplotlib.pyplot as plt
from analyze import draw_plot
from utils.database import session, Rate, Item, Review
from utils.path import TRAIN_DIR
TRAIN_POS_PATH = TRAIN_DIR + '/usefulness_train_pos.pickle'
... |
import numpy as np
def interp(y,length):
xp = np.linspace(0, len(y)-1,num = len(y))
fp = y
x = np.linspace(0, len(y)-1,num = length)
return np.interp(x, xp, fp)
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x));
def pad(data,padding):
pad_data = np.zeros(padding, dtype=data.dtype)
data = np... |
from os import name
from cassandra import ConsistencyLevel
from cassandra import query
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT, Session
from cassandra.policies import DCAwareRoundRobinPolicy, RetryPolicy
from cassandra.query import S... |
from datetime import date, datetime, timezone
from nz_covid19_lit.data_requestor import get_data
from nz_covid19_lit.file_io import load_from_file, save_to_file
def get_date_from_string(datetime_string):
formatted = datetime_string.replace('T', ' ').split(' ')[0]
return date.fromisoformat(formatted)
class N... |
import json
import os
import reprlib
def customize_type(**default_kwargs):
def deco(type_):
type_._custom_default_kwargs = default_kwargs
return type_
return deco
class Config(object):
def __init__(self, config, types=None):
self._cache = {((), None): config}
self._types... |
# Copyright 2022 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 to in writing, ... |
#!/usr/bin/env python
from dae.backends.impala.rsync_helpers import RsyncHelpers
import os
import re
import sys
import argparse
import toml
import subprocess
import logging
logger = logging.getLogger("remote_instance_mirror")
def parse_cli_arguments(argv):
parser = argparse.ArgumentParser(
description="... |
"""
非阻塞式的测试客户端(参数命令行)
usage: client.py [-h] [-t THREADS] [-d DEVICE_ID] host port
positional arguments:
host host ip
port host port
optional arguments:
-h, --help show this help message and exit
-t THREADS, --threads THREADS
thread number
... |
'''
Source: https://code.sololearn.com/cuvVQ9ZJvR5q/#py
I tweaked it and transformed it to Python 3
'''
#!/usr/bin/python
import sys
import socket
import getopt
import threading
import subprocess
# Define global variables
listen = False
command = False
upload = False
execute = ""
target = ""
uploa... |
# SPDX-FileCopyrightText: 2021 Genome Research Ltd.
#
# SPDX-License-Identifier: MIT
from openpyxl import load_workbook
import re
import os
import json
import shutil
from main.model import SubmissionsManifest, SubmissionsSample
from minio import Minio
from minio.error import ResponseError, BucketAlreadyOwnedByYou, Buc... |
import os
import shutil
import pytest
import numpy as np
import tensorflow as tf
import torch
from torch_mimicry.metrics import compute_kid
from torch_mimicry.metrics.inception_model import inception_utils
from torch_mimicry.nets.gan import gan
class ExampleGen(gan.BaseGenerator):
def __init__(self,
... |
#
# Collective Knowledge (classify image using various models such as DNN)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: <NAME>, https://fursin.net
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal da... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License... |
from extensions.vue_backend.messages.DLA_table_data_message import DLA_table_data_request, DLA_table_data_response, \
DLA_set_table_data_request, ColumnHeader
from pyecore.ecore import EReference, EClass
from esdl import esdl
from esdl.processing.ESDLQuantityAndUnits import qau_to_string
from typing import L... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
from __future__ import absolute_import, unicode_literals, division
from oclubs.utils.dates import today, tommorow, next_week, \
DATE_RANGE_MAX
from flask_wtf import FlaskForm
from wtforms import SelectField, SubmitField, RadioField, TextAreaField
from wtforms.field... |
"""
APRON Coefficients
==================
:Author: <NAME>
"""
from _ctypes import Union, Structure, POINTER, byref
from abc import ABCMeta
from copy import deepcopy
from ctypes import c_uint
from enum import IntEnum
from apronpy.cdll import libapron
from apronpy.interval import Interval, PyInterval, PyDoubleInterval,... |
import os
import time
import logging
from filelock import FileLock
from typing import List, Optional, Union
import numpy as np
import torch
from transformers import (
InputExample,
PreTrainedTokenizer,
)
from .task_data_processors import (
task_processors,
task_output_modes
)
from src.utils.misc import... |
from typing import Dict, Any, List, Optional, Union, Tuple
from flask import Response
from hydrus.utils import get_doc, get_api_name, get_hydrus_server_url
def validObject(object_: Dict[str, Any]) -> bool:
"""
Check if the Dict passed in POST is of valid format or not.
(if there's an "@type" key... |
import numpy as np
import collections
import logging
import scipy.signal
import pandas as pd
import os
import re
import json
import matplotlib.pyplot as plt
log = logging.getLogger(__name__)
def read_log(directory):
for f in ['log', 'log.json']:
try:
with open(os.path.join(directory, f)) as l... |
# source:
# https://stackoverflow.com/questions/6620471/fitting-empirical-distribution-to-theoretical-ones-with-scipy-python
import warnings
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.stats as st
from tqdm import tqdm
mpl.rcParams["figure.figsize"] = ... |
from collections import deque
import numpy as np
from sklearn.utils import check_random_state
def ffnn_control_update(env, ffnn, lstm, episode_buffer, gamma,
control_updates_per_transition, verbose=0,
random_state=None):
episodes = random_state.permutation(len(epis... |
# -*- coding: utf-8 -*-
import torch
args_ = None
def parse_arguments():
import argparse
# reinforcement
parser = argparse.ArgumentParser(description='AlphaChess training')
parser.add_argument('--batch_size', default=1024, type=int, help='Batch size for training')
parser.add_argument('--search_batch_size', defau... |
# coding:utf-8
# This file is part of Alkemiems.
#
# Alkemiems is free software: you can redistribute it and/or modify
# it under the terms of the MIT License.
__author__ = '<NAME>'
__version__ = 1.0
__maintainer__ = '<NAME>'
__email__ = "<EMAIL>"
__date__ = '2021/06/10 16:39:37'
from ztml.tools i... |
import re
import struct
from collections import defaultdict
from copy import copy
from binaryninja import (Endianness, LowLevelILOperation, PluginCommand,
RegisterValueType, get_choice_input, log_alert,
log_info)
def read_value(bv, addr, size):
fmt = {1: 'B', 2:... |
from pyquery import PyQuery
import requests
from datetime import timedelta, datetime
class Constants:
postURL = "https://banweb.banner.vt.edu/ssb/prod/HZSKVTSC.P_ProcRequest"
getURL = "https://banweb.banner.vt.edu/ssb/prod/HZSKVTSC.P_DispRequest"
getCommentsURL = "https://banweb.banner.vt.edu/ssb/prod/HZSK... |
import json
import time
import datetime
from twisted.internet import defer, task
from twisted.internet import reactor
from twisted.python.failure import Failure
from utils import calcMean
from exchange import verifyExchanges
from exchanges.gateio.GateIOService import gateio
from exchanges.bitfinex.BitfinexService ... |
# 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 agreed to in... |
#!/usr/bin/env python
import numpy as np
import xgboost as xgb
import matplotlib.pyplot as plt
from scipy.io import loadmat
from scipy.sparse import csr_matrix
import os.path
from pathlib import Path
import sys
import re
import datetime
import itertools
# ------------------------- Model ------------------------------... |
from .logging import ResultLogger
from itertools import product
def findCopies(keyList):
keyEqualities = [a == b for a, b in zip(keyList[1:], keyList)]
return [i + 1 for i, x in enumerate(keyEqualities) if x]
def prettyPrint(wnl):
w, n, letters = wnl
return w + ':' + '/'.join(map(str, [n, len(lette... |
import glob
import tensorflow as tf
from einops import rearrange
from chambers.augmentations import resize
from chambers.data.loader import InterleaveOneshotDataset, InterleaveImageDataset, InterleaveImagesDatasetTensor, \
InterleaveOneshotDatasetTensor
from chambers.data.utils import time_dataset
train_path = "... |
from pathlib import Path
from shutil import disk_usage, copy2
import os
from logging import getLogger
import math
from typing import Union
from typeguard import typechecked
from appdirs import user_cache_dir
from awsimple import __application_name__, __author__, AWSAccess, AWSimpleException
log = getLogger(__applica... |
import os
import shutil
from time import sleep
import csv
'''
This program is written by <NAME> :)
This program will startup when the computer is booted, will check your downloads folder for any updates every 1 min and sort the files in the VIT VTOP format.
Follow the following step to make that happen.
1. Change the... |
# -*- coding: utf-8 -*-
#
# (c) 2016 <NAME> <<EMAIL>>
#
# See LICENSE comming with the source of 'phell' for details.
#
from phell.utils import to_hex, from_hex
class MbrPartition(object):
STATUS_BOOTABLE = from_hex("80")
LBA_SIZE = 512
EMPTY_TYPE = from_hex("00")
FAT12_TYPE = from_hex("01")
FA... |
import re
from typing import Union, Dict
import pandas as pd
from ira.analysis.tools import ohlc_resample
from qlearn.core.data_utils import _get_top_names, detect_data_type, make_dataframe_from_dict
class Resampler:
def __init__(self):
self.start_ = None
self.stop_ = None
def for_range(sel... |
import collections
MENU_TEXT = '''Arithmetic Calculator
Supported operators by MathBot:
Operators Symbol
-------------------------
Tambah +
Kurang -
Kali *
Bagi /
Pangkat ^
Kurung ()
Also support variable assignment, ex:
A = 29.9
Then you can use it like this:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.