text stringlengths 3.07k 12.6k |
|---|
from django.utils.translation import ugettext_lazy as _
class Constants(object):
# Experiments
UNFINISHED = 0
COMPLETED = 1
EXPERIMENT_STATUS = (
(UNFINISHED, _('unfinished')),
(COMPLETED, _('completed')),
)
# Game
PRISONERS_DILEMMA = 'PD'
PUBLIC_GOODS_GAME = 'PGG'
... |
# Copyright 2010 <NAME>
# Copyright 2011 Nebula, 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... |
import logging
import sys
import threading
import multiprocessing
import queue as threading_Queue
import Arknights.helper
import config
import connector
from connector.ADBConnector import ADBConnector, ensure_adb_alive
from util.excutil import format_exception
from typing import Mapping
config.background = True
logge... |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
# ==========================================================================
# Copyright (C) 2016 Dr. <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 ... |
# Schedule.py
# <NAME> 20150318
# This file maintains synchronicity between the F2F meeting calendar and a Google calendar derived from it.
# The entries in the Google Calendar are marked with "autoGen", which appears as a "category" when viewed by
# thunderbird/sunbird. Other entries in the calendar not so marked... |
"""
Supporting code for the paper
"On the cross-validation bias due to unsupervised pre-processing" by <NAME> and <NAME>.
https://arxiv.org/abs/1901.08974v4
This module contains the simulation and plotting routines used to generate the results on the superconductivity
dataset, Figure 2, Section "4.2. Experiments o... |
import math
import time
########################
# CODE BY PYJAVAPULVER #
# COPYRIGHT 2019 #
########################
class colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\... |
#!/usr/bin/env python3
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2018
# [+] International Business Machines Corp.
#
#
# 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 Lic... |
# ------------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2019-2021 ThatRedKite
#
# 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 with... |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (C) 2014 Bokeh Development Team
#
# The license is in the LICENCE.txt, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
from butterphy import read_ti_adc, read_rx_input
from dragonphy import *
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
class AdcModel:
def __init__(self, N_bit =8, full_scale_range=1, signed=False):
self.signed = signed
self.N_bit = N_bit
self.f... |
import unittest
import sys
from pymarc.field import Field
class FieldTest(unittest.TestCase):
def setUp(self):
self.field = Field(
tag = '245',
indicators = [ 0, 1 ],
subfields = [
'a', 'Huckleberry Finn: ',
'b', 'An American Odyssey'
... |
import keras
import math
import numpy as np
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.layers.normalization import BatchNormalization
from keras.layers import Conv2D, Dense, Input, add, Activation, GlobalAveragePooling2D
from keras.layers import Lambda,... |
# The view is where you declare the logic.
from datetime import datetime
from .models import (
BomFile, BomItem, MastFile, MastItem, InvFile, InvItem, ItemMasterFile,
ItemMaster, Report, ReportItem, ReportPeriod
)
from .serializers import (
BomFileSerializer,
BomItemSerializer,
MastFileSerializer,
... |
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# 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/lice... |
# -*- coding: utf-8 -*-
# Copyright 2021 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... |
"""Support for Pioneer Network Receivers."""
import logging
import telnetlib
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_PAUSE,
SUPPORT_PLAY,
SUPPORT_SELECT_SOURCE,
SUPPO... |
# Copyright 2014 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.
"""
Function/method decorators that provide timeout and retry logic.
"""
import functools
import itertools
import logging
import sys
import six
from devil.... |
"""
sentry.tagstore.v2.models.tagvalue
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2017 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import six
from django.db import models, router, connections
from django.ut... |
# 导入所需模块
from cv2 import cv2
from matplotlib import pyplot as plt
import os
import numpy as np
import util
SZ = 20 # 训练图片长宽
MAX_WIDTH = 1000 # 原始图片最大宽度
Min_Area = 2000 # 车牌区域允许最大面积
PROVINCE_START = 1000
# 图像预处理
def img_preprocess(car_pic_file):
"""
:param car_pic_file: 图像文件
:return:已经处理好的图像文件 原图像文件
... |
# Python script of the samples of numpy
# Author: <NAME>
# Location: Learn By Insight
# Github: https://github.com/samewara/python-examples/blob/master/numpy-basic.py
# #####################################
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# ## NUMPY ... |
"""Parser for HA BLE (DIY sensors) advertisements"""
import logging
import struct
_LOGGER = logging.getLogger(__name__)
def to_int(value):
"""Convert to integer"""
return value & 0xFF
def unsigned_to_signed(unsigned, size):
"""Convert unsigned to signed"""
if (unsigned & (1 << size - 1)) != 0:
... |
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
from os.path import basename
from types import SimpleNamespace
from typing import (Any, Final, Iterable, List, Literal, Optional, Sequence,
TypedDict, cast)
import argparse
import asyncio
import logging
import sys
from aiohttp import TraceConfig
from ai... |
# Import Modules
from flask import Flask, render_template
from flask_socketio import SocketIO, emit
import numpy as np
import requests
from datetime import datetime
from fbprophet import Prophet
import pandas as pd
from helper_v4 import forecastr,determine_timeframe,get_summary_stats,validate_model,preprocessing
impor... |
"""Temporal difference trainer."""
import collections
import lzma
import pickle
import gin
import numpy as np
from alpacka import data
from alpacka.trainers import base
from alpacka.trainers import replay_buffers
TDTargetData = collections.namedtuple(
'TDTargetData', ['cum_reward', 'bootstrap_obs', 'bootstrap_g... |
import cv2
from PIL import Image
import numpy as np
import os
import time
import torch
from torch import nn
# from torchvision.models import resnet50
import torchvision.transforms as T
from hubconf import detr_resnet50, detr_resnet50_panoptic ,_make_detr
import ssl
import matplotlib.pyplot as plt
from models.detr im... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import nltk
from nltk.stem import WordNetLemmatizer
import zipfile
import pandas as pd
import numpy as np
import pickle
from collections import Counter
import gzip
import random
import sklearn
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from nltk.metric... |
import re
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.layers import Layer
from tensorflow.python.keras.preprocessing.sequence import pad_sequences
from nltk.corpus import stopwords
from gensim.models import KeyedVectors
import gensim
import pdb
import numpy as np
import itertools
de... |
from __future__ import absolute_import
__all__ = ("Http",)
import re
import six
from django.utils.translation import ugettext as _
from django.utils.http import urlencode
from six.moves.urllib.parse import parse_qsl
from sentry.interfaces.base import Interface, prune_empty_keys
from sentry.utils import json
from se... |
# coding=utf-8
# Copyright 2018 The TensorFlow 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 requi... |
import re
import requests
import urllib
from StringIO import StringIO
from urlparse import urlparse, urlunparse, urljoin
from tldextract import extract
from bs4 import BeautifulSoup
from PIL import Image
HTTPS_PROXY_URL = None
OG_PAGE_CHECK_TIMEOUT = 5
OG_IMAGE_CHECK_TIMEOUT = 5
OG_FAVICON_CHECK_TIMEOUT = 2
URL_SCH... |
import os
import io
import json
import hashlib
import re
import sqlite3
from datetime import datetime
from pathlib import Path
from .common import ClientError
def generate_checksum(file, chunk_size=4096):
"""
Generate checksum for file from chunks.
:param file: file to calculate checksum
:param chunk... |
from ..textbuf import Text
def test_initially_empty():
assert not Text().text
def test_can_initialize_text():
text = 'Playing again'
buf = Text(text)
assert buf.text == text
assert buf.position == len(text)
def test_can_set_text():
text = 'Playing'
new_text = 'Playing again'
buf ... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2019, 2020, 2021, 2022 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Engine-Serial utilities."""
import logging
import os
from... |
import torch
from tqdm import tqdm
def get_bbox(image_id, target, device='cpu', pred=False):
"""
image_id (int): image id from annotation.
target (dict): target data from annotation or result of model inference.
device (string): use CUDA of CPU.
pred (bool): if True, result include ... |
import datetime
import itertools
import time
from collections import defaultdict
from typing import Any, Dict, Mapping, Sequence, Set
from django.utils.timezone import now as timezone_now
from zerver.lib.timestamp import datetime_to_timestamp
from zerver.models import PushDeviceToken, Realm, UserPresence, UserProfile... |
import numpy as np
import re
import cv2
import sys
import os
""" check the filename path can be loaded"""
def data_load_check(data_path, filenames_file):
print ('load {} and {}'.format(data_path, filenames_file))
with open(filenames_file) as f:
lines = f.readlines()
split_line = [l.rstrip().spl... |
import glob
from collections import defaultdict
from io import StringIO
from pathlib import Path
import click
import ruamel.yaml
from toposort import toposort_flatten
yaml = ruamel.yaml.YAML()
yaml.indent(mapping=2, sequence=4, offset=2)
yaml.width = 4096 # or some other big enough value to prevent line-wrap
def y... |
"""
In this script we have functions that calculate the spectral norm for different keras layers.
Specifically we can calculate the spectral norm of
1) convolutional
2) locally connected layers
. This is a difficult problem as the full operators are huge sparse matrices.
"""
import numpy as np
from keras.callbacks imp... |
import argparse
import os
import sys
import json
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
from tqdm import tqdm
output_path = 'experiment_plots'
if not os.path.exists(output_path):
os.makedirs(output_path)
cross_entropy_key = 'hateful_memes/cross_entropy'
train_cross_entropy = f'trai... |
# coding=utf-8
# Copyright 2019 The TensorFlow Datasets 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 appl... |
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.application"
__author__ = "<NAME>"
__all__ = ["LocalApp"]
import abc
import copy
from os import chdir, getcwd, remove
from .application import ... |
import logging
import time
import numpy as np
import re
from qulab.device import BaseDriver
from .AlazarTechWrapper import (AlazarTechDigitizer, AutoDMA, DMABufferArray,
configure,initialize)
from .exception import AlazarTechError
log = logging.getLogger('qulab.Driver')
def getSamp... |
import csv
import inspect
import sys
from argparse import RawTextHelpFormatter
from datetime import datetime
from dateutil.relativedelta import relativedelta
from django.core.management.base import BaseCommand
from corehq.apps.users.models import CouchUser
from corehq.util.argparse_types import validate_range
from cu... |
import copy
from abc import abstractmethod
import numpy as np
from pymoo.model.callback import Callback
from pymoo.model.evaluator import Evaluator
from pymoo.model.individual import Individual
from pymoo.model.population import Population
from pymoo.model.result import Result
from pymoo.util.function_loader import F... |
#!/bin/env python3
# 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
# ... |
import torch
import cv2
from tqdm import tqdm
# Project imports
from utils import *
from options import TestOptions
from data_loaders import create_dataloader
from methods import BaseMethod
class Tester:
"""
Tests the performance of models in saved_models//
Initialize the trainer using a set of ... |
import sys,os
curr_path = os.path.dirname(os.path.abspath(__file__)) # 当前文件所在绝对路径
parent_path = os.path.dirname(curr_path) # 父路径
sys.path.append(parent_path) # 添加路径到系统路径
import gym
import torch
import numpy as np
import datetime
from common.utils import plot_rewards
from common.utils import save_results,make_dir
from ... |
import time
import json
from ipaddress import ip_address, ip_network, IPv4Address
import requests
import numpy as np
import pandas as pd
from .cipaddresses import find_subnet_key, check_ip
def find_subnets(ip_list: list, existing_subnets: dict = None) -> dict:
"""
given a list of IP Addresses, call an availa... |
import os
import json
import re
from jinja2 import Template
from jinja2 import FileSystemLoader
from jinja2.environment import Environment
def to_c_macro(name):
macro = re.sub('\W', '_', name)
macro = macro + ('_' if macro[0].isdigit() else '')
return macro.upper()
class SIGModel(object):
def __init... |
import os
import tempfile
import path
import functools
from itertools import islice
import pandas as pd
import numpy as np
from trumania.core.random_generators import SequencialGenerator, NumpyRandomGenerator, ConstantGenerator, seed_provider
from trumania.core.random_generators import DependentTriggerGenerator, Fake... |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Red Hat, 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... |
from getpass import getpass
import json
import glob
import os
from pathlib import Path
from typing import Union
try:
import pytest
except ImportError:
pytest = None
from aids.app.client import AIDScrapper, ClubClient, HoloClient, bs4
import aids.to_html as to_html
from aids.app.settings import BASE_DIR, secre... |
import os
import visdom
import torch
import imageio
from .logger import loggerConfig
from collections import namedtuple
import torch.optim as optim
import yaml
class Params:
def __init__(
self,
verbose: int,
machine: str = "machine",
timestamp: str = "",
visualize: bool =... |
"""UniFi sensor platform tests."""
from collections import deque
from copy import deepcopy
from asynctest import patch
from homeassistant import config_entries
from homeassistant.components import unifi
from homeassistant.components.unifi.const import (
CONF_CONTROLLER,
CONF_SITE_ID,
CONTROLLER_ID as CONF... |
import random
from tqdm import tqdm
import numpy as np
from PIL import ImageFilter
import torch
import torchvision
from sklearn.linear_model import LogisticRegression
from . import pytorch_utils as ptu
# standard imagenet stats
imagenet_mean = [0.485, 0.456, 0.406]
imagenet_std = [0.229, 0.224, 0.225]
def accu... |
# -*- coding: utf-8 -*-
"""
rnn
model built with tensorflow for constructing standard Recurrent Neural Network
(RNN) and Long Short-Term Memory (LSTM)
"""
import tensorflow as tf
class _BaseRNN(object):
"""base class recurrent neural network"""
def __init__(self, step_size, state_size, num_classes):
... |
# Copyright (c) 2015 <NAME>. All rights reserved.
# Copyright (c) 2015 <NAME>. All rights reserved.
# Copyright (c) 2015 <NAME>. 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... |
"""
Handle labels
"""
from lib.amech_io import parser
from routines.pf.models.typ import need_fake_wells
def make_pes_label_dct(rxn_lst, pes_idx, spc_dct, spc_model_dct):
""" Builds a dictionary that matches the mechanism name to the labels used
in the MESS input and output files for the whole PES
... |
__author__ = 'breddels'
import pathlib
import logging
from glob import glob as local_glob
import os
import re
import sys
from urllib.parse import parse_qs
import vaex.file.cache
normal_open = open
logger = logging.getLogger("vaex.file")
class FileProxy:
'''Wraps a file object, giving it a name a dup() method
... |
from bs4 import BeautifulSoup
import imagesize
import requests
import json
def my_range(start, end, step):
while start <= end:
yield start
start += step
'''TXT Variables'''
na = "N/A"
datasetPath = "D:/Pedras/"
'''
VALUES VARIABLES
rockname - <NAME>
rock_class - Class da Pedra
color - Cor da Pe... |
# Copyright 2021 The TensorFlow 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... |
from __future__ import absolute_import
from __future__ import division
import unittest
import pandas as pd
from collections import Counter
from mock import MagicMock
import pyspark.sql
from pyspark.sql import Row
from affirm.model_interpretation.shparkley.spark_shapley import (
compute_shapley_score,
compute_sh... |
"""
In this experiments, we analyze the fitting properties of the CKConv parameterization.
In particular we ask the following question:
Which kind of functions are we able to fit via continuous kernels?
"""
# general
import os
import wandb
import ml_collections
import sys
import matplotlib.pyplot as plt
import copy
... |
#!/usr/bin/env python3
'''
This file creates MK Landscapes based on command line configuration,
and outputs them to a directory of your choice. For a listing
of functionality, run ./make_mk.py --help
'''
import random
import math
import sys
from os import path
######## These are the function row creators ############... |
#!/usr/bin/env python3
#
# Copyright 2019 Trend Micro and contributors.
#
# 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 ... |
import tempfile
import os
import inspect
import subprocess
import dill
import re
from neurokernel.mixins import LoggerMixin
def mpi_run(func, targets=None, delete_tempfile=True, log=False,
log_screen=False, log_file_name='neurokernel.log'):
"""
Run a function with mpiexec.
Implemented as ... |
"""
Copyright (C) 2018 Intel Corporation
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 numpy as np
from scipy.ndimage.filters import maximum_filter
def check_common_points(kpts, mask):
idx_valid_points = []
for idx, ktp in enumerate(kpts):
if mask[int(round(ktp[0])), int(round(ktp[1]))]:
idx_valid_points.append(idx)
return np.asarray(idx_valid_points)
def sel... |
"""
A lightweight Captcha API made with Flask. This version is a new, fast and completely rewritten API,
originally by Vixen, which was discontinued.
The website is located at https://captchaAPI.pythonanywhere.com/
License: MIT
"""
# Standard library imports
import secrets
import datetime
import base64
from typing i... |
import os
import time
import json
import boto3
import logging
from datetime import date, datetime
from botocore.client import Config
# Load environment variables
sma_id = os.environ["SMA_ID"]
forwarding_table_name = os.environ["CallForwardingTableName"]
# Setup DynamoDB & Chime interface clients
client_config = Confi... |
"""Real-Time Fluid Dynamics for Games by <NAME> (2003).
Parts of author's work are also protected
under U. S. patent #6,266,071 B1 [Patent].
"""
def set_bnd(N, b, x):
"""We assume that the fluid is contained in a box with solid walls.
No flow should exit the walls. This simply means that the horizontal
... |
"""Generic importer and source code fixer for Python 2.4 and 2.5.
Users shouldn't import it directly.
"""
import sys
import re
import os
import os.path
import sys
# The code in this file has no SyntaxError in Python >=2.4 (and Python 3)
# though.
if not (2, 4) <= sys.version_info[:2] < (2, 6):
sys.exit(
'fa... |
import glob
import os
import re
from importlib import import_module
from unwind.models.meta import MigrateMeta
from malibu.util import log
from malibu.util.decorators import function_marker, function_registrator
modules = glob.glob(os.path.dirname(__file__) + "/*.py")
__all__ = [os.path.basename(f)[:-3] for f in mo... |
#! /usr/bin/env python
# encoding: utf-8
# <NAME> (UCLA), 2014
"""
Enable precompiled C++ header support (currently only clang++ and g++ are supported)
To use this tool, wscript should look like:
def options(opt):
opt.load('pch')
# This will add `--with-pch` configure option.
# Unless --with-pch during config... |
'''
Unit tests for mir_eval.segment
'''
import numpy as np
import json
import mir_eval
import glob
import warnings
import nose.tools
A_TOL = 1e-12
# Path to the fixture files
REF_GLOB = 'data/segment/ref*.lab'
EST_GLOB = 'data/segment/est*.lab'
SCORES_GLOB = 'data/segment/output*.json'
def __unit_test_boundary_fun... |
import logging
import os
import threading
import yaml
MULTITHREADING = True
lock = threading.Lock()
class SingletonDecorator:
def __init__(self, klass):
self.klass = klass
self.instance = None
def __call__(self, *args, **kwds):
if self.instance is None:
self.instance = s... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2014 <NAME>
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpo... |
# Copyright (c) 2016 Ansible by Red Hat, Inc.
#
# This file is part of Ansible Tower, but depends on code imported from Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... |
# -*- coding: utf-8 -*-
#
# This file is part of Flask-Wiki
# Copyright (C) 2020 RERO
#
# Flask-Wiki is free software; you can redistribute it and/or modify
# it under the terms of the Revised BSD License; see LICENSE file for
# more details.
"""Views to respond to HTTP requests."""
import glob
import os
from functoo... |
from blacklist import BLACKLIST
from src.db import db
from datetime import timedelta
from src.utility import AccessLevel
from flask_restful import Resource, reqparse
from flask_jwt_extended import (create_access_token, create_refresh_token,
fresh_jwt_required, get_jwt_claims,
... |
#!/usr/bin/env python3
from __future__ import with_statement
import argparse
import os
import errno
from fuse import FUSE, FuseOSError, Operations
from logger import logs, init_logging
from injector import inject, init_injector
from gpt import parse_gpt, READS
class Passthrough(Operations):
def __init__(self, ... |
"""
OpenVINO Profiler
Docker image-related logic
Copyright (c) 2021 Intel Corporation
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
Unles... |
from enum import IntEnum, IntFlag
from PIL import Image, ImageDraw
from .Texture2DConverter import get_image_from_texture2d
from ..enums import ClassIDType, SpritePackingMode, SpritePackingRotation
from ..streams import EndianBinaryReader
def get_image(sprite, texture, alpha_texture) -> Image:
if (
alph... |
#
# 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
# ... |
import os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np
class Graph:
def __init__(self, figure=None, axes=None, fig_size=None, dpi=None):
self.figure = plt.figure(figsize=fig_size, dpi=dpi) if figure is None else figure
self.axes = self.figure.add_subplot(1... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
import logging
import re
from copy import copy
from typing import Optional
import xlsxwriter
from RISparser import readris
from RISparser.config import TAG_KEY_MAPPING
from . import utils
class RisImporter:
@classmethod
def get_mapping(cls):
mapping = copy(TAG_KEY_MAPPING)
mapping.update(
... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from abc import ABC
from typing import List, Union
from azure.ai.ml.constants import SearchSpace, TYPE
from azure.ai.ml.entities._mixins ... |
import urllib.request
import codecs
import re
from datetime import date
from os import listdir
def mop_listing_pages(startURL = "http://www.daft.ie/ireland/houses-for-rent/",
count = -1):
"""Save all listing pages to disk
Keyword Arguments:
startURL -- Page urllib
count -- A c... |
import axi
import random
import numpy as np
def horizontal_lines():
paths = []
# horizontal lines
for i in range(4):
y = 1 / 8 + i / 4
paths.append([(0, y), (1, y)])
# horizontal lines
for i in range(4):
x = 1 / 8 + i / 4
paths.append([(x, 0), (x, 1 / 8)])
p... |
"""
@author: <NAME>
@contact: <EMAIL>
"""
from enum import Enum
import numpy as np # type: ignore
from radiantkit.channel import ImageGrayScale
from radiantkit.image import Image, ImageBinary, offset2
from radiantkit import stat
from scipy.ndimage.morphology import distance_transform_edt # type: ignore
from scipy.nd... |
# Imports
import torch
from torch import nn
from torch.utils.data import DataLoader, SubsetRandomSampler, TensorDataset
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import random
from sklearn.model_selection import train_test_split, KFold
from sklearn.metrics import classification_rep... |
import requests
import datetime
import fnmatch
import re
import logging
import subprocess
import os
import sys
from github import Github, Label
REPO_NAME = 'AOSC-Dev/aosc-os-abbs'
TARGET_LABEL = 'security'
AFTER_DATE = datetime.datetime(2019, 11, 6, 0, 0, 0)
TOKEN = os.getenv('TOKEN')
CVE_PATTERN = r'(?:\*\*)?CVE IDs:... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import numpy as np
from abc import abstractmethod
from alifebook_lib.simulators import VehicleSimulator
class SubsumptionModule(object):
def __init__(self):
super(SubsumptionModule, self)._... |
# Copyright (c) 2015 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
#
# Unless required by applicable... |
# Copyright 2020 Jigsaw Operations 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 i... |
"""
The Pytorch2Keras converter module over JIT-trace.
"""
import torch
import torch.jit
import torch.autograd
import torch.serialization
import contextlib
from torch.jit import _unique_state_dict
from .layers import AVAILABLE_CONVERTERS
@contextlib.contextmanager
def set_training(model, mode):
"""
A contex... |
from itertools import groupby
from PIL import Image
Image.MAX_IMAGE_PIXELS = 1000000000
import axi
import math
import numpy as np
import sys
LNG1 = -125
LNG2 = -100
LAT1 = 49
LAT2 = 31
WIDTH = 13
HEIGHT = 8.5
LANDSCAPE = True
ROWS = LAT1 - LAT2
if not LANDSCAPE:
WIDTH, HEIGHT = HEIGHT, WIDTH
def remove_flats... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.