src stringlengths 721 1.04M |
|---|
##############################################################
##HQIIS Updater Version 2.0
##
##*Changes for v2.0
## -Upgraded tool to work with SDSFIE 3.1 Army Adaptation
##
##This script takes data from an HQIIS excel file and can run a report from a USAR SDSFIE 3.1 geodatabase.
##
##This script only works on GIS re... |
"""temps vs high and low"""
import calendar
import numpy as np
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
def get_description():
""" Return a dict describing how to call... |
import _plotly_utils.basevalidators
class CaxisValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="caxis", parent_name="layout.ternary", **kwargs):
super(CaxisValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
# -*- coding: utf-8 -*-
# Copyright: (c) Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import platform
import re
from ansible.module_utils.common.sys_info ... |
from substance.monads import *
from substance.logs import *
from substance import (Command, Engine)
from tabulate import tabulate
from substance.constants import (EngineStates)
from substance.exceptions import (EngineNotRunning)
logger = logging.getLogger(__name__)
class Status(Command):
def getShellOptions(self... |
from aiohttp.web import HTTPFound
from aiohttp.web import HTTPMethodNotAllowed
from aiohttp_babel.middlewares import _
import aiohttp_jinja2
from aiohttp_security import authorized_userid
from aiohttp_security import forget
from asyncpg.exceptions import UniqueViolationError
from passlib.hash import sha256_crypt
from w... |
import os
request=context.REQUEST
response=request.RESPONSE
session= request.SESSION
if context.REQUEST['data']!='':
dat_inicio_sessao = context.REQUEST['data']
pauta = [] # lista contendo a pauta da ordem do dia a ser impressa
data = context.pysc.data_converter_pysc(dat_inicio_sessao) # converte data... |
# Copyright 2015 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... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import math
import random
from optparse import OptionParser
# Simple function to write out results in a (which contains three arrays) to file fn
def writeArray(fn, a):
if fn:
f = open(fn, 'w')
for i in range(0,len(a)):
f.write("%f %f %f %d\n" % (a[i... |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
"""
Utility functions for working with the color names and color value
formats defined by the HTML and CSS specifications for use in
documents on the Web.
See documentation (in docs/ directory of source distribution) for
details of the supported formats and conversions.
"""
import math
import re
import string
import... |
from django.db import connection, transaction
from django.db.models import signals, get_model
from django.db.models.fields import AutoField, Field, IntegerField, PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotExist
from django.db.models.related import RelatedObject
from django.db.models.query import Query... |
import json
import copy
import time
import signal
from benchmark.monitor import TestMonitor
from benchmark.launcher import TestLauncher
def _recursive_macro_replace(val, macros):
"""
Iterate over the items of val and replace the macros with
the properties of macros dictionary
"""
# Iterate over dicts
if isins... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017 jem@seethis.link
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
if 1:
# PyQt <-> PySide signal compatability
from PyQt5.QtCore import pyqtSlot, pyqtSignal
Signal = pyqtSignal
Slot = pyqtSlot
# TODO: narrow down... |
import sys, os
sys.path.insert(0, os.path.abspath('../snf-cyclades-app'))
import synnefo
reload(synnefo)
import synnefo.versions
reload(synnefo.versions)
from synnefo.versions.app import __version__
project = u'synnefo'
copyright = u'2010-2017, GRNET S.A.'
version = __version__
release = __version__
html_title = 'syn... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 mempool limiting together/eviction with the wallet."""
from test_framework.test_framework import ... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
import base64
import itertools
import json
import logging
import random
_logger = logging.getLogger(__name__)
class Model(object):
def __init__(self, database, secrets_path):
self._database = database
self._secrets_path = secrets_path
def add_user_discovery(self, results):
usernames... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Model for users comment,blog
"""
__author__ = 'Chuhong Ma'
import time, uuid
from orm import Model, StringField, BoolenField, FloatField, TextField
def next_id():
return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)
class User(Model):
__tabl... |
#!/usr/bin/env python3
"""This module is only imported in other diaspy modules and
MUST NOT import anything.
"""
import json
import copy
import re
BS4_SUPPORT=False
try:
from bs4 import BeautifulSoup
except ImportError:
print("[diaspy] BeautifulSoup not found, falling back on regex.")
else: BS4_SUPPORT=True
fro... |
#!/usr/bin/python
import time
import math
from pymavlink import mavutil
from droneapi.lib import VehicleMode, Location
import sc_config
from sc_video import sc_video
from sc_logger import sc_logger
"""
This class encapsulates the vehicle and some commonly used controls via the DroneAPI
"""
'''
TODO:
At rally point su... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import smbus
import time
class Ace128:
"""Class supporting the ACE-128 I2C Backpack"""
if GPIO.RPI_REVISION == 1:
_bus = smbus.SMBus(0)
else:
_bus = smbus.SMBus(1)
def __init__(self, i2caddr, pinOrder=(8,7,6,5,4,3,2,1)... |
#!/usr/bin/env python
lerp = lambda s, e, t: tuple(S + (E-S)*t for S, E in zip(s,e))
t = 0.65
cp0, cp1, cp2, cp3 = ((0, 300), (25, 50), (450, 50), (500,300))
M0 = lerp(cp0, cp1, t)
M1 = lerp(cp1, cp2, t)
M2 = lerp(cp2, cp3, t)
M3 = lerp(M0, M1, t)
M4 = lerp(M1, M2, t)
M5 = lerp(M3, M4, t)
print("""<svg width="100%... |
import os
import re
import shlex
import tempfile
import uuid
from subprocess import CalledProcessError
import paramiko
from .client import client
arches = [
[re.compile(r"amd64|x86_64"), "amd64"],
[re.compile(r"i?[3-9]86"), "i386"],
[re.compile(r"(arm$)|(armv.*)"), "armhf"],
[re.compile(r"aarch64"), ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'OptionGroup.package_price'
db.delete_column(u'events_optiongroup', 'package_price')
... |
import sys
import os.path
sys.path.append(os.path.abspath(__file__ + "\..\.."))
import windows
import windows.native_exec.simple_x86 as x86
import windows.native_exec.simple_x64 as x64
print("Creating a notepad") ## Replaced calc.exe by notepad.exe cause of windows 10.
notepad = windows.utils.create_process(r"C:\wind... |
from __future__ import print_function
import logging
import os
import pkg_resources
import re
import six
import sys
from collections import (
namedtuple as ntuple,
defaultdict as ddict,
OrderedDict as odict)
from datetime import datetime
from os.path import join as pathjoin, exists
from pint import UnitRegi... |
# Copyright (c) 2012 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.
"""Top-level presubmit script for Chromium.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presu... |
#################################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Dmitry Sovetov
#
# https://github.com/dmsovetov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "... |
from datetime import datetime
import json
import os
from django.test import TestCase
from corehq.apps.commtrack.models import CommtrackConfig
from corehq.apps.commtrack.tests.util import bootstrap_domain as initial_bootstrap
from corehq.apps.locations.models import Location, SQLLocation
from custom.ilsgateway.api impor... |
# -*- coding: utf-8 -*-
import os
import random
import string
import oss2
# 以下代码展示了文件上传的高级用法,如断点续传、分片上传等。
# 基本的文件上传如上传普通文件、追加文件,请参见object_basic.py
# 首先初始化AccessKeyId、AccessKeySecret、Endpoint等信息。
# 通过环境变量获取,或者把诸如“<你的AccessKeyId>”替换成真实的AccessKeyId等。
#
# 以杭州区域为例,Endpoint可以是:
# http://oss-cn-hangzhou.aliyuncs.com
# ... |
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from . import views_company, view_contact, view_role, view_company_type
urlpatterns = [
url(r'^company-type/$', view_company_type.all_company_types),
url(r'^company-type/(?P<id>[0-9]+)/$', view_company_type.single_c... |
#! /usr/bin/env python
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notic... |
# -*- coding: latin1 -*-
################################################################################################
# Script para coletar amigos a partir de um conjunto de alters do twitter
#
#
import tweepy, datetime, sys, time, json, os, os.path, shutil, time, struct, random
reload(sys)
sys.setdefaultencoding... |
# coding: utf-8
#
# Copyright 2013 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 ... |
# -*- coding: utf-8 -*-
import hashlib
import json
import re
import sqlite3
import time
import datetime
import common
from storage import db
version = '1.0'
class SQLiteStorage:
def __init__(self):
self._connect = sqlite3.connect(db)
self._connect.text_factory = str
self._create_table()... |
# -*- coding: cp1252 -*-
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
import os
import sys
from PyPDF2 import PdfFileReader
enc = sys.stdin.encoding
c = MongoClient("localhost",27017)
print ("Conectado")
dbh = c["sv03"]
errores = dbh["errores"]
def carga(tabla,carpeta):
collec... |
__author__ = 'fritz'
import json
from pubsub.database.models import db, AnkiPubSubTemplate
from copy import deepcopy
class Template():
def __init__(self,
name,
answer_format,
question_format,
deck,
ord,
back_answ... |
#!/usr/bin/env python
"""
parcer extracts content from warc files.
USAGE:
./parcex.py WARC-FILE
WARC-FILE must be a warc file that conforms to:
http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf
OUTPUT:
Directory structure with the schema as root.
The structure maps the structure of th... |
from marshmallow import Schema, fields
from sqlalchemy.exc import IntegrityError
from qlutter_todo.extensions import bcrypt, db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String, nullable=False, unique=True)
password = db.Column(db.String, nullable=False)
... |
from sympy.core.compatibility import range
from sympy import (FiniteSet, S, Symbol, sqrt,
symbols, simplify, Eq, cos, And, Tuple, Or, Dict, sympify, binomial,
cancel, KroneckerDelta, exp, I)
from sympy.concrete.expr_with_limits import AddWithLimits
from sympy.matrices import Matrix
from sympy.stats impo... |
import sys
import logging
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
def formatter_message(message, use_color = True):
if use_color:
message = message.replace("$RESET", RESET_SEQ).replace(
"$BOLD", BOLD_SEQ)
else:
message = message.replace("$RESET", "").rep... |
# Copyright (c) 2014 - 2016 townhallpinball.org
#
# 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, p... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-03-05 00:11:49
import os
import sys
import six
import copy
import time
import shutil
import logging
import logging.config
import click
import pyspid... |
# -*- coding: utf-8 -*-
"""The NTFS file system implementation."""
import pyfsntfs
# This is necessary to prevent a circular import.
import dfvfs.vfs.ntfs_file_entry
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.path import ntfs_path_spec
from dfvfs.resolver import resolver
from dfvfs.vfs... |
# Copyright (C) 2001-2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at you... |
# 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 t... |
#!/usr/bin/python -tt
# An incredibly simple agent. All we do is find the closest enemy tank, drive
# towards it, and shoot. Note that if friendly fire is allowed, you will very
# often kill your own tanks with this code.
#################################################################
# NOTE TO STUDENTS
# This is... |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... |
"""
Test of an Email Screen
Author: Kristen Nielsen kristen.e.nielsen@gmail.com
Modeled after tkSimpleDialog.py from pythonware.com
"""
from Tkinter import *
import tkMessageBox as MsgBox
from multilistbox import MultiListbox
from emailInputNew import EmailInput
class EmailSettings(Toplevel):
def _... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name
import os
import sys
import subprocess
import pytest
import numpy as np
from inspect import signature
from numpy.testing import assert_allclose
import astropy
from astropy.modeling.core import Model, custom_model
from astro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Bryan Davis and contributors
"""
Apache error log report generator
"""
import collections
import datetime
import hashlib
import re
import string
import textwrap
ERROR_FORMAT = (
r'\[(?P<datetime>[^\]]+)\] '
r'\[(?P<level>[^\]]+)\] '... |
############################################################################
# Original work Copyright 2017 Palantir Technologies, Inc. #
# Original work licensed under the MIT License. #
# See ThirdPartyNotices.txt in the project root for license information. #
# All modifi... |
"""
Filename: plot_zonal_ensemble.py
Author: Damien Irving, irving.damien@gmail.com
Description: Plot zonal ensemble
"""
# Import general Python modules
import sys, os, pdb
import argparse
from itertools import groupby
from more_itertools import unique_everseen
import numpy
import iris
from iris.experi... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""A tiny Python program to check that Python is working.
Try running this program from t... |
#!/usr/bin/env python
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2013, Centre National de la Recherche Scientifique (CNRS)
#
# Licensed under the Apache License, Version 2.0 (the "License");... |
import os, serial, time, numpy
watchTime = 3600
measureInterval = 5
calcTime = 1.5
def receiving(ser):
global last_received
buffer_string = ''
while True:
buffer_string = buffer_string + ser.read(ser.inWaiting())
if '\n' in buffer_string:
lines = buffer_string.split('\n') # Gua... |
##
# model.py
#
# This file is where we model the objects used by our web app
# for storing in the App Engine datastore.
#
# Note: we're taking advantage of a great project called GeoModel
# that allows us to easily query geospatial information from
# the datastore. Our primary use of this model is to perform
# pro... |
from werkzeug.utils import import_string, cached_property
class LazyView:
"""
Lazy view
Callable class that provides loading views on-demand as soon as they
are hit. This reduces startup times and improves general performance.
See flask docs for more:
http://flask.pocoo.org/docs/0.10/patterns... |
#########
# Copyright (c) 2013 GigaSpaces Technologies 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
#!/usr/bin/env python3
# This file is part of the MicroPython project, http://micropython.org/
# The MIT License (MIT)
# Copyright (c) 2019 Damien P. George
import os
import subprocess
import sys
import argparse
sys.path.append('../tools')
import pyboard
# Paths for host executables
CPYTHON3 = os.getenv('MICROPY_CP... |
# -*- coding:utf-8 -*-
# 预约更新
# import tornpg
import libs
import peewee
from core.base_model import BaseModel
class phpmps_refresh(BaseModel):
uid = peewee.CharField(max_length=36, null=False, unique=True, help_text='类别的ID', primary_key=True)
refresh_time = peewee.IntegerField(null=False)
i... |
import pytest
from bid import BidValue, BidSuit, Bid
from card import CardSuit
class TestBidValue:
def test_valid_inputs(self):
inputs = ['6', '7', '8', '9', '10', 6, 7, 8, 9, 10]
for input in inputs:
bid_value = BidValue(input)
assert bid_value.value == str(input)
def test_invalid_inputs(s... |
import tensorflow as tf
# How often to update smoothed variables (in terms of training steps).
DEFAULT_UPDATE_FREQUENCY = 5
class ExponentialSmoothing(object):
"""Defines TensorFlow variables and operations for exponential smoothing.
Following Marian [1], we maintain smoothed versions of all trainable
... |
import math
from typing import List, Optional, Tuple
from discord.ext import commands
from discordbot.command import MtgContext
from magic import tournaments
@commands.command()
async def swiss(ctx: MtgContext, num_players: Optional[int], num_rounds: Optional[int], top_n: Optional[int]) -> None:
"""Display the ... |
# Test tools for mocking and patching.
# Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mock 1.0
# http://www.voidspace.org.uk/python/mock/
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# Scripts maintained ... |
# -*- coding: utf-8 -*-
""" Tests for student account views. """
import logging
import re
from unittest import skipUnless
from urllib import urlencode
import mock
import ddt
from django.conf import settings
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.url... |
# This file is part of Korman.
#
# Korman is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Korman is distributed i... |
#!/usr/bin/env python
import re
from setuptools import setup, find_packages
pkgname = 'datastore.objects'
# gather the package information
main_py = open('datastore/objects/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", main_py))
packages = filter(lambda p: p.startswith('datastore'), fin... |
import sys, pygame
import numpy as np
from numpy.random import random
pygame.init()
size = width, height = 1000, 800
amplitude_max = 4.
amplitude = amplitude_max * random()
speed = [amplitude*random(), amplitude*random()]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
done = False
is_blue = True
x = 30
y = ... |
# 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 ... |
"""Test init of Airly integration."""
from datetime import timedelta
from homeassistant.components.airly.const import DOMAIN
from homeassistant.config_entries import (
ENTRY_STATE_LOADED,
ENTRY_STATE_NOT_LOADED,
ENTRY_STATE_SETUP_RETRY,
)
from homeassistant.const import STATE_UNAVAILABLE
from . import API... |
__author__ = 'thor'
from numpy import zeros, argmin, array, unique, where
from scipy.spatial.distance import cdist
def _df_picker(df, x_cols, y_col):
return df[x_cols].as_matrix(), df[[y_col]].as_matrix()
def df_picker_data_prep(x_cols, y_col):
return lambda df: _df_picker(df, x_cols, y_col)
def binomial... |
# -*- coding: utf-8 -*-
'''
handling thumbnailing
'''
from shotgun_replica import config as srconfig
import shotgun_api3
import os
from shotgun_api3.lib.httplib2 import Http
from shotgun_replica.utilities import debug
from elefant.utilities import config
import uuid
import shutil
def getUrlAndStoreLocally( entity_ty... |
# Copyright (C) 2006-2011 Julien Ridoux <julien@synclab.org>
#
# This file is part of the radclock program.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License,... |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.contrib.auth.models import AnonymousUser
from django.contrib.sta... |
from __future__ import absolute_import, division
import copy
from datetime import datetime
from itertools import chain
import six
import sqlalchemy as sa
from six.moves import range, zip
from sqlalchemy import func
from tests.models import ArchiveTable, MultiColumnUserTable, UserTable
from tests.utils import SQLiteT... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either ve... |
# -------------------------------------------------------------------------------
# Name: benchmark_pcap
# Purpose: Benchmark the creation and parsing of a biug pcap file
#
# Author:
#
# Created:
#
# Copyright 2014 Diarmuid Collins
#
# This program is free software; you can redistribute it and/o... |
from .api import Api
import logging
class SnapshotResource(Api):
def __init__(self):
self.path = '/v2/snapshots'
def all(self, resource_type=None, page=None, per_page=None):
logging.info('List all snapshots. (resource_type={}, page={}, per_page={})'.format(resource_type, page, per_page))
... |
from __future__ import unicode_literals
import socket
try:
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import unquote
from urllib.request import URLError, urlopen
except ImportError: # pragma: no cover
from BaseHTTPServer import B... |
import unittest
from zope.testing.cleanup import cleanUp
class SolrIndexTests(unittest.TestCase):
def setUp(self):
cleanUp()
def tearDown(self):
cleanUp()
def _getTargetClass(self):
from alm.solrindex.index import SolrIndex
return SolrIndex
def _makeOne(self, id, so... |
from django.utils.text import capfirst
from django.db.models import get_models
from django.utils.safestring import mark_safe
from django.contrib.admin import ModelAdmin
# get_models returns all the models, but there are
# some which we would like to ignore
IGNORE_MODELS = (
"sites",
"sessions",
"admin",
... |
import unittest
from tests import get_model_access, test_db, connection_string, SKIP_PYPGQUEUE_TEST
import idb.pypgqueue as pq
from time import sleep
from threading import Thread
import logging
def sleep_job(data):
secs = float(data["seconds"])
sleep(secs)
def exc_job(data):
raise Exception("Here's an excepti... |
"""Parses Atomic coordinates entries from PDB files"""
import math
from lightdock.error.lightdock_errors import PDBParsingError, PDBParsingWarning
from lightdock.structure.atom import Atom, HetAtom
from lightdock.structure.residue import Residue
from lightdock.structure.chain import Chain
from lightdock.util.logger im... |
# Copyright (C) 2007, Red Hat, Inc.
# Copyright (C) 2009, Aleksey Lim, Sayamindu Dasgupta
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your ... |
# encoding: UTF-8
"""
这里的Demo是一个最简单的策略实现,并未考虑太多实盘中的交易细节,如:
1. 委托价格超出涨跌停价导致的委托失败
2. 委托未成交,需要撤单后重新委托
3. 断网后恢复交易状态
4. 等等
这些点是作者选择特意忽略不去实现,因此想实盘的朋友请自己多多研究CTA交易的一些细节,
做到了然于胸后再去交易,对自己的money和时间负责。
也希望社区能做出一个解决了以上潜在风险的Demo出来。
"""
from ctaBase import *
from ctaTemplate import CtaTemplate
###################################... |
from typing import Dict, TYPE_CHECKING
import logging
import pyvex
import archinfo
from .... import options, BP_BEFORE
from ....blade import Blade
from ....annocfg import AnnotatedCFG
from ....exploration_techniques import Slicecutor
from .resolver import IndirectJumpResolver
if TYPE_CHECKING:
from angr.block ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
"""
This script is used by SmartyStreets when deploying a new version of the jquery.liveaddress plugin.
"""
import os.path as path
import os
import sys
import boto
from boto.s3.bucket import Bucket
from boto.s3.connection import S3Connection, OrdinaryCallingFormat
from boto.s3.key import Key
from utils import get_mim... |
# 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 Li... |
import logging
import weasyprint
from django.core.exceptions import PermissionDenied
from django.urls import reverse, reverse_lazy
from django.views.generic import DetailView, ListView, RedirectView
from django.views.generic.edit import UpdateView, DeleteView
from django.http import Http404, HttpResponse
from django.co... |
# Copyright 2018 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 a... |
from datetime import datetime
import re
import time
import urllib
import simplejson as json
from actions import Action
from webservice import WebService
class MobileMe(WebService):
loginform_url = 'https://auth.me.com/authenticate'
loginform_data = {
'service': 'account',
'ssoNamespace': 'pr... |
import string
import sys
from state import *
from tmsim import *
if __name__ == "__main__":
name = sys.argv[-1]
fileName = name + ".tm4"
path = "../tm4_files/" + fileName
try:
assert len(sys.argv) > 1
for flag in sys.argv[2:-1]:
if not (flag in ["-q", "-s", "-f"]):
... |
from __future__ import absolute_import
from __future__ import print_function
import ujson
from django.http import HttpResponse
from mock import patch
from typing import Any, Dict
from zerver.lib.initial_password import initial_password
from zerver.lib.sessions import get_session_dict_user
from zerver.lib.test_classe... |
from ems.qt import QtWidgets, QtCore, QtGui
from ems.qt.richtext.char_format_proxy import CharFormatProxy
Qt = QtCore.Qt
QObject = QtCore.QObject
QColor = QtGui.QColor
QAction = QtWidgets.QAction
QKeySequence = QtGui.QKeySequence
QFont = QtGui.QFont
QIcon = QtGui.QIcon
QPixmap = QtGui.QPixmap
ThemeIcon = QIcon.fromTh... |
# Copyright (c) 2015 VMware, 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... |
class HTTPRequest(object):
def doCreateXmlHTTPRequest(self):
if JS("""typeof $wnd.XMLHttpRequest != 'undefined'"""):
# IE7+, Mozilla, Safari, ...
res = JS("""new XMLHttpRequest()""")
return res
return None
def asyncImpl(self, method, user, pwd, url, postData,... |
VERSION='V 1.4 - 2014 Jun 4 - '
from grid2d import MapGrid
class stokesCubeMap :
def __init__(self,*Arg) :
arm_alias={'x':'S','y':'M'}
self._nameRIMO=None
self._angularCut=None
self._Nsamples=-1
self.File = []
self.Component = []
self.Instrument = []
self.Channel = [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.