content string |
|---|
"""Build model for inference or training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import logging
import nets
from ops import icp_grad # pylint: disable=unused-import
from ops.icp_op import icp
import project
import reader
import tensor... |
microcode = '''
def macroop PADDB_MMX_MMX {
maddi mmx, mmx, mmxm, size=1, ext=0
};
def macroop PADDB_MMX_M {
ldfp ufp1, seg, sib, disp, dataSize=8
maddi mmx, mmx, ufp1, size=1, ext=0
};
def macroop PADDB_MMX_P {
rdip t7
ldfp ufp1, seg, riprel, disp, dataSize=8
maddi mmx, mmx, ufp1, size=1, ext... |
# coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... |
"""
Tests of neo.io.brainwaresrcio
"""
import logging
import os.path
import unittest
import numpy as np
import quantities as pq
from neo.core import (Block, Event,
Group, Segment, SpikeTrain)
from neo.io import BrainwareSrcIO, brainwaresrcio
from neo.test.iotest.common_io_test import BaseTestI... |
"""Unittests for heapq."""
import random
import unittest
from test import test_support
import sys
# We do a bit of trickery here to be able to test both the C implementation
# and the Python implementation of the module.
# Make it impossible to import the C implementation anymore.
sys.modules['_heapq'] = 0
# We must... |
# Read 32 messages and verify that they are not fragmented.
# This can be removed if the "reassemble small messages" feature is removed. See
# https://crbug.com/1086273.
from mod_pywebsocket import common
from mod_pywebsocket import msgutil
NUMBER_OF_MESSAGES = 32
def web_socket_do_extra_handshake(request):
# D... |
# Django settings for {{ project_name }} project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... |
from classserializer import UserManager, User
from soaplib.core import Application
from soaplib.core.model.clazz import ClassModel
from soaplib.core.model.primitive import Integer, String
from soaplib.core.service import soap, DefinitionBase
from soaplib.core.server import wsgi
computer_database = {}
computerid_seq =... |
from openerp.osv import orm
class MergePartnerAutomatic(orm.TransientModel):
_inherit = 'base.partner.merge.automatic.wizard'
def _update_values(self, cr, uid, src_partners, dst_partner, context=None):
"""Make sure we don't forget to update the stored value of
invoice field commercial_partner... |
# -*- 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 'CourseAuthorization'
db.create_table('bulk_email_courseauthorization', (
('id', ... |
#!/usr/bin/env python
from socket import *
from optparse import OptionParser
UDP_ADDR = "0.0.0.0"
UDP_PORT = 7724
BUFFER_SIZE = 65536
#HEADER_KEYS = ['Logger', 'Level', 'Source-File', 'Source-Function', 'Source-Line', 'TimeStamp']
HEADER_KEYS = {
'mini': ('Level'),
'standard': ('Logger', 'Level', 'Source-Func... |
import math
from gnuradio import gr, gr_unittest, analog, blocks
class test_pll_freqdet(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block()
def tearDown (self):
self.tb = None
def test_pll_freqdet(self):
expected_result = (0.0,
4.3388892... |
# Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklable (module imports are okay... |
#._cv_part guppy.heapy.test.test_ER
# Tests of equivalence relations.
# These are also tested by test_Classifiers.
# This is some more tests, tailored esp. to the user view.
# (test_Classifiers was so slow already, so I start over)
# o Intended to be exhaustive wrt all ER's defined
#
# o Intersection of ER's
fro... |
"""Helper library for sharding during TPU compilation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import tensor_shape
_DEFAULT_NUMBER_OF_SHARDS = 1
... |
"""
Constraints
"""
class BadValue(ValueError):
def __init__(self, desc, obj, col, value, *args):
self.desc = desc
self.col = col
# I want these objects to be garbage-collectable, so
# I just keep their repr:
self.obj = repr(obj)
self.value = repr(value)
fu... |
import time
from twitter.common.quantity import Amount, Time
from .gauge import NamedGauge, gaugelike, namablegauge
class Rate(NamedGauge):
"""
Gauge that computes a windowed rate.
"""
@staticmethod
def of(gauge, name = None, window = None, clock = None):
kw = {}
if window: kw.update(window = wind... |
from __future__ import unicode_literals
import os
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlparse,
compat_urllib_request,
)
class MofosexIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?P<url>mofosex\.com/videos/(?P<i... |
#!/usr/bin/env python
#coding=utf-8
import json
import yaml
from aliyunsdkcore import client
from aliyunsdkrds.request.v20140815 import CreateAccountRequest,GrantAccountPrivilegeRequest,DeleteAccountRequest,DescribeAccountsRequest
# 添加用户
def AddUser(DBInstanceId,username,passwd):
accessKeyId, accessKeySecret = ""... |
"""Seqan Doc Links for Trac.
Version 0.1.
Copyright (C) 2010 Manuel Holtgrewe
Install by copying this file into the plugins directory of your trac
work directory. In your trac.ini, you can use something like this
(the following also shows the defaults).
[seqan_doc_links]
prefix = seqan
base_url = http://www.... |
from taiga.requestmaker import RequestMaker
from taiga.models import Task, Tasks
import unittest
from mock import patch
import six
if six.PY2:
import_open = '__builtin__.open'
else:
import_open = 'builtins.open'
class TestTasks(unittest.TestCase):
@patch('taiga.requestmaker.RequestMaker.get')
def tes... |
import errno
import logging
import re
from webkitpy.layout_tests.models import test_expectations
_log = logging.getLogger(__name__)
class LayoutTestFinder(object):
def __init__(self, port, options):
self._port = port
self._options = options
self._filesystem = self._port.host.filesystem
... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import os
import json
import pandas as pd
import xmltodict
import shutil
# RiBuild Modules
from delphin_6_automation.dat... |
""" Lint for IDL """
import os
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_node import IDLAttribute, IDLNode
from idl_ast import IDLAst
from idl_option import GetOption, Option, ParseOptions
from idl_outfile import IDLOutFile
from idl_visitor import IDLVisitor
Option('wcomment', 'Disable warnin... |
# manually build and launch your instances
# remember that the ip field deals with a private ip
def _get_parameter(node_id, private_ip, min_key, max_key):
p = {"id": node_id, "ip": private_ip, "min_key": min_key, "max_key": max_key}
return p
def create_instances_parameters():
"""
first = _get_param... |
#!/usr/bin/python -u
import sys
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
ctxt = libxml2.createFileParserCtxt("valid.xml")
ctxt.validate(1)
ctxt.parseDocument()
doc = ctxt.doc()
valid = ctxt.isValid()
if doc.name != "valid.xml":
print "doc.name failed"
sys.exit(1)
root = doc.children
if r... |
from __future__ import absolute_import, unicode_literals
from django.core.paginator import Paginator
from django.core import urlresolvers
from django.utils.html import mark_safe, escape
import django_tables2 as tables
from django_tables2.tables import Table
from django_tables2.utils import Accessor as A, AttributeDic... |
"""
==============================================
Label Propagation learning a complex structure
==============================================
Example of LabelPropagation learning a complex internal structure
to demonstrate "manifold learning". The outer circle should be
labeled "red" and the inner circle "blue". Be... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.common import hashDBWrite
from lib.core.data import kb
from lib.core.data impor... |
from bs4 import BeautifulSoup
import requests
from findmyhash.algo import Algo
from findmyhash.errors import *
from .Service import Service
class MD5DECRYPTION(Service):
NAME = "md5decryption"
HOST = "http://md5decryption.com"
ALGO_SUPPORTED = [Algo.MD5]
@classmethod
def algo_supported(cls,... |
"""The Flavor Rxtx API extension."""
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
authorize = extensions.soft_extension_authorizer('compute', 'flavor_rxtx')
class FlavorRxtxController(wsgi.Controller):
def _extend_flavors(self, req, flavors):
for flavor in flavors:
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
try:
import boto.ec2.autoscale
import boto.exception
from boto.ec2.auto... |
"""Unit tests for filter.py."""
import unittest2 as unittest
from filter import _CategoryFilter as CategoryFilter
from filter import validate_filter_rules
from filter import FilterConfiguration
# On Testing __eq__() and __ne__():
#
# In the tests below, we deliberately do not use assertEqual() or
# assertNotEquals()... |
"""A library for integrating Python's builtin ``ssl`` library with CherryPy.
The ssl module must be importable for SSL functionality.
To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of
``BuiltinSSLAdapter``.
"""
try:
import ssl
except ImportError:
ssl = None
from cherrypy import ws... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.clou... |
"""Functions for use in URLsconfs."""
from functools import partial
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from .resolvers import (
LocalePrefixPattern, RegexPattern, RoutePattern, URLPattern, URLResolver,
)
def include(arg, namespace=None):
app_name = No... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flask import jsonify
from flask_restplus import inputs
from flexget.api import api, APIResource
from flexget.api.app import NotFoundError, BadRequest, etag
from flexg... |
__revision__ = "src/engine/SCons/Options/__init__.py 2013/03/03 09:48:35 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy
This is for backwards compatibility. The new equivalent is the Variables/
class hierarchy. These will have deprecation warnings added (some day),
and will then be rem... |
from __future__ import print_function
import apt
import hashlib
class Package(object):
def __init__(self, pkg):
#handle only packages of type 'apt.package.Package'
if not isinstance(pkg, apt.package.Package):
raise Exception("pkg type not 'apt.package.Package'")
self.__pkg = pk... |
import json
from django import forms
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['HStoreField']
class HStoreField(forms.CharField):
"""A field for HStore data which accepts JSON input."""
widget = forms.Te... |
from __future__ import print_function
import os
import logging
import gzip
import urllib
from six import StringIO
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_noop as _
log = logging.getLogger(__name__)
URL = 'http://geolite.maxmi... |
"""Abstract injector class for GS requests."""
class FileNotFoundError(Exception):
"""Thrown by a subclass of CloudBucket when a file is not found."""
pass
class BaseCloudBucket(object):
"""An abstract base class for working with GS."""
def UploadFile(self, path, contents, content_type):
"""Uploads a f... |
from kraken import plugins
from kraken.core.maths import Vec3
from kraken_components.generic.tentacle_component import TentacleComponentGuide, TentacleComponentRig
from kraken.core.profiler import Profiler
from kraken.helpers.utility_methods import logHierarchy
Profiler.getInstance().push("tentacle_build")
tentacle... |
# -*- coding: utf-8 -*-
#
# WTForms documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 01 15:29:36 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't... |
"""Locked file interface that should work on Unix and Windows pythons.
This module first tries to use fcntl locking to ensure serialized access
to a file, then falls back on a lock file if that is unavialable.
Usage:
f = LockedFile('filename', 'r+b', 'rb')
f.open_and_lock()
if f.is_locked():
print '... |
from __future__ import absolute_import
from __future__ import print_function
from twisted.internet import defer
from twisted.trial import unittest
from buildbot.data import forceschedulers
from buildbot.schedulers.forcesched import ForceScheduler
from buildbot.test.util import endpoint
expected_default = {
'all_... |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import logging
from os.path import realpath, dirname, join
from logging import config, DEBUG, INFO
__all__ = ["log"]
class Log(object):
"""Wrapper of Python logging module for easier usage
:Example:
... |
import re
from generate_utils import *
# files to generate
fx_signatures = [ 'scf', 'scc', 'fcf', 'fcc', 'ccf', 'ccc' ]
roots = ['gr_freq_xlating_fir_filter_XXX']
def expand_h_cc_i (root, code3):
d = init_dict (root, code3)
expand_template (d, root + '.h.t')
expand_template (d, root + '.cc.t')
expan... |
# -*- coding: utf-8 -*-
import bot
class M_List(bot.Module):
index = "list"
def register(self):
self.addcommand(
self.list,
"list",
"List modules or, if <module> is specified, commands in a module, "
"<module> can be * for all commands.",
... |
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Collect information about node within ELB
'''
#
# Copyright 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
"""Utility classes for testing checkpointing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops as ops_lib
from tensorflow.python.ops import gen_lookup_ops
from tens... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import struct
import Config
import time
from Util import Util
from cstruct import CStruct
# PostEntry.accessed[0]
FILE_SIGN = 0x1 #/* In article mode, Sign , Bigman 2000.8.12 ,in accessed[0] */
# not used
FILE_OWND = 0x2 #/* accessed array */
#... |
import subprocess
import shlex
from subprocess import call
class PlayBulbCandle:
commands = {
'setName': '0x001C', # writeReq needed get/set
'setEffect': '0x0014', # get/set
'setColor': '0x0016', # get/set
'getType': '0x0023',
'getFamily': '0x0025',
'getFirmwareVersion': '0x0027',
'getAppVersion': '0x0... |
from tempest.api.volume import base
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
"""Negative tests of volume services"""
@classmethod
def resource_setup(cls):
super(VolumeServicesNegativeTest, cls).res... |
import json
import logging
import time
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.hooks.mysql_hook import MySqlHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from collections import OrderedDict
from datetime import date, datetime
fro... |
#!/usr/bin/python
import urllib2
import urllib
from simple_config import load_config
tester_config = load_config("tester.conf")
class ServiceTester:
def __init__(self, config=None):
if config is None:
config = tester_config
self.config = config
self.timeout_seconds = config["timeout_... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
su... |
import smtplib
import sys
import email
from email.mime.text import MIMEText
send_mail_host = 'smtp_host'
send_mail_user = 'smtp_user'
send_mail_user_name = u'send_mail_user_name'
send_mail_pswd = 'send_mail_password'
send_mail_postfix = 'send_mail_postfix'
get_mail_user = 'get_mail_user'
charset = 'utf-8'
get_mail_po... |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... |
import sys, struct
import layoutrom, buildrom
from python23compat import as_bytes
def subst(data, offset, new):
return data[:offset] + new + data[offset + len(new):]
def checksum(data, start, size, csum):
sumbyte = buildrom.checksum(data[start:start+size])
return subst(data, start+csum, sumbyte)
def mai... |
import sys
def alignpos(pos, alignbytes):
mask = alignbytes - 1
return (pos + mask) & ~mask
def checksum(data):
ords = map(ord, data)
return sum(ords)
def main():
inname = sys.argv[1]
outname = sys.argv[2]
# Read data in
f = open(inname, 'rb')
data = f.read()
f.close()
co... |
from msrest.serialization import Model
class ResourceType(Model):
"""Resource Type.
:param name: The resource type name.
:type name: str
:param display_name: The resource type display name.
:type display_name: str
:param operations: The resource type operations.
:type operations: list of ... |
import pilas
class Camara(object):
"""Representa el punto de vista de la ventana.
Los atributos ``x`` e ``y`` indican cual debe ser el
punto central de la pantalla. Por defecto estos
valores con (0, 0)."""
def __init__(self):
"""Inicializa la cámara.
"""
pass
@pilas.... |
from sqlalchemy import MetaData, Table
def upgrade(migrate_engine):
"""Remove the instance_group_metadata table."""
meta = MetaData(bind=migrate_engine)
if migrate_engine.has_table('instance_group_metadata'):
group_metadata = Table('instance_group_metadata', meta, autoload=True)
group_met... |
#!/usr/bin/python
# Terminator by Chris Jones <<EMAIL>>
# GPL v2 only
"""titlebar.py - classes necessary to provide a terminal title bar"""
import gtk
import gobject
from version import APP_NAME
from util import dbg
from terminator import Terminator
from editablelabel import EditableLabel
# pylint: disable-msg=R0904... |
# encoding: UTF-8
__author__ = 'CHENXY'
# C++和python类型的映射字典
type_dict = {
'int': 'int',
'char': 'string',
'double': 'float',
'short': 'int',
'unsigned': 'string'
}
def process_line(line):
"""处理每行"""
if '///' in line: # 注释
py_line = process_comment(line)
elif 'typede... |
import hashlib
import mock
from neutron.plugins.ml2.drivers.macvtap import macvtap_common as m_common
from neutron.tests import base
MOCKED_HASH = "MOCKEDHASH"
class MockSHA(object):
def hexdigest(self):
return MOCKED_HASH
class MacvtapCommonTestCase(base.BaseTestCase):
@mock.patch.object(hashlib,... |
from openerp import pooler
class WebKitHelper(object):
"""Set of usefull report helper"""
def __init__(self, cursor, uid, report_id, context):
"constructor"
self.cursor = cursor
self.uid = uid
self.pool = pooler.get_pool(self.cursor.dbname)
self.report_id = report_id
... |
''' unit test for ONTAP Command Ansible module '''
from __future__ import print_function
import json
import pytest
from units.compat import unittest
from units.compat.mock import patch, Mock
from ansible.module_utils import basic
from ansible.module_utils._text import to_bytes
import ansible.module_utils.netapp as ne... |
import datetime as dt
import logging
import dateutil.parser
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.paginator import Paginator, EmptyPage
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse,... |
"""Tests for StatSummarizer Python wrapper."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.framework import attr_value_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.python.framework import dtypes
from tensorflo... |
import threading
from urllib import quote, getproxies
from urlparse import urlparse
import os.path
import time
import traceback
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import ss, toSafeString, \
toUnicode, sp
from couchpotato.core.helpers.variable import md5, i... |
from __future__ import division, absolute_import, print_function
from collections import defaultdict
import datetime
import sys
import atexit
import platform
import sip
import numpy as N
from .. import qtall as qt
from .utilfuncs import rrepr
from .version import version
from ..compat import citems, curlrequest, curl... |
from datetime import datetime
import time
import htmlentitydefs
import re
import locale
from urllib import quote
from email.utils import parsedate
def parse_datetime(string):
return datetime(*(parsedate(string)[:6]))
def parse_html_value(html):
return html[html.find('>')+1:html.rfind('<')]
def parse_a_hr... |
{
'name' : 'Venezuela - Accounting',
'version': '1.0',
'author': ['OpenERP SA', 'Vauxoo'],
'category': 'Localization/Account Charts',
'description':
"""
Chart of Account for Venezuela.
===============================
Venezuela doesn't have any chart of account by law, but the default
proposed in Op... |
from gi.repository import Gtk
class ValidatableMaskedEntry(Gtk.Entry):
__gtype_name__ = 'ValidatableMaskedEntry'
class UndoableEntry(Gtk.Entry):
__gtype_name__ = 'UndoableEntry'
class StyledTextEditor(Gtk.TextView):
__gtype_name__ = 'StyledTextEditor'
class UndoableBuffer(Gtk.TextBuffer):
__gtype_na... |
import os
import sys
import gtk
import gtk.glade
gtk.glade.bindtextdomain("rhn-client-tools", "/usr/share/locale")
# We have to import gnome.ui before using glade for our GnomeUi widgets.
# ie the druid. Get rid of these widgets, and we won't need this import.
# see http://www.async.com.br/faq/pygtk/index.py?req=sho... |
"""Resumable decompression
A ctypes interface to zlib decompress/inflate functions that mimics
zlib.decompressobj interface but also supports getting and setting the
z_stream state to suspend/serialize it and then resume the decompression
at a later time.
"""
import cPickle
import ctypes
import zlib
if zlib.ZLIB_VER... |
from django.contrib.gis.gdal import Envelope, OGRException
from django.utils import unittest
class TestPoint(object):
def __init__(self, x, y):
self.x = x
self.y = y
class EnvelopeTest(unittest.TestCase):
def setUp(self):
self.e = Envelope(0, 0, 5, 5)
def test01_init(self):
... |
"""
A comparison of different methods in GLM
Data comes from a random square matrix.
"""
from datetime import datetime
import numpy as np
from sklearn import linear_model
from sklearn.utils.bench import total_seconds
if __name__ == '__main__':
import pylab as pl
n_iter = 40
time_ridge = np.empty(n_it... |
import sys
from twisted.python import log
from twisted.internet import reactor
from twisted.internet.defer import Deferred, \
DeferredList, \
gatherResults, \
returnValue, \
inlin... |
import os
import sys
from .workspace import get_workspace_location
from .util import path_has_prefix
def print_var(key, value, terse, export):
sys.stdout.write("%s\n" % value if terse else "%s%s=%s\n" % ("export " if export else "", key, value))
def run(args):
wsdir = get_workspace_location(args.workspace)
... |
"""
@author: Monnappa K A
@license: GNU General Public License 3.0
@contact: <EMAIL>
@Description: Static Analysis Module
"""
import magic
import hashlib
import json
import urllib2
import urllib
import sys
import os
import yara
import subprocess
class Static:
def __init__(self, mal_file):
... |
import re
def strip_comments_helper(data):
"""remove all /* */ format comments and surrounding whitespace."""
p = re.compile(r'[\s]*/\*.*?\*/[\s]*', re.DOTALL)
return p.sub('',data)
def minimize(data, exclude=None):
"""Central function call. This will call all other compression
functions. To ad... |
from confluent_kafka import Producer, KafkaError
from confluent_kafka.avro import AvroProducer
import json
import ccloud_lib
if __name__ == '__main__':
# Initialization
args = ccloud_lib.parse_args()
config_file = args.config_file
topic = args.topic
conf = ccloud_lib.read_ccloud_config(config_fil... |
import numpy as np
from games.constants import *
k = BLACK
g = GREEN
w = WHITE
r = RED
b = BLUE
m = DARK_RED
n = DARK_BLUE
p = PURPLE
o = ORANGE
y = YELLOW
NAV_SCREENS = {
"Snake":
np.array(
[
[m, w, m, m, m, m, w, m],
[w, m, m, m, m, m, m, w],
[m, w, m, m, m, m, w... |
"""
=====================
SVM: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
The sample weighting rescales the C parameter, which means that the classifier
puts more emphasis on getting these points right. The effect might ... |
"""
This component spies on DNS replies, stores the results, and raises events
when things are looked up or when its stored mappings are updated.
Similar to NOX's DNSSpy component, but with more features.
"""
from pox.core import core
import pox.openflow.libopenflow_01 as of
import pox.lib.packet as pkt
import pox.li... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
CanopyModel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
---------------------
... |
import os
from traitlets import Bool
from traitlets import default
from traitlets import Dict
from traitlets import Float
from traitlets import Int
from traitlets import List
from traitlets import TraitType
from traitlets import Union
from traitlets.config import Configurable
try:
# Traitlets >= 4.3.3
from tr... |
from pylib.base import environment
from pylib.device import adb_wrapper
from pylib.device import device_errors
from pylib.device import device_utils
from pylib.utils import parallelizer
class LocalDeviceEnvironment(environment.Environment):
def __init__(self, args, _error_func):
super(LocalDeviceEnvironment, s... |
"""Tests for student tracking"""
import mock
from django.test import TestCase
from django.core.urlresolvers import reverse, NoReverseMatch
from track.models import TrackingLog
from track.views import user_track
from nose.plugins.skip import SkipTest
class TrackingTest(TestCase):
"""
Tests that tracking logs ... |
"""Stuff that differs in different Python versions"""
import os
import imp
import sys
import site
__all__ = ['WindowsError']
uses_pycache = hasattr(imp, 'cache_from_source')
class NeverUsedException(Exception):
"""this exception should never be raised"""
try:
WindowsError = WindowsError
except NameError:
... |
import webob
import webob.exc
from nova.api.openstack import extensions
from nova import exception
from nova.i18n import _
from nova import objects
authorize = extensions.extension_authorizer('compute', 'fixed_ips')
class FixedIPController(object):
def show(self, req, id):
"""Return data about the given... |
from openerp.osv import orm
from openerp.tools.translate import _
class sale_order(orm.Model):
_inherit = "sale.order"
def fiscal_position_change(
self, cr, uid, ids, fiscal_position, order_line,
context=None):
'''Function executed by the on_change on the fiscal_position field... |
"""Functional tests for XLA Gather Op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.compiler.tests import xla_test
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
f... |
import os
import sys
from distutils.core import setup
from distutils.extension import Extension
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
readme = f.read()
f.close()
setup_kwargs = {}
try:
from Cython.Distutils import build_ext
except ImportError:
cython_installed = False
else:
cytho... |
import os
import struct
import volatility.plugins.taskmods as taskmods
import volatility.debug as debug
import volatility.obj as obj
import volatility.exceptions as exceptions
class ProcExeDump(taskmods.DllList):
"""Dump a process to an executable file sample"""
def __init__(self, config, *args, **kwargs):
... |
import os
import shutil
import tempfile
import contextlib
import unittest
import argparse
import sys
import torch
import __main__
import random
import inspect
from numbers import Number
from torch._six import string_classes
from collections import OrderedDict
import numpy as np
from PIL import Image
from _assert_uti... |
"""Module for supporting the lxml.etree library. The idea here is to use as much
of the native library as possible, without using fragile hacks like custom element
names that break between releases. The downside of this is that we cannot represent
all possible trees; specifically the following are known to cause proble... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.