content stringlengths 4 20k |
|---|
# -----------------------------------------------------------------------------
# yacc_badargs.py
#
# Rules with wrong # args
# -----------------------------------------------------------------------------
import sys
sys.tracebacklimit = 0
sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
# P... |
"""
model_b.py
by Ted Morin
contains a function to predict 10-year Coronary Heart Disease risks using model from
10.1161/CIRCULATIONAHA.107.699579
General Cardiovascular Risk Profile for Use in Primary Care
Framingham Heart Study
function expects parameters of
"ismale" "antihypertensive medication use" "age" "total c... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.executor.play_iterator import PlayIterator
from ansible.playbook import Playbook
from ansible.playbook.play_context import PlayContext
... |
"""
Make sure the base address setting is extracted properly.
"""
import TestGyp
import re
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
CHDIR = 'linker-flags'
test.run_gyp('base-address.gyp', chdir=CHDIR)
test.build('base-address.gyp', test.ALL, chdir=CHDIR)
de... |
#!/usr/bin/python
from distutils.core import setup
#from setuptools import setup,find_packages
NAME = "certmaster"
VERSION = "0.24"
SHORT_DESC = "%s remote configuration and management api" % NAME
LONG_DESC = """
A small pluggable xml-rpc daemon used by %s to implement various web services hooks
""" % NAME
if __na... |
from django import forms
from django.contrib import admin
from django.core.urlresolvers import reverse
import autocomplete_light
from import_export.admin import ExportMixin
from product_details import product_details
from sorl.thumbnail.admin import AdminImageMixin
from models import Keyword, MozSpace, Photo
class ... |
pi = 3.141592653589793238 # π = 3.141 592 653 589 793 238
####################################################################################################
speed_of_light_in_vacuum = c = 299792458 # 299 792 458 m s−1
electron_charge_magnitude = e = q = 1.602176565e-19 # 1.602 176 565(35)×10−19 C = 4.803 204 50(11)... |
"""
Convert use of sys.exitfunc to use the atexit module.
"""
from lib2to3 import pytree, fixer_base
from lib2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms
class FixExitfunc(fixer_base.BaseFix):
keep_line_order = True
BM_compatible = True
PATTERN = """
(
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipUnless
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher,
check_password, make_password, PBKDF2PasswordHasher, load_has... |
__author__ = 'tylin'
__version__ = '1.0.1'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Ple... |
DEBUG = 0
from struct import unpack
import sys
from timemachine import *
class XLRDError(Exception):
pass
##
# Parent of almost all other classes in the package. Defines a common "dump" method
# for debugging.
class BaseObject(object):
_repr_these = []
##
# @param f open file object, to which the ... |
import os
import logging
# validate, , validate things, internal
from .lib import validate
# CMakeGen, , generate build files, internal
from .lib import cmakegen
# Target, , represents an installed target, internal
from .lib import target
# install, , install subcommand, internal
from . import install
def addOptions... |
from spack import *
class Flac(AutotoolsPackage):
"""Encoder/decoder for the Free Lossless Audio Codec"""
homepage = "https://xiph.org/flac/index.html"
url = "http://downloads.xiph.org/releases/flac/flac-1.3.2.tar.xz"
version('1.3.2', '454f1bfa3f93cc708098d7890d0499bd')
version('1.3.1', 'b9... |
"""
The :mod:`sklearn.cluster` module gathers popular unsupervised clustering
algorithms.
"""
from .spectral import spectral_clustering, SpectralClustering
from .mean_shift_ import (mean_shift, MeanShift,
estimate_bandwidth, get_bin_seeds)
from .affinity_propagation_ import affinity_propagati... |
"""Support for controlling the PiFace Digital I/O module on a RPi."""
import logging
import pifacedigitalio as PFIO
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
_LOGGER = logging.getLogger(__name__)
DOMAIN = "rpi_pfio"
DATA_PFIO_LISTENER = "pfio_listener"
def setup(hass, co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... |
# -*- coding: utf-8 -*-
"""
flask.ctx
~~~~~~~~~
Implements the objects required to keep the context.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
from functools import update_wrapper
from werkzeug.exceptions import HTTPException
from .globa... |
# -*- coding: utf-8 -*-
from pymt import *
# PYMT Plugin integration
IS_PYMT_PLUGIN = True
PLUGIN_TITLE = 'SVG Viewer'
PLUGIN_AUTHOR = 'Nathanaël Lécaudé'
PLUGIN_DESCRIPTION = 'This is an example of Scalable Vector Graphics using the Squirtle library for pyglet.'
svgdata = """<?xml version="1.0" encoding="utf-8"?>
<!... |
from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from aanikone.utils import now
PAPERVOTE = 1
ELECTRONIC = 2
PRE_ELECTRONIC = 3
class Election(models.Model):
"""Election model, automatically generated from WebVoter database"""
name = ... |
"""Thirdparty Packages for internal use.
"""
import sys
import os
def import_thirdparty(lib):
"""
Imports a thirdparty package "lib" by setting all paths correctly.
At the moment, there is only the "pyglet" library, so we just put
pyglet to sys.path temporarily, then import "lib" and then restore the... |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from lyricwiki.items import LyricWikiItem
class LyricWikiSpider(CrawlSpider):
name = "mastakilla" #CHANGE NAME
... |
#!/usr/bin/python3
import defusedxml.ElementTree as ET
import urllib.request
import urllib.parse
import sys
import ssl
__author__ = 'Nick Levesque <<EMAIL>>'
class NexposeException(Exception):
'''Raise this exception when the Nexpose API returns errors.'''
pass
class Nexpose:
'''
Nexpose API wrapper.
'''
def _... |
"""
Main cell which predict the next keyboard configuration
"""
import collections
import tensorflow as tf
from deepmusic.moduleloader import ModuleLoader
import deepmusic.songstruct as music
class KeyboardCell(tf.contrib.rnn.RNNCell):
""" Cell which wrap the encoder/decoder network
"""
def __init__(s... |
from __future__ import absolute_import
import re
import inspect
import traceback
from distutils.util import strtobool
from base64 import b64decode
import tornado
from ..utils import template, bugreport
class BaseHandler(tornado.web.RequestHandler):
def render(self, *args, **kwargs):
functions = self._... |
import os.path
import IECore
import IECoreMaya
class DirNameParameterUI( IECoreMaya.PathParameterUI ) :
def __init__( self, node, parameter, **kw ):
IECoreMaya.PathParameterUI.__init__( self, node, parameter, **kw )
def _fileDialog( self ) :
IECoreMaya.PathParameterUI._fileDialog( self,
filter = IECore... |
import os
from ansible import utils
import ansible.constants as C
import ansible.utils.template as template
from ansible import errors
from ansible.runner.return_data import ReturnData
import base64
import json
import stat
import tempfile
import pipes
## fixes https://github.com/ansible/ansible/issues/3518
# http://m... |
"""Converting AST to code.
Adapted from Tangent.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# TODO(mdan): Use six for compatibility here.
import atexit
import imp
import os
import tempfile
import astor
import gast
from tensorflow.python.autograp... |
from __future__ import print_function
import copy
import re
import sys
from command import InteractiveCommand
from editor import Editor
from error import HookError, UploadError
from project import RepoHook
try:
input = raw_input
except NameError:
pass
UNUSUAL_COMMIT_THRESHOLD = 5
def _ConfirmManyUploads(multipl... |
#!/usr/bin/env python3
''' convert csv files downloaded from an online banking account into qif format. '''
# The MIT License (MIT)
#
# Copyright (c) 2015 mx[replace-this]pycoder.nl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (... |
"""Add things to old Pythons so I can pretend they are newer."""
# This file does lots of tricky stuff, so disable a bunch of lintisms.
# pylint: disable=F0401,W0611,W0622
# F0401: Unable to import blah
# W0611: Unused import blah
# W0622: Redefining built-in blah
import os, re, sys
# Python 2.3 doesn't have `set`
t... |
import analytic_contract_hr_expense
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from odoo.tests import common
@common.at_install(False)
@common.post_install(True)
class TestAccountInvoiceCompanyBankCurrency(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestAccountInvoiceCompanyBankCurrency, cls).setUpClass()
cls.invoice_model = cls.env['account.invoice']... |
# encoding: utf-8
import 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 'CustomUser.new_message_notification'
db.add_column('auth_customuser', 'new_message_not... |
bl_info = {
"name": "Stanford PLY format",
"author": "Bruce Merry, Campbell Barton",
"blender": (2, 57, 0),
"location": "File > Import-Export",
"description": "Import-Export PLY mesh data withs UV's and vertex colors",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:... |
"""Rules for MusicPhrase objects."""
__author__ = 'Michael Wagner'
from extensions.rules import base
NOTE_MAP = {'C4': 60, 'D4': 62, 'E4': 64, 'F4': 65, 'G4': 67, 'A4': 69,
'B4': 71, 'C5': 72, 'D5': 74, 'E5': 76, 'F5': 77, 'G5': 79,
'A5': 81}
def _get_midi_note_value(note):
if isinstan... |
# -*- coding: utf-8 -*-
'''
Created on 1 Aug 2013
@author: Éric Piel
Copyright © 2013 Éric Piel, Delmic
This file is part of Odemis.
Odemis is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
Odemis is ... |
"""Basic message consumer example"""
import functools
import logging
import pika
from pika.exchange_type import ExchangeType
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.I... |
import socket
import warnings
def g_log(*args):
warnings.warn("eventlet.util.g_log is deprecated because "
"we're pretty sure no one uses it. "
"Send mail to <EMAIL> "
"if you are actually using it.",
DeprecationWarning, stacklevel=2)
import sys
... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QEsg Export Dialog
A QGIS plugin
Calculo de rede de esgotamento sanitario no QGis
-------------------
begin : 2016-03-26
... |
"""
Disable EC2 Metadata
--------------------
**Summary:** disable aws ec2 metadata
This module can disable the ec2 datasource by rejecting the route to
``169.254.169.254``, the usual route to the datasource. This module is disabled
by default.
**Internal name:** ``cc_disable_ec2_metadata``
**Module frequency:** per... |
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import os
import sys
if '/srv/newsblur' not in ' '.join(sys.path):
sys.path.append("/srv/newsblur")
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.conf import settings
ACCESS_KEY = settings.S3_ACCESS_KEY
SECRET = setting... |
import types
from bson.json_util import dumps
import mock
import sys
from tests import MongoWSTestCase
class InitializersTestCase(MongoWSTestCase):
def create_test_script(self, **kwargs):
# Create module test_script in scripts
test_script = types.ModuleType('test_script')
run_mock = mock.M... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.networ... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
js_to_json,
parse_iso8601,
)
class NetzkinoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/(?P<category>[^/]+)/(?P<id>[^/]+)'
... |
from operator import itemgetter
from textwrap import dedent
from openerp import tools, SUPERUSER_ID
from openerp.osv import fields, osv
class board_board(osv.osv):
_name = 'board.board'
_description = "Board"
_auto = False
_columns = {}
@tools.cache()
def list(self, cr, uid, context=None):
... |
import logging
from collections import namedtuple
import os
from os.path import basename
import subprocess
from django.template.defaultfilters import slugify
log = logging.getLogger(__name__)
class VCSVersion(object):
"""
Represents a Version (tag or branch) in a VCS.
This class should only be instanti... |
VERSION = '1.1.7' # PIL version
PILLOW_VERSION = '2.9.0' # Pillow
_plugins = ['BmpImagePlugin',
'BufrStubImagePlugin',
'CurImagePlugin',
'DcxImagePlugin',
'EpsImagePlugin',
'FitsStubImagePlugin',
'FliImagePlugin',
'FpxImagePlugin',
... |
from openerp.osv import fields, osv
class document_configuration(osv.osv_memory):
_name='document.configuration'
_description = 'Directory Configuration'
_inherit = 'res.config'
def execute(self, cr, uid, ids, context=None):
dir_pool = self.pool.get('document.directory')
data_pool = se... |
import numpy
from numpy.testing import assert_array_equal
import pytest
from sksurv.functions import StepFunction
@pytest.fixture()
def a_step_function():
x = numpy.array([0, 1, 1.2, 1.75, 2, 2.1, 3, 3.94, 5.4, 9])
y = numpy.array([11, 9, 9.12, 7.5, 7.25, 5.14, 3, 2.94, 2.4, 1.9])
f = StepFunction(x, y)
... |
#!/usr/bin/env python
from aircraft import Aircraft
import util, time, math
from math import degrees, radians
from rotmat import Vector3, Matrix3
class Motor(object):
def __init__(self, angle, clockwise, servo):
self.angle = angle # angle in degrees from front
self.clockwise = clockwise # clockwis... |
"""
Support for Automation Device Specification (ADS).
For more details about this component, please refer to the documentation.
https://home-assistant.io/components/ads/
"""
import threading
import struct
import logging
import ctypes
from collections import namedtuple
import voluptuous as vol
from homeassistant.const... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cms', '0002_auto_20170521_1755'),
]
... |
__copyright__ = "Copyright 2011 SFCTA"
__license__ = """
This file is part of DTA.
DTA 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... |
import utilities.paths as paths
import keras_code.rnns.sentence.models as models
from evaluation.metrics import score
from scipy import spatial
import numpy as np
import math
DRIVE = paths.get_drive()
def test(split, model_id, model, embedding):
bs = 16
dataset = models.get_dataset(model_id, split, batch_siz... |
"""Test longpolling with getblocktemplate."""
from decimal import Decimal
import random
import threading
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import get_rpc_proxy
from test_framework.wallet import MiniWallet
class LongpollThread(threading.Thread):
def __init__(... |
##
## One-off script to export 6.002x users into the edX framework
##
## Could be modified to be general by:
## * Changing user_keys and up_keys to handle dates more cleanly
## * Providing a generic set of tables, rather than just users and user profiles
## * Handling certificates and grades
## * Handling merge/forks o... |
"""private_addons will be populated from puppet and placed in this directory"""
from lib.settings_base import * # noqa
from settings_base import * # noqa
import private_addons
DOMAIN = 'addons.allizom.org'
SERVER_EMAIL = '<EMAIL>'
SITE_URL = 'https://addons.allizom.org'
SERVICES_URL = SITE_URL
STATIC_URL = getatt... |
import urllib2
import urllib
import simplejson
from contextlib import contextmanager
class RequestWithMethod(urllib2.Request):
""" Request class that know how to set the method name """
def __init__(self, *args, **kwargs):
urllib2.Request.__init__(self, *args, **kwargs)
self._method = None
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible.inventory.group import Group
from .host import Host
from ansible.plugins.inventory.aggregate import InventoryAggregateParser
class Inventory:
'''
Create hosts and groups from... |
"""VP8 codec definitions.
This is an instance of a codec definition.
It tells the generic codec the following:
- Name of codec = directory of codec database
- File extension
- Options table
"""
import encoder
import file_codec
class Vp8Codec(file_codec.FileCodec):
def __init__(self, name='vp8'):
super(Vp8Codec,... |
"""An object that creates and updates buffers for enabled observables."""
import collections
import functools
from absl import logging
from dm_control.composer import variation
from dm_control.composer.observation import obs_buffer
from dm_env import specs
import numpy as np
DEFAULT_BUFFER_SIZE = 1
DEFAULT_UPDATE_IN... |
"""
Tar archive parser.
Author: Victor Stinner
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet,
Enum, UInt8, SubFile, String, NullBytes)
from lib.hachoir_core.tools import humanFilesize, paddingSize, timestampUNIX
from lib.hachoir_core.endian import BIG_ENDIAN
import re
cla... |
__revision__ = "$Id$"
from invenio.base.wrappers import lazy_import
from invenio.testsuite import make_test_suite, run_test_suite, InvenioTestCase
calculate_start_date = lazy_import('invenio.modules.comments.api:calculate_start_date')
class TestCalculateStartDate(InvenioTestCase):
"""Test for calculating previo... |
from typing import cast, Optional, Union
from aiohttp import hdrs, web
from aiohttp.payload import IOBasePayload, Payload
from openapi_core.schema.operations.models import Operation
from openapi_core.schema.specs.models import Spec
from openapi_core.validation.request.datatypes import (
OpenAPIRequest,
Request... |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
Author: Travis Pinney, Dane Springmeyer, & Justin Bronn
"""
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSourc... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
offsetcurve.py
---------------------
Date : Janaury 2015
Copyright : (C) 2015 by Giovanni Manghi
Email : giovanni dot manghi at naturalgis dot pt
*******... |
import time
from datetime import datetime
import traceback
import sys
from py4j.java_gateway import is_instance_of
from pyspark import SparkContext, RDD
class TransformFunction(object):
"""
This class wraps a function RDD[X] -> RDD[Y] that was passed to
DStream.transform(), allowing it to be called from... |
"""
ADD WHATEVER CODE YOU NEED TO DO HERE TO DECRYPT CREDENTIALS FOR USE OF YOUR BOT!
"""
def get_credentials():
# Here is a KMS example: (uncomment to make work)
# return kms_decrypt()
# For Docker, encryption is assumed to be happening outside of this, and the secrets
# are instead being passed in ... |
#!/usr/bin/python
import fileinput
import sys
import subprocess
from imp import load_source
from os.path import dirname, isfile, join, realpath
from fcntl import flock, LOCK_EX, LOCK_UN, LOCK_NB
from OmsConfigHostHelpers import write_omsconfig_host_telemetry, write_omsconfig... |
import hashlib
import json
import os
import subprocess
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import (HttpResponse, HttpResponseBadRequest,
HttpResponseNotFound, HttpResponseServerError)
from django.shortcuts import render
from dja... |
#!/usr/bin/env python
from numpy import array,hstack
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
label_traindat = lm.load_labels('../data/label_train_twoclass.dat')
p... |
import unittest
from autothreadharness.harness_case import HarnessCase
class MED_9_2_6(HarnessCase):
role = HarnessCase.ROLE_MED
case = '9 2 6'
golden_devices_required = 4
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main() |
"""Heat API Server.
This implements an approximation of the Amazon CloudWatch API and translates it
into a native representation. It then calls the heat-engine via AMQP RPC to
implement them.
"""
import eventlet
eventlet.monkey_patch(os=False)
import sys
from oslo_config import cfg
import oslo_i18n as i18n
from osl... |
import util
# run doctests
import doctest
doctest.testmod(util)
from unittest import TestCase
from mock import patch
from opencog.atomspace import AtomSpace, TruthValue, Atom, Handle
from opencog.atomspace import types, is_a, get_type, get_type_name
class MiscUtilTest(TestCase):
# we only need to test supportin... |
from __future__ import print_function
import time, string
import inspect, sys, os
# find featuredefs.py
moduledir = os.path.dirname(inspect.getfile(inspect.currentframe()))
sys.path.append(os.path.join(moduledir, '..'))
import featuredefs
if len(sys.argv) != 4:
print("Usage: {} DEFFILE HPPFILE CPPFILE".format(s... |
from .. import InstanceResource, ListResource
class Credential(InstanceResource):
""" A username/password entry in a CredentialList.
.. attribute:: sid
A 34 character string that uniquely identifies this resource.
.. attribute:: account_sid
The unique id of the Account responsible for ... |
import os
import fixtures
class RecursivePermDirFixture(fixtures.Fixture):
"""Ensure at least perms permissions on directory and ancestors."""
def __init__(self, directory, perms):
super(RecursivePermDirFixture, self).__init__()
self.directory = directory
self.least_perms = perms
... |
import sys
from PyQt4.QtCore import SIGNAL, QThread
import queues
class UISignaler(QThread):
_instance = None
def __init__(self, parent=None):
QThread.__init__(self, parent)
@classmethod
def get(cls):
if not cls._instance:
cls._instance = UISignaler()
return cls... |
from urlparse import urljoin
from django import template
from django.utils.encoding import iri_to_uri
register = template.Library()
class PrefixNode(template.Node):
def __repr__(self):
return "<PrefixNode for %r>" % self.name
def __init__(self, varname=None, name=None):
if name is None:
... |
'''
FreeType high-level python API
Adapted from freetype-py.
'''
import sys
import struct
from ctypes import (byref, c_char_p, c_ushort, cast, util, CDLL, Structure,
POINTER, c_int, c_short, c_long, c_void_p, c_uint,
c_char, c_ubyte, CFUNCTYPE)
from ..six import string_types
f... |
from django.contrib.contenttypes.models import ContentType
from django.contrib.syndication.views import Feed
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.feedgenerator import Atom1Feed
from concepts.models import ConceptVersion, Concept
from oclapi.feeds import FeedFi... |
from tempest_lib.common.utils import data_utils
from neutron.tests.api import base_routers as base
from neutron.tests.tempest import test
class RoutersTestDVR(base.BaseRouterTest):
@classmethod
def resource_setup(cls):
for ext in ['router', 'dvr']:
if not test.is_extension_enabled(ext, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
class NewPost(forms.Form):
title = forms.CharField(max_length=256)
content = forms.CharField(widget=forms.Textarea(attrs={'rows':20}))
abstract = forms.CharField(widget=forms.Textarea(attrs={'rows':4}), required=False)
author_id = ... |
class ParseError(Exception):
'''Base exceptions from requests made to Parse'''
pass
class ResourceRequestBadRequest(ParseError):
'''Request returns a 400'''
pass
class ResourceRequestLoginRequired(ParseError):
'''Request returns a 401'''
pass
class ResourceRequestForbidden(ParseError):
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
from ansible.plugins.action.copy import ActionModule as CopyActionModule
# Even though CopyActionModule inherits from ActionBase, we still need to
# directly inherit from ActionBase to... |
"""Tests for student member register task"""
import ddt
from datetime import datetime
from dateutil.tz import tzutc
import json
from mock import patch
from django.core.exceptions import ObjectDoesNotExist
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests... |
# META: timeout=long
import pytest
from webdriver.error import NoSuchCookieException
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def delete_cookie(session, name):
return session.transport.send("DELETE", "/session/%s/cookie/%s" % (session.session_id, name))
@pytest.fi... |
"""Various visualization tools for Alpha-Rank.
All equations and variable names correspond to the following paper:
https://arxiv.org/abs/1903.01373
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import logging
try:
import matplotlib.pa... |
"""Tests for notifications for models with assignable mixin."""
from datetime import datetime
from freezegun import freeze_time
from mock import patch
from sqlalchemy import and_
from ggrc import db
from ggrc.models import Request
from ggrc.models import Notification
from ggrc.models import NotificationType
from inte... |
from __future__ import absolute_import, print_function
from .c_spec import common_base_converter
from .c_spec import num_to_c_types
import numpy
num_typecode = {'?': 'PyArray_BOOL',
'b': 'PyArray_BYTE',
'B': 'PyArray_UBYTE',
'h': 'PyArray_SHORT',
'H': 'P... |
"""Library for getting system information during TensorFlow tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ctypes as ct
import platform
from tensorflow.core.util import test_log_pb2
from tensorflow.python.framework import errors
from tens... |
#!/usr/bin/python
import sys
sys.path.append("/home/pi/git/greenhouse-webservice/")
sys.path.append("/home/pi/git/greenhouse_envmgmt/greenhouse_envmgmt")
import smbus
import i2c_utility
from sense import SensorCluster
from control import ControlCluster
from time import sleep
# sensor_models.models.lazy_record.connect_... |
from boto import connect_s3, connect_ec2
from boto.s3.key import Key
from datetime import datetime
from django.conf import settings
from django.contrib import admin
from django.db import models
from django.forms import TextInput, Textarea
from kombu import Exchange
from models import InstanceRequest, AmazonMachineImage... |
from oslo_log import log as logging
from tempest.api.network import base
from tempest.common.utils import data_utils
from tempest import test
LOG = logging.getLogger(__name__)
class MeteringTestJSON(base.BaseAdminNetworkTest):
"""
Tests the following operations in the Neutron API using the REST client for
... |
import unittest
import os
import numpy as np
import time
import sys
import random
import paddle
import paddle.fluid as fluid
import functools
import contextlib
from paddle.dataset.common import download
from PIL import Image, ImageEnhance
import math
import paddle.fluid.contrib.int8_inference.utility as int8_utility
r... |
__all__ = ["PerMessageCompressOffer",
"PerMessageCompressOfferAccept",
"PerMessageCompressResponse",
"PerMessageCompressResponseAccept",
"PerMessageCompress",
"PerMessageDeflateOffer",
"PerMessageDeflateOfferAccept",
"PerMessageDeflateRespons... |
# coding:utf-8
import urllib2
import socket
import time
import random
def get_plugin_info():
plugin_info = {
"name": "Jboss 认证绕过",
"info": "通过Head请求可绕过Jboos的登陆认证,攻击者可通过此漏洞直接获取服务器权限。",
"level": "高危",
"type": "认证绕过",
"author": "wolf@YSRC",
"url": "https://access.redha... |
import eucadmin.describerequest
class DescribeTokens(eucadmin.describerequest.DescribeRequest):
ServiceName = 'Tokens'
Description = 'List Tokens services.' |
import pytest
from django.template import loader
from pootle.core.browser import get_table_headings
from pootle.core.delegate import panels
from pootle_app.models.permissions import get_matching_permissions
from pootle_app.panels import ChildrenPanel
from pootle_language.views import LanguageBrowseView
@pytest.mark... |
from __future__ import absolute_import
import sys
import pip
from pip.basecommand import Command
from pip.operations.freeze import freeze
from pip.wheel import WheelCache
class FreezeCommand(Command):
"""
Output installed packages in requirements format.
packages are listed in a case-insensitive sorted... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.