repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
xuxiao19910803/edx-platform | common/djangoapps/student/tests/test_credit.py | 12 | 8127 | """
Tests for credit courses on the student dashboard.
"""
import unittest
import datetime
import pytz
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from xmodule.modulestore.tests.django_utils import ModuleStoreTes... | agpl-3.0 |
jakirkham/lazyflow | lazyflow/operators/opFeatureMatrixCache.py | 1 | 12534 | from functools import partial
import logging
logger = logging.getLogger(__name__)
import numpy
from lazyflow.graph import Operator, InputSlot, OutputSlot
from lazyflow.request import RequestLock, Request, RequestPool
from lazyflow.utility import OrderedSignal
from lazyflow.roi import getBlockBounds, getIntersectingBl... | lgpl-3.0 |
kidburglar/youtube-dl | youtube_dl/extractor/rtp.py | 50 | 3090 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class RTPIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?'
_TESTS = [{
'url': 'http://www.rtp.pt/play/p405/e174042/paixoes-cruzadas',
... | unlicense |
reorder/cgminer_keccak_3.6 | api-example.py | 54 | 1334 | #!/usr/bin/env python2.7
# Copyright 2013 Setkeh Mkfr
#
# 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. See COPYING fo... | gpl-3.0 |
hehongliang/tensorflow | tensorflow/python/kernel_tests/sparse_reshape_op_test.py | 5 | 13690 | # 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... | apache-2.0 |
dxmahata/InformativeTweetCollection | requests_oauthlib/oauth1_session.py | 6 | 16132 | from __future__ import unicode_literals
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
import logging
from oauthlib.common import add_params_to_uri
from oauthlib.common import urldecode as _urldecode
from oauthlib.oauth1 import (
SIGNATURE_HMAC, SIGNATURE_RSA, SI... | apache-2.0 |
onitake/ansible | lib/ansible/modules/network/junos/junos_interface.py | 22 | 12307 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
Serag8/Bachelor | google_appengine/lib/django-1.2/django/contrib/admindocs/utils.py | 314 | 3796 | "Misc. utility functions/classes for admin documentation generator."
import re
from email.Parser import HeaderParser
from email.Errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import smart_str
try:
import docutils.... | mit |
hoaibang07/Webscrap | transcripture/sources/crawler_data.py | 1 | 2804 | # -*- encoding: utf-8 -*-
import io
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
import urllib2
import urlparse
def _remove_div_vdx(soup):
for div in soup.find_all('div', class_='vidx'):
div.extract()
return soup
def get_data(urlchuong_list, i):
filename = 'urlsach/data/sach' + str... | gpl-2.0 |
bealdav/OCB | addons/document/test_cindex.py | 444 | 1553 | #!/usr/bin/python
import sys
import os
import glob
import time
import logging
from optparse import OptionParser
logging.basicConfig(level=logging.DEBUG)
parser = OptionParser()
parser.add_option("-q", "--quiet",
action="store_false", dest="verbose", default=True,
help="don't prin... | agpl-3.0 |
stephanehenry27/Sickbeard-anime | lib/hachoir_parser/misc/bplist.py | 90 | 11349 | """
Apple/NeXT Binary Property List (BPLIST) parser.
Also includes a .createXML() function which produces an XML representation of the object.
Note that it will discard unknown objects, nulls and fill values, but should work for most files.
Documents:
- CFBinaryPList.c
http://src.gnu-darwin.org/DarwinSourceArchive/... | gpl-3.0 |
porcobosso/spark-ec2 | lib/boto-2.34.0/boto/cloudsearch2/search.py | 16 | 13430 | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates.
# 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 restriction, including
# without limitation the rights... | apache-2.0 |
levigross/pyscanner | mytests/django/template/context.py | 80 | 6146 | from copy import copy
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
# Cache of actual callables.
_standard_context_processors = None
# We need the CSRF processor no matter what the user has in their settings,
# because otherwise it is a security vulnerability,... | mit |
maheshp/novatest | nova/virt/xenapi/vmops.py | 1 | 74575 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2010 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
#
# ... | apache-2.0 |
sullivat/Markov-Twitter-Bot | src/mybot.test.py | 1 | 1257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime as dt
import logging
import time
import tweepy
from tweet_builder import *
from credentials import *
# Housekeeping: do not edit
logging.basicConfig(filename='tweet_test.log', level=logging.DEBUG)
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRE... | bsd-2-clause |
devGregA/code | scrapy/tests/test_middleware.py | 43 | 2341 | from twisted.trial import unittest
from scrapy.settings import Settings
from scrapy.exceptions import NotConfigured
from scrapy.middleware import MiddlewareManager
class M1(object):
def open_spider(self, spider):
pass
def close_spider(self, spider):
pass
def process(self, response, requ... | bsd-3-clause |
devs4v/devs4v-information-retrieval15 | project/venv/lib/python2.7/site-packages/django/db/models/fields/files.py | 58 | 19311 | import datetime
import os
import warnings
from inspect import getargspec
from django import forms
from django.core import checks
from django.core.files.base import File
from django.core.files.images import ImageFile
from django.core.files.storage import default_storage
from django.db.models import signals
from django.... | mit |
alphagov/notifications-api | migrations/versions/0151_refactor_letter_rates.py | 1 | 3140 | """
Revision ID: 0151_refactor_letter_rates
Revises: 0150_another_letter_org
Create Date: 2017-12-05 10:24:41.232128
"""
import uuid
from datetime import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0151_refactor_letter_rates'
down_revision = '0150_a... | mit |
mat12/mytest | lib/python/Plugins/SystemPlugins/PositionerSetup/rotor_calc.py | 103 | 3251 | import math
f = 1.00 / 298.257 # Earth flattning factor
r_sat = 42164.57 # Distance from earth centre to satellite
r_eq = 6378.14 # Earth radius
def calcElevation(SatLon, SiteLat, SiteLon, Height_over_ocean = 0):
a0 = 0.58804392
a1 = -0.17941557
a2 = 0.29906946E-1
a3 = -0.25187400E-2
a4 = 0.82622101E-4
sin... | gpl-2.0 |
jpscaletti/rev-assets | rev_assets/__init__.py | 1 | 1570 | """
===========================
RevAssets
===========================
Makes possible for python web apps to work with hashed static assets
generated by other tools like Gulp or Webpack.
It does so by reading the manifest generated by the revision tool.
"""
import json
import io
__version__ = '1.0.3'
class AssetN... | bsd-3-clause |
vikas1885/test1 | lms/djangoapps/mobile_api/test_milestones.py | 80 | 5550 | """
Milestone related tests for the mobile_api
"""
from mock import patch
from courseware.access_response import MilestoneError
from courseware.tests.helpers import get_request_for_user
from courseware.tests.test_entrance_exam import answer_entrance_exam_problem, add_entrance_exam_milestone
from util.milestones_helper... | agpl-3.0 |
mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/migrations/0017_author_removed.py | 385 | 19523 | # -*- 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):
# Dummy migration
pass
def backwards(self, orm):
# Dummy migration
pass
models = {
... | apache-2.0 |
frankiecjunle/yunblog | venv/lib/python2.7/site-packages/mako/filters.py | 61 | 6003 | # mako/filters.py
# Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import re
import codecs
from mako.compat import quote_plus, unquote_plus, codepoint2name, \
... | mit |
titilambert/alignak | alignak/macroresolver.py | 2 | 23875 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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, eit... | agpl-3.0 |
SamuelDSR/YouCompleteMe-Win7-GVIM | third_party/bottle/plugins/sqlite/bottle_sqlite.py | 7 | 3437 | '''
Bottle-sqlite is a plugin that integrates SQLite3 with your Bottle
application. It automatically connects to a database at the beginning of a
request, passes the database handle to the route callback and closes the
connection afterwards.
To automatically detect routes that need a database connection, the plugin
se... | gpl-3.0 |
google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_sgmllib.py | 14 | 16167 | import pprint
import re
import unittest
from test import test_support
sgmllib = test_support.import_module('sgmllib', deprecated=True)
class EventCollector(sgmllib.SGMLParser):
def __init__(self):
self.events = []
self.append = self.events.append
sgmllib.SGMLParser.__init__(se... | apache-2.0 |
avedaee/DIRAC | ResourceStatusSystem/Utilities/CSHelpers.py | 2 | 3673 | # $HeadURL: $
''' CSHelpers
Module containing functions interacting with the CS and useful for the RSS
modules.
'''
from DIRAC import S_OK, S_ERROR
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getGOCSiteName
from DIRAC.ResourceStatusSystem.Utilit... | gpl-3.0 |
Python1320/icmpviewer | main.py | 1 | 1217 | #!/usr/bin/env python2
QUEUE_NUM = 5
#hush verbosity
import logging
l=logging.getLogger("scapy.runtime")
l.setLevel(49)
import os,sys,time
from sys import stdout as out
import nfqueue,socket
from scapy.all import *
import GeoIP
gi = GeoIP.open("GeoLiteCity.dat",GeoIP.GEOIP_STANDARD)
lastip=""
def DoGeoIP(pkt):
gl... | unlicense |
williamsentosa/hadoop-modified | src/examples/python/WordCount.py | 123 | 2243 | #
# 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... | apache-2.0 |
sebastic/QGIS | python/plugins/processing/tests/RunAlgTest.py | 11 | 3686 | # -*- coding: utf-8 -*-
"""
***************************************************************************
RunAlgTest.py
---------------------
Date : March 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | gpl-2.0 |
mhabib1981/pySecn00b | zap_xml_parse.py | 1 | 2159 | from xml.dom.minidom import parse
import xml.dom.minidom
import sys
import csv
#uni_file=open(sys.argv[1],'r')
#non_uni_file=uni_file.decode("utf8")
dom_tree=parse(sys.argv[1])
collect=dom_tree.documentElement
output_data=[[],[],[],[],[],[],[],[]]
out_filename=((sys.argv[1].split("/")[-1]).split(".")[0])+".csv"
out_fi... | cc0-1.0 |
syaiful6/django | django/contrib/gis/db/backends/postgis/introspection.py | 330 | 5441 | from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.postgresql.introspection import DatabaseIntrospection
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# introspectio... | bsd-3-clause |
ibab/tensorflow | tensorflow/contrib/ffmpeg/__init__.py | 5 | 1566 | # 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 by applicable law or a... | apache-2.0 |
lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/combinatorics/tests/test_partitions.py | 3 | 3304 | from sympy.combinatorics.partitions import (Partition, IntegerPartition,
RGS_enum, RGS_unrank, RGS_rank,
random_integer_partition)
from sympy.utilities.pytest import raises
from sympy.utilities.iterables import default_sort_key, par... | gpl-3.0 |
androidarmv6/android_external_chromium_org | chrome/test/functional/test_clean_exit.py | 69 | 1495 | #!/usr/bin/env python
# Copyright (c) 2012 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 logging
import os
import signal
import subprocess
import tempfile
import unittest
import pyauto_functional
import pyauto
im... | bsd-3-clause |
billyhunt/osf.io | scripts/migration/migrate_personal_to_profile_websites.py | 40 | 1417 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate single value personal to profile_websites list."""
from __future__ import unicode_literals
import logging
import modularodm
from modularodm import Q
from website import models
from website.app import init_app
logger = logging.getLogger(__name__)
d... | apache-2.0 |
bedder/gifbot | test/test_gif_bot.py | 1 | 7000 |
# MIT License
#
# Copyright (c) 2018 Matthew Bedder (matthew@bedder.co.uk)
#
# 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... | mit |
google/fedjax | fedjax/models/stackoverflow.py | 1 | 5453 | # Copyright 2021 Google LLC
#
# 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, ... | apache-2.0 |
frdb194/django | tests/forms_tests/models.py | 261 | 3805 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import itertools
import tempfile
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
callable_default_counter = itertools.count()
def callab... | bsd-3-clause |
pawl/wtforms | tests/validators.py | 8 | 13083 | # -*- coding: utf-8 -*-
from unittest import TestCase
from wtforms.compat import text_type
from wtforms.validators import (
StopValidation, ValidationError, email, equal_to,
ip_address, length, required, optional, regexp,
url, NumberRange, AnyOf, NoneOf, mac_address, UUID,
input_required, data_required
... | bsd-3-clause |
t794104/ansible | lib/ansible/plugins/terminal/aruba.py | 82 | 2315 | #
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | gpl-3.0 |
10clouds/edx-platform | lms/djangoapps/courseware/tests/test_courses.py | 5 | 14043 | # -*- coding: utf-8 -*-
"""
Tests for course access
"""
import itertools
import ddt
from django.conf import settings
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
import mock
from nose.plugins.attrib import attr
from opaque_ke... | agpl-3.0 |
theheros/kbengine | kbe/src/lib/python/Lib/unittest/test/test_case.py | 50 | 50475 | import difflib
import pprint
import pickle
import re
import sys
import warnings
import inspect
from copy import deepcopy
from test import support
import unittest
from .support import (
TestEquality, TestHashing, LoggingResult,
ResultWithNoStartTestRunStopTestRun
)
class Test(object):
"Keep these TestCa... | lgpl-3.0 |
cloudbase/cinder | cinder/tests/unit/api/v3/test_messages.py | 5 | 5249 | # 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
# d... | apache-2.0 |
MattRijk/django-ecomsite | lib/python2.7/site-packages/django/core/servers/fastcgi.py | 241 | 6638 | """
FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.
Uses the flup python package: http://www.saddi.com/software/flup/
This is a adaptation of the flup package to add FastCGI server support
to run Django apps from Web servers that support the FastCGI protocol.
This module can be run standalo... | cc0-1.0 |
ProfessorX/Emacs-Laptop | elpa/anaconda-mode-20140916.600/jedi/evaluate/compiled/__init__.py | 17 | 13463 | """
Imitate the parser representation.
"""
import inspect
import re
import sys
import os
from jedi._compatibility import builtins as _builtins, unicode
from jedi import debug
from jedi.cache import underscore_memoization, memoize
from jedi.evaluate.sys_path import get_sys_path
from jedi.parser.representation import Pa... | gpl-2.0 |
firerszd/kbengine | kbe/src/lib/python/Lib/aifc.py | 83 | 31494 | """Stuff to parse AIFF-C and AIFF files.
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.
An AIFF-C file has the following structure.
+-----------------+
| FORM |
+-----------------+
| <size> |
+----+------------+
| | AIFC ... | lgpl-3.0 |
matsengrp/bioboxpartis | packages/ighutil/python/vdjalign/_version.py | 3 | 8543 |
IN_LONG_VERSION_PY = True
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (build by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter f... | gpl-3.0 |
grimmjow8/ansible | lib/ansible/utils/module_docs_fragments/validate.py | 366 | 1146 | # Copyright (c) 2015 Ansible, Inc
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansi... | gpl-3.0 |
juanalfonsopr/odoo | addons/survey_crm/__openerp__.py | 312 | 1593 | # -*- 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... | agpl-3.0 |
bobwalker99/Pydev | plugins/org.python.pydev.jython/Lib/encodings/cp858.py | 416 | 34271 | """ Python Character Mapping Codec for CP858, modified from cp850.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decod... | epl-1.0 |
blueyed/pip | pip/_vendor/requests/packages/chardet/constants.py | 3008 | 1335 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | mit |
acsone/odoo | addons/account/res_config.py | 40 | 25488 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
tjlaboss/openmc | openmc/lib/tally.py | 8 | 13615 | from collections.abc import Mapping
from ctypes import c_int, c_int32, c_size_t, c_double, c_char_p, c_bool, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
import scipy.stats
from openmc.exceptions import AllocationError, InvalidIDError
from openmc.data.reactio... | mit |
boa19861105/Butterfly-S-Sense-4.4.3 | scripts/build-all.py | 1250 | 9474 | #! /usr/bin/env python
# Copyright (c) 2009-2011, Code Aurora Forum. 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
# n... | gpl-2.0 |
lglenat/whmnet | RaspberryPi/readGateway.py | 1 | 12588 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
readGateway.py script
=====================
This script is used in the whmnet project to receive data from the
wireless network gateway and send it to a custom server on the web.
This script is run on a Raspberry Pi, connected to the Gateway
throu... | gpl-3.0 |
marcoantoniooliveira/labweb | oscar/lib/python2.7/site-packages/werkzeug/contrib/cache.py | 146 | 23519 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.cache
~~~~~~~~~~~~~~~~~~~~~~
The main problem with dynamic Web sites is, well, they're dynamic. Each
time a user requests a page, the webserver executes a lot of code, queries
the database, renders templates until the visitor gets the page he sees.
... | bsd-3-clause |
umairghani/py-jrpc | build/lib/jrpc/jrpcClient/SimpleTCPClient.py | 2 | 2711 | import json
import urllib2
import urlparse
import SimpleTCPClientException
from Method import _Method
__author__ = 'umairghani'
class SimpleTCPClient(object):
"""
Client class for a logical connection
to the TCP Server
"""
def __init__(self, host, port=80, ssl=False):
"""
Constr... | mit |
eepalms/gem5-newcache | src/arch/x86/isa/insts/x87/control/clear_exceptions.py | 91 | 2159 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
ISRyuu/ISNNTF | test.py | 1 | 3957 | import numpy as np
def iou(box_1, box_2):
box_1_ulx = box_1[0] - box_1[2] * 0.5
box_1_uly = box_1[1] - box_1[3] * 0.5
box_1_lrx = box_1[0] + box_1[2] * 0.5
box_1_lry = box_1[1] + box_1[3] * 0.5
box_2_ulx = box_2[0] - box_2[2] * 0.5
box_2_uly = box_2[1] - box_2[3] * 0.5
box_2_lrx = box_2[... | bsd-3-clause |
canaryhealth/nlu_trainer | nlu_trainer/util.py | 1 | 1186 | # -*- coding: utf-8 -*-
import re
def phrase_index(sentence, phrase):
'''
Returns the start and end index of phrase (first instance) if it exists in
sentence.
ex: >>> phrase_index('the quick brown fox jumps over the lazy dog',
'brown fox jumps')
(10, 24)
'''
phrase = str... | mit |
mttr/django | tests/test_client_regress/urls.py | 352 | 2521 | from django.conf.urls import include, url
from django.views.generic import RedirectView
from . import views
urlpatterns = [
url(r'', include('test_client.urls')),
url(r'^no_template_view/$', views.no_template_view),
url(r'^staff_only/$', views.staff_only_view),
url(r'^get_view/$', views.get_view),
... | bsd-3-clause |
delta2323/chainer | tests/chainer_tests/testing_tests/test_parameterized.py | 8 | 1837 | import unittest
from chainer import testing
@testing.parameterize(
{'actual': {'a': [1, 2], 'b': [3, 4, 5]},
'expect': [{'a': 1, 'b': 3}, {'a': 1, 'b': 4}, {'a': 1, 'b': 5},
{'a': 2, 'b': 3}, {'a': 2, 'b': 4}, {'a': 2, 'b': 5}]},
{'actual': {'a': [1, 2]}, 'expect': [{'a': 1}, {'a': 2}]},... | mit |
bensternthal/bedrock | bedrock/security/tests/test_views.py | 16 | 7643 | # 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 django.test import RequestFactory
from mock import patch, Mock
from nose.tools import eq_, ok_
from product_details... | mpl-2.0 |
4eek/edx-platform | common/test/acceptance/pages/lms/auto_auth.py | 66 | 3293 | """
Auto-auth page (used to automatically log in during testing).
"""
import re
import urllib
from bok_choy.page_object import PageObject, unguarded
from . import AUTH_BASE_URL
class AutoAuthPage(PageObject):
"""
The automatic authorization page.
When allowed via the django settings file, visiting
th... | agpl-3.0 |
Lujeni/ansible | lib/ansible/modules/network/nxos/nxos_reboot.py | 18 | 2450 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
MicBrain/cvmfs | python/cvmfs/history.py | 2 | 2111 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
import datetime
from _common import DatabaseObject
class RevisionTag:
""" Specific revisions in CernVM-FS 2.1.x repositories have named tags """
@staticmethod
def sql... | bsd-3-clause |
holycrepe/anki | aqt/errors.py | 16 | 3576 | # Copyright: Damien Elmes <anki@ichi2.net>
# -*- coding: utf-8 -*-
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
import cgi
from anki.lang import _
from aqt.qt import *
from aqt.utils import showText, showWarning
class ErrorHandler(QObject):
"Catch stderr and write into... | agpl-3.0 |
bwencke/eastmonroe | lib/werkzeug/contrib/testtools.py | 319 | 2449 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.testtools
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements extended wrappers for simplified testing.
`TestResponse`
A response wrapper which adds various cached attributes for
simplified assertions on various content types.
:copyright:... | apache-2.0 |
crafty78/ansible | lib/ansible/module_utils/redhat.py | 78 | 10206 | # 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 complete wo... | gpl-3.0 |
Denisolt/Tensorflow_Chat_Bot | local/lib/python2.7/site-packages/tensorflow/python/training/training.py | 6 | 11555 | # 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... | gpl-3.0 |
darkleons/BE | addons/report_webkit/wizard/report_webkit_actions.py | 382 | 6537 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Vincent Renaville
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the... | agpl-3.0 |
TobyRoseman/SFrame | cxxtest/test/test_cxxtest.py | 44 | 35206 | #-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of ... | bsd-3-clause |
lancezlin/ml_template_py | lib/python2.7/site-packages/terminado/management.py | 7 | 11358 | """Terminal management for exposing terminals to a web interface using Tornado.
"""
from __future__ import absolute_import, print_function
import sys
if sys.version_info[0] < 3:
byte_code = ord
else:
byte_code = lambda x: x
unicode = str
from collections import deque
import itertools
import logging
import... | mit |
kevinxw/namebench | tools/convert_servers_to_csv.py | 174 | 3169 | #!/usr/bin/env python
# Copyright 2009 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... | apache-2.0 |
dprog-philippe-docourt/django-qr-code | setup.py | 1 | 1589 | import re
from setuptools import setup
# Get version without importing
with open('qr_code/__init__.py', 'rb') as f:
VERSION = str(re.search('__version__ = \'(.+?)\'', f.read().decode('utf-8')).group(1))
setup(
name='django-qr-code',
version=VERSION,
packages=['qr_code', 'qr_code.qrcode', 'qr_code.tem... | bsd-3-clause |
Troyhy/django-registration | registration/models.py | 20 | 10561 | import datetime
import hashlib
import random
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
try:
from d... | bsd-3-clause |
adazey/Muzez | libs/youtube_dl/extractor/trutv.py | 52 | 2002 | # coding: utf-8
from __future__ import unicode_literals
import re
from .turner import TurnerBaseIE
class TruTVIE(TurnerBaseIE):
_VALID_URL = r'https?://(?:www\.)?trutv\.com(?:(?P<path>/shows/[^/]+/videos/[^/?#]+?)\.html|/full-episodes/[^/]+/(?P<id>\d+))'
_TEST = {
'url': 'http://www.trutv.com/shows/... | gpl-3.0 |
team-vigir/vigir_behavior_synthesis | vigir_ltl_synthesizer/src/vigir_ltl_synthesizer/StructuredSlugsParser/compiler.py | 3 | 29068 | #!/usr/bin/python
#
# Translates a structured specification into an unstructured one that is suitable to be read by the slugs synthesis tool
import math
import os
import sys
import resource
import subprocess
import signal
from Parser import Parser
from re import match
import StringIO
# ===============================... | bsd-3-clause |
40223220/worktogether | static/Brython3.1.1-20150328-091302/Lib/base64.py | 733 | 13975 | #! /usr/bin/env python3
"""RFC 3548: Base16, Base32, Base64 Data Encodings"""
# Modified 04-Oct-1995 by Jack Jansen to use binascii module
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
# Modified 22-May-2007 by Guido van Rossum to use bytes everywhere
import re
import struct
import binascii
_... | gpl-3.0 |
TiVo/samza | samza-test/src/main/python/integration_tests.py | 25 | 1141 | # 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... | apache-2.0 |
jbeich/Aquaria | ExternalLibs/freetype2/src/tools/docmaker/tohtml.py | 395 | 18731 | # ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008
# David Turner <david@freetype.org>
from sources import *
from content import *
from formatter import *
import time
# The following defines the HTML header used by all generated pages.
html_header_1 = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional/... | gpl-2.0 |
Meriipu/quodlibet | quodlibet/packages/raven/context.py | 13 | 3769 | """
raven.context
~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from collections import Mapping, Iterable
from threading import local
from weakref import ref as weakref
from raven.utils... | gpl-2.0 |
rajsadho/django | tests/gis_tests/gdal_tests/test_srs.py | 304 | 11694 | import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.gdal import SpatialReference, CoordTransform, GDALException, SRSException
class TestSRS:
def __init__(self, wkt, **kwargs):
self.wkt = wkt
for key, value in kwarg... | bsd-3-clause |
PyPlanet/PyPlanet | pyplanet/conf/backends/python.py | 1 | 1598 | import importlib
import os
from pyplanet.conf.backends.base import ConfigBackend
from pyplanet.core.exceptions import ImproperlyConfigured
class PythonConfigBackend(ConfigBackend):
name = 'python'
def __init__(self, **options):
super().__init__(**options)
self.module = None
def load(self):
# Make sure we... | gpl-3.0 |
ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtCore/__init__/QMetaMethod.py | 2 | 4241 | # encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so
# by generator 1.135
# no doc
# imports
import sip as __sip
class QMetaMethod(): # skipped bases: <type 'sip.simplewrapper'>
"""
QMetaMethod()
QMetaMethod(QMetaMethod)
"""
def access(self): # real sign... | gpl-2.0 |
keis/smoke | tests/test_mixed.py | 1 | 1963 | import pytest
import mock
from hamcrest import assert_that
from matchmock import called_once_with
from smoke import signal, Broker
class Source(object):
spam = signal()
egg = signal(name='egg')
class Mixed(Source, Broker):
pass
@pytest.fixture
def listener():
return mock.Mock()
@pytest.fixture
d... | mit |
daltonmaag/brotli | tools/rfc-format.py | 99 | 2111 | #!/usr/bin/python
#
# Takes an .nroff source file and prints a text file in RFC format.
#
# Usage: rfc-format.py <source file>
import re
import sys
from subprocess import Popen, PIPE
def Readfile(fn):
f = open(fn, "r")
return f.read()
def FixNroffOutput(buf):
p = re.compile(r'(.*)FORMFEED(\[Page\s+\d+\])$')
... | apache-2.0 |
SaM-Solutions/samba | source4/heimdal/lib/wind/util.py | 88 | 1978 | #!/usr/local/bin/python
# -*- coding: iso-8859-1 -*-
# $Id$
# Copyright (c) 2004 Kungliga Tekniska Högskolan
# (Royal Institute of Technology, Stockholm, Sweden).
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following... | gpl-3.0 |
AladdinSonni/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/net/regressionwindow.py | 165 | 2381 | # Copyright (C) 2010 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 ... | bsd-3-clause |
laginimaineb/android_fde_bruteforce | structures.py | 1 | 2262 | import struct
from StringIO import StringIO
#The crypt_mnt_ftr structure - see /system/vold/cryptfs.h
CRYPT_MNT_FTR = [('magic' , 'I'),
('major_version' , 'H'),
('minor_version' , 'H'),
('ftr_size' , 'I'),
('flags' , 'I'),
... | gpl-2.0 |
mahak/ansible | lib/ansible/inventory/helpers.py | 120 | 1293 | # (c) 2017, Ansible by RedHat Inc,
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ans... | gpl-3.0 |
chaluemwut/fbserver | venv/lib/python2.7/site-packages/scipy/ndimage/tests/test_ndimage.py | 9 | 199791 | # Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 and the following d... | apache-2.0 |
isabernardes/Heriga | Herigaenv/lib/python2.7/site-packages/django/contrib/auth/management/commands/changepassword.py | 136 | 2610 | from __future__ import unicode_literals
import getpass
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT... | mit |
windweaver828/kspeech | commandtools.py | 1 | 1026 | #!/usr/bin/env python
def isCommand(command, args):
index = 0
for arg in args:
if isinstance(arg, list):
for ar in arg:
if isinstance(ar, list):
for a in ar:
if isinstance(a, list):
index-=1
... | gpl-2.0 |
GitAngel/django | tests/template_tests/filter_tests/test_escape.py | 324 | 1495 | from django.template.defaultfilters import escape
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class EscapeTests(SimpleTestCase):
"""
The "escape" filter works the same whether autoescape is on or off,
but it has no effect on strings alrea... | bsd-3-clause |
welenofsky/python_koans | python3/libs/colorama/winterm.py | 523 | 4206 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from . import win32
# from wincon.h
class WinColor(object):
BLACK = 0
BLUE = 1
GREEN = 2
CYAN = 3
RED = 4
MAGENTA = 5
YELLOW = 6
GREY = 7
# from wincon.h
class WinStyle(object):
NORMAL = 0... | mit |
ohmu/kafka-python | kafka/admin/new_topic.py | 8 | 1306 | from __future__ import absolute_import
from kafka.errors import IllegalArgumentError
class NewTopic(object):
""" A class for new topic creation
Arguments:
name (string): name of the topic
num_partitions (int): number of partitions
or -1 if replica_assignment has been specified
... | apache-2.0 |
gooddata/openstack-nova | nova/tests/unit/cmd/test_scheduler.py | 2 | 2547 | # 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 the... | apache-2.0 |
ryfeus/lambda-packs | Rasterio_osgeo_shapely_PIL_pyproj_numpy/source/numpy/polynomial/chebyshev.py | 30 | 62880 | """
Objects for dealing with Chebyshev series.
This module provides a number of objects (mostly functions) useful for
dealing with Chebyshev series, including a `Chebyshev` class that
encapsulates the usual arithmetic operations. (General information
on how this module represents and works with such polynomials is in... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.