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 |
|---|---|---|---|---|---|
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | noemis-fr/old-custom | sale_layout/report/__init__.py | Python | agpl-3.0 | 1,058 |
import numpy
import h5py
from srxraylib.plot.gol import plot_image,plot_surface, plot
import matplotlib.pylab as plt
from silx.math.fit.functions import sum_gauss
from silx.math.fit import fittheories
from silx.math.fit.fitmanager import FitManager
def get_fwhm(x,h):
tt = numpy.where(h>=max(h)*0.5)
if h[tt].... | srio/shadow3-scripts | VORTX/plot_spectral_density.py | Python | mit | 3,482 |
import random
def sum(a, b):
return a + b
def raise_an_exception():
raise ValueError("This is a ValueError")
def make_a_move_with_mock_patch():
"""Figure out what move to make in a hypothetical game.
Use random.randint in part of the decision making process.
In order to test this function, you have to... | jjinux/sfpythontesting | sfpythontesting/main.py | Python | apache-2.0 | 982 |
from pycp2k.inputsection import InputSection
class _ldos2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Components = None
self.List = []
self._name = "LDOS"
self._keywords = {'Components': 'COMPONENTS'}
self._repeated_keywords = {'List': 'LIST'... | SINGROUP/pycp2k | pycp2k/classes/_ldos2.py | Python | lgpl-3.0 | 323 |
# Copyright 2015 Cisco Systems, 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 requi... | Gitweijie/first_project | networking_cisco/apps/saf/agent/vdp/ovs_vdp.py | Python | apache-2.0 | 36,822 |
import sys
import decimal
from unittest import TestCase
import json
import json.decoder
class TestScanString(TestCase):
def test_py_scanstring(self):
self._test_scanstring(json.decoder.py_scanstring)
def test_c_scanstring(self):
if json.decoder.c_scanstring is not None:
self._test... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/json_tests/test_scanstring.py | Python | mit | 3,474 |
#!/usr/bin/python3
""" configure.py:
Configuration helper functions used to set up this service
"""
# Import Required Libraries (Standard, Third Party, Local) ********************
import configparser
import logging
import logging.handlers
import os
import sys
from bob_wemo_service.device import Device
# Authorsh... | csm0042/bob_wemo_service | bob_wemo_service/configure.py | Python | gpl-3.0 | 9,245 |
# pythonequations is a collection of equations expressed as Python classes
# Copyright (C) 2008 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
# email: zunzun@zunzun.com
#
# License: BSD-style (see LICENSE.txt in main source directory)
# Version info: $Id: YieldDensity.py 274 2... | JMoravec/unkRadnet | zunzunCode/pythonequations/Equations2D/YieldDensity.py | Python | bsd-3-clause | 6,605 |
import numpy as np
from policies._policy_klucb import _computeKLUCB, _computeKLLCB
class Rank1ElimKL:
def __init__(self, K, L, T):
self.K = K
self.L = L
self.T = T
self.row_pulls = np.ones((K, L)) # number of pulls in row exploration
self.row_reward = np.zeros((K, L... | sumeetsk/rank1bandits | algs/rank1elimKL.py | Python | gpl-3.0 | 5,047 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2015, IBM
# 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/... | blueboxgroup/sshagentmux | sshagentmux/base_agent_request.py | Python | apache-2.0 | 5,329 |
import logging
logging.basicConfig(level=logging.DEBUG)
import simulation.plot.interface
simulation.plot.interface.optimization_parameters_for_data_kind(data_kind='WOD_TMM_1', with_line_search_steps=True) | jor-/simulation | simulation/plot/optimization_parameters.py | Python | agpl-3.0 | 205 |
#!/usr/bin/env python
#
# Copyright 2014 Thomas Rabaix <thomas.rabaix@gmail.com>
#
# 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... | rande/python-element | setup.py | Python | apache-2.0 | 1,230 |
def moveTower(height, fromPole, toPole, withPole):
"""
>>> moveTower(3, 'A', 'B', 'C')
moving disk from A to B
moving disk from A to C
moving disk from B to C
moving disk from A to B
moving disk from C to A
moving disk from C to B
moving disk from A to B
"""
if height >= 1:
... | TheAlgorithms/Python | other/tower_of_hanoi.py | Python | mit | 682 |
from discord.ext import commands
class AccessDenied(commands.CommandError): pass
| RIP95/kurisu-bot | addons/checks/errors.py | Python | mit | 83 |
# -*- coding: utf-8 -*-
"""RQ queues for Parker."""
from rq import Queue
from redis import StrictRedis
from configloader import load_config
_redis_config = load_config('redis')
crawl_q = Queue(
'crawl',
connection=StrictRedis(
**_redis_config
)
)
consume_q = Queue(
'consume',
connection=S... | nefarioustim/parker | parker/queues.py | Python | gpl-3.0 | 364 |
# 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 flt
from frappe import _
from frappe.model.document import Document
class MonthlyDistribution(Document):
def ge... | gangadharkadam/saloon_erp_install | erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py | Python | agpl-3.0 | 946 |
from pdu import *
def detect_multipart(pdu):
to_msisdn = pdu['body']['mandatory_parameters']['destination_addr']
from_msisdn = pdu['body']['mandatory_parameters']['source_addr']
short_message = pdu['body']['mandatory_parameters']['short_message']
optional_parameters = {}
for d in pdu['body'].get(... | dmaclay/python-smpp | smpp/pdu_inspector.py | Python | bsd-3-clause | 4,259 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import platform
import shutil
import sys
sys.path.append('bin')
from autojump_argparse import ArgumentParser # noqa
SUPPORTED_SHELLS = ('bash', 'zsh', 'fish', 'tcsh')
def cp(src, dest, dryrun=False):
print('copying f... | joelthelion/autojump | install.py | Python | gpl-3.0 | 7,912 |
#!/usr/bin/env python
import errno
import json
import os
import re
import shutil
import sys
from getmoduleversion import get_version
# set at init time
node_prefix = '/usr/local' # PREFIX variable from Makefile
install_path = None # base target directory (DESTDIR + PREFIX from Makefile)
target_defaults = None
variabl... | RPGOne/Skynet | node-master/tools/install.py | Python | bsd-3-clause | 6,577 |
import sys
import time
import copy
from dimacs_to_dpll import readDimacsFile
NBVAR = 'undefined'
def main():
if sys.argv[0] == 'dpll_solver.py':
file_name = sys.argv[1]
dpllHandler(file_name)
def dpllHandlerWithoutReadingDimacs(clauses, nbvar, nbclauses):
#for trying to see if we can solve the SAT-sentence ... | bibhaug/IST | AI-SATPLAN/dpll_solver.py | Python | gpl-3.0 | 9,034 |
"""Script to test basic message-passing with GUIReactor.
Continuously reads out sensor values monitored by SimpleMonitor and FilteringMonitor."""
import sys
import Tkinter as tk
import ttk
from components.messaging import Signal
from components.robots import Beeper
from components.sensors import SimpleMonitor, Filteri... | lietk12/robotic-package-sorting | test/gui_sensors.py | Python | bsd-2-clause | 6,517 |
__all__ = ["attribute", "base", "comment", "document", "dtd", "element", "node", "parse", "text"]
| minacle/yarh | yarh/__init__.py | Python | bsd-2-clause | 98 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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; eith... | pmghalvorsen/gramps_branch | gramps/gen/lib/__init__.py | Python | gpl-2.0 | 2,590 |
ELECTRUM_VERSION = '2.9.3.6' # version of the client package
PROTOCOL_VERSION = '0.10' # protocol version requested
# The hash of the mnemonic seed must begin with this
SEED_PREFIX = '01' # Electrum standard wallet
SEED_PREFIX_SW = '02' # Electrum segwit wallet
SEED_PREFIX_2FA = '101' # extende... | pknight007/electrum-vtc | lib/version.py | Python | mit | 568 |
"""
Support for interacting with Spotify Connect.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.spotify/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.http import HomeAssistantVie... | tinloaf/home-assistant | homeassistant/components/media_player/spotify.py | Python | apache-2.0 | 11,025 |
import re
from BeautifulSoup import BeautifulSoup, SoupStrainer
from geopy import Point, Location
from geopy.parsers import Parser
from geopy.util import unescape
from core.backports.six import string_types as basestring
FLOAT_RE = re.compile(r'([+-]?\d*\.?\d+)$')
class ICBMMetaTag(Parser):
META_NAME = 'ICBM'
... | M4rtinK/modrana | core/bundle/geopy/parsers/html.py | Python | gpl-3.0 | 5,675 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class HTTPStatus:
# 成功
Ok = 200
# 参数错误
BadRequest = 400
# 验证失败
UnAuthorized = 401
# 服务器拒绝该请求
Forbidden = 403
# 未找到该资源
NotFound = 404
# 服务器内部错误
InternalServerError = 500
# 服务器超载
ServiceUnavailable = 503
class ... | a358003542/expython | expython/flask/status.py | Python | mit | 1,600 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | vmturbo/nova | nova/tests/unit/objects/test_service.py | Python | apache-2.0 | 20,311 |
#!/usr/bin/env python3
import torch
from ..utils import broadcasting, fft
def toeplitz(toeplitz_column, toeplitz_row):
"""
Constructs tensor version of toeplitz matrix from column vector
Args:
- toeplitz_column (vector n) - column of toeplitz matrix
- toeplitz_row (vector n-1) - row of t... | jrg365/gpytorch | gpytorch/utils/toeplitz.py | Python | mit | 8,381 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Clément Schreiner
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | sputnick-dev/weboob | weboob/applications/qwebcontentedit/qwebcontentedit.py | Python | agpl-3.0 | 1,419 |
from server import app, init
import json
from services import load_credentials, get_database, get_watson_service
import pytest
app.config['CACHEDB'] = 'testcache'
app.config['VISITDB'] = 'visitcache'
app.config['TESTING'] = True
testapp = app.test_client()
init()
@pytest.fixture(scope="module")
def cacheDB():
... | JJGO/bluemix-project | test_server.py | Python | apache-2.0 | 3,258 |
import os
import shutil
import tempfile
from flask import json
from unittest.mock import patch
from apps.prepopulate.app_initialize import AppInitializeWithDataCommand
from apps.prepopulate.app_scaffold_data import AppScaffoldDataCommand
from apps.prepopulate.app_initialize import fillEnvironmentVariables
from superde... | superdesk/superdesk-core | tests/prepopulate/app_initialization_test.py | Python | agpl-3.0 | 4,694 |
import urllib
from mock import patch
from changes.models.repository import RepositoryBackend
from changes.testutils import APITestCase
class RepositoryTreeListTest(APITestCase):
def test_no_vcs(self):
repo = self.create_repo(url='https://example.co.nonexistent/bar')
path = '/api/0/repositories/{... | dropbox/changes | tests/changes/api/test_repository_tree_index.py | Python | apache-2.0 | 4,230 |
"""Component for the Somfy MyLink device supporting the Synergy API."""
import asyncio
import logging
from somfy_mylink_synergy import SomfyMyLinkSynergy
import voluptuous as vol
from homeassistant.components.cover import ENTITY_ID_FORMAT
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeas... | turbokongen/home-assistant | homeassistant/components/somfy_mylink/__init__.py | Python | apache-2.0 | 5,985 |
from django.contrib import admin
from . import models
class PaymentMessageAdmin(admin.ModelAdmin):
list_display = ['transaction_id', 'payment_status', 'date_created']
list_filter = ['payment_status']
readonly_fields = [
'is_sandbox',
'transaction_id',
'raw_message',
'paymen... | embedded1/django-oscar-paypal | paypal/ipn/admin.py | Python | bsd-3-clause | 428 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
def index(_resp, _usuario_logado):
_resp.write('Olá Usuário %s' % _usuario_logado.nome)
def salvar(_req, _resp, nome, sobrenome):
_resp.write('Salvando usuário %s %s %s'
% (_req.method, nome, sobrenome)) | renzon/gae-t01 | backend/src/web/usuario.py | Python | mit | 299 |
from pysparse.sparse import spmatrix
from pysparse.eigen import jdsym
from pysparse.itsolvers.krylov import qmrs
from numpy import zeros, dot, allclose, multiply, random
from math import sqrt
class diagPrecShifted:
def __init__(self, A, M, sigma):
self.shape = A.shape
n = self.shape[0]
self... | optimizers/pysparse | examples/jdsym_test.py | Python | bsd-2-clause | 3,659 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: harmony.py
# Purpose: music21 classes for representing harmonies and chord symbols
#
# Authors: Beth Hadley
# Christopher Ariza
# Michael Scott Cuthbert
#
# Copy... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/harmony.py | Python | mit | 92,397 |
#!/usr/bin/python
'''
Insta-pipe: A tool for rapid development of complicated shell commands.
'''
from __future__ import print_function, unicode_literals
import os
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from subprocess import Popen, PIPE, STDOUT
def main():
SHELL = os.environ.get('SHELL'... | perimosocordiae/instapipe | instapipe.py | Python | mit | 2,006 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ControlBrowser.py
Author: Adrian Bonilla @_ambonilla
2015
"""
from PyQt4.QtGui import QMainWindow
from PyQt4.QtGui import QApplication
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QPixmap
from PyQt4.QtCore import QUrl
from ViewBrowser import Ui_Browser
... | ambonilla/python-minimalistic-browser | ControlBrowser.py | Python | mit | 2,550 |
import json
from functools import wraps
from flask import Response
class Json:
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
from types import MethodType
app.json = MethodType(json_route, app)
return self
class _Enc... | Zankoku-Okuno/flask-json | flask_json/__init__.py | Python | bsd-3-clause | 2,025 |
"""Test Hue init with multiple bridges."""
from aiohue.groups import Groups
from aiohue.lights import Lights
from aiohue.scenes import Scenes
from aiohue.sensors import Sensors
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
from homeassistant.components.hue import sens... | sdague/home-assistant | tests/components/hue/test_init_multiple_bridges.py | Python | apache-2.0 | 5,501 |
import sys
sys.path.insert(1,"../../../")
import h2o, tests
def deepLearningDemo():
# Training data
train_data = h2o.import_file(path=tests.locate("smalldata/gbm_test/ecology_model.csv"))
train_data = train_data.drop('Site')
train_data['Angaus'] = train_data['Angaus'].asfactor()
print train_data.descri... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_demoDeeplearning.py | Python | apache-2.0 | 1,322 |
# Generated by Django 3.1.5 on 2021-01-15 15:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("shots", "0002_shot_is_ap... | manti-by/Churchill | churchill/apps/shots/migrations/0003_shotitem.py | Python | bsd-3-clause | 1,590 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import json
import arDemo
class ConnectionMock():
def __init__(self, data):
self.data = data
def recv(self, *args):
if self.data['comm_count'] == 50:
self.data['RocketLaunch'] = 1
if self.data['comm_count'] == 100... | projeto-si-lansab/si-lansab | ARDrone/simulations.py | Python | gpl-2.0 | 1,026 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resources/templates/window_settings.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog... | GandaG/fomod-designer | src/ui_templates/window_settings.py | Python | apache-2.0 | 48,001 |
"""
Classes used for defining and running pytest test suites
"""
import os
from glob import glob
from pavelib.utils.envs import Env
from pavelib.utils.test import utils as test_utils
from pavelib.utils.test.suites.suite import TestSuite
from pavelib.utils.test.utils import COVERAGE_CACHE_BASELINE, COVERAGE_CACHE_BAS... | eduNEXT/edunext-platform | pavelib/utils/test/suites/pytest_suite.py | Python | agpl-3.0 | 13,537 |
# coding: utf-8
# # Talks markdown generator for academicpages
#
# Takes a TSV of talks with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_... | cjlcarvalho/cjlcarvalho.github.io | markdown_generator/talks.py | Python | mit | 3,896 |
from __future__ import unicode_literals
import json
from django import forms
from django.conf import settings
from django.forms.util import flatatt
from django.utils.http import urlencode
from django.utils.safestring import mark_safe
from selectable.compat import force_text
from selectable.forms.base import import_l... | hzlf/openbroadcast | website/tools/__old__versions/selectable/forms/widgets.py | Python | gpl-3.0 | 9,907 |
#!/usr/bin/env python2
"""
Restore Gnome Files (Nautilus) file manager window locations and folders.
Author: Bruce Myers (http://brucemyers.com/)
Copyright 2014 Myers Enterprises II
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You m... | bamyers99/NautilusWinMon | src/window-monitor-login.py | Python | apache-2.0 | 2,369 |
#
# retval-histogram.py : print histogram of given function's return values
#
# Usage: retval-histogram.py [-- -u <unit>] <function>
# Unit is one of b, k, m, g
#
# $ uftrace script -S scripts/retval-histogram.py strlen
# histogram of return value of 'strlen'
#
# < 0b : 0 ( 0.0 %)
# < 2b ... | thepaul/uftrace | scripts/retval-histogram.py | Python | gpl-2.0 | 2,667 |
from solutions import min_three
import unittest
import random
class TestMinThree(unittest.TestCase):
def test_1000_cases(self):
for _ in range(1000):
first = (random.random() - 0.5) * 2000
second = (random.random() - 0.5) * 2000
third = (random.random() - 0.5) * 2000
... | lukin155/skola-programiranja | domaci-zadaci/05/test_min_three.py | Python | mit | 1,030 |
from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse_lazy
from accounts import const
from braces import views
from .. import forms
from .. import models
from .. import mixins
class LocationListView(mixins.UserMixin, views.LoginRequiredMixin, gene... | elatomczyk/dook | cowork/locations/views.py | Python | gpl-3.0 | 1,402 |
"""
View functions for Sharrock.
"""
from sharrock import registry
from sharrock.descriptors import ParamRequired, MethodNotAllowed, AccessDenied, Conflict, FailedToLocate
from django.shortcuts import render_to_response
from django.http import Http404, HttpResponse
from django.conf import settings
import logging
log =... | Axilent/sharrock | sharrock/views.py | Python | bsd-3-clause | 5,090 |
# -*- coding: utf-8 -*-
"""
HTTP Request to SmartRoute and set response to destination URI.
Added: 2013-11-20: Created by: https://github.com/vitovitolo
"""
import httplib
from socket import timeout
class getHTTP:
def __init__(self):
pass
def __del__(self):
pass
def child_init(self, rank):... | vitovitolo/corosync-pacemaker | sip_redirect/kamailio/getHTTP.py | Python | apache-2.0 | 1,218 |
# Copyright 2017 Grant Thornton Spain - Ismael Calvo <ismael.calvo@es.gt.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Partner VAT Unique",
"version": "11.0.1.0.0",
"category": "Customer Relationship Management",
"website": "https://github.com/OCA/partner-contact",... | microcom/partner-contact | partner_vat_unique/__manifest__.py | Python | agpl-3.0 | 495 |
import sys
from copy import deepcopy
from math import sqrt
def read_num():
return list(map(int, sys.stdin.readline().split()))
def read_sudoku():
try:
n = read_num()
if not n:
n = read_num()
n = n[0]
return [read_num() for _ in range(n*n)]
except Exception:
... | secnot/uva-onlinejudge-solutions | 989 - Su Doku/main.py | Python | mit | 2,568 |
from jinjasql import JinjaSql
from django.db import connections
from squealy.exceptions import ValidationFailedException
jinjasql = JinjaSql()
def run_validation(params, user, query, db, error_message="Validation Failed"):
query, bind_params = jinjasql.prepare_query(query, {"params": params, 'user': user})
... | hemny-singh/squealy | squealy/validators.py | Python | mit | 546 |
#
# 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/licenses/LICENSE-2.0
#
# Unle... | redhat-openstack/heat | heat/tests/test_common_serializers.py | Python | apache-2.0 | 4,661 |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | google-research/disentanglement_lib | disentanglement_lib/evaluation/abstract_reasoning/relational_layers_test.py | Python | apache-2.0 | 4,868 |
"""
Tests for Discussion API views
"""
from __future__ import unicode_literals
import json
from datetime import datetime
from urlparse import urlparse
import ddt
import httpretty
import mock
from django.urls import reverse
from pytz import UTC
from rest_framework.parsers import JSONParser
from rest_framework.test imp... | ahmedaljazzar/edx-platform | lms/djangoapps/discussion_api/tests/test_views.py | Python | agpl-3.0 | 69,375 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the psychopy.iohub library.
# Copyright (C) 2012-2016 iSolver Software Solutions
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import division, absolute_import, print_function
from builtins import zip
from builtins impor... | psychopy/versions | psychopy/iohub/devices/__init__.py | Python | gpl-3.0 | 43,748 |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
Dispatch membership post_syncdb signal.
Our memberships post_syncdb handler creates new
notice types and updates existing ones in the DB.
"""
def handle(self, *args, **kwargs):
from django.db.models.sign... | alirizakeles/tendenci | tendenci/apps/memberships/management/commands/dispatch_membership_post_syncdb.py | Python | gpl-3.0 | 647 |
# -*- coding: utf-8 -*-
"""An example: merging two video files
---------------------------------------------------------------------------
Author: Andrey Zhdanov
Copyright (C) 2014 BioMag Laboratory, Helsinki University Central Hospital
This program is free software: you can redistribute it and/or... | andreyzhd/VideoMEG | examples/merge_videos.py | Python | gpl-3.0 | 2,275 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... | Micronaet/micronaet-product | edi_extract/__init__.py | Python | agpl-3.0 | 1,111 |
"""
byceps.database
~~~~~~~~~~~~~~~
Database utilities.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Any, Callable, Dict, Iterable, TypeVar
import uuid
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.sql.dml import Insert
from s... | m-ober/byceps | byceps/database.py | Python | bsd-3-clause | 3,209 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | snnn/tensorflow | tensorflow/contrib/lite/python/interpreter_test.py | Python | apache-2.0 | 7,350 |
from __future__ import unicode_literals
from django.apps import AppConfig
from django.db.models import signals
from django.contrib.auth import get_user_model
def populate_users(sender, **kwargs):
User = get_user_model()
for i in range(10):
username = "user_{}".format(i+1)
email = "{}@example.c... | nav/presence | presence/apps/presence/apps.py | Python | mit | 836 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2018-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | t-wissmann/qutebrowser | tests/unit/utils/test_urlmatch.py | Python | gpl-3.0 | 19,453 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2common/st2common/validators/api/reactor.py | Python | apache-2.0 | 3,644 |
# coding=utf-8
from popular_proposal.tests import ProposingCycleTestCaseBase as TestCase
from popular_proposal.models import (ProposalLike,
Commitment,
PopularProposal,
)
from popular_proposal.subscriptions im... | ciudadanointeligente/votainteligente-portal-electoral | popular_proposal/tests/subscription_tests.py | Python | gpl-3.0 | 18,372 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | steedos/odoo7 | openerp/tools/config.py | Python | agpl-3.0 | 34,760 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.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 Li... | andreaso/ansible | lib/ansible/modules/cloud/vmware/vmware_target_canonical_facts.py | Python | gpl-3.0 | 2,984 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-production | production_accounting_external_startup/startup.py | Python | agpl-3.0 | 13,433 |
"""Extensions for monitoring the training process."""
import logging
from blocks.extensions import SimpleExtension, TrainingExtension
from blocks.algorithms import DifferentiableCostMinimizer
from blocks.monitoring.evaluators import AggregationBuffer, DatasetEvaluator
PREFIX_SEPARATOR = '_'
logger = logging.getLogger... | rizar/attention-lvcsr | libs/blocks/blocks/extensions/monitoring.py | Python | mit | 6,063 |
import pprint
import xml.dom.minidom
from xml.dom.minidom import Node
import sys
from optparse import OptionParser
import json
import random
usage="Run as python gexf2json.py input.gexf output.json [pretty]"
"""parser = OptionParser()
parser.add_option("-i", "--input", dest="input",
help="gexf file ... | davidcmh/sigma.js | plugins/gexf2Json.py | Python | mit | 5,798 |
"""
This is lifted directoy out of the WesternX key_base repo. Please be very
careful in changing this until our tools have migrated.
"""
from __future__ import absolute_import
import functools
import os
import nuke
from uitools.qt import QtGui
from sgfs.ui.scene_name.widget import SceneNameWidget
from sgfs.ui.pi... | westernx/sgfs | sgfs/nuke/open_script.py | Python | bsd-3-clause | 2,178 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# download.py
#
# Copyright © 2013-2016 Antergos
#
# This file is part of Cnchi.
#
# Cnchi 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 th... | Wyn10/Cnchi | cnchi/installation/download/download.py | Python | gpl-3.0 | 8,573 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 Lic... | tuskar/tuskar | tuskar/manager/__init__.py | Python | apache-2.0 | 716 |
from urlparse import urlparse, uses_netloc, uses_query
# workaround for http://bugs.python.org/issue7904
if urlparse('s3://bucket/key').netloc != 'bucket':
uses_netloc.append('s3')
if urlparse('s3://bucket/key?key=value').query != 'key=value':
uses_query.append('s3')
| waseem18/oh-mainline | vendor/packages/scrapy/scrapy/xlib/urlparse_monkeypatches.py | Python | agpl-3.0 | 277 |
import pytest
import salt.modules.freezer as freezer
from salt.exceptions import CommandExecutionError
@pytest.fixture()
def configure_loader_modules():
return {freezer: {"__opts__": {"cachedir": ""}}}
def test_compare_no_args():
"""
Test freezer.compare with no arguments
"""
with pytest.raises(... | saltstack/salt | tests/pytests/unit/modules/test_freezer.py | Python | apache-2.0 | 1,033 |
# Paparazzi center utilities
#
# Copyright (C) 2016 ENAC, Florian BITARD (intern student)
#
# This file is part of paparazzi.
#
# paparazzi 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, or ... | tomvand/paparazzi-gazebo | sw/supervision/python/processes.py | Python | gpl-2.0 | 8,578 |
import numpy as np
import KerasModeltoJSON as js
from keras.models import Sequential
from keras.layers import Conv1D, Conv2D, Dense, Activation, Flatten, MaxPooling1D, MaxPooling2D, AveragePooling1D, \
AveragePooling2D
from keras.layers import Reshape, Permute, RepeatVector, GlobalMaxPooling1D, GlobalMaxPooling2D, ... | adamtiger/NNSharp | PythonUtils/KerasTestGenerator.py | Python | mit | 27,310 |
import re
def add_location_to_wikitext(type, lat, lng, wikitext):
r"""
Adds a {{Location}} template containing `lat`, `lng` to the `wikitext`.
Replaces previously specified `{{Location}}`, `{{Location dec}}` templates.
>>> add_location_to_wikitext(None, 12.3, 45.6, "")
Traceback (most recent call... | simon04/locator-tool | backend/location_to_wikitext.py | Python | gpl-3.0 | 3,540 |
# -*- coding: utf-8 -*-
"""
################################################
Plataforma ActivUFRJ
################################################
:Author: *Núcleo de Computação Eletrônica (NCE/UFRJ)*
:Contact: carlo@nce.ufrj.br
:Date: $Date: 2009-2010 $
:Status: This is a "work in progress"
:Revision: $Revision: 0.0... | labase/activnce | main/utils/0_11_1201retiravirguladastags.py | Python | gpl-2.0 | 3,149 |
from __future__ import with_statement
import logging
import types
import urllib
import sys
import weakref
import UserList
import newrelic.api.application
import newrelic.api.object_wrapper
import newrelic.api.transaction
import newrelic.api.web_transaction
import newrelic.api.function_trace
import newrelic.api.error_... | galaxy-team/website | newrelic/hooks/framework_twisted.py | Python | agpl-3.0 | 20,328 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ************************************... | joshmoore/zeroc-ice | scripts/IceStormUtil.py | Python | gpl-2.0 | 11,378 |
# -----------------------------------------------------------------------------
# QP/Python Library
#
# Port of Miro Samek's Quantum Framework to Python. The implementation takes
# the liberty to depart from Miro Samek's code where the specifics of desktop
# systems (compared to embedded systems) seem to warrant a diff... | objarni/qp-python | examples/qcalc/test_qcalc.py | Python | bsd-3-clause | 18,200 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | zouyapeng/horizon-newtouch | openstack_dashboard/api/swift.py | Python | apache-2.0 | 11,697 |
r"""Generate images from ipyvolume using chrome headless.
Assuming osx, define the following aliases for convenience, and start in headless mode::
$ alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
$ chrome --remote-debugging-port=9222 --headless
Make sure you have `PyChromeDev... | maartenbreddels/ipyvolume | ipyvolume/headless.py | Python | mit | 2,434 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import unittest
from decimal import Decimal
from gaebusiness.business import CommandExecutionException
from google.appengine.ext import ndb
from google.appengine.ext.ndb.model import Model
from base import GAETestCase
from gaepagseguro.adm... | renzon/gaepagseguro | test/validation_commands_tests.py | Python | gpl-2.0 | 18,492 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.math
~~~~~~~~~~~~~~~~~~~~
Lexers for math languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import re
from pygments.util import shebang_match... | victoredwardocallaghan/pygments-main | pygments/lexers/math.py | Python | bsd-2-clause | 115,799 |
"""Longley dataset"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
The classic 1967 Longley Data
http://www.itl.nist.gov/div898/strd/lls/data/Longley.shtml
::
Longley, J.W. (1967) "An Appraisal... | bashtage/statsmodels | statsmodels/datasets/longley/data.py | Python | bsd-3-clause | 1,680 |
# coding: utf-8
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
requirements = [
'Django>=1.5.1',
]
setuptools.setup(
name="django-admin-actions",
version="0.1.0",
url="https://gith... | zerc/django-admin-actions | setup.py | Python | mit | 1,114 |
from __future__ import print_function, division
from sympy import Expr, sympify, Symbol, Matrix
from sympy.printing.pretty.stringpict import prettyForm
from sympy.core.containers import Tuple
from sympy.core.compatibility import is_sequence, string_types, u
from sympy.physics.quantum.matrixutils import (
numpy_nda... | sympsi/sympsi | sympsi/qexpr.py | Python | bsd-3-clause | 14,865 |
# -*- coding: utf-8 -*- vim:fileencoding=utf-8:
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 ... | grnet/ganetimgr | ganeti/views/graphs.py | Python | gpl-3.0 | 4,230 |
#!/usr/bin/env python3
"Sync hostlist and builds config files for services."
from . import buildfiles
__version__ = '1.4.7'
if __name__ == "__main__":
buildfiles.main()
| particleKIT/hostlist | hostlist/__init__.py | Python | gpl-3.0 | 176 |
#
# Copyright (C) 2005-2017 Christoph Rupp (chris@crupp.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | cruppstahl/upscaledb | python/unittests/uqi.py | Python | apache-2.0 | 1,579 |
# -*- coding: utf-8 -*-
"""
All data structures related to poker like poker actions, cards, rounds etc.
"""
from __future__ import print_function, absolute_import, division
from . import pokerth_pb2
__author__ = 'Florian Wilhelm'
__copyright__ = 'Florian Wilhelm'
# suits of poker cards (diamonds, hearts, spades, c... | FlorianWilhelm/pokerthproto | pokerthproto/poker.py | Python | bsd-3-clause | 1,907 |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.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
#
# http://www.apache.org/licenses/LICEN... | Anderson0026/mapproxy | mapproxy/test/unit/test_collections.py | Python | apache-2.0 | 3,143 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.