src stringlengths 721 1.04M |
|---|
"""Factories for populating models for tests."""
import factory
from factory.alchemy import SQLAlchemyModelFactory
from xmas import models
from xmas.core import db
from xmas.utils import slugify
class Event(SQLAlchemyModelFactory):
"""A factory instance of :class:`~xmas.models.Event`."""
FACTORY_FOR = mod... |
from django.db import models
# Create your models here.
#basics of myDistrict
class District(models.Model):
name = models.CharField(max_length=40)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
def __unicode__(self):
return "<District: %s id: %d>"%(self.name, self.id)
... |
# -*- encoding: utf8 -*-
import re
from setuptools import find_packages, setup
def _read_long_description():
try:
import pypandoc
return pypandoc.convert('README.md', 'rst', format='markdown')
except Exception:
return None
version = ''
with open('frigg_settings/__init__.py', 'r') as... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Event',
f... |
#!/usr/bin/env python2.5
#
# Copyright 2008 the Melange 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 applic... |
"""
Created on Aug 7, 2016
@author: tjoneslo
"""
import os
import logging
from .Map import GraphicMap
from .Galaxy import Galaxy
from .AllyGen import AllyGen
from PIL import Image, ImageDraw, ImageColor, ImageFont
class GraphicSubsectorMap(GraphicMap):
positions = {'A': (0, 0), 'B': (-8, 0), 'C': (-16, 0), 'D': ... |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... |
#!/usr/bin/env python
import unittest
import os
from os import path, getenv
from os.path import expanduser
import logging # https://docs.python.org/2/library/logging.html#logging-levels
import glob
import argparse
import sys
import csv
from time import gmtime, strftime
sys.path.append( os.getcwd() )
sys.path.insert( 1... |
#!/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()
requirements = [
"Django>=1.7,<1.10",
"Wagtail>=1.4",
]
test_requirements = [
"D... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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 L... |
#!/usr/bin/env python
# Copyright (c) 2013-2015 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
#
# Unles... |
from pypers.core.step import Step
from pypers.steps.mothur import Mothur
import os
import json
import re
import glob
class MothurSummarySeqs(Mothur):
"""
Summarizes the quality of sequences in an unaligned or aligned fasta-formatted sequence file.
"""
spec = {
'name' : 'MothurSummarySeqs',
... |
from multiprocessing import Pool
from multiprocessing.pool import ThreadPool
import numpy as np
import pytest
try:
from numcodecs.shuffle import Shuffle
except ImportError: # pragma: no cover
pytest.skip(
"numcodecs.shuffle not available", allow_module_level=True
)
from numcodecs.tests.common... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# Opserver
#
# Operational State Server for VNC
#
from gevent import monkey
monkey.patch_all()
try:
from collections import OrderedDict
except ImportError:
# python 2.6 or earlier, use backport
from ordereddict import OrderedDict
from ... |
'''
Created on Feb 24, 2015
@author: balandat
'''
import numpy as np
from scipy.integrate import quad
import matplotlib.pyplot as plt
from ContNoRegret.Domains import S
from ContNoRegret.Distributions import Uniform
from ContNoRegret.utils import create_random_Sigmas
from ContNoRegret.LossFunctions import GaussianLos... |
import re
def parse_version(version):
"""
simplistic parser for setuptools_scm versions
supports final versions and alpha ('a'), beta ('b') and rc versions. It just discards commits since last tag
and git revision hash.
Output is a version tuple containing integers. It ends with one or two eleme... |
""" Order 16: Use faker in python.
Generate lots of kinds data with Faker
* User information
"""
from faker import Faker, Factory
class FakerGenerator(object):
"""Generate different data by this class."""
fake = None
def __init__(self, language=None):
if language:
self.fake = Factor... |
'''
zstack image test class
@author: Youyk
'''
import apibinding.inventory as inventory
import zstackwoodpecker.header.header as zstack_header
import zstackwoodpecker.header.image as image_header
import zstackwoodpecker.operations.image_operations as img_ops
import zstackwoodpecker.operations.volume_operations as vol... |
# $Id$
#
# Copyright (C) 2001-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" Functionality for ... |
"""
test the deep-set functionality
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
from elixir import *
def setup():
metadata.bind = 'sqlite://'
global Table1, Table2, Table3
class Tab... |
# tests are fairly 'live' (but safe to run)
# setup authorized_keys for logged in user such
# that the user can log in as themselves before running tests
import unittest
import getpass
import ansible.playbook
import ansible.utils as utils
import ansible.callbacks as ans_callbacks
import os
import shutil
import ansibl... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abst... |
import ast
import logging
import threading
import time
import unittest
import six
from plop.collector import Collector, PlopFormatter
class CollectorTest(unittest.TestCase):
def filter_stacks(self, collector):
# Kind of hacky, but this is the simplest way to keep the tests
# working after the inte... |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the <a href="http://www.virustotal.com">VirusTotal</a>
API class.
"""
from __future__ import unicode_literals
try:
str = unicode
except NameError:
pass
import json
from PyQt5.QtCore imp... |
from django.core.cache import cache
from rest_framework import viewsets, views
from rest_framework.response import Response
from stationspinner.corporation.serializers import CorporationSheetSerializer, \
CorporationSheetListSerializer
from stationspinner.corporation.models import CorporationSheet, Asset
from stati... |
# Copyright (c) 2018 OpenStack Foundation
#
# 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 ... |
from common import Constant
from storage.model import m
from main.logger_helper import L
import abc
from common import utils
# update in db (without propagatting the change by default)
def update_custom_relay(pin_code, pin_value, notify=False, ignore_missing=False):
relay = m.ZoneCustomRelay.find_one({m.ZoneCust... |
# -*- coding: utf-8 -*-
# This file is part of Cockpit.
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Cockpit 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 2.1 of the License, or
# (at your... |
import re
import os
import json
import datetime
import logging
from uuid import uuid4
from tornado import gen
from whoosh.analysis import StemmingAnalyzer, StopFilter
from whoosh.fields import *
from whoosh.index import create_in, exists_in, open_dir
from whoosh.writing import IndexingError
from summer.utils import D... |
# -*- coding: utf-8 -*-
#
# FATSLiM documentation build configuration file, created by
# sphinx-quickstart on Mon May 9 17:28:42 2016.
#
# 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.
#
# A... |
square = 16 * 25
class Spiral:
@classmethod
def spiral(cls, radius, start=(0,0)):
clip1 = (2*radius - 1)//square
clip2 = max(0, radius - square//2)
offset1 = (clip1 % 2) * square//2
for p in cls.spiral_inner(pow(clip1+1, 2)):
yield tuple(
v + ... |
from collections import OrderedDict
import logging
from optparse import make_option
from pprint import pprint
from os import listdir
from os.path import isfile, join
from django.conf import settings
from django.core.management import BaseCommand, call_command
from django.db import connection
from django.db.transaction ... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with t... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
__version__ = '0.13.10'
__... |
import pytest
import seaflowpy as sfp
# pylint: disable=redefined-outer-name
@pytest.mark.s3
def test_S3_file_listing():
"""Test S3 multi-file filtering and ensure output can be read back OK"""
config = sfp.conf.get_aws_config()
cloud = sfp.clouds.AWS(config.items("aws"))
files = sorted(cloud.get_fil... |
#===============================================================================
# This file is part of PyManageMC.
#
# PyManageMC 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... |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import transaction
from pyramid.threadlocal import get_current_registry
from dace.interfaces import IProcessDefinition
import dace.processinstance.tests.example.process... |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from __future__ import with_statement
import os
try:
import eventlet
except ImportError:
raise RuntimeError("You need eventlet installed to use this worker.")
from eventlet import h... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import traceback
import os
import unittest
import werkzeug
import werkzeug.routing
import werkzeug.utils
import odoo
from odoo import api, models
from odoo import SUPERUSER_ID
from odoo.http import reque... |
"""Tests for searches about functions"""
from dxr.testing import SingleFileTestCase, MINIMAL_MAIN
class ReferenceTests(SingleFileTestCase):
"""Tests for finding out where functions are referenced or declared"""
source = r"""
#include <stdio.h>
const char* getHello() {
return "He... |
#
# Copyright 2015 Google 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 writing... |
#!/usr/bin/python
#coding=utf-8
from flask import Blueprint,render_template,make_response,redirect,request,g,jsonify
from flask import session as flaskSession
from sqlalchemy import distinct,desc,or_
from app.model.base import User,Site,Novel,Shelf,Comment,Message
from novelSpider.task import createDownloader
def obje... |
'''
tests/test_formgets.py
Tests for the various getstr/getint/getbool helper functions.
Part of streetsign.
'''
import sys
import os
import unittest
sys.path.append(os.path.dirname(__file__) + '/..')
from streetsign_server.views.utils import getstr, getint, getbool, \
... |
# coding: utf-8
# #Statistical Inference for Everyone: Technical Supplement
#
#
#
# This document is the technical supplement, for instructors, for [Statistical Inference for Everyone], the introductory statistical inference textbook from the perspective of "probability theory as logic".
#
# <img src="http://web... |
import logging
import os
from pkg_resources import resource_filename
try:
# Python 3
import configparser
except ImportError:
# Python 2
import ConfigParser as configparser
logger = logging.getLogger(__name__)
config_dir = "/etc/fablab_schedule/"
config_filename = "fablab_schedule.cfg"
example_config... |
# -*- coding: utf-8 -*-
"""
Basic HTTP access interface.
This module handles communication between the bot and the HTTP threads.
This module is responsible for
- Setting up a connection pool
- Providing a (blocking) interface for HTTP requests
- Translate site objects with query strings into URLs
- UR... |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Services module forms
"""
from django import forms
from django.db.models import Q
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.utils.html im... |
# -*- coding: utf-8 -*-
# Copyright 2013-2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
"""
Binders
=======
Binders are components that know how to find the external ID for an
Odoo ID, how to find the Odoo ID for an external ID and how to
create the binding between them.
"""
i... |
#
# This file is part of the CCP1 Graphical User Interface (ccp1gui)
#
# (C) 2002-2005 CCLRC Daresbury Laboratory
#
# 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 ... |
from PyQt4 import QtGui, Qt, QtCore
from question import Question
class RadioQuestion(Question):
def __init__(self, id, question, card, parent = None):
self.buttons = []
super(RadioQuestion, self).__init__(id, question, card, parent)
def updateValue(self, question, answer):
se... |
# Copyright (c) 2014 Red Hat, 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 require... |
import requests
import time
import re
import praw
from cms.util import BeautifulSoup, _FAKE_HEADERS
SUBMITTED_FMT = 'https://www.reddit.com/user/%s/submitted/'
SUBREDDIT_FMT = 'https://www.reddit.com/r/%s/'
USER_AGENT='sheenrocks\' user agent'
RATE_LIMIT = 1
class Reddit(object):
def __init__(self, username=No... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio 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... |
from fec_alerts.models import new_filing
from summary_data.models import Committee_Overlay, Candidate_Overlay, DistrictWeekly, District
from formdata.models import SkedE
from rest_framework import serializers
class NFSerializer(serializers.HyperlinkedModelSerializer):
form_name = serializers.Field(source='get_fo... |
import numpy
import time
import sys
import subprocess
import os
import random
import numpy as np
from is13.data import load
from is13.rnn.elman import model
from is13.metrics.accuracy import conlleval
from is13.utils.tools import shuffle, minibatch, contextwin
from gensim.models import Phrases
from sklearn.metrics impo... |
import os
import os.path
import fabric.contrib.files
from fabric.api import sudo
from utils import build_object_ring, render
def disk_setup(swift_user):
# Setup a loopdevice to act as disk for swift
sudo('mkdir -p /srv')
sudo('truncate -s 1GB /srv/swift-disk')
sudo('mkfs.xfs /srv/swift-disk')
f... |
#!/usr/bin/python
# macgen.py script to generate a MAC address for virtualized guests
#
from __future__ import print_function
from builtins import map
from builtins import range
import random
import sys
import re
import hashlib
from config import HOSTS,HOST_IDX, main_network
#
def randomMAC(host,counters):
if hos... |
# acc.py
# tests of accellerometers
# currently seems to work with the values as they are!
from pyb import Accel, LED, delay, millis
red = LED(1)
green = LED(2)
yellow = LED(3)
blue = LED(4)
def xtest(p=5,m=-5, d= 20, timeOut= 1000):
"""
this uses the pyboard leds to indicate movement in the x,y,z dire... |
#coding=utf-8
from gerrit_notify import GerritNotify
from gi.repository import GObject, Gtk
from os.path import expanduser
import subprocess
from ConfigParser import SafeConfigParser
class TrayiconPlugin (GObject.Object):
notify = None
def do_activate (self, notify):
self.notify = notify
self.... |
"""This Module contains testing for the Priority Q."""
import pytest
TEST_SET = [
[(17, 1), (99, 2), (15, 1), (99, 3), (1, 2), (9, 3)]
]
BAD_PRIO = [True, False, [1, 2], (), {"oops": "This is bad"}, "No more, please!"]
BAD_INIT = [[(1, 2), (1, 2, 3)], True, False, "whoops"]
@pytest.fixture
def empty_priority_q(... |
# coding: utf8
"""
TODO(?): что будет есть характеристика колебательная?
"""
# Other
from pylab import *
from numpy import *
from scipy.optimize import leastsq
import scipy.interpolate as interpolators
# App
import dsp_modules.signal_generator as generator
from app_math.simple_math_operators import XAxis
from dsp... |
from sqlite3 import IntegrityError, OperationalError
from .db_context_manager import DBContextManager
QUERIES = {
'insert_interest':
"""
INSERT INTO interests
(interest)
VALUES
(?)
""",
'select_interest_id':
"""
SELECT id FROM interests
WHERE interest = ?
""",
'sele... |
import threading
import weakref
import contextlib
import logging
import fasteners
import os
LOG = logging.getLogger(__name__)
class Semaphores(object):
def __init__(self):
self._semaphores = weakref.WeakValueDictionary()
self._lock = threading.Lock()
def get(self, name):
with self._loc... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Yokadi unit tests
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
@author: Sébastien Renard <Sebastien.Renard@digitalfox.org>
@license: GPL v3 or later
"""
import unittest
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, o... |
import os
import sys
import json
import glob
import pymongo
import datetime
import gzip
# def importMongo(path,collection, db=None):
# if db is None:
# client = pymongo.MongoClient("mongodb-ikebukuro")
# db = client.atlas
# col = db[collection]
# for filename in glob.glob(path):
#... |
# -*- coding: utf-8 -*-
"""RemSphinx speech to text logger
This module is designed to just handle logging. There's nothing more to it
Just printing and logging to files
Developed By: David Smerkous
"""
from logging import getLogger, INFO, Formatter, FileHandler, StreamHandler
from os.path import dirname, realpath, i... |
import json
import re
LUA_SOURCE = """
function main(splash)
assert(splash:go(splash.args.url))
assert(splash:runjs(splash.args.js_source))
assert(splash:wait_for_resume(splash.args.slybot_actions_source))
splash:set_result_content_type("text/html")
return splash.html()
end
"""
JS_SOURCE = """
fun... |
#! usr/bin/python3
# -*- coding: utf-8 -*-
#
# Flicket - copyright Paul Bourne: evereux@gmail.com
import bcrypt
from flask_wtf import FlaskForm
from flask_babel import lazy_gettext
from sqlalchemy import func, or_
from wtforms import BooleanField
from wtforms import PasswordField
from wtforms import StringField
from w... |
import array
import asyncio
import fcntl
import signal
import termios
def get_size(stdout):
# Thanks to fabric (fabfile.org), and
# http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/
"""
Get the size of this pseudo terminal.
:returns: A (rows, cols) tuple.
"""
#assert st... |
# Copyright 2013 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.
import functools
import logging
import socket
import sys
from py_trace_event import trace_event
from telemetry.core import exceptions
from telemetry import... |
import sublime, sublime_plugin
import os.path
import webbrowser
class FitnesseSelectCommand(sublime_plugin.EventListener):
def check_syntax(self, view):
if os.path.basename(view.file_name()) == "content.txt":
current_syntax = view.settings().get('syntax')
if current_syntax != "Packages/Fitnesse/Fitnesse.tmLa... |
# ===============================================================================
# Copyright 2016 Jake Ross
#
# 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... |
#pylint: disable=E1121,W0105
'''
Copyright 2014 eBay Software Foundation
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 applicabl... |
#!/usr/bin/env python
from setuptools import setup
setup(name='ontap-api-wrapper',
version='0.5.4.post0',
description='Python wrapper for NetApp Manageability SDK',
author='Andrew Leonard',
author_email='andy.leonard@sbri.org',
maintainer='Jiri Machalek',
maintainer_email='machalek... |
import enum
import functools
import operator
from collections import defaultdict
from contextlib import suppress
from datetime import timedelta
from typing import Any, Callable, Iterable, Sequence, Tuple, Union
import numpy as np
import pandas as pd
from . import duck_array_ops, nputils, utils
from .npcompat import D... |
from decimal import Decimal
import requests
from tabulate import tabulate
import json
def yahoo_finance_query(**params):
''' Return the text of the request to the Yahoo finance API
s - ids of entities we wnant to receive. Every stock, index or currency has their own ID.
If you want to get values of mo... |
# -*- coding: utf-8 -*-
#
# Copyright 2008 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 Lice... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... |
# Copyright 2019 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.
from __future__ import print_function
import json
import os
import sys
import shutil
import subprocess
import tempfile
CHROMIUM_PATH = os.path.join(os.path... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import itertools
import calendar
import sys
import traceback
import gc
import time
import geopy
import math
from peewee import (InsertQuery, Check, CompositeKey, ForeignKeyField,
SmallIntegerField, IntegerField, CharField, DoubleField,
... |
#!/usr/bin/env python
#
# Copyright 2016 the original author or 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 require... |
"""
File name: InstanciateSchedules.py
This file is part of: priyomdb
LICENSE
The contents of this file are subject to the Mozilla Public License
Version 1.1 (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.mozilla.org/MPL/
Software ... |
"""
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
distri... |
from scene import *
from ui import get_screen_size
import random
import time
A = Action
class snake(Scene):
def setup(self):
self.movement = 1
self.movementStep = 0.1
self.lastStep = 0
self.grid = []
self.snakePos = []
self.food = -1
self.snakeColour = '#000000'
self.emptyColour = '#ffffff'
self.food... |
from fractions import Fraction
from fractions import gcd
def nextPermLexic(perm):
# ###########################################################################
#The following algorithm generates the next permutation lexicographically
#after a given permutation. It changes the given permutation in-place.
#1- Find the l... |
#! /usr/bin/python
"""
MGText
Text-entry plugin for Pimoroni's menu system for the Raspberry Pi Display-O-Tron.
Code and info: https://github.com/mattgemmell/DOT-MGTextEntry
By: Matt Gemmell
http://mattgemmell.com/
http://twitter.com/mattgemmell
"""
from dot3k.menu import MenuOption
_UP = 0
_DOWN = 1
_LEFT = 2
_... |
import functools
from flask import jsonify as flask_jsonify
from flask import request
from flask import url_for
def jsonify(exclude=None):
"""
This decorator generates a JSON response from a Python dictionary or
a SQLAlchemy model.
"""
def decorator(f):
@functools.wraps(f)
def wra... |
#encoding: utf8
from pythran.tests import TestEnv
from unittest import skip, skipIf
import numpy
from pythran.typing import *
class TestAdvanced(TestEnv):
def test_generator_enumeration(self):
code = '''
def dummy_generator(l):
for i in l: yield i
def generator_en... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Crypter import Crypter, create_getInfo
class SexuriaCom(Crypter):
__name__ = "SexuriaCom"
__type__ = "crypter"
__version__ = "0.11"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2012 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# flake8: noqa
from wdom.tag import NewTagClass as NewTag
from wdom.themes import *
name = 'INK'
project_url = 'http://ink.sapo.pt/'
project_repository = 'https://github.com/sapo/Ink/'
license = 'MIT License'
license_url = 'https://github.com/sapo/Ink/blob/develop/LICENS... |
from flask import render_template, Flask, request, redirect, url_for, current_app
from app import app
from urllib2 import urlopen
from bs4 import BeautifulSoup
from flaskext import wtf
from flaskext.wtf import Form, TextField, TextAreaField, SubmitField, validators, ValidationError
from google.appengine.ext import db
... |
"""This script uses the Twitter Streaming API, via the tweepy library,
to pull in tweets and store them in a Redis server.
"""
import os
import redis
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
# Get your twitter credentials from the environment variables.
# ... |
# coding=utf-8
#
# Copyright © 2011 Intel 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, modify, me... |
from flask.ext import wtf
import auth
import flask
import model
import wtforms
import util
from main import app
###############################################################################
# Create
###############################################################################
class PayUpdateForm(wtf.Form):
nam... |
# -*- coding: utf-8; encoding: utf-8; -*-;
"""
mailto.py
http://labs.unoh.net/2007/06/python_2.html
Known issue:
- need some change for exceptions
"""
__author__ = "ymotongpoo <ymotongpoo@gmail.com>"
__date__ = "21 Nov. 2008"
__credits__ = "0x7d8 -- programming training"
__version__ = "$Revision: 0.10"
import... |
# -*- encoding: utf-8 -*-
#
# 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 ... |
"""
Bulk walk MIB
+++++++++++++
Send a series of SNMP GETBULK requests
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at 195.218.195.228:161
* with values non-repeaters = 0, max-repetitions = 25
* for two OIDs in tuple form
* stop on end-of-mib condition for both OIDs
This script performs similar to... |
import smtplib
import time
import sys
import os
print "Usage:python", sys.argv[0], "[recipient](1..n) reports_dir"
print "Example:python", sys.argv[0], " wilson@ex.com jake@ex.com /opt/reports"
# constants
fromaddr = "bpm2clouddecker@gmail.com"
password = '********'
def timestamp():
ISOTIMEFORMAT = "%Y-%m-%d-%X"... |
from core.himesis import Himesis, HimesisPreConditionPatternNAC
import cPickle as pickle
from uuid import UUID
class HTopClass2TableNAC0(HimesisPreConditionPatternNAC):
def __init__(self, LHS):
"""
Creates the himesis graph representing the AToM3 model HTopClass2TableNAC0.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.