content stringlengths 4 20k |
|---|
#######################################################################
# functionality:
# 1. Creates a Google Calendar API service object
# 2. Deletes all events in the calendar in case changes have been
# made to existing events
# 3. Create events based on all the posts in
# "_posts" (POSTS_DIREC... |
# Author: Idan Gutman
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 ... |
import time
from profile_creators import profile_extender
from telemetry.core import exceptions
from telemetry.core import util
class FastNavigationProfileExtender(profile_extender.ProfileExtender):
"""Extends a Chrome profile.
This class creates or extends an existing profile by performing a set of tab
navig... |
import sys, os
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
lexers['php'] = PhpLexer(startinline=True, linenos=1)
lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1)
primary_domain = 'php'
# -- General configuration -----------------------------------------------------... |
from funfactory.urlresolvers import reverse
from mock import patch
from nose.tools import eq_
from pyquery import PyQuery as pq
from bedrock.mozorg.tests import TestCase
@patch('bedrock.newsletter.utils.get_languages_for_newsletters',
lambda *x: set(['en', 'fr', 'pt']))
@patch('lib.l10n_utils.template_is_acti... |
"""Simple base-classes for extensions and filters.
None of the filter and extension functions are considered 'optional' by the
framework. These base-classes provide simple implementations for the
Initialize and Terminate functions, allowing you to omit them,
It is not necessary to use these base-classes - but if you... |
#!/usr/bin/env python3
import os
import argparse
import json
import libdlt
from unis.exceptions import CollectionIndexError
from libdlt.util.common import print_progress
SYS_PATH="/etc/periscope"
USER_DEPOTS=os.path.join(SYS_PATH, "depots.conf")
UNIS_URL = "http://unis.crest.iu.edu:8890"
XFER_TOTAL = 0
def progress(... |
from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from mock import Mock
from ..models import FacilityUser, DeviceOwner, Facility, KolibriAnonymousUser
from ..api import KolibriAuthPermissions
from ..permissions.base import BasePermissions
from ..permissions.gene... |
from __future__ import unicode_literals
import re
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from paypal.payflow import codes
from paypal import base
@python_2_unicod... |
"""
Commands that use the dictd protocol to define word.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you\'re keeping the plugin in CVS or some similar system.
__version__ = "%%VERSION%%"
__author__ = supybot.authors.jemfi... |
"""SmartHab configuration flow."""
import logging
import pysmarthab
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
from . import DOMAIN
_LOGGER = logging.getLogger(__name__)
class SmartHabConfigFlow(config_entries.ConfigFlow, domain=DOMA... |
import os
import runtime.temp_file as temp_file
from runtime import db
from runtime.diagnostics import SQLFlowDiagnostic
from runtime.model import EstimatorType
from runtime.pai import cluster_conf, pai_model, table_ops
from runtime.pai.get_pai_tf_cmd import (ENTRY_FILE, JOB_ARCHIVE_FILE,
... |
from django.contrib.auth.decorators import permission_required
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.cache import add_never_cache_headers
try:
from django.template.response import TemplateResponse
except ImportError:
Templ... |
#!/usr/bin/env python
#
# A module to analyze and identify any common problems which can be determined from log files
#
# Initial code by Andrew Chapman (<EMAIL>), 16th Jan 2014
#
# some logging oddities noticed while doing this, to be followed up on:
# - tradheli MOT labels Mot1,Mot2,Mot3,Mot4,GGain
# - Pixhawk ... |
"""SavedModel builder.
Builds a SavedModel that can be saved to storage, is language neutral, and
enables systems to produce, consume, or transform TensorFlow Models.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import
from... |
from __future__ import print_function, division
import numpy as np
from mdtraj.utils import ensure_type
from mdtraj.utils.six.moves import range
from mdtraj.geometry import _geometry
__all__ = ['compute_distances', 'compute_displacements',
'compute_center_of_mass', 'find_closest_contact']
################... |
# encoding: 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):
# Adding model 'Tag'
db.create_table('articles_tag', (
('id', self.gf('django.db.models.fields... |
# -*- coding: utf-8 -*-
from __future__ import (print_function, division,
absolute_import, unicode_literals)
import unittest
from mock import Mock
from pytest import fixture
from oauth2client.client import OAuth2Credentials
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDri... |
from __future__ import absolute_import, division, print_function
import copy
from ansible.module_utils.k8s.helper import COMMON_ARG_SPEC, AUTH_ARG_SPEC, OPENSHIFT_ARG_SPEC
from ansible.module_utils.k8s.common import KubernetesAnsibleModule, OpenShiftAnsibleModuleMixin, to_snake
try:
from openshift.helper.excepti... |
from .utils import merge_dict, perform_request, CommentClientRequestError
import models
import settings
class User(models.Model):
accessible_fields = [
'username', 'follower_ids', 'upvoted_ids', 'downvoted_ids',
'id', 'external_id', 'subscribed_user_ids', 'children', 'course_id',
'group_... |
"""Various authentication engines supported by RepoXplorer."""
import base64
import json
import jwt
from urllib.parse import urljoin
import requests
from pecan import conf
from repoxplorer.exceptions import UnauthorizedException
from repoxplorer import index
from repoxplorer.index import users
class BaseAuthEngine... |
from __future__ import print_function
import sys, os, time
startTime = time.time()
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse
op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
_,... |
import mock
from neutron.agent.linux import ip_link_support as ip_link
from neutron.tests import base
class TestIpLinkSupport(base.BaseTestCase):
IP_LINK_HELP = """Usage: ip link add [link DEV] [ name ] NAME
[ txqueuelen PACKETS ]
[ address LLADDR ]
[ broa... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
# Import Datadog
try:
from datadog import initialize, api
HAS_DAT... |
#!/usr/bin/env python
# This script belongs to https://github.com/
# this script convert LUNA 16 mhd file to RGB-jpg file.
__author__ = "Zengming Shen,Email:<EMAIL>"
import os,glob
import argparse
import numpy as np
import SimpleITK as sitk
from PIL import Image
import cv2
import scipy.misc
DATA_DIRECTORY = '/... |
import airflow
from airflow.operators.dummy_operator import DummyOperator
from airflow.models import DAG
from airflow.exceptions import AirflowSkipException
args = {
'owner': 'airflow',
'start_date': airflow.utils.dates.days_ago(2)
}
# Create some placeholder operators
class DummySkipOperator(DummyOperator)... |
"""Module :mod:`sklearn.kernel_ridge` implements kernel ridge regression."""
# Authors: Mathieu Blondel <<EMAIL>>
# Jan Hendrik Metzen <<EMAIL>>
# License: BSD 3 clause
import numpy as np
from .base import BaseEstimator, RegressorMixin
from .metrics.pairwise import pairwise_kernels
from .linear_model.ridge ... |
from gi.repository import Gtk, GObject, Pango, Gdk
class HyperTextView(Gtk.TextView):
__gtype_name__ = "HyperTextView"
__gsignals__ = {"anchor-clicked": (GObject.SignalFlags.RUN_LAST, GObject.TYPE_NONE, (str, str, int))}
__gproperties__ = {
"link": (GObject.TYPE_PYOBJECT, "link color", "link colo... |
from __future__ import absolute_import
from django.core.exceptions import ValidationError
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from six import text_type
from zerver.decorator import to_non_negative_int
from zerver.lib.actions import do_update_pointer
fro... |
### Shelly's code
import turtle
import random
import time
SIZE_X=1300
SIZE_Y=750
turtle.setup(SIZE_X,SIZE_Y)
UP_EDGE = SIZE_Y/2
DOWN_EDGE = -SIZE_Y/2
RIGHT_EDGE = SIZE_X/2
LEFT_EDGE = -SIZE_X/2
#how far the snake moves
SQUARE_SIZE=40
pos_list=[]
turtle.tracer(1,0)
#def first_screen():
w = turtle.clone()
turtle.bg... |
import account_payment
import wizard
import account_move_line
import account_invoice
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import errno
import itertools
import math
import os
import platform
import signal
import subprocess
import sys
import threading
def to_bytes(str):
# Encode to UTF-8 to get binary data.
return str.encode('utf-8')
def to_string(bytes):
if isinstance(bytes, str):
return bytes
return to_bytes(byte... |
import datetime
import re
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import redirect
from .core.sqlRunner import *
from .core.SqlRunnerThread import *
from .forms import SqlScriptForm
from .forms import RunForm
... |
"""
Provides classes for (WS) SOAP bindings.
"""
from logging import getLogger
from suds import *
from suds.sax import Namespace
from suds.sax.parser import Parser
from suds.sax.document import Document
from suds.sax.element import Element
from suds.sudsobject import Factory, Object
from suds.mx import Content
from su... |
# -*- coding: utf-8 -*- IGNORE:C0111
from __future__ import absolute_import, print_function, unicode_literals
import logging
import yamlish
import yaml
import tempfile
import textwrap
INPUT = 1
OUTPUT = 2
if yamlish.py3k:
unicode = str
#logging.basicConfig(level=logging.DEBUG)
def _generate_test_name(source):... |
import os
import sys
import re
import signal
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
usage = "usage: perf script report compaction-times.py -- [-h] [-u] [-p|-pv] [-t | [-m] [-fs] [-ms]] [pid|pid-range|comm-regex]\n"
class popt:
DISP_DFL = 0
DISP_PROC = 1
DISP_PROC_VERBOSE=2
class topt:
DISP_TIME = 0
DISP... |
import time
from distutils.version import LooseVersion
try:
import boto.ec2
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def get_volume(module, ec2):
name = module.params.get('name')
id = module.params.get('id')
zone = module.params.get('zone')
filters = {}
volume_ids = None
... |
"""
Verifies that LTO flags work.
"""
import TestGyp
import os
import re
import subprocess
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
CHDIR = 'lto'
test.run_gyp('test.gyp', chdir=CHDIR)
test.build('test.gyp', test.ALL, chdir=CHDIR)
def ObjPath(srcpa... |
text="""
#define FUNC$numR(m_r,m_func,$argt)\\
virtual m_r m_func($argtp) { \\
if (Thread::get_caller_ID()!=server_thread) {\\
m_r ret;\\
command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\
return ret;\\
} else {\\
return visual_server->m_func($argp);\\
}\\
}
#define FUN... |
import numpy as np
from pandas import DataFrame
def numpy_dot():
"""
Imagine a point system in which each country is awarded 4 points for each
gold medal, 2 points for each silver medal, and one point for each
bronze medal.
Using the numpy.dot function, create a new dataframe called
'oly... |
"""Rope object analysis and inference package
Rope makes some simplifying assumptions about a python program. It
assumes that a program only performs assignments and function calls.
Tracking assignments is simple and `PyName` objects handle that. The
main problem is function calls. Rope uses these two approaches fo... |
from openerp.osv import fields, osv
# from openerp.tools import float_compare
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class account_compensation(osv.Model):
_inherit = "account.compensation"
def is_vat_on_payment(self, compensation):
vat_on_p = 0
fo... |
from __future__ import (absolute_import, division, print_function)
from PyQt4 import QtGui, QtCore
from functools import partial
from reduction_gui.widgets.base_widget import BaseWidget
from reduction_gui.reduction.inelastic.dgs_pd_sc_conversion_script import PdAndScConversionScript
import ui.inelastic.ui_dgs_pd_sc_con... |
from django.db import models
from django.conf import settings
class Orador(models.Model):
class Meta:
verbose_name = "orador"
verbose_name_plural = "oradores"
nombre = models.CharField(verbose_name='nombre', max_length=100)
bio = models.TextField(verbose_name='curriculum vitae')
foto... |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
# motion_expand.py
# Descomprime los datos con el movimiento.
import os
import sys
from GOP import GOP
from subprocess import check_call
from subprocess import CalledProcessError
from MCTF_parser import MCTF_parser
#MOTION_DECODER_NAME = "gzip"
#MOTION_DECODER_NAME = "... |
# Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
import os
import sys
import py_entitymatching as mg
p = mg.get_install_path()
datasets_path = os.sep.join([p, 'datasets', 'example_datasets'])
snb = mg.SortedNeighborhood... |
"""Test resources processing, i.e. <if> and <include> tag handling."""
import unittest
from processor import FileCache, Processor, LineNumber
class ProcessorTest(unittest.TestCase):
"""Test <include> tag processing logic."""
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwar... |
import os
import re
class DependencyGraph(object):
# This is based on the JobGraph from Zuul.
def __init__(self):
self._names = set()
self._dependencies = {} # dependent_name -> set(parent_names)
def add(self, name, dependencies):
# Append the dependency information
self... |
"""Generates C++ source files from a mojom.Module."""
import mojom.generate.generator as generator
import mojom.generate.module as mojom
import mojom.generate.pack as pack
from mojom.generate.template_expander import UseJinja
_kind_to_cpp_type = {
mojom.BOOL: "bool",
mojom.INT8: "int8_t",
mojom... |
# -*- coding: utf-8 -*-
"""
sphinx.config
~~~~~~~~~~~~~
Build configuration file handling.
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import sys
from os import path
from sphinx.errors import ConfigError
from sp... |
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from optparse import make_option
import sys
import os
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
def vararg_callback(option, opt_str, opt_value, parser):
parser.rargs.... |
__author__ = 'oier'
import os
import numpy as np
from data.parameters import true_params
from data.parameters import false_params
import distance as dist
import numpy as np
def pdftotext(path):
os.system("pdftotext {data}".format(data=path))
return(path.replace(".pdf",".txt"))
import pandas as pd
def parse(p... |
import os
from os import path as op
import shutil
import zipfile
import sys
import pytest
from mne import datasets, read_labels_from_annot, write_labels_to_annot
from mne.datasets import testing
from mne.datasets._fsaverage.base import _set_montage_coreg_path
from mne.datasets.utils import _manifest_check_download
f... |
class Solution(object):
def solveEquation(self, equation):
"""
:type equation: str
:rtype: str
"""
left, right = equation.split('=')
a1, b1 = self._parse(left)
a2, b2 = self._parse(right)
if a1 == a2:
if b1 == b2:
return "In... |
"""
This page is in the table of contents.
The gts.py script is an import translator plugin to get a carving from an gts file.
An import plugin is a script in the interpret_plugins folder which has the function getCarving. It is meant to be run from the interpret tool. To ensure that the plugin works on platforms wh... |
import copy
from advisor.db_log_parser import DataSource, NO_COL_FAMILY
from advisor.ini_parser import IniParser
import os
class OptionsSpecParser(IniParser):
@staticmethod
def is_new_option(line):
return '=' in line
@staticmethod
def get_section_type(line):
'''
Example sectio... |
__author__ = 'user'
from PyQt4 import Qt, QtGui
class QColorComboBox(QtGui.QComboBox):
ColorNames = ["darkGreen", "green", "gray", "red", "white", "blue", "cyan", "darkMagenta", "yellow",
"darkRed", "black", "magenta"]
ColorRole = Qt.Qt.UserRole + 1
def __init__(self, parent=None):
... |
import tensorflow as tf
import os
import sys
sys.path.append(os.path.realpath(".."))
from helpers.layers import denselayer
from models.base_model import BaseModel
import numpy as np
class FeedForward(BaseModel):
def __init__(self, sess, args):
BaseModel.__init__(self, sess)
self.n_hiddens = arg... |
import base64
import os
try:
from _thread import get_ident
except ImportError:
from thread import get_ident
try:
from urllib import quote
except ImportError:
from urllib.parse import quote
from sqlobject import col
from sqlobject import dberrors
from sqlobject.dbconnection import DBAPI, Boolean
sqlite... |
import readBoard as rb
import State
import copy
def getPossibilities(state):
possibilities = []
#Loop through each tile to find the spaces that can be filled by a spawning tile
for i in range(4):
for j in range(4):
#If we find an empty space, add a child to children where a two is spawned, and a ... |
__all__ = ['IWebSocketChannel',
'IWebSocketChannelFrameApi',
'IWebSocketChannelStreamingApi']
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class IWebSocketChannel(object):
"""
A WebSocket channel is a bidirectional, full-duplex, ordered, reliable message channel
over a WebSock... |
from case import Case
class Case7_1_3(Case):
DESCRIPTION = """Send a ping after close message"""
EXPECTATION = """Clean close with normal code, no pong."""
def init(self):
self.suppressClose = True
def onConnectionLost(self, failedByMe):
Case.onConnectionLost(self, failedByMe... |
# The default ``config.py``
def set_prefs(prefs):
"""This function is called before opening the project"""
# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_files()`.
# No... |
import product_extended
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from collections import defaultdict
from django.shortcuts import get_object_or_404, render, redirect
from django.db import transaction
from django import forms
from .models import Survey, Question, Answer
@transaction.atomic
def load(request, id):
survey = get_object_or_404(Survey, id=id, active=True)
conte... |
import constants
# 255: Control characters that usually does not exist in any text
# 254: Carriage/Return
# 253: symbol (punctuation) that does not belong to word
# 252: 0 - 9
# The following result for thai was collected from a limited sample (1M).
# Character Mapping Table:
TIS620CharToOrderMap = ( \
255,255,255,... |
import debugger_unittest
import sys
import re
import os
CHECK_BASELINE, CHECK_REGULAR, CHECK_CYTHON = 'baseline', 'regular', 'cython'
class PerformanceWriterThread(debugger_unittest.AbstractWriterThread):
CHECK = None
debugger_unittest.AbstractWriterThread.get_environ # overrides
def get_environ(self):
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_sys_daemon_log_tmm
short_description: Manage BIG-IP t... |
import fnmatch
import os
def generate( env ):
def Glob( env, includes = None, excludes = None, dir = '.' ):
"""Adds Glob( includes = Split( '*' ), excludes = None, dir = '.')
helper function to environment.
Glob both the file-system files.
includes: list of file name pattern included i... |
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
NETWORKS_DETAIL_URL = 'horizon:admin:networks:detail'
class NetworkAgentTests(test.BaseAdminViewTests):
@test.create_st... |
# -*- coding: utf-8 -*-
from vilya.libs.store import store
def main():
rs = store.execute("select id, type "
"from issues "
"where type='project'")
for r in rs:
id, _ = r
rs1 = store.execute("select id, project_id, issue_id "
... |
#!/usr/bin/env python
"""
Use like this:
find somedir | xargs flake8 | python linting.py
or:
flake8 somedir | python linting.py
or:
git ls-files somedir | python linting.py
"""
import os
import sys
# Enter any part of a warning that we deem OK.
# It can be a pep8 warning error code or any other par... |
"""
Contains the class that specializes the round class of the competition, to
be used on the tests.
"""
import csv
import os.path
import os
from guadaboard import guada_board
#from resistencia import xdg
from resistencia.contest import round as contest_round
class TestRound(contest_round.Round):
"""
This c... |
"""Module/script to byte-compile all .py files to .pyc (or .pyo) files.
When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.
Without arguments, if compiles all modules on sys.path, without
recursing into subdir... |
"""Tests for pddm.py."""
import io
import unittest
import pddm
class TestParsingMacros(unittest.TestCase):
def testParseEmpty(self):
f = io.StringIO(u'')
result = pddm.MacroCollection(f)
self.assertEqual(len(result._macros), 0)
def testParseOne(self):
f = io.StringIO(u"""PDDM-DEFINE foo( )
bod... |
"""
Provide the class Message and its subclasses.
"""
class Message(object):
message = ''
message_args = ()
def __init__(self, filename, loc):
self.filename = filename
self.lineno = loc.lineno
self.col = getattr(loc, 'col_offset', 0)
def __str__(self):
return '%s:%s: ... |
# from winbase.h
STDOUT = -11
STDERR = -12
try:
from ctypes import windll
except ImportError:
windll = None
SetConsoleTextAttribute = lambda *_: None
else:
from ctypes import (
byref, Structure, c_char, c_short, c_uint32, c_ushort
)
handles = {
STDOUT: windll.kernel32.GetStdHan... |
"""Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... |
"""Definitions for openpyxl shared exception classes."""
class CellCoordinatesException(Exception):
"""Error for converting between numeric and A1-style cell references."""
class ColumnStringIndexException(Exception):
"""Error for bad column names in A1-style cell references."""
class DataTypeException(Exce... |
from django.http import HttpResponse
from django.test import RequestFactory, SimpleTestCase
from django.test.utils import override_settings
class SecurityMiddlewareTest(SimpleTestCase):
@property
def middleware(self):
from django.middleware.security import SecurityMiddleware
return SecurityMid... |
from __future__ import print_function
from LogAnalyzer import Test,TestResult
import DataflashLog
class TestDupeLogData(Test):
'''test for duplicated data in log, which has been happening on PX4/Pixhawk'''
def __init__(self):
Test.__init__(self)
self.name = "Dupe Log Data"
def __matchSample(self, sample, ... |
# encoding: UTF-8
"""
展示如何执行策略回测。
"""
from __future__ import division
from vnpy.trader.app.ctaStrategy.ctaBacktesting import BacktestingEngine, MINUTE_DB_NAME
if __name__ == '__main__':
from vnpy.trader.app.ctaStrategy.strategy.strategyAtrRsi import AtrRsiStrategy
# 创建回测引擎
engine = BacktestingEng... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:... |
import sys
import SimpleITK as sitk
import numpy as np
if len(sys.argv) < 2:
print('Wrong number of arguments.', file=sys.stderr)
print('Usage: ' + __file__ + ' image_file_name', file=sys.stderr)
sys.exit(1)
# Read image information without reading the bulk data.
file_reader = sitk.ImageFileReader()
file... |
import glob, os, sys, unittest, getopt, time
use_resources = []
class ResourceDenied(Exception):
"""Test skipped because it requested a disallowed resource.
This is raised when a test calls requires() for a resource that
has not be enabled. Resources are defined by test modules.
"""
def is_resource... |
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.util import truncate_name
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
... |
import webapp2
import os
from google.appengine.ext.webapp import template
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import ndb
from google.appengine.api import images
from src.model.WorkModels import Work,PhotoModel,WorkResourceAttribute
class WorkAdminCreate... |
# coding: utf-8
from riotpy.resources.match import MatchResource
from base import Manager
class MatchHistoryManager(Manager):
"""
We are spliting this one and MatchManager because Riot did it.
That way, our lib is closer to their documentation.
"""
def get_summoner_match_history(self, sum... |
"""Public-key encryption and signature algorithms.
Public-key encryption uses two different keys, one for encryption and
one for decryption. The encryption key can be made public, and the
decryption key is kept private. Many public-key algorithms can also
be used to sign messages, and some can *only* be used for sig... |
"""
Table for storing information about whether or not Studio users have course creation privileges.
"""
from django.db import models
from django.db.models.signals import post_init, post_save
from django.dispatch import receiver, Signal
from django.contrib.auth.models import User
from django.utils import timezone
from... |
bl_info = {
"name": "Save As Game Engine Runtime",
"author": "Mitchell Stokes (Moguri)",
"version": (0, 3, 1),
"blender": (2, 61, 0),
"location": "File > Export",
"description": "Bundle a .blend file with the Blenderplayer",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/E... |
# title: Watershed Transform
# adapted from: Justin Chen, Arnold Song
import numpy as np
import gc
import warnings
from skimage import filters, morphology, feature, img_as_ubyte
from scipy import ndimage
from ctypes import *
from lib import utils
# For Testing:
from skimage import segmentation
import matplotlib.image... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
from traceback import format_exc
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.digit... |
import abc
import logging
import Sea
import numpy as np
from ..base import Base
class Coupling(Base):
"""
Abstract base class for all :mod:`Sea.adapter.couplings` classes.
"""
__metaclass__ = abc.ABCMeta
def __init__(self, obj, connection, subsystem_from, subsystem_to):
Base.__init__(... |
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This is a tool for comparing two or more gtacoinds to each other
using a script provided.
To use, create a class that implements get_tests(), and pass it in
as the test generator to TestManager. get_tests() should be a... |
import gettext
import os.path
import locale
import sys
def _get_translation():
try:
return gettext.translation("faces")
except:
try:
if sys.frozen:
path = os.path.dirname(sys.argv[0])
path = os.path.join(path, "resources", "faces", "locale")
... |
"""
ColoredBaseFormatter
"""
__RCSID__ = "$Id$"
import sys
from DIRAC.FrameworkSystem.private.standardLogging.Formatter.BaseFormatter import BaseFormatter
class ColoredBaseFormatter(BaseFormatter):
"""
ColoredBaseFormatter is used to format log record to create a string representing a log message.
It is bas... |
# -*- coding: utf-8 -*-
import lxml.etree as ET
class Serializer(object):
def __init__(self):
return None
@staticmethod
def getSerializeMembers(SerializeObject):
strSerializeMembers = []
for member in dir(SerializeObject):
strMember = str(member)
strType = ... |
""" Models registries.
"""
from collections import Mapping, defaultdict
import logging
import os
import threading
import openerp
from .. import SUPERUSER_ID
from openerp.tools import assertion_report, lazy_property, classproperty, config
from openerp.tools.lru import LRU
_logger = logging.getLogger(__name__)
class ... |
"""
Tests for Version Based App Upgrade Middleware
"""
from datetime import datetime
from unittest import mock
import ddt
from django.core.cache import caches
from django.http import HttpRequest, HttpResponse
from pytz import UTC
from lms.djangoapps.mobile_api.middleware import AppVersionUpgrade
from lms.djangoapps... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.