text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# init all the extensions instances
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask.ext.mail import Mail
mail = Mail()
from flask.ext.login import LoginManager
login_manager = LoginManager()
from flask_debugtoolbar import DebugToolbarExtension
toolbar = DebugToolb... |
from math import factorial
import scipy.special
import numpy as np
def sloppy_spherical(y):
r = np.linalg.norm(y)
costheta = y[2] / r
theta = np.arccos(costheta)
phi = np.arccos(y[0] / r / np.sin(theta))
return r, theta, phi
def Rdirect(n_max, y):
r, theta, phi = sloppy_spherical(y)
real =... |
# import pandas as pd
# import numpy as np |
import torch
class Attack(object):
r"""
Base class for all attacks.
.. note::
It automatically set device to the device where given model is.
It temporarily changes the original model's training mode to `test`
by `.eval()` only during an attack process.
"""
def __init__(s... |
"""
Copyright (c) 2004-Present VMware, Inc. or its affiliates.
This program and the accompanying materials are made available under
the terms of the 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://ww... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... |
#!/usr/bin/python
from p4_hlir.main import HLIR
from p4_hlir.hlir.p4_parser import p4_parse_state
import p4_hlir
from p4_hlir.hlir.p4_tables import p4_table
from compiler import HP4Compiler, CodeRepresentation
import argparse
import itertools
import code
from inspect import currentframe, getframeinfo
import sys
import... |
from checkv.modules import (
download_database,
update_database,
contamination,
completeness,
complete_genomes,
quality_summary,
end_to_end,
)
try:
from importlib import metadata
except ImportError:
import importlib_metadata as metadata
__version__ = metadata.version("checkv") |
from .getColor import *
from .getDecile import *
from .getPercentile import *
from .getStateName import *
from .path import * |
NAME = "complicated-wires"
import curses
from defusekit import wards
from defusekit.kittypes import Window
def get_instruction(red: bool, blue: bool, star: bool, led: bool) -> str:
binstr = "".join(["1" if b else "0" for b in (red, blue, star, led)])
wirestate = int(binstr, 2)
C = "Cut the wire"
D =... |
# Problem 4: Largest palindrome product
# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
# Find the largest palindrome made from the product of two 3-digit numbers.
num = 999 # Numbers start from 999
num2 = 999
palindrome = [] # Sto... |
"""
HiddenLayer
Implementation of the Graph class. A framework independent directed graph to
represent a neural network.
Written by Waleed Abdulla. Additions by Phil Ferriere.
Licensed under the MIT License
"""
from __future__ import absolute_import, division, print_function
import os
import re
from random import get... |
# greaseweazle/usb.py
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct
import itertools as it
from greaseweazle import version
from greaseweazle ... |
import ops.cmd
import util.ip
DATA_TYPES = ['all', 'browser', 'cache', 'expensive', 'icmp', 'ip', 'jobobject', 'jobobjectdetails', 'logicaldisk', 'memory', 'networkinterface', 'objects', 'pagingfile', 'physicaldisk', 'process', 'processor', 'system', 'tcp', 'telephony', 'terminalservices', 'thread', 'udp']
class Perfo... |
import random
from random import shuffle
import numpy as np
from datetime import datetime
import time
import queue
import threading
import logging
from PIL import Image
import itertools
import re
import os
import glob
import shutil
import sys
import copy
import h5py
from typing import Any, List, Tuple
import torch
impo... |
"""
Co-citation Network / Degree Plot
===============================================================================
>>> from techminer2 import *
>>> directory = "/workspaces/techminer2/data/"
>>> file_name = "/workspaces/techminer2/sphinx/images/co_citation_network_degree_plot.png"
>>> co_citation_network_degree_pl... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class QueryCompareResultReq:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The ... |
#cas
def get_infos():
import ti_graphics, ti_system
fnop = lambda : None
screen_w, screen_h, screen_y0, font_w, font_h, poly_set_pixel, poly_fill_rect, poly_draw_ellipse, poly_fill_circle, poly_get_key, poly_draw_string = 320, 210, 30, 10, 15, fnop, fnop, fnop, fnop, ti_system.wait_key, fnop
def poly_fill_rect(... |
from QUBEKit.ligand import Ligand
import os
import sys
from PyQt5 import QtWidgets, QtGui
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineView
import qdarkstyle
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, molecule=None, parent=None):
super(Ma... |
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "... |
import fnmatch, warnings, json, os
import numpy as np
from six import string_types
from tinydb.storages import MemoryStorage
from tinydb import where
from espei.utils import PickleableTinyDB
from espei.core_utils import recursive_map
class DatasetError(Exception):
"""Exception raised when datasets are invalid.""... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: ipa_service
author: Cédri... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Meson(PythonPackage):
"""Meson is a portable open source build system meant to be both
... |
# Copyright 2011 VMware, 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 ... |
from monero_glue.xmr import crypto
from monero_glue.xmr.sub.keccak_hasher import HashWrapper
from monero_serialize import xmrserialize
class PreMlsagHasher(object):
"""
Iterative construction of the pre_mlsag_hash
"""
def __init__(self, state=None):
from monero_glue.xmr.sub.keccak_hasher impo... |
import logging
from datetime import datetime, timedelta
from spark.tests import TestCase
from nose.tools import eq_
from geo.continents import (AFRICA, ASIA, EUROPE, NORTH_AMERICA, SOUTH_AMERICA,
OCEANIA, ANTARCTICA)
from users.models import User
from stats.models import SharingHistory
f... |
# Copyright 2019 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.txt" file acc... |
# coding=utf-8
# Copyright 2019 TF.Text 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 ag... |
import sys
from typing import Any
from typing import Callable
from typing import List
from typing import Union
from ..utils import test_iterable
class _HeapNode:
def __init__(self, key: Any, value: Any):
self.key = key
self.value = value
self.degree = 0
self.marked = False
... |
#!/usr/bin/env python
# Copyright (c) 2014 Alain Martin
import argparse
import ast
import os
import re
import subprocess
import sys
import tempfile
FEATURE_EXT = '.feature'
REPO_ROOT = os.path.dirname(os.path.abspath(__file__))
def compiler_arg_choices():
compilers_dir = os.path.join(REPO_ROOT, 'compilers')
... |
import cv2
import os
import numpy as np
import matplotlib.pyplot as plt
# %%
def _pick(L, ty, path):
L_ = [cv2.imread(os.path.join(path, i)) for i in L if i.split('_')[0]==ty]
# 輸入影像
return L_
def _gray(img):
return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
def _Pos(img, idx):
def on_press(event):
... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
import errno
import json
import os
import subprocess
import sys
import time
import uuid
import zipfile
import shutil
from Bio import SeqIO
from installed_clients.AssemblyUtilClient import AssemblyUtil
from installed_clients.DataFileUtilClient import DataFileUtil
from installed_clients.KBaseReportClient import KBaseRe... |
#!D:\School\UMD\INST326\Group Project\venv\Scripts\python.exe
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
del sys.argv[i]
... |
import unittest
from python_oop.testing.exercise.vehicle.project.vehicle import Vehicle
# from project.vehicle import Vehicle
class VehicleTest(unittest.TestCase):
def setUp(self):
self.vehicle = Vehicle(50.0, 300.0)
def test_vehicle__init_method(self):
self.assertEqual(50.0, self.vehicle.fu... |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# Copyright 2021 The Flax 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 wri... |
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class RangeSlider(Component):
"""A RangeSlider component.
A double slider with two handles.
Used for specifying a range of numerical values.
Keyword arguments:
- id (string; optional)
- marks (optional):... |
import torch
import numpy as np
class ScheduledOptim:
""" A simple wrapper class for learning rate scheduling """
def __init__(self, model, train_config, model_config, current_step):
self._optimizer = torch.optim.Adam(
model.parameters(),
betas=train_config["optimizer"]["beta... |
# coding: utf-8
"""
BillForward REST API
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
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... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
#!/usr/bin/env python3
# pylint: disable=too-many-ancestors
# standard library
import os
import sys
import re
import argparse
from shutil import copy2
# from subprocess import Popen, PIPE
# import time
# from lxml import etree
# local library
import inkex
from inkex.command import inkscape
from inkex.elements import... |
import copy
from TheanoLib.init import Normal
from TheanoLib.modules import Sequential, Flatten, Dropout, Dense, identity, Softmax, FanOut, Parallel, Subtensor, \
SimpleApply, softmax
from architecture import create_conv_colum
import theano.tensor as T
def create(image_size=(448, 448), n_outs=[447], dropout=False,... |
from typing import Final
__version__: Final = "1.0.0"
HTTP_HEADERS: Final = {"User-Agent": f"delphi_epidata/{__version__}"}
BASE_URL: Final = "https://delphi.cmu.edu/epidata/" |
# -*- coding: utf-8 -*-
import re
import cherrypy
from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.constants import AccessType, TokenScope
from girder.models.file import File as FileModel
from girder.models.folder import Folder as FolderModel
from girder.models.it... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
import pytest
import platform
import functools
import itertools
import datetime
from azure.core.exceptions import HttpResponseError, ClientAut... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
"""Addeding lessons taught to user
Revision ID: 1c697a5bd34f
Revises: 23aebf11a765
Create Date: 2014-01-04 13:13:39.599020
"""
# revision identifiers, used by Alembic.
revision = '1c697a5bd34f'
down_revision = '23aebf11a765'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gener... |
import yaml
from tests.base.io_test import BaseIOTest
from tests.base.value_error import BaseValueErrorTest
from queenbee.operator.function import Function
ASSET_FOLDER = 'tests/assets/functions'
class TestIO(BaseIOTest):
klass = Function
asset_folder = ASSET_FOLDER
class TestValueError(BaseValueErrorTest... |
# 计算结构张量的特征值。
from skimage.feature import structure_tensor
from skimage.feature import structure_tensor_eigenvalues
import numpy as np
square = np.zeros((5, 5))
square[2, 2] = 1
A_elems = structure_tensor(square, sigma=0.1, order='rc')
print(structure_tensor_eigenvalues(A_elems)[0]) |
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from django.db.models import Q
from django.shortcuts import get_object_or_404
from nomadgram.images.models import Comment
from nomadgram.images.models import Image
from nomadgram.images.models impor... |
import os
DIRNAME = os.path.dirname(__file__)
DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(DIRNAME, 'mptt.db')
#DATABASE_ENGINE = 'mysql'
#DATABASE_NAME = 'mptt_test'
#DATABASE_USER = 'root'
#DATABASE_PASSWORD = ''
#DATABASE_HOST = 'localhost'
#DATABASE_PORT = '3306'
#DATABASE_ENGINE = 'po... |
import logging
import json
import azure.functions as func
import azure.durable_functions as df
async def main(req: func.HttpRequest, starter: str) -> func.HttpResponse:
client = df.DurableOrchestrationClient(starter)
payload: str = json.loads(req.get_body().decode()) # Load JSON post request data
instance... |
from NENV import *
import ctypes.test.test_pickling
class NodeBase(Node):
pass
class Array_Node(NodeBase):
"""
"""
title = 'ARRAY'
type_ = 'ctypes.test.test_pickling'
init_inputs = [
NodeInputBP(label='typ'),
NodeInputBP(label='len'),
]
init_outputs = [
... |
import re
import uuid
from xml.etree.cElementTree import XML, tostring
from django.conf import settings
from dimagi.utils.parsing import json_format_datetime
from corehq.apps.app_manager.util import get_cloudcare_session_data
from corehq.apps.cloudcare.touchforms_api import CaseSessionDataHelper
from corehq.apps.for... |
# -*- coding: utf-8 -*-
"""
@file
@brief Data from INSEE
**Source**
* ``irsocsd2014_G10.xlsx``: ?
* ``fm-fecondite-age-mere.csv``: `INSEE Bilan Démographique 2016 <https://www.insee.fr/fr/statistiques/1892259?sommaire=1912926>`_
* ``pop-totale-france.xlsx``: `INED Population totale
<https://www.ined.fr/fr/tout-savo... |
#!/usr/bin/env python
"""
Functions and objects to deal with meteoroids orbits
"""
__author__ = "Hadrien A.R. Devillepoix, Trent Jansen-Sturgeon "
__copyright__ = "Copyright 2016-2017, Desert Fireball Network"
__license__ = "MIT"
__version__ = "1.0"
import numpy as np
from numpy.linalg import norm
import matplotlib.p... |
'''
Test the hosts module
'''
# Import python libs
import os
import shutil
# Import Salt libs
import integration
HFN = os.path.join(integration.TMP, 'hosts')
class HostsModuleTest(integration.ModuleCase):
'''
Test the hosts module
'''
def __clean_hosts(self):
'''
Clean out the hosts f... |
import numpy as np
import ray
ray.shutdown()
ray.init()
# A : Action Space
# S : State Space
@ray.remote
class VI_worker(object):
def __init__(self, list_of_actions, tran_dict, reward_dict, beta, backup_states, true_action_prob=0.8,
unknown_value=0):
self.backup_states = backup_states
... |
from .average_meter import AverageMeter
from .progress import TrainingProgress |
import panel as pn
SCRIPT = """
<script src="https://www.unpkg.com/terminal@0.1.4/lib/terminal.js" type="text/javascript"></script>
"""
script_panel = pn.pane.HTML(SCRIPT, width=0, height=0, margin=0, sizing_mode="fixed")
HTML = """
<div id="terminal-1"></div>
<script>
var t1 = new Terminal()
t1.setHeight("100%")
... |
"""article_topic URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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... |
from render_util import *
from render_single import *
import numpy
import skimage
import skimage.io
def mb(p, time):
z = [p[0], p[1], p[2]]
dr = 1.0
t0 = 1.0
cond = True
power = 20.0
for i in range(4):
r = sqrt(z[0] ** 2.0 + z[1] ** 2.0 + z[2] ** 2.0)
#cond *= r <= 2.0
... |
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkalidns.request.v20150109.DescribeSubDomainRecordsRequest import DescribeSubDomainRecordsRequest
from aliyunsdkalidns.request.v201... |
"""
This file offers the methods to automatically retrieve the graph Halanaerobium kushneri.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import io
import os
import re
import shutil
import time
import warnings
from unittest import SkipTest, skipUnless
from django.conf import settings
from django.core import management
from django.core.management import execute_from_command_line
from djan... |
from typing import Union
import torch
from torch import nn
from ..composition import AdapterCompositionBlock, parse_composition
from ..heads import CausalLMHead, ClassificationHead, MultiLabelClassificationHead
from ..model_mixin import InvertibleAdaptersMixin, ModelAdaptersMixin
from .bert import (
BertEncoderAd... |
import unittest
from blindreviewparser.parser.blind_review_parser import *
class TestElasticService(unittest.TestCase):
def setUp(self) -> None:
self.es_endpoint = 'http://localhost:9200'
self.elastic_service = ElasticService(self.es_endpoint)
self.sample = Review(
company='o... |
#!/usr/bin/env python
# Copyright 2017 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 sys
import unittest
if __name__ == '__main__':
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(... |
# -*- coding: utf-8 -*-
import unittest
import freqerica.hamiltonian.exact
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def test_absolute_truth_and_meaning(self):
assert True
if __name__ == '__main__':
unittest.main() |
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
class LoginForm(AuthenticationForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['username'].label = ""
self.fields['password'].labe... |
"""
ASGI config for online_quiz project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_S... |
from server import app
from flask import Response, request
from prometheus_client import generate_latest, Counter
from functools import wraps
# route to display configured Prometheus metrics
# note that you will need to set up custom metric observers for your app
@app.route('/metrics')
def prometheus_metrics():
MI... |
# -*- coding: utf-8 -*-
import traceback
import xlsconfig
import util
from tps import tp0, convention
from base_parser import ConverterInfo, BaseParser
# 利用Excel表头描述,进行导表,不需要转换器
class DirectParser(BaseParser):
def __init__(self, filename, module, sheet_index=0):
super(DirectParser, self).__init__(filename, module,... |
from aeropy.geometry.parametric import poly
from aeropy.structural.stable_solution import (structure, mesh_1D, properties,
boundary_conditions)
from aeropy.xfoil_module import output_reader
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
impo... |
import opfython.stream.loader as l
import opfython.stream.parser as p
from opfython.subgraphs import KNNSubgraph
# Defining an input file
input_file = 'data/boat.txt'
# Loading a .txt file to a dataframe
txt = l.load_txt(input_file)
# Parsing a pre-loaded dataframe
X, Y = p.parse_loader(txt)
# Creating a knn-subgra... |
from flask import Blueprint, render_template, current_app, session
from flask import abort, jsonify
from flask_login import current_user
import ishuhui.tasks.task as task
from ..models.chapter import Chapter
from ..models.comic import Comic
from ..tasks.celery_task import refresh_chapters_task
bp_admin = Blueprint('a... |
#!/usr/bin/env python
import sys
import json
import time
import logging
import traceback
from core import Messages, EncryptedConnection, Gatekeeper
from threads import Heartbeat, EventWatcher
class GatekeeperApp(object):
def run(self, config):
try:
logging.info("Starting up Gatekeeper...")
... |
from .dataSource import DataSource
from .trend import TrendAnalyze
from jqdatasdk import *
from jqdatasdk.api import get_fundamentals, get_industry_stocks, get_security_info
from jqdatasdk.utils import query
import talib
from datetime import datetime, timedelta
import json
import logging
from sqlalchemy.orm.query impo... |
#!/usr/bin/env python3
import os
import sys
thispath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(thispath),"helper"))
from MiscFxns import *
from StandardModules import *
def CompareEgy(EgyIn):
return EgyIn+224.912529687124<0.00001
def CompareGrad(GradIn):
Cor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Onchere Bironga
#
# 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... |
import logging
import json
import pandas as pd
from flask import render_template
from flask_wtf import Form
from wtforms import fields
from wtforms.validators import Required
from . import app, estimator, target_names
logger = logging.getLogger('app')
class PredictForm(Form):
"""Fields for Predict"""
# sepa... |
from setuptools import setup
setup(name = 'distributions',
version = '0.2',
description = 'Gaussian distributions',
packages = ['distributions'],
zip_safe = False) |
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
# coding: utf-8
"""
Argo Server API
You can get examples of requests and responses by using the CLI with `--gloglevel=9`, e.g. `argo list --gloglevel=9` # noqa: E501
The version of the OpenAPI document: v2.11.8
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
... |
import pandas as pd
import numpy as np
import pickle
from keras.preprocessing.text import Tokenizer
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers.embeddings import Embedding
from keras.layers.convolutional import Conv1D
from keras.layers.convolutional import MaxPooling1D... |
# -*- coding: utf-8 -*-
#
# Python documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
... |
"""
The first config example
"""
from types import SimpleNamespace
agency = 'NSA'
snuffler = SimpleNamespace(phase_map={1: 'P', 2: 'S'}) |
"""
The intensity measurement scale has changed, and might change again
Therefore, I need this module to translate between numeric intensity scores
and casualty numbers
"""
from typing import Optional
from datetime import date
import pydantic
class CasualtyRange(pydantic.BaseModel):
lower: int
upper: Optional[... |
#!/usr/bin/env python
# Copyright 2016 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 json5_generator
import template_expander
from collections import namedtuple
from core.css import css_properties
class Propert... |
# Generated by Django 3.1.5 on 2021-01-08 10:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0002_remove_classifydata_pending_tag'),
]
operations = [
migrations.CreateModel(
name='ClassifyTag',
fields=... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pearson-model-param.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class SIGGRAPHGenerator(nn.Module):
def __init__(self, norm_layer=nn.BatchNorm2d, classes=529):
super(SIGGRAPHGenerator, self).__init__()
# Conv1
model1=[nn.Conv2d(4, 64, kernel_size=3, stride=1, padding=1, bias=True),]
... |
"""landmark_recognition URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/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'... |
import uvicorn
from neo4j import GraphDatabase
from ariadne.asgi import GraphQL
from neo4j_graphql_py import neo4j_graphql
from ariadne import QueryType, make_executable_schema, MutationType, gql
typeDefs = gql('''
directive @cypher(statement: String!) on FIELD_DEFINITION
directive @relation(name:String!, direction:St... |
from jumpscale import j
from time import sleep
app = j.tools.prefab._getBaseAppClass()
class PrefabS3Scality(app):
NAME = 's3scality'
def install(self, start=False, storageLocation="/data/", metaLocation="/meta/"):
"""
put backing store on /storage/...
"""
self.prefab.system... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from org.bukkit import Particle, Sound
from org.bukkit.potion import PotionEffectType
from com.wynnlab.spells import PySpell
from com.wynnlab.util import BukkitUtils
class Spell(PySpell):
def __init__(self):
self.l = None
self.entities = None
self.shift = False
def init(self):
... |
#!/usr/bin/env python
"""
@author: Francis Obiagwu
@software: SecureDocumentSharing
@file: DSPdu.py
@time: 6/6/18 7:16 PM
"""
import binascii
import struct
from datetime import datetime
from DSCodes import DSCode
class DSPdu:
"""
The DSPdu class is used to create a generic pdu object. The user have the opti... |
import numpy as np
#test inputs
inputs = [1, 2, 3, 2.5]
weights = [[0.2, 0.8, -0.5, 1],
[0.5, -0.91, 0.26, -0.5],
[-0.26, -0.27, 0.17, 0.87]]
biases = [2, 3, 0.5]
def neuron_output(inputs, weights,bias):
return sum(inputs[i] * weights[i] for i in range(len(inputs)))+ bias
#this can also be done with numpy becau... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.