code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | ProfessionalIT/maxigenios-website | sdk/google_appengine/google/appengine/ext/db/polymodel.py | Python | mit | 12,828 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## Usage:
## ant catalog-export -Dproject=tm1
## gunzip -c ./files/workloads/tm1.trace.gz | ./scripts/json-to-mysql.py --debug --catalog=tm1.json | gzip --best -c > tm1.csv.gz
##
## To load in MySQL:
## LOAD DATA INFILE '/tmp/tm1.csv' INTO TABLE tm1_log FIELDS TERMINATED B... | gxyang/hstore | tools/traces/json-to-mysql.py | Python | gpl-3.0 | 6,675 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para zippyshare
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core im... | orione7/Italorione | servers/zippyshare.py | Python | gpl-3.0 | 2,075 |
# -*- coding: utf-8 -*-
##############################################################################
#
# 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... | Johnzero/erp | openerp/addons/resource/__openerp__.py | Python | agpl-3.0 | 2,072 |
#!/usr/bin/python
from pprint import pprint
from pyroute2 import IPRoute
from pyroute2 import IPDB
from pyroute2.common import uifname
# high-level interface
ipdb = IPDB()
interface = ipdb.create(ifname=uifname(), kind='dummy').\
commit().\
add_ip('172.16.0.1/24').\
add_ip('172.16.0.2/24').\
commit()... | tomislacker/python-iproute2 | examples/nla_operators.py | Python | apache-2.0 | 764 |
#
# Copyright 2014 Quantopian, 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 wr... | DVegaCapital/zipline | zipline/gens/tradesimulation.py | Python | apache-2.0 | 15,130 |
"""
Internationalization support.
"""
import re
import warnings
from contextlib import ContextDecorator, suppress
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.functional import lazy
__all__ = [
'activate', 'deactivate', 'override', 'deactivate_all',
'get_language', 'get_lang... | tysonclugg/django | django/utils/translation/__init__.py | Python | bsd-3-clause | 7,467 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | mo-g/iris | lib/iris/tests/test_iterate.py | Python | gpl-3.0 | 25,812 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_bank_statement_import,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_bank_statement_import is free software:
# you can redi... | MarcosCommunity/odoo | comunity_modules/account_bank_statement_import/tests/test_res_partner_bank.py | Python | agpl-3.0 | 2,949 |
# -*- encoding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
from openerp.http import route
from openerp.addons.report.controllers import main as report
class ReportController(report.ReportController):
@route()
def report_routes(self, reportname, docids=None, converter=None, **data):
... | MackZxh/OCA-Choice | reporting-engine/report_xml/controllers.py | Python | lgpl-3.0 | 1,000 |
"""
Render to gtk from agg
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import os
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_gtk impo... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/backends/backend_gtkagg.py | Python | bsd-2-clause | 4,369 |
#!/usr/bin/env python
# Copyright (c) 2014 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.
"""Waterfall monitoring script.
This script checks all builders specified in the config file and sends
status email about any s... | Jonekee/chromium.src | chrome/test/chromedriver/test/waterfall_builder_monitor.py | Python | bsd-3-clause | 8,008 |
'''
This module will:
- change the input() and raw_input() commands to change \r\n or \r into \n
- execute the user site customize -- if available
- change raw_input() and input() to also remove any trailing \r
Up to PyDev 3.4 it also was setting the default encoding, but it was removed because... | dannyperry571/theapprentice | script.module.pydevd/lib/pydev_sitecustomize/sitecustomize.py | Python | gpl-2.0 | 7,681 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_stats_quantile_rast.py
------------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
**********... | dwadler/QGIS | python/plugins/processing/algs/grass7/ext/r_stats_quantile_rast.py | Python | gpl-2.0 | 2,502 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferDelightUI/InteractiveDelightRenderUI.py | Python | bsd-3-clause | 2,146 |
"Memcached cache backend"
import pickle
import re
import time
import warnings
from django.core.cache.backends.base import (
DEFAULT_TIMEOUT, BaseCache, InvalidCacheKey, memcache_key_warnings,
)
from django.utils.deprecation import RemovedInDjango41Warning
from django.utils.functional import cached_property
clas... | atul-bhouraskar/django | django/core/cache/backends/memcached.py | Python | bsd-3-clause | 9,298 |
import sys
__all__ = (
'BaseForm',
'Form',
)
from wtforms.compat import with_metaclass, iteritems, itervalues
class BaseForm(object):
"""
Base Form Class. Provides core behaviour like field construction,
validation, and data and error proxying.
"""
def __init__(self, fields, prefix=''):... | barrand/CTRs | src/lib/wtforms/form.py | Python | mit | 10,588 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Kevin Brebanov <https://github.com/kbrebanov>
# Based on pacman (Afterburn <https://github.com/afterburn>, Aaron Bull Schaefer <aaron@elasticdog.com>)
# and apt (Matthew Williams <matthew@flowroute.com>) modules.
#
# GNU General Public License v3.0+ (see COPYING or... | roadmapper/ansible | lib/ansible/modules/packaging/os/apk.py | Python | gpl-3.0 | 11,168 |
# Copyright 2016 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... | tornadozou/tensorflow | tensorflow/python/keras/_impl/keras/preprocessing/image_test.py | Python | apache-2.0 | 8,769 |
"""SCons.Tool.sunc++
Tool-specific initialization for C++ on SunOS / Solaris.
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, 2010, 201... | ake-koomsin/mapnik_nvpr | scons/scons-local-2.2.0/SCons/Tool/sunc++.py | Python | lgpl-2.1 | 4,786 |
from __future__ import absolute_import
from pex.interpreter import *
| abel-von/commons | src/python/twitter/common/python/interpreter.py | Python | apache-2.0 | 69 |
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | leimaohui/dnf-yocto | tests/cli/test_term.py | Python | gpl-2.0 | 3,321 |
"""Support for hydrological data from the Fed. Office for the Environment."""
from datetime import timedelta
import logging
from swisshydrodata import SwissHydroData
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_MONITORED_CO... | tchellomello/home-assistant | homeassistant/components/swiss_hydrological_data/sensor.py | Python | apache-2.0 | 4,964 |
"""Common initialisation for the Plugwise integration."""
from homeassistant.components.plugwise.const import DOMAIN
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry
from tests.test_util.aiohttp import AiohttpClientMocker
async def async_init_integration(
hass: HomeAssistant... | jawilson/home-assistant | tests/components/plugwise/common.py | Python | apache-2.0 | 728 |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.errors import HeaderParseError
from email.parser import HeaderParser
from django.urls import reverse
from django.utils.safestring import mark_safe
try:
import docutils.core
import docutils.nodes
import docutils.pars... | fenginx/django | django/contrib/admindocs/utils.py | Python | bsd-3-clause | 7,971 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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 Lice... | garyjyao1/ansible | lib/ansible/modules/extras/cloud/cloudstack/cs_domain.py | Python | gpl-3.0 | 7,796 |
import datetime
import pickle
from io import StringIO
from operator import attrgetter
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.db import DEFAULT_DB_ALIAS, connections, router, transaction
from django.db.models ... | edmorley/django | tests/multiple_database/tests.py | Python | bsd-3-clause | 90,725 |
import numpy as np
from numpy.testing import assert_equal, assert_raises, assert_almost_equal
from skimage.measure import LineModel, CircleModel, EllipseModel, ransac
from skimage.transform import AffineTransform
from skimage.measure.fit import _dynamic_max_trials
from skimage._shared._warnings import expected_warnings... | michaelaye/scikit-image | skimage/measure/tests/test_fit.py | Python | bsd-3-clause | 8,327 |
# -*- coding: utf-8 -*-
# vispy: gallery 30
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------... | ghisvail/vispy | examples/basics/visuals/markers.py | Python | bsd-3-clause | 2,332 |
# Copyright 2011 OpenStack LLC.
# 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... | tylertian/Openstack | openstack F/nova/nova/api/openstack/compute/contrib/server_diagnostics.py | Python | apache-2.0 | 2,505 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | Antiun/purchase-workflow | purchase_group_orders/__openerp__.py | Python | agpl-3.0 | 1,654 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
#
# 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
# with... | ff94315/hiwifi-openwrt-HC5661-HC5761 | staging_dir/host/lib64/scons-2.1.0/SCons/Errors.py | Python | gpl-2.0 | 7,448 |
import pathlib
from qgis.testing import start_app, unittest, TestCase
from qgis.testing.mocked import get_iface
from qgis.core import QgsRasterLayer, QgsProject, QgsMultiBandColorRenderer, QgsRasterRenderer, QgsSingleBandGrayRenderer
from qgis.gui import QgsRendererRasterPropertiesWidget, QgsMapCanvas, QgsMultiBandColo... | pblottiere/QGIS | tests/src/python/test_qgsrendererrasterpropertieswidget.py | Python | gpl-2.0 | 2,524 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import main
import bus
| chienlieu2017/it_management | odoo/addons/calendar/controllers/__init__.py | Python | gpl-3.0 | 123 |
"""
Unit tests for enrollment methods in views.py
"""
import ddt
from mock import patch
from django.test.utils import override_settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from courseware.tests.helpers import LoginEnrollmentTestCase
from courseware.tests.modulesto... | geekaia/edx-platform | lms/djangoapps/instructor/tests/test_legacy_enrollment.py | Python | agpl-3.0 | 14,981 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Sale Partner Order Policy module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | damdam-s/sale-workflow | sale_partner_order_policy/__openerp__.py | Python | agpl-3.0 | 2,015 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from .geo import AitoffAxes, HammerAxes, LambertAxes, MollweideAxes
from .polar import PolarAxes
from matplotlib import axes
class ProjectionRegistry(object):
"""
Manages the set of project... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/projections/__init__.py | Python | bsd-2-clause | 3,371 |
from __future__ import print_function
import os
from os import listdir
from os.path import isdir, isfile, splitext
from gi.repository import Gtk
import cairo
from pychess.Utils.const import *
from pychess.Utils.Piece import Piece
from pychess.gfx import Pieces
from pychess.System.prefix import addDataPrefix, getUser... | Aleks31/pychess | create_theme_preview.py | Python | gpl-3.0 | 1,780 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ProjectTask(models.Model):
_name = "project.task"
_inherit = ["project.task", 'pad.common']
description_pad = fields.Char('Pad URL', pad_content_field='description')
| chienlieu2017/it_management | odoo/addons/pad_project/models/project_task.py | Python | gpl-3.0 | 319 |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from kitsune.search.es_utils import es_delete_cmd
from kitsune.search.utils import FakeLogger
class Command(BaseCommand):
help = 'Delete an index from elastic search.'
option_list = BaseCommand.option_list + (... | orvi2014/kitsune | kitsune/search/management/commands/esdelete.py | Python | bsd-3-clause | 721 |
# this is a virtual module that is entirely implemented server side
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1... | tsdmgz/ansible | lib/ansible/modules/commands/telnet.py | Python | gpl-3.0 | 2,332 |
# 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... | ghchinoy/tensorflow | tensorflow/contrib/recurrent/python/kernel_tests/recurrent_test.py | Python | apache-2.0 | 6,957 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import account_report_common_journal
import account_report_print_journal
import account_report_partner_ledger
| vileopratama/vitech | src/addons/account_extra_reports/wizard/__init__.py | Python | mit | 210 |
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | FNST-OpenStack/horizon | openstack_dashboard/dashboards/project/volumes/snapshots/tests.py | Python | apache-2.0 | 9,169 |
#! /usr/bin/env python
import os
import re
import sys
import time
import random
import getopt
import logging
import tempfile
import subprocess
import shutil
# This script runs and kills db_stress multiple times. It checks consistency
# in case of unsafe crashes in RocksDB.
def main(argv):
try:
opts, args ... | Applied-Duality/rocksdb | tools/db_crashtest.py | Python | bsd-3-clause | 7,009 |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models import NOT_PROVIDED
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_... | WhySoGeeky/DroidPot | venv/lib/python2.7/site-packages/django/db/backends/mysql/schema.py | Python | mit | 4,645 |
#!/usr/bin/env python
parameter_list=[[]]
def features_dense_io_modular():
from modshogun import RealFeatures, CSVFile
feats=RealFeatures()
f=CSVFile("../data/fm_train_real.dat","r")
f.set_delimiter(" ")
feats.load(f)
return feats
if __name__=='__main__':
print('Dense Real Features IO')
features_dense_io_modu... | AzamYahya/shogun | examples/undocumented/python_modular/features_dense_io_modular.py | Python | gpl-3.0 | 344 |
# Copyright 2016 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... | laosiaudi/tensorflow | tensorflow/contrib/learn/python/learn/estimators/tensor_signature_test.py | Python | apache-2.0 | 8,630 |
import unittest
import time
from robot.utils.asserts import assert_equals
from robot.utils import format_time
from robot.output.stdoutlogsplitter import StdoutLogSplitter as Splitter
class TestOutputSplitter(unittest.TestCase):
def test_empty_output_should_result_in_empty_messages_list(self):
splitter ... | yahman72/robotframework | utest/output/test_stdout_splitter.py | Python | apache-2.0 | 3,622 |
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'access_and_security'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'compute'
# Python panel class of the PANEL to be added.
... | FNST-OpenStack/horizon | openstack_dashboard/enabled/_1060_project_access_panel.py | Python | apache-2.0 | 435 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | ktan2020/legacy-automation | win/Lib/site-packages/waitress/receiver.py | Python | mit | 4,849 |
from headerid import * | tijptjik/thegodsproject | plugins/headerid/__init__.py | Python | mit | 22 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | jmesteve/saas3 | openerp/addons/hr_timesheet_invoice/report/report_analytic.py | Python | agpl-3.0 | 5,179 |
#!/usr/bin/env python
#
# Copyright 2010 Facebook
#
# 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... | wolfelee/luokr.com | www.luokr.com/lib/tornado/stack_context.py | Python | bsd-3-clause | 13,172 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Widiot/simpleblog | venv/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py | Python | mit | 8,752 |
""" Simplify linking to Bokeh Github resources.
This module proved four new roles that can be uses to easily link
to various resources in the Bokeh Github repository:
``:bokeh-commit:`` : link to a specific commit
``:bokeh-issue:`` : link to an issue
``:bokeh-milestone:`` : link to a milestone page
``:bokeh-pull:`... | akloster/bokeh | bokeh/sphinxext/bokeh_github.py | Python | bsd-3-clause | 4,812 |
#! /usr/bin/env python3
"""Find the maximum recursion limit that prevents interpreter termination.
This script finds the maximum safe recursion limit on a particular
platform. If you need to change the recursion limit on your system,
this script will tell you a safe upper bound. To use the new limit,
call sys.setrec... | Salat-Cx65/python-for-android | python3-alpha/python3-src/Tools/scripts/find_recursionlimit.py | Python | apache-2.0 | 3,554 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ovnicraft/openerp-restaurant | stock/report/picking.py | Python | agpl-3.0 | 1,861 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | alxgu/ansible | lib/ansible/modules/storage/netapp/netapp_e_auditlog.py | Python | gpl-3.0 | 11,350 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | inovtec-solutions/OpenERP | openerp/addons/document_page/__init__.py | Python | agpl-3.0 | 1,090 |
# 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... | ucloud/uai-sdk | examples/mxnet/train/imagenet/code/symbols/alexnet.py | Python | apache-2.0 | 3,218 |
"""Qubits for quantum computing.
Todo:
* Finish implementing measurement logic. This should include POVM.
* Update docstrings.
* Update tests.
"""
from __future__ import print_function, division
import math
from sympy import Integer, log, Mul, Add, Pow, conjugate
from sympy.core.basic import sympify
from sympy.core... | kaichogami/sympy | sympy/physics/quantum/qubit.py | Python | bsd-3-clause | 24,119 |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_age_limit,
)
class BreakIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?break\.com/video/(?:[^/]+/)*.+-(?P<id>\d+)'
_TESTS = [{
'url': 'http://www.break... | miminus/youtube-dl | youtube_dl/extractor/breakcom.py | Python | unlicense | 1,895 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | Branlala/docker-sickbeardfr | sickbeard/lib/guessit/transfo/guess_bonus_features.py | Python | mit | 2,155 |
# Copyright 2014 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... | jinhou/cuda-convnet2 | shownet.py | Python | apache-2.0 | 18,206 |
"""scons.Node.Alias
Alias nodes.
This creates a hash of global Aliases (dummy targets).
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation fi... | bleepbloop/Pivy | scons/scons-local-1.2.0.d20090919/SCons/Node/Alias.py | Python | isc | 4,271 |
# Python - 3.6.0
Test.describe('Basic tests')
Test.assert_equals(replicate(3, 5), [5, 5, 5])
Test.assert_equals(replicate(5, 1), [1, 1, 1, 1, 1])
Test.assert_equals(replicate(0, 12), [])
Test.assert_equals(replicate(-1, 12), [])
Test.assert_equals(replicate(8, 0), [0, 0, 0, 0, 0, 0, 0, 0])
| RevansChen/online-judge | Codewars/7kyu/recursive-replication/Python/test.py | Python | mit | 292 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
sys.path.append("omi-summer-lab/omi")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "omi_stl.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fa... | omi/stl-api-gateway | manage.py | Python | mit | 847 |
""" periodic_porous script. """
import numpy as np
from generate_mesh import MESHES_DIR, store_mesh_HDF5, line_points, \
rad_points, round_trip_connect, numpy_to_dolfin
from utilities.plot import plot_edges, plot_faces
from meshpy import triangle as tri
from common import info
import os
import dolfin as df
import m... | gautelinga/BERNAISE | utilities/mesh_scripts/periodic_porous.py | Python | mit | 6,640 |
# -*- coding: utf-8 -*-
"""
apps.authors.forms
~~~~~~~~~~~~~~
Authors forms
:copyright: (c) 2012 by arruda.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from authors.models import Author
class NewAuthorForm(forms.ModelForm):
"a new Author form"
... | arruda/rmr | rmr/apps/authors/forms.py | Python | mit | 397 |
import numpy as np
import matplotlib.pyplot as plt
"""
This handles simulation of the evidence accumulation process directly. An agent makes a predefined number of
observations and the derived information is computed exactly, rather than being approximated with a FP-solution.
"""
# Parameters for the simulation
lengt... | Spstolar/net-ev-accum | Code/Plotting/SDEapprox.py | Python | mit | 2,183 |
import re
from unittest import TestCase
from pyWordyClock.WordyClock import *
class AcceptanceTest(TestCase):
def testShouldRoundTimeToClosest5MinuteBlock(self):
self.assertEquals((1,0), roundToClosest5Minutes(1, 0))
self.assertEquals((1,0), roundToClosest5Minutes(1, 1))
self.assertEquals... | kenlim/pyWordyClock | test/AcceptanceTest.py | Python | mit | 2,616 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the Wapiti project (http://wapiti.sourceforge.net)
# Copyright (C) 2012-2013 Nicolas Surribas
#
# 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 So... | sapientgov/openfda-travel | misc/wapiti-2.3.0/wapitiCore/net/jsoncookie.py | Python | mit | 5,383 |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A tool for computing Nash equilibria',
'author': 'Petr Šebek',
'license': 'MIT',
'url': 'https://github.com/Artimi/neng',
'author_e... | Artimi/neng | setup.py | Python | mit | 604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 James Zhang
# Copyright (c) 2015 Rasmus Sorensen
#
# The MIT License (MIT)
#
# 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 Softwa... | scholer/auto-save | auto_save.py | Python | mit | 3,580 |
import numpy as np
import Errors
default_plot_font = {
'family': 'FreeSerif',
'size' : 10
}
def GetSubplotPos(fig):
p = fig.subplotpars
print "left:\t{0}".format(p.left)
print "right:\t{0}".format(p.right)
print "bottom:\t{0}".format(p.bottom)
print "top:\t{0}".format(p.to... | jokebill/NEST-pyTools | PlotTools.py | Python | mit | 10,947 |
#!/usr/bin/env python
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from setuptools import Extension
setup(
name='simulations',
version='0.8.3',
author='Gregory McWhirter',
author_email='gmcwhirt@uci.edu',
description='A framework for evolutionary game ... | gsmcwhirter/simulations | setup.py | Python | mit | 1,289 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2015_06_15/operations/_express_route_service_providers_operations.py | Python | mit | 5,214 |
import asyncio
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp.types import RegisterOptions, SubscribeOptions
from autobahn.wamp import auth
from serpent.config import config
from pony.orm import *
from serpent.dashboard.models import *
import json
class DashboardAPIComp... | SerpentAI/SerpentAI | serpent/wamp_components/dashboard_api_component.py | Python | mit | 5,508 |
import uuid
import pytest
from flask import current_app, json
from freezegun import freeze_time
from notifications_python_client.authentication import create_jwt_token
from app.dao.api_key_dao import save_model_api_key
from app.dao.notifications_dao import dao_update_notification
from app.dao.templates_dao import dao... | alphagov/notifications-api | tests/app/notifications/test_rest.py | Python | mit | 22,267 |
from django.test import TestCase
from main.consistency import ensure_variant_set_consistency
from main.models import AlignmentGroup
from main.models import ExperimentSample
from main.models import Variant
from main.models import VariantAlternate
from main.models import VariantCallerCommonData
from main.models import... | churchlab/millstone | genome_designer/main/tests/test_consistency.py | Python | mit | 3,062 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "%d min. tilbage at læse",
"(active)": "",
"Also available in:": "Fås også i:",
"Archive": "Arkiv",
"Categories": "Kategorier",
"Comments": "Kommentarer",
"LANGUAGE": "Dansk",
"Lang... | JohnTroony/nikola | nikola/data/themes/base/messages/messages_da.py | Python | mit | 1,375 |
from __future__ import division
import os
from math import ceil, floor
from xml.dom.minidom import parse
import numpy as np
from skimage.io import imread
from skimage.transform import rescale
from .dataset import Datasets
from .download import maybe_download_and_extract
URL = 'http://host.robots.ox.ac.uk/pascal/VO... | rusty1s/embedded_gcnn | lib/datasets/pascal_voc.py | Python | mit | 5,768 |
"""advent of code day 1.
http://adventofcode.com/2016/day/1
"""
import sys
import string
def face(direction, facing):
"""Keep track of facing direction."""
try:
lr = direction[0]
if lr == "R":
facing += 1
elif lr == "L":
facing -= 1
facing = facing % ... | shaggy245/adventofcode | day01/day1.py | Python | mit | 1,282 |
# a very simple blackjack game
# in the game the cards have the following values ...
# ace 11 or 1
# J, Q, K are 10
# the rest of the cards 2 - 10 are face value
# you start with two cards and add them up
# if you have 21, then you have the best score, a blackjack
# if you have between 1... | ActiveState/code | recipes/Python/578586_Black_Jack/recipe-578586.py | Python | mit | 3,112 |
from flask import Flask,json, Response, send_from_directory
import redis
app = Flask(__name__, static_url_path='')
r = redis.StrictRedis(host='localhost', port=6379, db=0)
@app.route('/')
def root():
return send_from_directory('', 'index.html')
@app.route('/js/<path:path>')
def send_js(path):
return send_fro... | keoghpe/daftpunk | frontend/server.py | Python | mit | 1,972 |
import sys, os
def trySetupCoverage(): # pragma: no cover - can hardly measure coverage here :)
try:
import coverage
coverage.process_startup() # doesn't do anything unless COVERAGE_PROCESS_START is set
except Exception:
pass
def loadTestCustomize():
try:
# Generic file ... | emilybache/texttest-runner | src/main/python/libexec/sitecustomize.py | Python | mit | 1,650 |
import pytest
from ..structures import List, NonNull
from ..scalars import String
def test_list():
_list = List(String)
assert _list.of_type == String
assert str(_list) == '[String]'
def test_nonnull():
nonnull = NonNull(String)
assert nonnull.of_type == String
assert str(nonnull) == 'Strin... | sjhewitt/graphene | graphene/types/tests/test_structures.py | Python | mit | 1,067 |
# -*- coding: utf-8 -*-
import asyncio
from ..enerpi import (EnerpiStreamer, LOGGER, EnerpiSensor, CONF_HOST, CONF_PORT, CONF_PREFIX,
CONF_SCAN_INTERVAL, CONF_DELTA_REFRESH, CONF_DEVICES, CONF_MAIN_POWER, CONF_LASTWEEK)
##########################################
# ENERPI PLATFORM:
##############... | azogue/hass_config | custom_components/sensor/enerpi.py | Python | mit | 1,986 |
"""Actions to take when suggestions are made."""
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
from django.core.mail import mail_admins
from django.template.loader import get_template
from django.template import Context
from suggestions import mo... | mikesname/ehri-collections | ehriportal/suggestions/signals.py | Python | mit | 910 |
import random # pragma: no cover
import io # pragma: no cover
from collections import Counter # pragma: no cover
import os.path # pragma: no cover
import csv # pragma: no cover
import numpy
from pathlib import Path
import json
from ._vendorized.keras_data_utils import get_file # pragma: no cover
from ..neural.util imp... | ryfeus/lambda-packs | Spacy/source2.7/thinc/extra/datasets.py | Python | mit | 8,162 |
from enum import Enum
class bantypes(Enum):
commands = 1
markov = 2
irc = 3
music = 4
| PJB3005/MoMMI | MoMMI/permissions.py | Python | mit | 104 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('visit', '0066_visit_visit2_other_description'),
]
operations = [
migrations.RemoveField(
model_name='visit',
... | koebbe/homeworks | visit/migrations/0067_remove_visit_visit2_no_issues.py | Python | mit | 371 |
from setuptools import setup, find_packages
setup(name='django-starter-box',
version='0.1.1',
license='MIT',
description='Django starter box',
long_description='Starter box',
author='Lucas Tan',
author_email='do-not-spam@gmail.com',
url='http://github.com/lucastan/django-starter-box',
p... | lucastan/django-starter-box | setup.py | Python | mit | 786 |
__author__ = 'sibirrer'
from astrofunc.correlation import Correlation
import numpy as np
import pytest
#from lenstronomy.unit_manager import UnitManager
class TestCorrelation(object):
def setup(self):
self.correlation = Correlation()
def test_corr1D(self):
residuals = np.ones((10,10))
... | sibirrer/astrofunc | test/test_correlation.py | Python | mit | 487 |
from django.core.urlresolvers import NoReverseMatch
class CrudError(Exception):
pass
class AttrCrudError(AttributeError, CrudError):
pass
class SetupCrudError(AssertionError, CrudError):
pass
class ReverseCrudError(NoReverseMatch, CrudError):
pass
| samuelcolvin/django-crud | django_crud/exceptions.py | Python | mit | 272 |
# Python - 3.6.0
Test.assert_equals(high_and_low("4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"), "542 -214")
| RevansChen/online-judge | Codewars/7kyu/highest-and-lowest/Python/test.py | Python | mit | 103 |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
from local_packages.list import ListNode
class Solution:
def hasCycle(self, head: ListNode) -> bool:
slow, fast = head, head
while fast and fast.next:
s... | l33tdaima/l33tdaima | p141e/has_cycle.py | Python | mit | 972 |
# -*- coding: utf-8 -*-
"""Module: barcode.ean
:Provided barcodes: EAN-13, EAN-8, JAN
"""
from functools import reduce
from .base import Barcode
from .charsets import ean as _ean
from .errors import IllegalCharacterError, WrongCountryCodeError
from .helpers import sum_chars
# EAN13 Specs (all sizes in mm)
SIZES = d... | steenzout/python-barcode | steenzout/barcode/ean.py | Python | mit | 5,816 |
import operator
from typing import Union, Callable
class DdExpression:
def __init__(self, dd_id: Union[tuple, str, float, int], expression_repr: str = None, expression_chain: Callable = None) -> None:
self.dd_id = dd_id if isinstance(dd_id, tuple) else (dd_id,)
self.expression_repr = expression_re... | TomMcL/xadd | variable.py | Python | mit | 3,674 |