code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import ssl
from pyOpenSSL import SSL
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
SSL.Context(method=SSL.SSLv2_METHOD)
SSL.Context(method=SSL.SSLv23_METHOD)
herp_derp(ssl_version=ssl.PROTOCOL_SSLv2)
herp_derp(method=SSL.SSLv2_METHOD)
herp_derp(method=SSL.SSLv23_METHOD)
# strict tests
ssl.wrap_socket(ssl_version=s... | chair6/bandit | examples/ssl-insecure-version.py | Python | apache-2.0 | 892 |
# Copyright (c) 2003-2013 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id$
#
# Description:
# EAP packets
#
# Author:
# Aureliano Calvo
from impacket.helper import Pro... | hecchi777/S3-SlaacSecuritySolution | impacket-0.9.11/impacket/eap.py | Python | apache-2.0 | 1,437 |
# Copyright (c) 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... | projectcalico/calico-neutron | neutron/db/l3_agentschedulers_db.py | Python | apache-2.0 | 22,584 |
def check_resource_count(expected_count):
test.assertEqual(expected_count, len(reality.all_resources()))
example_template = Template({
'A': RsrcDef({}, []),
'B': RsrcDef({'a': '4alpha'}, ['A']),
'C': RsrcDef({'a': 'foo'}, ['B']),
'D': RsrcDef({'a': 'bar'}, ['C']),
})
engine.create_stack('foo', exam... | zaneb/heat-convergence-prototype | scenarios/update_interrupt_create.py | Python | apache-2.0 | 673 |
# 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... | helifu/kudu | examples/python/basic-python-example/basic_example.py | Python | apache-2.0 | 2,977 |
from Node import error
SYNTAX_NODE_SERIALIZATION_CODES = {
# 0 is 'Token'. Needs to be defined manually
# 1 is 'Unknown'. Needs to be defined manually
'UnknownDecl': 2,
'TypealiasDecl': 3,
'AssociatedtypeDecl': 4,
'IfConfigDecl': 5,
'PoundErrorDecl': 6,
'PoundWarningDecl': 7,
'Poun... | amraboelela/swift | utils/gyb_syntax_support/NodeSerializationCodes.py | Python | apache-2.0 | 7,221 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2019 The Apollo 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... | xiaoxq/apollo | modules/tools/restore_video_record/restore_video_record.py | Python | apache-2.0 | 9,788 |
'''
Datastore via remote webdav connection
'''
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
import os
import tarfile
import logging
from fs.contrib.davfs import DAVFS
from urllib.parse import urlparse
from contextlib import closing
from sumatra.core im... | open-research/sumatra | sumatra/datastore/davfs.py | Python | bsd-2-clause | 3,593 |
class DSF_SIC_Map(object):
"""docstring for SIC_Map"""
def __init__(self, dsffile = 'crsp/dsf.csv', sicfile = 'sic_codes.txt'):
self.dsf = pd.read_csv("dsf.csv", dtype = {'CUSIP': np.str, 'PRC': np.float}, na_values = {'PRC': '-'})
self.sic = pd.read_table(sicfile, header = 1)
self.sic.c... | dlab-projects/python-taq | marketflow/dsf_with_sic.py | Python | bsd-2-clause | 887 |
from bravado_core.spec import Spec
import mock
from pyramid.config import Configurator
from pyramid.registry import Registry
import pytest
from swagger_spec_validator.common import SwaggerValidationError
import pyramid_swagger
from pyramid_swagger.model import SwaggerSchema
@mock.patch('pyramid_swagger.register_api_... | analogue/pyramid_swagger | tests/includeme_test.py | Python | bsd-3-clause | 3,308 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hhlregistrations', '0004_auto_20150411_1935'),
]
operations = [
migrations.AddField(
model_name='event',
... | hacklab-fi/hhlevents | hhlevents/apps/hhlregistrations/migrations/0005_auto_20150412_1806.py | Python | bsd-3-clause | 592 |
# Copyright 2015 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.
from tracing.mre import job as job_module
class Failure(object):
def __init__(self, job, function_handle_string, trace_canonical_url,
fai... | catapult-project/catapult | tracing/tracing/mre/failure.py | Python | bsd-3-clause | 1,876 |
from django import forms
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.contenttypes.admin import GenericStackedInline
from django.contrib.messages.m... | wkschwartz/django | tests/admin_checks/tests.py | Python | bsd-3-clause | 32,171 |
##########################################################################
#
# 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 ... | lucienfostier/gaffer | python/GafferOSLUI/OSLImageUI.py | Python | bsd-3-clause | 9,411 |
import django.db.models.deletion
import oauthlib.common
from django.db import migrations, models
def move_existing_token(apps, schema_editor):
ServiceAccount = apps.get_model("account", "ServiceAccount")
for service_account in ServiceAccount.objects.iterator():
service_account.tokens.create(
... | maferelo/saleor | saleor/account/migrations/0034_service_account_token.py | Python | bsd-3-clause | 1,717 |
import six
from django import template
from oscar.core.loading import get_model
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import resolve, Resolver404
from oscar.apps.customer import history
from oscar.core.compat import urlparse
Site = get_model('sites', 'Site')
register =... | MrReN/django-oscar | oscar/templatetags/history_tags.py | Python | bsd-3-clause | 1,884 |
# Copyright 2019 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.
import sys
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=no... | endlessm/chromium-browser | third_party/depot_tools/fetch_configs/devtools-frontend.py | Python | bsd-3-clause | 1,092 |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: True if this Binary tree is Balanced, or false.
"""
def isBalanced(self, root):
# ... | Chasego/codirit | jiuzhang/Nine Chapters/3 Binary Tree & Divide Conquer/py/BalancedBinaryTree_rec.py | Python | mit | 873 |
# -*- coding: utf-8 -*-
# -- ==alkane_monolayer== --
import mbuild as mb
from mbuild.lib.surfaces import Betacristobalite
from mbuild.lib.atoms import H
from mbuild.examples.alkane_monolayer.alkylsilane import AlkylSilane
class AlkaneMonolayer(mb.Monolayer):
"""An akylsilane monolayer on beta-cristobalite. """... | ctk3b/mbuild | mbuild/examples/alkane_monolayer/alkane_monolayer.py | Python | mit | 1,378 |
from app import celery
from flask import current_app as app
from datetime import timedelta
from celery.decorators import periodic_task
from flask import jsonify, request, abort
import requests
import json
@periodic_task(run_every=(timedelta(seconds=1)))
def ping():
print "ping!"
headers = {'content-type': 'app... | darksigma/traceless | slave/app/async/routes.py | Python | mit | 537 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^$', 'whatify.views.index'),
url(r'^search/(.+)$', 'whatify.views.search'),
url(r'^torrent_groups/(\d+)$', 'whatify.views.get_torrent_group'),
url(r'^torrent_groups/(\d+)/download$', 'whatify.views.download_torrent_group')... | grandmasterchef/WhatManager2 | whatify/urls.py | Python | mit | 531 |
import asposebarcodecloud
from asposebarcodecloud.BarcodeApi import BarcodeApi
from asposebarcodecloud.BarcodeApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
import ConfigParser
config = Config... | farooqsheikhpk/Aspose.BarCode-for-Cloud | Examples/Python/generating-saving/cloud-storage/set-barcode-image-height-width-quality-settings.py | Python | mit | 2,140 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module defines Entry classes for containing experimental data.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Pi... | mbkumar/pymatgen | pymatgen/entries/exp_entries.py | Python | mit | 2,923 |
#!/usr/bin/env python3
# Copyright (C) 2010-2011 Marcin Kościelnicki <koriakin@0x04.net>
# Copyright (C) 2010 Luca Barbieri <luca@luca-barbieri.com>
# Copyright (C) 2010 Marcin Slusarz <marcin.slusarz@gmail.com>
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy o... | hakzsam/envytools | rnn/headergen.py | Python | mit | 7,156 |
id_mappings = {
"EX1_097": "Abomination",
"CS2_188": "Abusive Sergeant",
"EX1_007": "Acolyte of Pain",
"NEW1_010": "Al'Akir the Windlord",
"EX1_006": "Alarm-o-Bot",
"EX1_382": "Aldor Peacekeeper",
"EX1_561": "Alexstrasza",
"EX1_393": "Amani Berserker",
"CS2_038": "Ancestral Spirit",
... | slaymaker1907/hearthbreaker | tests/card_tests/id_mapping.py | Python | mit | 23,324 |
# -*- coding: utf-8 -*-
## $Id: webmessage_templates.py,v 1.32 2008/03/26 23:26:23 tibor Exp $
##
## handles rendering of webmessage module
##
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU G... | MSusik/invenio | invenio/legacy/bibexport/templates.py | Python | gpl-2.0 | 29,937 |
from autotest.client.shared import error
from virttest import qemu_monitor
def run(test, params, env):
"""
QMP Specification test-suite: this checks if the *basic* protocol conforms
to its specification, which is file QMP/qmp-spec.txt in QEMU's source tree.
IMPORTANT NOTES:
o Most tests depe... | uni-peter-zheng/tp-qemu | qemu/tests/qmp_basic.py | Python | gpl-2.0 | 14,858 |
'''OpenGL extension NV.transform_feedback
This module customises the behaviour of the
OpenGL.raw.GL.NV.transform_feedback to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a new mode to the GL, called transform feedback,
which records vertex attributes of the primitives proc... | D4wN/brickv | src/build_data/windows/OpenGL/GL/NV/transform_feedback.py | Python | gpl-2.0 | 2,570 |
#!/usr/bin/env python
print(CurrentScript().arguments)
| dthain/cctools | weaver/src/examples/arguments.py | Python | gpl-2.0 | 56 |
from __future__ import absolute_import
class DummyException(Exception):
pass
def import_global(
name, modules=None, exceptions=DummyException, locals_=None,
globals_=None, level=-1):
'''Import the requested items into the global scope
WARNING! this method _will_ overwrite your global s... | samowitsch/bCNC | bCNC/lib/python_utils/import_.py | Python | gpl-2.0 | 2,797 |
# -*- coding: iso-8859-1 -*-
""" crypto.cipher.rijndael
Rijndael encryption algorithm
This byte oriented implementation is intended to closely
match FIPS specification for readability. It is not implemented
for performance.
Copyright © (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license... | felipenaselva/felipe.repository | script.module.cryptopy/lib/crypto/cipher/rijndael.py | Python | gpl-2.0 | 14,723 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.trial.distreporter}.
"""
from cStringIO import StringIO
from twisted.trial._dist.distreporter import DistReporter
from twisted.trial.unittest import TestCase
from twisted.trial.reporter import TreeReporter
class DistRe... | geodrinx/gearthview | ext-libs/twisted/trial/_dist/test/test_distreporter.py | Python | gpl-3.0 | 2,019 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
# (c) 2019, René Moser <mail@renemoser.net>
# 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__ = ... | aperigault/ansible | lib/ansible/modules/cloud/vultr/vultr_ssh_key_info.py | Python | gpl-3.0 | 3,294 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2014 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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 Li... | sigrokproject/libsigrokdecode | decoders/eeprom24xx/lists.py | Python | gpl-3.0 | 5,965 |
#!/usr/bin/env /usr/bin/python
#
# Copyright 2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your o... | mrjacobagilbert/gnuradio | gr-dtv/python/dtv/atsc_rx_filter.py | Python | gpl-3.0 | 2,537 |
##
## This file is part of the libsigrok project.
##
## Copyright (C) 2014 Martin Ling <martin-sigrok@earth.li>
##
## 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 Lice... | mtitinger/libsigrok | bindings/swig/doc.py | Python | gpl-3.0 | 4,655 |
# -*- coding: utf-8 -*-
from datetime import date, datetime, timedelta
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
class MaintenanceStage(models.Model):
""" Model for case stages. Th... | richard-willowit/odoo | addons/maintenance/models/maintenance.py | Python | gpl-3.0 | 20,858 |
# 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/.
from __future__ import absolute_import
try:
from setuptools import setup
except ImportError:
from distutils.core... | CYBAI/servo | python/mach/setup.py | Python | mpl-2.0 | 1,204 |
"""add timezone to each station
Revision ID: 4d0be367f095
Revises: 6722b0ef4e1
Create Date: 2014-03-19 16:43:00.326820
"""
# revision identifiers, used by Alembic.
revision = '4d0be367f095'
down_revision = '6722b0ef4e1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | rootio/rootio_web | alembic/versions/4d0be367f095_station_timezone.py | Python | agpl-3.0 | 644 |
# -*- coding: utf-8 -*-
from . import models
from .hooks import set_default_map_settings
| brain-tec/partner-contact | partner_external_map/__init__.py | Python | agpl-3.0 | 90 |
# -*- 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... | Antiun/carrier-delivery | delivery_carrier_label_postlogistics/delivery.py | Python | agpl-3.0 | 10,691 |
# -*- 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... | jmesteve/saas3 | openerp/addons/account/wizard/account_report_account_balance.py | Python | agpl-3.0 | 1,729 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Jordi Esteve <jesteve@zikzakmedia.com>
# $Id$
#
# Th... | jmesteve/saas3 | openerp/addons_extra/l10n_es_fiscal_year_closing/wizard/__init__.py | Python | agpl-3.0 | 1,141 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Cut-off Base module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can re... | AlceConsorcio/account-closing | account_cutoff_base/__openerp__.py | Python | agpl-3.0 | 2,130 |
#!/usr/bin/env python
import os, sys
usage = "usage: %s [infile [outfile]]" % os.path.basename(sys.argv[0])
if len(sys.argv) < 1:
print (usage)
else:
stext = "<insert_a_suppression_name_here>"
rtext = "memcheck problem #"
input = sys.stdin
output = sys.stdout
hit = 0
if len(sys.argv) > 1:
... | lubosz/gst-plugins-vr | valgrind_helpers/valgrind-make-fix-list.py | Python | lgpl-2.1 | 628 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the :class:`iris.coord_systems.VerticalPerspective` class."""
# Import iris.tests first so that some things ... | SciTools/iris | lib/iris/tests/unit/coord_systems/test_VerticalPerspective.py | Python | lgpl-3.0 | 3,251 |
# encoding: utf-8
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
class ObjCDataFormatterNS... | llvm-mirror/lldb | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py | Python | apache-2.0 | 1,050 |
# Copyright (c) 2015 FUJITSU LIMITED
#
# 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... | Akrog/cinder | cinder/tests/test_fujitsu_compatibility.py | Python | apache-2.0 | 2,530 |
# Copyright 2013 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 agree... | tweksteen/compute-image-packages | gcimagebundle/gcimagebundlelib/utils.py | Python | apache-2.0 | 13,831 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
'''
Usage:
advogato.py <name> <diary entry file>
'''
from twisted.web.xmlrpc import Proxy
from twisted.internet import reactor
from getpass import getpass
import sys
class AddDiary:
def __init__(self, name, password):
... | jxta/cc | vendor/Twisted-10.0.0/doc/web/examples/advogato.py | Python | apache-2.0 | 1,110 |
from openflow.optin_manager.sfa.rspecs.elements.element import Element
class PLTag(Element):
fields = [
'tagname',
'value',
]
| dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/rspecs/elements/pltag.py | Python | apache-2.0 | 161 |
#!/usr/bin/python
#
# 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 b... | wubr2000/googleads-python-lib | examples/dfa/v1_20/create_campaign.py | Python | apache-2.0 | 2,699 |
# Copyright (c) 2014 VMware, 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 writi... | sajuptpm/neutron-ipam | neutron/tests/unit/vmware/nsxlib/test_switch.py | Python | apache-2.0 | 14,400 |
#!/usr/bin/python
#
# Copyright 2015 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 b... | wubr2000/googleads-python-lib | examples/dfp/v201505/audience_segment_service/get_first_party_audience_segments.py | Python | apache-2.0 | 2,062 |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | mmasaki/trove | trove/tests/unittests/guestagent/test_pkg.py | Python | apache-2.0 | 21,209 |
# -*- coding: utf-8 -*-
"""
sphinx.environment.managers.indexentries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index entries manager for sphinx.environment.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import bisect
import un... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/environment/managers/indexentries.py | Python | apache-2.0 | 7,329 |
# 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... | neilhan/tensorflow | tensorflow/contrib/losses/python/losses/loss_ops_test.py | Python | apache-2.0 | 48,390 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2021-11-10 19:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0238_abstractprovider_allow_updates'),
]
operations = [
migrations.... | Johnetordoff/osf.io | osf/migrations/0239_auto_20211110_1921.py | Python | apache-2.0 | 497 |
# 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 under th... | bigswitch/horizon | openstack_dashboard/dashboards/project/stacks/forms.py | Python | apache-2.0 | 18,998 |
"""
Statistics for astronomy
"""
import numpy as np
from scipy.stats.distributions import rv_continuous
def bivariate_normal(mu=[0, 0], sigma_1=1, sigma_2=1, alpha=0,
size=None, return_cov=False):
"""Sample points from a 2D normal distribution
Parameters
----------
mu : array-lik... | nhuntwalker/astroML | astroML/stats/random.py | Python | bsd-2-clause | 3,890 |
import copy
import datetime
import decimal
import math
import warnings
from itertools import tee
from django.db import connection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
from django import forms
from django.core import exceptions, validators
from django.utils.datastructur... | klnprj/testapp | django/db/models/fields/__init__.py | Python | bsd-3-clause | 47,219 |
from __future__ import print_function
import numpy as nm
try:
import matplotlib.pyplot as plt
import matplotlib as mpl
except (ImportError, RuntimeError):
plt = mpl = None
#print 'matplotlib import failed!'
from sfepy.base.base import output, pause
def spy(mtx, eps=None, color='b', **kwargs):
"""... | vlukes/sfepy | sfepy/base/plotutils.py | Python | bsd-3-clause | 4,706 |
"""
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | cdegroc/scikit-learn | examples/decomposition/plot_sparse_coding.py | Python | bsd-3-clause | 3,808 |
# -*- coding: utf-8 -*-
"""
CSS Testing
:copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from os.path import join
from cssutils import CSSParser
import unittest
import trytond.tests.test_tryton
dir = 'static/css/'
class CSSTest(unit... | gautampanday/nereid-webshop | tests/test_css.py | Python | bsd-3-clause | 1,062 |
# Copyright (c) 2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Vendor core functionality used from xarray.
This code has been reproduced with modification under the terms of the Apache License, Version
2.0 (notice included below).
Copyr... | ahaberlie/MetPy | src/metpy/_vendor/xarray.py | Python | bsd-3-clause | 2,816 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ImageAttachment'
db.create_table('upload_imageattachment', (
('id', self.gf('dja... | safwanrahman/linuxdesh | kitsune/upload/migrations/0001_initial.py | Python | bsd-3-clause | 4,996 |
# Copyright (c) 2013 David Holm <dholmster@gmail.com>
# This file is part of SimpleGUITk - https://github.com/dholm/simpleguitk
# See the file 'COPYING' for copying permission.
from .plot import plot_lines
| dholm/simpleguitk | simpleplot/__init___flymake.py | Python | bsd-3-clause | 207 |
"""This file contains code for use with "Think Stats" and
"Think Bayes", both by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
"""This file contains class definitions for:
H... | AllenDowney/MarriageNSFG | thinkstats2.py | Python | mit | 75,264 |
#!/usr/bin/env python
# *-* coding: UTF-8 *-*
"""Problema unic."""
from __future__ import print_function
def gaseste_unic(istoric):
"""unic"""
result = istoric.pop()
for numar in istoric:
result = result ^ numar
return result
if __name__ == "__main__":
assert gaseste_unic([1, 2, 3, 2, 1... | alexandrucoman/labs | python/solutii/monica_vizitiu/unic/unic.py | Python | mit | 374 |
# Author: Fred L. Drake, Jr.
# fdrake@acm.org
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-desc... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/pprint.py | Python | mit | 11,932 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
# See LICENSE for details.
from .openssl import OpenSSL
# For python3
def _equals_bytes(a, b):
if len(a) != len(b):
return False
result = 0
for x, y in zip(a, b):
result |= x ^ y
r... | cpacia/Subspace | subspace/pyelliptic/hash.py | Python | mit | 1,739 |
from __future__ import absolute_import
import nsq
import unittest
class WriterUnitTest(unittest.TestCase):
def setUp(self):
super(WriterUnitTest, self).setUp()
def test_constructor(self):
name = 'test'
reconnect_interval = 10.0
writer = nsq.Writer(nsqd_tcp_addresses=['127.0.... | goller/pynsq | tests/test_writer.py | Python | mit | 892 |
"""Plugin for filesystem tasks."""
from __future__ import unicode_literals, division, absolute_import
import os
import logging
from path import Path
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.config_schema import one_or_more
log = logging.getLogger('listdi... | ratoaq2/Flexget | flexget/plugins/input/listdir.py | Python | mit | 1,908 |
#!/usr/bin/python
import participantCollection
participantCollection = participantCollection.ParticipantCollection()
numberStillIn = participantCollection.sizeOfParticipantsWhoAreStillIn()
initialNumber = participantCollection.size()
print "There are currently **" + str(numberStillIn) + " out of " + str(initialNumber... | foobarbazblarg/stayclean | stayclean-2015-january/display-on-last-day-before-participants-must-check-in.py | Python | mit | 1,018 |
# unit tests for Mini-project 7 (The Fifteen Puzzle), by k., 08/02/2014
import unittest
from mini_project7 import Puzzle
class TestFunctions(unittest.TestCase):
def setUp(self):
pass
def test_lower_row_invariant(self):
state = Puzzle(4, 4, [[4, 2, 3, 7], [8, 5, 6, 10], [9, 1, 0, 11], [12, 13,... | lifeloverxg/principles-of-computing-2 | test_mini_project7.py | Python | mit | 11,001 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
rgb2pct.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************************... | drnextgis/QGIS | python/plugins/processing/algs/gdal/rgb2pct.py | Python | gpl-2.0 | 2,969 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio 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... | inveniosoftware/invenio-upgrader | invenio_upgrader/upgrades/__init__.py | Python | gpl-2.0 | 812 |
# emacs: -*- mode: python; coding: utf-8; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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... | jakesyl/fail2ban | fail2ban/server/datetemplate.py | Python | gpl-2.0 | 7,428 |
###############################################################################
#cyn.in is an open source Collaborative Knowledge Management Appliance that
#enables teams to seamlessly work together on files, documents and content in
#a secure central environment.
#
#cyn.in v2 an open source appliance is distributed un... | collective/cyn.in | src/ubify.viewlets/ubify/viewlets/browser/spaceicon.py | Python | gpl-3.0 | 3,414 |
"""A module that is accepted by Python but rejected by tokenize.
The problem is the trailing line continuation at the end of the line,
which produces a TokenError."""
""\
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pylint/test/input/func_tokenize_error.py | Python | agpl-3.0 | 173 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Gengo Translator',
'category': 'Website/Website',
'summary': 'Translate website in one-click',
'description': """
This module allows to send website content to Gengo translation service in a si... | ddico/odoo | addons/website_gengo/__manifest__.py | Python | agpl-3.0 | 544 |
"""
Serializers and ModelSerializers are similar to Forms and ModelForms.
Unlike forms, they are not constrained to dealing with HTML output, and
form encoded input.
Serialization in REST framework is a two-phase process:
1. Serializers marshal between complex types like model instances, and
python primitives.
2. The... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rest_framework/serializers.py | Python | agpl-3.0 | 41,575 |
from sympy import (symbols, product, factorial, rf, sqrt, cos,
Function, Product, Rational)
a, k, n = symbols('a,k,n', integer=True)
def test_simple_products():
assert product(2, (k, a, n)) == 2**(n-a+1)
assert product(k, (k, 1, n)) == factorial(n)
assert product(k**3, (k, 1, n)) == fac... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/concrete/tests/test_products.py | Python | agpl-3.0 | 1,362 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/util-macros/package.py | Python | lgpl-2.1 | 1,752 |
"""Fixer that changes raw_input(...) into input(...)."""
# Author: Andre Roberge
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixRawInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< name='raw_input' trailer< '(' [any] ')' > any* >
... | Orav/kbengine | kbe/src/lib/python/Lib/lib2to3/fixes/fix_raw_input.py | Python | lgpl-3.0 | 471 |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""Python 2<->3 compatibility module"""
import sys
def print_(template, *args, **kwargs):
template = str(template)
if args:
template ... | grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/compat.py | Python | apache-2.0 | 961 |
# Copyright 2016 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 or agreed to in writing, ... | jgeewax/gcloud-python | runtimeconfig/google/cloud/runtimeconfig/_helpers.py | Python | apache-2.0 | 2,925 |
# 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... | chemelnucfin/tensorflow | tensorflow/python/keras/metrics_confusion_matrix_test.py | Python | apache-2.0 | 51,243 |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTag
# Retrieves a specified tag object.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... | jordanemedlock/psychtruths | temboo/core/Library/GitHub/GitDataAPI/Tags/GetTag.py | Python | apache-2.0 | 4,161 |
#!/usr/bin/env python
# update-dependencies-bad.py - Fails on bad.swift -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LI... | gottesmm/swift | test/Driver/Dependencies/Inputs/update-dependencies-bad.py | Python | apache-2.0 | 1,560 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Badges
# Returns badges for a given user.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | jordanemedlock/psychtruths | temboo/core/Library/Foursquare/Users/Badges.py | Python | apache-2.0 | 3,462 |
import six
import sys
from optparse import make_option, NO_DEFAULT
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django_extensions.management.modelviz import generate_dot
try:
import pygraphviz
HAS_PYGRAPHVIZ = True
except ImportError:
HAS_PYGRAPHV... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/django_extensions/management/commands/graph_models.py | Python | bsd-3-clause | 7,278 |
import json
from tempfile import mkdtemp
from os.path import join, basename
from shutil import rmtree
from distutils.dir_util import copy_tree
from twisted.trial import unittest
from twisted.internet.defer import inlineCallbacks
from slyd.projectspec import create_project_resource
from slyd.projectspec import convert_t... | CENDARI/portia | slyd/tests/test_spec.py | Python | bsd-3-clause | 3,884 |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 24 15:08:01 2013
@author: steve
"""
import numpy as np
import mdptoolbox
from .utils import SMALLNUM, P_forest, R_forest, P_small, R_small, P_sparse
from .utils import P_forest_sparse, R_forest_sparse
def test_ValueIterationGS_small():
sdp = mdptoolbox.mdp.ValueIt... | silgon/pymdptoolbox | src/tests/test_ValueIterationGS.py | Python | bsd-3-clause | 1,658 |
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
try:
import cPickle as pickle
except ImportError:
import pickle
# Handle the case where the requests module has been patched to not have
# urllib3 bundled as part of its source.
try:
from pip._v... | ncos/lisa | src/lisa_drive/scripts/venv/lib/python3.5/site-packages/pip-10.0.1-py3.5.egg/pip/_vendor/cachecontrol/compat.py | Python | mit | 724 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from qsrlib_qsrs.qsr_rcc_abstractclass import QSR_RCC_Abstractclass
class QSR_RCC8(QSR_RCC_Abstractclass):
"""Symmetrical RCC5 relations.
Values of the abstract properties
* **_unique_id** = "rcc8"
* **_all_possible_relat... | cdondrup/strands_qsr_lib | qsr_lib/src/qsrlib_qsrs/qsr_rcc8.py | Python | mit | 1,237 |
#! /usr/bin/python
# Script for increasing versions numbers across the code
import sys
import glob
import re
import argparse
def check_version_format(version):
"""Check format of version number"""
pattern = '^[0-9]+[\.][0-9]+[\.][0-9]+(\-.+)*$'
return re.match(pattern, version) is not None
BIO_FORMATS_... | stelfrich/bioformats | tools/bump_maven_version.py | Python | gpl-2.0 | 3,006 |
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This 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) any late... | mensler/ansible | lib/ansible/modules/system/puppet.py | Python | gpl-3.0 | 9,396 |
# coding=utf-8
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Item",
"_doctype": "Item",
"color": "#f39c12",
"icon": "octicon octicon-package",
"type": "link",
"link": "List/Item"
},
{
"module_name": "Customer",
"_doctype": "Custo... | ovresko/erpnext | erpnext/config/desktop.py | Python | gpl-3.0 | 12,428 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# 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 ... | kartoza/geonode | geonode/notifications_helper.py | Python | gpl-3.0 | 3,847 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.