text stringlengths 1 927k |
|---|
from rb_tocase import Case
STRINGS = [
"Hello World Haha",
"hello world haha",
"HELLO WORLD HAHA",
"Hello-World-Haha",
"hello-world-haha",
"HELLO-WORLD-HAHA",
"Hello_World_Haha",
"hello_world_haha",
"HELLO_WORLD_HAHA",
"HelloWorldHaha",
"helloWorldHaha"
]
for s in STRI... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..histogrammatching import HistogramMatching
def test_HistogramMatching_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
usedefault=True,
... |
# api.py
from dotenv import load_dotenv
load_dotenv()
import flask
from mongo import load_db
app = flask.Flask(__name__)
app.config["DEBUG"] = True
db = load_db()
@app.route("/", methods=["GET"])
def home():
return "<h1>Payoff API</h1><p>Back-end to the Payoff Budget Application</p>"
app.run() |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import L... |
'''
This is really a very simple a64dbg python adp demo.
'''
# import basic adp definition like error/event code
from adpdef import *
# import adp api entries
from adp import *
import os
# adcpp output handler for api send2py
def adcpp_output(data):
print(data)
# auto attach the Calculator process
def attach_calc... |
from .models import Projects,Rates,Comments,Profile
from django import forms
class RateForm(forms.ModelForm):
class Meta:
model=Rates
exclude=['user','project']
class PostForm(forms.ModelForm):
class Meta:
model=Projects
exclude=['user','design','usability','content']
class ... |
import os
import xml.etree.ElementTree as ET
import csv
filepath = "C:/Your/Folder/Labelme/Files/" # set path of Labelme XML Files here include slash at end of path
for filename in os.listdir(filepath):
try:
file = filepath + filename
tree = ET.parse(file)
root = tree.getroot()
o... |
"""This module contains the general information for MgmtEntity ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MgmtEntityConsts:
CHASSIS_DEVICE_IO_STATE1_OK = "ok"
CHASSIS_DEVICE_IO_STATE1_OPEN_ERROR = "openError"... |
import unittest
from odesli.Odesli import Odesli
from odesli.entity.song.Song import Song
EXPECTED_YOUTUBE_SONG = Song('VHb_XIql_gU', 'youtube', 'Kids', 'MGMT - Topic', 'https://i.ytimg.com/vi/VHb_XIql_gU/hqdefault.jpg', 480, 360, { 'youtube': 'https://www.youtube.com/watch?v=VHb_XIql_gU', 'youtubeMusic': 'https://mu... |
# coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team and Facebook, 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
#
# Un... |
# OpenPharmacophore
from openpharmacophore._private_tools.exceptions import InvalidFileFormat, NoLigandsError, OpenPharmacophoreTypeError
from openpharmacophore.pharmacophore.pharmacophoric_point import UniquePharmacophoricPoint
from openpharmacophore import StructuredBasedPharmacophore
from openpharmacophore import Ph... |
from __future__ import annotations
from jsonclasses import jsonclass, types
from jsonclasses_pymongo import pymongo
@pymongo
@jsonclass(class_graph='simple')
class SimpleScore:
name: str
score: float |
# Standard Library
import json
import os
import shutil
# Import from third library
import torch
# Import from local
from .log_helper import default_logger as logger
from .registry_factory import SAVER_REGISTRY
__all__ = ['Saver']
@SAVER_REGISTRY.register('base')
class Saver(object):
def __init__(self, save_cf... |
from redis import Redis, StrictRedis
r0 = StrictRedis.from_url('redis://localhost/0')
r1 = StrictRedis.from_url('redis://localhost/0', socket_timeout=10)
r2 = StrictRedis.from_url('redis://localhost/0?socket_timeout=10')
r3 = StrictRedis()
url1 = 'redis://localhost/0'
r4 = StrictRedis.from_url(url1)
r5 = StrictRedis.... |
# 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 zope.publisher.interfaces.browser import IDefaultBrowserLayer
class IYafowilLayer(IDefaultBrowserLayer):
"""YAFOWIL related browser layer.
"""
class IYafowilDemoLayer(IYafowilLayer):
"""YAFOWIL demos related browser layer.
""" |
"""test import from a builtin module"""
from __future__ import absolute_import
__revision__ = None
from math import log10
def log10_2():
"""bla bla bla"""
return log10(2) |
import spikeextractors as si
#import spikewidgets as sw
import spiketoolkit as st
import mlprocessors as mlpr
import json
from cairio import client as ca
import numpy as np
from copy import deepcopy
def compare_sortings_with_truth(sortings,compute_resource,num_workers=None):
print('>>>>>> compare sortings with tru... |
"""
Augmenters that create wheather effects.
Do not import directly from this file, as the categorization is not final.
Use instead::
from imgaug import augmenters as iaa
and then e.g.::
seq = iaa.Sequential([iaa.Snowflakes()])
List of augmenters:
* FastSnowyLandscape
* Clouds
* Fog
* Clou... |
"""
Create the numpy.core.multiarray namespace for backward compatibility. In v1.16
the multiarray and umath c-extension modules were merged into a single
_multiarray_umath extension module. So we replicate the old namespace
by importing from the extension module.
"""
import functools
import warnings
from . import o... |
'''
python代码调用dll例程
dll功能为读写剪切板(自定义格式)
'''
from ctypes import cdll, c_void_p, c_int, c_wchar_p
class CExtDll:
'''
封装dll导出功能
1.写入格式是自定义的RemoteFileName,因此写入后,操作系统的粘贴不能操作.
2.读出格式支持两种,自定义的和系统的.因此操作系统的复制/剪切操作后,也可以读出.
3.系统剪切板同一类数据只保存一个,因此写入剪切板后,之前的自定义数据会被清空.
4.如果剪切板中存在两种可读数据(目前未出现,操作系统复制/剪切前会清空自定义... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from functools import namedtuple, partial
import warnings
import tqdm
import jax
from numpyro.util import _versiontuple
if _versiontuple(jax.__version__) >= (0, 2, 25):
from jax.example_libraries import optimizers
else:
fro... |
#Julie Chang and Chris Metzler 2020
import abc
# import tensorflow as tf
import numpy as np
# import matplotlib as mpl
# mpl.use('TKAgg')
import matplotlib.pyplot as plt
from PIL import Image
from numpy.fft import ifftshift
import fractions
# import layers.optics_no_transpose as optics
#import optics_no_transpose as ... |
import pandas as pd
import os
from configparser import ConfigParser
from datetime import datetime
import numpy as np
def analyze_process_data_log(configini,chosenlist):
dateTime = datetime.now().strftime('%Y%m%d%H%M%S')
config = ConfigParser()
configFile = str(configini)
config.read(configFile)
c... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in producti... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @file intro_convolution.py
# @brief
# @author QRS
# @blog qrsforever.github.io
# @version 1.0
# @date 2019-06-03 20:52:26
################################ jupyter-vim #######################################
# https://github.com/qrsforever/vim/blob/master/bundle/.configs/j... |
# chatbot/bot.py
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
diego = ChatBot("Diego")
trainer = ChatterBotCorpusTrainer(diego)
trainer.train(
"chatterbot.corpus.english.greetings",
"chatterbot.corpus.english.conversations",
) |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2020, Battelle Memorial Institute.
#
# 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... |
import os
def create_folder(initial_dir, nb, service):
directory = os.path.join(initial_dir, nb)
directory = os.path.join(directory, service)
if not os.path.exists(directory):
os.makedirs(directory)
print('Created patient directory -- ' + directory)
else:
prin... |
import datetime
import unittest
from conflowgen.domain_models.container import Container
from conflowgen.domain_models.data_types.container_length import ContainerLength
from conflowgen.domain_models.data_types.mode_of_transport import ModeOfTransport
from conflowgen.domain_models.data_types.storage_requirement import... |
from unittest.mock import patch
import os
from chapter10 import C10
import pytest
TESTDIR = os.path.join(os.path.dirname(__file__), 'tests')
def pytest_configure():
pytest.SAMPLE = os.path.join(TESTDIR, '1.c10')
pytest.EVENTS = os.path.join(TESTDIR, 'event.c10')
pytest.ETHERNET = os.path.join(TESTDIR, ... |
"""Import uuid to create unique order number"""
import uuid
from django.db import models
from django.db.models import Sum
from django.conf import settings
from django_countries.fields import CountryField
from products.models import Product
from profiles.models import UserProfile
class Order(models.Model):
"""
... |
import copy
import sys
sys.path.append("..")
sys.path.append("../../../..")
import os
import argparse
import numpy as np
import torch
import torch.nn as nn
from models import nin_gc, nin
import quantize
# ******************** 是否保存模型完整参数 ********************
#torch.set_printoptions(precision=8, edgeitems=sys.maxsize,... |
from app import create_app,db
from flask_script import Manager,Server
from app.models import User, Joke, Commentjoke, Debate, Commentdebate, Pickup, Commentlines
from flask_migrate import Migrate, MigrateCommand
#Creating app instance
# app = create_app('development')
app = create_app('production')
# app = create_ap... |
from psy.cdm.irm import McmcHoDina, McmcDina, EmDina, MlDina
from psy.mirt.irm import Irt2PL, Mirt2PL
from psy.mirt.grm import Grm
from psy.cat.tirt import SimAdaptiveTirt
from psy.fa.rotations import GPForth
from psy.fa.factors import Factor
from psy.sem.cfa import cfa
from psy.sem.sem import sem
from psy.sem.ccfa imp... |
""" Generates Tisserand plots """
from enum import Enum
import numpy as np
from astropy import units as u
from matplotlib import pyplot as plt
from poliastro.plotting._base import BODY_COLORS
from poliastro.twobody.mean_elements import get_mean_elements
from poliastro.util import norm
class TisserandKind(Enum):
... |
from mpyc.runtime import mpc
from src.dataset import ObliviousDataset, Sample
from src.output import output
from src.secint import secint as s
from src.forest import train_forest
def sample(ins, out):
return Sample([s(i) for i in ins], s(out))
samples = ObliviousDataset.create(
sample([1, 1, 1, 2], 1),
... |
import matplotlib.pyplot as plt
n = 5
T = [-1, -.5, 0., .5, 1]
x = [1] * len(T)
y = [1] * len(T)
plt.subplot(122)
for i in range(1, n+1):
for j in range(len(T)):
x[j], y[j] = (x[j] + y[j]*T[j], x[j] - y[j]*T[j])
for j in range(len(T)-1):
plt.arrow(x[j], y[j], x[j+1]-x[j], y[j+1]-y[j], head_wid... |
from typing import Dict, Optional
import pydantic
from settings.globalsettings import GlobalSettings
globalsettings = GlobalSettings()
AWS_ACCOUNT_ID = globalsettings.AWS_ACCOUNT_ID
AWS_REGION = globalsettings.AWS_REGION
class GlueSettings(
pydantic.BaseSettings
): # pylint: disable=too-few-public-methods
... |
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
PACKAGE = 'logrotate'
PACKAGE_BINARY = '/usr/sbin/logrotate'
def test_logrotate_package_installed(host):
"""
Tests if logrotate packag... |
from board import Board
from algorithm import minimax_alpha_beta
import time
from statistics import mean
from math import sqrt, floor
board_list_start = [[".", "b", ".", "b", ".", "b", ".", "b"],
["b", ".", "b", ".", "b", ".", "b", "."],
[".", "b", ".", "b", ".", "b", ".", "b"],
... |
import csv
def parse_tickers(tickers):
"""accepts tickers string input i.e. 'GOOG,AAPL,MSFT'
and outputs tickers list ['GOOG','AAPL','MSFT']"""
num_commas = tickers.find(',')
tickers = tickers.rsplit(',',num_commas+1)
return tickers
def write_portfolio(portfolio,tickers,file_p... |
# Generated by Django 3.1.1 on 2020-09-28 19:21
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('realtors', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
from typing import Dict
import dgl
import dgl.function as fn # for graphs
import numpy as np
import torch
import torch.nn as nn
from dgl.nn.pytorch.glob import AvgPooling, MaxPooling
from dgl.nn.pytorch.softmax import edge_softmax
from einops import rearrange
from packaging import version
from torch import Tensor, ei... |
"""
pythonmodule
============
Provides utility functions for working with SHEMAT-Suite output in Python.
"""
import os
import shutil
###############################################################################
# Directories #
#########################... |
# -*- coding: utf-8 -*-
# Smart Contract Reverse Engineering Toolkit: Mapping
#
# Copyright (C) 2019-2020 CRTK Project
# Author: Hao-Nan Zhu <hao-n.zhu@outlook.com>
# URL: <https://github.com/hao-n/crtk>
# For license information, see LICENSE
opcode_mapping = {
'00': 'STOP',
'01': 'ADD',
'02': 'MUL',
'... |
# Copyright 2015 Violin Memory, 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 requi... |
#!/usr/bin/python
#
# This file is part of django-emporio project.
#
# Copyright (C) 2011-2020 William Oliveira de Lagos <william.lagos@icloud.com>
#
# Emporio is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as published by
# the Free Software Founda... |
# %%
import gc
import itertools
import math
import typing as ty
from copy import deepcopy
from pathlib import Path
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim.swa_utils as swa_utils
import zero
from torch import Tensor
import wandb
import lib
import lib.nod... |
# built-in
from typing import List, Type
# app
from ._base import BaseShell
from ._manager import Shells
from ._utils import is_windows
def _register_shell(cls: Type[BaseShell]) -> Type[BaseShell]:
if cls.name in Shells.shells:
raise NameError('already registered: ' + cls.name)
Shells.shells[cls.name... |
from django import forms
class EpochForm(forms.Form):
epochtime = forms.IntegerField(required=True) |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import getopt
import web
import sys
#from web.wsgiserver import CherryPyWSGIServer
#from cherrypy import wsgiserver
from cheroot import wsgi # This replaces the 2 above
from flask import Flask, request, request_started
from functools import wraps
from models import User, Account
from database import db_session
import s... |
from factory import Faker
from factory.django import DjangoModelFactory
from ..models.tnb_faucet import FaucetModel, FaucetOption, PostModel
class FaucetOptionFactory(DjangoModelFactory):
# account_number = Faker('pystr', max_chars=VERIFY_KEY_LENGTH)
coins = Faker('pyint', max_value=1500, min_value=1)
de... |
class Verification:
types = {
'activationToken': str,
'answer': str,
'passCode': str,
'nextPassCode': str
}
def __init__(self):
self.activationToken = None # str
self.answer = None # str
self.passCode = None # str
self.nextPassCode = N... |
# -*- coding: utf-8 -*-
import scrapy
import json
import re
import logging
from locations.items import GeojsonPointItem
class PigglyWigglySpider(scrapy.Spider):
''' This spider scrapes from two different places, an api which has their stores in Wisconsin
and Illinois, and a page which has all of their oth... |
import tensorflow as tf
def dense_model(in_shape, hidden_layer_shapes, num_outputs, name):
x = None
inputs = tf.keras.layers.Input(shape=(in_shape,), name="observations")
for i,layer_shape in enumerate(hidden_layer_shapes):
x = tf.keras.layers.Dense(
layer_shape, name="dense_" + str(i)... |
import argparse
import os
import shutil
import time
import math
import logging
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms a... |
"""Program to make a peanut butter and jelly sandwich."""
def go_to_store():
"""Go to the store and buy sandwich ingredients."""
print("Buying bread...")
print("Buying peanut butter and jelly...\n")
def prepare_ingredients():
"""Prepare sandwich ingredients."""
print("Toasting bread...")
pri... |
import pyro.poutine as poutine
from pyro.logger import log
from pyro.poutine import condition, do, markov
from pyro.primitives import (clear_param_store, enable_validation, factor, get_param_store, iarange, irange, module,
param, plate, plate_stack, random_module, sample, validation_enabled... |
import argparse
import torch
import os
from transformers import AutoTokenizer, AutoModelForMaskedLM
from utils import load_data, write_to_file
from metric import compute_metrics
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model_name_or_path", default="model/chinese_be... |
# from __future__ import annotations
import torch
from itertools import combinations
from typing import Union, Sequence, Callable, Optional
from torch.multiprocessing import Value
from rising.random import AbstractParameter, DiscreteParameter
from rising.transforms.abstract import AbstractTransform, BaseTransform
fro... |
from dictknife import loading
from dictknife.jsonknife import get_resolver
from dictknife import DictWalker
def run(*, filename):
def onload(d, resolver, w=DictWalker(["$include"])):
for _, sd, in w.walk(d):
subresolver, jsref = resolver.resolve(sd.pop("$include"))
sd.update(subres... |
import HABApp
from HABApp.core.events import AllEvents
from . import WrappedFunction
from typing import Optional, Any
class EventBusListener:
def __init__(self, topic, callback, event_type=AllEvents,
attr_name1: Optional[str] = None, attr_value1: Optional[Any] = None,
attr_name2:... |
'''
Stuff for driving MS office applications from Python using COM
Currently just Excel but Word will come soon.
'''
from win32com.client import Dispatch
from types import *
from string import uppercase
class Excel:
'''
Wrapper for MS Excel derived from that in Python Programming on Win32
'''
def __i... |
from datetime import datetime
import os
from bson.objectid import ObjectId
from girder import logger
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.setting import Setting
from girder.models.user import User
from girder.settings import SettingKey
from girder.utility.mail_... |
#!/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 enum
def __init__():
global __all__
global arch
import sys
import importlib
__all__ = []
arch = dict()
CurModule = sys.modules[__name__]
for entry in os.listdir(os.path.dirname(__file__)):
if os.path.isdir(os.path.dirname(__file__) + "/" + entry):
... |
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.urls import reverse_lazy, reverse
from django.utils.safestring import mark_safe
from django.views.generic.detail import DetailView
from django.views.generic.edit import ... |
from contractionsDict import contractionsDict
import pandas as pd
import time
import numpy as np
import re
from pattern.en import pluralize, singularize
import sys
import csv
from LemmitizationandStemConverter import ObtainStemAndLemmatizationWord
def priorProb(scv):
pct = 0 #positive count total
nct = 0 #negative c... |
#!/usr/bin/env python3
""" for testing the module awsbuild """
import sys
import logging
from bao_config import AwsConfig
from bao_connector import AwsConnector
def main():
""" main """
my_logfile = 'logs/awsbuild.log'
my_region = 'us-east-1'
#my_vpc = 'vpc-xxx'
#my_tag = 'momo-us-east-1'
# s... |
WHITELIST = [
'',
' pages',
'!',
'"',
'#blamebarks',
'#blamebethy',
'#blamedan',
'#blamedrew',
'#blamedubito',
'#blamegeezer',
'#blamelimeymouse',
'#blameloopy',
'#blameremote',
'#blameskipps',
'#blamesmirky',
'#blametubby',
'#smirkbump',
'#smirkyc... |
from django.db import models
from django.contrib.auth.models import AbstractUser
import json
# Create your models here.
class User(AbstractUser):
USERTYPE_CHOICES = (
('buyer', 'Buyer'),
('seller', 'Seller')
)
userType = models.CharField(choices=USERTYPE_CHOICES, default='buyer', max_length=9)
profile_... |
"""
Test method for Sub opcode
"""
from easier68k.simulator.m68k import M68K
from easier68k.core.opcodes.subq import Subq
from easier68k.core.models.assembly_parameter import AssemblyParameter
from easier68k.core.enum.ea_mode import EAMode
from easier68k.core.enum.register import Register
from easier68k.core.enum.op_... |
class py_solution:
def __init__(self,L):
self.L = L
self.stack = []
self.A = ['(','[','{']
self.B = [')',']','}']
def is_valid_parentheses(self):
for i in self.L :
if i in self.A :
self.stack.append(i)
else :
if len... |
import pytest
import os
import platform
import time
import requests
from validators import (
validate_dns_dashboard,
validate_storage,
validate_ingress,
validate_ambassador,
validate_gpu,
validate_registry,
validate_forward,
validate_metrics_server,
validate_prometheus,
validate_... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2019-01-04 08:34
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... |
# -*- coding: utf-8 -*-
from app.core.models import Domain
def get_domainid_bysession(request):
""" 获取操作域名ID
:param request:
:return:
"""
try:
domain_id = int(request.session.get('domain_id', None))
except:
domain_id = 0
if not domain_id:
obj = Domain.objects.order_b... |
from django.contrib import admin
# Register your models here.
from .models import feedback_data
admin.site.register(feedback_data) |
"""This module contains the user model that regesters a new user """
import os
import datetime
from .db import Db
from werkzeug.security import generate_password_hash
class User():
def __init__(self, username, email, password, designation):
self.username = username
self.email = email
self.... |
"""
now using
https://towardsdatascience.com/reading-and-visualizing-geotiff-images-with-python-8dcca7a74510
https://github.com/GeoUtils/georaster/blob/master/georaster/georaster.py
https://rasterio.readthedocs.io/en/latest/topics/color.html
"""
import os
import pprint as pp
import time
from datetime import datetime
f... |
from immfly.settings import * # NOQA
INSTALLED_APPS += [ # NOQA
'drf_yasg',
] |
import discord
import requests
import os
my_secret = os.environ['TOKEN']
glow = 'terra1tu9yjssxslh3fd6fe908ntkquf3nd3xt8kp2u2'
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == cl... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from functools import wraps
from inspect import Parameter, signature
from itertools import chain
from typing import Mapping, Sequence
class CallParamDict:
def __init__(
self,
func,
args: tuple,
kwargs: dict,
pos_param_names: Sequence[str],
all_params: Mapping[str, P... |
try:
from pip.req import parse_requirements
except ImportError:
# The req module has been moved to pip._internal in the 10 release.
from pip._internal.req import parse_requirements
import lnt
import os
from sys import platform as _platform
import sys
from setuptools import setup, find_packages, Extension
i... |
from moviepy.editor import VideoFileClip
import os
def setbitrate(inputvideo, bitrate):
"""
改变视频码率,降低码率也可以实现对视频大小的最优化压缩
:param inputvideo:
:param bitrate: 例如600k
:return:
"""
path, _ = os.path.splitext(inputvideo)
a = '设置码率{}.mp4'.format(bitrate)
name = path + a
cmd = 'ffmpeg -... |
class SceneFile:
def __init__(self, fileName, root):
self.root = root
self.file = fileName
self.meta = None |
"""
Ethereum Virtual Machine (EVM) Errors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. contents:: Table of Contents
:backlinks: none
:local:
Introduction
------------
Errors which cause the EVM to halt exceptionally.
"""
class StackUnderflowError(Exception):
"""
Occurs when a pop is executed on an empt... |
from distutils.core import setup
setup(
name='pyrules',
version='0.2',
packages=['pyrules2'],
package_dir={'': 'src'},
url='https://github.com/mr-niels-christensen/pyrules',
license='MIT',
author='Niels Christensen',
author_email='nhc@mayacs.com',
description='pyrules is a pure-Pyth... |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
A simple example to run CCSD(T) and UCCSD(T) calculation.
'''
import pyscf
mol = pyscf.M(
atom = 'O -0.26677564 -0.27872083 0.00000000;\
H -0.26677564 0.82127917 0.00000000;\
H -0.266775... |
__author__ = 'pather'
import urllib.request
import re
africa_url_response = urllib.request.urlopen('http://worldpopulationreview.com/continents/africa-population/')
africa_url_html = africa_url_response.read()
africa_url_text = africa_url_html.decode('UTF-8')
africa_current_population = re.search('<span>([^<]*)', afr... |
# 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
from datetime import datetime
from spotty.providers.gcp.helpers.ce_client import CEClient
class Instance(object):
def __init__(self, ce: CEClient, data: dict):
"""
Args:
data (dict): Example:
{'canIpForward': False,
'cpuPlatform': 'Intel Haswell',
... |
#
# Copyright (C) 2014 Dell, 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 wri... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import modelcluster.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailembeds.blocks
import wagtail.wagtailimages.blocks
from django.db import migrations, models
import articles.fields
import interactives.mod... |
import numpy as np
def power(x):
return np.power(x, 2) |
import argparse
import cv2
import os
import numpy as np
from math import log10, ceil
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--input_file', type=str, required=True, default=None,
help="input video file (.avi, .mp4, .mkv, mov)")
parser.add_argument('... |
import os
from pathlib import Path, PurePosixPath
from typing import Any, Dict, Iterable, Optional, Union
from ..client import Client, register_client_class
from ..cloudpath import implementation_registry
from .s3path import S3Path
try:
from boto3.session import Session
from boto3.s3.transfer import Transfer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.