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 |
|---|---|---|---|---|---|
# Prototype of Multi-secret sharing scheme by Roy & Adhikari
# Filip Kubicz 2016-2017
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from multisecret.MultiSecretRoyAdhikari import Dealer
import multisecret.MultiSecretCommon as common
# TODO: test if h... | Qbicz/multi-secret-sharing | python/tests/test_MultiSecretRoyAdhikari.py | Python | mit | 10,632 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the volume system implementation using pyvslvm."""
import unittest
from dfvfs.path import os_path_spec
from dfvfs.path import qcow_path_spec
from dfvfs.path import lvm_path_spec
from dfvfs.volume import lvm_volume_system
from tests import test_lib as shared_test... | dc3-plaso/dfvfs | tests/volume/lvm_volume_system.py | Python | apache-2.0 | 3,267 |
from nose.tools import eq_, raises
from SnmpLibrary import SnmpLibrary
a = [
('.1.2.3.256', '1'),
('.1.2.3.257', '1'),
('.1.2.3.258', '1'),
('.1.2.3.259', '1'),
('.1.2.3.260', '1'),
('.1.2.3.261', '1'),
((1, 2, 3, 262), '1'),
((1, 2, 3, 263), '1'),
((1, 2, 3, 264), '1'),
((1, 2,... | kontron/robotframework-snmplibrary | utest/test_snmplibrary.py | Python | apache-2.0 | 1,412 |
'''Pammy version file.'''
from gitversion import rewritable_git_version
__VERSION__ = rewritable_git_version(__file__)
| benbacardi/pammy | pammy/version.py | Python | gpl-3.0 | 119 |
#!/bin/sh
"""": # -*-python-*- # -*-python-*-
bup_python="$(dirname "$0")/cmd/bup-python" || exit $?
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys, os, subprocess, signal, getopt
argv = sys.argv
exe = os.path.realpath(argv[0])
exepath = os.path.split(exe)[0] or '.'
exeprefix = os.path.split(o... | mhoeher/bup | main.py | Python | lgpl-2.1 | 6,962 |
# This source code is copied from `concurrent.futures` to make the ProcessPoolExecutor use multiprocessing_on_dill.
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Implements ProcessPoolExecutor.
The follow diagram and text describe the data-flow through the s... | MJB47/Jokusoramame | joku/core/mp2.py | Python | mit | 20,312 |
import os
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import skipUnlessPassed
def setUpModule():
if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
skipModule("No ssh package in image")
class ScpTest(oeRuntimeTest):
@skipUnlessP... | marcosbontempo/inatelos | poky-daisy/meta/lib/oeqa/runtime/scp.py | Python | mit | 961 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
#
# @author Dominik Wille
# @author Stefan Pojtinger
# @tutor Alexander Schlaich
# @sheet 11
#
#Packete einlesen:
import numpy as np
import csv
import matplotlib.pyplot as plt
import random
# Aufgabe 11.1.1 Haben wir leider nbicht so richtig zum laufen gebracht... :(
P_... | dominikwille/comp | sheet11/sheet11.py | Python | bsd-2-clause | 4,331 |
# -*- coding: utf-8 -*-
import datetime
def time():
t = str(datetime.datetime.now())
t = t[:t.find('.')] # remove mircrosecond (i know i'm lazy)
return t
def log(msg, *args):
try:
for elm in args:
msg = msg.format(elm)
except:
pass
print "{} -> {}".format(time(), ms... | devoxel/lucan | src/helper.py | Python | mit | 323 |
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2009 Serge Noiraud
# Copyright (C) 2008 Benny Malengier
#
# 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
# th... | sam-m888/addons-source | HtmlView/htmlview.py | Python | gpl-2.0 | 18,280 |
from django import http
import mock
from olympia.amo.tests import TestCase
from olympia.addons import decorators as dec
from olympia.addons.models import Addon
class TestAddonView(TestCase):
def setUp(self):
super(TestAddonView, self).setUp()
self.addon = Addon.objects.create(slug='x', type=1)
... | Prashant-Surya/addons-server | src/olympia/addons/tests/test_decorators.py | Python | bsd-3-clause | 5,016 |
"""
Simple tester for the vgg19_trainable
"""
import tensorflow as tf
from tensoflow_vgg import vgg19_trainable as vgg19
from tensoflow_vgg import utils
img1 = utils.load_image("./test_data/tiger.jpeg")
img1_true_result = [1 if i == 292 else 0 for i in range(1000)] # 1-hot result for tiger
batch1 = img1.reshape((1... | xpharry/Udacity-DLFoudation | tutorials/transfer-learning/tensorflow_vgg/test_vgg19_trainable.py | Python | mit | 1,435 |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 2 21:49:38 2016
@author: yaoyuhan
This is from 'https://github.com/vr2262/azel2radec'
"""
import numpy as np
import numexpr
import math
def ltc2utc(year, month, day, hour, longitude_deg):
"""Convert Local Time to Gregorian time
"""
if longitude_deg>0:
... | yaoyuhan/starpy | tools/time.py | Python | mit | 3,359 |
# ToHTML (c) 2002, 2003, 2005, 2006, 2007
# David Turner <david@freetype.org>
from sources import *
from content import *
from formatter import *
import time
# The following defines the HTML header used by all generated pages.
#
html_header_1 = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
... | alexpaulzor/projectm | src/WinLibs/freetype-2.3.5/src/tools/docmaker/tohtml.py | Python | lgpl-2.1 | 15,764 |
"""Handles the HTTP frontend (ie. answers to requests from a
UI."""
import time
import json
import logging
from ppp_datamodel.exceptions import AttributeNotProvided
from ppp_datamodel.communication import Request
from .config import Config
from .exceptions import ClientError, BadGateway, InvalidConfig
DOC_URL = 'ht... | ProjetPP/PPP-libmodule-Python | ppp_libmodule/http.py | Python | agpl-3.0 | 5,843 |
"""This file implements message authentication (HMAC).
A MAC is a message authentication code, which is essentially a fancy hash of
some input text. The text is sent along with the MAC and the receiver can
verify the text by computing their own MAC and comparing results. The sender
and receiver share a secret key wh... | danieljohnlewis/pisces | pisces/hmac.py | Python | mit | 6,247 |
import pytest
import numpy as np
import pandas as pd
from pandas.util import testing as tm
from pandas import (Series, period_range, DatetimeIndex, PeriodIndex,
DataFrame, Period)
class TestPeriodIndex(object):
def setup_method(self, method):
pass
def test_slice_with_negative_s... | amolkahat/pandas | pandas/tests/indexes/period/test_partial_slicing.py | Python | bsd-3-clause | 5,592 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'boar.accounts.views.accounts', name='accounts'),
url(r'^signout/$', 'boar.accounts.views.signout', name='accounts_signout'),
url(r'^settings/$', 'boar.accounts.views.settings_form', name='accounts_settings'),
url(r'^mailing-... | boar/boar | boar/accounts/urls.py | Python | bsd-3-clause | 562 |
from gettext import gettext as _
import os.path
from gourmet import convert
from gourmet import shopping
from .optionparser import args
from . import gglobals
from .gtk_extras import dialog_extras as de
# Follow commandline db specification if given
dbargs = {}
if 'file' not in dbargs:
dbargs['file']=os.path.join... | thinkle/gourmet | gourmet/recipeManager.py | Python | gpl-2.0 | 3,124 |
"""
A module for adding system-wide tests for Edraak.
"""
| Edraak/edraak-platform | common/djangoapps/edraak_tests/__init__.py | Python | agpl-3.0 | 58 |
# -*- coding: utf-8 -*-
# vim: ts=4
###
#
# Listen is the legal property of mehdi abaakouk <theli48@gmail.com>
# Copyright (c) 2006 Mehdi Abaakouk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software... | hillwoodroc/deepin-music-player | src/player/fadebin.py | Python | gpl-3.0 | 75,163 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2013 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors:
#
# MDTraj is free software: y... | kyleabeauchamp/mdtraj | mdtraj/testing/docstrings.py | Python | lgpl-2.1 | 8,819 |
from numpy import *
from os.path import *
from sys import *
from random import *
from hashing_trick import *
from loadcsv import *
from heapq import *
from math import *
class Heap(object):
"""docstring for Heap."""
def __init__(self):
super(Heap, self).__init__()
self.heap = []
def push(s... | joaquinbf/FineFoodReviews | kmeans.py | Python | gpl-3.0 | 4,851 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
no_cache = True | XWARIOSWX/wnframework | website/templates/pages/message.py | Python | mit | 161 |
from django.apps import AppConfig
import session_csrf
class BaseAppConfig(AppConfig):
name = 'snippets.base'
def ready(self):
# The app is now ready. Include any monkey patches here.
# Monkey patch CSRF to switch to session based CSRF. Session
# based CSRF will prevent attacks from ... | akatsoulas/snippets-service | snippets/base/app.py | Python | mpl-2.0 | 597 |
# Copyright (c) 2014 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 applica... | mtreinish/subunit2sql | subunit2sql/tests/test_shell.py | Python | apache-2.0 | 5,069 |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | gem/sidd | sidd/ms/__init__.py | Python | agpl-3.0 | 1,019 |
# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# 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, either version 3 of the
# License, or (at your option) any la... | genenetwork/genenetwork2_diet | wqflask/utility/AJAX_table.py | Python | agpl-3.0 | 7,135 |
#!C:\OSGEO4~1\bin\python.exe
# ******************************************************************************
# $Id: gdalchksum.py 8e263710cb425c4a8b76b1f363b98be41ea0a983 2018-04-30 19:40:20 +1000 Ben Elliston $
#
# Project: GDAL
# Purpose: Application to checksum a GDAL image file.
# Author: Frank Warme... | kubaszostak/gdal-dragndrop | osgeo/apps/Python27/Scripts/gdalchksum.py | Python | mit | 3,101 |
# The MIT License (MIT)
#
# Copyright (c) 2013 Numenta, Inc.
#
# 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, mod... | rhyolight/pycept | pycept/version.py | Python | mit | 1,140 |
# -*- coding: utf-8 -*-
#
# Minesweeper - Python implementation with PyQt4 of minesweeper game
#
# Copyright (C) 2017
# Pablo Marcos - pablo.marcosm@estudiante.uam.es
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | pablomm/minesweeper | minesweeper/mainwindow.py | Python | gpl-3.0 | 6,730 |
__author__ = "Rick Sherman, Nitin Kumar"
__credits__ = "Jeremy Schulman"
import unittest2 as unittest
from nose.plugins.attrib import attr
from mock import MagicMock, patch, mock_open
import os
from lxml import etree
from ncclient.manager import Manager, make_device_handler
from ncclient.transport import SS... | cmek/py-junos-eznc | tests/unit/test_device.py | Python | apache-2.0 | 20,389 |
# Snafu: Snake Functions - Web Connector
import flask
import threading
import os
import configparser
app = flask.Flask("snafu")
gcb = None
@app.route("/invoke/<function>")
def invoke(function):
response = gcb(function)
if not response:
flask.abort(500)
return response
def initinternal(function, configpath):
... | serviceprototypinglab/snafu | snafulib/connectors/web.py | Python | apache-2.0 | 879 |
import json
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
from lizard_map.models import WorkspaceEdit
import lizard_map.admin
import lizard_map.coordinates
import lizard_map.layers
import lizard_map.m... | lizardsystem/lizard-map | lizard_map/tests/test_appview.py | Python | lgpl-3.0 | 4,553 |
#!/usr/bin/python
#
# Copyright 2011 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 b... | kbdick/RecycleTracker | recyclecollector/scrap/gdata-2.0.18/samples/apps/orgunit_quick_start_example.py | Python | gpl-3.0 | 15,135 |
# -*- coding: utf-8 -*-
from . import ir_autovacuum
from . import product_wishlist
from . import res_users
| Aravinthu/odoo | addons/website_sale_wishlist/models/__init__.py | Python | agpl-3.0 | 107 |
#!/Users/wuga/Documents/website/wuga/env/bin/python2.7
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| wuga214/Django-Wuga | env/bin/django-admin.py | Python | apache-2.0 | 161 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/mainwindow.ui'
#
# Created: Sat Jul 5 06:52:17 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except ... | AnthonyReid99/VisualGit | ui/mainwindow.py | Python | gpl-3.0 | 48,584 |
import logging
import os
import sys
from nose2.compat import unittest
from nose2 import events, loader, runner, session, util
log = logging.getLogger(__name__)
__unittest = True
class PluggableTestProgram(unittest.TestProgram):
"""TestProgram that enables plugins.
Accepts the same parameters as :class:`u... | usc-isi-i2/WEDC | spark_dependencies/python_lib/nose2/main.py | Python | apache-2.0 | 11,709 |
#!/usr/bin/python
from guild.actor import ActorException
from guild.stm import Store, ConcurrentUpdate, BusyRetry
import time
class InsufficientFunds(ActorException):
pass
class Account(object):
"""This is the 'traditional' approach of interacting with the STM module
It's here as a bare example, but le... | sparkslabs/guild | examples/blog/accounts-stm.py | Python | apache-2.0 | 5,946 |
import logging
import numpy as np
import networkx as nx
from pele.landscape import TSGraph, LocalConnect
from pele.landscape._distance_graph import _DistanceGraph
__all__ = ["DoubleEndedConnect"]
logger = logging.getLogger("pele.connect")
class DoubleEndedConnect(object):
"""
Find a connected network of ... | kjs73/pele | pele/landscape/connect_min.py | Python | gpl-3.0 | 22,781 |
"""
mbed SDK
Copyright (c) 2011-2013 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 wr... | jeremybrodt/mbed | tools/export/__init__.py | Python | apache-2.0 | 9,290 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-appengine-admin | tests/unit/gapic/appengine_admin_v1/test_services.py | Python | apache-2.0 | 72,973 |
import unittest
from time import strftime, time, gmtime
from pymongo import Connection
from waskr.database import Stats
config = {
'db_engine': 'mongodb',
'db_host': 'localhost',
'db_port': 27017,
}
class TestDatabase(unittest.TestCase):
def __init__(self, *args, **params):
... | AloneRoad/waskr | waskr/tests/test_database.py | Python | mit | 5,538 |
#
# Copyright 2015 Ram Sriharsha
#
# 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, ... | YanjieGao/magellan | python/__init__.py | Python | apache-2.0 | 626 |
"""Models for the Play app."""
from datetime import datetime
from io import BytesIO
import uuid
from PIL import Image, ImageFile
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from django.urls import reverse
import django.utils.timezone
class Categ... | studybuffalo/studybuffalo | study_buffalo/play/models.py | Python | gpl-3.0 | 6,201 |
# -*- 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 M2M table for field galleries on 'Page'
m2m_table_name = db.shorten_name(u'cms_page_galleries')
... | jeffreylu9/django-cms | cms/migrations/0041_auto.py | Python | bsd-3-clause | 16,849 |
#Problem 1
#http://projecteuler.net/problem=1
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
def p1(n) :
# simple version, bad performance O(n)
n -=1
result = 0
... | david-lorenzo/peuler | problem001.py | Python | gpl-2.0 | 1,103 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-7 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | arjclark/rose | lib/python/rose/suite_run.py | Python | gpl-3.0 | 27,421 |
# compute some coverage stats for an xmfa file
import collections
import sys
count = 0
covered = collections.defaultdict(int)
unique = collections.defaultdict(int)
for line in sys.stdin:
if count == 0:
count += 1
continue
fields = line.split()
bases = collections.defaultdict(int)
for i in xrange(0, l... | supernifty/mgsa | mgsa/xmfa_stats.py | Python | mit | 759 |
## Autoregressive Moving Average (ARMA): Artificial data
from __future__ import print_function
import numpy as np
import statsmodels.api as sm
from statsmodels.tsa.arima_process import arma_generate_sample
np.random.seed(12345)
# Generate some data from an ARMA process:
arparams = np.array([.75, -.25])
maparams = ... | detrout/debian-statsmodels | examples/python/tsa_arma_1.py | Python | bsd-3-clause | 938 |
import os, sys
import re
from itertools import chain
import unittest
import importlib
srcRe = re.compile("^([^/.]+)\.py$")
def iterFiles(dsc) :
base, dirnames, filenames = dsc
baseL = os.path.normpath(base).split(os.path.sep)
def add(baseL,match) :
moduleL = list(baseL)
if f != '__init__.p... | tjamet/dynker | tests/unit/test_modules.py | Python | gpl-2.0 | 759 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2008 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ... | kawamuray/ganeti | test/py/ganeti.ssh_unittest.py | Python | gpl-2.0 | 5,178 |
from time import time
from random import random
from PyTango import AttrQuality, AttrWriteType, DispLevel
from PyTango.server import Device, DeviceMeta, attribute, command
from PyTango.server import device_property
class PowerSupply(Device):
""" A power supply device
Device states description:
- De... | vxgmichel/python-tango-devicedoc | demo/powersupply.py | Python | gpl-3.0 | 2,109 |
import os
import subprocess
import sublime, sublime_plugin
VAR = 'PATH'
class LoadPathCommand(sublime_plugin.TextCommand):
'''Load PATH-Variable in a new view.'''
def run(self, edit):
current_window = self.view.window()
if path_opened(current_window, 'PATH (SublimePathEditor)'):
print('PATH is alr... | Masterkraft0r/SublimePathEditor | SublimePathEditor.py | Python | gpl-2.0 | 1,318 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Emanuel Cino
# Copyright 2014 Compassion Suisse
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | ndtran/l10n-switzerland | l10n_ch_account_statement_base_import/__init__.py | Python | agpl-3.0 | 1,002 |
# -*- coding: utf-8 -*-
# Copyright 2013 django-htmlmin 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 re
import six
import bs4
try:
from django.conf import settings
except:
settings = {}
from .util import force_tex... | cobrateam/django-htmlmin | htmlmin/minify.py | Python | bsd-2-clause | 7,270 |
# Copyright (c) 2012 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 os
import unittest
from telemetry import tab_test_case
from telemetry import util
from telemetry.inspector_timeline import InspectorTimeline
_SAM... | nacl-webkit/chrome_deps | tools/telemetry/telemetry/inspector_timeline_unittest.py | Python | bsd-3-clause | 4,095 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the object filter functions."""
import unittest
from plaso.lib import objectfilter
class DummyObject(object):
def __init__(self, key, value):
setattr(self, key, value)
class HashObject(object):
def __init__(self, hash_value=None):
self.value = has... | jorik041/plaso | tests/lib/objectfilter.py | Python | apache-2.0 | 17,640 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... | Exgibichi/statusquo | test/functional/test_framework/util.py | Python | mit | 19,296 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('textanalysis', '0001_initial'),
]
operations = [
migrations.AlterUniqueTogether(
name='articleword',
... | meshulam/chicago-justice | cjp/textanalysis/migrations/0002_remove_textanalysis_models.py | Python | gpl-3.0 | 721 |
# The maximum amount of n grams to be allowed to chain
MAX_N=8 | smg247/markov-babbler | markov_babbler/settings.py | Python | mit | 62 |
from django.db import models
class Element(models.Model):
ename = models.CharField(max_length=50)
isDeprecated = models.BooleanField()
isSelfClosing = models.BooleanField()
isSingular = models.BooleanField()
isMeta = models.BooleanField()
isHeadElement = models.BooleanField()
isFormElement ... | uxq/HTMLThor | htmlthorapp/models.py | Python | gpl-2.0 | 1,097 |
from cooperativegames.measures.cooperativegames_metrics import \
weighted_winning_coalitions, weighted_worsable_coalitions,\
shapley_index, banzhaf_index, shapley_value
| tgquintela/CooperativeGames | cooperativegames/measures/__init__.py | Python | mit | 179 |
#! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditi... | tkaitchuck/nupic | py/nupic/support/features_list.py | Python | gpl-3.0 | 2,736 |
from .base import Config
from django.utils.functional import SimpleLazyObject
__version__ = '1.0'
try:
from django.apps import AppConfig # noqa
except ImportError:
config = SimpleLazyObject(Config)
else:
default_app_config = 'constance.apps.ConstanceConfig'
| metalpriest/django-constance | constance/__init__.py | Python | bsd-3-clause | 274 |
#try:
# import pypandoc
#except Exception:
# from pypandoc.pandoc_download import download_pandoc
# download_pandoc()
#
#
#from OrthoEvol.Tools.logit import LogIt
#
#
#class PandocConverter(object):
# input_formats, output_formats = pypandoc.get_pandoc_formats()
# """Convert files using the pypandoc wrap... | datasnakes/Datasnakes-Scripts | OrthoEvol/Tools/pandoc/pandoc.py | Python | mit | 1,112 |
import IMP
import IMP.test
import IMP.pmi.samplers
import IMP.pmi.representation
import IMP.pmi.restraints.basic
import IMP.pmi.macros
import IMP.pmi.output
import glob
import time
import os.path
class Tests(IMP.test.TestCase):
def test_serial(self):
"""Test the _SerialReplicaExchange class"""
s =... | shanot/imp | modules/pmi/test/expensive_test_replica_exchange.py | Python | gpl-3.0 | 11,877 |
from django.utils.encoding import force_str
from pyquery import PyQuery as pq
from olympia import amo
from olympia.addons.models import Addon, AddonReviewerFlags
from olympia.amo.tests import TestCase, addon_factory, version_factory
from olympia.constants.reviewers import REVIEWER_DELAYED_REJECTION_PERIOD_DAYS_DEFAUL... | mozilla/addons-server | src/olympia/reviewers/tests/test_forms.py | Python | bsd-3-clause | 16,462 |
# 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 (t... | apache/allura | ForgeTracker/forgetracker/model/__init__.py | Python | apache-2.0 | 942 |
# 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 u... | mbaijal/incubator-mxnet | python/mxnet/symbol/symbol.py | Python | apache-2.0 | 107,261 |
from Bio import SeqIO, SeqRecord, Seq
from Bio.Alphabet import IUPAC
GB_FILE = '../../samples/NC_006581.gb'
OUT_FILE = 'nadh.fasta'
with open(GB_FILE) as gb_fh:
record = SeqIO.read(gb_fh, 'genbank')
seqs_for_fasta = []
for feature in record.features:
# Each Genbank record may have several features, the program... | Serulab/Py4Bio | code/ch19/genbank1.py | Python | mit | 1,131 |
#!/usr/bin/env python3
# RibbaPi - APA102 LED matrix controlled by Raspberry Pi in python
# Copyright (C) 2016 Christoph Stahl
#
# 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 ... | stahlfabrik/RibbaPi | animation/clock.py | Python | gpl-3.0 | 4,711 |
# -*- coding: utf-8 -*-
"""
Fix annotations for 1001912
"""
# Import statements
import re
def main():
with open('sms_corpus.txt', 'r') as infile:
text = infile.read()
with open('sms_corpus.ann_', 'r') as infile:
anns = [ann.strip('\n') for ann in infile.readlines()]
the_list = set([
... | justhalf/weak-semi-crf-naacl2016 | data/sms_corpus/students/60/fix.py | Python | gpl-3.0 | 999 |
from rest_framework.renderers import BaseRenderer
class BinaryFileRenderer(BaseRenderer):
media_type = 'application/octet-stream'
format = 'zip'
charset = None
render_style = 'binary'
def render(self, data, media_type=None, renderer_context=None):
return data
| mlbench/mlbench | mlbench/master/api/renderers.py | Python | apache-2.0 | 291 |
#!/usr/bin/env python
# encoding: utf-8
"""Class to translate filesystem events to Moodle actions
"""
import os
from moodlefuse.moodle.assignments.assignment_handler import AssignmentHandler
from moodlefuse.moodle.resources.resource_handler import ResourceHandler
from moodlefuse.moodle.emulator.js_enabled_emulator i... | BroganD1993/MoodleFUSE | moodlefuse/filesystem/file_system_translator.py | Python | mit | 7,987 |
import ConfigParser
from os.path import expanduser, join
from collections import deque
from TabSpider import TabSpider
conf_file = join(expanduser("~"),"scrape.conf")
# Config
config = ConfigParser.ConfigParser()
config.read(conf_file)
salt = config.get('info', 'salt')
tab_page = config.get('info','tab_page')
domain ... | rclough/PickSlide | Bullshit.py | Python | unlicense | 1,173 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def udpHandler(packetNum, packet, glob):
names = map(lambda i: i.name.lower(), packet.layers)
if "udp" not in names:
return glob
return glob
| LyleMi/Trafficker | Trafficker/handlers/udp.py | Python | mit | 209 |
# vim: set fileencoding=utf-8 :
# GNU Solfege - free ear training software
# Copyright (C) 2009, 2011 Tom Cato Amundsen
#
# 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... | allancarlos123/Solfege | solfege/fpeditor.py | Python | gpl-3.0 | 34,015 |
import numpy as np
from bokeh.plotting import *
def grid_example():
N = 80
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
output_server("grid")
l = line(x,y, color="#0000FF", tools="pan,wheel_zoom,box_zoom,reset,previewsave",
title="line")
N = 9
x2 = np.linspace(-2, 2, N)
y2 ... | sahat/bokeh | examples/plotting/server/grid.py | Python | bsd-3-clause | 1,122 |
"""Simple image processing examples."""
import operator
import math
import traceback
from ..titanic import ndarray
from ..fpbench import fpcparser
from ..arithmetic import mpmf, ieee754, posit, analysis
from . import search
from .utils import *
from .benchmarks import mk_blur
from PIL import Image
import numpy as n... | billzorn/fpunreal | titanfp/quantifind/ex_img.py | Python | mit | 5,360 |
# -*- coding: utf-8 -*-
"""
Microsoft translator API
The Microsoft Translator services can be used in web or client
applications to perform language translation operations. The services
support users who are not familiar with the default language of a page or
application, or those desiring to commu... | openlabs/Microsoft-Translator-Python-API | setup.py | Python | bsd-3-clause | 2,212 |
from utilities import CandidateSelection,DataClean
from utilities import load_data,cross_validate
from sklearn.pipeline import Pipeline
from keyword_metrics import keyword_prf,keyword_prf_onegram
from nltk.stem import PorterStemmer
import networkx, nltk
import gensim
class Tfidf_KeywordSelection:
def __init__(sel... | saatvikshah1994/SmartMM | KeywordExtraction/unsupervised/keywordextraction_tfidf.py | Python | mit | 2,513 |
tutorial_tests = """
Let's try a simple generator:
>>> def f():
... yield 1
... yield 2
>>> for i in f():
... print i
1
2
>>> g = f()
>>> g.next()
1
>>> g.next()
2
"Falling off the end" stops the generator:
>>> g.next()
Traceback (most recent call la... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_generators.py | Python | gpl-2.0 | 39,364 |
#!/usr/bin/env python
# This file is part of Openplotter.
# Copyright (C) 2015 by sailoog <https://github.com/sailoog/openplotter>
#
# Openplotter 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 versio... | ajros/openplotter | wifi_server.py | Python | gpl-2.0 | 4,942 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/libsodium/package.py | Python | lgpl-2.1 | 2,467 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-18 03:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Patien... | kylewalters18/obulamu | server/app/migrations/0001_initial.py | Python | mit | 669 |
from builtins import object
from django import forms
from pykeg.core import models
class NotificationSettingsForm(forms.ModelForm):
class Meta(object):
model = models.NotificationSettings
exclude = ["user", "backend"]
| Kegbot/kegbot-server | pykeg/notification/forms.py | Python | gpl-2.0 | 240 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-14 17:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import posgradmin.models
class Migration(migrations.Migration):
dependencies = [
mi... | sostenibilidad-unam/posgrado | posgradmin/posgradmin/migrations/0022_anexoexpediente.py | Python | gpl-3.0 | 975 |
from base64 import decodestring
import json
from unittest import TestCase
from ipython_genutils.py3compat import unicode_type
from ..nbjson import reads, writes
from .. import nbjson
from .nbexamples import nb0
from . import formattest
class TestJSON(formattest.NBFormatTest, TestCase):
nb0_ref = None
ext =... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbformat/v4/tests/test_json.py | Python | bsd-2-clause | 3,764 |
"""
This module is the main entry point for accessing the recommendation services.
It provides a factory method that is called for creating the two recommender
instances. One of these instances is used for internal users who are allowed
to see HSR-internal documents. The other instance is applied when HSR-internal
docu... | feibl/search-rex | search_rex/recommendations/__init__.py | Python | mit | 6,687 |
"""
@author: JD Chodera
@author: JH Prinz
"""
from openpathsampling.engines import BaseSnapshot, SnapshotFactory
from . import features
@features.base.attach_features([
features.velocities,
features.coordinates,
features.box_vectors,
features.engine
])
class MDSnapshot(BaseSnapshot):
"""
A f... | jhprinz/openpathsampling | openpathsampling/engines/openmm/snapshot.py | Python | lgpl-2.1 | 2,992 |
import logging
import bpy
import numpy
from . import pam
from . import pam_vis
from . import model
from . import layer
MAX_FACTOR = 5
MAX_STEP_SIZE = 1
logger = logging.getLogger(__package__)
def getNeuralObjects():
'''returns all objects that are used in PAM connections and have a particle system
'''
n... | MartinPyka/Parametric-Anatomical-Modeling | pam/tracing.py | Python | gpl-2.0 | 14,196 |
import math, os
import numpy as np
from director import lcmUtils
import director.objectmodel as om
import director.applogic as app
from director import transformUtils
from director.debugVis import DebugData
from director import ioUtils
from director import filterUtils
from director.shallowCopy import shallowCopy
from ... | mitdrc/director | src/python/director/drakevisualizer.py | Python | bsd-3-clause | 26,055 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six im... | kinow-io/kinow-python-sdk | kinow_client/apis/attributes_api.py | Python | apache-2.0 | 18,013 |
from platforms.generic_linux import generic_linux_deploy
from platforms.generic_linux import generic_linux_build
###############################################################################
#
class rhel7_linux_deploy(generic_linux_deploy):
def init_ip_route(
self,
):
from steps.deploy.init... | uvsmtid/common-salt-states | states/bootstrap/bootstrap.dir/modules/platforms/rhel7.py | Python | apache-2.0 | 2,065 |
"""
# Name: check_answer_api/utilities/answer_transformer.py
# Description:
# Created by: Unknown
# Date Created: ---
# Last Modified: Dec 2, 2016
# Modified by: Martinus Alexander
"""
import re
import pattern_dictionary_all
import pattern_dictionary_standardize_mathquill
"""
Helper method to make... | deka108/meas_deka | assessment/utilities/answer_transformer.py | Python | apache-2.0 | 1,384 |
#!/usr/bin/python
import unittest
from query.query_parser import QueryParser
from datetime import datetime
class UtQueryParser(unittest.TestCase):
'''complex query test driver'''
@property
def parser(self):
parser = QueryParser()
return parser
def test_empty(self):
d... | vollov/net-audit | test/query/ut_query_parser.py | Python | mit | 4,213 |
#!/usr/bin/python
"""
Role
====
Defines a basic interface for plugin managers which filter the
available list of plugins before loading.
One use fo this would be to prevent untrusted plugins from entering the system
API
===
"""
from yapsy.IPlugin import IPlugin
from yapsy.PluginManagerDecorator import PluginMan... | cgroza/gEcrit | yapsy/FilteredPluginManager.py | Python | gpl-3.0 | 3,286 |
# Copyright 2015-2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | Sutto/cloud-custodian | tools/c7n_azure/tests_azure/test_policy_mode.py | Python | apache-2.0 | 25,451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.