content
stringlengths
4
20k
""" A logistic regression implementation that uses NumPy (http://www.numpy.org) to act on batches of input data using efficient matrix operations. In practice, one may prefer to use the LogisticRegression algorithm in ML, as shown in examples/src/main/python/ml/logistic_regression_with_elastic_net.py. """ from __futur...
"""Reconfigure an Abe instance to use or not use Firstbits.""" def populate_firstbits(store): blocks, fbs = 0, 0 log_incr = 1000 for addr_vers, block_id in store.selectall(""" SELECT c.chain_address_version, cc.block_id FROM chain c JOIN chain_candidate cc ON (c....
import OutputFormats import Utils from Groups import TestGroup, excludeDirs from Sources import SourceTree, SourceCache from shutil import copytree, rmtree from os.path import join import os from mercurial import ui as UserInterface, hg class TestSuite: """Representation of a standard CSS test suite.""" def __ini...
import logging import unittest import requests from requests.exceptions import ConnectionError from mock_services import http_mock from mock_services import is_http_mock_started from mock_services import no_http_mock from mock_services import reset_rules from mock_services import start_http_mock from mock_services i...
"""Tests for mel_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import test_util as tf_test_util from te...
import json import requests from six import wraps class MockResponse(object): def __init__(self, method=None, url=None, params=None, headers=None, timeout=None, data=None): self.url = url self.method = method self.params = params self.headers = headers self...
#!/usr/bin/env python from __future__ import with_statement try: from setuptools import setup except ImportError: # Distribute is not actually required to install from distutils.core import setup __AUTHOR__ = 'David Halter' __AUTHOR_EMAIL__ = '<EMAIL>' readme = open('README.rst').read() + '\n\n' + open('...
from m5.params import * from m5.SimObject import SimObject class X86IntelMPFloatingPointer(SimObject): type = 'X86IntelMPFloatingPointer' cxx_class = 'X86ISA::IntelMP::FloatingPointer' cxx_header = 'arch/x86/bios/intelmp.hh' # The minor revision of the spec to support. The major version is assumed ...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import unittest from packaging.version import InvalidVersion, Version from internal_backend.utilities.register import PantsReleases def _branch_name(revision_str):...
from __future__ import print_function # Copyright (c) 2011, Roger Lew [see LICENSE.txt] # This software is funded in part by NIH Grant P20 RR016454. import atexit import os import sys from copy import copy from data_restructurer import long2wide def goodbye(): pass def get(text): global t...
# -*- coding: utf-8 -*- from openerp.tests import common class TestOnChange(common.TransactionCase): def setUp(self): super(TestOnChange, self).setUp() self.Discussion = self.env['test_new_api.discussion'] self.Message = self.env['test_new_api.message'] def test_default_get(self): ...
"""Contains the model definition for the OverFeat network. The definition for the network was obtained from: OverFeat: Integrated Recognition, Localization and Detection using Convolutional Networks Pierre Sermanet, David Eigen, Xiang Zhang, Michael Mathieu, Rob Fergus and Yann LeCun, 2014 http://arxiv.org/a...
''' Copyright 2016 University of Auckland 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...
# -*- coding: utf-8 -*- """ Code to manage fetching and storing the metadata of IdPs. """ from celery.task import task import datetime import dateutil.parser import logging from lxml import etree import requests from onelogin.saml2.utils import OneLogin_Saml2_Utils from third_party_auth.models import SAMLConfiguration...
"""Class ANY (generic) rdata type classes.""" __all__ = [ 'AFSDB', 'CERT', 'CNAME', 'DLV', 'DNAME', 'DNSKEY', 'DS', 'GPOS', 'HINFO', 'HIP', 'ISDN', 'KEY', 'LOC', 'MX', 'NS', 'NSEC', 'NSEC3', 'NSEC3PARAM', 'NXT', 'PTR', 'RP', 'RRSIG...
# vi: syntax=python:et:ts=4 from pkgconfig import run_pkg_config from config_check_utils import find_include from os.path import join def CheckLua(context, require_version): env = context.env backup = env.Clone().Dictionary() context.Message("Checking for Lua development files version " + require_version...
""" This module converts code written for Numeric to run with numpy Makes the following changes: * Changes import statements (warns of use of from Numeric import *) * Changes import statements (using numerix) ... * Makes search and replace changes to: - .typecode() - .iscontiguous() - .byteswapped() - ....
""" Tests of DarkLangMiddleware """ from django.contrib.auth.models import User from django.http import HttpRequest from django.test import TestCase from mock import Mock from dark_lang.middleware import DarkLangMiddleware from dark_lang.models import DarkLangConfig UNSET = object() def set_if_set(dct, key, value...
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: warnings import linecache import sys import types __all__ = ['warn', 'warn_explicit', 'showwarning', 'formatwarning', 'filterwarnings', 'simplefilter', 'resetwarnings', 'catch_warnings'] def warnpy3k(message, category = None, stacklevel = 1...
from kivy.graphics import Line from kivy.app import App from kivy.core.audio import SoundLoader from kivy.uix.widget import Widget from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty from kivy.vector import Vector from kivy.config import Config from kivy.clock import Clock from kivy.uix.i...
# -*- coding: utf-8 -*- """ requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. """ import os import collections from itertools import islice class IteratorProxy(object): """docstring for IteratorProxy""" def __init__(self, i): self.i = i # self.i = chain.from_iter...
"""Operations for generating random numbers.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import random_seed...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import xml.etree.ElementTree as ET from ansible.compat.tests import unittest from ansible.compat.tests.mock import patch from ansible.module_utils import basic from ansible.module_utils._text import to_bytes...
""" Base classes for view based unit tests. """ import mox import nova_adminclient as adminclient from django import test from django.conf import settings from django.contrib.auth import models as auth_models TEST_PROJECT = 'test' TEST_USER = 'test' TEST_REGION = 'test' class BaseViewTests(test.TestCase): def...
"""Test mempool descendants/ancestors information update. Test mempool update of transaction descendants/ancestors information (count, size) when transactions have been re-added from a disconnected block to the mempool. """ import time from decimal import Decimal from test_framework.test_framework import BitcoinTestF...
# -*- coding: utf-8 -*- # Envelopes SOAP from .soap import SOAPEnvio as SOAPEnvio_10 from .soap import SOAPRetorno as SOAPRetorno_10 #Consulta situação de lote RPS from .ConsultarSituacaoLoteRps import ConsultarSituacaoLoteRpsEnvio as ConsultarSituacaoLoteRpsEnvio_10 from .ConsultarSituacaoLoteRps import ConsultarS...
''' This is a one-off command aimed at fixing a temporary problem encountered where input_state was added to the same dict object in capa problems, so was accumulating. The fix is simply to remove input_state entry from state for all problems in the affected date range. ''' import json import logging from optparse im...
# coding: utf-8 import configparser class Config: def __init__(self, config_file='kissenium.ini'): self.config = configparser.ConfigParser() self.config.read(config_file) def get_config(self): return self.config def get_default(self, parameter, default): if parameter in...
""" miscellaneous sorting / groupby utilities """ import numpy as np from pandas.compat import long from pandas.core.categorical import Categorical from pandas.core.dtypes.common import ( _ensure_platform_int, _ensure_int64, is_categorical_dtype) from pandas.core.dtypes.missing import isnull import pandas....
from nose.tools import * import mock import unittest from dataverse import Connection, Dataverse, DataverseFile, Dataset from dataverse.exceptions import UnauthorizedError from framework.exceptions import HTTPError from website.addons.dataverse.tests.utils import DataverseAddonTestCase from website.addons.dataverse.c...
import getpass import os import luigi.contrib.hadoop import luigi.contrib.hdfs from nose.plugins.attrib import attr import unittest from snakebite.minicluster import MiniCluster @attr('minicluster') class MiniClusterTestCase(unittest.TestCase): """ Base class for test cases that rely on Hadoop's minicluster f...
""" Sources: English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales Scottish regions: http://...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazu...
# -*- coding: utf-8 -*- """ *************************************************************************** hugeFileNormalize.py --------------------- Date : May 2014 Copyright : (C) 2014 by Martin Isenburg Email : martin near rapidlasso point com *************...
from Crypto.Cipher import AES import base64 import time import socket import string import hashlib from log import LogFactory BS = 16 log = LogFactory().get_log(__name__) def unpad(s): return s[0:-ord(s[-1])] def current_milli_time(): return int(round(time.time() * 1000)) def pad(s): return s + (BS - len(s) % ...
"""Cache module, with a least recently used algorithm for the management of the deletion of entries. """ __docformat__ = "restructuredtext en" from threading import Lock from logilab.common.decorators import locked _marker = object() class Cache(dict): """A dictionary like cache. inv: len(self....
#!/usr/bin/python3 # -*- coding: utf-8 -*- from window import Ui_MainWindow as Ui_mainWin from setting2 import Ui_DockWidget as Ui_settingWin from edit2 import Ui_Form as Ui_editWin import core import sys import os from PyQt5 import QtWidgets from PyQt5.QtWidgets import QFileDialog from PyQt5.QtWidgets import QMessageB...
from gi.repository import GObject from sugar3.graphics import style from sugar3.graphics import animator from sugar3.graphics.icon import Icon from jarabe.model.buddy import get_owner_instance from jarabe.desktop.viewcontainer import ViewContainer from jarabe.desktop.favoriteslayout import SpreadLayout class _Anima...
__version__ = '${version}' from distutils.version import LooseVersion try: import requests except ImportError: REQUESTS_FOUND = False else: REQUESTS_FOUND = True # # Requires the clc-python-sdk. # sudo pip install clc-sdk # try: import clc as clc_sdk from clc import APIFailedResponse except Imp...
import sys, time from django.db.backends.creation import BaseDatabaseCreation TEST_DATABASE_PREFIX = 'test_' PASSWORD = 'Im_a_lumberjack' class DatabaseCreation(BaseDatabaseCreation): # This dictionary maps Field objects to their associated Oracle column # types, as strings. Column-type strings can contain fo...
"""scons.Node.Alias Alias nodes. This creates a hash of global Aliases (dummy targets). """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and asso...
import IECore import Gaffer import GafferUI import GafferCortex import GafferCortexUI class OpPathPreview( GafferUI.DeferredPathPreview ) : def __init__( self, path ) : self.__column = GafferUI.ListContainer( borderWidth = 8 ) GafferUI.DeferredPathPreview.__init__( self, self.__column, path ) with self.__c...
#!/usr/bin/env python """Allows the user to specify rotation type and rotation angle. History: 2001-11-05 ROwen First version with history. 2002-06-11 ROwen Disables invalid rot types based on coordSysvar. 2002-06-25 ROwen Removed an unneeded keyword from inputCont. 2002-07-31 ROwen Modified to use the RO....
""" Common code and definitions used by Link extractors (located in scrapy.contrib.linkextractor). """ import re from six.moves.urllib.parse import urlparse from scrapy.utils.url import url_is_from_any_domain from scrapy.utils.url import canonicalize_url, url_is_from_any_domain, url_has_any_extension from scrapy.utils...
from temboo.core.choreography import Choreography from temboo.core.choreography import InputSet from temboo.core.choreography import ResultSet from temboo.core.choreography import ChoreographyExecution import json class SearchPhotos(Choreography): def __init__(self, temboo_session): """ Create a ...
import urlparse from django.test import TestCase from fandjango.views import authorize_application from facetools.middleware import FandjangoIntegrationMiddleware, GET_REDIRECT_PARAM from test_project.canvas.views import test_url class FandjangoMiddlewareTests(TestCase): def test_authorization_redirect_fix(self...
''' Analyse observation basket ''' import argparse import joblib import pandas as pd import apriori import helpers from rules import RuleGenerator parser = argparse.ArgumentParser(description='Convert Halias RDF dataset for data mining') parser.add_argument('minsup', help='Minimum support', nargs='?', type=float, de...
from sympy import (Symbol, symbols, factorial, factorial2, binomial, rf, ff, gamma, polygamma, EulerGamma, O, pi, nan, oo, simplify) from sympy.utilities.pytest import XFAIL def test_rf_eval_apply(): x, y = symbols('x,y') assert rf(nan, y) == nan assert rf(x, y) == rf(x, y) assert rf(oo, 0) == 1...
import os import sys from docs_server_utils import StringIdentity from file_system import FileSystem, FileNotFoundError, StatInfo from future import Future from path_util import AssertIsDirectory, AssertIsValid from test_util import ChromiumPath def _ConvertToFilepath(path): return path.replace('/', os.sep) def ...
""" Feature agglomeration. Base classes and functions for performing feature agglomeration. """ # License: BSD 3 clause import numpy as np from ..base import TransformerMixin from ..utils import check_array from ..utils.validation import check_is_fitted import warnings #############################################...
from distutils.version import LooseVersion FW_VERSION = None fw = None fw_offline = False import_failure = True try: import firewall.config FW_VERSION = firewall.config.VERSION from firewall.client import FirewallClient from firewall.client import FirewallClientZoneSettings from firewall.errors im...
from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import Client, TestCase, modify_settings, override_settings from .settings import FLATPAGES_TEMPLATES @modify_settings(INSTALLED_APPS={'append': 'django.contr...
from __future__ import absolute_import, print_function import inspect import logging import raven import sentry from django.conf import settings from django.db.utils import DatabaseError from raven.contrib.django.client import DjangoClient from . import metrics UNSAFE_FILES = ( 'sentry/event_manager.py', 's...
# -*- coding: utf-8 -*- """Tests for the music_service module.""" from __future__ import unicode_literals import mock import pytest import soco.soap from soco.exceptions import MusicServiceException from soco.music_services.accounts import Account from soco.music_services.music_service import ( MusicService, Mus...
from sympy import sqrt, Rational, oo, Symbol, exp, pi, symbols from sympy.functions import erf from operator import abs from sympy.mpmath import mp from sympy.utilities.tests.test_pickling import check # Disable sympy.statistics deprecation warning for the tests # The warning is in __init__.py, so we only need to d...
import array import unittest from test.support import run_unittest, import_module, get_attribute import os, struct fcntl = import_module('fcntl') termios = import_module('termios') get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature try: tty = open("/dev/tty", "rb") except OSError: raise ...
from __future__ import absolute_import import zerver.models from zerver.lib.cache import cache_with_key, realm_alert_words_cache_key import ujson @cache_with_key(realm_alert_words_cache_key, timeout=3600*24) def alert_words_in_realm(realm): users = zerver.models.UserProfile.objects.filter(realm=realm, is_active=T...
import os import unittest from webkitpy.common.checkout.changelog_unittest import ChangeLogTest from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.tool.mocktool import MockOptions, MockTool from webkitpy.tool.steps.preparechangelog import PrepareChangeLog class PrepareChangeLogTest(ChangeLo...
""" Python wrapper for Dynamic Topic Models (DTM) and the Document Influence Model (DIM) [1]. This module allows for DTM and DIM model estimation from a training corpus. Example: >>> model = gensim.models.wrappers.DtmModel('dtm-win64.exe', my_corpus, my_timeslices, num_topics=20, id2word=dictionary) .. [1] https:/...
import urllib import gdata.webmastertools.service import gdata.service try: from xml.etree import ElementTree except ImportError: from elementtree import ElementTree import atom import getpass username = '' password = '' username = raw_input('Please enter your username: ') password = getpass.getpass() client =...
from abc import abstractmethod import concurrent.futures from apscheduler.executors.base import BaseExecutor, run_job class BasePoolExecutor(BaseExecutor): @abstractmethod def __init__(self, pool): super(BasePoolExecutor, self).__init__() self._pool = pool def _do_submit_job(self, job, r...
"""This file provides the opening handshake processor for the WebSocket protocol (RFC 6455). Specification: http://tools.ietf.org/html/rfc6455 """ # Note: request.connection.write is used in this module, even though mod_python # document says that it should be used only in connection handlers. # Unfortunately, we ha...
"""Customization of default Flask Jinja2 template loader. By default the Flask Jinja2 template loader is not aware of the order of Blueprints as defined by the PACKAGES configuration variable. """ from distutils.version import LooseVersion from flask import __version__ as flask_version from flask.templating import D...
""" Tests display of metadata in webclient """ import omero from weblibrary import IWebTest from weblibrary import _get_response from django.core.urlresolvers import reverse from omero.model.enums import UnitsLength class TestCoreMetadata(IWebTest): """ Tests display of core metatada """ def test_p...
# -*- coding: utf-8 -*- """ The Pygments Markdown Preprocessor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This fragment is a Markdown_ preprocessor that renders source code to HTML via Pygments. To use it, invoke Markdown like so:: from markdown import Markdown md = Markdown() md.tex...
import glob, string, os, sys from ElementTree import ElementTree, Element NS_XHTML = "{http://www.w3.org/1999/xhtml}" ## # Convert an HTML or HTML-like file to XHTML, using the <b>tidy</b> # command line utility. # # @param file Filename. # @param new_inline_tags An optional list of valid but non-standard # inli...
"""Generates the obfuscated jar and test jar for an apk. If proguard is not enabled or 'Release' is not in the configuration name, obfuscation will be a no-op. """ import optparse import os import sys from util import build_utils from util import proguard_util def ParseArgs(argv): parser = optparse.OptionParser(...
# # Example file for parsing and processing JSON # (For Python 3.x, be sure to use the ExampleSnippets3.txt file) import urllib2 import json def printResults(data): # Use the json module to load the string data into a dictionary theJSON = json.loads(data) # now we can access the contents of the JSON like any...
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( float_or_none, str_to_int, parse_duration, ) class SnotrIE(InfoExtractor): _VALID_URL = r'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)' _TESTS = [{ 'url': '...
# pylint: disable=abstract-method """ Views to support exchange of authentication credentials. The following are currently implemented: 1. AccessTokenExchangeView: 3rd party (social-auth) OAuth 2.0 access token -> 1st party (open-edx) OAuth 2.0 access token 2. LoginWithAccessTokenView: 1st party (...
categories = ["control_registers", "halt", "invlpg", "undefined_operation", "msrs", "segmentation"] microcode = "" for category in categories: exec "import %s as cat" % category microcode += cat.microcode
import numbers import re class ConfigError (Exception): note = None def render_path(path): if isinstance(path, basestring): return path def aux(p): if not isinstance(p, basestring): return '[%d]' % p return ('.%s' if _isidentifier(p) else '["%s"]') % p return '$' ...
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 4 3 8 9 10 11 1 8 4 3 7 9 10 11 1 9 4 3 7 8 10 11 1 10 4 3 7 8 9 11 1 11 0 0 1 12 4 3 13 14 15 16 1 13 4 3 12 14 15 16 1 14 4 3 12 13 15 16 1 15 4 3 12 13 14 16 1 16 0 0 1 17 4 3 18 19 20 21 1 18 4 3 17 19 20 21 1 19 4 3 17 18 20 21 1 20 4 3 17 18 19 21 1 21 0 0 1...
# coding: utf-8 from __future__ import unicode_literals import functools import re from .common import InfoExtractor from ..utils import ( int_or_none, unified_strdate, OnDemandPagedList, xpath_text, determine_ext, qualities, float_or_none, ExtractorError, ) class ZDFIE(InfoExtractor...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import os import re import glob import shutil import gzip import bz2 import filecmp import z...
"""Simple DirectMedia Layer tool for SCons. This tool sets up an environment to use the SDL library. """ import os import sys import SCons.Script def _HermeticSDL(env): """Set things up if sdl is hermetically setup somewhere.""" if sys.platform in ['win32', 'cygwin']: env.SetDefault( SDL_DIR='$SDL_...
"""All the interfaces that are exposed through the webservice.""" __all__ = [ 'DerivationError', 'ICommercialSubscription', 'IDistribution', 'IDistributionMirror', 'IDistributionSet', 'IDistributionSourcePackage', 'IDistroSeries', 'IDistroSeriesDifference', 'IDistroSeriesDifferenceC...
#!/usr/bin/env python import argparse import json from collections import defaultdict from luigi import six from luigi.six.moves.urllib.request import urlopen class LuigiGrep(object): def __init__(self, host, port): self._host = host self._port = port @property def graph_url(self): ...
import re import datetime from requests.auth import AuthBase import sickbeard import generic from sickbeard.bs4_parser import BS4Parser from sickbeard.common import Quality from sickbeard import logger from sickbeard import tvcache from sickbeard import show_name_helpers from sickbeard import db from sickbeard import ...
""" This module allows importing AbstractBaseUser even when django.contrib.auth is not in INSTALLED_APPS. """ from __future__ import unicode_literals from django.contrib.auth import password_validation from django.contrib.auth.hashers import ( check_password, is_password_usable, make_password, ) from django.db imp...
# -*- coding: utf-8 -*- import storage import widgetUtils import wx_settings import manage import output from mysc.thread_utils import call_threaded class autocompletionSettings(object): def __init__(self, config, buffer, window): super(autocompletionSettings, self).__init__() self.config = config self.buffer =...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import math import measurement_stats as mstats from measurement_stats.angle import Angle from tracksim.trackway import TrackPosition class LineSegment2D(object): ...
from collections import namedtuple from MySQLdb.constants import FIELD_TYPE from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.utils.datastructures import OrderedSet from django.utils.encoding import force_text FieldInfo = namedtuple('FieldInfo', Fi...
from __future__ import (absolute_import, division, print_function) __metacl_interfaceass__ = type import json from ansible.compat.tests.mock import patch from ansible.modules.network.nxos import nxos_acl_interface from .nxos_module import TestNxosModule, load_fixture, set_module_args class TestNxosAclInterfaceModul...
""" jsonapi_attr: custom jsonapi attributes """ from sqlalchemy.ext.hybrid import hybrid_property from .swagger_doc import parse_object_doc JSONAPI_ATTR_TAG = "_s_is_jsonapi_attr" class jsonapi_attr(hybrid_property): """ hybrid_property type: sqlalchemy.orm.attributes.create_proxied_attribute.<locals>.Pr...
import sys import time from util.io import formatting class Scope(object): def __init__(self, parent, name): self.parent = parent self.name = name self.children = [] def begin(self): self._start = time.clock() def end(self): self._end = time.clock() @property def elapsed(self): return self._e...
from SpeedOp import SpeedOp from consts import * from CNCConfig import CNCConfig import HeeksCNC class DepthOp(SpeedOp): def __init__(self): SpeedOp.__init__(self) def ReadDefaultValues(self): SpeedOp.ReadDefaultValues(self) config = CNCConfig() self.abs_mode = config.R...
import random import operator import math import numpy from deap import base from deap import creator from deap import gp from deap import tools # Define new functions def protectedDiv(left, right): try: return left / right except ZeroDivisionError: return 1 adfset2 = gp.PrimitiveSet("ADF2",...
from django.db import models from django.core.urlresolvers import NoReverseMatch from olympia import amo from olympia.amo.models import ModelBase, ManagerBase from olympia.amo.urlresolvers import reverse class TagManager(ManagerBase): def not_denied(self): """Get allowed tags only""" return self...
import re class ConfigFileOps: class entry: def __init__(self, name, value, op, separator): self.name = name self.value = value self.state = "new" self.op = op self.separator = separator def setState(self, state): self.state = s...
from xmodule.modulestore.django import modulestore from xmodule.course_module import CourseDescriptor from django.conf import settings from opaque_keys.edx.locations import SlashSeparatedCourseKey from microsite_configuration import microsite from staticfiles.storage import staticfiles_storage def get_visible_course...
#!/usr/bin/env python from __future__ import division from helper import unittest, PillowTestCase import sys from PIL import Image, ImageFilter min_iterations = 100 max_iterations = 10000 @unittest.skipIf(sys.platform.startswith('win32'), "requires Unix or MacOS") class TestImagingLeaks(PillowTestCase): def _g...
# -*- coding: utf-8 -*- """ """ __title__ = 'newspaper' __author__ = 'Lucas Ou-Yang' __license__ = 'MIT' __copyright__ = 'Copyright 2014, Lucas Ou-Yang' from .packages.feedparser import feedparser from .source import Source from .article import Article from .settings import POPULAR_URLS, TRENDING_URL from .configurati...
#!/usr/local/bin/python2 """ Python 2 version From Pi.cpp Ed Strassberger 2007-08-22 Try various algorithms for calculating Pi 3.14159265358979323846264 """ from Pi_arctan import pi_arctan from Pi_triangle import pi_triangle if __name__ == "__main__": num_steps = 21000000 ...
from requestbuilder import Arg from euca2ools.commands.iam import IAMRequest, AS_ACCOUNT, arg_user class DeleteUserPolicy(IAMRequest): DESCRIPTION = 'Remove a policy from a user' ARGS = [arg_user(help='user the policy is attached to (required)'), Arg('-p', '--policy-name', dest='PolicyName', meta...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.cloudstack i...
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : DB Manager Description : Database manager plugin for QGIS Date : May 23, 2011 copyright : (C) 2011 by Giuseppe Sucameli email : <EMAIL> **...
#!/usr/bin/env python from __future__ import unicode_literals # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import io import re import string from test.helper import FakeYDL from youtube_dl.extractor import YoutubeIE fro...
import mock from openstack_dashboard.api.rest import cinder from openstack_dashboard.test import helpers as test class CinderRestTestCase(test.TestCase): def test_volumes_get(self): self._test_volumes_get(False, {}) def test_volumes_get_all(self): self._test_volumes_get(True, {}) def te...
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:...