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 |
|---|---|---|---|---|---|
from client import DjangoClient
from django.db import connection
import time
class BatianAPMMiddleware(object):
def __init__(self, **kwargs):
self.client = DjangoClient()
def process_request(self, request):
request.start_time = time.time()
def process_view(self, request, view_func, view... | ishuah/python-batian | batian/contrib/django/middleware.py | Python | gpl-2.0 | 658 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/fake/fakemq.py | Python | gpl-2.0 | 4,021 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 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... | toofar/qutebrowser | qutebrowser/misc/editor.py | Python | gpl-3.0 | 9,693 |
import os
import socket
if hasattr(socket, "AF_UNIX"):
from ._unix import FakeSnapd # noqa: F401
try:
from ._unittests import ( # noqa: F401
FakeElf,
FakeExtension,
FakeMetadataExtractor,
FakeMultipass,
FakePlugin,
FakeProjectOptions,
FakeSnapCommand,
... | chipaca/snapcraft | tests/fixture_setup/__init__.py | Python | gpl-3.0 | 1,177 |
#from gi.repository import Gtk
import cairo, os
from softwarecenter.enums import ViewPages
from softwarecenter.paths import datadir
from mkit import floats_from_string
class SectionPainter(object):
# specify background overlay image and color mappings for available and installed view ids
BACKGROUND_IMAG... | armikhael/software-center | softwarecenter/ui/gtk3/widgets/sections.py | Python | gpl-3.0 | 1,787 |
# -*- coding: utf-8 -*-
############################################################################
# LGPL License #
# #
# This program is free software: you can redistribute it and/or ... | BennX/jim-db | buildenvironment/darwin.py | Python | gpl-3.0 | 2,969 |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# import sys
import os
from setuptools import setup, find_packages
def package_files(directory):
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.appe... | vuillaut/ImArray | setup.py | Python | gpl-3.0 | 1,396 |
import re
def split_string(string, seperator=' '):
""" Split string on separator """
return string.split(seperator)
def split_regex(string, seperator_pattern):
""" Split string on regular expression """
return re.split(seperator_pattern, string)
# Dedicated filters
def keyboard_layouts(keyboards, f=... | gislab-npo/gislab | system/filter_plugins/utils.py | Python | gpl-3.0 | 1,704 |
from hashlib import md5
from django import template
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.template.defaultfilters import title
from social_auth.models import UserSocialAuth
register = template.Library()
@register.filter(is_safe=True)
def social_link(us... | Nivl/www.melvin.re | nivls_website/user_profile/templatetags/user_tags.py | Python | gpl-3.0 | 4,342 |
#!/usr/bin/env python3
# Copyright (c) 2008-11 Qtrac Ltd. All rights reserved.
# This program or module 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... | therealjumbo/python_summer | py31eg/external_sites.py | Python | gpl-3.0 | 1,475 |
import theano
import theano.tensor as T
import lasagne
class MLPEncoder(object):
def __init__(self, LAYER_UNITS, classifier = False):
self.layer1_units = LAYER_UNITS[0]
self.layer2_units = None
self.layer3_units = None
if len(LAYER_UNITS) > 1:
self.layer2_units = LAYER... | Jonbean/models | neural_reasoner/MLP_Encoder.py | Python | gpl-3.0 | 3,035 |
import sys
import os
import numpy as np
import copy
import pysam
import dinucshuffle
from Bio import SeqIO
import dubiotools as dbt
class Reader(object):
def __init__(self):
#self.type='BaseReader'
pass
def pull(self):
return ([],[])
def pull_as_onehot(self,batch_size):
... | LarsDu/DeepNucDecomp | deepnuc/readers.py | Python | gpl-3.0 | 11,974 |
from pytank.Applications import *
from pytank.Buttons import *
from pytank.Fuctions import *
from pytank.SystemFunctions import Ping
import traceback
def Main():
ConnectToConfigurator()
AddDevices(Configurator_security,15,Configurator_securitypanels)
ResetToFactory()
try:
CurrentOpenedWindows = GetLis... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/__OLD_SCRIPTS/runnner_AddAllSecurityDevices.py | Python | gpl-3.0 | 484 |
# -*- coding: utf-8 -*-
#
# main.py
#
# Copyright (C) 2010 - 2015 Wei-Ning Huang (AZ) <aitjcize@gmail.com>
# All Rights reserved.
#
# This file is part of cppman.
#
# 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 S... | czchen/debian-cppman | cppman/main.py | Python | gpl-3.0 | 11,297 |
# (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... | eerorika/ansible | lib/ansible/plugins/action/async.py | Python | gpl-3.0 | 5,578 |
# This file is part of Lurklib.
# Copyright (C) 2011 LK-
#
# Lurklib 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.... | bbqsrc/lurklib | lurklib/connection.py | Python | gpl-3.0 | 14,032 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_labeltools_label_leaves_in_expr_with_leaf_indices_01():
r'''Leaf indices start at 0.
'''
staff = Staff("c'8 d'8 e'8 f'8")
labeltools.label_leaves_in_expr_with_leaf_indices(staff)
assert systemtools.TestManager.compare(
staff,
... | mscuthbert/abjad | abjad/tools/labeltools/test/test_labeltools_label_leaves_in_expr_with_leaf_indices.py | Python | gpl-3.0 | 899 |
from Regions import *
from Classes import button
import Settings
GlobalCustomButtonThreshold = Settings.GlobalCustomButtonThreshold
v_home = button()
v_home.Image("v_home.png")
v_home.Region(VIEWER_REGION)
source1 = button()
source1.Image("source1.png")
source1.Region(CONFIGURATOR_REGION)
showunsupporteddevices ... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/__OLD_SCRIPTS/Buttons.py | Python | gpl-3.0 | 86,791 |
# Miro - an RSS based video player application
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Participatory Culture Foundation
#
# 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; eithe... | rwaldron/mirovideoconverter3 | mvc/widgets/gtk/tableviewcells.py | Python | gpl-3.0 | 10,124 |
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
import csv
import logging
from core.util import stripfalse
from core.trans... | brownnrl/moneyguru | core/loader/csv.py | Python | gpl-3.0 | 7,401 |
def activity01(num1):
'''Determine if an input number is Even or Odd'''
if (num1 % 2 == 0):
return 'Even'
else:
return 'Odd'
def activity02(iv_one, iv_two):
'''Return the sum of two input values'''
one_plus_two = iv_one + iv_two
return one_plus_two
def activity03(num_list):
'''Given a list of integers,... | Zekvan/Cybrary-PythonForSecurityProfessionals | Module 2 Apprentice Python/Solutions/Apprentice_Activities_Solution.py | Python | gpl-3.0 | 616 |
#!/usr/bin/env python
"""
Directed Graphs
===============
Default visualisation for a directed graph.
"""
import matplotlib.pyplot as plt
from netgraph import Graph
cube = [
(0, 1),
(1, 2),
(2, 3), # <- bidirectional edges
(3, 2), # <-
(3, 0),
(4, 5),
(5, 6), # <-
(6, 5), # <-
(6... | paulbrodersen/netgraph | examples/plot_02_directed_network.py | Python | gpl-3.0 | 461 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
from django.conf import settings
from django.db.models import Q
from django.http import Http404, HttpResponseR... | ckprice/bedrock | bedrock/releasenotes/views.py | Python | mpl-2.0 | 7,250 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/ActiveData-ETL | vendor/jx_sqlite/expressions/in_op.py | Python | mpl-2.0 | 1,259 |
# coding=utf-8
from django.conf.urls import url
from feedback.views import redirect
urlpatterns = [
url(r'^redirect/$', redirect,
{'redirect_to': 'http://www.d120.de/'}),
url(r'^redirect/(?P<tail>.*)$', redirect,
{'redirect_to': 'http://www.d120.de/'}),
]
| d120/pyfeedback | src/feedback/tests/redirect_urls.py | Python | agpl-3.0 | 282 |
import json
import os
from flask import Flask, render_template, request, Response, redirect, url_for
from flask_mail import Mail, Message
from flask_bootstrap import Bootstrap
from flask_wtf import Form
from wtforms import StringField, SubmitField
from wtforms.widgets import TextInput
from wtforms.validators import Re... | xujun10110/url-abuse | web/__init__.py | Python | agpl-3.0 | 13,088 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#################################################... | eicher31/compassion-modules | sbc_compassion/migrations/10.0.1.5.0/post-migration.py | Python | agpl-3.0 | 2,776 |
from reversion import revisions
from judge.models.choices import TIMEZONE, ACE_THEMES, MATH_ENGINES_CHOICES, EFFECTIVE_MATH_ENGINES
from judge.models.comment import Comment, CommentVote
from judge.models.contest import Contest, ContestTag, ContestParticipation, ContestProblem, ContestSubmission, Rating
from judge.mode... | monouno/site | judge/models/__init__.py | Python | agpl-3.0 | 1,672 |
# -*- coding: utf-8 -*-
# (c) 2017 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_product_supplierinfo_import
| esthermm/odoo-addons | product_supplierinfo_import/tests/__init__.py | Python | agpl-3.0 | 179 |
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import partner_merge
| OCA/partner-contact | partner_deduplicate_by_website/wizards/__init__.py | Python | agpl-3.0 | 148 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-29 12:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0032_add_bulk_delete_pag... | UTNkar/moore | src/branding/migrations/0001_initial.py | Python | agpl-3.0 | 2,489 |
"""Tests for the principal package."""
from pyramid import testing
from pytest import fixture
from pytest import mark
from unittest.mock import Mock
import pytest
import unittest
@fixture
def integration(integration):
integration.include('pyramid_mailer.testing')
integration.include('pyramid_mako')
integr... | liqd/adhocracy3.mercator | src/adhocracy_core/adhocracy_core/resources/test_principal.py | Python | agpl-3.0 | 31,954 |
# coding: utf-8
from .models import AppCoffees
from boites.views import AppCreateView, AppUpdateView, AppDeleteView
class AppCoffeesCreateView(AppCreateView):
model = AppCoffees
fields = ['url', 'uid']
class AppCoffeesUpdateView(AppUpdateView):
model = AppCoffees
fields = ['url', 'uid', 'enabled']
... | bgaultier/laboitepro | laboite/apps/coffees/views.py | Python | agpl-3.0 | 387 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import pytest
from shuup.simple_cms.views import PageView
from shuup.testing.facto... | hrayr-artunyan/shuup | shuup_tests/simple_cms/test_children.py | Python | agpl-3.0 | 2,105 |
import requests
from django.db import models
from django.conf import settings
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailsearch import index
from wagtail.wagtailadmin.edit_handlers import FieldPanel
class PersonPage(Orderable, Page):
user = models.OneToOneField(settings.AUTH_USER_... | City-of-Helsinki/devheldev | aboutus/models.py | Python | agpl-3.0 | 1,845 |
# -*- coding: utf-8 -*-
"""
ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke
tests/test_error_missingroutine.py: Checks for proper error handling if routine does not exist
Required to run on platform / side: [UNIX, WINE]
Copyr... | pleiszenburg/zugbruecke | tests/test_error_missingroutine.py | Python | lgpl-2.1 | 1,798 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCekit(PythonPackage):
"""CEKit is a Container image creation tool.
CEKit helps to bu... | iulian787/spack | var/spack/repos/builtin/packages/py-cekit/package.py | Python | lgpl-2.1 | 1,533 |
# Orca
#
# Copyright (C) 2015 Igalia, S.L.
#
# Author: Joanmarie Diggs <jdiggs@igalia.com>
#
# This library 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 2.1 of the License, or (at yo... | pvagner/orca | src/orca/scripts/apps/evolution/braille_generator.py | Python | lgpl-2.1 | 2,352 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PySpacy(PythonPackage):
"""spaCy is a library for advanced Natural Language Processing in
Python and Cython... | iulian787/spack | var/spack/repos/builtin/packages/py-spacy/package.py | Python | lgpl-2.1 | 1,855 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... | Fat-Zer/FreeCAD_sf_master | src/Mod/Path/PathScripts/PathDrillingGui.py | Python | lgpl-2.1 | 7,330 |
import sys
def setup(core, object):
object.setStfFilename('static_item_n')
object.setStfName('item_jedi_robe_06_04')
object.setDetailFilename('static_item_d')
object.setDetailName('item_jedi_robe_06_04')
object.setStringAttribute('protection_level', 'Radiant')
object.setStringAttribute('class_required', 'Jedi'... | agry/NGECore2 | scripts/object/tangible/wearables/robe/robe_s32.py | Python | lgpl-3.0 | 1,064 |
#!/usr/bin/env python3
import os, sys
pandoraPath = os.getenv('PANDORAPATH', '/usr/local/pandora')
sys.path.append(pandoraPath+'/bin')
sys.path.append(pandoraPath+'/lib')
from pyPandora import Point2DInt
testPoint = Point2DInt(4,6)
print('point: ',testPoint)
testPoint._x += 1
testPoint._y = testPoint._y//2
print('... | montanier/pandora | examples/python/testPoint.py | Python | lgpl-3.0 | 350 |
#! /usr/bin/env python
'''
this module runs pylint on all python scripts found in a directory tree
'''
import os
import re
import sys
from optparse import OptionParser
total = 0.0
count = 0
errors = 0
VERBOSE = False
BASE_DIRECTORY = os.getcwd()
SUMMARY = False
class WritableObject(object):
"dummy output stream... | wangy1931/tcollector | pylint-runner.py | Python | lgpl-3.0 | 3,903 |
#!/usr/bin/env python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import socket
import netaddr
import logging
import netifaces
import tempfile
from contrail_vrouter_provisioning import local
from contrail_vrouter_provisioning.base import ContrailSetup
from contrail_vrouter_provisio... | eonpatapon/contrail-controller | src/vnsw/provisioning/contrail_vrouter_provisioning/common.py | Python | apache-2.0 | 50,063 |
import re
from typing import Any, Callable, Dict, Match, Optional
from urllib.parse import urljoin
import magic
import requests
from django.conf import settings
from django.utils.encoding import smart_str
from version import ZULIP_VERSION
from zerver.lib.cache import cache_with_key, get_cache_with_key, preview_url_ca... | zulip/zulip | zerver/lib/url_preview/preview.py | Python | apache-2.0 | 4,624 |
# 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... | mlperf/training_results_v0.7 | Google/benchmarks/bert/implementations/bert-cloud-TF2.0-tpu-v3-32/tf2_common/benchmark/models/resnet_cifar_model.py | Python | apache-2.0 | 10,418 |
import sys
try:
from pymysql.tests import base
import pymysql.cursors
from pymysql.constants import CLIENT
except Exception:
# For local testing from top-level directory, without installing
sys.path.append('../pymysql')
from pymysql.tests import base
import pymysql.cursors
from pymysql.... | imron/scalyr-agent-2 | scalyr_agent/third_party/pymysql/tests/test_SSCursor.py | Python | apache-2.0 | 3,766 |
# Copyright 2014 Scalyr 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, so... | imron/scalyr-agent-2 | tests/unit/json_lib/objects_test.py | Python | apache-2.0 | 9,833 |
#!/usr/bin/env python
bob2 = {'name': {'first': 'Bob', 'last': 'Smith'},
'age': 42,
'job': ['software', 'writing'],
# 'pay': [ 40000, 50000]}
'pay': ( 40000, 50000)}
print bob2
print(bob2['name'])
print(bob2['name']['first'])
print(bob2['name']['last'])
... | lichengshuang/createvhost | python/others/Preview/p26_1.py | Python | apache-2.0 | 596 |
import subprocess
class Printer( object ):
def __init__(self, name, flags=None, options=None):
self.name = name
if flags:
self.flags = flags
else:
self.options = {}
if options:
self.options = options
else:
self.options = []
def __str__(self):
ret = 'Printer: ' + self.name + '\n'
ret +=... | roycem90/python-o365 | examples/EmailPrinting/printing.py | Python | apache-2.0 | 3,325 |
# Copyright 2017 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... | AnishShah/tensorflow | tensorflow/python/data/kernel_tests/reader_dataset_ops_test.py | Python | apache-2.0 | 31,212 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | tanglei528/ceilometer | ceilometer/openstack/common/db/exception.py | Python | apache-2.0 | 1,876 |
# Copyright (c) 2015 Russell Sim <russell.sim@gmail.com>
#
# 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 ... | annegentle/fairy-slipper | fairy_slipper/tests/cmd/test_tempest.py | Python | apache-2.0 | 12,719 |
# Copyright 2013 Huawei Technologies Co.,LTD.
#
# 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... | danielmellado/tempest | tempest/api/compute/admin/test_servers_negative.py | Python | apache-2.0 | 6,694 |
# -*- coding: utf-8 -*-
import pytest
from zirkon.toolbox.scope import Scope
from zirkon.toolbox.serializer.codec import Codec
def test_Codec_subclass():
class MyCodec(Codec):
def encode(self, obj):
pass
def decode(self, encoded_obj):
pass
my_codec = MyCodec(Scope())
| simone-campagna/daikon | tests/unit/toolbox/serializer/test_codec.py | Python | apache-2.0 | 320 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Cloudscaling Gro... | gorocacher/payload | payload/openstack/common/db/sqlalchemy/models.py | Python | apache-2.0 | 3,729 |
# Copyright 2015 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... | frreiss/tensorflow-fred | tensorflow/python/ops/parsing_ops.py | Python | apache-2.0 | 49,979 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | saydulk/horizon | openstack_dashboard/test/test_data/sahara_data.py | Python | apache-2.0 | 21,811 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | cxysteven/Paddle | python/paddle/trainer_config_helpers/networks.py | Python | apache-2.0 | 52,297 |
import datetime
import os
from django.apps import apps
from django.core.management.base import BaseCommand
from django.db import connection
from django.db.migrations import Migration
from django.db.migrations import operations
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.writer imp... | CenterForOpenScience/SHARE | share/management/commands/maketriggermigrations.py | Python | apache-2.0 | 4,022 |
# Copyright 2017 Janos Czentye
#
# 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, s... | 5GExchange/escape | escape/escape/api/__init__.py | Python | apache-2.0 | 717 |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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 la... | TribeMedia/synapse | synapse/push/clientformat.py | Python | apache-2.0 | 3,212 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2010,2011,2012,2013 Contributor
#
# 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 Li... | stdweird/aquilon | lib/python2.6/aquilon/worker/commands/add_sandbox.py | Python | apache-2.0 | 3,149 |
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import ... | cloudcopy/seahub | seahub/notifications/views.py | Python | apache-2.0 | 5,436 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | xq262144/hue | apps/spark/src/spark/job_server_api.py | Python | apache-2.0 | 4,607 |
#! /usr/bin/env python
#
# Copyright 2016 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 requir... | googlei18n/language-resources | my/bigrams.py | Python | apache-2.0 | 4,368 |
# -*- coding: utf-8 -*-
class Keywords(dict):
def __init__(self,
keywords=[]):
for keyword in keywords:
self.__setitem__(keyword.name, keyword)
# def __iter__(self):
# return self.itervalues()
| jfrygeo/solutions-geoprocessing-toolbox | suitability/toolboxes/scripts/MultidimensionSupplementalTools/MultidimensionSupplementalTools/Scripts/mds/keywords.py | Python | apache-2.0 | 245 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | BiznetGIO/horizon | releasenotes/source/conf.py | Python | apache-2.0 | 9,736 |
# Copyright 2013-2014 Massachusetts Open Cloud Contributors
#
# 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... | henn/hil | tests/unit/model.py | Python | apache-2.0 | 2,883 |
import os
import subprocess
import runner
import parsers
import printers
PROJECT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../")
def call(cmd, cwd):
proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
try:
out, err = proc.communic... | eucpp/gcmalloc | tools/helper_heap_plots.py | Python | apache-2.0 | 4,616 |
"""Drop create Program permission from ProgramOwner and ProgramEditor roles.
Revision ID: 40a621571ac7
Revises: 1a22bb208258
Create Date: 2013-12-05 22:12:46.273929
"""
# revision identifiers, used by Alembic.
revision = '40a621571ac7'
down_revision = '1a22bb208258'
import sqlalchemy as sa
from alembic import op
f... | uskudnik/ggrc-core | src/ggrc_basic_permissions/migrations/versions/20131205221246_40a621571ac7_drop_create_program_.py | Python | apache-2.0 | 1,385 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db.models import Max
from django.utils.timezone import now as timezone_now
def backfill_subscription_log_events(a... | tommyip/zulip | zerver/migrations/0093_subscription_event_log_backfill.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 use ... | apache/libcloud | libcloud/test/common/test_aws.py | Python | apache-2.0 | 13,084 |
"""Support for NWS weather service."""
from datetime import timedelta
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_SUNNY,
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
ATTR_FORECAST_TEMP,
ATTR_FORECAST_TIME,
ATTR_FORECAST_WIND... | partofthething/home-assistant | homeassistant/components/nws/weather.py | Python | apache-2.0 | 10,236 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | cloudera/hue | desktop/core/ext-py/apache-ranger-0.0.3/apache_ranger/model/ranger_service.py | Python | apache-2.0 | 1,561 |
# Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | sebrandon1/tempest | tempest/tests/lib/services/identity/v3/test_roles_client.py | Python | apache-2.0 | 11,253 |
import datetime
import os
from tornado.web import UIModule
from pushmanager.core import util
from pushmanager.core.settings import Settings
class Request(UIModule):
"""Displays an individual request entry with expandable details/comments."""
def javascript_files(self):
return [self.handler.static_ur... | hashbrowncipher/pushmanager | pushmanager/ui_modules.py | Python | apache-2.0 | 3,881 |
# Copyright 2017 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... | horance-liu/tensorflow | tensorflow/contrib/quantize/python/quantize.py | Python | apache-2.0 | 16,035 |
from django.conf import settings
from django.db import models
from django.utils.encoding import force_bytes, force_str
from django.utils.six import with_metaclass
from cryptography.fernet import Fernet, InvalidToken
fernet = Fernet(settings.FERNET_KEY)
class EncryptedTextField(with_metaclass(models.SubfieldBase, m... | tombooth/django-field-cryptography | django_field_cryptography/fields.py | Python | bsd-2-clause | 1,749 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | zstars/weblabdeusto | server/src/experiments/ud_xilinx/programmers.py | Python | bsd-2-clause | 3,090 |
# Copyright (c) 2009-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software 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,
# thi... | gholms/euca2ools | euca2ools/commands/ec2/runinstances.py | Python | bsd-2-clause | 14,968 |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import integer, positive_integer, network_port, boolean
VALID_RULETYPES = ('SYSTEM', 'FORWARD')
def validate_ruletype(ruletype):
"""Vali... | ikben/troposphere | troposphere/route53.py | Python | bsd-2-clause | 5,700 |
#/usr/bin/env python
'''
Author: Chris Duffy
Date: March 2015
Name: smtp_vrfy.py
Purpose: To validate users on a box running SMTP
Copyright (c) 2015, Christopher Duffy All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following condi... | liorvh/pythonpentest | smtp_vrfy.py | Python | bsd-3-clause | 7,182 |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Table, ForeignKey, types
from sqlalchemy.ext.mutable import Mutable
#from werkzeug import generate_password_hash, check_password_hash
from geoalchemy2 import Geometry
from flask.ext.login import UserMixin
from .constants import *
from ..extensions import db
from ... | wandonye/vshare | vshare/chat/models.py | Python | bsd-3-clause | 1,154 |
from setuptools import setup, find_packages
setup(
name='submitty_utils',
author='Submitty',
version='0.6.0',
packages=find_packages(exclude=('tests',)),
license='BSD',
description='Python Submitty Utils',
install_requires=[
'tzlocal'
],
tests_require=[],
zip_safe=True
)... | RCOS-Grading-Server/HWserver | python_submitty_utils/setup.py | Python | bsd-3-clause | 321 |
"""
SQLite3 backend for the sqlite3 module in the standard library.
"""
import decimal
import re
import warnings
from sqlite3 import dbapi2 as Database
import pytz
from django.core.exceptions import ImproperlyConfigured
from django.db import utils
from django.db.backends import utils as backend_utils
from django.db.b... | alexallah/django | django/db/backends/sqlite3/base.py | Python | bsd-3-clause | 17,790 |
# -*- coding: utf-8 -*-
import copy
import json
import sys
import traceback
from django.conf import settings
from django.core.files.storage import default_storage as storage
import mock
from nose.plugins.attrib import attr
from nose.tools import eq_
from pyquery import PyQuery as pq
import waffle
import amo
import a... | robhudson/zamboni | apps/devhub/tests/test_views_validation.py | Python | bsd-3-clause | 33,929 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from carcd import constants
import pinyin
import string
import re
from collections import OrderedDict
import sys
def beautify(context):
... | jeroyang/carcd | carcd/name.py | Python | bsd-3-clause | 4,120 |
import numpy as np
import pytest
from pandas._libs.tslibs.timedeltas import delta_to_nanoseconds
import pandas as pd
from pandas import Timedelta
@pytest.mark.parametrize(
"obj,expected",
[
(np.timedelta64(14, "D"), 14 * 24 * 3600 * 1e9),
(Timedelta(minutes=-7), -7 * 60 * 1e9),
(Time... | toobaz/pandas | pandas/tests/tslibs/test_timedeltas.py | Python | bsd-3-clause | 793 |
import functools
import networkx
class Ordering(object):
@functools.total_ordering
class OrderedItem(object):
def __init__(self, ordering, item):
self._ordering = ordering
self._item = item
def __eq__(self, other):
return self._item == other._item
d... | abortz/saycbridge | src/z3b/ordering.py | Python | bsd-3-clause | 1,694 |
# -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from conpaas.core.https import client
def check_agent_process(host, port):
"""GET () check_agent_process"""
method = 'check_agent_process'
return client.check_response(client.jsonrpc_get(host, port, '/', method))
def c... | mihaisoloi/conpaas | conpaas-services/src/conpaas/services/selenium/agent/client.py | Python | bsd-3-clause | 783 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/core/collection/parameter_exploration.py | Python | bsd-3-clause | 3,905 |
"""Undocumented Module"""
__all__ = ['DirectCheckButton']
from panda3d.core import *
from .DirectButton import *
from .DirectLabel import *
class DirectCheckButton(DirectButton):
"""
DirectCheckButton(parent) - Create a DirectGuiWidget which responds
to mouse clicks by setting a state of on or off and ex... | tobspr/panda3d | direct/src/gui/DirectCheckButton.py | Python | bsd-3-clause | 8,498 |
import logging
import time
from pyquery import PyQuery as pq
from django.conf import settings
from django.db import connection
from django.contrib.auth.models import AnonymousUser, User
from django.test import TestCase
from django.test.client import Client
from nose.tools import assert_equal, with_setup, assert_fa... | mozilla/mozilla-badges | vendor-local/src/django-valet-keys/valet_keys/tests/test_views.py | Python | bsd-3-clause | 5,954 |
from django.template.loader import get_template
from django.utils.translation import ugettext
import jinja2
from django_jinja import library
from olympia import amo
from olympia.access import acl
from olympia.ratings.models import RatingFlag
from .. import forms
@library.filter
def stars(num, large=False):
# ... | lavish205/olympia | src/olympia/ratings/templatetags/jinja_helpers.py | Python | bsd-3-clause | 2,881 |
"""
pyshtools datasets.
To load a dataset, call the relevant method as in this example:
hlm = pysh.datasets.Venus.VenusTopo719()
When accessing a pyshtools dataset, the file will first be downloaded from the
orginal source and stored in the user's cache directory (if it had not been
done previously). The file ha... | SHTOOLS/SHTOOLS | pyshtools/datasets/__init__.py | Python | bsd-3-clause | 968 |
##########################################################################
#
# Copyright (c) 2013-2014, John Haddon. 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 ... | chippey/gaffer | python/GafferOSL/__init__.py | Python | bsd-3-clause | 1,943 |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... | mixman/djangodev | django/contrib/markup/templatetags/markup.py | Python | bsd-3-clause | 3,450 |
# coding=utf-8
from django.contrib.contenttypes.generic import BaseGenericInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.forms.models import construct_instance
class GenericInlineFormSet(BaseGenericInlineFormSet):
def save_new(self, form, commit=True):
kwargs = {
... | suselrd/django-allmedia | media/formsets.py | Python | bsd-3-clause | 655 |
from os.path import dirname, join
import pandas as pd
from bokeh.layouts import row, column
from bokeh.models import ColumnDataSource, CustomJS
from bokeh.models.widgets import RangeSlider, Button, DataTable, TableColumn, NumberFormatter
from bokeh.io import curdoc
df = pd.read_csv(join(dirname(__file__), 'salary_da... | stonebig/bokeh | examples/app/export_csv/main.py | Python | bsd-3-clause | 1,441 |