text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from flask import render_template, flash, redirect, request, url_for, abort
from flask_login import login_user, logout_user, login_required, current_user
from . import loans
from forms import LoanApplicationForm, ApproveLoan, RepayLoan
from ..models import db
from ..models import Loan, User
from datetime import date
... | Kimanicodes/wananchi | app/loans/views.py | Python | mit | 4,187 | 0.000955 |
# pylint: disable=missing-docstring
"""
Module for checking permissions with the comment_client backend
"""
import logging
import six
from edx_django_utils.cache import DEFAULT_REQUEST_CACHE
from opaque_keys.edx.keys import CourseKey
from lms.djangoapps.teams.models import CourseTeam
from openedx.core.djangoapps.dj... | cpennington/edx-platform | lms/djangoapps/discussion/django_comment_client/permissions.py | Python | agpl-3.0 | 10,094 | 0.004557 |
# -*- coding: utf-8 -*-
from flask_login import LoginManager
from tamactiluya.models import User
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view = 'user.login'
@login_manager.user_loader
def user_loader(uname) -> User or None:
"""
:param uname:
:retu... | tokyo-jesus/tamactiluya | tamactiluya/auth.py | Python | mit | 413 | 0.002421 |
"""WebDAV interface to the document repository."""
from __future__ import annotations
from .views import webdav # noqa
| abilian/abilian-sbe | src/abilian/sbe/apps/documents/webdav/__init__.py | Python | lgpl-2.1 | 121 | 0 |
from swampdragon import route_handler
from swampdragon.route_handler import BaseRouter
class ChatRouter(BaseRouter):
route_name = 'chat-route'
valid_verbs = ['chat', 'subscribe']
def get_subscription_channels(self, **kwargs):
return ['chatroom']
def chat(self, *args, **kwargs):
error... | Valchris/tdoa | client/libraries/swamp/chat_example/chat_example/chat/routers.py | Python | mit | 771 | 0 |
class URIError(Exception):
pass
| sergeyglazyrindev/amigrations | amigrations/adapters/exceptions.py | Python | mit | 36 | 0 |
r"""
Main classes of OpenPNM
=======================
This module contains the main classes from which all other major objects
(Network, Geometry, Physics, Phase, and Algorithm) derive.
The Base class
--------------
The ``Base`` class is a ``dict`` that has added methods for indexing the pores
and throats, applying l... | PMEAL/OpenPNM | openpnm/core/__init__.py | Python | mit | 1,947 | 0 |
# -*- coding: utf-8 -*-
import ipaddress
__all__ = [
'config_to_map',
'get_region'
]
def config_to_map(topology_config):
"""
args:
topology_config: dict
{
'region1': [
'10.1.1.0/24',
'10.1.10.0/24',
'172.1... | polaris-gslb/polaris-core | polaris_common/topology.py | Python | bsd-3-clause | 2,452 | 0.001631 |
from flask_bcrypt import generate_password_hash
# Change the number of rounds (second argument) until it takes between
# 0.25 and 0.5 seconds to run.
generate_password_hash('password1', 8)
| VaSe7u/Supernutrient_0_5 | hash_check.py | Python | mit | 195 | 0 |
import enum
from typing import Dict, Set
from backend.common.consts.event_type import EventType
@enum.unique
class AwardType(enum.IntEnum):
"""
An award type defines a logical type of award that an award falls into.
These types are the same across both years and competitions within a year.
In other w... | the-blue-alliance/the-blue-alliance | src/backend/common/consts/award_type.py | Python | mit | 5,567 | 0 |
from taas.reservation.models import Payment
def delete_payment_before_last_reservation_delete(sender, instance=None, **kwargs):
payment = instance.payment
if payment is None:
return
elif payment.reservation_set.count() == 1 and payment.type == Payment.STAGED:
instance.payment.delete()
| crypotex/taas | taas/reservation/handlers.py | Python | gpl-2.0 | 320 | 0.009375 |
import sci_inst_byname
| karim-omran/openerp-addons | scientific_institutions/wizard/__init__.py | Python | agpl-3.0 | 23 | 0 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | Karel-van-de-Plassche/bokeh | bokeh/application/handlers/code.py | Python | bsd-3-clause | 6,686 | 0.004487 |
""" An SIR Particle Filter based localisation system for tracking a robot with ambiguous bearing
Jason Kulk
"""
from NAO import NAO
import numpy, time
class Localisation:
X = 0
Y = 1
THETA = 2
XDOT = 3
YDOT = 4
THETADOT = 5
STATE_LENGTH = 6
VEL_PAST_LENGTH = 13
def __init__... | soneoed/naowalkoptimiser | server/MCLLocalisation.py | Python | gpl-3.0 | 26,832 | 0.011777 |
import os
import shutil
import pytest
from ..pyautoupdate.launcher import Launcher
@pytest.fixture(scope='function')
def fixture_update_dir(request):
"""Fixture that creates and tears down version.txt and log files"""
def create_update_dir(version="0.0.1"):
def teardown():
if os.path.isfil... | rlee287/pyautoupdate | test/pytest_makevers.py | Python | lgpl-2.1 | 1,008 | 0.001984 |
"""
Simulation of a variation of Buffon's Coin Experiment.
The program checks if the coin will balance in addition
to touching one of the lines of the grid.
"""
import random
import math
DEFAULT_TRIALS = 100000
def __convex__hull(points):
"""Computes the convex hull of a set of 2D points.
Input: an iterab... | wei2912/bce-simulation | utils/coin_var.py | Python | mit | 4,752 | 0.004419 |
from sklearn_explain.tests.skl_datasets_reg import skl_datasets_test as skltest
skltest.test_reg_dataset_and_model("RandomReg_500" , "SVR_poly_8")
| antoinecarme/sklearn_explain | tests/skl_datasets_reg/RandomReg_500/skl_dataset_RandomReg_500_SVR_poly_8_code_gen.py | Python | bsd-3-clause | 149 | 0.006711 |
from __future__ import unicode_literals, division, absolute_import
import os
from flexget import plugin
from flexget.event import event
from flexget.utils import json
def load_uoccin_data(path):
udata = {}
ufile = os.path.join(path, 'uoccin.json')
if os.path.exists(ufile):
try:
with o... | antivirtel/Flexget | flexget/plugins/metainfo/uoccin_lookup.py | Python | mit | 3,924 | 0.004077 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from future.moves.xmlrpc import client as xmlrpc_client
import os
import mock
from flexget.plugins.plugin_rtorrent import RTorrent
torrent_file = os.path.join(os.path.dirname... | qvazzler/Flexget | tests/test_rtorrent.py | Python | mit | 13,663 | 0.001244 |
from __future__ import unicode_literals
from django.db import models
from django.db.migrations.operations.base import Operation
from django.db.migrations.state import ModelState
from django.db.models.options import normalize_together
from django.utils import six
from django.utils.functional import cached_property
fro... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/db/migrations/operations/models.py | Python | gpl-3.0 | 29,026 | 0.002136 |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
from aaf2.auid import AUID
from uuid import UUID
import uuid
import unittest
class MobIDTests(unittest.TestCase):
def test_basic(self):
s = "0d010101-0101-2100-060e-2b3402060101"
v = AUID(s... | markreidvfx/pyaaf2 | tests/test_auid.py | Python | mit | 1,210 | 0.002479 |
#!/usr/bin/env python
import os
import subprocess
import sys
from cStringIO import StringIO
from translate.storage import factory, mo, test_base
# get directory of this test
dir = os.path.dirname(os.path.abspath(__file__))
# get top-level directory (moral equivalent of ../..)
dir = os.path.dirname(os.path.dirname(d... | biswajitsahu/kuma | vendor/packages/translate/storage/test_mo.py | Python | mpl-2.0 | 4,424 | 0.00859 |
'''
Implements the base CFSNode class and a few inherited variants.
This file is part of RTSLib Community Edition.
Copyright (c) 2011 by RisingTide Systems LLC
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 Soft... | JonnyJD/rtslib-fb | rtslib/node.py | Python | agpl-3.0 | 8,950 | 0.001453 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct... | ashang/calibre | src/calibre/ebooks/mobi/debug/mobi6.py | Python | gpl-3.0 | 32,481 | 0.006373 |
#
# $Id$
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006, Mike Osadnik
# Copyright (c) 2006-2013, Andrew Aksyonoff
# Copyright (c) 2008-2013, Sphinx Technologies Inc
# All rights reserved
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the... | darky83/E.F.A.-2.x.x.x | build/Sphinx/sphinxapi.py | Python | gpl-3.0 | 34,597 | 0.05434 |
# Natural Language Toolkit: POS Tag Simplification
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# Brown Corpus
# http://khnt.hit.uib.no/icame/manuals/brown/INDEX.HTM
brown_mapping1 = {
'j': 'ADJ', '... | syllog1sm/TextBlob | text/nltk/tag/simplify.py | Python | mit | 3,411 | 0.004398 |
#!/usr/bin/env python
import sys
sys.path.append('..')
from pyswmap import MapCalc
# A quick example showing current module capabilities:
# We create a new instance of class MapCalc and supply the BMR
# with the following values:
# 1. The IPv6 rule prefix: rulev6 (a string)
# 2. The IPv4 rule prefix: rulev4 ... | ejordangottlieb/pyswmap | examples/basic_example.py | Python | mit | 4,881 | 0.002868 |
from django_gravatar.helpers import get_gravatar_url, has_gravatar
from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='profile')
def __unicode__(self):
return self.user.username
class Meta:
... | MihaZelnik/Django-Unchained | src/project/apps/web/models.py | Python | mit | 1,716 | 0.000583 |
from ..app import db
class Step(db.EmbeddedDocument):
action = db.StringField(max_length=255)
workdir = db.StringField(max_length=255)
class SubProject(db.EmbeddedDocument):
id = db.ObjectIdField(required=True, default=lambda: ObjectId())
name = db.StringField(max_length=255)
url = db.StringField(... | exactassembly/cerise | app/project/models.py | Python | gpl-2.0 | 646 | 0.006192 |
# Copyright 2012 VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | cloudbase/neutron-virtualbox | neutron/tests/unit/openvswitch/test_ovs_tunnel.py | Python | apache-2.0 | 28,244 | 0 |
import sys
from fsgamesys.plugins.pluginmanager import PluginManager
"""
DOSBox-FS launcher script used for testing.
"""
def app_main():
executable = PluginManager.instance().find_executable("dosbox-fs")
process = executable.popen(sys.argv[1:])
process.wait()
| FrodeSolheim/fs-uae-launcher | launcher/apps/dosbox_fs.py | Python | gpl-2.0 | 276 | 0 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | a10networks/acos-client | acos_client/version.py | Python | apache-2.0 | 641 | 0 |
import pandas as pd
import struct
def read_pos(f):
""" Loads an APT .pos file as a pandas dataframe.
Columns:
x: Reconstructed x position
y: Reconstructed y position
z: Reconstructed z position
Da: mass/charge ratio of ion"""
# read in the data
n = len(file(f).read())/4... | oscarbranson/apt-tools | apt_importers.py | Python | gpl-2.0 | 4,972 | 0.007039 |
from text import TextReader
from xml import XMLReader
| perfidia/screensketch | src/screensketch/screenspec/reader/__init__.py | Python | mit | 54 | 0 |
## Copyright 2009 Luc Saffre
## This file is part of the Lino project.
## Lino 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.
## L... | MaxTyutyunnikov/lino | lino/utils/requests.py | Python | gpl-3.0 | 1,997 | 0.027541 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | agry/NGECore2 | scripts/mobiles/yavin4/geonosian_bunker/enhanced_kliknik.py | Python | lgpl-3.0 | 1,688 | 0.026659 |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... | amadeusproject/amadeuslms | analytics/tests/test_general_dashboard.py | Python | gpl-2.0 | 4,202 | 0.031392 |
import os
from nose.tools import assert_equal
from nose import SkipTest
from unittest import TestCase
from tests import TEST_APP_KEY, TEST_APP_SECRET
from bigdoorkit.client import Client
from bigdoorkit.resources.level import NamedLevelCollection, NamedLevel
from bigdoorkit.resources.award import NamedAwardCollection... | splee/bigdoorkit | tests/test_resource.py | Python | mit | 3,184 | 0.003769 |
# Copyright (c) 2012 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | sebrandon1/neutron | neutron/tests/unit/common/test_utils.py | Python | apache-2.0 | 30,791 | 0.00013 |
# Copyright 2017 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/distributions/python/ops/geometric.py | Python | bsd-2-clause | 7,545 | 0.003446 |
""" Agent to extend the number of tasks given the Transformation definition
"""
from DIRAC import S_OK, gLogger
from DIRAC.Core.Base.AgentModule import AgentModule
from DIRAC.ConfigurationSystem.Client.Helpers.Operations ... | sposs/DIRAC | TransformationSystem/Agent/MCExtensionAgent.py | Python | gpl-3.0 | 4,963 | 0.032642 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2017 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import re
f... | hlmnrmr/superdesk-core | superdesk/text_utils.py | Python | agpl-3.0 | 4,433 | 0.001805 |
"""
=========
Visualize
=========
Widgets for data visualization.
"""
# Category description for the widget registry
NAME = "Visualize"
DESCRIPTION = "Widgets for data visualization."
BACKGROUND = "#FFB7B1"
ICON = "icons/Category-Visualize.svg"
PRIORITY = 2
| yzl0083/orange | Orange/OrangeWidgets/Visualize/__init__.py | Python | gpl-3.0 | 266 | 0 |
# -*- 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-tasks | samples/generated_samples/cloudtasks_v2beta2_generated_cloud_tasks_cancel_lease_sync.py | Python | apache-2.0 | 1,442 | 0.000693 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('coding', '0006_auto_20150619_2103'),
]
operations = [
migrations.AlterField(
model_name='code',
name... | michaelbrooks/uw-message-coding | message_coding/apps/coding/migrations/0007_auto_20150619_2106.py | Python | mit | 744 | 0 |
from flask import Flask
from flask import request
from flask import render_template
from flask import redirect
from flask import url_for
app = Flask(__name__)
from app import views
| DavidAwad/HeroquestBot | app/__init__.py | Python | gpl-2.0 | 184 | 0.01087 |
# Copyright 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | devananda/ironic | ironic/common/network.py | Python | apache-2.0 | 1,491 | 0 |
import threading
import urllib2
import os
import shutil
import tempfile
from json import loads
from enigma import eDVBDB, eEPGCache
from Screens.MessageBox import MessageBox
from config import config, ConfigText
from Tools import Notifications
from base64 import encodestring
from urllib import quote
from time import sl... | OpenPLi/enigma2 | lib/python/Components/ImportChannels.py | Python | gpl-2.0 | 6,369 | 0.021667 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | sysadminmatmoz/odoo-clearcorp | product_invoice_report/__openerp__.py | Python | agpl-3.0 | 1,883 | 0.002124 |
__version__ = version = '0.0.1'
from pyportfolio.models import Equity, Option, Future, Account, Trade, Commodity, Index, Currency
| davidastephens/pyportfolio | pyportfolio/__init__.py | Python | bsd-3-clause | 131 | 0.007634 |
import pytest
from lemur.notifications.views import * # noqa
from .vectors import VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN
def test_notification_input_schema(client, notification_plugin, notification):
from lemur.notifications.schemas import NotificationInputSchema
input_data = {
'label'... | nevins-b/lemur | lemur/tests/test_notifications.py | Python | apache-2.0 | 3,324 | 0.003309 |
def bloup(n):
for i in xrange(0,n):
print "%s pikachu lol %d soup soup" % (" "*(i%10), i)
bloup(666)
| refnil/CS_Game_Practice | test.py | Python | apache-2.0 | 121 | 0.033058 |
##############################################################################
#
# 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/i18n/locales/__init__.py | Python | gpl-3.0 | 22,122 | 0.000271 |
# python filter_transcript_counts.py < transcript_counts.txt > active_transcripts.txt
import sys
print "Gene\tTranscript\tExpression"
for l in sys.stdin:
t = l.strip().split('\t')
if float(t[2]) > 1.1:
print '\t'.join(t[0:3])
| ahonkela/pol2rna | python/filter_transcript_counts.py | Python | bsd-3-clause | 244 | 0.008197 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2009 Edgewall Software
# Copyright (C) 2004 Daniel Lundin <daniel@edgewall.com>
# Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2008 Matt Good <matt@matt-good.net>
# All rights reserved.
#... | dokipen/trac | trac/web/session.py | Python | bsd-3-clause | 11,069 | 0.000723 |
from MuellerBrown import getPotentialAndForces
from PlotUtils import PlotUtils
import numpy as np
import matplotlib.pyplot as plt
import MuellerBrown as mbpot
m=1.0
def getKineticEnergy(velocity):
return 0.5*m*(velocity[0]**2+velocity[1]**2)
dt = 0.01
num_steps = 1000
#initial_position = np.array( [ 0.0 , ... | valsson/MD-MC-Codes-2016 | MuellerBrown-MD/MD-MuellerBrown.py | Python | mit | 1,665 | 0.013213 |
import commands
import sys
import postproc_yt as pp
import os
import shutil
targetdir = sys.argv[1]
timestep = float(sys.argv[2])
face = float(sys.argv[3])
level = float(sys.argv[4])
ppdir = os.getenv('PPDIR')
outdir = os.getenv('PPOUTDIR')
D = pp.FileSetup(targetdir, face=face, level=level,
timeste... | low-sky/simscript | postproc/pipeline.py | Python | gpl-2.0 | 893 | 0.00224 |
#!/usr/bin/env python
#
# !!!!!!!!! WARNING !!!!!!!!!!!!!!!
# This Script was bastardized To Read Password From /home/bspaans/.googlecode
#
#
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is int... | anthonyt/mingus-counterpoint | googlecode_upload.py | Python | gpl-3.0 | 9,994 | 0.008505 |
#!/usr/bin/env python
# ECLAIR/src/ECLAIR/Build_instance/ECLAIR_core.py
# Author: Gregory Giecold for the GC Yuan Lab
# Affiliation: Harvard University
# Contact: g.giecold@gmail.com, ggiecold@jimmy.harvard.edu
"""ECLAIR is a package for the robust and scalable
inference of cell lineages from gene ex... | GGiecold/ECLAIR | src/ECLAIR/Build_instance/ECLAIR_core.py | Python | mit | 58,120 | 0.01139 |
import clr
import xmlutil
clr.AddReference('System.Xml')
from System.Xml import *
d = XmlDocument()
d.Load('C:\Program Files (x86)\IronPython 2.7\Tutorial\load.xml')
n = d.SelectNodes('//Puzzle/SavedGames/Game/@caption')
for e in n:
print e.Value
for e in xmlutil.Walk(d):
print e.Name, e.Value
| kenwilcox/PlayingWithIronPython | PythonLibs.py | Python | mit | 307 | 0.016287 |
#!/usr/bin/env python
# coding: utf-8
#
# StreamBuddy - a video and data streaming serviweng zieleinfahrtce.
# Copyright (c) 2015, Tobias Bleiker & Dumeni Manatschal
#
# 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
# ... | tbleiker/StreamBug | tests/cmd_interface_02_server_clients.py | Python | agpl-3.0 | 3,447 | 0 |
#!/usr/bin/env python
import numpy
import re, os
import matplotlib.pyplot as plt
import pylab
a = 0.8
plt.rc('axes', color_cycle=[[0,0,a], [0,a,0], [a,0,0]])
files = os.listdir('logs')
lookup = sorted([[int(re.search('\d+', elem).group(0)), elem]
for elem in files], key=lambda x:x[0])
for n, f in lookup:
if ... | afrachioni/umbrella | tools/plot_hist.py | Python | gpl-3.0 | 556 | 0.034173 |
# -*- coding: utf-8 -*-
""" Sphinx configuration file. """
#
# Coredata API client documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 6 19:20:17 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration value... | koddsson/coredata-python-client | docs/conf.py | Python | mit | 8,383 | 0.006084 |
# Copyright 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | openvswitch/ovn-scale-test | rally_ovs/plugins/ovs/ovnclients.py | Python | apache-2.0 | 5,955 | 0.002015 |
# Copyright (c) 2014 Christopher Felton
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | cfelton/gizflo | gizflo/toolchain/_toolflow.py | Python | gpl-3.0 | 3,668 | 0.004362 |
from serapeum.backup.modules.config.arguments import Arguments
from serapeum.backup.modules.config import Config
from serapeum.backup.modules.log import logger
config = Config(Arguments().config_file)
from serapeum.backup.modules.ds.stack import Stack
from serapeum.backup.modules.files import Files
from serapeum.bac... | pieterdp/serapeum.backup | serapeum/backup/__init__.py | Python | gpl-3.0 | 4,529 | 0.006845 |
from django.shortcuts import render
from .models import Temas, Biblioteca
from django.shortcuts import get_object_or_404
from django.db.models import Q
# Create your views here.
def index(request,template='biblioteca/index.html',slug=None):
temas = Temas.objects.all()
ultimas_guias = Biblioteca.objects.filter(tipo_d... | shiminasai/plataforma_fadcanic | biblioteca/views.py | Python | mit | 1,157 | 0.020743 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Charles Li <chuck@mixed-metaphors.com>
# Copyright (c) 2011 Tristan Matthews <le.businessman@gmail.com>
# This file is part of CloudSound.
# CloudSound is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | tmatth/CloudSound | feldmanesque.py | Python | gpl-3.0 | 6,736 | 0.021229 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2022 BigML
#
# 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 ... | bigmlcom/python | bigml/tests/test_44_compare_predictions.py | Python | apache-2.0 | 22,664 | 0.001456 |
import random
random.randint(0, 3)
random.randint(0, 3)
print(random.randint(0, 3))
print(random.randint(0, 3))
print(random.randint(0, 3))
# What does randint do?
# What do the values 0 and 3 do? Try changing those numbers, rerun the program, and write down what changed.
# What is the difference between random.randi... | bensk/CS9 | _site/Code Examples/March21DoNow.py | Python | mit | 361 | 0.01385 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_server_failure.py | Python | mit | 6,474 | 0.000618 |
import pycparser
def main_eg():
parser = pycparser.CParser()
buf = '''
int main( int argc, char** argv ) {
j = p && r || q;
return j;
}
'''
t = parser.parse( buf, 'x.c' )
return t
if __name__ == "__main__":
t = main_eg()
t.show()
| quenette/COMPASS-I | t/scripts/test_pycparser.py | Python | apache-2.0 | 289 | 0.031142 |
import sys
from collections import Counter
rows = zip(*[l.strip() for l in sys.stdin])
print ''.join(Counter(l).most_common()[-1][0] for l in rows) # 0 zamiast -1 dla part1
| tehasdf/AdventOfCode2016 | p6.py | Python | mit | 175 | 0.017143 |
# Copyright 2017 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... | kevin-coder/tensorflow-fork | tensorflow/python/saved_model/simple_save.py | Python | apache-2.0 | 4,171 | 0.001199 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import datetime
import time
import gettext
from pseudo_cluster.task import Task_record
from pseudo_cluster.tasks_list import Tasks_list
from pseudo_cluster.extended_task import Extended_task_record
from pseudo_cluster.actions_list impor... | pseudo-cluster/pseudo-cluster | scripts/run_pseudo_tasks_slurm.py | Python | lgpl-2.1 | 7,019 | 0.011711 |
"""
homeassistant.components.sensor.efergy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors home energy use as measured by an efergy
engage hub using its (unofficial, undocumented) API.
Configuration:
To use the efergy sensor you will need to add something
like the following to your config/configurati... | teodoc/home-assistant | homeassistant/components/sensor/efergy.py | Python | mit | 4,293 | 0 |
"""
Create new streamparse project template.
"""
from __future__ import absolute_import
from streamparse.bootstrap import quickstart
def subparser_hook(subparsers):
""" Hook to add subparser for this command. """
subparser = subparsers.add_parser('quickstart',
descripti... | hodgesds/streamparse | streamparse/cli/quickstart.py | Python | apache-2.0 | 643 | 0 |
#!/usr/bin/env python
LICENSE="""
Copyright (C) 2011 Michael Ihde
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.
This progra... | JCHappytime/MyQuantopian | strategies/strategy.py | Python | gpl-2.0 | 3,094 | 0.004848 |
import os
import pymysql
pymysql.install_as_MySQLdb()
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.163.com'
MAIL_PORT = 25
MAIL_USE_TLS = True
MAIL... | penglee87/flaskweb | config.py | Python | mit | 1,488 | 0.004704 |
from flask import request, abort, jsonify, render_template
from flask.ext.sqlalchemy import BaseQuery
import math
class PaginatedQuery(object):
def __init__(self, query_or_model, paginate_by, page_var='page',
check_bounds=False):
self.paginate_by = paginate_by
self.page_var = page... | pbecotte/devblog | backend/blog/utils.py | Python | mit | 2,165 | 0.000462 |
import base64
import hashlib
import json
import os
import bcrypt
from sqlalchemy.orm.exc import NoResultFound
from server_global import db
class Admin(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(100), nullable=False, unique=True)
password = db.Column(db.String... | glennyonemitsu/MarkupHiveServer | src/model/admin.py | Python | mit | 506 | 0 |
import base64
from flask import request, jsonify, session as flask_session
from flask.ext.login import login_user, LoginManager, current_user, current_app
from flexget.api import api, APIResource, app
from flexget.webserver import User
from flexget.utils.database import with_session
login_manager = LoginManager()
lo... | tsnoam/Flexget | flexget/api/authentication.py | Python | mit | 3,365 | 0.00208 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | InakiZabala/odoomrp-wip | product_packaging_through_attributes/__openerp__.py | Python | agpl-3.0 | 1,619 | 0 |
# migrate.py [up|seed|down] [local|docker]
# e.g. migrate.py up docker
import sys
import os
import re
from subprocess import call, check_output
from operator import itemgetter, attrgetter, methodcaller
CASSANDRA_PATH_LOCAL = '/Users/jacekdalkowski/Dev/_cassandra/apache-cassandra-3.0.0/bin/'
ARTIFACTS_PATH_LOCAL = '/... | jacekdalkowski/bike-timer | web-database/db_migrations/migrate.py | Python | apache-2.0 | 2,224 | 0.022932 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.base import StatsMixin
from sentry.api.bases.group import GroupEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.api.serializers.models.environment... | mitsuhiko/sentry | src/sentry/api/endpoints/group_environment_details.py | Python | bsd-3-clause | 2,927 | 0.000342 |
import os
import sys
from datetime import datetime
from io import BytesIO
from pathlib import Path
from typing import List
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
from mini_fiction import ponydump
from mini_fiction.logic.image import SavedImage
# Вообще всё будет работать и без этих exclude, но выкидывание... | andreymal/mini_fiction | mini_fiction/dumpload.py | Python | gpl-3.0 | 18,621 | 0.001913 |
import traceback
import sys
from gribapi import *
INPUT = 'rap_130_20120822_2200_001.grb2'
VERBOSE = 1 # verbose error reporting
def example():
f = open(INPUT)
while 1:
gid = grib_new_from_file(f)
if gid is None: break
iterid = grib_keys_iterator_new(gid, 'ls')
# Differen... | thomasvdv/flightbit | forecast/keys_iterator.py | Python | gpl-2.0 | 1,140 | 0.001754 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
PRODUCT_SORT_CHOI... | janusnic/shoop | shoop/front/utils/product_sorting.py | Python | agpl-3.0 | 1,352 | 0 |
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | ejona86/grpc | src/python/grpcio_tests/tests_aio/unit/_constants.py | Python | apache-2.0 | 816 | 0 |
import logging
from concurrent.futures import ThreadPoolExecutor
import stomp
from stomp.listener import TestListener
from .testutils import *
executor = ThreadPoolExecutor()
def create_thread(fc):
f = executor.submit(fc)
print("Created future %s on executor %s" % (f, executor))
return f
class Reconn... | jasonrbriggs/stomp.py | tests/test_override_threading.py | Python | apache-2.0 | 1,654 | 0 |
# -*- coding: utf8 -*-
import os
import os.path
import flask
import flask_assets
import flask_sqlalchemy
from .cross_domain_app import CrossDomainApp
from zeeguu.util.configuration import load_configuration_or_abort
import sys
if sys.version_info[0] < 3:
raise "Must be using Python 3"
# *** Starting the App *** ... | MrAlexDeluxe/Zeeguu-Web | zeeguu_web/app.py | Python | mit | 1,825 | 0.006027 |
# -*- coding: utf-8 -*-
# Copyright 2019 Joan Marín <Github@JoanMarin>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Tax Group Types",
"category": "Financial",
"version": "10.0.1.0.0",
"author": "EXA Auto Parts Github@exaap, "
"Joan Marín Github@JoanMarin",
... | odoo-colombia/l10n-colombia | account_tax_group_type/__manifest__.py | Python | agpl-3.0 | 636 | 0.001577 |
# Copyright (c) 2018 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | openstack/neutron-lib | neutron_lib/api/definitions/network_segment_range.py | Python | apache-2.0 | 5,876 | 0 |
from __future__ import print_function
import datetime
from collections import OrderedDict
from django.urls import reverse
from django.http import JsonResponse
from django.utils.translation import get_language, activate
from wagtail.core import blocks
from wagtail.core.models import Page
from wagtail.core.rich_text imp... | PARINetwork/pari | core/utils.py | Python | bsd-3-clause | 5,677 | 0.002818 |
"""
WSGI config for meetings 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | jnayak1/osf-meetings | meetings/meetings/wsgi.py | Python | apache-2.0 | 393 | 0 |
from PyObjCTools.TestSupport import *
from Quartz.QuartzCore import *
from Quartz import *
class TestCIPluginInterfaceHelper (NSObject):
def load_(self, h): return 1
class TestCIPlugInInterface (TestCase):
def testMethods(self):
self.assertResultIsBOOL(TestCIPluginInterfaceHelper.load_)
def no_t... | albertz/music-player | mac/pyobjc-framework-Quartz/PyObjCTest/test_ciplugininterface.py | Python | bsd-2-clause | 488 | 0.006148 |
"""
KeepNote
Low-level Create-Read-Update-Delete (CRUD) interface for notebooks.
"""
#
# KeepNote
# Copyright (c) 2008-2011 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@alum.mit.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Genera... | brotchie/keepnote | keepnote/notebook/connection/__init__.py | Python | gpl-2.0 | 11,118 | 0.004767 |
# -*- coding: utf-8 -*-
import pytest
from tests.models.test_etl_record import etl_records # noqa
from tests.models.test_abstract_records import dynamodb_connection # noqa
from mycroft.backend.worker.etl_status_helper import ETLStatusHelper
import mock
RECORDS = [
{'status': 'error', 'date': '2014-09-01', 'star... | Yelp/mycroft | mycroft/tests/backend/test_etl_helper.py | Python | mit | 2,789 | 0.000359 |
# tronmoves: Moves library for a Google AI 2010 TronBot entry.
# Copyright (C) 2010 Corey Abshire
#
# 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... | jogo279/trobo | opponents/corey_abshire/tronmoves.py | Python | bsd-2-clause | 4,160 | 0.001442 |
"""Calculate the liquid volume of a cylinder on its side"""
from hcsr04sensor import sensor
trig_pin = 17
echo_pin = 27
# default values
# temperature = 20 celcius
# unit = "metric"
# gpio_mode = GPIO.BCM
# Get litres in a cylinder
cyl_length_metric = 300 # centimeters
cyl_radius_metric = 48 # centimeters
cyl_depth... | alaudet/hcsr04sensor | recipes/cylinder_volume_side_metric.py | Python | mit | 844 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.