src
stringlengths
721
1.04M
import os import time import tempfile __doc__ = """ Synchronize local folder while writing into the file. This is a testcase for: https://github.com/owncloud/mirall/issues/2210 (corrupted file upload if file modified during transfer) owncloudcmd will delay syncing of the file if the file is modified every 2 seco...
# -*- coding:utf-8 -*- from django.db.models import * class Event(Model): content = CharField(u'内容',max_length = 200) starttime = IntegerField(u'开始时间') endtime = IntegerField(u'结束时间') #longitude = DecimalField(u'经度',max_digits = 18,decimal_places = 14) #latitude = DecimalField(u'纬度',max_digits...
#!/usr/bin/env python3 # This file is part of the Soletta Project # # Copyright (C) 2015 Intel Corporation. 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 ...
# RuggedPOD management API # # Copyright (C) 2015 Maxime Terras <maxime.terras@numergy.com> # Copyright (C) 2015 Pierre Padrixe <pierre.padrixe@gmail.com> # Copyright (C) 2015 Guillaume Giamarchi <guillaume.giamarchi@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the term...
#!/usr/bin/python # -*- coding: utf-8 -*- # read.py file is part of slpkg. # Copyright 2014-2017 Dimitris Zlatanidis <d.zlatanidis@gmail.com> # All rights reserved. # Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg # Slpkg is free software: you can redistribu...
import numpy as np from data import * from construct import * from train import * from hippocampi_to_patches import * class DigitsPipeline(object): def __init__(self): self.D = Data() self.D.load_digits_data() self.D.reshape([16,16],[1]) self.N = FeedForwardNetwork() ...
# -*- coding: utf8 -*- """Web forms :license: AGPL v3, see LICENSE for more details :copyright: 2014-2021 Joe Doherty """ # 3rd party imports from flask_wtf import FlaskForm from flask_wtf.file import FileAllowed, FileField from wtforms import TextAreaField, RadioField, ValidationError # Pjuu imports from pjuu.post...
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor # # 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...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
# encoding: utf-8 from . import api_setting import exceptions class BaseVersioning(object): default_version = api_setting.DEFAULT_VERSION allowed_versions = api_setting.ALLOWED_VERSION version_param = api_setting.VERSION_PARAM def determine_version(self, request, *args, **kwargs): msg = '{cls...
#! /usr/bin/python # Import dependencies import serial, sys, sendmail, decimal import socket HOST = "raspberrypi" PORT = 1981 DEBUG = False; # Serial port settings AT_PORT = "/dev/ttyATH0" AT_BAUD = 115200 # Serial packet structure MAGIC_1 = 0xA9 MAGIC_2 = 0xBD MSG_TYPE_REQUEST = 0x00 MSFG_TYPE_RESPONSE = 0x01 MS...
# Copyright (C) Mesosphere, Inc. See LICENSE file for details. import copy import logging import time import requests from generic_test_code.common import ping_mesos_agent from mocker.endpoints.marathon import ( SCHEDULER_APP_ALWAYSTHERE, SCHEDULER_APP_ALWAYSTHERE_DIFFERENTPORT, ) from mocker.endpoints.mesos...
from PyQt4 import QtCore from sys import * import os import subprocess # if platform == 'win32': # path.insert(0, "../CommandLineFiles") # elif platform == 'darwin': # path.insert(0, "..\\CommandLineFiles") # import CalculateGeneralizedDStatistic import sys from CommandLineFiles.RunDGEN import run_saved_dge...
import pytest __author__ = 'Sol' import psutil, sys from psychopy.iohub import launchHubServer, Computer getTime = Computer.getTime from psychopy.tests import skip_under_vm @skip_under_vm def startHubProcess(): io = launchHubServer() assert io != None io_proc = Computer.getIoHubProcess() io_proc_...
""" TODO: npy_void """ from __future__ import absolute_import import numpy from .capi import sctypebits c_char = dict(\ ctype = 'signed char', init = ' = 0', argument_format = 'b', return_format = 'b', argument_title = 'a python integer (converting to C signed char)', return_title = 'a python ...
from PyQt4 import QtGui, uic, QtCore, Qt import PyQt4 import pandas import sys import os viewBase, viewForm = uic.loadUiType(os.path.join(os.path.dirname(os.path.realpath(__file__)),"view.ui")) class Helper(viewBase, viewForm): def __init__(self, parent = None): super(viewBase,self).__init__...
# -*- coding: utf-8 -*- # # * Copyright (c) 2009-2016. Authors: see NOTICE file. # * # * 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...
from flask import Blueprint, flash, jsonify, request, render_template, session, redirect, url_for from .auth import Auth from app import CONFIG from app.member import Member from app.utils import get_logger, get_position_name mod_auth = Blueprint('mod_auth', __name__, static_folder='../static') logger = get_logger(...
from utilities import ParameterException, get_table_ref import os import boto3 import json from datetime import datetime from uuid import uuid4 as uuid from boto3.dynamodb.conditions import Key #Actions #create def create_device(deviceData,roomID): print("Creating Device") #ValidateInput if not 'deviceNam...
import imp import django from django.test import TestCase from django.test.client import RequestFactory from django.utils.decorators import decorator_from_middleware from django.http import HttpResponse, HttpResponseNotFound from django.core import urlresolvers from django.contrib.auth.models import AnonymousUser from...
"""This view provides the main git-cola user interface. """ from __future__ import division, absolute_import, unicode_literals import os from functools import partial from qtpy import QtCore from qtpy import QtGui from qtpy import QtWidgets from qtpy.QtCore import Qt from qtpy.QtCore import Signal from ..compat impor...
# -*- coding: utf-8 -*- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. ''' Provide auth0 / OpenID Connect protection for API endpoints. accept_token will take an oaut...
# -*- coding: utf-8 -*- # IDD3 - Propositional Idea Density from Dependency Trees # Copyright (C) 2014-2015 Andre Luiz Verucci da Cunha # # 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 ...
""" Drives a TestMachine to completion. Engine needs to be completely generic and agnostic from any specific request types, response types, protocols, etc, adding a new initiator or """ import gevent import logging from gevent import Timeout from gevent.queue import Queue from funcytaskengine import settings from f...
import unittest from django.utils.termcolors import ( DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES, colorize, parse_color_setting, ) class TermColorTests(unittest.TestCase): def test_empty_string(self): self.assertEqual(parse_color_setting(''), PALETTES[DEFA...
# Copyright 2014: Intel 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 a...
# Copyright 2012 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 by a...
import numpy as np import tensorflow as tf import helpers tf.reset_default_graph() PAD = 0 EOS = 1 VOCAB_SIZE = 10 EMBEDDINGS_SIZE = 20 ENC_HIDDEN_UNITS = 20 DEC_HIDDEN_UNITS = 20 # Fake Function to Emulate a series of encoder and decoder sequences # Given encoder_inputs [5, 6, 7], decoder_targets would be [5, 6, 7...
#!/usr/bin/python # input: csv-formatted stream, with each line corresponding to the data for a user # output: # assumes the input messages from a specific user are contiguous import fileinput import json rev_inds = {} FEATURE_NAMES = [ 'closetabshortcut', 'newbookmark', 'newtabshortcut', 'newbookmarkshor...
'''Includes various utility functions for the converter service''' from re import compile as cmpl from argparse import ArgumentParser, Action, ArgumentTypeError import os from constants import VIDEO_FILE_EXTENSIONS def str2float(string): '''Converts a string to a floating point value''' return float(cmpl(r'[^\...
import json import os import random import sys from subprocess import Popen, PIPE from urllib.parse import urlencode from OpenSSL import SSL from twisted.web.server import Site, NOT_DONE_YET from twisted.web.resource import Resource from twisted.web.static import File from twisted.web.test.test_webclient import Payloa...
import collections __source__ = 'https://leetcode.com/problems/bag-of-tokens/' # Time: O() # Space: O() # # Description: Leetcode # 948. Bag of Tokens # # You have an initial power P, an initial score of 0 points, # and a bag of tokens. # # Each token can be used at most once, has a value token[i], # and has potentia...
from umlfri2.application.events.diagram import ElementShownEvent, ConnectionShownEvent from ..base import Command, CommandNotDone class ShowElementCommand(Command): def __init__(self, diagram, element_object, point): self.__diagram_name = diagram.get_display_name() self.__diagram = diagram ...
# 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 # d...
import json class DatasetDescriptor(object): def __init__(self): self.data = {'NUMBER_OF_RECORDS': 0, 'ARCHIVE_GENERATED_AT': None, 'BASISOFRECORDS': {}, 'TAXON_MATCHES': {}, 'TAXONOMY': {}, 'COORDINAT...
#!/usr/bin/env python #---------------------------------------------------------------------- # Copyright (c) 2012-2015 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "Work") to # deal in the Work without ...
try: import cPickle as pickle except ImportError: import pickle import collections import optparse import sys from six import itervalues def read_profiling_data(logger, files_in): from ..profiler import ProfileRecord data = collections.defaultdict(ProfileRecord) for path in files_in: logger.info('Re...
import argparse import hashlib import logging import os import queue import socket from urllib.parse import quote, urlsplit from urllib.request import Request, urlopen from urllib.error import URLError from pyquery import PyQuery ''' 根据输入的网址和深度爬网页 需要对php网页取得真实的网站地址 next: 并行化 断点续抓 URLCr...
#!/usr/bin/env python # Copyright (c) 2015-2017 Enzien Audio, Ltd. (info@enzienaudio.com) # # 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 ...
import os import jinja2 from flask_json import as_json from web.routes.api_analysis import analysis_api from web.routes.api_search import search_api from web.routes.api_word import words_api from web.routes.bootstrap import bootstrap from web.routes.error import error from api.dictionary.wordnik import Wordnik from ...
import logging import time import elliptics from tornado.httpclient import HTTPError from infrastructure import infrastructure from infrastructure_cache import cache from jobs import TaskTypes, RetryError from task import Task logger = logging.getLogger('mm.jobs') class MinionCmdTask(Task): PARAMS = ('group'...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# -*- coding:utf-8 -*- from owlmixin import OwlMixin, TList, TOption from jumeaux.addons.judgement import JudgementExecutor from jumeaux.addons.utils import when_filter from jumeaux.logger import Logger from jumeaux.models import JudgementAddOnPayload, JudgementAddOnReference logger: Logger = Logger(__name__) LOG_PR...
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest import warnings from unittest import mock from django.conf import settings from django.core...
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. # Copyright (c) 2016, Gluu # # Author: Yuriy Movchan # from org.gluu.service.cdi.util import CdiUtil from org.gluu.oxauth.security import Identity from org.gluu.model.custom.script.type.auth import PersonAuthentic...
from __future__ import absolute_import, division, print_function from mask_phase_2_dimension_change import neighbor_smoothing from mask_phase_2_dimension_change import masking_reshape_start, masking_reshape_end import numpy as np def t_binary_grouping(t, cutoff, prop = False, abs_on = False): """ Evaluated ...
#!/usr/bin/env python3 # # scanner.py - part of the FDroid server tools # Copyright (C) 2010-13, Ciaran Gultnieks, ciaran@ciarang.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, eit...
class Options(object): _special_attrs = ('_value', '_attributes') def __init__(self, value=None): super(Options, self).__init__() self._value = value self._attributes = {} def __getattr__(self, item): if item in self._attributes: return self._attributes[item] ...
#!/usr/bin/env python3 # # Copyright (C) 2018 INRA # # 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 version. # # This program is...
'''********************************************************************************* APP - SMART PARKING LOT SYSTEM *********************************************************************************''' from pubnub import Pubnub from threading import Thread import sys pub_key = "demo" sub_key = "demo" g_userData = dict...
# -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2004,2005,2006 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # Licensees having purchased or holding a valid Flumotion Advanced # Streaming Server license may use this file in accordance with the # Flum...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors # # This file is part of Alignak. # # Alignak is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free S...
# -*- encoding: utf-8 -*- from abjad.tools import datastructuretools from abjad.tools import durationtools from abjad.tools import mathtools from abjad.tools.abctools import AbjadValueObject class Talea(AbjadValueObject): '''Talea. .. container:: example :: >>> talea = rhythmmakertools...
import csv from django.http import HttpResponse from django.utils.translation import ugettext_lazy as _ from efenua.decorators import action def make_export_as_csv(fields=None, exclude=None, header=True): """ This function returns an export csv action 'fields' and 'exclude' work like in django Mo...
from random import randint from view import GridView class Grid(object): def __init__(self): self.matrix = [ [2, 0, 2, 0], [0, 0, 0, 8], [0, 2, 0, 0], [0, 0, 2, 4]] self.score = 0 print "Play with WASD!" def be...
import numpy from collections import OrderedDict class Bot: ID_NUM = 0 # Populated by GET_NINPUTS VISION = None INPUTS = None NINPUTS = None # Populated by GET_NACTIONS ACTIONS = None NACTIONS = None VIEW_DIST = 100.0 FOV = 60 # Angular distance from center VISION_BINS = ...
# -*- coding: utf-8 -*- """ Anything related to the DB. Includes the classes for Anime and Config. """ __author__ = 'Sohhla' import re import sqlite3 from log import LoggerManager import constant from strings import escape_unicode class DBManager(): """ Controls access to the SQLite DB. DB is located at...
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, Inc. # # 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 ...
# Neural Network # -- nn.py # # @package NeuralNetwork import Queue import random import math import time import threading NUM_THREADS = 1 NUM_TESTS = 100 NUM_INPUTS = 50 NUM_HIDDEN = 30 NUM_OUTPUTS = 50 USE_BACKPROPOGATE = True OUTPUTS = [] # test_input = [ .0, .3, .6, .2, .8 ] class Node: def __init__(self):...
import time import pandas as pd from warnings import warn from carto.auth import APIKeyAuthClient from carto.datasets import DatasetManager from carto.exceptions import CartoException, CartoRateLimitException from carto.sql import SQLClient, BatchSQLClient, CopySQLClient from pyrestcli.exceptions import NotFoundExce...
#!/usr/bin/python # copyright (C) 2011 Jean-Louis Durrieu # # 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 version. # # This ...
from datetime import timedelta from django.db.models import Case, F, IntegerField, Q, Sum, When import ws.utils.perms as perm_utils from ws import models from ws.utils.dates import local_date, local_now, ws_year def deactivate_ratings(participant, activity): """ Mark any existing ratings for the activity as ina...
# Copyright 2017 Battelle Energy Alliance, LLC # # 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 t...
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ ==================================== rsfMRI: ANTS, FS, FSL, SPM, aCompCor ==================================== A preprocessing workflow for Siemens resting state data. This work...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2010-2016 GRNET S.A. # # 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 ...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2019 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
""" Adapted from: https://gist.github.com/vbe0201/ade9b80f2d3b64643d854938d40a0a2d """ import asyncio import functools import itertools import math import random import discord import youtube_dlc from async_timeout import timeout from discord.ext import commands # Silence useless bug reports messages youtube_dlc.u...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '.\ejemplo.ui' # # Created: Sat Sep 20 10:17:47 2014 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_MainWindow(object): def setupUi...
# -*- coding: utf-8 -*- import pytest from cfme import test_requirements from cfme.common.provider import BaseProvider from cfme.common.vm import VM from cfme.utils.generators import random_vm_name from cfme.utils.wait import wait_for from cfme.utils.log import logger from cfme.cloud.provider.azure import AzureProvide...
""" .. versionadded:: 1.1.0 The least-mean-fourth (LMF) adaptive filter implemented according to the paper :cite:`zerguine2000convergence`. The NLMF is an extension of the LMF adaptive filter (:ref:`filter-lmf`). The NLMF filter can be created as follows >>> import padasip as pa >>> pa.filters.FilterNLMF(n) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import os import sys from os.path import abspath from os.path import dirname from os.path import exists from os.path import join if __name__ == "__main__": base_path = dirname(dirname(abspath(__...
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import os from builtins import object from collections import defaultdict from twitter.c...
# -*- coding: utf-8 -*- # libavg - Media Playback Engine. # Copyright (C) 2003-2014 Ulrich von Zadow # # 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, o...
from moneywagon import ( get_unspent_outputs, CurrentPrice, get_optimal_fee, PushTx, get_onchain_exchange_rates ) from moneywagon.core import get_optimal_services, get_magic_bytes from bitcoin import mktx, sign, pubtoaddr, privtopub from .crypto_data import crypto_data from .currency_support import CurrencySupp...
# -*- coding: iso-8859-1 -*- #============================================================ # # This file is part of FEval, a module for the # evaluation of Finite Element results # # Licencse: FEval is provided under the GNU General Public License (GPL) # # Authors: Martin Lüthi, tinu@tnoo.net # #...
# Copyright 2013 Mellanox Technologies, Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
import asyncio import logging import multiprocessing from django.conf import settings import asterisk.manager from redis_collections import Dict logger = multiprocessing.log_to_stderr(logging.INFO) def _connect_to_ami() -> asterisk.manager.Manager: """ Connecting to asterisk(AMI) """ while True: ...
# Copyright (c) 2014 Ahmed H. Ismail # 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...
"""mastool test module""" import ast import collections import os from mastool import practices Fixture = collections.namedtuple('Fixture', 'practice finds ignores') ALL_FIXTURES = [ Fixture( practice=practices.find_for_x_in_y_keys, finds=['for_in_y_keys.py'], ignores=['for_in_y.py'] ...
# Copyright 2009-2013 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type __all__ = [ 'BinaryPackageFile', 'SourceFileMixin', 'SourcePackageReleaseFile', ] from sqlobject import ForeignKey from zope.interface im...
#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # vi:ts=4:et import pycurl import unittest try: import urllib.parse as urllib_parse except ImportError: import urllib as urllib_parse from . import appmanager from . import util setup_module, teardown_module = appmanager.setup(('app', 8380)) class ResetTes...
#!/usr/bin/env python import sys # For debug, preference local install over all else if "DEBUG" in sys.argv: sys.path.insert(0, "../") sys.path.insert(0, "../../") # For mvtest sys.path.insert(0, ".") sys.argv.remove("DEBUG") import numpy import os import mvtest import unittest import test_analyze_tped...
############################################################################### ## ## Copyright (C) 2014 Greg Fausak ## ## 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:...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal #...
import time import itertools import datetime import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.cross_validation import train_test_split from sklearn import metrics import scipy class Glass(object): def __init__(self, file, t...
import collections from .basemodel import BaseModel from beastling.util import xml from beastling.util import log class BinaryModel(BaseModel): def __init__(self, model_config, global_config): BaseModel.__init__(self, model_config, global_config) self.remove_constant_features = model_config.rem...
from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s import os as os import sys import pyqtgraph as pg import numpy as np import Ui_qtView as qtView_face from sifork import experiment pg.setConfigOption('background', 'w') pg.setConfigOption(...
class Robot: def key_press(self, keycode): raise NotImplementedError("Subclasses should implement this!") def key_release(self, keycode): raise NotImplementedError("Subclasses should implement this!") def send_keys(self, keys): raise NotImplementedError("Subclasses should implement...
"""Twitter authentication related utilities.""" import logging import tweepy log = logging.getLogger(__name__) def get_authorized_api(access_token_key, access_token_secret, consumer_key, consumer_secret): """Return an API object initialized with the given token and secret. :Parameters: - `access_t...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2009-2016 Glencoe Software, Inc. All Rights Reserved. # Use is subject to license terms supplied in LICENSE.txt # # 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...
"""Compatibility fixes for older version of python, numpy and scipy If you add content to this file, please give the version of the package at which the fix is no longer needed. # XXX : originally copied from scikit-learn """ # Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org> # Gael Varoq...
#!/usr/bin/env python # Copyright 2012 (Alexandre Zani) # # 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...
from tantalus_db.base import db from tantalus_db.models import Referencing, Transaction, TransactionLine, ServiceLine, Relation, Product, BtwType from tantalus_db.utility import get_or_none, transactional from tantalus.logic.rows import transform_collection from collections import defaultdict from datetime import dat...
# -*- coding:utf-8 -*- head_xm = u'[虾]' head_163 = u'[易]' #summary fmt_summary_skip_title = u'增量下载忽略列表:' fmt_summary_skip_header = u'来源\t 最后下载时间 \t歌曲名\t保存路径' fmt_summary_success_title = u'成功下载列表:' fmt_summary_success_header = u'歌曲名\t保存路...
import scrapy from ..items import Article, Comment class GuardianSpider(scrapy.Spider): name = "guardian" allowed_domains = ["theguardian.com"] start_urls = [ "http://www.theguardian.com/world/2016/feb/09/draft-snoopers-charter-fails-on-spying-powers-and-privacy-protections" ] def __init_...
#!/usr/bin/env python2.7 # # Copyright (c) 2016, Daniel Bolgheroni. # 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 notice, # ...
class GLPluginInterface: """Users can add their own hooks into the visualizer by overloading this class's methods. Each method should return True if the user event was processed. A return value of True stops cascading events to a parent interface.""" def __init__(self): self.window = None...
''' qobuz.node.similar_artist ~~~~~~~~~~~~~~~~~~~~~~~~~ :part_of: kodi-qobuz :copyright: (c) 2012-2018 by Joachim Basmaison, Cyril Leclerc :license: GPLv3, see LICENSE for more details. ''' from qobuz import config from qobuz.api import api from qobuz.gui.util import lang from qobuz.node import get...
import pyfpgrowth from apyori import apriori import time from nbminer.freq_itemsets.buckets.buckets import Bucket from nbminer.freq_itemsets.buckets.buckets import Patterns class FrequentItemsetsBase: def __init__(self, threshold=10, itemset_min=1): self.threshold = threshold self.itemset_min = it...
#!/usr/bin/env python import struct import os import argparse import shutil import sys from collections import namedtuple from datetime import datetime import csv import re from Crypto.Cipher import AES from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 from Crypto.Hash import SHA from Crypto.Util....