content stringlengths 4 20k |
|---|
"""
Access to Embedded Controller (EC)
Usage:
>>> write_command( command )
>>> write_data( data )
>>> read_data()
>>> read_memory( offset )
>>> write_memory( offset, data )
>>> read_memory_extended( word_offset )
>>> write_memory_extended( word_offset, data )
>>> read_range( start_offs... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
from django.db import connection
from django.test import TestCase
from django.utils import unittest
class UserCreationFormTest... |
__all__ = ["StorageLevel"]
class StorageLevel(object):
"""
Flags for controlling the storage of an RDD. Each StorageLevel records whether to use memory,
whether to drop the RDD to disk if it falls out of memory, whether to keep the data in memory
in a JAVA-specific serialized format, and whether to r... |
"""
Template for PDF Receipt/Invoice Generation
"""
import logging
from django.conf import settings
from django.utils.translation import ugettext as _
from PIL import Image
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.li... |
import product_margin
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
#!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <<EMAIL>>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call stack by dr... |
"""Base Command class, and related routines"""
from __future__ import absolute_import
import logging
import os
import sys
import traceback
import optparse
import warnings
from pip._vendor.six import StringIO
from pip import cmdoptions
from pip.locations import running_under_virtualenv
from pip.download import PipSes... |
#! /usr/bin/env python
import sys
from optparse import OptionParser
import random
# finds the highest nonempty queue
# -1 if they are all empty
def FindQueue():
q = hiQueue
while q > 0:
if len(queue[q]) > 0:
return q
q -= 1
if len(queue[0]) > 0:
return 0
return -1
... |
import os, sys
import gtk
gdk = gtk.gdk
# PySol imports
# Toolkit imports
from tkutil import makeToplevel, setTransient, wm_withdraw
from pysollib.mfxutil import kwdefault, KwStruct, openURL
# ************************************************************************
# *
# ******************************************... |
#!/usr/bin/env python
"""
mtpy/mtpy/uofa/convert_coordinates_in_edis.py
This is a convenience script for converting coordinates in EDI files.
Files are parsed and if a 'lat' or 'lon' is detected, the argument on
the other side of an '=' is converted into decimal degrees. The rest of the file
remains unchanged.
arg... |
import simplejson
import cgi
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
from lxml import etree
# Specify Your Terminology will move to 'partner' module
class specify_partner_terminology(osv.osv_memory):
_name = 'base.setup.terminology'
_inherit = 'res.co... |
import os, random, sys, math, itertools, operator, datetime, re, cProfile
from framework import *
#import simulator classes
from robot import *
from proxSensor import *
#Room perimeter polygon, currently there should be just one of these
class Room():
def __init__(self, world, xsize, ysize):
self... |
from __future__ import division
import libtbx.test_utils.parallel
from libtbx.utils import Sorry, Usage
import libtbx.phil
import random
import os
import sys
master_phil = libtbx.phil.parse("""
directory = None
.type = path
.multiple = True
module = None
.type = str
.multiple = True
nproc = 1
.type= int
sh... |
# gozerbot/pdod.py
#
#
""" pickled dicts of dicts """
## jsb imports
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import Persist
## Pdod class
class Pdod(Persist):
""" pickled dicts of dicts """
def __getitem__(self, name):
""" return item with name """
if self.data.has_ke... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
qualities,
unified_strdate,
clean_html,
)
class UltimediaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ultimedia\.com/default/index/video[^/]+/id/(?P<i... |
""" support for skip/xfail functions and markers. """
import os
import sys
import traceback
import py
import pytest
from _pytest.mark import MarkInfo, MarkDecorator
def pytest_addoption(parser):
group = parser.getgroup("general")
group.addoption('--runxfail',
action="store_true", dest="runxfail", ... |
from nova.api.openstack import extensions
from nova import network
authorize = extensions.extension_authorizer('compute', 'floating_ip_pools')
def _translate_floating_ip_view(pool_name):
return {
'name': pool_name,
}
def _translate_floating_ip_pools_view(pools):
return {
'floating_ip_p... |
from __future__ import print_function
import os, sys, copy
sys.path.append(os.environ['SU2_RUN'])
import SU2
from collections import OrderedDict
# todo:
# verify command line interface
# commenting
# verify optimization, gradients, flow solutions
# verbosity
# plotting
# verbose redirection
# pyopt optimizers
# ne... |
from django.core import checks
from django.db import models
from django.test import SimpleTestCase
from .tests import IsolateModelsMixin
class TestDeprecatedField(IsolateModelsMixin, SimpleTestCase):
def test_default_details(self):
class MyField(models.Field):
system_check_deprecated_details ... |
import re
import random
from collections import defaultdict, deque
"""
Codecademy Pro Final Project supplementary code
Markov Chain generator
This is a text generator that uses Markov Chains to generate text
using a uniform distribution.
num_key_words is the number of words that compose a key (suggested: 2 or ... |
import re
def a_valid_tap(tap):
'''Returns True if the tap is valid.'''
regex = re.compile(r'^([\w-]+)/(homebrew-)?([\w-]+)$')
return regex.match(tap)
def already_tapped(module, brew_path, tap):
'''Returns True if already tapped.'''
rc, out, err = module.run_command([
brew_path,
... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsDateTimeEdit
.. note:: This program 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 later version.
"""
__... |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import Tkinter,tkFont
import math
import glob
import os
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.initialize()
def initialize(self):
self.grid()
self.HOME = os.getcwd()
if not... |
"""The frontend for the Mojo bindings system."""
import argparse
import imp
import os
import pprint
import sys
# Disable lint check for finding modules:
# pylint: disable=F0401
def _GetDirAbove(dirname):
"""Returns the directory "above" this file containing |dirname| (which must
also be "above" this file)."""
... |
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from ..person import RegExpName
from ._memberbase import father_base
... |
#! /usr/bin/env python
'''
Copyright (C) 2012 Diego Torres Milano
Created on Sep 8, 2012
@author: diego
@see: http://code.google.com/p/android/issues/detail?id=36544
'''
import re
import sys
import os
# This must be imported before MonkeyRunner and MonkeyDevice,
# otherwise the import fails.
# PyDev sets PYTHONPA... |
from base64 import b64encode
from ..packages.six import b
ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generating request headers.
:param keep_ali... |
#!/usr/bin/env python
"""
This file contains Python code illustrating the creation and manipulation of
vtkTable objects.
"""
from __future__ import print_function
from vtk import *
#------------------------------------------------------------------------------
# Script Entry Point (i.e., main() )
#-------------------... |
import os
import sys
import re
import string
import traceback
# get type names
from types import *
from ply import lex
from ply import yacc
##########################################################################
#
# Base classes for use outside of the assembler
#
###################################################... |
# language codes, as used in PE file ressources
# this file is used by pefile.py
langcodes = {
1: 'ar',
2: 'bg',
3: 'ca',
4: 'zh_Hans',
5: 'cs',
6: 'da',
7: 'de',
8: 'el',
9: 'en',
10: 'es',
11: 'fi',
12: 'fr',
13: 'he',
14: 'hu',
15: 'is',
16: 'it',
... |
"""Logging configuration"""
import os
import platform
import sys
from logging.handlers import SysLogHandler
def get_logger_config(log_dir='/var/tmp',
logging_env="no_env",
edx_filename="edx.log",
dev_env=False,
debug=False,
... |
import sqlalchemy as sa
from sqlalchemy import event
from neutron.common import exceptions as qexception
from neutron.db import model_base
from neutron.extensions import routedserviceinsertion as rsi
class ServiceRouterBinding(model_base.BASEV2):
resource_id = sa.Column(sa.String(36),
... |
"""
Parsers are used to parse the content of incoming HTTP requests.
They give us a generic way of being able to handle various media types
on the request, such as form content or json encoded data.
"""
from __future__ import unicode_literals
import json
from django.conf import settings
from django.core.files.upload... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
from django.conf import settings
from django.db.backends import (BaseDatabaseFeatures, BaseDatabaseWrapper,
BaseDatabaseValidation)
from django.db.backends.postgresql_psycopg2.operations import DatabaseOperation... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
def query_package(module, slackpkg_p... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec
from ansible.module_utils.... |
import command
import gitutil
import os
def FindGetMaintainer():
"""Look for the get_maintainer.pl script.
Returns:
If the script is found we'll return a path to it; else None.
"""
try_list = [
os.path.join(gitutil.GetTopLevel(), 'scripts'),
]
# Look in the list
for pat... |
"""HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
This is just a copy of the Python 2.2 HMAC module, modified to work when
used on versions of Python before 2.2.
"""
__revision__ = "$Id: HMAC.py,v 1.5 2002/07/25 17:19:02 z3p Exp $"
import strin... |
from . import ProxyTerminus
from flask import Flask
from flask import request
from flask import make_response
import urllib2
import socket
import json
import threading
import datetime
import ssl
import logging
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
network_times = open('times', 'w')
network... |
import io
import types
import textwrap
import unittest
import email.policy
import email.parser
import email.generator
from email import headerregistry
def make_defaults(base_defaults, differences):
defaults = base_defaults.copy()
defaults.update(differences)
return defaults
class PolicyAPITests(unittest.T... |
#!/usr/bin/python
"""short_description: Check or wait for migrations between nodes"""
# Copyright: (c) 2018, Albert Autin
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADA... |
from __future__ import absolute_import
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.socialaccount.providers import registry
from allauth.tests import MockedResponse
from .provider import VKProvider
class VKTests(create_oauth2_tests(registry.by_id(VKProvider.id))):
def get_mocked_res... |
"""Base option parser setup"""
from __future__ import absolute_import
import sys
import optparse
import os
import re
import textwrap
from distutils.util import strtobool
from pip._vendor.six import string_types
from pip._vendor.six.moves import configparser
from pip.locations import (
legacy_config_file, config_b... |
from django import forms
from django.conf import settings
from django.contrib.admin.util import flatten_fieldsets, lookup_field
from django.contrib.admin.util import display_for_field, label_for_field
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from d... |
from datetime import datetime, timedelta
from nose.tools import eq_
from django.test.client import RequestFactory
from kitsune.community import api
from kitsune.products.tests import product
from kitsune.questions.tests import answer, answervote, question
from kitsune.search.tests import ElasticTestCase
from kitsune... |
from tastypie.resources import ModelResource
from apps.survey.models import Profile, SurveyUser, Survey
from apps.survey.survey import parse_specification
from apps.survey.spec import Question, Branch, Else
from pickle import loads
from inspect import isclass
class EpiwebModelResource(ModelResource):
class Meta:
... |
# -*- 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 'DamageScenario.ahn_version'
db.add_column(u'lizard_damage... |
# -*- 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 'Project.programming_language'
db.add_column(u'projects_pr... |
#!/usr/bin/python2.7
# -*- encoding=utf-8 -*-
import gevent
from gevent import monkey
import itertools
from urlparse import urljoin
from utils import flatten, get_json, get_xpath, parse_cell, sanitize, split
monkey.patch_all()
class BaseCrawler(object):
url_image_base = 'http://info.nec.go.kr'
attrs = []
... |
import StringIO
import errno
import hashlib
import os
import re
from webkitpy.common.system import path
class MockFileSystem(object):
sep = '/'
pardir = '..'
def __init__(self, files=None, dirs=None, cwd='/'):
"""Initializes a "mock" filesystem that can be used to completely
stub out a f... |
import re
import traceback
import urllib
from collections import OrderedDict
from urllib.parse import urljoin
import validators
from sickchill import logger
from sickchill.helper.common import convert_size, try_int
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
from sickchi... |
from django.utils.timezone import utc as timezone_utc
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import floor_to_hour, floor_to_day, ceiling_to_hour, \
ceiling_to_day, timestamp_to_datetime, datetime_to_timestamp, \
TimezoneNotUTCException, convert_to_UTC
from datetime import ... |
"""Invenio BibEdit Administrator Interface."""
__revision__ = "$Id"
__lastupdated__ = """$Date: 2008/08/12 09:26:46 $"""
import cProfile
import cStringIO
import pstats
from flask.ext.login import current_user
from invenio.utils.json import json, json_unicode_to_utf8, CFG_JSON_AVAILABLE
from invenio.modules.access.... |
# -*- coding: utf-8 -*-
import logging
from uuid import uuid4
from flask import Blueprint, request, current_app, jsonify
_logger = logging.getLogger(__name__)
mod = Blueprint('jssdk', __name__, template_folder='templates')
@mod.route('/cgi-bin/ticket/getticket', methods=['GET'])
def getticket():
"""
获取 j... |
# -*- coding: utf-8 -*-
from __future__ import division
from os import getenv
from os.path import isfile
from sys import exit
import click
@click.command()
@click.option("--n", default=10, help="How many commands to show.")
@click.option("--plot", is_flag=True, help="Plot command usage in pie chart.")
@click.option(... |
from sympy.core import (Rational, Symbol, S, Float, Integer, Number, Pow,
Basic, I, nan, pi, symbols)
from sympy.core.tests.test_evalf import NS
from sympy.functions.elementary.miscellaneous import sqrt, cbrt
from sympy.functions.elementary.exponential import exp, log
from sympy.functions.elementary.trigonometric impor... |
import os
def _fail(module, cmd, out, err, **kwargs):
msg = ''
if out:
msg += "stdout: %s" % (out, )
if err:
msg += "\n:stderr: %s" % (err, )
module.fail_json(cmd=cmd, msg=msg, **kwargs)
def _ensure_virtualenv(module):
venv_param = module.params['virtualenv']
if venv_param is... |
import CTK
import Handler
HELPS = [('modules_handlers_ssi', _("Server Side Includes"))]
class Plugin_ssi (Handler.PluginHandler):
def __init__ (self, key, **kwargs):
kwargs['show_document_root'] = False
Handler.PluginHandler.__init__ (self, key, **kwargs)
Handler.PluginHandler.AddCommon (s... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import * # noqa
from ycm.tests.test_utils import ( CurrentWorkingDirectory, Extended... |
"""NASNet-A models for Keras.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras_applications import nasnet
from tensorflow.python.keras.applications import keras_modules_injection
from tensorflow.python.util.tf_export import keras_export
@ker... |
# -*- 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 model 'Tipo_User'
db.create_table(u'demo_tipo_user', (
... |
import os
import subprocess
from . import base
from . import filetype
from . import status
class CompileCheck(base.PerFileCheck):
COMPILECOMMAND = []
ONLY_IF_OLDFILE_COMPILES = True
def prepareOldFileDir(self, dirname):
return dirname
def checkOldFile(self, changedFile):
with base.T... |
"""This plugin provides test results in the standard XUnit XML format.
It's designed for the `Jenkins`_ (previously Hudson) continuous build
system, but will probably work for anything else that understands an
XUnit-formatted XML representation of test results.
Add this shell command to your builder ::
nosetests... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
navigate... |
"""Path tracking utilities, representing mapper graph traversals.
"""
from .. import inspection
from .. import util
from .. import exc
from itertools import chain
from .base import class_mapper
import logging
log = logging.getLogger(__name__)
def _unreduce_path(path):
return PathRegistry.deserialize(path)
_W... |
import sip
sip.setapi('QString', 2)
from PyQt4 import QtCore, QtGui
from embeddeddialog import Ui_embeddedDialog
from embeddeddialogs_rc import *
class CustomProxy(QtGui.QGraphicsProxyWidget):
def __init__(self, parent=None, wFlags=0):
super(CustomProxy, self).__init__(parent, wFlags)
self.popu... |
import re
from django.db.backends import BaseDatabaseIntrospection
# This light wrapper "fakes" a dictionary interface, because some SQLite data
# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
# as a simple dictionary lookup.
class FlexibleFieldLookupDict:
# Maps SQL types to Django... |
import sys
import socket
import fcntl
import struct
import array
import os
import binascii
# Roughly based on http://voorloopnul.com/blog/a-python-netstat-in-less-than-100-lines-of-code/ by Ricardo Pascal
STATE_ESTABLISHED = '01'
STATE_SYN_SENT = '02'
STATE_SYN_RECV = '03'
STATE_FIN_WAIT1 = '04'
STATE_FIN_WAIT2 = '05... |
import hr_expense
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import tempfile
import time
import urllib2
from tempest.common import commands
from tempest import config
from tempest import exceptions
from tempest.scenario import manager
from tempest.services.network import resources as net_resources
from tempest import test
config = config.CONF
class TestLoadBalancerBasic(mana... |
import hr_evaluation
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from .main import Core
from uuid import uuid4
def start():
return Core()
config = [{
'name': 'core',
'order': 1,
'groups': [
{
'tab': 'general',
'name': 'basics',
'description': 'Needs restart before changes take effect.',
'wizard': True,
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qt_wfm_interface.ui'
#
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_InterfaceWindow(object):
def setupUi(self, InterfaceWindow):
Inte... |
from django.db import models
from django.contrib.auth.models import User
CAMPSTATUS = (
(0, 'Deleted'),
(1, 'Accepting new members'),
(2, 'Closed to new members'),
(3, 'Camp will not come to Midburn 2016'),
)
# Create your models here.
class Camp(models.Model):
users = models.ManyToManyField(User)
... |
import numpy as np
from ..utils import read_str
def _unpack_matrix(fid, rows, cols, dtype, out_dtype):
"""Unpack matrix."""
dtype = np.dtype(dtype)
string = fid.read(int(dtype.itemsize * rows * cols))
out = np.frombuffer(string, dtype=dtype).reshape(
rows, cols).astype(out_dtype)
return ... |
# -----------------------------------------------------------------------------
# yacc_error3.py
#
# Bad p_error() function
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
# ... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Employee and Attendance"),
"items": [
{
"type": "doctype",
"name": "Employee",
"description": _("Employee records."),
},
{
"type": "doctype",
"name": "Employee Attendance To... |
import sys, os
# Delay import _tkinter until we have set TCL_LIBRARY,
# so that Tcl_FindExecutable has a chance to locate its
# encoding directory.
# Unfortunately, we cannot know the TCL_LIBRARY directory
# if we don't know the tcl version, which we cannot find out
# without import Tcl. Fortunately, Tcl will itself ... |
import psycopg2
import psycopg2.extras
from steersuitedb.Util import getTime
from Sequence import TestSequence
# this is not completely encapsulated by another transaction so it should
# be used by the client when inserting data
class Test(object):
"""A simple example class"""
__id_name = "test_id"
__tabl... |
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard.dashboards.project.routers import\
tables as r_tables
class DeleteRouter(r_tables.DeleteRouter):
redirect_url = "horizon:project:network_topology:router"
class RoutersTable(r_tables.RoutersTable):
class Meta:
name =... |
import numpy as np
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrixPyTables
from pylearn2.datasets.dense_design_matrix import DefaultViewConverter
from pylearn2.datasets.dense_design_matrix import from_dataset
from pylearn2.utils im... |
from contextlib import closing
import pytest
import sqlalchemy
from sqlalchemy.sql.schema import Table as DbTable
from osmaxx.utils.frozendict import frozendict
from tests.conftest import TagCombination
from tests.conversion.converters.inside_worker_test.conftest import slow
from tests.conversion.converters.inside_wo... |
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
def _system_state_change(module, flavor):
state = module.params['state']
if state == 'present' and not flavor:
return True
if state == 'absent' and flavor:
return True
return False
def main():
arg... |
"""
A Django settings file for use on AWS while running
database migrations, since we don't want to normally run the
LMS with enough privileges to modify the database schema.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=... |
"""
Master: Handles the program loop
"""
import pcap, Queue, logging
import contextlib
import ethercut.ui as ui
import ethercut.log as log
import ethercut.sniff as sniff
import ethercut.utils as utils
import ethercut.net.link as link
import ethercut.discovery as discovery
import ether... |
from django.test import TestCase
from django.conf import settings
import mock
from oscar.apps.basket import forms
from oscar.test import factories
class TestBasketLineForm(TestCase):
def setUp(self):
self.basket = factories.create_basket()
self.line = self.basket.all_lines()[0]
def mock_ava... |
#! /usr/bin/env python
from openturns import *
from math import *
from math import *
def printNumericalPoint(point, digits):
oss = "["
eps = pow(0.1, digits)
for i in range(point.getDimension()):
if i == 0:
sep = ""
else:
sep = ","
if fabs(point[i]) < eps:... |
#! /usr/bin/env python
"""Read/write data from an ESRI ASCII file into a RasterModelGrid.
ESRI ASCII functions
++++++++++++++++++++
.. autosummary::
~landlab.io.esri_ascii.read_asc_header
~landlab.io.esri_ascii.read_esri_ascii
~landlab.io.esri_ascii.write_esri_ascii
"""
import os
import pathlib
import r... |
from gi.repository import Gtk
import logging
import os.path
from threading import (
Thread,
Timer
)
import pylast
from xl import (
common,
event,
player,
providers,
settings
)
from xl.nls import gettext as _
from xlgui import icons
from xlgui.widgets.menu import MenuItem
from xlgui.widget... |
import netaddr
import netaddr.core as netexc
from oslo_config import cfg
from oslo_log import log as logging
import six
import webob
from webob import exc
from nova.api.openstack import extensions
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova.i18n import _LE
impo... |
from sympy.polys.rings import ring
from sympy.polys.domains import ZZ, QQ, AlgebraicField
from sympy.polys.modulargcd import (
modgcd_univariate,
modgcd_bivariate,
_chinese_remainder_reconstruction_multivariate,
modgcd_multivariate,
_to_ZZ_poly,
_to_ANP_poly,
func_field_modgcd,
_func_fie... |
import pytest
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as splin
from numpy.testing import assert_allclose
try:
import sparse
except Exception:
sparse = None
pytestmark = pytest.mark.skipif(sparse is None,
reason="pydata/sparse not installed")
... |
print(int(False))
print(int(True))
print(int(0))
print(int(1))
print(int(+1))
print(int(-1))
print(int('0'))
print(int('+0'))
print(int('-0'))
print(int('1'))
print(int('+1'))
print(int('-1'))
print(int('01'))
print(int('9'))
print(int('10'))
print(int('+10'))
print(int('-10'))
print(int('12'))
print(int('-12'))
prin... |
__all__ = ['Parser']
import struct
import logging
from exceptions import ParseError
import core
# http://www.pcisys.net/~melanson/codecs/rmff.htm
# http://www.pcisys.net/~melanson/codecs/
# get logging object
log = logging.getLogger(__name__)
class RealVideo(core.AVContainer):
def __init__(self, file):
... |
"""
Directives for typically HTML-specific constructs.
"""
__docformat__ = 'reStructuredText'
import sys
from docutils import nodes, utils
from docutils.parsers.rst import Directive
from docutils.parsers.rst import states
from docutils.transforms import components
class MetaBody(states.SpecializedBody):
class ... |
"""Contains the definition of the Inception V4 architecture.
As described in http://arxiv.org/abs/1602.07261.
Inception-v4, Inception-ResNet and the Impact of Residual Connections
on Learning
Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, Alex Alemi
"""
from __future__ import absolute_import
from __futur... |
from builtins import range
import re
from . import Mesh
from . import Vertex
from . import Cell
from . import BBox
from . import Field
from . import FieldID
from . import ValueType
debug = 0
def readEnsightGeo(name, partFilter, partRec):
"""
Reads Ensight geometry file (Ensight6 format) and returns corresp... |
from openerp import tools
import openerp.addons.decimal_precision as dp
from openerp.osv import fields,osv
class account_invoice_report(osv.osv):
_name = "account.invoice.report"
_description = "Invoices Statistics"
_auto = False
_rec_name = 'date'
def _compute_amounts_in_user_currency(self, cr, u... |
import OpenPNM
import scipy as sp
class GenericNetworkTest:
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[10, 10, 10])
def teardown_class(self):
mgr = OpenPNM.Base.Workspace()
mgr.clear()
def test_find_connected_pores_numeric_not_flattend(self):
a = self.... |
# coding: latin-1
import unittest
import ctypes
from ctypes.test import need_symbol
import _ctypes_test
@need_symbol('c_wchar')
class UnicodeTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
dll = ctypes.CDLL(_ctypes_test.__file__)
cls.wcslen = dll.my_wcslen
cls.wcslen.argt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.