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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.contrib.auth.signals import user_logged_in
from markup_deprecated.templatetags.markup import markdown
from django.utils import timezone
from... | pysv/djep | pyconde/accounts/models.py | Python | bsd-3-clause | 7,406 |
"""
@author: Maneesh D
@email: maneeshd77@gmail.com
"""
from multiprocessing import Process, Queue
def is_prime(num):
limit = int(num ** 0.5) + 1
for i in range(2, limit):
if num % i == 0:
return False
return True
def sum_primes(start, end, q):
total = 0
for num in rang... | maneeshd/PyTutorial | Advanced/Multi-Threading & Processing/multiprocessing/primes_multi_processing.py | Python | mit | 1,126 |
#!/usr/bin/env python
#
# Copyright 2005,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your opt... | GREO/GNU-Radio | gr-audio-alsa/src/qa_alsa.py | Python | gpl-3.0 | 1,240 |
import os, glob
from imp import find_module, load_module
EXTENSIONS_PATH = os.path.dirname(os.path.abspath(__file__))
EXTENSIONS_DIRECTORIES = glob.glob(os.path.join(EXTENSIONS_PATH, '*/'))
extensions_parameters = []
def import_extension(extension_directory):
extension_name = os.path.basename(os.path.normpath(exten... | SophieIPP/openfisca-france | openfisca_france/model/extensions/__init__.py | Python | agpl-3.0 | 865 |
from django.conf.urls import *
from django.http import HttpResponseRedirect
from anon_provider import AnonProvider, openid_page
urlpatterns = patterns('',
(r'^$', lambda r: HttpResponseRedirect('/openid/')),
(r'^server/$', AnonProvider()),
(r'^(\w+)/$', openid_page),
)
| fgirault/smeuhsocial | apps/django_openid/demos/provider/urls.py | Python | mit | 283 |
import os
import pickle
import random
import re
from datetime import datetime
from data_processing import (InteractiveAnswer, _in_list, colorit, space_fill,
split_wrd)
BOARDER_LENGTH = 40
class Quest():
def __init__(self, q, sel=None, ta=None, args={}):
'''
Class rep... | heyrict/exam | exam.py | Python | apache-2.0 | 16,883 |
from collections import namedtuple
from functools import wraps
import json
import typing
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.core.exceptions import (
PermissionDenied,
ValidationError,
)
from djang... | jlaunonen/kirppu | kirppu/views/monolithic.py | Python | mit | 35,876 |
import logging
from autotest.client.shared import error
from virttest import aexpect, utils_misc
@error.context_aware
def run_autotest_regression(test, params, env):
"""
Autotest regression test:
Use Virtual Machines to test autotest.
1) Clone the given guest OS (only Linux) image twice.
2) Boot... | sathnaga/virt-test | tests/autotest_regression.py | Python | gpl-2.0 | 11,381 |
# The Hazard Library
# Copyright (C) 2012-2014, GEM Foundation
#
# 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.
... | larsbutler/oq-hazardlib | openquake/hazardlib/tests/mfd/truncated_gr_test.py | Python | agpl-3.0 | 9,724 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Kazade/NeHe-Website | google_appengine/google/appengine/ext/remote_api/remote_api_services.py | Python | bsd-3-clause | 17,948 |
from . import unittest
from shapely.geometry import LineString
class ProductZTestCase(unittest.TestCase):
def test_line_intersection(self):
line1 = LineString([(0, 0, 0), (1, 1, 1)])
line2 = LineString([(0, 1, 1), (1, 0, 0)])
interxn = line1.intersection(line2)
self.assertTrue(int... | jdmcbr/Shapely | tests/test_products_z.py | Python | bsd-3-clause | 517 |
from cgitb import text
__author__ = 'rafa'
import pygtk
pygtk.require('2.0')
import gtk
import MySQLdb
class Handler():
def delete_event(self, widget,data=None):
print( "Call from Glade." )
# TIP:if you return 0 , destroy, but if you return 1, stop , not kill program
# TODO: Here create ... | rafathefull/tinnydb | principal.py | Python | gpl-3.0 | 7,430 |
#!/usr/bin/python3
"""
File: QuTech_VSM_Module.py
Author: Jeroen Bergmans, TNO/QuTech
Purpose: Instrument driver for Qutech Vector Switch Matrix
Usage:
Notes: # General
The VSM consists of 32 qubit tuners:
8 modules (numbered from left to right)
4 channels per modu... | DiCarloLab-Delft/PycQED_py3 | deprecated/pycqed/instrument_drivers/physical_instruments/attic/QuTech_VSM_Module_jeroen.py | Python | mit | 13,698 |
switch_failure_rate = 0.0
switch_recovery_rate = 1.0
dataplane_drop_rate = 0.0
controlplane_block_rate = 0.0
controlplane_unblock_rate = 1.0
ofp_message_receipt_rate = 1.0
ofp_message_send_rate = 1.0
ofp_cmd_passthrough_rate = 1.0
ofp_flow_mod_failure_rate = 0.0
link_failure_rate = 0.0
link_recovery_rate = 1.0
controll... | jmiserez/sts | config/fuzzer_params.py | Python | apache-2.0 | 815 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/unit/test_process_buildstep.py | Python | mit | 9,964 |
#!/usr/bin/env python
from __future__ import print_function
import optparse
import os
import pwd
import signal
import subprocess
import sys
import time
import traceback
from six.moves.urllib.parse import urlunparse
from tornado import httpclient
from tornado import httputil
from tornado import gen
from tornado impor... | arpith/zulip | tools/run-dev.py | Python | apache-2.0 | 13,278 |
#!/usr/bin/env python
# encoding: utf-8
"""
releaseutils.py
Python Utils for releasing the Checker Framework
This contains no main method only utility functions
Created by Jonathan Burke 11/21/2012
Copyright (c) 2012 University of Washington
"""
import sys
import urllib2
import re
import subprocess
import os
import ... | Jianchu/checker-framework | release/release_utils.py | Python | gpl-2.0 | 36,734 |
"""
$url mitele.es
$type live
$region Spain
"""
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
from streamlink.utils.parse import parse_qsd
from streamlink.utils.url import update_qsd
log = logging.ge... | chhe/streamlink | src/streamlink/plugins/mitele.py | Python | bsd-2-clause | 3,570 |
import database_manager
while True:
cmd = input()
# print(cmd)
if cmd == 'drop':
database_manager.drop_tables()
elif cmd == 'init':
database_manager.init()
elif cmd.lower().startswith('addst'):
params = cmd[5:].replace(' ', '').split(',')
if database_manager.add_st... | mirtaba/BayatBot | Exam.py | Python | mit | 1,507 |
class ColoredButtonGroup(QtGui.QGroupBox):
def __init__(self, numColBut, *args, **kwargs):
super(ColoredButtonGroup, self).__init__(*args, **kwargs)
self.numColBut = numColBut
self.buttonGroup = QtGui.QButtonGroup()
layout = QtGui.QHBoxLayout()
layout.setSpacing(1)... | satishgoda/learningqt | basics/color/color_buttongroup.py | Python | mit | 1,407 |
import claripy
import ana
import nose
import pickle
import tempfile
import logging
l = logging.getLogger('claripy.test.serial')
def test_pickle():
bz = claripy.backend_z3
a = claripy.BitVecVal(0, 32)
b = claripy.BitVec('x', 32, explicit_name=True)
c = a+b
nose.tools.assert_equal(c.resolved_with(... | zhuyue1314/claripy | tests/test_serial.py | Python | bsd-2-clause | 2,258 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-12 08:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0013_remove_eoi_selected_partners'),
]
... | unicef/un-partner-portal | backend/unpp_api/apps/project/migrations/0014_auto_20170912_0844.py | Python | apache-2.0 | 783 |
import networkx as nx
from bokeh.io import output_file, show
from bokeh.models import (BoxSelectTool, Circle, EdgesAndLinkedNodes, HoverTool,
MultiLine, NodesAndLinkedEdges, Plot, Range1d, TapTool)
from bokeh.palettes import Spectral4
from bokeh.plotting import from_networkx
G=nx.karate_club... | bokeh/bokeh | sphinx/source/docs/user_guide/examples/graph_interaction.py | Python | bsd-3-clause | 1,374 |
from os import path
import argparse
__all__ = ('Config',)
def percentage(string):
errstr = "must be a float between 0 and 1, not %r" % string
try:
value = float(string)
except ValueError:
raise argparse.ArgumentTypeError(errstr)
if value < 0 or value > 1:
raise argparse.Argume... | ekager/focus-android | tools/l10n/android2po/config.py | Python | mpl-2.0 | 6,251 |
from celery import Task
# django-haystack indexing automatically
from haystack.management.commands import update_index
class UpdateIndexTask(Task):
def run(self):
update_index.Command().handle()
| deadlylaid/book_connect | wef/items/tasks/haystack_indexing.py | Python | mit | 211 |
from instabot import User, api, Sender, Getter
import logging.config
import unittest
from instabot.user.user_controller import UserController
class TestUser(unittest.TestCase):
def test_getter(self):
get = Getter()
print ("USERS AVAILABLE: %d" % get.controller.queue.qsize())
resp = list(g... | instagrambot/instapro | test.py | Python | apache-2.0 | 1,220 |
import subprocess
import os
class CommandRunner:
HOST_LIST_TO_RUN_LOCAL = ["localhost", "127.0.0.1"]
def __init__(self, local_hostname, logger):
logger.debug("Creating CommandRunner with Args - local_hostname: {local_hostname}, logger: {logger}".format(**locals()))
self.local_hostname = loca... | teamclairvoyant/airflow-scheduler-failover-controller | scheduler_failover_controller/command_runner/command_runner.py | Python | apache-2.0 | 2,797 |
# 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... | heiths/allura | Allura/allura/lib/decorators.py | Python | apache-2.0 | 10,039 |
"""Top-level import for all CLI-related functionality in apitools.
Note that importing this file will ultimately have side-effects, and
may require imports not available in all environments (such as App
Engine). In particular, picking up some readline-related imports can
cause pain.
"""
# pylint:disable=wildcard-impo... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudapis/apitools/base/py/cli.py | Python | gpl-3.0 | 432 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
'''Django template filters to be used to display builds.
'''
from __future__ import absolute_import, division
from __fut... | mozilla/elmo | apps/tinder/templatetags/build_extras.py | Python | mpl-2.0 | 4,246 |
# #####
# This file is part of the RobotDesigner of the Neurorobotics subproject (SP10)
# in the Human Brain Project (HBP).
# It has been forked from the RobotEditor (https://gitlab.com/h2t/roboteditor)
# developed at the Karlsruhe Institute of Technology in the
# High Performance Humanoid Technologies Laboratory (H2T)... | HBPNeurorobotics/BlenderRobotDesigner | robot_designer_plugin/export/sdf/sdf_export.py | Python | gpl-2.0 | 50,899 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# This library 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... | xiangke/pycopia | core/pycopia/OS/Linux/firewall.py | Python | lgpl-2.1 | 1,458 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2018-02-27 13:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('calculator', '0004_collection_to_show'),
]
operati... | GenosResearchGroup/ContourMetrics | apps/calculator/migrations/0005_auto_20180227_1322.py | Python | mit | 2,718 |
"""Helpers to deal with Cast devices."""
from __future__ import annotations
from typing import Optional
import attr
from pychromecast import dial
from pychromecast.const import CAST_MANUFACTURERS
@attr.s(slots=True, frozen=True)
class ChromecastInfo:
"""Class to hold all data about a chromecast for creating con... | w1ll1am23/home-assistant | homeassistant/components/cast/helpers.py | Python | apache-2.0 | 6,729 |
# countline.py
# counting lines of java file or java files in a dir
import os
import sys
def process_file(path):
total = 0
if (path.endswith('.java')):
handle = open(path, 'r')
for eachLine in handle:
if len(eachLine) > 1:
#print len(eachLine), ' > ', eachLine,
... | kesalin/PythonSnippet | countline.py | Python | gpl-2.0 | 1,288 |
# Copyright (c) 2015 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 applicab... | ctrlaltdel/neutrinator | vendor/openstack/tests/unit/cloud/test_endpoints.py | Python | gpl-3.0 | 16,034 |
"""A key-value[] store that implements reservoir sampling on the values."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import random
import threading
class Reservoir(object):
"""A map-to-arrays container, with deterministic Reser... | kcartier/tensorflow-toe-in-the-water | tensorflow/python/summary/impl/reservoir.py | Python | apache-2.0 | 7,300 |
import os
import dbus.service # Ignore PyImportSortBear
from coalib.misc.Exceptions import get_exitcode
from coalib.output.Interactions import fail_acquire_settings
from coalib.output.printers.ListLogPrinter import ListLogPrinter
from coalib.parsing.Globbing import fnmatch
from coalib.processes.Processing import exe... | svsn2117/coala | coalib/output/dbus/DbusDocument.py | Python | agpl-3.0 | 6,851 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import warnings
try:
# Python 2.6
import unittest2 as unittest
except ImportError:
import unittest
try:
from mock import Mock, patch
except:
# python3
from unittest.mock import Mock, patch # noqa
from contextlib imp... | awiddersheim/flask-restplus | tests/__init__.py | Python | mit | 3,507 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | Lilykos/invenio | invenio/modules/search/upgrades/search_2015_03_03_fix_models.py | Python | gpl-2.0 | 3,136 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="heatmap.colorbar.title", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | plotly/python-api | packages/python/plotly/plotly/validators/heatmap/colorbar/title/_font.py | Python | mit | 1,535 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 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... | angdraug/nova | nova/tests/compute/test_compute_utils.py | Python | apache-2.0 | 37,999 |
# coding: utf-8
from django.db import models
class TipoDeGestion(models.Model):
nombre = models.CharField(max_length=255)
def __unicode__(self):
return u"TipoDeGestion: " + self.nombre
class Meta:
db_table = 'tiposDeGestion'
verbose_name_plural = 'tiposDeGestion'
class JSONAP... | Dte-ba/suite-backend | escuelas/models/tipo_de_gestion.py | Python | gpl-3.0 | 370 |
from flask import render_template, request, redirect, url_for, abort, flash,\
make_response
from flask_login import login_required, current_user
from bson.objectid import ObjectId
from . import main
from .forms import EditProfileForm, EditProfileAdminForm, PostForm
from .. import db
from ..paginations import Pag... | nonemaw/Flask_nonemaw | app/main/views.py | Python | mit | 13,717 |
import numpy as np
import pywt
from scipy.misc import imresize
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
X_L = 10
L = 14
N_BATCH = 50
OBS_SIZE = 30
# ---------------------------- helpers
def vectorize(coords):
retX, retY = np.zeros([L]... | evanthebouncy/nnhmm | mnist_haar/data.py | Python | mit | 2,672 |
from datetime import date
import pytest
from django.core.urlresolvers import reverse
from django.utils import translation
from ..views import Index, ByTag
from ..models import Content
from .factories import ContentFactory
pytestmark = pytest.mark.django_db
def test_anonymous_should_access_index_page(app):
ass... | Lcaracol/ideasbox.lan | ideasbox/blog/tests/test_views.py | Python | mit | 8,940 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright :
# (c) 2016 VMCloud Solution (http://vmcloudsolution.pe)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | vmcloudsolution/odoo-generico | pos_lock_screen/__openerp__.py | Python | agpl-3.0 | 1,520 |
import unittest
import sys
from base_test_class import BaseTestCase
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from group_test import ... | rackerlabs/django-DefectDojo | tests/product_type_group_test.py | Python | bsd-3-clause | 10,530 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# imgbase
#
# Copyright (C) 2014 Red Hat, 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 optio... | fabiand/imgbased | src/imgbased/plugins/layer.py | Python | gpl-2.0 | 2,481 |
#!/usr/bin/env python3
import os, os.path
import sys, shutil, subprocess
import urllib.request
import hashlib
import re
configure_args = sys.argv[1:]
host_arch = 'i686-w64-mingw32'
if configure_args[0] == '--64':
configure_args = configure_args[1:]
host_arch = 'x86_64-w64-mingw32'
# the path to the MPD sou... | jwise/musicpd | win32/build.py | Python | gpl-2.0 | 12,680 |
import vtk
"""
attempt to get images mapped to the same space, but it'ts not working.
"""
reader_path = "/home/ksansom/caseFiles/mri/VWI_proj/case2/vmtk/7_AX_3D_MRA_COW.mha"
reader = vtk.vtkMetaImageReader()
reader.SetFileName(reader_path)
reader.Update()
reader_path2 = "/home/ksansom/caseFiles/mri/VWI_proj/case2/... | kayarre/Tools | vtk/get_image_transform.py | Python | bsd-2-clause | 1,514 |
import argparse
import sys,os
#custom libraries
from mosealib import controller
from mosealib import enrichment
#Things to do:
#1. Include pfm matrix creator
def main():
#create a top-level parser
parser = argparse.ArgumentParser(description = "Runs motif scan & enrichment")
subparsers = parser.... | comprna/MoSEA | mosea.py | Python | isc | 5,249 |
# -*- coding:utf-8 -*-
from common import http
def get_conf(request):
builder = http.ResponseBuilder()
home = [{"nodeName":"服务列表","href":"#service","nodestyle":["level1"],"children":[]},
{"nodeName":"集群信息","href":"#cluster","nodestyle":["level1"],"children":[
{"nodeName":"集群状态","href":"#cluster/stat... | linyvxiang/galaxy | console/backend/src/console/conf/views.py | Python | bsd-3-clause | 863 |
from wex import regex as r
def test_regroup():
f = r.re_group('(\d+)') | list
assert f('a1 b23') == ['1', '23']
def test_regroup_iterable():
f = r.re_group('(\d+)') | list
assert f(['a1 b23']) == ['1', '23']
def test_regroup_nested_iterable():
f = r.re_group('(\d+)') | list
assert f([['a1 ... | gilessbrown/wextracto | tests/test_regex.py | Python | bsd-3-clause | 793 |
# https://graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation
def selector(values, setBits):
maxBits = len(values)
def select(v):
out = []
for i in range(maxBits):
if (v & (1 << i)):
out.append(values[i])
return out
v = (2 ** setBits) - 1
... | asgeir/old-school-projects | python/verkefni2/cpattern.py | Python | mit | 1,006 |
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | bouncestorage/swift | swift/common/middleware/slo.py | Python | apache-2.0 | 36,514 |
from openstatesapi.jurisdiction import make_jurisdiction
J = make_jurisdiction('la')
J.url = 'http://louisiana.gov'
| openstates/billy | billy2pupa/la.py | Python | bsd-3-clause | 117 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015-16, Ritesh Khadgaray <khadgaray () gmail.com>
# Copyright: (c) 2018, Ansible Project
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__... | pgmillon/ansible | lib/ansible/modules/cloud/vmware/vmware_vm_shell.py | Python | gpl-3.0 | 13,224 |
# xorn.geda - Python library for manipulating gEDA files
# Copyright (C) 1998-2010 Ales Hvezda
# Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
# Copyright (C) 2013-2017 Roland Lutz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | bert/geda-gaf | xorn/src/python/geda/plainread.py | Python | gpl-2.0 | 34,369 |
__author__ = 'alforro'
from django.conf.urls import patterns, url
from proyectos import views
from django.contrib.auth.decorators import login_required
urlpatterns = patterns('',
url(r'^$', login_required(views.IndexView.as_view()), name='lista_proyecto'),
url(r'^crear$', login_required(views.CreateProyecto.a... | alforro/sgpa2015 | proyectos/urls.py | Python | gpl-2.0 | 1,040 |
from django.shortcuts import render, render_to_response
from django.contrib import auth
from django.core.context_processors import csrf
from django.contrib.auth.decorators import login_required
from .models import Ticket, UserProfile, Order, TicketType, OrderType
from django.core.mail import send_mail
from django.templ... | abogeorge/simpleTicket | simpleTicket/siteEngine/views.py | Python | mit | 15,240 |
# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org
# Released to the public domain.
# Regenerate the Scintilla and SciTE source files that list
# all the lexers and all the properties files.
# Should be run whenever a new lexer is added or removed.
# Requires Python 2.4 or later
# Most files are regene... | downpoured/lnzscript | lnzscript/lnzeditor/app/scintilla/src/LexGen.py | Python | gpl-3.0 | 9,047 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... | stackforge/tacker | tacker/tests/etc/samples/etsi/nfv/user_data_sample_userdata_invalid_script/UserData/lcm_user_data_invalid_script.py | Python | apache-2.0 | 993 |
#!/usr/bin/env python2
import argparse
import os
from fedora_elections import APP
parser = argparse.ArgumentParser(description="Run the Fedora election app")
parser.add_argument(
"--config", "-c", dest="config", help="Configuration file to use for packages."
)
parser.add_argument(
"--debug",
dest="debug... | fedora-infra/elections | runserver.py | Python | gpl-2.0 | 1,753 |
# Copyright 2014 Netflix, 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... | gorcz/sketchy | config-test.py | Python | apache-2.0 | 1,838 |
"""
WSGI config for test_server_django_logging 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.setde... | dlparker/test_project_django_logging_dlp | test_server_django_logging/wsgi.py | Python | mit | 429 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/StreamLines/A3.py | Python | lgpl-2.1 | 1,528 |
import numpy as np
from timeit import default_timer as timer
from skimage.io import imsave
from shapely.geometry import Polygon
from PIL.Image import fromarray
from PIL.ImageDraw import ImageDraw
from sldc import Image, Segmenter
from sldc.builder import SSLWorkflowBuilder
class NumpyImage(Image):
def __init__(s... | waliens/sldc | benchmark/tile_size_poly_count.py | Python | mit | 4,493 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Christian Schwede <christian.schwede@enovance.com>
#
# 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... | cschwede/swift-metadataheaders | metadataheaders/middleware.py | Python | apache-2.0 | 2,723 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2004 Robert Kaye
# Copyright (C) 2006 Lukáš Lalinský
#
# 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; ... | mineo/picard | picard/cluster.py | Python | gpl-2.0 | 17,531 |
from django.shortcuts import render
def home_page(request):
return render(request, 'launchers/launcher_home_page.html')
| yurychu/business_manager | business_manager/launchers/views.py | Python | mit | 126 |
# Standard Library Imports
import collections
from datetime import datetime, timedelta
import logging
import time
import json
import traceback
# 3rd Party Imports
import requests
from requests.packages.urllib3.util.retry import Retry
from gevent.lock import Semaphore
# Local Imports
from PokeAlarm import Unknown
from P... | blsmit5728/PokeAlarm | PokeAlarm/LocationServices/GMaps.py | Python | agpl-3.0 | 11,432 |
import numpy as np
import json
with open('db/cpt.json', 'rb') as outfile:
procHier = json.load(outfile)
outfile.close()
with open('db/icd.json', 'rb') as outfile:
icdHier = json.load(outfile)
outfile.close()
icdMap=dict([(icdHier[x]['level2'],{'desc':icdHier[x]['desc'],'code':x}) for x in icdHier.ke... | mitliagkas/pyliakmon | getTopics.py | Python | mit | 2,508 |
""" Theano wrapper for your machine learning needs.
Available demos:
Classification:
1: Epoch-based Logistic Regression on the iris dataset.
2: Logistic Regression with Stohastic Gradient Descent
Regression:
1: Epoch-based Linear Regression on the boston housing dataset.
2: Linea... | sotlampr/theano-wrapper | theano_wrapper/demo.py | Python | mit | 16,526 |
"""
Stack based upon linked list
基于链表实现的栈
Author: Wenru
"""
from typing import Optional
class Node:
def __init__(self, data: int, next=None):
self._data = data
self._next = next
class LinkedStack:
"""A stack based upon singly-linked list.
"""
def __init__(se... | wangzheng0822/algo | python/08_stack/linked_stack.py | Python | apache-2.0 | 1,071 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio-Query-Parser.
# Copyright (C) 2014, 2015, 2016 CERN.
#
# Invenio-Query-Parser 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
# ... | tiborsimko/invenio-query-parser | invenio_query_parser/version.py | Python | gpl-2.0 | 1,335 |
# -*- coding: utf-8 -*-
"""
Photo Catalog v 1.0 (photocat)
Copyright (c) Karol Będkowski, 2004-2007
This file is part of Photo Catalog
"""
__author__ = 'Karol Będkowski'
__copyright__ = 'Copyright (C) Karol Będkowski 2006'
__revision__ = '$Id$'
import weakref
def create_weakref_proxy(obj):
if not obj or isinst... | KarolBedkowski/photocat | photocat/lib/hlpweakref.py | Python | gpl-2.0 | 426 |
from __future__ import absolute_import
import unittest
import time
from testutils import ADMIN_CLIENT, suppress_urllib3_warning
from testutils import TEARDOWN
from testutils import harbor_server
from library.user import User
from library.project import Project
from library.repository import Repository
from library.ba... | wy65701436/harbor | tests/apitests/python/test_garbage_collection.py | Python | apache-2.0 | 5,516 |
from google.appengine.ext import db
class Comment(db.Model):
content = db.TextProperty(required=True)
created = db.DateTimeProperty(auto_now_add=True)
last_modified = db.DateTimeProperty(auto_now=True)
user_id = db.IntegerProperty(required=True)
user_name = db.TextProperty(required=True) | mr-karan/Udacity-FullStack-ND004 | Project3/udacityblog-159515/models/comment.py | Python | mit | 309 |
#!/usr/bin/env python3
import os
import sys
import xml.dom
from xml.dom import minidom
# STRINGTABLE DIAG TOOL
# Author: KoffeinFlummi
# ---------------------
# Counts duplicates stringtable entries
def check_module(projectpath, module):
""" Checks the given module for all the different languages. """
loca... | MikeMatrix/ACE3 | tools/stringtableduplicates.py | Python | gpl-2.0 | 1,652 |
#
# Copyright (c) 2021 Project CHIP 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 applica... | project-chip/connectedhomeip | scripts/tests/chiptest/test_definition.py | Python | apache-2.0 | 8,373 |
# _*_ coding:utf-8 _*_
#-------------------------------------------------------------------------------
# Name: albonazionalegestoriambientali_it
# Purpose: Parse linked in given a list of companies and write users to a csv file
#
# Author: Ramakrishna
#
# Created: 21/Feb/2016
# Copyright: (c... | brkrishna/freelance | albonaziona/media_list.py | Python | gpl-2.0 | 3,510 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-26 17:06
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('splitbill', '0009_transaction_raw'),
]
operations ... | Breakthru/splitbills | splitbill/migrations/0010_auto_20161226_1706.py | Python | gpl-3.0 | 1,239 |
# -*- 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 field 'Profile.age_accompanying_children'
db.add_column('accounts_profile', 'age_accompanying_child... | EuroPython/djep | pyconde/accounts/migrations/0006_auto__add_field_profile_age_accompanying_children.py | Python | bsd-3-clause | 4,777 |
import os
from docutils import nodes, utils
def file_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""Role for files.
:file:`./path/to/moo` ->
text: ./path/to/moo (italicized + file icon)
:file:`./path/to/moo/` ->
text: ./path/to/moo/ (italicized + directory icon)
... | tony/django-docutils | django_docutils/lib/roles/file.py | Python | mit | 2,146 |
#Starts with a BOM
| github/codeql | python/ql/test/library-tests/encoding/utf8_bom.py | Python | mit | 22 |
#bolttools - a framework for creation of part libraries
#Copyright (C) 2013 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#versi... | jreinhardt/BOLTS | backends/exchange.py | Python | gpl-3.0 | 3,384 |
from nose.tools import assert_equal, assert_greater
from unittest.mock import patch
from ... import db
from ..sync import sync
from ..notice import send_notice
from ..backends.postgresql import PostgreSQL
from . import g
def send_notice_email(conf, target, notice):
assert_equal(target, 'answeror+foo@gmail.com')
... | Answeror/torabot | torabot/core/test/test_notice.py | Python | mit | 1,532 |
#
# 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... | nathanielvarona/airflow | airflow/providers/google/suite/hooks/drive.py | Python | apache-2.0 | 9,602 |
import ast
import json
import unicodedata
import base64
def elicit_intent(message, image_url, title):
return {
'dialogAction' : {
'type' : 'ElicitIntent',
'message' : message,
'responseCard' : {
'version' : 1,
'contentType' : 'application/vnd.amazonaws.car... | CodeOpsTechnologies/BookBot | get_publisher.py | Python | mit | 2,409 |
# Copyright 2018 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... | nburn42/tensorflow | tensorflow/python/grappler/hierarchical_controller.py | Python | apache-2.0 | 43,598 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
# (c) 2014, James Cammarata, <jcammarata@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 ... | nitzmahone/ansible | test/units/parsing/vault/test_vault_editor.py | Python | gpl-3.0 | 19,535 |
# -*- coding: utf8 -*-
from __future__ import print_function
import ast
import re
import warnings
import yaml # use yaml instead of json to get non unicode (works with ascii only data)
from rlp.utils import decode_hex, encode_hex
from ethereum import utils
from ethereum.utils import (
big_endian_to_int, ceil32,... | shahankhatch/pyethereum | ethereum/abi.py | Python | mit | 27,824 |
#!/usr/bin/env python
import sys
warnings = list()
try:
from setuptools import setup, Extension
except ImportError:
warnings.append("warning: using disutils.core.setup, cannot use \"develop\" option")
from disutils.core import setup, Extension
try:
from distutils.command.build_py import build_py_2to3... | t2abdulg/deap | setup.py | Python | lgpl-3.0 | 3,638 |
# Copyright 2018 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... | xzturn/tensorflow | tensorflow/tools/compatibility/ast_edits_test.py | Python | apache-2.0 | 23,745 |
# Copyright 2018-2021 Peppy Player peppy.player@gmail.com
#
# This file is part of Peppy Player.
#
# Peppy Player 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 you... | project-owner/Peppy | ui/navigator/timer.py | Python | gpl-3.0 | 1,465 |
"""
flp-benders.py: model for solving the capacitated facility location problem using Benders' decomposition
minimize the total (weighted) travel cost from n customers
to some facilities with fixed costs and capacities.
Copyright (c) by Joao Pedro PEDROSO and Mikio KUBO, 2012
"""
from pyscipopt import Model, quicksu... | SCIP-Interfaces/PySCIPOpt | tests/test_customizedbenders.py | Python | mit | 11,595 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-25 01:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Accoun... | maxwallasaurus/arboretum | authentication/migrations 08-40-23-458/0001_initial 08-45-26-265.py | Python | mit | 1,345 |
"""
#;+
#; NAME:
#; files
#; Version 1.0
#;
#; PURPOSE:
#; Module for file utilities
#; 10-Dec-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
f... | profxj/xastropy | xastropy/xutils/files.py | Python | bsd-3-clause | 597 |
from tools.load import LoadMatrix
from numpy import where
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
parameter_list=[[traindat,testdat, 1.5, 1.0],[traindat,testdat, 1.0, 1.5]]
def kernel_wavelet_modular (fm_train_real=traindat,fm_test... | ratschlab/ASP | examples/undocumented/python_modular/kernel_wavelet_modular.py | Python | gpl-2.0 | 840 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.