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 |
|---|---|---|---|---|---|
'''
Cara membaca kode Python? Ngurut aja. Dari atas ke bawah. :)
'''
import string
print "Halo.. ini modul utama aplikasi"
print "Menghitung rumus luas segitiga ya : (alas*tinggi)/2"
alas = 30
tinggi = 40
luas = (alas * tinggi) / 2
print string.join(["Maka luasnya adalah ",`luas`])
| swdevbali/belajar_python | ajaib.py | Python | gpl-2.0 | 285 |
from main import ShtoomMainWindow
| braams/shtoom | shtoom/ui/qtui/__init__.py | Python | lgpl-2.1 | 34 |
__author__ = 'davide'
def ex6(n):
f1 = (n * (n + 1) / 2) ** 2
f2 = sum(i ** 2 for i in range(n + 1))
return f1 - f2
if __name__ == "__main__":
print(ex6(100)) | DavideCanton/Python3 | euler/ex6.py | Python | gpl-3.0 | 178 |
#!/usr/bin/python
# Usage: list_to_make_var.py <input file (mod list)> <output file 1(build script)> <output file 2(clean script)> <OS>
# argv: argv[0] argv[1] argv[2] argv[3] argv[4]
#
# Include library
#
import os
import sys
def OpenF... | flake123p/ProjectH | Make/PY02_dump_dependent_tree/mod6/list_to_build_script.py | Python | gpl-3.0 | 1,336 |
from __future__ import unicode_literals
import csv
import six
from django.core.files.temp import NamedTemporaryFile
from openpyxl import Workbook
from openpyxl.writer.write_only import WriteOnlyCell
class TableExporter(object):
"""
Class that abstracts out writing a table of data to a CSV or Excel file. Thi... | tsotetsi/textily-web | temba/utils/exporter.py | Python | agpl-3.0 | 2,852 |
#!/usr/bin/env python
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/remarketing/upload_store_sales_transactions.py | Python | apache-2.0 | 30,022 |
import copy
"""
The description of the algorithm used in the program
"""
# Simple queue implementation
class queue:
def __init__(self):
self.queue = []
def enqueue(self, elem):
self.queue.append(elem)
def dequeue(self):
if not len(self.queue):
raise ValueError('Que... | edosedgar/xs-pkg | algoCourse/hw2/solution.py | Python | gpl-2.0 | 2,738 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, 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 _
from shoop.admin.ba... | akx/shoop | shoop/addons/admin_module/__init__.py | Python | agpl-3.0 | 1,677 |
# coding=utf-8
###########################################################################
# Name: SettingsWizard
# Author: Alan Jackson
# Date: 4th April 2009
#
# Settings wizard for the Linux/OS X based launcher
# for the game Lord of the Rings Online
#
# Based on a script by SNy <SNy@bmx-chemnitz.de>
# Python po... | nwestfal/pylotro | PyLotROLauncher/SettingsWizard.py | Python | gpl-3.0 | 7,771 |
output = 0
for i in range(3):
output += 1
print output
| orende/intro-till-python | ex2b.py | Python | mit | 68 |
# -*- coding:utf-8 -*-
"""
flask_cas.cas_urls
Functions for creating urls to access CAS.
"""
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import urlencode
from six.moves.urllib.parse import urljoin
def create_url(base, path=None, *query):
""" Create a url.
Creates a url by combining... | pycook/cmdb | cmdb-api/api/flask_cas/cas_urls.py | Python | gpl-2.0 | 3,593 |
from dudu.buz import promotion
from dudu.buz import transactions
from dudu.buz import starbuzz
from dudu.buz.transactions import save_transactions
items=["DONUT:$1","LATTE:$2","FILTER:$4","MUFFIN:$3"]
prices=[1.00, 2.00, 4.00, 3.00]
running=True
while running:
option=1
for choice in items:
print(str(o... | vollov/python-test | dudu/buz/cafe_pos.py | Python | mit | 1,176 |
import cv2 as cv
import argparse
import numpy as np
parser = argparse.ArgumentParser(
description='This sample shows how to define custom OpenCV deep learning layers in Python. '
'Holistically-Nested Edge Detection (https://arxiv.org/abs/1504.06375) neural network '
'is ... | sankit1/cv-tricks.com | OpenCV/Edge_detection/edge.py | Python | mit | 3,392 |
# 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... | kobejean/tensorflow | tensorflow/contrib/tensorrt/test/const_broadcast_test.py | Python | apache-2.0 | 3,077 |
# Copyright 2014-2016 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | bjackman/workload-automation | wlauto/workloads/googlephotos/__init__.py | Python | apache-2.0 | 4,661 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from StringIO import StringIO
from lxml import etree
from balbec.xmlhandler import XmlHandler
class HtmlHandler(XmlHandler):
def __init__(self, documentRoot):
XmlHandler.__init__(self, documentRoot)
def readUrlPrefix(self):
configFi... | mkulke/balbec | src/htmlhandler.py | Python | agpl-3.0 | 1,132 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import numpy as np
from fancytools.os.PathStr import PathStr
from imgProcessor.imgIO import imread
from imgProcessor.equations.gaussian import gaussian
class FitHistogramPeaks(object):
'''
try to fit the... | radjkarl/imgProcessor | imgProcessor/measure/FitHistogramPeaks.py | Python | gpl-3.0 | 8,992 |
# minimum lifespan of a committee (in days)
MIN_LIFESPAN = 1
| codeforanchorage/collective-development | app/mod_dan/constants.py | Python | mit | 61 |
from sys import argv
import os
def splitSDF( inFilename, splitSize):
with open( inFilename) as inF:
numMols = 1
chunkNum = 0
location = inFilename.split("/")[:-1]
location = "/".join(location)+"/"
reducedFilename = inFilename.split("/")[-1]
reducedFilename = reducedFilename.split(".")[0]
foldername = ... | ndaniels/Ammolite | scripts/splitSDF.py | Python | gpl-2.0 | 885 |
# Copyright 2013 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 a... | subramani95/neutron | neutron/plugins/vmware/common/sync.py | Python | apache-2.0 | 30,109 |
#
# Copyright (C) 2017 Dominik Murzynowski
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
from unittest.mock import patch
from pycnic.errors import HTTP_400, HTTP_404
from api.entity_type import EntityTypeHandler
from api.meta_attribute imp... | qiubit/luminis | backend/tests/test_api_object_posts.py | Python | mit | 10,120 |
# -*- coding: utf-8 -*-
"""Script to compact all Brython scripts in a single one."""
import time
import datetime
import os
import re
import sys
import tarfile
import zipfile
import shutil
import javascript_minifier
from version import version, implementation
if sys.version_info[0] != 3:
raise ValueError("This s... | kikocorreoso/brython | scripts/make_dist.py | Python | bsd-3-clause | 7,307 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('calendars', '0004_auto_20150718_1529'),
]
operations = [
migrations.AlterField(
model_name='event',
... | Fisiu/calendar-oswiecim | webapp/calendars/migrations/0005_auto_20150718_1537.py | Python | agpl-3.0 | 451 |
#Copyright ReportLab Europe Ltd. 2000-2012
#this test and associates functionality kinds donated by Ian Sparks.
#see license.txt for license details
"""
Tests for internal links and destinations
"""
__version__='''$Id$'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOu... | MatthewWilkes/reportlab | tests/test_pdfgen_links.py | Python | bsd-3-clause | 6,777 |
# pylint: disable=g-bad-file-header
# Copyright 2016 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/LICENS... | jeffzheng1/tensorflow | tensorflow/python/training/monitored_session_test.py | Python | apache-2.0 | 37,076 |
from unittest import mock
from aiohttp import web
from aiohttp.web_urldispatcher import View
async def test_render_ok():
resp = web.Response(text='OK')
class MyView(View):
async def get(self):
return resp
request = mock.Mock()
request._method = 'GET'
resp2 = await MyView(req... | singulared/aiohttp | tests/test_py35/test_cbv35.py | Python | apache-2.0 | 351 |
import os
import fcntl
import errno
import littlevent.error
import littlevent.close
import littlevent.loop
class FileDescriptor (littlevent.close.Obj):
def __init__ (self, loop, fd_num, close_it, error_handler):
self.fd_num = fd_num
self.close_it = close_it
self.error_handler = error_handle... | fixator/aprinter | host_stuff/littlevent/fd_io.py | Python | bsd-2-clause | 3,880 |
# 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 PyPyspellchecker(PythonPackage):
"""Pure python spell checker based on work by Peter Norvi... | LLNL/spack | var/spack/repos/builtin/packages/py-pyspellchecker/package.py | Python | lgpl-2.1 | 644 |
"""
Support for IP Webcam settings.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.android_ip_webcam/
"""
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.android_ip_webcam import (
KEY_MAP, ICON_MAP, DAT... | tinloaf/home-assistant | homeassistant/components/switch/android_ip_webcam.py | Python | apache-2.0 | 2,983 |
# Copyright 2022 The Magenta 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 ... | magenta/magenta | magenta/models/svg_vae/svg_utils.py | Python | apache-2.0 | 23,915 |
#!/usr/bin/env python
# Test Harness to test the Game Controller Functionality
#
import requests # https://github.com/kennethreitz/requests/
import time
import random
import os
# Global Variables
controller_endpoint = os.environ['GC_ENDPOINT']
#Replace this variables as appropriate
server_url = 'http://' + contro... | emccode/hackathon-mars | game-controller/tests/game-controller-harness.py | Python | mit | 8,214 |
# -*- coding: utf-8 -*-
'''
#------------------------------------------------------------------------------
# Name: moment_matrix.py
# Purpose: This file contains functions for creating the moment matrix
# introduced in [1].
#
# Author: Vincent Russo (vrusso@cs.uwaterloo.ca)
#
# Referenc... | vprusso/npa_nonlocal | npa_nonlocal/moment_matrix.py | Python | gpl-2.0 | 25,282 |
#!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | coxmediagroup/googleads-python-lib | examples/dfp/v201505/content_metadata_key_hierarchy_service/update_content_metadata_key_hierarchies.py | Python | apache-2.0 | 3,872 |
# Copyright © 2018 Tom Most <twm@freecog.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dist... | twm/yarrharr | yarrharr/migrations/0007_article_raw_title_backfill.py | Python | gpl-3.0 | 1,862 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# jsonrpc - jsonrpc interface for XBMC-compatible remotes
# -----------------------------------------------------------------------
# $Id$
#
# JSONRPC and XBMC eventserver to be used for XBMC-compatible
# remotes. Onl... | freevo/freevo2 | src/plugins/jsonrpc/__init__.py | Python | gpl-2.0 | 8,340 |
"""Support for BME680 Sensor over SMBus."""
import logging
import threading
from time import sleep, time
import bme680 # pylint: disable=import-error
from smbus import SMBus # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const i... | leppa/home-assistant | homeassistant/components/bme680/sensor.py | Python | apache-2.0 | 13,364 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
import six
from armet import http
import flask
from flask.globals import current_app
from werkzeug.wsgi import get_current_url
class RequestHeaders(http.request.Headers):
def __init__(self, handle):
#! Reference to... | armet/python-armet | armet/connectors/flask/http.py | Python | mit | 4,454 |
#!/usr/bin/env python
# flake8: noqa: E501
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public Licens... | leandrotoledo/python-telegram-bot | telegram/passport/encryptedpassportelement.py | Python | lgpl-3.0 | 12,172 |
import asyncio
from asyncio.futures import Future
import json
import email.utils
import sys
import re
import random
from datetime import (
datetime,
timedelta,
)
from hashlib import md5
from ..handlers import WebSocketHandler
class Handler(object):
initiates_session = False
allowed_methods = ('GET',)... | vkryachko/Vase | vase/sockjs/handlers.py | Python | bsd-2-clause | 20,773 |
# -*- coding: utf-8 -*-
import curses, time
class Visualisation(object):
"""
Basic visualisation of the world map, powered by curses.
"""
def __init__(self, worldMap):
self.size = worldMap.height
self.worldMap = worldMap
curses.initscr()
self.win = curses.newwin(0, 0... | eyeswideopen/beastArena | Visualisation.py | Python | gpl-3.0 | 874 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jianajavier/pnc-cli | pnc_cli/swagger_client/models/user.py | Python | apache-2.0 | 6,614 |
class Solution(object):
def solveNQueens(self, n):
"""
:type n: int
:rtype: List[List[str]]
"""
def search(cur):
if cur == n:
add_answer()
else:
for i in range(n):
ok = True
rows[... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/51_N-Queens.py | Python | mit | 1,340 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
try:
import cPickle as pickle
except ImportError:
import pickle
from collections import OrderedDict
from functools import reduce
from itertools import product
from operator import add
import os
imp... | chemreac/chemreac | chemreac/tests/test_integrate.py | Python | bsd-2-clause | 12,589 |
# -*- coding: utf-8 -*-
# © 2015 Ainara Galdona - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "MRP Repair Analytic",
"version": "8.0.2.2.0",
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"license": "A... | odoomrp/odoomrp-wip | mrp_repair_analytic/__openerp__.py | Python | agpl-3.0 | 1,132 |
from django.template.loaders.app_directories import Loader \
as AppDirectoriesLoader
from .loader_utils import get_template_dirs
try:
from django.template.loaders.app_directories import app_template_dirs
except ImportError:
from django.template.utils import get_app_template_dirs
app_template_dirs = get... | RevSquare/django-adaptive | django_adaptive/app_directories.py | Python | bsd-3-clause | 668 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ['DJANGO_SETTINGS_MODULE'] = 'lino_book.projects.chooser.settings'
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lino-framework/book | lino_book/projects/chooser/manage.py | Python | bsd-2-clause | 256 |
# Copyright 2016 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... | wangyum/tensorflow | tensorflow/contrib/learn/python/learn/utils/saved_model_export_utils.py | Python | apache-2.0 | 17,583 |
#!/usr/local/bin/python
# -*-coding: UTF-8
"""
This is a Library for creating WRL file.
This WRL module give the filepointer of output file.
This has color class include the red, green and blue values.
Copylight Masato MASUDA. 2017.23.Aug.
"""
import numpy as np
import math
#import SOM
class color:
def __init__(se... | kinect110/RPSOM | src/SOM/WRL.py | Python | mit | 17,107 |
import urllib
import warnings
from django.conf import settings
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404
from django.views import generic
from wordpress.models import Post, Term, User
PER_PAGE = getattr(settings, 'WP_PER_PAGE', 10)
TAXONOMIES = {
'term':... | sunlightlabs/django-wordpress | wordpress/views.py | Python | bsd-3-clause | 6,165 |
"""Common functions and classes for AutoCMS components."""
__version__ = '3.0.4'
import re
import os
import cPickle as pickle
class JobRecord(object):
"""Complete information about a specific AutoCMS test job.
A JobRecord may store arbitrarily many properties about a completed job
depending on how the ... | appeltel/AutoCMS | autocms/core.py | Python | mit | 8,531 |
#! /usr/bin/env python
# ______________________________________________________________________
'''
Test type mapping.
'''
# ______________________________________________________________________
import numba
from numba import *
from numba.decorators import numba_compile
import unittest
# ___________________________... | teoliphant/numba | tests/test_types.py | Python | bsd-2-clause | 1,338 |
# Calliope
# Copyright (C) 2016,2018 Sam Thursfield <sam@afuera.me.uk>
#
# 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... | ssssam/calliope | calliope/__init__.py | Python | gpl-2.0 | 3,512 |
import base64
import os
import os.path
import uuid
CONSUL_ACL = {
"service": {
# We don't rely on Consul to have a secure notion of
# what service belongs where, so we're fine with any
# consul node being able to write to the services.
"": {"policy": "write"},
},
}
def _secure... | dstufft/psf-salt | salt/_extensions/pillar/consul.py | Python | mit | 4,157 |
import random
import math
class CreateTestParameters(object):
def __init__(self):
self.broker()
self.buffer_test()
self.buystop_percentage()
self.diversify()
self.duration()
self.hold()
self.margin()
self.positions() # Calculate before quantity()
... | StepsTeam/mastermind | djmm/api/parameters.py | Python | mit | 5,670 |
# Copyright (c) 2015, Warren Weckesser. All rights reserved.
# This software is licensed according to the "BSD 2-clause" license.
from __future__ import print_function
from setuptools import setup
from os import path
def get_heatmapcluster_version():
"""
Find the value assigned to __version__ in heatmapclu... | WarrenWeckesser/heatmapcluster | setup.py | Python | bsd-2-clause | 1,668 |
# Copyright 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 law ... | adelina-t/nova | nova/cmd/cert.py | Python | apache-2.0 | 1,293 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2006 James Henstridge
#
# base.py: the most common jhbuild commands
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | GNOME/jhbuild | jhbuild/commands/base.py | Python | gpl-2.0 | 24,247 |
from setuptools import setup
from wakatime.__init__ import __version__ as VERSION
packages = [
'wakatime',
]
setup(
name='wakatime',
version=VERSION,
license='BSD 3 Clause',
description='Interface to the WakaTime api.',
long_description=open('README.rst').read(),
author='Alan Hamlett',
... | AppVentus/AvTime-client | packages/wakatime/setup.py | Python | bsd-3-clause | 957 |
from __future__ import absolute_import
from __future__ import print_function
from tqdm import tqdm
import pickle as pkl
import hashlib
import os
import argparse
import pandas as pd
def formatter(x):
try:
x = float(x)
return '{:.1f}'.format(x)
except:
return x
def main():
parser... | YerevaNN/mimic3-benchmarks | mimic3benchmark/tests/hash_tables.py | Python | mit | 2,196 |
# -*- coding: utf-8 -*-
import pymongo
import conf
import threading
def writeInfo(info):
connection = pymongo.Connection('localhost', 27017)
db = connection[conf.database]
infoCol = db.Info
mainInfo = {
"name":info["name"],
"userID":info["id"],
"domain":info["domain"],
... | windkeepblow/WeiboCrawler | dbhandler.py | Python | mit | 3,988 |
import math
from array import array
import cPickle
class convertcovariancetabletoarray:
registered = True #Value to define db operator
def __init__(self):
self.n = 0
self.data = {}
self.mydata1D = []
self.headers = []
self.flag = True
def step(self, *args):
... | alexpap/exareme | exareme-tools/madis/src/functionslocal/aggregate/toarray.py | Python | mit | 1,037 |
""" DIRAC Workload Management System Client class encapsulates all the
methods necessary to communicate with the Workload Management System
"""
import os
import StringIO
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Core.DISET.RPCClient import RPCClient
fr... | vmendez/DIRAC | WorkloadManagementSystem/Client/WMSClient.py | Python | gpl-3.0 | 7,246 |
# talkatv - Commenting backend for static pages
# Copyright (C) 2012 talkatv contributors, see AUTHORS
#
# 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... | talkatv/talkatv | talkatv/migrations.py | Python | agpl-3.0 | 2,452 |
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseNotFound, HttpResponseForbidden
from django.template.loader import render_to_string
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.views.decorators... | lkundrak/scraperwiki | web/codewiki/viewsrpc.py | Python | agpl-3.0 | 14,800 |
from clones.models import *
from django.contrib import admin
class FingerprintAdmin(admin.ModelAdmin):
ordering = ['-id']
list_display = ('__unicode__', 'timestamp')
admin.site.register(Fingerprint, FingerprintAdmin)
admin.site.register(Clone)
| jantoniomartin/condottieri-old | clones/admin.py | Python | agpl-3.0 | 248 |
"""homesite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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')
Class-ba... | aninternetof/bremen | homesite/urls.py | Python | mit | 1,105 |
import re
from unidecode import unidecode
from ..utils import translation, squeeze, check_str, check_empty
from .phonetic_algorithm import PhoneticAlgorithm
class Soundex(PhoneticAlgorithm):
"""
The Soundex algorithm.
[Reference]: https://en.wikipedia.org/wiki/Soundex
[Authors]: Robert C. Russel, Ma... | Lilykos/pyphonetics | pyphonetics/phonetics/soundex.py | Python | mit | 1,168 |
#!/usr/bin/env python
# created by chris@drumminhands.com
# modified by varunmehta
# see instructions at http://www.drumminhands.com/2014/06/15/raspberry-pi-photo-booth/
import atexit
import glob
import logging
import math
import os
import subprocess
import sys
import time
import traceback
from time import sleep
impo... | varunmehta/photobooth | photobooth.py | Python | mit | 12,204 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
Install py2exe: http://sourceforge.net/projects/py2exe/files/
Copy script to the web2py directory
c:\bin\python27\python standalone_exe.py py2exe
"""
from distutils.core import setup
import py2exe
from gluon.import_all import base_modules, contribut... | madhurauti/Map-Polygon | static/scripts/tools/standalone_exe.py | Python | mit | 1,906 |
# -*- 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 field 'Plan.has_persistence'
db.add_column(u'physical_plan', 'ha... | globocom/database-as-a-service | dbaas/physical/migrations/0028_auto__add_field_plan_has_persistence.py | Python | bsd-3-clause | 12,315 |
# This file is the Zulip local_settings.py configuration for the
# zulip.com installation of Zulip. It shouldn't be used in other
# environments, but you may find it to be a a helpful reference when
# setting up your own Zulip installation to see how Zulip can be
# configured.
#
# On a normal Zulip production server, ... | jrowan/zulip | zproject/local_settings.py | Python | apache-2.0 | 5,560 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import re
from django.conf import settings as django_settings
from django import template
from django.contrib.contenttypes.models import ContentType
from django.db.models import Model
from django.forms import BaseFo... | tkliuxing/django-wiki | wiki/templatetags/wiki_tags.py | Python | gpl-3.0 | 5,389 |
from __future__ import unicode_literals
import frappe, os, copy, json, re
from frappe import _
from frappe.modules import get_doc_path
from jinja2 import TemplateNotFound
from frappe.utils import cint, strip_html
from frappe.utils.pdf import get_pdf
no_cache = 1
no_sitemap = 1
base_template_path = "templates/www/pr... | anandpdoshi/frappe | frappe/utils/print_format.py | Python | mit | 1,764 |
import sys
import os
import re
import json
from config import settings
import hashlib
def create_folder(path):
if not os.path.exists(path):
os.makedirs(path)
def main():
if len(sys.argv) > 1:
path = sys.argv[1]
else:
print("Please give the location of where you want to start the pr... | codefisher/mozbutton_sdk | start_project.py | Python | mit | 2,442 |
"""
WSGI config for antibiobank 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "antibiobank.settings")
from djang... | dridk/antibiobank | antibiobank/wsgi.py | Python | gpl-3.0 | 397 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/yaml.py
# parses "Yet Another Markup Language" into a list of tuples.
# Each tuple says what the data is e.g.
# ('Paragraph', 'Heading1', 'Why Repo... | nakagami/reportlab | src/reportlab/lib/yaml.py | Python | bsd-3-clause | 5,833 |
from .. import base
class Stock(base.Resource):
NAME_ATTR = 'display_name'
def __repr__(self):
return "<Stock: %s>" % self.name
class StockManager(base.Manager):
resource_class = Stock
def get(self, flavor_id, availability_zone=None):
if availability_zone is not None:
r... | nttcom/eclcli | eclcli/bare/bareclient/v2/stocks.py | Python | apache-2.0 | 547 |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data*3
if __name__ == '__main__':
rospy.init_node('third')
sub = rospy.Subscriber('count_up', Int32, cb)
pub = rospy.Publisher('third', Int32, queue_size=1)
rate = rospy.Rate(10)
... | tm-susan/task2 | third.py | Python | mit | 395 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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/l... | mellanox-openstack/vsa | src/scripts/tstextents.py | Python | apache-2.0 | 977 |
#!/usr/bin/python3
## ZappyTeam.py for super_zappy in /home/aracthor/programs/projects/hub/super_zappy/ia/python
##
## Made by aracthor
## Login <aracthor@epitech.net>
##
## Started on Tue Feb 24 11:07:02 2015 aracthor
## Last Update Tue Feb 24 11:08:47 2015 aracthor
##
class ZappyTeam:
def __init__(self):
... | Aracthor/super_zappy | AI/python/ZappyTeam.py | Python | gpl-2.0 | 409 |
# #
# Copyright (c) 2005-2017 Apple 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 ... | macosforge/ccs-calendarserver | twistedcaldav/method/post.py | Python | apache-2.0 | 2,228 |
# Copyright (c) 2013 "OKso http://okso.me"
#
# This file is part of Intercom.
#
# Intercom 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 late... | oksome/Intercom | intercom/controllers/keystrokes.py | Python | agpl-3.0 | 2,427 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
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 ... | benosteen/RDFDatabank | message_workers/solrFields.py | Python | mit | 6,137 |
from django.contrib import admin
# Register your models here.
from models import article
class ArticleAdmin(admin.ModelAdmin):
list_display = ('head', 'pub_date')
fields = ['head', 'text']
admin.site.register(article,ArticleAdmin)
| davel1/dj-page-news | news/admin.py | Python | gpl-2.0 | 246 |
from connexion.cli import main # pragma: no cover
main() # pragma: no cover
| NeostreamTechnology/Microservices | venv/lib/python2.7/site-packages/connexion/__main__.py | Python | mit | 79 |
""" Code to launch an external editor. """
import os
import shutil
import logging
import os.path
import tempfile
import subprocess
import pkg_resources
l = logging.getLogger(__name__)
class EditorException(OSError):
pass
class NoChanges(EditorException):
pass
def get_editor():
""" Returns the configur... | bwesterb/pol | src/editor/__init__.py | Python | gpl-3.0 | 1,540 |
"""AuthZ Adapter implementations of type managers."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specification
from . import se... | mitsei/dlkit | dlkit/authz_adapter/type/managers.py | Python | mit | 1,075 |
'''
@author: Sergio Rojas
@contact: rr.sergio@gmail.com
--------------------------
Contenido bajo
Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE)
http://creativecommons.org/licenses/by-nc-sa/3.0/ve/
Creado en abril 21, 2016
'''
x=4
x0 = x
repetir = 0
suma = 0
while repetir < x0:
suma = s... | rojassergio/Aprendiendo-a-programar-en-Python-con-mi-computador | Programas_Capitulo_03/Cap02_pagina_69_cuadrado2.py | Python | mit | 417 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('webpos', '0008_bill_date'),
]
op... | radome/OpenGenfri | pos/webpos/migrations/0009_auto_20141229_1626.py | Python | mit | 687 |
"""filechooser.py - Custom FileChooserDialog implementations."""
import os
import gtk
import pango
from PyQt5.QtWidgets import QDialog, QFileDialog
import encoding
import image
import labels
from preferences import prefs
import thumbnail
_main_filechooser_dialog = None
_library_filechooser_dialog = None
class _C... | isaaccortes/Comiqs | src/filechooser.py | Python | gpl-3.0 | 14,377 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2013,2014,2015,2016,2017 Contributor
#
# 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 t... | quattor/aquilon | lib/aquilon/worker/commands/update_share.py | Python | apache-2.0 | 2,109 |
"""
Public hack roster
"""
from hackfsu_com.views.generic import PageView
from hackfsu_com.util import acl
class ResultsPage(PageView):
template_name = 'organize/judging/results/index.html'
access_manager = acl.AccessManager(acl_accept=[acl.group_organizer])
| andrewsosa/hackfsu_com | api/webapp/views/organize/judging/results/index.py | Python | apache-2.0 | 274 |
#!/usr/bin/env python
from setuptools import setup
setup(name='pgv',
version='0.0.2',
description="PostgreSQL schema versioning tool",
long_description=open("README.rst").read(),
author='Kirill Goldshtein',
author_email='goldshtein.kirill@gmail.com',
packages=['pgv', 'pgv.utils', '... | go1dshtein/pgv | setup.py | Python | gpl-2.0 | 968 |
from ..datavalue import normalize
def test_string():
string = normalize({
'type': "string",
'value': "I have a lovely bunch of coconuts"
})
assert str(string) == "'I have a lovely bunch of coconuts'"
def test_quantity():
quantity = normalize({
'type': "quantity",
'va... | mediawiki-utilities/python-mwbase | mwbase/tests/test_datavalue.py | Python | mit | 1,499 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron
# Copyright 2015, TODAY Clouder SASU
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License with Attribution
# ... | nicolas-petit/clouder | clouder/clouder_runner_docker/runner.py | Python | gpl-3.0 | 7,557 |
import pytest
import json
import sys
import six
from flex.constants import EMPTY
from flex.http import JSONDecodeError
from tests.factories import (
RequestFactory,
)
def test_null_body_returns_null():
request = RequestFactory(body=None)
assert request.data is None
def test_empty_string_body_returns_e... | pipermerriam/flex | tests/http/test_request_data_property.py | Python | mit | 2,960 |
# -*- coding: utf-8 -*-
import json
from layeredconfig import source
class JsonFile(source.Source):
"""Source for json files"""
def __init__(self, source, **kwargs):
super(JsonFile, self).__init__(**kwargs)
self._source = source
def _read(self):
with open(self._source) as fh:
... | hakkeroid/lcconcept | src/layeredconfig/sources/jsonfile.py | Python | bsd-3-clause | 457 |
# -*- coding: latin-1 -*-
#retriever
"""Retriever script for direct download of vertnet-amphibians data"""
import os
from builtins import str
from pkg_resources import parse_version
from retriever.lib.models import Table
from retriever.lib.templates import Script
try:
from retriever.lib.defaults import VERSION
... | henrykironde/deletedret | scripts/vertnet_amphibians.py | Python | mit | 10,575 |
from agora_site.agora_core.models import Election, CastVote
from agora_site.agora_core.tasks.election import (start_election, end_election,
release_election_results, archive_election)
from agora_site.misc.generic_resource import GenericResource, GenericMeta
from agora_site.agora_core.resources.user import UserResou... | pirata-cat/agora-ciudadana | agora_site/agora_core/resources/election.py | Python | agpl-3.0 | 28,122 |
import unittest, tempfile, os
from pychemy.peptides import *
from pychemy.amino_acids import AMINO_ACIDS
class Peptides_Testing(unittest.TestCase):
###############################
def test_get_next_aa_with_valid_single_aa(self):
for key in AMINO_ACIDS:
if key.mod != 'N-term' and key.mod != 'C-term':
... | benjiec/pychemy | pychemy/tests/test_peptides.py | Python | mit | 2,147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.