content stringlengths 4 20k |
|---|
import argparse
import datetime
import grp
import os
import pwd
import sys
import elasticsearch
import elasticsearch.helpers
import pytz
import xattr
ES_NODES = ['uct2-es-head.mwt2.org:9200', 'uct2-es-door.mwt2.org:9200']
TZ_NAME = "US/Central"
TIMEZONE = pytz.timezone(TZ_NAME)
def get_es_client():
""" Instanti... |
# Hacker Rank Capture the Flag 2017-04-26
# Extract information from a given website and submit the specified output as Plain Text.
# https://www.hackerrank.com/contests/capture-the-flag/challenges/secret-key
import urllib.request, json
secret_keys_url = "https://cdn.hackerrank.com/hackerrank/static/contests... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
from collections import defaultdict
from threading import Thread
from PyQt5.Qt import (
QVBoxLayout, QTextBrowser, QProgressBar, Qt, QWidget, QStackedWidget,
QLabel, QSizePolicy, pyqtSignal, QIcon, QIn... |
#!/usr/bin/env python
###############EDITABLE REGION################################
#Path where AnyPlot will be installed.
#Default is to create AnyPlot in /home/$user
#If you modify 'default', use the entire adress ('/Users/../')
install_path='default'
#Pointer to bash file. This is to include Qgui in environme... |
import os
from django.shortcuts import HttpResponse
from django.http.response import FileResponse
from django.utils.encoding import smart_str
def xfilesend_response(request, filename, disposition='attachment',
download_name=None,
content_type='application/octet-stream')... |
import types
from os import path
from PyQt5.QtWidgets import QFrame, QHeaderView
from PyQt5.QtGui import QPixmap
from gui.view.gen.ui_AppMainWindow import Ui_MainWindow
from golem.core.common import get_golem_path
from mainwindow import MainWindow
class AppMainWindow(object):
def __init__(self):
self.wi... |
'''
Work with Libraries - show persons and communities with maxUsed biggr 80%
Author: Christoph Stoettner
Mail: <EMAIL>
Documentation: http://scripting101.org
Version: 5.0.1
Date: 09/19/2015
License: Apache 2.0
'''
execfile("filesAdmin.py")
import sys
noresult = 0
# Create tw... |
import os
import unittest
import pytest
from mock import Mock
from trashcli.fstab import volume_of
from trashcli.list_mount_points import os_mount_points
from trashcli.restore import RestoreCmd, TrashDirectories, TrashDirectory, \
TrashedFiles, TrashDirectories2
from .support import MyPath
from .files import requ... |
"""Tests for third_party.nucleus.io.tabix."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
if 'google' in sys.modules and 'google.protobuf' not in sys.modules:
del sys.modules['google']
import os
import shutil
from absl.testing import absl... |
from marshmallow import Schema
from webargs.fields import (
String,
List,
Nested,
Int,
Boolean,
)
class ProductSchema(Schema):
name = String()
period = String(enum=["monthly", "yearly"])
price = Int()
product_listing_id = String(required=True)
quantity = Int(required=True)
c... |
from oslo_log import log as logging
from oslo_utils import uuidutils
from cinder.compute import nova
from cinder import exception
from cinder.i18n import _, _LW
from cinder.openstack.common.scheduler import filters
from cinder.volume import utils as volume_utils
LOG = logging.getLogger(__name__)
HINT_KEYWORD = 'loc... |
#!/usr/bin/env python
# encoding: utf-8
from t import T
import urllib2
import cookielib
import pexpect
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo=''):
result = {}
result['result']=False
... |
import functools
import mock
from jacket.compute.pci import whitelist
def fake_pci_whitelist():
devspec = mock.Mock()
devspec.get_tags.return_value = None
patcher = mock.patch.object(whitelist, 'get_pci_device_devspec',
return_value=devspec)
patcher.start()
return patcher
... |
import typing
import math
import contextlib
from timeit import default_timer
from operator import itemgetter
from searx.engines import engines
from .models import HistogramStorage, CounterStorage
from .error_recorder import count_error, count_exception, errors_per_engines
__all__ = ["initialize",
"get_engi... |
import os
import sys
_TERMCODES = {
"bold": 1,
"hidden": 2,
"underline": 4,
"blink": 5,
"reverse": 7,
"formatting": 12,
"black": 30,
"red": 31,
"green": 32,
"yellow": 33,
"blue": 34,
"magenta": 35,
"cyan": 36,
"white": 37,
"bgred": 41,
"bggreen": 42,
... |
"""A simple web server for testing purpose.
It serves the testing html pages that are needed by the webdriver unit tests."""
import logging
import os
import socket
import threading
from io import open
try:
from urllib import request as urllib_request
except ImportError:
import urllib as urllib_request
try:
... |
"""
Test functions for multivariate normal distributions.
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_almost_equal,
run_module_suite, assert_allclose, assert_equal, assert_raises)
import numpy
import numpy as np
import scipy.linalg
import scipy.stat... |
import time
from assertions import assert_invalid, assert_unavailable
from dtest import Tester
from cassandra import ConsistencyLevel, Timeout
from cassandra.query import SimpleStatement
from cassandra.policies import RetryPolicy
cql_version="3.0.0"
class TestBatch(Tester):
def counter_batch_accepts_counter_mut... |
import pymetar
WEATHERCODE_FILE = 'static/weather.txt'
def handler_weather_weather(source, parameters):
if not parameters:
reply(source, u'ииии?')
return
try:
rf=pymetar.ReportFetcher(parameters.strip())
fr=rf.FetchReport()
except Exception, ex:
if parameters.count... |
from .sub_resource import SubResource
class NetworkInterfaceIPConfiguration(SubResource):
"""IPConfiguration in a network interface.
:param id: Resource ID.
:type id: str
:param application_gateway_backend_address_pools: The reference of
ApplicationGatewayBackendAddressPool resource.
:type a... |
import urllib.parse
import json
from tornado.testing import AsyncHTTPTestCase
from application import server
class BaseTestCase(AsyncHTTPTestCase):
def get_app(self):
application = server.Application()
application.settings["xsrf_cookies"] = False # ignore xsrf when test
return applicati... |
"""OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "R B Wilkinson"
__date__ = "12/12/11"
__copyright__ = "(C) 2011 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__revision__ = "$Id$"
fro... |
import connection_manager
import datetime
class storage(object):
def __init__(self):
connection = connection_manager.connectionManager()
self.client = connection.client
def update(self):
following_ids = self.get_followers()
tracks = ''
errors = open('errors.txt', 'w+')
for user in following_ids:
user_... |
__author__ = 'Wei Xie'
__email__ = '<EMAIL>'
__affiliation__ = 'Living Analytics Research Centre, Singapore Management University'
__website__ = 'http://mysmu.edu/phdis2012/wei.xie.2012'
from datetime import date, timedelta as td
import time
import MySQLdb
import topicsketch.stream as stream
import exp_config
imp... |
import datetime
import sys
import unittest
from test_support import test_env
test_env.setup_test_env()
from google.appengine.ext import ndb
from components import utils
from components.auth import model
from components.auth import realms
from components.auth import replication
from components.auth.proto import realm... |
import os
import time
from urllib.parse import urlparse
import pymysql
from pyquery import PyQuery as pquery
import requests
import re
def init_reptile(tar_url):
""" 初始化爬虫 """
web_res_context = requests.get(tar_url)
web_res_context.encoding = 'utf-8'
document = pquery(web_res_context.text)
# 添加属性... |
import pacman, re
class package:
def short_name(self):
return "invalidstartdir"
def long_name(self):
return "Looks for anything that's not $startdir/pkg or $startdir/src"
def prereq(self):
return ""
def analyze(self, pkginfo, tar):
ret = [[],[],[]]
for i in pkginfo.pkgbuild:
startdirs = re.split('\$st... |
"""
Provides an APIView class that is the base of all views in REST framework.
"""
from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.utils.datastructures import SortedDict
from django.views.decorators.csrf import csrf_exempt
from res... |
import os
import shutil
import sys
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.base.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
@staticmethod
def is_in_memory_db(database_name):
return database_name == ':memory:' or 'mode=mem... |
from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigNothing, NoSave
from Tools.CList import CList
from os import path as os_path
import os
class videoSettings:
firstRun = True
def __init__(self):
self.last_modes_preferred = []
self.createConfig()
d... |
from ...functions import adjoint, conjugate
from .matexpr import MatrixExpr
class Transpose(MatrixExpr):
"""
The transpose of a matrix expression.
This is a symbolic object that simply stores its argument without
evaluating it. To actually compute the transpose, use the ``transpose()``
function, ... |
# -*- coding: utf-8 -*-
"""Mimesis is a Python library, which helps generate fake data.
Copyright (c) 2016 - 2020 Isaak Uchakaev (Likid Geimfari)
Repository: https://github.com/lk-geimfari/mimesis
Email: <<EMAIL>>
"""
from mimesis.providers import (
Address,
BaseDataProvider,
BaseProvider,
Business,
... |
from haystack.query import SQ
from django.db.models import Q
from ovp.apps.projects.models import Category
from ovp.apps.projects.models import Project
from ovp.apps.projects.models import Apply
from ovp.apps.organizations.models import Organization
from ovp.apps.channels.content_flow import BaseContentFlow
from ovp.a... |
#!/usr/bin/python
"""
Copyright 2017 Paul Willworth <<EMAIL>>
This file is part of Galaxy Harvester.
Galaxy Harvester is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License,... |
"""
Base tool class, from the project one
"""
import os
from .base_project import Project, GVSBUILD_TOOL
class Tool(Project):
def __init__(self, name, **kwargs):
self.dir_part = None
self.mark_deps = False
self.tool_path = None
self.full_exe = None
Project.__init__(self, n... |
#!/usr/bin/env python
import os, sys, struct, socket, traceback, urllib2, errno, tempfile
from distutils import log
def _read_integer(sf):
return struct.unpack('>i', sf.read(4))[0]
def _read_string(sf):
return sf.read(_read_integer(sf))
def _write_string(sf, result):
if result == None:
sf.write... |
import requests
import re
from itertools import izip
from bs4 import BeautifulSoup
import ticker_api
class ParseError(Exception):
pass
def company_query(symbols, fields=None):
results = {}
query_fields = None
derived_fields = None
if fields is None:
query_fields = ticker_api.COMPANY['... |
# -*- coding: utf-8 -*-
import threading
from .misc import Periodical, isiterable
from .Plugin import Plugin
class Addon(Plugin):
__name__ = "Addon"
__type__ = "hook" # @TODO: Change to `addon` in 0.4.10
__version__ = "0.55"
__status__ = "stable"
__threaded__ = [] # @TODO: Remove in 0.4.10
... |
# -*- encoding: utf-8 -*-
"""Functions for manipulating the model metadata in it's raw form –
dictionary:
* Model metadata loading and writing
* Expanding metadata – resolving defaults, converting strings to required
structures
* Simplifying metadata – removing defaults for better output readability
... |
from __future__ import unicode_literals, division, absolute_import
import base64
import hashlib
import logging
import datetime
import os
from sqlalchemy import Column, Integer, String, DateTime, Unicode
from flexget import db_schema, plugin
from flexget.event import event
from flexget.utils.sqlalchemy_utils import ta... |
from iptest.assert_util import *
import exceptions
#------------------------------------------------------------------------------
def test_raise():
events = []
expectedEvents = [
'A.__enter__', 'A.__exit__(None)', 'A.__enter__', 'A.__exit__(None)', 'A.__enter__', 'A.__exit__(exception)',
'A.__enter__... |
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class Error(Model):
"""Error.
:param status:
:type status: int
:param constant_id:
:type constant_id: int
:param message:
:type message: str
"""
_attribute_map = {
'status': {'key': '... |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from toontown.ai import DistributedPhaseEventMgr
class DistributedMailboxZeroMgr(DistributedPhaseEventMgr.DistributedPhaseEventMgr):
neverDisable = 1
notify = DirectNotifyGlobal.directNotify.newCategory('Distrib... |
from __future__ import absolute_import
from __future__ import unicode_literals
import dnf.arch
import tests.support
class ArchTest(tests.support.TestCase):
def test_basearch(self):
fn = dnf.arch.basearch
self.assertEqual(fn('armv6hl'), 'armhfp')
self.assertEqual(fn('armv7hl'), 'armhfp')
... |
#####################################################################################
## ____ _______ _________________ _ _____ ________ ___ ______________
## / __/__< / / / / __/ __/ ___/ __ \/ |/ / _ \ / __/ __ \/ _ \/_ __/ _/ __/
## / _//___/ /_ _/ _\ \/ _// /__/ /_/ / / // / _\ \/ /_/ /... |
# -*- coding: utf-8 -*-
#
# TARGET arch is: ['-target', 'i386-linux']
# WORD_SIZE is: 4
# POINTER_SIZE is: 4
# LONGDOUBLE_SIZE is: 12
#
import ctypes
# if local wordsize is same as target, keep ctypes pointer function.
if ctypes.sizeof(ctypes.c_void_p) == 4:
POINTER_T = ctypes.POINTER
else:
# required to acce... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import DetailView
from django.views.generic.list import ListView
from django.views.generic.base import RedirectView
from django.views.generic.edit import UpdateView
f... |
"""
Python bindings for rSCADA libmbus.
"""
from ctypes import cdll, cast, c_char_p
from ctypes.util import find_library
from .MBusFrame import MBusFrame
from .MBusFrameData import MBusFrameData
from .MBusLowLevel import MBusLib
class MBus:
"""
A class to communicate to a device via MBus.
"""
MBUS_A... |
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... |
"""
This module is essentially a broker to xmodule/tabs.py -- it was originally introduced to
perform some LMS-specific tab display gymnastics for the Entrance Exams feature
"""
from django.conf import settings
from django.utils.translation import ugettext as _, ugettext_noop
from courseware.access import has_access
f... |
import warnings
from invenio.legacy.dbquery import run_sql
from invenio.utils.text import wait_for_user
depends_on = ['invenio_release_1_1_0']
def info():
return "New hidden format added to serve as helper in generating WebAuthorProfile pages"
def do_upgrade():
""" Implement your upgrades here """
prese... |
"""CAP Deposit utils."""
from __future__ import absolute_import, print_function
def clean_empty_values(data):
"""Remove empty values from model."""
if not isinstance(data, (dict, list)):
return data
if isinstance(data, list):
return [v for v in (clean_empty_values(v) for v in data) if v]
... |
# -*- coding: utf-8 -*-
import PyQt5.QtCore as Qc
import PyQt5.QtGui as Qg
import PyQt5.QtWidgets as Qw
import sys
import os
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if PATH not in sys.path:
sys.path.append(PATH)
print(PATH)
import tedqt as tqt
from tedutil.dec import dec
def qfl(label... |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
import sys # noqa: F401
... |
"""Test a Fast R-CNN network on an imdb (image database)."""
from fast_rcnn.config import cfg, get_output_dir
import argparse
from utils.timer import Timer
import numpy as np
import cv2
import caffe
from utils.cython_nms import nms
import cPickle
import heapq
from utils.blob import im_list_to_blob
import os
def _get_... |
from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... |
from reportlab.lib.units import inch
from common import Barcode
import string
_fim_patterns = {
'A' : "|| | ||",
'B' : "| || || |",
'C' : "|| | | ||",
'D' : "||| | |||",
# XXX There is an E.
# The below has been seen, but dunno if it is E or not:
# 'E' : '|||| ||||'
}
_postnet_patterns =... |
import os, re, sys, subprocess, socket
from autotest_lib.client.common_lib import utils, error
from autotest_lib.server.hosts import remote
class NetconsoleHost(remote.RemoteHost):
def _initialize(self, console_log="netconsole.log", *args, **dargs):
super(NetconsoleHost, self)._initialize(*args, **dargs)... |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create arc plots
# get the interactor ui
camera = vtk.vtkCamera()
# read the bore
bore = vtk.vtkPolyDataReader()
bore.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/bore.vtk")
tuber =... |
"""Function for interpolating formatted errors from the TensorFlow runtime.
Exposes the function `interpolate` to interpolate messages with tags of the form
{{type name}}.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import iterto... |
import numpy as np
import WaveTools as WT
import math
def readProbeFile(filename):
with open (filename, 'rb') as csvfile:
data=np.loadtxt(csvfile, delimiter=",",skiprows=1)
time=data[:,0]
data = data[:,1:]
csvfile.seek(0)
header = csvfile.readline()
header = ... |
"""Support for SCSGate components."""
import logging
from threading import Lock
import voluptuous as vol
from homeassistant.const import (CONF_DEVICE, CONF_NAME)
from homeassistant.core import EVENT_HOMEASSISTANT_STOP
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
ATTR_ST... |
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 UpdateAllStatuses(Choreography):
def __init__(self, temboo_session):
"""
Crea... |
import argparse
import logging
from common import _utils
def main(argv=None):
parser = argparse.ArgumentParser(description='Shutdown EMR cluster')
parser.add_argument('--region', type=str, help='The region where the cluster launches.')
parser.add_argument('--jobflow_id', type=str, help='Job flows to be shutdown... |
import re
def properties_root_device_name(properties):
"""get root device name from image meta data.
If it isn't specified, return None.
"""
root_device_name = None
# NOTE(yamahata): see image_service.s3.s3create()
for bdm in properties.get('mappings', []):
if bdm['virtual'] == 'root'... |
#encoding=utf-8
version = '0.4'
import hashlib
import urllib2
from urllib import urlencode
import json
import logging
def _verfy_ac(private_key, params):
items = params.items()
items.sort()
params_data = ""
for key, value in items:
params_data = params_data + str(key) + str(value)
param... |
"""
This module provides access to manipulating the current selection
on the end-user's system.
A selection is represented by a Python dictionary-like object
called a "Selection Dictionary", or "seldict" for short. The keys
in a seldict are strings that correspond to different formats that
the... |
try:
import argparse
except ImportError:
# since Python 2.6 and earlier don't have argparse, we simply provide
# the source for the same as _argparse and we use it instead.
import _argparse as argparse
import shutil
import StringIO
import string
import os
from datetime import date
import rjsmin
... |
from datetime import timedelta
import airflow
from airflow import DAG
from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobFlowOperator
from airflow.contrib.operators.emr_add_steps_operator import EmrAddStepsOperator
from airflow.contrib.sensors.emr_step_sensor import EmrStepSensor
from airfl... |
import h5py as hdf
import numpy as np
from numpy.lib import recfunctions
data_dir = './data/truth/'
#data_dir = '/home/boada/scratch/hdf5/'
def load_tiles(tiles):
data = []
for t in tiles:
t = t.replace('truth','')
f = hdf.File(data_dir+'Aardvark_v1.0c_truth_des_rotated.'+ t +'.hdf5', 'r')
dse... |
from unittest import mock
from oslo_config import cfg
from heat.common import exception
from heat.common import template_format
from heat.engine.clients.os import glance
from heat.engine.clients.os import neutron
from heat.engine.clients.os import sahara
from heat.engine.resources.openstack.sahara import cluster as s... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
VariableDistanceBuffer.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************... |
"""NDArray API of MXNet."""
from . import _internal, contrib, linalg, op, random, sparse, utils
# pylint: disable=wildcard-import, redefined-builtin
try:
from .gen_op import * # pylint: disable=unused-wildcard-import
except ImportError:
pass
from . import register
from .op import *
from .ndarray import *
# pyl... |
from sulley import *
import struct
import time
ndmp_messages = \
[
# Connect Interface
0x900, # NDMP_CONNECT_OPEN
0x901, # NDMP_CONECT_CLIENT_AUTH
0x902, # NDMP_CONNECT_CLOSE
0x903, # NDMP_CONECT_SERVER_AUTH
# Config Interface
0x100, # NDMP_CONFIG_GET_HO... |
from test.test_support import verbose, verify, TestFailed
import sys
import new
class Eggs:
def get_yolks(self):
return self.yolks
print 'new.module()'
m = new.module('Spam')
if verbose:
print m
m.Eggs = Eggs
sys.modules['Spam'] = m
import Spam
def get_more_yolks(self):
return self.yolks + 3
pri... |
"""
WebJournal element - prints journal info
"""
from invenio.legacy.webjournal.utils import \
parse_url_string, \
make_journal_url, \
get_current_issue, \
get_journal_css_url, \
get_journal_name_intl
def format_element(bfo, var=''):
"""
Print several journal specific variables.
@... |
# -*- coding: utf-8 -*-
"""
support for presenting detailed information in failing assertions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import six
from _pytest.assertion import rewrite
from _pytest.assertion import truncate
from _pyte... |
# -*- coding: utf-8 -*-
import json
import sys
from textwrap import dedent
import pytest
from tests import format_item
def test_simple_run(tmpdir, runner):
runner.write_with_general(dedent('''
[pair my_pair]
a = "my_a"
b = "my_b"
collections = null
[storage my_a]
type = "filesystem"
... |
from __future__ import print_function
import numpy as np
from landlab import ModelParameterDictionary
from landlab.core.model_parameter_dictionary import MissingKeyError, ParameterValueError
from landlab.field.scalar_data_fields import FieldError
from landlab.grid.base import BAD_INDEX_VALUE
class StreamPowerEroder(... |
from __future__ import absolute_import, division, unicode_literals
from collections import Mapping
from datetime import date, datetime
from decimal import Decimal
from mo_future import binary_type, generator_types, get_function_arguments, get_function_defaults, none_type, text
from mo_dots import Data, FlatList, Nul... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 28 14:09:55 2015
Shape should probably have been called outline but I have not yet bothered to
rename it. It is a subclass of LineGroup with extra methods for checking if it
is a closed polygon. The shape can be manifold (have internal holes) as long
as they are fully enc... |
import asyncio
from sqlalchemy import Table, Column, String, UniqueConstraint
from cloudbot import hook
from cloudbot.util import database
from cloudbot.util.persistent_set import PersistentSet
from plugins.global_tracking import Registry
WEREWOLF_CHAN = '##werewolf'
# WEREWOLF_CHAN = '##abra2'
MIRROR_CHAN = '##werew... |
def serialize_group(osf_group):
return {
'id': osf_group._id,
'name': osf_group.name,
'created': osf_group.created,
'modified': osf_group.modified,
'creator': serialize_member(osf_group.creator, osf_group),
'managers': [serialize_member(manager, osf_group) for manage... |
import os
# Update database configuration with $DATABASE_URL.
# Django settings for mysite project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
import dj_database_url
DATABASES = {
'default': {
... |
from __future__ import absolute_import, division, print_function, with_statement
import unittest
from . import struct
class StructTest(unittest.TestCase):
def testPropertyAccess(self):
self.assertEqual(struct.struct(foo="bar").foo, "bar")
def testJsonSerialization(self):
self.assertEqual(st... |
# parametrized test, using py.test
# see _parametric_test_t_demo.py for a skeletal.
# important: set cocos_utest=1 in the environment before run.
# that simplifies the pyglet mockup needed
# remember to erase or set to zero for normal runs
import os
assert os.environ['cocos_utest']
# set the desired pyglet mockup
im... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import traceback
import textwrap
from ansible.compat.six import iteritems
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.plugins import modul... |
from pyosm.parsing import iter_changeset_stream
from pyosm.model import Finished
import sys
import unicodecsv
import gzip
import re
class ThingHolder(object):
def __init__(self, nodes, ways, relations, changesets):
self.nodes = nodes
self.ways = ways
self.relations = relations
self.... |
from translate.misc.typecheck import _TC_NestedError, _TC_TypeError, check_type, Or
from translate.misc.typecheck import register_type, _TC_Exception
class _TC_IterationError(_TC_NestedError):
def __init__(self, iteration, value, inner_exception):
_TC_NestedError.__init__(self, inner_exception)
... |
from __future__ import absolute_import
import parser
import re
import tokenize
import token
import StringIO
SPACE = 'space'
SINGLE_QUOTED_STRING = 'single_quoted'
DOUBLE_QUOTED_STRING = 'double_quoted'
SUBSTITUTION = 'substitution'
REDIRECT = 'redirect'
PIPE = 'pipe'
RIGHT_ARROW = 'right_arrow'
BOLD_RIGHT_ARROW = 'br... |
from __future__ import print_function
from twisted.conch.client import connect, default, options
from twisted.conch.error import ConchError
from twisted.conch.ssh import connection, common
from twisted.conch.ssh import session, forwarding, channel
from twisted.internet import reactor, stdio, task
from twisted.python i... |
from rest_framework import viewsets
from onadata.apps.api.permissions import XFormPermissions
from onadata.apps.logger.models.xform import XForm
from onadata.libs import filters
from onadata.libs.mixins.anonymous_user_public_forms_mixin import (
AnonymousUserPublicFormsMixin)
from onadata.libs.mixins.last_modifie... |
from oauth2_provider.oauth2_backends import OAuthLibCore, get_oauthlib_core
from django.utils.http import urlencode
import ast
from django.utils import timezone
from rest_framework.pagination import PageNumberPagination
from rest_framework.renderers import JSONRenderer
from django.http import HttpResponse
from csp impo... |
"""
Copyright (C) 2016-2017 Junjie Chen (<EMAIL>),
Harbin Institute of Technology, Shenzhen, China
Bioinformatics Group.
The software is maintained by Junjie Chen.
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 Softwar... |
import os
# diff the output directory and only copy if necessary to
# avoid unecessarily dirtying build dependencies when no
# changes are necessary
exit_status = os.system("diff -x .svn -x .fake -x .DS_Store out/cppsrc/ ../ee/catalog/")
if (exit_status != 0):
os.system("rm ../ee/catalog/*")
os.system("cp out... |
"""High level parallel SNP and indel calling using multiple variant callers.
"""
import os
import collections
import copy
import pprint
import toolz as tz
from bcbio import bam, utils
from bcbio.distributed.split import grouped_parallel_split_combine
from bcbio.pipeline import datadict as dd
from bcbio.pipeline impor... |
# -*- coding: utf-8 -*-
"""
Unit tests for the causality module.
:copyright: Copyright 2014-2020 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function
import sys
import unittest
import numpy as np
import quantities as pq
... |
"""
Copyright 2008 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) any later ... |
def wavelet_inverse(wave, scale, dt, dj=0.25, mother="MORLET",param=-1):
"""Inverse continuous wavelet transform
Torrence and Compo (1998), eq. (11)
INPUTS
waves (array like):
WAVE is the WAVELET transform. This is a complex array.
scale (array like):
... |
from cinderclient import exceptions as cinder_exception
import mock
from nova import context
from nova import exception
from nova import test
from nova.volume import cinder
class FakeCinderClient(object):
class Volumes(object):
def get(self, volume_id):
return {'id': volume_id}
def l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.