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 |
|---|---|---|---|---|---|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | nusdbsystem/incubator-singa | test/python/test_optimizer.py | Python | apache-2.0 | 12,498 |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from os.path import dirname
import platform
import sys
import tempfile
import unittest
import driver_env
import driver_... | davidbrazdil/nacl | pnacl/driver/tests/driver_test_utils.py | Python | bsd-3-clause | 4,978 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
import logging
from django.core import urlresolvers
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext, loader
from django.utils import simplejs... | django-wodnas/django-tinymce | tinymce/views.py | Python | mit | 4,440 |
import unittest
from backtesting.Order import Order
from backtesting.Parser.CSVOrderParser import CSVOrderParser
class CSVOrderParserTest(unittest.TestCase):
def test_parse_file(self):
parser = CSVOrderParser("data/SimpleOrdersFile.csv")
parser.parse()
orders = parser.get_parsed_orders(... | Winterflower/voyager | test/Parser/test_CSV_Order_Parser.py | Python | mit | 1,514 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | jmehnle/ansible | lib/ansible/plugins/action/junos.py | Python | gpl-3.0 | 5,819 |
import uuid, os, requests, re
from django.conf import settings
from panapp.constants import NAME_INVALID, DOB_INVALID, PAN_INVALID
def get_upload_file_path(instance, filename):
ext = filename.split('.')[-1]
filename = "%s.%s" % (uuid.uuid4(), ext)
initial_path = str(settings.BASE_DIR) + str(settings.MEDIA_... | sheeshmohsin/insta_hack | panverification/panapp/utils.py | Python | mit | 3,344 |
######################################################################
# Python Open Dynamics Engine Wrapper
# Copyright (C) 2004 PyODE developers (see file AUTHORS)
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of EITHER:
# (1) The GNU Lesser Gen... | coiax/pyode | examples/transforms.py | Python | lgpl-2.1 | 6,011 |
from django.views.decorators.cache import never_cache
from django.views.generic.base import RedirectView
from C4CApplication.views.utils import create_user
class MemberDetailsRedirectView(RedirectView):
url = ""
connected_member = None
def dispatch(self, request, *args, **kwargs):
... | dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/views/MemberDetailsRedirectView.py | Python | agpl-3.0 | 1,019 |
import re
__all__ = (
'Email', 'email', 'EqualTo', 'equal_to', 'IPAddress', 'ip_address',
'Length', 'length', 'NumberRange', 'number_range', 'Optional', 'optional',
'Required', 'required', 'Regexp', 'regexp', 'URL', 'url', 'AnyOf',
'any_of', 'NoneOf', 'none_of'
)
class ValidationError(ValueError):
... | ForrestSutton/foodsafely | wtforms/validators.py | Python | gpl-2.0 | 11,527 |
#! /usr/bin/env python
## Simple Python routine for creating a new AVR project
## Feel free to extend this to meet your needs
## In particular, main.h includes nearly every AVR library you'll ever need
## which is no problem, b/c the linker will just ignore the unused ones.
## But if you're not using them, it migh... | hexagon5un/AVR-Programming | setupProject/setupProject.py | Python | mit | 1,408 |
# Copyright 2017 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/syntaxnet/dragnn/python/network_units_test.py | Python | bsd-2-clause | 5,321 |
# Copyright (c) 2012-2013 Rackspace Hosting
# 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
#
# Unles... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/cells/weights/ram_by_instance_type.py | Python | gpl-2.0 | 1,971 |
"""Tests the pytest-redis backup list arguments."""
import utils
def create_test_file(testdir):
"""Create test file and return array of paths to tests."""
test_filename = "test_file.py"
test_filename_contents = """
def test_exists():
assert True
def test_does_exist():
... | sabidib/pytest-redis | tests/test_backup_list.py | Python | mit | 2,296 |
from django.contrib import admin
from locations.models import LocationType, LocationBase
admin.site.register(LocationType)
admin.site.register(LocationBase)
| ascii1011/basecat | apps/locations/admin.py | Python | gpl-2.0 | 159 |
'''
Tests for the ``gtk.CellRendererText`` class.
'''
import gtk
from gtk import gdk
def test_default_attributes():
cr = gtk.CellRendererText()
assert not cr.get_property('editable')
assert not cr.get_property('text')
# gtk.CellRenderer properties
bg = cr.get_property('cell-background-gdk')
as... | GNOME/testinggtk | tests/test_cellrenderertext.py | Python | lgpl-2.1 | 2,177 |
from O365.message import Message
import logging
import json
import requests
log = logging.getLogger(__name__)
class Inbox( object ):
'''
Wrapper class for an inbox which mostly holds a list of messages.
Methods:
getMessages -- downloads messages to local memory.
Variables:
inbox_url -- url used for fetc... | roycem90/python-o365 | O365/inbox.py | Python | apache-2.0 | 2,984 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2009, Eucalyptus Systems, Inc.
# All rights reserved.
#
# 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 res... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/tests/integration/ec2/test_connection.py | Python | gpl-3.0 | 8,892 |
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^ratings/', include('star_ratings.urls', namespace='ratings', app_name='ratings')),
url(r'^', includ... | radamizell/WallApp | walltalkie/urls.py | Python | mit | 612 |
from xml.dom.minidom import Document
import os
import re
from PIL import Image
import shutil
import random
import time
import glob
class Palette:
def __init__(self):
#print 'image info'
self.paletteColors = {}
self.palette = {}
def generatePaletteInfo(self):
file = 'icon.png'
self.im = Image.open(fi... | initials/dowebsite | _python/core.py | Python | gpl-3.0 | 2,064 |
# I just use a tricky technique here
# Improved from 3.10% to 14.34 %
# Far from perfect, however, better
# {Leetcode : AC, Lintcode : AC}
# Based on the 001 version, and make use of the SYMMETRY of this problem
class Solution(object):
def solveNQueens(self, n):
"""
:type n: int
:rtype: Lis... | Chasego/cod | leetcode/051-N-Queens/NQueens_002.py | Python | mit | 1,941 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import summary_template
from . import summary
from . import summary_log
from . import file_system
| CLVsol/clvsol_odoo_addons | clv_summary/models/__init__.py | Python | agpl-3.0 | 256 |
# -*- coding: utf-8 -*-
#
# Author: Taylor Smith <taylor.smith@alkaline-ml.com>
#
# Test the autoencoder
from __future__ import division, absolute_import, division
from tensorflow.examples.tutorials.mnist import input_data
from numpy.testing import assert_almost_equal
from smrt.autoencode import AutoEncoder
import num... | tgsmith61591/smrt | smrt/autoencode/tests/test_autoencoder.py | Python | bsd-3-clause | 1,531 |
#!/usr/bin/env python
import numpy
numpy.seterr(all='raise')
import pylab
from constants import T, L, d, pl, E, mu_s, mu_d, mu_v0
us = mu_s; ud = mu_d; v0 = mu_v0;
#from defs import FS
DIRNAME="out-bow-skip/"
import os
if not os.path.exists(DIRNAME):
os.makedirs(DIRNAME)
FS = 44100
#FS = 88200
Y_MIN = -1.0
Y_... | gperciva/artifastring | research/numpy-string/test_changing_slipstate.py | Python | gpl-3.0 | 5,901 |
import commands
import os
#linux
commands.getstatusoutput('netstat -n')
commands.getoutput('netstat -n')
#windows
os.system('netstat -n') | AgainstWind/python-demos | common-libs/test.py | Python | apache-2.0 | 140 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import time
import odoo
import odoo.tests
from odoo.modules.module import get_manifest
from odoo.tools import mute_logger
_logger = logging.getLogger(__name__)
class TestAssetsGenerateTimeCommon(odoo.tests.TransactionCase):
... | jeremiahyan/odoo | addons/web/tests/test_assets.py | Python | gpl-3.0 | 2,324 |
from .app import app
class Highlighter(object):
def __init__(self, default_attr='highlight', default_focus='highlight_focus'):
self.highlights = {}
self.default_attr = default_attr
self.default_focus = default_focus
def apply(self, row, attr_style=None, focus_style=None):
attr_... | dustinlacewell/console | console/highlights.py | Python | mit | 972 |
# -*- coding: utf-8 -*-
#Copyright (C) 2011 Seán Hayes
from django.conf.urls.defaults import patterns, include, url
from django.http import HttpResponse
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', ... | SeanHayes/swarm-war | swarm_war_test_project/urls.py | Python | agpl-3.0 | 1,127 |
import RPi.GPIO as GPIO
#from sakshat import SAKSHAT
import time
import os,sys
import signal
#SAKS = SAKSHAT()
GPIO.setmode(GPIO.BCM) # BOARD编号方式,基于插座引脚编号
GPIO.setwarnings(False)
DS = 6
SHCP = 19
STCP = 13 #LED灯
LKEY = 16
RKEY = 20 #左右开关
BEEP = 12
LIR_RCV = ... | chbpku/rpi.sessdsa | 代码/11 多功能篮球计分器/nightlight/digital-clock/beep.py | Python | gpl-3.0 | 2,319 |
# Raspberry Pi Film Capture Library package
#
# Copyright (c) 2016, Joe Herman
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# lis... | jphfilm/rpi-film-capture | server/filmCap/__init__.py | Python | mit | 1,890 |
from ..external.qt.QtGui import QWidget, QListWidgetItem
from ..external.qt.QtCore import Signal
from .qtutil import load_ui
class ComponentSelector(QWidget):
""" An interface to view the components and data of a DataCollection
Components can be draged and dropped.
The currently-selected componentID is... | bsipocz/glue | glue/qt/component_selector.py | Python | bsd-3-clause | 3,939 |
# Copyright (c) 2009 The Regents of The University of Michigan
# 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 ... | xiaoyuanW/gem5 | src/arch/sparc/SparcNativeTrace.py | Python | bsd-3-clause | 1,822 |
#! /usr/bin/env python
"""
pyparsing based grammar for DCPU-16 0x10c assembler
"""
try:
from itertools import izip_longest
except ImportError:
from itertools import zip_longest as izip_longest
try:
basestring
except NameError:
basestring = str
import logging; log = logging.getLogger("dcpu16_asm")
log... | Olical/dcpu16py | asm_pyparsing.py | Python | mit | 16,612 |
from django import template
from django.core.urlresolvers import reverse
import yaml
register = template.Library()
@register.inclusion_tag('menus/subnav.html', takes_context=True)
def subnav(context, path=None):
"""Renderiza sub navegação para objetos no padrão Mestre Detalhe
Existem três possíveis fontes ... | ramiroluz/saap | saap/core/templatetags/menus.py | Python | gpl-3.0 | 4,559 |
# -*- coding: utf-8 -*-
#
# traffic documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 5 23:08: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
# autogenerated file.
#
# A... | ariel17/traffic | docs/conf.py | Python | mit | 10,344 |
# -*- coding: utf-8 -*-
#
# File: __init__.py
# Module: l10n_ch_hr_payroll
#
# Created by sge@open-net.ch
#
# Copyright (c) 2014-TODAY Open-Net Ltd. <http://www.open-net.ch>
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright ... | cgaspoz/l10n-switzerland | l10n_ch_hr_payroll/models/__init__.py | Python | agpl-3.0 | 1,194 |
import cv2
import numpy as np
import opensfm.transformations as tf
from opensfm import align
from opensfm import types
def points_errors(reference, candidate):
common_points = set(reference.points.keys()).intersection(
set(candidate.points.keys())
)
return np.array(
[
referenc... | oscarlorentzon/OpenSfM | opensfm/synthetic_data/synthetic_metrics.py | Python | bsd-2-clause | 3,481 |
from django.apps import apps
import logging
import urlparse
import random
import requests
from framework.celery_tasks import app as celery_app
from website import settings, mails
from website.util.share import GraphNode, format_contributor
logger = logging.getLogger(__name__)
@celery_app.task(ignore_results=True)... | aaxelb/osf.io | website/project/tasks.py | Python | apache-2.0 | 5,755 |
#!/usr/bin/env python
from solo.template import render_template
class HomeController(object):
def index(self):
return render_template('index.html')
def _404_page(self, *args, **kw):
return render_template('404.html') | whiteclover/Lilac | lilac/controller/home.py | Python | lgpl-3.0 | 251 |
# Natural Language Toolkit: Senseval 2 Corpus Reader
#
# Copyright (C) 2001-2011 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Steven Bird <sb@csse.unimelb.edu.au> (modifications)
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Read from the Senseval 2 Corpus.
SENSEVAL... | tadgh/ArgoRevisit | third_party/nltk/corpus/reader/senseval.py | Python | apache-2.0 | 7,816 |
from tornado import gen
from jupyterhub.auth import Authenticator
from traitlets import Dict
class BasicAuthenticator(Authenticator):
""" Simple authenticator based on a fixed set of users"""
#: Dictionary of regular username: password keys allowed
user_data = Dict().tag(config=True)
#: Dictionary ... | simphony/simphony-remote | remoteappmanager/jupyterhub/auth/basic_authenticator.py | Python | bsd-3-clause | 902 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsmarkerlinesymbollayer.py
---------------------
Date : November 2018
Copyright : (C) 2018 by Nyall Dawson
Email : nyall dot dawson at gmail dot co... | dwadler/QGIS | tests/src/python/test_qgsmarkerlinesymbollayer.py | Python | gpl-2.0 | 6,063 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pppcemr', '0085_auto_20160222_2041'),
]
operations = [
migrations.CreateModel(
name='DrugAdmin',
fie... | sstebbins/pppcpro | pppcemr/migrations/0086_drugadmin.py | Python | agpl-3.0 | 532 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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, ei... | Alignak-monitoring/alignak | alignak/daemons/pollerdaemon.py | Python | agpl-3.0 | 2,565 |
#!/usr/bin/env python2
#
# Author: Masahiro Yamada <yamada.masahiro@socionext.com>
#
# SPDX-License-Identifier: GPL-2.0+
#
"""
Move config options from headers to defconfig files.
Since Kconfig was introduced to U-Boot, we have worked on moving
config options from headers to Kconfig (defconfig).
This tool intends to... | dasuimao/U-BOOT-Tiny4412 | tools/moveconfig.py | Python | gpl-3.0 | 45,311 |
# Pimp is a highly interactive music player.
# Copyright (C) 2011 kedals0@gmail.com
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | larcher/python-mpd-server | mpdserver/mpdserver.py | Python | gpl-3.0 | 16,989 |
import numpy as np
from scipy.linalg import kron
from scipy.sparse import identity
from copy import deepcopy
from mps import MPS,ket2mps,overlap,expect
from dmrg import DMRGEngine
from testdmrg import lhgen,rhgen
ket=np.random.rand(2**4)
mps=ket2mps(ket,2,4,cano='mixed',div=2)
ket2=np.random.rand(2**4)
mps2=ket2mps(k... | Lynn-015/NJU_DMRG | dmrg/testmps.py | Python | mit | 1,886 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | bin/analysis/shape/__init__.py | Python | apache-2.0 | 7,687 |
#!/usr/bin/env python
# -*- coding: <utf-8> -*-
"""
This file is part of Spartacus project
Copyright (C) 2016 CSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, o... | CommunicationsSecurityEstablishment/spartacus | CapuaEnvironment/IntructionFetchUnit/InstructionFetchUnit.py | Python | gpl-2.0 | 5,388 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 KuraLabs S.R.L
#
# 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 appl... | carlos-jenkins/autoapi | lib/autoapi/apinode.py | Python | apache-2.0 | 12,082 |
#
# Copyright (C) 2013-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | espressomd/espresso | testsuite/python/integrator_npt_stats.py | Python | gpl-3.0 | 2,473 |
"""
The Beer Distribution Problem for the PuLP Modeller
Authors: Antony Phillips, Dr Stuart Mitchell 2007
"""
# Import PuLP modeler functions
from pulp import *
# Creates a list of all the supply nodes
Warehouses = ["A", "B"]
# Creates a dictionary for the number of units of supply for each supply node
supply = {"... | ruxkor/pulp-or | examples/BeerDistributionProblem.py | Python | mit | 2,318 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import find_packages
from setuptools import setup
import py_swf
readme = open('README.rst').read()
doclink = """
Documentation
-------------
The full documentation is at http://py-swf.readthedocs.i... | quantsini/pyswf | setup.py | Python | mit | 1,452 |
#/***************************************************************************
# * Copyright (c) Victor Titov (DeepSOIC) *
# * (vv.titov@gmail.com) 2016 *
# * *
# * Th... | bblacey/FreeCAD-MacOS-CI | src/Mod/Part/BOPTools/JoinAPI.py | Python | lgpl-2.1 | 7,655 |
"""Basic checks for HomeKit motion sensors and contact sensors."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from tests.components.homekit_controller.common import setup_test_component
V1_ON = ("fan", "on")
V1_ROTATION_DIRECTION = ("fan", "ro... | jawilson/home-assistant | tests/components/homekit_controller/test_fan.py | Python | apache-2.0 | 17,165 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
THEANO_LINKER = "cvm"
from controllers import TrainingController, TrainingValidator
from base import NeuralTrainer
from trainers import *
from optimize import *
from annealers import *
from customize_trainer import CustomizeTrainer
from util import wrap_core, multiple_l2_... | zomux/deepy | deepy/trainers/__init__.py | Python | mit | 452 |
#!/usr/bin/env python
########################################################################################################################
# Load configuration from specified file #
################################################################################################################... | sahmri/simpleBackup | settings.py | Python | apache-2.0 | 3,188 |
import pytest
import salt.modules.win_servermanager as win_servermanager
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {win_servermanager: {"__grains__": {"osversion": "6.2"}}}
def test_install():
"""
Test win_servermanager.install
"""
moc... | saltstack/salt | tests/pytests/unit/modules/test_win_servermanager.py | Python | apache-2.0 | 2,675 |
# Copyright 2015 Cloudbase Solutions Srl
# Copyright 2010-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/licen... | gabriel-samfira/networking-hyperv | hyperv/tests/base.py | Python | apache-2.0 | 5,081 |
"""This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import string
import random
def process_file(filename, skip_header):
"""Makes a histogram that contains the words from a file.
... | hacpai/reading-lists | Think Python/analyze_book.py | Python | bsd-2-clause | 3,358 |
#!/usr/bin/env python
"""
git-ftp: painless, quick and easy working copy syncing over FTP
Copyright (c) 2008-2012
Edward Z. Yang <ezyang@mit.edu>, Mauro Lizaur <mauro@cacavoladora.org> and
Niklas Fiekas <niklas.fiekas@googlemail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of thi... | householdsteve/bearded-octo-ironman | git-ftp.py | Python | gpl-2.0 | 16,737 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-21 08:43
import datetime
from django.db import migrations, models
import django.db.models.deletion
import seahub.base.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.... | miurahr/seahub | seahub/share/migrations/0001_initial.py | Python | apache-2.0 | 4,833 |
import sys
from PyQt4 import QtGui,QtCore
#add frontend here
class Exampleone(QtGui.QWidget):
#remove this
def __init__(self):
super(Exampleone, self).__init__()
self.initUI()
def initUI(self):
cb = QtGui.QCheckBox('time pass]', self)
cb.move(20, 20)
... | mlskit/astromlskit | FRONTEND/FrontEnd.py | Python | gpl-3.0 | 3,807 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="size", parent_name="layout.scene.yaxis.tickfont", **kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/yaxis/tickfont/_size.py | Python | mit | 505 |
import sys
# This is a test module for Python. It looks in the standard
# places for various *.py files. If these are moved, you must
# change this module too.
try:
import os
except:
print """Could not import the standard "os" module.
Please check your PYTHONPATH environment variable."""
sys.exit(1)
... | teeple/pns_server | work/install/Python-2.7.4/PC/testpy.py | Python | gpl-2.0 | 834 |
from unittest import TestCase
from z80 import Z80
from z80 import add_8bit, add_16bit, sub_8bit, sub_16bit
from z80 import rotate_right, rotate_right_through_carry
from z80 import rotate_left, rotate_left_through_carry
from z80 import ALUResult
from z80 import signed_8bit
from z80 import shift_left, shift_right_arithme... | zbyrne/gameboy | pyboy/test_z80.py | Python | gpl-2.0 | 11,995 |
# -*- coding: utf-8 -*-
import os
from utils import make_dir
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
INSTANCE_FOLDER_PATH = os.path.join(PROJECT_ROOT, 'instance')
class BaseConfig(object):
PROJECT = "rootio"
DEBUG = False
TESTING = False
ADMINS = ['fabiocl93@gmai... | fcl-93/rootio_web | rootio/config-server-backup.py | Python | agpl-3.0 | 2,381 |
import sqlite3
import os
def init():
"""
Creates and initializes settings database.
Doesn't do anything if the file already exists. Remove the local copy to recreate the database.
"""
if not os.path.isfile("settings.sqlite"):
app_db_connection = sqlite3.connect('settings.sqlite')
... | Pasotaku/Anime-Feud-Survey-Backend | Old Python Code/settings_db_init.py | Python | mit | 617 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-02-27 01:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tab', '0005_merge'),
]
operations = [
migrations.AlterField(
model_name='judge',
name='ballot... | jolynch/mit-tab | mittab/apps/tab/migrations/0006_auto_20180227_0142.py | Python | mit | 433 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib import unquote_plus
import urllib2
from django.db import models
from django.conf import settings
from django.http import QueryDict
from django.utils.http import urlencode
from paypal.standard.models import PayPalStandardBase
from paypal.standard.conf im... | bluestemscott/librarygadget | librarygadget/paypal/standard/pdt/models.py | Python | mit | 3,495 |
#!/usr/bin/env python
#
# Copyright (c) 2012 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.
"""Process Android resources to generate R.java, and prepare for packaging.
This will crunch images and generate v14 compatible ... | ondra-novak/chromium.src | build/android/gyp/process_resources.py | Python | bsd-3-clause | 9,505 |
class Program:
"""Data type encapsulating an executable BASIC program."""
def __init__(self):
pass
| chaosotter/python-basic | lib/runtime/program.py | Python | mit | 116 |
# Headers
__author__ = 'Somsubhra Bairi'
__email__ = 'somsubhra.bairi@gmail.com'
# All imports
from os import walk, path, stat
from extras import Logger
# The Kucera Francis frequency class
class KFFrequency:
# Constructor for the Kucera Francis frequency class
def __init__(self, in_dir, out_file, dict_fi... | Somsubhra/Enrich | src/features/kf_frequency.py | Python | mit | 2,397 |
import numpy as np
from scipy import *
from scipy.sparse import *
from itertools import izip
import operator
def sort_dic_by_value (dic,reverse=False):
return sorted(dic.iteritems(), key=operator.itemgetter(1),reverse=reverse)
## Maximum value of a dictionary
def dict_max(dic):
aux = dict(map(lambda item: (it... | iarroyof/lxmls-toolkit | lxmls/util/my_math_utils.py | Python | mit | 1,945 |
from datetime import date
from django.conf import settings
from django.core import mail
from django.urls import reverse
from extforms.forms import SelfOrganisedSubmissionExternalForm
from extrequests.models import SelfOrganisedSubmission
from workshops.models import Curriculum, Language
from workshops.tests.base impo... | pbanaszkiewicz/amy | amy/extforms/tests/test_selforganised_submission_form.py | Python | mit | 4,753 |
# -*- 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 'BBCodeTag'
db.create_table('precise_bbcode_bbcodetag', (
('id', self.gf('django.... | slasyz/django-precise-bbcode | precise_bbcode/south_migrations/0001_initial.py | Python | bsd-3-clause | 3,304 |
# Copyright 2015 NEC Corporation. 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 l... | ArchiFleKs/magnum | magnum/conductor/handlers/common/cert_manager.py | Python | apache-2.0 | 9,401 |
"""
PyPixel Cache wrapper by @WireSegal and TheDestruc7i0n
You may use this code, as long as you give credit
http://pypixel.thedestruc7i0n.ca/
Allows you to make calls to the Hypixel API through python.
Updated by TheDestruc7i0n to be able to Cache files
"""
#Old imports
import json
import urllib2
import time
#Tha... | destruc7i0n/PyPixel_Cache | pypixel_cache.py | Python | mit | 7,497 |
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2017 Laboratoire de Recherche et
# Développement de l'Epita
#
# This file is part of Spot, a model checking library.
#
# Spot 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 So... | mcc-petrinets/formulas | spot/tests/python/decompose_scc.py | Python | mit | 2,129 |
# Copyright (c) 2011 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | pvo/swift | test/unit/common/middleware/test_tempurl.py | Python | apache-2.0 | 28,059 |
# Copyright 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 requi... | redhat-openstack/nova | nova/tests/network/test_neutronv2.py | Python | apache-2.0 | 147,363 |
"""
Copyright 2015 Stefano Terna
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... | iottly/iottly-device-agent-py | iottly-device-agent-py/example.py | Python | apache-2.0 | 1,652 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Xevaquor'
__license__ = 'MIT'
from pacman import *
class HumanAgent(object):
def __init__(self, agent_index):
self.agent_index = agent_index
def make_decision(self, state, game, input_state):
legal_moves = game.get_legal_moves(state)
... | Xevaquor/aipac | HumanAgent.py | Python | mit | 620 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# roboturtle documentation build configuration file, created by
# sphinx-quickstart on Sat Nov 19 00:46:39 2016.
#
# 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
#... | erfindergarden/roboturtle | docs/conf.py | Python | mit | 9,619 |
from .question_answer_similarity import QuestionAnswerSimilarity
from .tuple_entailment import MultipleChoiceTupleEntailmentModel
from .tuple_inference import TupleInferenceModel
concrete_models = { # pylint: disable=invalid-name
'QuestionAnswerSimilarity': QuestionAnswerSimilarity,
'MultipleChoiceTup... | matt-gardner/deep_qa | deep_qa/models/multiple_choice_qa/__init__.py | Python | apache-2.0 | 438 |
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_in
from nose.tools import assert_raises
from nose.tools import assert_true
import networkx as nx
import dagology as dag
class TestCubeSpace(object):
""" Unit tests for the cube space model"""
def test_number_... | JamesClough/dagology | dagology/generators/tests/test_cube_space.py | Python | mit | 726 |
"""SCons.Tool.gs
Tool-specific initialization for Ghostscript.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# ... | looooo/pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/gs.py | Python | isc | 2,545 |
# Lint as: python3
# Copyright 2019 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 ... | tombstone/models | official/modeling/optimization/configs/optimization_config_test.py | Python | apache-2.0 | 2,164 |
from mendeley.exception import MendeleyException
from mendeley.models.catalog import *
from mendeley.resources.base import add_query_params, ListResource, GetByIdResource
class Catalog(GetByIdResource):
"""
Top-level resource for accessing catalog documents.
"""
_url = '/catalog'
def __init__(sel... | Mendeley/mendeley-python-sdk | mendeley/resources/catalog.py | Python | apache-2.0 | 6,150 |
#!/usr/bin/env python3
# © 2015 James R. Barlow: github.com/jbarlow83
#
# 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/.
import atexit
import logging
import re
from col... | jbarlow83/OCRmyPDF | src/ocrmypdf/pdfinfo/info.py | Python | gpl-3.0 | 31,669 |
from brushcutter import *
import numpy as np
direxamples='/Volumes/P4/workdir/raphael/work_conserve_remap/'
merrafile = direxamples + 'MERRA_rain_3hours_1980_2days_conserve.nc'
eraigrd = direxamples + 'lsm_erainterim_roms_conserve.nc'
# ---------- define segments on ERAint grid -----------------------
domain = obc_se... | raphaeldussin/brushcutter | examples/forcing/example_precip_MERRA.py | Python | gpl-3.0 | 2,297 |
class Solution:
# @param a list of integers
# @return an integer
def removeDuplicates(self, A):
if len(A) <= 1:
return len(A)
cnt = 1
for i in range(1, len(A)):
if A[i] != A[cnt-1]:
A[cnt] = A[i]
cnt += 1
return cnt
| kunth/Leetcode | Python/remove-duplicates-from-sorted-array.py | Python | gpl-2.0 | 316 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
from M2Crypto import X509
class Certificate:
""" Wraps an X.509 certificate object as stored in CVMFS repositories """
def __init__(self, certificate_file):
self._... | reneme/python-cvmfsutils | cvmfs/certificate.py | Python | bsd-3-clause | 1,323 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... | jtrobec/pants | src/python/pants/invalidation/cache_manager.py | Python | apache-2.0 | 14,023 |
#!/usr/bin/env python
"""
Seshat
Web App/API framework built on top of gevent
Main framework app
For more information, see: https://github.com/JoshAshby/
http://xkcd.com/353/
Josh Ashby
2012
http://joshashby.com
joshuaashby@joshashby.com
"""
from gevent import monkey; monkey.patch_all()
import gevent
#To use fastCG... | JoshAshby/Fla.gr | app/seshat/framework.py | Python | mit | 1,849 |
from urllib import urlopen
import datetime
import pickle
import os
import json
import httpretty
class ScraperTestMakerMixin(object):
def testmaker_url_get(self, url):
data = urlopen(url).read()
self.mock_http_data[url] = data
return data
def make_test(self):
'''
Stores... | bhitov/boston_events_scraper | lib/test.py | Python | gpl-3.0 | 2,619 |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
desopts = UnwrapElement(IN[0])
elementlist = list()
for item in desopts:
elementlist.ap... | andydandy74/ClockworkForDynamo | nodes/0.7.x/python/DesignOption.DesignOptionSet.py | Python | mit | 424 |
# -*- coding: utf-8 -*-
import time
import typing
import queue
import multiprocessing.queues
from abc import ABCMeta, abstractmethod
from .runner import TestRunner
from .loader import load_test_from_dict
from .suite import TestSuite
import logging
logger = logging.getLogger(__name__)
class BaseTestConsumer(TestRu... | yyang179/ngta | ngta/consumer.py | Python | mit | 2,323 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your applicat... | F483/bikesurf.org | apps/station/tests.py | Python | mit | 532 |
# -*- coding: utf-8 -*-
#
# This file is part of the Christine project
#
# Copyright (c) 2006-2007 Marco Antonio Islas Cruz
#
# Christine 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... | dksr/REMIND | python/base/utils/Singleton.py | Python | mit | 2,080 |
"""pytest configuration
Extends output capture as needed by pybind11: ignore constructors, optional unordered lines.
Adds docstring and exceptions message sanitizers: ignore Python 2 vs 3 differences.
"""
import pytest
import textwrap
import difflib
import re
import sys
import contextlib
import platform
import gc
_u... | google/aistreams | third_party/pybind11/tests/conftest.py | Python | apache-2.0 | 6,671 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.