content
stringlengths
4
20k
from yahoo_finance import Share from classes import * import time, threading allStocks = {} allStocks["Volvo-B"] = 'VOLV-B.ST' allStocks["Google"] = 'GOOG' allStocks["Apple"] = 'AAPL' allStocks["Facebook"] = 'FB' allStocks["Audi"] = 'AUDVF' #allStocks["Samsung Korea"] = '005930.KS' stockClasses = {} result = [] mainTh...
import pytest import numpy as np import nnabla as nn import nnabla.functions as F from nbla_test_utils import list_context from nnabla.normalization_functions import _force_list, _get_axes_excluding ctxs = list_context('LayerNormalization') def ref_layer_normalization(x, beta, gamma, batch_axis, eps, output_stat): ...
import m5 from m5.defines import buildEnv from m5.objects import * from Benchmarks import * import CpuConfig import MemConfig def _listCpuTypes(option, opt, value, parser): CpuConfig.print_cpu_list() sys.exit(0) def _listMemTypes(option, opt, value, parser): MemConfig.print_mem_list() sys.exit(0) de...
"""Tests for tensor2tensor.models.research.glow_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import tempfile import numpy as np from tensor2tensor.models.research import glow from tensor2tensor.models.research import glow_ops import ten...
from collections import OrderedDict import functools import re from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 ...
""" Views related to course tabs """ from access import has_course_access from util.json_request import expect_json, JsonResponse from django.http import HttpResponseNotFound from django.conf import settings from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied f...
from __future__ import unicode_literals, division, absolute_import import logging from flexget import plugin from flexget.event import event from flexget.config_schema import one_or_more log = logging.getLogger('unique') class Unique(object): """ Take action on entries with duplicate fields, except for the ...
from django import forms from django.core.exceptions import NON_FIELD_ERRORS from django.test import TestCase from django.utils.functional import lazy from . import ValidationTestCase from .models import ( Article, Author, GenericIPAddressTestModel, GenericIPAddrUnpackUniqueTest, ModelToValidate, ) class Bas...
""" Contains functions to fetch API information from last.fm API.""" import logging import youtube import util.web CHART_URL = 'http://lastfm-ajax-vip1.phx1.cbsig.net/kerve/charts?nr={0}&type=track&format=json' TAG_SEARCH_URL = 'http://lastfm-ajax-vip1.phx1.cbsig.net/kerve/charts?nr={0}&type=track&f=tag:{1}&...
import numpy as np a_2d = np.arange(6).reshape(2, 3) print(a_2d) # [[0 1 2] # [3 4 5]] a_2d_rot = np.rot90(a_2d) print(a_2d_rot) # [[2 5] # [1 4] # [0 3]] print(np.shares_memory(a_2d, a_2d_rot)) # True a_2d_rot[0, 0] = 100 print(a_2d_rot) # [[100 5] # [ 1 4] # [ 0 3]] print(a_2d) # [[ 0 1 100] # [...
from airflow.exceptions import AirflowException from airflow.models import BaseOperator from airflow.providers.amazon.aws.hooks.emr import EmrHook from airflow.utils.decorators import apply_defaults class EmrModifyClusterOperator(BaseOperator): """ An operator that modifies an existing EMR cluster. :param...
import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages, Extension, Feature from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError import numpy BUILD_EXT_WARNING = """ WARNIN...
import struct import time import cherrypy def decode(encoding=None, default_encoding='utf-8'): """Decode cherrypy.request.params from str to unicode objects.""" if not encoding: ct = cherrypy.request.headers.elements("Content-Type") if ct: ct = ct[0] encoding = ct.para...
import random from annoying.functions import get_object_or_None from django.db import transaction from pixelpuncher.item.models import Item, LevelEquipment, PlayerContainer from pixelpuncher.player.utils.avatar import unlock_layer def create_item(item_type): item = Item.objects.create( item_type=item_ty...
# # This file is part of Dragonfly. # (c) Copyright 2007, 2008 by Christo Butcher # Licensed under the LGPL. # # Dragonfly 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 3 of the ...
import json import os from base64 import b64decode from subprocess import ( check_call ) from charmhelpers.fetch import ( apt_install, filter_installed_packages, ) from charmhelpers.core.hookenv import ( config, local_unit, log, relation_get, relation_ids, related_units, uni...
import unittest from PyDealII.Debug import * class TestTriangulationWrapper(unittest.TestCase): def setUp(self): self.dim = [['2D', '2D'], ['2D', '3D'], ['3D', '3D']] self.restricted_dim = [['2D', '2D'], ['3D', '3D']] def build_hyper_cube_triangulation(self, dim): triangulation_1 = T...
#!/usr/local/bin/python3 import csv import json import random import copy import re import uuid from random import getrandbits from ipaddress import IPv4Address, IPv6Address import time import calendar COMPANY_INPUT_CSV = '../data/Finance/sp500.csv' SIGNALS_JSON = '../data/Finance/signals.json' CSV_FIELDS = ['id','...
# Reads the USB VID and PID from the file specified by sys.argv[1] and then # inserts those values into the template file specified by sys.argv[2], # printing the result to stdout from __future__ import print_function import sys import re import string needed_keys = ("USB_PID_CDC_MSC", "USB_PID_CDC_HID", "USB_PID_CD...
from __future__ import with_statement from os import path import pybtex.io from pybtex.plugin import Plugin from pybtex.database import BibliographyData class BaseParser(Plugin): default_plugin = 'bibtex' unicode_io = False def __init__(self, encoding=None, **kwargs): self.encoding = encoding ...
import sys import apt import apt_pkg from apt.progress.base import InstallProgress import common class OsSlim(): def __init__(self): pass def get_unneed_packages(self): cache = common.get_cache_list() unneed_packages_list = [] if cache: for pkg in cache: ...
"""Some automation of Windows Media player""" from __future__ import unicode_literals from __future__ import print_function #import os import time import sys try: from pywinauto import application except ImportError: import os.path pywinauto_path = os.path.abspath(__file__) pywinauto_path = os.path.sp...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import time ############################################## # Configuration, please edit ############################################## # Data about this site BLOG_AUTHOR = "Your Name" BLOG_TITLE = "Demo Site" # This is the main URL for your site. It wil...
""" Defines a setup to compile to a restricted gate set. It provides the `engine_list` for the `MainEngine`. This engine list contains an AutoReplacer with most of the gate decompositions of ProjectQ, which are used to decompose a circuit into a restricted gate set (with some limitions on the choice of gates). """ im...
# being a bit too dynamic # pylint: disable=E1101 from __future__ import division import warnings from math import ceil import numpy as np from pandas.core.dtypes.common import is_list_like from pandas.core.dtypes.generic import ABCSeries from pandas.core.index import Index from pandas.compat import range def form...
#!/usr/bin/env python3.2 def sort_direct_acyclic_graph(edge_list) : # edge_set is consummed, need a copy edge_set = set([tuple(i) for i in edge_list]) # node_list will contain the ordered nodes node_list = list() # source_set is the set of nodes with no incomming edges node_from_list, node_to_list = zip(* ed...
from unittest import TestCase, main from os import environ, remove, close from os.path import basename, exists from tempfile import mkstemp from json import dumps from qiita_client.qiita_client import (QiitaClient, _format_payload, ArtifactInfo) from qiita_client.testing import P...
""" Null Payload RTP Classes. Null Payload Pre-Framer. Null Payload RTP Packet Stuffer - Same thing. This Null payload also assumes constant bit rate load. Subcomponents functionality: * FileControl: - Only if RFA internal - isn't * FileReader - only if internal - isn't * FileSelector - only if internal ...
""" Check code quality using pep8, pylint, and diff_quality. """ from paver.easy import sh, task, cmdopts, needs, BuildFailure import os import re from .utils.envs import Env ALL_SYSTEMS = 'lms,cms,common' @task @needs('pavelib.prereqs.install_python_prereqs') @cmdopts([ ("system=", "s", "System to act on"), ])...
# coding=utf-8 # pylint: disable=pointless-string-statement # This is disabled for typehinting docstring. """Definitions relating to post-processing.""" import logging from safe.definitions.exposure import exposure_place from safe.definitions.extra_keywords import ( extra_keyword_earthquake_longitude, extra...
"""The main samba-tool command implementation.""" from samba import getopt as options from samba.netcmd import SuperCommand class cache_loader(dict): """ We only load subcommand tools if they are actually used. This significantly reduces the amount of time spent starting up samba-tool """ de...
#!/usr/bin/env python __author__ = 'Copyright (c) 2015 Alan Yorinks All rights reserved.' """ Copyright (c) 2015 Alan Yorinks All rights reserved. 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; e...
import sys, os from mmap import mmap class load(): romFile = None romHeader = None prgBanks = 0 chrBanks = 0 prgSize = 0 chrSize = 0 megSize = float(131072) # Cast as float for compatibility with mappers which support banks smaller than 1 megabit. def __init__(self, fileName): self.romFile = open(fileName,...
try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from ckan import (__version__, __description__, __long_description__, __license__) entry_points = { 'nose.plugins....
from .test_project_base import TestProjectBase from openerp.exceptions import AccessError from openerp.tools import mute_logger EMAIL_TPL = """Return-Path: <<EMAIL>> X-Original-To: {to} Delivered-To: {to} To: {to} cc: {cc} Received: by mail1.openerp.com (Postfix, from userid 10002) id 5DF9ABFB2A; Fri, 10 Aug 2012...
from django.apps import AppConfig class TaskManagerConfig(AppConfig): name = 'task_manager'
""" Django settings for dream project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) impo...
from discord.ext import commands from utils import checks import asyncio import traceback import discord import inspect import aiohttp from contextlib import redirect_stdout import io from mods.cog import Cog #mainly from https://github.com/Rapptz/RoboDanny/blob/master/cogs/repl.py class Repl(Cog): def __init__(self...
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.core.files.uploadedfile import InMemoryUploadedFile from django.db.models import Q from piston.handler import BaseHandler, HandlerMetaClass, typemapper import base64 from utils import rc from decorators import module_admin_requi...
"""Decorator service for the media_player.play_media service.""" import logging import voluptuous as vol from homeassistant.components.media_player import ( MEDIA_PLAYER_PLAY_MEDIA_SCHEMA) from homeassistant.components.media_player.const import ( ATTR_MEDIA_CONTENT_ID, ATTR_MEDIA_CONTENT_TYPE, DOMAIN as M...
# -*- coding: utf-8 -*- ''' zen Add-on Copyright (C) 2016 zen 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 3 of the License, or (at your option) any later v...
# -*- coding: utf-8 -*- """ Features of waveforms (e.g waveform_snr). :copyright: Copyright 2014-2020 by the Elephant team, see `doc/authors.rst`. :license: Modified BSD, see LICENSE.txt for details. """ from __future__ import division, print_function, unicode_literals import warnings import neo import numpy as np ...
import os from time import time from flask import Blueprint, current_app from flask import request, abort, jsonify from werkzeug.wsgi import wrap_file from werkzeug.datastructures import Headers from .core import Excesiv # CONFIG # ----------------------------------------------- FILE_INPUT_NAME = 'files[...
from webkitpy.common.config import irc as config_irc from webkitpy.common.thread.messagepump import MessagePump, MessagePumpDelegate from webkitpy.thirdparty.autoinstalled.irc import ircbot from webkitpy.thirdparty.autoinstalled.irc import irclib class IRCBotDelegate(object): def irc_message_received(self, nick,...
""" This file contains implementation override of SearchResultProcessor which will allow * Blends in "location" property * Confirms user access to object """ from django.core.urlresolvers import reverse from opaque_keys.edx.locations import SlashSeparatedCourseKey from search.result_processor import SearchResul...
#!/usr/bin/python3 -i import input_data from input_data import DataSet from tensorflow.python.framework import dtypes from os import path import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import pdb import logging from analysis_model_divergence import get_dist_model_distance, Metrics import ...
import time from oslo_log import log from tempest_lib.common.utils import data_utils import testtools from ec2api.tests.functional import base from ec2api.tests.functional import config CONF = config.CONF LOG = log.getLogger(__name__) class SecurityGroupBaseTest(base.EC2TestCase): def _test_rules(self, add_f...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals ELEMENTS = [ 'Any', 'Other', 'Application', 'Group', 'Window', 'Sheet', 'Drawer', 'Alert', 'Dialog', 'Button', 'RadioButton', 'RadioGroup', 'CheckBox', 'DisclosureTriangle', ...
""" [07/12/13] Challenge #126 [Hard] Not-So-Normal Triangle Search https://www.reddit.com/r/dailyprogrammer/comments/1i65z6/071213_challenge_126_hard_notsonormal_triangle/ # [](#HardIcon) *(Hard)*: Not-So-Normal Triangle Search A three-dimensional triangle can be defined with three points in 3D space: one for each c...
""" Django settings for meinberlin project. Generated by 'django-admin startproject' using Django 1.8.17. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build ...
import bpy # Load a font def load_font(font_path): """ Load a new TTF font into Blender, and return the font object """ # get the original list of fonts (before we add a new one) original_fonts = bpy.data.fonts.keys() # load new font bpy.ops.font.open(filepath=font_path) # get the new list of fonts (after we...
from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa import six import itertools # LBPROC codes and their English equivalents LBPROC_PAIRS = ((1, "Difference from another experiment"), (2, "Difference from zonal (or other sp...
#!/usr/bin/env python """shaderdemo.py: Demonstrate GLSL. References: * rndblnch / opengl-programmable <http://bitbucket.org/rndblnch/opengl-programmable> * OpenGLBook.com <http://openglbook.com/chapter-4-entering-the-third-dimension.html> * Tutorials for modern OpenGL (3.3+) <http://www.opengl-tutor...
from boundary import PluginBase class PluginUninstall(PluginBase): def __init__(self): PluginBase.__init__(self) self.method = "DELETE" self.path = "v1/plugins/installed" self.removeMetrics = False self.removeDashes = False def add_arguments(self): PluginBase.a...
from bigdl.nn.layer import * from bigdl.nn.initialization_method import * from bigdl.nn.criterion import * from bigdl.optim.optimizer import * from bigdl.util.common import * from bigdl.util.common import _py2java from bigdl.nn.initialization_method import * from bigdl.dataset import movielens import numpy as np import...
import re WHITESPACE = re.compile(r'\s{2,}') def tidy_bug_title(title, package): """ Strips various package name prefixes from a bug title. For example: "emacs: Not as good as vim" => "Not as good as vim" "[emacs] Not as good as vim" => "Not as good as vim" """ title = title.st...
import datetime import luigi import luigi.postgres from luigi.tools.range import RangeDaily from helpers import unittest import mock from nose.plugins.attrib import attr def datetime_to_epoch(dt): td = dt - datetime.datetime(1970, 1, 1) return td.days * 86400 + td.seconds + td.microseconds / 1E6 class MockP...
from __future__ import absolute_import from django.core.urlresolvers import reverse from exam import fixture from sentry.models import OrganizationMember, OrganizationMemberTeam, Team from sentry.testutils import APITestCase class OrganizationTeamsListTest(APITestCase): def test_simple(self): user = sel...
""" homeassistant.util.package ~~~~~~~~~~~~~~~~~~~~~~~~~~ Helpers to install PyPi packages. """ import logging import os import subprocess import sys import threading from urllib.parse import urlparse import pkg_resources _LOGGER = logging.getLogger(__name__) INSTALL_LOCK = threading.Lock() def install_package(pack...
import sys, os, Ice, traceback, time from PySide import * from genericworker import * ROBOCOMP = '' try: ROBOCOMP = os.environ['ROBOCOMP'] except: print '$ROBOCOMP environment variable not set, using the default value /opt/robocomp' ROBOCOMP = '/opt/robocomp' if len(ROBOCOMP)<1: print 'genericworker.p...
import MySQLdb as _mysql from collections import namedtuple import re # Only needs to compile one time so we put it here float_match = re.compile(r'[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$').match def is_number(string): return bool(float_match(string)) class MySQLDatabase(object): """ This is the driver class ...
# Creates two identical panels. Zooming in on the right panel will show # a rectangle in the first panel, denoting the zoomed region. import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle # We just subclass Rectangle so that it can be called with an Axes # instance, causing the r...
"""Contains custom Django template filters.""" from django import template from django.utils import html from django.utils import safestring from google.appengine.ext import webapp import logging register = webapp.template.create_template_register() @register.filter def replace(str_to_replace, args): """Performs...
import string import gtk import gtk.glade import os import gobject import sys import tempfile INSTALLPATH = '/usr/share/system-config-selinux' sys.path.append(INSTALLPATH) import commands ENFORCING = 1 PERMISSIVE = 0 DISABLED = -1 modearray = ( "disabled", "permissive", "enforcing" ) SELINUXDIR = "/etc/selinux/" RE...
import os import sys import logging import openerp import openerp.netsvc as netsvc import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv, expression, orm from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from openerp import SUPERUSER_ID, api from opene...
from __future__ import unicode_literals, division import math from sorl.thumbnail.engines.base import EngineBase from sorl.thumbnail.compat import BufferIO try: from PIL import Image, ImageFile, ImageDraw, ImageFilter except ImportError: import Image import ImageFile import ImageDraw def round_corne...
from vtk import * source = vtkRandomGraphSource() source.DirectedOff() source.SetNumberOfVertices(10) source.SetEdgeProbability(0.22) source.SetUseEdgeProbability(True) source.AllowParallelEdgesOn() source.SetStartWithTree(True) # Connect to the centrality filter. centrality = vtkBoostBrandesCentrality () centrality....
from nltk.probability import DictionaryProbDist class ClusterI(object): """ Interface covering basic clustering functionality. """ def cluster(self, vectors, assign_clusters=False): """ Assigns the vectors to clusters, learning the clustering parameters from the data....
import sys from test_printers_common import * test_source = sys.argv[1] test_bin = sys.argv[2] printer_files = sys.argv[3:] printer_names = ['global glibc-pthread-locks'] PRIOCEILING = 42 try: init_test(test_bin, printer_files, printer_names) go_to_main() check_debug_symbol('struct pthread_mutexattr') ...
import feedparser from model.Feed import Feed from model.Chapter import Chapter import datetime import pytz from dateutil.parser import parse class XMLParser(object): def __init__(self, feedRepo=None, chapterRepo=None): '''Constructor''' self.feedRepo = feedRepo self.chapterRepo = chapterR...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from google.protobuf import json_format from tensorflow.core.framework import summary_pb2 from tensorflow.core.framework import types_pb2 class ScalarSummaryTest(tf.test.TestCase): ...
import dcs import os def load_graph(mission_file): m = dcs.mission.Mission() m.load_file(mission_file) graph = dcs.terrain.Graph() # add nodes for g in [x for x in m.country('USA').vehicle_group if x.units[0].type == dcs.vehicles.Armor.APC_AAV_7.id]: splitname = str(g.name).split(' ') ...
from __future__ import generators import logging _logger = logging.getLogger(__name__) import os from urlparse import urljoin, urldefrag from urllib import pathname2url from rdflib.term import URIRef, Variable, _XSD_PFX class Namespace(URIRef): @property def title(self): return URIRef(self + 'ti...
# -*- coding: utf-8 -*- """ /*************************************************************************** d3MapRendererDialog A QGIS plugin Vector logic and data visualisation with the d3.js library. ------------------- begin : 2015-0...
#!/usr/bin/python # Usage: ./times_to_chain.py TIMES_FILE.times # Get modules import sys import os import math # Get input file name from command line and name output file inFileName = sys.argv[1] movieFileName = inFileName[:-6] + "-chain.mpg" # Open input file inFile = open(inFileName, 'r') # Read file into list...
#!/usr/bin/python3 ''' Name: nodeClass.py Devs: Chris [<EMAIL>], Version: 0.0.0.7 Desc: ''' class nodeClass(object): """ docstring for this class Attributes: nodeId (int): the id of the node. nodeName (str): the name of the node. nodeType (str): 3 node types availible...
import random from gnuradio import gr, gr_unittest, blocks import pmt class qa_repack_bits_bb (gr_unittest.TestCase): def setUp (self): random.seed(0) self.tb = gr.top_block () self.tsb_key = "length" def tearDown (self): self.tb = None def test_001_simple (self): ...
import json import jwe import jwt import waffle from django.utils import timezone from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import AuthenticationFailed from api.base import settings from framework import sentry from framework.auth import get_or_create_user from osf...
"""This module wraps Android's split-select tool.""" import os from pylib import cmd_helper from pylib import constants from pylib.utils import timeout_retry _SPLIT_SELECT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'split-select') def _RunSplitSelectCmd(args): """Runs a split-select command. Args: ar...
from __future__ import division from sklearn.ensemble import RandomForestClassifier from methods1 import * from smote import * def formatData(tbl): """ Convert Tbl to Pandas DataFrame :param tbl: Thing object created using function createTbl :returns table in a DataFrame format """ Rows = [i.ce...
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.absp...
"""Test the Azure DevOps config flow.""" from aioazuredevops.core import DevOpsProject import aiohttp from homeassistant import config_entries, data_entry_flow from homeassistant.components.azure_devops.const import ( CONF_ORG, CONF_PAT, CONF_PROJECT, DOMAIN, ) from homeassistant.core import HomeAssist...
#!/usr/bin/env python # coding:utf-8 from x1tool import * from utils.lib_car_purchase_calculator import * class X1ToolCarPurchaseCalculator(X1Tool): 'appid: 96da1eec94c9f3ae273d90799802f6cbe73caea5bbb6243b6d2b89ba' DEFAULT_METADATA = {'name': "Car Purchase Calculator", 'author': "Ken", 'comments': "Enjoy it....
from kivy.app import App from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from ElectricGraph import ElectricGraph from kivy.uix.screenmanager import ScreenManager, Screen, WipeTransition sm = ScreenManager(transition=WipeTransition()) homescreen = Screen(name='Home Screen') sm.add_widget(h...
"""Initial migration Revision ID: fc791d73e762 Revises: 416eb615ff1a Create Date: 2017-04-23 19:14:43.751659 """ # revision identifiers, used by Alembic. revision = 'fc791d73e762' down_revision = '416eb615ff1a' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa import residue t...
import numpy as np import unittest import LinearSampling.api as lsApi __author__ = 'Administrator' class TestAdvanced(unittest.TestCase): @classmethod def setUpClass(cls): cls.plugin = lsApi.Plugin() @classmethod def tearDownClass(cls): cls.plugin.closeAllSessions() def testCalc...
import shlex from coalib.bearlib.abstractions.Linter import linter from coalib.bears.requirements.GoRequirement import GoRequirement @linter(executable='golint', output_format='regex', output_regex=r'.+:(?P<line>\d+):(?P<column>\d+): (?P<message>.*)') class GoLintBear: """ Checks the code usi...
''' Geophys2NetCDF Class Created on 29/02/2016 @author: Alex Ip ''' import os import errno import logging import subprocess import tempfile from shutil import rmtree from geophys2netcdf._geophys2netcdf import Geophys2NetCDF from _ers2netcdf import ERS2NetCDF logger = logging.getLogger(__name__) logger.setLevel(loggi...
# -*- coding: utf-8 -*- """Copyright (c) 2012 Sergio Gabriel Teves All rights reserved. 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 3 of the License, or (at your option) any...
import os import logging import json def readMetadataFolderForImgConvert(folder, pos_subfolder): logging.debug('readMetadataFolder(): %s, %s' % (folder, pos_subfolder)) path = os.path.join(folder, pos_subfolder, 'metadata.txt') if not os.path.exists(path): logging.info('readMetadataFolder(): metadata.txt not foun...
""" Copyright (c) 2014 Regents of the University of California All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of ...
""" Decision tree classification and regression using MLlib. This example requires NumPy (http://www.numpy.org/). """ from __future__ import print_function import numpy import os import sys from operator import add from pyspark import SparkContext from pyspark.mllib.regression import LabeledPoint from pyspark.mllib...
""" Due to our factory, we cannot put the instantiation of the Celery application into our app.py module, as it will lead to circular dependencies since tasks.py also need to import this object, and the factory ends up importing tasks.py when it imports all the managers. Hopefully we will eliminate the factory in the ...
#!python3 # -*- coding:utf-8 -*- import os import sys import time import ctypes import shutil import subprocess IsPy3 = sys.version_info[0] >= 3 if IsPy3: import winreg else: import codecs import _winreg as winreg BuildType = 'Release' IsRebuild = True Build = 'Rebuild' Update = False Copy = False CleanAl...
"""Package for unit tests.""" from __future__ import absolute_import import unittest def suite(): """Gather all the tests from this package in a test suite.""" import tests.unit.test_rules.test_uri as test_uri import tests.unit.test_rules.test_base as test_base import tests.unit.test_rules.test_bod...
""" This module provides a variety of list sorting algorithms, to illustrate the many different algorithms (recipes) for solving a problem, and how to analyze algorithms experimentally. """ from __future__ import print_function, division # These algorithms are taken from: # Levitin (2004) The Design and Analysis of Al...
"""Algorithms for partial fraction decomposition of rational functions. """ from __future__ import print_function, division from sympy.polys import Poly, RootSum, cancel, factor from sympy.polys.polytools import parallel_poly_from_expr from sympy.polys.polyoptions import allowed_flags, set_defaults from sympy.polys.p...
"""Internal support module for sre""" # update when constants are added or removed MAGIC = 20031017 MAXREPEAT = 2147483648 #from _sre import MAXREPEAT # SRE standard exception (access as sre.error) # should this really be here? class error(Exception): pass # operators FAILURE = "failure" SUCCESS = "success" ...
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import sys import TestCmd import unittest import UserDict import SCons.Node.FS import SCons.Warnings import SCons.Scanner.C test = TestCmd.TestCmd(workdir = '') os.chdir(test.workpath('')) # create some source files and headers...
import requests import time from collections import OrderedDict from factornado import get_logger from examples import minimal, registry, tasks, periodic_task import os import signal from tornado import ioloop class ServerList(object): def __init__(self): self.name = 'serverList' self.logger = ge...