src stringlengths 721 1.04M |
|---|
# detrend.py
#
# this takes a simple csv of time-series data and applies a 2nd or 3rd order polynomial fit.
# useful for "detrending" astronomical time series data before processing.
#
# Ray Sanders - rjs@raymondjsanders.com
#
import pprint
import os
import sys
import numpy
from matplotlib import pyplot
from scipy.opti... |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later versi... |
# encoding=utf-8
import copy
import unittest
from wpull.body import Body
from wpull.errors import ProtocolError
from wpull.http.request import Request, Response
class TestRequest(unittest.TestCase):
def test_request(self):
request = Request('http://example.com/robots.txt')
request.prepare_for_se... |
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
# Copied from https://gist.github.com/huyng/814831
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
import consulate
import os
import signal
impor... |
#!/usr/bin/env python3
PKG = 'lg_volume_control'
NAME = 'test_volume_control'
import unittest
import os
from lg_volume_control import VolumeControlMaster
from std_msgs.msg import UInt8, Int8
from lg_common.helpers import write_log_to_file
class MockPub:
def __init__(self):
self.data = []
def publi... |
#
# 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 or agreed to in writing, software
# ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 26 11:25:06 2016
@author: william
"""
import urllib
import pygeoj
import unicodedata
import pandas as pd
sectors = {"Bouches-du-Rhône":[]}
file13 = pygeoj.load("Data/france-geojson/departements/13/communes.geojson")
for feature in file13:
s = feature.properties['no... |
import re
from dataclasses import dataclass
from enum import auto
from enum import Enum
from typing import cast
from typing import List
from typing import Optional
from typing import Tuple
from .._internal import _to_bytes
from .._internal import _to_str
from ..datastructures import Headers
from ..exceptions import Re... |
"""A helper function for parsing and executing regex skills."""
import logging
import re
_LOGGER = logging.getLogger(__name__)
async def parse_regex(opsdroid, message):
"""Parse a message against all regex skills."""
# pylint: disable=broad-except
# We want to catch all exceptions coming from a skill m... |
import pytest
import os
import unittest
from pathlib import Path
from devel.dataset import transform_file_structure
import io3d
from loguru import logger
@unittest.skipIf(os.environ.get("TRAVIS", False), "Skip on Travis-CI")
def test_pilsen_pigs():
input_dir = r'H:\biomedical\orig\pilsen_pigs_raw\transplantation'... |
import os
from flask import (
Blueprint,
current_app,
jsonify,
request
)
from flask_jwt_extended import jwt_required
from app.dao.venues_dao import (
dao_create_venue,
dao_get_venues,
dao_update_venue,
dao_get_venue_by_id
)
from app.errors import register_errors
from app.routes.venues... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from core.load_modules import load_all_modules
from core.load_modules import load_all_graphs
from core.alert import messages
from core.config_builder import default_profiles
from core.config import _profiles, _synonym_profile
from core.config_builder import _buil... |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# Copyright (C) 2015 - 2020 David Mohammed <fossfreedom@ubuntu.com>
#
# 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... |
# Copyright (C) 2014 Daniel Lee <lee.daniel.1986@gmail.com>
#
# This file is part of StereoVision.
#
# StereoVision 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 you... |
# Copyright 2019 The ROBEL Authors.
#
# 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 or agreed to in wr... |
################################################################################
# JobBoard: a simple Django-based job board
# Copyright (c) 2009, Imaginary Landscape
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided... |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 CERN.
#
# B2Share 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... |
#!/bin/env python
# coding: utf-8
from app import db
from app.models import User, Role, Department, Idc, Server, Software, Project, Module, Environment
import os
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
if le... |
#!/usr/bin/python
########################################################################
# Copyright (c) 2015-2016
# Jason Jones <jason<at>jasonjon<dot>es>
# All rights reserved.
########################################################################
#
# This file is part of IDA TACO
#
# IDATACO is free software: ... |
# _*_ coding: utf-8 _*_
import itertools
import random
from csv_io import write_to_csv as writeToFile
import cPickle
'''
Sequences will be generated as lists, containing all possible combinations of intersections (4), directions (4) and targets (2)
The sequences are encoded as follows: (intersection, direction (st... |
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright (c) 2017 Massimiliano Patacchiola
# https://mpatacchiola.github.io
# https://mpatacchiola.github.io/blog/
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, F... |
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> and others
# (c) 2017, Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import ... |
from django.db.migrations import operations
from django.db.migrations.autodetector import MigrationAutodetector
from .operations import AlterConstraints
class MigrationAutodetectorWithDbConstraints(MigrationAutodetector):
db_constraints_operations = []
def generate_created_models(self, *args, **kwargs):
... |
# -*- 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 field 'Author.photo'
db.add_column(u'press_author', 'photo',
self.gf('django.... |
# coding: utf-8
#
# Copyright 2010 Alexandre Fiori
# based on the original Tornado by Facebook
#
# 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... |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
"""
Description: Record trajectory
1. requires firmware 1.2.0 and above support
"""
import os
import sys
import time
s... |
from PyQt4.QtCore import pyqtSignal, Qt
from PyQt4.QtGui import QTableView, QApplication, QWidget, QVBoxLayout
from PyQt4.QtGui import QLineEdit, QSpinBox, QDoubleSpinBox, QCheckBox
class PersonDataForm(QWidget):
def __init__(self, parent=None):
super(PersonDataForm, self).__init__(parent)
self... |
# Copyright 2016:
# * Jim Unroe KC9HI, <rock.unroe@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This... |
"""
This is a thin veneer around a `pyfilesystem`. It adds a few bits of
functionality:
1) Django configuration. This can go to Amazon S3 or a static
filesystem.
2) The ability to get URLs for objects stored on the filesystem.
3) The ability to create objects with a limited lifetime. A
task can garbage-collect those o... |
"""This module contains the general information for EquipmentSystemIOController ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class EquipmentSystemIOControllerConsts:
ADMIN_POWER_CMC_REBOOT = "cmc-reboot"
ADMIN_POWER_... |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from hashlib import md5
from itertools impor... |
# 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 or agreed to in writing, software
# distributed under t... |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... |
# Copyright 2010 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# 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
#
# ht... |
def get():
info = {}
info.update(
{ 'author': 'Ingy dot Net',
'author_email': 'ingy@ingy.net',
'classifiers': [ 'Development Status :: 2 - Pre-Alpha',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Intended Audience :: De... |
# Copyright (c) 2006, 2009-2010, 2012-2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2012, 2014 Google, Inc.
# Copyright (c) 2014-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Arun Persaud <arun@nubati.net>
# Copyright (c) 2015 Ionel Cristian Maries <contact@ionelmc.ro>
# Copyri... |
import alltheitems.__main__ as ati
import bottle
import collections
import contextlib
import datetime
import itertools
import json
import pathlib
import random
import re
import xml.sax.saxutils
import alltheitems.item
import alltheitems.util
import alltheitems.world
class FillLevel:
def __init__(self, stack_size... |
#
# upgrade_bootloader_gui.py: gui bootloader dialog for upgrades
#
# Copyright (C) 2002, 2007 Red Hat, Inc. All rights reserved.
#
# 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 versi... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Author: Paul Belanger <paul.belanger@polybeacon.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
# #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <HTTPretty - HTTP client mock for Python>
# Copyright (C) <2011-2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"... |
""" PingThread.py
Thread that pings the target server """
# Imports
import NetworkMonitor
import re
import ThreadBase
import time
import subprocess
class PingThread(ThreadBase.ThreadBase):
def __init__(self, platform, targetServer, interval, logFile, outputFile):
"""Constructor"""
# Initialize va... |
#!/usr/bin/python3
# Imported libraries
import sqlite3
# The sql connection & cursor
conn = sqlite3.connect('sql.db')
c = conn.cursor()
# List items============================================
print("==> Activity")
c.execute('''Select todo_id,
note,
status_id,
employee_id,
active,
... |
import re
import pytest
from pandas._libs.tslibs import Timedelta, offsets, to_offset
@pytest.mark.parametrize(
"freq_input,expected",
[
(to_offset("10us"), offsets.Micro(10)),
(offsets.Hour(), offsets.Hour()),
("2h30min", offsets.Minute(150)),
("2h 30min", offsets.Minute(150... |
#!/usr/bin/env python
# ROS IMPORTS
import roslib; roslib.load_manifest('simple_ur_driver')
import rospy
import tf; import tf_conversions as tf_c
import PyKDL
# URDF
from urdf_parser_py.urdf import URDF
from pykdl_utils.kdl_kinematics import KDLKinematics
# MSGS and SERVICES
from simple_ur_msgs.srv import *
from sensor... |
"""Sorts a CSV file on the group field
"""
import argparse
import csv
from operator import itemgetter
from LmCommon.common.lmconstants import ENCODING
# .............................................................................
def sort_file_on_field(input_filename, output_filename, group_position):
"""Sorts a... |
"""this management commands will fix corrupted posts
that do not have revisions by creating a fake initial revision
based on the content stored in the post itself
"""
from django.core.management.base import NoArgsCommand
from django.db.models import signals, Count
from askbot import models
from askbot import const
def... |
"""
PSET-4
Word Game Part 9: You and your Computer
"""
PROMPT_STR = "Enter n to deal a new hand, r to replay the last hand, or e to end game: "
NO_REPL_AVAIL_STR = "You have not played a hand yet. Please play a new hand first!"
INVALID_CMD = "Invalid command."
CHOOSE_PLAYER_STR = "Enter u to have yourself play, c to h... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... |
# -*- coding: utf-8 -*-
import os
from os.path import splitext, basename
import time
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
from flask import jsonify
from PIL import Image
from PIL import ImageDraw
import cStringIO as StringIO
import ur... |
"""
Functions to create initializers for parameter variables.
Usage
-------
>>> from lasagne.layers import DenseLayer
>>> from lasagne.init import Constant, Glorot
>>> l1 = DenseLayer((100,20), num_units=50, W=GlorotUniform(), b=Constant(0.0))
"""
import numpy as np
from .utils import floatX
class Initializer(obje... |
# ----------------------------------------------------------------------------
# Copyright (c) 2017-, labman development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------... |
from __future__ import absolute_import
from typing import Any, DefaultDict, Dict, List, Set, Tuple, TypeVar, Text, \
Union, Optional, Sequence, AbstractSet, Pattern, AnyStr, Callable, Iterable
from typing.re import Match
from zerver.lib.str_utils import NonBinaryStr
from django.db import models
from django.db.mode... |
import maya.cmds as cmds
from functools import partial
from . import custom_renamer
from . import field_replacer
from . import template_renamer
from . import bonus_tools
from . import renamer_settings as settings
######CollapseCommands#####################################################
############################... |
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20151105_0513'),
('devices', '0001_initial'),
('devicetypes', '0001_initial'),
migrations.swappab... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
#------------------------------------------------------------------------------
# setlx2py: setlx_util.py
#
# Central place for functions which are needed in at least
# two different files
#
# Copyright (C) 2014, Jan-Christoph Klie
# License: Apache v2
#------------------------------------------------------------------... |
# ~ util package that would hold common functionalities and tools that all versions of the api would use
# (@: Name): "mailMorth"
# (@:Description): "email Management, and automation api code"
# (@:Author): "inteliJence development team"
# under the license of Apache License 2.0 and intelijence Protective Rig... |
from django.contrib.auth.models import User
from django.test import TestCase
from .models import Blog, Subscription
# Create your tests here.
class BlogTest(TestCase):
def setUp(self):
Blog.objects.create(name='test',
unique_name='test_blog')
def test_srt_representation(se... |
from huuey.paths import Paths
class Scene:
name = None
lights = []
owner = None
recycle = None
locked = None
appdata = None
picture = None
lastupdated = None
version = None
_id = None
_parent = None
def __init__(self, obj, parent, _id):
self._parent = parent
... |
# Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# 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 ap... |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
import six
from django.test import RequestFactory
from shoop.... |
"""Component to interface with various media players."""
from __future__ import annotations
import asyncio
import base64
import collections
from contextlib import suppress
import datetime as dt
import functools as ft
import hashlib
import logging
import secrets
from typing import final
from urllib.parse import urlpars... |
from django.contrib.admin import AdminSite
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import RequestFactory, TestCase, Client
from formative.admin import FormativeBlobAdmin
from formative.forms import FormativeTypeForm
from formative.models import Formative... |
# http://pyrocko.org - GPLv3
#
# The Pyrocko Developers, 21st Century
# ---|P------/S----------~Lg----------
from __future__ import absolute_import
import numpy as num
from . import parstack_ext
try:
range = xrange
except NameError:
pass
def parstack(arrays, offsets, shifts, weights, method,
le... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import logging
import os
import re
from collections import OrderedDict
import docutils
import docutils.core
import docutils.io
from docutils.writers.html4css1 import HTMLTranslator, Writer
import six
from six.moves.html_parser import HTM... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
''' High-level HTTP communication interface. '''
import re
import codecs
import httplib
from spidy.common.errors import WebException
WEB_URL_PATTERN = re.compile('''([a-z]{3,9}:\/\/|[a-z]{3,9}:\/\/www\.|www\.)([\w.-]+)((?:\/[\w\/:@\-_~.%!$&'()*+=,;]*)?(?:\?[\w\-\+=&;%@._]*)?(?:#[\w\/:?@\-_~.%!$&'()*+=,... |
# -*- coding: utf-8 -*-
import unittest
from funcionario_repo import FuncionarioRepo
class TestFuncionariosRepository(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.funcionario_repo = FuncionarioRepo()
def teste_deve_recuperar_funcionario_pelo_id(self):
nome_esperado = "FA... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\src\rrt\maya\ui\submit.ui'
#
# Created: Wed Oct 24 16:19:16 2012
# by: PyQt4 UI code generator 4.7.7
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUt... |
# -*- 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 'Complejo'
db.create_table(u'complejos_complejo', (
(u'id', self.gf('django.db.mo... |
# Organic Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for organic solar cells.
# Copyright (C) 2012 Roderick C. I. MacKenzie
#
# roderick.mackenzie@nottingham.ac.uk
# www.opvdm.com
# Room B86 Coates, University Park, Nottingham, NG7 2RD, UK
#
# This program is free softwar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import web
import hashlib
import pprint
import sys
import logging
import traceback
import getopt
import re
from web.wsgiserver import CherryPyWSGIServer
import json
import threading
import time
import sqlite3
from wechatpy import WeChatClient
from wechatpy... |
import copy
from .fuzzfactory import reqfactory
from .payman import payman_factory
from ..fuzzobjects import FuzzResult, FuzzType, FuzzWord, FuzzWordType
from ..helpers.obj_factory import ObjectFactory, SeedBuilderHelper
class FuzzResultFactory(ObjectFactory):
def __init__(self):
ObjectFactory.__init__(... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
MultilineTextPanel.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*******************... |
##
# Copyright (c) 2005-2014 Apple Inc. All rights reserved.
#
# 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 l... |
# Copyright 2018 D-Wave Systems 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 or... |
#!/usr/bin/python
#from jenkinsapi.jenkins import Jenkins
#from jenkinsapi.custom_exceptions import JenkinsAPIException
#from jenkinsapi.constants import STATUS_SUCCESS
import jenkins
import jenkinspoll
import click
import os
import requests
@click.command()
@click.option('--jenkins-url', help="The URL of the Jenkins ... |
import MySQLdb
import db_connect_creds
from datetime import datetime
username, password = db_connect_creds.read_creds()
cxn = MySQLdb.connect('localhost', user=username, passwd=password)
date = datetime.now()
cxn.query('CREATE DATABASE IF NOT EXISTS InfernalWireless')
cxn.commit()
cxn.close()
cxn = MySQLdb.connec... |
#!/usr/bin/env python
"""Abstracts encryption and authentication."""
import hashlib
import time
import zlib
from M2Crypto import BIO
from M2Crypto import EVP
from M2Crypto import Rand
from M2Crypto import RSA
from M2Crypto import X509
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib import ... |
# -*- coding: UTF-8 -*-
from behave import step, then
from dogtail.predicate import GenericPredicate
from dogtail.tree import root
from dogtail.rawinput import keyCombo, typeText
from time import sleep
from behave_common_steps import wait_until
import datetime
import os
@step(u'Create new appointment')
def create_new... |
"""Provider module for CloudNS"""
import logging
import requests
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
NAMESERVER_DOMAINS = ["cloudns.net"]
def provider_parser(subparser):
"""Configure provider parser for CloudNS"""
identity_group = subparser.add_... |
from api.libs.base import CoreView
from cmdb.models import MachineRoom, DataCenter
from account.models import UserProfile
from django.db.utils import IntegrityError
class MachineRoomView(CoreView):
"""
机房视图类
"""
login_required_action = ["get_list", "post_create", "post_delete", "post_change"]
supe... |
#!/bin/env python
#==========================================================================
# (c) 2006 Total Phase, Inc.
#--------------------------------------------------------------------------
# Project : Aardvark Sample Code
# File : aabitrates.py
#------------------------------------------------------------... |
import nltk
class IndexedText(object):
def __init__(self, stemmer, text):
self._text = text
self._stemmer = stemmer
self._index = nltk.Index((self._stem(word), i)
for (i, word) in enumerate(text))
def concordance(self, word, width=40):
key = se... |
# Copyright (c) 2014 Mirantis 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 or agreed to in writ... |
# -*- coding: utf-8 -*-
import time, sched, urllib2, json
from devsup.db import IOScanListBlock
from devsup.hooks import initHook
from devsup.util import StoppableThread
class BPLReport(object):
reports = {}
def __init__(self, name, url, period):
self.name = name
self.url, self.period = url, ... |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... |
#!/usr/bin/env python3
"""Tests for package-level objects in python-gsl."""
# Copyright © 2016 Timothy Pederick.
#
# Based on the GNU Scientific Library (GSL):
# Copyright © 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 The GSL Team.
#... |
class InitModule:
def init(self, viewer):
raise Exception("init has not been implemented.")
class InteractiveModule:
def _handle(self, viewer, ch):
raise Exception("_handle has not been implemented.")
def _handle_help(self, viewer, buf):
raise Exception("_handle_help has not been... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
from mock import patch
from requests.exceptions import ConnectionError
from django.test import TestCase
from django.test.utils import override_settings
from ..tasks import backup_db, refresh_material_views
class S3BucketMock(object):
pass
class S3Mock(object):
def __init__(self, *args, **kwargs):
s... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('Datasets/SN_d_tot_V2.0.csv')
# print(df)
""" CSV file doesn't have column labels
Column 1-3: Gregorian calendar date
Column 4: Date in fraction of year
Column 5: Daily total sunspot number. A value of -1 indicates that ... |
# -*- coding: utf-8 -*-
#
# mimecat documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 11 12:01:01 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
# -*- coding: utf-8 -*-
import datetime
import json
import logging
import sys
import threading
import arrow
from pale import config as pale_config
from pale.arguments import BaseArgument
from pale.fields import ResourceField, ListField, ResourceListField
from pale.errors import APIError, ArgumentError, AuthenticationE... |
"""
File argtest.py: (3.X + 2.X) function decorator that performs
arbitrary passed-in validations for arguments passed to any
function method. Range and type tests are two example uses;
valuetest handles more arbitrary tests on a argument's value.
Arguments are specified by keyword to the decorator. In the act... |
import os
template = '''#!/bin/sh
SPACE="{space} create {daemons} partitions tolerate {ft} failures"
exec python "${{HYPERDEX_SRCDIR}}"/test/runner.py --daemons={daemons} --space="${{SPACE}}" -- \\
"${{HYPERDEX_BUILDDIR}}"/test/replication-stress-test --quiet -n {daemons} -h {{HOST}} -p {{PORT}}
'''
SIMPLE = "sp... |
#! /usr/bin/env python
# MMapArea.py
# This file is part of Labyrinth
#
# Copyright (C) 2006 - Don Scorgie <Don@Scorgie.org>
#
# Labyrinth 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 th... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings as django_settings
from django.contrib import messages
from django.contrib.auth import (
REDIRECT_FIELD_NAME,
login as auth_login,
authenticate,
update_session_auth_hash)
from django.contrib.auth.decorators... |
#! /usr/bin/env python3
import sys
sys.path.append('../')
import stre.settings
import datetime
import subprocess
host = stre.settings.DATABASES['default']['HOST']
user = stre.settings.DATABASES['default']['USER']
password = stre.settings.DATABASES['default']['PASSWORD']
name = stre.settings.DATABASES['default']['NAME... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.