src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
"""
stego_lsb.LSBSteg
~~~~~~~~~~~~~~~~~
This module contains functions for hiding and recovering
data from bitmap (.bmp and .png) files.
:copyright: (c) 2015 by Ryan Gibson, see AUTHORS.md for more details.
:license: MIT License, see LICENSE.md for more details.
"""
imp... |
"""
Author: PH01L
Email: phoil@osrsbox.com
Website: https://www.osrsbox.com
Description:
A very simple example script of how to load the osrsbox-db item database,
loop through the loaded items, and print and items that are both weapons
and available in free to play.
Copyright (c) 2019, PH01L
#####################... |
"""
.. module:: Notifier
:platform: Unix, Windows
:synopsis: Implements a simple Observer/Observable pattern for communication between between Facemovie thread and Ivolution GUI
.. moduleauthor:: Julien Lengrand-Lambert <jlengrand@gmail.com>
"""
class Observer():
"""
Implements a simple Observer from t... |
import unittest
from canopen import emcy
class TestEmcyConsumer(unittest.TestCase):
def test_emcy_list(self):
emcy_node = emcy.EmcyConsumer()
emcy_node.on_emcy(0x81, b'\x01\x20\x02\x00\x01\x02\x03\x04', 1473418396.0)
emcy_node.on_emcy(0x81, b'\x10\x90\x01\x00\x01\x02\x03\x04', 1473418397.... |
# Copyright 2015 PerfKitBenchmarker 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 appli... |
#!/usr/bin/python2
"""
Runs a validation command on the provided file, and generates an Event from
the results.
If a format has no defined validation commands, no command is run.
"""
from __future__ import print_function
import ast
import sys
# archivematicaCommon
from custom_handlers import get_script_logger
from ex... |
# -*- coding: utf-8 -*-
'''
This package contains the loader modules for the salt streams system
'''
# Import Python libs
from __future__ import absolute_import
import logging
import copy
import re
# Import Salt libs
import salt.loader
import salt.utils
import salt.utils.minion
log = logging.getLogger(__name__)
cla... |
import os
import inspect
from datetime import datetime
from argparse import ArgumentParser
from locksmith.lock import *
from locksmith.log import logger
class CommandlineArgumentError(Exception):
pass
class CommandError(Exception):
pass
def cmd_list(conf, argv):
"""
List all existing build environme... |
class VirtualMachine:
def __init__(self, ram_size=512, executing=True):
self.data = {i: None for i in range(ram_size)}
self.stack = []
self.executing = executing
self.pc = 0
self.devices_start = 256
def push(self, value):
"""Push something onto the stack."""
... |
from bs4 import BeautifulSoup
import os
import pandas as pd
import sys
import traceback
from sklearn.feature_extraction.text import CountVectorizer
class FeaturesExtractor:
def __init__(self):
self.FEATURE_NAMES = ['e1_token_id', 'e1_number','e1_sentence','e1_token','e1_aspect', 'e1_class','e1_event_id'... |
# Copyright 2017 reinforce.io. 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 law or... |
"""
This is the Django template system.
How it works:
The Lexer.tokenize() method converts a template string (i.e., a string
containing markup with custom template tags) to tokens, which can be either
plain text (TokenType.TEXT), variables (TokenType.VAR), or block statements
(TokenType.BLOCK).
The Parser() class ta... |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 7.0.3 "Blackbird"
#
# SU2 Project Website: https://su2code.github.io
#
# The SU2 Project is maintained by the SU2 Foundation
# (http://su2foundation.org)
#
# Copyright 2012-... |
# -*- coding: utf-8 -*-
"""
This page defines the Implementation of an analyzer for "www.lemonde.fr"
"""
from HTMLParser import HTMLParser
from Isite_extractor import ISiteExtractor
class LeMondeExtractor(ISiteExtractor):
"""
This class implements the Page analyzer interface for "lemonde.fr" website
"""
... |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Collection of parser fonctions for qitests actions """
from __future__ import absolute_import
from __future__ import un... |
import codecs
import re
import os
from setuptools import setup, find_packages, Command
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)... |
import sys
sys.path.append(".")
disabled = False
try:
# pyglet requires ctypes > 1.0.0
import ctypes
ctypes_major = int(ctypes.__version__.split('.')[0])
if ctypes_major < 1:
disabled = True
except:
disabled = True
from sympy import *
x,y = symbols('xy')
class TestPlotting... |
"""
This is the *abstract* django models for many of the database objects
in Evennia. A django abstract (obs, not the same as a Python metaclass!) is
a model which is not actually created in the database, but which only exists
for other models to inherit from, to avoid code duplication. Any model can
import and inherit... |
'''Train a simple deep CNN on the CIFAR10 small images dataset.
GPU run command with Theano backend (with TensorFlow, the GPU is automatically used):
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python cifar10_cnn.py
It gets down to 0.65 test logloss in 25 epochs, and down to 0.55 after 50 epochs.
(it's s... |
import sys
from pyspark.sql import SparkSession, functions, types
spark = SparkSession.builder.appName('reddit relative scores').getOrCreate()
assert sys.version_info >= (3, 4) # make sure we have Python 3.4+
assert spark.version >= '2.1' # make sure we have Spark 2.1+
schema = types.StructType([ # commented-out fie... |
#
# Copyright © 2016 <code@io7m.com> http://io7m.com
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTH... |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenSesame is distri... |
# -*- coding: utf-8 -*-
# License: See LICENSE file.
import math
CLASSIC = 0
WRAP = 1
#MOBIUS = 2
def distance(world_shape, type=CLASSIC):
def distance_classic(a,b):
val = 0.0
for ad,bd in zip(a,b):
val += (ad-bd)**2
return math.sqrt(val)
def distance_wrap(a,b):
... |
import urllib
import urllib2
import pprint
import json
import datetime
import time
import logging
from calendar_bot import CalendarClient
'''returns 'TANAAN!!' if today is paapaiva and string for something else
returns None if no paapaiva in next 10 days
'''
def is_paapaiva(client):
#the events from raati15 cal... |
from __future__ import print_function
import os
from IPython.display import display, HTML, Javascript
leaflet_css = '//cdn.leafletjs.com/leaflet-0.7.2/leaflet.css'
# leaftlet_js = "//cdn.leafletjs.com/leaflet-0.7.2/leaflet"
# leaflet_draw_js = ['//cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.2.3/leaflet.draw-src.j... |
from sets import Set
from interfaceDB import insert_link_with_tag, is_link, is_tag, get_tags_ids_of_link, get_tags_from_ids, \
get_links_ids_from_tag, get_link_data_from_id
class LinkList(list):
def __init__(self, link_name, link_desc=None, link_tags=[]):
list.__init__([])
self.name = link_n... |
# Copyright 2017 Christoph Mende
#
# 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... |
import os
import sys
import alize
PATH = os.path.abspath(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if not PATH in sys.path:
sys.path.insert(0, PATH)
if alize.__version__ < "0.1.0":
sys.exit("alize version over 0.1.0. : %s " % (alize.__version__))
from alize.application import AlizeRunner
f... |
from django.test import TestCase
class CartTest(TestCase):
from django.test.client import Client
Client = staticmethod(Client)
from shame.models import Store
Store = staticmethod(Store)
from shame.models import Product
Product = staticmethod(Product)
from xml.etree import ElementTree
... |
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... |
if __name__ == '__main__':
#####
##temporary dev hack
import os,time
os.chdir('..')
#####
from pyviko import core, mutation, restriction
#ovr = core.readFasta('test/dem/over/2000.fasta')
#toKO = core.readFasta('test/dem/ko/2000.fasta')
'''#True batch script
t1 = time.time()
for i in range(len(toKO)):
... |
"""
Processing.
Author: Dave Hale, Colorado School of Mines
Version: 2012.05.20
---
Receiver stations: 954 - 1295 ( 954 <=> 0.000)
Source stations: 1003 - ???? (1003 <=> 7.350)
"""
from imports import *
s1 = Sampling(4001,0.002,0.000) # time sampling
s2 = Sampling(342,0.015,0.000) # receiver sampling (first group at ... |
import six
from .fields import Field
class MetaModel(type):
"""The metaclass for :class:`~schemazoid.micromodels.Model`.
The main function of this metaclass
is to move all of fields into the ``_clsfields`` variable on the class.
"""
def __new__(cls, name, bases, attrs):
fields = {}
... |
# Copyright [2015] Hewlett-Packard Development Company, L.P.
# 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... |
"""Event scheduler by Joseph Lansdowne.
Uses Pygame's wait function if available, else the less accurate time.sleep.
To use something else, do:
import sched
sched.wait = wait_function
This function should take the number of milliseconds to wait for. This will
always be an integer.
Python version: 2.
Release: 11-de... |
import PySimpleGUI as sg
from Ingredient_Library import restoreIngredientLibrary, storeIngredientLibrary, createIngredient
from Ingredient_Library import listIngredients, getFamilyTypes, getBaseTypes, deleteIngredient
from Ingredient_Library import restoreBases
from Drink_Library import restoreDrinkLibrary, storeDrinkL... |
# -*- coding: utf-8 -*-
__author__ = 'M.Novikov'
from model.project import Project # Проекты Mantis
from random import randrange # Случайности
import random # Случайнос... |
# -*- coding: utf-8 -*-
#
# Copyright 2011 Manuel Stocker <mensi@mensi.ch>
#
# This file is part of GitTornado.
#
# GitTornado 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, o... |
# Connect to a known game Server and spew out whatever it tells us, before the missing heartbeat causes us to disco
#
import socket
import struct
import sys
import json
# internet variables
game_address = ('127.0.0.1', 27001) # a hack so that I can use the tcpserver when testing.
######
# misc helper function decl... |
from django.core.management.base import BaseCommand, CommandError
from library.ui.models import Fileinfo, Media
from settings import MEDIA_ROOT
import os
from mutagen.mp4 import MP4
class Command(BaseCommand):
args = ''
help = 'build list of media filenames'
def handle(self, *args, **options):
fil... |
#!/usr/bin/env python
"""
This contains Global variables for sx.
@author : Shane Bradley
@contact : sbradley@redhat.com
@version : 2.17
@copyright : GPLv2
"""
import sys
import os.path
import logging
import datetime
from sx.logwriter import LogWriter
"""
@cvar MAIN_LOGGER_NAME: The name of the main logger
... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to run long running tasks.
This allows a task to run in Task Queue which gives about 10 minutes execution
time.
Usage:
In https://chromeperf.app... |
"""
PyPal.py
@author: byteface
"""
class PyPal(object):
"""
PyPal is the heart for all pypals :)
"""
# TODO - tell command to pass messages to other pypals. non conflicting. saves having to quit out of current one
# TODO - list commands
# TODO - learn from. quick command to copy commands between ... |
"""Download files with progress indicators.
"""
import cgi
import logging
import mimetypes
import os
from pipenv.patched.notpip._vendor import requests
from pipenv.patched.notpip._vendor.requests.models import CONTENT_CHUNK_SIZE
from pipenv.patched.notpip._internal.models.index import PyPI
from pipenv.patched.notpip.... |
import pytest
import dateparser
from ModifyDateTime import apply_variation
@pytest.mark.parametrize('original_time, variation, expected', [
# sanity
('2020/01/01', 'in 1 day', '2020-01-02T00:00:00'),
# textual variation 1
('2020/01/01', 'yesterday', '2019-12-31T00:00:00'),
# textual variation 2
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.shortcuts import get_object_or_404
from ..core.utils.slug import slugify_uniquely
from ..core.generic import GenericView
from ..core.decorators im... |
import HaloRadio.TopWeb as TopWeb
import HaloRadio.StyleListMaker as StyleListMaker
import HaloRadio.Style as Style
class plugin(TopWeb.TopWeb):
def GetReqs(self):
return "amv"
def handler(self, context):
import HaloRadio.UserSongStatsListMaker as UserSongStatsListMaker
import HaloRadio.Use... |
import pickle
import praw
import random
from textblob import TextBlob
from datetime import datetime
from sklearn import linear_model
class RedditBot:
"""A class that performs basic operations, working with Reddit's
PRAW API."""
def __init__(self, botName):
# Setup the bot and primary variables.
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
'''**********************************************************************
Copyright (C) 2009-2016 The Freeciv-web project
This program 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, eithe... |
#!/usr/bin/env python
'''
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")... |
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import requests
def greeting():
"Plays greeting audio via REST API"
r = requests.get("http://localhost:3000/playAudio/welcome.mp3");
def decCount(i):
if i > 0:
i -= 1
T_POLL = 0.5 # sec
T_INSIDE_ACTIVE = 20 # sec
T_WELCOME_DELAY = 2 # sec
T_WELC... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#Imports
#*************************************************************************
import cv2
import serial
import numpy as np
#puerto = serial.Serial('/dev/ttyACM0', 9600, timeout=1)
#*************************************************************************
#Fun... |
#!/usr/bin/env python
# YAM SPLIT - Austin G. Davis-Richardson
# Splits barcoded, 3-paired illumina files based on a .yaml config file
import sys
import os
from glob import glob
import string
try:
import yaml
except ImportError:
print >> sys.stderr, "could not import yaml\ntry:\n sudo easy_install pyyaml"
... |
import os
import sys
root_path = os.path.abspath("../../../../")
if root_path not in sys.path:
sys.path.append(root_path)
import unittest
import numpy as np
from Util.Util import DataUtil
from _Dist.NeuralNetworks.e_AdvancedNN.NN import Advanced
from _Dist.NeuralNetworks._Tests._UnitTests.UnitTestUtil import clea... |
###############################################################################
#
# 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):
"""... |
from typing import (
List,
Tuple,
Callable,
)
from re import split
from itertools import combinations
from collections import Counter
from networkx import Graph
from .sentence import Sentence
__all__: Tuple[str, ...] = (
'parse_text_into_sentences',
'multiset_jaccard_index',
'build_sentence... |
import asyncio
import os
import signal
import ssl
from multiprocessing import Process
from random import randint
from time import sleep
from unittest.mock import Mock
import aiohttp
import pytest
import requests
from proxypooler import config
from proxypooler.pooler import ProxyPooler
from proxypooler.ext import ser... |
"""
Auto-auth page (used to automatically log in during testing).
"""
import urllib
from bok_choy.page_object import PageObject
from . import BASE_URL
class AutoAuthPage(PageObject):
"""
The automatic authorization page.
When allowed via the django settings file, visiting
this url will create a user ... |
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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 2015 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides a cross-platform Python interface for the UNI-T 330A/B/C temperature,
humidity, and pressure data loggers.
This code controls a UNI-T 330 A/B/C device via a cross-platform Python script.
The device accepts commands and provides responses. I’ve decoded all the
... |
# Copyright 2016 Google 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 law or agr... |
#!/usr/bin/python3
import re, os
HEADER_REGEX = re.compile('#include "(.*)"')
# This list may contain not all headers directly, but each jngen header
# must be among the dependencies of some file from here.
LIBRARY_HEADERS = [
"array.h",
"random.h",
"common.h",
"tree.h",
"graph.h",
"geometry... |
# Copyright (C) 2012 by Eka A. Kurniawan
# eka.a.kurniawan(ta)gmail(tod)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; version 2 of the License.
#
# This program is distributed in the hop... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-02-23 05:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('familias', '0003_merge_20170223_0525'),
]
operatio... |
# chemicalFormulas.py
#
# Original code by Paul McGuire
# Code obtained from Python forum http://www.daniweb.com/software-development/python/threads/102740
# Code shared in forum in Dec 29th, 2007
#
# wrapped and adapted by Martins Mednis
#
from pyparsing import Word, Optional, OneOrMore, Group, ParseException
# defi... |
#!/usr/bin/env python3
import numpy as np
import numpy.random
from time import time
# web mercator projection functions
# ---------------------------------
def linear_lat(lat, atanh = np.arctanh, sin = np.sin, radians = np.radians):
return atanh(sin(radians(lat)))
def inv_linear_lat(ll, asin = np.arcsin, tanh = n... |
import unittest
from sail_sms import SMSBackup, SMSImporter, SMSParser
import time
import os
class SMSBackupTest(unittest.TestCase):
def setUp(self):
self.backup_tool = SMSBackup("assets/test_commhistory.db", "assets/")
parser = SMSParser("assets/samples.xml")
self.sms_list = parser.get_a... |
import subprocess
import time
import locale
import logging
from pyp2rpm import version
from pyp2rpm import utils
logger = logging.getLogger(__name__)
def get_deps_names(runtime_deps_list):
'''
data['runtime_deps'] has format:
[['Requires', 'name', '>=', 'version'], ...]
this function creates list of... |
#!/usr/bin/python -Es
# -*- coding: utf-8 -*-
# Authors: Daniel P. Berrange <berrange@redhat.com>
# Eren Yagdiran <erenyagdiran@gmail.com>
#
# Copyright (C) 2013-2015 Red Hat, Inc.
# Copyright (C) 2015 Universitat Politècnica de Catalunya.
#
# This program is free software; you can redistribute it and/or modif... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# vasppy documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 6 13:36:30 2018.
#
# 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
# aut... |
# -*- 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 'PhoneNumber.spam'
db.add_column(u'contact_phonenumber', 'spam',
self.g... |
#!usr/bin/env python
#encoding: utf-8
import os
import sys
import config as cfg
from math import sqrt
from simple_oss import SimpleOss
import json
TASK_ID = os.environ.get('ALI_DIKU_TASK_ID')
INSTANCE_COUNT = int(os.environ.get('INSTANCE_COUNT'))
INSTANCE_ID = int(os.environ.get('ALI_DIKU_INSTANCE_ID'))
OSS_HOST = os.... |
from __future__ import division
import re
import textwrap
import wifi.subprocess_compat as subprocess
from wifi.utils import db2dbm
from wifi.exceptions import InterfaceError
class Cell(object):
"""
Presents a Python interface to the output of iwlist.
"""
def __init__(self):
self.bitrates =... |
import os
import csv
from collections import namedtuple
from cliff.command import Command
from ckan_api_client.high_level import CkanHighlevelClient
class PasswdDialect(csv.Dialect):
delimiter = ':'
doublequote = False # means: use escapechar to escape quotechar
escapechar = '\\'
lineterminator = o... |
from django.conf.urls import patterns, include, url
from django.apps import apps
from mysite.views import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
(r'^$', home_page),
# Examples:
# url(r'^$', 'mysite.views.h... |
<<<<<<< HEAD
<<<<<<< HEAD
"""Interface to the liblzma compression library.
This module provides a class for reading and writing compressed files,
classes for incremental (de)compression, and convenience functions for
one-shot (de)compression.
These classes and functions support both the XZ and legacy LZMA
container f... |
import unittest
import os.path
import types
from pygration.migration import VersionNumber, Loader
import pygration
@pygration.step_class
class TestStep(object):
ADD_FILE = 'add.sql'
class StepTest(unittest.TestCase):
def test_class_decorator(self):
self.assertEqual("test.migration_test", TestStep.ve... |
# coding=utf-8
# Copyright 2021 The init2winit 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 la... |
from hera import models
from hera import settings
from django.core.exceptions import PermissionDenied
import requests
import json
import socket
import hmac
CALL_TIMEOUT = 600 # seconds # <-- TODO: warn in docs
class Session:
def __init__(self, account, api_key):
self.account = models.Account.get_account... |
"""Modoboa stats forms."""
import rrdtool
from pkg_resources import parse_version
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django import forms
from modoboa.lib import form_utils
from modoboa.parameters import forms as param_forms
class ParametersForm(param_forms.Adm... |
#coding = utf-8
from mpl_toolkits.mplot3d import Axes3D
from autoencoder import AutoEncoder, DataIterator
import codecs
from random import shuffle
from matplotlib import pyplot as plt
import numpy as np
class IrisDataSet(object):
def get_label_id(self, label):
if label in self.label_id_dict:
r... |
####################################################################################################
#
# PyDvi - A Python Library to Process DVI Stream.
# Copyright (C) 2011 Salvaire Fabrice
#
####################################################################################################
#########################... |
# Copyright 2011 Nicholas Bray
#
# 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... |
# Copyright 2006 James Tauber and contributors
#
# 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 agre... |
from models import db
import time
from User import User
tags = db.Table('PostTag',
db.Column('Tag', db.Integer, db.ForeignKey('Tag.Id')),
db.Column('Post', db.Integer, db.ForeignKey('Post.Id'))
)
class Post(db.Model):
__tablename__ = 'Post'
Id = db.Column(db.Integer, primary_... |
#
# 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... |
# -*- coding: utf-8 -*-
#
# Lego Mindstorms EV3 documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 7 20:37:24 2014.
#
# 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... |
from django.test import TestCase
from carreteras.models import *
class ModelsTestCase(TestCase):
# Load test data
fixtures = ['test']
class EstadoTestCase(ModelsTestCase):
def test_should_have_test_data(self):
self.assertEqual(len(Estado.objects.all()), 32)
def test_should_return_name_when_converted_to_string... |
"""This module contains the general information for BiosVfLegacyUSBSupport ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfLegacyUSBSupportConsts:
VP_LEGACY_USBSUPPORT_AUTO = "Auto"
VP_LEGACY_USBSUPPORT_DISA... |
{% if cookiecutter.use_celery == 'y' %}
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.l... |
#!/usr/bin/env python
# coding:utf-8
# vi:tabstop=4:shiftwidth=4:expandtab:sts=4
import theano
import lasagne
import numpy as np
import cv2
import main
#from .main import batch_iterator_train,batch_iterator_test
from .main import register_training_callbacks, register_model_handler
from ..utils.curry import curry
floa... |
'''
Created on 1.12.2016
@author: Darren
''''''
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.
Example:
Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99])
A direct way... |
from liblightbase import lbutils
from liblightbase.lbdoc.metadata import DocumentMetadata
def generate_metaclass(struct, base=None):
"""
Generate document metaclass. The document metaclass
is an abstraction of document model defined by base
structures.
@param struct: Field or Group object.
@... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_mainwindow.ui'
#
# Created: Tue Jan 13 13:18:41 2015
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except ... |
#
# NEPI, a framework to manage network experiments
# Copyright (C) 2014 INRIA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... |
#!/usr/bin/env python
import json
import numpy
import scipy.sparse as sp
from optparse import OptionParser
__author__ = "Gregory Ditzler"
__copyright__ = "Copyright 2014, EESI Laboratory (Drexel University)"
__credits__ = ["Gregory Ditzler"]
__license__ = "GPL"
__version__ = "0.1.0"
__maintainer__ = "Gregory Ditzler... |
import threading
from i3pystatus import SettingsBase, Module, formatp
from i3pystatus.core.util import internet, require
class Backend(SettingsBase):
settings = ()
updates = 0
class Updates(Module):
"""
Generic update checker.
To use select appropriate backend(s) for your system.
For list o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.