content stringlengths 4 20k |
|---|
"""
@author: Brendan Dolan-Gavitt
@license: GNU General Public License 2.0
@contact: <EMAIL>
"""
#pylint: disable-msg=C0111
from struct import unpack
from struct import error as StructError
def recombine(outbuf):
return "".join(outbuf[k] for k in sorted(outbuf.keys()))
def xpress_decode(inputBuf... |
import sys
from optparse import OptionParser
from xml.dom import minidom
import codecs
from androguard.core import androconf
from androguard.core.bytecodes import apk
from androguard.util import read
option_0 = { 'name' : ('-i', '--input'), 'help' : 'filename input (APK or android\'s binary xml)', 'nargs' : 1 }
opti... |
"""
Verifies 'AR' in make_global_settings.
"""
import os
import sys
import TestGyp
def resolve_path(test, path):
if path is None:
return None
elif test.format == 'make':
return '$(abspath %s)' % path
elif test.format in ['ninja', 'xcode-ninja']:
return os.path.join('..', '..', path)
else:
test... |
from sympy.parsing.maxima import parse_maxima
from sympy import Rational, Abs, Symbol, sin, cos, E, oo, log, factorial
from sympy.abc import x
n = Symbol('n', integer=True)
def test_parser():
assert Abs(parse_maxima('float(1/3)') - 0.333333333) < 10**(-5)
assert parse_maxima('13^26') == 917333301932686166583... |
from __future__ import print_function
import espressomd._system as es
import espressomd
from espressomd import thermostat
from espressomd import code_info
from espressomd import analyze
from espressomd import integrate
import numpy
print("""
=======================================================
= ... |
# -*- 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 'Tag'
db.create_table('tags_tag', (
('id', self.gf('django.db.models.fields.AutoF... |
from mantid.api import *
from mantid.kernel import *
import math
class ReactorSANSResolution(PythonAlgorithm):
"""
Calculate and populate the Q resolution
"""
def category(self):
return "SANS"
def seeAlso(self):
return [ "EQSANSResolution" ]
def name(self):
retur... |
"""cxxtest: A Python package that supports the CxxTest test framework for C/C++.
.. _CxxTest: http://cxxtest.tigris.org/
CxxTest is a unit testing framework for C++ that is similar in
spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because
it does not require precompiling a CxxTest testing library, it
emp... |
import time
from lxml import etree
from osv import fields, osv
from tools.translate import _
class account_common_report(osv.osv_memory):
_name = "account.common.report"
_description = "Account Common Report"
def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
if char... |
# -*- coding: utf-8 -*-
import re
import time
from ..internal.Account import Account
from ..internal.misc import json
class RapiduNet(Account):
__name__ = "RapiduNet"
__type__ = "account"
__version__ = "0.12"
__status__ = "testing"
__description__ = """Rapidu.net account plugin"""
__license... |
# -*- coding: utf-8 -*-
import re
def _to_fixed_point(match):
"""Return the fixed point form of the matched number.
Parameters:
match is a MatchObject that matches exp_regex or similar.
If you wish to make match using your own regex, keep the following in mind:
group 1 should be the coef... |
from functools import wraps
from django.core.exceptions import ObjectDoesNotExist # NOQA
from django.db.models import signals # NOQA
from django.db.models.aggregates import * # NOQA
from django.db.models.deletion import ( # NOQA
CASCADE, DO_NOTHING, PROTECT, SET, SET_DEFAULT, SET_NULL, ProtectedError,
)
from d... |
import sys
def enabled():
return ('--remote_debug-host' in sys.argv and
'--remote_debug-port' in sys.argv)
def register_cli_opts():
from oslo_config import cfg
cli_opts = [
cfg.StrOpt('host',
help='Debug host (IP or name) to connect. Note '
... |
from gnuradio import gr, blks2
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import time, struct, sys
# from current dir
from transmit_path import transmit_path
from pick_bitrate import pick_tx_bitrate
import fusb_options
clas... |
from __future__ import unicode_literals
from hyper.common.headers import HTTPHeaderMap
import pytest
class TestHTTPHeaderMap(object):
def test_header_map_can_insert_single_header(self):
h = HTTPHeaderMap()
h['key'] = 'value'
assert h['key'] == [b'value']
def test_header_map_insensiti... |
"""
Tests for L{twisted.web.util}.
"""
from twisted.trial.unittest import TestCase
from twisted.web.util import _hasSubstring
class HasSubstringTestCase(TestCase):
"""
Test regular expression-based substring searching.
"""
def test_hasSubstring(self):
"""
L{_hasSubstring} returns Tr... |
#! /usr/bin/env python
import getopt
def usage():
print >>sys.stderr,"""Usage: check_asdis -i <pcap_file> [-o <wrong_packets.pcap>]
-v increase verbosity
-d hexdiff packets that differ
-z compress output pcap
-a open pcap file in append mode"""
def main(argv):
PCAP_IN = None
PCAP_... |
"""The gradient of the tutorial zero_out op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import sparse_ops
@ops.RegisterGradient("Zer... |
"""Library with a variant of appengine_rpc using httplib2.
The httplib2 module offers some of the features in appengine_rpc, with
one important one being a simple integration point for OAuth2 integration.
"""
import cStringIO
import logging
import os
import re
import urllib
import urllib2
import httplib2
from o... |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... |
"""
Tests things related to ARCHS.
"""
import TestGyp
import TestMac
import re
import subprocess
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
test.run_gyp('test-no-archs.gyp', chdir='archs')
test.build('test-no-archs.gyp', test.ALL, chdir='archs')
result... |
import os
import string
from pydispatch import dispatcher
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Generate Agent',
'Author': ['@harmj0y'],
'Description': ("Generates an agent code instance for a spe... |
"""
Code to break subtitle dialogue
into 60 equal-length clean slices per episode.
"""
from __future__ import division
import pandas as pd
from datetime import datetime
import re, os
import argparse
from clean_extracted_text import clean_text
def convert_time(time_):
new_time = datetime.strptime(time_, '%H:%M:%S,%... |
#!/usr/bin/python
import scipy
import numpy
import pickle
from numpy import *
from scipy import ndimage
from scipy import interpolate
from numpy import loadtxt
import os
import numpy as np
from numpy import *
import matplotlib
from pylab import rcParams
from pylab import *
from matplotlib import pyplot
import ... |
import json
from social.tests.backends.oauth import OAuth2Test
class InstagramOAuth2Test(OAuth2Test):
backend_path = 'social.backends.instagram.InstagramOAuth2'
user_data_url = 'https://api.instagram.com/v1/users/self'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_toke... |
import unittest
import os
import commands
import comm
import time
class TestMobileSpecAppClose(unittest.TestCase):
def test_close(self):
comm.setUp()
app_name = "mobilespec"
pkg_name = "org.apache." + app_name.lower()
if not comm.check_app_installed(pkg_name, self):
co... |
# -*- coding: utf-8 -*-
import sys
import logging.config
from djaio.core.utils import deep_merge
class ColoredFormatter(logging.Formatter):
RESET = '\x1B[0m'
RED = '\x1B[31m'
YELLOW = '\x1B[33m'
BRGREEN = '\x1B[01;32m' # grey in solarized for terminals
def format(self, record, color=False):
... |
"""Run the Chrome WebUI presubmit scripts on our test javascript.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools, and see
http://www.chromium.org/developers/web-development-style-guide for the rules
we're checking against here... |
import fileinput
import math
import collections
import time
import numpy as np
from pylab import *
from matplotlib import pyplot as plt
import matplotlib.mlab as mlab
#file_path = '/media/ABB4-4F3A/DATALOG.TXT'
file_path = 'DATALOG.TXT'
def split_in_blocks(txt_file, pattern):
'''
Find the last appears of the text t... |
import bpy
for ob in bpy.context.selected_objects:
odata = bpy.context.object.data
for vert in ob.data.vertices:
vert.co[0] *= ob.scale[0]
vert.co[1] *= ob.scale[1]
vert.co[2] *= ob.scale[2]
ob.scale = (1,1,1)
for lob in bpy.data.objects:
if ... |
"""TLS Lite + httplib."""
import socket
import httplib
from gdata.tlslite.TLSConnection import TLSConnection
from gdata.tlslite.integration.ClientHelper import ClientHelper
class HTTPBaseTLSConnection(httplib.HTTPConnection):
"""This abstract class provides a framework for adding TLS support
to httplib."""
... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the f... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from secureauth import get_version
setup(
name='django-secure-auth',
version=get_version(),
description='Secure authentication by TOTP, SMS, Codes & Question',
keywords='django secure auth protection totp sms codes question',
lon... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
from ansible.module_utils.nxos import get_config, load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import Ansib... |
from django.test import TestCase
from .models import SubTask, Task
class TestOrderableManager(TestCase):
@classmethod
def setUpTestData(cls):
tasks = [Task.objects.create(sort_order=i) for i in range(3)]
cls.first_task, cls.middle_task, cls.last_task = tasks
def test_gets_next(self):
... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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 limitation
the rights to use, copy, modify, merg... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import unittest
import numpy as np
import data_utils.augmentor.trans_mean_variance_norm as trans_mean_variance_norm
import data_utils.augmentor.trans_add_delta as trans_add_delta
import data_utils.au... |
"""Exfoliate is the asynchronous HTTP client for developers who prefer synchronous Python.
Enjoy the benefits of a scalable, asynchronous HTTP client without worrying about coroutines or
event loops. Exfoliate is the gentler, more Pythonic way to scrape the web.
"""
import asyncio
import aiohttp
import threading
imp... |
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):
... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, extract_email_id
from erpnext.controllers.status_updater import StatusUpdater
class Contact(StatusUpdater):
def autoname(self):
# concat first and last name
self.name = " ".join(filter(None,
[cstr(self.get(f)).strip() for f... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# This exploit template was generated via:
# $ pwn template ./vuln
from pwn import *
# Set up pwntools for the correct architecture
exe = context.binary = ELF('./vuln')
# Many built-in settings can be controlled on the command-line and show up
# in "args". For example, ... |
"""Buck agnostic utility functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
from collections import namedtuple
import copy
import functools
import inspect
import subprocess
import sys
import os
def is_in_d... |
from jinja2 import Markup, escape
from mongoengine.base import BaseList
from mongoengine.fields import GridFSProxy, ImageGridFsProxy
from flask_admin.model.typefmt import BASE_FORMATTERS, list_formatter
from . import helpers
def grid_formatter(view, value):
if not value.grid_id:
return ''
args = h... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
name: toml
version_added: "2.8"
short_description: Uses a specific TOML file as an inventory source.
description:
- TOML based inventory format
- File MUST have a valid '.toml' f... |
import json
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import MessageEncoder, MessageDecoder
from django.utils import six
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
"""
session... |
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class Orderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"
procure_uom_id = fields.Many2one(comodel_name='uom.uom',
string="Procurement UoM")
@api.constrains('product_id', 'pro... |
import datetime
import icalendar
import os
import pytz
import unittest
from pykolab.xml import Attendee
from pykolab.xml import Event
from pykolab.xml import EventIntegrityError
from pykolab.xml import InvalidAttendeeParticipantStatusError
from pykolab.xml import InvalidEventDateError
from pykolab.xml import event_fro... |
import os
import pyauto_functional
import pyauto
class ChromeosSecurity(pyauto.PyUITest):
"""Security tests for chrome on ChromeOS.
Requires ChromeOS to be logged in.
"""
def setUp(self):
pyauto.PyUITest.setUp(self)
baseline_file = os.path.abspath(os.path.join(
pyauto.PyUITest.DataDir(), 'py... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rbhusPipeProjCreateMod.ui'
#
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUt... |
import struct
class GssChannelBindingsStruct(object):
INITIATOR_ADDTYPE = 'initiator_addtype'
INITIATOR_ADDRESS_LENGTH = 'initiator_address_length'
ACCEPTOR_ADDRTYPE = 'acceptor_addrtype'
ACCEPTOR_ADDRESS_LENGTH = 'acceptor_address_length'
APPLICATION_DATA_LENGTH = 'application_data_length'
I... |
"""This module provides a TokenStore class which is designed to manage
auth tokens required for different services.
Each token is valid for a set of scopes which is the start of a URL. An HTTP
client will use a token store to find a valid Authorization header to send
in requests to the specified URL. If the HTTP clien... |
import numpy as np
from .. import backend as K
TAGS = ['rock', 'pop', 'alternative', 'indie', 'electronic',
'female vocalists', 'dance', '00s', 'alternative rock', 'jazz',
'beautiful', 'metal', 'chillout', 'male vocalists',
'classic rock', 'soul', 'indie rock', 'Mellow', 'electronica',
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import time
from ansible.module_utils.facts.collector import BaseFactCollector
class DateTimeFactCollector(BaseFactCollector):
name = 'date_time'
_fact_ids = set()
def collect(self, module=None, coll... |
import h5py
import numpy as np
from bemio.__version__ import base
def write_hdf5(bemio_obj,out_file=None):
'''
Function that writes NEMOH, WAMIT, or NEMOH data to a standard human
readable data format that uses the HDF5 format. This data can easily be
input into various codes, such as MATLAB, Python, C... |
"""
AT-specific Form helpers
"""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{... |
import os
import os.path
import pipes
import shutil
import tempfile
import base64
import re
from ansible import utils
from ansible.runner.return_data import ReturnData
class ActionModule(object):
TRANSFERS_FILES = True
def __init__(self, runner):
self.runner = runner
def _assemble_from_fragments... |
"""
NOTE: this API is WIP and has not yet been approved. Do not use this API
without talking to Christina or Andy.
For more information, see:
https://openedx.atlassian.net/wiki/display/TNL/User+API
"""
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import stat... |
# -*- coding: utf-8 -*-
"""
tests.reqctx
~~~~~~~~~~~~
Tests the request context.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import flask
try:
from greenlet import greenlet
except ImportError:
greenlet = None
def test_teardown... |
import sys
import gdb
import os
import os.path
pythondir = '/home/hiwifi/hc5761/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/share/gcc-4.6.4/python'
libdir = '/home/hiwifi/hc5761/staging_dir/toolchain-mipsel_r2_gcc-4.6-linaro_uClibc-0.9.33.2/mipsel-openwrt-linux-uclibc/lib'
# This file might be load... |
__version__ = "1.0.3"
from sys import version_info
def detect(aBuf):
if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or
(version_info >= (3, 0) and not isinstance(aBuf, bytes))):
raise ValueError('Expected a bytes object, not a unicode object')
from . import universaldetector
... |
import IECore
import Gaffer
import GafferUI
import os
## Supported plug metadata - used to provide arguments to a
# PathChooserDialogue :
#
# - "path:leaf"
# - "path:valid"
# - "path:bookmarks"
class PathPlugValueWidget( GafferUI.PlugValueWidget ) :
## path should be an instance of Gaffer.Path, optionally with
# ... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
import json
try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule
from ansible.module_utils.aws.core impo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... |
# must be fixed for the new plugin interface
from Tools.BoundFunction import boundFunction
from Tools.Directories import pathExists
from Plugins.Plugin import PluginDescriptor
from pluginrunner import PluginRunner
from os import listdir
TUXBOX_PLUGINS_PATH = "/usr/lib/tuxbox/plugins/"
def getPlugins():
pluginlist =... |
import numpy as np
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert... |
#!/usr/bin/python
"""
# Created on July 24, 2017
#
# @author: Vilian Atmadzhov (<EMAIL>) GitHub ID: vivobg
#
# module_check: not supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <<EMAIL>>
# Vilian Atmadzhov, <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/g... |
class AbstractWriter(object):
def __init__(self, file, condition):
self.external_stop = False
self._condition = condition
self.file = file
def open(self):
""" Opens the currently set port"""
raise NotImplementedError()
def is_open(self):
""" Fluch of file l... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: bigip_qkview
short_description: Manage qkviews on the devic... |
from __future__ import print_function
import re
import sys
from command import Command
from git_command import GitCommand
CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$')
class CherryPick(Command):
common = True
helpSummary = "Cherry-pick a change."
helpUsage = """
%prog <sha1>
"""
helpDescrip... |
from django.utils.encoding import python_2_unicode_compatible
from ..models import models
from ..utils import gisfield_may_be_null
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
... |
import time
from typing import List, Type
from mediawords.job import JobBroker
from mediawords.util.log import create_logger
from .setup_broker_test import AbstractBrokerTestCase, Worker
log = create_logger(__name__)
class TestBrokerLock(AbstractBrokerTestCase):
@classmethod
def worker_paths(cls) -> List[... |
""" test partial slicing on Series/Frame """
from datetime import datetime
import operator as op
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame, DatetimeIndex, Index, Series, Timedelta, Timestamp, date_range)
from pandas.core.indexing import IndexingError
from pandas.util imp... |
from __future__ import absolute_import
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
import os
import gzip
import struct
import array
import numpy as np
from urllib.request import urlretrieve
def download(url, filename):
if not os.path.exists('data'):
... |
"""
Filter to add support for Trusted Computing Pools.
Filter that only schedules tasks on a host if the integrity (trust)
of that host matches the trust requested in the ``extra_specs`` for the
flavor. The ``extra_specs`` will contain a key/value pair where the
key is ``trust``. The value of this pair (``trusted``/... |
"""
The utilities.py module handles all utility functions that Automater
requires.
Class(es):
Parser -- Class to handle standard argparse functions with
a class-based structure.
IPWrapper -- Class to provide IP Address formatting and parsing.
Function(s):
No global exportable functions are defined.
Exception(s):
No ... |
import argparse
import os
import tempfile
import subprocess
import utils
# javac options
parser = argparse.ArgumentParser()
current_directory = os.getcwd()
parser.add_argument('-version', action='store_true')
parser.add_argument('-cp', '-classpath', type=str, dest='classpath')
parser.add_argument('-bootclasspath', t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from bts.api import BTS
import json
import logging
import logging.handlers
import os
import time
import smtplib
class DelegateWatch(object):
def __init__(self):
self.confirm = 2
self.load_config()
self.i... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.playbook.taggable import Taggable
from units.mock.loader import DictDataLoader
class TaggableTestObj(Taggable):
def __init__(self):
self._loader = DictDataLoader(... |
from __future__ import unicode_literals
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y H:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strft... |
import os
import sys
from robot.variables import GLOBAL_VARIABLES
from robot.api import logger
from keywordgroup import KeywordGroup
class _LoggingKeywords(KeywordGroup):
# Private
def _debug(self, message):
logger.debug(message)
def _get_log_dir(self):
logfile = GLOBAL_VARIABLES['${LOG ... |
from itertools import islice
from collections import OrderedDict
from turbodbc_intern import make_row_based_result_set, make_parameter_set
from .exceptions import translate_exceptions, InterfaceError, Error
_NO_NUMPY_SUPPORT_MSG = "This installation of turbodbc does not support NumPy extensions. " \
... |
import os
import re
import sublime
from ..package_manager import PackageManager
class ExistingPackagesCommand():
"""
Allows listing installed packages and their current version
"""
def __init__(self):
self.manager = PackageManager()
def make_package_list(self, action=''):
"""
... |
"""Tests for unified pooling functionality in tensorflow.ops.nn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tens... |
import os
import pygame
import sys
from diamond_game.model.models import Board
import Queue
def main():
pygame.init()
size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0
screen = pygame.display.set_mode(size)
ball = pygame.image.load("test.png")
ballrect = ball.get_rect()
... |
"""
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.core.exceptions import FieldError
from django.db import connections
from django.db.models.query_utils import Q
from django.db.models.sql.constants import (
CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS,
)
from django... |
from django.core.urlresolvers import NoReverseMatch
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from .urls import urlpatterns
@api_view(('GET',))
def root_endpoint(request, format=None):
"""
List of all the available ... |
"""The Mixture distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.distributions.python.ops import categorical
from tensorflow.contrib.distributions.python.ops import distribution
from tensorflo... |
from collections import defaultdict
from random import choice, randint
from tornado_json.exceptions import api_assert, APIError
from tornado_json import schema
from pony.orm import db_session, CommitException, select, commit
from tornado.web import authenticated
from wlsports.db import Team as TeamEntity
from wlsport... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import time
import glob
from ansible.plugins.action.dellos6 import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
f... |
"""Support passing legacy Invenio str objects to Jinja2 templates."""
import warnings
try:
from markupsafe import Markup as jinja2_Markup, escape as jinja2_escape
except ImportError:
from jinja2._markupsafe import Markup as jinja2_Markup, \
escape as jinja2_escape
from invenio.utils.deprecation impor... |
"""
sentry.runner.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import click
from datetime import timedelta
from django.utils import timezon... |
"""
Module for storing static data structures
"""
import os
import sys
import getpass
import tempfile
def __expand_all(path):
path = os.path.expanduser(path)
path = os.path.expandvars(path)
return path
def __expand_all_in_list(lst):
for i, path in enumerate(lst):
lst[i] = __expand_all(path)
... |
import os
import sys
import transaction
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from ..models.meta import Base
from ..models import (
get_engine,
get_session_factory,
get_tm_session,
)
from ..models import Entry
def us... |
#!/usr/bin/python
import os, socket, sys, stat
######################################################################
##
## trigger_avid_update.py for media_harmony VFS module.
##
## Copyright (C) Andrew Klaassen 2012.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms... |
from gslib.help_provider import HELP_NAME
from gslib.help_provider import HELP_NAME_ALIASES
from gslib.help_provider import HELP_ONE_LINE_SUMMARY
from gslib.help_provider import HelpProvider
from gslib.help_provider import HELP_TEXT
from gslib.help_provider import HelpType
from gslib.help_provider import HELP_TYPE
_de... |
#http://documen.tician.de/pyopencl/
import pyopencl as cl
import numpy as np
import struct
import timing
timings = timing.Timing()
#ctx = cl.create_some_context()
mf = cl.mem_flags
class Radix:
def __init__(self, max_elements, cta_size, dtype):
self.WARP_SIZE = 32
self.SCAN_WG_SIZE = 256
... |
"""
kombu.transport.filesystem
==========================
Transport using the file system as the message store.
"""
from __future__ import absolute_import
from Queue import Empty
from anyjson import loads, dumps
import os
import shutil
import time
import uuid
import tempfile
from . import virtual
from kombu.excep... |
import unittest
import mock
import hid_constants
import hid_descriptors
import hid_gadget
import usb_constants
report_desc = hid_descriptors.ReportDescriptor(
hid_descriptors.UsagePage(0xFF00), # Vendor Defined
hid_descriptors.Usage(0x00),
hid_descriptors.Collection(
hid_constants.CollectionTyp... |
from optparse import make_option
import os
import threading
from webkitpy.common.config.ports import DeprecatedPort
from webkitpy.common.host import Host
from webkitpy.common.net.irc import ircproxy
from webkitpy.common.net.statusserver import StatusServer
from webkitpy.tool.multicommandtool import MultiCommandTool
fr... |
#!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info
config = Configuration('opt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.