text
stringlengths
475
200k
#!/usr/bin/env python import mimetypes import glob import os import os.path # Initialize the mimetypes database mimetypes.init() # Create the package.opf file package = open('package.opf', 'w') # The glob below should encompass everything under # OEBPS. Right now I'm trying to remove empty directories # and the pac...
"""Latex filters. Module of useful filters for processing Latex within Jinja latex templates. """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in th...
# Copyright 2018 Google. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
from ._baseclass import ArtBaseClass import numpy as np from opc.colors import BLACK from opc.hue import hsvToRgb from math import fmod, sin, cos, sqrt class ClearTrain(object): def __init__(self, length): self.length = length self.points = [(0, 0) for i in range(length)] self.head = 0 ...
import sys import base64 import json import subprocess import traceback from functools import wraps try: import ssl except ImportError: ssl = False PY2 = sys.version_info < (3, 0) try: import __builtin__ str_instances = (str, __builtin__.basestring) except Exception: str_instances = (str, ) try...
"""Tests for distutils.command.build_clib.""" import unittest import os import sys from test.support import run_unittest from distutils.command.build_clib import build_clib from distutils.errors import DistutilsSetupError from distutils.tests import support from distutils.spawn import find_executable class BuildCLib...
import numpy as np from scipy import linalg from sklearn.decomposition import nmf from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_false from sklearn.utils.testing import raises from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing import assert_gr...
"""A PyQT4 class to load a page image from a ComicArchive in a background thread""" # Copyright 2012-2014 Anthony Beville # 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.apa...
#!/usr/bin/env python2 ## # autosign # https://github.com/leosartaj/autosign.git # # copyright (c) 2014 sartaj singh # licensed under the mit license. ## import shutil, os from autosign import config """ Helper functions for performing tests """ def newFile(fName): """ Touch a new file """ with ope...
'''OpenGL extension ARB.internalformat_query This module customises the behaviour of the OpenGL.raw.GL.ARB.internalformat_query to provide a more Python-friendly API Overview (from the spec) OpenGL 4.1 has a number of queries to indicate the maximum number of samples available for different formats. These give ...
#List of all apps and menu to open them #copyright (c) 2015 Tyler Spadgenske #GPL License ############################### #To be packaged with stock TYOS ############################### import sys, time import pygame class Run(): def __init__(self, fona): #Stuff to follow app protocol self.exit = ...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests to ensure all attributes of L{twisted.internet.gtkreactor} are deprecated. """ import sys from twisted.trial.unittest import TestCase class GtkReactorDeprecation(TestCase): """ Tests to ensure all attributes of L{twisted.int...
# (c) 2016, Samuel Boucher <[EMAIL]> # (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = """ lookup: keyring author: - Samuel Bouche...
# -*- test-case-name: twisted.web.test.test_static -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Static resources for L{twisted.web}. """ import os import warnings import urllib import itertools import cgi import time from zope.interface import implements from twisted.web import se...
# -*- coding: utf-8 -*- """ werkzeug.serving ~~~~~~~~~~~~~~~~ There are many ways to serve a WSGI application. While you're developing it you usually don't want a full blown webserver like Apache but a simple standalone one. From Python 2.5 onwards there is the `wsgiref`_ server in the standa...
from __future__ import absolute_import from datetime import timedelta from functools import wraps from apscheduler.schedulers.base import BaseScheduler from apscheduler.util import maybe_ref try: from tornado.ioloop import IOLoop except ImportError: # pragma: nocover raise ImportError('TornadoScheduler requi...
import inspect import collections from contextlib import contextmanager from functools import wraps # Used in exec statement import re class Events(object): """ Events container. All available events are attributes of this class. """ def __init__(self): self._events = {} @contex...
#!/usr/bin/python # coding: utf-8 -*- # (c) 2017, Wayne Witzel III <[EMAIL]> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import sys import gevent import uuid import time sys.path.append("../config/common/tests") from testtools.matchers import Equals, Contains, Not from test_utils import * import test_common import test_case from vnc_api.vnc_api import * from vnc_api.g...
# # 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...
from django import forms from django.forms.widgets import CheckboxSelectMultiple from django.utils.translation import ugettext_lazy as _ from django_comments_xtd.conf import settings as comments_settings from django_comments_xtd.forms import CommentForm from django_comments_xtd.models import TmpXtdComment from .model...
"""Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS:...
# coding=utf8 """ asl.py - Willie Freies Labor Activity Streams Lite Module Licensed under a Mozilla Public License 2.0. """ from willie.module import commands, interval import urllib2, json, os, pickle from datetime import datetime, timedelta ASL_QUERY = '-wiki.*&-sensor.traffic-light&-sensor.mate-o-meter&-twitter.re...
## # Copyright 2013 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercules foundation (http://w...
# Copyright 2017 The UAI-SDK Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
# Copyright 2019 The TensorFlow Authors. 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 applica...
#!/usr/bin/env python # Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia 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 ...
from __future__ import print_function, division from sympy.core import S, sympify, Expr, Rational, Symbol, Dummy from sympy.core import Add, Mul, expand_power_base, expand_log from sympy.core.cache import cacheit from sympy.core.compatibility import default_sort_key, is_sequence from sympy.core.containers import Tuple...
#!/usr/bin/env python import json import os.path from time import time from pysnap.utils import (encrypt, decrypt, decrypt_story, make_media_id, request) MEDIA_IMAGE = 0 MEDIA_VIDEO = 1 MEDIA_VIDEO_NOAUDIO = 2 FRIEND_CONFIRMED = 0 FRIEND_UNCONFIRMED = 1 FRIEND_BLOCKED = 2 PRIVACY_EVERYONE ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
#!/usr/bin/python # This file is part of Ansible # # Ansible 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. # # Ansible is distributed...
# Copyright 2014 Red Hat, 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 law or a...
# Copyright 2013 Google, Inc. All Rights Reserved. # # Google Author(s): Behdad Esfahbod from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.misc.textTools import safeEval from . import DefaultTable import operator import struct class table_C_O_L_R_(Defau...
#!/usr/bin/env python # Copyright(C) 2011,2012,2013,2014 by Abe developers. # 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, either version 3 of the # License, or (at your option) any lat...
""" Various complex queries that have been problematic in the past. """ import threading from django.db import models class DumbCategory(models.Model): pass class NamedCategory(DumbCategory): name = models.CharField(max_length=10) class Tag(models.Model): name = models.CharField(max_length=10) par...
# Copyright (c) 2007, Robert Coup <[EMAIL]> # 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, # this list of cond...
from operator import add, sub import sys #image stuff from PIL import Image, ImageDraw #Read in the directions with open(sys.argv[1]) as f: directions = f.read()[:-1] directions.strip() directions = directions.split(', ') compass = 0 # Compass directions: # 0 : north # 1 : east # 2 : south # 3 : west # turning R...
# Copyright 2017 The TensorFlow Authors. 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 applica...
# 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, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.g...
import warnings from .. import widgets from .core import StringField, BooleanField __all__ = ( 'BooleanField', 'TextAreaField', 'PasswordField', 'FileField', 'HiddenField', 'SubmitField', 'TextField' ) class TextField(StringField): """ Legacy alias for StringField .. deprecated:: 2.0 """ ...
from __future__ import unicode_literals from django.contrib.gis import admin from django.contrib.gis.geos import Point from django.test import TestCase, override_settings, skipUnlessDBFeature from .admin import UnmodifiableAdmin from .models import City, site @skipUnlessDBFeature("gis_enabled") @override_settings(R...
#!/usr/bin/env python2 # Author: Nic Wolfe <[EMAIL]> # 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 ...
import MySQLdb import dump_table from optparse import OptionParser import db_config #calculate the ship attribute tables. def dumpAttribute(conn,query,attrNum): cursor = conn.cursor() cursor.execute(query) rowcount = int(cursor.rowcount) conn.query("BEGIN;"); for i in range (0,rowcount): ...
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditi...
""" A script to convert the drosophila connectome into SpineML This build upon the pure data to add in the required infered network components: # Install libSpineML from source # https://github.com/AdamRTomkins/libSpineML """ from __future__ import division from libSpineML import smlExperiment as exp from libSpine...
# # shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213 # # Written by Hye-Shik Chang <[EMAIL]> # import _codecs_jp, codecs import _multibytecodec as mbc codec = _codecs_jp.getcodec('shift_jisx0213') class Codec(codecs.Codec): encode = codec.encode decode = codec.decode class IncrementalEncoder(mbc.M...
import re import traceback from bs4 import BeautifulSoup from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.media._base.providers.torrent.base import TorrentMagnetProvider import six log = CPLog(...
# -*- coding: utf8 -*- ############################ # imports import time import datetime import urllib2 import re import os import pickle import numpy as np import matplotlib.pyplot as plt ############################ # defining the parameters currentPriceRegex = re.compile(r'(?<=\<td\ align\=\"center\"\ bgcolor\...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import gc import locale # system locale module, not tornado.locale import logging import operator import textwrap import sys from tornado.httpclient import AsyncHTTPClient from tornado.httpserver import HTTPServer f...
# -*- coding: utf-8 -*- """ @author: QQ:412319433 """ import requests from bs4 import BeautifulSoup import sqlite3 import time s = time.clock() def htmlparse(bs, tag, attr = None, attrs= None): ''' bs : BeautifulSoup对象 tag : 要处理的标签名 attr : 要获取属性值的属性名 attrs : 要查找的属性值对 ''' content ...
#encoding=utf-8 from __future__ import print_function import sys sys.path.append("../../") import jieba jieba.enable_parallel(4) import jieba.posseg as pseg def cuttest(test_sent): result = pseg.cut(test_sent) for w in result: print(w.word, "/", w.flag, ", ", end=' ') print("") if __name__ == "...
# -*- coding: utf-8 -*- # (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik # Author: Dominik Gresch <[EMAIL]> """ Defines the data container for eigenvalue data (bandstructures). """ import types import numpy as np from fsc.export import export from fsc.hdf5_io import HDF5Enabled, subscribe_hdf5 from .k...
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies file copies using an explicit build target of 'all'. """ import TestGyp test = TestGyp.TestGyp() test.run_gyp('copies.gyp', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2014 Lukas Kemmer # # 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 # # Unl...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Jon Hawkesworth (@jhawkesworth) <[EMAIL]> # # This file is part of Ansible # # Ansible 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...
import json import base64 class Mail(object): """ An object that represents a single email to be sent via Apostle.io Arbitrary attributes can be added at runtime and will be sent as the 'data' key to Apostle.io """ # The template slug to be sent template_id = None # The email address to be sent to email =...
# -*- coding: utf-8; -*- # This file is part of Superdesk. # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license # # Author : tomas # Creation: 2018-03-21 09:28 import superdesk import subp...
"""Blocking and non-blocking HTTP client interfaces. This module defines a common interface shared by two implementations, ``simple_httpclient`` and ``curl_httpclient``. Applications may either instantiate their chosen implementation class directly or use the `AsyncHTTPClient` class from this module, which selects an...
# -*- coding: utf-8 -*- """ pygments.styles.autumn ~~~~~~~~~~~~~~~~~~~~~~ A colorful style, inspired by the terminal highlighting style. :copyright: 2006-2007 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from pygments.style import Style from pygments.token import Keyword, N...
### # Copyright (c) 2002-2005, Jeremiah Fincher # 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 co...
# (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = """ lookup: varnames author: Ansible Core version_added: "2.8" short_descriptio...
""" Python Character Mapping Codec cp874 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP874.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,inpu...
# -*- coding: utf-8 -*- """ OnionShare | https://onionshare.org/ Copyright (C) 2014 Micah Lee <[EMAIL]> 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 o...
# This is a copy of the Python logging.config.dictconfig module, # reproduced with permission. It is provided here for backwards # compatibility for Python versions prior to 2.7. # # Copyright 2009-2010 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # docu...
from __future__ import unicode_literals import os import re from unittest import skipUnless from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.tests.utils import postgis from django.test import TestCase from django.utils._os import upath if HAS_GEOS: ...
# Copyright 2016 The TensorFlow Authors. 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 applica...
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import gevent from gevent import monkey; monkey.patch_all() from pysandesh.sandesh_base import * from gen_py.generator_msg.ttypes import * from pysandesh_example.gen_py.vn.ttypes import * from pysandesh_example.gen_py.vm.ttypes import * import sandes...
# -*- coding: utf-8 -*- """ pygments.cmdline ~~~~~~~~~~~~~~~~ Command line interface. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys import getopt from textwrap import dedent from pygments import __version__, highlight fro...
# pylint: disable=C0111 # pylint: disable=W0621 from lettuce import world, step from terrain.steps import reload_the_page from selenium.webdriver.common.keys import Keys from common import type_in_codemirror, upload_file from django.conf import settings from nose.tools import assert_true, assert_false, assert_equal ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from itertools import chain from django.contrib.admin.utils import ( NotRelationField, flatten, get_fields_from_path, ) from django.core import checks from django.core.exceptions import FieldDoesNotExist from django.db import models from django.forms...
import builtins import collections import datetime import decimal import enum import functools import math import re import types import uuid from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.utils import COMPILED_REGEX_TYPE, RegexObject from django.utils...
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood # Copyright (c) 2009 The Hewlett-Packard Development Company # 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 co...
import numpy as np import pandas as pd from statsmodels.tools.grouputils import Grouping from statsmodels.tools.tools import categorical from statsmodels.datasets import grunfeld, anes96 from pandas.util import testing as ptesting class CheckGrouping(object): def test_reindex(self): # smoke test ...
ClimateDataPortal = local_import('ClimateDataPortal') def clear_tables(): ClimateDataPortal.place.truncate() ClimateDataPortal.rainfall_mm.truncate() ClimateDataPortal.temperature_celsius.truncate() db.commit() #clear_tables() def frange(start, end, inc=1.0): value = start i = 0 while Tru...
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- #------------------------------------------------------------------- # tarfile.py #------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustäbel <[EMAIL]> # All rights reserved. # # Permission is hereby granted, free of char...
import warnings from django.conf import settings from django.conf.urls import patterns, url from django.core.urlresolvers import LocaleRegexURLResolver from django.utils import six from django.utils.deprecation import RemovedInDjango20Warning from django.views.i18n import set_language def i18n_patterns(prefix, *args...
from django.test import TestCase from crawler.engine import LinkFinder, IngredientFinder import urllib.request from ..models import DataIngredient class CrawlerTestCase(TestCase): def test_links_finder_count(self): """Test the count of links in link finder is equal to the expected amount""" finde...
#!/usr/bin/env python """ Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def __i...
# -*- test-case-name: twisted.internet.test.test_pollingfile -*- # Copyright (c) 2001-2009 Twisted Matrix Laboratories. # See LICENSE for details. """ Implements a simple polling interface for file descriptors that don't work with select() - this is pretty much only useful on Windows. """ from zope.interface import i...
"""Tests for user API middleware""" from mock import Mock, patch from unittest import TestCase from django.http import HttpResponse from django.test.client import RequestFactory from student.tests.factories import UserFactory, AnonymousUserFactory from ..tests.factories import UserCourseTagFactory from ..middleware ...
# -*- coding: utf-8 -*- from south.db import db from django.db import models from adm.application.models import * class Migration: def forwards(self, orm): # Adding field 'Applicant.is_offline' db.add_column('application_applicant', 'is_offline', orm['application.applicant:is_offline...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# protocol-server # # a reference implementation of the Web Annotation Protocol # # Developed by Benjamin Young (@bigbulehat) and Shane McCarron (@halindrome). # Sponsored by Spec-Ops (https://spec-ops.io) # # Copyright (c) 2016 Spec-Ops # # for license information, see http://www.w3.org/Consortium/Legal/2008/04-testsu...
import io import os from .context import reduction, set_spawning_popen if not reduction.HAVE_SEND_HANDLE: raise ImportError('No support for sending fds between processes') from . import forkserver from . import popen_fork from . import spawn from . import util __all__ = ['Popen'] # # Wrapper for an fd used whil...
"""Pure-Python RSA implementation.""" from cryptomath import * import xmltools from ASN1Parser import ASN1Parser from RSAKey import * class Python_RSAKey(RSAKey): def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0): if (n and not e) or (e and not n): raise AssertionError() ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2011-2013 Codernity (http://codernity.com) # # 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/L...
import json from copy import deepcopy from . import api class Search: """Build and execute a search query.""" def __init__(self): self.query = {} def expression(self, value): """Specify the search query expression.""" self.query["expression"] = value return self def m...
from tmapi.models import Association from base_manager import BaseManager from entity_type import EntityType from property_assertion import PropertyAssertion class EntityTypePropertyAssertionManager (BaseManager): def filter_by_authority_entity_type (self, authority, entity_type): return self.filter(sco...
""" Useful form fields for use with SQLAlchemy ORM. """ import operator from wtforms import widgets from wtforms.fields import SelectFieldBase from wtforms.validators import ValidationError from .tools import get_primary_key from flask_admin._compat import text_type, string_types from flask_admin.form import Form...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
import time import urllib import http.client # RESTful interface of Kyoto Tycoon class KyotoTycoon: # connect to the server def open(self, host = "127.0.0.1", port = 1978, timeout = 30): self.ua = http.client.HTTPConnection(host, port, False, timeout) # close the connection def close(self): ...
#!/usr/bin/env python3 # Copyright (c) 2014-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down into individual test cases via subprocess. It will f...
"""pyversioncheck - Module to help with checking versions""" import types import rfc822 import urllib import sys # Verbose options VERBOSE_SILENT=0 # Single-line reports per package VERBOSE_NORMAL=1 # Single-line reports per package, more info if outdated VERBOSE_EACHFILE=2 # Report on each URL chec...
__doc__=""" NOTES: See https://rdflib.readthedocs.org/en/4.2.1/_modules/rdflib/plugins/stores/sparqlstore.html where SparQLClient + SparQLQuery is called a "sparql store" INSERTs and DELETEs without a WHERE clause have the DATA keyword: INSERT DATA { ... } DELETE DATA { ... }. DELETE INSERT WHERE ...
from multiprocessing import Process, Pipe from aux.engine.actor.base import BaseActor import select class Reactor(BaseActor): def __init__(self, name, looper="select"): self.parent = super(Reactor, self) self.parent.__init__(name) self.callbacks = list() self.shouldStop = F...
# This file is part of DiSTAF # Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # any l...
#! /usr/bin/python # -*- coding: utf-8 -*- import tensorflow as tf import tensorlayer as tl tf.logging.set_verbosity(tf.logging.DEBUG) tl.logging.set_verbosity(tl.logging.DEBUG) sess = tf.InteractiveSession() # prepare data X_train, y_train, X_val, y_val, X_test, y_test = tl.files.load_mnist_dataset(shape=(-1, 784)...