content stringlengths 4 20k |
|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for sync_app
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import hashlib
import shutil
import unittest
CURDIR = os.path.abspath(os.curdir)
... |
import IECore
import Gaffer
import GafferScene
import GafferOSL
import GafferOSLTest
class OSLObjectTest( GafferOSLTest.OSLTestCase ) :
def test( self ) :
p = GafferScene.Plane()
p["dimensions"].setValue( IECore.V2f( 1, 2 ) )
p["divisions"].setValue( IECore.V2i( 10 ) )
self.assertSceneValid( p["out"] )
... |
from django.db.models.query import QuerySet
from model_utils.managers import PassThroughManager
from .io import read_frame
import django
class DataFrameQuerySet(QuerySet):
def to_pivot_table(self, fieldnames=(), verbose=True,
values=None, rows=None, cols=None,
aggfun... |
import sys
import time
import random
import threading
import weaver.client as client
# grid graph params
num_node_groups = 1000
nodes_per_group = 5
num_vts = 1
num_cls = 10
clients = []
for i in range(num_cls):
clients.append(client.Client(client._CLIENT_ID + i, i % num_vts))
# create grid graph
nodes = [[0 for i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <<EMAIL>>.
License: GPL v2
Thanks to Hans Donner <<EMAIL>> for GaeGoogleAccount.
"""
from google.appengine.api import users
from cas_auth import CasAuth
class GaeGoogl... |
from __future__ import absolute_import
from nearpy.tests.hashes_tests import TestRandomBinaryProjections, \
TestRandomDiscretizedProjections, TestPCABinaryProjections, TestPCADiscretizedProjections
from nearpy.tests.engine_tests import TestEngine
from nearpy.tests.storage_tests import TestStorage
from nearpy.tests... |
from transport.AbstractTransport import AbstractTransport
import requests
from flask import Flask, request
from Router import Router
import json
from flask_restful import Resource
class Facebook(AbstractTransport):
verify_token = None
access_token = 'test'
access_point_root = None
ENDPOINTS_TO_ADD ... |
__author__ = 'Aram Kananov <<EMAIL>>, Petr Vanek, <<EMAIL>>'
class OracleReferentialConstraint:
def __init__(self, name, data_dict):
self.name = name
self.table_name, type, check_cond, r_owner, r_constraint_name, delete_rule = data_dict.all_constraints[name]
self.type = "Referential"
... |
'''
Copyright 2016 Yahoo Inc.
Licensed under the terms of the Apache 2.0 license.
Please see LICENSE file in the project root for terms.
'''
from ConversionUtil import wrapClass
from RegisterContext import registerContext
from pyspark.sql import DataFrame
from pyspark.mllib.linalg import Vectors
class CaffeOnSpark:
... |
# coding=utf-8
"""InaSAFE Disaster risk assessment tool developed by AusAid -
**Table Tests implementation.**
Contact : <EMAIL>
.. 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; eith... |
"""Nova app models."""
# Copyright 2015 Solinea, 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
from __future__ import print_function
import unittest
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.fluid.framework as framework
class TestStaticDeviceManage(unittest.TestCase):
def _test_device(self, device_name, device_class):
paddle.set_device(device_name)
... |
import httplib
import os
import socket
import ssl
import urllib
import xmlrpclib
class SafeTransportWithCert(xmlrpclib.SafeTransport):
'''Sample client for talking XMLRPC over SSL supplying
a client X509 identity certificate.'''
def __init__(self, use_datetime=0, keyfile=None, certfile=None,
... |
#!/usr/bin/env python
import rospy
import numpy
from std_msgs.msg import *
import geometry_msgs.msg
from sensor_msgs.msg import LaserScan
from people_tracking.srv import LoadWalls, LearnWalls
import rospkg
import os
import json
import base64
import json
import numpy as np
class WallFilter:
def __init__ (self, s... |
from construct import (
Array,
Bytes,
Struct,
VarInt,
Int8ub,
Int16ub,
Int24ub,
Int32ub,
PascalString,
Embedded,
Prefixed,
Range,
GreedyRange,
Switch,
Optional,
)
ProtocolVersion = "version" / Struct(
"major" / Int8ub,
"minor" / Int8ub,
)
TLSPlaintex... |
"""
Copyright 2008, 2009, 2015 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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... |
import pytest
from fixture.application import Application
import jsonpickle
import os.path
import importlib
import json
from fixture.db import DbFixture
fixture = None #фикстура не определена
target = None
def load_config(file): # функ... |
from django.utils.translation import ugettext_lazy as _
from horizon import tables
class EquipmentListFilterAction(tables.FilterAction):
name = "filter"
class NodeListTable(tables.DataTable):
id = tables.Column("id", verbose_name=_("ID"), hidden=True)
hostname = tables.Column("hostname",
... |
import os
import logging
import sys
from botocore.client import Config
from awscli.customizations.cloudformation.s3uploader import S3Uploader
from awscli.customizations.cloudformation.artifact_exporter import Template
from awscli.customizations.cloudformation.yamlhelper import yaml_dump
from awscli.customizations.clo... |
# python
# This file is generated by a program (mib2py).
import CISCO_C12000_IF_HC_COUNTERS_MIB
OIDMAP = {
'1.3.6.1.4.1.9.10.31': CISCO_C12000_IF_HC_COUNTERS_MIB.ciscoC12000IfHcCountersMIB,
'1.3.6.1.4.1.9.10.31.1': CISCO_C12000_IF_HC_COUNTERS_MIB.cHCCounterMIBObjects,
'1.3.6.1.4.1.9.10.31.2': CISCO_C12000_IF_HC_COUN... |
# -*- coding: utf-8 -*-
from __future__ import (
division, absolute_import, print_function,
# commented out since __all__ require str in Python 2.
# unicode_literals,
)
from builtins import * # noqa
from future.builtins.disabled import * # noqa
from magic_constraints.exception import (
... |
# -*- coding: utf-8 -*-
from time import sleep
from urllib.parse import urlparse
import pytest
from cfme import test_requirements
from cfme.base.ui import ServerView
from cfme.utils.appliance import provision_appliance
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.conf import credent... |
from mapentity.views import (MapEntityLayer, MapEntityList, MapEntityJsonList, MapEntityFormat,
MapEntityDetail, MapEntityDocument, MapEntityCreate, MapEntityUpdate, MapEntityDelete)
from geotrek.core.views import CreateFromTopologyMixin
from .models import (PhysicalEdge, LandEdge, Compete... |
import os
import sys
import logging
import openerp
import openerp.netsvc as netsvc
import openerp.addons.decimal_precision as dp
from openerp.osv import fields, osv, expression, orm
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from openerp import SUPERUSER_ID
from openerp im... |
from gengo import Gengo
# Get an instance of Gengo to work with...
gengo = Gengo(
public_key='your_public_key',
private_key='your_private_key',
sandbox=True,
)
# Exhaustive view, chances are your code will never be quite this verbose (programatically build this).
jobs_data = {
'job_1': {
'type... |
"""
Copyright (c) 2016 Genome Research Ltd.
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, merge, publish, distr... |
#! /usr/bin/env python
# coding=utf-8
import os
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
def read(*parts):
return open(os.path.join(os.path.dirname(__file__), *parts)).read()
# Provided as an attribute, so you can append to these instea... |
"""
Modules middleware: handles modular behavior of the system
"""
from django.core.exceptions import MiddlewareNotUsed
from anaf.core.conf import settings
from anaf.core.models import Module
# This must be fired after Django processes request
# i.e. after Django's own middleware has been fired
def check_modules():... |
import datetime
from decimal import Decimal
import re
from weboob.tools.browser import BasePage, BrokenPageError
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction
__all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage']
class Lo... |
# -*- coding: utf-8 -*-
"""
requests.safe_mode
~~~~~~~~~~~~
This module contains a decorator that implements safe_mode.
:copyright: (c) 2012 by Kenneth Reitz.
:license: ISC, see LICENSE for more details.
"""
from .models import Response
from .packages.urllib3.response import HTTPResponse
from .exceptions import Re... |
import unittest
from instruments.instrument_catalog import InstrumentCatalog
from structure.score import Score
from structure.instrument_voice import InstrumentVoice
from structure.line import Line
from structure.note import Note
from timemodel.duration import Duration
from timemodel.position import Position
from timem... |
from spack import *
class Essl(Package):
"""IBM's Engineering and Scientific Subroutine Library (ESSL)."""
homepage = "https://www.ibm.com/systems/power/software/essl/"
url = "ibm-essl"
version('6.1')
version('5.5')
variant('ilp64', default=False, description='64 bit integers')
var... |
import picking |
from __future__ import division
import logging
import time
import math
import smbus
class Hat:
address = 0x40
mode1 = 0x00
mode2 = 0x01
prescale = 0xFE
bus = smbus.SMBus(1)
def __init__(self):
self.set_all_pwm(0, 0)
self.bus.write_byte_data(self.address, self.mode2, 0x04)
... |
import shutil
from guess_language import guess_language
from coalib.bearlib import deprecate_settings
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.Result import Result
from coalib.resu... |
# -*- coding: utf-8 -*-
from datetime import date, timedelta
from workalendar.core import LunarCalendar, WesternCalendar, Calendar
from workalendar.core import MON, FRI, SAT, IslamicMixin, EphemMixin
class SouthKorea(LunarCalendar):
"South Korea"
FIXED_HOLIDAYS = LunarCalendar.FIXED_HOLIDAYS + (
(3, ... |
from core.database import stockdata
from sklearn.svm import SVR
from sklearn import preprocessing, grid_search
from sklearn.metrics import mean_squared_error, mean_absolute_error, median_absolute_error
import numpy as np
import matplotlib.pyplot as plt
import pickle
import sys
#sys.exit('This is too good to change. Do... |
from __future__ import unicode_literals
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Frappe Technologies Pvt. Ltd. and Contributors"
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th"
app_color = "#e74c3c"
app_version = "5.0.29"
error_r... |
#!/usr/bin/env python
## python client for capturing faces and send them to server
import cv2
import cv2.cv as cv
import sys
import os
import numpy as np
import time
from websocket import create_connection
import base64
import json
import serial
import thread
## connect to local server
ws_hw = create_connection("ws... |
# lose a point if no inference method specified
import sys, codecs, csv
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl.nexson_syntax import extract_tree_nexson
def write_tree_list(outpath):
conflict_analyses = read_conflict_analyses()
trees_in_synthesis = read_synthesis_list()
... |
"""WSGI server interface to Python runtime.
WSGI-compliant interface between the Python runtime and user-provided Python
code.
"""
import logging
import sys
import types
from google.appengine import runtime
from google.appengine.api import lib_config
_DEADLINE_DURING_LOADING = 22
class Error(Exception):
... |
import copy
from Passes import lpla
from Passes import dfg
def alg2lpla( operation, pme, linv, alg, variant ):
# function
inop = [op for op in operation.operands if op.isInput()]
outop = [op for op in operation.operands if op.isOutput()]
f = lpla.function( operation.name, variant, inop, outop )
#... |
"""HTTP endpoints for interacting with orders."""
from __future__ import absolute_import
import logging
from decimal import Decimal
import dateutil
import django_filters
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.db import transaction
from django.util... |
# encoding: UTF-8
'''
本文件中包含了CTA模块中用到的一些基础设置、类和常量等。
History
<id> <author> <description>
2017050301 hetajen DB[CtaTemplate增加日线bar数据获取接口][Mongo不保存Tick数据][新增数据来源Sina]
2017051500 hetajen 夜盘tick|bar数据增加tradingDay字段,用于指明夜盘tick|bar数据的真实交易日
2017052500 hetajen DB[增加:5分钟... |
import unittest
from tempfile import mkstemp
import os
from types import StringType, DictType
from math import ceil
from Tribler.Core.API import *
from Tribler.Core.Merkle.merkle import *
from Tribler.Core.BitTornado.bencode import bdecode
from traceback import print_exc
DEBUG=False
class TestMerkle... |
"""add domain, page url unique keys
Revision ID: 178c6db7516
Revises: 25abb99fc57
Create Date: 2013-11-14 16:53:36.719799
"""
# revision identifiers, used by Alembic.
revision = '178c6db7516'
down_revision = '25abb99fc57'
import sqlalchemy as sa
from alembic import op
def upgrade():
op.add_column(
'pa... |
import re
from django.views.decorators.cache import cache_page
from commonware.response.decorators import xframe_allow
from bs4 import BeautifulSoup
from lib import l10n_utils
from bedrock.legal_docs.views import LegalDocView, load_legal_doc
HN_PATTERN = re.compile(r'^h(\d)$')
HREF_PATTERN = re.compile(r'^https?\... |
# no unicode literals
from __future__ import absolute_import, division, print_function
import distutils.spawn
import glob
import inspect
import os
import os.path
import re
import shutil
import signal
import subprocess
import Interrupt
import WatchmanInstance
import WatchmanTestCase
try:
import unittest2 as unit... |
# -*- 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):
# Changing field 'Profile.status_in_project'
db.alter_column('pledger_profile', 'status_in_project', self.g... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import traceback
import datetime
import requests
from collections import defaultdict
import time
import structlog
log =structlog.get_logger()
odpwAPI="http://data.wu.ac.at/portalwatc... |
#!/usr/bin/env python3
'''
t5_full.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <<EMAIL>>
This work can be distributed under the terms of the GNU GPLv3.
'''
if __name__ == '__main__':
import pytest
import sys
sys.exit(pytest.main([__file__] + sys.argv[1:]))
from common import populate_... |
from __future__ import print_function, division
import os
from clas12_wiremap.ui import QtGui, uic
from clas12_wiremap import initialize_session, dc_fill_tables, dc_find_connections
class TBTab(QtGui.QTabWidget):
def __init__(self, parent=None):
super(QtGui.QTabWidget, self).__init__(parent)
curd... |
# -*- coding: utf-8 -*-
# Write a program to solve a Sudoku puzzle by filling the empty cells.
# Empty cells are indicated by the character '.'.
# You may assume that there will be only one unique solution.
# A sudoku puzzle...
# ...and its solution numbers marked in red.
# https://leetcode.com/problems/sudoku-solv... |
import sys
from pymongo import MongoClient
import pymongo
if len(sys.argv) < 5:
print("Not enough arguments.")
print("addRiskNumbers.py <mongoURL> <mongoPort> <userName> <password>")
sys.exit(0)
mongoURL = sys.argv[1]
mongoPort = sys.argv[2]
userName = sys.argv[3]
password = sys.argv[4]
connString = "mon... |
from yabgp.message.attribute.linkstate.linkstate import LinkState
from yabgp.tlv import TLV
# https://tools.ietf.org/html/rfc7752#section-3.3.3.1
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Type | ... |
from nose.tools import assert_equals
import dssg.tests as _test
from dssg.model import Deployment
class TestDeployment:
@classmethod
def setup_class(self):
"""Set up preliminary test data"""
_test.create_deployment(
'ushine integration',
'http://dssg.ushahididev.com')... |
from nova.api.openstack.compute.plugins.v3 import migrate_server
from nova import exception
from nova.openstack.common import uuidutils
from nova.tests.api.openstack.compute.plugins.v3 import \
admin_only_action_common
from nova.tests.api.openstack import fakes
class MigrateServerTests(admin_only_action_common.C... |
#! /usr/bin/env python
"""
agilent4155_matlab_param.py
Prarmeter extractor for matlab generated .xlsx files
Created by Jeremy Smith on 2015-07-07
University of California, Berkeley
<EMAIL>
"""
import os
import sys
import xlrd
import numpy as np
import myfunctions as mf
from scipy import stats
__author__ = "Jeremy Sm... |
import unittest
from appium import webdriver
from appium.common.exceptions import NoSuchContextException
import desired_capabilities
from time import sleep
from selenium.webdriver.common.touch_actions import TouchActions
class SelendroidTests(unittest.TestCase):
def setUp(self):
desired_caps = desired_c... |
'''
Copyright (c) 2015 FlorianSeidel
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, merge, publish, distribute, ... |
# dump_link.py - dumps information about shell shortcuts
#
import sys, os
from win32com.shell import shell, shellcon
import pythoncom
import glob
from win32com.storagecon import *
def DumpLink(fname):
shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.II... |
"""
mbed
The mbed framework The mbed SDK has been designed to provide enough
hardware abstraction to be intuitive and concise, yet powerful enough to
build complex projects. It is built on the low-level ARM CMSIS APIs,
allowing you to code down to the metal if needed. In addition to RTOS,
USB and Networking libraries,... |
"""Auth provider that validates credentials via an external command."""
import asyncio.subprocess
import collections
import logging
import os
from typing import Any, Dict, Optional, cast
import voluptuous as vol
from homeassistant.exceptions import HomeAssistantError
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDE... |
# coding=utf-8
##
# PlayBack/TabbedPaneSelection.
# <p>
# Test tabbed pane selection.
#
# @data COMMENT [String] Comment for the test
# @data JAVAGUI_INSTANCE_NAME [String] instance of the JavaGUI to control
# @data TAB_COMPONENT_NAME [String] The ID of the TAB selector to be controlled
# @data TAB_IDX [Int] The indic... |
# -*- 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 'CustomerPaymentProfile'
db.create_table(u'authorizenet_customerpaymentprofile', (
... |
from django.core.management.base import AppCommand
from django_seed import Seed
from django_seed.exceptions import SeederCommandError
from optparse import make_option
import django
class Command(AppCommand):
help = 'Seed your Django database with fake data'
args = "[appname ...]"
option_list = AppComman... |
#!/usr/bin/env python3
"""
Unwanted patterns test cases.
The reason this file exist despite the fact we already have
`ci/code_checks.sh`,
(see https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh)
is that some of the test cases are more complex/imposible to validate via regex.
So this file is somewhat a... |
import six
from .U32 import U32
from .des_data import des_SPtrans, des_skb
def c2l(c):
"char[4] to unsigned long"
l = U32(c[0])
l = l | (U32(c[1]) << 8)
l = l | (U32(c[2]) << 16)
l = l | (U32(c[3]) << 24)
return l
def l2c(l):
"unsigned long to char[4]"
c = []
c... |
"""This test checks that GeneticSearch is functional.
It also checks that it is usable with a separate scheduler.
"""
import ray
from ray.tune import run
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.automl import GeneticSearch
from ray.tune.automl import ContinuousSpace, DiscreteSpace, SearchS... |
import json
from augur.__version__ import __version__
from augur.__version__ import is_augur_version_compatible
from augur.validate import validate_json, ValidateError, load_json_schema
FILTERED_ATTRS = ["generated_by"]
class NodeDataFile:
def __init__(self, fname):
self.fname = fname
with ope... |
# encoding: 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):
# Changing field 'Entry.place'
db.alter_column('place_data_entry', 'place_id', self.gf('django.db.models.f... |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from myrecipe import views
urlpatterns = patterns('',
### Adds a new recipe. ###
url(r'^add/$', views.NewRecipeView.as_view(template_name="myrecipe/addRecipe.html"), name="addRecipe... |
from __future__ import unicode_literals
import unittest
import frappe
from frappe.test_runner import make_test_records
from erpnext.controllers.item_variant import (create_variant, ItemVariantExistsError,
InvalidItemAttributeValueError, get_variant)
from erpnext.stock.doctype.item.item import StockExistsForTemplate
... |
#
# Elastic Model: Testelastic
#
from itest.models.elastic.basemodel import ElasticBaseModel
from itest.database.elasticdblib import dbname
from datetime import datetime
from dateutil import parser
class Elasticmail(ElasticBaseModel):
#
# Use the cerberus schema style
# which offer you an Elastic schema ... |
import re
import sys
import uuid
import time
import random
import signal
import socket
import logging
from contextlib import contextmanager
from gettext import gettext as _
from optparse import Values
import eventlet
import eventlet.pools
from eventlet.green.httplib import CannotSendRequest
from swift.common.utils im... |
from dolfin import *
from mshr import *
# Create geometry
s1 = Sphere(Point(0, 0, 0), 1.4)
b1 = Box(Point(-1, -1, -1), Point(1, 1, 1))
c1 = Cylinder(Point(-2, 0, 0), Point(2, 0, 0), 0.8, 0.8)
c2 = Cylinder(Point(0, -2, 0), Point(0, 2, 0), 0.8, 0.8)
c3 = Cylinder(Point(0, 0, -2), Point(0, 0, 2), 0.8, 0.8)
geometry = s... |
from io import BytesIO
import factory
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.core.files import base
from django.core.files import images
from PIL import Image
from adhocracy4.test import factories
class UserFactory(factory.django.DjangoModelFactory):
... |
import sys
import numpy as nmp
def get_basin_info( cf_bm ):
from netCDF4 import Dataset
l_b_names = [] ; l_b_lgnms = []
l_b_names.append(u'GLO') ; l_b_lgnms.append(u'Global Ocean')
id_bm = Dataset(cf_bm)
list_var = id_bm.variables.keys()
for cv in list_var:
if cv[:5] == 'tmask':
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
import json
import glob
import time
import sys
from pprint import pprint
# This script will analyze the results of the fuzzing scripts.
# It will give a list of the accepted lengths, lengthfields and ids.
# This gives an impression of the preci... |
import sys
sys.path.append("..")
import time
import struct
import AcraNetwork.IENA as iena
import AcraNetwork.iNetX as inetx
import AcraNetwork.McastSocket as mcast
import AcraNetwork.SimpleEthernet as SimpleEthernet
import argparse
from collections import deque
def main():
# Setup some constan... |
""" Program to generate all 2xN flat foldable maps for a given N
In general, assume left-most horizontal crease is a valley
Real answer = final answer * 2
Implementation details:
- each "face" is a tuple (column, row) (a.k.a (x,y)) whose entries are INTS (start @ (1,1))
- graph will be a dictionary whose values are ... |
from .constants import LDP_NON_RDF_SOURCE
from rdflib import Graph, URIRef
import requests
import sys
import fileinput
import tempfile
try:
from os import scandir
except ImportError:
from scandir import scandir
def get_child_nodes(node, predicates, auth, logger):
"""Get the children based on specified co... |
from setuptools import setup
import versioneer # that's a local versioneer.py script from this repo
def _check_requirements():
"""Prepare a list of requirements to be passed to setup().
We don't want to add required libraries to ``install_requires``
unconditionally, because then we would risk updating ... |
from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that accounts can be created and can set their password"
u = User.obje... |
from concurrent.futures import ThreadPoolExecutor
import grpc
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.qrlnode import QRLNode
from qrl.generated.qrl_pb2_grpc import add_PublicAPIServicer_to_server, add_AdminAPIServicer_to_server
from qrl.generated.qrlmining_pb2_grpc import add_Mining... |
import argparse
import os
import logging
from . import arguments
from . import constants as C
from . import data_io
from . import utils
from . import vocab
from .log import setup_main_logger
logger = logging.getLogger(__name__)
def main():
params = arguments.ConfigArgumentParser(description='Preprocesses and sh... |
import getopt
import math
import os.path
import sys
import strace
import strace_utils
#
# Analyze the systime
#
def analyze_systime(input_file, output_file=None, bin_size=0.1, \
separator=',', quote='"'):
'''
Analyze the systime
Arguments:
input_file - the input file, or None for standard input
output_... |
from openerp.osv import fields, osv, orm
from openerp.tools.translate import _
class split_in_production_lot(orm.TransientModel):
_inherit = "stock.move.split"
_columns = {
'use_exist' : fields.boolean('Existing Lots', invisible=True),
}
_defaults = {
'use_exist': True,
}
def d... |
import os, sys, re
from stat import *
class StatCache:
def __init__(self):
self._dict = {}
def getStat(self, key):
if not key in self._dict:
try:
self._dict[key] = os.stat(key)
except OSError:
self._dict[key] = None
return self._... |
from evelink import api
class Map(object):
"""Wrapper around /map/ of the EVE API."""
@api.auto_api
def __init__(self, api=None):
self.api = api
@api.auto_call('map/Jumps')
def jumps_by_system(self, api_result=None):
"""Get jump counts for systems in the last hour.
Return... |
from importlib import import_module
from pkgutil import iter_modules
def load_object(path):
"""Load an object given its absolute object path, and return it.
object can be a class, function, variable o instance.
path ie: 'scrapy.contrib.downloadermiddelware.redirect.RedirectMiddleware'
"""
try:
... |
#!/usr/local/bin/python3
#
# lxdm_post_login.py
# /etc/lxdm/PostLogin calls me :)
import sys
import os
from chrubix.utils import logme
from chrubix import load_distro_record
import datetime
def pause_for_one_second():
current_second = datetime.datetime.now().second
while datetime.datetime.now().second == cur... |
# -*- coding: utf-8 -*-
###############################################################################
#
# PyLint tests that will never be applied by Trump.
#
# Too many/few arguments, ignored, because its confusing and doesn't make
# sense to refactor many of these objects.
#
# pylin... |
from django.shortcuts import render, get_object_or_404, get_list_or_404
from django.utils import timezone
from django.conf import settings
from django.views.decorators.cache import cache_page
from schedule.models import Game, Team
from datetime import date
@cache_page(settings.CACHE_TIMEOUT, cache='page_views')
def i... |
try:
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
desc = {
"s0": uctypes.UINT16 | 0,
"sub": (0, {"b0": uctypes.UINT8 | 0, "b1": uctypes.UINT8 | 1,}),
"arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2),
"arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}),
"bitf0": uc... |
from collections import defaultdict
from django.utils.translation import ugettext as _
xeps = defaultdict(lambda: defaultdict(lambda: None))
def xep0138_notes(value):
if value['status'] is False:
return ''
client = set(value.get('client', []))
server = set(value.get('server', []))
if value... |
from tempest.api.network import base
from tempest import test
class ExtensionsTestJSON(base.BaseNetworkTest):
_interface = 'json'
"""
Tests the following operations in the Neutron API using the REST client for
Neutron:
List all available extensions
v2.0 of the Neutron API is assumed. It... |
import logging
import uuid
from datetime import datetime
logger = logging.getLogger(__name__)
# one instance per connection
class AttackSession(object):
def __init__(self, protocol, source_ip, source_port, databus, log_queue):
self.log_queue = log_queue
self.id = uuid.uuid4()
logger.info... |
from osv import fields, osv
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'state_id': fields.many2one("res.country.state", 'Ubication', domain="[('country_id','=',country_id),('type','=','normal')]"),
}
res_partner()
# vim:expandtab:smartinde... |
#! /usr/bin/python
import os
import datetime
keys = []
comments = []
now = datetime.datetime.now()
header = r'''# Copyright (C) 2011 Clint Bellanger
# This file is distributed under the same license as the FLARE package.
#
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.