text stringlengths 2 999k |
|---|
import torch
import torch.nn.functional as F
from .. import BaseModel
from cogdl.utils import spmm
from .mlp import MLP
class PPNP(BaseModel):
@staticmethod
def add_args(parser):
"""Add model-specific arguments to the parser."""
# fmt: off
parser.add_argument("--num-features", type=in... |
"""This module contains the general information for FabricZoneIdUniverse ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class FabricZoneIdUniverseConsts():
pass
class FabricZoneIdUniverse(Manag... |
# 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 ... |
import json
import redis
from notifications import notify
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.shortcuts import render
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_r... |
#Copyright ReportLab Europe Ltd. 2000-2017
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/doctemplate.py
__version__='3.4.2'
__doc__="""
This module contains the core structure of platypus.
rlatypus constructs documents. Documen... |
import pytest
import sdk_install as install
import sdk_utils as utils
from tests.config import (
PACKAGE_NAME,
DEFAULT_TASK_COUNT
)
def setup_module(module):
install.uninstall(PACKAGE_NAME)
utils.gc_frameworks()
options = {
"service": {
"specification_uri": "https://gist.gith... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import rdflib, urllib
file_in = "etymwn.tsv"
file_out = "./data/"
file_ns = rdflib.Namespace("http://example.org/etymwn#")
g = rdflib.Graph(store='Sleepycat', identifier='etymwn')
g.open(file_out, create=True)
print("Precalculate file size...", end="")
with open(file... |
import os
import sys
import vstruct.qt as vs_qt
import envi.expression as e_expr
import envi.qt.config as e_q_config
import vqt.main as vq_main
import vqt.colors as vq_colors
import vqt.qpython as vq_python
import vqt.application as vq_app
import vivisect.cli as viv_cli
import vivisect.base as viv_base
import vivise... |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... |
#!/usr/bin/env python
# Copyright 2019 The Kubernetes 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 appli... |
# -*- coding: utf-8 -*-
"""
propulsion_base.py generated by WhatsOpt 1.10.4
"""
# DO NOT EDIT unless you know what you are doing
# whatsopt_url:
# analysis_id: 3
import numpy as np
from numpy import nan
from os import path
from importlib import import_module
from yaml import load, FullLoader
from openmdao.api impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import random
from momblish.corpus_analyzer import CorpusAnalyzer
from momblish import Momblish
__author__ = "Stephen Prater"
__copyright__ = "Stephen Prater"
__license__ = "mit"
test_corpus = [
'abcd',
'abdc',
'acbd',
'acdb',
'adbc',
'adc... |
# -*- coding: utf-8 -*-"""
"""
This module provides a simple CLI for extracting Red-Green-Blue from images
"""
import argparse, argcomplete
import os.path as osp
import sys
from .lamplight import image_info, image_split, save_images
def interface(filename, directory):
img_type, name, src_image = image_info(fi... |
"""Emoji
Available Commands:
.hypno"""
from telethon import events
import asyncio
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern=r"hypno"))
async def _(event):
if event.fwd_from:
return
animation_interval = 0.8
animation_ttl = range(0, 15)
#input_str = event.pattern_... |
import argparse
import logging
import torch
import pathlib
import numpy as np
from classifier.config.defaults import cfg
from classifier.data.build import make_data_loaders
from classifier.logger import setup_logger
from classifier.trainer import Trainer
from classifier.models import build_model
from classifier.utils i... |
# -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_readConnectionLost -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTestCase.test_readConnectionLost}
to test that IHalfCl... |
#!/usr/bin/env python
# Script that converts CCSM output to a series of SQL 'insert' commands.
#
# usage: ccsm2sql.py <table> < <ccsm-file> | sqlite3 <db>
#
# Copyright (c) 2007-2018 Carnegie Mellon University. All Rights Reserved.
# See COPYRIGHT file for details.
import argparse
import scale
parser = argparse.Arg... |
import sys
import os
import h5py
import sima
import numpy as np
from shapely.geometry import MultiPolygon, Polygon, Point
import pickle
from sima.ROI import poly2mask, _reformat_polygons
from itertools import product
import scipy.stats as stats
import time
import warnings
import re
import matplotlib
import matplotlib.p... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Papyrus(CMakePackage):
"""Parallel Aggregate Persistent Storage"""
homepage = "https:... |
from datetime import datetime
import aiohttp
import discord
from .constants import BASE_URL, TEAMS
from .helper import hockey_config
import logging
log = logging.getLogger("red.Hockey")
class Standings:
def __init__(
self,
name: str,
division: str,
conference: str,
divisio... |
__author__ = "Jie Lei"
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class BidafAttn(nn.Module):
"""from the BiDAF paper https://arxiv.org/abs/1611.01603.
Implemented by @easonnie and @jayleicn
"""
def __init__(self, channel_size, method="origi... |
import braintree
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
from orders.models import Order
gateway = braintree.BraintreeGateway(settings.BRAINTREE_CONF)
def payment_process(request):
order_id = request.session.get('order_id')
order = get_object_or_404(O... |
import sys
try:
import layout
except ImportError:
# Failed to import our package, which likely means we were started directly
# Add the additional search path needed to locate our module.
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from layout.main imp... |
import threading
import unittest
import uuid
from io import StringIO
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import viewsets, filters
from rest_framework.exceptions import NotFound
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
# L... |
"""Module to make any python script a a daemon.
"""
import os
import sys
import time
import atexit
from signal import SIGTERM
try:
# Running from the source repo "test".
from tcutils.pkgs.Traffic.traffic.utils.logger import LOGGER, get_logger
except ImportError:
# Distributed and installed as package
f... |
# Copyright 2020 Neal Lathia
#
# 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 agre... |
from django import forms
from .models import Register
class RegisterForm(forms.Form):
email = forms.EmailField(widget=forms.TextInput(attrs={
'class': 'form-control form-control-lg',
'label': '',
'placeholder': 'Email Address ...'
}))
# def clean_email(self, *args, **kwargs):
#... |
# Copyright 2010-2011 Yelp
#
# 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, softwa... |
import sublime
import sublime_plugin
import os
from hyperhelpcore.common import log
from hyperhelpcore.core import help_index_list
###----------------------------------------------------------------------------
class HyperhelpAuthorReloadIndexCommand(sublime_plugin.TextCommand):
"""
If the current view is... |
# coding=utf-8
import ConfigParser
__author__ = 'rxread'
class Config(object):
def __init__(self, config_file_name):
self.cf = ConfigParser.ConfigParser()
self.cf.read(config_file_name)
key_list = self.cf.get('common', 'key_search_word_list').split(',')
custom_black_list = self.c... |
'''
timelapse_generator.py - Create a .gif or sequence of .png files using a pixels.log
Author: Martín "Netux" Rodriguez
'''
import argparse
import re
from datetime import datetime, timedelta
from json import loads
from math import floor
from pathlib import Path
from PIL import Image
def find_config_path():
parent... |
"""
Django settings for movie_recommendatio_30103 project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-04-01 09:07
from __future__ import unicode_literals
from django.db import migrations
def migrate_documents(apps, schema_editor):
Applicant = apps.get_model('assignments', 'Applicant')
PrivateDocument = apps.get_model('files', 'PrivateDocument')
... |
# Copyright 2018-2021 Jakub Kuczys (https://github.com/jack1142)
#
# 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 app... |
from django.test import TestCase
from django.db import connections
import pandas
from pandas.testing import assert_frame_equal, assert_series_equal
from transform_layer.services.data_service import DataService
import transform_layer.calculations as calc
import json
import math
import unittest
import os
import pyreadr
... |
"""Graph defenition class which is used to exchange the nodes information between tvm and CLI."""
from __future__ import absolute_import as _abs
import json
class GraphDef(object):
"""The class which is used to exhange the nodes inforamtion between TVM and CLI.
This class contains the list of nodes."""
... |
# Train net Given an image of vessel and content and mask (region) of the vessel predict the material of the vessel content and the material of the vessel
#...............................Imports..................................................................
import os
import numpy as np
import NetModel
import torch
i... |
from .z3 import *
from . import z3num
from . import z3poly
from . import z3printer
from . import z3rcf
from . import z3types
from . import z3util
# generated files
from . import z3core
from . import z3consts
|
# pylint: disable=no-self-use
from functools import partial
from c2cgeoform.views.abstract_views import AbstractViews, ListField
from sqlalchemy.orm import subqueryload
from sqlalchemy.sql.functions import concat
from c2cgeoportal_commons.models.main import TreeItem, Metadata
_list_field = partial(ListField, TreeIt... |
#!/usr/bin/python3
"""Tests for the redirect.py script."""
#
# (C) Pywikibot team, 2017-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from contextlib import suppress
import pywikibot
from pywikibot import Page, i18n
from scripts.redirect import RedirectRobot
from tests import Mock, patch
f... |
"""This module contains the general information for FabricDceSwSrvPcEp ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class FabricDceSwSrvPcEpConsts():
ADMIN_STATE_DISABLED = "disabled"
ADMIN_STATE_ENAB... |
#
# 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 us... |
from ContactsSafe import db
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from ContactsSafe import login
#creates table User
class User(db.Model, UserMixin):
#columns in the table
id = db.Column(db.Integer, primary_key = T... |
import pytest
from back.models import helper
from back.models.social import Like, DisLike
from back.exceptions import _SchemaLoadError
def test_add_like(user_data, like_data, db_session):
assert db_session.query(Like).all() == []
user_id = helper.add_user(user_data)["id"]
like_data["user_id"] = user_id
... |
#!/usr/bin/env python
#
# xdp_redirect_cpu.py Redirect the incoming packet to the specific CPU
#
# Copyright (c) 2018 Gary Lin
# Licensed under the Apache License, Version 2.0 (the "License")
from bcc import BPF
import time
import sys
from multiprocessing import cpu_count
import ctypes as ct
flags = 0
def usage():
... |
#Write your code below this row 👇
#Initializes the variable for the total
total_even_numbers = 0
#Goes through all even numbers
for even_number in range(2, 101, 2):
#Adds the current even number to the total
total_even_numbers += even_number
#Prints the total of even numbers from 1 to 100
print(total_even_numbe... |
import sys
import validation
from major_minor import *
class Command(Major):
def __init__(self, name, defaultHelpOption=True):
super().__init__(name)
self.options = self._minors
def addOption(self, option):
self._addMinor(option)
def addNewOption(self, longname, shortname, valid=... |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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
#
# Un... |
import json
import sys
import asyncio
import newrelic.agent
from aiohttp import ClientSession, InvalidURL, ClientError, ClientResponseError, ClientTimeout, ContentTypeError, ClientConnectionError, ClientOSError, ClientConnectorError, ClientProxyConnectionError, \
ClientSSLError, ClientConnectorSSLError, ClientConn... |
"""Implement the Google Smart Home traits."""
import logging
from typing import List, Optional
from homeassistant.components import (
alarm_control_panel,
binary_sensor,
camera,
cover,
fan,
group,
input_boolean,
input_select,
light,
lock,
media_player,
scene,
script,... |
"""
Exceptions used in the Hummingbot codebase.
"""
class HummingbotBaseException(Exception):
"""
Most errors raised in Hummingbot should inherit this class so we can
differentiate them from errors that come from dependencies.
"""
class ArgumentParserError(HummingbotBaseException):
"""
Unabl... |
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
# pylint: disable=redefined-outer-name
import os
import re
from decisionengine.framework.tests.fixtures import ( # noqa: F401
DEServer,
PG_DE_DB_WITHOUT_SCHEMA,
PG_PROG,
SQLALCHEMY_PG_WITH_SCHEMA,
S... |
# Copyright (c) 2020-2022 Qianqian Fang <q.fang at neu.edu>. All rights reserved.
# Copyright (c) 2016-2019 Iotic Labs Ltd. 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 a... |
import pygame
import sys
import traceback
from myplane import *
import enemy
import bullet
import supply
from pygame.locals import *
from random import *
pygame.init()
pygame.mixer.init()
bg_size = width, height = 480, 700
screen = pygame.display.set_mode(bg_size)
pygame.display.set_caption("飞机大战 -- Cat-fishing")
bac... |
from broccoli import register
from broccoli.funcstions.roguelike import healing_use
from broccoli.material import RogueLikeItem
from broccoli.img.loader import NoDirection
@register.item
class HealingHerb(RogueLikeItem):
name = '薬草'
power = 10
image = NoDirection('img/item/herb1.png')
use = healing_us... |
import HTTPRequester
import Thread_types
import re
import zlib
def multi_post_call(path, headers, payloadslist, boundaries, original_request):
#boundaries = array of post parameters
HTTPRequester.check_max_threads() #check if all the threads are being used
new_thread = Thread_types.Threadsr(path, header... |
"""Pure python code for initial experiments with data."""
from masculinity_survey import DataSource, MetaData
# DataSource.download_data()
print(DataSource.get_data_path())
for column_name in MetaData.get_column_names():
print(MetaData.get_description(column_name))
print(MetaData.get_allowed_values(column_na... |
from textwrap import dedent, indent
import pytest
from flourish import Flourish
from flourish.sourcelist import SourceList
class TestBlueprint:
def test_blueprint_resources_imported(self):
from flourish import blueprint
assert blueprint.toolbar
assert blueprint.template
def test_blu... |
import colorpair_generator as color
from cable_colors import get_colorpair_names
"""
This function is implemented to create a reference manual with
color names and its corresponding codes for the wiring personnel
"""
def create_reference_manual():
reference_manual = []
pair_number_start_index = 1
pair_n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 3 13:23:59 2021
@author: th
"""
import torch
from torch.nn import ReLU, Linear, Softmax, SmoothL1Loss, Tanh, LeakyReLU
from torch_geometric.nn import GCNConv, global_max_pool, global_mean_pool, SGConv, GNNExplainer, SAGEConv, GATConv, FastRGCNCon... |
"""
Evaluate NLG models on utterances of Multiwoz test dataset
Metric: dataset level BLEU-4, slot error rate
Usage: python evaluate.py [usr|sys|all]
"""
import json
import random
import sys
import zipfile
import numpy as np
import torch
from nltk.translate.bleu_score import corpus_bleu, SmoothingFunction
from convlab... |
# coding=utf-8
# import os
# import sys
# import argparse
# import logging
# import jieba
class SimHash(object):
def __init__(self, tokens='', hashbits=128):
"""
:param tokens:
:param hashbits:
"""
self.hashbits = hashbits
self.hash = self.simhash(tokens)
def ... |
"""
WSGI config for TEKDB 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
# from whitenoise.django import Djang... |
import pytest
from eth_utils import to_checksum_address
from raiden.api.python import RaidenAPI
from raiden.exceptions import (
DepositMismatch,
InvalidSettleTimeout,
TokenNotRegistered,
UnexpectedChannelState,
UnknownTokenAddress,
)
from raiden.tests.utils.detect_failure import raise_on_failure
fr... |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch
import torch.nn.functional as F
__all__ = ['Res2Net', 'res2net50_v1b', 'res2net101_v1b', 'res2net50_v1b_26w_4s']
model_urls = {
'res2net50_v1b_26w_4s': 'https://shanghuagao.oss-cn-beijing.aliyuncs.com/res2net/res2net50_v1b_26... |
"""
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
distri... |
from __future__ import absolute_import, division, print_function
import iotbx.pdb
import mmtbx.model
from mmtbx.validation.ramalyze import ramalyze
from libtbx.utils import null_out
from mmtbx.validation.comparama import add_arrows_on_plot
from PIL import Image
pdb_str = """\
ATOM 13 CB PHE A 1 11.914 1... |
# 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... |
import numpy
import cv2
import threading
import queue
import time
class SingleTask:
"""
本类管理了两个子线程来执行单一的神经网络任务
"""
def __init__(self, net, **kwargs):
"""
实例化方法
- net: Net实例
"""
self.net = net
self.useWebcam = False
self.videoIndex = 0
... |
expected_output = {
'lisp_id': {
0: {
'peer_addr': '44.44.44.44',
'peer_port': 4342,
'local_address': '11.11.11.11',
'local_port': 55239,
'session_type': 'Active',
'session_state': 'Up',
'session_state_time': '(16:24:12)',
... |
""" Classes and functions for pipette state tracking
"""
import logging
from typing import Any, Dict, Optional, Tuple, Union
from opentrons.types import Point
from opentrons.config import pipette_config
from .types import CriticalPoint
mod_log = logging.getLogger(__name__)
class Pipette:
""" A class to gather a... |
from django.test import TestCase
from ..factories import DocumentTypeFactory, LetterFactory
from ..models import DocumentType, Letter
from ...generic.tests.mixins import FactoryTestCaseMixin
class LetterFactoryTestCase(FactoryTestCaseMixin, TestCase):
FACTORY = LetterFactory
MODEL = Letter
class DocumentTy... |
# https://www.codechef.com/LRNDSA01/problems/LAPIN
for _ in range(int(input())):
s = input()
first = sorted(s[0:len(s) // 2 + (1 if len(s) % 2 == 1 else 0)])
second = sorted(s[len(s) // 2:])
print("YES" if first == second else "NO")
|
from __future__ import annotations
import numpy as np
import pandas as pd
import sklearn.datasets
from sklearn import datasets
from IMLearn.metrics import mean_square_error
from IMLearn.utils import split_train_test
from IMLearn.model_selection import cross_validate
from IMLearn.learners.regressors import PolynomialFit... |
import random
import factory.fuzzy
from random import uniform
from protocols import (
reports_2_1_0,
reports_3_0_0,
reports_4_0_0,
reports_5_0_0,
reports_6_0_0,
reports_6_0_1,
participant_1_0_0,
participant_1_0_3,
participant_1_1_0
)
from protocols.util.dependency_manager import (
... |
from .datepicker import BaseDialogPicker, MDDatePicker
|
""" One of the helpers for the gui application.
Similar modules: class:`.NativeArgsSaver`, :class:`.ParameterSaver`,
:class:`.UiLoader`, :class:`.Worker`, :class:`.DataProvider`
"""
from pathlib import Path
import os.path
from shutil import copyfile
from idact.detail.environment.environment_impl import Environ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import urllib
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from jp.ac.kyoto_su.cse.wz.MVC.Model import OpenGLModel
from jp.ac.kyoto_su.cse.wz.Parts.Polygon import OpenGLPolygon
TRACE = True
DEBUG = False
class Penguin... |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Upload all debug symbols required for crash reporting purposes.
This script need only be used to upload release builds symbols or to debug
crashes... |
x = [2,3,5,6,8]
y = [1,6,22,33,61]
x_2 = list()
x_3 = list()
x_4 = list()
x_carpi_y = list()
x_2_carpi_y = list()
for i in x:
x_2.append(int(pow(i,2)))
x_3.append(int(pow(i,3)))
x_4.append(int(pow(i,4)))
print("xi : ", x, sum(x))
print("xi^2 : ", x_2, sum(x_2))
print("xi^3 : ", x_3, sum(x_3))
print("xi^... |
# encoding: UTF-8
"""
导入CSV历史数据到MongoDB中
"""
import sys
import csv
from datetime import datetime, timedelta
from time import time
import pymongo
from vnpy.trader.app.ctaStrategy.ctaBase import SETTING_DB_NAME, TICK_DB_NAME, MINUTE_DB_NAME, DAILY_DB_NAME
from vnpy.trader.vtGlobal import globalSetting
from vnpy.trader.vt... |
"""
Schema Base Classes
"""
class JsonSchema: # pylint: disable=too-few-public-methods
"""
Basic Schema Definition
"""
schema_name = ''
schema_version = 0
schema_definition = {}
example = None
|
import re
from setuptools import setup, find_packages
with open('plaid/version.py', 'r') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
f.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('Cannot find version information')
url = 'https://github.co... |
from flask import Flask, render_template, Response
from camera import VideoCamera
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
def gen(camera):
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type:... |
import pytest
from test_fixtures.scenarios.basic import * # noqa
from organizations.tests.conftest import organization_random # noqa - used by local tests
from logs.tests.conftest import flexible_slicer_test_data, report_type_nd # noqa
@pytest.fixture
def root_platform(platforms):
return platforms['root']
@... |
#!/usr/bin/env python
import jinja2
import os
import copy
import logging
from ansible.module_utils.basic import AnsibleModule
from s3vaultlib.metadata.ec2 import EC2Metadata
from s3vaultlib.connection.connectionmanager import ConnectionManager
from s3vaultlib.s3vaultlib import S3Vault
logging.basicConfig(level=logging... |
# -*- coding: utf-8 -*-
from django.contrib.admin.utils import prepare_lookup_value
from django.contrib import admin
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
from django.contrib.admin.utils import reverse_field_path
from django.contrib.admin.utils import get_model_from_relat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 2 16:27:03 2019
@author: avinash
"""
import os
# list of files and directory
dir_content = os.listdir('.')
def find(word, letter):
index = -1
while(index < len(word)):
if word[index] == letter:
return(index)
... |
a = [5, 10, 15, 20, 25]
def my_list(L):
another_list = [L[0], L[-1]]
return another_list
print('Initial list', a)
print('New list', my_list(a))
|
from sql import *
from google.cloud import spanner, storage
from sql.aggregate import *
from sql.conditionals import *
import sqlite3
import pandas as pd
import json
def store(data):
#TODO store json in google cloud storage
def make_json(res):
dump = {}
for r in res:
#TODO append to json for data bac... |
# Copyright (C) 2012 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
"""
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
Follow up:
Could you solve thi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmmtools documentation build configuration file, created by
# sphinx-quickstart on Sat May 13 13:35:37 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... |
import sys
import os
import os.path
import difflib
import subprocess
import re
import pydoc
import inspect
import unittest
import test.support
import xml.etree
from contextlib import contextmanager
from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard
from test import pydoc_mod
expected_text_pattern = ... |
import PyQt5.Qt as qt
import sys
from moviepy.video.io import ffmpeg_reader
from moviepy.video.io import ffmpeg_writer
import time
import os
class CutDialog(qt.QTableWidget):
sg_try_pause = qt.pyqtSignal(str)
sg_try_start = qt.pyqtSignal(str)
sg_try_cancel = qt.pyqtSignal(str)
def __init__(s... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
"""Constants for the deCONZ component."""
import logging
_LOGGER = logging.getLogger('homeassistant.components.deconz')
DOMAIN = 'deconz'
CONFIG_FILE = 'deconz.conf'
DATA_DECONZ_EVENT = 'deconz_events'
DATA_DECONZ_ID = 'deconz_entities'
DATA_DECONZ_UNSUB = 'deconz_dispatchers'
CONF_ALLOW_CLIP_SENSOR = 'allow_clip_se... |
"""Tests for the homewizard component."""
from asyncio import TimeoutError
from unittest.mock import patch
from aiohwenergy import AiohwenergyException, DisabledError
from homeassistant.components.homewizard.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ... |
""" Hyperparameters for Box2d Point Mass task with PIGPS."""
from __future__ import division
import os.path
from datetime import datetime
import numpy as np
from gps import __file__ as gps_filepath
from gps.agent.box2d.agent_box2d import AgentBox2D
from gps.agent.box2d.point_mass_world import PointMassWorld
from gps.... |
import numpy as np
import tensorflow as tf
import datetime
import ctr_funcs as func
import config_dstn as cfg
import os
import shutil
# config
str_txt = cfg.output_file_name
base_path = './tmp'
model_saving_addr = base_path + '/dstn_s_' + str_txt + '/'
output_file_name = base_path + '/dstn_s_' + str_txt + '.txt'
num_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.