src stringlengths 721 1.04M |
|---|
from __future__ import print_function
import unittest
import xml.etree.ElementTree as ET
from scan.commands import *
# These tests compare the XML as strings, even though for example
# both "<comment><text>Hello</text></comment>"
# and "<comment>\n <text>Hello</text>\n</comment>"
# would be acceptable XML representat... |
#The MIT License (MIT)
#Copyright (c) 2014 Microsoft Corporation
#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, modi... |
#!/usr/bin/env python
"""
Perform a vertical operation on a 3D results file to get 2D
"""
import numpy as np
import sys
from tqdm import tqdm
from pyteltools.geom.transformation import Transformation
import pyteltools.slf.misc as operations
from pyteltools.slf import Serafin
from pyteltools.utils.cli_base import logg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
requirements = [
'docopt',
]
test_requirements = [
# '... |
# -*- coding: utf-8 -*-
"""Sample model module."""
from datetime import datetime as dt
import traceback
import json
from tg import request
from sqlalchemy import *
from sqlalchemy.orm import mapper, relation, backref
from sqlalchemy import Table, ForeignKey, Column
from sqlalchemy.types import Integer, Unicode
# from ... |
from flask import render_template, redirect, url_for, abort, flash, request, current_app, make_response
from flask_login import login_required, current_user
from . import main
from ..models import User, Role, Permission, Post, Comment
from ..decorators import admin_required, permission_required
from .. import db
from ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Employee',
fields=[
('id', models.AutoField(ver... |
import os
import asyncio
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.locks
import hmac
import hashlib
import json
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
import atexit
# import functools
import logging
import requests
import git... |
from etaprogress import eta
from etaprogress.components import misc
from etaprogress.progress import ProgressBar
def test_terminal_width():
assert 80 == misc.terminal_width()
def test_undefined():
misc.terminal_width = lambda: 40
progress_bar = ProgressBar(None, max_width=30)
assert '0 [? ... |
import numpy
from sandbox.kernel.AbstractKernel import AbstractKernel
from sandbox.util.Parameter import Parameter
class PolyKernel(AbstractKernel):
"""
A class to find polynomial kernel evaluations k(x, y) = (<x, y> + b)^degree
"""
def __init__(self, b=1.0, degree=2):
"""
Initialise ... |
import cmd
import copy
import httplib
import oauth.oauth as oauth
import pprint
import readline
import sys
import urlparse
import webbrowser
import invoicible
# key and secret granted by the service provider for this consumer application
CONSUMER_KEY = ''
CONSUMER_SECRET_KEY = ''
# access token for this consumer app... |
'''
Combined example of the following listings
Listing 10.4: Computing the final reduction (multiple passes over the data)
'''
import numpy as np
import pyopencl as cl
import utility
from string import Template
ARRAY_SIZE = 2**20 # Note: The code assumes that the size of the array is divisible by the max work group ... |
# Django settings for examples project.
import sys
from os.path import dirname, join
import logging
logging.basicConfig(level=logging.DEBUG)
# add our parent directory to the path so that we can find cache_toolbar
sys.path.append('../')
# in order to track django's caching we need to import the panels code now
# so ... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node disconnect and ban behavior"""
import time
from test_framework.test_framework import Syscoin... |
#!/usr/bin/env python
"""arc2warc - convert one arc to a new warc"""
import os
import sys
import hashlib
import uuid
import sys
import os.path
import datetime
from optparse import OptionParser
from hanzo.warctools import ArcRecord,WarcRecord
from hanzo.warctools.warc import warc_datetime_str
parser = OptionParser... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... |
import os
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.files.storage import default_storage as storage
import amo
from amo.decorators import write
from amo.utils import chunked, resize_image
from mkt.site.storage_utils import wa... |
import xml.etree.ElementTree as etree
import base64
from struct import unpack, pack
import sys
import io
import os
import time
import itertools
import xbmcaddon
import xbmc
import urllib2,urllib
import traceback
import urlparse
import posixpath
import re
import socket, struct
from flvlib import tags... |
import unittest
import sys
from datetime import timedelta, timezone, datetime
import pickle
import pytest
import tz
from tz.tools import pairs
from tz.zoneinfo import ZoneInfo, enfold, parse_std_dst, parse_mnd_time, \
dth_day_of_week_n, PosixRules, ZERO, parse_time, julian_day, \
parse_name_offset
def tz_sh... |
import pandas
import numpy as np
import click
from bitstring import BitArray
from base58 import b58encode_int, b58decode_int
class Clusterer:
def __init__(self):
pass
def cluster(self, n, state_processor, pca = False, model_type = 'kmeans', z_score_exclude = 0.0, seed = None, quiet = False):
from sklearn.... |
"""
Testing the utility functions.
"""
import gzip
import logging
import math
import os
import unittest
import gensim
from gensim.models import TfidfModel
import operator
from safire.data import VTextCorpus, FrequencyBasedTransformer
from safire.data.filters.positionaltagfilter import PositionalTagTokenFilter
from s... |
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. Th... |
# -*- coding: utf-8 -*-
#
# File: content.py
#
# Copyright (c) 2008 by []
# Generator: ArchGenXML Version 2.1
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Lic... |
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import timedelta
from odoo.tests import common
from odoo import fields
from odoo.osv import expression
from odoo.exceptions import ValidationError
class TestChangePriceAtDate(common.TransactionCase):
def ... |
from setuptools import setup
setup(
name = "Alarmageddon",
description = "Automated testing and reporting",
version = "1.0.0",
author = "Tim Stewart, Scott Hellman",
author_email = "timothy.stewart@pearson.com, scott.hellman@pearson.com",
url = "https://github.com/Pearson... |
__author__ = 'tsungyi'
import lib.pycocotools._mask as _mask
# Interface for manipulating masks stored in RLE format.
#
# RLE is a simple yet efficient format for storing binary masks. RLE
# first divides a vector (or vectorized image) into a series of piecewise
# constant regions and then for each piece simply store... |
#!/usr/bin/env python
# Copyright (C) 2011-2014 Swift Navigation Inc.
# Contact: Niels Joubert <njoubert@gmail.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS"... |
# instagrabALL.py - download all images from instagram user
import re
from selenium import webdriver
import time
import sys
import itertools
import os
import urllib.request
from urllib.request import FancyURLopener
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.desired_capabilities... |
from django import forms
from django.forms import ModelForm, Field, ValidationError
from explorer.models import Query, MSG_FAILED_BLACKLIST
from django.db import DatabaseError, connections
from crontab import CronTab
from explorer.utils import get_connections_list
_ = lambda x: x
class SqlField(Field):
def vali... |
# Copyright 2018 The Oppia 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 applicable ... |
from collections import deque
class Solution(object):
# Op1: DFS
def wallsAndGates(self, rooms):
"""
:type rooms: List[List[int]]
:rtype: void Do not return anything, modify rooms in-place instead.
"""
for i in range(len(rooms)):
for j in range(len(rooms[0])... |
import numpy as np
from moviepy.video.VideoClip import VideoClip, ColorClip
from moviepy.audio.AudioClip import CompositeAudioClip
# CompositeVideoClip
class CompositeVideoClip(VideoClip):
"""
A VideoClip made of other videoclips displayed together. This is the
base class for most compositions.
... |
"""
This module enables Manifest file parsing.
Copied from
https://chromium.googlesource.com/external/googleappengine/python/+/master
/google/appengine/tools/jarfile.py
"""
import zipfile
_MANIFEST_NAME = 'META-INF/MANIFEST.MF'
class InvalidJarError(Exception):
"""
InvalidJar exception class
"""
pas... |
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Validates all aggregate functions across all datatypes
#
import logging
import pytest
from tests.common.test_vector import *
from tests.common.impala_test_suite import ImpalaTestSuite
from tests.common.test_dimensions import create_exec_op... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.backend.codegen.wire.java.java_wire_library import JavaWireLibrary
from pants.... |
#!/usr/bin/python
from multiprocessing import Value
from threading import Thread, Lock
import os
import time
class Scanner(object):
interface = None
freqlist = None
process = None
debugfs_dir = None
is_ath10k = False
lock = None
run = True
def dev_to_phy(self, dev):
f = open(... |
#!/usr/bin/python2
"""Identifies the latest National Water Model files in HydroShare."""
from hs_list import list_sims, list_dates
def _find_complete_sim(sims):
for key in reversed(sims):
sim = sims[key]
if sim['is_complete']:
return (key, sim)
return (None, None)
def find_lates... |
from django.core.management.base import BaseCommand
from django.conf import settings
from datetime import datetime
from pytz import timezone
from dateutil.tz import tzlocal
from icalendar import Calendar
import urllib.request
from ...models import Event, CalendarFeed
class Command(BaseCommand):
help = 'Updates... |
#=== PHYSICS =========================================================================================
# 2D physics functions.
# Authors: Tom De Smedt, Giorgio Olivero (Vector class)
# License: BSD (see LICENSE.txt for details).
# Copyright (c) 2008 City In A Bottle (cityinabottle.org)
# http://cityinabottle.org/nodebo... |
#!/usr/bin/env python
"""
Show solace clients and counts, optionally pump all stats into influxdb
"""
import logging
import sys
logging.basicConfig(format='[%(module)s] %(filename)s:%(lineno)s %(asctime)s %(levelname)s %(message)s',
stream=sys.stderr)
import libsolace.settingsloader as settings... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import collections
import os
import re
import sys
from colorama import init
from colorama import Fore, Back, Style
init()
##########################################################################################
PATTERN_01 = r'# TODO'
#####################################... |
import threading
import time
import traceback
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
from lib.FileManager.workers.progress_helper import update_progress
class CopyFromSftp(BaseWorkerCustomer):
def __init__(self, source, target, paths... |
from __future__ import division, print_function, absolute_import
import os
import numpy as np
from numpy.testing import dec, assert_allclose
from scipy import stats
from test_continuous_basic import distcont
# this is not a proper statistical test for convergence, but only
# verifies that the estimate and true value... |
# coding=utf-8
# Copyright 2021 Google LLC.
#
# 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 ... |
#!/usr/bin/env python
# Copyright (c) 2014 The Diamond Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listtransactions API
from test_framework import DiamondTestFramework
from diamondrpc.authpr... |
"""
Testing data image interface.
"""
import numpy as np
# Local imports
from ..volume_field import VolumeField
from ...transforms.transform import Transform, CompositionError
################################################################################
# Tests
def test_interface():
img = VolumeField()
im... |
# Copyright 2018 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... |
# -*- coding: utf-8 -*-
import pyjsonrpc
from gsmmodem.modem import GsmModem, SentSms, Sms
from gsmmodem.exceptions import TimeoutException, PinRequiredError, IncorrectPinError
def text(number, message, key):
if key.strip() == '9703BB8D5A':
print "Creating modem instance"
modem = GsmModem('/dev/tt... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages, setup
description = 'Adapt botocore to paste'
here = os.path.abspath(os.path.dirname(__file__))
try:
readme = open(os.path.join(here, 'README.rst')).read()
changes = open(os.path.join(here, 'CHANGES.txt')).read()
... |
###############################################################################
# #
# bounceables.py #
# #
... |
#!/usr/bin/python
#
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# The following dictionaries should be provided to buildcfg.py
# 1: base dictionary //only character words will be considered
# 2: tweak set file
# 3: dictionary with count // PCFG will be built over this
# 4: output PCFG file name/path
# 5: output Trie file name/path
# empty lines and line beginning with '#' will be ... |
import time
import math
version = '1.0.1 2016 Dec 31'
""" utility functions for working with python time """
def seconds_to_round_time(start_time=None, secs=1):
""" return the number of seconds to wait to get to the next
even time, rounded up from the start
secs = 10 for 10 seconds boundaries, = 7200 for... |
"""
Django settings for kpir project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
# -*- coding: utf-8 -*-
"""
Settings for the hello scripts.
You most likely need to edit a few of them, e.g. API_HOST and the OAuth
credentials.
"""
OUR_BANK = '00100'
USERNAME = '1000203893'
PASSWORD = '1000203893'
CONSUMER_KEY = 'bvldezvlnqj4mtva4jfktke4xliep0bt1xm44yxi'
CONSUMER_SECRET... |
from flask import Flask, session, redirect, url_for, escape, request, render_template
from flask.ext.mongoengine import MongoEngine
from pbkdf2 import crypt
from models import *
import logging, datetime, math, os
#SSL for future security maybe?
'''
import ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load... |
"""
This class is defined to override standard pickle functionality
The goals of it follow:
-Serialize lambdas and nested functions to compiled byte code
-Deal with main module correctly
-Deal with other non-serializable objects
It does not include an unpickler, as standard python unpickling suffices.
This module wa... |
# Copyright 2017 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... |
"""
The Attack interface.
"""
from abc import ABCMeta
import collections
import warnings
import numpy as np
import tensorflow as tf
from cleverhans.compat import reduce_max
from cleverhans.model import Model
from cleverhans import utils
_logger = utils.create_logger("cleverhans.attacks.attack")
class Attack(objec... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import train_test_split
from sklearn.cross_validation import cross_val_score
from sklearn.grid_search import GridSearchCV
from sklearn.tree import DecisionTreeClassifier
#... |
# 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.
import os
import sys
import pkg_resources
import subprocess
class Com... |
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
#-------------------------------------------------------------------------------
... |
# -*- coding: utf-8 -*-
#
# (c) 2016 Boundless, http://boundlessgeo.com
# This code is licensed under the GPL 2.0 license.
#
import os
from collections import defaultdict
from qgis.core import *
from PyQt4 import QtGui, QtCore
from geogigpy.commitish import Commitish
from geogigpy.commit import Commit
from geogigpy imp... |
#!/usr/bin/env python
# Cloudsnake Application server
# Licensed under Apache License, see license.txt
# Author: Markus Gronholm <markus@alshain.fi> Alshain Oy
import fuse
import time, sys
import stat, os, errno
import libCloudSnakeClient as SnakeClient
fuse.fuse_python_api = (0, 2)
class ObjectStat(fuse.Stat)... |
"""module containing some general mysql-related functions"""
import MySQLdb, re
import config_grunt
import email_grunt
import filesystem_grunt
def connect():
"connect and do setup"
global cursor, mysql_db
mysql_params = config_grunt.config_dict["mysql"]
mysql_connection_params = {
"host": mysq... |
# coding=utf-8
# qingfanyi - Chinese to English translation tool
# Copyright (C) 2016 Rohan McGovern <rohan@mcgovern.id.au>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... |
# -*- coding: utf-8 -*-
r"""
Parser for python source files
==============================
"""
# Created Sun Nov 27 14:03:07 2016
# Author: Óscar Nájera
from __future__ import division, absolute_import, print_function
import ast
from distutils.version import LooseVersion
from io import BytesIO
import re
import sys
imp... |
#!/usr/bin/env python
# Library for treating FITS files as Python Imaging Library objects
# Copyright (c) 2005, 2006, 2007, Jeremy Brewer
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#... |
from fabric.api import *
from fabric.colors import green, red
from fabric.contrib import files
import datetime
import os
def _environment ():
env.release = datetime.datetime.now().strftime ("%Y-%m-%d-%H%M%S")
env.project_name = 'lancms2'
# FIXME: hardcoded path:
env.path_home = '/opt/lancms2/'
env.path_root = o... |
# Passwords, API keys, and other sensitive information.
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from conf_site.settings.base import INSTALLED_APPS
DATABASES_DEFAULT = {
"ENGINE": "django.db.backends.postgresql",
... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Twitter 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/env python3
# Copyright (C) 2018 Facebook
#
# This file is part of libbtrfsutil.
#
# libbtrfsutil is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... |
#
# Copyright (C) 2013 Satoru SATOH <ssato @ redhat.com>
# License: GPLv3+
#
import sos_analyzer.tests.common as C
import sos_analyzer.utils as TT
import logging
import os.path
import os
import unittest
class Test_00_pure_functions(unittest.TestCase):
def test_10_to_log_level(self):
self.assertEquals(TT.... |
import yaml
from myriad.character import Player
from myriad.world import Map, World
from myriad.item import Item, OpenableItem, OpenableReadableItem, ReadableItem
# XXX maybe the story object should have a map attribute assigned based on
# story type... e.g., provided ASCII map, procedurally generated map, etc.
clas... |
import re
import threading
import unittest
from selenium import webdriver
from app import create_app, db
from models import Todo
class IntegrationTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
# start Firefox
try:
cls.client = webdriver.Firefox(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from io import BytesIO
from .. import KeyValueStore
class RedisStore(KeyValueStore):
"""Uses a redis-database as the backend.
:param redis: An instance of :py:class:`redis.StrictRedis`.
"""
def __init__(self, redis):
self.redis = redis
def... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
#!/usr/bin/env python
'''
@author Luke Campbell <LCampbell@ASAScience.com>
@file ion/services/dm/presentation/catalog_management_service.py
@description Catalog Management Service
'''
from pyon.public import PRED,RT
from pyon.util.log import log
from pyon.util.arg_check import validate_is_instance
from pyon.core.excep... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of Pynder.
Pynder is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... |
import pymysql.cursors
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host=host
self.name=name
self.user =user
self.password=password
self.connection=pymysql.connect(host=host, database=n... |
"""Sphinx documentation generator configuration file.
The full set of configuration options is listed on the Sphinx website:
http://sphinx-doc.org/config.html
"""
import sys
import os
# pylint:disable=invalid-name
# Add the Robottelo root directory to the system path. This allows references
# such as :mod:`robottelo... |
import os
import math
import random
import collections
import numpy as np
import tensorflow as tf
import cs224d.data_utils as data_utils
from tensorflow.models.embedding import gen_word2vec as word2vec
class Options(object):
def __init__(self):
#Model Options
self.emb_dim = 20
self.train_... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
#!/usr/bin/python
# Get a handle to the API client
import ssl
import sys
import pprint
import argparse
import requests
SERVICE_TYPE_MAP = {
'zookeeper': 'ZOOKEEPER',
'hdfs': 'HDFS',
'hbase': 'HBASE',
'yarn': 'YARN',
'oozie': 'OOZIE',
'hbase': 'HBASE',
'kafka': 'KAFKA',
}
SERVICE_ROLE_TYPE_MAP = {
... |
#!/usr/bin/python
"""
Copyright Hugh Perkins 2016
You can use this under the BSDv2 license
This script re-indent files, without changing git blame. It will create
a new commit for each author present in the original blame, with commit message
'automated re-indentation'
"""
import sys
import os
from os import path
i... |
#encoding:utf-8
from principal.models import Obra, Video
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.core.mail import EmailMessage
from dja... |
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
#MAEC -> OVAL Translator
#v0.94 BETA
#Generic mappings class
#Generates OVAL tests/objects/states from a CybOX Defined Object
import oval57 as oval
class cybox_oval_mappings(object):
def __init__(self, id_namespace):
self.test_id_base = 0
self.obj_id_base = 0
self.ste_id_base = 0
s... |
# 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
# d... |
#!/usr/bin/env python
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
from __future__ import print_function
class GPIO:
""" Class representing one fake GPIO signal for debugging purposes """
def __init__(self, name, directio... |
from datetime import datetime
from pyramid.httpexceptions import exception_response
from pyramid.view import view_config
from pyramid.response import Response
from xml.etree import ElementTree
from consuming_services_apis import Post
from consuming_services_apis.data.memory_db import MemoryDb
@view_config(route_nam... |
"""
Created on Sat Jul 19 12:51:34 2015
@author: Chao-Jun Feng
define PCA trainset class
"""
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as pl
from .trainset import trainset
from scipy.linalg import eigh
class pcaTS(trainset):
"""
PCA analysis of TS
:param z: ... |
import os
from astropy.io import ascii
from astropy.table import Table
from astropy.coordinates import Distance, Angle, SkyCoord
from astropy import units as u
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import sys
# Change path so that we can import functions from the '... |
from HTMLParser import HTMLParser
import DOM
from html_constants import *
cur = None
class parser(HTMLParser):
def handle_starttag(self, tag, attrs):
global cur
a = {}
for attr in attrs:
a[attr[0]] = attr[1]
cur = DOM.Element(cur, tag, a)
if tag in self_closing_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2009 by the FIFE team
# http://www.fifengine.de
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'filter.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_filter(object):
def setupUi(self, filter):
filter.setObjectName... |
from __future__ import absolute_import
from __future__ import division
from __future__ import nested_scopes
from __future__ import print_function
import logging
import pickle
import select
import socket
import struct
import threading
import time
from hops import util
from hops.experiment_impl.util import experiment_u... |
"""
PyQt5.6 python3.4
Table has editor
"""
import random
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
txt = '''The ASCII character set is suitable for encoding English-language documents,but it does not have much in the way of special characters, such as the French ‘ç.’
It is who... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.