code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""
This is a simple example on how to use Flask and Asynchronous RPC calls.
I kept this simple, but if you want to use this properly you will need
to expand the concept.
Things that are not included in this example.
- Reconnection strategy.
- Consider implementing utility functionality for checking and gett... | eandersson/python-rabbitmq-examples | Flask-examples/amqpstorm_threaded_rpc_client.py | Python | gpl-3.0 | 3,624 |
from helper import unittest, PillowTestCase
from PIL import Image, CurImagePlugin
TEST_FILE = "Tests/images/deerstalker.cur"
class TestFileCur(PillowTestCase):
def test_sanity(self):
im = Image.open(TEST_FILE)
self.assertEqual(im.size, (32, 32))
self.assertIsInstance(im, CurImagePlugin... | davidwilson-85/easymap | graphic_output/Pillow-4.2.1/Tests/test_file_cur.py | Python | gpl-3.0 | 1,063 |
__author__ = 'Cosmin Popescu'
| vim-scripts/Vim-SQL-Workbench | resources/py/lib/__init__.py | Python | gpl-3.0 | 30 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import subprocess
import os
import sys
import shutil
# svn:
#__version__ = subprocess.Popen(['svnversion','-n','.'],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[0].decode()
# git:
GIT_LOG_FORMAT_OPT... | DVS-P2P/bubblestorm | testbed/setup.py | Python | gpl-3.0 | 2,416 |
from flask import Blueprint, render_template, request, abort, make_response
from pystatus.models import User
bp = Blueprint('activitystreams', __name__, url_prefix='/main/activitystreams')
@bp.route('/user_timeline/<user_id>.atom', methods=['GET'])
def user_timeline(user_id):
print 'activity stream'
user = Us... | bijanebrahimi/pystatus | pystatus/views/activitystreams.py | Python | gpl-3.0 | 588 |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/onlinehelp/onlinehelp.py | Python | gpl-3.0 | 5,638 |
#!/usr/bin/python
from PyWeb import *
from template import *
#from PyWebDynamic import *
class TEST:
def __init__(self):
self.p = PyWeb("test.html")
self.p.addTemplate(myTemplate)
self.p.createPage()
if __name__ == "__main__":
ttestsst = TEST()
| simsor/PyWeb | tests/test.py | Python | gpl-3.0 | 260 |
#!/usr/bin/env python3
import bvc
from gurobipy import *
import numpy as np
__author__ = "Dan Mapleson, Luis Yanes, Katie Barr, Sophie Kirkwood and Tim Stitt"
__copyright__ = "Copyright 2016, Quantum MSA"
__credits__ = ["Dan Mapleson", "Luis Yanes", "Katie Barr",
"Sophie Kirkwood", "Tim Stitt"]
_... | maplesond/msa2qubo | gurobi.py | Python | gpl-3.0 | 1,975 |
from functools import partial
import sys
import numpy as np
import os.path
from pkg_resources import resource_filename
if (sys.version_info > (3, 0)):
# Python 3 code in this block
import configparser as ConfigParser
else:
import ConfigParser
import fitsio
from picca.utils import userprint
from . import da... | igmhub/pyLyA | py/picca/fitter2/parser.py | Python | gpl-3.0 | 8,093 |
"""
Contains definitions for the MicroPython micro:bit related APIs so they can be
used in the editor for autocomplete and call tips.
Copyright (c) 2015-2016 Nicholas H.Tollervey and others (see the AUTHORS file).
Based upon work done for Puppy IDE by Dan Pope, Nicholas Tollervey and Damien
George.
This program is f... | ajwillia/mu | mu/resources/api.py | Python | gpl-3.0 | 40,706 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWSumm.
#
# GWSumm 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) ... | gwpy/gwsumm | gwsumm/triggers.py | Python | gpl-3.0 | 14,721 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function
import yaml
from yaml import Loader, SafeLoader
_marked_classes = {t: type("Marked" + t.__name__.title(), (t,),
{'start': None, 'end': None})
for t in (dict, list, str)}
def _wrap(method_n... | liam2/liam2 | liam2/markedyaml.py | Python | gpl-3.0 | 1,201 |
# functions to support bundled libraries
from Configure import conf
import sys, Logs
from samba_utils import *
def PRIVATE_NAME(bld, name, private_extension, private_library):
'''possibly rename a library to include a bundled extension'''
# we now use the same private name for libraries as the public name.
... | LukeM12/samba | buildtools/wafsamba/samba_bundled.py | Python | gpl-3.0 | 8,139 |
def quick_sort(array):
pass
def test_quick_sort():
assert quick_sort([1, 3, 2]) == [1, 2, 3]
| cosven/pat_play | classics/test_quick_sort.py | Python | gpl-3.0 | 103 |
#!/usr/bin/python2
# -*- encoding: utf-8 -*-
#pylint: disable=W0105
import argparse
import logging
import configparser
import requests
from libpydhcpserver.dhcp import DHCPServer
class PBAADHCPServer(DHCPServer):
def __init__(
self, server_address, server_port, client_port, aaserver_addr,
... | lcy0321/pbaadhcpserver | pbaadhcpserver.py | Python | gpl-3.0 | 15,974 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-07-22 10:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('inforecords', '0010_related_names'),
]
operations = [
migrations.RemoveField(
... | HiSPARC/publicdb | publicdb/inforecords/migrations/0011_remove_pulseheightthresholds.py | Python | gpl-3.0 | 507 |
'''
SVG rasterization transform.
'''
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
import os, re
from urlparse import urldefrag
from lxml import etree
from PyQt5.Qt import (
Qt, QByteArray, QBuffer, QIODevice, QColor, QImage, QPa... | sharad/calibre | src/calibre/ebooks/oeb/transforms/rasterize.py | Python | gpl-3.0 | 9,021 |
#####################################
# Example how to control Agilent Function egenrator over GPIB
# Author, Peter Vago, NI Systems Engineer, 2016
#
# PyVISA 1.8 version is used.
# For migrating from older version (<1.5) read this: https://media.readthedocs.org/pdf/pyvisa/master/pyvisa.pdf
#
########################... | petervago/instrument-control | Python_client/test_tcp.py | Python | gpl-3.0 | 5,163 |
# -*- coding: utf-8 -*-
"""Strict unflexible table constructor: The hand-knitted table for GnuVet.
Provides html formatting in cells.
First set_headers if required, then append_row and set_alignment, finally
adjust rows2contents if appropriate.
Setting headers after filling table deletes all table entries.
Optionall... | gnuvet/gnuvet | gtable.py | Python | gpl-3.0 | 37,590 |
# Copyright 2012, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Qtmacs.
#
# Qtmacs 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... | olitheolix/qtmacs | qtmacs/miniapplets/base_query.py | Python | gpl-3.0 | 18,531 |
# Copyright (C) 2009 Chris Newton <redshodan@gmail.com>
#
# This file is part of remacs.
#
# remacs 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 la... | redshodan/remacs | python/remacs/protocolserver.py | Python | gpl-3.0 | 4,371 |
'''
Created on Mar 28, 2017
@author: J001684
'''
from math import hypot
class Vector:
'''
classdocs
'''
def __init__(self, x=0, y=0):
'''
Constructor
'''
self.x = x
self.y = y
def _repr_(self):
return 'Vector({x}, {y... | domchoi/fluentPython | dataModel/vector.py | Python | gpl-3.0 | 743 |
# Force loading views
from oioioi.disqualification.views import disqualification_fragment
app_name = 'disqualification'
urlpatterns = ()
| sio2project/oioioi | oioioi/disqualification/urls.py | Python | gpl-3.0 | 139 |
#!/usr/bin/python2
# Copyright (C) 2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... | ofayans/freeipa | ipaplatform/setup.py | Python | gpl-3.0 | 1,334 |
# This file is part of Tautulli.
#
# Tautulli 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.
#
# Tautulli is distributed in the ... | drzoidberg33/plexpy | plexpy/pmsconnect.py | Python | gpl-3.0 | 155,901 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = "postgresql://test@localhost/test" if 'DATABASE_URL' not in os.environ else os.environ['DATABASE_URL']
SQLALCHEMY_TRACK_MODIFICATIONS = False
ERROR_404_HELP = False
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_A... | robonyong/owl-rates | app/config.py | Python | gpl-3.0 | 468 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017-2018 Canonical Ltd
#
# 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 Foundation.
#
# This program is distributed in ... | mvo5/snapcraft | tests/unit/plugins/test_dotnet.py | Python | gpl-3.0 | 10,579 |
word = 'a loooooooog word'
num = 12
string = 'bang!'
total = string * (len(word) - num)
print(len(word))
print(total)
phone_number = '1386-666-0006'
hiding_number = phone_number.replace(phone_number[:9], '*')
print(hiding_number)
search = '168'
num_a = '1386-168-0006'
#print(search + ' is at ' + str(num_a.find(searc... | Zbsiz/ZQ-home | python/test.py | Python | gpl-3.0 | 1,308 |
# -*- 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 model 'Game'
db.create_table('game_game', (
('id', self.gf('django.db.models.fields.Aut... | luzi82/owatube | game/migrations/0001_initial.py | Python | gpl-3.0 | 11,684 |
# -*- coding: utf-8 -*-
"""
Test Country
:copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import json
import unittest
from decimal import Decimal
import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, USER, DB_NAM... | PritishC/nereid | trytond_nereid/tests/test_country.py | Python | gpl-3.0 | 6,084 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013 Código Sur Sociedad Civil.
# All rights reserved.
#
# This file is part of Cyclope.
#
# Cyclope 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 Foundat... | CodigoSur/cyclope | cyclope/apps/staticpages/admin.py | Python | gpl-3.0 | 4,331 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of HSPlasma.
#
# HSPlasma 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... | H-uru/libhsplasma | Python/scripts/prp-checkfiles.py | Python | gpl-3.0 | 5,456 |
'''
2 Wavelet packets
2.4 Best basis (1D)
@author Matthias Moulin & Vincent Peeters
@version 1.0
'''
import cost
import heapq
import node
import numpy as np
import pywt
###############################################################################
# ANALYSIS ALGORITHM FUNCTIONS
###############################... | matt77hias/FingerprintCompression | src/binarytree.py | Python | gpl-3.0 | 7,683 |
#!/usr/bin/env python
import sys
import argparse
import collections
import numpy as np
import tifffile as TIFF
import sane
import click
import toml
def quick_scan(settings = {}, test = False):
"""Make scan using first scanning device found by SANE driver.
"""
# init and find devices
sane.init()
... | pmagwene/unscanny | scanit.py | Python | gpl-3.0 | 1,722 |
import pygame
from PacManMap import *
class MakeGraph:
def __init__(self):
self.shortest_path_from_one_to_other = {}
self.nodes = self.find_nodes()
def get_shortest_path(self):
return self.shortest_path_from_one_to_other
def get_nodes(self):
return self.nodes
def find_nodes(self):
nodes = []
for row... | Yordan92/Pac-man-multiplayer | MakeGraph.py | Python | gpl-3.0 | 3,015 |
from Entity import Entity
class Attachment(Entity):
ENTITY_TYPE = "attachments"
"""Represent an Inbox Attachment element.
Documentation : http://developers.bookingsync.com/reference/endpoints/inbox_attachments/
"""
def __init__(self, id=None):
return super(Attachment, self).__init__("atta... | BNBLORD/bookingsynclord | bookingsynclord/entities/Attachment.py | Python | gpl-3.0 | 334 |
"""
LibNix
Copyright (C) 2017 Mark Biciunas
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 program is distributed in th... | mbiciunas/libnix | src/libnix/config/script/run_script.py | Python | gpl-3.0 | 1,491 |
__author__ = 'Sergey Tomin'
from ocelot import *
from ocelot.gui import *
import copy as cp
import numpy as np
"""
ro*tan(phi)+
"""
Q1 = Quadrupole(l=0.2, k1=5)
Q2 = Quadrupole(l=0.2, k1=-5)
Db = Drift(l = 2)
Dc = Drift(l = 3/2.)
# to get non dispersive section
angle = 45.*pi/180.
phi = Q1.l*np.sqrt(Q1.k1)
Lc = 2.*D... | ocelot-collab/ocelot | demos/ebeam/non_disp_offset.py | Python | gpl-3.0 | 2,476 |
# This file is part of Virtual Programming Lab.
#
# Virtual Programming Lab 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.
#
# Virtu... | buchuki/programming_lab | programming_lab/classlist/forms.py | Python | gpl-3.0 | 1,349 |
from django.forms import Form, RegexField
# Naive validation of a SIP URI
_sip_uri_regex = r'^((?P<user>[a-zA-Z0-9 _\-\+\.\%]+)@)?(?P<host>([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})$'
class SIPURIForm(Form):
uri = RegexField(label='', regex=_sip_uri_regex, error_messages={'invalid': 'Invalid... | saghul/sipwping-django | sipwping/forms.py | Python | gpl-3.0 | 333 |
from mrjob.job import MRJob
class MRCharCount(MRJob):
def mapper(self, _, line):
self.increment_counter('group', 'total_chars', len(line))
yield "chars", len(line)
def reducer(self, key, values):
yield key, sum(values)
if __name__ == '__main__':
MRCharCount.run()
| tayebzaidi/PPLL_Spr_16 | ejemplos_map_reduce/011-char_count.py | Python | gpl-3.0 | 317 |
"""
This Module is the graphic user interface wrapper for accessing the all small molecules database
Current Problems:
Compatibility issues and quick fix:
Issues with upgraded version of matplotlib:
for ubuntu:
sudo apt-get install tk-dev libpng-dev libffi-dev dvipng texlive-... | azariven/BioSig_SEAS | SEAS_Aux/Visualizer/Spec_Gui.py | Python | gpl-3.0 | 24,054 |
import numpy as np
import westpa
import cPickle as pickle
def dist(pt1, pt2):
return np.sum((pt1-pt2)**2)
def mueller(x, y):
aa = [-1, -1, -6.5, 0.7]
bb = [0, 0, 11, 0.6]
cc = [-10, -10, -6.5, 0.7]
AA = [-200, -100, -170, 15]
XX = [1, 0, -0.5, -1]
YY = [0, 0.5, 1.5, 1]
V1 = 0
for ... | nrego/westpa | lib/examples/stringmethodexamples/examples/Mueller/get_strings.py | Python | gpl-3.0 | 1,298 |
from cloudinit.config import cc_apt_configure
from cloudinit import util
from ..helpers import TestCase
import copy
import os
import re
import shutil
import tempfile
def load_tfile_or_url(*args, **kwargs):
return(util.decode_binary(util.read_file_or_url(*args, **kwargs).contents))
class TestAptProxyConfig(Tes... | larsks/cloud-init-patches | tests/unittests/test_handler/test_handler_apt_conf_v1.py | Python | gpl-3.0 | 4,917 |
import unittest
from word_treasure import *
class WordTreasureTestCase(unittest.TestCase):
"""Test for functions in word treasure.
The major aim is to check if there is any
unexpected crash.
Doesnot check the validity of the response"""
def test_definition_call(self):
word1 = "hello"
... | harsimrans/word-treasure | word_treasure/test_wordt.py | Python | gpl-3.0 | 1,648 |
import time
import datetime
import sqlite3
import urllib
import gzip
import urllib2
import StringIO
import sickbeard
from sickbeard import db
from sickbeard import logger
from sickbeard.common import *
class TVCache():
def __init__(self, providerName):
self.providerName = pr... | mattsch/Sickbeard | sickbeard/tvcache.py | Python | gpl-3.0 | 1,097 |
#! /usr/bin/env python
from pySecDec.loop_integral import loop_package
import pySecDec as psd
li = psd.loop_integral.LoopIntegralFromPropagators(
propagators = ['k1**2-msq','(k1+p1+p2)**2-msq','k2**2-msq','(k2+p1+p2)**2-msq','(k1+p1)**2-msq','(k1-k2)**2','(k2-p3)**2-msq','(k2+p1)**2','(k1-p3)**2'],
powerlist = [1,1,0,... | mppmu/secdec | examples/elliptic2L_physical/generate_elliptic2L_physical.py | Python | gpl-3.0 | 1,518 |
"""
Simple base event handlers.
"""
from base import *
class GraphEvH(EvHandler):
"""
Example graph event handler.
It can zoom with mouse and keyboard, create new nodes...
"""
def __init__(self,maingraph):
self.maingraph=maingraph
def scroll_up(self):
x,y=self.maingraph.RawPoi... | caedesvvv/pynoded | pynoded/evh/graph.py | Python | gpl-3.0 | 2,168 |
#coding=utf-8
#2017.10.3£¬Flash,ship class
import pygame
class Ship():
def __init__(self,ai_settings,screen):
"""³õʼ»¯·É´¬²¢ÉèÖÃÆä³õʼλÖÃ"""
self.screen=screen
self.ai_settings = ai_settings
#¼ÓÔØ·É´¬Í¼Ïñ²¢»ñÈ¡ÆäÍâ½Ó¾ØÐÎ
self.image=pygame.image.load("images/ship.bmp")
self.rect=self.imag... | FlashXT/XJTU_WorkLog | 2017.10/Engineering/PyGame/alien_invasion/ship.py | Python | gpl-3.0 | 1,131 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('userhome', '0002_auto_20161014_2208'),
]
operations = [
migrations.AddField(
model_name='notice',
na... | shubham0d/SmartClass | SmartClass/userhome/migrations/0003_auto_20161015_0037.py | Python | gpl-3.0 | 584 |
'''
Copyright 2021 Travel Modelling Group, Department of Civil Engineering, University of Toronto
This file is part of the TMG Toolbox.
The TMG Toolbox 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 Fou... | TravelModellingGroup/TMGToolbox | TMGToolbox/src/XTMF_internal/import_function_batch_file.py | Python | gpl-3.0 | 2,153 |
# RANDOM PASSWORD GENERATOR
# Author: Dan Barrese (danbarrese.com)
# Version: 1.01
# Description: Yep. This is my first Python script.
# Skills exemplified in this script:
# * Random number generation
# * Command line interface
# * List comprehension
# * Loops
#
# Update History:
# 2013.12.25 [DRB][1.0] Initial imp... | danbarrese/pwdgen | pwdgen.py | Python | gpl-3.0 | 4,586 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: bigip_device_syslog
sho... | F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_syslog.py | Python | gpl-3.0 | 17,783 |
#
# This file is part of opsd.
#
# opsd 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.
#
# opsd is distributed in the hope that it wil... | warwick-one-metre/opsd | warwick/observatory/operations/actions/onemetre/initialize.py | Python | gpl-3.0 | 5,291 |
import enum
from contextlib import suppress
from typing import Tuple
import urwid
from clisnips.database.pager import Pager
from clisnips.database.search_pager import SearchPagerType, SearchSyntaxError
from clisnips.database.snippets_db import SnippetsDatabase
class SnippetsModel:
class Signals(enum.Enum):
... | ju1ius/clisnips | clisnips/tui/models/snippets.py | Python | gpl-3.0 | 3,536 |
import unittest
from card import Card
class CardTest(unittest.TestCase):
def test_create(self):
suit = 'Hearts'
rank = 'Ace'
card1 = Card(suit, rank)
self.assertEqual((suit, rank), card1.get_value())
def test___eq__(self):
card1 = Card('Spades', 'Queen')
card2... | munhyunsu/Hobby | 2018F_SCSCAlgorithm/week2/card_tests.py | Python | gpl-3.0 | 528 |
# -*- coding: utf-8 -*-
import json
import time
from translate.app import app, views
from translate.app.ratelimit import RateLimit
from translate.backend import BackendManager
class TestAPIv1():
def setup_class(self):
views.manager = BackendManager({})
app.config['TESTING'] = True
app.c... | erik/translate | tests/api_test.py | Python | gpl-3.0 | 5,990 |
from oncall import db
class Event(db.Model):
__tablename__ = 'events'
id = db.Column('id', db.Integer, primary_key=True)
user_username = db.Column(db.String(200), db.ForeignKey('users.username'))
team_slug = db.Column(db.Integer, db.ForeignKey('teams.slug'))
role = db.Column(db.String(200))
sta... | kincl/oncall | oncall_old/models/event.py | Python | gpl-3.0 | 1,172 |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 19 00:50:49 2017
Utils for calculating the NMF
@author: David Gutierrez
"""
from sklearn.decomposition import NMF
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import sys
import os
sys.path.append(os.path.abspath("/home/scidb/Heart... | davidgutierrez/HeartRatePatterns | Python/NMF.py | Python | gpl-3.0 | 3,873 |
# encoding: utf-8
import paste.fixture
from ckan.common import config
import ckan.model as model
import ckan.tests.legacy as tests
import ckan.plugins as p
import ckan.lib.helpers as h
import ckanext.reclineview.plugin as plugin
import ckan.lib.create_test_data as create_test_data
import ckan.config.middleware as mid... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckanext/reclineview/tests/test_view.py | Python | gpl-3.0 | 6,249 |
#!/usr/bin/python
# coding: utf-8
from datetime import datetime
import deform
import colander
import jinja2
from deform import ValidationFailure
from deform.widget import CheckedPasswordWidget
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPForbidden
from pyramid.httpexceptions import HTTP... | toway/towaymeetups | mba/views/admin/meetup_types.py | Python | gpl-3.0 | 3,010 |
__version__ = '2.0.post6'
| Outernet-Project/librarian-netinterfaces | librarian_netinterfaces/__init__.py | Python | gpl-3.0 | 26 |
# -*- coding: utf-8 -*-
# Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
# The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
# A partially filled sudoku which is valid.
# Note:
# A valid Sudoku board (partially filled) is not necessarily sol... | pengkobe/leetcode | questions/Valid_Sudoku.py | Python | gpl-3.0 | 1,179 |
from ambition_validators import MicrobiologyFormValidator
from ..models import Microbiology
from .form_mixins import SubjectModelFormMixin
class MicrobiologyForm(SubjectModelFormMixin):
form_validator_cls = MicrobiologyFormValidator
class Meta:
model = Microbiology
fields = '__all__'
| botswana-harvard/ambition-subject | ambition_subject/forms/microbiology_form.py | Python | gpl-3.0 | 314 |
from tox import Tox
import os
from settings import *
from toxcore_enums_and_consts import *
from ctypes import *
from util import Singleton, folder_size
from file_transfers import *
from collections import defaultdict
class Bot(Singleton):
def __init__(self, tox):
"""
:param tox: tox instance
... | ingvar1995/filebot | bot.py | Python | gpl-3.0 | 20,494 |
# -*- coding: utf-8 -*-
#
# Doqu is a lightweight schema/query framework for document databases.
# Copyright © 2009—2010 Andrey Mikhaylenko
#
# This file is part of Docu.
#
# Doqu is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as pub... | neithere/doqu | doqu/ext/mongodb/converters.py | Python | gpl-3.0 | 8,345 |
# -*- coding: utf-8 -*-
import os
from turtle import*
def T(l):
if l > 4:
pensize(l / 6)
fd(l)
rt(33)
T(l * .7)
lt(66)
T(l * .7)
rt(33)
bk(l)
seth(90)
goto(0, -99)
T(99)
os.system("pause")
| NicovincX2/Python-3.5 | Géométrie/Fractales/arbre.py | Python | gpl-3.0 | 261 |
import json
import datetime
from reinforcepy.environments import ALEEnvironment
from reinforcepy.networks.dqn.tflow.nstep_a3c import NStepA3C
from reinforcepy.learners.dqn.asynchronous.q_thread_learner import QThreadLearner
from reinforcepy.learners.dqn.asynchronous.async_thread_host import AsyncThreadHost
def main(r... | Islandman93/reinforcepy | examples/ALE/DQN_Async/run_a3c.py | Python | gpl-3.0 | 1,478 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/odroid/ROS/install/include".split(';') if "/home/odroid/ROS/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "message_runtime".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lbluef... | chickonice/AutonomousFlight | ROS/build/bluefox2/catkin_generated/pkg.installspace.context.pc.py | Python | gpl-3.0 | 901 |
# coding=utf-8
import unittest
"""124. Binary Tree Maximum Path Sum
https://leetcode.com/problems/binary-tree-maximum-path-sum/description/
Given a **non-empty** binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some
starting node to any node in the tree along ... | openqt/algorithms | leetcode/python/lc124-binary-tree-maximum-path-sum.py | Python | gpl-3.0 | 1,352 |
from os.path import join, split
from os import listdir, getcwd
from PIL import Image, ImageTk
class Loader:
def __init__(self, save_location: str=getcwd()):
self._path = save_location if save_location else None
self._files = list()
self.cache = dict()
self.__current_index = 0
... | zeziba/PiMotionCamera | src/GUI/img_loader/loader.py | Python | gpl-3.0 | 1,624 |
'''
Created on 14/05/2013
@author: diogo
'''
from os import path
from time import time
class Log(object):
'''
Log model. Writes all output from simulator
'''
def __init__(self,params):
'''
Here set the name of the file using params and time
'''
self.file_ = path.join(... | dcc-ufrj/SimuCache | simucache/model/log.py | Python | gpl-3.0 | 2,127 |
# Python program to find whether a number is a palindrome or not
# Function to reverse a number
def reverse(num):
# Initialize variable
rev = 0
while ( num > 0 ) :
dig = num % 10
rev = rev * 10 + dig
num = num // 10
# Returning reversed number
return rev
# --- main... | jainaman224/Algo_Ds_Notes | Palindrome/palindrome_no.py | Python | gpl-3.0 | 690 |
"""Script for running a tsunami inundation scenario for Busselton, WA Australia.
Source data such as elevation and boundary data is assumed to be available in
directories specified by project.py
The output sww file is stored in directory named after the scenario, i.e
slide or fixed_wave.
The scenario is define... | AuScope/VHIRL-Portal | src/main/resources/org/auscope/portal/server/scriptbuilder/templates/run_busselton.py | Python | gpl-3.0 | 10,162 |
from django.db import models
class Partido(models.Model):
# inscripcion = models.CharField(max_length=200)
codigo= models.IntegerField(default=0)
nombre = models.CharField(max_length=200)
codcas=models.CharField(max_length=20, default=0)
def __str__(self):
return self.nombre
cla... | mmanto/sstuv | comun/models.py | Python | gpl-3.0 | 1,062 |
from django.contrib import admin
from abcast.models import *
from django.contrib.auth.models import User
from genericadmin.admin import GenericAdminModelAdmin, GenericTabularInline
class MembersInline(admin.TabularInline):
model = Station.members.through
class ChannelsInline(admin.TabularInline):
model = C... | hzlf/openbroadcast | website/apps/abcast/admin/baseadmin.py | Python | gpl-3.0 | 1,860 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x05\x5d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x17\x00... | NuttamonW/Archaeological | ElectricalConductivity/resources_rc.py | Python | gpl-3.0 | 6,837 |
###############################
# This file is part of PyLaDa.
#
# Copyright (C) 2013 National Renewable Energy Lab
#
# PyLaDa is a high throughput computational platform for Physics. It aims to make it easier to submit
# large numbers of jobs on supercomputers. It provides a python interface to physical input, suc... | pylada/pylada-light | src/pylada/crystal/binary.py | Python | gpl-3.0 | 2,322 |
"""Core eval alignment algorithms
"""
import warnings
from functools import partial, wraps
from pandas.compat import zip, range
import numpy as np
import pandas as pd
from pandas import compat
import pandas.core.common as com
def _align_core_single_unary_op(term):
if isinstance(term.value, np.ndarray):
... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/computation/align.py | Python | gpl-3.0 | 7,849 |
#!/usr/bin/env python
#
# WebExtract v1.0
# A web-based utility to extract archive files for unix systems.
#
# @link http://github.com/farhadi/webextract
# @copyright Copyright 2010, Ali Farhadi (http://farhadi.ir/)
# @license GNU General Public License 3.0 (http://www.gnu.org/licenses/gpl.html)
#
import ... | farhadi/webextract | webextract.py | Python | gpl-3.0 | 6,622 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('agentex', '0003_auto_20150622_1101'),
]
operations = [
migrations.CreateModel(
name='LastLogins',
fi... | tomasjames/citsciportal | app/agentex/migrations/0004_lastlogins.py | Python | gpl-3.0 | 591 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | jcftang/ansible | lib/ansible/module_utils/ios.py | Python | gpl-3.0 | 2,926 |
import os
import math
def rotatePoint(centerPoint,point,angle):
angle = math.radians(angle)
temp_point = point[0]-centerPoint[0] , point[1]-centerPoint[1]
temp_point = ( temp_point[0]*math.cos(angle)-temp_point[1]*math.sin(angle) , temp_point[0]*math.sin(angle)+temp_point[1]*math.cos(angle))
temp_point... | baldengineers/mapper | tf2/prefabs/block.py | Python | gpl-3.0 | 19,942 |
import numpy as np
import scipy.sparse as sp
from scipy.optimize import fmin_l_bfgs_b
from Orange.classification import Learner, Model
__all__ = ["LinearRegressionLearner"]
class LinearRegressionLearner(Learner):
def __init__(self, lambda_=1.0, preprocessors=None, **fmin_args):
'''L2 regularized linear ... | jzbontar/orange-tree | Orange/classification/linear_regression.py | Python | gpl-3.0 | 4,108 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/ocil_2_0/ChoiceQuestionResultType.py | Python | gpl-3.0 | 988 |
UNICODE=1
UNDEF_NDEBUG=1
INSTALL_MULTIVERSION=1
FLAVOUR=""
EP_ADD_OPTS=1
EP_FULL_VER=0
WX_CONFIG="None"
WXPORT="msw"
MONOLITHIC=0
FINAL=0
HYBRID=1
| beiko-lab/gengis | bin/Lib/site-packages/wx-2.8-msw-unicode/wx/build/build_options.py | Python | gpl-3.0 | 160 |
import os
import mxnet as mx
# MXNET_CPU_WORKER_NTHREADS must be greater than 1 for custom op to work on CPU
os.environ["MXNET_CPU_WORKER_NTHREADS"] = "2"
class DisableShearing(mx.operator.CustomOp):
def forward(self, is_train, req, in_data, out_data, aux):
out = in_data[0].copy().asnumpy().reshape(-1,... | Bartzi/stn-ocr | mxnet/operations/disable_shearing.py | Python | gpl-3.0 | 1,178 |
import fractions
# @include
def rotate_array(rotate_amount, A):
def apply_cyclic_permutation(rotate_amount, offset):
temp = A[offset]
for i in range(1, cycle_length):
idx = (offset + i * rotate_amount) % len(A)
A[idx], temp = temp, A[idx]
A[offset] = temp
rotat... | meisamhe/GPLshared | Programming/MPI — AMath 483 583, Spring 2013 1.0 documentation_files/rotate_array_permutation.py | Python | gpl-3.0 | 569 |
try:
# Python 3
import tkinter as tk
import tkinter.messagebox as tkm
import tkinter.simpledialog as tkd
except ImportError:
# Python 2
import Tkinter as tk
import tkMessageBox as tkm
import tkSimpleDialog as tkd
import networkx as nx
from networkx_viewer.graph_canvas import GraphCan... | jsexauer/networkx_viewer | networkx_viewer/viewer.py | Python | gpl-3.0 | 17,151 |
# this example shows how to append new calculated results to an already
# existing cmr file, illustrated for calculation of PBE energy on LDA density
import os
import cmr
# set True in order to use cmr in parallel jobs!
cmr.set_ase_parallel(enable=True)
from ase.structure import molecule
from ase.io import read, wri... | ajylee/gpaw-rtxs | gpaw/test/cmr_append.py | Python | gpl-3.0 | 2,763 |
T = raw_input().lower()
vowels = "aeiouy"
output = ""
for i in range(0,len(T)):
if T[i] not in vowels:
output += "." + T[i]
print output
| Dawny33/Code | Code_Forces/A_string_task.py | Python | gpl-3.0 | 152 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
#
# If you use this software in your research, please cite the following
# journal articles:
#
# J. D. Berry, M. J. ... | jdber1/opendrop | opendrop/mvp/typing.py | Python | gpl-3.0 | 1,995 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies 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 3 of the License, or
# (at your option) any later version.
... | noplay/gns3-gui | gns3/modules/dynamips/pages/frame_relay_switch_configuration_page.py | Python | gpl-3.0 | 6,628 |
####################################################################################################
#
# PyOpenGLng - An OpenGL Python Wrapper with a High Level API.
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | FabriceSalvaire/PyOpenGLng | examples/high-level-api-demo/ShaderProgramesV3.py | Python | gpl-3.0 | 3,221 |
import json
from django.contrib.auth import get_backends
from django.contrib.auth.models import User, AnonymousUser
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from geonode.contrib.groups.models import Group, GroupInvitation
from geonode.documents.... | mishravikas/geonode-cas | geonode/contrib/groups/tests.py | Python | gpl-3.0 | 15,540 |
#
# -*- coding:utf8 -*-
from django.shortcuts import render,HttpResponse
from app01 import models
from app01 import forms
import json
# Create your views here.
def bookmodel(request):
if request.method == 'GET':
Form = forms.BookModelForm()
elif request.method == 'POST':
Form = forms.BookModel... | dianshen/github | day15/app01/views.py | Python | gpl-3.0 | 2,682 |
# configuration script for the MLN query & parameter learning tools
#
# If you want to use PyMLNs with the Alchemy System (http://alchemy.cs.washington.edu),
# set the path where it is installed on your system in the alchemy_versions dictionary below.
#
# Depending on your naming convention for mln and database f... | opcode81/ProbCog | src/main/python/configMLN.py | Python | gpl-3.0 | 3,791 |
import os
from pkg_resources import resource_string as resource_bytes
# Try to get the version number, which will be different if we're living in a
# snap world or a deb. Actually, I'd prefer to not even have the -NubuntuY
# version string when we're running from source, but that's trickier, so don't
# worry about ... | CanonicalLtd/ubuntu-image | ubuntu_image/__init__.py | Python | gpl-3.0 | 690 |
#!/usr/env/python2
"""
Implements multi-threaded job handler that solves a classic network problem:
When processing a network job, often there will be data transferred but at such a slow
rate that the connection is in fact "hung". In this case, the thread should be considered
as "dead", and another thread ... | j4v/pyProjects | pyWorker/pyworker.py | Python | gpl-3.0 | 5,287 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
r"""Pychemqt, Chemical Engineering Process simulator
Copyright (C) 2009-2017, Juan José Gómez Romera <jjgomera@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwa... | jjgomera/pychemqt | lib/EoS/Cubic/PR.py | Python | gpl-3.0 | 12,880 |