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 hortee.settings import *
| bne/hortee | hortee/production.py | Python | apache-2.0 | 31 | 0 |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
... | bgroff/kala-app | django_kala/organizations/views/new_organization.py | Python | mit | 1,353 | 0.002217 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/primaires/interpreteur/masque/noeuds/base_noeud.py | Python | bsd-3-clause | 2,736 | 0.000368 |
from web.backend.utils import loadPresetsList, transition2isolver, getAddressesToRead
from graph.graph_utils import vanillaTransitions, vanillaBossesTransitions, vanillaEscapeTransitions, GraphUtils
from logic.logic import Logic
from utils.version import displayedVersion
from gluon.html import OPTGROUP
class Plando(o... | theonlydude/RandomMetroidSolver | web/backend/plando.py | Python | mit | 2,305 | 0.003471 |
import logging
logger = logging.getLogger('sci-wms')
__version__ = '1.0.0'
| ayan-usgs/sci-wms | sciwms/__init__.py | Python | gpl-3.0 | 76 | 0 |
#!/usr/bin/env python3
"""
Copyright (c) 2015 Alan Yorinks All rights reserved.
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 versio... | MrYsLab/rb4s | redbot_accel.py | Python | gpl-3.0 | 18,018 | 0.003219 |
"""taskburster URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | danhuynhdev/taskbuster | taskbuster/urls.py | Python | mit | 1,187 | 0 |
# Copyright (C) 2011 Marie E. Rognes
#
# This file is part of DOLFIN.
#
# DOLFIN 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.... | maciekswat/dolfin_1.3.0 | test/documentation/test.py | Python | gpl-3.0 | 1,132 | 0 |
import unittest
from katas.kyu_6.compare_versions import compare_versions
class CompareVersionsTestCase(unittest.TestCase):
def test_true(self):
self.assertTrue(compare_versions('11', '10'))
def test_true_2(self):
self.assertTrue(compare_versions('11', '11'))
def test_true_3(self):
... | the-zebulan/CodeWars | tests/kyu_6_tests/test_compare_versions.py | Python | mit | 729 | 0 |
from django.db.models import CharField, Value
from django.db.models.functions import Length, LPad, RPad
from django.test import TestCase
from .models import Author
class PadTests(TestCase):
def test_pad(self):
Author.objects.create(name='John', alias='j')
tests = (
(LPad('name', 7, Va... | nesdis/djongo | tests/django_tests/tests/v21/tests/db_functions/test_pad.py | Python | agpl-3.0 | 1,830 | 0.00165 |
from six import iteritems, itervalues
from six.moves import range
from ..interfaces import ISnapshotable
from ..errors import AccessViolationError, InvalidResourceError
from ..util import align, sizeof_fmt, Flags
from ..snapshot import SnapshotNode
import enum
DEFAULT_MEMORY_SIZE = 0x1000000
# Types
from ctypes imp... | happz/ducky | ducky/mm/__init__.py | Python | mit | 24,453 | 0.010714 |
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU Lesser General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (LGPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# includin... | credativ/gofer | src/gofer/agent/manager.py | Python | lgpl-2.1 | 5,843 | 0 |
import os
from django.conf.urls import url
from . import views
from .earthquakes import viewsEarthquakes
from .weather import viewsWeather
from .gtfs import viewsGTFS
from django.http import HttpResponseRedirect
from .utils.utils import *
from django.db import connection
import simplekml
import time
import subprocess
... | navijo/FlOYBD | Django/mysite/floybd/urls.py | Python | mit | 10,036 | 0.005281 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import zipfile
from lxml import etree
import os
import uploader
from iso639 import languages as isoLanguages
def extractCover(zipFile, coverFile, coverpath, tmp_file_name):
if coverFile is None:
return None
else:
zipCoverPath = os.path.join(coverp... | ajurcevic/calibre-web | cps/epub.py | Python | gpl-3.0 | 4,225 | 0.003314 |
# -*- coding: utf-8 -*-
"""
Created on 26/11/15
@author: Carlos Eduardo Barbosa
Convert table with SSP parameters of MILES II from the original to the
appropriate format for the MCMC run.
"""
import os
import numpy as np
from config import *
if __name__ == "__main__":
os.chdir(os.path.join(home, "tables"))
... | kadubarbosa/hydra1 | miles2_table.py | Python | gpl-2.0 | 1,347 | 0.019302 |
"""
This file unregisters the admin class for each model specified in
ALPHAFILTER_ADMIN_FIELDS and replaces it with a new admin class that
subclasses both the original admin and one with an alphabet_filter attribute
"""
from django.db.models import get_model
from django.contrib import admin
from django.conf import s... | affan2/django-alphabetfilter | alphafilter/admin.py | Python | apache-2.0 | 788 | 0.003807 |
# ****************************************************************************
# Copyright 2018 The Apollo 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
#
# ht... | ycool/apollo | cyber/python/cyber_py/cyber.py | Python | apache-2.0 | 10,449 | 0.000383 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/Fortran/F03FILESUFFIXES.py | Python | mit | 4,014 | 0.001495 |
#!/usr/bin/python2.7
# Run this script as user: www-data
import os
import server_path
import squeakspace.server.db_sqlite3 as db
import config
try:
os.remove(config.db_path)
except OSError:
pass
conn = db.connect(config.db_path)
c = db.cursor(conn)
db.make_db(c, config.total_quota)
db.commit(conn)
db.close(c... | eek6/squeakspace | admin/init_server_db.py | Python | gpl-3.0 | 325 | 0 |
from pyramid.view import view_config
@view_config(route_name='url#index', request_method='GET', renderer='templates/url/index.pt')
def index(request):
return {}
@view_config(route_name='url#show', request_method='GET', renderer='templates/url/show.pt')
def show(request):
return {}
@view_config(route_name='ur... | antljones/saw | saw/views/url.py | Python | mit | 940 | 0.014894 |
# Copyright (c) The AcidSWF Project.
# See LICENSE.txt for details.
"""
Support for creating a service which runs a web server.
@since: 1.0
"""
import logging
from twisted.python import usage
from twisted.application import service
from acidswf.service import createAMFService
optParameters = [
['log-level', ... | thijstriemstra/acidswf | python/acidswf/application/amf.py | Python | gpl-3.0 | 1,733 | 0.004616 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | huangkuan/hack | lib/gcloud/monitoring/client.py | Python | apache-2.0 | 7,310 | 0 |
"""Test that anonymous structs/unions are transparent to member access"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class AnonymousTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(
compiler="ic... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/c/anonymous/TestAnonymous.py | Python | bsd-3-clause | 6,073 | 0.000988 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of co... | buildbot/supybot | test/test_ircmsgs.py | Python | bsd-3-clause | 10,535 | 0.001804 |
# -*- coding: utf-8 -*-
#
# 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
#... | sid88in/incubator-airflow | airflow/contrib/operators/gcp_compute_operator.py | Python | apache-2.0 | 7,129 | 0.001964 |
#!/usr/bin/python
# Copyright (c) 2014-2017 Ansible Project
# Copyright (c) 2017, 2018 Will Thames
# Copyright (c) 2017, 2018 Michael De La Rue
# 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__ = t... | anryko/ansible | lib/ansible/modules/cloud/amazon/rds_snapshot_info.py | Python | gpl-3.0 | 12,831 | 0.002416 |
'''
Build a simple neural machine translation model
'''
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import numpy
import copy
import os
import warnings
import sys
import time
from scipy import optimize, stats
from collections... | skaasj/dl4mt-material | session2/nmt.py | Python | bsd-3-clause | 39,416 | 0.007687 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hikaye', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='stories',
new_name='Sto... | oznurf/EKSI_HIKAYE | hikaye/migrations/0002_auto_20150819_1605.py | Python | mit | 342 | 0 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2015, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file COPYING.txt, distributed with this software.
Created on Jun 11, 2015
"""
import sys
from atom.atom import set_default
from atom.api import (
Callable,
Int,
Tuple,
... | frmdstryr/enamlx | enamlx/widgets/plot_area.py | Python | mit | 6,354 | 0.000158 |
# -*- coding:utf-8 -*-
################################################################################
#
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
################################################################################
'''
Created on 2015年3月14日
@author: Administrator
'''
import ... | onehao/opensource | pyml/crawler/minispider/test/SpiderHtmlParserTest.py | Python | apache-2.0 | 3,201 | 0.010016 |
"""
hapefile.py
Provides read and write support for ESRI Shapefiles.
author: jlawhead<at>geospatialpython.com
date: 20110927
version: 1.1.4
Compatible with Python versions 2.4-3.x
"""
from struct import pack, unpack, calcsize, error
import os
import sys
import time
import array
#
# Constants for shape types
NULL = 0
P... | janhui/test_engine | dev/plugins/define_boundary_ids/shapefile.py | Python | lgpl-2.1 | 38,004 | 0.005289 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# 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
ANSIBLE_METADATA = {'metadata_... | lmprice/ansible | lib/ansible/modules/network/aci/aci_access_port_to_interface_policy_leaf_profile.py | Python | gpl-3.0 | 11,226 | 0.002494 |
import convis
import numpy as np
import matplotlib.pylab as plt
plt.figure()
plt.imshow(convis.numerical_filters.gauss_filter_2d(4.0,4.0))
plt.figure()
plt.plot(convis.numerical_filters.exponential_filter_1d(tau=0.01)) | jahuth/convis | docs/filters-1.py | Python | gpl-3.0 | 218 | 0.009174 |
#!/usr/bin/env python
import lib_v2 as lib
import sys
import os
def main(argv=None):
"""
Usage is:
submit.py [--account <chargecode>] [--url <url>] -- <commandline>
Run from the working dir of the job which must contain (in addition
to the job files) a file named scheduler.conf with scheduler prop... | SciGaP/DEPRECATED-Cipres-Airavata-POC | saminda/cipres-airavata/sdk/scripts/remote_resource/trestles/submit_v2.py | Python | apache-2.0 | 5,478 | 0.011135 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | appleseedhq/gaffer | python/GafferUI/__init__.py | Python | bsd-3-clause | 12,297 | 0.024152 |
# Copyright 2015 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... | theflofly/tensorflow | tensorflow/python/ops/rnn.py | Python | apache-2.0 | 66,326 | 0.004568 |
from kivy.graphics import Color, Line, Quad
from modeful.ui.diagram.relationship import Trigonometry
from modeful.ui.diagram.relationship.association import Association
class Composition(Association):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
with self.canv... | Modeful/poc | modeful/ui/diagram/relationship/composition.py | Python | gpl-3.0 | 774 | 0.003876 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | andrefbsantos/Tuxemon | tuxemon/core/components/ui/__init__.py | Python | gpl-3.0 | 8,220 | 0.001825 |
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from mymoney.core.utils.currencies import get_currencies
class BankAccountManager(models.Manager):
def get_user_bankaccounts(self, user):
if not hasattr(... | ychab/mymoney | mymoney/apps/bankaccounts/models.py | Python | bsd-3-clause | 2,268 | 0 |
from cyder.cydns.views import CydnsDeleteView
from cyder.cydns.views import CydnsDetailView
from cyder.cydns.views import CydnsCreateView
from cyder.cydns.views import CydnsUpdateView
from cyder.cydns.views import CydnsListView
from cyder.cydns.cname.models import CNAME
from cyder.cydns.cname.forms import CNAMEForm
c... | ngokevin/cyder | cyder/cydns/cname/views.py | Python | bsd-3-clause | 808 | 0 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | appleseedhq/gaffer | python/GafferCortexUI/CompoundPlugValueWidget.py | Python | bsd-3-clause | 11,940 | 0.039698 |
from rest_framework.serializers import ModelSerializer
from ..models import BackScratcher
class ProductsSerializer(ModelSerializer):
class Meta:
model = BackScratcher
fields = ['id', 'name', 'description', 'price', 'sizes']
| agustin380/scratchbling | src/products/api/serializers.py | Python | gpl-3.0 | 247 | 0 |
from a10sdk.common.A10BaseClass import A10BaseClass
class AddressList(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ipv4_address: {"type": "string", "description": "IP address", "format": "ipv4-address"}
:param ipv4_netmask: {"type": "string", "description":... | amwelch/a10sdk-python | a10sdk/core/interface/interface_loopback_ip.py | Python | apache-2.0 | 2,191 | 0.008672 |
import saas_server
import res_config
| fevxie/odoo-saas-tools | saas_server/models/__init__.py | Python | lgpl-3.0 | 37 | 0 |
""" Compute HalsteadMetric Metrics.
HalsteadMetric metrics, created by Maurice H. HalsteadMetric in 1977, consist
of a number of measures, including:
Program length (N): N = N1 + N2
Program vocabulary (n): n = n1 + n2
Volume (V): V = N * LOG2(n)
Difficulty (D): D = (n1/2) * (N2/n2)
Effort (E... | ipmb/PyMetrics | PyMetrics/halstead.py | Python | gpl-2.0 | 10,366 | 0.016593 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-07-28 13:17
from __future__ import unicode_literals
from django.db import migrations
import ideascube.models
class Migration(migrations.Migration):
dependencies = [
('library', '0005_auto_20160712_1324'),
]
operations = [
migra... | ideascube/ideascube | ideascube/library/migrations/0006_auto_20160728_1317.py | Python | agpl-3.0 | 3,408 | 0 |
from sqlalchemy import Column, String, Integer
from BusTrack.repository import Base, session
from BusTrack.repository.models import STRING_LEN_SMALL
class UserType(Base):
__tablename__ = 'user_type'
id = Column(Integer, primary_key=True)
role_name = Column(String(STRING_LEN_SMALL))
@staticmethod
... | Rjtsahu/School-Bus-Tracking | BusTrack/repository/models/UserType.py | Python | gpl-3.0 | 743 | 0 |
import subprocess, threading
from subprocess import PIPE
class TimedSubProc (object):
def __init__(self, cmd):
self.cmd = cmd.split()
self.process = None
def run(self, timeout=5, stdin=None, stdout=PIPE, stderr=PIPE):
self.output = None
def target():
self.pr... | maxspad/MGrader | autograder/modules/questions/timedsubproc.py | Python | bsd-3-clause | 861 | 0.013937 |
# -*- coding: utf-8 -*-
"""
Various utilities
Authors: Ed Rousseau <rousseau@redhat.com>, Zack Cerza <zcerza@redhat.com, David Malcolm <dmalcolm@redhat.com>
"""
__author__ = """Ed Rousseau <rousseau@redhat.com>,
Zack Cerza <zcerza@redhat.com,
David Malcolm <dmalcolm@redhat.com>
"""
import os
import sys
import subpro... | Lorquas/dogtail | dogtail/utils.py | Python | gpl-2.0 | 14,664 | 0.002523 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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... | bluemini/kuma | vendor/packages/translate/lang/my.py | Python | mpl-2.0 | 1,082 | 0 |
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from answer import Answer
from base import Base
class Question(Base):
__tablename__ = 'question'
id = Column(Integer, primary_key=True)
question = Column(String(256))
answers = relationship('Answer', bac... | ZhuChara2004/MA-Summer-Practice-2016 | homeworks/team-2/prof-test/backend/models/question.py | Python | gpl-3.0 | 438 | 0.004566 |
###########################################################################
# Concurrent WSGI server - webserver3h.py #
# #
# Tested with Python 2.7.9 on Ubuntu 14.04 & Mac OS X #
################... | hamishcunningham/fishy-wifi | wegrow-cloudside/elf-data-collector/webserver4/server-again.py | Python | agpl-3.0 | 6,539 | 0.001682 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="serverless-wsgi",
version="3.0.0",
python_requires=">3.6",
author="Logan Raarup",
author_email="logan@logan.dk",
description="Amazon AWS API Gateway WSGI wrapper",
long_description... | logandk/serverless-wsgi | setup.py | Python | mit | 867 | 0.001153 |
# Copyright (c) 2012 Adam Stokes <adam.stokes@canonical.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 Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This pro... | lmiccini/sos | sos/plugins/dpkg.py | Python | gpl-2.0 | 1,590 | 0 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | JPO1/python-docs-samples | appengine/ndb/modeling/relation_model_models_test.py | Python | apache-2.0 | 2,299 | 0 |
#!/usr/bin/env python
# coding=utf-8
# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2017, A... | danielbair/aeneas | aeneas/validator.py | Python | agpl-3.0 | 28,502 | 0.001193 |
# Copyright (c) 2013 Calin Crisan
# This file is part of motionEye.
#
# motionEye 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.
#
#... | ccrisan/motioneye | motioneye/diskctl.py | Python | gpl-3.0 | 7,702 | 0.006492 |
from ._compat import PY2, filename_to_ui, get_text_stderr
from .utils import echo
class ClickException(Exception):
"""An exception that Click can handle and show to the user."""
#: The exit code for this exception
exit_code = 1
def __init__(self, message):
if PY2:
if message is n... | sourlows/rating-cruncher | src/lib/click/exceptions.py | Python | apache-2.0 | 6,390 | 0.000156 |
from django.contrib.auth.models import AbstractUser
from django.db.models import CharField
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
class User(AbstractUser):
# First Name and Last Name do not cover name patterns
# around the globe.
name = CharField(_("Name o... | mistalaba/cookiecutter-django | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/models.py | Python | bsd-3-clause | 466 | 0 |
#! /usr/bin/python
'''
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the total sum of all root-to-leaf numbers.
For example,
1
/ \
2 3
The root-to-leaf path 1->2 represen... | shub0/algorithm-data-structure | python/sum_roof_to_leaf.py | Python | bsd-3-clause | 1,428 | 0.002101 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 applicabl... | gabriel-samfira/jrunner | jrunner/jobqueue/workers/__init__.py | Python | apache-2.0 | 1,084 | 0 |
"""
Django settings for mysite2 project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... | wasit7/PythonDay | django/mysite2/mysite2/settings.py | Python | bsd-3-clause | 3,183 | 0.001257 |
# -*- coding: utf-8 -*-
"""Converts an IRI to a URI."""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright 2006, Joe Gregorio"
__contributors__ = []
__version__ = "1.0.0"
__license__ = "MIT"
import urllib.parse
# Convert an IRI to a URI following the rules in RFC 3987
#
# The characters we n... | endlessm/chromium-browser | tools/swarming_client/third_party/httplib2/python3/httplib2/iri2uri.py | Python | bsd-3-clause | 4,153 | 0.000963 |
from django.contrib import admin
from .models import Gallery, Photo
class PhotoInline(admin.StackedInline):
model = Photo
extra = 1
class GalleryAdmin(admin.ModelAdmin):
inlines = [PhotoInline]
admin.site.register(Gallery, GalleryAdmin)
| gygcnc/gygcnc | gygcnc/image_gallery/admin.py | Python | bsd-3-clause | 255 | 0.003922 |
import os
import platform
import subprocess
class SoundPlayer:
"""Simple audio file player, invokes afplay on macs, mpg123 otherwise."""
def __init__(self):
self.basedir = os.path.dirname(__file__)
self.sounds = {
'startup': 'run.mp3',
'shutdown': 'quit.mp3',
... | tmc/mutter | mutter/notifiers.py | Python | bsd-2-clause | 1,358 | 0.003682 |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
ExtractorError,
float_or_none,
int_or_none,
parse_iso8601,
strip_or_none,
)
class ToggleIE(InfoExtractor):
IE_NAME = 'toggle'
_VALID_UR... | rg3/youtube-dl | youtube_dl/extractor/toggle.py | Python | unlicense | 8,970 | 0.0019 |
#
# 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... | Acehaidrey/incubator-airflow | tests/providers/amazon/aws/operators/test_s3_delete_objects.py | Python | apache-2.0 | 3,825 | 0.003137 |
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
| piratecb/up1and | app/main/__init__.py | Python | mit | 98 | 0.010204 |
from io import BytesIO
class PreDownload(BytesIO):
def __init__(self, initial_bytes, url):
super(PreDownload, self).__init__(initial_bytes)
if not url:
raise ValueError('url must be provided')
self.url = url
| JohnVinyard/zounds | zounds/datasets/predownload.py | Python | mit | 250 | 0 |
from flask import Flask, request, redirect, url_for
app = Flask(__name__)
logged_in = False
LOGIN_TEMPLATE = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="POST" action="">
<input type="text" name="username">
<input type="password" name="... | altnight/individual-sandbox | diary/20171022/sample/auth_sample/server.py | Python | apache-2.0 | 1,243 | 0.006436 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'options_dialog_base.ui'
#
# Created: Mon Feb 17 11:50:09 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
e... | assefay/inasafe | safe_qgis/ui/options_dialog_base.py | Python | gpl-3.0 | 23,148 | 0.003629 |
import codecs
import os.path
import sys
import setuptools
# READ README.md for long description on PyPi.
try:
long_description = open("README.md", encoding="utf-8").read()
except Exception as e:
sys.stderr.write(f"Failed to read README.md:\n {e}\n")
sys.stderr.flush()
long_description = ""
# Get th... | blackjax-devs/blackjax | setup.py | Python | apache-2.0 | 1,650 | 0.000606 |
import collections
import itertools
import sys
def count_homopolymers( fh ):
s = []
print "building..."
for line in fh:
if line.startswith( '>' ):
continue
s.append( line.strip() )
print "counting..."
runs = collections.defaultdict(int)
best = collections.defaultdict(int)
last = None
fo... | supernifty/mgsa | mgsa/count_homopolymers.py | Python | mit | 550 | 0.038182 |
from sympy import (pi, sin, cos, Symbol, Integral, summation, sqrt, log,
oo, LambertW, I, meijerg, exp_polar, Max)
from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line,
plot3d, plot3d_parametric_surface)
from sympy.plotting.plot import unset_show
from ... | sahilshekhawat/sympy | sympy/plotting/tests/test_plot.py | Python | bsd-3-clause | 8,460 | 0.002719 |
from common.constants import gameModes
from pp import ez
from pp import wifipiano3
from pp import cicciobello
PP_CALCULATORS = {
gameModes.STD: ez.Ez,
gameModes.TAIKO: ez.Ez,
gameModes.CTB: cicciobello.Cicciobello,
gameModes.MANIA: wifipiano3.WiFiPiano
}
| osuripple/lets | pp/__init__.py | Python | agpl-3.0 | 272 | 0 |
from compiler.compiler import LambdaCompiler
def main():
f = open('input.txt', 'r')
compiler = LambdaCompiler(f)
compiler.perform('output.py')
if __name__ == "__main__":
main()
| felipewaku/compiladores-p2 | lambda_compiler/__main__.py | Python | mit | 195 | 0.010256 |
import re
from django.conf import settings
from tincan import (
Activity,
ActivityDefinition,
LanguageMap
)
from xapi.patterns.base import BasePattern
from xapi.patterns.eco_verbs import (
LearnerCreatesWikiPageVerb,
LearnerEditsWikiPageVerb
)
class BaseWikiRule(BasePattern): # pylint: disable=ab... | marcore/pok-eco | xapi/patterns/manage_wiki.py | Python | agpl-3.0 | 1,746 | 0.001145 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Animation'
db.create_table(u'aldryn_wow_animation', (
... | narayanaditya95/aldryn-wow | aldryn_wow/south_migrations/0001_initial.py | Python | bsd-3-clause | 5,058 | 0.007513 |
from rest_framework import serializers
from ..upload_handling.serializers import ArticleImageSerializer
class ArticleSerializer(serializers.Serializer):
main_title = serializers.CharField(max_length=255)
sub_title = serializers.CharField(max_length=255)
author = serializers.CharField(max_length=255)
i... | REBradley/WineArb | winearb/articles/serializers.py | Python | bsd-3-clause | 435 | 0.002299 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/gan/python/features/python/spectral_normalization_impl.py | Python | apache-2.0 | 12,318 | 0.003491 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pygmo(CMakePackage):
"""Parallel Global Multiobjective Optimizer (and its Python alter ego... | LLNL/spack | var/spack/repos/builtin/packages/pygmo/package.py | Python | lgpl-2.1 | 1,202 | 0.002496 |
from app import constants
from flask_babel import lazy_gettext as _
from flask_wtf import FlaskForm
from flask_wtf.file import FileField
from wtforms import StringField, SelectField, DateField
from wtforms.validators import InputRequired, Optional
from app.models.examination import test_type_default
class CourseForm... | viaict/viaduct | app/forms/examination.py | Python | mit | 1,224 | 0 |
"""
Registers signal handlers at startup.
"""
# pylint: disable=unused-import
import openedx.core.djangoapps.monitoring.exceptions
| synergeticsedx/deployment-wipro | openedx/core/djangoapps/monitoring/startup.py | Python | agpl-3.0 | 131 | 0 |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Command to start up the Docker plugin.
"""
from os import umask
from stat import S_IRUSR, S_IWUSR, S_IXUSR
from twisted.python.usage import Options
from twisted.internet.endpoints import serverFromString
from twisted.application.internet import StreamServe... | hackday-profilers/flocker | flocker/dockerplugin/_script.py | Python | apache-2.0 | 3,412 | 0 |
#!/usr/bin/env python
'''
Main entry to worch from a waf wscript file.
Use the following in the options(), configure() and build() waf wscript methods:
ctx.load('orch.tools', tooldir='.')
'''
def options(opt):
opt.add_option('--orch-config', action = 'store', default = 'orch.cfg',
help='G... | hwaf/hwaf | py-hwaftools/orch/tools.py | Python | bsd-3-clause | 7,185 | 0.010717 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 13:35:59 2017
@author: mkammoun.lct
"""
import numpy as np
import matplotlib.pyplot as pl
from bisect import bisect
import math
n=200
n2=10000
def per(theta,n):
perm=[]
for i in range(1,n+1):
if np.random.binomial(1,theta/(float(th... | kammmoun/PFE | codes/Ewens&uniform+RSK_rho_1.py | Python | apache-2.0 | 2,011 | 0.03083 |
import datetime
import os
from unittest import mock
import pytest
from nanogen import models
example_post = """\
# Test Post
And this is my _markdown_ **content**.
Look, it also has:
* an
* unordered
* list
"""
example_config = """\
[site]
author = Example user
email = user@example.com
description = A test desc... | epochblue/nanogen | tests/test_models.py | Python | mit | 10,406 | 0.001057 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Adrien Vergé
#
# 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 pro... | adrienverge/yamllint | tests/test_yamllint_directives.py | Python | gpl-3.0 | 17,973 | 0 |
"""
Module to handle distortions in diffraction patterns.
"""
import numpy as np
import scipy.optimize
def filter_ring(points, center, rminmax):
"""Filter points to be in a certain radial distance range from center.
Parameters
----------
points : np.ndarray
Candidate points.
... | ercius/openNCEM | ncempy/algo/distortion.py | Python | gpl-3.0 | 8,278 | 0.010993 |
from db import get_engines,get_sessions,Song,Track,Note
from iter import TimeIterator
from utils import Counter
from sqlalchemy.orm import sessionmaker
from preference_rules import *
import music21,sys
from optparse import OptionParser
from multiprocessing import Process,Queue
class ChordSpan(object):
"""
A ... | jasonsbrooks/ARTIST | src/artist_generator/analyze/chords.py | Python | mit | 10,666 | 0.008063 |
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | EmanueleCannizzaro/scons | src/engine/SCons/Tool/MSCommon/sdk.py | Python | mit | 14,245 | 0.00702 |
from . import common
import os
import hglib
class test_paths(common.basetest):
def test_basic(self):
f = open('.hg/hgrc', 'a')
f.write('[paths]\nfoo = bar\n')
f.close()
# hgrc isn't watched for changes yet, have to reopen
self.client = hglib.open()
paths = self.clie... | beckjake/python3-hglib | tests/test-paths.py | Python | mit | 512 | 0.001953 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | crmccreary/openerp_server | openerp/addons/document_ftp/wizard/ftp_browse.py | Python | agpl-3.0 | 2,556 | 0.004304 |
# this one is like your scripts with argv
def print_two(*args):
arg1,arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
# this just takes one arguments
def print_one(arg1):... | Cloudlie/pythonlearning | ex18.py | Python | mit | 514 | 0.015564 |
def extractCnoveltranslationsCom(item):
'''
Parser for 'cnoveltranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('what if my brother is too good?', 'What if My Brother is Too... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractCnoveltranslationsCom.py | Python | bsd-3-clause | 784 | 0.026786 |
#!/home/dante/Projects/free-art/venv/bin/python3
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# the image into a set of til... | DanteOnline/free-art | venv/bin/painter.py | Python | gpl-3.0 | 2,138 | 0.000935 |
from django.core.management.base import BaseCommand
from faceDB.face_db import FaceDB
from faceDB.face import FaceCluster
from faceDB.util import * # only required for saving cluster images
from carnie_helper import RudeCarnie
from query.models import *
import random
import json
class Command(BaseCommand):
help ... | MattPerron/esper | esper/query/management/commands/gender_tracks.py | Python | apache-2.0 | 2,055 | 0.001946 |
import unittest
import testRObject
import testVector
import testArray
import testDataFrame
import testFormula
import testFunction
import testEnvironment
import testRobjects
import testMethods
import testPackages
import testHelp
import testLanguage
# wrap this nicely so a warning is issued if no numpy present
import t... | welltempered/rpy2-heroku | rpy/robjects/tests/__init__.py | Python | gpl-2.0 | 1,832 | 0.003821 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.utils import formats, dateparse, timezone
from .models import Period, Traineeship, Student
from django.core.exceptions import ValidationError
from datetime import datetime, d... | Lapin-Blanc/AS_STAGES | django_calendar/views.py | Python | mit | 8,052 | 0.007211 |
#!/usr/bin/env python
# Copyright 2015 Stanford University
#
# 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 applicabl... | SKA-ScienceDataProcessor/legion-sdp-clone | language/travis.py | Python | apache-2.0 | 2,295 | 0.004793 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.