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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
"""Usage: compile_to_bitcode.py <source> [options]
"""
import sys
import subprocess
import os
def change_suffix(src, suffix):
out, _ = os.path.splitext(src)
out += "." + suffix
return out
def compile_benchmark(src, args, output = None, fix_inline=False,
fix_volatile=False, lar... | yaqwsx/SymDIVINE | scripts/compile_to_bitcode.py | Python | mit | 2,169 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/tests/scheduler/test_scheduler_options.py | Python | apache-2.0 | 5,241 |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.datastore_v1.proto import (
datastore_pb2 as google_dot_cloud_dot_datastore__v1_dot_proto_dot_datastore__pb2,
)
class DatastoreStub(object):
"""Each RPC normalizes the partition IDs of the keys in its input en... | tseaver/google-cloud-python | datastore/google/cloud/datastore_v1/proto/datastore_pb2_grpc.py | Python | apache-2.0 | 8,633 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/modules/api/models/keys.py | Python | gpl-3.0 | 3,652 |
from random import choice
from string import ascii_letters, digits
import six
def generate_random_string(length=20):
return ''.join((choice(ascii_letters + digits)
for _ in six.moves.xrange(length)))
def strip_leading_spaces(source):
r"""
This is to help you write multilingual strin... | transifex/openformats | openformats/tests/utils/strings.py | Python | gpl-3.0 | 833 |
"""Views for the pages app."""
from django.views.generic.detail import DetailView
from .models import Page
class PageDetail(DetailView):
"""Page detail view."""
model = Page
def get_template_names(self):
names = super(PageDetail, self).get_template_names()
names.append('arpegio-pages/pag... | arpegio-dj/arpegio | arpegio/pages/views.py | Python | bsd-3-clause | 357 |
"{foo[bar]}".format(foo=dict(bar=42))
<warning descr="Too few arguments for format string">"{foo[bar]}"</warning>.format(foo=dict(foo=42)) | jwren/intellij-community | python/testData/inspections/PyStringFormatInspection/NewStyleMappingKeyWithSubscriptionDictCall.py | Python | apache-2.0 | 138 |
# (c) Copyright [2015] Hewlett Packard Enterprise Development LP
#
# 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 r... | hpe-storage/horizon-hpe-storage-ui | horizon_hpe_storage/storage_panel/storage_arrays/tables.py | Python | apache-2.0 | 4,728 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "final_age.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... | gauravsitlani/programming | final_age/python/manage.py | Python | gpl-3.0 | 807 |
from django.contrib import admin
from blog.models import Article, Comment
# Register your models here.
admin.site.register(Article)
admin.site.register(Comment)
| MikeLing/personalblog | blog/admin.py | Python | mit | 161 |
from __future__ import print_function
__author__ = 'Robert Smallshire'
import sys
class Node(object):
def __init__(self, indent=None, lines=None, parent=None):
if indent is not None:
self.indent = indent
else:
self.indent = 0
if lines is not None:
... | rob-smallshire/cartouche | cartouche/nodes.py | Python | bsd-3-clause | 11,215 |
from rest_framework import serializers
from crowdsourcing import constants
from crowdsourcing.serializers.dynamic import DynamicFieldsModelSerializer
from crowdsourcing.models import Qualification, QualificationItem, WorkerAccessControlEntry, \
RequesterAccessControlGroup
from crowdsourcing.tasks import update_wor... | shirishgoyal/crowdsource-platform | crowdsourcing/serializers/qualification.py | Python | mit | 2,547 |
u'''
Created on Sep 13, 2011
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
import os, io, sys, json
from collections import defaultdict
from arelle import XbrlConst
from arelle.ModelObject import ModelObject
from arelle.ModelValue import QName
from arell... | sternshus/arelle2.7 | svr-2.7/arelle/RenderingResolver.py | Python | apache-2.0 | 43,274 |
#!/usr/bin/env python
# coding=utf-8
"""321. Swapping Counters
https://projecteuler.net/problem=321
A horizontal row comprising of 2n \+ 1 squares has n red counters placed at
one end and n blue counters at the other end, being separated by a single
empty square in the centre. For example, when n = 3.
A counter can ... | openqt/algorithms | projecteuler/pe321-swapping-counters.py | Python | gpl-3.0 | 972 |
from unittest import TestCase
from rfxcom.protocol.temphumiditybaro import TempHumidityBaro
from rfxcom.exceptions import (InvalidPacketLength, UnknownPacketSubtype,
UnknownPacketType)
class TempHumidityBaroTestCase(TestCase):
def setUp(self):
self.data = bytearray(b'\x0... | skimpax/python-rfxcom | tests/protocol/test_temphumiditybaro.py | Python | bsd-3-clause | 3,512 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | src/examples/python/outdated/extractor_mfcc.py | Python | agpl-3.0 | 4,847 |
from django.contrib import admin
from .models import PizzaPlace
admin.site.register(PizzaPlace)
| nicole-a-tesla/meetup.pizza | pizzaplace/admin.py | Python | mit | 99 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferSceneUI/MeshTangentsUI.py | Python | bsd-3-clause | 5,682 |
import warnings
from pypeerassets.kutil import Kutil
from pypeerassets.protocol import Deck
from pypeerassets import pavoteproto
from hashlib import sha256
from binascii import unhexlify
from pypeerassets import transactions
from pypeerassets.pautils import read_tx_opreturn, find_tx_sender, get_block_info
from .network... | backpacker69/pypeerassets | pypeerassets/voting.py | Python | bsd-3-clause | 7,188 |
from setuptools import setup
setup(
name = 'weblayer-pastedemo',
version = '0.1',
install_requires=[
'weblayer',
'PasteScript',
'WSGIUtils'
],
scripts = ['demo.py'],
entry_points = {
'paste.app_factory': [
'main=demo:app_factory',
]
}
)
| thruflo/weblayer | src/weblayer/examples/deploy/paste/setup.py | Python | unlicense | 318 |
import numpy as np
def softmax(x):
"""Compute the softmax function for each row of the input x.
It is crucial that this function is optimized for speed because
it will be used frequently in later code. You might find numpy
functions np.exp, np.sum, np.reshape, np.max, and numpy
broadcasting usefu... | IAAAIAAIA/CS231n | thomas/assignment1/q1_softmax.py | Python | mit | 2,587 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Mentorship'
db.create_table('tracker_mentorship', (
('id', self.gf('django.db.mo... | kern3020/opportunity | opportunity/tracker/migrations/0002_auto__add_mentorship.py | Python | mit | 13,807 |
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
class VideoCamera(object):
def __init__(self):
# Using OpenCV to capture from device 0. If you have trouble capturing
# from a webcam, comment the line below out and use a... | tobykurien/pi-tracking-telescope | app/playground/video_streaming_with_flask_example-master/camera.py | Python | mit | 1,387 |
from numberRecognition import app
if __name__ == '__main__':
app.run(host='0.0.0.0') | JaeGyu/PythonEx_1 | flaskEx/numberRecognition/app_start.py | Python | mit | 86 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveLegacyIE
from ..compat import (
compat_parse_qs,
compat_urlparse,
)
class TlcDeIE(InfoExtractor):
IE_NAME = 'tlc.de'
_VALID_URL = r'https?://(?:www\.)?tlc\.de/(?:[^/]... | malept/youtube-dl | youtube_dl/extractor/tlc.py | Python | unlicense | 1,644 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('applicants', '0010_auto_20151126_0525'),
]
operations = [
migrations.AddField(
model_name='applicant',
... | shailr/vms | applicants/migrations/0011_applicant_number_of_missed_calls.py | Python | gpl-2.0 | 421 |
import re
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from crispy_forms import layout as crispy
from crispy_forms.helper import FormHelper
from memoized import memoized
from corehq.apps.hqwebapp import... | dimagi/commcare-hq | corehq/apps/hqadmin/forms.py | Python | bsd-3-clause | 8,362 |
from django.contrib.auth.models import User
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.builds.constants import EXTERNAL, LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.constants import PRIVATE, PUBLIC
from readthedocs.projects.models import ... | rtfd/readthedocs.org | readthedocs/rtd_tests/tests/test_version_querysets.py | Python | mit | 11,875 |
# Copyright (c) 2009 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
# Copyright (c) 2010 Research In Motion Limited. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/common/config/committervalidator.py | Python | bsd-3-clause | 5,209 |
"""
Filename: gth_solve.py
Author: Daisuke Oyama
Routine to compute the stationary distribution of an irreducible Markov
chain by the Grassmann-Taksar-Heyman (GTH) algorithm.
"""
import numpy as np
from numba import jit
from .external import numba_installed, jit
if not numba_installed:
try:
xrange
e... | mgahsan/QuantEcon.py | quantecon/gth_solve.py | Python | bsd-3-clause | 4,553 |
# -*- 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):
# Deleting model 'TaskLog'
db.delete_table('pypi_tasklog')
# Deleting model 'PackageModified'
... | crate-archive/crate-site | crateweb/apps/pypi/migrations/0008_auto__del_tasklog__del_packagemodified.py | Python | bsd-2-clause | 8,580 |
import datetime
import os
import shutil
import unicodecsv as csv
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from mptindicators.scorecard.models import Country, Section, Indicator, IndicatorScore
from zipfile import ZipFile
TMP_DIR = settings.TMP_DIR
DATA_DIR = os... | sunlightlabs/mptindicators | mptindicators/scorecard/management/commands/publishdata.py | Python | bsd-3-clause | 3,481 |
#!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# 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... | asacamano/keyczar | cpp/src/tools/swtoolkit/site_scons/site_tools/target_platform_bsd.py | Python | apache-2.0 | 3,718 |
#!/usr/bin/python2
import os
import re
import sys
import argparse
import matplotlib.pyplot as plt
from pylab import *
"""
opens output files from ./output
creates graphs from the output files in ./images
to create output files in ./output
$ ./run_alot.sh
"""
def makediffs(X, Y, hX, hY):
diffs = []
for i ... | trauzti/mimir | pymimir/make_images.py | Python | isc | 6,617 |
from twisted.web import resource
import os
from hatena import Log, ServerLog, Silent, NotFound
from DB import Database
from Hatenatools import TMB
#The movie folder:
class PyResource(resource.Resource):
isLeaf = False
def __init__(self):
resource.Resource.__init__(self)
self.CreatorID = CreatorIDResource()
de... | dylmye/hatena-server | public/ds/v2-xx/movie.py | Python | isc | 8,285 |
# 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/changes/hgbuildbot.py | Python | mit | 5,750 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BatchPanel.py
---------------------
Date : November 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... | gioman/QGIS | python/plugins/processing/gui/BatchPanel.py | Python | gpl-2.0 | 11,053 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/libdmx/package.py | Python | lgpl-2.1 | 1,814 |
import scrapy
import json
from deals.settings import HTML_STORAGE
from deals.lib.file_storage import list_dir
class AldiSpider(scrapy.Spider):
name = 'Aldi'
base_domain = 'aldi.ie'
allowed_domains = ['aldi.ie']
# TODO: pull from mongo
start_urls = [
"https://www.aldi.ie/api/productsearch/c... | astrok100/Weekly-Deals-Scrapy | deals/spiders/aldi.py | Python | mpl-2.0 | 1,026 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/__init__.py | Python | mit | 731 |
# This import fixes sys.path issues
from .parentpath import *
import os
import re
import unittest
import logging
import StringIO
from ogutils.loggers import default
from ogutils.system import streams
LOCAL_LOG_DIR = os.path.join(os.path.dirname(__file__), 'logs')
class FlaskLoggerTest(unittest.TestCase)... | OpenGov/og-python-utils | tests/loggers_default_test.py | Python | mit | 2,700 |
#
# The Python Imaging Library.
# $Id$
#
# image enhancement classes
#
# For a background, see "Image Processing By Interpolation and
# Extrapolation", Paul Haeberli and Douglas Voorhies. Available
# at http://www.sgi.com/grafica/interp/index.html
#
# History:
# 1996-03-23 fl Created
# 2009-06-16 fl Fixed mean calcu... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/PIL/ImageEnhance.py | Python | mit | 2,760 |
#!/usr/bin/env python3
import sys
tpl, ver = sys.argv[1:]
print(open(tpl, "rt").read().format(version=ver[1:].replace("-", "_")))
| terhorst/psmcpp | conda/template.py | Python | gpl-3.0 | 130 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | rvs/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/filerep/mpp18816/verify/verify.py | Python | apache-2.0 | 2,327 |
#!/usr/bin/python
#
# Copyright 2013 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... | lociii/googleads-python-lib | examples/adspygoogle/dfp/v201306/creative_set_service/create_creative_set.py | Python | apache-2.0 | 2,334 |
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
class Solution:
def connect(self, root: 'Node') -> 'Node':
curr = ro... | jiadaizhao/LeetCode | 0101-0200/0116-Populating Next Right Pointers in Each Node/0116-Populating Next Right Pointers in Each Node.py | Python | mit | 612 |
#
# Part of p5: A Python package based on Processing
# Copyright (C) 2017-2019 Abhik Pal
#
# 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) ... | p5py/p5 | p5/sketch/events.py | Python | gpl-3.0 | 7,538 |
import pyaf.Bench.web_traffic.Forecaster as fo
PROJECTS = ['en.wikipedia.org']
data_dir = 'data/web-traffic-time-series-forecasting'
lForecaster = fo.cProjectForecaster()
lForecaster.mDataDirectory = data_dir
lForecaster.mBackendName = 'pyaf_hierarchical_top_down'
lForecaster.mKeysFileName = 'key_1.csv.zip'
last_da... | antoinecarme/pyaf | tests/bench/web_traffic_jobs/en.wikipedia.org/test_web_traffic_en.wikipedia.org_pyaf_hierarchical_top_down.py | Python | bsd-3-clause | 447 |
##
## 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 ... | lulf/qpid-dispatch | python/qpid_dispatch_internal/management/qdrouter.py | Python | apache-2.0 | 2,794 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from simplespamblocker.models import Option
class OptionAdmin(admin.ModelAdmin):
list_display = ('id', 'site', 'is_block_author', 'is_block_content',
'is_block_email', 'is_block_url... | moqada/django-simple-spam-blocker | simplespamblocker/admin.py | Python | bsd-3-clause | 1,957 |
#!/usr/bin/env python3
import urllib.request as req
import re
import os
from pathlib import Path
def main():
url = input().strip()
path = Path(input().strip())
opener = req.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
req.install_opener(opener)
page = req.urlopen(url).re... | garciparedes/python-examples | environment/scripting/torrent_crawler.py | Python | mpl-2.0 | 587 |
# -*- coding: utf-8 -*-
# Simple Bot (SimpBot)
# Copyright 2016-2017, Ismael Lugo (kwargs)
#
# Simpcoins! inspired by buttcoins
#---------------------------------
# configuration module
import random
from string import ascii_letters, digits, punctuation
def unsort(list):
"""Return a copy of unsorted list"""
... | IsmaelRLG/simpbot | extra/simpcoins/config.py | Python | mit | 1,465 |
import csv
import json
import tempfile
from fs.memoryfs import MemoryFS
import numpy as np
fsys = MemoryFS()
fsys.makedir('raw_data')
fsys.makedir('result_data')
fsys.makedir('result_data/dataset_200_step/')
pure_path = 'result_data/dataset_200_step/'
fsys.create(pure_path + 'a.tfrecord')
fsys.create(pure_path + 'b.t... | chenmich/learn_rnn_tensorflow | learn_fs.py | Python | apache-2.0 | 415 |
def join(a, *b):
return a + "/" + "/".join(b)
def normpath(x):
return x
| github/codeql | python/ql/test/query-tests/Security/lib/os/path.py | Python | mit | 81 |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | deepmind/acme | acme/jax/utils_test.py | Python | apache-2.0 | 2,776 |
import random
import sys
def Cartas():
return 4*["A",2,3,4,5,6,7,8,9,10,"J","Q","K"]
def Usuario(usuario,baraja):
usuario.append( baraja.pop(0))
usuario.append( baraja.pop(0))
print("Tu mano es:")
print (usuario)
return usuario
def Maquina(maquina, baraja):
maquina.append(... | afsolanoc95/programapython | recursividad21.py | Python | gpl-3.0 | 3,450 |
import os
import webapp2
from actions import cronActions
from views import views
import secrets
SECS_PER_WEEK = 60 * 60 * 24 * 7
# Enable ctypes -> Jinja2 tracebacks
PRODUCTION_MODE = not os.environ.get(
'SERVER_SOFTWARE', 'Development').startswith('Development')
ROOT_DIRECTORY = os.path.dirname(__file__)
if no... | onejgordon/action-potential | actionpotential.py | Python | mit | 1,267 |
################################################################################
# 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... | tzulitai/flink | flink-python/pyflink/fn_execution/tests/test_fast_coders.py | Python | apache-2.0 | 11,430 |
# -*- coding: utf-8 -*-
#
# Kate/Pâté plugins to work with C++ code formatting
# Copyright 2010-2013 by Alex Turbov <i.zaufi@gmail.com>
#
#
# This software 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... | hlamer/kate | addons/kate/pate/src/plugins/format.py | Python | lgpl-2.1 | 19,591 |
from awxkit.api.mixins import HasCreate, HasInstanceGroups, HasNotifications, DSAdapter
from awxkit.utils import random_title, suppress, PseudoNamespace
from awxkit.api.resources import resources
import awxkit.exceptions as exc
from . import base
from . import page
class Organization(HasCreate, HasInstanceGroups, Has... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awxkit/awxkit/api/pages/organizations.py | Python | apache-2.0 | 1,807 |
# -*- coding: utf-8 -*-
"""
test_gluster_bridge
----------------------------------
Tests for `gluster_bridge` module.
"""
from tendrl.gluster_bridge.tests import base
class TestGluster_bridge(base.TestCase):
def test_something(self):
assert True
| shtripat/gluster_bridge | tendrl/gluster_bridge/tests/test_gluster_bridge.py | Python | lgpl-2.1 | 265 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2013 ccheng <ccheng@cchengs-MacBook-Pro.local>
#
# Distributed under terms of the MIT license.
"""
"""
import urllib
from one_server import create_app, mongo
import one_server
import json
from bson.json_util import dumps
app = create_ap... | ufo22940268/one-server | tests/base.py | Python | bsd-2-clause | 3,141 |
import os
from setuptools import setup
import sys
if sys.version_info < (2, 6):
raise Exception('Wiggelen requires Python 2.6 or higher.')
install_requires = []
# Python 2.6 does not include the argparse module.
try:
import argparse
except ImportError:
install_requires.append('argparse')
# Python 2.6 do... | martijnvermaat/wiggelen | setup.py | Python | mit | 2,054 |
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as file:
long_description = file.read()
setup(name='passgen',
version='1.1.1',
description='Random password generator',
long_description=long_description,... | soslan/passgen | setup.py | Python | mit | 1,122 |
def break_numbers(stuff):
"""This functionality will break up numbers for us."""
numbers = stuff.split()
return numbers
def sort_numbers(numbers):
"""This functionality will sort numbers for us"""
numbers.sort()
return numbers
def add_numbers(sorted_numbers):
"""This functionality will add numbers for us"""
a... | mrniranjan/python-scripts | reboot/math43.py | Python | gpl-2.0 | 911 |
from pygame_font import *
| gmittal/aar-nlp-research-2016 | src/pygame-pygame-6625feb3fc7f/symbian/lib/font.py | Python | mit | 28 |
from flask import render_template
from flask.ext.login import current_user
def sponsors():
return render_template('sponsors.html', active_page='sponsors')
| PhoenixRacing/PhoenixRacingWebApp-noregrets | application/controllers/sponsors.py | Python | bsd-3-clause | 157 |
#!/usr/bin/python
import yaml
import re
import os
import subprocess
import ConfigParser
import time
import hashlib
import sys
'''This file will be looked up under OPKG_DIR/conf'''
OPKG_CONF_FILE='/etc/opkg/conf/opkg.env'
META_FILE_PREVIOUS='Previous.meta'
META_FILE_LATEST='Latest.meta'
EXTRA_PARAM_DELIM=','
EXTRA_PA... | kurianinc/opkg | src/openpkg.py | Python | mit | 30,669 |
import sys
sus = []
def guess():
def solve(N, B, F):
sus.append((0,N,B))
brokens = []
while F:
if len(brokens) == B: break
print(guess())
sys.stdout.flush()
res = input()
while sus:
r = sus.pop()
F -= 1
print(" ".join(brokens))
sys.stdou... | zuun77/givemegoogletshirts | codejam/2019/q4.py | Python | apache-2.0 | 484 |
# -*- coding: utf-8 -*-
"""
Tests for self assessment handlers in Open Assessment XBlock.
"""
import copy
import json
import datetime
import mock
import pytz
from openassessment.assessment.api import self as self_api
from openassessment.workflow import api as workflow_api
from openassessment.xblock.data_conversion impo... | EDUlib/edx-ora2 | openassessment/xblock/test/test_self.py | Python | agpl-3.0 | 17,776 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import os
import shutil
import tempfile
from django.conf import settings
from django.core.management import call_command
from django.template import Context, Template
from django.test import SimpleTestCase, override_settings
from django.u... | moreati/django | tests/staticfiles_tests/cases.py | Python | bsd-3-clause | 4,520 |
import unittest
from yyproto.header import Header
from yyproto.packer import Packer
from yyproto.unpacker import Unpacker
class TestHeader(unittest.TestCase):
def test_pack(self):
buf = bytearray(256)
packer = Packer(buf)
header = Header()
header.length = 10
header.id = ... | decimalbell/yyproto | python/yyproto/tests/test_header.py | Python | bsd-3-clause | 1,002 |
# Copyright (c) 2014 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | rahulunair/nova | nova/tests/unit/virt/vmwareapi/test_imagecache.py | Python | apache-2.0 | 12,118 |
from Model import Model
class FMModel(Model):
################################
######### Constructors #########
def __init__(self,configModel,utils,config,strTrial):
super(FMModel,self).__init__(configModel,utils,strTrial)
self.dims = configModel[3][0]
self.logCV = utils.MODEL... | ChrisRackauckas/TBEEF | utils/FMModel.py | Python | mit | 29,342 |
from django import forms
class VaryingField(forms.Field):
def __init__(self, crucible, varying_on_field, *args, **kwargs):
self.crucible = crucible
self.varying_on_field = varying_on_field
self.curried_args = args
self.curried_kwargs = kwargs
def determine_field(self, form):
... | chrisdickinson/django-butter | butter/fields/varying.py | Python | bsd-3-clause | 596 |
import logging
import decode_bcd
import decode_common
import hexdump
def get_table_slots ( req ):
return 20
# 0 ... max-1
# return dict of: score, shortname
def get_table_slot_dict ( req, blockdata, n ):
# first 4b are 'high score' for top of screen
# then 4b per score (1 through 20)
# then 6b per r... | skeezix/compo4all | spaghetti-server/g_ms_fshark.py | Python | gpl-2.0 | 1,291 |
from django.conf.urls.defaults import *
from order.views import order_pizza, order_bread
urlpatterns = patterns('order.views',
url(r'^$', 'place_order'),
url(r'pizza/(?P<order_id>\d+)$', order_pizza),
url(r'bread/(?P<order_id>\d+)$', order_bread),
)
| ajpocus/pizzeria | order/urls.py | Python | bsd-3-clause | 264 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
# File : dirac-create-distribution-tarball
# Author : Adria Casajus
########################################################################
"""
Create tarballs for a given DIRAC release
"""
impo... | arrabito/DIRAC | Core/scripts/dirac-create-distribution-tarball.py | Python | gpl-3.0 | 25,052 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_cluster.py | Python | mit | 3,370 |
import piecash
from piecash_utilities.report import report, execute_report
@report(
title="My simplest report with a book",
name="piecash-simple-report-book",
menu_tip="A simple report that opens a book",
options_default_section="general",
)
def generate_report(
book_url,
):
with piecash.... | sdementen/gnucash-utilities | report_example/report_simplest_book.py | Python | mit | 752 |
from django.contrib import admin
from .models import People
# Register your models here.
admin.site.register(People) | hhalmeida/corponovo | app/admin.py | Python | mit | 117 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | unreleased/azure-mgmt-machinelearning/azure/mgmt/machinelearning/models/azure_ml_web_services_management_client_enums.py | Python | mit | 1,816 |
""" waysoffib.py | Thu, Jan 26, 2017 | Roman S. Collins
Sources:
- S1: Dylan Murphy - Python tutoring
http://pastebin.com/89dxMK2L
- S2: 5 ways for fibonacci
https://technobeans.com/2012/04/16/5-ways-of-fibonacci-in-python/
"""
import sys
sys.setrecursionlimit(18000)
# Global declarations fo... | RomanSC/algorithms | chapter-1/waysoffib.py | Python | gpl-3.0 | 3,178 |
import urllib2
from bottle import route, run, static_file, debug, post, request, response
@route('/')
def index():
return send_static('index.html')
@post('/export/')
def export():
url = request.forms.get('gURL')
name = request.forms.get('expName')
data = urllib2.urlopen(url)
response.add_header(... | adrianrego/dashing | server.py | Python | bsd-2-clause | 602 |
def get_resource():
pass
| tomka/rednotebook | rednotebook/gui/keepnote/__init__.py | Python | gpl-2.0 | 28 |
# Author: Jason Lu
known = {0: 0, 1: 1}
def fibonacci(n):
assert (n >= 0), 'n must be >= 0'
if n in known:
return known[n]
res = fibonacci(n-1) + fibonacci(n-2)
known[n] = res
return res
if __name__ == '__main__':
from timeit import Timer
t = Timer('fibonacci(8)', 'from __main__... | jinzekid/codehub | python/设计模式/结构型模式/修饰起模式/fibonacci.py | Python | gpl-3.0 | 365 |
'''score releted stuff'''
import os
import pickle
import sys
import math
from config import *
import utils
import pygame
from pygame.locals import *
import music
MAX = 7 # max players number in highscore screen - magical number
CPL = 15 # max char per line
class HighScores(object):
def __init__(self, screen, f... | jjconti/twistedmold | lib/scores.py | Python | gpl-3.0 | 7,144 |
# -*- coding: utf-8 -*-
import math
from collections import OrderedDict
import flask
import pandas as pd
import netCDF4
import numpy as np
from bokeh.embed import components
from bokeh.resources import INLINE
from bokeh.templates import RESOURCES
from bokeh.util.string import encode_utf8
from bokeh.models import Da... | ijstokes/bokeh-blaze-tutorial | app/my_bokeh_app.py | Python | mit | 1,411 |
import pygame
import time
pygame.mixer.init()
s1 = pygame.mixer.Sound("1.wav")
s2 = pygame.mixer.Sound("2.wav")
s3 = pygame.mixer.Sound("3.wav")
s4 = pygame.mixer.Sound("4.wav")
s5 = pygame.mixer.Sound("5.wav")
squeak = pygame.mixer.Sound("squeak.wav")
explosion = pygame.mixer.So... | whaleygeek/school_mc_demo | demo3/countdown.py | Python | mit | 768 |
# Copyright (c) 2019 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | OpenKMIP/PyKMIP | kmip/tests/unit/pie/objects/test_application_specific_information.py | Python | apache-2.0 | 8,739 |
import urllib
import urllib2
import cgi
from decimal import Decimal
from django.conf import settings
from django.core.urlresolvers import reverse
from django import forms
from django.http import Http404
from django.shortcuts import get_object_or_404
from tendenci.apps.payments.paypal.forms import PayPalPaymentForm
fr... | alirizakeles/tendenci | tendenci/apps/payments/paypal/utils.py | Python | gpl-3.0 | 7,883 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from os.path import abspath, dirname, join
#
# Bokeh documentation build configuration file, created by
# sphinx-quickstart on Sat Oct 12 23:43:03 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note ... | DuCorey/bokeh | sphinx/source/conf.py | Python | bsd-3-clause | 9,859 |
"""Pytest configuration file
"""
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "treebeard.tests.settings"
import django
def pytest_report_header(config):
return "Django: " + django.get_version()
def pytest_configure(config):
django.setup()
| tabo/django-treebeard | treebeard/tests/conftest.py | Python | apache-2.0 | 257 |
__author__ = 'yusaira-khan'
import unittest
import un_iife_ize.un_iife_ize as un_iife_ize
class CheckVar(unittest.TestCase):
def test_simple(self):
statement = [('var hello,world=5;', 0)]
exp = [('hello=undefined,world=5;', 0)]
v = un_iife_ize.Var(statement)
v.extract_all()
... | yusaira-khan/un-iife-ize | tests/vars.py | Python | mit | 2,836 |
"""Entitlement Models"""
import logging
import uuid as uuid_tools
from datetime import timedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import IntegrityError, models, transaction
from django.utils.encoding import python_2_unicode_compatible
from django.utils.time... | cpennington/edx-platform | common/djangoapps/entitlements/models.py | Python | agpl-3.0 | 21,559 |
import subprocess
import time
from oeqa.oetest import oeRuntimeTest
class CommSshTest(oeRuntimeTest):
'''Ssh to logon target device
@class CommSshTest
'''
def test_comm_ssh(self):
'''check device ssh ability
@fn test_comm_ssh
@param self
@return
'''
# Run... | ipuustin/intel-iot-refkit | meta-iotqa/lib/oeqa/runtime/connectivity/services/ssh.py | Python | mit | 572 |
"""
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
For example,
Given:
s1 = "aabcc",
s2 = "dbbca",
When s3 = "aadbbcbcac", return true.
When s3 = "aadbbbaccc", return false.
"""
__author__ = 'Danyang'
class Solution(object):
def isInterleave(self, s1, s2, s3):
... | algorhythms/LeetCode | 097 Interleaving String.py | Python | mit | 2,718 |
# Base class for a BLE device. Each OS supported by the library should
# inherit from this class and implement the abstract methods.
# Author: Tony DiCola
#
# Copyright (c) 2015 Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docume... | fourtriple/bt-dist | Adafruit_Python_BluefruitLE/Adafruit_BluefruitLE/interfaces/device.py | Python | gpl-3.0 | 3,958 |
"""
Implementation of the GMO notification
"""
import logging
from shoppingcart.processors.GMO import parse_order_id, payment_accepted, AbstractReadParams
from shoppingcart.processors.exceptions import CCProcessorException
from shoppingcart.processors.helpers import get_processor_config
from ga_shoppingcart import or... | nttks/edx-platform | lms/djangoapps/ga_shoppingcart/notifications.py | Python | agpl-3.0 | 6,388 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"Test for copy"
from trytond.model import ModelSQL, fields
__all__ = [
'CopyOne2Many', 'CopyOne2ManyTarget',
'CopyOne2ManyReference', 'CopyOne2ManyReferenceTarget',
... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/tests/copy_.py | Python | gpl-3.0 | 3,032 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.