content stringlengths 4 20k |
|---|
import logging
from collections import namedtuple
from . import export
log = logging.getLogger(__name__)
NO_QUERY = 0
PARSED_QUERY = 1
RAW_QUERY = 2
SpecialCommand = namedtuple('SpecialCommand',
['handler', 'command', 'shortcut', 'description', 'arg_type', 'hidden',
'case_sensitive'])
COMMANDS ... |
__version__ = "0.1"
import ImageFile, ImagePalette
def i16(c):
return ord(c[1]) + (ord(c[0])<<8)
##
# Image plugin for the GD uncompressed format. Note that this format
# is not supported by the standard <b>Image.open</b> function. To use
# this plugin, you have to import the <b>GdImageFile</b> module and
# us... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from agent.models import Agent, AgentProfile
from agent.forms import AgentProfileForm
from agent.admin_filters import ManagerFilter
class AgentProfileInline(admin.StackedInline):
model = AgentProfile
form = AgentProfileForm
cla... |
from profile_creators import profile_safe_url_list
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
class ProfileSafeUrlPage(page_module.Page):
def __init__(self, url, page_set):
super(ProfileSafeUrlPage, self).__init__(
url=url,
... |
# -*- coding: utf-8 -*-
"""
jinja2.debug
~~~~~~~~~~~~
Implements the debug interface for Jinja. This module does some pretty
ugly stuff with the Python traceback system in order to achieve tracebacks
with correct line numbers, locals and contents.
:copyright: (c) 2010 by the Jinja Team.
:... |
"""Tests for distutils.command.install_scripts."""
import os
import unittest
from distutils.command.install_scripts import install_scripts
from distutils.core import Distribution
from distutils.tests import support
from test.support import run_unittest
class InstallScriptsTestCase(support.TempdirManager,
... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Sample', fields ['name']
db.delete_uniqu... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
from ansible.module_utils.facts.virtual.base import Virtual, VirtualCollector
class HPUXVirtual(Virtual):
"""
This is a HP-UX specific subclass of Virtual. It defines
- virtualization_type
- v... |
# -*- coding: utf-8 -*-
from django.test import TestCase, Client
from should_dsl import should
from core.tests.format_test import FormatTest
from sys import stderr
from core.tests.db_mock import DatabaseMock
import re #Regular expressions
class TestViews(FormatTest, TestCase):
def setUp(self):
self.m... |
"""
Test dashboard search
"""
import os
import json
from bok_choy.web_app_test import WebAppTest
from common.test.acceptance.tests.helpers import generate_course_key
from common.test.acceptance.pages.common.logout import LogoutPage
from common.test.acceptance.pages.common.utils import click_css
from common.test.accept... |
from tempest.api.compute import base
from tempest import test
class ServerAddressesTestJSON(base.BaseV2ComputeTest):
@classmethod
def resource_setup(cls):
# This test module might use a network and a subnet
cls.set_network_resources(network=True, subnet=True)
super(ServerAddressesTest... |
import logging
from django.conf import settings
from rest_framework import generics, permissions
from rest_framework.reverse import reverse
from rest_framework.response import Response
from collectionjson import services
from core.renderers import BinaryFileRenderer
from core.swiftmanager import SwiftManager
from .m... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
qualities,
)
class Revision3EmbedIE(InfoExtractor):
IE_NAME = 'revision3:embed'
_VALID_URL = r'(... |
#! /usr/bin/env python
import os
import re
import sys
import time
import random
import getopt
import logging
import tempfile
import subprocess
import shutil
# This script runs and kills db_stress multiple times. It checks consistency
# in case of unsafe crashes in RocksDB.
def main(argv):
try:
opts, args ... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.jsrouting
~~~~~~~~~~~~~~~~~~~~~~~~~~
Addon module that allows to create a JavaScript function from a map
that generates rules.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
... |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import ugett... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import syslog
from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.basic import *
class EjabberdUserException(Exception):
""" Base exception fo... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'VerificationStatus.location_id'
db.add_column('verify_stu... |
import mock
from heat.engine.resources.openstack.keystone import role
from heat.engine import stack
from heat.engine import template
from heat.tests import common
from heat.tests import utils
keystone_role_template = {
'heat_template_version': '2013-05-23',
'resources': {
'test_role': {
't... |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 (at your option) any la... |
""" This file implements linking semantics common to all unixes. On unix, static
libraries must be specified in a fixed order on the linker command line. Generators
declared there store information about the order and use it properly.
"""
import builtin
from b2.build import generators, type
from b2.util.utilit... |
import volatility.utils as utils
import volatility.obj as obj
import volatility.plugins.common as common
import volatility.debug as debug
import volatility.win32.tasks as tasks
import volatility.win32.modules as modules
try:
import distorm3
has_distorm = True
except ImportError:
has_distorm = False
class ... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import int_or_none
class MGTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mgtv\.com/v/(?:[^/]+/)*(?P<id>\d+)\.html'
IE_DESC = '芒果TV'
_TESTS = [{
'url': 'http://www.mgtv.com/v/1/290525/f... |
from hachoir_core.field import FieldSet, UserVector, UInt8
class RGB(FieldSet):
color_name = {
( 0, 0, 0): "Black",
(255, 0, 0): "Red",
( 0, 255, 0): "Green",
( 0, 0, 255): "Blue",
(255, 255, 255): "White",
}
static_size = 24
def createFields(self... |
import os
import sys
from celery import task
from celery.result import AsyncResult
from django.core.files.uploadedfile import (InMemoryUploadedFile,
TemporaryUploadedFile)
from django.utils.datastructures import MultiValueDict
from io import BytesIO
from onadata.apps.api impo... |
import re
import codecs
def parse(text):
stack = [[]]
state = 'list'
i = 0
line = 1
column = 0
while i < len(text):
c = text[i]
if c == '\n':
line += 1
column = 0
else:
column += 1
if state == 'list':
if c == '(':
... |
from quantum import context as quantum_context
from quantum import manager
from quantum.openstack.common import jsonutils
from quantum.openstack.common import log as logging
LOG = logging.getLogger(__name__)
class L3RpcCallbackMixin(object):
"""A mix-in that enable L3 agent rpc support in plugin implementations... |
"""DOI field."""
from invenio.modules.deposit.field_base import WebDepositField
from wtforms import StringField
from ..filter_utils import strip_prefixes, strip_string
from ..processor_utils import datacite_lookup
from ..validation_utils import DOISyntaxValidator
__all__ = ['DOIField']
def missing_doi_warning(dum... |
from django.test import TestCase
from django.contrib.auth.models import User, Group
from yacon.models.groupsq import GroupOfGroups, OwnedGroupOfGroups
# ============================================================================
class GroupOfGroupsTests(TestCase):
def _user(self, username, email, password):
... |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... |
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
from Ui_searchwidget import Ui_Form as UI_SearchWidget
from Ui_searchreplacewidget import Ui_Form as UI_SearchReplaceWidget
from Ui_gotolinewidget import Ui_Form as UI_GotoLineWidget
class GotoLineWidget(QtGui.QWidget):
def __init__(self, editor):
Q... |
"""SCons.Tool.lex
Tool-specific initialization for lex.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foun... |
2#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
#
# Copyright: (c) Administrator 2011
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python
class Gol02:
... |
import os
from checkbox.plugin import Plugin
from checkbox.properties import String
from checkbox.variables import get_variables
class EnvironmentInfo(Plugin):
routers = String(default="single")
router_ssid = String(default="")
router_psk = String(default="")
wpa_bg_ssid = String(default="")
wp... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
determine_ext,
ExtractorError,
float_or_none,
parse_duration,
unified_strdate,
)
class NRKIE(InfoExtractor):
_VALID_URL = r'(?:nrk:... |
"""test sparse matrix construction functions"""
from __future__ import division, print_function, absolute_import
from numpy.testing import assert_equal
from scipy.sparse import csr_matrix
import numpy as np
from scipy.sparse import extract
class TestExtract(object):
def setup_method(self):
self.cases =... |
"""Tests for basic building blocks used in eager mode RevNet."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gc
import time
import tensorflow as tf
from tensorflow.contrib.eager.python.examples.revnet import blocks_test
from tensorflow.contrib.e... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OpenScriptFromFileAction.py
---------------------
Date : May 2018
Copyright : (C) 2018 by Mathieu Pellerin
Email : nirvn dot asia at gmail dot com
******... |
import unittest
import logging
import struct
from struct import *
from nose.tools import *
from nose.plugins.skip import Skip, SkipTest
from ryu.ofproto import ether, inet
from ryu.lib.packet.packet import Packet
from ryu.lib.packet.udp import udp
from ryu.lib.packet.ipv4 import ipv4
from ryu.lib.packet import packet_u... |
from django.db import models
from thing.models.item import Item
from thing.models.region import Region
class PriceHistory(models.Model):
"""Historical item price data"""
region = models.ForeignKey(Region)
item = models.ForeignKey(Item)
date = models.DateField()
minimum = models.DecimalField(max_... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class InaIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?ina\.fr/video/(?P<id>I?[A-Z0-9]+)'
_TEST = {
'url': 'http://www.ina.fr/video/I12055569/francois-hollande-je-crois-que-c-est-clair-video.ht... |
MUTATION_TYPES = ["-", "+", "."]
class MutationsAtSinglePosition(object):
def __init__(self, chrom, pos, cov, ref=None):
self.snvs = {}
self.deletions = {}
self.insertions = {}
self.chrom = chrom
self.pos = pos
self.cov = cov
if ref:
self.ref = r... |
import base64
import re
import six
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def _get_path_validator_regex():
# rfc3986 path validator regex from
# http://jmrware.com/articles/2009/uri_regexp/URI_regex.html
pchar... |
import os
import re
import shutil
import tempfile
source_code_dir = os.path.dirname(__file__)
def copytree(src, dst):
shutil.copytree(src, dst, ignore=shutil.ignore_patterns('__pycache__'))
class POFileAssertionMixin:
def _assertPoKeyword(self, keyword, expected_value, haystack, use_quotes=True):
... |
"""
Support for Homematic switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.homematic/
"""
import logging
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import STATE_UNKNOWN
import homeassistant.components... |
# Create your views here.i
from django.template import Context, loader
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.conf import settings
from connect.models import AGroup,AThing
from django.http im... |
import os
import signal
import subprocess
import sys
import time
def _IsLinux():
"""Return True if on Linux; else False."""
return sys.platform.startswith('linux')
class Xvfb(object):
"""Class to start and stop Xvfb if relevant. Nop if not Linux."""
def __init__(self):
self._pid = 0
def Start(self)... |
# -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
from base64 import b64encode
from .compat import urlparse, str
from .cookies import extract_cookies_to_jar
from .utils import parse_dict_header, ... |
# -*- encoding: utf8 -*-
from setuptools import setup, find_packages
from setuptools.command.test import test
from sorl import __version__, __author__, __maintainer__, __email__, __license__
class TestCommand(test):
def run(self):
from tests.runtests import runtests
runtests()
setup(
name=... |
import datetime
import logging
import shutil
import os
import re
def create_path(*args, **kwargs):
"""
Construct a path. You can access dt or datetime as objects.
:param args: path components passed to :py:func:`os.path.join`
:param absolute: make path absolute
:param dt: datetime object
:pa... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from razlad.functions import f_probability, max_probabil
import pickle
# Формирвоание скачков
# Характеристики скачков
graph_len... |
# -*- coding: utf-8 -*-
# pylint: disable=E1103,C0103
"""
Copyright 2012-2014 Olivier Cortès <<EMAIL>>
This file is part of the 1flow project.
1flow 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... |
import time
# from os.path import abspath, dirname
from selenium import webdriver
from fetchone.models import GovDetail, DetailLink, ListinLink
# from selenium.webdriver.common.keys import Keys
# driver = webdriver.Firefox()
# chrome_driver_path = abspath(dirname(dirname(__file__))) + "/chromedriver"
class ScrapeIn... |
"""Common TFGAN summaries."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.eval.python import eval_utils
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops... |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.contrib.sites import models
from django.contrib.sites.management import create_default_site
from django.contrib.sites.middleware import CurrentSiteMiddleware
from django.contrib.sites.models import Site, c... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'PageModeratorState'
db.delete_table(u'cms_pagemoderator... |
# coding: utf-8
"""Compatibility tricks for Python 3. Mainly to do with unicode."""
import __builtin__
import functools
import sys
import re
import types
from .encoding import DEFAULT_ENCODING
orig_open = open
def no_code(x, encoding=None):
return x
def decode(s, encoding=None):
encoding = encoding or DEFAU... |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from nose.tools import assert_false, assert_equal, assert_regexp_matches
from common import type_in_codemirror, press_the_notification_button, get_codemirror_value
KEY_CSS = '.key h3.title'
DISPLAY_NAME_KEY = "C... |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.endpoints.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
from __future__ import absolute_import, unicode_literals
import time
from oauthlib.common import... |
__author__ = 'Benjamin S. Murphy'
__version__ = '1.4.0'
__doc__ = """
PyKrige
=======
Code by Benjamin S. Murphy and the PyKrige Developers
<EMAIL>
Summary
-------
Kriging toolkit for Python.
ok: Contains class OrdinaryKriging, which is a convenience class for easy
access to 2D ordinary kriging.
u... |
"""
This module contains a Google Cloud Bigtable Hook.
"""
from typing import Dict, List, Optional
from google.cloud.bigtable import Client
from google.cloud.bigtable.cluster import Cluster
from google.cloud.bigtable.column_family import ColumnFamily, GarbageCollectionRule
from google.cloud.bigtable.instance import In... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
xpath_text,
qualities,
)
class PladformIE(InfoExtractor):
_VALID_URL = r'''(?x)
https?://
(?:
... |
"""
First run the following in a mongo shell:
db.getCollection('addondataversenodesettings').update({'user_settings': {'$type': 2}}, {$rename: { user_settings: 'foreign_user_settings'}}, {multi: true})
Then change the user_settings field of AddonDataverseNodeSettings to foreign_user_settings
"""
import sys
impor... |
aes_s_box_table = bytes((
0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,... |
import socket
import threading
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers import basehttp
from django.test.testcases import TransactionTestCase
from django.core.management import call_command
class StoppableWSGIServer(basehttp.WSGIServer):
"""WSGIServer with short timeout, so that ... |
from datetime import datetime
from pprint import pprint
from sqlalchemy import *
from migrate import *
import migrate.changeset
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
user_table = Table('user', meta,
Column('id', Integer, primary_key=True),
Column('user_nam... |
'''Makes a file available as a JS variable with the name:
__resource_(input file base name)'''
import json
import os
import re
import sys
def makejsresource(input_path, output_path):
input = open(input_path)
data = input.read()
input.close()
if os.path.exists(output_path):
raise Exception('... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context)
self.localcontext... |
"""
function to parse data from *.record files, created using Apollo-Auto
current implementation illustrates sample record file parsing for
* radar (Continental ars-408)
* camera (Leopard Imaging 6mm)
* lidar (Velodyne vls-128)
* saves extracted images in separate folder using *.jpg format
* saves radar and lidar dat... |
from __future__ import print_function, division
import pickle
import sys
import os
# Compute precision, recall, F-score and specificity.
folder = 'eval/pr_points'
# Used by Table 5 and Fig. 2.
expriments = {
# Results in Table 5.
'basic': [
('baseline', '{}.pk'),
('DPFreq', '{}_mindepfreq_5.... |
#!/usr/bin/env python
'''
Created on 2011-08-12
@author: <EMAIL>
'''
import os, re, sys, traceback
from zabbix_api import ZabbixAPI, ZabbixAPIException
# options
server = "http://127.0.0.1/zabbix"
username = "admin"
password = "zabbix"
hostname = "Zabbix Server"
ejabberd_hrl = os.path.join(os.pa... |
'''
Apache Libcloud generic external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
Cloud providers using the Apache libcloud library.
This script also assumes there is a libcloud.ini file alongside it
'''
import sys
import os
import argpa... |
# -*- coding: utf-8 -*-
r"""
Utilities for downloadable items
================================
"""
# License: 3-clause BSD
from __future__ import absolute_import, division, print_function
import os
import zipfile
CODE_DOWNLOAD = """
\n.. container:: sphx-glr-download
:download:`Download Python source code: {0}... |
"""
A set of HTML generator tags for building HTML documents.
Usage::
>>> from lxml.html.builder import *
>>> html = HTML(
... HEAD( TITLE("Hello World") ),
... BODY( CLASS("main"),
... H1("Hello World !")
... )
... )
>>> import... |
import os
import errno
from backends import get_backend, get_all_backends
from Config import Config
from Printer import get_printer
from Utils import get_document_paths_from_dir, get_skipped_tests
class TestReferences:
def __init__(self, docsdir, refsdir):
self._docsdir = docsdir
self._refsdir = r... |
from .base_signer import BaseSigner
import base64
import hashlib
import hmac
import re
class V1Signer(BaseSigner):
def __init__(self, digest):
"""Initializes a V1Signer object.
Keyword arguments:
digest -- A callable which, when called, returns a hasher object.
For example (a... |
"""
Module that provides a connection to the ModuleStore specified in the django settings.
Passes settings.MODULESTORE as kwargs to MongoModuleStore
"""
from __future__ import absolute_import
from importlib import import_module
from django.conf import settings
if not settings.configured:
settings.configure()
fro... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
)
class YouJizzIE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.)?youjizz\.com/videos/[^/#?]+-(?P<id>[0-9]+)\.html(?:$|[?#])'
_TEST = {
'url': 'http://www.youjizz.com/video... |
"""
test Daeso Dutch command line scripts
"""
# If tests fail, make sure to manually kill server processes!
# Assumes that all executables are in PATH
import pprint
import socket
import subprocess
import time
import unittest
import xmlrpclib
class Test_graph_align_server(unittest.TestCase):
def setUp(self):... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pygithub3.core import json
from pygithub3.exceptions import NotFound, BadRequest, UnprocessableEntity
class GithubError(object):
""" Handler for API errors """
def __init__(self, response):
self.response = response
self.status_code = respo... |
"""Multivariate Normal distribution classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops import distribution_util
from tensorflow.contrib.distributions.python.ops import mvn_linear_operator as mvn_lino... |
import six
class RpcError(Exception):
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, self)
class RpcRequestError(RpcError):
def __init__(self, request, *args, **kwargs):
self.request = request
super(RpcError, self).__init__(*args, **kwargs)
class Timeout(RpcReque... |
#! /usr/bin/env python
"""
This script adds a license file to a DMG. Requires Xcode and a plain ascii text
license file.
Obviously only runs on a Mac.
Copyright (C) 2011 Jared Hobbs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "S... |
def legacy_data(project):
"""
Check if legacy data has a name and value.
:param project: Project object
:return: All checks passed boolean, [Check results]
"""
checks = []
all_checks_passed = True
for ld in project.legacy_data.all():
if not ld.name:
all_checks_passe... |
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.http import Http404, HttpResponseRedirect
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db impor... |
# -*- coding: utf-8 -*-
from sqlalchemy import func
from sqlalchemy.sql.expression import cast
from geoalchemy2.elements import WKTElement
from geoalchemy2.types import Geometry, Geography
from geoalchemy2.shape import to_shape
from skylines.database import db
from skylines.lib.geo import geographic_distance
class ... |
from __future__ import unicode_literals
from operator import attrgetter
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
from django.db import models
from django.db.models import Count
from django.test import TestCase, override_settings
from .mod... |
import json, urllib, urllib2
from urllib2 import Request, urlopen, HTTPError
kern_version = None
def plugin_init(kernel_target, config, lldb_obj, isConnected):
""" initialize the common data as required by plugin """
global kern_version
kern_version = str(kernel_target.version)
def plugin_execute(command_... |
from node import bin, hex, nullid
from i18n import _
import util, error, revlog, encoding
_defaultextra = {'branch': 'default'}
def _string_escape(text):
"""
>>> d = {'nl': chr(10), 'bs': chr(92), 'cr': chr(13), 'nul': chr(0)}
>>> s = "ab%(nl)scd%(bs)s%(bs)sn%(nul)sab%(cr)scd%(bs)s%(nl)s" % d
>>> s
... |
from oslo_config import cfg
from nova.scheduler import filters
isolated_opts = [
cfg.ListOpt('isolated_images',
default=[],
help='Images to run on isolated host'),
cfg.ListOpt('isolated_hosts',
default=[],
help='Host reserved for specific images'... |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.views.generic import RedirectView
from . import views
from .models import Article, DateArticle
date_based_info_dict = {
'queryset': Article.objects.all(),
'date_field': 'date_created',
'month_format': '%m',
}
... |
import os
import argparse
import sys
from lib.channelunits import createChannelUnitJSONFile
from tools.topometrics.topometrics import visitTopoMetrics
def runSingleVisit(visitID, visitFolder, visitOutputFolder, workbenchDB, bVerbose):
xmlFile = os.path.join(visitOutputFolder, "topometrics.xml")
logFile = os.p... |
'''
UART test for the CC3200 based boards.
UART0 and UART1 must be connected together for this test to pass.
'''
from machine import UART
from machine import Pin
import os
import time
mch = os.uname().machine
if 'LaunchPad' in mch:
uart_id_range = range(0, 2)
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import certificates.models
import model_utils.fields
import xmodule_django.models
import django_extensions.db.fields
import django_extensions.db.fields.json
import django.db.models.deletion
import django.utils.time... |
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from .filepost import encode_multipart_formdata
__all__ = ['RequestMethods']
class RequestMethods(object):
"""
Convenience mixin for classes who implement a :meth:`urlopen` method, such
as :class:`~urllib3.... |
import urllib
import urlparse
from django.http import HttpResponseRedirect
from mobiclicks import conf
from mobiclicks.tasks import confirm_click
class MobiClicksMiddleware(object):
'''
If a request is redirected from MobiClicks,
stores the acquisition code in the session
so that conversions can be ... |
from django.core.exceptions import ValidationError
def clean_ipv6_address(ip_str, unpack_ipv4=False,
error_message="This is not a valid IPv6 address"):
"""
Cleans a IPv6 address string.
Validity is checked by calling is_valid_ipv6_address() - if an
invalid address is passed, ValidationError is... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
import os
from fnmatch import fnmatch
from copy import deepcopy
from ansible.module... |
from .iq_picture import PictureIqProtocolEntity
from yowsup.structs import ProtocolTreeNode
class ResultGetPictureIqProtocolEntity(PictureIqProtocolEntity):
'''
<iq type="result" from="{{jid}}" id="{{id}}">
<picture type="image | preview" id="{{another_id}}">
{{Binary bytes of the picture.}}
... |
import logging
import base64
import time
import re
from datetime import datetime
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def find_exe(paste,raw):
""" decode the base64 encoded paste and return """
signature = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.