content stringlengths 4 20k |
|---|
from __future__ import unicode_literals
import datetime
import decimal
import logging
import sys
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.core.urlresolvers import get_resolver
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import render, r... |
from openerp.tests.common import TransactionCase
class TestSearch(TransactionCase):
"""Tests for search on name_search (account.account)
The name search on account.account is quite complexe, make sure
we have all the correct results
"""
def setUp(self):
super(TestSearch, self).setUp()
... |
from __future__ import absolute_import, division, unicode_literals
import sys
from types import ModuleType
from pip._vendor.six import text_type
try:
import xml.etree.cElementTree as default_etree
except ImportError:
import xml.etree.ElementTree as default_etree
__all__ = ["default_etree", "MethodDispatche... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0002_auto_20151029_0516'),
]
operations = [
migrations.CreateModel(
name='Login_Sessions',
... |
import os
try:
from manageiq_client.api import ManageIQClient
HAS_CLIENT = True
except ImportError:
HAS_CLIENT = False
def manageiq_argument_spec():
options = dict(
url=dict(default=os.environ.get('MIQ_URL', None)),
username=dict(default=os.environ.get('MIQ_USERNAME', None)),
... |
""" A sparse matrix in COOrdinate or 'triplet' format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['coo_matrix', 'isspmatrix_coo']
from warnings import warn
import numpy as np
from scipy._lib.six import zip as izip
from ._sparsetools import c... |
import mock
from oslo_log import log as logging
from nova import exception
from nova import objects
from nova import test
from nova import utils
from nova.virt.libvirt.storage import rbd_utils
LOG = logging.getLogger(__name__)
CEPH_MON_DUMP = """dumped monmap epoch 1
{ "epoch": 1,
"fsid": "33630410-6d93-4d66-8e4... |
# -*- encoding: utf-8 -*-
import math
import numbers
def greatest_multiple_less_equal(m, n):
r'''Greatest integer multiple of `m` less than or equal to `n`.
::
>>> mathtools.greatest_multiple_less_equal(10, 47)
40
::
>>> for m in range(1, 10):
... print(m, mathtools... |
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.core.paginator import InvalidPage, Paginator
from django.db.models.query import QuerySet
from django.http import Http404
from django.utils import six
from django.utils.translation import ugettext as _
from djang... |
"""Stuff to parse Sun and NeXT audio files.
An audio file consists of a header followed by the data. The structure
of the header is as follows.
+---------------+
| magic word |
+---------------+
| header size |
+---------------+
| data size |
... |
# -*- coding: utf-8 -*-
'''
Created on Mar 12, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def change_realm_audit_log_event_type_tense(apps: StateApps, schema_editor: DatabaseSchemaEd... |
import unittest
import operator
import sys
import pickle
from test import support
class G:
'Sequence using __getitem__'
def __init__(self, seqn):
self.seqn = seqn
def __getitem__(self, i):
return self.seqn[i]
class I:
'Sequence using iterator protocol'
def __init__(self, seqn):
... |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="hoverlabel", parent_name="layout.scene.annotation", **kwargs
):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.other
~~~~~~~~~~~~~~~~~~~~~
Just export lexer classes previously contained in this module.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers.sql import SqlLexer, MySqlLexe... |
# encoding: utf-8
"""
Older utilities that are not being used.
WARNING: IF YOU NEED TO USE ONE OF THESE FUNCTIONS, PLEASE FIRST MOVE IT
TO ANOTHER APPROPRIATE MODULE IN IPython.utils.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development... |
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, 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.ap... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: purefa_dns
version_added: '2.8'
short_description: Configure... |
from types import FunctionType
from .. import core, importing
import sys
import os
safe_names = {}
safe_modules = None
sandy_func_list = {}
def retrive_sf(name_):
for name, obj in sandy_func_list.values():
if name == name_:
return obj
def scan(name, obj, seen, lst):
if id(obj) in seen:... |
import base64
import logging
import re
from functools import partial
from Crypto.Cipher import Blowfish
from streamlink.compat import bytes, is_py3
from streamlink.plugin import Plugin, PluginArguments, PluginArgument
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streaml... |
import argparse
import collections
import re
import subprocess
import sys
__DESCRIPTION = """
Processes a perf.data sample file and reports the hottest Ignition bytecodes,
or write an input file for flamegraph.pl.
"""
__HELP_EPILOGUE = """
examples:
# Get a flamegraph for Ignition bytecode handlers on Octane benc... |
from novaprinter import prettyPrinter
from helpers import retrieve_url, download_file
from html.parser import HTMLParser
from urllib.parse import urlencode
class torrentz(object):
# mandatory properties
url = 'https://torrentz.eu'
name = 'Torrentz'
supported_categories = {'all': ''}
trackers_list... |
from nova.api.openstack.compute.contrib import fping
from nova.api.openstack import extensions
from nova import exception
from nova import test
from nova.tests.api.openstack import fakes
import nova.utils
FAKE_UUID = fakes.FAKE_UUID
def execute(*cmd, **args):
return "".join(["%s is alive" % ip for ip in cmd[1:]... |
"""This code example runs a report that includes custom fields found in the line
items of an order. To download the report run download_report.py."""
__author__ = ('Jeff Sham',
'Vincent Tsao')
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
import spirit.urls
import get_feedback.urls
# Override admin login for security purposes
from django.... |
"""A generally useful event scheduler class.
Each instance of this class manages its own queue.
No multi-threading is implied; you are supposed to hack that
yourself, or use a single instance per application.
Each instance is parametrized with two functions, one that is
supposed to return the current time, one that i... |
"""Add Re-Opening to Reasons enum
Revision ID: ebeb3491636e
Revises: dc926c74551d
Create Date: 2018-06-12 20:01:56.529081
"""
# revision identifiers, used by Alembic.
revision = "ebeb3491636e"
down_revision = "b722969f38a6"
from alembic import op
import sqlalchemy as sa
old_options = ("closing", "denial")
new_opti... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def get_sub_array_from_array(object_array, to_match):
'''
Finds and returns a sub array from an array of arrays.
to_match should be a unique idetifier of a sub array
'''
for item in object_arra... |
major = 0
minor = 5
revision = 74
# status must be either empty string or must start with a dash
status = "-1"
assert not status or status.startswith("-"), "Status MUST start with dash if set"
version = {
"major": major,
"minor": minor,
"revision": revision,
"status": status,
}
versionString = "%(maj... |
"""Tests for PoissonLogNormalQuadratureCompoundTest."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops import poisson_lognormal
from tensorflow.contrib.distributions.python.ops import test_util
from tensorfl... |
# standard imports
# third-party imports
import numpy as np
# local imports
import pyoptools.raytrace.ray.ray as ray
import pyoptools.raytrace.ray.ray_source as ray_source
def beam_equal(beam1, beam2):
"Beams are equals i.e. each Ray in them are equal. Rays are compared in the same order in the two beams."
... |
{
"name": "Reset a chart of accounts",
"summary": ("Delete the accounting setup from an otherwise reusable "
"database"),
"version": "8.0.1.0.0",
"author": "Therp BV,Odoo Community Association (OCA)",
"category": 'Accounting & Finance',
"depends": [
'account',
],
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import re
from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector
from ansible.module_utils.facts.timeout import TimeoutError, timeout
from ansible.module_utils.facts.utils import ge... |
from south.db import db
from django.db import models
from mysite.search.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
def backwards(self, orm):
"Write your backwards migration here"
models = {
'auth.group': {
... |
from gnuradio import gr, gr_unittest, blocks
import os
import tempfile
import pmt
class test_file_descriptor_source_sink(gr_unittest.TestCase):
def setUp (self):
os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_... |
from twisted.internet import defer
class WANPPPConnectionClient:
def __init__(self, service):
self.service = service
self.namespace = service.get_type()
self.url = service.get_control_url()
self.service.subscribe()
self.service.client = self
def remove(self):
... |
import sys
from ossie.utils import sb
dsource=sb.DataSource()
dsink=sb.DataSink()
test_comp=sb.Component('Foo')
data=range(100)
dsource.connect(test_comp, providesPortName='dataShortIn')
test_comp.connect(dsink, providesPortName='shortIn', usesPortName='dataShortOut')
sb.start()
dsource.push(data)
dest_data=dsink.getD... |
"""
Solve the unique lowest-cost assignment problem using the
Hungarian algorithm (also known as Munkres algorithm).
"""
# Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux.
# Heavily refactored by Lars Buitinck.
#
# TODO: a version of this algorithm has been incorporated in SciPy; use that
#... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
import pytest
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ans... |
from pyparsing import Literal, CaselessLiteral, Word, upcaseTokens, delimitedList, Optional, \
Combine, Group, alphas, nums, alphanums, ParseException, Forward, oneOf, quotedString, \
ZeroOrMore, restOfLine, Keyword
def test( str ):
print str,"->"
try:
tokens = simpleSQL.parseString( str )
... |
from OpenSSL import SSL
import sys
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import LineReceiver
from twisted.internet import ssl, reactor
class EchoClient(LineReceiver):
end="Bye-bye!"
def connectionMade(self):
self.sendLine("Hello, world!")
self.sendLi... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_flort_dj_cspp
@file marine-integrations/mi/dataset/parser/test/test_flort_dj_cspp.py
@author Jeremy Amundson
@brief Test code for a flort_dj_cspp data parser
"""
import os
import numpy
import yaml
from nose.plugins.attrib import attr
fr... |
import arcpy,sys,os,datetime
# {{{ HANDLE PARAMETERS
paramWorkspace = arcpy.GetParameterAsText(0)
paramOutFile = arcpy.GetParameterAsText(1)
paramWildcard = arcpy.GetParameterAsText(2)
if len(paramWorkspace) == 0:
paramWorkspace = arcpy.env.workspace
if not os.path.isdir(paramWorkspace):
arcpy.AddError("Input param... |
# $Id: 9efdb91769a07b38061d1041ac0486b77f362738 $
"""
Oracle extended database driver.
"""
__docformat__ = "restructuredtext en"
# ---------------------------------------------------------------------------
# Imports
# ---------------------------------------------------------------------------
import os
import sys
... |
# coding: utf-8
from __future__ import unicode_literals
import datetime
from .common import InfoExtractor
class NerdCubedFeedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nerdcubed\.co\.uk/feed\.json'
_TEST = {
'url': 'http://www.nerdcubed.co.uk/feed.json',
'info_dict': {
... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import randomRange
from lib.core.data import kb
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOW
def tamper(payload, **kwargs)... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import sys
from xml.dom import minidom
from swid_generator.command_manager import CommandManager as CM
from swid_generator.generators.utils import create_temp_folder
def sign_xml(data, signature_args):
fold... |
"""This module is reponsible for creating a layout
of plots as a 2D axes and handling corener cases
and deleting empty plots
"""
from trappy.plotter import AttrConf
import uuid
import json
import os
from IPython.display import display, HTML
if not AttrConf.PLOTTER_IPYTHON:
raise ImportError("No Ipython Environme... |
#!/usr/bin/env python
"""Tile search using random placement and evaluation. Works surprisingly well.
--------------------------------------------------------------------
This program is licensed under the GNU General Public License (GPL)
Version 3. See http://www.fsf.org for details of the license.
Rugged Circuits L... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... |
import click
from matplotlib.style import available
from readtagger.plot_coverage import plot_coverage_in_regions
from readtagger import VERSION
@click.command('Plot relative coverage for alignment files.')
@click.option('-f',
'--file',
type=(str, str, int),
multiple=True,
... |
"""
Prompt_toolkit is designed a way that the amount of changing state is reduced
to a minimum. Where possible, code is written in a pure functional way. In
general, this results in code where the flow is very easy to follow: the value
of a variable can be deducted from its first assignment.
However, often, practicali... |
"""Tests for contrib.resampler.python.ops.resampler_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.contrib import resampler
from tensorflow.python.... |
"""Ops and modules related to RPC.
@@rpc
@@try_rpc
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.rpc.python.ops.rpc_op import rpc
from tensorflow.contrib.rpc.python.ops.rpc_op import try_rpc
from tensorflow.python.util.all_uti... |
from functools import partial
import contextlib
import inspect
import operator
import warnings
import numpy as np
import pandas as pd
from . import npcompat
from .pycompat import PY3, range, dask_array_type
from .nputils import (
nanfirst, nanlast, interleaved_concat as _interleaved_concat_numpy,
array_eq, ar... |
import argparse
import ast
import os
import sys
from collections import OrderedDict
from distutils.spawn import find_executable
import config
import wpttest
def abs_path(path):
return os.path.abspath(os.path.expanduser(path))
def url_or_path(path):
import urlparse
parsed = urlparse.urlparse(path)
... |
__author__ = 'Joseph'
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self._browser = webdriver.Firefox()
self._browser.implicitly_wait(3)
def tearDown(self):
self._browser.quit()
def test_can_read_faq_and_documentation(se... |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
from guardian.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'GroupObjectPermission.object_id'
db.delete_column('guardian_groupobjectpermission', 'object_id... |
"""
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... |
#!/usr/bin/env python
# (Supposedly allows execution without python keyword)
__author__ = "whitehaven"
import sys
import argparse
from random import shuffle
from array import array
ALPHABET_LENGTH = 26
HALF_ALPHABET_LENGTH = int(ALPHABET_LENGTH / 2)
BLOCK_LENGTH = 8
# pre-generate random list of chars to avoid usin... |
import eventlet
eventlet.monkey_patch()
import argparse
import collections
import datetime
import logging
import os
import random
import string
import sys
import threading
import time
import yaml
from scipy.stats import rv_discrete
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging im... |
from sqlalchemy.sql import func
# from brainminer.base.exceptions import ModelNotFoundException
# ----------------------------------------------------------------------------------------------------------------------
class BaseDao(object):
def __init__(self, obj_class, db_session):
self.obj_class = o... |
#!/usr/bin/python3
# requirements: disk /dev/sdb with six empty and unused partitions (sdb1-sdb6)
from sys import exit
from storage import *
from storageitu import *
set_logger(get_logfile_logger())
environment = Environment(False)
storage = Storage(environment)
storage.probe()
staging = storage.get_staging()
... |
from oslo_log import log as logging
from tempest.common import waiters
from tempest import config
from tempest.scenario import manager
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
class BaremetalBasicOps(manager.BaremetalScenarioTest):
"""
This smoke test tests the pxe_ssh ... |
"""WebSubmit Admin Regression Test Suite."""
__revision__ = "$Id$"
from invenio.testsuite import InvenioTestCase
from invenio.base.globals import cfg
from invenio.base.wrappers import lazy_import
from invenio.testsuite import make_test_suite, run_test_suite, \
test_web_page_content, merge_error_messages
dump_s... |
"""Built-in loss functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.utils.generic_utils import deserialize_keras_object
from tensorflow.python.keras.utils.g... |
"""Tools for use in AppleEvent clients and servers.
pack(x) converts a Python object to an AEDesc object
unpack(desc) does the reverse
packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record
unpackevent(event) returns the parameters and attributes from an AEAppleEvent record
Plus... ... |
import six.moves.urllib.parse as urlparse
import mock
from nova import exception
from nova.image.download import file as tm_file
from nova import test
class TestFileTransferModule(test.NoDBTestCase):
@mock.patch('nova.virt.libvirt.utils.copy_image')
def test_filesystem_success(self, copy_mock):
sel... |
# -*- coding: utf-8 -*-
import gettext as gettext_module
import os
import shutil
import stat
import unittest
from django.core.management import (
CommandError, call_command, execute_from_command_line,
)
from django.core.management.utils import find_command
from django.test import SimpleTestCase, override_settings... |
import django
django.setup()
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
import logging
from dateutil.parser import parse
from datetime import datetime, timedelta
from django.utils import timezone
from osf.models import AbstractNode, Preprint
from website.app import init_... |
"""This module provides a common interface for all HTTP requests.
HttpResponse: Represents the server's response to an HTTP request. Provides
an interface identical to httplib.HTTPResponse which is the response
expected from higher level classes which use HttpClient.request.
GenericHttpClient: Provide... |
"""
This module provides classes to interface with the Crystallography Open
Database. If you use data from the COD, please cite the following works (as
stipulated by the COD developers)::
Merkys, A., Vaitkus, A., Butkus, J., Okulič-Kazarinas, M., Kairys, V. &
Gražulis, S. (2016) "COD::CIF::Parser: an error-cor... |
#!/usr/bin/env python
#! -*- encoding:utf-8
import sys
import json
import fetch
import sqlite3
import pinyin
import argparse
import requests_cache
from pdb import set_trace as bp
from model import *
from fetch import *
args = None
class Printer:
def __init__(self, dump):
self.dump = dump
def provi... |
import datetime
import unittest
from airflow import DAG, configuration
from airflow.contrib.sensors.wasb_sensor import WasbBlobSensor
from airflow.contrib.sensors.wasb_sensor import WasbPrefixSensor
try:
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
moc... |
from django.contrib import messages
from django.test import RequestFactory, SimpleTestCase
class DummyStorage:
"""
dummy message-store to test the api methods
"""
def __init__(self):
self.store = []
def add(self, level, message, extra_tags=''):
self.store.append(message)
class ... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary... |
"""
Tests of Connect with sliced spatial populations.
"""
import unittest
import nest
import numpy as np
import numpy.testing as np_testing
nest.set_verbosity('M_ERROR')
class ConnectSlicedSpatialTestCase(unittest.TestCase):
N = 21
middle_node = N//2
free_pos = nest.spatial.free([[x, 0.] for x in np.lin... |
from __future__ import unicode_literals
import os
import re
import fnmatch
from pipeline.storage import default_storage
__all__ = ["glob", "iglob"]
def glob(pathname):
"""Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
"""
ret... |
"""
Middleware for theming app
Note:
This middleware depends on "django_sites_extensions" app
So it must be added to INSTALLED_APPS in django settings files.
"""
from django.conf import settings
from .models import SiteTheme
from .views import get_user_preview_site_theme
class CurrentSiteThemeMiddleware(obj... |
#!/usr/bin/env python
# Generates random shapefile which may be used for benchmarks
import os
import sys
import random
import string
import math
from osgeo import ogr
from optparse import OptionParser
def error(msg):
print(msg)
sys.exit(1)
parser = OptionParser("usage: %prog [options] output")
parser.add_... |
'''This file generates shell code for the setup.SHELL scripts to set environment variables'''
from __future__ import print_function
import argparse
import copy
import errno
import os
import platform
import sys
CATKIN_MARKER_FILE = '.catkin'
system = platform.system()
IS_DARWIN = (system == 'Darwin')
IS_WINDOWS = (sy... |
from quantum.api import extensions
from quantum.api.v2 import attributes
from quantum.openstack.common import log as logging
LOG = logging.getLogger(__name__)
FLAVOR_NETWORK = 'flavor:network'
FLAVOR_ROUTER = 'flavor:router'
FLAVOR_ATTRIBUTE = {
'networks': {
FLAVOR_NETWORK: {'allow_post': True,
... |
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from Map.models import Map
from django.template.response import TemplateResponse
# Create your views here.
@login_required()
def home_view(request):
"""The home view detects whether a user has a default map and ... |
import datetime
import json
import os
import psycopg2 as dbapi2
import re
from flask import Flask
from flask import redirect
from flask import render_template
from flask.helpers import url_for
app = Flask(__name__)
def get_elephantsql_dsn(vcap_services):
"""Returns the data source name for ElephantSQL."""
... |
import socket
import threading
import core.responder.settings as settings
import core.responder.fingerprint as fingerprint
from core.responder.packets import NBT_Ans
from SocketServer import BaseRequestHandler, ThreadingMixIn, UDPServer
from core.responder.utils import *
def start():
try:
server = ThreadingUDPServ... |
data = (
'[?]', # 0x00
'k', # 0x01
'kh', # 0x02
'kh', # 0x03
'kh', # 0x04
'kh', # 0x05
'kh', # 0x06
'ng', # 0x07
'cch', # 0x08
'ch', # 0x09
'ch', # 0x0a
'ch', # 0x0b
'ch', # 0x0c
'y', # 0x0d
'd', # 0x0e
't', # 0x0f
'th', # 0x10
'th', # 0x11
'th', # 0x12
'n', #... |
privilege_table = {"authority": ["register", "remove", "update", "resolve", "list", "getcredential", "*"],
"refresh": ["remove", "update"],
"resolve": ["resolve", "list", "getcredential"],
"sa": ["getticket", "redeemslice", "redeemticket", "createslice", "creates... |
from m5.params import *
from System import System
class ArmMachineType(Enum):
map = {'RealView_EB' : 827,
'RealView_PBX' : 1901,
'VExpress_ELT' : 2272,
'VExpress_CA9' : 2272,
'VExpress_EMM' : 2272,
'VExpress_EMM64' : 2272}
class ArmSystem(System):
type =... |
"""Models for storing the classification data models."""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
import datetime
from core.platform import models
import feconf
import python_utils
import utils
from g... |
from operator import attrgetter
from django.test import TestCase
from models import Person
class RecursiveM2MTests(TestCase):
def test_recursive_m2m(self):
a, b, c, d = [
Person.objects.create(name=name)
for name in ["Anne", "Bill", "Chuck", "David"]
]
# ... |
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) |
import logging
import time
def internal_yum_update(session, command, prompt, timeout):
"""
Helper function to perform the yum update test.
:param session: shell session stablished to the host
:param command: Command to be sent to the shell session
:param prompt: Machine prompt
:param timeout:... |
from __future__ import unicode_literals
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import logging
from oauthlib.common import add_params_to_uri
from oauthlib.common import urldecode as _urldecode
from oauthlib.oauth1 import (
SIGNATURE_HMAC, SIGNATURE_RSA, SI... |
# -*- coding: utf-8 -*-
"""
pygments.styles.paraiso_dark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paraíso (Dark) by Jan T. Sott
Pygments template by Jan T. Sott (https://github.com/idleberg)
Created with Base16 Builder by Chris Kempson
(https://github.com/chriskempson/base16-builder).
:copyright: Cop... |
"""Build script to generate a new sdk_tools bundle.
This script packages the files necessary to generate the SDK updater -- the
tool users run to download new bundles, update existing bundles, etc.
"""
import buildbot_common
import build_version
import glob
import optparse
import os
import sys
SCRIPT_DIR = os.path.d... |
"""
The :mod:`sklearn.linear_model` module implements generalized linear models. It
includes Ridge regression, Bayesian Regression, Lasso and Elastic Net
estimators computed with Least Angle Regression and coordinate descent. It also
implements Stochastic Gradient Descent related algorithms.
"""
# See http://scikit-le... |
from openerp import models, fields, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.multi
def onchange_requested_date(self, requested_date, commitment_date):
"""Warn if the requested dates is sooner than the commitment date"""
result = super(SaleOrder, self).onchange_reque... |
"""
MySQL implementation of the database manager interface
"""
import logging
import MySQLdb
from autotest.installation_support.database_manager import base
class MySQLDatabaseManager(base.BaseDatabaseManager):
'''
Class that manages MySQL database instances
'''
def __init__(self, name, admin=Non... |
from gnuradio import gr, filter
from gnuradio import blocks
import sys
try:
from gnuradio import qtgui
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n")
sys.exit(1)
try:
from gnuradio import analog
except ImportErro... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.che... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.