text stringlengths 2 999k |
|---|
"""backendAPI URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import (QByteArray, QPointF, QRectF, QTimer,
pyqtProperty, pyqtSlot)
from PyQt5.QtGui import QPainter
from PyQt5.QtSvg import QSvgRenderer
import os
import sys
class QLedWidget(QWidget):
'''LED indicator
...
Inherits
---... |
"""app/components/base
Abstract base class for components
#! candidate for moving into utils/components
"""
from typing import List, Dict, Any, Union
from abc import ABC
from dash import Dash
from dash.development.base_component import ComponentMeta
from dash_html_components import Div
from penn_chime.parameters i... |
from dynamodb_tutorial_python import __version__
def test_version():
assert __version__ == '0.1.0'
|
a=list(map(int,input().split()))
b=list(map(int,input().split()))
f=0
for i in range(3):
if a[i]<b[i]:f+=(a[i]-b[i])
print(abs(f))
|
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
# Copyright (c) Dietmar Wolz.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory.
import math
import os
import sys
from numpy.random import Generator, MT19937, SeedSequence
from scipy.optimize import OptimizeResult, Bounds
import multiprocessing as mp
from multipro... |
import cv2
import numpy as np
import time
import math
from picamera.array import PiRGBArray
from picamera
import RPi.GPIO as GPIO
from CameraLED import CameraLED
# https://github.com/ArduCAM/RPI_Motorized_IRCut_Control
# https://github.com/BigNerd95/CameraLED
led = CameraLED() # CameraLED(134)
led.off() # Night vision ... |
# pylint: disable=all
"""Bokeh forestplot."""
from collections import defaultdict, OrderedDict
from itertools import cycle, tee
import bokeh.plotting as bkp
import matplotlib.pyplot as plt
import numpy as np
from bokeh.layouts import gridplot
from bokeh.models import Band, ColumnDataSource
from bokeh.models.annotation... |
# This file is generated by objective.metadata
#
# Last update: Sun Jul 11 21:53:01 2021
#
# flake8: noqa
import objc, sys
if sys.maxsize > 2 ** 32:
def sel32or64(a, b):
return b
else:
def sel32or64(a, b):
return a
if objc.arch == "arm64":
def selAorI(a, b):
return a
else:
... |
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2013 California Institute of Technology. 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... |
import numpy as np
from numpy import linalg as la
class cylinder: # Класс, описывающий цилиндр
def __init__(self, o, a, b, c):
# o - центр основания, a, b - оси эллпса, c - центральная ось цилиндра
self.o = o
self.a = a
self.b = b
self.c = c
def check(self): # Проверк... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
''' Nose test generators
Need function load / save / roundtrip tests
'''
from __future__ import division, print_function, absolute_import
import os
from os.path import join as pjoin, dirname
from glob import glob
from io import BytesIO
from tempfile import mkdtemp
fro... |
"""
编写一个程序,通过已填充的空格来解决数独问题。
一个数独的解法需遵循如下规则:
数字 1-9 在每一行只能出现一次。
数字 1-9 在每一列只能出现一次。
数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。
空白格用 '.' 表示。
一个数独。
答案被标成红色。
Note:
给定的数独序列只包含数字 1-9 和字符 '.' 。
你可以假设给定的数独只有唯一解。
给定数独永远是 9x9 形式的。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/sudoku-solver
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处... |
import pandas
data_feat = pandas.read_csv('features_results.csv')
data_class = pandas.read_csv('class_results.csv')
print('\nSelect K best Comparison:\n')
print(data_feat)
print('\n\nClassifiers Comparison:\n')
print(data_class)
|
def count_bytes(binary_data):
"""Return the length of a string a string of bytes.
Should raise TypeError if binary_data is not a bytes string.
"""
if not isinstance(binary_data, bytes):
raise TypeError("expected bytes, got %s" % type(binary_data))
return len(binary_data)
def text_in_byte... |
"""Auto-generated file, do not edit by hand. EH metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_EH = PhoneMetadata(id='EH', country_code=212, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[5-9]\\d{8}', possible_number_pattern='\... |
# -*- coding: utf-8 -*-
#
# Image and annotations preprocessing for lightnet networks
# The image transformations work with both Pillow and OpenCV images
# The annotation transformations work with brambox.annotations.Annotation objects
# Copyright EAVISE
#
import random
import collections
import logging
import... |
import io
import os
import sys
import json
import tokenize
from pyswahili.sw_to_en import dictionary
class PySwahili(object):
def __init__(self, filename=""):
if filename:
self.swahili_code = filename
self.sw_to_en = dictionary
def load_python_code(self) -> str:
try:
... |
#!/usr/bin/env python
# Copyright 2015, Yahoo Inc.
# Licensed under the terms of the Apache License, Version 2.0. See the LICENSE file associated with the project for terms.
import os
import json
from setuptools import setup
# Package Metadata filename
METADATA_FILENAME = 'lopq/package_metadata.json'
BASEPATH = os.p... |
#! /usr/bin/env python3
"""
Put a number of random messages in a Kafka topic
Put in topic topic 'one'(*) 1000(*) random messages of size 100(*) with id starting at 0(*).
The first 10 bytes of the message is the id in hex.
(*) Can be overwritten with command line parameters:
[topic [messagecount [messagesize [sta... |
import os
from setuptools import find_packages, setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
return [line.strip()
for line in open(os.path.join(os.path.dirname(__file__), fname))]
setup(
name='mwviews',
version='0.1.... |
#
# 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 us... |
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from spark_auto_mapper_fhir.fhir_types.list import FhirList
from spark_auto_mapper_fhir.fhir_types.integer import FhirInteger
from spark_auto_mapper_fhir.fhir_types.string import FhirString
from spark_auto_mapper_fhir.extensions.extension_ba... |
# coding: utf-8
"""
CLOUD API
IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and ... |
from aocd import get_data
def simulate(a, part2=False):
p = a.copy()
ip = 0
i = 0
while True:
if not 0 <= ip < len(p):
return i
prev_ip = ip
ip = ip + p[ip]
p[prev_ip] += 1 if not part2 or p[prev_ip] < 3 else -1
i += 1
def part1(a):
return simu... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-03-15 22:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('finders', '0024_auto_20200306_1051'),
]
operations = [
migrations.RenameField(
... |
import albumentations as A
from albumentations.pytorch import ToTensorV2
import cv2
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import RandomSampler, SequentialSampler, WeightedRandomSampler
from torch.utils.data.distributed import DistributedSampler
from torch.nn.utils.... |
import glob,os,re,shutil,tempfile
from functools import reduce
def sorted_number_split(html_base, assetdir, ext):
assetfiles = glob.glob(f"{html_base}{assetdir}/*.{ext}")
filenames = map(os.path.basename, assetfiles)
numberfiles = filter(lambda line: re.match(re.compile(f"[0-9]+\.{ext}"), line), fi... |
#!/usr/bin/python
import sys
import random
if len(sys.argv) < 2:
print ('Usage:<filename> <k> [nfold = 5]')
exit(0)
random.seed( 10 )
k = int( sys.argv[2] )
if len(sys.argv) > 3:
nfold = int( sys.argv[3] )
else:
nfold = 5
fi = open( sys.argv[1], 'r' )
ftr = open( sys.argv[1]+'.train', 'w' )
fte = op... |
from enum import Enum
class Params(Enum):
MODEL = "model"
EES_RATE = "ees_rate"
INH_COEF = "inh_coef"
SPEED = "speed"
SIM_TIME = "sim_time"
C_TIME = "c_time"
RECORD_FROM = "record_from"
MULTITEST = "multitest"
ESS_THRESHOLD = "ees_threshold"
class Name(Enum):
MP_E = "MP_E"
class Afferent(Enum):
IA = 'Ia... |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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, modi... |
# Copyright 2015 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 nvstrings
import numpy as np
values = np.array([97, 112, 112, 108, 101], dtype=np.int8)
print("values",values.tobytes())
offsets = np.array([0,1,2,3,4,5], dtype=np.int32)
print("offsets",offsets)
s = nvstrings.from_offsets(values,offsets,5)
print(s)
bitmask = np.array([29], dtype=np.int8)
print("bitmask",bitma... |
import logging
from typing import List, Tuple
import backoff
import sqlalchemy.exc
from climsoft_api.api.qctype import schema as qctype_schema
from climsoft_api.utils.query import get_count
from fastapi.exceptions import HTTPException
from opencdms.models.climsoft import v4_1_1_core as models
from sqlalchemy.orm.sessio... |
#!/usr/env/bin python
import argparse
import functools
import logging
import multiprocessing
import os
import sys
import time
import types
import typing
from bert import \
utils as bert_utils, \
constants as bert_constants, \
encoders as bert_encoders, \
datasource as bert_datasource, \
aws as ber... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\interactions\social\greeting_socials\greetings.py
# Compiled at: 2019-11-05 20:03:01
# Size of sourc... |
from os.path import (join, dirname, isdir, splitext, basename, realpath)
from os import listdir, mkdir
import sh
import glob
import json
import importlib
from pythonforandroid.logger import (warning, shprint, info, logger,
debug, error)
from pythonforandroid.util import (current_di... |
#!/bin/env python
# Copyright (c) 2002-2017, California Institute of Technology.
# All rights reserved. Based on Government Sponsored Research under contracts NAS7-1407 and/or NAS7-03001.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following con... |
'''Generate Opentype'''
|
#
# 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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_link_to_form
from functools i... |
# ===================================================================================================
# _ __ _ _
# | |/ /__ _| | |_ _ _ _ _ __ _
# | ' </ _` | | _| || | '_/ _` |
# |_|\_\__,_|_|\__|\_,_|_| \__,_|
... |
from BayesianTree import Node, Tree, acceptance
import numpy as np
import pandas as pd
import copy
import time
start_time = time.time()
#****************************************************************************************************
# read in the data
#**********************************************************... |
import os
import json
import random
import argparse
from tqdm import tqdm
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.nn.init as weight_init
from torch.utils.data impo... |
import ember
from sklearn.preprocessing import StandardScaler
from ReadFile import *
from ReadModel import *
def check_malware(check_file_path, model_file_path):
check_file_obj = read_file(check_file_path)
scaler = StandardScaler()
scaler.fit(check_file_obj)
sample_data_new = scaler.transform(che... |
# coding=utf-8
#
# Copyright 2015-2016 F5 Networks 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 la... |
import numpy as np
from gym import utils
from my_envs.mujoco import mujoco_env
from math import pi,sin,cos
from transformations import quaternion_inverse, quaternion_multiply, euler_from_quaternion
import os
state_M =np.array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[0., 0., 0.... |
_base_ = [
'../_base_/models/dnl_r50-d8.py', '../_base_/datasets/cityscapes.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'
]
|
'''
Compare the flux in the masked NOEMA and 30-m data.
'''
from spectral_cube import SpectralCube
from astropy.io import fits
import numpy as np
import astropy.units as u
from cube_analysis.feather_cubes import flux_recovery
from paths import noema_co21_file_dict, iram_matched_data_path
from constants import co21_... |
import logging
import os
import platform
import subprocess
import sys
import warnings
from pytest import raises, mark
from twisted import version as twisted_version
from twisted.internet import defer
from twisted.python.versions import Version
from twisted.trial import unittest
import scrapy
from scrapy.crawler impor... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block processing.
This reimplements tests from the bitcoinbridgej/FullBlockTestGenerator used
by ... |
from backbone.backbone import *
from utils import *
from roi_align.roi_align import RoIAlign # RoIAlign module
class GCN_Module(nn.Module):
def __init__(self, cfg):
super(GCN_Module, self).__init__()
self.cfg=cfg
NFR =cfg.num_features_relation
NG=cfg... |
#!/usr/bin/env python
'''
Parse PicoGreen/RiboGreen results from from Gemini XPS Microplate Reader
Convert 384 well plate format to 96 well plate format
Write to different excel spreadsheets
example:
python Parse.Pico.Ribo.Reads.py -f data/pico.reads.txt -s data/standards.txt -a1 1st_plate -a2 2nd_plate -b1 3rd_plate ... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
import os
import cv2
import numpy as np
import plotly
from plotly.graph_objs import Scatter
from plotly.graph_objs.scatter import Line
import torch
from torch.nn import functional as F
from typing import Iterable
from torch.nn import Module
# Plots min, max and mean + standard deviation bars of a population over time... |
"""Parser for OpenDRIVE (.xodr) files."""
import math
import itertools
import warnings
import xml.etree.ElementTree as ET
import numpy as np
from scipy.integrate import quad
from scipy.integrate import solve_ivp
from pynverse import inversefunc
from shapely.geometry import Polygon, MultiPolygon, GeometryCollection, Po... |
"""
* This file is part of PYSLAM
*
* Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com>
*
* PYSLAM 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 the License, or
... |
import sys
from operator import add
from pyspark import SparkContext
#import pyspark_csv as pycsv
from csv import reader
import os
import StringIO
import datetime
import numbers
import re
def str2date(x):
x = x.strip()
try:
x = datetime.datetime.strptime(x, '%m/%d/%Y')
except ValueError:
re... |
"""Unit test for the compound methods."""
import pytest
import torch
from assertpy import assert_that
from numpy.testing import assert_array_equal
from torch.nn import functional
from torch.nn import Module
from midnite.visualization import compound_methods
from midnite.visualization.compound_methods import _prepare_i... |
# Generated by Django 2.2 on 2020-06-04 02:49
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
from mock import patch
import unittest
import redis
from opencensus.trace import tracer as tracer_module, config_integration
from opencensus.trace.exporters.capturing_exporter import CapturingExporter
from opencensus.trace.ext.redis.trace import MODULE_NAME
from opencensus.trace.propagation.google_cloud_format import... |
import os
####### Database config. This assumes Postgres #######
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'commcarehq',
'USER': 'commcarehq',
'PASSWORD': 'commcarehq',
'HOST': 'localhost',
'PORT': '5432'
}
}
### Rep... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic... |
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import sys
def plot_tweets_counts(accounts: pd.DataFrame) -> None:
plt.figure(figsize=(12, 12))
sns.histplot(data=accounts, x="tweets_count", binwidth=500)
plt.title("Twitter activity (tweets, retweets, replies) for all accounts")
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from setuptools import setup, find_packages
setup(name='url_short',
version='0.1',
description='High-performance URL shortener backed by Redis',
url='https://github.com/neeraj2608/redis-url-shorten',
author='Raj Rao',
test_suite='tests',
install_requires=[
'flask',
... |
img_scale = (800, 800)
work_dir = './work_dirs/ABFN/ABFN_res50_scale_xview'
# model settings
model = dict(
type='FasterSSPNet',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
... |
import re
def remove_html_tag(texte):
"""
This function only returns the text content inside an HTML tag.
:param texte: str. The full HTML tag.
:return: The text content of a HTML tag.
"""
texte = str(texte)
if rep := re.match('(.*?)(<.*?>)(.*?)', texte):
texte = texte.replace(rep... |
"""Tests for Codecov API interface."""
from agithub import base as agithub_base
import unittest
from unittest import mock
import env
from apis import codecov
class TestCodecovApi(unittest.TestCase):
def setUp(self):
super(TestCodecovApi, self).setUp()
mock.patch.object(
env, 'get', side_effect={... |
#!/usr/bin/env python
from setuptools import setup, find_packages
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = open('README.md').read()
setup(
name='allacronyms',
version='1.0.0',
description='An unofficial api to ... |
"""Multiply vectors"""
def vmul(vec1, vec2):
"""Return element wise multiplication"""
return [v1*v2 for v1, v2 in zip(vec1, vec2)]
|
from __future__ import print_function, division, absolute_import
from collections import defaultdict
import logging
import uuid
from tornado import gen
import tornado.queues
from .client import Future, _get_global_client, Client
from .utils import tokey, sync
from .worker import get_client
logger = logging.getLogge... |
"""
tests.components.test_input_select
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests input_select component.
"""
# pylint: disable=too-many-public-methods,protected-access
import unittest
from homeassistant.components import input_select
from homeassistant.const import (
ATTR_ICON, ATTR_FRIENDLY_NAME)
from tests.comm... |
import statsmodels.api as sm
from numpy import *
def ols(y,x,addConstant=True,robust='nonrobust',cov_keywords=None):
if addConstant==True:
x=sm.add_constant(x)
model=sm.OLS(y,x,missing='drop')
results=model.fit(cov_type=robust,cov_kwds=cov_keywords)
return results
def nanols(y,x,constant=True,f... |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... |
from helper import *
from models import BertPlain, BertCombined
from dataloader import MedTypeDataset
from torch.utils.data import DataLoader
from transformers.optimization import AdamW
from transformers import get_linear_schedule_with_warmup, BertTokenizer
from sklearn.metrics import average_precision_score
class Me... |
import os
import json
import logging
import mlflow
import matplotlib.pyplot as plt
import argparse
logger = logging.getLogger(__name__)
class EvalTool(object):
"""
Object class that holds all functions for evaluating and
plotting score metrics for ranked retrieval.
The predictions are expected to ... |
#!/usr/bin/env python
#
# geometric_calibration documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated... |
#!/usr/bin/env python
# Copyright (C) 2019 Alibaba Group Holding Limited
# Copyright (C) 2017 Pan Yang (panyangnlp@gmail.com)
from __future__ import print_function
import logging
import os
import sys
import multiprocessing
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
if __name... |
from flask import Flask, render_template, request, make_response, redirect, url_for, send_file
import userDBConnecter as db
import session_manager as sm
import appointments_manager as am
import forgotUsername as fu
import base64
import bleach
import doctor
import secrets
import string
app = Flask(__name__)
@app.rout... |
import os
import random
import h5py
import pickle
import argparse
import numpy as np
from utils import load_image, print_progress_bar
def load_data(input_path):
""" Load coco dataset """
with open(input_path, 'rb') as file:
coco_raw = pickle.load(file)
image_categories = coco_raw['image_categorie... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack Foundation
# 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.a... |
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
# username = models.CharField("nick", max_length=100, unique=True)
# email = mo... |
# Copyright (c) 2012 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.
import os
import tempfile
import unittest
from telemetry.core import util
from telemetry.page import page_set
simple_archive_info = """
{
"archives": ... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.lib.arraypad import _validate_lengths
from scipy.ndimage import uniform_filter, gaussian_filter
dtype_range = {np.bool_: (False, True),
np.bool8: (False, True),
np.uint8: (0, 255),
... |
import haversine as hs
#this function will return the distance (in m) between two coordinates
#returns a scalar value
def dist(lat1, lon1, lat2, lon2):
loc1 = (lat1, lon1)
loc2 = (lat2, lon2)
distance_between_km = hs.haversine(loc1,loc2)
distance_between_m = distance_between_km * 1000
return distan... |
from typing import FrozenSet
from collections import Iterable
from math import log, ceil
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msa... |
from protean import BaseAggregate, BaseEvent, BaseEventHandler, handle
from protean.fields import Identifier, String
from protean.utils import fully_qualified_name
class User(BaseAggregate):
email = String()
name = String()
class Registered(BaseEvent):
user_id = Identifier()
email = String()
class... |
import requests
import json
import os
def get_auth_headers():
CLIENT_ID = os.getenv('TWITCH_CLIENT_ID')
CLIENT_SECRET = os.getenv('TWITCH_CLIENT_SECRET')
body = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
"grant_type": 'client_credentials'
}
r = requests.post... |
"""
Created on Sep 1, 2020
Physical operator that implements a JOIN.
The intermediate results are stored in queues and processed incrementally.
@author: Lars Heling
"""
from multiprocessing import Value, Queue
from Queue import Empty
from operatorstructures import Tuple, Record, RJTTail
from time import time
from r... |
from __future__ import print_function
if 1:
# deal with old files, forcing to numpy
import tables.flavor
tables.flavor.restrict_flavors(keep=["numpy"])
import numpy
import sys, os, time
from optparse import OptionParser
import tables
import matplotlib.mlab as mlab
def convert(
infilename, outfilena... |
"""Support for Ampio Air Quality data."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.air_quality import (
PLATFORM_SCHEMA, AirQualityEntity)
from homeassistant.const import CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession
... |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from . import _utilities
import typing
# Export this package's modules as members:
from .kustomize import *
from .provider import *
from .yaml import *
# Make subpac... |
from __future__ import absolute_import, print_function
from os import path
import hashlib
import logging
import six
from django.db import IntegrityError, transaction
from sentry.api.serializers import serialize
from sentry.cache import default_cache
from sentry.tasks.base import instrumented_task
from sentry.utils ... |
IMAGE_CODE_EXPIRE = 300 # 图形验证码过期时间单位: 秒
|
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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 re... |
# Copyright (c) MONAI Consortium
# 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, so... |
import numpy as np
import pandas as pd
import altair as alt
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc
from utils import Header, make_dash_table,Header2
# Allow large data set
alt.data_transfo... |
# Copyright 2018 The TensorFlow Probability 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 o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.