text stringlengths 2 999k |
|---|
import datetime
from filecmp import dircmp
from datetime import datetime
from . import common
import os
import pprint
import shutil
import tempfile
from distutils import dir_util
# re-use existing CF build logic
from . import check
argparser = None
# all options passed to javac by the build system are copied to the... |
import requests
new_measurement = {
"sepal_length": 5.7,
"sepal_width": 3.1,
"petal_length": 4.9,
"petal_width": 2.2,
}
response = requests.post("http://127.0.0.1:8001/predict", json=new_measurement)
print(response.content)
|
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: leetcode_10
Description : ^_^ !!!
Author : anglemiku
Eamil : anglemiku.v@gmail.com
date: 2019-09-09
-------------------------------------------------
Change Activity: 201... |
"""
Simple config
=============
Although CherryPy uses the :mod:`Python logging module <logging>`, it does so
behind the scenes so that simple logging is simple, but complicated logging
is still possible. "Simple" logging means that you can log to the screen
(i.e. console/stdout) or to a file, and that you can easily ... |
#
# Copyright 2016 Quantopian, 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 wr... |
#!/usr/bin/env python
"""
Fraunhofer IML
Department Automation and Embedded Systems
Tabsize : 4
Charset : UTF-8
"""
__author__ = "Dennis Luensch"
__maintainer__ = "Dennis Luensch"
__email__ = "dennis.luensch@iml.fraunhofer.de"
from MARSEntity import MARSEntity
from MARSEntityTypes imp... |
import datetime
import os
from common import mparams, mx_logging, settings
from common.deployment import deploy_to_gce
from common.util import deploy_util, helper_util
from projects.edison.eval import image_query
from projects.edison.util import predictions_loader
from projects.edison.train import model_preprocessor_s... |
# 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... |
# -*- coding: utf-8 -*-
# @Date : 2019-08-15
# @Author : Xinyu Gong (xy_gong@tamu.edu)
# @Link : None
# @Version : 0.0
from models_search import shared_gan, controller
|
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
import sys
sys.path.append('../lib/BeamDynamicsTools/')
from numpy import *
from Ellipse import *
import pylab as pl
S1 = matrix([
[0.577100, 0.398000, 0.000000, 0.000000, 0.000000, 0.000000],
[0.398000, 171.8262, 0.000000, 0.000000, 0.000000, 0.000000],
[0.000000, 0.000000, 0.343900, -0.27150, 0.000000, 0.000000],
[... |
import numpy as np
from scipy.stats import norm
from reliabpy.models.observation import Probability_of_Detection as PoD
import torch
class _Base(object):
def _global_init(self):
self.store_results = True
self.t, self.action, self.output = 0, None, None
self.force_detection = False
... |
import json
from app import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
Name = db.Column(db.String(20), nullable=False, unique=True)
Email = db.Column(db.String(30), nullable=False, unique=True)
Username = db.Column(db.String(15), nullable=False, unique=True)
Password = db... |
from flask.testing import FlaskClient
class MDMClient(FlaskClient):
"""MDMClient is a superset of the flask testing client meant to perform higher level operations similar to the
native mdmclient binary.
Attributes:
_private_key (rsa.RSAPrivateKey): RSA Private Key for the simulated client.... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import logging
from ..core import get_core_context
from ava.runtime import environ
from ava.runtime.config import settings
from .bottle import request, response, HTTPError, static_file as _static_file
from . im... |
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... |
import numbers
import numpy as np
from .survey import Survey
try:
from openpyxl import load_workbook
OPENPYXL = True
except ImportError:
OPENPYXL = False
def get_standard_data(filename):
# import data from Excel
assert OPENPYXL, "ImportError: try pip install welleng[easy]"
workbook = load_wor... |
import unittest
from test_env import TestFromDir
import os
class TestGWebb(TestFromDir):
path = os.path.join(os.path.dirname(__file__),"g webb")
TestGWebb.populate(TestGWebb)
if __name__ == '__main__':
unittest.main()
|
import random
import logging
import requests
from typing import Any, Dict, Optional
XKCD_TEMPLATE_URL = 'https://xkcd.com/%s/info.0.json'
LATEST_XKCD_URL = 'https://xkcd.com/info.0.json'
class XkcdHandler:
'''
This plugin provides several commands that can be used for fetch a comic
strip from https://xk... |
from flask import g
import psycopg2.extras
import os
import time
user = os.environ['POSTGRES_USER']
password = os.environ['POSTGRES_PASSWORD']
host = os.environ['POSTGRES_HOST']
database = os.environ['POSTGRES_DB']
port = os.environ['POSTGRES_PORT']
DATABASE_URL = f'postgresql://{user}:{password}@{host}:{port}/{databa... |
from flask import Flask, render_template, request, make_response
import sqlite3
from rake_nltk import Rake
import nltk
from nltk.corpus import wordnet
import PyDictionary
import json
from nltk.stem import WordNetLemmatizer
import os
from datetime import datetime
from functools import wraps, update_wrapper
app = Flask(... |
from typing import Set
from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
Permission,
PermissionsMixin,
)
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.db.models import Q, Value
from django.forms.m... |
from marshmallow import fields
from app.ext import ma
class RatingSchema(ma.Schema):
id = fields.Integer(dump_only=True)
description = fields.String()
score = fields.Integer()
user_id = fields.Integer()
company_id = fields.Integer()
created_at = fields.DateTime() |
import datetime
import os
import sys
import utils
class Logger():
def __init__(self):
self.cur_path = sys.path[0]
utils.safe_mkdir(os.path.join(self.cur_path, 'log/'))
def log(self, content):
path = os.path.join(self.cur_path, 'log/', datetime.datetime.now().strftime("%Y%m%d"))
... |
import unittest
import os
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.config.sections.client.console import ConsoleConfiguration
from programytest.config.file.base_file_tests import ConfigurationBaseFileTests
class YamlConfigurationFileTests(ConfigurationBaseFileTests):
def t... |
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from setuptools import setup, find_packages
import glob
import os
# Find runtime and external library files by obtaining the module path and
# trimming the absolute path of the resulting files.
dace_path = os.path.dirname(os.path.abspath(__fil... |
# Comandos para o banco de dados
import os
import sqlite3 as sql
from sqlite3 import Error
def ConexaoBanco():
caminho = 'agenda.db'
con = None
try:
con = sql.connect(caminho)
except Error as erro:
print(erro)
return con
# Cria uma tabela de nome pessoas, se não existir antes
de... |
from tensorflow.keras import backend as K
import tensorflow as tf
_EPSILON = K.epsilon()
def accuracy_fn(batch_size):
def accuracy(y_true, y_pred):
y_pred = K.clip(y_pred, _EPSILON, 1.0-_EPSILON)
accuracy = 0
for i in range(0,batch_size,3):
try:
q_embedding = y... |
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py |
import abc
import collections.abc
from typing import Any, Dict, Iterator, List, Type
from .cleaners import Cleaner
from .data import BaseData
from .exceptions import FileParseException
from .labels import Label
DEFAULT_TEXT_COLUMN = "text"
DEFAULT_LABEL_COLUMN = "label"
class Record:
"""Record represents a data... |
"""
Integer factorization
"""
from __future__ import print_function, division
import random
import math
from .primetest import isprime
from .generate import sieve, primerange, nextprime
from sympy.core import sympify
from sympy.core.evalf import bitcount
from sympy.core.logic import fuzzy_and
from sympy.core.numbers ... |
from __future__ import absolute_import, unicode_literals
import datetime
import pickle
from operator import attrgetter
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.db import connections, router, DEFAULT_DB_ALIAS
f... |
# Generated by Django 2.1.7 on 2019-04-02 06:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0002_auto_20190402_0559'),
]
operations = [
migrations.RenameField(
model_name='choices',
old_name='choice',
... |
#!/usr/bin/env python3
import os, time, datetime, argparse
from ROOT import gROOT, TH1D
from anlpy2.analysis_status import AnalysisStatus as stt
from anlpy2.event_flags import EventFlags as evs
from anlpy2.analysis_framework import VANLModule
from anlpy2.commandline_arguments import ArrayAction as anl_action, Argume... |
""" SimSiam Model """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import torch
import torch.nn as nn
def _prediction_mlp(in_dims: int,
h_dims: int,
out_dims: int) -> nn.Sequential:
"""Prediction MLP. The original paper's implementation has... |
#knockout
|
import asyncio
import os
import sys
import logging
import argparse
from iop.core import flows
from iop.core.util import Stop
async def mont_flow(flow, module, penalty):
logger = logging.getLogger(module)
logger.info("started")
while True:
try:
await flow()
except Stop:
... |
import logging
try:
import tensorflow as tf
import tensorflow.keras as k
except ImportError:
tf = None
from lenskit import util
from lenskit.algorithms.mf_common import MFPredictor
from lenskit.algorithms.bias import Bias
from .util import init_tf_rng, check_tensorflow
_log = logging.getLogger(__name__)
... |
#!/usr/bin/env python3
import argparse
import math
import os.path
import numpy as np
import pandas as pd
from astropy import units as u
import artistools as at
def addargs(parser):
parser.add_argument('-inputpath', '-i',
default='1.00_5050.dat',
help='Path of inp... |
from django.urls import path
from . import views
urlpatterns = [
path("", views.home, name="home"),
path("signup", views.signup, name="signup"),
path("login", views.loginstudent, name="login"),
path("profile", views.profile, name="profile"),
path("logout", views.logoutstudent, name="logout")
] |
# Copyright 2009-2011 10gen, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# Just like ThreadedResolver, but doesn't suck
#
# The contents of this file are subject to the Python Software Foundation
# License Version 2.3 (the License). You may not copy or use this file, in
# either source code or executable form, except in compliance with the License.
# You may obtain a copy of the License at... |
"""console interface for cryptoy's NaCL commands."""
import json
import logging
import click
from rich.console import Console
from rich.logging import RichHandler
from cryptoy import __version__
from cryptoy.nacl.box import BoxKeyPair
console = Console()
logger = logging.getLogger(__name__)
def setup_logging(verb... |
# coding: utf-8
"""
Transaction Management Bus (TMB) API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: V3.2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import a... |
#!/usr/bin/env python3
instructions = []
with open("input", "r", encoding="utf8") as f:
lines = f.read()[:-1]
lines = lines.replace(":", " ").split('\n')
for i in lines:
instructions += [i.split()]
def take_ins(nr):
ins, arg = instructions[nr]
return ins, int(arg)
def execute(ins_nr, ACC):
glob... |
# Copyright 2011-2016 Josh Kearney
#
# 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 agre... |
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. Th... |
import json
import os
from io import BytesIO
try:
import cPickle as pickle
except ImportError:
import pickle
import unittest
import bmemcached
class PickleableThing(object):
pass
class JsonPickler(object):
def __init__(self, f, protocol=0):
self.f = f
def dump(self, obj):
if ... |
#!usr/bin/python2.7
# coding=utf-8
import base64
from bs4 import BeautifulSoup as parser
def main(cookie, url, config):
try:
action = None
fb_dtsg = None
jazoest = None
status = False
response = config.httpRequest(url+'/451770935827529', cookie).encode('utf-8')
html = parser(response, 'html.parser')
fo... |
"""
Histogram1D: a plugin which accumulates a histogram based on its configuration.
Only notifies downstream plugins on a `report' action.
Constructor arguments:
nbins: number of bins
xlow: low edge of histogram
xhigh: high edge of histogram
in_field: string, name of field to extract from alert data
in_in... |
from direct.directnotify import DirectNotifyGlobal
import DistributedRaceAI
from toontown.toonbase import ToontownGlobals, TTLocalizer
from toontown.coghq import MintLayout
from toontown.ai import HolidayBaseAI
from direct.showbase import DirectObject
import RaceGlobals, random, os, json
class RaceManagerAI(DirectObje... |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Using the GOST R 34.10-94, GOST R 34.10-2001, and GOST R 34.11-94
# Algorithms with Certificates and CRLs
#
# ASN.1 source from:
# https://w... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from hypothesis import given
import hypothesis.strategies as st
from caffe2.python import core
from caffe2.python import workspace
import caffe2.pyth... |
import os
import numpy as np
import tensorflow as tf
# Ignore warn: Your CPU supports instructions that this TensorFlow binary
# was not compiled
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
##构造数据##
x_data = np.random.rand(100).astype(np.float32) # 随机生成100个类型为float32的值
y_data = x_data * 0.1 + 0.3 # 定义方程式y=x_data*A+B
... |
# Copyright: (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, 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
import os
from ast import l... |
from cli import cli
from rich import box
class Printer:
def __init__(self, algorithms):
self.algorithms = algorithms
def all(self):
cli.table(['Название'], list(
self.algorithms.keys()), autoheader='Номер')
def choose(self, index=None):
try:
index = cli.i... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# License: MIT. See LICENSE
import ast
from types import FunctionType, MethodType, ModuleType
from typing import Dict, List
import frappe
from frappe.model.document import Document
from frappe.utils.safe_exec import get_safe_globals, s... |
'''Find cross references from git commit history.'''
import re
import os.path
import git
from nerm.crossrefs import Crossref
class Gitref(Crossref):
def __init__(self, commit, fulltext, relation = 'gitref'):
self.relation = relation
self.commit = commit
self.fullhash = commit.hexsha
... |
import time
class define:
GREEN = "\033[32m"
RED = "\033[0;31m"
BLUE = "\033[94m"
ORANGE = "\033[33m"
host = "https://127.0.0.1:3443/" #端口后面一定要加/
api_key = "" #替换此处apikey
api_header = {'X-Auth':api_key,'content-type':'appl... |
import Data as DB
import plotly.express as px
import folium
import dash_table
import plotly.express as plot
import Icons
import base64
###############################
Confirmed_Cases = int(DB.Global_Countrys['confirmed'].sum())
Deaths_Count = int(DB.Global_Countrys['deaths'].sum())
Recovered_Count = int(DB.Global_Cou... |
import overflow1, overflow2, overflow3, overflow4, overflow5
from binaryninja import get_choice_input, PluginCommand
choices = ['Overflow 1', 'Overflow 2', 'Overflow 3', 'Overflow 4', 'Overflow 5']
def choose_writeup(bv):
choice = get_choice_input("Writeup:", "Open Writeup", choices) + 1
if choice == 1:
... |
sites = [
"nu.nl",
"rtlz.nl",
"nos.nl",
"reddit.com",
"onelogin.com",
"chrislaffra.com",
"microsoft.com",
"google.com",
"apple.com",
"youtube.com",
"blogger.com",
"mozilla.org",
"wordpress.org",
"en.wikipedia.org",
"linkedin.com",
"vimeo.com",
"maps.google.com",
"drive.google.com",
... |
# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1321004887.3172851
_template_filename=u'/home/tonycai/workspace/ops_repos/dev/pyfisheyes/pyfisheyes/templates/component/navigation.html'
... |
# Generated by Django 2.1.7 on 2019-04-03 20:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('user', '0031_auto_20190403_2126'),
]
operations = [
migrations.RenameField(
model_name='profile',
old_name='follow',
... |
# Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 ... |
import ROOT
import os
script_dir = os.path.dirname(os.path.abspath(__file__))
ROOT.gROOT.LoadMacro(script_dir+"/AtlasStyle.C")
ROOT.SetAtlasStyle()
|
import pandas as pd
import sqlite3
DB_FILE_PATH = 'rpg_db.sqlite3'
connection = sqlite3.connect(DB_FILE_PATH)
curs = connection.cursor()
# -- How many total Characters are there?
query1 = '''
SELECT COUNT() FROM charactercreator_character cc;
'''
result1 = curs.execute(query1).fetchall()
print('\n****RESULT1:****\n--... |
from django.contrib import admin
from.models import Article, Comment
class CommentInline(admin.TabularInline):
model = Comment
extra = 1
class ArticleAdmin(admin.ModelAdmin):
inlines = [
CommentInline
]
admin.site.register(Article, ArticleAdmin)
admin.site.register(Comment)
|
import collections
import math
from .. import utils
from . import base
__all__ = ['AdaBound']
class AdaBound(base.Optimizer):
"""AdaBound optimizer.
Example:
::
>>> from creme import compose
>>> from creme import linear_model
>>> from creme import metrics
... |
import unittest
import datetime
from sqlalchemy import and_
from knowledge_repo import KnowledgeRepository, KnowledgePost
from knowledge_repo.app.models import Post, Subscription, Email, User
from knowledge_repo.app.utils.emails import send_internal_error_email, send_subscription_emails, send_comment_email, send_revie... |
from rest_framework import generics
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create new user"""
serializer_class = UserSerializer
cl... |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .base import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPT... |
"""Contains custom skorch Dataset and CVSplit."""
from functools import partial
from numbers import Number
import warnings
import numpy as np
from scipy import sparse
from sklearn.model_selection import ShuffleSplit
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import StratifiedShuf... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... |
#ejemplo 1
num1 = 121
num2 = 33
print("resultado =", num1 ** num2)
#ejemplo 2
num1 = 131
num2 = 0.2
num3 = 402.74
print("resultado =",num1 ** num2 ** num3)
#ejemplo 3
num1 = (23 ** 23)
num2 = (1 ** 1)
num3 = 23
print("resultado =", num1 ** num2 ** num3) |
"""
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.co... |
number_grid = [
[1, 2, 4, 5],
[245, 4, 2, 4]
]
for row in number_grid:
for col in row:
print(col) |
# Copyright (c) 2022 PaddlePaddle 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 appli... |
# coding: utf-8
"""
ORY Keto
A cloud native access control server providing best-practice patterns (RBAC, ABAC, ACL, AWS IAM Policies, Kubernetes Roles, ...) via REST APIs. # noqa: E501
The version of the OpenAPI document: v0.0.0-alpha.37
Contact: hi@ory.sh
Generated by: https://openapi-generato... |
from __future__ import unicode_literals
from django.apps import AppConfig
class YtrConfig(AppConfig):
name = 'ytr'
|
"""Inventories admin."""
# Django
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
# Django forms
from django import forms
# Actions Mixin
from apps.utils.admin.actions import ActionDownloadData
# Models
from apps.inventories.models import (
Product,
... |
"""This package contains Django management related code."""
|
"""
Django settings for Core project.
Generated by 'django-admin startproject' using Django 3.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib im... |
from __future__ import print_function, division
from sympy.core.sympify import _sympify
from sympy.core import S, Basic
from sympy.matrices.expressions.matexpr import ShapeError
from sympy.matrices.expressions.matpow import MatPow
class Inverse(MatPow):
"""
The multiplicative inverse of a matrix expression
... |
from parser0 import Parser
from lexer import Lexer
from interpreter import Interpreter
def main():
while True:
try:
text = input('calc> ')
except EOFError:
break
if not text:
continue
lexer = Lexer(text)
parser = Parser(le... |
import os
import pytest
from linkml_validator.plugins.jsonschema_validation import JsonschemaValidationPlugin
from linkml_validator.plugins.range_validation import RangeValidationPlugin
from linkml_validator.validator import Validator
from tests import BASE_DIR
@pytest.mark.parametrize(
"schema,filename,plugins,... |
# Copyright 2019 The Texar 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 ... |
from django.db import models
from django.contrib.auth.models import User, PermissionsMixin
# Create your models here.
class User(User, PermissionsMixin):
def __str__(self):
return "@{}".format(self.username)
|
from django.db import models
#str. 194
from django.contrib.auth.models import User
#str. 196
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
class Action(models.Model):
user = models.ForeignKey(User, related_name='actions', db_index=True)
... |
"""Unit tests for altair API"""
import io
import json
import os
import tempfile
import pytest
import pandas as pd
import altair.vegalite.v2 as alt
@pytest.fixture
def basic_chart():
data = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28, 55, 43, 91, 81, 53, 19, 87, 5... |
# Copyright (c) 2021 Moneysocket Developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import os
import hashlib
class SharedSeed():
SHARED_SEED_LEN = 16
def __init__(self, seed_bytes=None):
self.seed_bytes = ... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "Hello world"
if __name__ == "__main__":
app.run()
|
# Copyright 2021 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 agreed to in writing, ... |
# -*- coding:utf-8 -*-
"""
:author: Albert Li
:copyright: © 2019 Albert Li
:time: 2020/4/15 21:38
"""
from flask_wtf import FlaskForm
from wtforms import SubmitField, TextAreaField
from wtforms.validators import DataRequired
class SiteDescForm(FlaskForm):
"""网站描述表单"""
body = TextAreaField(label=... |
from .base import *
# Everything here must be provided through environment variables.
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
ALLOWED_HOSTS = [os.environ['DJANGO_ALLOWED_HOSTS']]
# Database configuration env variable must be provided
DATABASES = {
'default': {
'ENGINE': os.environ['DJANGO_DB_ENGINE'... |
from flask import request
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import ValidationError, DataRequired, Length
from flask_babel import _, lazy_gettext as _l
from app.models import User
class EditProfileForm(FlaskForm):
username = StringFi... |
import graphene
from graphene import relay
from ...core.permissions import DiscountPermissions, OrderPermissions
from ...discount import models
from ..channel import ChannelQsContext
from ..channel.dataloaders import ChannelByIdLoader
from ..channel.types import (
Channel,
ChannelContext,
ChannelContextTyp... |
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('C:/Users/Hardik/Documents/OpeCV/Tut6/Noise.jpg')
kernel = np.ones((5,5),np.uint8)
gradient = cv2.morphologyEx(img,cv2.MORPH_BLACKHAT,kernel)
cv2.imshow('Original',img)
cv2.imshow('Filtered',gradient)
cv2.waitKey(0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.