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 |
|---|---|---|---|---|---|
import hashlib
import json
import os
import unicodedata
import uuid
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
from django.db import models
from django.dispatch import receiver
from django.template.defaultfilters import... | eviljeff/zamboni | mkt/files/models.py | Python | bsd-3-clause | 11,351 |
import datetime
from mozillians.phonebook.models import Invite
from mozillians.users.models import IdpProfile
def redeem_invite(redeemer, code):
if code:
try:
invite = Invite.objects.get(code=code, redeemed=None)
voucher = invite.inviter
except Invite.DoesNotExist:
... | akatsoulas/mozillians | mozillians/phonebook/utils.py | Python | bsd-3-clause | 853 |
"""
Template Tags go in this directory
Load modules in templates with {% load badger %}
"""
| jricardo27/travelhelper | travelhelper/apps/core/templatetags/__init__.py | Python | bsd-3-clause | 93 |
from django.template.loader import render_to_string
from glitter.templates import get_layout
def baseblock(block, request, rerender, content_block, block_classes):
css_classes = ' '.join(block_classes)
# Find the column
layout = get_layout(template_name=content_block.obj_version.template_name)
column... | developersociety/django-glitter | glitter/block_views.py | Python | bsd-3-clause | 652 |
# Copyright 2010 Google Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# trib... | kumar303/rockit | vendor-local/boto/gs/acl.py | Python | bsd-3-clause | 10,641 |
# -*- coding: utf-8 -*-
#
# COFFEE documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 30 11:25:59 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | gmarkall/COFFEE | doc/source/conf.py | Python | bsd-3-clause | 7,963 |
import os
from importlib import import_module
from pulsar import ImproperlyConfigured
from cloud import aws
from .. import core
content_types = {'fjson': 'application/json',
'inv': 'text/plain'}
class Docs(core.AgileCommand):
"""Requires a valid sphinx installation
"""
description = ... | quantmind/pulsar-agile | agile/plugins/docs.py | Python | bsd-3-clause | 2,024 |
# -*- coding: utf-8 -*-
"""
line.client
~~~~~~~~~~~
LineClient for sending and receiving message from LINE server.
:copyright: (c) 2014 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
import rsa
import requests
try:
import simplejson as json
except ImportError:
import json... | Inndy/LINE | line/api.py | Python | bsd-3-clause | 7,999 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-25 19:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0008_notification_recipient'),
]
operations = [
migrations.DeleteModel(
... | divio/django-shop | shop/migrations/0009_delete_email.py | Python | bsd-3-clause | 361 |
# Time: O(max(r, c) * wlogw)
# Space: O(w)
class Solution(object):
def shortestDistance(self, maze, start, destination):
"""
:type maze: List[List[int]]
:type start: List[int]
:type destination: List[int]
:rtype: int
"""
start, destination = tuple(start), tu... | yiwen-luo/LeetCode | Python/the-maze-ii.py | Python | mit | 1,267 |
from .Exporter import Exporter
from ..python2_3 import asUnicode
from ..parametertree import Parameter
from ..Qt import QtGui, QtCore, QtSvg, QT_LIB
from .. import debug
from .. import functions as fn
import re
import xml.dom.minidom as xml
import numpy as np
__all__ = ['SVGExporter']
class SVGExporter(Exporter):
... | campagnola/acq4 | acq4/pyqtgraph/exporters/SVGExporter.py | Python | mit | 17,330 |
import sys, os, socket, atexit, re
import pkg_resources
from pkg_resources import ResolutionError, ExtractionError
from setuptools.compat import urllib2
try:
import ssl
except ImportError:
ssl = None
__all__ = [
'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_available', 'cert_paths',
'opener_for'
]
c... | c0710204/mirrorsBistu | pypi/bandersnatch/lib/python2.7/site-packages/setuptools/ssl_support.py | Python | mit | 7,288 |
from dolfin import *
import numpy as np
import pandas as pd
n = 6
Dim = np.zeros((n,1))
ErrorL2 = np.zeros((n,1))
ErrorH1 = np.zeros((n,1))
OrderL2 = np.zeros((n,1))
OrderH1 = np.zeros((n,1))
# parameters['reorder_dofs_serial'] = False
for x in range(1,n+1):
parameters['form_compiler']['quadrature_degree'] = -1
... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Hartman2D/Laplacian.py | Python | mit | 1,981 |
import shutil
from django.contrib.admin.models import User
from projects.models import Project
from rtd_tests.utils import make_test_git
from rtd_tests.base import RTDTestCase
class TestBuilding(RTDTestCase):
"""These tests run the build functions directly. They don't use celery"""
fixtures = ['eric.json']... | Acidburn0zzz/readthedocs.org | readthedocs/rtd_tests/tests/test_doc_building.py | Python | mit | 818 |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Test script for security-check.py
'''
import os
import subprocess
import unittest
def write_testcode(... | rnicoll/bitcoin | contrib/devtools/test-security-check.py | Python | mit | 5,500 |
import difflib
import os
import re
import subprocess
BREW_CMD_PATH = '/Library/Homebrew/cmd'
TAP_PATH = '/Library/Taps'
TAP_CMD_PATH = '/%s/%s/cmd'
def _get_brew_path_prefix():
"""To get brew path"""
try:
return subprocess.check_output(['brew', '--prefix'],
uni... | ytjiang/thefuck | thefuck/rules/brew_unknown_command.py | Python | mit | 3,202 |
class CommentFile:
def __init__(self, f, commentstring="#"):
self.f = f
self.commentstring = commentstring
def next(self):
line = self.f.next()
while line.startswith(self.commentstring):
line = self.f.next()
return line
def __iter__(self):
retur... | alliance-genome/agr_prototype | indexer/src/files/comment_file.py | Python | mit | 327 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Identities module forms
"""
from django import forms
from django.core.files.storage import default_storage
from django.template import defaultfilters
from django.core.urlresolvers import reverse
from dja... | thiagof/treeio | treeio/identities/forms.py | Python | mit | 15,660 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Form implementation generated from reading ui file 'acq4/analysis/modules/STDPAnalyzer/STDPPlotsTemplate.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
... | pbmanis/acq4 | acq4/analysis/modules/STDPAnalyzer/STDPPlotsTemplate.py | Python | mit | 3,796 |
"""SMTP email backend class."""
import smtplib
import socket
import ssl
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.message import sanitize_address
from django.core.mail.utils import DNS_NAME
class EmailBackend(BaseEmailBackend):... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/core/mail/backends/smtp.py | Python | mit | 5,306 |
#!/usr/bin/env python
__author__ = 'waroquiers'
import unittest
from pymatgen.util.testing import PymatgenTest
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import ExplicitPermutationsAlgorithm
from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import... | setten/pymatgen | pymatgen/analysis/chemenv/coordination_environments/tests/test_coordination_geometries.py | Python | mit | 14,930 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/location_paged.py | Python | mit | 874 |
"""Schema migrations."""
| yongwen/makahiki | makahiki/apps/widgets/smartgrid_play_tester/migrations/__init__.py | Python | mit | 25 |
#!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin, urlparse, parse_qs
from bs4 import BeautifulSoup
from utils import utils, inspector
# https://www.sba.gov/office-of-inspector-general
archive = 1994
# options:
# standard since/year options for a year range ... | divergentdave/inspectors-general | inspectors/sba.py | Python | cc0-1.0 | 10,624 |
# vim: set encoding=utf-8
# @todo: this file is becoming too large; refactor
import logging
import string
from pyparsing import CaselessLiteral, FollowedBy, OneOrMore, Optional
from pyparsing import Suppress, Word, LineEnd, ZeroOrMore
from regparser.grammar import atomic, tokens, unified
from regparser.grammar.utils ... | grapesmoker/regulations-parser | regparser/grammar/amdpar.py | Python | cc0-1.0 | 17,063 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutItemLegend.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"... | CS-SI/QGIS | tests/src/python/test_qgslayoutlegend.py | Python | gpl-2.0 | 9,958 |
#!/usr/bin/env python
class RoundFloatManual(object):
def __init__(self, val):
assert isinstance(val, float), \
"Value must be a float!"
self.value = round(val, 2)
def __str__(self):
return '%.2f' % self.value
__repr__ = __str__
| opensvn/test | src/study/python/cpp/ch13/roundFloat2.py | Python | gpl-2.0 | 280 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from projects.models import Project
class Necessity(models.Model):
"""
Item or service that an organization regularly needs
"""
name = models.CharField(verbose_name=_('Name'), max_length=20)
satisfied = models.Bo... | MauricioAlmeida/maoaberta | maoaberta/organizations/models.py | Python | gpl-2.0 | 2,083 |
__author__ = 'bromix'
from ..abstract_context_ui import AbstractContextUI
from ...logging import *
from .mock_progress_dialog import MockProgressDialog
class MockContextUI(AbstractContextUI):
def __init__(self):
AbstractContextUI.__init__(self)
self._view_mode = None
def set_view_mode(self, ... | Etharr/plugin.video.youtube | resources/lib/youtube_plugin/kodion/impl/mock/mock_context_ui.py | Python | gpl-2.0 | 1,400 |
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.utils import (Parameter, ParametrizedLocator, ParametrizedString, Version,
VersionPick)
from widgetastic.widget import Checkbox, Table, Text, View
from widgetastic_manageiq import FileInput, SummaryForm, SummaryTable
from widgetastic_patt... | jkandasa/integration_tests | cfme/services/catalogs/ansible_catalog_item.py | Python | gpl-2.0 | 16,192 |
#!/usr/bin/env kross
import os, sys, re, types, string, datetime, urllib
# import the reportlab module.
import reportlab
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.lib.units import inch, cm
from reportlab.lib.pagesizes import A0,A1,A2,A3,A4,A5,A6,B0,B1,B2,B3,B4,B5,B6,lette... | KDE/calligra-history | kword/plugins/scripting/scripts/kwreportlab.py | Python | gpl-2.0 | 18,197 |
# Generated by Django 2.2.7 on 2019-12-02 02:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0017_auto_20191125_0931'),
]
operations = [
migrations.RemoveField(
model_name='session',
name='date_las... | skyoo/jumpserver | apps/terminal/migrations/0018_auto_20191202_1010.py | Python | gpl-2.0 | 2,294 |
import os
import sys
# Add parent directory to path to make test aware of other modules
srcfolder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', "src"))
if srcfolder not in sys.path:
sys.path.append(srcfolder)
| lmotta/Roam | tests/__init__.py | Python | gpl-2.0 | 234 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
ponysay - Ponysay, cowsay reimplementation for ponies
Copyright (C) 2012, 2013, 2014 Erkin Batu Altunbaş et al.
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 Softw... | tdsmith/ponysay | src/balloon.py | Python | gpl-3.0 | 8,019 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2021 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... | fiete201/qutebrowser | tests/test_conftest.py | Python | gpl-3.0 | 1,648 |
#
# This code is part of Ansible, but is an independent component.
#
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complet... | kbrebanov/ansible | lib/ansible/module_utils/network/nxos/nxos.py | Python | gpl-3.0 | 14,622 |
from indivo.models import Record, Demographics
from base import *
class TestRecord(TestModel):
model_fields = ['label', 'demographics', 'owner', 'external_id']
model_class = Record
def _setupargs(self, label, demographics=None, owner=None, external_id=None, extid_principal_key=None):
self.label = ... | sayan801/indivo_server | indivo/tests/data/record.py | Python | gpl-3.0 | 1,535 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | Eigenlabs/EigenD | lib_pico/preadtemp.py | Python | gpl-3.0 | 1,052 |
# -*- coding: utf-8 -*-
##################################################################################################
import logging
import xbmc
import xbmcgui
import xbmcaddon
##################################################################################################
LOG = logging.getLogger("EMBY."+__... | angelblue05/plugin.video.emby | resources/lib/dialogs/resume.py | Python | gpl-3.0 | 1,522 |
import numpy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plot
# Data generation
alpha = numpy.linspace(1, 8, 5)
t = numpy.linspace(0, 5, 16)
T, A = numpy.meshgrid(t, alpha)
data = numpy.exp(-T * (1. / A))
# Plotting
fig = plot.figure()
ax = fig.gca(projection = '3d')
Xi = T.flatten()
Yi = A.f... | moonbury/notebooks | github/MatplotlibCookbook/Chapter 7/09.py | Python | gpl-3.0 | 546 |
# 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 later version.
#
# This program is distributed i... | apyrgio/synnefo | snf-cyclades-app/synnefo/volume/management/commands/snapshot-show.py | Python | gpl-3.0 | 2,301 |
# coding=utf-8
# Author: medariox <dariox@gmx.com>
# based on Dustyn Gibson's <miigotu@gmail.com> work
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | andrewleech/SickRage | sickbeard/providers/gftracker.py | Python | gpl-3.0 | 7,214 |
from lookupTests import *
from compositionTests import *
from udgTests import *
from dataFlowTests import *
from cfgTests import *
from parsingTests import *
from interproc import *
from initGraphTests import *
| fabsx00/python-joern | testing/tests/__init__.py | Python | gpl-3.0 | 212 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without res... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/boto/regioninfo.py | Python | agpl-3.0 | 6,214 |
"""
Methods for exporting course data to XML
"""
import logging
import lxml.etree
from xblock.fields import Scope
from xmodule.contentstore.content import StaticContent
from xmodule.exceptions import NotFoundError
from xmodule.modulestore import Location
from xmodule.modulestore.inheritance import own_metadata
from fs... | morenopc/edx-platform | common/lib/xmodule/xmodule/modulestore/xml_exporter.py | Python | agpl-3.0 | 10,461 |
"""
Test the publish code (mostly testing that publishing doesn't result in orphans)
"""
import itertools
import os
import re
import unittest
import uuid
import xml.etree.ElementTree as ET
from contextlib import contextmanager
from shutil import rmtree
from tempfile import mkdtemp
import pytest
import ddt
from open... | eduNEXT/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_publish.py | Python | agpl-3.0 | 55,886 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-2014 OpenERP (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | Codefans-fan/odoo | openerp/fields.py | Python | agpl-3.0 | 70,820 |
# pylint: disable=consider-iterating-dictionary, missing-module-docstring
import json
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.... | eduNEXT/edunext-platform | lms/djangoapps/discussion/notification_prefs/tests.py | Python | agpl-3.0 | 9,839 |
"""
Utility Mixins for unit tests
"""
import json
import sys
from django.conf import settings
from django.urls import clear_url_caches, resolve
from django.test import TestCase
from mock import patch
from util.db import CommitOnSuccessManager, OuterAtomic
class UrlResetMixin(object):
"""Mixin to reset urls.py ... | philanthropy-u/edx-platform | common/djangoapps/util/testing.py | Python | agpl-3.0 | 6,042 |
# 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 RCombinat(RPackage):
"""routines for combinatorics"""
homepage = "https://cloud.r-pro... | iulian787/spack | var/spack/repos/builtin/packages/r-combinat/package.py | Python | lgpl-2.1 | 598 |
# -*- coding: utf-8 -*-
"""
This is a collection of exceptions which are raised throughout the sourcecode.
"""
#external imports
#import ...
#internal imports
#import ..
class ImageBuildException(Exception):
"""
This exception is raised any time an image fails to build and subuser is not at fault.
"""
pass
| subuser-security/subuser | subuserlib/classes/exceptions.py | Python | lgpl-3.0 | 318 |
'''
Goldwasser-Micali Public Key Encryption Scheme (Quadratic Residuosity problem)
| From: "S. Goldwasser, S. Micali: Probabilistic encryption and how to play
| mental poker keeping secret all partial information"
| Published in: 14th Symposium on Theory of Computing (1982)
| Available from: http://groups.csai... | lferr/charm | charm/schemes/pkenc/pkenc_gm82.py | Python | lgpl-3.0 | 2,619 |
# Copyright 2018 The Oppia 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 applicable ... | brianrodri/oppia | core/controllers/practice_sessions.py | Python | apache-2.0 | 3,351 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | ebagdasa/tempest | tempest/api/network/admin/test_quotas.py | Python | apache-2.0 | 3,707 |
"""Test the HomeKit config flow."""
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.homekit.const import DOMAIN
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_NAME, CONF_PORT
from tests.async_mock import patch
from tests.common... | sdague/home-assistant | tests/components/homekit/test_config_flow.py | Python | apache-2.0 | 21,181 |
import datetime
import httplib
import os
import uuid
import markupsafe
from flask import make_response
from flask import redirect
from flask import request
import furl
import jwe
import jwt
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from framework import sentry
from framework.auth imp... | zamattiac/osf.io | website/addons/base/views.py | Python | apache-2.0 | 25,393 |
class A:
def __init__(self):
self.x = 1
self.y = None
def foo(self):
a = self.y
| IllusionRom-deprecated/android_platform_tools_idea | python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py | Python | apache-2.0 | 97 |
# 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... | yajiedesign/mxnet | example/automatic-mixed-precision/amp_model_conversion.py | Python | apache-2.0 | 8,765 |
"""Tests for certbot_nginx._internal.http_01"""
import unittest
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from acme import challenges
from certbot import achallenges
from certbot.tests import acme_util
from certbot.tests import util ... | letsencrypt/letsencrypt | certbot-nginx/tests/http_01_test.py | Python | apache-2.0 | 10,269 |
# 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 ... | zzcclp/carbondata | python/pycarbon/tests/mnist/dataset_with_unischema/tests/conftest.py | Python | apache-2.0 | 1,952 |
#
# 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... | irinabov/debian-qpid-dispatch | python/qpid_dispatch_internal/router/__init__.py | Python | apache-2.0 | 1,041 |
#
# 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... | dmitriz/zipline | zipline/utils/events.py | Python | apache-2.0 | 17,605 |
import pytest
from pnc_cli import projects
from pnc_cli.swagger_client.apis.projects_api import ProjectsApi
from test import testutils
import pnc_cli.user_config as uc
@pytest.fixture(scope='function', autouse=True)
def get_projects_api():
global projects_api
projects_api = ProjectsApi(uc.user.get_api_client... | thauser/pnc-cli | test/integration/test_projects_api.py | Python | apache-2.0 | 2,376 |
# Copyright 2015. 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... | vpramo/contrail-neutron-plugin | neutron_plugin_contrail/plugins/opencontrail/vnc_client/router_res_handler.py | Python | apache-2.0 | 24,484 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# 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
#
# U... | Azure/azure-linux-extensions | VMEncryption/main/oscrypto/ubuntu_1604/Ubuntu1604EncryptionStateMachine.py | Python | apache-2.0 | 7,381 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/tensorrt/test/reshape_transpose_test.py | Python | apache-2.0 | 6,477 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Taobao 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/lic... | cloudbau/glance | glance/store/sheepdog.py | Python | apache-2.0 | 10,437 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistrib... | sippy/b2bua | sippy/UaStateGeneric.py | Python | bsd-2-clause | 1,909 |
# Django
from django.apps import AppConfig
class BhsConfig(AppConfig):
name = 'apps.bhs'
verbose_name = 'Base'
def ready(self):
import algoliasearch_django as algoliasearch
from .indexes import AwardIndex
Award = self.get_model('award')
algoliasearch.register(Award, Awar... | dbinetti/barberscore-django | project/apps/bhs/config.py | Python | bsd-2-clause | 898 |
import angr
######################################
# socket
######################################
class socket(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, domain, typ, protocol):
conc_domain = self.state.solver.eval(domain)
conc_typ = self.state.solver.eval(typ)
... | iamahuman/angr | angr/procedures/posix/socket.py | Python | bsd-2-clause | 728 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
from djangodblog.helpers import construct_checksum
for e in orm.Error.obj... | dcramer/django-db-log | djangodblog/migrations/0004_fill_error_checksums.py | Python | bsd-3-clause | 3,710 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | jniediek/mne-python | mne/viz/tests/test_evoked.py | Python | bsd-3-clause | 7,380 |
#!/usr/bin/env python
##########################################################################
#
# Copyright (c) 2019, Cinesite VFX Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | boberfly/gaffer | config/azure/publishBuild.py | Python | bsd-3-clause | 5,308 |
"""
.. module:: skrf.calibration
========================================
calibration (:mod:`skrf.calibration`)
========================================
This Package provides functionality for performing and testing
calibration algorithms. Most functionality is in the :mod:`calibration`
module.
.. automodule:: skrf... | scikit-rf/scikit-rf | skrf/calibration/__init__.py | Python | bsd-3-clause | 552 |
from __future__ import print_function
import numpy as np
import pandas as pd
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.glyphs import Circle, Line
from bokeh.objects import (
ColumnDataSource, Glyph, Grid, GridPlot, LinearAxis, Plot, Range1d
... | the13fools/Bokeh_Examples | glyphs/anscombe.py | Python | bsd-3-clause | 3,251 |
def omp_parallel_sections_reduction():
import math
dt = 0.5
rounding_error = 1.E-9
sum = 7
dsum = 0
dt = 1. / 3.
result = True
product = 1
logic_and = 1
logic_or = 0
bit_and = 1
bit_or = 0
i = 0
exclusiv_bit_or = 0
known_sum = (1000 * 999) / 2 + 7
if 'o... | hainm/pythran | pythran/tests/openmp.legacy/omp_parallel_sections_reduction.py | Python | bsd-3-clause | 8,373 |
'''
'''
from __future__ import absolute_import
from ...exceptions import ProtocolError
index = {}
def register(cls):
''' Decorator to add a Message (and its revision) to the Protocol index.
'''
key = (cls.msgtype, cls.revision)
if key in index:
raise ProtocolError("Duplicate message specifi... | htygithub/bokeh | bokeh/server/protocol/messages/__init__.py | Python | bsd-3-clause | 643 |
#!/usr/bin/env python
# Copyright 2021 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.
# This is generated, do not edit. Update BuildConfigGenerator.groovy and
# 3ppFetch.template instead.
from __future__ import print_fun... | nwjs/chromium.src | third_party/android_deps/libs/com_google_android_material_material/3pp/fetch.py | Python | bsd-3-clause | 1,395 |
from werkzeug.exceptions import NotFound
from werkzeug.utils import redirect
from .models import URL
from .utils import expose
from .utils import Pagination
from .utils import render_template
from .utils import url_for
from .utils import validate_url
@expose("/")
def new(request):
error = url = ""
if request... | mitsuhiko/werkzeug | examples/couchy/views.py | Python | bsd-3-clause | 2,120 |
import json
import os
from os.path import join as pjoin
import unittest
from IPython.testing.decorators import onlyif
from IPython.utils.tempdir import TemporaryDirectory
from IPython.kernel import kernelspec
sample_kernel_json = {'argv':['cat', '{connection_file}'],
'display_name':'Test kernel'... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/kernel/tests/test_kernelspec.py | Python | mit | 2,717 |
import os
from gzip import GzipFile
import django
import nibabel as nb
import neurovault.apps.statmaps.utils as nvutils
from neurovault.apps.statmaps.models import StatisticMap, BaseStatisticMap
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "neurovault.settings")
django.setup()
for image in StatisticMap.objects.f... | chrisfilo/NeuroVault | scripts/detect_parcellations_and_rois.py | Python | mit | 804 |
from django.apps import AppConfig
class AlarmConfig(AppConfig):
name = 'alarm'
| pythonvietnam/nms | apps/alarm/apps.py | Python | mit | 85 |
import os, sys
from http.server import HTTPServer, CGIHTTPRequestHandler
webdir = '.'
port = 80
os.chdir(webdir)
server_address = ("", port)
server_object = HTTPServer(server_address, CGIHTTPRequestHandler)
server_object.serve_forever()
| ordinary-developer/lin_education | books/techno/python/programming_python_4_ed_m_lutz/code/chapter_1/step_6/02_a_web-based_shell_interface/webserver.py | Python | mit | 240 |
"""Modifies a password for a volume's access"""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command()
@click.argument('access_id')
@click.option('--password', '-p', multiple=False,
help='Password you want to set, this command... | softlayer/softlayer-python | SoftLayer/CLI/block/access/password.py | Python | mit | 849 |
"""Example for exporting ResNet50 model to ONNX graph.
$ pwd
/path/to/onnx-chainer
$ python examples/resnet50/export.py -I target.jpg -O onnx_model
'model.onnx' will be output under 'onnx_model' directory.
"""
import argparse
import os
import chainer.cuda
import chainercv.links as C
from chainercv.transforms i... | pfnet/chainer | onnx_chainer/examples/resnet50/export.py | Python | mit | 2,402 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from thumbor.filters import BaseFilter, filter_method
from thumbor.u... | kkopachev/thumbor | thumbor/filters/format.py | Python | mit | 823 |
# -*- coding: latin-1 -*-
#retriever
"""Retriever script for direct download of vertnet-amphibians data"""
import os
from builtins import str
from pkg_resources import parse_version
from retriever.lib.models import Table
from retriever.lib.templates import Script
try:
from retriever.lib.defaults import VERSION
... | henrykironde/deletedret | scripts/vertnet_amphibians.py | Python | mit | 10,575 |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#if __name__ == "__main__":
# print "Hello World"
from ProgrammingOutlook import AddMapiJournalToPST
import jpype
import os.path
asposeapis... | kashifiqb/Aspose.Email-for-Java | Plugins/Aspose.Email Java for Python/tests/ProgrammingOutlook/AddMapiJournalToPST/AddMapiJournalToPST.py | Python | mit | 672 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer.functions import vae
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestGaussianKLDivergence(unittest.Te... | woodshop/chainer | tests/functions_tests/test_vae.py | Python | mit | 3,930 |
from __future__ import unicode_literals
from frappe import _
from frappe.desk.moduleview import add_setup_section
def get_data():
data = [
{
"label": _("Users"),
"icon": "icon-group",
"items": [
{
"type": "doctype",
"name": "User",
"description": _("System and Website Users")
},
... | sbktechnology/trufil-frappe | frappe/config/setup.py | Python | mit | 5,480 |
import baseclass
import unittest
import storage.devicelibs.lvm as lvm
class LVMTestCase(baseclass.DevicelibsTestCase):
def testLVM(self):
##
## pvcreate
##
# pass
for dev, file in self._LOOP_DEVICES:
self.assertEqual(lvm.pvcreate(dev), None)
# fail
... | Rogentos/argent-anaconda | tests/storage/devicelibs/lvm.py | Python | gpl-2.0 | 6,895 |
#!/usr/bin/env python
from math import sqrt
import argparse
from marsyas import *
from os import path, mkdir, makedirs
majTriad = [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]
augTriad = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]
minTriad = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0]
dimTriad = [1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0]
noChord... | eriser/marsyas | scripts/chord-detection/scripts/AccumulateChroma.py | Python | gpl-2.0 | 3,906 |
"""
Perform gitosis actions for a git hook.
"""
from ConfigParser import NoOptionError, NoSectionError
import errno
import logging
import os
import sys
import shutil
from gitosis import repository
from gitosis import ssh
from gitosis import gitweb
from gitosis import gitdaemon
from gitosis import app
from gitosis imp... | brn0/gitosis | gitosis/run_hook.py | Python | gpl-2.0 | 2,455 |
import pytest
from cfme.exceptions import ItemNotFound
from cfme.infrastructure.provider.openstack_infra import OpenstackInfraProvider
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.wait import wait_for
pytestmark = [
pytest.mark.usefixtures("setup_provider_modscope"),
pytest... | Yadnyawalkya/integration_tests | cfme/tests/openstack/infrastructure/test_host_lifecycle.py | Python | gpl-2.0 | 7,824 |
from django.db import models
from django.contrib.auth.models import User
class AutoSetField(object):
pass
class AutoUserField(models.ForeignKey, AutoSetField):
def __init__(self, **kws):
if 'to' in kws:
# Fixes south. We always want this to point to the User
# model.
... | evangeline97/localwiki-backend-server | localwiki/versionutils/versioning/fields.py | Python | gpl-2.0 | 645 |
# Copyright 2010 Google Inc.
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011, Eucalyptus Systems, Inc.
#
# 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 re... | nanocell/lsync | python/boto/auth.py | Python | gpl-3.0 | 24,702 |
import unittest
import os
import logging
import overpy
from mock import patch
from osm2gtfs.tests.creators.creators_tests import CreatorsTestsAbstract
from osm2gtfs.core.osm_connector import OsmConnector
from osm2gtfs.core.cache import Cache
# Define logging level
logging.basicConfig(level=os.environ.get("LOGLEVEL", ... | nlehuby/osm2gtfs | osm2gtfs/tests/creators/tests_br_florianopolis.py | Python | gpl-3.0 | 2,872 |
"""Defines ``Group`` and ``UserPartition`` models for partitioning"""
from collections import namedtuple
from stevedore.extension import ExtensionManager
# We use ``id`` in this file as the IDs of our Groups and UserPartitions,
# which Pylint disapproves of.
# pylint: disable=redefined-builtin
# UserPartition IDs... | msegado/edx-platform | common/lib/xmodule/xmodule/partitions/partitions.py | Python | agpl-3.0 | 10,492 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher
# Copyright 2013 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
# pub... | acsone/account-invoicing | account_invoice_rounding/__init__.py | Python | agpl-3.0 | 1,027 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | astagi/taiga-back | taiga/projects/api.py | Python | agpl-3.0 | 20,069 |