text stringlengths 3.07k 22.1k |
|---|
import numpy as np
from .qnumber import is_qsparse
__all__ = ['retained_bond_indices', 'split_matrix_svd', 'qr']
def retained_bond_indices(s, tol):
"""
Indices of retained singular values based on given tolerance.
"""
w = np.linalg.norm(s)
if w == 0:
return np.array([], dtype=int)
# ... |
import logging
from openeye import oechem, oeszybki, oeomega
from torsion.utils.process_sd_data import get_sd_data, has_sd_data
from torsion.dihedral import get_dihedral
TORSION_LIBRARY = [
'[C,N,c:1][NX3:2][C:3](=[O])[C,N,c,O:4] 0 180', # amides are flipped cis and trans
'[#1:1][NX3H:2][C:3... |
# -*- coding: utf-8 -*-
from django.conf import settings # @Reimport
from django.contrib import messages
from .. import models
from . import import_base
from .. import utils
from django.db import transaction
class Csv_unicode_reader_ope_base(import_base.Property_ope_base, utils.Csv_unicode_reader):
pass
cla... |
import os
import math
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement, ElementTree
from xml.dom import minidom
import shutil
import cv2
def is_exist_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def prettify(elem):
"""Return a pretty-printed XML stri... |
from dsn.s_expr.structure import TreeText
from dsn.s_expr.clef import BecomeNode, TextBecome, Insert, Replace, Delete
from spacetime import st_become, st_insert, st_replace, st_delete
from collections import namedtuple
from list_operations import l_become, l_insert, l_delete, l_replace
from historiography import Hist... |
import pickle
from collections import Counter
from math import log
from typing import List, Dict, Tuple
import numpy as np
from scipy.sparse import csr_matrix
from scipy.spatial.distance import cosine
from common import check_data_set, flatten_nested_iterables
from preprocessors.configs import PreProcessingConfigs
fr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 21 11:05:24 2017
The oil and sugar separation (pretreatment) section for the baseline lipid cane biorefinery is defined here as System objects. The systems include all streams and units starting from enzyme treatment to purification of the sugar sol... |
# -*- coding: utf-8 -*-
import json
"""
This module responsibility is for reading and setting elements of the json templates in memory.
"""
def set_template_pool_id(in_memory_json_object: str, pool_id: str):
"""
Finds the poolName or poolId inside the in_memory_json_object and sets the value based on the poo... |
import numpy as np
from phi import struct
from phi.math.math_util import is_static_shape
# creates normal distributed noise that can vary over the batch
def generateNoise(grid, var, mean=0, seed=0, dtype=np.float32):
size = grid.data.shape
rand = np.random.RandomState(seed)
def array(shape):
result... |
#!/usr/bin/env python
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... |
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.db.models import Q
from django.http import JsonResponse
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, permissions
from rest_framework.authtoken.models import Token
fr... |
import pygame
from pygame.locals import *
import random
from res import Unit
from utils import KeyWrapper, Tick, RGBs
from settings import *
from core.effect import Effect, Dodge
class UnitRole(object):
Player = "player"
Enemy = "zoobie"
Bullet = "bullet"
class Stamina(Tick):
stock = 1
def __ini... |
from pyparsing import *
from functools import reduce
import pyparsing
pyparsing.ParserElement.enablePackrat()
X, Y = 0, 1
## TODO: design this out
COLORMAP = {
'F.Cu' : '#e18335',
'F.Fab': '#819595',
'F.SilkS': '#e4cc37',
'F.CrtYd': '#8fc93a',
'B.Cu' : '#0072bb',
'B.Fab': '#564d4a',
'B.Si... |
## imports
import os
import sys
import numpy as np
import cv2
import logging
import imutils
from matplotlib import pyplot as plt
from pathlib import Path
from pylab import array, plot, show, axis, arange, figure, uint8
# setup logger
logger = logging.getLogger(__name__)
# https://www.pyimagesearch.com/2014/08/25/... |
#! /usr/bin/env python
"""
Aegean Residual (AeRes) has the following capability:
- convert a catalogue into an image model
- subtract image model from image
- write model and residual files
"""
__author__ = "<NAME>"
import logging
import numpy as np
from astropy.io import fits
from AegeanTools import catalogs, fittin... |
"""This module contains functions related to generating and comparing the time order
of CRDS file names. Different projects have different naming conventions.
"""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from crds import python23
import os
import ... |
from tkinter import *
from math import *
from random import randrange
import random
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from random import randrange
haut =50 #hauteur du tableau
larg =50 #largeur du tableau
cote =10 #dimension d'une case... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
import unittest
import pyslow5 as slow5
import time
import numpy as np
"""
Run from root dir of repo after making pyslow5
python3 -m unittest -v python/test.py
"""
#globals
debug = 0 #TODO: make this an argument with -v
class TestBase(unittest.TestCase):
def setUp(self):
self.s5 = slow5.Open('e... |
import argparse
import xml.etree.ElementTree as ET
import zipfile
from pathlib import Path
import sys
import pymap3d
import shapely.geometry as SHP
from descartes.patch import PolygonPatch
from matplotlib import pyplot as plt
from matplotlib.collections import PatchCollection, LineCollection
from shapely.geometry impor... |
import csv
import os
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
from path import Path
from vector_math import *
from find_matches import *
from file_paths import *
#********************
#**** this function reads a CSV file and returns a header, and a list that has been converted to fl... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import re
import shutil
sys.path.append("..")
from utils.baiducloud import *
from utils.common import *
from tqdm import tqdm
from datetime import timedelta
live_id = 'zard'
danmu_merge_cloud_root_path = 'danmu_merge'
danmu_merge_local_root_path = os.path.abspath... |
"""
run.py
Run TF-IDF Debater and generate debater data for the given debate option.
"""
from pytorch_pretrained_bert.tokenization import BertTokenizer, BasicTokenizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.metrics.pairwise import cosine_similarity
import argparse
import json
import... |
# 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, softwa... |
from tkinter import *
from datetime import datetime
import sqlite3
root = Tk()
root.title("Symptom-Medication Database")
root.geometry("400x600")
#Create A Database
conn = sqlite3.connect('symptom-med.db')
#Create a Cursor:
c = conn.cursor()
def save():
#Connect To Database
conn = sqlite3.connect('s... |
"""
Module to plot a pie chart for the profiled sections of the code.
TODO: Fix legend box size conflict. Make font of legends smaller.
https://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend
TODO: Create several charts instead of hierarchic pie charts..
"""
import os
import pickle
import numpy as np... |
from __future__ import absolute_import, unicode_literals
import datetime
from decimal import Decimal
import mock
import pytz
from temba_client.v2.types import Contact as TembaContact
from django.test.utils import override_settings
from django.utils import timezone
from tracpro.contacts.models import ChangeType
fr... |
# -*- coding: utf-8 -*-
from datetime import timedelta
from pyramid.security import Allow
from schematics.exceptions import ValidationError
from schematics.transforms import whitelist
from schematics.types import (
BooleanType,
DateType,
IntType,
MD5Type,
StringType,
)
from schematics.types.compound... |
"""
Created on Sat May 23 18:17:31 2020
celebx = 'CC1=CC=C(C=C1)C2=CC(=NN2C3=CC=C(C=C3)S(=O)(=O)N)C(F)(F)F'
tiotixene = 'CN1CCN(CC1)CCC=C2C3=CC=CC=C3SC4=C2C=C(C=C4)S(=O)(=O)N(C)C'
Troglitazone = 'CC1=C(C2=C(CCC(O2)(C)COC3=CC=C(C=C3)CC4C(=O)NC(=O)S4)C(=C1O)C)C'
@author: akshat
"""
import selfies
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 15:44:58 2018
@author: joachim
"""
import os
import re
import yaml
import logging
import warnings
from tunacell.io.text import (TextParsingError, MissingFileError,
MissingFolderError, MismatchFileError,
... |
# -*- coding: utf-8 -*-
"""Main module. Launch by running python -m rest_uploader.cli"""
import os
import shutil
import tempfile
import platform
import time
import mimetypes
import json
import requests
import csv
from tabulate import tabulate
from watchdog.observers import Observer
from watchdog.events import FileSys... |
"""
Copyright 2020 InfAI (CC SES)
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... |
import random
from time import sleep
from celery import chain, chord, shared_task, states
from django.core.files.base import ContentFile
from django.db import transaction
from django.utils import timezone
from eulxml import xmlmap
from extras.tasks import CurrentUserTaskMixin
from ows_client.request_builder import Cat... |
from pddlgym.parser import PDDLDomainParser, PDDLProblemParser
from pddlgym.structs import LiteralConjunction
import pddlgym
import os
import numpy as np
from itertools import count
np.random.seed(0)
PDDLDIR = os.path.join(os.path.dirname(pddlgym.__file__), "pddl")
I, G, W, P, X, H = range(6)
TRAIN_GRID1 = np.arra... |
import os
import random
from typing import Union
from copy import deepcopy as dcp
rd=lambda l:random.choice(list(l))
exts={
'':[''],
'archive':['archive'],
'qwq':['qwq','qwq1','qwq2','qwq3','qwq4','bmp'],
'pic':['png','jpg','jpeg','bmp','tif','tiff','gif',],
'gif':['gif'],
'tar':... |
import codecs
from contextlib import suppress
import logging
import os
from pathlib import Path
from typing import Union
import tempfile
_LOGGER = logging.getLogger(__name__)
def ensure_unique_string(preferred_string, current_strings):
test_string = preferred_string
current_strings_set = set(current_strings... |
"""Library of functions used to work with netbox.
"""
import pynetbox
import os
# Common mappings for device types and roles
device_roles = {
"CSR1000v": "router",
"ASAv": "firewall",
"NX-OSv 9000": "switch",
"IOSvL2": "switch",
"OTHER": "other",
}
# Constants for Interface Form Factor IDs
FF_100... |
from collections import defaultdict
import math
import copy
import inspect
import itertools as it
# representation for our graph of transactions
# u ---w---> v means: u owes v the amount of w dollars
class Graph:
def __init__(self, vertices, balances={}):
self.vertices = vertices
self.graph = defaultdict(l... |
import asyncio
import threading
import time
import os
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colors
from matplotlib.ticker import PercentFormatter
import plotly.plotly as py
import pandas as pd
from dquant.scripts.basic_units import cm, inch
import copy
curPath = os.path.abspath(os.p... |
from bench_db import get_timings_by_id
from bench_graphs import do_warmup_plot
num_iter = 7
color_copy_by_ref = 'green'
name = 'native-'
def warmup_all_plots():
warmup_plot_fannkuch()
warmup_plot_spectralnorm()
warmup_plot_bintree()
def warmup_plot_fannkuch():
ids = [
100 # fannkuchredux-... |
""" Python Obit SpectrumFit class
Class for fitting spectra to image pixels
This class does least squares fitting of log(s) as a polynomial in log($\nu$).
Either an image cube or a set of single plane images at arbitrary
frequencies may be fitted.
Model: S = S_0 exp (alpha*ln(nu/nu_0) + beta*ln(nu/nu_0)**2+...)
The r... |
# MIT License
# This project is a software package to automate the performance tracking of the HPC algorithms
# Copyright (c) 2021. <NAME>, <NAME>, <NAME>, <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to ... |
from math import sqrt, log
from random import shuffle
from artificial_idiot.util.misc import randint
class Node:
"""A node in a search tree. Contains a pointer to the parent (the node
that this is a successor of) and to the actual state for this node. Note
that if a state is arrived at by two paths, then ... |
import numpy as np
import scipy.signal
from gym.spaces import Box, Discrete
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
from torch.distributions.categorical import Categorical
def initialize_weights_he(m):
if isinstance(m, nn.Linear) or isinstan... |
# !/usr/bin/env python3
import os
import xlsxwriter
servers = [61, 62, 63, 64, 66, 67, 68, 69, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52]
storage1 = [236, 237, 238, 239, 240, 241, 242, 243]
storage2 = [101, 102, 103, 104, 105, 106, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126... |
# -*- coding: utf-8 -*-
# original implementations of the methods below are
# Copyright © 2001-2017 Python Software Foundation; All Rights Reserved
# they are licensed under the PSF LICENSE AGREEMENT FOR PYTHON 3.5.4
# changes were applied to allow these methods to deal with ansi color escape codes. These changes are... |
#!/usr/bin/env python3
"""
Unit tests for ShoulderBird command line module
To run these tests from command line use the following:
$ python -m pytest -v testes/test_module_shoulderbirdcli.py
Author : Preocts <<EMAIL>>
Discord : Preocts#8196
Git Repo: https://github.com/Preocts/Egg_Bot
"""
from typing import Name... |
import argparse
import cv2
import numpy as np
import torch
from models.with_mobilenet import PoseEstimationWithMobileNet
from modules.keypoints import extract_keypoints, group_keypoints
from modules.load_state import load_state
from modules.pose import Pose, track_poses
from val import normalize, pad_width
import ti... |
'''
Abstraction of machine learning model
Authors: <NAME>, <NAME>
'''
import os
import multiprocessing
import logging
import warnings
import itertools
import numpy as np
import scipy as sp
from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.linear_model import SGDClassifier
from sklea... |
from .base_object import BaseGtfsObjectCollection
from ..utils.validating import not_none_or_empty
class Route(object):
def __init__(self, transit_data, route_id, route_short_name, route_long_name, route_type, agency_id,
route_desc=None, route_url=None, route_color=None, route_text_color=None, ro... |
import pendulum
import pytest
import prefect.schedules.filters as filters
def test_on_datetime_0():
filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2, 3, 4, 5))
assert filter_fn(pendulum.datetime(2019, 1, 2, 3, 4, 5))
def test_on_datetime_1():
filter_fn = filters.on_datetime(pendulum.datetim... |
import numpy as np
from PIL import Image
from scipy.ndimage.morphology import binary_erosion
from improc3d import quantile_scale, calc_bbox3d
from .utils import MIN_UINT8, MAX_UINT8
from .utils import assign_colors, compose_image_and_labels
class ImageRenderer:
"""Renders slices from a 3D image using PIL.
N... |
import curses
import json
import os
import string
import sys
import threading
import time
import websocket
from websocket import WebSocketException as WSException
from maps import Map, ChunkMap
from chunks import ChunkDiff, jsonify_diffs, dejsonify_diffs
from utils import Position
from clientchunkpool import ClientChu... |
from __future__ import print_function
import copy
from inspect import isclass, isfunction
import attr
import yaml
from attr.validators import optional, instance_of
from jira.resources import Resource, Issue, Worklog
from prettytable import PrettyTable
from .common import iso_to_ctime_str, friendly_worklog_time, iso_... |
# Copyright (c) 2019 <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, merge, publish, distribute, ... |
from ctypes import windll
from os import system
from queue import Queue
from random import choices, choice
from string import ascii_letters, digits
from threading import Thread
from time import sleep
from colorama import Fore, init
from requests import get
from yaml import full_load
init()
default_values... |
# gemato: Profile behavior tests
# vim:fileencoding=utf-8
# (c) 2017-2020 <NAME>
# Licensed under the terms of 2-clause BSD license
import itertools
import os
import os.path
import pytest
import gemato.cli
from gemato.profile import (
EbuildRepositoryProfile,
BackwardsCompatEbuildRepositoryProfile,
)
fro... |
"""
@file
@brief Simple simulation of an epidemic. It makes a couple of assumption
on how the disease is transmitted and its effect on a person. The user
can specify many parameters.
"""
import random
import copy
import os
from collections import Counter
from pyquickhelper.loghelper import noLOG
from ..helpers.pygame_h... |
import os
import sys
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torchlibrosa.stft import Spectrogram, LogmelFilterBank
from torchlibrosa.augmentation import SpecAugmentation
from pytorch_utils import do_mixup
def ini... |
"""Smart tasks set timers to turn on/off lights in various ways.
> Currently supporting wake up
SmartTask # return top level info
TaskControl # Change top level values
StartAction # Get top level info on start action
StartActionItem # Get info on specific device in task
StartActionItemCont... |
import random
from typing import List
import NeuralNetwork as nn
import os
import multiprocessing as mp
import threading as thrd
import pickle
import time
class Cards:
def __init__(self):
self.cards = []
for _ in range(4):
temp = random.sample(range(8), 8)
for ... |
"""Test mysensors messages."""
import pytest
import voluptuous as vol
from mysensors import Gateway, Message, get_const, Sensor
from mysensors.const_14 import Internal, MessageType
PRES_FIXTURES_14 = {
'S_DOOR': 'Front Door',
'S_ARDUINO_NODE': '1.4',
'S_ARDUINO_RELAY': '1.4',
}
PRES_FIXTURES_15 = {
'... |
# ------------------------------------------------------------------------------
# Recurrence
# ------------------------------------------------------------------------------
# Somewhat based upon RFC 5545 RRules, implemented using dateutil.rrule
# Does not support timezones ... and probably never will
# Does not suppo... |
"""This module is used for Plotting the loss and accuracy curve."""
import numpy as np
import plotly.graph_objects as go
from plotly import offline
def scatter_plotly_keras(history_dict=None, title=None, filename=None,
plot_loss=True):
"""使用 Keras 模型输出的训练字典,画出损失值和准确度的折线图。
"""... |
"""
Zabbix Monitoring for Elasticsearch
"""
import json
import sys
import logging
import argparse
from distutils.util import strtobool
import configparser
from collections import MutableMapping
from elasticsearch import Elasticsearch, exceptions
import urllib3
def parse_conf(argv=None):
"""Read configuration pa... |
#!/usr/bin/env python3
#
# entry_points.py
"""
Parser and emitter for ``entry_points.txt``.
.. note::
The functions in this module will only parse well-formed ``entry_points.txt`` files,
and may return unexpected values if passed malformed input.
"""
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# Permission is hereby... |
#Some codes are adopted from https://github.com/DCASE-REPO/DESED_task
import torch
import numpy as np
import random
def frame_shift(features, label=None, net_pooling=None):
if label is not None:
batch_size, _, _ = features.shape
shifted_feature = []
shifted_label = []
for idx in ra... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 <NAME> <<EMAIL>>
#
# Distributed under terms of the BSD 3-Clause license.
"""Basic operations on Zotero's SQLite database.
Functions in this module are those related to reading data from SQLite database.
"""
# standard libraries
from ... |
from flask import Blueprint, make_response, url_for
from portality import util
from portality.core import app
from portality import models
from portality.lib import dates
import json, requests, math, os, time
from datetime import datetime
blueprint = Blueprint('status', __name__)
@blueprint.route('/stats')
@util.jso... |
import inspect
import logging
import os
import pickle
import cloudpickle
from quake.client.base.task import make_input, new_py_task
from quake.client.job import _set_rank
from quake.common.layout import Layout
from quake.job.config import JobConfiguration
from .glob import get_global_plan, get_inout_obj, set_inout_ob... |
import torch
import torch.nn as nn
import torch.nn.functional as F
def dcgan(inp=2,
ndf=32,
num_ups=4, need_sigmoid=True, need_bias=True, pad='zero', upsample_mode='nearest', need_convT = True):
layers= [nn.ConvTranspose2d(inp, ndf, kernel_size=3, stride=1, padding=0, bias=False),... |
from tkinter import *
import win32gui
import subprocess
import adjustScreen
from pynput import keyboard
class App():
# class var
x=y=0
width= 100
height= 100
hwnd = win32gui.GetForegroundWindow()
lst = ['Click to see App List']
state = 1
# constructor
def __init__(self):
self.root = Tk()
self.root.over... |
import os
import argparse
import csv
import pickle
import logging
import multiprocessing
import subprocess
import autosklearn.classification
import pandas as pd
from ml_utils import load_polya_seq_df, map_clvs, compare, KARBOR_FEATURE_COLS
from kleat.misc.cluster import cluster_clv_sites
from kleat.misc.utils import... |
import json
import os
import random
import numpy as np
from math import ceil
import bottle
from bottle import HTTPResponse
# import time
from timeit import default_timer as timer
from grid_data_maker import *
from util_fns import *
# my_moves
delta = [[-1, 0], # go up
[0, -1], # go left
[1, 0], #... |
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
import pytest # type: ignore
from looker_sdk import methods, models
from henry.modules import exceptions, fetcher
@pytest.fixture(name="fc")
def initialize() -> fetcher.Fetcher:
"""Returns an instance of fetcher"""
options = fetcher.Input(... |
"""Workspace rules (Nixpkgs)"""
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_package",
)
def haskell_nixpkgs_package(
name,
attribute_path,
nix_file_deps = [],
repositories = {},
build_file_content = None,
... |
# Copyright (C) 2022 viraelin
# License: MIT
from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6.QtGui import *
# todo: bug when showing again if color is black/white/gray
class ColorPicker(QWidget):
color_changed = pyqtSignal(str)
def __init__(self, parent=None, color=QColor(Qt.GlobalColor.... |
################################################################################
# Copyright (c) 2020 ContinualAI #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
import sys
import time
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from util_torch import graphs_re,choice_by_prob,gumbel_softmax,graphs_threshold
class GNN_Block(nn.Module):
def __init__(self,input_size,output_size,gn... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Provides a non-parametric two-stage least squares instrumental variable estimator."""
import numpy as np
from copy import deepcopy
from sklearn import clone
from sklearn.linear_model import LinearRegression
from ...utilit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0321,C0103,C0301,E1101,C0303,E1004,C0330,R0915,R0914,W0703,C0326
"""
SchemaMap
Used to map solr fields to more common user names and vice versa
2020.0106.1 - First version
Notes:
2020-03-13 - Added Body to USER2SOLR_MAP as a standalone item, in case... |
import io
from enum import Enum
from contextlib import closing
import csv
import requests
import zipfile
from linalgo.annotate.models import Annotation, Annotator, Corpus, Document, \
Entity, Task
class AssignmentType(Enum):
REVIEW = 'R'
LABEL = 'A'
class AssignmentStatus(Enum):
ASSIGNED = 'A'
... |
import cmd
from asm_dicts import reg_dict
commands = [
'START',
'RESET',
'MODE',
'STEP',
'LOAD',
'REQ'
]
mode_commands = [
'GET',
'SET_CONT',
'SET_STEP'
]
load_commands = [
'INSTR',
'FILE'
]
req_commands = [
'MEM_DATA',
'MEM_INSTR',
'REG',
'REG_PC',
'LA... |
import pandas
import matplotlib.pyplot as plt
from ETF import get_split_name_and_isin, get_combined_name_and_isin
from pypfopt import expected_returns, risk_models, plotting, discrete_allocation
from pypfopt.efficient_frontier import EfficientFrontier
import base64
import io
import numpy as np
import math
from timeit i... |
""" Unit tests for ``wheezy.validation.model``.
"""
import unittest
from datetime import date, datetime, time
from decimal import Decimal
from wheezy.validation.model import (
bool_value_provider,
boolean_true_values,
bytes_value_provider,
date_value_provider,
datetime_value_provider,
float_va... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
#
from vnc_api.vnc_api import *
from kube_manager.vnc.config_db import *
import uuid
LOG = logging.getLogger(__name__)
class ServiceLbManager(object):
def __init__(self, vnc_lib=None, logger=None):
self._vnc_lib = vnc_lib
self.l... |
import open3d as o3d
import numpy as np
import sys, os
import matplotlib.pyplot as plt
import cv2
import torch
import glob
import copy
import mathutils
from PIL import Image
from pytorch3d.loss import chamfer_distance
from tk3dv.nocstools.aligning import estimateSimilarityUmeyama
import math
from tqdm import tqdm
def ... |
import unittest
import warnings
from gmplot.utility import StringIO, _format_LatLng
from gmplot.writer import _Writer
from gmplot.drawables.route import _Route
from gmplot.google_map_plotter import GoogleMapPlotter
class GMPlotTest(unittest.TestCase):
def test_format_LatLng(self):
self.assertEqual(_format_... |
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Reports binary size metrics for LaCrOS build artifacts.
More information at //docs/speed/binary_size/metrics.md.
"""
import argpars... |
#!/usr/bin/python3
# raspberry pi nrf24l01 hub
# more details at http://blog.riyas.org
# Credits to python port of nrf24l01, <NAME> & maniacbugs original c library
import time
from time import gmtime, strftime, sleep
import paho.mqtt.client as mqtt
import threading
import queue
import logging
import os, struct, anyco... |
from pydantic import BaseModel
from typing import List
example_chapters_list = [
{
"chapter_number": 1,
"name": "अर्जुनविषादयोग",
"name_translation": "<NAME>",
"name_transliterated": "<NAME>",
"name_meaning": "Arjuna's Dilemma",
"chapter_summary": "The first chapter of the Bhag... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 23 10:49:26 2019
@author: fg010
"""
#%%
from __future__ import print_function,absolute_import, division, print_function, unicode_literals
import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2... |
#%%
import tensorflow as tf
import tensorflow.keras as K
from tensorflow.keras import layers
#%%
class ConvLayer(K.layers.Layer):
def __init__(self, filter_size, kernel_size, strides, name="ConvLayer", **kwargs):
super(ConvLayer, self).__init__(name=name, **kwargs)
self.conv2d = layers.Conv2D(filter... |
"""
Create a ClearML Monitoring Service that posts alerts on Slack Channel groups based on some logic
Creating a new Slack Bot (Allegro ClearML Bot):
1. Login to your Slack account
2. Go to https://api.slack.com/apps/new
3. Give the new App a name (For example "Allegro Train Bot") and select your workspace
4. Press Cr... |
"""
Created on Mon Feb 1 22:41:45 2021
@author: anvaari
"""
import telebot
from flask import Flask,request
import os
from urllib.parse import quote as urldecode
from datetime import datetime as dt
from jdatetime import datetime as jdt
from dateutil import tz
from ics import Event,Calendar
def evligen(title,s... |
import sys
import os
import argparse
import re
from glob import glob
instructions = """
To use:
python3 SRTTimeShifter.py filename seconds (options)
Takes the given subtitle file or files, in SRT format,
and shifts the times in each by the given number of seconds.
For time, use decimals, not frames (e.g. 2.5 seconds... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import pytest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from fido2.ctap import CtapError
from fido2.utils import hmac_sha256, sha256
from tests.utils import FidoRequest, shannon_entropy, verify
def get_salt_params(cipher, sha... |
__version__ = "0.3"
from random import choice
import pygame
class Game:
"""The game class."""
def __init__(self, width, height, game_rect=(0, 0, 328, 328)):
# Init the display
self.width, self.height = width, height
self.game_rect = game_rect
self.screen = pygame.display.set... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.