text stringlengths 1 927k |
|---|
# Copyright (c) 2016, Matt Layman
'''The junk drawer. A place for methods that don't logically fit elsewhere.'''
import os
import random
import shutil
import string
import sys
from werkzeug import security
from markwiki.models.user import User
def boolify(value):
'''Check the string value for boolean-like beha... |
"""
WSGI config for firey_server 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... |
# -*- coding: utf-8 -*-
from typing import Dict, Tuple, Any, Optional
import re
import string
import ast
import codecs
import argparse
import yaml
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
from reportlab.pdfbase.ttfonts import TT... |
# -*- coding: utf-8 -*-
import docker_registry.core.driver as engine
import tempfile
from ..lib import config
__all__ = ['load']
def temp_store_handler():
tmpf = tempfile.TemporaryFile()
def fn(buf):
tmpf.write(buf)
return tmpf, fn
_storage = {}
def load(kind=None):
"""Returns the r... |
import subprocess, os
import tempfile, qiime2
from q2_pepsirf.format_types import PeptideFastaFmt, ProteinFastaFmt, PepsirfLinkTSVFormat
# Name: link
# Process: runs pepsirf's link module
# Method inputs/parameters: protein_file, peptide_file, meta,
# kmer_size, kmer_redundancy_control, outfile, pepsirf_binary
# Meth... |
from datetime import time
import pandas as pd
from pytz import timezone
from .precomputed_trading_calendar import PrecomputedTradingCalendar
precomputed_taiwan_holidays = pd.to_datetime([
"1999-01-01",
"1999-02-10",
"1999-02-11",
"1999-02-12",
"1999-02-15",
"1999-02-16"
# TODO
])
class TW... |
from .sub_folder1.module1 import Module1
from .sub_folder1.module2 import Module2
module1 = Module1()
do_add = module1.add(1,1)
module2 = Module2()
do_minus = module2.minus(1,1) |
import sys, clr
import ConfigParser
from os.path import expanduser
# Set system path
home = expanduser("~")
cfgfile = open(home + "\\STVTools.ini", 'r')
config = ConfigParser.ConfigParser()
config.read(home + "\\STVTools.ini")
# Master Path
syspath1 = config.get('SysDir','MasterPackage')
sys.path.append(syspath1)
# Bui... |
"""
Manipulate protein sequences and alignments
"""
# core
import io
import gzip
import logging
import re
import functools
# pip
import dendropy
# local
from cathpy.core import error as err
from cathpy.core.tests import is_valid_domain_id
from cathpy.core.models import AminoAcid, AminoAcids, Residue, Segment
LOG = ... |
import polyadcirc.run_framework.domain as dom
import polyadcirc.pyGriddata.manufacture_gap as manu
grid_dir = '.'
domain = dom.domain(grid_dir)
domain.read_spatial_grid()
x_values = [n.x for n in domain.node.values()]
y_values = [n.y for n in domain.node.values()]
xr = max(x_values)
xl = min(x_values)
yu = max(y_val... |
from networkx.algorithms.assortativity import *
from networkx.algorithms.block import *
from networkx.algorithms.boundary import *
from networkx.algorithms.centrality import *
from networkx.algorithms.cluster import *
from networkx.algorithms.clique import *
from networkx.algorithms.community import *
from networkx.alg... |
# 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 ... |
#!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Utilities and (decompositions of) global constraints in Z3.
#
# Here I have collected some useful (or perhaps not that useful) methods for z3py.
# These where added mostly for simplifying the porting of my "traditional"
# constraint programming models.
#
#
############... |
"""
This script finds a palminized model with given arguments then finetune it.
Usage:
script.py --input-dir path [-h] [-v|-vv] [--seed int] [--train-val-split float] [--keep-last-layer] [--lr float] [--use-clr policy] [--min-lr float --max-lr float] [--epoch-step-size int] [--nb-epoch int] [--only-mask] [--tb] (-... |
import subprocess
import json
import os
class ExifTool:
sentinel = "{ready}\n"
def __init__(self, executable="/usr/bin/exiftool"):
self.executable = executable
def __enter__(self):
self.process = subprocess.Popen(
[self.executable, "-stay_open", "True", "-@", "-"],
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('analytics', '0011_auto_20150404_1556'),
]
operations = [
migrations.Al... |
# Generated by Django 1.11.16 on 2019-03-12 10:52
from corehq.sql_db.operations import RawSQLMigration
from django.db import migrations
from custom.icds_reports.const import SQL_TEMPLATES_ROOT
migrator = RawSQLMigration((SQL_TEMPLATES_ROOT, 'database_views'))
class Migration(migrations.Migration):
dependencies... |
import os
import os.path as op
import warnings
import gc
from nose.tools import assert_true, assert_raises
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_equal,
assert_array_equal, assert_allclose)
from mne.datasets import testing
from mne.io import Raw
from... |
import sys
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=True)
def conv_in... |
from flask import Flask
from flask_apscheduler import APScheduler
class Config(object):
JOBS = [
{
'id': 'job1',
'func': 'jobs:job1',
'args': (1, 2),
'trigger': 'interval',
'seconds': 10
}
]
SCHEDULER_API_ENABLED = True
def job... |
# 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! ***
# Export this package's modules as members:
from .address import *
from .attached_disk import *
from .autoscalar import *
from .backend... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... |
from distutils.core import setup
setup(
name='HealthcareScraper',
version='1.0',
packages=['HealthcareScraper'],
url='',
license='MIT',
author='anthonyshook',
author_email='',
description='Code for Fetching data from the Healthcare.gov website.',
long_description_content_type = 'tex... |
"""
Leia um número real e imprima a quinta parte deste número.
"""
num = float(input('Digite um número real: '))
qui = num / 5
print(f'A quinta parte de {num} é {qui}') |
"
Name : c4_09_python_fv.py
Book : Hands-on Data Science with Anaconda )
Publisher: Packt Publishing Ltd.
Author : Yuxing Yan and James Yan
Date : 1/25/2018
email : yany@canisius.edu
paulyxy@hotmail.com
"
import numpy as np
import matplotlib.pyplot as mlt
n=np.linspace(0,10,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2017 bitbank, inc. (ビットバンク株式会社)
#
# 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, includ... |
#!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: {0} training_file [testing_file]'.format(sys.argv[0]))
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "../svm-scale"
svmtrain_... |
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
from __future__ import division
import decimal
import operator
import random
from itertools import product
import numpy as np
import pandas as pd
import pytest
import cudf
from cudf.core import Series
from cudf.core.index import as_index
from cudf.tests import utils
fr... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistri... |
"""Test the miniencoding lib
A decent testing approach is to test the round trip with a random, valid
string of bytes. by taking this approach, the same error/ bug would have to be
present in both the 'from' and 'to' functions which whilst possible is unlikely
"""
# pylint: disable=invalid-name
import random
import st... |
"""
Definition of views.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import config
from django.shortcuts import render, HttpResponse
from django.http import HttpRequest, JsonResponse
from django.template import RequestContext
import ee
import datetime as dt
import types
im... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
from prjxray.util import OpenSafeFil... |
import os
from flask import Flask, g
from flask_sijax import sijax
path = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax/')
app = Flask(__name__)
app.config['SIJAX_STATIC_PATH'] = path
app.config['SIJAX_JSON_URI'] = '/static/js/sijax/json2.js'
flask_sijax.Sijax(app)
@app.route('/')
def index():
r... |
"""Sphinx configuration."""
from datetime import datetime
project = "AFS_analysis_childcare_providers"
author = "Nesta"
copyright = f"{datetime.now().year}, {author}"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
# "sphinx_click",
"sphinx_rtd_theme",
]
autodoc_typehints = "description"
h... |
from django.shortcuts import render,redirect
from .forms import UpdateDocForm,addPatientForm,TreatmentForm,NewNextOfKinForm,NewMedicineForm
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from .models import Doctor,Medicine,NextOfKin,Patient
# Create your views here... |
# Copyright (c) 2016 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, mer... |
# pylint: disable=unused-argument
# 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.... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from flask import Blueprint, abort, current_app, jsonify, request
from sqlalchemy.exc import IntegrityError
from app.config import QueueNames
from app.dao.annual_billing_dao import set_default_free_allowance_for_service
from app.dao.dao_utils import transaction
from app.dao.fact_billing_dao import fetch_usage_year_for... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import itertools
import logging
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
from typing import ClassVa... |
import sys
from launch import LaunchDescription, LaunchService
from launch_ros.actions import Node
def generate_launch_description():
opcua_parameters = {
"server_address": "opc.tcp://192.168.100.30:4840/",
"node_ids": ["ns=4;s=|var|CODESYS CONTROL FOR Raspberry Pi MC SL.Application.IO.bool_from_p... |
import boto3
import json
import os
from sam_spot_bot_create_job.bot_dao import BotDao
# Global variables are reused across execution contexts (if available)
session = boto3.Session()
def lambda_handler(event, context):
"""
Sample json in API request body -
{
"name": name,
"fi... |
'''
Copyright (C) 2014 Parrot SA
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following di... |
# ######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
# Combination Sum
'''
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.
The same number may be chosen from candidates an unlimited number of times. Two... |
import cv2
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
import torch
import torchvision.models as models
from torch.autograd import Variable
import torchvision.transforms as transforms
def plot_image(image, figsize):
""" Display an image """
fig = plt.figure(figsize = figsiz... |
import paddle
from paddle import nn
import math
import numpy as np
def _cfg(url='', **kwargs):
return {
'url': url,
'num_classes': 2, 'input_size': (3, 600, 600), 'pool_size': None,
'crop_pct': .9, 'interpolation': 'bicubic',
'mean': (0.5, 0.5, 0.5), 'std': (0.5, 0.5, 0.5),
... |
"""
MPI-aware read and write PETSc Vec to HDF5
The goal of this module is to save snapshots of a PETSc Vec to HDF5
files, and obviously to read them again later. The obvious way to do
this is parallel HDF5. Unfortunately, distributions of HDF5 and h5py
may be built without support for parallel operation. (In particula... |
# *****************************************************************************
# * Copyright 2020 Amazon.com, Inc. and its affiliates. All Rights Reserved. *
# *
# Licensed under the Amazon Software License (the "License"). *
... |
#!/usr/bin/env python3
import fileutils
def part1(lst):
positions = parse_positions(lst)
def calc(x, i):
return abs(x - i)
return get_min_fuel(positions, calc)
def part2(lst):
positions = parse_positions(lst)
def calc(x, i):
n = abs(x - i)
return n * (n + 1) / 2
r... |
# Copyright 2018 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... |
import collections # Used for ordered dictionary
from PRS import PRS_sumstats
from UKBB_Functions import PROBA_FOLDER
import sys
Top_Gen_Dict = PRS_sumstats.Get_Top_Gen_Dict()
Hyp_Param_Dict_A = collections.OrderedDict()
Hyp_Param_Dict_R = collections.OrderedDict()
# TRAIN_PATH = '/net/mraid08/export/jafar/UKBioBank/D... |
__author__ = 's30244' |
# 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
# di... |
import getpass
import os
import platform
class SystemUtil:
__SYSTEM_NAMES_WINDOWS: set = ['Windows']
@staticmethod
def isWindows() -> bool:
osName: str = platform.system()
return osName in SystemUtil.__SYSTEM_NAMES_WINDOWS
@staticmethod
def getCurrentUserName() -> str:
us... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains implementations for asset files
"""
from __future__ import print_function, division, absolute_import
__author__ = "Tomas Poveda"
__license__ = "MIT"
__maintainer__ = "Tomas Poveda"
__email__ = "tpovedatd@gmail.com"
import os
import logging
imp... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from cc... |
#!/usr/bin/env python3
# Copyright 2019 The Tensor2Tensor 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 ap... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from .validators import is_item_iterable
def coerce_sequence_of_tuple(sequence):
"""Make sure all items of a sequence are of type tuple.
Parameters
----------
sequence : sequence
A se... |
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 later... |
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode = True
from core.config import Config
from core import Trainer
if __name__ == "__main__":
config = Config("./config/negative_margin.yaml").get_config_dict()
trainer = Trainer(config)
trainer.train_loop() |
#! /usr/bin/python3
"""
contains extra preprocessing steps for raw data, including:
- using regular expression to capture misclassified Skills in Experience class
- separating terms with special characters (e.g. '/', ',')
"""
from preprocessing.src.utils import * # pylint: disable=all
import re
import inflec... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
from dash.dependencies import Input, Output
import pandas as pd
import pickle
# from os.path import dirname
# DIR = dirname(__file__)
# MODELS_DIR = DIR + '/../models/'
# DATA_DIR = DIR + '/../data/'
# data_... |
import argparse
import getpass
import os
import re
import socket
from datetime import datetime
import github
from dateutil.relativedelta import relativedelta
from github import Github
from termcolor import colored
CHANGED_FILES_PAD = 50
STATE_OPEN = 'open'
STATE_MERGED = 'merged'
STATE_CLOSED = 'closed'
class Pull... |
from typing import Optional, Dict, Any
import pytest
@pytest.mark.skip()
def test_qcodes_dummy():
from qcodes.instrument.base import InstrumentBase as qcodes_InstrumentBase
from entropylab.instruments.qcodes_adapter import QcodesAdapter
class MockQcodesDriver(qcodes_InstrumentBase):
def __init__... |
from setuptools import setup, find_packages
setup(
name='all2vec',
version='0.6.0',
author='Ravi Mody, Jon Banafato',
author_email='datascience@iheartmedia.com',
description='Store and compare high dimensional vectors',
packages=find_packages(exclude=['tests']),
zip_safe=True,
install_... |
# import the version variable
from ._version import __version__
# NOTE: kornia filters and geometry must go first since are the core of the library
# and by changing the import order you might get into a circular dependencies issue.
from . import filters
from . import geometry
# import the other modules for convenien... |
import komand
from .schema import PowershellStringInput, PowershellStringOutput
# Custom imports below
from komand_powershell.util import util
class PowershellString(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="powershell_string",
description="Ex... |
################################################################################
# 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... |
from pathlib import Path
import json_schema_to_class
current_dir: Path = Path(__file__).parent
json_schema_to_class.generate_dir(
schema_dir=current_dir.parent / 'schema',
output_dir=current_dir / 'build'
)
if __name__ != '__main__':
from .build import * # noqa: F403
del json_schema_to_class
de... |
# -*- coding: utf-8 -*-
from model.contact import Contact
def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.add_new_contact(contact)
new_contacts = db.get_contact_list()
old_contacts.append(contact)
assert sorted(ol... |
#!/usr/bin/env python
# Copyright 2016 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
import _plotly_utils.basevalidators
class ErrorYValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name='error_y', parent_name='bar', **kwargs):
super(ErrorYValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... |
"""
default package settings definition
author: Michael Grupp
This file is part of evo (github.com/MichaelGrupp/evo).
evo 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 y... |
"""Tests for Lib/fractions.py."""
from decimal import Decimal
from test.test_support import run_unittest
import math
import numbers
import operator
import fractions
import unittest
from copy import copy, deepcopy
from cPickle import dumps, loads
F = fractions.Fraction
gcd = fractions.gcd
# decorator for skipping test... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# License: MIT (see LICENSE file provided)
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
"""
**polib** allows you to manipulate, create, modify gettext files (pot, po
and mo files). You can load existing files, iterate through it's entries,
add, modify entr... |
import csv
import decimal
from datetime import date, datetime
from decimal import Decimal
import random
import json
from django.http import QueryDict
from pytest import mark
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils import timezone
from django_factory_boy import ... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models import signals
import registration
GENDER_CHOICES = (
(u'M',u'Male'),
(u'F',u'Female'),
(u'N',u"Don't wish to reveal")
)
YEAR_CHOICES = (
(u'U1',u'Undergraduate 1st year'),
(u'U2',u'Undergraduate 2nd year'),
(u'U3',... |
# Copyright (c) 2020-2021 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
from .run_time_series_multinet import run_timeseries |
#!/usr/bin/python2
import sys
import os
from time import sleep
from threading import Timer
import rospy
import baxter_interface
from baxter_interface import CHECK_VERSION
class JointPlayer(object):
def __init__(self, filename, loops=1):
self.filename=filename
self.loops=loops
def t... |
# vim: set sw=4 ts=4 expandtab :
oneamo = 1000000000000000000
moteperamo = 1000000000000000000
DELTA_AMO = 0.000000001 # 10^-9 AMO
DELTA_MOTE = 1000000000 # 10^9 mote
BLKSHOUR = 60*60
BLKSDAY = 60*60*24
BLKSWEEK = 60*60*24*7
BLKSMONTH = 60*60*24*30
BLKSQUARTER = 60*60*24*90
BLKSYEAR = 60*60*24*365 |
# Generated by Django 3.2.5 on 2021-07-03 19:55
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('catalog', '0006_chapter_votes'),
]
operations = [
migrations.AddField(
model_name='book',
... |
"""
WSGI config for the Church IMS 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/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... |
import matplotlib.pyplot as plt
from numpy import sin,cos,pi,sqrt,exp,floor,zeros,copy,array
from numpy.random import normal
from numpy.linalg import norm
from random import uniform
from time import time
start = time()
def euler(x,v):
for i in range(n_particles):
sigmaF = zeros(2)
for j in range(n_... |
# MINLP written by GAMS Convert at 04/21/18 13:54:54
#
# Equation counts
# Total E G L N X C B
# 13 1 0 12 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
#!/usr/bin/env python
"""
Install wagtail-metadata using setuptools
"""
from setuptools import find_packages, setup
with open('README.rst', 'r') as f:
readme = f.read()
setup(
name='wagtail-metadata',
version='2.0.0',
description="A tool to assist with metadata for social media.",
long_descriptio... |
"""Slice a Volume with multiple planes
Make low values of the scalar completely transparent"""
from vedo import *
vol = Volume(dataurl+'embryo.slc').alpha([0,0,0.5]).c('k')
slices = []
for i in range(4):
sl = vol.slicePlane(origin=[150,150,i*50+50], normal=(0,-1,1))
slices.append(sl)
amap = [0, 1, 1, 1, 1] ... |
"""This module provides the `Scan` `Op`.
Memory reuse in scan
--------------------
To reduce the number of memory allocations and copies associated with calling
the inner function and recovering the outputs at every iteration, Scan uses a
memory pre-allocation mechanism for some of its outputs. Instead of repeatedly
... |
# <controller>
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.contrib import messages
from meu_condominio.forms import *
from meu_condominio.models import Condominio, Funcionario
def funcionarios(requ... |
import pytest
from seleniumbase import BaseCase
from qa327_test.conftest import base_url
from unittest.mock import patch
from qa327_test.common import TEST_USER, TEST_TICKET, auto_login
from qa327.models import Ticket
from datetime import datetime
from qa327_test.conftest import base_url
"""
This file defines all unit... |
import MySQLdb
import re, time
#connect() 方法用於建立資料庫的連線,裡面可以指定引數:使用者名稱,密碼,主機等資訊。
#這只是連線到了資料庫,要想操作資料庫需要建立遊標。
conn= MySQLdb.connect(
host='localhost',
port = 3306,
user='bokai',
passwd='2841p4204',
db ='tw_sim_evaluate',
)
#通過獲取到的資料庫連線conn下的cursor()方法來建立遊標。
cur = conn.curso... |
# Copyright (c) 2021 Ichiro ITS
#
# 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, merge, publish, distribu... |
'''
@author: Deniz Altinbuken, Emin Gun Sirer
@note: Script to check DNS Port bindings
@copyright: See LICENSE
'''
import socket
import sys
def testdnsport():
addr = 'localhost'
port = 53
thesocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
thesocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSE... |
# -*- coding: utf-8 -*- #
"""
Created on Tue Mar 3 11:18:30 2015
@author: wcgrizolli
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
from myFourierLib import *
sys.path.append('/home/wcgrizolli/pythonWorkspace/wgTools')
import wgTools as wgt
sys.path.append('/home/wcgrizolli/pythonWorkspace/... |
"""
`busio` - Bus protocol support like I2C and SPI
=================================================
See `CircuitPython:busio` in CircuitPython for more details.
* Author(s): cefn
"""
import threading
from adafruit_blinka import Enum, Lockable, agnostic
from adafruit_blinka.agnostic import board_id, detector
impor... |
import math
import warnings
import torch
from typing import List, Union
from torch import Tensor, nn
from ..common import EncoderModule, _take
__all__ = ["GenericTimmEncoder", "make_n_channel_input_std_conv"]
class GenericTimmEncoder(EncoderModule):
def __init__(self, timm_encoder: Union[nn.Module, str], layer... |
from PyQt4 import QtGui,QtCore
import sys
import ui_main
import numpy as np
import pylab
import time
import pyqtgraph
class ExampleApp(QtGui.QMainWindow, ui_main.Ui_MainWindow):
def __init__(self, parent=None):
pyqtgraph.setConfigOption('background', 'w') #before loading widget
super(ExampleApp, se... |
# Copyright 2014 IBM Corp.
#
# 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 t... |
""" Print the gyro sensor data.
Copyright (C) 2019 Basler AG
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from hucon import Mpu6050
mpu = None
print('Get the data from the accelerometer.')
mpu = Mpu605... |
import os
import csv
import sys
import time
import pandas as pd
from sklearn.preprocessing import StandardScaler
from typing import Tuple
from sklearn.externals import joblib
from sklearn.model_selection import train_test_split
# 每个特征集的特征数量
FEATURE_NUM = {
'IS09_emotion': 384,
'IS10_paraling': 1582,
'IS11_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.