text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# ACCESS_KEY_ID/ACCESS_KEY_SECRET 根据实际申请的账号信息进行替换
ACCESS_KEY_ID = "LTAIzr81fXY9ZnnL"
ACCESS_KEY_SECRET = "0RtnH7nGDPtqBB23pwAbmGJBtXCIpQ" |
from collections import OrderedDict
from datetime import datetime, date, time, timedelta
from decimal import Decimal
from operator import itemgetter
import hashlib
from django import forms, VERSION, conf
from django.apps import apps
from django.conf.urls import url
from django.contrib import admin, messages
from djang... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""Cleanup build artifacts."""
import argparse
import logging
import os
import shutil
import sys
from glob import iglob
logger = logging.getLogger()
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('toplevel')
parser.add_argument('--all... |
class TestDay002(object):
testcases = [
([3, 2, 1], [2, 3, 6]),
([1, 2, 3, 4, 5], [120, 60, 40, 30, 24]),
([5, 4, 3, 2, 1], [24, 30, 40, 60, 120])
]
def test_product_expect_self01(self):
from solutions.day_002.solution01 import product_expect_self
for (inputs, expect... |
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def input():
return sys.stdin.readline().strip()
import math
import collections
from collections import deque, Counter, defaultdict
from bisect import bisect_left, bisect
from copy import deepcopy
import itertools
from heapq import heappush, heapp... |
"""
This module provides some Cardano blockchain transaction tools
"""
from os import path
from json import loads as json_loads
from subprocess import run as subprocess_run
from tokutils import get_address, get_address_file, get_vkey_file, get_protocol_keydeposit
def split_list(tx):
"""
split list in two with '+' ... |
from jadi import component
from aj.plugins.dashboard.api import Widget
@component(Widget)
class ScriptWidget(Widget):
id = 'script'
name = _('Script')
template = '/terminal:resources/partial/widget.html'
config_template = '/terminal:resources/partial/widget.config.html'
def __init__(self, context... |
# -*- coding: utf-8 -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 Thomas Voegtlin
#
# 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 witho... |
from wimblepong import Wimblepong
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from utils import Transition, ReplayMemory
class Q_CNN(nn.Module):
def __init__(self, state_space, action_space, size, fc1_size=64):
super(Q_CNN... |
# Author: a101269
# Date : 2020/3/5
"""
A wrapper/loader for the official conll-u format files.
"""
import os
import io
FIELD_NUM = 10
FIELD_TO_IDX = {'id': 0, 'word': 1, 'lemma': 2, 'upos': 3, 'xpos': 4, 'feats': 5, 'head': 6, 'deprel': 7, 'deps': 8,
'misc': 9}
class CoNLLFile():
def ... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = pa... |
"""
Update all Document.web_uris.
Revision ID: 9f5e274b202c
Revises: e10ce4472966
Create Date: 2017-01-20 16:07:03.442975
"""
from __future__ import unicode_literals
from collections import namedtuple
import logging
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_ba... |
import gzip
import io
import pandas
from .. import Utilities
def try_parse(string, fail=None):
try:
return float(string)
except Exception:
return fail;
def skip_na(key, value):
skip = (not value or value == "NA")
return skip
def skip_non_rsid_value(key, value):
return not "rs" in... |
"""
ID: ebd60a5b-403f-4eac-a651-8a9a52c2b11c
Useful with Dijkstra's when you want the path. This version assumes all the keys you need are there,
but you could use .get() instead.
"""
from collections.abc import Mapping
from typing import Optional
from src.typehints import Node
def backpedal(goal: Node, parents: Ma... |
import mmcv
import os.path as osp
from utilities.helper import natural_keys
import os
import cv2
class Mta_dataset_image:
def __init__(self,img,frame_no_cam,cam_id):
self._img = img
self._frame_no_cam = frame_no_cam
self._cam_id = cam_id
self._img_dims = (self._img.shape[:2][1],s... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protos/data.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _r... |
# Copyright 2021 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... |
"""
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... |
def gradient_colors(nb_colors, color_start=None, color_end=None):
"""Produce a color gradient."""
if color_start is None:
color_start = [1, 0, 0]
if color_end is None:
color_end = [0, 0, 1]
# start at black, finish at white
gradient = [color_start]
# If only one color, return bla... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import argparse
import os
import sys
import pdb
import csv
def generate_data(input_csv, binarize=False, head_only=False, head_row... |
import discord
import unicodedata
import time
from redbot.core import Config, checks, commands
from typing import Optional, Union
class ReactRole(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.config = Config.get_conf(
self, identifier=95932766180343811, force_registratio... |
#!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2016-2019 Illumina, 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/LIC... |
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.forms import widgets
from paper_admin.monkey_patch import MonkeyPatchMeta
# Метакласс MonkeyPatch для класса Widget.
WidgetMonkeyPatchMeta = type("WidgetMonkeyPatchMeta", (MonkeyPatchMeta, widgets.MediaDefiningClass, ), {})
class PatchRe... |
"""
Django settings for data_aggregate project.
Generated by 'django-admin startproject' using Django 3.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
impor... |
from datetime import datetime
from app.ModelTrainer import ModelTrainer
class Pipeline:
model_trainer = ModelTrainer()
def execute(self):
target_predictor = self.model_trainer.train()
print("Start predicting values:")
print(datetime.now())
target_predictor.calculate_prediction_accuracies()
def... |
from collections import defaultdict
import json
import os
from typing import Dict, List
import cv2
from torch.utils.data import Dataset
class ArchCaptionsDatasetRaw(Dataset):
r"""
A PyTorch dataset to read ARCH dataset and provide it completely
unprocessed. This dataset is used by various task-specific d... |
# encoding: utf-8
"""Step implementations for document settings-related features"""
from __future__ import absolute_import, division, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.settings import Settings
from helpers import test_docx
# given ==========... |
import argparse
import time
from dataset import *
from models import FlowNetS, PWC_Net, LightFlowNet
from torch.utils.tensorboard import SummaryWriter
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
np.random.seed(seed=1)
PRINT_INTERVAL = 50
device = torch.device('cuda') if torch.cuda.is... |
import sys,os, glob
import subprocess
import numpy as np
L=2000
sim_prefix = '/20140820_seqs'
dt=100
valdt = 1
jobcount = 0
D=0.5
year_list = range(5000, 24800, dt)
dir_list = glob.glob('../data_new/N_10000_L_2*sdt_1*')
for dir_name in dir_list:
for sample_size in [200]:
for dscale in [0.5, 1.0, 2.0, 3.0]... |
import logging
import re
import scrapy
from scrapy_selenium import SeleniumRequest
from ..items import ComicSerie, ChapterUrl
from ..item_loaders import ComicSerieLoader
_logger = logging.getLogger(__name__)
class MangabatSpider(scrapy.Spider):
name = 'mangabat'
allowed_domains = [
'm.mangabat.com',
... |
import unittest
from skeletor.cli.menu import Menu, confirm
class MenuInteraction(object):
def __init__(self, inputs):
self.inputs = inputs
self.idx = -1
self.calls = []
def get(self, prompt):
self.idx += 1
return self.inputs[self.idx]
def func_a(self):
... |
from flask import Blueprint
# create blueprint for the components in this module
# to connect to app instance.
bp = Blueprint('source', __name__)
# import modules to include package members.
from app.source import routes |
# coding: utf-8
from __future__ import unicode_literals
import calendar
import re
import time
from .amp import AMPIE
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import compat_urlparse
class AbcNewsVideoIE(AMPIE):
IE_NAME = 'abcnews:video'
_VALID_URL = r'''(?x)
... |
from pygame import *
class Gamesp(sprite.Sprite):
def __init__(self, pl_image, pl_y, pl_x, size_x, size_y, pl_speed):
sprite.Sprite.__init__(self)
self.image = transform.scale(image.load(pl_image), (size_x, size_y))
self.speed = pl_speed
self.rect = self.image.get_rect()
sel... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
import os.path as osp
import PIL
import numpy as np
import sc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import codecs
import distutils.spawn
import os.path
import platform
import re
import sys
import subprocess
import shutil
from functools import partial
from collections import defaultdict
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
... |
class BinHeap:
def __init__(self):
self.heapList = [0]
self.currentSize = 0
def percUp(self,i):
while i // 2 > 0:
if self.heapList[i] < self.heapList[i // 2]:
tmp = self.heapList[i // 2]
self.heapList[i // 2] = self.heapList[i]
self.heap... |
"""Account service."""
import sys
import six
from pyicloud.utils import underscore_to_camelcase
class AccountService(object):
"""The 'Account' iCloud service."""
def __init__(self, service_root, session, params):
self.session = session
self.params = params
self._service_root = servi... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='simplemona',
version='0.5.0',
description='Monacoin mining with no registration required.',
author='Eric Cook/Musee Ullah',
author_email='milkteafuzz@gmail.com',
url='http://simplemona.com',
entry_points=... |
__title__ = 'jsons'
__version__ = '1.3.0'
__author__ = 'Ramon Hagenaars'
__author_email__ = 'ramon.hagenaars@gmail.com'
__description__ = 'For serializing Python objects to JSON (dicts) and back'
__url__ = 'https://github.com/ramonhagenaars/jsons'
__license__ = 'MIT' |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 15:10:42 2016
@author: liudiwei
"""
import numpy as np
from adaboost import AdaboostClassifier
#每行数据以\t隔开,最后一列为类标号
def loadDataSet(datafile):
featData = []; labelDate = []
with open(datafile, 'r') as fr_file:
for eachline in fr_file:
onelin... |
# -*- coding: utf-8 -*-
#
# DeepIMDB documentation build configuration file, created by
# sphinx-quickstart.
#
# 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
# autogenerated file.
#
# All configuration values have ... |
import re
def find_first_char(s, char_list):
min_index = len(s)
for elem in char_list:
if s.find(elem) != -1:
min_index = min(min_index,s.find(elem))
if min_index == len(s):
return ""
return s[min_index]
def parse_element(s):
"""
:description
... |
#!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Performance runner for d8.
Call e.g. with tools/run-perf.py --arch ia32 some_suite.json
The suite json format is expected to be... |
#!/usr/bin/env python2
import os
import pkgutil
import importlib
import fwsynthesizer
from fwsynthesizer.utils import *
FRONTENDS = [ x[1] for x in pkgutil.iter_modules(__path__) ]
class Frontend:
"Frontend object"
def __init__(self, name, diagram, language_converter,
query_configuration=Non... |
class InvalidPathException(Exception):
pass
class PageNotFoundException(Exception):
pass |
""" Tests related to connecing inputs to outputs."""
import unittest
import numpy as np
from io import StringIO
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal, assert_warning
from openmdao.utils.mpi import MPI
try:
from openmdao.vectors.petsc_vector import PETScVector
except... |
# 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 the... |
from __future__ import absolute_import
from __future__ import unicode_literals
import collections
import os
import shutil
import mock
from ogreclient.core.scan import scan_for_ebooks
from ogreclient.prereqs import get_definitions
from ogreclient.providers import LibProvider
@mock.patch('ogreclient.utils.connection... |
import os
import sys
import subprocess
import tempfile
from time import sleep
from os.path import exists, join, abspath
from shutil import rmtree
from tempfile import mkdtemp
from twisted.trial import unittest
from scrapy.utils.python import retry_on_eintr
from scrapy.utils.test import get_testenv
class ProjectTest(... |
# mysql/__init__.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import base # noqa
from . import cymysql # noqa
from . import gaerdbms #... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from cmsplugin_filer_utils.migration import rename_tables_new_to_old
class Migration(SchemaMigration):
cms_plugin_table_mapping = (
# (old_name, new_name),
('cmsplugin_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The SymbiFlow 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
print("hello world!") |
import os
import sqlite3
import json
# From: https://goo.gl/YzypOI
def singleton(cls):
instances = {}
def getinstance():
if cls not in instances:
instances[cls] = cls()
return instances[cls]
return getinstance
class DatabaseDriver(object):
"""
Database driver for ... |
__author__ = 'austin'
def module_check_r(module):
"""
Just for debian-based systems like Kali and Ubuntu
"""
ri = tk.messagebox.askyesno("error",
"""%s was not found on your system if your an admin and would like to install it
press yes"""... |
from matrix import *
import random
def draw_matrix(m):
array = m.get_array()
for y in range(m.get_dy()):
for x in range(m.get_dx()):
if array[y][x] == 0:
print("□", end='')
elif array[y][x] == 1:
print("■", end='')
else:
... |
# # # Module that initializes server conn,
from client_manager import ClientManager
import socket, select, logging, os
from multiprocessing import Pipe, Process, Queue
host = '0.0.0.0'
port = 5050
def setup_logging():
FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s'
logging.basicConfig(filename... |
from __future__ import print_function
import unittest
from implicit.approximate_als import (
AnnoyAlternatingLeastSquares,
FaissAlternatingLeastSquares,
NMSLibAlternatingLeastSquares,
)
from implicit.gpu import HAS_CUDA
from .recommender_base_test import RecommenderBaseTestMixin
# don't require annoy/fa... |
import os
import json
import argparse
from tqdm import tqdm
import pickle
from bson import json_util
from mongoengine import connect
from annotation.models import Doc, User, Sent, Annotation
import config as config
def export_data(annotation_type):
output_path = os.path.join(os.path.abspath(os.path.dirname(__fil... |
# -*- coding: utf-8 -*-
# @Author: Jie Yang
# @Date: 2017-11-27 16:53:36
# @Last Modified by: Jie Yang, Contact: jieynlp@gmail.com
# @Last Modified time: 2019-01-09 21:39:10
"""
convert NER/Chunking tag schemes, i.e. BIO->BIOES, BIOES->BIO, IOB->BIO, IOB->BIOES
"""
from __future__ import print_function
i... |
import multiprocessing
import sys
from PyQt5.QtWidgets import QApplication
from sfmkeyframe.view.KeyframeMainWindow import KeyframeMainWindow
# for windows compatibility
multiprocessing.set_start_method('spawn')
app = QApplication(sys.argv)
mainWindow = KeyframeMainWindow()
mainWindow.show()
sys.exit(app.exec_()) |
# Copyright 2015 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... |
"""
This file generates a set of most distant permutations from each other. This is only a support dataset: this will be useful
when we will crop each image and reorder them in those distances.
This is a kind of mathematical distribution, no data are loaded here.
"""
import numpy as np
import itertools
import os
from ... |
"""
Soft Voting/Majority Rule classifier and Voting regressor.
This module contains:
- A Soft Voting/Majority Rule classifier for classification estimators.
- A Voting regressor for regression estimators.
"""
# Authors: Sebastian Raschka <se.raschka@gmail.com>,
# Gilles Louppe <g.louppe@gmail.com>,
# ... |
# -*- coding: utf-8 -*-
"""Implementation of factory that create instances containing of triples and numeric literals.tsv."""
import logging
import pathlib
from typing import Any, Dict, Optional, TextIO, Tuple, Union
import numpy as np
import torch
from .triples_factory import TriplesFactory
from .utils import load... |
try:
import json
except ImportError:
from django.utils import simplejson as json
import requests
from copy import copy
from django.conf import settings
from billing import CreditCard
from billing import Gateway, GatewayNotConfigured
from billing.signals import transaction_was_successful, transaction_was_unsucc... |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import tags_or_list
def validate_tags_or_list(x):
"""
Property: AppBlock.Tags
Property: Application.Tags
Property: Fleet.Tags
Property: ImageBuilder.Tags
Property: Stack.... |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Prints "1" if Chrome targets should be built with hermetic Xcode.
Prints "2" if Chrome targets should be built with hermetic Xcode,... |
# PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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 flask import Flask, jsonify
import datetime as dt
import numpy as np
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func, inspect
engine = create_engine("sqlite:///Resources/hawaii.sqlite", connect_args={'check_same_threa... |
'''
This file is a part of Test Mile Arjuna
Copyright 2018 Test Mile Software Testing Pvt Ltd
Website: www.TestMile.com
Email: support [at] testmile.com
Creator: Rahul Verma
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 ... |
# Copyright 2020 BlueCat Networks. All rights reserved.
# -*- coding: utf-8 -*-
type = 'ui'
sub_pages = [
{
'name' : 'move_to_bluecatgateway_udf_page',
'title' : u'Migrate to BlueCatGateway UDF',
'endpoint' : 'move_to_bluecatgateway_udf/move_to_bluecatgateway_udf_endpoint',
... |
from osiris.base.generalutils import flag
def test_flag_values():
assert not flag(None)
assert not flag('None')
assert not flag('none')
assert not flag('null')
assert not flag('0')
assert not flag(0)
assert not flag('N')
assert not flag('no')
assert not flag('false')
assert fl... |
import os
from dotenv import load_dotenv
from helpers import RequestHandler
class Order(RequestHandler):
def place_order(self, isin: str, expires_at: str, quantity: int, side: str):
load_dotenv()
order_details = {
"isin": isin,
"expires_at": expires_at,
"side":... |
paths = [
[(0, 0), (0, 1), (1, 1), (2, 1), (3, 1), (3, 2)],
[(1, 0), (1, 1), (1, 2), (1, 3), (1, 4)],
[(2, 0), (2, 1), (2, 2), (2, 3), (2 , 4)]
];
def solvePath(grid, car, start, finish):
return paths[car - 1]; |
from .test_build_features import categorical_features, features_to_drop, numerical_features, target_col, feature_params
__all__ = ["categorical_features", "features_to_drop", "numerical_features", "target_col", "feature_params"] |
"""
Youtube Tag
---------
This implements a Liquid-style youtube tag for Pelican,
based on the jekyll / octopress youtube tag [1]_
Syntax
------
{% youtube id [width height] %}
Example
-------
{% youtube dQw4w9WgXcQ 640 480 %}
Output
------
<span class="videobox">
<iframe
width="640" height="480" src="h... |
import tensorflow as tf
class FaceGANModel(object):
def __init__(self, batch_size=64, learning_rate=1e-3):
# 1. Define input.
self.input_image = tf.placeholder(tf.float32, [batch_size, 40 * 55],
name="input_image")
self.input_prior = tf.placeholder... |
class Solution():
def my_solution(self, A: str, B: str) -> int:
# Brute force, time O(n*m), n=len(A), m=len(B)
if not A:
return -1
i, j, n, m = 0, 0, len(A), len(B)
while i <= n-m:
if B[j] == A[i]:
while j<m and B[j] == A[i+j]: j+=1
... |
comment_format = {
'platformAvatar': 'thumbnail_url',
'badge': 'badge',
'fanID': 'youtube_fan_id',
'authorDisplayName': 'account_title',
'commentDatePosted': 'timestamp',
'commentID': 'comment_id',
'textDisplay': 'content',
'archive': 'archived',
'... |
#!/usr/bin/env python3
import requests
import string
import time
# exclude '%'
candidates = string.printable[:66] + string.printable[67:]
def guess():
user = "admin"
pw = []
url = "http://chall1.heroctf.fr:8080/index.php"
for i in range(10):
for a in candidates:
pw.append(a)
... |
from base import BaseAGSServer
########################################################################
class ImageService(BaseAGSServer):
"""
An image service provides access to raster data through a web
service. Multiple rasters can be served as one image service through
mosaic dataset techn... |
# -*- coding: utf-8 -*-
"""MacOS keychain database files."""
import collections
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtformats import data_format
from dtformats import errors
class KeychainDatabaseColumn(object):
"""MacOS keychain database column.
Attributes:
attribute_data_ty... |
# coding: utf-8
"""
Engine api
Engine APIs # noqa: E501
OpenAPI spec version: 1.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import vtpl_api
from vtpl_api.models.engine_task_status_cumulative import EngineTask... |
#
# PySNMP MIB module BEGEMOT-MIB2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BEGEMOT-MIB2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:37:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
'''
流调查询
'''
from settings_class import settings_obj
import pandas as pd
from util.logger import logger
from sqlalchemy import desc
from datetime import datetime,timedelta
def get_forward_backward_time(current_time, minutes):
# 获取向前和向后的时间
if isinstance(current_time,str):
current = datetime.strptime(cu... |
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
import logging
from traits.api import provides
from .i_operation import IOperation
from .base_operation import BaseOperation
log = logging.getLogger(__name__)
@provides(IOperation)
class OptimizeOperation(BaseOperation):
"""Performs... |
import glob
import math
import os
import os.path as osp
import random
import time
from collections import OrderedDict
import cv2
import json
import numpy as np
import torch
import copy
from torch.utils.data import Dataset
from torchvision.transforms import transforms as T
from cython_bbox import bbox_overlaps as bbox... |
import time
import tflearn
import numpy as np
import tensorflow as tf
from h_RNN.RNN import RNNWrapper, Generator
from h_RNN.SpRNN import SparseRNN
from Util.Util import DataUtil
class MnistGenerator(Generator):
def __init__(self, im=None, om=None, one_hot=True):
super(MnistGenerator, self).__init__(im, ... |
"""
Project: SSITH CyberPhysical Demonstrator
Name: logging.py
Author: Steven Osborn <steven@lolsborn.com>, Ethan Lew <elew@galois.com>
Date: 01 January 2021
Logs for Cyberphys Components
"""
import pathlib, os
import logging.config
# load utils/logging.conf
logging_filepath = pathlib.Path(os.path.realpath(__file__)... |
CLONE_PATH = "/tmp"
DEBUG=True |
import unittest
from parameterized import parameterized as p
from solns.waterBottles.waterBottles import *
class UnitTest_WaterBottles(unittest.TestCase):
@p.expand([
[]
])
def test_naive(self):
pass |
import argparse
import app.main
def main(days: int, dry_run: bool) -> None:
deleted = app.main.storage_backend.delete_older_than_days(days, dry_run)
if dry_run:
print(f"{len(deleted)} files would have been deleted")
else:
print(f"{len(deleted)} files were deleted")
app.main.cache... |
import pandas as pd
import numpy as np
GAINMILES_BINS = [-1, 0, 1, 5, 10, 25, 100]
SINUOSITY_BINS = [-1, 0, 1.2, 1.5001]
LANDCOVER_BINS = [-1, 0, 50, 75, 90]
RARESPP_BINS = [0, 1, 2, 5, 10]
STREAMORDER_BINS = [-1, 0, 1, 2, 3, 4, 5, 6]
def classify_gainmiles(series):
bins = GAINMILES_BINS + [series.max() + 1]
... |
import time
import pigpio
class OnkyoCommand():
def __init__(self, pi, gpio):
self.pi = pi
self.gpio = gpio
pi.set_mode(gpio, pigpio.OUTPUT)
def _create_header_wave(self):
wf = []
wf.append(pigpio.pulse(1 << self.gpio, 0, 3000))
wf.append(pigpio.pulse(0, 1 << ... |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/vehicle/shared_military_e.iff"
result.attribute_template_... |
# Copyright 2015 Internap.
#
# 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, so... |
import unittest
from fixtures.base import BaseTestCase
from pages.forgot_password_page import ForgotPasswordPage
from pages.login_page import LoginPage
from parameters.parameters import *
class ForgotPasswordTestCase(BaseTestCase):
def setUp(self):
super(ForgotPasswordTestCase, self).setUp()
self.... |
# MIT License
# Copyright (c) 2018 Balazs Bucsay
# 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, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.