text stringlengths 3.07k 22.1k |
|---|
import logging
from collections import OrderedDict
from django import template
from django.urls import reverse
from django.conf import settings
from django.utils.encoding import smart_text
from django.utils.safestring import mark_safe
from django.template import Variable, VariableDoesNotExist, Template
from django.temp... |
"""
MIT License
Copyright (c) 2021-present Aspect1103
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, pub... |
'''
Common Utilities for Genie Clean
'''
# Python
import re
import os
import logging
import json
import importlib
from functools import wraps
# Genie
from genie.libs import clean
from genie.abstract import Lookup
from genie.harness.utils import load_class
from genie.metaparser.util.schemaengine import Schema, Optiona... |
from ipykernel.kernelbase import Kernel
from pexpect import EOF, TIMEOUT, spawn
from tempfile import NamedTemporaryFile
from os import path, fpathconf, fsync
import re
import signal
import traceback
from codecs import open
def readfile(filename):
with open(filename, encoding="utf-8") as f:
return f.read... |
#! /usr/bin/python3.8
"""
@file mib_packet_content_parser.py
@brief Parses the Service Packet Definition files for all variables
@details Used by the Mib Exporter, inherits generic File Parser
"""
import re
from genmib.parserbase.mib_file_list_parser import FileListParser
from genmib.parserbase.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# nghttp2 - HTTP/2 C Library
# Copyright (c) 2012 <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... |
import argparse
from multiprocessing import cpu_count
from os.path import *
import pandas as pd
import os
from pkg_resources import resource_filename
from snakemake import snakemake
from isicle.utils import inchi2key, smi2key, write_string
from isicle import __version__
from isicle import export
from isicle import prep... |
import numpy as np
#import scipy.stats
import random
import sys
import tables
from scipy import sparse
def zscore(mat, return_unzvals=False):
"""Z-scores the rows of [mat] by subtracting off the mean and dividing
by the standard deviation.
If [return_unzvals] is True, a matrix will be returned that can b... |
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fi... |
import logging
import os
import tempfile
import threading
from contextlib import contextmanager
from distutils.dir_util import copy_tree
from funcy import cached_property, retry, suppress, wrap_with
from dvc.compat import fspath
from dvc.config import NoRemoteError, NotDvcRepoError
from dvc.exceptions import (
Ch... |
"""
Watstock's market prediction neural network.
"""
from __future__ import print_function
import time
import datetime
from dateutil.relativedelta import relativedelta
import numpy as np
import math
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers impo... |
#!/usr/bin/env python3
from collections import defaultdict
from gzip import GzipFile
from math import modf
from sys import stderr
from xml.sax import make_parser
from xml.sax.handler import feature_external_ges
from xml.dom import pulldom
cpuClock = 3579545
vdpClock = cpuClock * 6
masterClock = cpuClock * 960
vdpTic... |
"""
This script has been used to compute the Dirichlet results of the paper
Efficient spectral-Galerkin methods for second-order equations using different Chebyshev bases
The results have been computed using Python 3.9 and Shenfun 3.1.1.
The generalized Chebyshev-Tau results are computed with dedalus,
and are as... |
#!/usr/bin/env python
#
# Template for MVVM applications.
#
from __future__ import generators, unicode_literals
import sys
if sys.version_info[0] < 3:
str = unicode
import Tkinter as tkinter
import ttk
import tkFileDialog as filedialog
import tkSimpleDialog as simpledialog
else:
import tkinter
... |
# Project Quex (http://quex.sourceforge.net); License: MIT;
# (C) 2005-2020 <NAME>;
#_______________________________________________________________________________
import quex.input.regular_expression.core as regular_expression
import quex.input.files.mode_option as mode_option
import quex.input.files.... |
import calendar
import os
import re
import urllib
import logging
import time
import datetime
import cloudstorage as gcs
from google.appengine.api import app_identity, mail, users, search
from google.appengine.ext import ndb
from flask import Flask, jsonify, abort, request, make_response, url_for
from entities_def i... |
"""
A collection of functions which test the most basic operations of various services.
"""
from __future__ import absolute_import, unicode_literals
import datetime
import logging
import time
import uuid
from io import BytesIO
import attr
import gevent
import requests
from celery import Celery
from django.conf import... |
import argparse
import os
import json
import numpy as np
import torch
from tqdm import tqdm
from torch.utils.data import DataLoader
from transformers import AutoConfig, AutoTokenizer
from transformers.optimization import AdamW, get_linear_schedule_with_warmup
from utils import set_seed, collate_fn
from prepro import RE... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Classes and functions that support unsupervised clustering
of data using Simulated Annealing (SA) based algorithms
"""
from abc import ABC, abstractmethod
import time
from scipy.spatial.distance import pdist, cdist
import numpy as np
class AbstractCoolingSchedule(ABC... |
"""
Created on 06.06.2018
"""
import random, json, math
from datetime import datetime
from django.http import HttpResponse
from django.shortcuts import render_to_response, redirect
from django.db import connection
from django.utils.cache import patch_response_headers
from core.libs.cache import getCacheEntry, setC... |
"""
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
import services
import sims4.commands
from typing import It... |
import torch
import csv
import hashlib
import os
import tarfile
import logging
import sys
import zipfile
import gzip
from ._download_hooks import _DATASET_DOWNLOAD_MANAGER
from torchtext import _CACHE_DIR
def reporthook(t):
"""
https://github.com/tqdm/tqdm.
"""
last_b = [0]
def inner(b=1, bsize=1... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding: utf-8
# Copyright 2014 Orange
#
# 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
#
# Un... |
#
# BSD 3-Clause License
#
# Copyright (c) 2017 xxxx
# All rights reserved.
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 ... |
import os.path
import pkgutil
import re
import tokenize
import pytest
import streamlink.plugins
import tests.plugins
from streamlink.compat import is_py2
from streamlink.plugin.plugin import Matcher, Plugin
from streamlink.utils.module import load_module
from streamlink_cli.argparser import build_parser
plugins_pat... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import textwrap
from dataclasses import dataclass
from typing import Generic, Optional, Sequence, Type, get_type_hints
from pants.engine.console import Console
from pants.engine.goal impo... |
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from tqdm import trange
import os
from astropy.io import fits
from astropy.table import Table
from astropy.stats import sigma_clipped_stats
from photutils import make_source_mask
from specklepy.io.outfile import Outfile
from specklepy.l... |
from datetime import datetime
import itertools
import json
from django.shortcuts import render
from django.db.models import F, Sum
from django.http import JsonResponse, HttpResponse
from django_tables2 import RequestConfig
from diagnosis.models import AdmissionsByGender, AdmissionsByAge, SurgeryByGender
from diagn... |
import datetime
from django.db import models
from apps.accounts import models as accounts_models
from apps.commons import (
models as commons_models,
constants as commons_constants,
validators as commons_validators,
)
from apps.facility.models import Facility, TestingLab
from fernet_fields import EncryptedC... |
from django.views import View
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse, JsonResponse
from django.views.generic import TemplateView
from tournament.models import *
from tournament.forms import *
from . import constants
from utils import calc_rating_change, par... |
# 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, Version 2.0 (the
# "License"); you may not u... |
# pylint:disable=unsupported-assignment-operation
# pylint:disable=unsubscriptable-object
"""Module containing different I/O functions to load data recorded by Withings Sleep Analyzer."""
import datetime
import re
from ast import literal_eval
from pathlib import Path
from typing import Dict, Optional, Sequence, Union
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import bisect
import io
import logging
import six
from os.path import splitext
from flask import current_app
from mongoengine.fields import BaseField
from werkzeug.datastructures import FileStorage
from .files import extension
from .images import make_... |
import numpy as np
from scipy.stats import norm
from scipy import stats
counter = 0
class AcquisitionFunction(object):
"""
An object to compute the acquisition functions.
"""
def __init__(self, acq):
self.acq=acq
acq_name=acq['name']
L... |
# Built on top of the original implementation at https://github.com/ArrowLuo/CLIP4Clip
#
# Modifications by Copyright 2022 Zilliz. 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 Li... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------... |
'''
https://raw.githubusercontent.com/xcq1/ark-moddodo
'''
import arkit
import sys
import os
import argparse
import shutil
import subprocess
from collections import OrderedDict
import struct
from paths import *
from linux_utils import run_shell_command_as_user
from debug import get_logger
log = get_logger("moddodo"... |
import collections
from enum import Enum
from vtypes import (
VString,
VInt,
VBool,
VUnsignedInt,
VDict,
VValidatorDict,
VList,
VDate,
VDateTime,
VTime,
VEnum,
Validator,
)
class Props(object):
@classmethod
def _attrs(cls):
return [name for name in dir(... |
import json
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_leaflet as dl
import settings
from dash.dependencies import Output, Input
# Mapbox setup
mapbox_url = "https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{{z}}/{{x}}/{{y}}{{r}}?access_token={access_token}"
mapbo... |
"""
== score_entities.py
Script to calculate scores for events and timexes, both for the extents and the
attributes. Prints the counts and the calculated statistics to the standard output.
== usage
% python score_extents.py tokens extent_key extent_res attr_key attribute_res
tokens the base-segmen... |
#!/usr/bin/env python3
import json
import time
import urllib.request
import requests
import bs4
from bs4 import BeautifulSoup
from datetime import datetime
import os.path
from os import path
class Image(object):
url = ''
width = ''
height = ''
def __init__(self, data):
self.__dict__ = json.lo... |
# Copyright 2020, The TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
"""
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,
software distribut... |
"""Bounding boxes transformation functions."""
from __future__ import division
import copy
import numpy as np
import random
from utils.bbox import bbox_iou
__all__ = ['random_crop_with_constraints', 'crop', 'flip', 'resize', 'translate']
def random_crop_with_constraints(bboxs, size, min_scale=0.3, max_scale=1,
... |
"""schema.py: Functions for working with Energistics schema definitions.
To run as a script, set the following 3 environment variables and a file will be created with rst-format tables
listing the elements for each obj_* class:
EML_SCHEMA_SPECIFIC_DIR: directory containing main xsd files for the schema
EML_SC... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import six
import validators
from girder import events, logprint, logger
from girder.api import access
from girder.api.describe import Description, describeRoute, autoDescribeRoute
from girder.api.rest import \
boundHandler, loadmodel, RestException
from girder.consta... |
# Copyright 2019 The PlaNet 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim :set ft=py:
import struct
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import blosc
from six import PY3, integer_types, binary_type
from .abstract_objects import (MutableMappingObject,
... |
#Import modules
import arcpy, os, sys, shutil, glob, zipfile, csv
from arcpy.sa import *
import natcap.invest.fisheries.fisheries
arcpy.env.overwriteOutput = True
workspace_dir = arcpy.env.scratchFolder
def isLicensed():
"""Set whether tool is licensed to execute."""
try:
if arcpy.CheckExtension("Spatial") == "Av... |
import cv2
import mediapipe as mp
import time
import tkinter
from KeyboardControl import keyboardControl
from PositionDetect import positionDetector
class handDetector():
def __init__(self, mode = False, maxHands = 1, detectionConf = 0.6, trackConf = 0.7):
self.mpHands = mp.solutions.hands
self.han... |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under GPLv2 license
# scapy.contrib.description = Message Queuing Telemetry Transport (MQTT)
# scapy.contrib.status = loads
from scapy.packet import Packet, bind_la... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
This script contains two classes used for iterating chips in the dataset:
- LandsatDataset: reads one chip at a time from tiles in disk (so very slow)
- SingleShardChipsDataset:
"""
import logging
import math
import os
from random import shuf... |
import dataclasses
import torch
import torch.nn as nn
import torch.nn.functional as F
@dataclasses.dataclass
class Node:
inp: any
module: nn.Module
activated: bool
stride: int
dim: int
def __hash__(self):
return hash(self.module)
class NetFactory(nn.Module):
def __init__(self):
super().__in... |
import logging
from django import forms
from django.contrib import admin, messages
from django.contrib.admin import ModelAdmin, SimpleListFilter, widgets
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Group
from django.forms import Form
from django.template.response import Templ... |
from typing import Callable, Tuple
import numpy as np
from numpy.typing import ArrayLike
try:
import cupy as cp
import cusignal
NO_CUPY = False
except ImportError:
NO_CUPY = True
import scipy.signal
import scipy.fft
def direct_ambiguity(
delay_bins: ArrayLike,
doppler_bins: ArrayLike,
s... |
#!/usr/bin/env python3
"""Reddit Bot that provides downloadable links for v.redd.it videos"""
import os
import re
import urllib.parse
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
import praw
import requests
import yaml
from praw.models import Comment, Message
def load_con... |
#!/usr/bin/env python3
"""benchmark_plot.py
Usage:
benchmark_plot.py -a ALGORITHM [-b BACKENDS...] -g GEOMETRY -i INPUT... [-n] [-e] [-t TITLE] [-o OUTPUT_FILE]
benchmark_plot.py (-h | --help)
Options:
-h --help Show this screen.
-a ALGORITHM --algo ALGORITHM Algorithm ['constructi... |
import numpy as np
import pandas as pd
from scipy.spatial import Delaunay
from scipy.spatial.distance import cdist
from sklearn.linear_model import RANSACRegressor, LinearRegression
import ops.utils
def find_triangles(df):
v, c = get_vectors(df[['i', 'j']].values)
return (pd.concat([
pd.DataFrame(v).... |
import json
import os
from pathlib import Path
import shutil
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from attr import dataclass
@dataclass
class PropertyInfo:
Name: str
Type: Optional[str]
Pattern: Optional[str]
UnderlyingDataType: Optional[s... |
from __future__ import absolute_import, print_function, unicode_literals
import json
import logging
from wolframclient.evaluation.base import WolframAsyncEvaluator
from wolframclient.evaluation.cloud.asyncoauth import (
OAuth1AIOHttpAsyncSession as OAuthAsyncSession,
)
from wolframclient.evaluation.cloud.asyncoau... |
import board # basic definitions
import digitalio
import time
import neopixel # for neopixels
import random
import math
# my routines that are set up for ease of use and consistency
import local
# Color definitions
RED = local.gammaCorrectPixel((255, 0, 0))
YELLOW = local.gammaCorrectPixel((255, 255, 0))
GRE... |
# This file is part of beets.
# Copyright 2014, <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, ... |
#!/usr/bin/python
import os
import cli.app
import cli.log
import logging
import re
from math import floor
from multiprocessing import Pool, Process, cpu_count
from time import sleep
from os import walk
from os import path
from zipfile import ZipFile
from shutil import copy2
from natsort import natsorted
from reportlab... |
import pytest
from praw.models import (Button, ButtonWidget, Calendar, CommunityList,
CustomWidget, Menu, MenuLink, IDCard, Image,
ImageData, ImageWidget, ModeratorsWidget, Redditor,
RulesWidget, Submenu, Subreddit, TextArea, Widget)
from ... i... |
import os
from datetime import datetime, timezone
from sqlalchemy.schema import Index
from typing import Optional
from swagger_server.database.db import db
from swagger_server.database.models.mixins import BaseMixin, TimestampMixin
class EmailAddresses(BaseMixin, db.Model):
"""
EmailAddresses - from COmanage... |
#!/usr/bin/env python
import os,sys
from optparse import OptionParser
import time
import fastq
import preprocesser
from multiprocessing import Process, Queue
import copy
from util import *
AFTERQC_VERSION = "0.9.6"
def parseCommand():
usage = "Automatic Filtering, Trimming, Error Removing and Quality Control for... |
import argparse
import tensorflow as tf
import opennmt as onmt
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--model_dir", default="model",
help="Checkpoint directory.")
# Step 1
parser.add_argument("--src", required=True, ... |
from __future__ import annotations
from librespot import util
from librespot.crypto import Packet
from librespot.proto import Mercury_pb2 as Mercury, Pubsub_pb2 as Pubsub
from librespot.structure import Closeable, PacketsReceiver, SubListener
import io
import json
import logging
import queue
import struct
import thread... |
import json
import requests
import pickle
from bs4 import BeautifulSoup
import re
import time
#LINK OPEN APIs => https://github.com/public-apis/public-apis#jobs
#LINK API => https://jobs.github.com/api
base_url_github_jobs = "https://jobs.github.com/positions.json?"
#If it is the first time running the script, set ... |
import math
import os
import pdb
import random
import time
from collections import OrderedDict
import utils.net as net_utils
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import torchvision.models as models
import torchvision.models... |
# Copyright 2021 The KubeEdge Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
from pathlib import Path
import os
import sys
import io
import errno
import subprocess
import shutil
import shlex
from pkg_resources import resource_filename
import appdirs
import yaml
from .util import (
mkdir_p,
create_symlink,
resolve_path,
resolve_path_pathlib,
jsondump,
to_string,
... |
from django.conf import settings
from django.db import connection, models, transaction
from django.utils.translation import ugettext_lazy as _
from .classification import Classification
from .structural_element import StructuralElement
class FunctionQuerySet(models.QuerySet):
def latest_version(self):
re... |
import numpy as np
from numpy.linalg import inv
from numpy import random
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
"""
Simple Kalman filter
Initialise the filter
Args:
X: State estimate
P: Estimate covariance
A: State transition model
B: Control matrix
M: Control vect... |
import random
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import spacy
from utils import translate_sentence, bleu, save_checkpoint, load_checkpoint
from torch.utils.tensorboard import SummaryWriter # to print to tensorboard
from torchtext.datasets import Multi30k
from torchtext.da... |
def disassemble_script(inp, ip_reg):
r_names = ['A', 'B', 'C', 'D', 'E', 'F']
r_names[ip_reg] = 'IP'
for n, line in enumerate(inp):
op, *params = line.split()
a, b, c = map(int, params)
print(f'{n:>2}: ', end='')
if op == 'addr':
print(f'{op} {r_names[a]} + {r_nam... |
#
# Copyright 2016 Cluster Labs, 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 ... |
# -*- coding: utf-8 -*-
# <NAME>
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import matplotlib
# Fijamos la semilla, la volveré a fijar en algunas ocasiones
np.random.seed(1)
def simula_unif(N, dim, rango):
return np.random.uniform(rango[0],rango[1],(N,dim))
d... |
import os
import cv2
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
import tensorflow as tf
from tensorflow.keras.applications import InceptionResNetV2, VGG16
from tensorflow.keras.models import Sequential, Model
from tensorflow.ker... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from collections import defaultdict
from dateutil import rrule
from django.conf import settings
from django.db import connection
... |
# -*- coding: utf-8 -*-
__author__ = 'spacegoing'
import numpy as np
import cv2
from matplotlib import pyplot as plt
class GMM:
'''
This class is a python version of part of (GMM) opencv grabcut.cpp
(opencv/modules/imgproc/src/grabcut.cpp)
Magic numbers in __init__ are:
modelSize = 1 + 3 + 9 # c... |
import numpy as np
from keras import backend as K
from util.pose_utils import keys_to_stack, stack_by_keys, pose_index
class BaseGenerator(object):
""" A generator that dynamically creates batches from a list of N examples. """
def __init__(self, N, batch_size, create_y):
"""
Para... |
#!/usr/bin/env python3
# modified from https://github.com/apache/singa/blob/master/examples/cnn/train_cnn.py
import time
from datetime import datetime
import numpy as np
from PIL import Image
from singa import device, opt, tensor
from tqdm import tqdm
import os
from ..proto.utils import parseargs
from .app import Cl... |
import hashlib
from django.test import Client, TestCase, override_settings
from django.urls import resolve, reverse
from .models import DLC, Author, Liaison
from .views import LiaisonList
@override_settings(LOGIN_REQUIRED=False)
class LiaisonCreateViewTests(TestCase):
fixtures = ['testdata.yaml']
def setUp... |
"""
General utilities.
"""
import functools
import numpy as np
import pandas as pd
def parse_engine(engine):
"""
Choose the best engine available and check if it's valid.
Parameters
----------
engine : str
The name of the engine. If ``"auto"`` will favor numba if it's available.
Ret... |
# Copyright (c) 2021 Graphcore Ltd. 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 ... |
import matplotlib
matplotlib.use('Agg')
import spectral_gap_analysis as sp
import numpy as np
from matplotlib import pyplot as plt
import noise_generator as gen
import sync_generator as sync
import burer_monteiro as bm
def landscape(A, z, max_radius):
"""
Computes differences between function values and predi... |
## Plotting Libraries
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
import copy
import numpy as np
from gurobipy import *
def to_numpy(gurobi_variable):
temp = [gurobi_variable[i].x for i in gurobi_variable.keys()]
return np.asarray(temp)
def MasterProblem(horizon=20, init... |
from scipy.stats import lognorm
import numpy as np
def all_true(logical_list):
try:
logical_list[2]
return logical_list[0] and all_true(logical_list[1:])
except IndexError:
return logical_list[0] and logical_list[1]
class MarkovRenewalProcess():
""" Markov renewal process
- t... |
######################################################
#
# Utility functions
#
######################################################
import numpy as np
from sklearn.metrics import mean_squared_error
import copy
from numpy.linalg import qr as qr
def unnormalize(arr, mean, std):
return arr *std + mean
... |
#!/usr/bin/env python
import os
import sys
import copy
import os
import time
import gc
import numpy as np
from .. import Group, ValidateLarchPlugin
from ..utils import OrderedDict
from ..utils.strutils import bytes2str
from . import XDIFile, XDIFileException
from .xsp3_hdf5 import XSPRESS3_TAUS, estimate_icr
@Vali... |
#!/usr/bin/env python3
import sys
from math import ceil
import mrcc.kmer_mutation_formulas_thm5 as thm5
import mrcc.hypergeometric_slicer as hgslicer
from scipy.optimize import brentq, fsolve, newton
from scipy.stats import norm as scipy_norm
from numpy import sqrt
import argparse
from matplotlib import pyplot as plt
... |
"""This module holds OAuth Provider profiles"""
import logging
import re
from flask import abort, flash, g, redirect, request, session, url_for, jsonify, make_response
from flask_appbuilder._compat import as_unicode
from flask_appbuilder.security.sqla import models as ab_models
from flask_appbuilder.security.views im... |
""" This rule will download an archive from Minio, Google Storage, S3 or
Backblaze, check sha256, extract it, and symlink the provided BUILD file
inside. """
# License: Apache 2.0
# Provenance: https://github.com/1e100/cloud_archive
def validate_checksum(repo_ctx, url, local_path, expected_sha256):
# Verify check... |
from django.http import HttpResponseNotFound, HttpResponseServerError, JsonResponse, HttpResponseForbidden
import django
from web.models import *
from web.utils import incr_view_star, get_visitor_subscribe_feeds, get_user_subscribe_feeds, get_login_user, \
add_user_sub_feeds, del_user_sub_feed, get_user_unread_cou... |
from typing import Any, List, Optional, Sequence, Union
import numpy as np
from ..argument_utility import (
ActionScalerArg,
AugmentationArg,
EncoderArg,
ScalerArg,
UseGPUArg,
check_augmentation,
check_encoder,
check_use_gpu,
)
from ..augmentation import AugmentationPipeline
from ..con... |
# cd /mnt/c/workspace/quantum_calc
# python3 test_tsp.py
from dimod import *
import numpy as np
import matplotlib.pyplot as plt
import random
import math
from dwave_qbsolv import QBSolv
from dwave.system.samplers import *
from dwave.system.composites import EmbeddingComposite
### プロキシを通す ###
# https... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, empress development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import argparse
from datetime import datetime, timedelta
import logging
from logging.handlers import RotatingFileHandler
import time
import sys
from bs4 import BeautifulSoup
import dateutil.parser
import requests
from utils import get_max_case_date, upsert_record, CASE_TYPES
from utils_details import parse_details
#... |
import random
from Game.Corak.dicio import salas, U, R, L, D, mapSize, rules
class keep():
def __init__(S, sala, at):
S.sala = sala
S.at = at
S.type = 1
keeper.append(S)
def hall(Do, obj):
out = 0
if Do[2] == "clear": clearall()
if Do[2] == "strt": out = strt()
if "g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.