content stringlengths 4 20k |
|---|
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import argparse
import csv
from collections import namedtuple
try:
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
except ImportError:
raise ... |
import os
from sahara import conductor as c
from sahara import context
from sahara import exceptions as e
from sahara.i18n import _
import sahara.plugins.mapr.services.spark.spark as spark
import sahara.plugins.mapr.util.general as g
import sahara.plugins.mapr.versions.version_handler_factory as vhf
import sahara.plug... |
from functools import wraps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.utils.decorators import available_attrs
from django.utils.six.moves.urllib.parse import urlparse
from django.shortcuts import resolve_url
def... |
from openerp.osv import orm, fields
class ResPartner(orm.Model):
_inherit = 'res.partner'
_columns = {
'ref_customer': fields.char('Customer Reference', size=64,
help='This is my customer reference for'
' the supplier'),
... |
from collections import OrderedDict
from typing import Dict, Type
from .base import CustomerClientLinkServiceTransport
from .grpc import CustomerClientLinkServiceGrpcTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[CustomerClientLinkServiceTransport]]
... |
"""A deep MNIST classifier using convolutional layers.
See extensive documentation at
https://www.tensorflow.org/get_started/mnist/pros
"""
# Disable linter warnings to maintain consistency with tutorial.
# pylint: disable=invalid-name
# pylint: disable=g-bad-import-order
from __future__ import absolute_import
from _... |
from openerp.osv import fields
from openerp.osv import osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
class mrp_subproduct(osv.osv):
_name = 'mrp.subproduct'
_description = 'Byproduct'
_columns={
'product_id': fields.many2one('product.product', 'Product', re... |
BASECAMP_ACCOUNT_ID = "12345678"
BASECAMP_USERNAME = "<EMAIL>"
BASECAMP_PASSWORD = "p455w0rd"
# This script will mirror this many hours of history on the first run.
# On subsequent runs this value is ignored.
BASECAMP_INITIAL_HISTORY_HOURS = 0
# Change these values to configure Zulip authentication for the plugin
ZUL... |
"""This package manipulates Docker image layer metadata."""
from collections import namedtuple
import copy
import json
import os
import os.path
import sys
import tarfile
from third_party.py import gflags
gflags.DEFINE_string(
'name', None, 'The name of the current layer')
gflags.DEFINE_string(
'base', None, ... |
from __future__ import unicode_literals
from .adobepass import AdobePassIE
from ..utils import (
update_url_query,
smuggle_url,
)
class SyfyIE(AdobePassIE):
_VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'http://www.syfy.com/theinternetruined... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from contextlib import closing
from itertools import chain
import os
import textwrap
from xml.etree import ElementTree
from twitter.common.collections import OrderedD... |
"""
Finite Discrete Random Variables - Prebuilt variable types
Contains
========
FiniteRV
DiscreteUniform
Die
Bernoulli
Coin
Binomial
Hypergeometric
"""
from __future__ import print_function, division
from sympy.core.compatibility import as_int, range
from sympy.core.logic import fuzzy_not, fuzzy_and
from sympy.stat... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
def pool_exists(api, pool):
# hack to determine if pool exists
result = False
try:
api.LocalLB.Pool.get_object_status(pool_names=[pool])
result = True
... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import _init_path
import sys
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from lxml import etree
class PascalVocWriter:
def __init__(self, foldername, filename, imgSize, databaseSrc='Unknown', localImgPath=None):
self... |
import mongoengine as me
from st2common import log as logging
from st2common.models.db import MongoDBAccess
from st2common.models.db import stormbase
from st2common.models.db.actionalias import ActionAliasDB
from st2common.models.db.executionstate import ActionExecutionStateDB
from st2common.models.db.execution import... |
# -*- coding: utf-8 -*-
"""
geoip-service
~~~~~~~~~~~~~
A simple, free GeoIP REST endpoint.
"""
import os
from itertools import chain
from functools import wraps
from flask import Flask, request, jsonify, current_app
from flask.ext.cache import Cache
from geoip2 import database
from geoip2.errors import AddressNot... |
#!/usr/bin/env python
# coding=utf-8
from CosmAna import Pylib
from CosmAna import PS
import numpy as np
from CosmAna import ReadSnapshot
from CosmAna import PCS as Assigment
from CosmAna import MPI_IO
from smooth import Smooth
import os
def checkdir(dirpath):
isExists = os.path.exists(dirpath)
if not isExists... |
"""Process Android resources to generate R.java, and prepare for packaging.
This will crunch images and generate v14 compatible resources
(see generate_v14_compatible_resources.py).
"""
import optparse
import os
import re
import shutil
import sys
import zipfile
import generate_v14_compatible_resources
from util imp... |
from capstone import *
from ropperapp.common.utils import *
from ropperapp.common.error import *
from ropperapp.common.enum import Enum
from .gadget import Gadget, GadgetType
from binascii import hexlify
import re
import struct
import sys
class Ropper(object):
def __init__(self, arch):
super(Ropper, self... |
"""
Django settings for demo project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... |
from spack import *
class PyFparser(PythonPackage):
"""Parser for Fortran 77..2003 code."""
homepage = "https://github.com/stfc/fparser"
url = "https://github.com/stfc/fparser/archive/0.0.5.tar.gz"
giturl = "https://github.com/stfc/fparser.git"
version('0.0.6', '15553fde76b4685fa8edb0a547... |
"""Hooks for nose library."""
import re
import textwrap
import astroid
import astroid.builder
_BUILDER = astroid.builder.AstroidBuilder(astroid.MANAGER)
def _pep8(name, caps=re.compile('([A-Z])')):
return caps.sub(lambda m: '_' + m.groups()[0].lower(), name)
def _nose_tools_functions():
"""Get an iterato... |
"""
TestCases for testing the locking sub-system.
"""
import time
import unittest
from test_all import db, test_support, verbose, have_threads, \
get_new_environment_path, get_new_database_path
if have_threads :
from threading import Thread
import sys
if sys.version_info[0] < 3 :
from thr... |
from __future__ import division, print_function, absolute_import
import warnings
from numpy.testing import (assert_almost_equal, assert_array_equal,
TestCase, run_module_suite, assert_allclose, assert_equal, assert_)
from scipy.interpolate import (KroghInterpolator, krogh_interpolate,
BarycentricInter... |
'''Diffusion mapping by Ann B Lee, March 2009. Last modified, JWR: 3/23/2009 ported to python'''
import numpy as nu
from scipy.cluster.vq import kmeans2
#from scipy.sparse.linalg import svds as svd
from scipy.linalg import svd
def diffuse(D,eps_val,neigen=None,t=None,threshold = 5E-6):
''' diffuse(D,eps_val,t,n... |
import pydevd_constants #@UnusedImport -- defines False and True if not there.
IS_PY3K = pydevd_constants.IS_PY3K
class IORedirector:
'''This class works to redirect the write function to many streams
'''
def __init__(self, *args):
self._redirectTo = args
def write(self, s):
for r in... |
"""
This file is part of gempy.
gempy 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.
gempy is distributed in the h... |
from django.conf.urls import patterns, url
from django.contrib.auth import context_processors
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
from django.contrib.auth.views import password_reset, login
from django.contrib.auth.decorators import login_required
fr... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
class FilterTagTests(SimpleTestCase):
@setup({'filter01': '{% filter upper %}{% endfilter %}'})
def test_filter01(self):
output = self.engine.render_to_string('filter01')
self.ass... |
import re
import os
from zipfile import ZipFile
# String from tar that shows the tar contents are different from the
# filesystem
DIFFERENCE_RE = re.compile(r': (.*) differs$')
# When downloading an archive, how much of the archive to download before
# saving to a tempfile (64k)
BUFSIZE = 65536
class UnarchiveError(E... |
# coding=utf-8
"""
Collects stats from bind 9.5's statistics server
#### Dependencies
* [bind 9.5](http://www.isc.org/software/bind/new-features/9.5)
configured with libxml2 and statistics-channels
"""
import diamond.collector
import sys
import urllib2
if sys.version_info >= (2, 5):
import xml.etree.cEle... |
"""Interpret sun audio headers."""
from warnings import warnpy3k
warnpy3k("the sunaudio module has been removed in Python 3.0; "
"use the sunau module instead", stacklevel=2)
del warnpy3k
MAGIC = '.snd'
class error(Exception):
pass
def get_long_be(s):
"""Convert a 4-char value to integer."""
r... |
#!/usr/bin/env python
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.node import RemoteController, OVSKernelSwitch
MAC = 12
DPID = 16
class CustomCLI(CLI):
"""Custom CLI to allow us to add our own commands."""
def __init__ (self, net):
"""Init method for our custom CLI."""
... |
# coding: utf-8
from __future__ import unicode_literals
from boxsdk.exception import BoxAPIException
from boxsdk.util.shared_link import get_shared_link_header
class BoxResponse(object):
"""Represents a response to a Box API request."""
def __init__(self, network_response):
self._network_response =... |
import re
import time
import sys
import traceback
import threading
from Queue import Queue
import offlineimap
debugtypes = {'':'Other offlineimap related sync messages',
'imap': 'IMAP protocol debugging',
'maildir': 'Maildir repository debugging',
'thread': 'Threading debuggin... |
from openerp.addons.base.tests.test_ir_actions import TestServerActionsBase
class TestServerActionsEmail(TestServerActionsBase):
def test_00_state_email(self):
""" Test ir.actions.server email type """
cr, uid = self.cr, self.uid
# create email_template
template_id = self.registr... |
"""Keypair management extension."""
import webob
import webob.exc
from nova.api.openstack import common
from nova.api.openstack.compute.schemas import keypairs
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova.compute import api as compute_api
from... |
"""Two neuron example
----------------------------
See Also
~~~~~~~~~~
:doc:`one_neuron`
"""
import nest
import nest.voltage_trace
import matplotlib.pyplot as plt
weight = 20.0
delay = 1.0
stim = 1000.0
neuron1 = nest.Create("iaf_psc_alpha")
neuron2 = nest.Create("iaf_psc_alpha")
voltmeter = nest.Create("voltme... |
from __future__ import print_function
import os
import sys
def _find_spark_home():
"""Find the SPARK_HOME."""
# If the enviroment has SPARK_HOME set trust it.
if "SPARK_HOME" in os.environ:
return os.environ["SPARK_HOME"]
def is_spark_home(path):
"""Takes a path and returns true if th... |
from twisted.trial import unittest
from piped import processing
from piped.providers import pipeline_provider
class PipelineProviderTest(unittest.TestCase):
def setUp(self):
self.runtime_environment = processing.RuntimeEnvironment()
self.runtime_environment.configure()
self.configura... |
import gtk
class SetResultFont(gtk.ToolButton):
"""
@param query: QueryTab
@param emma: Emma
"""
def __init__(self, query, emma):
self.emma = emma
self.query = query
super(SetResultFont, self).__init__()
self.set_label('Font')
self.set_icon_name(gtk.STOCK_S... |
import logging
from scrapy.exceptions import NotConfigured
from scrapy import signals
class AutoThrottle(object):
def __init__(self, crawler):
self.crawler = crawler
if not crawler.settings.getbool('AUTOTHROTTLE_ENABLED'):
raise NotConfigured
self.debug = crawler.settings.get... |
class PlotWorkbench(Workbench):
"""Workbench of Plot module."""
from plotUtils import Paths
import PlotGui
Icon = 'Icon.svg'
MenuText = "Plot"
ToolTip = ("The Plot module is used to edit/save output plots performed "
"by other tools")
def Initialize(self):
from PySid... |
'''
Blocks and utilities for COMEDI devices
'''
# The presence of this file turns this directory into a Python package
import os
try:
from comedi_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
fr... |
class ModuleDocFragment(object):
# inventory cache
DOCUMENTATION = r'''
options:
cache:
description:
- Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.
type: bool
default: no
env:
- name: ANSIBLE_INVENTORY_CACHE
ini:
... |
"""
Defines a form for providing validation of HLS Playback course-specific configuration.
"""
import logging
from django import forms
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locator import CourseLocator
from openedx.core.djangoapps.video_config.models import (
CourseHLSPlaybackEnabledFlag,
... |
"""Internal utilities for `LinearOperator` classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.pyt... |
import oemedical_medication_template
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr
'''
Some components do not have type set, try and guess whether they turn up in
earnings or deductions in existing salary slips
'''
def execute():
frappe.reload_doc("accounts", "doctype", "salary_component_account")
for s in frap... |
################################################################################
# printbot3d.py
#
# Dan Heeks 18th October 2010
import nc
import iso_modal
import math
################################################################################
class CreatorPrintbot(iso_modal.CreatorIsoModal):
de... |
'''
Kivy framework
==============
Kivy is an open source library for developing multi-touch applications. It is
completely cross-platform (Linux/OSX/Win) and released under the terms of the
MIT License.
It comes with native support for many multi-touch input devices, a growing
library of multi-touch aware widgets and... |
'''
Recorder module
===============
.. versionadded:: 1.1.0
Create an instance of :class:`~kivy.input.recorder.Recorder`, attach to the
class, and bind some keys to record / play sequences:
- F6: play the last record in a loop
- F7: read the latest recording
- F8: record input events
Configuration
-----... |
r"""Python sandbox implementation for build files.
This module contains classes for Python sandboxes that execute in a
highly-controlled environment.
The main class is `Sandbox`. This provides an execution environment for Python
code and is used to fill a Context instance for the takeaway information from
the executi... |
import exceptions
from grit.extern import FP
# This module assumes that within a bundle no two messages can have the
# same id unless they're identical.
# The basic classes defined here for external use are Message and Translation,
# where the former is used for English messages and the latter for
# translations. Th... |
from django.test import TestCase
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
class TestSuBackend(TestCase):
def setUp(self):
super(TestSuBackend, self).setUp()
from django_su.backends imp... |
from twisted.internet.defer import inlineCallbacks
from Tribler.Core.CacheDB.SqliteCacheDBHandler import PeerDBHandler
from Tribler.Core.CacheDB.sqlitecachedb import str2bin
from Tribler.Test.Core.test_sqlitecachedbhandler import AbstractDB
from Tribler.dispersy.util import blocking_call_on_reactor_thread
FAKE_PERMI... |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
traindna = lm.load_dna('../data/fm_train_dna.dat')
testdna = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindna,testdna,4,0,False,False],[traindna,testdna,3,0,False,False]]
def preprocessor_sortulongstring (fm_train_dna=traindna,... |
#
# Regions
#
AP_NORTHEAST_1 = 'ap-northeast-1'
AP_NORTHEAST_2 = 'ap-northeast-2'
AP_SOUTHEAST_1 = 'ap-southeast-1'
AP_SOUTHEAST_2 = 'ap-southeast-2'
EU_WEST_1 = 'eu-west-1'
EU_CENTRAL_1 = 'eu-central-1'
SA_EAST_1 = 'sa-east-1'
US_EAST_1 = 'us-east-1'
US_WEST_1 = 'us-west-1'
US_WEST_2 = 'us-west-2'
#
# Availability Z... |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph output formats.
#
# AUTHOR Michal Bukovsky <<EMAIL>>
#
def make_graphviz_tree(root):
from graphviz import Digraph
from hashlib import md5
from operator import attrgetter
name = next(iter(root.children)).name
dot = Digr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.module_utils import urls
from ansible.module_utils.six.moves import urllib
from ansible.module_utils.six.moves import ur... |
import os
from random import randrange
from gi.repository import GdkPixbuf
from constants import (HIGH, MEDIUM, LOW, FILLS, SHAPES, NUMBER, COLORS,
COLOR_PAIRS)
from gencards import (generate_pattern_card, generate_number_card,
generate_word_card, generate_custom_card)
tr... |
import time
import sys
import os
from compgen import ComponentGenerator
class VendorConfigGenerator(ComponentGenerator):
def __init__(self, vendor):
self.vendor = vendor
summary="Vendor Configuration files for %s." % self.vendor
ComponentGenerator.__init__(self, vendor, "vendor-config-" + s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
name: host_list
version_added: "2.4"
short_description: Parses a 'host list' string
description:
- Parses a host list string as a comma separated values of hosts
- This plugin on... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwn import *
#host = "10.211.55.23"
#port = 8888
host = "111.186.63.20"
port = 10001
context.arch = "amd64"
r = remote(host,port)
def alloc(size):
r.recvuntil(":")
r.sendline("1")
r.recvuntil(":")
r.sendline(str(size))
def update(idx,data):
r... |
"""Tests for random_crop."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.ops import random_ops
from tensorflow.python.platform import test
class RandomCropTest(test.TestCase):
def testNoOp(self):
# No ... |
"""
cryptocurrency.py
A plugin that uses the CoinMarketCap JSON API to get values for cryptocurrencies.
Created By:
- Luke Rogers <https://github.com/lukeroge>
Special Thanks:
- https://coinmarketcap-nexuist.rhcloud.com/
License:
GPL v3
"""
from urllib.parse import quote_plus
from datetime import dateti... |
import json
from social.tests.backends.oauth import OAuth2Test
class PodioOAuth2Test(OAuth2Test):
backend_path = 'social.backends.podio.PodioOAuth2'
user_data_url = 'https://api.podio.com/user/status'
expected_username = 'user_1010101010'
access_token_body = json.dumps({
'token_type': 'bearer... |
"""Tests for legendre module.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.polynomial.legendre as leg
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
TestCase, assert_almost_equal, assert_raises,
assert_equal, assert_, run_mod... |
import sys, pickle
from unittest import TestCase
import simplejson as json
from simplejson.compat import u, b
class TestErrors(TestCase):
def test_string_keys_error(self):
data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}]
self.assertRaises(TypeError, json.dumps, data)
def test_dec... |
"""
Like the old south.modelsparser, but using introspection where possible
rather than direct inspection of models.py.
"""
from __future__ import print_function
import datetime
import re
import decimal
from south.utils import get_attribute, auto_through
from south.utils.py3 import text_type
from django.db import m... |
# Values for Command field in SMB message header
SMB_COM_CREATE_DIRECTORY = 0x00
SMB_COM_DELETE_DIRECTORY = 0x01
SMB_COM_CLOSE = 0x04
SMB_COM_DELETE = 0x06
SMB_COM_RENAME = 0x07
SMB_COM_TRANSACTION = 0x25
SMB_COM_ECHO = 0x2B
SMB_COM_OPEN_ANDX = 0x2D
SMB_COM_READ_ANDX = 0x2E
SMB_COM_WRITE_ANDX = 0x2F
SMB_COM_TRANSACTION... |
import logging
import sys
import socket
import ssl
from urllib.parse import urlparse
from urllib.parse import urljoin
from urllib.parse import quote
from urllib.parse import unquote
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(Inse... |
from nova import db
from nova import exception
from nova.tests.functional.v3 import test_servers
from nova.tests.unit.objects import test_network
from nova.tests.unit import utils as test_utils
class FixedIpTest(test_servers.ServersSampleBase):
extension_name = "os-fixed-ips"
def setUp(self):
super(F... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from views import LayersView,MapurlsView,MapurlsHtmlView,MapurlDetailView,SuggestView
admin.autodi... |
# -*- coding: utf-8 -*-
try:
import simplejson as json
except ImportError:
import json
import logging
import pprint
import werkzeug
from openerp import http, SUPERUSER_ID
from openerp.http import request
_logger = logging.getLogger(__name__)
class AdyenController(http.Controller):
_return_url = '/payme... |
"""WebSocket extension for Apache HTTP Server.
mod_pywebsocket is a WebSocket extension for Apache HTTP Server
intended for testing or experimental purposes. mod_python is required.
Installation
============
0. Prepare an Apache HTTP Server for which mod_python is enabled.
1. Specify the following Apache HTTP Serv... |
import os
from nevow.testutil import TestCase
import formless
from formless import process as flpr
def process(typed, value):
return flpr(typed, [value])
class Typed(TestCase):
def testString(self):
s = formless.String()
self.assertEquals(process(s, ''), None)
self.assertEquals(pro... |
"""
The module for psi-statistics for RBF kernel
"""
import numpy as np
from GPy.util.caching import Cacher
def psicomputations(variance, lengthscale, Z, variational_posterior):
"""
Z - MxQ
mu - NxQ
S - NxQ
gamma - NxQ
"""
# here are the "statistics" for psi0, psi1 and psi2
# Produced ... |
#!/usr/bin/env python
"""
Alternative for a shell (like Bash).
Warning: This is work in progress!
For now we use this to test which functionality/flexibility we need in
'contrib.shell'. APIs can change a lot over there...
"""
import os
from pygments.style import Style
from pygments.token import Token
from prompt_too... |
"""Default implementation of SQL comparison operations.
"""
from .. import exc, util
from . import operators
from . import type_api
from .elements import BindParameter, True_, False_, BinaryExpression, \
Null, _const_expr, _clause_element_as_expr, \
ClauseList, ColumnElement, TextClause, UnaryExpressio... |
import os, uuid, signal
import shutil
from ftplib import FTP
from wpakConfigObj import Config
from wpakFileUtils import fileUtils
# This class is used to initialize transfer queues and dispatch files to the queue
# It reads files from the global queue directory, starting from the oldest ones, and stops one all threa... |
"""Fetch list of popular user-agents.
The script is based on a gist posted by github.com/averrin, the output of this
script is formatted to be pasted into configdata.yml
"""
import requests
from lxml import html # pylint: disable=import-error
def fetch():
"""Fetch list of popular user-agents.
Return:
... |
import kvy
import constants
Z_TOP = 10
Z_BOTTOM = -10
class View(kvy.ScatterLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.layers = dict()
for z in range(Z_BOTTOM, Z_TOP + 1):
layer = SpriteLayer(z)
self.layers[z] = layer
self.screen... |
from gpiodev import GPIOHandle
import asyncio
'''
LCD7 is a device with four 7-segment LED digits to show. 7 segments
are not enough to show arbitraty letters, but it can be used as clocks
or counter.
Though there are 4x7 = 28 LED segments to switch on and off, it uses
only 12 GPIO pins. 4 pins are used to choose th... |
from rest_framework import serializers
from .models import Position
from .models import Dataset as CommentDataset
from coadd.models import Dataset
from common.models import Filter
class PositionSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.SerializerMethodField()
pst_dataset = serial... |
from datetime import datetime
from nose.tools import assert_equals
from server.timeserietable import TimeSerieTable
class TestTimeSerieTable(object):
def mock_time(self, hour, min, sec):
return datetime(2005, 7, 12, hour, min, sec)
def test_simple_insert(self):
t = TimeSerieTable(3600)
... |
from mediadrop.lib.auth.api import IPermissionPolicy
from mediadrop.lib.auth.permission_system import PermissionPolicies
from mediadrop.model import DBSession, Permission
__all__ = ['GroupBasedPermissionsPolicy']
class GroupBasedPermissionsPolicy(IPermissionPolicy):
@property
def permissions(self):
d... |
import os
import subprocess
from mercurial import util, config
from mercurial.node import hex, nullid
from mercurial.i18n import _
from common import NoRepo, commit, converter_source, checktool
class submodule(object):
def __init__(self, path, node, url):
self.path = path
self.node = node
... |
# -*- coding: utf-8 -*-
# Placed into the Public Domain by tav <<EMAIL>>
"""Validate Javascript Identifiers for use as JSON-P callback parameters."""
import re
from unicodedata import category
# ------------------------------------------------------------------------------
# javascript identifier unicode categorie... |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
from manuskript.models import references as Ref
from manuskript.functions import mainWindow
from manuskript.enums import Plot
from PyQt5.QtWidgets import QTextEdit, QLineEdit, QListView
from manuskript.ui.highlighters.searchResultHighlighters.abstractSpecificSearchResu... |
# -*- coding: utf-8 -*-
"""
Flood Alerts Module - Model
@author: Fran Boon
@see: http://eden.sahanafoundation.org/wiki/Pakistan
"""
module = "flood"
if deployment_settings.has_module(module):
# -----------------------------------------------------------------------------
# Rivers
resourcenam... |
import res_company
import account
import res_config |
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.db.models.loading import get_app
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from .models import Empty
class EmptyModelTests(TestCase):
def... |
"""Quickstart command to generate a new project.
Quickstart takes the files from gearshift.quickstart and processes them to produce
a new, ready-to-run project.
"""
import pkg_resources
import re
import os
import os.path
import shutil
import stat
import optparse
import sys
import gearshift
try:
from paste.script... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
from django.template.defaultfilters import timeuntil_filter
from django.test import SimpleTestCase
from django.test.utils import requires_tz_support
from ..utils import setup
from .timezone_utils import TimezoneTestCase
class Timeunti... |
from openerp.osv import orm, fields
from openerp.addons import decimal_precision as dp
COMPANY_FISCAL_TYPE = [
('1', 'Simples Nacional'),
('2', 'Simples Nacional – excesso de sublimite de receita bruta'),
('3', 'Regime Normal')
]
COMPANY_FISCAL_TYPE_DEFAULT = '3'
SQL_CONSTRAINTS = [
('l10n_br_tax_def... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.python.tasks.checkstyle.common import Nit, PythonFile
from pants.backend.python.tasks.checkstyle.variable_names import (PEP8VariableNames,
... |
from setuptools import setup, find_packages
setup(
name="c7n_sphere11",
version='0.1.1',
description="Cloud Custodian - Sphere11 - Resource Locking",
classifiers=[
"Topic :: System :: Systems Administration",
"Topic :: System :: Distributed Computing"
],
url="https://github.com/... |
"""
The set of functions initializing the Selenium Web Driver
for each browser we support (currently Chrome, Safari, Firefox)
"""
import subprocess
import base64
from selenium import webdriver
def chrome(webdriver_path, extension_paths=None):
options = webdriver.ChromeOptions()
# Disable any default apps in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.