text stringlengths 1 927k |
|---|
import sys,os,glob
try:
import pyUSRP as u
except ImportError:
try:
sys.path.append('..')
import pyUSRP as u
except ImportError:
print "Cannot find the pyUSRP package"
import argparse
def run(backend, files, welch, dbc):
for f in files:
u.calculate_noise(f, verbose = T... |
from collections import defaultdict
import pyvex
from ..knowledge_plugins.xrefs import XRef, XRefType
from ..engines.light import SimEngineLight, SimEngineLightVEXMixin
from .propagator.vex_vars import VEXTmp
from .propagator.values import Top
from . import register_analysis
from .analysis import Analysis
from .forwa... |
import requests
class RepositoryMixin:
def has_open_repository(self):
url = "https://api.github.com/repos/{0}/{1}".format(self.owner, self.repo)
try:
response = requests.get(url)
# If the response was successful, no Exception will be raised
response.raise_for_... |
# coding: utf-8
# Copyright 2020. ThingsBoard
# #
# 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
# #
# Unl... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import logging
from typing import Dict, Tuple, Any, Optional
from .dialogue_object import DialogueObject
from memory_nodes import ObjectNode, RewardNode
from .interpreter_helper import interpret_reference_object, ErrorWithResponse
class PutMemoryHandler(Dialo... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test objects... |
"""This file contains all the classes you must complete for this project.
You can use the test cases in agent_test.py to help during development, and
augment the test suite with your own test cases to further test your code.
You must test your agent's strength against a set of agents with known
relative strength usin... |
"""
requests:
sqlalchemy
apscheduler
定时任务
sqlalchemy 文档: https://apscheduler.readthedocs.io/en/stable/index.html
"""
import time
import json
try:
from pytz import utc, timezone
china_tz = timezone('Asia/Shanghai')
from apscheduler.schedulers.background import BackgroundScheduler
# from apsched... |
"""
Functions for Imaging Pipeline
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from astropy.io import fits
from astropy.modeling import models, fitting
from astropy.table import Table
from scipy.optimize import curve_fit
import os
from astropy.coordinates import SkyCo... |
from elasticsearch.client import SnapshotClient
from fiases.fias_data import ES
import fiases.fias_data
sn = SnapshotClient(ES)
def register(location="/usr/share/elasticsearch/snapshots"):
sn_body = {
"type": "fs",
"settings": {
"compress": "true",
"location": location
}
... |
from flask import Flask, render_template, url_for, request, redirect
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
class Todo(db.Model):
id = db.Column(db.Integer, primary_key=True)
... |
from __future__ import print_function
from builtins import object
from builtins import str
from lib.common import helpers
class Module(object):
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module... |
import argparse
import logging
import os
from time import sleep
from googleapiclient import discovery
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser(description="Control a google cloud instance.")
parser.add_argument('--debug', '-d', dest='debug', action='store_true', help="Debug mode")
parser.a... |
#!/usr/bin/env python3
# pyfu/flat.py
"""
Method for calculating the correction for the relative transmissions of the fibres using extracted sky flats.
The OBJTYP term "flatness" was created to distinguish this correction from that of a true flatfield.
"""
import numpy as np
import logging
from astropy.io impo... |
## \file Constants.py
# \author Thulasi Jegatheesan
# \brief Provides the structure for holding constant values
## \brief Structure for holding the constant values
class Constants:
pi = 3.14159265
L_min = 0.1
L_max = 50.0
rho_W_min = 950.0
rho_W_max = 1000.0
A_C_max = 100000.0
C_W_min = 4170... |
from django.urls import path
from . import views
app_name = "users"
urlpatterns = [
path(
"<str:username>",
view = views.UserProfile.as_view(),
name = "user_profile"
),
path(
"<str:username>/following",
view = views.UserFollowing.as_view(),
name = "user_foll... |
"""
zeep.wsdl.messages.soap
~~~~~~~~~~~~~~~~~~~~~~~
"""
import copy
from collections import OrderedDict
from lxml import etree
from lxml.builder import ElementMaker
from zeep import exceptions, xsd
from zeep.utils import as_qname
from zeep.xsd.context import XmlParserContext
from zeep.wsdl.messages.base impo... |
import unittest
import re
import pytest
import numpy as np
import scipy
from scipy.optimize import check_grad, approx_fprime
from six.moves import xrange
from sklearn.metrics import pairwise_distances, euclidean_distances
from sklearn.datasets import (load_iris, make_classification, make_regression,
... |
# Generated by Django 2.2 on 2020-01-19 12:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('csv_to_table', '0003_auto_20200119_1405'),
]
operations = [
migrations.AlterField(
model_name='people',
name='date',
... |
import json
config = 'config.json'
with open(config, 'r') as f:
data = json.load(f)
default = data["default"]
class AbstractCommand():
def __init__(self, handler = [], description = None):
self.handler = handler
self.description = description
def hdl(self):
return self.ha... |
#!/usr/bin/env python
import functools
import glob
import logging
import os
import platform
import re
import shutil
import stat
import sys
import tempfile
import time
from pathlib import Path
from typing import Callable, Dict, List, Tuple
import requests
from plugin import Plugin, PluginManager
from localstack import... |
"""
le script principale sert à annoter un répertoire de fichiers xml de recettes
"""
import glob
import re
import os
from oper_utils import xml_to_recipe_annotated
from Ner_classifieur_annote import load_crf_model, predict_text, transform_to_xml_annote
from NER_ingredient_detector import get_content_from_xmlfile
from... |
from setuptools import setup
setup(name='lognotify',
version='0.1',
py_modules = ['lognotify'],
description='A real-time log monitoring & notification utility which pops up a notification (while running your application) whenever it sees an error in log-file.',
url='http://github.com/shashank-s... |
import cv2
import numpy as np
# Load image, grayscale, Otsu's threshold
image = cv2.imread('1.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
# Remove text
cnts = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cnts... |
import os
import sys
import requests
from collections import OrderedDict
import conans
from conans import __version__ as client_version
from conans.client.cmd.create import create
from conans.client.hook_manager import HookManager
from conans.client.recorder.action_recorder import ActionRecorder
from conans.client.cl... |
"""
使用有限状态机算法
通过已经创建的事件和状态
对订单状态进行自动的调度
"""
# pylint: disable=arguments-differ
from typing import NoReturn
from ...core.tools import web
from ...core.algorithm import fsm
from . import events
from . import status
from . import settings
# 状态转移表
_TransferTable = (
(status.Created, events.Confirm, status.Confirmed)... |
from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.ma as ma
from numpy.testing import *
from numpy.compat import sixu
rlevel = 1
class TestRegression(TestCase):
def test_masked_array_create(self,level=rlevel):
"""Ticket #17"""
x = np.ma.masked_array([... |
"""\U0001F1EB\U0001F1EF \U00002B50 CSV track coordinate to TrackMate XML conversion.
Fiji allows for quick and easy viewing of images. TrackMate can be used to view tracks.
Unfortunately, it isn't that simple to convert "normal" coordinate output into
TrackMate-viewable format.
Requires a "tracks.csv" file that contai... |
#
# Copyright 2018 Joachim Lusiardi
#
# 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... |
#!/usr/bin/python3
"""
This module contains the tests for FileStorage class
"""
import unittest
import io
import sys
import models
from models.engine.file_storage import FileStorage
from models.base_model import BaseModel
from models.user import User
from models.state import State
from models.city import City
from mode... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 21 19:43:50 2022
Illustrating a basic transient magnetic diffusion problem, See Jackson Section 5.18
@author: zettergm
"""
import numpy as np
import scipy.sparse.linalg
import scipy.sparse
from scipy.special import erf
import matplotlib.pyplot as ... |
from bs4 import BeautifulSoup
from requests import get
import json
class Script:
def query(self, url):
datas = get(url)
soup = BeautifulSoup(datas.text, 'html.parser')
tag = soup.find_all('article')
data = []
for i in tag:
try:
title = i.find('h... |
'''Some helper functions for PyTorch, including:
- get_mean_and_std: calculate the mean and std value of dataset.
- msr_init: net parameter initialization.
- progress_bar: progress bar mimic xlua.progress.
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.i... |
# -*- coding: utf-8 -*-
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = LockFile('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'some... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# Copyright 2017 Robert Csordas. 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 law or a... |
m=float(input('Quantos metros?'))
c=m*100
mm=m*1000
print('A conversão de {} para centímetros é {} e para milímetros é {}.'.format(m,c,mm)) |
#!/usr/bin/python3
mice = {"number": 2, "names": [{"name": "Pinky", "tag": "the real genius"},{"name": "The Brain", "tag": "insane one"}], "world_domination_status": "pending"}
## print following
## Pinky is the real genius, and The Brain is the insane one
print(f'{mice["names"][0]["name"]} is {mice["names"][0]["tag"]... |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-262
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class SyslogRemoteLoggingClientRef(object):
"""
NOT... |
from wtforms import StringField, Form
class EditSessionForm(Form):
subject = StringField('Subject')
date = StringField('Date')
other_user = StringField('Other User') |
from typing import NamedTuple
def CsvExampleGen(
output_examples_uri: 'ExamplesUri',
input_base: str,
input_config: {'JsonObject': {'data_type': 'proto:tfx.components.example_gen.Input'}},
output_config: {'JsonObject': {'data_type': 'proto:tfx.components.example_gen.Output'}},
range_config: {'JsonO... |
# Packages up pygw so it's pip-installable
from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
def get_version():
try:
from maven_version import get_maven_version
version = get_maven_version()
except ModuleNotFoundError:
# If... |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... |
import pandas as pd
import numpy as np
import yfinance as yf
from sklearn.linear_model import LinearRegression
import statsmodels
import statsmodels.api as sm
import statsmodels.tsa.stattools as ts
import datetime
import scipy.stats
import math
import openpyxl as pyxl
from scipy import signal
from scipy import stats... |
import random
from pyschieber.player.base_player import BasePlayer
from pyschieber.trumpf import Trumpf
class RandomPlayer(BasePlayer):
def choose_trumpf(self, geschoben):
return move(choices=list(Trumpf))
def choose_card(self, state=None):
cards = self.allowed_cards(state=state)
ret... |
# qubit number=3
# total number=60
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... |
# 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... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
class IFormatProvider:
""" Provides a mechanism for retrieving an object to control formatting. """
def GetFormat(self,formatType):
"""
GetFormat(self: IFormatProvider,formatType: Type) -> object
Returns an object that provides formatting services for the specified type.
formatType: An object that... |
import os
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from starlette.responses import FileResponse
from histocat.api.db import get_db
from histocat.core.panorama import service
router = APIRouter()
@router.get("/panoramas/{id}/image", responses={200: {"content": {"image/png": {}}}})
a... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-23 09:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('filemonitor', '0005_auto_20170523_1541'),
]
operations = [
migrations.Renam... |
# 使用yield 实现单线程的异步并发效果
import time
def consumer(name):
print("%s 准备吃包子啦!" %name)
while True:
baozi = yield #接收值
print("包子[%s]来了,被[%s]吃了!" %(baozi,name))
def producer(name):
c = consumer("A")
c2 = consumer("B")
c.__next__()
c2.__next__()
print("老子开始做包子了")
for i in rang... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
# 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 ... |
# Generated by Django 3.1.4 on 2020-12-18 06:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignment', '0007_document'),
]
operations = [
migrations.RenameField(
model_name='document',
old_name='description... |
import json
import logging
from pathlib import Path
import sys
from typing import Optional
from pydantic import (
BaseModel,
StrictBool,
StrictInt,
StrictStr,
ValidationError,
validator,
)
log = logging.getLogger()
def validate_extension(extension):
"""
Checks that the API extension... |
# 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
# distributed under th... |
# 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 ... |
# coding: utf-8
"""
Mailchimp Marketing API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 3.0.74
Contact: apihelp@mailchimp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import... |
data = [("000060", 8.25), ("000020", 5.75), ("039490", 1.3)]
def 정렬규칙(x):
return x[1]
data.sort(key=정렬규칙)
print(data) |
# 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 ... |
import torch.nn as nn
import torch.nn.functional as F
class noise_Conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1,
groups=1, bias=True, noise_std=0.1):
super(noise_Conv2d, self).__init__(in_channels, out_chann... |
# Copyright 2014: Rackspace UK
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
from pyblazing.apiv2 import context
from pyblazing.apiv2 import make_context
BlazingContext = context.BlazingContext
import pyblazing.apiv2 |
from source.element.cr_beam_element import CRBeamElement
import numpy as np
np.set_printoptions(suppress=False, precision=4, linewidth=100)
def test_crbeam_element_update_incremental():
material_params = {'rho': 7850, 'e': 2069000000.0, 'nu': 0.29, 'zeta': 0.05, 'lx_i': 1.2, 'is_nonlinear': True}
element_pa... |
from typing import List
import random
import re
class Concept:
def __init__(self, name: str, options: List[str]):
self.name = name.lower()
self.options = options
def next(self):
return random.choice(self.options)
def render_to(self, template):
return [template.format(opti... |
import os
import sys
import pytest
from pytest import fixture
if sys.version_info < (3, 6):
raise pytest.skip("plantuml_markdown plugin requires Python >= 3.6", allow_module_level=True)
from tests import V8_PLUGIN_PATH
from tests.conftest import CompileResult
from v8.plantuml_markdown.plantuml_markdown import Pl... |
from __future__ import unicode_literals
import unittest
from datetime import date
from mock import Mock, patch
from xero import Xero
from xero.exceptions import (
XeroBadRequest,
XeroExceptionUnknown,
XeroForbidden,
XeroInternalError,
XeroNotAvailable,
XeroNotFound,
XeroNotImplemented,
... |
from django.shortcuts import render
from rest_framework import generics, status
from .serializers import RoomSerializer, CreateRoomSerializer, UpdateRoomSerializer
from .models import Room
from rest_framework.views import APIView
from rest_framework.response import Response
from django.http import JsonResponse
# Creat... |
# Generated by Django 2.1.15 on 2019-12-31 00:14
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
#!/usr/bin/env python
import json
import SNMPUtil
import argparse
### Monitoring iDRAC Servers - Powerunit Performance
### It uses snmpwalk command to get the hadrware data from the iDRAC Servers.
### SNMPUtil.py is used to get the snmp raw data and parsed to get the output json
### Download and install the latest v... |
import sys, smtplib
fromaddr = input("From: ")
toaddrs = input("To: ").split(',')
print("Enter message, end with ^D:")
msg = ''
while 1:
line = sys.stdin.readline()
if not line:
break
msg = msg + line
# The actual mail send
server = smtplib.SMTP('localhost', 2500)
server.sendmail(fromaddr, toaddr... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
from __future__ import absolute_import, division, print_function, unicode_literals
from wowp.actors.special import Splitter, Chain
from wowp.schedulers import NaiveScheduler
from wowp.actors import FuncActor
from wowp.util import ConstructorWrapper
def test_splitter():
splitter = Splitter(multiplicity=2, inport_n... |
# Copyright 2015 0xc0170
#
# 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, soft... |
# Copyright (c) 2017-2020 Wenyi Tang.
# Author: Wenyi Tang
# Email: wenyitang@outlook.com
# Update: 2020 - 2 - 7
from importlib import import_module
from ..Backend import BACKEND
__all__ = [
'get_model',
'list_supported_models'
]
def get_model(name: str):
name = name.lower()
try:
if BACKEND == 'pyt... |
import argparse
import re
import logging
import requests
from typing import Iterator
from typing import List
LOGGER_NAME="advent"
def init_logging(is_verbose: bool):
"""
Creates standard logging for the logger_name passed in
"""
logger = logging.getLogger(LOGGER_NAME)
logger.setLevel(logging.D... |
import poplib
from ...utils import Timer
class EmailChecker(Timer):
'''WARNING: This uses POP3 and by default deletes the emails it reads!'''
username = None
password = None
server = None
port = None
on_mail = None
delete = None
def __init__(self, username, password, server, port=1... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import botocore
import boto3
import sys
import os
import json
import subprocess
import click
import StringIO
import gzip
from datetime import datetime
from textwrap import dedent
import mimetypes
TARGETS = ['infra', 'dev', 'int', 'prod']
mimetypes.init()
mimet... |
from __future__ import print_function, division
import numpy as np
from R_tools import rho2u,rho2v
def calc_etat(ubar,vbar,hflow,pm,pn):
''' compute divergence of barotropic momentum (units m/h)
arrays are (x,y) ordered -- hflow is full column depth (SSE-z_bot)'''
return -( np.diff(rho2u(hflow/pn)*ubar,ax... |
from .starter_class import StarterClass
from .boto_manager import BotoClientManager
from .config import _CONFIG
__all__ = ['BotoClientManager', 'StarterClass', '_CONFIG'] |
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
from eth2spec.test.helpers.keys import pubkey_to_privkey
from eth2spec.test.helpers.voluntary_exits import sign_voluntary_exit
def run_voluntary_exit_processing(spec, state, signed_voluntary_exit, valid=True):
"... |
# Generated by Django 2.2.2 on 2019-07-29 19:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField... |
import execjs
def get_js_function(js_path, func_name, *func_args):
'''
获取指定目录下的js代码, 并且指定js代码中函数的名字以及函数的参数。
:param js_path: js代码的位置
:param func_name: js代码中函数的名字
:param func_args: js代码中函数的参数
:return: 返回调用js函数的结果
'''
with open(js_path, encoding='utf-8') as fp:
js = fp.read()
... |
# coding: utf-8
"""
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end --
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \... |
class Singleton(type):
"""
"""
_instances = {}
def __call__(cls, *args, **kwargs):
"""
Possible changes to the value of the `__init__` argument do not affect
the returned instance.
"""
if cls not in cls._instances:
instance = super().__call__(*args, ... |
"""
ASGI config for to_do_list project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Machinecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""rawtranscation RPCs QA test.
# Tests the following RPCs:
# - createrawtransaction
# - signra... |
import unittest
import numpy as np
from UncertainSCI.families import LaguerrePolynomials
class IDistTestCase(unittest.TestCase):
"""
Tests for (Laguerre polynomial) inversed induced distributions.
"""
def test_idistinv_laguerre(self):
"""Evaluation of Laguerre inversed induced distribution ... |
# Logging module.
import os
from os import path
import datetime
from michiru import config
from michiru.modules import hook
## Module information.
__name__ = 'logger'
__author__ = 'Shiz'
__license__ = 'WTFPL'
__desc__ = 'Log activities.'
config.item('logger.path', path.join('{local}', 'logs', '{server}', '{channel... |
from bs4 import BeautifulSoup
from selenium import webdriver
import selenium as se
from selenium.webdriver.chrome.options import Options
# This is the temporary url **** Need to make it dynamic
url = "https://www.realestate.co.nz/residential/sale?by=featured&lct=d225&maxba=2&maxbe=4&maxp=1400000&ql=80&scat=1"
# Compo... |
from django import http
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.storage.ba... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from django.contrib import admin
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from .models import Container, ContainerImage, Mirror
from .models import ContainerBox, ContainerBoxConta... |
# File name: tile.py
# Author: Michael Chunko
# Python Version: 3.7
# This file contains the class representing a tile on a map
class Tile:
def __init__(self, blocked=True, block_sight=None, seen=False):
self.blocked = blocked
# By default, a blocked tile also blocks sight
if block_sight... |
'''
TESS User Reducer
-----------------
This module porvides functions to calculate uesr weights for the TESS project.
Extracts are from Ceasars `PluckFieldExtractor`.
'''
from .running_reducer_wrapper import running_reducer_wrapper
import numpy as np
@running_reducer_wrapper(relevant_reduction=True)
def tess_user_re... |
# Third-party dependencies fetched by Bazel
# Unlike WORKSPACE, the content of this file is unordered.
# We keep them separate to make the WORKSPACE file more maintainable.
# Install the nodejs "bootstrap" package
# This provides the basic tools for running and packaging nodejs programs in Bazel
load("@bazel_tools//to... |
from __future__ import absolute_import
from .data_prep import img_pad |
def main(request, response):
token = request.GET.first("token")
if request.server.stash.remove(token) is not None:
return "1"
else:
return "0" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.