text stringlengths 1 927k |
|---|
#
# This file is part of the FFEA simulation package
#
# Copyright (c) by the Theory and Development FFEA teams,
# as they appear in the README.md file.
#
# FFEA 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 ... |
# -*- coding: utf-8 -*-
"""A ``stats`` package.""" |
"""Class for RESQML Horizon Interpretation organizational objects."""
from ._utils import (equivalent_extra_metadata, alias_for_attribute, extract_has_occurred_during,
equivalent_chrono_pairs, create_xml_has_occurred_during)
import resqpy.olio.uuid as bu
import resqpy.olio.xml_et as rqet
from res... |
"""Basic canvas for animations."""
from __future__ import annotations
__all__ = ["Scene"]
import copy
import datetime
import inspect
import platform
import random
import threading
import time
import types
from queue import Queue
from typing import Callable
import srt
from manim.scene.section import DefaultSectionT... |
#!/usr/bin/env python
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments fo... |
from testutils import assert_raises
# __abs__
assert abs(complex(3, 4)) == 5
assert abs(complex(3, -4)) == 5
assert abs(complex(1.5, 2.5)) == 2.9154759474226504
# __eq__
assert complex(1, -1) == complex(1, -1)
assert complex(1, 0) == 1
assert 1 == complex(1, 0)
assert complex(1, 1) != 1
assert 1 != complex(1, 1)
as... |
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from users.tests.factories import UserFactory
User = get_user_model()
class CurrentUserViewSetRetrieveTest(APITestCase):
def setUp(self) -> None... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
import os
import shutil
import tempfile
from unittest import TestCase
from tsfresh.scripts import run_tsfresh
from mock imp... |
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def create_database():
# connect to default database
conn = psycopg2.connect("host=127.0.0.1 dbname=studentdb user=student password=student")
conn.set_session(autocommit=True)
cur = conn.cursor()
# create sparkif... |
from highcliff.ai.ai import AI, intent_is_real |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
for line in sys.stdin.readlines():
line = line.strip()
print("\\index{%s}" % (line.replace('_','\\_')))
print("\\begin{section}{%s}" % (line.replace('_','\\_')))
#print "\\inputminted[tabsize=2,breaklines,... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from django import forms
from mtr.utils.forms import GlobalInitialFormMixin
from mtr.utils.helpers import model_choices
from .lib.manager import manager
from .models import Settings, Field
# TODO: refactor
class SettingsAdminForm(GlobalInitialFormMixin, forms.ModelForm):
class Meta:
exclude = tuple()... |
import os
import json
import imp
import mimetypes
import xlrd
import csv
import re
import requests
import time
import sys
import traceback
from httplib import BadStatusLine
from flask import Flask, render_template, send_from_directory, Response
from jinja2 import Markup, TemplateSyntaxError
from jinja2.loaders import ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from mock import Mock, call
from h.routes import includeme
def test_includeme():
config = Mock(spec_set=["add_route"])
includeme(config)
# This may look like a ridiculous test, but the cost of keeping it
# up-to-date is hopefully pre... |
# -*- coding: utf-8 -*-
"""
base handler tests
~~~~~~~~~~~~~~~~~~
:author: Sam Gammon <sg@samgammon.com>
:copyright: (c) Sam Gammon, 2014
:license: This software makes use of the MIT Open Source License.
A copy of this license is included as ``LICENSE.md`` in
the root of the project... |
import sqlite3
#This generically adds stuff to the depositions / treatments and dep_conds / treatmetn_conds tables...
def batch_commit_function(self, conn, splits_lst, batch_dict):
status = 'No status yet'
#TABLE device_stacks (id INTEGER PRIMARY KEY, stack_name TEXT, bot_elec_pat INTEGER, top_elec_pat INTEGER)
#TAB... |
#
# 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 appl... |
"""initial setup
Revision ID: 6183aa4c39c7
Revises:
Create Date: 2021-01-20 22:11:55.367985+00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6183aa4c39c7'
down_revision = None
branch_labels = None
depends_on = No... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
"""
Script to process wind farm & turbine csv downloaded from: https://eerscmap.usgs.gov/uswtdb/data/
Metadata description can be found at https://eerscmap.usgs.gov/uswtdb/assets/data/uswtdb_v1_0_20180419.xml
Disregarding the following attributes for now:
t_rsa turbine rotor swept area square meters
t_ttlh turbine tot... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
import pyre
class ifac(pyre.protocol, family="deferred.ifac"):
"""sample protocol"""
@classmethod
def pyre_default(cls, **kwds): return comp
class comp(pyre.component, family="defer... |
"""
Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/pwm.py
Copyright (c) 2015-2016 vsergeev / Ivan (Vanya) A. Sergeev
License: MIT
"""
import os
from time import sleep
from errno import EACCES
try:
from microcontroller.pin import pwmOuts
except ImportError:
raise RuntimeError... |
# Copyright 2016 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 flask import Flask, render_template, session, redirect, request
import random
app = Flask(__name__)
app.secret_key='This'
@app.route('/')
def start():
if not ('num') in session:
session['num'] = random.randrange(0,101)
print session['num']
num = session['num']
if ('guess') in session:
... |
from pymongo import MongoClient
import os
import hashlib
from datetime import datetime
import common.misc as misc
# Perform advanced search in the database
def search_nested(args):
try:
# If user wants to retrieve all the database
if args.NESTED[0] == 'ALL':
print('Search for all websi... |
# -*- coding: utf-8 -*-
import unittest
from datetime import date
from rdcache.ext import RedisCache, RedisPool
redis = RedisPool({
"default": {
"host": "127.0.0.1",
"port": 6379,
"password": "",
"db": 0,
},
})
backend = redis.get('default')
cache = RedisCache(backend, touch = ... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from elasticsearch import Elasticsearch
from flask_caching import Cache
from flask_mail import Mail
from celery import Celery
app = Flask(__name__)
app.config['SERVER_NAME'] = 'localhost:5000'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test... |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
UselessOperatorsViolation,
)
from wemake_python_styleguide.visitors.ast.operators import (
UselessOperatorsVisitor,
)
# Usages:
assignment = 'constant = {0}'
assignment_addition = 'constant = x + {0}'
assignme... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal ... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Glenn Ruben Bakke
#
# 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 wi... |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.nxos.interface.get import get_interface_information
class TestGetInterfaceInformation(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
R3_nx:
connections:
... |
"""
Tests for the datasette.database.Database class
"""
from datasette.database import Database, Results, MultipleValues
from datasette.utils.sqlite import sqlite3
from datasette.utils import Column
from .fixtures import app_client, app_client_two_attached_databases_crossdb_enabled
import pytest
import time
import uuid... |
from collections import namedtuple
from dataclasses import dataclass, field
from datetime import datetime
from typing import List
from .base import MangadexBase
from .exceptions import MangadexException
from .group import Group
from .language import Language
@dataclass(frozen=True)
class PartialChapter(MangadexBase):... |
# Copyright 2018 Google LLC. 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... |
# coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. 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
#
# Un... |
import pika
class Broker:
def __init__(self, area):
# Validate broker attributes
if area not in ["A", "B", "C", "D"]:
raise ValueError(
"Please provide a valid sender area. [A, B, C, D]"
)
self.area = area
self.connection = None
... |
from . import _common
c = _common |
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
from typing import Any, List, Tuple, IO, overload
# ----- os.path variables -----
supports_unicode_filenames = False
# ----- os.path function stubs -----
def abspath(path: str) -> str: pass
def basen... |
"""
The SPC-MGR is built based in part on graph attention mechanism (https://arxiv.org/abs/1710.10903),
part on MG-SCR (https://www.ijcai.org/proceedings/2021/0135),
and includes open-source codes provided by
the project of Graph Attention Network (GAT) at https://github.com/PetarV-/GAT,
and the project of MG-SCR at ht... |
from direct.task import Task
from otp.otpbase import OTPLocalizer
from direct.gui.DirectGui import *
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
class DownloadWatcher(DirectObject):
def __init__(self, phaseNames):
self.phaseNames = phaseNames
self.text = Direct... |
from __future__ import with_statement
import sys
import socket
import re
import time
import datetime
import errno
def timestamp():
return datetime.datetime.now().strftime("[%H:%M:%S]")
class IRCClient:
def __init__(self, address, port, nick, username, realname):
self.connected = False
self.active_session = Fal... |
# -*- encoding: utf-8 -*-
'''
Text Input
==========
.. versionadded:: 1.0.4
.. image:: images/textinput-mono.jpg
.. image:: images/textinput-multi.jpg
The :class:`TextInput` widget provides a box for editable plain text.
Unicode, multiline, cursor navigation, selection and clipboard features
are supported.
The :cl... |
from tkinter import ttk
import tkinter as tk
from tkinter import *
import tkinter.scrolledtext as tkscrolled
# pip install pillow
from PIL import ImageTk, Image
class base:
#esto es un constructor
def __init__(self, window):
self.wind = window #guarda la ventana que tiene como parametro
self.... |
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
with open("requirements.txt", "r") as f:
requirements = f.readlines()
setup(
name='reactive-uart2ip',
version='0.2',
author="Gianluca Scopelliti",
author_email="gianlu... |
"""Parse and handle input arguments"""
import argparse
import logging
import multiprocessing
from patteRNA import version
logger = logging.getLogger(__name__)
def parse_cl_args(inputargs):
"""
Parse command line arguments.
Args:
inputargs (list): List of input arguments.
Returns:
in... |
# 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
from... |
#!/usr/bin/python
#
# File : gen_appbin.py
# This file is part of Espressif's generate bin script.
# Copyright (C) 2013 - 2016, Espressif Systems
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of version 3 of the GNU General Public License as
# published by the Free Softwa... |
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = "cdhweb.blog" |
import collections
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import conv
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cudnn.cudnn
_cudnn_version = libcudnn.getVersion()
def _check_cudnn_acceptable_type(x_dtype):
... |
class SingletonMeta(type):
"""
A metaclass to use other classes as singleton.
:see: https://www.datacamp.com/community/tutorials/python-metaclasses
"""
_instances = {}
""" A {dict} containing classes which must be a singleton. """
def __call__(cls, *args, **kwargs):
"""
:p... |
#!/usr/bin/env python
# -*- coding:utf8 -*- //Python2中 只要有中文头部就需要添加
n = input('请输入用户名: ')
n2 = input('请输入密码: ')
print(n)
print(n2) |
#!/usr/bin/env python3
# Copyright (c) 2016-2021 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 segwit transactions and blocks on P2P network."""
from decimal import Decimal
import random
import... |
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... |
import numpy as np
from scipy.sparse import issparse
from sklearn.utils import sparsefuncs
from .. import logging as logg
from ..utils import doc_params
from ._docs import doc_norm_descr, doc_quant_descr, doc_params_bulk, doc_norm_quant, doc_norm_return, doc_ex_quant, doc_ex_total
def _normalize_data(X, counts, after=... |
import logging
import mqtt
import argparse
import yaml
import sawnee
import repeat
import datetime
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
logging.basicConfi... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-04 19:53
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('transport', '0014_line_rendered_timetable'),
]
... |
# MINLP written by GAMS Convert at 05/15/20 00:51:19
#
# Equation counts
# Total E G L N X C B
# 4 0 2 2 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
from volumina_viewer import volumina_n_layer
import vigra
import json
import os
import numpy as np
def check_train_cache(sample):
cache_folder = '/home/constantin/Work/home_hdd/cache/regression_tests_mcluigi/%s' % sample
for ff in os.listdir(cache_folder):
if ff.startswith("EdgeGroundtruth"):
... |
from .hooks import Hook
from .hooks_collection import *
from .runner import Runner |
import py
import logging
import pytest
logger = logging.getLogger(__name__)
@pytest.fixture
def tmpfile(tmpdir_factory):
tmpdir = tmpdir_factory.mktemp('temp')
filename = tmpdir.join('tmpfile')
yield str(filename)
try:
filename.remove(ignore_errors=True)
except (py.error.EBUSY, py.error.... |
# -*- coding: utf-8 -*-
import fnmatch
import fulltext
import os
from flask import Flask, request, render_template, redirect, url_for, send_from_directory, jsonify
from werkzeug.utils import secure_filename
from werkzeug import SharedDataMiddleware
import re
import math
import time
import json
import shinglmethods
imp... |
from sqlalchemy.testing import assert_raises_message
import sqlalchemy as sa
from sqlalchemy import Integer, PickleType, String, ForeignKey, Text
import operator
from sqlalchemy import testing
from sqlalchemy.util import OrderedSet
from sqlalchemy.orm import mapper, relationship, create_session, \
PropComparator, s... |
#!/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
"License");... |
#!/usr/bin/env python
#
# Copyright 2009-2013 by The Regents of the University of California
# 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 from
#
# http://www.apache.org/licenses/LICENSE-2.... |
# Consider all integer combinations of ab for 2 <= a <= 5 and 2 <= b <= 5:
# 2^2 = 4, 2^3 = 8, 2^4 = 16, 2^5 = 32
# 3^2 = 9, 3^3 = 27, 3^4 = 81, 3^5 = 243
# 4^2 = 16, 4^3 = 64, 4^4 = 256, 4^5 = 1024
# 5^2 = 25, 5^3 = 125, 5^4 = 625, 5^5 = 3125
# If they are then placed in numerical order, with any repeats removed, we ... |
#=========================================================================
# TranslationImport_closed_loop_component_test.py
#=========================================================================
# Author : Peitian Pan
# Date : June 6, 2019
"""Closed-loop test cases for translation-import with component."""
impor... |
# Generated by Django 3.0.5 on 2020-05-02 01:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("myapp", "0003_mymodel_is_paid"),
("myapp", "0003_mymodel_is_active"),
]
operations = [] |
from unittest.case import TestCase
from pandas import Series, DataFrame
from probability.distributions import Beta, Dirichlet
class BaseTest(TestCase):
def setUp(self) -> None:
self.b1 = Beta(700, 300)
self.b2 = Beta(600, 400)
self.b3 = Beta(500, 500)
self.d1 = Dirichlet([500, ... |
# Copyright 2018 The TensorFlow Probability 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 applicable law o... |
from __future__ import division
import datetime
import exifread
import logging
import xmltodict as x2d
from codecs import encode, decode
from six import string_types
from opensfm.sensors import sensor_data
from opensfm import types
from opensfm import pygeometry
logger = logging.getLogger(__name__)
inch_in_mm = 2... |
def defaults():
return dict(
actor='mlp',
ac_kwargs={
'pi': {'hidden_sizes': (64, 64),
'activation': 'tanh'},
'val': {'hidden_sizes': (64, 64),
'activation': 'tanh'}
},
adv_estimation_method='gae',
epochs=300, # ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
'''
Run QPLIB problems for the OSQP paper
This code tests the solvers:
- OSQP
- GUROBI
- MOSEK
'''
from qplib_problems.qplib_problem import QPLIBRunner
import solvers.solvers as s
from utils.benchmark import compute_stats_info
import os
import argparse
parser = argparse.ArgumentParser(description='QPLIB... |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'stave_backend.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django... |
# Copyright 2020 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 typing import overload
from UdonPie import System
from UdonPie import UnityEngine
from UdonPie.Undefined import *
class Scrollbar:
def __new__(cls, arg1=None):
'''
:returns: Scrollbar
:rtype: UnityEngine.UI.Scrollbar
'''
pass
@staticmethod
def op_Implicit(arg... |
################################################################################
######### © 2020 ETH Zurich, Institute of Geophysics, Daniel T. Birdsell #######
################################################################################
### Define global parameters using units of J, kg, C, s, m
### The notation ... |
# Copyright 2020, Bloomberg Finance L.P.
#
# 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... |
# Copyright (c) 2014 Red Hat, 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 require... |
# model settings
model = dict(
type='CascadeRCNN',
num_stages=3,
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style='... |
#!/usr/bin/env python
text = ""
while text.lower() != "quit":
text = input("Please enter a chemical formula (or 'quit' to exit): ")
if text == "quit":
print("...exiting program")
elif text == "H2O":
print("Water")
elif text == "NH3":
print("Ammonia")
elif text == "CH4":
... |
#@+leo-ver=5-thin
#@+node:ekr.20060328125925: * @file ../plugins/chapter_hoist.py
#@+<< docstring >>
#@+node:ekr.20060328125925.1: ** << docstring >>
""" Creates hoist buttons.
This plugin puts two buttons in the icon area: a button called 'Save Hoist' and
a button called 'Dehoist'. The 'Save Hoist' button hoists the ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import random
import unittest
import d2go.runner.default_runner as default_runner
import torch
from d2go.optimizer import (
build_optimizer_mapper,
)
from d2go.utils.testing import helper
class TestArch(torch.nn.Modul... |
#-*-Mode:python;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
# ex: set ft=python fenc=utf-8 sts=4 ts=4 sw=4 et:
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
class PyTest(Command):
user_options = []
def initialize_options(s... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.views.generic import ListView, TemplateView, View
from django.views.generic.edit import FormView
from django.core.files.storage import FileSystemStorage
from .forms import UploadFirmwareForm
from .utils import *
# / , main ... |
#!/usr/bin/env python
a = eval(input('Enter value of a: '))
b = eval(input('Enter value of b: '))
if a < b:
print('a is less than b')
elif a > b:
print('a is greater than b')
elif a == b:
print('a is equal to b') |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
#!/bin/env python
import advancedSearch
import fnmatch
import json
import logging
import math
import mmap
import multiprocessing
import os
import passwordmeter
import re
import tarfile
import time
import yaml
import zipfile
import zlib
from termcolor import colored
CONFIG = yaml.safe_load(open('config.yaml'))
BASE64_... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
# -*- coding: utf-8 -*-
'''
A module to pull data from Cobbler via its API into the Pillar dictionary
Configuring the Cobbler ext_pillar
==================================
The same cobbler.* parameters are used for both the Cobbler tops and Cobbler pillar
modules.
.. code-block:: yaml
ext_pillar:
- cobbler:
... |
import time
from src.stream_analyzer import Stream_Analyzer
ear = Stream_Analyzer(
device = None, # Manually play with this (int) if you don't see anything
rate = None, # Audio samplerate, None uses the default source settings
FFT_window_siz... |
from machine import I2C
def test_i2c():
i2c_dev = I2C(I2C.I2C1, I2C.STANDARD_MODE)
addres = 0x19
LIS2DH12_WHO_AM_I = 0x0F # 板载三轴加速度传感器 身份寄存器
r_data = bytearray([0x00]) # 存储数据
i2c_dev.read(addres, bytearray(LIS2DH12_WHO_AM_I), 1, r_data, 1, 1)
print("read data lis2dh12 who_am_i reg 0x{0:02x}"... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
This script computes the max mean mass concentration of several pollutants
from a CSV file containing the following columns:
- 'DateTime' : ISO 8601 date and time
- 'Timestamp': seconds elapsed since 01/01/1970
- 'PM10 (µg/m3)' (optional)
- 'PM2.5 (µg/... |
## @ingroup Methods-Aerodynamics-Common-Fidelity_Zero-Lift
# generate_wing_wake_grid.py
#
# Created: April 2021, R. Erhard
# Modified:
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
import numpy as np
impo... |
from .run import run_depth |
"""Integration test for Row object."""
from ..context import py3odb
def test_row(sample_odb):
"""Test the iteration capability of the Row object on real data."""
with py3odb.Reader(sample_odb, "SELECT varno,lat,lon,obsvalue FROM <odb>") as odb_reader:
for row in odb_reader:
assert len(row)... |
from .json_encoder import ReportEncoder
__all__ = [
'ReportEncoder',
] |
"""
This Module interacts with Gerrit and retrieves Data from Gerrit
"""
import os
import json
import logging
import argparse
import pandas as pd
from datetime import datetime, timedelta
from json.decoder import JSONDecodeError
from urllib.parse import urlunsplit, urlencode
from typing import Tuple, Union
try:
fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.