content stringlengths 4 20k |
|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Google Chrome history event formatters."""
import unittest
from plaso.formatters import chrome
from tests.formatters import test_lib
class ChromeFileDownloadFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the Chrome file download event forma... |
import os
import sys
#conary
from conary.deps import deps
from conary import versions
from conary.versions import VersionFromString as VFS
from rmake.lib import recipeutil
#test
from rmake_test import rmakehelp
from conary_test import recipes
from rmake_test import fixtures
class RecipeUtilTest(rmakehelp.RmakeHelpe... |
{
"name": "GOODERP Goods Management",
"version": '11.11',
"author": 'ZhengXiang',
"website": "http://www.osbzr.com",
"category": "gooderp",
"depends": ['core'],
"description":
'''
该模块继承自 core 模块,进一步扩展定义了商品及其相关的类。
''',
"data": [
'security/groups.xml',
... |
# -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... |
# -*- coding=utf-8
import logging
import random
import string
import sys
import os
import time
import filecmp
import hashlib
from _threading_local import local
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, stream=sys.stdout, format="%(asctime)s - %(message)s")
access_id = os.e... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... |
#!/usr/bin/env python
"""
Copyright 2018-present Open Networking Foundation
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 License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by appl... |
import json
from collections import namedtuple, Iterable, OrderedDict
import numpy as np
def isnamedtuple(obj):
"""Heuristic check if an object is a namedtuple."""
return isinstance(obj, tuple) \
and hasattr(obj, "_fields") \
and hasattr(obj, "_asdict") \
and callable(obj._asdi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Parsing routines for the ODB++ line record text format
according to the ODB++ 7.0 specification:
http://www.odb-sa.com/wp-content/uploads/ODB_Format_Description_v7.pdf
"""
from collections import defaultdict
from .Utils import readFileLines, readZIPFileLines
def filt... |
import json
import pytest
from health_check.backends import BaseHealthCheckBackend
from health_check.conf import HEALTH_CHECK
from health_check.exceptions import ServiceWarning
from health_check.plugins import plugin_dir
from health_check.views import MediaType
try:
from django.urls import reverse
except ImportE... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
VetEpiGIS-Tool
A QGIS plugin
Spatial functions for vet epidemiology
-------------------
begin : 2015-11-10
git sha : $Format:%H$
... |
"""
Cylinder formfactor in Born approximation
"""
import bornagain as ba
from bornagain import deg, angstrom, nm
def get_sample():
"""
Returns a sample with cylinders in a homogeneous environment ("air"),
implying a simulation in plain Born approximation.
"""
# defining materials
m_ambience = ... |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
out_path):
import os
from genomicode import filelib
from genomicode import... |
"""
Licensing:
This code is distributed under the MIT license.
Authors:
Original FORTRAN77 version of i4_sobol by Bennett Fox.
MATLAB version by John Burkardt.
PYTHON version by Corrado Chisari
Original Python version of is_prime by Corrado Chisari
Original MATLAB versions of other funct... |
import socket
import sys
import time
import eventlet
eventlet.monkey_patch()
from oslo.config import cfg
from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import constants as q_constants
from neutro... |
"""DHCPv6 Relay Agent"""
# pylint: disable=invalid-name,line-too-long
import pytest
import references
import misc
import srv_control
import srv_msg
@pytest.mark.v6
@pytest.mark.relay
def test_v6_relay_message_solicit_advertise():
misc.test_setup()
srv_control.config_srv_subnet('3000::/64', '3000::1-3000::... |
"""
This module provides a class for principal components analysis (PCA).
PCA is an orthonormal, linear transform (i.e., a rotation) that maps the
data to a new coordinate system such that the maximal variability of the
data lies on the first coordinate (or the first principal component), the
second greatest variabili... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param Stapling_Timeout: {"description": "OCSP Stapling Timeout", "format": "counter", "type": "number", "oid": "10", "optional": true, "size": "8"}
:param... |
# -*- coding: UTF-8 -*-
"""
win32timezone:
Module for handling datetime.tzinfo time zones using the windows
registry for time zone information. The time zone names are dependent
on the registry entries defined by the operating system.
Currently, this module only supports the Windows NT line of products
and not Win... |
import mock
import django_dynamic_fixture as fixture
from django.test import TestCase
from django.contrib.auth.models import User
from django.db.models.signals import pre_delete
from readthedocs.projects.models import Project
from ..models import GoldUser
from ..signals import delete_customer
class GoldSignalTests(... |
from layers.senders.text_message_sender import TextMessageSender
from layers.receivers.ack_receiver import AckReceiver
from models.sending_message import SendingMessage
from yowsup.layers.auth import YowAuthenticationProtocolLayer
from yowsup.layers.protocol_messages import YowMessagesProtocolLayer
from yowsup.layers.... |
from opus_core.variables.variable import Variable
from urbansim.functions import attribute_label
class number_of_potential_household_movers(Variable):
"""Number of households that should potentially move. Expects attribute 'potential_movers'
of household set that has 1's for households that should move, o... |
from django.contrib.auth.decorators import login_required
from thing.models import * # NOPEP8
from thing.stuff import * # NOPEP8
@login_required
def contracts(request):
"""Contracts"""
character_ids = list(Character.objects.filter(
apikeys__user=request.user.id,
apikeys__valid=True,
... |
"""
Antigrain Geometry Point Collection
This collection provides fast points. Output quality is perfect.
"""
from vispy import glsl
from . raw_point_collection import RawPointCollection
class AggPointCollection(RawPointCollection):
"""
Antigrain Geometry Point Collection
This collection provides fast p... |
# -*- coding: utf-8 -*-
#
# Utils Unit Tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3utils.py
#
import unittest
from s3.s3utils import *
from s3.s3data import S3DataTable
from s3.s3datetime import S3Calendar
# =============================================... |
# -*- encoding: utf-8 -*-
from thefuck.shells import thefuck_alias
from thefuck.utils import memoize
target_layout = '''qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'''
source_layouts = [u'''йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,''',
u'''ضصثقفغعهخحجچش... |
import sys
from random import randint
import pygame
from pygame.locals import QUIT,Rect,KEYDOWN,K_SPACE
pygame.init()
pygame.key.set_repeat(5,5)
SURFACE = pygame.display.set_mode((800,600))
FSPCLOCK = pygame.time.Clock()
def main():
walls = 80
ship_y = 250
velocity = 0
score = 0
slope = randint(1,... |
# -*- coding: utf-8 -*-
from .errors import ForbiddenError, UnauthorizedError
from app.detective.models import Topic
from app.detective.search import Search
from app.detective.neomatch import Neomatch
from app.detective.parser import schema
from app.detective.individual import IndividualA... |
#!/bin/python
import dnslib.intercept
import dnslib.server
import os
import re
import signal
import socket
import sys
class TimeoutInterceptResolver(dnslib.intercept.InterceptResolver):
def resolve(self, request, handler):
old_send = request.send
def new_send(self, *k, **kw):
kw["time... |
import re
from ....dependencies import DependentSet
from ...feature import Feature
from ...meta import aggregators, bools
class Diff(DependentSet):
def __init__(self, name, datasources):
super().__init__(name)
self.datasources = datasources
# Sitelinks
self.sitelinks_added = \
... |
import sys
import os, mapnik
from timeit import Timer, time
from nose.tools import *
from utilities import execution_path
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_clearing_image_data():
im ... |
"""Support for ZoneMinder binary sensors."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity,
)
from . import DOMAIN as ZONEMINDER_DOMAIN
async def async_setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the ZoneMinder binary sen... |
from __future__ import print_function
from __future__ import absolute_import
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: <EMAIL>
#
import khmer
from screed.fas... |
import pytest
from fixture.application import Application
import jsonpickle
import json
import os.path
import importlib
from fixture.db import DbFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__fi... |
# ----------------------------------------------------------------------------#
# Imports
# ----------------------------------------------------------------------------#
from flask import request, jsonify, abort, Blueprint
import models
mod = Blueprint('flashcard', __name__)
# retrieve multiple
@mod.route('/flashcar... |
from openerp import models, fields, api, _
from openerp.addons.decimal_precision import decimal_precision as dp
class ProductTemplate(models.Model):
_inherit = 'product.template'
task_work_ids = fields.One2many(
comodel_name='product.task.work', inverse_name='product_id',
string='Task Works')... |
"""This module is deprecated. Please use `airflow.providers.salesforce.hooks.salesforce`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.salesforce.hooks.salesforce import SalesforceHook, pd # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.salesforce.hoo... |
# -*- coding: utf-8 -*-
import copy
import logging
from lxml import etree, html
from openerp import SUPERUSER_ID, api, tools
from openerp.addons.website.models import website
from openerp.http import request
from openerp.osv import osv, fields
_logger = logging.getLogger(__name__)
class view(osv.osv):
_inherit... |
"""Verifies that a list of libraries is installed on the system.
Takes a list of arguments with every two subsequent arguments being a logical
tuple of (path, check_soname). The path to the library and either True or False
to indicate whether to check the soname field on the shared library.
Example Usage:
./check_cud... |
import openerp.tests.common as common
class TestContractRecurringInvoicingMarker(common.TransactionCase):
def setUp(self):
super(TestContractRecurringInvoicingMarker, self).setUp()
self.partner = self.env['res.partner'].create({
'name': 'Test',
'lang': 'en_US',
})
... |
import base64
import hashlib
import hmac
import sys
import time
import uuid
try:
from lxml import etree as ET
except ImportError:
from xml.etree import ElementTree as ET
from libcloud.common.base import ConnectionUserAndKey, XmlResponse
from libcloud.common.types import MalformedResponseError
from libcloud.ut... |
"""
This file defines BlockPictureExplorer, an explorer for
PictureSensor.
"""
from nupic.regions.PictureSensor import PictureSensor
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# BlockPictureExplorer
class BlockPictureExplorer(PictureSensor.PictureExplorer):
"""
Presents each category at an NxN "bl... |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# VORONOI.ACCRETION
# Laura L Watkins [<EMAIL>]
# - converted from IDL code by Michele Cappellari (bin2d_accretion)
# -----------------------------------------------------------------------------
from numpy import *
f... |
from .services.service_usage import ServiceUsageClient
from .services.service_usage import ServiceUsageAsyncClient
from .types.resources import OperationMetadata
from .types.resources import Service
from .types.resources import ServiceConfig
from .types.resources import State
from .types.serviceusage import BatchEnabl... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.catalog.CatalogItemList import CatalogItemList
from toontown.catalog import CatalogItem
from toontown.catalog.CatalogFurnitureItem import CatalogFurnitureItem, FLCloset, FLBank, FLPhon... |
import urllib2
from lxml import etree
from xml.etree.ElementTree import ElementTree
import string
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
try:
from supybot.i18n import PluginI... |
"""Provide functionality to record stream."""
import threading
from typing import List
import av
from homeassistant.core import callback
from .core import PROVIDERS, Segment, StreamOutput
@callback
def async_setup_recorder(hass):
"""Only here so Provider Registry works."""
def recorder_save_worker(file_out:... |
import datetime
import unittest
import morphlib
class StopwatchTests(unittest.TestCase):
def setUp(self):
self.stopwatch = morphlib.stopwatch.Stopwatch()
def test_tick(self):
self.stopwatch.tick('tick', 'a')
self.assertTrue(self.stopwatch.times('tick'))
self.assertTrue(self.... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
from msrestazure.azure_exceptions import CloudError
except ImportError:
pass
... |
"""
Load and retrieve OCSManager configuration
"""
import ConfigParser
import os
import logging
import re
import sys
log = logging.getLogger(__name__)
class OCSConfig(object):
"""OCSConfig class documentation. Load and retrieve ocsmanager
options from configuration file.
"""
def __init__(self, conf... |
import sys
sys.path.append('..')
from onem2mlib import *
if __name__ == '__main__':
# Create session
session = Session('http://localhost:8282', 'admin:admin')
# Get the <CSEBase> resource
cse = CSEBase(session, 'mn-cse')
# Get a list of all <remoteCSE> resource
remoteCSEs = cse.remoteCSEs()
# For simplicity... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
"""
Start the function name with 'is' or 'has' when returning bool.
This rule might be violated a lot because there are a lot of cases
in which functions return bool to indicate exceptions.
Please turn off this rule. If you think it's too overwhelming.
== Violation ==
bool checkSth() { <== Violation. The function... |
#!/usr/bin/env python
# vim: aui ts=4 sts=4 et sw=4
from django.core.exceptions import ValidationError
from django.utils.timezone import now
from rapidsms.tests.harness import RapidTest
from ..models import Message
__all__ = ['MessageLogModelTest']
class MessageLogModelTest(RapidTest):
def setUp(self):
... |
import numpy as np
from scipy.signal import lfilter, lfilter_zi, filtfilt, butter
from pandas import DataFrame
from .base import MultiSequencePreprocessingMixin
class Butterworth(MultiSequencePreprocessingMixin):
"""Smooth time-series data using a low-pass, zero-delay Butterworth filter.
Parameters
----... |
"""
❏DChars-FE❏ config_ini.py
"""
import configparser, os, codecs
CONFIG_INI = None
#///////////////////////////////////////////////////////////////////////////////
def read_configuration_file():
"""
function read_configuration_file()
read the config.ini and return the result.
... |
# -*- coding: utf-8 -*-
"""
This module implements the Search functionality of TheTVDb API.
Allows to search for tv series in the db.
See [Search API section](https://api.thetvdb.com/swagger#!/Search)
"""
from .base import TVDB
class Search(TVDB):
"""
Class that allow to search for series with filters.
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
解析各种时间字符串到时间对象或者标准字符串格式
"""
import re
import sys
import time
import datetime
reload(sys)
sys.setdefaultencoding("utf-8")
# 标准时间格式
STARDAND_FORMAT = '%Y-%m-%d %H:%M:%S'
# 中文数字
CHINESE_NUMS = u'〇一二三四五六七八九十'
# 纯数字格式
PATTERN_NUMBER_TIME = re.compile(ur'\d{8}')
# 标准时间格式的正则... |
from __future__ import absolute_import
import types
import numpy as np
__all__ = [
'autobinning',
]
def autobinning(data, method="freedman_diaconis"):
"""
This method determines the optimal binning for histogramming.
Parameters
----------
data: 1D array-like
Input data.
metho... |
# -*- coding: utf-8 -*-
##j## BOF
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;discuss
The following license agreement remains valid unless any additions... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetMessage(Choreography):
def __init__(self, temboo_session):
"""
Create a ne... |
# -*- coding: utf-8 -*-
###############################################################################################
#
# MediaPortal for Dreambox OS
#
# Coded by MediaPortal Team (c) 2013-2015
#
# This plugin is open source but it is NOT free software.
#
# This plugin may only be distributed to and executed... |
from __future__ import (
absolute_import, print_function, division, unicode_literals
)
import logging
import re
import sys
from datetime import datetime
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
CURRENT_YEAR = datetime.today().year
LICENSE_BLOB = """Copyright (c) %d The Jaege... |
"""
Module for creating Three.js geometry JSON nodes.
"""
import os
from .. import constants, logger
from . import base_classes, io, api
FORMAT_VERSION = 3
class Geometry(base_classes.BaseNode):
"""Class that wraps a single mesh/geometry node."""
def __init__(self, node, parent=None):
logger.debug(... |
from __future__ import with_statement
import maya.OpenMaya
import maya.cmds
import IECoreMaya
import _IECoreMaya
import StringUtil
class FnTransientParameterisedHolderNode( IECoreMaya.FnParameterisedHolder ) :
def __init__( self, object ) :
IECoreMaya.FnParameterisedHolder.__init__( self, object )
## Creates a... |
from jedi._compatibility import Python3Method
from jedi.common import unite
from jedi.parser.python.tree import ExprStmt, CompFor
class Context(object):
api_type = None
"""
To be defined by subclasses.
"""
predefined_names = {}
tree_node = None
def __init__(self, evaluator, parent_context... |
from __future__ import unicode_literals
import sys
import types
PY3 = sys.version_info[0] == 3
if PY3:
text_type = str
byte_type = bytes
import io
StringIO = io.BytesIO
class BaseClass(object):
def __repr__(self):
return self.__str__()
else:
text_type = unicode
byte_ty... |
import cProfile
import pstats
from django.core.management.base import BaseCommand
from weblate.trans.models import SubProject, Project
class Command(BaseCommand):
'''
Runs simple project import to perform benchmarks.
'''
help = 'performs import benchmark'
def add_arguments(self, parser):
... |
import random
def get_score():
roll = []
min = 7
removed = False
for num in range(0, 4):
newroll = random.randint(1, 6)
if newroll < min:
min = newroll
roll.append(newroll)
print("Rolls: ", roll)
highestthree = []
for num in range(0, 4):
if roll[num] == min and not removed:
removed = True
... |
def correlation(self, column_a, column_b):
"""
Calculate correlation for two columns of current frame.
Parameters
----------
:param column_a: (str) The name of the column from which to compute the correlation.
:param column_b: (str) The name of the column from which to compute the correlation.... |
from pseudo.api_translator import ApiTranslator
from pseudo.pseudo_tree import Node, method_call, call, to_node
from pseudo.api_translators.cpp_api_handlers import Read, Slice, ReadFile
class CppTranslator(ApiTranslator):
'''
C++ api translator
The DSL is explained in the ApiTranslator docstring
C++ ... |
from flask.ext.wtf import Form
from wtforms import StringField, IntegerField, PasswordField, SubmitField
from wtforms.validators import ValidationError, Required, Email, Length, Regexp, EqualTo
from bountyfunding.core.models import Account
class LoginForm(Form):
email = StringField('Email', validators=[Required(... |
from cartodb_services.refactor.config.exceptions import ConfigException
from abc import ABCMeta, abstractmethod
class RedisConnectionConfig(object):
"""
This represents a value object to contain configuration needed to set up
a connection to a redis server.
"""
def __init__(self, host, port, time... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import hashlib
if False:
from typing import Iterable, List, MutableSet
def expand_reqs_helper(fpath, visited):
# type: (str, MutableSet[str]) -> List[str]
if fpath in visited:
return []
else:
... |
from ansible.utils import parse_kv, template
class ActionModule(object):
"""
TODO: FIXME when upgrading to Ansible 2.x
"""
TRANSFERS_FILES = False
def __init__(self, runner):
self.runner = runner
self.basedir = runner.basedir
def _arg_or_fact(self, arg_name, fact_name, args,... |
"""
Tests the transfer student management command
"""
import unittest
from mock import call, patch
from six import text_type
import ddt
from course_modes.models import CourseMode
from django.conf import settings
from django.core.management import call_command
from opaque_keys.edx import locator
from shoppingcart.mode... |
import datetime
from django.db.models import Q
from django.utils import timezone
from airmozilla.main.models import (
Approval,
Event,
SuggestedEvent,
EventTweet
)
def badges(request):
if not request.path.startswith('/manage/'):
return {}
context = {'badges': {}}
# Event manager ... |
import os
import pytest
from funcy import first
from dvc.remote.index import RemoteIndex
@pytest.fixture(scope="function")
def index(dvc):
idx = RemoteIndex(dvc.tmp_dir, "foo")
idx.load()
yield idx
idx.dump()
os.unlink(idx.path)
def test_init(dvc, index):
assert str(index.path) == os.path.... |
# -*- 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 'MailFeedRule.finish_action'
db.add_column(u'core_mailfeed... |
from __future__ import absolute_import, unicode_literals
from datetime import datetime, timedelta
from celery import states
from celery.utils import gen_unique_id
from djcelery import celery
from djcelery.models import TaskMeta, TaskSetMeta
from djcelery.utils import now
from djcelery.tests.utils import unittest
fro... |
"""
Functions and classes for calculating statistics from the results of a
transcript quantification run. Exports:
get_statistics: Return all statistic instances.
get_graphable_statistics: Return statistic instances suitable for graphing.
"""
import classifiers
import itertools
import math
import os.path
import tpms ... |
# from django.shortcuts import redirect
# from django.urls import reverse
# from django.shortcuts import render
# from django.contrib.auth.decorators import login_required
# from django.contrib import messages
# from django.http import Http404
# from django.conf import settings
# from django.contrib.auth.decorat... |
import json
import os
import shutil
import xml.etree.ElementTree as ET
import errno
import glob
import textwrap
import shutil
try:
from urllib.request import Request, urlopen
except ImportError:
from urllib2 import Request, urlopen
URL = os.environ['URL']
VERSION = os.environ['VERSION']
if "http" not in URL:... |
#! /usr/bin/env python2
#-*- coding:utf-8 -*-
from builtins import range
import unittest
class TestParseAsm(unittest.TestCase):
def test_ParseTxt(self):
from miasm.arch.x86.arch import mn_x86
from miasm.core.parse_asm import parse_txt
ASM0 = '''
;
.LFB0:
.LA:
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/main.ui'
#
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
import os
import datetime
from subprocess import Popen, PIPE
import logging
from django.conf import settings
logger = logging.getLogger(__name__)
def updaterepo(project, update=True):
if os.path.exists(project.working_copy):
if not update:
return
p = Popen(['hg', 'pull', '-u'], std... |
"""Compress archive sources in gzip."""
import os
from rose.popen import RosePopenError
class RoseArchGzip(object):
"""Compress archive sources in gzip."""
SCHEMES = ["gz", "gzip"]
def __init__(self, app_runner, *args, **kwargs):
self.app_runner = app_runner
def compress_sources(self, ta... |
from django.test import TestCase
from rest_framework.test import APITestCase
from django.contrib.auth import get_user_model
from activities.models import Activity
import datetime
import time
from pprint import pprint
import json
import random
User = get_user_model()
class APIHeatMapTest(TestCase):
def test_re... |
from __future__ import unicode_literals
from django.test import TestCase
from taggit.models import Tag
from modelcluster.forms import ClusterForm
from tests.models import Place, TaggedPlace
class TagTest(TestCase):
def test_can_access_tags_on_unsaved_instance(self):
mission_burrito = Place(name='Mission ... |
#encoding:utf-8
"""
pythoner.net
Copyright (C) 2013 PYTHONER.ORG
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 3 of the License, or
(at your option) any later version.
Th... |
from ventana import Ventana
import utils
import pygtk
pygtk.require('2.0')
import gtk, gtk.glade, time, sqlobject
try:
import pclases
except ImportError:
import sys
from os.path import join as pathjoin; sys.path.append(pathjoin("..", "framework"))
import pclases
import datetime
try:
import geninform... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import unittest
import warnings
from django import http
from django.contrib.formtools import preview, utils
from django.test import TestCase, override_settings
from django.utils._os import upath
from django.contrib.formtools.te... |
# -*- coding: utf-8 -*-
'''
Created on Mar 14, 2012
@author: moloch
Copyright 2012 Root the Box
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 License at
http://www.apache.org/licen... |
from m5.SimObject import SimObject
from m5.defines import buildEnv
from m5.params import *
from m5.util import fatal
class Root(SimObject):
_the_instance = None
def __new__(cls, **kwargs):
if Root._the_instance:
fatal("Attempt to allocate multiple instances of Root.")
return N... |
# -*- coding: utf-8 -*-
import struct
import dpkt
import stp
import ethernet
class LLC(dpkt.Packet):
_typesw = {}
def _unpack_data(self, buf):
if self.type == ethernet.ETH_TYPE_8021Q:
self.tag, self.type = struct.unpack('>HH', buf[:4])
buf = buf[4:]
elif self.type == ... |
"""
Copyright (c) 2014-2015 F-Secure
See LICENSE for details
"""
from .errors import DoesNotExist, ValidationError, DataConflictError, AuthorizationError
from .link import LinkHolder
class ResourceContainer(object):
def __init__(self, entry_point, resource_interface):
self._entry_point = entry_point
... |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
b1 = tsds.load_airline_passengers()
df = b1.mPastData
df.head()
lEngine = autof.cForecastEngine()
lEngine
H = b1.mHorizon;
lEngine.mOptions.enable_slow_mode();
lEngine.mOptions.mCores = 256
lEngine.mOp... |
#! /usr/bin/python
'''
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
empty() -- Return whether the stack is empty.
Notes:
You must use only standard operations of a queue -- which means o... |
'''
Copyright 2016, EMC, Inc.
Author(s):
Test for switch telemetry.
'''
import sys
import subprocess
import json
import time
# set path to common libraries
sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/fit_tests/common")
import fit_common
# POLLS is num... |
from __future__ import unicode_literals
import re
from requests.compat import urljoin
from sickbeard import logger, tvcache
from sickrage.providers.nzb.NZBProvider import NZBProvider
class BinSearchProvider(NZBProvider):
"""BinSearch Newznab provider"""
def __init__(self):
# Provider Init
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.