content stringlengths 4 20k |
|---|
'''
Created on 06 Jan 2016
Copyright (c) 2016 Brendan Gray and Sylvermyst Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limit... |
import numpy as np
from psi4 import core
def get_qm_atoms_opts(mol):
"""Provides list of coordinates of quantum mechanical atoms from
psi4.core.Molecule `mol` to pylibefp.core.efp() `efpobj`. Also
converts from `read_options("EFP"` to pylibefp opts dictionary.
"""
efpobj = mol.EFP
ptc = []
... |
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.encoding import force_str
from django.utils.six.moves.urllib.parse import urlparse
fr... |
from oslo_config import cfg
config_drive_opts = [
cfg.StrOpt('config_drive_format',
default='iso9660',
choices=('iso9660', 'vfat'),
help="""
Configuration drive format
Configuration drive format that will contain metadata attached to the
instance when it boots.
Possible values:
* iso9660... |
"""Reader for existing document trees."""
from docutils import readers, utils, transforms
class Reader(readers.ReReader):
"""
Adapt the Reader API for an existing document tree.
The existing document tree must be passed as the ``source`` parameter to
the `docutils.core.Publisher` initializer, wrapp... |
import volatility.plugins.gui.windowstations as windowstations
class DeskScan(windowstations.WndScan):
"""Poolscaner for tagDESKTOP (desktops)"""
def render_text(self, outfd, data):
seen = []
for window_station in data:
for desktop in window_station.desktops():
o... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
try:
import requests
HAS_REQUESTS = True
except ImportError:
HAS_R... |
#!/usr/bin/python3.4
import argparse
import matplotlib.pyplot as plt
import csv
import sys
import seaborn as sns
PLOT_TYPES = ["distribution", "mass", "raw"]
# Format of the chart:
# x axis -> append number
# y axis -> time for that particular append
def generateRawPlot(test):
# set figure size
plt.figure(... |
"""
Defines the URL routes for this app.
"""
from django.conf import settings
from django.conf.urls import url
from ..profile_images.views import ProfileImageView
from .accounts.views import (
AccountDeactivationView,
AccountRetireMailingsView,
AccountRetirementPartnerReportView,
AccountRetirementStat... |
"""Glue for the "yapf" library.
"""
import os
import sys
from elpy.rpc import Fault
YAPF_NOT_SUPPORTED = sys.version_info < (2, 7) or (
sys.version_info >= (3, 0) and sys.version_info < (3, 4))
try:
if YAPF_NOT_SUPPORTED:
yapf_api = None
else:
from yapf.yapflib import yapf_api
f... |
WORLD_SIZE = 1000
## The game world, which contains all entities.
class World():
## World constructor
# @param game The owning Game.
def __init__(self, game):
## The owning Game.
self.game = game
## The grid which all entities reside in
#
# All entities in the Worl... |
# -*- coding: utf-8 -*-
import time
from openerp import api, models
class ReportJournal(models.AbstractModel):
_name = 'report.account_extra_reports.report_journal'
def lines(self, target_move, journal_ids, sort_selection, data):
if isinstance(journal_ids, int):
journal_ids = [journal_id... |
from django.test import TestCase, Client
from django.test.utils import setup_test_environment
from django.contrib.auth.models import User
from django.urls import reverse
from django.db.utils import IntegrityError
from dash.models import Author, Post, Comment, Category, Follow
from dash.forms import PostForm, CommentFor... |
import os
import os.path
import re
import time
import copy
from datetime import datetime, timedelta
from behave import *
import sys, requests, json
import bdd_test_util
@then(u'I wait up to {waitTime} seconds for an error in the logs for peer {peerName}')
def step_impl(context, waitTime, peerName):
timeout = tim... |
import json
import logging
import socket
import dcm.agent.plugins.api.base as plugin_base
import dcm.agent.logger as dcm_logger
_g_logger = logging.getLogger(__name__)
class RemoteTester(plugin_base.Plugin):
protocol_arguments = {}
def __init__(self, conf, job_id, items_map, name, arguments):
sup... |
#See http://www.dealingdata.net/2016/07/23/PoGo-Series-Tweepy/
import sys
import os
import jsonpickle
import tweepy
#Authentication
auth = tweepy.AppAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
#Creating a twitter API wrapper using tweepy
#See http://docs.tweepy.org/e... |
from st2common.exceptions.auth import (TokenNotFoundError, ApiKeyNotFoundError,
UserNotFoundError, AmbiguousUserError,
NoNicknameOriginProvidedError)
from st2common.models.db import MongoDBAccess
from st2common.models.db.auth import UserDB, T... |
import argparse
import datetime
import itertools
try:
import ujson as json
except ImportError:
import json
import os
import random
import sys
try:
from itertools import izip
except ImportError:
izip = zip
def main(argv=None):
"""
The main function of this script.
:param argv: List[str] Arguments to pars... |
__author__ = "Ian Goodfellow"
from pylearn2.sandbox.lisa_rl.bandit.environment import Environment
class ClassifierBandit(Environment):
"""
An n-armed contextual bandit based on a classification problem.
Each of the n-arms corresponds to a different class. If the agent
selects the correct class for th... |
import mock
from django.urls.base import reverse
from seqr.views.apis.awesomebar_api import awesomebar_autocomplete_handler
from seqr.views.utils.test_utils import AuthenticationTestCase, AnvilAuthenticationTestCase, MixAuthenticationTestCase
@mock.patch('seqr.views.utils.permissions_utils.safe_redis_get_json', lambd... |
"""The core WSGIController"""
import inspect
import logging
import types
from webob.exc import HTTPException, HTTPNotFound
import pylons
__all__ = ['WSGIController']
log = logging.getLogger(__name__)
class WSGIController(object):
"""WSGI Controller that follows WSGI spec for calling and return
values
... |
from collections import OrderedDict
from typing import Dict, Type
from .base import MobileAppCategoryConstantServiceTransport
from .grpc import MobileAppCategoryConstantServiceGrpcTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[MobileAppCategoryConsta... |
# -*- coding: 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 model 'Country'
db.create_table('embargo_country', (
('id', self.gf('django.db.models.f... |
from common_fixtures import * # NOQA
from requests.auth import AuthBase
import requests
from cattle import from_env
class LocalAuth(AuthBase):
def __init__(self, jwt, prj_id=None):
# setup any auth-related data here
self.jwt = jwt
self.prj_id = prj_id
def __call__(self, r):
#... |
"""ECC secp256k1 OpenSSL wrapper.
WARNING: This module does not mlock() secrets; your private keys may end up on
disk in swap! Use with caution!
This file is modified from python-bitcoinlib.
"""
import ctypes
import ctypes.util
import hashlib
import sys
ssl = ctypes.cdll.LoadLibrary(ctypes.util.find_library ('ssl')... |
import logging
from .logclient import LogClient
from .logitem import LogItem
from .putlogsrequest import PutLogsRequest
from threading import Thread
import atexit
from time import time
from enum import Enum
from .version import LOGGING_HANDLER_USER_AGENT
import six
if six.PY2:
from Queue import Empty, Full, Queue... |
from PyQt4.QtGui import *
from ui import SimpleDialog
class SimpleDialog(QDialog, SimpleDialog.Ui_simpleDialog):
""" Simple dialog for displaying messages and errors to users """
def __init__(self, message, parent=None):
super(SimpleDialog, self).__init__(parent)
self.setupUi(self)... |
class classinstancemethod(object):
"""
Acts like a class method when called from a class, like an
instance method when called by an instance. The method should
take two arguments, 'self' and 'cls'; one of these will be None
depending on how the method was called.
"""
def __init__(self, fun... |
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from collections import OrderedDict
from math import log, sqrt
import numpy as np
import pandas as pd
from six.moves import cStringIO as StringIO
from bokeh.plotting import figure, show, output_server
antibiotics = """
bacteria,... |
'''
Anchor Layout
=============
.. only:: html
.. image:: images/anchorlayout.gif
:align: right
.. only:: latex
.. image:: images/anchorlayout.png
:align: right
:class:`AnchorLayout` aligns children to a border (top, bottom, left, right)
or center.
To draw a button in the lower-right corn... |
"""An extensible ASCII table reader and writer.
basic.py:
Basic table read / write functionality for simple character
delimited files with various options for column header definition.
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author: Tom Aldcroft (<EMAIL>)
"""
import re
from . import core
cl... |
"""
CLI interface for nova bare-metal management.
"""
import os
import sys
from oslo.config import cfg
import six
from nova import config
from nova.i18n import _
from nova import objects
from nova.openstack.common import cliutils
from nova.openstack.common import log as logging
from nova import version
from nova.v... |
# pylint: disable=no-member
"""
Tests for OAuth token exchange views
"""
from datetime import timedelta
import json
import mock
import unittest
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
import httpretty
import provider.constants
from provider import ... |
"""Benchmark for masked_matmul_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=g-bad-todo, g-import-not-at-top
import time
from tensorflow.contrib.factorization.python.ops import gen_factorization_ops
from tensorflow.python.client... |
from osv import fields,osv
class analytic_journal_rate_grid(osv.osv):
_name="analytic_journal_rate_grid"
_description= "Relation table between journals and billing rates"
_columns={
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True,),
'account_id':... |
from django.http import HttpResponse
from django.utils.html import *
from datetime import datetime
import csv
import re
ERROR_CODE="error"
ILLEGAL_CODE="illegal"
FAILURE_CODE="failure"
SUCCESS_CODE="success"
class MyError(Exception):
pass
class GuestDataHandler:
def __init__(self,columns,request):
se... |
#!/usr/bin/env python
"""Test for client comms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import time
from absl import app
from future.builtins import range
import mock
import queue
import requests
from grr_response_client import comms
from grr_... |
"""Locations where we look for configs, install stuff, etc"""
from __future__ import absolute_import
import os
import os.path
import site
import sys
from distutils import sysconfig
from distutils.command.install import install, SCHEME_KEYS # noqa
from pip.compat import WINDOWS, expanduser
from pip.utils import appd... |
#!/usr/bin/env python
# coding: utf-8
#
# xiaoyu <<EMAIL>>
#
# 2014/02/18
#
"""
Tests for wechat backends.
Put this file to your/app/, serialize a `test_all.json` which include a
model and its instances and run
`python manage.py tests yourapp.WeChatTestCase`
WeixinMp is a model for your weixin article,
e.g:
class W... |
import time
from datetime import datetime
from dateutil import relativedelta
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_payslip_employees(osv.osv_memory):
_name ='hr.payslip.employees'
_description = 'Generate payslips for all selected employees'
_columns = {
... |
"""
Support for interfacing to the Logitech SqueezeBox API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.squeezebox/
"""
import logging
import telnetlib
import urllib.parse
from homeassistant.components.media_player import (
DOMAIN, M... |
from boto.regioninfo import RegionInfo, get_regions
def regions():
"""
Get all available regions for the Amazon DynamoDB service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
import boto.dynamodb.layer2
return get_regions('dynamodb', connection_cls=boto.dynamodb... |
from spack import *
class RAnnotate(RPackage):
"""Using R enviroments for annotation."""
homepage = "https://www.bioconductor.org/packages/annotate/"
git = "https://git.bioconductor.org/packages/annotate.git"
version('1.54.0', commit='860cc5b696795a31b18beaf4869f9c418d74549e')
depends_on('... |
import inspect
import re
from django.apps import apps as django_apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.middleware.csrf import rotate_token
from django.utils.crypto import constant_time_compare
from django.utils.module_loading import i... |
# offence-category.py
# old bailey
#
# given a directory of trial files each marked with XML
# extract a list mapping trial id to offence
import os, sys, re
from BeautifulSoup import BeautifulStoneSoup
# given a directory string, return a list of file names
def getFileNames(dirstr):
import os
dircommand = 'di... |
from south.db import db
from django.db import models
from apps.rss_feeds.models import *
class Migration:
def forwards(self, orm):
# Deleting field 'Feed.page_data'
db.delete_column('feeds', 'page_data')
def backwards(self, orm):
# Adding field ... |
"""
@file disksize.py
"""
##
# @addtogroup pnp pnp
# @brief This is pnp component
# @{
# @addtogroup disksize disksize
# @brief This is disksize module
# @{
##
import os
import time
import re
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import collect_pnp_log
class DiskSizeTest(oeRuntimeTest):
""... |
# -*- coding: utf-8 -*-
#!/usr/bin/python
#####
# Made by Jose Patricio VM
#####
# Script para generar pacos a partir de ordenes de Servicio de PCI Industrial
#
#
#####
import wget
import pyexcel
import datetime, time, re
from sys import argv
import simplejson
from linkaform_api import network, utils, settings
#Nomb... |
"""DNS TTL conversion."""
import dns.exception
class BadTTL(dns.exception.SyntaxError):
pass
def from_text(text):
"""Convert the text form of a TTL to an integer.
The BIND 8 units syntax for TTLs (e.g. '1w6d4h3m10s') is supported.
@param text: the textual TTL
@type text: string
@raises dns.... |
from logs import logDecorator as lD
import jsonref
config = jsonref.load(open('../config/config.json'))
logBase = config['logging']['logBase'] + '.lib.argParsers.config'
@lD.log(logBase + '.parsersAdd')
def addParsers(logger, parser):
'''add argument parsers specific to the ``config/config.json`` file
Th... |
"""
Posix reactor base class
"""
import warnings
import socket
import errno
import os
from zope.interface import implements, classImplements
from twisted.python.compat import set
from twisted.internet.interfaces import IReactorUNIX, IReactorUNIXDatagram
from twisted.internet.interfaces import IReactorTCP, IReactorUD... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from pybb.compat import get_image_field_full_name, get_user_model_path, get_user_frozen_models
AUTH_USER = get_user_model_path()
class Migration(SchemaMigration):
def forwards(self, orm):... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Tag(models.Model):
name = models.CharField(max_length=10)
parent = models.ForeignKey('self', blank=True, null=True,
related_name='c... |
import mock
from oslo_utils import timeutils
from nova import context
from nova.notifications.objects import service as service_notification
from nova import objects
from nova.objects import fields
from nova import test
from nova.tests.unit.objects.test_service import fake_service
class TestServiceStatusNotification... |
import sys
if sys.version_info < (2, 6):
raise NotImplementedError("Python 2.6 or greater is required.")
py3k = sys.version_info >= (3, 0)
py33 = sys.version_info >= (3, 3)
if py3k:
import builtins as compat_builtins
string_types = str,
binary_type = bytes
text_type = str
def callable(fn):
... |
"""Tests for test file generation for speech commands."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.examples.speech_commands import generate_streaming_test_wav
from tensorflow.python.platform import test
class Gen... |
from icalendar import Calendar, Event, vDatetime
import sys
months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec" ]
def tabular_string_to_calendar(calstr):
"""Parse an erratically formatted string.
Return a list of icalendar.Calendar entries.
"""
e... |
TIS620CharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253,18... |
import json
import six
import re
# (?<!\\) - don't match leading slashes
# (?:\\\\)* - allow any even number of slashes
# (\.) - capture the actual separator
PERIOD_SPLIT = re.compile(r'(?<!\\)(?:\\\\)*(\.)')
OPEN_SQUARE_BRACKET_SPLIT = re.compile(r'(?<!\\)(?:\\\\)*(\[)')
EQUAL_SPLIT = re.compile(r'(?<!\\)(?:\\\\)*(=)... |
"""This code example creates a new template creative for a given advertiser.
To determine which companies are advertisers, run get_advertisers.py.
To determine which creative templates exist, run
get_all_creative_templates.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" fi... |
import functools
from requests.adapters import HTTPAdapter
from .controller import CacheController
from .cache import DictCache
from .filewrapper import CallbackFileWrapper
class CacheControlAdapter(HTTPAdapter):
invalidating_methods = set(['PUT', 'DELETE'])
def __init__(self, cache=None,
... |
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.session import SessionStorage
from django.test import TestCase
from django.utils.safestring import SafeData, mark_safe
from .base import BaseTests
def set_session_data(storage, ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt impo... |
from datetime import datetime, timedelta
import json
import shutil
import tempfile
from c7n import policy, manager
from c7n.resources.ec2 import EC2
from c7n.utils import dumps
from .common import BaseTest, Config
class DummyResource(manager.ResourceManager):
def resources(self):
return [
... |
data = (
'Hu ', # 0x00
'Xi ', # 0x01
'Shu ', # 0x02
'He ', # 0x03
'Xun ', # 0x04
'Ku ', # 0x05
'Jue ', # 0x06
'Xiao ', # 0x07
'Xi ', # 0x08
'Yan ', # 0x09
'Han ', # 0x0a
'Zhuang ', # 0x0b
'Jun ', # 0x0c
'Di ', # 0x0d
'Xie ', # 0x0e
'Ji ', # 0x0f
'Wu ', ... |
#!/usr/bin/python
import re
import time
import imp
import sys
import argparse
import os
import linecache
from azuremodules import *
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--user', help='specifies user to login', required=True, type= str )
parser.add_argument('-p', '--password', help='specifies... |
"""
Implementation of Simple Storage Service support.
:py:class:`S3Target` is a subclass of the Target class to support S3 file system operations
"""
from __future__ import division
import itertools
import logging
import os
import os.path
try:
from urlparse import urlsplit
except ImportError:
from urllib.pars... |
from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext
from django.forms.widgets import SplitDateTimeWidget,DateTimeInput
from autograde.models import *
from autograde.utils import *
class ProjectMetaForm(forms.ModelForm):
def __init__(self,*args,**kwargs):
super(Projec... |
"""This test contains necessary smoke tests for the Automate."""
import pytest
from cfme import test_requirements
pytestmark = [
test_requirements.automate,
pytest.mark.smoke,
pytest.mark.tier(2),
pytest.mark.ignore_stream(("upstream", {"domain_name": "RedHat"}))
]
@pytest.mark.rhel_testing
@pytest.... |
"""
from airflow import DAG
from airflow.operators import BashOperator
from datetime import datetime, timedelta
from airflow.operators.docker_operator import DockerOperator
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime.utcnow(),
'email': ['<EMAIL>'],
'email_o... |
import datetime
from .base import TestBase
from modelstats import models
from modelstats import datasets
class TestDateDataSet(TestBase):
def test_datedataset(self):
self.create_users()
queryset = self.user_model.objects.all()
dataset = datasets.DateDataSet(field='date_joined', fill_mi... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from .iosxr_module import TestIosxrModule, load_fixture, set_module_args
from ansible.modules.network.iosxr import iosxr_system
class TestIosxrSystemModule(TestIosxrModule)... |
from openerp.osv import fields, osv
import re
from openerp.report.render.rml2pdf import customfonts
class base_config_settings(osv.osv_memory):
_name = 'base.config.settings'
_inherit = 'res.config.settings'
_columns = {
'module_multi_company': fields.boolean('Manage multiple companies',
... |
from __future__ import absolute_import, division, print_function, \
with_statement
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
from shadowsocks.crypto import rc4_md5
from shadowsocks.crypto import openssl
from shadowsocks.crypto import sodium
from shadowsocks.crypto i... |
import sys
sys.path.append(".")
import csv
import numpy as np
from datasets import Photo
import cv2
def f1_score(precision, recall):
return 2*precision*recall/(precision+recall)
def detect_faces(detector, image):
"""
Input: a face detector and an image, you may prorivde a detector as this:
*** detecto... |
import datetime
import qt_compat
QtCore = qt_compat.import_module('QtCore')
QtGui = qt_compat.import_module('QtGui')
import config
import weechat.color as color
class ChatTextEdit(QtGui.QTextEdit):
"""Chat area."""
def __init__(self, debug, *args):
QtGui.QTextEdit.__init__(*(self,) + args)
se... |
"""
Example icoFoam PISO algorithm
"""
from salome_version import getVersion as SalomeVersion
if SalomeVersion() > '5.1.4':
import os
print "Not supported Salome version. Use Salome 5.1.4 or 5.1.3"
os._exit( os.EX_OK )
pass
from Foam import ref, man
from Foam import fvm, fvc
from Tkinter import *
im... |
from __future__ import unicode_literals
import frappe
import json
import copy
@frappe.whitelist()
def get_data(doctypes, last_modified):
data_map = {}
for dump_report_map in frappe.get_hooks().dump_report_map:
data_map.update(frappe.get_attr(dump_report_map))
import datetime
out = {}
doctypes = json.loads(... |
# -*- test-case-name: vumi.application.tests.test_test_helpers -*-
import os
from twisted.internet.defer import inlineCallbacks
from twisted.trial.unittest import SkipTest
from zope.interface import implements
from vumi.tests.helpers import (
MessageHelper, WorkerHelper, MessageDispatchHelper, PersistenceHelper,... |
FAKE_API_VERSION = "1.1"
class Failure(Exception):
def __init__(self, details):
self.details = details
def __str__(self):
return str(self.details)
class Session(object):
def __init__(self, uri, transport=None, encoding=None, verbose=0,
allow_none=1, ignore_ssl=False):
... |
# coding=utf-8
from decimal import Decimal
coin_cfg = []
max_to_lend_rate = 0
max_to_lend = 0
max_percent_to_lend = 0
min_loan_size = 0.001
log = None
def init(config, log1):
global coin_cfg, max_to_lend_rate, max_to_lend, max_percent_to_lend, min_loan_size, log
coin_cfg = coin_cfg = config.get_coin_cfg()
... |
from pyanaconda.ui.tui import simpleline as tui
from pyanaconda.ui.tui.tuiobject import TUIObject, YesNoDialog
from pyanaconda.ui.common import Spoke, StandaloneSpoke, NormalSpoke
from pyanaconda.users import validatePassword, cryptPassword
import re
from collections import namedtuple
from pyanaconda.iutil import setde... |
"""
SQLite3 backend for the sqlite3 module in the standard library.
"""
import decimal
import math
import re
import warnings
from sqlite3 import dbapi2 as Database
import pytz
from django.core.exceptions import ImproperlyConfigured
from django.db import utils
from django.db.backends import utils as backend_utils
from... |
from __future__ import print_function, division
import pyzdde.arraytrace as at # Module for array ray tracing
import pyzdde.zdde as pyz
import os as os
import sys as sys
from math import sqrt as sqrt
if sys.version_info[0] > 2:
xrange = range
cd = os.path.dirname(os.path.realpath(__file__))
def trace_rays():
... |
__revision__ = "test/MSVS/vs-8.0-clean.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Verify the -c option's ability to clean generated Visual Studio 8.0
project (.vcproj) and solution (.sln) files.
"""
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
host_arch = test.get_vs_host_arch()
... |
import json
import os
from collections import defaultdict
from item import item_types, ManualTest, WebdriverSpecTest, Stub, RefTest, TestharnessTest
from log import get_logger
from sourcefile import SourceFile
CURRENT_VERSION = 2
class ManifestError(Exception):
pass
class ManifestVersionMismatch(ManifestErro... |
#
# General code for JSBeautifier unpackers infrastructure. See README.specs
# written by Stefano Sanfilippo <<EMAIL>>
#
"""General code for JSBeautifier unpackers infrastructure."""
import pkgutil
import re
from jsbeautifier.unpackers import evalbased
# NOTE: AT THE MOMENT, IT IS DEACTIVATED FOR YOUR SECURITY: ... |
import fileinput
import os
import re
import string
import sys
if_else = lambda a,b,c:(a and [b] or [c])[0]
max_len = 79
ident = 4
def nearest_ident_pos(text):
return (len(text)/ident) * ident
def block_format(limits, text, first_sep=' ', sep=',', need_last_ident=1 ):
if sep == ',' and string.find( text,... |
"""Xbox Media Player Support."""
from __future__ import annotations
import re
from typing import List
from xbox.webapi.api.client import XboxLiveClient
from xbox.webapi.api.provider.catalog.models import Image
from xbox.webapi.api.provider.smartglass.models import (
PlaybackState,
PowerState,
SmartglassCo... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.base.base import BaseDatabaseWrapper
from djan... |
from django.apps import apps
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import CharField, Field, related
from django.db.models.options import EMPTY_RELATION_TREE, IMMUTABLE_WARNING
from djan... |
import github.GithubObject
import github.GitTreeElement
class GitTree(github.GithubObject.CompletableGithubObject):
"""
This class represents GitTrees as returned for example by http://developer.github.com/v3/todo
"""
def __repr__(self):
return self.get__repr__({"sha": self._sha.value})
... |
import sys
import os
REMOVE_THESE = ["-I/usr/include", "-I/usr/include/", "-L/usr/lib", "-L/usr/lib/"]
class Pkg:
def __init__(self, pkg_name):
self.name = pkg_name
self.priority = 0
self.vars = {}
def parse(self, pkg_config_path):
f = None
for pkg_path in pkg_config_path.split(':'):
if pkg_path[-1] !... |
# Use this functions only with a database based on an import with osmosis
def objects_bbox(_bbox, db_selects, options, add_columns={}, add_param_type=[], add_param_value=[]):
import pghstore
qry = ''
if len(add_columns):
add_columns_qry = ', ' + ', '.join([
q + ' as "' + k + '"'
... |
import sys
import socket
import unittest
import test_utils
sys.path.insert(1, sys.path[0]+'/../../../python')
from pysandesh.sandesh_base import *
from gen_py.msg_test.ttypes import *
class SandeshTraceTest(unittest.TestCase):
def setUp(self):
self._sandesh = Sandesh()
http_port = test_utils.get_... |
from Exscriptd.Config import Config
from Exscriptd.config.ConfigSection import ConfigSection
class DatabaseConfig(ConfigSection):
def __init__(self, *args, **kwargs):
ConfigSection.__init__(self, *args, **kwargs)
self.db_name = None
self.dbn = None
self.config = C... |
import unittest
import pickle
from ctypes import *
import _ctypes_test
dll = CDLL(_ctypes_test.__file__)
class X(Structure):
_fields_ = [("a", c_int), ("b", c_double)]
init_called = 0
def __init__(self, *args, **kw):
X.init_called += 1
self.x = 42
class Y(X):
_fields_ = [("str", c_char... |
import errno
import os
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import util
LOG = logging.getLogger(__name__)
class DataSourceNoCloud(sources.DataSource):
def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)
... |
# $HeadURL$
""" The CountryMapping module performs the necessary CS gymnastics to resolve country codes """
__RCSID__ = "$Id$"
from DIRAC import gConfig, S_OK, S_ERROR
def getCountryMapping( country ):
""" Determines the associated country from the country code"""
mappedCountries = [country]
while True:
m... |
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
usage = "perf trace -s syscall-counts-by-pid.py [comm]\n";
for_comm = None
if len(sys.argv) > 2:
sys.exit(usage)
if len(sys.argv) > 1:
for_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.