code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import with_statement
import sys
from django.core.urlresolvers import clear_url_caches, reverse
from cms.api import create_page, create_title
from cms.apphook_pool import apphook_pool
from cms.compat import get_user_model
from cms.appresolver import applications_page_check, cle... | SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/cms/tests/apphooks.py | Python | mit | 22,882 |
#!/usr/bin/env python
# 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
# "Li... | jianlirong/incubator-hawq | tools/bin/hawqpylib/hawqlib.py | Python | apache-2.0 | 21,065 |
from django.conf.urls import url
from wagtail.documents.views import serve
urlpatterns = [
url(r'^(\d+)/(.*)$', serve.serve, name='wagtaildocs_serve'),
url(r'^authenticate_with_password/(\d+)/$', serve.authenticate_with_password,
name='wagtaildocs_authenticate_with_password'),
]
| mikedingjan/wagtail | wagtail/documents/urls.py | Python | bsd-3-clause | 298 |
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | mozilla/caseconductor-ui | ccui/environments/forms.py | Python | gpl-3.0 | 3,860 |
# Copyright 2020 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... | googleapis/python-analytics-data | samples/snippets/quickstart_test.py | Python | apache-2.0 | 831 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-04-26 11:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('proposals', '0026_auto_20160425_1501'),
]
operations = [
migrations.AlterModelOption... | pycontw/pycontw2016 | src/proposals/migrations/0027_auto_20160426_1137.py | Python | mit | 659 |
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.di... | lukasbk/ErrorPro | setup.py | Python | bsd-3-clause | 1,185 |
from empressx.retinue.reactors import celery | TeamNext/EmpressX | empressx/retinue/reactors/__init__.py | Python | mit | 44 |
# python imports
import sys
# pygenn interface
from .genn_groups import SynapseGroup, NeuronGroup, CurrentSource, CustomUpdate
from .genn_model import GeNNModel
if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata
__version__ = metadata.version("pygenn") | genn-team/genn | pygenn/__init__.py | Python | gpl-2.0 | 318 |
# Copyright (c) 2013 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
# list of conditions and th... | v-legoff/croissant | croissant/output/__init__.py | Python | bsd-3-clause | 1,636 |
import gtk, gobject, gtk.glade
import gnome, gnome.ui, pango
import os, os.path
from gtk_goodies import gconf_wrapper, Undo, dialog_extras, image_extras
import gsudoku, sudoku, saver, sudoku_maker, printing, sudoku_generator_gui
import game_selector
import time, threading
from gettext import gettext as _
from gettext i... | TheBestHuman/DesktopSudokuGenerator | lib/gnome_sudoku.py | Python | gpl-3.0 | 38,776 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from os.path import join, abspath, dirname
from thumbor.context impo... | abaldwin1/thumbor | vows/fixtures/storage_fixture.py | Python | mit | 1,125 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUM... | jmighion/ansible | lib/ansible/modules/network/f5/bigip_monitor_tcp.py | Python | gpl-3.0 | 29,361 |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... | zhanqxun/cv_fish | numpy/ma/core.py | Python | apache-2.0 | 247,843 |
from __future__ import absolute_import
from idb.postgres_backend import apidbpool, NamedTupleCursor
import uuid
# import copy
# import traceback
# from idb.helpers.etags import objectHasher
class AnnotationApplicator(object):
corrections = None
keytups = None
def __init__(self, reload=True):
if ... | iDigBio/idb-backend | idb/annotations/apply.py | Python | gpl-3.0 | 1,898 |
#!/usr/bin/env python
import glob
import inspect
import os
import keyring
import getpass
import sys
import signal
from i3pystatus import Module, SettingsBase
from i3pystatus.core import ClassFinder
from collections import defaultdict, OrderedDict
def signal_handler(signal, frame):
sys.exit(0)
signal.signal(signal.... | claria/i3pystatus | setting_util.py | Python | mit | 2,881 |
# Copyright 2011 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... | dbarobin/google-mysql-tools | pylib/thread_tools.py | Python | apache-2.0 | 10,602 |
# Debugging module
from plantcv.plantcv import params
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
def _debug(visual, filename=None, **kwargs):
"""Save or display a visual for debugging.
Inputs:
visual - An image or plot to display for debugging
filename - An opti... | danforthcenter/plantcv | plantcv/plantcv/_debug.py | Python | mit | 771 |
import os
import cairo
import pango
import pangocairo
from settings import StringSetting
from common.config import TweakSettings
(
SHOW_ALWAYS,
SHOW_CHILD,
SHOW_NONE,
) = range(3)
class RenderCell:
font_name = StringSetting('/desktop/gnome/interface/font_name').get_string()
try:
font_size ... | tualatrix/ubuntu-tweak-old | src/common/canvas.py | Python | gpl-2.0 | 3,376 |
#!/usr/bin/python
from random import *
import itertools as iter
import copy
import math
SUIT = ['♠','♥','♦','♣']
RANK = [2,3,4,5,6,7,8,9,10,11,12,13,14]
FACE = ['J','Q','K','A']
output = ""
deck = []
#shuffle(deck)
players = 9
loc = 0 # location within a deck
hands = []
class Card(object):
def __init__(self,rank,... | SMendez223/PyPoker | poker.py | Python | mit | 9,463 |
import logging
from pywall.funnycats.funnycats import FunnyCats
from pywall.funnycats.user import get_user_list_score
from wall import Wall
class ScoreWall(Wall):
userListScore = []
def __init__(self, canvas, jenkins_url, score_view, dbname):
Wall.__init__(self, canvas, jenkins_url)
self.funnycats = FunnyCat... | pauloremoli/pywall | dist/pywall-0.1.0/pywall/wall/scorewall.py | Python | lgpl-3.0 | 1,959 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Unit tests for the :class:`iris.common.metadata.CubeMetadata`.
"""
# Import iris.tests first so that some things can be i... | bjlittle/iris | lib/iris/tests/unit/common/metadata/test_CubeMetadata.py | Python | lgpl-3.0 | 30,212 |
import numpy as np
import pylab as pl
from matplotlib.mlab import normpdf
from writePvpFile import writeHeaderFile, writeData
from math import pi, sqrt, fabs
import os
#For plotting
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
datasetVal = 1
eyeVal = 1
numBins = 5
numSigma = 2
targetMean =... | PetaVision/projects | DepthLCA/scripts/python_analysis/makePosMat.py | Python | epl-1.0 | 4,399 |
# coding: utf-8
import unittest
from tests.crawler_unit_test import *
from tests.crawler_system_test import *
from tests.crawler_acceptance_test import *
from tests.csv_exporter_unit_test import *
if __name__ == '__main__':
unittest.main(verbosity=2)
| ralphavalon/avaloncrawler | run_tests.py | Python | mit | 261 |
#!/usr/bin/python
#By Rhys McCaig @mccaig / mccaig@gmail.com
import sys
import json
import logging
import re
from datetime import datetime, timedelta
import xml.etree.ElementTree as ET
import thread
import numpy
import requests
class NikePlus:
"""Class for working with the Nike+ API"""
#Nike+ Settings
#You migh... | rhysmccaig/blue-ribbon-plus | nikeplus/nikeplus.py | Python | mit | 31,565 |
import copy
import scipy.spatial
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib
from Target import Ellipse as _Ellipse
from Target import Square
class TargetDetector(object):
'''
Generic Target Detector Class
Inherit from this to write a new detector
'''
def _... | ezietsman/photogrammetry-playground | TargetDetector.py | Python | mit | 9,881 |
# -*- coding: utf-8 -*-
"""Errors and Exceptions."""
class OperationFailure(IOError):
"""raise this if a operation (e.g. cd) fails.
The FSI is responsible for undoing errors."""
pass
class IsDir(OperationFailure):
"""raise this if a command only works on a file but a dirname is passed."""
pass
cl... | ywangd/stash | lib/stashutils/fsi/errors.py | Python | mit | 539 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserProfile.show_login_help'
db.add_column('panda_userprofile', 'show_login_help',
... | newsapps/panda | panda/migrations/0026_auto__add_field_userprofile_show_login_help.py | Python | mit | 13,753 |
# -*- coding: utf-8 -*-
"""
Template loading and rendering
:Copyright: 2015 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
from jinja2 import Environment, evalcontextfilter, Markup, PackageLoader, \
StrictUndefined
FILENAME_EXTENSION = '.html'
LOADER = PackageLoader('bombdefusalmanual.pages'... | homeworkprod/better-bomb-defusal-manual | bombdefusalmanual/templating.py | Python | mit | 934 |
from psychopy import visual, event
import Image, pylab, cv
mywin = visual.Window(allowGUI=False, monitor='testMonitor', units='norm',
colorSpace='rgb', color=[-1, -1, -1], fullscr=True)
mywin.setMouseVisible(False)
capture = cv.CaptureFromCAM(0)
img = cv.QueryFrame(capture)
pi = Image.fromstring... | psychopy/psychopy | docs/source/recipes/webcam_demo.py | Python | gpl-3.0 | 815 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# frePPLe documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 22 23:39:31 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | frePPLe/frePPLe | doc/conf.py | Python | agpl-3.0 | 8,520 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
orm.ArticleHistoryItem.objects.all().delet... | PerceptumNL/ReadMore | readmore/main/migrations/0005_clear_history.py | Python | agpl-3.0 | 12,313 |
# © 2015 Massachusetts Institute of Technology
import string
import random
from catan.comms import TxClient, TxFragmentClient, FragmentReassembler
import catan.globals as G
import logging
logger = logging.getLogger(__name__)
messageList = []
def string_generator(size=100, chars = string.ascii_uppercase + string.digit... | mit-ll/CATAN | experiments/frag_test.py | Python | bsd-3-clause | 2,249 |
import unittest
from bolt.discord.permissions import Permission
class TestPermission(unittest.TestCase):
def test_permission_from_list_to_list(self):
expected = ['MANAGE_WEBHOOKS', 'USE_EXTERNAL_EMOJIS']
permission = Permission(['MANAGE_WEBHOOKS', 'USE_EXTERNAL_EMOJIS'])
actual = permiss... | Arcbot-Org/Arcbot | tests/discord/test_permission.py | Python | gpl-3.0 | 1,719 |
"""Tests converting Gettext PO localization files to flat XML files"""
from io import BytesIO
from translate.convert import po2flatxml, test_convert
class TestPO2FlatXML:
postring = """msgid "one"
msgstr "One"
msgid "two"
msgstr "Two"
"""
@staticmethod
def _convert(postring, templatestring=None, **kwa... | nijel/translate | translate/convert/test_po2flatxml.py | Python | gpl-2.0 | 4,918 |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | rstens/gwells | gwells/models/GroundElevationMethodCode.py | Python | apache-2.0 | 1,435 |
# Copyright 2016 Nordstrom Inc., authors, and contributors <see AUTHORS file>
#
# 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 req... | Nordstrom/elwin | test/centralStorageClass.py | Python | apache-2.0 | 6,364 |
# Copyright 2015 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 req... | stevelle/glance | glance/common/jsonpatchvalidator.py | Python | apache-2.0 | 5,179 |
import logging
import epidag.factory.arguments as vld
from epidag.factory import get_workshop
from equationbased.statespace.eqbehaviour import *
__author__ = 'TimeWz667'
__all__ = []
logger = logging.getLogger(__name__)
# Behaviour library
EBMBehaviourLibrary = get_workshop('EBM_BE')
EBMBehaviourLibrary.register... | TimeWz667/Kamanian | complexism/equationbased/statespace/belibrary.py | Python | mit | 1,823 |
# -*- coding: utf-8 -*-
# Code adapted from the main `TextBlob`_ library.
#
# :repo: `https://github.com/sloria/TextBlob`_
# :source: textblob/blob.py
# :version: 2013-10-21 (a88e86a76a)
#
# :modified: 2014-09-17 <m.killer@langui.ch>
#
"""Wrappers for various units of text.
This includes the main :class:`TextBlobDE <t... | markuskiller/textblob-de | textblob_de/blob.py | Python | mit | 30,630 |
#!/usr/bin/python
"""
This Python script is written by Zhiyang Ong to test his
Python script to build a database of NCBI SRA files.
The script is named: build_sra_seq_db.py
Synopsis:
Carry out automated regression testing to see if
"build_sra_seq_db.py" works as specified.
This script can be execute... | eda-globetrotter/Calabria-Digital-Bio | reads-dna-seq/fix_imports.py | Python | mit | 2,642 |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... | elthariel/dff | api/gui/itemview/treeitemmodel.py | Python | gpl-2.0 | 12,455 |
"""A Django library, but but auto-loaded via the templatetags/ directory.
Instead, to use it, it needs to be added to the builtins.
"""
def foo(value):
return "{foo}"
from django.template import Library
register = Library()
register.filter('foo_django_builtin', foo)
| akx/coffin | tests/res/apps/django_lib.py | Python | bsd-3-clause | 274 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 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/secondaires/navigation/equipage/volontes/relacher_gouvernail.py | Python | bsd-3-clause | 3,566 |
from isort import SortImports
from coalib.bearlib import deprecate_settings
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.R... | IPMITMO/statan | coala-bears/bears/python/PyImportSortBear.py | Python | mit | 12,036 |
from __future__ import unicode_literals
import datetime
import mock
import pytz
from tracpro.test import factories
from tracpro.test.cases import TracProTest
from .. import forms
class TestPollChartFilterForm(TracProTest):
def setUp(self):
super(TestPollChartFilterForm, self).setUp()
self.o... | xkmato/tracpro | tracpro/polls/tests/test_forms.py | Python | bsd-3-clause | 2,907 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | dezinezync/DZDynamicType | build.py | Python | mit | 6,816 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper functions used in multiple unit tests."""
import base64
import json
import mock
import os
import re
import unittest
import urllib
from google.app... | sahiljain/catapult | dashboard/dashboard/common/testing_common.py | Python | bsd-3-clause | 8,456 |
# -*- coding: utf-8 -*-
from . import basic
Basic = basic.BasicCanonicalSolver | rahulsharma1991/frontera | frontera/contrib/canonicalsolvers/__init__.py | Python | bsd-3-clause | 78 |
import my_data_room
d = my_data_room. my_room
print "hi my name is %s, and i am %d years old" % (d['name' ,d['age'])
print "hi my name is %s", d["name"]
print "my adress is %s", d['adress']
print "i have %s roommates", d['noroommates']
print "her name is %s ", d['roommate']
print "my room is %d big", d['square ... | ArtezGDA/text-IO | Lola/format_room.py | Python | mit | 407 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jakereps/qiime-workshops | config/settings/production.py | Python | bsd-3-clause | 3,818 |
# The MIT License (MIT)
# Copyright (c) 2016, 2017 by the ESA CCI Toolbox development team and contributors
#
# 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 wi... | CCI-Tools/cate-core | cate/core/ds.py | Python | mit | 23,947 |
# Connect to wireless network as client
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("itcollege")
# Synchronize clock
#This may not work, but will connect nonetheless
import ntptime
ntptime.settime()
# Create a variable for hostname based on MAC address:
import ubinascii as binas... | Danzmann/iot_exemple | boot.py | Python | gpl-3.0 | 435 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
from frappe import _
from frappe.desk.notifications import clear_notifications
import functools
@frappe.w... | ESS-LLP/erpnext-medical | erpnext/setup/doctype/company/delete_company_transactions.py | Python | gpl-3.0 | 4,230 |
import glob
import os
import struct
import sys
import invoke
import requests
from .base import BaseTest
class Test(BaseTest):
def __init__(self, func, deps=[], needs_rpython=True, needs_rubyspec=False,
create_build=False):
super(Test, self).__init__()
self.func = func
s... | babelsberg/babelsberg-r | tasks/travis.py | Python | bsd-3-clause | 5,222 |
from django.contrib import admin
from apps.friends.models import Contact
from apps.friends.models import Friendship, FriendshipInvitation, FriendshipInvitationHistory
from apps.friends.models import JoinInvitation
class ContactAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'email', 'user', 'added')
cla... | Turan-no/Turan | apps/friends/admin.py | Python | agpl-3.0 | 1,079 |
#!/usr/bin/env python2
# coding: utf-8
import os
import unittest
from pykit import strutil
from pykit.strutil import Hex
from pykit import ututil
from pykit import utfjson
dd = ututil.dd
class TestHex(unittest.TestCase):
def test_init(self):
byte_length = 3
cases = (
(0, 0),
... | sejust/pykit | strutil/test/test_hex.py | Python | mit | 5,256 |
import openmc
from openmc.source import Source
from openmc.stats import Box
###############################################################################
# Simulation Input File Parameters
###############################################################################
# OpenMC simulation parame... | kellyrowland/openmc | examples/python/lattice/hexagonal/build-xml.py | Python | mit | 5,739 |
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# This file is part of the Patchwork package.
#
# Patchwork 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; eith... | dlespiau/patchwork | patchwork/views/__init__.py | Python | gpl-2.0 | 8,522 |
# copyright 2009 Thomas Gideon
#
# This file is part of flashbake.
#
# flashbake 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 lat... | commandline/flashbake | src/flashbake/plugins/__init__.py | Python | gpl-3.0 | 6,371 |
from drawille.graphics_utils import get_pos, CH_HEIGHT, CH_WIDTH, frange
from arena import *
__author__ = 'ericmuxagata'
BASE_SIZE = 5
DIR_W = 0
DIR_S = 1
DIR_E = 2
DIR_N = 3
class SnakeNode(object):
def __init__(self,x,y,c,dir, next=None,prev=None):
self.x, self.y = x,y
self.color, self.dir = c... | marcioapaiva/baphomet | snake.py | Python | mit | 3,430 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/deployment_operation_paged.py | Python | mit | 998 |
# wsse/tests/test_utils.py
# coding=utf-8
# pywsse
# Authors: Rushy Panchal, Naphat Sanguansin, Adam Libresco, Jérémie Lumbroso
# Date: August 30th, 2016
# Description: Test utility functions.
from unittest import TestCase
import hashlib
import base64
import datetime
import mock
from wsse import utils, settings, exc... | PrincetonUniversity/pywsse | wsse/tests/test_utils.py | Python | lgpl-3.0 | 20,298 |
"""Index board jobpost
Revision ID: 5d4d936e9c
Revises: 4bd08758f049
Create Date: 2015-03-18 20:43:19.264986
"""
# revision identifiers, used by Alembic.
revision = '5d4d936e9c'
down_revision = '4bd08758f049'
from alembic import op
def upgrade():
op.create_index(
op.f('ix_board_jobpost_jobpost_id'),
... | hasgeek/hasjob | migrations/versions/5d4d936e9c_index_board_jobpost.py | Python | agpl-3.0 | 498 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2015, Anima Istanbul
#
# This module is part of anima-tools and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
from anima import logger
from anima.env import empty_reference_resolution
from anima.ui.base import AnimaDialogBase, ui_call... | sergeneren/anima | anima/ui/version_updater.py | Python | bsd-2-clause | 12,135 |
from django.conf.urls import include, url
from .views import YoMamaBotView
urlpatterns = [
url(r'^m/?$', YoMamaBotView.as_view())
]
| sek8888/yotest | fb_yomamabot/urls.py | Python | gpl-3.0 | 166 |
# Copyright (c) 2012 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 ... | sebrandon1/nova | nova/compute/resource_tracker.py | Python | apache-2.0 | 43,617 |
from jnius import autoclass, cast
from android.runnable import run_on_ui_thread
Toast = autoclass('android.widget.Toast')
context = autoclass('org.renpy.android.PythonActivity').mActivity
@run_on_ui_thread
def toast(text, length_long=False):
duration = Toast.LENGTH_LONG if length_long else Toast.LENGTH_SHORT
... | tehpug/RFAttendance | toast/androidtoast.py | Python | gpl-3.0 | 471 |
#!/usr/bin/env python3
#
# borme_poller.py -
# Copyright (C) 2015 Pablo Castellano <pablo@anche.no>
#
# 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 yo... | PabloCastellano/bormeparser | scripts/borme_poller.py | Python | gpl-3.0 | 3,333 |
import base64
from converters.abstract_converter import AbstractConverter
class Base64Converter(AbstractConverter):
ENCODED_CHUNK_LEN = 4
def encode(self, normal_message):
return base64.standard_b64encode(normal_message)
def decode(self, encoded_message):
return base64.standard_b64decod... | belyak/ftk-5-networks-core | converters/base64_converter.py | Python | gpl-3.0 | 338 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(prima... | elcarlitux/software | django/mysite2/polls/migrations/0001_initial.py | Python | agpl-3.0 | 1,262 |
class ReverseComplement(object):
def __init__(self, sequence, reverse = True):
if reverse:
self.inputSeq = sequence[::-1]
else:
self.inputSeq = sequence
self.inputSeq = self.inputSeq.upper()
self.complementTable = self.createComplementTable()
self... | michael-weinstein/complement | complement.py | Python | mit | 5,007 |
import imp
import sys
import traceback
class ErrorlessImport(object):
def find_module(self, name, path):
try:
return imp.find_module(name, path)
except ImportError:
#raise
return FreeLoader()
class Mock(object):
def __repr__(self):
return "<Silly Hu... | johncosta/private-readthedocs.org | readthedocs/core/hacks.py | Python | mit | 798 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostNatServiceNameServiceSpec(vim, *args, **kwargs):
'''This data object type specifi... | xuru/pyvisdk | pyvisdk/do/host_nat_service_name_service_spec.py | Python | mit | 1,156 |
# -*- coding: utf-8 -*-
"""
The Yacas domain.
:copyright: Copyright 2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx import addnodes
from sphinx.roles import XRefRole
from sphinx... | martanoga/yacas | docs/util/yacasdomain.py | Python | lgpl-2.1 | 13,972 |
#
__version__ = '2.8.0.dev4'
| bubenkoff/pytest | _pytest/__init__.py | Python | mit | 29 |
# -*- coding: utf-8 -*-
#
# audiodiff documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 31 11:29:44 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | clee704/audiodiff | docs/conf.py | Python | mit | 8,197 |
# Python test set -- built-in functions
import test.test_support, unittest
import sys
import pickle
import itertools
import warnings
warnings.filterwarnings("ignore", "integer argument expected",
DeprecationWarning, "unittest")
# pure Python implementations (3 args only), for comparison
def p... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_xrange.py | Python | gpl-2.0 | 7,825 |
import unittest
from Tribler.community.market.core.ttl import Ttl
class TtlTestSuite(unittest.TestCase):
"""Ttl test cases."""
def setUp(self):
# Object creation
self.ttl = Ttl(0)
self.ttl2 = Ttl(2)
self.ttl3 = Ttl(2)
self.ttl4 = Ttl(1)
def test_init(self):
... | vandenheuvel/tribler | Tribler/Test/Community/Market/test_ttl.py | Python | lgpl-3.0 | 1,095 |
##########################################################################
#
# Copyright (c) 2011-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 prov... | chippey/gaffer | python/GafferTest/PlugTest.py | Python | bsd-3-clause | 23,322 |
#encoding: utf8
import pytest
from rejit.x86encoder import InstructionEncodingError, Reg, Scale, Encoder, Encoder32, Encoder64, Opcode, Mem
reg64 = [Reg.EAX, Reg.ECX, Reg.EDX, Reg.EBX, Reg.ESP, Reg.EBP, Reg.ESI, Reg.EDI, Reg.R8, Reg.R9, Reg.R10, Reg.R11, Reg.R12, Reg.R13, Reg.R14, Reg.R15]
reg64_1 = reg64[:8]
reg6... | ziowk/rejit | tests/test_x86encoder.py | Python | gpl-2.0 | 16,018 |
"""
SkCode emoticons replacement utility test code.
"""
import unittest
from html import escape as escape_html
from skcode.etree import RootTreeNode
from skcode.tags import TextTreeNode
from skcode.utility.smileys import (
setup_smileys_replacement,
do_smileys_replacement,
DEFAULT_EMOTICONS_MAP,
EMOTI... | TamiaLab/PySkCode | tests/tests_utility/tests_smileys.py | Python | agpl-3.0 | 5,389 |
from django.db.models.signals import post_save, post_delete
from wagtail.wagtailsearch.index import get_indexed_models
from wagtail.wagtailsearch.backends import get_search_backends
def get_indexed_instance(instance):
indexed_instance = instance.get_indexed_instance()
if indexed_instance is None:
ret... | taedori81/wagtail | wagtail/wagtailsearch/signal_handlers.py | Python | bsd-3-clause | 1,254 |
import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class PurchaseModeratedOfflineTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 4
def run_test(self)... | OpenBazaar/openbazaar-go | qa/purchase_moderated_offline.py | Python | mit | 11,018 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2014 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | avanzosc/avanzosc6.1 | avanzosc_link_purchase_order_with_purchase_order/__openerp__.py | Python | agpl-3.0 | 1,537 |
from django_freeradius.apps import DjangoFreeradiusConfig
class SampleRadiusConfig(DjangoFreeradiusConfig):
name = 'sample_radius'
| openwisp/django-freeradius | tests/sample_radius/apps.py | Python | gpl-3.0 | 137 |
"""
Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 ... | ffu/DSA-3.2.2 | grc/gui/Utils.py | Python | gpl-3.0 | 2,514 |
from collections import OrderedDict
@IN.hook
def access_keys():
entitier = IN.entitier
# flagger not available here
#flagger = IN.flagger
keys = {}
group = 'Flag'
keys[group] = OrderedDict() # we may need order
keys_entity_type = keys[group]
# flag any entities
keys_entity_type['flag'] = {
'title' :... | vinoth3v/In | In/flag/access.py | Python | apache-2.0 | 1,957 |
import random
from tsp.ga.selection import SelectionScheme
class TournamentSelection(SelectionScheme):
"""
Runs tournaments between indivduals until a sufficient number are obtained.
"""
def __init__(self):
self.tournament_size = 5
def select(self, population):
selected = []
while len(selected... | SoftlySplinter/sem6120-assign2 | tsp/ga/selection/tournament.py | Python | unlicense | 609 |
# !/usr/bin/env python
# coding: utf-8
'''
Description:
Merge k sorted linked lists and return it as one sorted list.
Analyze and describe its complexity.
Tags: Divide and Conquer, Linked List, Heap
Solution 1: Brute force
k个长度为n的list依次合并; 时间复杂度为2n+3n+...+kn=O(nk^2), 空间复杂度为O(1)
Solution 2: Heap
利用最小堆... | Jan-zou/LeetCode | python/LinkedList/23_merge_k_sorted_lists.py | Python | mit | 2,965 |
# coding=utf-8
from flask import Flask
from flask_site.homepage import index_page
__author__ = 'dolacmeo'
app = Flask(__name__)
app.config['DEBUG'] = True
app.register_blueprint(index_page)
if __name__ == '__main__':
app.run('0.0.0.0')
pass
| dolaCmeo/quick_flask | quick_flask.py | Python | mit | 252 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
"""
Unit tests for octoprint.access.users
"""
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under te... | foosel/OctoPrint | tests/access/users/__init__.py | Python | agpl-3.0 | 347 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
"""
# NOTE:
THE self.lang[operator] PATTERN ... | klahnakoski/SpotManager | vendor/jx_base/expressions/not_left_op.py | Python | mpl-2.0 | 2,670 |
class Node:
""" Used for traversal in a binary tree """
def __init__(self, key):
self.key = key
self.height = 0
self.left = None
self.right = None
class AVL:
""" Same as binary, though with enforced height balancing.
Left and right subtrees may only differ in heights b... | jrpotter/lodestar | lodes/Trees/AVL/avl.py | Python | apache-2.0 | 3,894 |
#!/usr/bin/python
#
# 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
# "Lice... | ikoula/cloudstack | scripts/vm/hypervisor/ovm3/cloudstack.py | Python | gpl-2.0 | 19,613 |
# -*- coding: utf-8 -*-
##
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
# This file is part of openmano
# 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 ... | me-ankur/openmano | openmano/httpserver.py | Python | apache-2.0 | 43,187 |
# coding:utf8
"""
@file bucketSort.py
@brief bucket sort simple test.
分析:
1,桶本身就已经是具备顺序的一个个集合
2,本质上,这是一种非比较类-线性时间-分配类-排序
3,物以类聚、人以群分,社会分层始终存在,左与右的选择
4,缺点:浪费空间,桶的数量
关键字:分配到各个桶、收集各个桶的信息
@author unlessbamboo
@version 1.0
@date 2016-02-15
"""
def bucketSort(list... | unlessbamboo/grocery-shop | algorithm/sort/bucketSort.py | Python | gpl-3.0 | 1,071 |
# -*- coding:utf-8 -*-
# #############################################################################
# ################################ Notes ##################################
# #############################################################################
"""
1. run the script
2. acces to the codes by li... | denisjul/firststeps | download-law-codes/download_codes.py | Python | gpl-3.0 | 8,846 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
import module.api.config as config
import module.common.const as const
import module.common.util as util
from xml.etree.ElementTree import Element,SubElement
from bottle import route, request, HTTPResponse
from module.common.topologydb import *
from module.co... | dana-i2cat/felix | msjp/module/api/monitoring_tn_rest.py | Python | apache-2.0 | 11,392 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from calcoohija import CalculadoraHija
from calcoohija import numerical_float
from calcoohija import resultado
def resultados_operaciones(lineas):
for operandos in lineas:
operando = operandos.split(',')
operacion = operando[0]
numero... | vmartinezf/ptavi-p2 | calcplus.py | Python | gpl-2.0 | 939 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.