text stringlengths 2 999k |
|---|
################################### LICENSE ####################################
# Copyright 2016 Morphux #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... |
# Standard Imports
import os
import re
import sys
import shutil
import tempfile
# Third Parties Imports
import unittest
from cloudify.workflows.local import init_env, load_env, FileStorage
from cloudify.test_utils.local_workflow_decorator \
import IGNORED_LOCAL_WORKFLOW_MODULES
# Local Imports
from utils import ... |
""" Tests the dash app works """
import unittest
from test.selenium_utils import open_dash
class TestApp(unittest.TestCase):
""" Tests the dash app works """
driver = open_dash()
def test_title(self):
""" Test that the app is able to load """
self.assertEqual("Dash", self.driver.title)
... |
#!/usr/bin/env python3
# Copyright 2012-2017 The Meson development team
# 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 sys
import asyncio
import bbc_songs_async
import logging
FORMAT = "%(asctime)-15s %(message)s"
logging.basicConfig(format=FORMAT,level=logging.DEBUG)
def print_titles( loop, titles ):
for title in titles:
print( title )
loop.stop()
def main(argv):
print("Hello world!")
logging.warning... |
class BST:
def __init__(self):
self.root = None
self.keys = []
def addKey(self, key):
if self.root is None:
self.root = BSTnode(key)
self.keys.append(key)
print(f'Dodalismy: {key} , wys.: {self.height(self.root)-1}')
else:
... |
from kafka import KafkaConsumer
from kafka import KafkaProducer
from petrarch2 import EventCoder
from pymongo import MongoClient
from petrarch2 import PETRwriter
import urllib
import json
from bson import ObjectId
from PhoenixConverter import PhoenixConverter
from kafka.client import SimpleClient
from kafka.producer.si... |
"""Various helpful bits and pieces without much of a common theme."""
from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2010 Andreas Kloeckner"
__license__ = """
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
fi... |
from enum import IntEnum
class MovementType(IntEnum):
INGRESS = 1
EGRESS = 2
COMMITTED = 3 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
import requests # importing request library to make https request to google news
# importing beautiful soup to extract data from the website
from bs4 import BeautifulSoup
import csv
requirement = int(input(
"Please Enter the number of articles that is required in the excel file.\n"))
stub = "https://www.news.g... |
import torch
from torch.autograd import Variable
import torch.nn as nn
from torchvision.models import vgg
from torchvision.models.vgg import VGG as DefaultVGG
from nntransfer.models.wrappers import *
from torch.hub import load_state_dict_from_url
from neural_cotraining.configs.model import ClassificationModelConfig
imp... |
#coding: utf-8
''' mbinary
#######################################################################
# File : hammingDistance.py
# Author: mbinary
# Mail: zhuheqin1@gmail.com
# Blog: https://mbinary.xyz
# Github: https://github.com/mbinary
# Created Time: 2018-12-17 17:36
# Description:
hamming distance is the numbe... |
import hashlib
from constants import dbconstants
from db import mongobase
def dictionary_from_network_builder(network_builder_object):
database_object_dict = dict({})
database_object_dict['network_type'] = network_builder_object.network_type
database_object_dict['number_of_layers'] = network_builder_objec... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Configurations management
"""
# pylint: disable=fixme,broad-except
import os
import sys
import ast
import json
from pathlib import Path
if sys.hexversion < 0x3060000:
raise Exception('Python version must be >= 3.6')
class C... |
#!/usr/bin/env python
# encoding: utf-8
from rest_framework import filters, viewsets, status
from rest_framework.response import Response
from rest_framework_bulk import ListBulkCreateUpdateDestroyAPIView
from django_filters.rest_framework import DjangoFilterBackend
from django.db.models import Q
from .models import ... |
# Copyright 2017 BBVA
#
# 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, softwar... |
# 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... |
# Retipy - Retinal Image Processing on Python
# Copyright (C) 2018 Alejandro Valdes
#
# This program 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
# (at your option) any ... |
from __future__ import absolute_import
import os
import importlib
import pkgutil
import cloudperf.providers
import cachetools
import pandas as pd
prices_url = 'https://cloudperf-data.s3-us-west-2.amazonaws.com/prices.json.gz'
performance_url = 'https://cloudperf-data.s3-us-west-2.amazonaws.com/performance.json.gz'
d... |
# -*- coding: utf-8 -*-"
import cgi
import os, sys
form = cgi.FieldStorage()
serv = form.getvalue('serv')
def get_app_dir():
d = sys.path[0]
d = d.split('/')[-1]
return sys.path[0] if d == "app" else os.path.dirname(sys.path[0])
def get_config_var(sec, var):
from configparser import ConfigParser, ExtendedInte... |
import cv2
import logging
import sys
from stego import ConcealException as ConcealException
logger = logging.getLogger(__name__)
class Image(object):
"""
Image Class
An Image object for holding the Carrier image
"""
def __init__(self, path):
"""
Init Function
:param path... |
"""Test config flow."""
from unittest.mock import Mock, patch
from openpeerpower.components.oppio.handler import OppioAPIError
from openpeerpower.const import EVENT_OPENPEERPOWER_START
from openpeerpower.setup import async_setup_component
async def test_oppio_discovery_startup(opp, aioclient_mock, oppio_client):
... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
"""
"""
from urllib.request import HTTPError, urlopen
from bs4 import BeautifulSoup
def get_exomol_database_list(molecule, isotope_full_name):
"""Parse ExoMol website and return list of available databases, and recommended database
Args:
molecule: str
isotope_full_name: str, isotope ful... |
"""Config module."""
import json
import logging
from pathlib import Path
from camerabot.exceptions import ConfigError
_CONFIG_FILE_MAIN = 'config.json'
_CONFIG_FILE_LIVESTREAM = 'livestream_templates.json'
_CONFIG_FILES = (_CONFIG_FILE_MAIN, _CONFIG_FILE_LIVESTREAM)
_LOG = logging.getLogger(__name__)
class Config... |
import ctypes
import numpy
import sys
import os
import os.path
from numpy.compat import asbytes, asstr
def _generate_candidate_libs():
# look for likely library files in the following dirs:
lib_dirs = [os.path.dirname(__file__),
'/lib',
'/usr/lib',
'/usr/local/l... |
from spotdl import const
from spotdl import handle
from spotdl import spotdl
import urllib
import pytest
def load_defaults():
const.args = handle.get_arguments(raw_args="", to_group=False, to_merge=False)
const.args.overwrite = "skip"
spotdl.args = const.args
spotdl.log = const.logzero.setup_logger(... |
class FIS(object):
def __init__(self, name):
self.name = name
self.fuzzification = []
def tri(self, x, a):
if x <= a[0]:
return 0
elif a[0] < x < a[1]:
return (x - a[0]) / (a[1] - a[0])
elif x == a[1]:
return 1
elif a[1] < x <... |
# coding=utf8
import asyncio
import time
import threading
import pprint
import sys
import traceback
import random
import amanobot
import amanobot.aio
from amanobot.namedtuple import (
InlineQuery, ChosenInlineResult, InputTextMessageContent,
InlineQueryResultArticle, InlineQueryResultPhoto, InlineQueryResultGa... |
#sbaas
from SBaaS_base.sbaas_base_query_update import sbaas_base_query_update
from SBaaS_base.sbaas_base_query_drop import sbaas_base_query_drop
from SBaaS_base.sbaas_base_query_initialize import sbaas_base_query_initialize
from SBaaS_base.sbaas_base_query_insert import sbaas_base_query_insert
from SBaaS_base.sbaas_bas... |
from flask_login import current_user
from flask_wtf import FlaskForm
from wtforms.fields import StringField, PasswordField, BooleanField, SubmitField
from wtforms.fields.html5 import URLField
from wtforms.validators import DataRequired, url, Length, Regexp, EqualTo, Email, ValidationError
from thermos.models import Us... |
# Copyright 2013 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.
from measurements import rasterize_and_record_micro
from telemetry import test
from telemetry.core import wpr_modes
from telemetry.page import page_measuremen... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from .get_suppression import *
from .suppression import *
def _register_module():
import pulumi
fr... |
# -*- coding: utf-8 -*-
import scrapy
class QuotesPaginationSpider(scrapy.Spider):
name = "quotes_pagination.py"
allowed_domains = ["toscrape.com"]
start_urls = ['http://quotes.toscrape.com/']
def parse(self, response):
self.log('I just visited: ' + response.url)
for quote in response... |
"""
File: chapter14/tree_api_service/apa102_api.py
Flask-RESTFul resource implementation for controlling APA102 LED Strip.
Built and tested with Python 3.7 on Raspberry Pi 4 Model B
Dependencies:
pip3 install flask-restful
"""
import logging
from flask_restful import Resource, Api, reqparse, inputs
# Initialize L... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
import json
import logging
import os
import re
import signal
import subprocess
from typing import Any, Dict, List, Optional
import wandb
from wandb.errors import CommError, LaunchError
from .abstract import AbstractRun, AbstractRunner, Status
from .._project_spec import (
DEFAULT_LAUNCH_METADATA_PATH,
get_ent... |
import json
import argparse
import os
import time
import torch
import numpy as np
from scipy.spatial.distance import cosine
from sklearn.preprocessing import scale
from sklearn.linear_model import LogisticRegression
import chart_studio
import chart_studio.plotly as py
import plotly.io as pio
import plotly.graph_obje... |
"""
Django settings for dummy_app project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... |
from backend.common_tile import CommonTile
import math
class DiplomaticQuarter(CommonTile):
def __init__(self):
super().__init__()
self.default_building_list = [
'consulate',
'chancery',
]
self._building_list = None
self._consulate = None
se... |
from dataclasses import dataclass
from typing import List, Optional
from tinkoff.investments.model.base import (
BaseModel,
Currency,
FigiName,
InstrumentType,
TickerName,
)
@dataclass
class MarketInstrument(BaseModel):
figi: FigiName
ticker: TickerName
lot: int
name: str
type... |
from django.shortcuts import render, redirect
from models import User
from account.models import Volunteer,Accomadation,Hospital,Pronearea
from account.views import landinpage
from controlunit.views import cplandinpage
from tests import index
def register(request):
if request.method == 'POST' and 'register' i... |
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of sourc... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
# function
def f(x):
return 2*x[0]**2 + 10*x[1]**2
# gradient (normalized)
def fp(x):
fx1 = 4*x[0]
fx2 = 20*x[1]
# mag = np.sqrt(fx1**2+fx2**2)
return np.array([fx1, fx2])
x0 = [3,3]
res = minimize(f, x0)#, jac=fp)
p... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='Profil3r',
version="1.3.1",
packages=find_packages(),
author="Rog3rSm1th",
author_email="r0g3r5@protonmail.com",
install_requires=["pwnedpasswords", "requests", "PyInquirer", "jinja2"],
description="Profil3r is... |
#!/usr/bin/env python3
import logging
import sys
import tempfile
import threading
import time
import unittest
import warnings
from os.path import dirname, realpath; sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
from logger.writers.text_file_writer import TextFileWriter
from logger.writers.composed_w... |
# Copyright 2013 NEC 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 ag... |
import logging
import json
from flask import Flask, request, Response
from flask_restful import Resource, Api, Headers
import os
app = Flask(__name__)
api = Api(app)
logging.basicConfig(level=logging.INFO,
format='[%(asctime)s] [%(levelname)s] %(module)s.%(funcName)s:%(lineno)s: %(message)s')
cl... |
import configparser
import argparse
import time
import random
from .webship import WebDrive
from .ourdatabase import DataBase
import os
import traceback
def main():
# Parse config.ini
config = configparser.ConfigParser(allow_no_value=True)
config_filename = os.path.join(os.path.dirname(os.path.realpath(_... |
# -*- coding: utf-8 -*-
"""Test for tmuxp Session object."""
from __future__ import absolute_import, unicode_literals, with_statement
import logging
import pytest
from libtmux import Pane, Session, Window, exc
from libtmux.common import has_gte_version
from libtmux.test import TEST_SESSION_PREFIX, namer
logger = lo... |
"""
Reload All Link Documents
TESTED REVIT API: 2017
Author: min.naung@https://twentytwo.space/contact | https://github.com/mgjean
This file is shared on www.revitapidocs.com
For more information visit http://github.com/gtalarico/revitapidocs
License: http://github.com/gtalarico/revitapidocs/blob/master/LICENSE.md
"... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: 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: postgresql_user
short_description:... |
import os
import random
import math
import time
import argparse
import yaml
from collections import OrderedDict
import ..utils
import modules
import datasets
import models
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import D... |
from django.db import connection
from baserow.contrib.database.fields.models import (
TextField, LongTextField, NumberField, BooleanField, DateField, LinkRowField,
FileField
)
class FieldFixtures:
def create_model_field(self, table, field):
with connection.schema_editor() as schema_editor:
... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
import _plotly_utils.basevalidators
class MetaValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="meta", parent_name="icicle", **kwargs):
super(MetaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
array_ok=kw... |
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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 th... |
import os
import sys
import json
from flask_sqlalchemy import SQLAlchemy
from flask import (jsonify, request, Response, abort, Flask, render_template)
from sqlalchemy import inspect
from flask_jwt_extended import (JWTManager, create_access_token, jwt_required, get_jwt_identity, get_raw_jwt)
from datetime import ... |
import disnake
from typing import Union
from disnake.ext import commands
import database as db
import constants as var
from functions import get_prefix
from ext.permissions import has_command_permission
class ReactionRoles(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def cog_check(sel... |
from pprint import pprint
from ayesaac.services.common import QueueManager
from ayesaac.utils.logger import get_logger
logger = get_logger(__file__)
class Interpreter(object):
"""
The Interpreter class purpose is a simple comparison with what the vision part find
and what the user asked for.
(Whic... |
#!/usr/bin/python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
from __future__ import division
## about: process homophily/monophily across all Add Health Schools [in-directed]
## for reference: [Male == 1; Female == 2, Unreported/Missing = 0]
## codings are based on: http://moreno.ss.uci.edu/data.html#adhealth
## how to run [example]:
## cd [Folder_Path_of_Script]
## python c_... |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... |
import streamlit as st
import pandas as pd
import numpy as np
st.title('Share My Places from Google Maps') |
import numpy as np
from .....Ports import NEUROMODULATORS, AP, BP, ARRIVE
from pydesim import Errors
import math
class RSTDP:
"""
negative dw when dt < 0 using STDP rule
positive dw when dt > 0 using RSTDP rule
Use small An value
"""
def __init__(
self,
s,
Ap,
A... |
import torch
from scipy.ndimage import zoom
from sklearn.model_selection import train_test_split
import jrieke.datasets as datasets
import numpy as np
def pprint(*args):
out = [str(argument) + "\n" for argument in args]
print(*out, "\n")
class Flatten(torch.nn.Module):
def __init__(self):
super(... |
from rest_framework import serializers
class IntegerPrimaryKeyField(
serializers.PrimaryKeyRelatedField,
serializers.IntegerField,
):
"""A field that refers to foreign keys by an integer primary key."""
|
import click
import sys
class CondorCommand(click.MultiCommand):
@property
def commands(self):
from condor.scripts.bibliography import bibliography
from condor.scripts.model import model
from condor.scripts.query import query
from condor.scripts.matrix import matrix
fr... |
import numpy as np
import pandas as pd
import pdb
class DataGeneratorDF(object):
"""input is a DataFrame with MultiIndex, considering Panal data structure is depreciated after pandas=0.24"""
def __init__(self, data_df, sequence_window=2, add_cash=False, risk_free_return=0.0001):
data_df = data_df.... |
from typing import Dict
from typing import List
from typing import Set
from redisolar.dao.base import SiteGeoDaoBase
from redisolar.dao.base import SiteNotFound
from redisolar.dao.redis.base import RedisDaoBase
from redisolar.models import GeoQuery
from redisolar.models import Site
from redisolar.schema import FlatSit... |
import graph_nets as gn
import sonnet as snt
import networkx as nx
import numpy as np
import setGPU
import tensorflow as tf
tf.compat.v1.set_random_seed(42)
from graph_nets import utils_np, utils_tf
from heptrkx import load_yaml
from heptrkx import master
import os
import glob
import argparse
import ... |
#!/usr/bin/env python
# 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
# "L... |
from flask import render_template,request,redirect,url_for,abort,flash
from . import main
from ..models import User,Comments,Pitches
from .. import db,photos
from .forms import UpdateProfile ,NewPitch, NewComment
from flask_login import login_required
import markdown2
# Views for our templates
@main.route('/')
def ind... |
from __future__ import absolute_import
from mock import patch, PropertyMock
from django_nose.tools import assert_equal
from pontoon.base.utils import aware_datetime
from pontoon.base.tests import TranslationFactory
from pontoon.checks.models import (
Warning,
Error,
)
from pontoon.sync.tests import FakeCheck... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djconnectwise', '0010_remove_project_project_href'),
]
operations = [
migrations.AddField(
model_name='company',... |
import asyncio
import os
import random
import statcord
import aiosqlite
from dotenv import load_dotenv
import discord
from discord import errors
from discord.ext import commands
import koreanbots
from koreanbots.integrations import discord
load_dotenv(verbose=True)
class botstat(commands.Cog):
def __init__(self, bo... |
import onnx
from onnx import helper
from onnx import TensorProto
from enum import Enum
def GenerateModel(model_name, sign, b_zp = True, bias = False):
nodes = [ # DynamicQuantizeMatMul subgraph
helper.make_node("DynamicQuantizeLinear", ["A"], ["a_quantized", "a_scale", "a_zp"], "DynamicQuantizeLinear"),
... |
from Database import GlobalDatabase
from queue import Empty
from MakeComposite import MakeComposite
def CompositeImage( qRequest, qReply ):
while True:
message = qRequest.get()
# Skip all but the last message in case we fall behind.
while True:
if message[0] == 'terminate':
return
try:
messa... |
from data import make_dataset, save_submission
from features import build_features
from models import train_model, predict_model
def main():
train, test, words, users = make_dataset.main()
X, y, final_test = build_features.main(train, test, words, users)
pipeline = train_model.fit(X, y)
submissions = predict_mod... |
# FILE NAME : Team-One-Calculator-Project.py
# DESCRIPTION : Calculator Program
# FUNCTION DEFINITIONS:
def div(n1,n2):
return n1/n2
def mult(n1,n2):
return (n1*n2)
def sub(n1, n2):
return (n1-n2)
def add(num1,num2):
c=num1+num2
print ("Sum = " + str(c))
# INITIAL MESSAGE:
print ("Welcome to Calculator Functi... |
"""Probabilistic numerical methods for solving linear systems.
This module provides routines to solve linear systems of equations in a
Bayesian framework. This means that a prior distribution over elements
of the linear system can be provided and is updated with information
collected by the solvers to return a posteri... |
#!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Interlis driver testing.
# Author: Pirmin Kalberer <pka(at)sourcepole.ch>
#
###############################################################... |
from __future__ import absolute_import, division
__filetype__ = "detector"
#External Modules
import os
import numpy as np
from astropy.io import fits as pyfits
#Local Modules
from ..astro_image import AstroImage
from .instrument import Instrument
from .jwst_instrument import JwstInstrument
from ..utilities import O... |
"""
Definition of forms.
"""
from django import forms
# from django.utils.translation import ugettext_lazy as _
from forum.models import Topic, Post, Forum
class PostForm(forms.ModelForm):
class Meta():
model = Post
exclude = ('creator', 'updated', 'created', 'topic', 'user_ip',)
class Topi... |
# Copyright 2014 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" file accompa... |
from app import db, bcrypt
from mongoengine import signals
from datetime import datetime
class User(db.Document):
username = db.StringField(required=True, verbose_name="用户名")
email = db.StringField(required=True, verbose_name="E-Mail")
password = db.StringField(verbose_name='修改密码')
password_hash = db.... |
# 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... |
from mmdet.datasets.builder import PIPELINES
from mmdet.datasets.pipelines import LoadAnnotations
@PIPELINES.register_module()
class LoadAnnotationsOBB(LoadAnnotations):
def __init__(self,
with_obb=False,
# with_annotation_type=False,
# with_rpnsemi_type=False,
... |
import torch
import numpy as np
from typing import Tuple, Any, Union, Optional, Dict
TensorType = Any
class DMControlSuiteEnv:
def __init__(self,
name: str,
max_episode_length: int = 1000,
action_repeat:int = 2,
size: Tuple[int] = (64, 64),
... |
# 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... |
import string
def alpha_to_num(in_alpha):
# Upper- and lowercase characters have different ascii decimal values.
# Therefore we need to set a different starting position for each.
if in_alpha.isupper():
ascii_start_position = 65
else:
ascii_start_position = 97
# Gives us a number... |
import os
import commons
install_phase = commons.POST_INSTALL
enabled = True
def execute(installer):
# Generage machine-id for live setup, but keep this file empty for images
# so it gets regenerated on boot.
if installer.install_config['live']:
installer.cmd.run_in_chroot(installer.photon_root, "... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 22 20:45:02 2020
@author: Anubhav Sharma
"""
import sys
import os
import tkinter as tk
def send():
os.system('python3 gui.py')
def rece():
os.system('python3 client.py')
window=tk.Tk()
window.config(bg="black")
window.title("Pair Share"... |
# ----------------------------------------------------------------------------
# Copyright (c) 2020, Franck Lejzerowicz.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------... |
import os
import secrets
from twython import Twython
import redis
from flask import Flask, flash, redirect, render_template, request, url_for, jsonify
from settings import UPLOAD_FOLDER, REDIS_HOST
from utils import allowed_file, get_extension, get_job_position
app = Flask(__name__)
app.secret_key = os.environ.get("... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# 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 Apach... |
default_app_config = "User.apps.UserConfig" |
from pathlib import Path
import pytest
from haystack.file_converter import MarkdownConverter
from haystack.file_converter.docx import DocxToTextConverter
from haystack.file_converter.pdf import PDFToTextConverter, PDFToTextOCRConverter
from haystack.file_converter.tika import TikaConverter
@pytest.mark.tika
@pytest... |
#
# A class representing the entire user interface of a Z-Machine.
#
# For the license of this file, please consult the LICENSE file in the
# root directory of this distribution.
#
import zaudio
import zscreen
import zstream
import zfilesystem
class ZUI(object):
"""This class encapsulates the entire user interfac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.