code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# __author__ = 'maximus'
"""
For Dlink DES-3526, DES-3528, DES-3552, DGS-3426G
Get config: grab output from CLI
Transport: telnet
"""
import logging
from protocols.telnet import Telnet
import re
import pexpect
class Dlink(Telnet):
def __init__(self):
self... | Prototype-X/CCND | template/telnet-out-dlink.py | Python | gpl-3.0 | 1,733 |
class TestFilterSeen:
config = """
templates:
global:
accept_all: true
tasks:
test:
mock:
- {title: 'Seen title 1', url: 'http://localhost/seen1'}
test2:
mock:
- {title: 'Seen title 2', url: 'http://local... | Flexget/Flexget | flexget/tests/test_seen.py | Python | mit | 8,301 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import swisseph as swe
import unittest
class TestDifcsn(unittest.TestCase):
def test_01(self):
self.assertEqual(swe.difcsn(360 * 360000, 540 * 360000), 64800000);
if __name__ == '__main__':
unittest.main()
# vi: sw=4 ts=4 et
| astrorigin/pyswisseph | tests/test_swe_difcsn.py | Python | gpl-2.0 | 293 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - tests of cache action functions
@copyright: 2008 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
import os, StringIO
from MoinMoin import caching
from MoinMoin.action import AttachFile, cache
from MoinMoin._tests import bec... | Glottotopia/aagd | moin/local/moin/MoinMoin/action/_tests/test_cache.py | Python | mit | 8,144 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Block(models.Model):
key = models.SlugField(unique=True)
content = models.TextField(help_text="Add you *markdown* here.")
theme = models.ForeignKey('Theme', blank=True, null=True)... | AASHE/django-block-content | block_content/models.py | Python | mit | 689 |
import unicodecsv
import codecs
rows = [row for row in unicodecsv.reader(codecs.open('data/2014-04-04-Bibsysmatch.csv', 'r'), delimiter=';')]
q = [row[1] + row[2] for row in rows]
dups = unicodecsv.writer(codecs.open('data/dups.csv', 'w'))
uniq = unicodecsv.writer(codecs.open('data/uniq.csv', 'w'))
for row in rows:
... | danmichaelo/wikidata_bibsys_bot | find_dups.py | Python | unlicense | 433 |
import argparse
import getpass
import windows.crypto as crypto
from windows import winproxy
from windows.generated_def import *
import windows.crypto.generation as gencrypt
# http://stackoverflow.com/questions/1461272/basic-questions-on-microsoft-cryptoapi
def crypt(src, dst, certs, **kwargs):
"""Encrypt the co... | hakril/PythonForWindows | samples/crypto/encryption_demo.py | Python | bsd-3-clause | 6,936 |
from ...tests import context_wrap
from ..systemd.unitfiles import UnitFiles
KDUMP_DISABLED_RHEL7 = """
UNIT FILE STATE
kdump.service disabled
""".strip()
KDUMP_ENABLED_RHEL7 = """
UNIT FILE STATE
kdump.service ... | PaulWay/insights-core | insights/parsers/tests/test_unitfiles.py | Python | apache-2.0 | 1,752 |
# module pyparsing.py
#
# Copyright (c) 2003-2013 Paul T. McGuire
#
# 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, cop... | SystemsBioinformatics/cbmpy | cbmpy/pyparsing.py | Python | gpl-3.0 | 153,748 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2019 Sergey Astanin
# https://bitbucket.org/astanin/python-tabulate
# 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, includ... | anlambert/tulip | doc/python/tabulate.py | Python | lgpl-3.0 | 60,926 |
import argparse
import os
import shutil
from urllib import parse as urlparse
from feedgen.feed import FeedGenerator
from .remix import RemixFeed, Remix, Clip, Query
from .fastparser import remix_from_string
from .mix import mix_session
TEMP_DIR = 'temp'
def with_mp3_ext(name):
if not name.endswith('.mp3'):
... | thomasballinger/remixcast | remixcast/feedmix.py | Python | mit | 3,519 |
"""
This extension adds a language field to every page. When calling setup_request,
the page's language is activated.
Pages in secondary languages can be said to be a translation of a page in the
primary language (the first language in settings.LANGUAGES), thereby enabling
deeplinks between translated pages.
This exte... | hgrimelid/feincms | feincms/module/page/extensions/translations.py | Python | bsd-3-clause | 8,025 |
import socket
import base64
def read_lines():
global client_socket
lines_buffer = ""
data = True
while data:
try:
data = client_socket.recv(4096)
lines_buffer += data
except socket.timeout:
break
return lines_buffer
print("thermeq3 delete devic... | autopower/thermeq3 | support/del_dev.py | Python | gpl-3.0 | 972 |
import braintree
from braintree.errors import Errors
from braintree.credit_card_verification import CreditCardVerification
class ErrorResult(object):
"""
An instance of this class is returned from most operations when there is a validation error. Call :func:`errors` to get the collection of errors::
... | DiptoDas8/Biponi | lib/python2.7/site-packages/braintree/error_result.py | Python | mit | 2,482 |
# Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Viewfinder base operation.
ViewfinderOperation is the base class for all other Viewfinder operations. It contains code
that is common across at least two derived operations.
"""
__authors__ = ['andy@emailscrubbed.com (Andy Kimball)']
from copy import deepcopy... | liduanw/viewfinder | backend/op/viewfinder_op.py | Python | apache-2.0 | 17,030 |
"""
Py.test configuration to fix functional.scanl1 to work on Python 3,
to fix hipsterplot.plot to print without whitespaces and to define
the docstring display hook function for pytest-doctest-custom.
"""
from IPython.lib.pretty import pretty
def repr4test(val):
if type(val) is list and all(type(x) is str and len... | danilobellini/pyscanprev | conftest.py | Python | mit | 929 |
"""
Cement configparser extension module.
"""
import os
import re
from ..core import config
from ..utils.misc import minimal_logger
from configparser import RawConfigParser
LOG = minimal_logger(__name__)
class ConfigParserConfigHandler(config.ConfigHandler, RawConfigParser):
"""
This class is an implementa... | datafolklabs/cement | cement/ext/ext_configparser.py | Python | bsd-3-clause | 4,974 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based slightly on the lambdas section of AboutBlocks in the Ruby Koans
#
from runner.koan import *
class AboutLambdas(Koan):
def test_lambdas_can_be_assigned_to_variables_and_called_explicitly(self):
add_one = lambda n: n + 1
self.assertEqual(11, ... | MichaelSEA/python_koans | python3/koans/about_lambdas.py | Python | mit | 860 |
#
# Copyright 2016 University of Southern California
#
# 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... | informatics-isi-edu/microscopy | pyramid/scanlib/setup.py | Python | apache-2.0 | 1,099 |
# -*- coding: utf-8 -*-
# -*- Channel HDFullS -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
from builtins import chr
from builtins import range
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
from lib import alfaresolver_py... | alfa-addon/addon | plugin.video.alfa/channels/hdfulls.py | Python | gpl-3.0 | 12,860 |
from resources.objects.waypoint import WaypointObject
from engine.resources.common import CRC
import sys
def setup():
return
def run(core, actor, target, commandString):
ghost = actor.getSlottedObject('ghost')
friend = commandString.split(' ')[0]
if ghost.getFriendList().contains(friend):
... | agry/NGECore2 | scripts/commands/findfriend.py | Python | lgpl-3.0 | 1,569 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# 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
#
# ... | citrix-openstack/build-tempest | tools/skip_tracker.py | Python | apache-2.0 | 4,310 |
from django.contrib import admin
from django.contrib.auth.models import User
from timeslot.models import Program, Day, Config
from image_cropping import ImageCroppingMixin
class ProgramAdmin(ImageCroppingMixin, admin.ModelAdmin):
list_display = ('name', 'user', 'moderator', 'start', 'end',)
search_fields ... | Xicnet/radioflow-scheduler | project/timeslot/admin.py | Python | agpl-3.0 | 607 |
# trinket.settings.development
# The Django settings for Trinket in development
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Wed Apr 01 23:19:25 2015 -0400
#
# Copyright (C) 2015 District Data Labs
# For license information, see LICENSE.txt
#
# ID: development.py [] bbengfort@districtdat... | DistrictDataLabs/cultivar | trinket/settings/development.py | Python | apache-2.0 | 1,071 |
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
from HSM_HSModelClass import *
from HSM_PlottingFunctions import *
from HSM_FunctsOfSimulateClass import *
class Simulate:
""" Creates a simulation (of which one can make time run, plot the results, make simulation of experiments """
def __in... | QTB-HHU/ModelHeatShock | HSM_SimulateClass.py | Python | gpl-3.0 | 6,174 |
#!/usr/bin/env python
# Copyright 2017 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 errno
import logging
import os
import shutil
from devil.utils import cmd_helper
from devil.utils import parallelizer
def _Mak... | Passw/gn_GFW | build/android/pylib/utils/maven_downloader.py | Python | gpl-3.0 | 4,715 |
# Django settings for pyUrl project.
import sys
import os
# import dj_database_url
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('deshrajdry', 'deshrajdry@gmail.com'),
)
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE'... | DESHRAJ/pyUrl | pyUrl/settings.py | Python | gpl-2.0 | 6,237 |
from oauth2client.client import flow_from_clientsecrets, credentials_from_clientsecrets_and_code
from apiclient.discovery import build
import json, httplib2, sys
from oauth2client.file import Storage
import setting, os
target_calendar_name = "debug"
credentials = None
storage = Storage(setting.STORAGE_FILE)
if os.pa... | mamewotoko/stacklr | oauth2/oauth2client/calendar_test.py | Python | apache-2.0 | 1,868 |
"""Test to assert URLs"""
from django.urls import reverse
def test_urls():
"""Assert URLs which match to views"""
assert reverse("channel-list") == "/api/v0/channels/"
assert (
reverse("channel-detail", kwargs={"channel_name": "a_channel"})
== "/api/v0/channels/a_channel/"
)
assert... | mitodl/open-discussions | channels/urls_test.py | Python | bsd-3-clause | 795 |
import unittest
from src_datasets import *
class TestFocalMechamismRotations(unittest.TestCase):
def test_rotate_focal_mechanism(self):
"""
Test whether a focal mechanism is correctly rotated.
:return:
"""
src_fm = k91_fs_PTBaxes
rot_axes = map(sols2rotaxis, k9... | mauroalberti/gsf | tests/test_rotations.py | Python | gpl-3.0 | 1,178 |
import threading
import time
import random
class Task(threading.Thread):
lock = threading.Lock()
Counter = 0
def __init__(self, duration, loop):
threading.Thread.__init__(self)
self.duration = duration
self.loop = loop
Task.Counter = Task.Counter + 1
self.... | rajadg/Python | PySamples/py_Threads/Threading/__init__.py | Python | gpl-3.0 | 2,011 |
#!/usr/bin/env python
from __future__ import division, unicode_literals
import glob
import os
import shutil
import sys
import zipfile
from itertools import product
import numpy as np
import scipy.ndimage
import tifffile
from skimage.draw import ellipse
from fissa import extraction, readimagejrois
def maybe_make_d... | rochefort-lab/fissa | fissa/tests/generate_downsampled_resources.py | Python | gpl-3.0 | 16,558 |
import os
import sys
from struct import pack
from base64 import b64encode, b64decode
try:
from Crypto.Hash import HMAC as hmac, SHA as sha1
from Crypto.Random.random import getrandbits, randint, choice
except ImportError:
import hmac
from random import randint, choice
try:
from hashlib import sha1
exc... | nikcub/Sketch | sketch/util/security.py | Python | bsd-2-clause | 2,791 |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
"""
Object abstraction
==================
Basic usage
-----------
The object abstraction module al... | gonicus/gosa | backend/src/gosa/backend/objects/__init__.py | Python | lgpl-2.1 | 37,413 |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... | sussexstudent/falmer | manage.py | Python | mit | 1,026 |
# -*- coding: utf-8 -*-
import os
import sys
from os import environ
# Django settings for pull project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Full filesystem path to the project.
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))... | jannson/Similar | pull/settings.py | Python | mit | 7,261 |
'''
Import Articles from the crowdynews database
'''
import sys
import os
sys.path.insert(0,'../')
from elasticsearch import Elasticsearch
from models.article import Article, getArticleMod
from elasticsearch_dsl.connections import connections
from urllib import unquote
import random
from controllers.guardian_scrape... | ControCurator/controcurator | cronjobs/importArticles.py | Python | mit | 3,404 |
"""
:created: 2017-09
:author: Alex BROSSARD <abrossard@artfx.fr>
"""
from PySide2 import QtWidgets, QtCore
from pymel import core as pmc
from auri.auri_lib import AuriScriptView, AuriScriptController, AuriScriptModel, grpbox
from auri.scripts.Maya_Scripts import rig_lib
from auri.scripts.Maya_Scripts.rig_lib import ... | Sookhaal/auri_maya_rigging_scripts | general/center_of_gravity.py | Python | mit | 5,456 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Any, List, Optional, Sequence
import pytest
from pants.backend.python.lint.bandit.rules import BanditFieldSet, BanditRequest
from pants.backend.python.lint.bandit.rule... | jsirois/pants | src/python/pants/backend/python/lint/bandit/rules_integration_test.py | Python | apache-2.0 | 8,167 |
import re
import pytest
import numpy as np
import warnings
from scipy.sparse import csr_matrix
from sklearn import datasets
from sklearn import svm
from sklearn.utils.extmath import softmax
from sklearn.datasets import make_multilabel_classification
from sklearn.random_projection import _sparse_random_matrix
from skl... | manhhomienbienthuy/scikit-learn | sklearn/metrics/tests/test_ranking.py | Python | bsd-3-clause | 71,428 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, re
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.utils import today, cint, global_dat... | gangadharkadam/shfr | frappe/website/doctype/blog_post/blog_post.py | Python | mit | 3,543 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Osmo Salomaa
#
# 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 option) any later version.
#
# This pr... | M4rtinK/modrana | core/voice.py | Python | gpl-3.0 | 12,511 |
#!/usr/bin/env python2
#
# Copyright (c) 2016 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
# A S ==> R B, A goes to sleep state, A runtime is timestamp_switch - previous_timestamp.
# B state goes to running
# A R ==> R B, A goes to queue state, A runtime is timestamp_switch - previous_timestamp.
# B s... | tidyjiang8/zephyr-doc | samples/legacy/task_profiler/profiler/scripts/contextswitch_run.py | Python | apache-2.0 | 27,573 |
#
# This module defines a ctypes foreign function interface to a Glk
# library that has been built as a shared library. For more information
# on the Glk API, see http://www.eblong.com/zarf/glk/.
#
# Note that the way this module interfaces with a Glk library is
# slightly different from the standard; the standard int... | sussman/zvm | zvm/glk.py | Python | bsd-3-clause | 13,477 |
import logging
import monque.instance
from monque.config import Configuration
class Task(object):
"""
A Task object can be executed remotely via the queue, or can be executed directly
as a callable or just invoking the run() method.
A Task object is actually more of an 'actor', in that the remote w... | jslade/python-monque | monque/task.py | Python | mit | 3,734 |
from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'cogLevel': 0,
'farPlaneDistance': 1500,
'modelFilename': 'phase_10/models/cashbotHQ/ZONE08a',
'wantDoors': 1},
1001: {'type... | silly-wacky-3-town-toon/SOURCE-COD | toontown/coghq/CashbotMintBoilerRoom_Battle01.py | Python | apache-2.0 | 13,409 |
import json
import io
with io.open("quran.json", 'r', encoding='utf8') as quran:
quranObj = json.load(quran)
uniqueAyahList = []
uniqueAyahObjects = []
for surahNum, surah in enumerate(quranObj):
for ayahNum, ayah in enumerate(surah["arabic"]):
if ayah not in uniqueAyahList:
uniqueAyahList.append(ayah)
uni... | mmmoussa/Quranic-Recitation-Recognition | src/repeats.py | Python | mit | 1,140 |
import unittest
from ClusterShell.RangeSet import RangeSet
from collatex import Collation
from collatex.extended_suffix_array import Block
from collatex.core_functions import collate
from collatex.suffix_based_scorer import Scorer
from collatex.tokenindex import TokenIndex
__author__ = 'ronalddekker'
class Test(unit... | ljo/collatex | collatex-pythonport/tests/test_suffix_based_scorer.py | Python | gpl-3.0 | 3,791 |
import os
from setuptools import setup
from imp import load_source
burgaur = load_source("burgaur", "burgaur")
def read(fname):
filename = os.path.join(os.path.dirname(__file__), fname)
return open(filename).read().replace('#', '')
setup(
name="burgaur",
version=burgaur.__version__,
author=burga... | vga-/burgaur | setup.py | Python | mit | 683 |
# check that consts are not replaced in anything except standalone identifiers
from micropython import const
X = const(1)
Y = const(2)
Z = const(3)
# import that uses a constant
import micropython as X
print(globals()['X'])
# function name that matches a constant
def X():
print('function X', X)
globals()['X']()... | AriZuu/micropython | tests/micropython/const2.py | Python | mit | 623 |
# Similarity and difference of multi thread vs. multi process
# Written by Vamei
import os
import threading
import multiprocessing
import queue
import time
# worker function
def worker(sign, lock,qq):
# lock.acquire()
print(sign, os.getpid())
print(__name__)
time.sleep(1)
return 'Hello'
# lock... | liguangyulgy/mytest1 | HttpRequestDemo/mtmp.py | Python | bsd-2-clause | 1,255 |
#!/usr/bin/python
# Thunder: http://www.dreamcheeky.com/thunder-missile-launcher
# O.I.C Storm: http://www.dreamcheeky.com/storm-oic-missile-launcher
# This script requires:
# * python-usb
# * The ImageTk library. On Debian/Ubuntu 'sudo apt-get install
# python-imaging-tk'
# Also, unless you want to toggle with udev ... | bendst/usb-missile | research/frontend-launcher.py | Python | gpl-3.0 | 5,948 |
from collections import OrderedDict
import contextlib
import multiprocessing
import urllib
import requests
from . import parser
class Spider(object):
"""A simple spider to fetch URLS.
:arg callable callback: A method that accepts a single argument
(the response object) to be called whenever a reques... | willcodefortea/sportssystems_crawler | sport_systems/spider.py | Python | bsd-3-clause | 6,320 |
# This file is part of Jeedom.
#
# Jeedom 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.
#
# Jeedom is distributed in the hope that i... | jeedom/plugin-dotti | resources/dottid/dottid.py | Python | gpl-2.0 | 9,884 |
# -*- coding: utf-8 -*-
# Website Cached at: 2016-07-24 14:35:26
from scrapy.selector import Selector
from scrapy.spiders import Spider
from scrapy.http import Request
from meishi.misc.log import *
from meishi.items.MeishiFavItem import *
class MeishiFavSpider(Spider):
name = "meishi_fav"
allowed_domains =... | Lessica/9Taste-Scrapy | meishi/spiders/MeishiFavSpider.py | Python | mit | 1,625 |
"""Tests for the MatchMaker REST API extension"""
import uuid
from scout.server.app import create_app
from scout.server.extensions import matchmaker
class MockNodesResponse(object):
def __init__():
self.status_code = 200
def json(self):
return [
{"id": "node1", "description": "T... | Clinical-Genomics/scout | tests/server/extensions/test_matchmaker_extension.py | Python | bsd-3-clause | 1,485 |
# Pyflakes is not ported to Pythong 3 yet.
__all__ = [
'PyFlakesChecker',
]
import os
import subprocess
PACKAGE_PATH = os.path.dirname(__file__)
class PyFlakesChecker(object):
"""A fake for py3 that can run py2 in a sub-proc."""
def __init__(self, tree, filename='(none)'):
self.messages =... | chevah/pocket-lint | pocketlint/__init__.py | Python | mit | 867 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^login/$', views.auth),
url(r'^logout/$', views.signout),
] | aliakbars/tbdc | accounts/urls.py | Python | apache-2.0 | 144 |
"""
pyLDAvis Gensim
===============
Helper functions to visualize LDA models trained by Gensim
"""
import funcy as fp
import numpy as np
import pandas as pd
from past.builtins import xrange
from . import prepare as vis_prepare
def _normalize(array):
return pd.DataFrame(array).\
apply(lambda row: row / row.su... | codingafuture/pyLDAvis | pyLDAvis/gensim.py | Python | bsd-3-clause | 2,502 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-31 11:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0110_auto_20171003_1358'),
]
operations = [
migrations.RenameField(
... | softwaresaved/fat | lowfat/migrations/0111_auto_20171031_1122.py | Python | bsd-3-clause | 915 |
import sys
from captcha import get_version as get_captcha_version
from setuptools import find_packages, setup
from setuptools.command.test import test as test_command
class Tox(test_command):
user_options = [("tox-args=", "a", "Arguments to pass to tox")]
def initialize_options(self):
test_command.i... | mbi/django-simple-captcha | setup.py | Python | mit | 2,125 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 - Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
# Pireal 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 Li... | centaurialpha/pireal | src/pireal/gui/dialogs/new_relation_dialog.py | Python | gpl-3.0 | 6,538 |
"""Testing for kernels for Gaussian processes."""
# Author: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Licence: BSD 3 clause
from collections import Hashable
import numpy as np
from sklearn.base import clone
from sklearn.externals.funcsigs import signature
from sklearn.gaussian_process.kernels \
import ... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/sklearn/gaussian_process/tests/test_kernels.py | Python | mit | 11,615 |
#! /usr/bin/env python
'''
file clean_dvi.py
This file is part of LyX, the document processor.
Licence details can be found in the file COPYING
or at http://www.lyx.org/about/licence.php
author Angus Leeming
Full author contact details are available in the file CREDITS
or at http://www.lyx.org/about/credits.php
Usag... | hashinisenaratne/HSTML | lib/scripts/clean_dvi.py | Python | gpl-2.0 | 3,235 |
import random, os, time, pygame, time, sys
from pygame.locals import *
from gameUtils import loadSoundFile, loadImage
from gameSprites import Mario, Fireball, Shell, PowBlock
from config import *
import psyco
psyco.full()
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode( (30*32, 30*32) )
bac... | iPatso/PyGameProjs | PYex/Mario Shell Defense/test.py | Python | apache-2.0 | 928 |
"""Admin objects for the ``linklist`` app."""
from django.contrib import admin
from . import models
class LinkAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'position')
list_editable = ('position', )
admin.site.register(models.Link, LinkAdmin)
admin.site.register(models.LinkCategory)
| bitmazk/cmsplugin-linklist | linklist/admin.py | Python | mit | 313 |
""" Admin dashboard tests.
"""
from django.test import TestCase
class AdminTest(TestCase):
fixtures = ['users_data.json']
def test_admin_dashboard(self):
self.client.login(username='admin', password='secret')
response = self.client.get('/dashboard/admin/')
self.assertEqual(response.st... | wiliamsouza/gunclub | gunclub/tests/dashboard/admin_tests.py | Python | apache-2.0 | 806 |
"""
WSGI config for project_management project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | jrasky/pm_vagrant | project_management/project_management/wsgi.py | Python | bsd-3-clause | 979 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# MonsterTV EPG EHF.com
# Version 0.1 (11.11.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Jesús (www.mimediacenter... | manusev/plugin.video.kuchitv | resources/tools/epg_ehf.py | Python | gpl-2.0 | 31,563 |
from google.appengine.ext.webapp import template
from models.user import User
import webapp2
class IndexHandler(webapp2.RequestHandler):
def get(self):
template_params = {}
user = None
if self.request.cookies.get('session'):
user = User.checkToken(self.request.cookies.get('session'))
if not user:
self.... | racheliel/My-little-business | MyLittleBuisness/web/pages/homeUserIn.py | Python | mit | 778 |
from __future__ import absolute_import
from builtins import object
"""Celery beat scheduler backed by Redis.
The schedule will be saved as a pickled data in the key
'celery:beat:<filename>', where filename is the schedule filename
configured in celery
Prerequisite:
You are using Redis as your broker (BROKER_URL =... | Kegbot/kegbot-server | pykeg/util/celery.py | Python | gpl-2.0 | 2,201 |
# Copyright (C) 2017 Red Hat, Inc.
#
# fedmsg 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 option) any later version.
#
# fedmsg is distributed in the... | release-engineering/fedmsg_meta_umb | fedmsg_meta_umb/tests/test_distill.py | Python | lgpl-2.1 | 2,955 |
"""
WSGI config for prac1SITW project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import Djan... | Marcelpv96/SITWprac2017 | prac1SITW/wsgi.py | Python | gpl-3.0 | 486 |
# Copyright 2018 ARM Limited
#
# 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 writin... | lisatn/workload-automation | wa/instruments/serialmon.py | Python | apache-2.0 | 3,092 |
from fileparse import Text
| davelab6/telaro | src/dash2/words/telaro/__init__.py | Python | gpl-3.0 | 28 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Class', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Exercise',
fields=[
... | Mihai925/EduCoding | Exercise/migrations/0001_initial.py | Python | mit | 856 |
__all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts',
'upload_docs', 'build_clib', 'dist_info',
]
from distutils.command.bdist impor... | nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/setuptools/command/__init__.py | Python | mit | 551 |
"""
Functions to parse input from command line
"""
import json
_UNSET = object()
class Lexer(object):
def __init__(self, input_str):
self._input_str = input_str
self._pos = 0
self._skip_whitespaces()
def next_msg(self):
ret = dict()
while not self._isoverflow():
... | ylgrgyq/lean-parrot | py/input_parser.py | Python | epl-1.0 | 5,951 |
from logger import logger | szeged/csibe | bin/csibe/__init__.py | Python | bsd-3-clause | 25 |
# coding: utf-8
from test.lib.testing import eq_
from sqlalchemy import *
from sqlalchemy import types as sqltypes, exc
from sqlalchemy.sql import table, column
from test.lib import *
from test.lib.testing import eq_, assert_raises, assert_raises_message
from test.lib.engines import testing_engine
from sqlalchemy.dial... | ioram7/keystone-federado-pgid2013 | build/sqlalchemy/test/dialect/test_oracle.py | Python | apache-2.0 | 57,961 |
# -*- coding: utf-8 -*-
#
# This file is part of pysenslog.
# Copyright 2015 Leonardo Rossi <leonardo.rossi@studenti.unipr.it>.
#
# pysenslog 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 versi... | hachreak/pylocating | src/pylocating/benchmarks/__init__.py | Python | gpl-2.0 | 806 |
import unittest
import numpy as np
import theano
import theano.tensor as T
from tests.helpers import (SimpleTrainer, SimpleClf, SimpleTransformer,
simple_reg)
from theano_wrapper.layers import (BaseLayer, HiddenLayer, MultiLayerBase,
BaseEstimator, BaseTra... | sotlampr/theano-wrapper | tests/test_layers.py | Python | mit | 18,340 |
#===========================================================================
#
# Config file
#
#===========================================================================
__doc__ = """Config file parsing.
"""
from .. import util
from ..util import config as C
#=======================================================... | TD22057/T-Home | python/tHome/acurite/config.py | Python | bsd-2-clause | 1,348 |
"""
=======================================
Visualizing the stock market structure
=======================================
This example employs several unsupervised learning techniques to extract
the stock market structure from variations in historical quotes.
The quantity that we use is the daily variation in quote ... | zorroblue/scikit-learn | examples/applications/plot_stock_market.py | Python | bsd-3-clause | 11,182 |
# coding: utf-8
# 2012 © Bruno Chareyre <bruno.chareyre_A_hmg.inpg.fr>
"Test and demonstrate the use of timestepper and density scaling."
from yade import pack,qt,timing
O.periodic=True
O.cell.hSize=Matrix3(0.1, 0, 0,
0 ,0.1, 0,
0, 0, 0.1)
n=1000
sp=pack.SpherePack()
num=sp.makeCloud(Vector3().Zero,O.c... | anna-effeindzourou/trunk | examples/timeStepperUsage.py | Python | gpl-2.0 | 6,248 |
# Copyright 2012 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... | david-caro/jenkins-job-builder | jenkins_jobs/modules/triggers.py | Python | apache-2.0 | 68,792 |
{% 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... | asyncee/cookiecutter-django | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py | Python | bsd-3-clause | 1,701 |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... | MoroGasper/client | client/contrib/socks.py | Python | gpl-3.0 | 19,381 |
# Author: Denis A. Engemann <denis.engemann@gmail.com>
# License: BSD (3-clause)
import mkl
import sys
import os.path as op
import numpy as np
import mne
from mne.io import Raw
from mne.preprocessing import read_ica
from mne.viz import plot_drop_log
from meeg_preprocessing.utils import setup_provenance, set_eog_ecg_c... | kingjr/meg_expectation_p3 | scripts/run_extract_epochs.py | Python | gpl-3.0 | 6,371 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py | Python | apache-2.0 | 8,063 |
"""Wrapper around 'git diff'."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlgit_diff
#
# Public Functions:
# raw_diff_range_to_here
# raw_diff_range
# no_index
# create_add_file
#... | kjedruczyk/phabricator-tools | py/phl/phlgit_diff.py | Python | apache-2.0 | 5,562 |
#!/usr/bin/env python
# encoding: utf-8
import json
from . import *
class DummyResource(object):
'''
Dummy resource mixin to emulate the behavior of an async http library.
Used for testing without Sanic or Aiohttp
'''
@classmethod
def build_http_response(cls, payload, status=200):
re... | 475Cumulus/TBone | tbone/testing/resources.py | Python | mit | 1,049 |
# -*- coding: utf-8 -*-
"""test_docs.py:
Test if moose.doc is working.
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2017-, Dilawar Singh"
__version__ = "1.0.0"
__maintainer__ = "Dilawar Singh"
__email__ = "dilawars@ncbs.res.in"
__status__ = "Develop... | upibhalla/moose-core | tests/python/test_docs.py | Python | gpl-3.0 | 550 |
#!/usr/bin/env python
def test(memory, noun, verb):
pc = 0
m = memory[:]
if noun is not None:
m[1] = noun
if verb is not None:
m[2] = verb
while pc < len(m):
opcode = m[pc]
if opcode == 1:
augend = m[m[pc + 1]]
addend = m[m[pc + 2]]
... | opello/adventofcode | 2019/python/02-2.py | Python | mit | 1,292 |
from time import time, sleep
from unittest import TestCase
import stubs
from mediator import Mediator, Event, SubscriberInterface, VENUSIAN_CATEGORY
from venusian import Scanner
class Listener(object):
def __init__(self):
self.events = []
def __call__(self, event):
self.events.append(event)... | Kilte/mediator | tests.py | Python | mit | 6,965 |
import binascii
import os.path
import sys
def tof(filepath):
with open(filepath, 'r') as f:
content = f.read()
content = content.replace("0x","")
content = content.split(',')
for i in range(len(content)):
if len(content[i]) == 1: content[i] = "0" + content[i]
content = "".join(content)
with open(filepath+... | TheHX/godot | tools/scripts/file-hex-array.py | Python | mit | 1,512 |
"""
A custom manager for working with trees of objects.
"""
import contextlib
from django.db import models, transaction, connections, router
from django.db.models import F, Max
from django.utils.translation import ugettext as _
from mptt.exceptions import CantDisableUpdates, InvalidMove
__all__ = ('TreeManager',)
... | denys-duchier/django-mptt-py3 | mptt/managers.py | Python | mit | 41,639 |
from flask import Blueprint, render_template, request, url_for, redirect
from app import db, login_manager, pubnub
from flask.ext.login import login_required, current_user
from app.auth.models import User
import uuid
mod_devices = Blueprint('devices', __name__)
@mod_devices.route('/devices', methods=['GET'])
@login_r... | brynamo/app | app/devices/views.py | Python | mit | 6,540 |
import pymake.data, pymake.parser, pymake.parserdata, pymake.functions
import unittest
import logging
def multitest(cls):
for name in cls.testdata.keys():
def m(self, name=name):
return self.runSingle(*self.testdata[name])
setattr(cls, 'test_%s' % name, m)
return cls
class TestBa... | mozilla/pymake | tests/parsertests.py | Python | mit | 10,871 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-01-03 06:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service', '0005_auto_20161008_1519'),
]
operations = [
migrations.AddField(
... | sfcl/ancon | service/migrations/0006_settings_lang.py | Python | gpl-2.0 | 475 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.