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 -*-
##############################################################################
#
# Author: Luis Felipe Mileo - mileo at kmee.com.br
# Copyright 2014 KMEE - www.kmee.com.br
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | David-Amaro/odoo-brazil-banking | __unported__/account_statement_l10n_br_cnab240_import/parser/cnab240_parser.py | Python | gpl-3.0 | 4,194 |
def hello():
print("Hello, GAME MODE 2020!")
return True
| mousepawgames/diamondquest | src/diamondquest/hello.py | Python | gpl-3.0 | 65 |
######################################################################
#
# wgtRotorSrch.py: weighted rotor search (conformer search)
#
######################################################################
import openbabel
import sys
# Make sure we have a filename
try:
filename = sys.argv[1]
except:
print "Usage:... | torcolvin/openbabel | scripts/python/examples/wgtRotorSrch.py | Python | gpl-2.0 | 1,636 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-TODAY Cubic ERP (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | OSSESAC/odoopubarquiluz | extra-addons/purchase_requisition_analytic/analytic.py | Python | agpl-3.0 | 2,149 |
class BST:
class Node:
def __init__(self, x = None, l = None, r = None):
self.data = x
self.left = l
self.right = r
def is_leaf(self):
return self.left == None and self.right == None
def __str__(self):
return '(' + st... | doylew/practice | python/l8/BST.py | Python | mit | 6,553 |
import time
import re
import json
import socket
import threading
import base64
import logging
import urllib
import sys
import errno
from thirdparty.YLBaseServer import YLBaseServer
reload(sys)
sys.setdefaultencoding('utf8')
class Message:
def __str__(self):
return ' '.join(['%s:%s' % item for item in s... | ihuanglei/ylauto | thirdparty/yeelight/YeelightServer.py | Python | mit | 16,165 |
# -*- coding: utf-8 -*-
import sys
import pygeoip
import os.path
import socket
import sqlite3
import time
import re
DATAFILE = os.path.join(sys.path[0], "GeoIP.dat")
# STANDARD = reload from disk
# MEMORY_CACHE = load to memory
# MMAP_CACHE = memory using mmap
gi4 = pygeoip.GeoIP(DATAFILE, pygeoip.MEMORY_CACHE)
def ... | rnyberg/pyfibot | pyfibot/modules/module_geokick.py | Python | bsd-3-clause | 5,174 |
from __future__ import print_function
# Author: Sarah Knepper <sarah.knepper@intel.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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 restr... | sasmita/upm | examples/python/ttp223.py | Python | mit | 1,735 |
"""
Shogun demo, based on PyQT Demo by Eli Bendersky
Christian Widmer
Soeren Sonnenburg
License: GPLv3
"""
import numpy
import sys, os, csv
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import matplotlib
from matplotlib.colorbar import make_axes, Colorbar
from matplotlib.backends.backend_qt4agg import FigureCa... | c4goldsw/shogun | examples/undocumented/python_modular/graphical/interactive_svr_demo.py | Python | gpl-3.0 | 11,223 |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from celery_app.tasks import add
from celery.result import AsyncResult
def create_task(request):
if request.method == 'POST':
task = add.delay(request.POST['x'], request.POST['y'])
print task
return redirec... | praekelt/ndoh-control | subsend/views.py | Python | bsd-3-clause | 634 |
# -*- coding: utf-8 -*-
# pylint: disable=bad-continuation, unused-import
""" CLI commands.
"""
# Copyright © 2015 Jürgen Hermann <jh@web.de>
#
# 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
... | jhermann/tablemate | src/tablemate/commands/__init__.py | Python | apache-2.0 | 870 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from .logger import init_logging, deinit_logging, error
def is_ascii(o):
tab_feeds = (9, 10, 12, 13)
return (o > 31 and o < 127) or (o in tab_feeds)
def is_text_ascii(data, confidence=0.7):
data_length = len(... | bnomis/pyf | pyf/filetype.py | Python | mit | 4,529 |
# -*- coding: utf-8 -*-
from os import environ
from .base import *
# Secret configuration
SECRET_KEY = environ.get('SECRET_KEY')
| priver/webmon | webmon/webmon/settings/production.py | Python | mit | 131 |
# Space Invaders Stage 7: Head-Up-Display (HUD)
import turtle as t
import math
# Fenstergröße
WIDTH = 700
HEIGHT = 700
# Weltgröße
WW = 600
WH = 600
# Hier kommen die Klassendefinitionen hin
class GameWorld(t.Turtle):
def __init__(self):
t.Turtle.__init__(self)
self.penup()
self.hid... | kantel/python-schulung | sources/spaceinvaders/stage07.py | Python | mit | 4,655 |
#!/usr/bin/env python3
#
# Program to run a command via netrepl on a destination host
#
# author: ulno
# create date: 2017-09-16
#
import time
from netrepl import Netrepl_Parser
import sys, select
_debug = "netrepl command:"
def main():
parser = Netrepl_Parser('Connect to netrepl and run'
... | ulno/micropython-extra-ulno | lib/netrepl/command.py | Python | mit | 1,813 |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... | StixoTvorec/py-try | Parsers/mysql/connector/cursor.py | Python | mit | 42,281 |
#!/usr/bin/env python
'''
Application exceptions
'''
class IsopumpException(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
self.status_code = status_code
... | tommilligan/isoprene-pumpjack | isoprene_pumpjack/exceptions/__init__.py | Python | apache-2.0 | 513 |
import ddext
from ddext import SD
def init():
ddext.input('doc_id', 'text')
ddext.input('sent_id', 'int')
ddext.input('words', 'text[]')
ddext.input('lemmas', 'text[]')
ddext.input('poses', 'text[]')
ddext.input('ners', 'text[]')
ddext.returns('doc_id', 'text')
ddext.returns('sent_id', 'int')
ddext... | HazyResearch/dd-genomics | xapp/code/gene_mentions.py | Python | apache-2.0 | 3,854 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | anthonyfok/frescobaldi | frescobaldi_app/logtool/logwidget.py | Python | gpl-2.0 | 6,556 |
# Copyright (c) 2016, Xilinx, 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of ... | Xilinx/PYNQ | pynq/tests/test_su.py | Python | bsd-3-clause | 2,019 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# all with zero means
def mv_normal(covariance, x):
result = 1.0 / np.sqrt(4 * np.pi * np.pi * np.linalg.det(covariance))
result *= np.exp(-0.5 * x.getT() * np.linalg.inv(covariance) * x)
return np.asscalar(result)... | ocozalp/matplotlib-animations | metropolis_sampling.py | Python | mit | 2,702 |
import os
import scipy
import scipy.io
from SloppyCell.ReactionNetworks import *
import Common
pts_per_param = 100
# Fraction uncertainty assumed for data points
f = 0.1
Plotting.figure(figsize=(8/2.54, 13/2.54))
Plotting.gcf().set_facecolor('w')
Plotting.axes([0, 0, 1, 1])
for model_ii, (model, N_c, N_s) in enum... | GutenkunstLab/SloppyCell | Example/Gutenkunst2007/Fig3_plot.py | Python | bsd-3-clause | 2,421 |
import os
DIRNAME = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
DATABASE_ENGINE='sqlite3'
DATABASE_NAME = os.path.join(DIRNAME, 'versions.db')
TEST_DATABASE_NAME = os.path.join(DIRNAME, '.test-versions.db')
INSTALLED_APPS=(
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib... | nowells/django-versions | versions/tests/settings.py | Python | mit | 946 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/models/probe.py | Python | mit | 4,280 |
# encoding: utf-8
##############################################################################
# #
# Ezeplot - Dynamical systems visualisation #
# ... | grajkiran/ezeplot | helpers.py | Python | gpl-3.0 | 3,093 |
#! /usr/bin/env python
# Copyright 2010 Will Bickerstaff
# This file is part of PyCycle.
#
# PyCycle 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... | WillBickerstaff/pycycle | lib/Bike/wheel.py | Python | gpl-3.0 | 1,870 |
# cs.???? = currentstate, any variable on the status tab in the planner can be used.
# Script = options are
# Script.Sleep(ms)
# Script.ChangeParam(name,value)
# Script.GetParam(name)
# Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO'
# Script.WaitFor(string,timeout)
# Script.SendRC(chan... | vizual54/MissionPlanner | Scripts/example1.py | Python | gpl-3.0 | 1,491 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | kenorb-contrib/BitTorrent | BitTorrent/Choker.py | Python | gpl-3.0 | 7,514 |
#!/usr/bin/python
class Solution:
# @param {integer} numCourses
# @param {integer[][]} prerequisites
# @return {integer[]}
def findOrder(self, numCourses, prerequisites):
#if prerequisites==[]:
# return range(numCourses)
self.n=numCourses
self.prerequisites=prerequisites
self.loop=0
self.visited=... | aertoria/MiscCode | toplogy DFS better.py | Python | apache-2.0 | 1,256 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.apach... | adkerr/tempest | tempest/api/compute/base.py | Python | apache-2.0 | 11,864 |
import c_interface_functions as CI
| MichaelDAlbrow/pyDIA | Code/DIA_CPU_header.py | Python | mit | 35 |
# 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-network/azure/mgmt/network/v2017_09_01/models/network_interface_association.py | Python | mit | 1,333 |
import re
from openid import codecutil # registers 'oid_percent_escape' encoding handler
# from appendix B of rfc 3986 (http://www.ietf.org/rfc/rfc3986.txt)
uri_pattern = r'^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
uri_re = re.compile(uri_pattern)
# gen-delims = ":" / "/" / "?" / "#" / "[" / "]" /... | arantebillywilson/python-snippets | microblog/flask/lib/python3.5/site-packages/openid/urinorm.py | Python | mit | 4,439 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, subprocess, hashlib, shutil, glob, stat, sys, time
from subprocess import check_call
from tempfile import NamedT... | Eksmo/calibre | setup/upload.py | Python | gpl-3.0 | 10,267 |
# coding: utf-8
#
# This file is part of mpdav.
#
# mpdav 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.
#
# mpdav is distributed in t... | mprochnow/mpdav | mpdav/multi_status.py | Python | gpl-3.0 | 3,683 |
# -*- coding: utf-8 -*-
"""Provides custom exceptions for the ``cfme`` module. """
class CFMEException(Exception):
"""Base class for exceptions in the CFME tree
Used to easily catch errors of our own making, versus errors from external libraries.
"""
pass
class ApplianceVersionException(CFMEExcept... | Yadnyawalkya/integration_tests | cfme/exceptions.py | Python | gpl-2.0 | 8,012 |
'''
Based on the original TW-700 plugin by Tom Wilson.
forked from Kabal/eventghost-epson-tw700
'''
eg.RegisterPlugin(
name = "EpsonSerial",
author = "Nick Card",
version = "0.0.0",
kind = "external",
guid = "{73aeb32f-7efa-4ca1-a5cf-f1e5de0601e2}",
url = "",
description = (''),
canMult... | Nick2253/home-theater-project | eventghost/plugins/EpsonSerial/__init__.py | Python | mit | 5,706 |
# -*- encoding: utf-8 -*-
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
(r'^', include('consulting.urls')),
url(r'^accounts/login/$', 'django.contrib.auth.views.l... | frhumanes/consulting | web/src/urls.py | Python | apache-2.0 | 865 |
import os
import sys
from twisted.internet import protocol
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
from twisted.python.failure import Failure
from juju import errors
class HookProtocol(protocol.ProcessProtocol):
"""Protocol used to communicate between the unit agent and hook pr... | mcclurmc/juju | juju/hooks/invoker.py | Python | agpl-3.0 | 10,665 |
import urllib
import urllib2
import re
import json
import time
from datetime import datetime
from urlparse import urlparse, parse_qs
from traceback import format_exc
from bs4 import BeautifulSoup
import xbmcplugin
import xbmcgui
import xbmcaddon
import xbmcvfs
addon = xbmcaddon.Addon()
__addonname__ = addon.getAddon... | noba3/KoTos | addons/plugin.video.fox.news/default.py | Python | gpl-2.0 | 10,792 |
"""
Copyright 2017-present Airbnb, 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 agreed to in writing, sof... | airbnb/streamalert | streamalert_cli/terraform/alert_processor.py | Python | apache-2.0 | 2,636 |
#
# 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 us... | chgm1006/spark-app | src/main/python/ml/isotonic_regression_example.py | Python | apache-2.0 | 1,770 |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 05 01:30:36 2017
"""
import feedparser
import os
import base64
from nntplib import *
from justposting import *
import shutil
from bs4 import BeautifulSoup
def solidotpost ():
try:
rss_url = r'http://www.solidot.org/index.rss'
nntpserver = "news.aioe.... | Mosesofmason/rss2nntp | solidot.py | Python | gpl-3.0 | 6,227 |
import collections
import copy
import weakref
from ._env import oactx, oalog
from ._util import oagprop
from openarc.exception import *
class CacheProxy(object):
"""Responsible for manipulation of relational data frame"""
def __init__(self, oag):
self._oag = oag
# Cache storage object.
... | kchoudhu/openarc | openarc/_rdf.py | Python | bsd-3-clause | 20,228 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from __future__ import print_function
from jenkinsflow.flow import serial
from .cfg import ApiType
from .framework import api_select
from .framework.utils import assert_lines_in, bu... | lechat/jenkinsflow | test/reporting_queued_test.py | Python | bsd-3-clause | 1,549 |
""" Utilities for transforming from the 1.x to other versions.
:Authors: Sana dev team
:Version: 1.1
"""
import logging
from uuid import UUID
import re
import cjson as _json
import shutil, os
from django.contrib.auth.models import User, UserManager
from django.views.generic import RedirectView
#from django.views.gen... | SanaMobile/sana.mds | src/mds/api/v1/v2compatlib.py | Python | bsd-3-clause | 14,907 |
# -*- coding: UTF-8 -*-
#! python3 # noqa E265
"""
Isogeo API v1 - Model of Limitation entity
See: http://help.isogeo.com/api/complete/index.html
"""
# #############################################################################
# ########## Libraries #############
# ##################################
# s... | isogeo/isogeo-plugin-qgis | modules/isogeo_pysdk/models/limitation.py | Python | gpl-3.0 | 8,927 |
# 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... | CMSS-BCRDB/RDS | trove/db/sqlalchemy/migrate_repo/versions/006_dns_records.py | Python | apache-2.0 | 1,320 |
#!/usr/bin/python
"""
Netconfigit
Network device configuration archive tool
Copyright (C) 2014 Fluent Trade Technologies
"""
__license__ = "MIT License"
__author__ = "Eric Griffin"
__copyright__ = "Copyright (C) 2014, Fluent Trade Technologies"
__version__ = "1.1"
import sys
import os.path
import signal
import logg... | FluentTradeTechnologies/netconfigit | main.py | Python | mit | 4,083 |
import struct
from unittest import TestCase
import binascii
from instructor import model as instructor_model
from instructor import fields as instructor_fields
from instructor import errors as instructor_errors
class InstructorTest(TestCase):
def test_simple_test(self):
class Protocol(instructor_model.In... | pikhovkin/instructor | tests/test_instructor.py | Python | mit | 9,535 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Musicoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
in... | musicoin/Musicoin | share/qt/clean_mac_info_plist.py | Python | mit | 897 |
import os
import sys
import re
if (sys.version_info > (3, 0)):
import importlib
type = 'none'
tts_module = None
debug_messages = None
mute = False
mute_anon = None
urlRegExp = "(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?"
url_filter = None
banned=[]
def setup(robot_config)... | Nocturnal42/runmyrobot | tts/tts.py | Python | apache-2.0 | 3,275 |
import urllib.request, urllib.error, urllib.parse
from flask import Flask, g
from .test_case import TestCase
from flask_login import login_user, current_user, current_app
import requests
class IntegrationTestCase(TestCase):
def create_user(self, email, password, username="identifier", fn="First", ln="Last", role... | tetherless-world/graphene | whyis/test/integration_test_case.py | Python | apache-2.0 | 1,695 |
import struct
from sulley import blocks, primitives, sex
class q_value (blocks.block):
def __init__ (self, name, request, value, options={}):
blocks.block.__init__(self, name, request, None, None, None, None)
self.value = value
self.options = options
# fuzz by default
if... | firebitsbr/pwn_plug_sources | src/voiper/sulley/sulley/legos/sip.py | Python | gpl-3.0 | 11,911 |
import unittest
import numpy as np
import pydrake
from pydrake.solvers import ik
import os.path
class TestRBTIK(unittest.TestCase):
def testPostureConstraint(self):
r = pydrake.rbtree.RigidBodyTree(os.path.join(pydrake.getDrakePath(), "examples/Pendulum/Pendulum.urdf"))
q = -0.9
posture_con... | billhoffman/drake | drake/bindings/python/pydrake/test/testRBTIK.py | Python | bsd-3-clause | 1,165 |
"""Handle events that were forwarded from the Segment webhook integration"""
import datetime
import json
import logging
from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.ht... | BehavioralInsightsTeam/edx-platform | common/djangoapps/track/views/segmentio.py | Python | agpl-3.0 | 11,748 |
from . import db
from .assoc import section_professor
class Professor(db.Model):
__tablename__ = 'professors'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), unique=True)
first_name = db.Column(db.Text, nullable=False)
last_name = db.Column... | SCUEvals/scuevals-api | scuevals_api/models/professor.py | Python | agpl-3.0 | 905 |
import re
import tweepy
from django.conf import settings
from django.core.cache import cache
class TwitterTimeline:
KEY = "twitter/twitter/timeline"
KEY_LT = "twitter/twitter/timeline_longterm"
KEY_US = "twitter/twitter/username"
def __init__(self, count=0, cache_timeout=600, cache_long_term_timeout... | sinnwerkstatt/landmatrix | apps/wagtailcms/twitter/__init__.py | Python | agpl-3.0 | 5,214 |
from distutils.core import setup
setup(name='pairs2groups',
author='Andrew Straw',
author_email='strawman@astraw.com',
url='http://astraw.github.io/pairs2groups/',
packages=['pairs2groups'],
version='1.0.0', # also set in doc-src/conf.py and pairs2groups/__init__.py
license='MIT',
... | astraw/pairs2groups | setup.py | Python | mit | 403 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Pluggable Output Processor (main module)
#
# Copyright (c) 2013-2017 Alex Turbov <i.zaufi@gmail.com>
#
# Pluggable Output Processor 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... | zaufi/pluggable-output-processor | outproc/cli.py | Python | gpl-3.0 | 8,736 |
from rest_framework import serializers
from openbudgets.apps.sheets import models
from openbudgets.apps.accounts.serializers import AccountMin
from openbudgets.commons.serializers import UUIDRelatedField, UUIDPrimaryKeyRelatedField
from openbudgets.apps.entities.serializers import EntityMin, DivisionMin
class Templat... | openbudgets/openbudgets | openbudgets/apps/sheets/serializers.py | Python | bsd-3-clause | 5,802 |
"""
Handle logging in a Message Box?
"""
from PyQt4 import QtGui, QtCore
import logging
import sys
class MyQWidget(QtGui.QWidget):
def center(self):
frameGm = self.frameGeometry()
screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos())
centerPoint =... | CNR-Engineering/ModelerTools | common/qt_log_in_textbrowser.py | Python | gpl-3.0 | 788 |
import statsmodels.api as sm
import numpy as np
class LSM(object):
def __init__(self, lambdas):
self.lambdas = lambdas
def calc(self, y, x):
X = np.zeros((len(x), len(self.lambdas)))
for i in range(0, len(self.lambdas)):
X[:, i] = self.lambdas[i](x)
ols = sm.OLS(... | exleym/simpaq | solvers/regressions.py | Python | mit | 390 |
from django.core.urlresolvers import reverse
from socialregistration.contrib.foursquare.client import Foursquare
from socialregistration.contrib.foursquare.models import FoursquareProfile
from socialregistration.views import OAuthRedirect, OAuthCallback, SetupCallback
class FoursquareRedirect(OAuthRedirect):
clien... | lgapontes/django-socialregistration | socialregistration/contrib/foursquare/views.py | Python | mit | 915 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | amazinger2013/OpenSesame | libopensesame/python_workspace.py | Python | gpl-3.0 | 3,215 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Standard paths
'''
__author__ = "Karol Będkowski"
__copyright__ = "Copyright (c) Karol Będkowski, 2009-2010"
__version__ = "2010-05-03"
LINUX_LOCALES_DIR = '/usr/share/locale/'
LINUX_INSTALL_DIR = '/usr/share/alldb/'
LINUX_DOC_DIR = '/usr/share/doc/alldb/'
LINUX_DATA_DIR... | KarolBedkowski/alldb | alldb/configuration.py | Python | gpl-2.0 | 436 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-14 06:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... | anhel-strauke/horns_and_hooves | horns_site/catalog/migrations/0001_initial.py | Python | mit | 1,159 |
from Core import TreeClass as tc
file_in = open('output/gram_5_2_diff.txt','r')
lines = file_in.readlines()
for i in range(len(lines)/4):
tree = tc.ScoreTree(lines[i*4])
file_out = open('output/gram_5_2_diff/pair_{0}_a_original.dot'.format(i+1), 'w')
file_out.write(tree.toGraphInput())
file_out.close()... | Nacturne/CoreNLP_copy | python_tools/lexical/gram_5_1_diff.py | Python | gpl-2.0 | 898 |
import unittest
from cask_desh import CashDesk
class CashDeskTest(unittest.TestCase):
def test_total_zero_when_new_instance_made(self):
new_cash_desk = CashDesk()
self.assertEqual(0, new_cash_desk.total())
def test_total_after_money_take(self):
new_cash_desk = CashDesk()
new... | HackBulgaria/Programming101-2 | week1/1-Python-OOP-problems-set/cash_desk_test.py | Python | mit | 1,059 |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
from gi.repository import Gtk
from gi.repository import AppIndicator3 as appindicator
from avashell.utils import resource_path
from avashell.shell_base import ShellBase, STR_EXIT, STR_OPEN_HELP
class StatusIcon(object):
def __init__(... | sampot/avashell | avashell/shell_gtk.py | Python | bsd-3-clause | 1,759 |
import uuid
from django.test import TestCase
from unittest.mock import patch
from casexml.apps.case.tests.util import delete_all_cases, delete_all_xforms
from corehq.apps.domain.shortcuts import create_user
from corehq.apps.registry.tests.utils import create_registry_for_test, Invitation, Grant
from corehq.apps.userr... | dimagi/commcare-hq | corehq/apps/userreports/tests/test_registry_pillow.py | Python | bsd-3-clause | 9,881 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 10:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('primus', '0011_auto_20160418_1213'),
]
operations = [
migrations.AlterField(... | sighill/shade_app | primus/migrations/0012_auto_20160418_1217.py | Python | mit | 449 |
from tl.testing.thread import ThreadAwareTestCase
import unittest
from mock import patch
import json
from urllib import urlencode
import app
class BaseTestCase(ThreadAwareTestCase):
def setUp(self):
app.app.config['TESTING'] = True
self.app = app.app.test_client()
self.source_ip = '192.16... | esarafianou/rupture | sniffer/test_sniff.py | Python | mit | 2,182 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_fiscal_icfvenderresumido.ui'
#
# Created: Mon Nov 24 22:25:51 2014
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
from pydaruma.pydaruma impo... | edineicolli/daruma-exemplo-python | scripts/fiscal/ui_fiscal_icfvenderresumido.py | Python | gpl-2.0 | 8,088 |
# Copyright 2015, 2018 IBM Corp.
#
# 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 require... | phenoxim/nova | nova/virt/powervm/image.py | Python | apache-2.0 | 2,330 |
# coding=utf-8
"""
- Author:
- Maple.Liu 16/3/30 13:46 maple.liu@microfastup.com
- File : __init__.py.py
"""
| evilloop/django-base-bridge | base_bridge/views/generic/__init__.py | Python | gpl-2.0 | 122 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | simobasso/ansible | lib/ansible/constants.py | Python | gpl-3.0 | 18,626 |
# Copyright (c) 2013 AnsibleWorks, Inc.
#
# This file is part of Ansible Commander.
#
# Ansible Commander 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 3 of the License.
#
# Ansible Commander is di... | shilicqupt/ansible-commander | lib/main/tests/inventory.py | Python | gpl-3.0 | 21,738 |
"""
Database objects and DDL operations
"""
import io
import base64
from collections import OrderedDict
import json
import fdb
import fdb.schema
from bottle import request, redirect, HTTPError, template
from common import baseApp, appconf, render, formval_to_utf8, serve_file
def register_ddl(db):
appconf.ddl... | ctengiz/firewad | sub/db.py | Python | mit | 19,339 |
"""
TestCases for checking dbShelve objects.
"""
import os, string, sys
import random
import unittest
from test_all import db, dbshelve, test_support, verbose, \
get_new_environment_path, get_new_database_path
if sys.version_info < (2, 4) :
from sets import Set as set
#----------... | ktan2020/legacy-automation | win/Lib/bsddb/test/test_dbshelve.py | Python | mit | 12,297 |
#!/usr/bin/env python
## \file configure.py
# \brief An extended configuration script.
# \author T. Albring
# \version 6.2.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the open-source community.
#... | srange/SU2 | preconfigure.py | Python | lgpl-2.1 | 28,082 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def PermissionEvent(vim, *args, **kwargs):
'''This event records a permission operation.'... | xuru/pyvisdk | pyvisdk/do/permission_event.py | Python | mit | 1,162 |
from selenium.webdriver.firefox.webdriver import WebDriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
class Application:
def __init__(self):
self.wd = WebDriver()
self.wd.implicitly_wait(60)
self.session = SessionHelper(self)
self.group = GroupH... | supersidr/python_training | fixture/application.py | Python | apache-2.0 | 514 |
# *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 17-1-11 下午12:45
'''
import logging
import os
if not os.path.exists('logs'):
os.mkdir('logs')
logger = logging.getLogger('access_log')
sh = logging.StreamHandler()
fh = logging.FileHandler('logs/access.log')
fh.setFormatter(logging.Formatter('%(asctime)s - %(lev... | ioiogoo/Vue-News-Board | server/logger.py | Python | gpl-2.0 | 424 |
# python3
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | google/gps_building_blocks | py/gps_building_blocks/airflow/utils/blob.py | Python | apache-2.0 | 2,659 |
# Copyright (c) 2017 Fujitsu 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 requir... | noironetworks/neutron | neutron/db/models/loggingapi.py | Python | apache-2.0 | 1,465 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Fortran/F90PATH.py | Python | mit | 7,429 |
import re
import json
import xml.etree.ElementTree
from .common import InfoExtractor
from ..utils import (
compat_urlparse,
compat_urllib_parse,
determine_ext,
unified_strdate,
)
class NHLBaseInfoExtractor(InfoExtractor):
@staticmethod
def _fix_json(json_string):
return json_string.re... | ashutosh-mishra/youtube-dl | youtube_dl/extractor/nhl.py | Python | unlicense | 4,358 |
import setuptools_scm # noqa: F401
from setuptools import setup
setup()
| rshk/python-pcapng | setup.py | Python | apache-2.0 | 74 |
from os import path
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, render, redirect
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.views... | Rhombik/rhombik-object-repository | project/views.py | Python | agpl-3.0 | 13,528 |
# Copyright 2014 Netflix, 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... | lucab/security_monkey | security_monkey/auditors/iam_role.py | Python | apache-2.0 | 4,512 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | gfsa/training/train_util.py | Python | apache-2.0 | 14,842 |
# -*- coding: utf-8 -*-
#
# Julia Language documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 14 22:49:22 2012.
#
# 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.
... | shubhamg31/columbus_julia | lib/julia/doc/conf.py | Python | apache-2.0 | 8,962 |
# Copyright 2016 Mirantis, 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... | NetApp/manila | manila/tests/share/drivers/container/fakes.py | Python | apache-2.0 | 1,757 |
"""
outlined.py
--------------
Show a mesh with edges highlighted using GL_LINES
"""
import trimesh
import numpy as np
if __name__ == '__main__':
mesh = trimesh.load('../models/featuretype.STL')
# get edges we want to highlight by finding edges
# that have sharp angles between adjacent faces
edges =... | mikedh/trimesh | examples/outlined.py | Python | mit | 1,159 |
import os
from alexandriadocs import __version__
from alexandriadocs.settings import * # NOQA
DEBUG = False
COMPRESS_OFFLINE = True
ALLOWED_HOSTS = [os.environ.get('DJ_ALLOWED_HOSTS')]
SECRET_KEY = os.environ.get('DJ_SECRET_KEY')
# database configs
DATABASES = {
'default': {
'ENGINE': 'django.db.bac... | srtab/alexandriadocs | alexandriadocs/alexandriadocs/settings/production.py | Python | apache-2.0 | 1,766 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
urlpatterns = patterns('flatui.views',
url(r'^$', 'index' ,name='index'),
)
| jsalva/ndim | ndim/flatui/urls.py | Python | mit | 185 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrayAssignments in the Ruby Koans
#
from runner.koan import *
class AboutListAssignments(Koan):
def test_non_parallel_assignment(self):
names = ["John", "Smith"]
self.assertEqual(["John", "Smith"], names)
def test_parallel_ass... | rfines/PythonKoans | python2/koans/about_list_assignments.py | Python | mit | 947 |
'''
Copyright (c) 2011, Joseph LaFata
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... | OldhamMade/unitbench | examples/example.py | Python | bsd-3-clause | 2,897 |
# Copyright (C) 2014 Yahoo! Inc. All Rights Reserved.
# 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
#
... | amit0701/rally | rally/task/types.py | Python | apache-2.0 | 14,821 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.