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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
users = [
{
'username': "faris",
'email': "faris@theluckybead.com"
},
{
'username': "Pilot Andy",
'email': "report_to_faa@faa.... | chriskennard/lucky_flask | apps/02_mayo/app.py | Python | mit | 658 |
#!/usr/bin/env python
# Copyright (c) 2002-2005 ActiveState Corp.
# See LICENSE.txt for license details.
# Author:
# Trent Mick (TrentM@ActiveState.com)
# Home:
# http://trentm.com/projects/px/
"""Ensure that we cannot get p4 to hang."""
import os
import sys
import unittest
import types
import pprint
import test... | trentm/python-p4lib | test/test_hang.py | Python | mit | 2,756 |
# Extension of pip-accel that deals with dependencies on system packages.
#
# Author: Peter Odding <peter.odding@paylogic.com>
# Last Change: October 31, 2015
# URL: https://github.com/paylogic/pip-accel
"""
System package dependency handling.
The :mod:`pip_accel.deps` module is an extension of pip-accel that deals
w... | pombredanne/pip-accel | pip_accel/deps/__init__.py | Python | mit | 12,082 |
"""Base classes for formatters.
"""
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class Formatter(object):
@abc.abstractmethod
def add_argument_group(self, parser):
"""Add any options to the argument parser.
Should use our own argument group.
"""
@six.add_metaclass(abc.AB... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/cliff/formatters/base.py | Python | mit | 1,507 |
####################################
# Driftwood 2D Game Dev. Suite #
# areamanager.py #
# Copyright 2014-2017 #
# Michael D. Reiley & Paul Merrill #
####################################
# **********
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of ... | Driftwood2D/Driftwood | src/areamanager.py | Python | mit | 15,769 |
from datetime import date
from ..core import WesternCalendar
from ..registry_tools import iso_register
@iso_register('HR')
class Croatia(WesternCalendar):
'Croatia'
FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
(6, 22, "Anti-Fascist Struggle Day"),
(8, 5, "Victory & Homeland Thanksgivi... | novafloss/workalendar | workalendar/europe/croatia.py | Python | mit | 1,404 |
# -*- coding: utf-8 -*-
"""
sphinx.make_mode
~~~~~~~~~~~~~~~~
sphinx-build -M command-line handling.
This replaces the old, platform-dependent and once-generated content
of Makefile / make.bat.
This is in its own module so that importing it is fast. It should not
import the main Sphinx m... | neerajvashistha/pa-dude | lib/python2.7/site-packages/sphinx/make_mode.py | Python | mit | 10,500 |
from datetime import datetime
from django.template.loader import render_to_string
from django.contrib.auth import get_user_model
from utils import make_absolute_url
from shared.mail import send as send_mail
from . import changes, models
User = get_user_model()
def _make_user_context(subscription, context=None, u... | codeforboston/cornerwise | server/user/mail.py | Python | mit | 3,668 |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Bitcoin test... | litecoin-project/litecoin | test/functional/test_framework/messages.py | Python | mit | 42,131 |
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import reporter
import numpy as np
class PixelwiseSoftmaxClassifier(chainer.Chain):
"""A pixel-wise classifier.
It computes the loss based on a given input/label pair for
semantic segmentation.
Args:
... | chainer/chainercv | chainercv/links/model/pixelwise_softmax_classifier.py | Python | mit | 2,173 |
#!/usr/bin/env python3
# Copyright (c) 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 coinstatsindex across nodes.
Test that the values returned by gettxoutsetinfo are consistent
between a... | apoelstra/bitcoin | test/functional/feature_coinstatsindex.py | Python | mit | 13,503 |
import os
import sys
import unittest
import shutil
from iktomi import web
from iktomi.cli import app
from logging import Logger
import six
if six.PY2:
from StringIO import StringIO
else:
from io import StringIO
import signal
from time import sleep
import subprocess
if six.PY2:
from urllib2 import urlopen
e... | boltnev/iktomi | tests/cli/app.py | Python | mit | 5,228 |
# -*- 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):
# Changing field 'Message.clock'
db.alter_column('djangotribune_message', 'clock', self.gf('django.db.model... | cible/djangotribune | djangotribune/migrations/0002_auto__chg_field_message_clock__chg_field_message_created.py | Python | mit | 7,522 |
from flask import session
from models.user import User
def current_user():
uid = session.get('user_id', '')
u = User.find_by(id=uid)
return u
def admin():
uid = session.get('user_id', '')
u = User.find_by(id=uid)
return u | chidaobanjiu/Flask_Web | routes/__init__.py | Python | mit | 250 |
from unittest import TestCase
from routeros_api import exceptions
try:
from unittest import mock
except ImportError:
import mock
try:
from StringIO import StringIO as BytesIO
except ImportError:
import io
BytesIO = io.BytesIO
from routeros_api import base_api
class TestEncodeLength(TestCase):
... | socialwifi/RouterOS-api | tests/test_base_api.py | Python | mit | 3,663 |
# Time: O(m + n)
# Space: O(1)
#
# Implement wildcard pattern matching with support for '?' and '*'.
#
# '?' Matches any single character.
# '*' Matches any sequence of characters (including the empty sequence).
#
# The matching should cover the entire input string (not partial).
#
# The function prototype should b... | yiwen-luo/LeetCode | Python/wildcard-matching.py | Python | mit | 3,914 |
from __future__ import absolute_import, print_function, unicode_literals
from kolibri.core.webpack.hooks import WebpackInclusionHook
class FacilityManagementSyncHook(WebpackInclusionHook):
"""
Inherit a hook defining assets to be loaded sychronously in the template
"""
class Meta:
abstract = T... | christianmemije/kolibri | kolibri/plugins/facility_management/hooks.py | Python | mit | 324 |
def sumArray(x):
sum = 0
for i in x:
sum = sum + i
return sum
input()
numbers = list(map(int, input().split()))
print(sumArray(numbers)) | chandps/CodingChallenges | Hackerrank/warmup/AVeryBigSum.py | Python | mit | 156 |
"""
Kerberos aware Requester
"""
from jenkinsapi.utils.requester import Requester
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
# pylint: disable=W0222
class KrbRequester(Requester):
"""
A class which carries out HTTP requests with Kerberos/GSSAPI authentication.
"""
def __init__(self, *a... | salimfadhley/jenkinsapi | jenkinsapi/utils/krb_requester.py | Python | mit | 1,381 |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import ctypes
import errno
import os
import pyglet
from pyglet.app.xlib import XlibSelectDevice
from .base import Device, Control, RelativeAxis, AbsoluteAxis, Button, Joystick
from .base import DeviceOpenException
from .evdev_cons... | AustinRoy7/Pomodoro-timer | venv/Lib/site-packages/pyglet/input/evdev.py | Python | mit | 9,203 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'superlists.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| rodowi/remember-the-beer | superlists/urls.py | Python | mit | 301 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... | offlinehacker/flumotion | flumotion/component/producers/playlist/smartscale.py | Python | gpl-2.0 | 8,782 |
import logging
from autotest.client.shared import error
from virttest import aexpect
@error.context_aware
def run_pxe(test, params, env):
"""
PXE test:
1) Boot up guest from NIC(from pxe/gpxe server)
2) Snoop the tftp packet in the tap device
3) Analyzing the tcpdump result
:param test: QEMU... | spiceqa/virt-test | tests/pxe.py | Python | gpl-2.0 | 1,066 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the postgres provider.
Note: to prepare the DB, you need to run the sql files specified in
tests/testdata/provider/testdata_pg.sh
Read tests/README.md about writing/launching tests with PostgreSQL.
Run with ctest -V -R PyQgsPostgresProvider
.. note:: This program is fr... | tudorbarascu/QGIS | tests/src/python/test_provider_postgres.py | Python | gpl-2.0 | 66,653 |
# InterruptibleQueue.py
#
# Copyright (C) 2016 Carlos Garcia Campos <carlosgc@gnome.org>
#
# 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) ... | grubba/poppler | regtest/InterruptibleQueue.py | Python | gpl-2.0 | 2,346 |
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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, ... | kaplun/invenio | modules/websubmit/lib/websubmit_webinterface.py | Python | gpl-2.0 | 48,514 |
# $HeadURL$
"""
Collection of DIRAC useful network related modules
by default on Error they return None
getAllInterfaces and getAddressFromInterface do not work in MAC
"""
__RCSID__ = "$Id$"
import socket
import struct
import array
import os
import fcntl
import platform
from DIRAC.Core.Utilities.ReturnValues... | avedaee/DIRAC | Core/Utilities/Network.py | Python | gpl-3.0 | 4,293 |
#### PATTERN | EN | MOOD & MODALITY ################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
### LIST FUN... | boompieman/iim_project | project_python2/lib/python2.7/site-packages/pattern/text/en/modality.py | Python | gpl-3.0 | 21,985 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.conf import settings
import geonode.utils
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('base', '__first__'),
]
operations = [
migr... | tomkralidis/geonode | geonode/maps/migrations/24_initial.py | Python | gpl-3.0 | 4,833 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
page_title = "Partners"
def get_context(context):
partners = frappe.db.sql("""select * from `tabSales Partner`
where show_in_website=1 order by name asc""", as_dict=True)
... | mhbu50/erpnext | erpnext/templates/pages/partners.py | Python | gpl-3.0 | 380 |
#!/usr/bin/env python
# encoding: utf-8
from collections import OrderedDict
import sys
import waflib
_board_classes = {}
class BoardMeta(type):
def __init__(cls, name, bases, dct):
super(BoardMeta, cls).__init__(name, bases, dct)
if 'abstract' not in cls.__dict__:
cls.abstract = Fal... | bho008/ardupilot | Tools/ardupilotwaf/boards.py | Python | gpl-3.0 | 10,495 |
# -*- coding: UTF-8 -*-
import re
import wx
from outwiker.gui.tabledialog import TableDialog
from outwiker.gui.tablerowsdialog import TableRowsDialog
from outwiker.pages.wiki.utils import getCommandsByPos
from outwiker.pages.wiki.tabledialogcontroller import (
TableDialogController,
TableRowsDialogController... | unreal666/outwiker | src/outwiker/pages/wiki/tableactions.py | Python | gpl-3.0 | 2,837 |
from __future__ import print_function
from numpy.testing import run_module_suite, assert_equal, TestCase
from pandas.util.testing import assert_almost_equal
from pandas.compat import range
import nose
import unittest
raise nose.SkipTest('skipping this for now')
try:
import statsmodels.tsa.var as sm_var
impo... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/stats/tests/test_var.py | Python | gpl-3.0 | 5,004 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid -**InaSAFE Wizard**
This module provides: Function Centric Wizard Step: Agg. Layer Disjoints
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Gene... | Samweli/inasafe | safe/gui/tools/wizard/step_fc65_agglayer_disjoint.py | Python | gpl-3.0 | 2,279 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 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 ... | cjahangir/geodash | geonode/upload/forms.py | Python | gpl-3.0 | 7,786 |
#!/usr/bin/env python
# script para gerar os bancos de dados
import sys, getopt
import os
import os.path
import csv
import gzip
# It will connect to DataStoreClient
from sciwonc.dataflow.DataStoreClient import DataStoreClient
import ConfigCSVGZ_ImportTask_7
import ConfigDB_ImportTask_7
# connector and config
clien... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/0-import-data/4-import-10files-mongo-3sh/import_7/ImportTask_7.py | Python | gpl-3.0 | 765 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2017-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... | areeda/gwpy | gwpy/signal/spectral/_median_mean.py | Python | gpl-3.0 | 1,851 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('contentstore.management.commands.create_course', '... | eduNEXT/edunext-platform | import_shims/studio/contentstore/management/commands/create_course.py | Python | agpl-3.0 | 461 |
CRITICAL = 50
ERROR = 40
WARNING = 30
INFO = 20
DEBUG = 10
VERBOSE = 0
| Lysxia/dissemin | notification/levels.py | Python | agpl-3.0 | 71 |
""" Management command to update courses' search index """
import logging
from textwrap import dedent
from django.core.management import BaseCommand, CommandError
from elasticsearch import exceptions
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator impor... | edx/edx-platform | cms/djangoapps/contentstore/management/commands/reindex_course.py | Python | agpl-3.0 | 4,610 |
import zmq
c = zmq.Context()
s = c.socket(zmq.PUSH)
s.connect("tcp://localhost:5557")
s.send("default", flags=zmq.SNDMORE)
s.send("03960478444a2c18b0cd82b461c2654fc3b96dd117ddd524558268be3044192b97".decode("hex"))
| eXcomm/OpenBazaar | ident/send_ident.py | Python | agpl-3.0 | 215 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Lucien Loiseau
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | laurent-george/weboob | modules/googletranslate/module.py | Python | agpl-3.0 | 3,073 |
"""
Common utilities for tests in block_structure module
"""
from contextlib import contextmanager
from uuid import uuid4
from unittest.mock import patch
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from xmodule.modulestore.exceptions import ItemNotFoundError
from ..api import get_cache
fro... | eduNEXT/edx-platform | openedx/core/djangoapps/content/block_structure/tests/helpers.py | Python | agpl-3.0 | 10,644 |
import json
import unittest
from fs.memoryfs import MemoryFS
from lxml import etree
from mock import Mock, patch
from six import text_type
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds
from xmodule.error_module import NonStaffErrorDescriptor
from opaque_keys.edx.keys import CourseKey
... | procangroup/edx-platform | common/lib/xmodule/xmodule/tests/test_conditional.py | Python | agpl-3.0 | 19,289 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gasistafelice.settings')
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
# After upgrading Django, replace the last 2 lines with the next two:
#from django.core.wsgi import get_wsgi_application
#application = get_wsgi_applicati... | OrlyMar/gasistafelice | gasistafelice/wsgi.py | Python | agpl-3.0 | 325 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('edxnotes.views', 'lms.djangoapps.edxnotes.views')
... | eduNEXT/edunext-platform | import_shims/lms/edxnotes/views.py | Python | agpl-3.0 | 365 |
# coding: utf-8
'''
# Copyright (C) 1994-2016 Altair Engineering, Inc.
# For more information, contact Altair at www.altair.com.
#
# This file is part of the PBS Professional ("PBS Pro") software.
#
# Open Source License Information:
#
# PBS Pro is free software. You can redistribute it and/or modify it u... | subhasisb/test2 | src/unsupported/pbs-alps-inventory-check.py | Python | agpl-3.0 | 10,196 |
from __future__ import unicode_literals
import uuid
from moto.core import BaseBackend
from moto.ec2 import ec2_backends
class BaseObject(object):
def camelCase(self, key):
words = []
for i, word in enumerate(key.split('_')):
if i > 0:
words.append(word.title())
... | riccardomc/moto | moto/ecs/models.py | Python | apache-2.0 | 11,936 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | mandeepdhami/neutron | neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py | Python | apache-2.0 | 100,003 |
#!/usr/bin/env python3
###############################################################################
# Copyright 2017 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... | jinghaomiao/apollo | modules/tools/vehicle_calibration/plot_grid.py | Python | apache-2.0 | 1,962 |
"""
Support for balance data via the Starling Bank API.
For more details about this platform, please refer to the documentation at
https://www.home-assistant.io/components/sensor.starlingbank/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from... | jamespcole/home-assistant | homeassistant/components/starlingbank/sensor.py | Python | apache-2.0 | 3,334 |
try:
from unittest2 import TestCase
from mock import Mock, patch
except ImportError:
from unittest import TestCase
from mock import Mock, patch
import datetime
from cfn_sphere.aws.ec2 import Ec2Api
from cfn_sphere.exceptions import CfnSphereException
class Ec2ApiTests(TestCase):
@patch("cfn_sphe... | marco-hoyer/cfn-sphere | src/unittest/python/aws_tests/ec2_tests.py | Python | apache-2.0 | 1,394 |
# 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... | alshedivat/tensorflow | tensorflow/python/kernel_tests/morphological_ops_test.py | Python | apache-2.0 | 18,627 |
"""EFILTER sample projects."""
| google/dotty | sample_projects/tagging/__init__.py | Python | apache-2.0 | 31 |
"""Auto-generated file, do not edit by hand. TT metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_TT = PhoneMetadata(id='TT', country_code=1, international_prefix='011',
general_desc=PhoneNumberDesc(national_number_pattern='[589]\\d{9}', possible_number_pattern='\\... | roubert/python-phonenumbers | python/phonenumbers/data/region_TT.py | Python | apache-2.0 | 1,896 |
# Copyright 2008 the V8 project authors. 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 of source code must retain the above copyright
# notice, this list of conditi... | facekapow/runtime | deps/v8/test/mozilla/testcfg.py | Python | apache-2.0 | 4,506 |
######################################################################
# Cloud Routes Web Application
# -------------------------------------------------------------------
# HTTP Get Status Code Health Check - Forms Class
######################################################################
from wtforms import TextFi... | Runbook/runbook | src/web/monitorforms/http-get-statuscode/__init__.py | Python | apache-2.0 | 4,293 |
#!/usr/bin/python
#
# Copyright 2012 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... | lociii/googleads-python-lib | examples/adspygoogle/adxbuyer/v201306/basic_operations/add_campaigns.py | Python | apache-2.0 | 4,435 |
# 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... | sarvex/tensorflow | tensorflow/python/ops/cond_v2.py | Python | apache-2.0 | 51,016 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright Yassine Lamgarchal <lamgarchal.yassine@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/... | tempbottle/chillaxd | setup.py | Python | apache-2.0 | 2,076 |
import unittest
from qubell.api.private.testing import norm
class NormNamesTests(unittest.TestCase):
def test_same_when_no_special_symbols(self):
assert norm('default') == 'default'
def test_preserve_upper_case(self):
assert norm('privateHA') == 'privateHA'
def test_underscore_is_accept... | vasichkin/contrib-python-qubell-client | qubell/tests/testing/test_norm.py | Python | apache-2.0 | 479 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/python/kernel_tests/fft_ops_test.py | Python | apache-2.0 | 21,871 |
# Copyright (c) 2013, Rethink Robotics
# 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. Redistributions of source code must retain the above copyright notice,
# this list of conditions an... | umassrobotics/baxter | baxter/baxter_interface/src/baxter_interface/__init__.py | Python | bsd-3-clause | 1,872 |
from django.db import models
class Book(models.Model):
title = models.CharField(max_length=50)
description = models.TextField()
def get_absolute_url(self):
return "/book/%s/" % self.id
class Author(models.Model):
# This model has purposefully no get_absolute_url
name = models.Char... | Ixxy-Open-Source/django-linkcheck-old | linkcheck/tests/sampleapp/models.py | Python | bsd-3-clause | 383 |
from sympy.physics.secondquant import (
Dagger, Bd, VarBosonicBasis, BBra, B, BKet, FixedBosonicBasis,
matrix_rep, apply_operators, InnerProduct, Commutator, KroneckerDelta,
FockState, AnnihilateBoson, CreateBoson, BosonicOperator,
F, Fd, FKet, FBra, BosonState, CreateFermion, AnnihilateFermion,
eva... | mattpap/sympy-polys | sympy/physics/tests/test_secondquant.py | Python | bsd-3-clause | 15,895 |
#!/usr/bin/env python
"""Tests reparenting is picked up in topology."""
import json
import threading
import time
import numpy
import logging
import base_end2end_test
import utils
import vtctl_helper
from vtproto import topodata_pb2
from vttest import sharding_utils
def setUpModule():
pass
def tearDownModule(... | dumbunny/vitess | test/end2end/reparent_test.py | Python | bsd-3-clause | 9,631 |
from __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('datasets', parent_package, top_... | alexis-roche/nipy | nipy/labs/datasets/setup.py | Python | bsd-3-clause | 578 |
"""
Bias and Variance
-----------------
This script plots some simple examples of how model complexity affects
bias and variance.
"""
import numpy as np
import pylab as pl
from matplotlib import ticker
from matplotlib.patches import FancyArrow
# Suppress warnings from Polyfit (ill-conditioned fit)
import warnings
wa... | vtesin/sklearn_tutorial | examples/plot_bias_variance_examples.py | Python | bsd-3-clause | 4,638 |
# -*- coding: utf-8 -*-
"""Test exporting functions."""
# Authors: MNE Developers
#
# License: BSD-3-Clause
from datetime import datetime, timezone
from mne.io import RawArray
from mne.io.meas_info import create_info
from pathlib import Path
import os.path as op
import pytest
import numpy as np
from numpy.testing imp... | wmvanvliet/mne-python | mne/export/tests/test_export.py | Python | bsd-3-clause | 17,316 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
def zero_one_norm(mat, two_side=False):
"""Normalize each column of input 2D array into zero-one range.
For `two_side` mode, the positive and negative data would be normalized
... | sealhuang/brainCodingToolbox | braincode/math/norm.py | Python | bsd-3-clause | 3,380 |
# Copyright (c) 2016-2018, Alexander Belchenko
# 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 of source code must retain
# the above copyright notice, this list ... | adfernandes/intelhex | intelhex/__main__.py | Python | bsd-3-clause | 1,876 |
import imp
import os
import sys
import subprocess
from distutils.version import LooseVersion
from SCons.Script import BoolVariable, Dir, Environment, File, SCons, Variables
monoreg = imp.load_source('mono_reg_utils', 'modules/mono/mono_reg_utils.py')
def can_build(env, platform):
if platform in ['javascript']... | NateWardawg/godot | modules/mono/config.py | Python | mit | 16,111 |
"""PyPI and direct package downloading"""
import sys
import os
import re
import shutil
import socket
import base64
from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
require, Environment, find_distributions, safe_name, safe_version,
to_filename, Requirement, ... | bobeirasa/virtualenvs | pyzabbixhue/lib/python2.7/site-packages/setuptools/package_index.py | Python | mit | 38,964 |
'''
reStructuredText renderer
=========================
.. versionadded:: 1.1.0
`reStructuredText <http://docutils.sourceforge.net/rst.html>`_ is an
easy-to-read, what-you-see-is-what-you-get plaintext markup syntax and parser
system.
.. note::
This widget requires the ``docutils`` package to run. Install it wi... | manthansharma/kivy | kivy/uix/rst.py | Python | mit | 33,744 |
"""Tornado handlers for nbconvert."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import zipfile
from tornado import web
from ..base.handlers import (
IPythonHandler, FilesRedirectHandler,
path_regex,
)
from IPython.nbformat import... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/html/nbconvert/handlers.py | Python | mit | 5,232 |
"""
This wsgi server is a single threaded, single process server that interleaves
the iterations of the wsgi apps - I could add a threadpool for blocking apps in
the future.
If you don't return iterators from apps and return lists you'll get, at most,
the performance of a server that processes requests sequentia... | seanjensengrey/cogen | cogen/web/wsgi.py | Python | mit | 30,713 |
import chainer
import chainer.functions as F
from chainer import testing
import numpy as np
from onnx_chainer_tests.helper import ONNXModelTest
@testing.parameterize(
{'name': 'dropout', 'ops': lambda x: F.dropout(x, ratio=0.5)},
)
class TestNoises(ONNXModelTest):
def setUp(self):
class Model(chain... | hvy/chainer | tests/onnx_chainer_tests/functions_tests/test_noises.py | Python | mit | 775 |
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
def _fwd_kern():
return cuda.elementwise(
'T x, T cond, T W', 'T y',
'y = cond >= 0 ? x : x * W', 'prelu')
class PReLU(function.Function):
"""Parametric ReLU function.
PR... | masia02/chainer | chainer/functions/prelu.py | Python | mit | 3,059 |
import re
from postgres.orm import Model
name_pattern = re.compile(r'^[A-Za-z0-9,._ -]+$')
def slugize(slug):
"""Convert a string to a string for an URL.
"""
assert name_pattern.match(slug) is not None
slug = slug.lower()
for c in (' ', ',', '.', '_'):
slug = slug.replace(c, '-')
whi... | mccolgst/www.gittip.com | gratipay/models/community.py | Python | cc0-1.0 | 1,966 |
import os, shutil, glob, re, time, datetime, sys, traceback
import StringIO
import fnmatch
import hashlib
import zipfile
import subprocess
#### OS PATH File
def join_path(*args):
return os.path.normpath(os.path.join(*args))
def current_path():
return os.getcwd()
def dir_name(path):
return os.path.dirnam... | emop/webrobot | webrobot_gao/src/sailing/common/common.py | Python | gpl-2.0 | 4,297 |
# Copyright (C) 2007-2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# policygentool is a tool for the initial generation of SELinux policy
#
# 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 ... | rhatdan/selinux | policycoreutils/sepolicy/sepolicy/templates/executable.py | Python | gpl-2.0 | 9,891 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# dnsdist documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 9 00:08:08 2017.
#
# 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
# au... | Habbie/pdns | pdns/dnsdistdist/docs/conf.py | Python | gpl-2.0 | 6,427 |
import sys
import logging
import os
import ssl
import hashlib
from Config import config
from util import SslPatch
from util import helper
class CryptConnectionManager:
def __init__(self):
# OpenSSL params
if sys.platform.startswith("win"):
self.openssl_bin = "src\\lib\\opensslVerify\\... | frerepoulet/ZeroNet | src/Crypt/CryptConnection.py | Python | gpl-2.0 | 4,946 |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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.
... | xmbcrios/xmbcrios.repository | script.module.urlresolver/lib/urlresolver/plugins/gorillavid.py | Python | gpl-2.0 | 2,619 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
All layers. Configurable with conf.load_layers.
"""
from __future__ import absolute_import
# We import conf from arch to... | gpotter2/scapy | scapy/layers/all.py | Python | gpl-2.0 | 899 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | ilastik/utility/gui/threadRouter.py | Python | gpl-3.0 | 4,479 |
import os
from pythonforandroid.recipes.sdl2_ttf import LibSDL2TTF
from pythonforandroid.util import load_source
util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))
assert LibSDL2TTF._version == "2.0.15"
assert LibSDL2TTF.depends == []
assert LibSDL2TTF.python_depends == ... | GroestlCoin/electrum-grs | contrib/android/p4a_recipes/sdl2_ttf/__init__.py | Python | gpl-3.0 | 565 |
from math import sin, cos, pi, degrees, radians
import bpy
from bpy.props import BoolProperty, IntProperty, FloatProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import (fullList, match_long_repeat, updateNode,
SvSetSocketAnyType, SvGetSocketAnyType... | kilon/sverchok | old_nodes/circle.py | Python | gpl-3.0 | 4,642 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import struct
... | sharad/calibre | src/calibre/ebooks/mobi/reader/index.py | Python | gpl-3.0 | 9,769 |
# -*- coding: utf-8 -*-
# Copyright 2015 Alessio Gerace <alessio.gerace@agilebg.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
class RoundingByCurrency(models.Model):
_name = 'company.rounding'
company_id = fields.Many2one('res.company', 'Company', re... | acsone/account-invoicing | account_invoice_rounding_by_currency/models/company.py | Python | agpl-3.0 | 1,984 |
#!python3
import sys
import zmq
import struct
# Connect to the public heartbeat service.
url = 'tcp://mainnet.libbitcoin.net:9092'
if len(sys.argv) > 1:
url = sys.argv[1]
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect(url)
socket.setsockopt(zmq.SUBSCRIBE, b'')
while True:
# Colle... | RojavaCrypto/libbitcoin-server | data/subscribe-heartbeat.py | Python | agpl-3.0 | 541 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo.tools.translate import _
from odoo.tools import email_split
from odoo.exceptions import UserError
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
# welcome email s... | levkar/odoo | addons/portal/wizard/portal_wizard.py | Python | agpl-3.0 | 9,012 |
# Copyright 2013-2021 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 PyHeapdict(PythonPackage):
"""A heap with decrease-key and increase-key operations"""
... | LLNL/spack | var/spack/repos/builtin/packages/py-heapdict/package.py | Python | lgpl-2.1 | 981 |
##############################################################################
# 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... | tmerrick1/spack | lib/spack/spack/test/util/prefix.py | Python | lgpl-2.1 | 3,253 |
# Copyright 2013-2021 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 Numdiff(AutotoolsPackage):
"""Numdiff is a little program that can be used to compare puta... | LLNL/spack | var/spack/repos/builtin/packages/numdiff/package.py | Python | lgpl-2.1 | 1,801 |
# Copyright 2017 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 agre... | abbytiz/runtimes-common | reconciletags/reconciletags.py | Python | apache-2.0 | 5,084 |
import json
import os
import re
import subprocess
import time
from collections import defaultdict
from typing import Any, DefaultDict, Dict, List
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
normal_queues = [
'deferred_work',
'digest_emails',
'email_mirror',
... | timabbott/zulip | scripts/lib/check_rabbitmq_queue.py | Python | apache-2.0 | 8,032 |
# 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 t... | ging/horizon | openstack_dashboard/dashboards/admin/volumes/tabs.py | Python | apache-2.0 | 5,396 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | shishaochen/TensorFlow-0.8-Win | third_party/grpc/src/python/grpcio/grpc/_links/service.py | Python | apache-2.0 | 17,715 |
"""Support for loading picture from Neato."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Any
from pybotvac.exceptions import NeatoRobotException
from pybotvac.robot import Robot
from urllib3.response import HTTPResponse
from homeassistant.components.camera imp... | sander76/home-assistant | homeassistant/components/neato/camera.py | Python | apache-2.0 | 4,610 |