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 |
|---|---|---|---|---|---|
Nexenta/cinder | cinder/zonemanager/drivers/brocade/brcd_fc_zone_connector_factory.py | 13 | 3195 | # (c) Copyright 2015 Brocade Communications Systems 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/LICEN... | apache-2.0 |
ProfessionalIT/professionalit-webiste | sdk/google_appengine/lib/django-1.2/django/core/files/uploadhandler.py | 236 | 7028 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import TemporaryUplo... | lgpl-3.0 |
georgemarshall/django | tests/db_functions/math/test_cos.py | 57 | 2271 | import math
from decimal import Decimal
from django.db.models import DecimalField
from django.db.models.functions import Cos
from django.test import TestCase
from django.test.utils import register_lookup
from ..models import DecimalModel, FloatModel, IntegerModel
class CosTests(TestCase):
def test_null(self):
... | bsd-3-clause |
spirosmastorakis/ndnSIM2-refactored | bindings/modulegen__gcc_ILP32.py | 46 | 17626 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
from pybindgen.typehandlers.smart_ptr import StdSharedPtr
from ns3_ptr import Ns3PtrMemoryPolicy
import pybindgen.settings
import warnings
import sys
def module_init():
root_module = Module('ns.ndnSIM', cpp_namespace='::ns3')
... | gpl-3.0 |
revanthkolli/osf.io | tests/test_metadata.py | 27 | 1207 | # -*- coding: utf-8 -*-
'''Unit tests for models and their factories.'''
import unittest
from nose.tools import * # PEP8 asserts
from framework.forms.utils import process_payload
from website.project.model import MetaSchema
from website.project.model import ensure_schemas
from website.project.metadata.schemas import... | apache-2.0 |
bugsnag/bugsnag-python | bugsnag/sessiontracker.py | 1 | 4934 | from copy import deepcopy
from uuid import uuid4
from time import strftime, gmtime
from threading import Lock, Timer
from typing import List, Dict, Callable
import atexit
try:
from contextvars import ContextVar
_session_info = ContextVar('bugsnag-session', default={}) # type: ignore
except ImportError:
fr... | mit |
masters3d/coursebuilder-masters3d | modules/dashboard/question_group_editor.py | 4 | 8077 | # 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 ... | apache-2.0 |
XiaodunServerGroup/medicalmooc | common/djangoapps/util/tests/test_sandboxing.py | 35 | 1212 | """
Tests for sandboxing.py in util app
"""
from django.test import TestCase
from util.sandboxing import can_execute_unsafe_code
from django.test.utils import override_settings
class SandboxingTest(TestCase):
"""
Test sandbox whitelisting
"""
@override_settings(COURSES_WITH_UNSAFE_CODE=['edX/full/.*'... | agpl-3.0 |
KohlsTechnology/ansible | lib/ansible/plugins/callback/stderr.py | 59 | 3194 | # (c) 2017, Frederic Van Espen <github@freh.be>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callbac... | gpl-3.0 |
ojengwa/odoo | addons/hr_holidays/__init__.py | 442 | 1094 | # -*- 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 |
Emergya/icm-openedx-educamadrid-platform-basic | lms/djangoapps/courseware/tests/helpers.py | 46 | 6508 | import json
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from courseware.access import has_access
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from student.m... | agpl-3.0 |
sunze/py_flask | venv/lib/python3.4/site-packages/celery/tests/backends/test_rpc.py | 8 | 2317 | from __future__ import absolute_import
from celery.backends.rpc import RPCBackend
from celery._state import _task_stack
from celery.tests.case import AppCase, Mock, patch
class test_RPCBackend(AppCase):
def setup(self):
self.b = RPCBackend(app=self.app)
def test_oid(self):
oid = self.b.oid... | mit |
jodosh/MP4GS | python/CameraCalibration/calculateMatrixValuesLeft.py | 2 | 1979 | import numpy as np
import cv2
import glob
# termination criteria
criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 100, .01)
goodImages = 0
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
objp = np.zeros((3*4,3), np.float32)
objp[:,:2] = np.mgrid[0:4,0:3].T.reshape(-1,2)
# Arrays to s... | bsd-3-clause |
SlimRoms/android_external_chromium_org | tools/site_compare/scrapers/firefox/firefox2.py | 189 | 6725 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Does scraping for Firefox 2.0."""
import pywintypes
import time
import types
from drivers import keyboard
from drivers import ... | bsd-3-clause |
zachjanicki/osf.io | tests/framework_tests/test_email.py | 26 | 2676 | # -*- coding: utf-8 -*-
import unittest
import smtplib
import mock
from nose.tools import * # flake8: noqa (PEP8 asserts)
import sendgrid
from framework.email.tasks import send_email, _send_with_sendgrid
from website import settings
from tests.base import fake
# Check if local mail server is running
SERVER_RUNNING ... | apache-2.0 |
edx/edx-platform | openedx/features/course_experience/__init__.py | 3 | 6887 | """
Unified course experience settings and helper methods.
"""
import crum
from django.utils.translation import ugettext as _
from edx_django_utils.monitoring import set_custom_attribute
from waffle import flag_is_active # lint-amnesty, pylint: disable=invalid-django-waffle-import
from edx_toggles.toggles import Lega... | agpl-3.0 |
eagle00789/PythonMiniProbe | miniprobe/miniprobe.py | 2 | 5761 | #!/usr/bin/env python
# Copyright (c) 2014, Paessler AG <support@paessler.com>
# 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 not... | bsd-3-clause |
BirchJD/RPiTimer | PiTimer_Step-4/Schedule.py | 1 | 5941 | # PiTimer - Python Hardware Programming Education Project For Raspberry Pi
# Copyright (C) 2015 Jason Birch
#
# 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
... | gpl-3.0 |
todaychi/hue | desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Util/py3compat.py | 145 | 3912 | # -*- coding: utf-8 -*-
#
# Util/py3compat.py : Compatibility code for handling Py3k / Python 2.x
#
# Written in 2010 by Thorsten Behrens
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the publi... | apache-2.0 |
PaulieC/sprint5-Council | AvailableTournaments/AllPlayAll.py | 2 | 1192 | __author__ = "Paul Council, Anand Patel"
__version__ = "sprint1"
__credits__ = ["William Ezekiel"]
# imports
from ServerPackage.Tournament import *
class AllPlayAll(Tournament):
""" AllPlayAll Tournament Type, every player is in a match with every other player """
def __init__(self):
"""
Ini... | apache-2.0 |
eLRuLL/scrapy | scrapy/utils/serialize.py | 29 | 1201 | import json
import datetime
import decimal
from twisted.internet import defer
from scrapy.http import Request, Response
from scrapy.item import BaseItem
class ScrapyJSONEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, o):
if isinstance(o, set):
... | bsd-3-clause |
ujjvala-addsol/addsol_hr | openerp/addons/payment_ogone/tests/test_ogone.py | 430 | 9309 | # -*- coding: utf-8 -*-
from lxml import objectify
import time
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment.tests.common import PaymentAcquirerCommon
from openerp.addons.payment_ogone.controllers.main import OgoneController
from openerp.tools i... | agpl-3.0 |
dweisz/pydolphot | make_fakerun.py | 1 | 2967 | import numpy as np
import sys
import subprocess
import os
'''
def makephotfiles(base, nstart, nruns, nimages):
for i in range(nstart,nstart+nruns):
for j in range(1, nimages+1):
subprocess.call("ln -s "+base+"."+np.str(j)+".res.fits " + base+"_"+np.str(i)+"."+np.str(j)+".res.fits", shell=True)
subprocess.c... | mit |
garthomp/ruby_blog | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/styles/vs.py | 364 | 1073 | # -*- coding: utf-8 -*-
"""
pygments.styles.vs
~~~~~~~~~~~~~~~~~~
Simple style with MS Visual Studio colors.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Co... | mit |
geopython/QGIS | tests/src/python/test_qgsreadwritecontext.py | 14 | 1935 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsReadWriteContext.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"... | gpl-2.0 |
Biomechanical-ToolKit/BTKCore | Testing/Python/_TDDCommon.py | 4 | 1078 | import unittest
import EventTest
import AnalogTest
import PointTest
import ForcePlatformTypesTest
import EventCollectionTest
import PointCollectionTest
import MetaDataInfoTest
import MetaDataTest
import AcquisitionTest
import WrenchTest
import IMUTypesTest
def suite():
suite = unittest.TestSuite()
suite.addTe... | bsd-3-clause |
defcello/Children-of-Eden-Synth-Server | src/data/webpages/rolandfantomxr/SRX05.py | 4 | 17998 | ####################################################################################################
# Copyright 2013 John Crawford
#
# This file is part of PatchCorral.
#
# PatchCorral is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | gpl-3.0 |
Capgemini/PyPomVisualiser | pypomvisualiser/pom/PomParser.py | 2 | 3484 | '''
Created on 31 Mar 2015
@author: WMOORHOU
'''
from xml.dom.minidom import parse
from pypomvisualiser.pom.Pom import Pom, PomDependency
from pypomvisualiser.exceptions.PyPomExceptions import PomParseError
class PomParser(object):
'''
classdocs
'''
def __init__(self):
self.pop... | mit |
collab-project/luma.cryptocurrency | luma/cryptocurrency/endpoint/coinmarketcap.py | 1 | 1134 | # -*- coding: utf-8 -*-
# Copyright (c) 2017 Thijs Triemstra and contributors
# See LICENSE.rst for details.
"""
Endpoint for coinmarketcap.com
:see: https://coinmarketcap.com/api/
"""
from datetime import datetime
from dateutil.tz.tz import tzutc
from . import Endpoint, EndpointResponse
class CoinmarketcapRespo... | mit |
rohitwaghchaure/New_Theme_Erp | erpnext/stock/doctype/stock_entry/stock_entry.py | 1 | 34617 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.utils import cstr, cint, flt, comma_or, nowdate
from frappe import _
from erpnext.stock.utils impo... | agpl-3.0 |
notforhire/Yup | src/test/bctest.py | 169 | 1476 | # Copyright 2014 BitPay, Inc.
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import subprocess
import os
import json
import sys
def bctest(testDir, testObj, exeext):
execprog = testObj['exec'] + exeext
execargs = testObj[... | mit |
sirioz/python-digitalocean | digitalocean/tests/test_certficate.py | 2 | 2679 | import json
import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestCertificate(BaseTest):
def setUp(self):
super(TestCertificate, self).setUp()
self.cert_id = '892071a0-bb95-49bc-8021-3afd67a210bf'
self.cert = digitalocean.Certificate(id=self.cert_i... | lgpl-3.0 |
localprojects/Change-By-Us | giveaminute/migrations/versions/002_Update_Need_table_with_quanitity_and_address_and_whatnot.py | 4 | 2489 | """
:copyright: (c) 2011 Local Projects, all rights reserved
:license: Affero GNU GPL v3, see LICENSE for more details.
"""
from sqlalchemy import *
from migrate import *
def upgrade(migrate_engine):
# Upgrade operations go here. Don't create your own engine; bind migrate_engine
# to your metadata
... | agpl-3.0 |
reyrodrigues/EU-SMS | temba/contacts/migrations/0031_contactfield_audit_fields.py | 2 | 1975 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.timezone import utc
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL... | agpl-3.0 |
kyroskoh/phantomjs | src/breakpad/src/tools/gyp/pylib/gyp/MSVSNew.py | 138 | 11514 | #!/usr/bin/python2.4
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""New implementation of Visual Studio project generation for SCons."""
import common
import os
import random
# hashlib is supplied as of P... | bsd-3-clause |
FlaPer87/django-nonrel | django/contrib/sessions/tests.py | 27 | 9749 | r"""
>>> from django.conf import settings
>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession
>>> from django.contrib.sessions.backends.cached_db import SessionStore as CacheDBSession
>>> from django.con... | bsd-3-clause |
laonawuli/addrest | web2py/gluon/contrib/login_methods/oneall_account.py | 33 | 4559 | #!/usr/bin/env python
# coding: utf8
"""
Oneall Authentication for web2py
Developed by Nathan Freeze (Copyright © 2013)
Email <nathan@freezable.com>
This file contains code to allow using onall.com
authentication services with web2py
"""
import os
import base64
from gluon import *
from gluon.storage i... | mit |
antivirtel/Flexget | flexget/plugins/urlrewrite_torrentleech.py | 6 | 6852 | from __future__ import unicode_literals, division, absolute_import
import re
import urllib
import logging
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.entry import Entry
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexg... | mit |
TheTypoMaster/chromium-crosswalk | third_party/cython/src/Cython/Compiler/TreeFragment.py | 96 | 8733 | #
# TreeFragments - parsing of strings to trees
#
import re
from StringIO import StringIO
from Scanning import PyrexScanner, StringSourceDescriptor
from Symtab import ModuleScope
import PyrexTypes
from Visitor import VisitorTransform
from Nodes import Node, StatListNode
from ExprNodes import NameNode
import Parsing
im... | bsd-3-clause |
aabbox/kbengine | kbe/src/lib/python/Lib/ctypes/test/test_anon.py | 264 | 2051 | import unittest
from ctypes import *
class AnonTest(unittest.TestCase):
def test_anon(self):
class ANON(Union):
_fields_ = [("a", c_int),
("b", c_int)]
class Y(Structure):
_fields_ = [("x", c_int),
("_", ANON),
... | lgpl-3.0 |
frankrousseau/weboob | modules/cci/module.py | 7 | 1691 | # -*- coding: utf-8 -*-
# Copyright(C) 2013 Bezleputh
#
# 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... | agpl-3.0 |
LChristakis/chalice-hunter | lib/python3.4/site-packages/gunicorn/workers/sync.py | 54 | 7036 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
#
from datetime import datetime
import errno
import os
import select
import socket
import ssl
import sys
import gunicorn.http as http
import gunicorn.http.wsgi as wsgi
import gunicorn.util as... | mit |
dhanunjaya/neutron | neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py | 3 | 128050 | # 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... | apache-2.0 |
cmelange/ansible | lib/ansible/playbook/helpers.py | 31 | 15606 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | gpl-3.0 |
HonzaKral/django | tests/migrations/test_multidb.py | 366 | 6909 | import unittest
from django.db import connection, migrations, models
from django.db.migrations.state import ProjectState
from django.test import override_settings
from .test_operations import OperationTestBase
try:
import sqlparse
except ImportError:
sqlparse = None
class AgnosticRouter(object):
"""
... | bsd-3-clause |
pumanzor/iot-redlibre | linkit/stepmotor.py | 6 | 2151 | #!/usr/bin/python
# Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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, inclu... | mit |
zulip/zulip | zerver/lib/markdown/api_return_values_table_generator.py | 2 | 9063 | import copy
import json
import re
from typing import Any, Dict, List, Mapping, Optional
import markdown
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
from zerver.openapi.openapi import check_deprecated_consistency, get_openapi_return_values
from .api_arguments_table_genera... | apache-2.0 |
antepsis/anteplahmacun | sympy/ntheory/tests/test_egyptian_fraction.py | 51 | 1886 | from sympy.core.numbers import Rational
from sympy.ntheory.egyptian_fraction import egyptian_fraction
from sympy.core.add import Add
from sympy.utilities.pytest import raises
from sympy.utilities.randtest import random_complex_number
def test_egyptian_fraction():
def test_equality(r, alg="Greedy"):
return... | bsd-3-clause |
thp44/delphin_6_automation | data_process/2d_1d/archieve/moisture_content_comparison.py | 1 | 18274 | __author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import pandas as pd
import matplotlib.pyplot as plt
# RiBuild Modules
# -----------------------------------------------... | mit |
kingvuplus/Gui3 | lib/python/Plugins/newplugin.py | 90 | 3448 | #!/usr/bin/python
import os
os.system("clear")
internalname = raw_input("Internal plugin name (no whitespaces, plugin directory): ")
name = raw_input("Visible plugin name: ")
print
os.system("clear")
dirlist = []
count = 0
print "Plugin categories:"
for dir in os.listdir("."):
if os.path.isdir(dir):
count += 1
... | gpl-2.0 |
ernesto-g/micropython | tests/wipy/wlan/wlan.py | 66 | 4116 | '''
WLAN test for the CC3200 based boards.
'''
from network import WLAN
import os
import time
import testconfig
mch = os.uname().machine
if not 'LaunchPad' in mch and not 'WiPy' in mch:
raise Exception('Board not supported!')
def wait_for_connection(wifi, timeout=10):
while not wifi.isconnected() and timeou... | mit |
Lafunamor/ns3 | .waf-1.7.13-5a064c2686fe54de4e11018d22148cfc/waflib/Tools/waf_unit_test.py | 267 | 3438 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os,sys
from waflib.TaskGen import feature,after_method
from waflib import Utils,Task,Logs,Options
testlock=Utils.threading.Lock()
@feature('test')
@after_method('apply_... | gpl-2.0 |
janezhango/BigDataMachineLearning | py/testdir_single_jvm/test_parse_header_rows_mismatch_fvec.py | 2 | 3846 | import unittest, time, sys, random
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_import as h2i
import h2o_browse as h2b
def write_syn_dataset(csvPathname, rowCount, headerData, rList):
dsf = open(csvPathname, "w+")
dsf.write(headerData + "\n")
for i in range(rowCount):
#... | apache-2.0 |
smartforceplus/SmartForceplus | addons/portal/__openerp__.py | 250 | 2271 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
bloff/ZeroNet | src/Config.py | 1 | 11857 | import argparse
import sys
import os
import ConfigParser
class Config(object):
def __init__(self, argv):
self.version = "0.3.1"
self.rev = 307
self.argv = argv
self.action = None
self.createParser()
self.createArguments()
def createParser(self):
# Crea... | gpl-2.0 |
md5555/S6-UniKernel | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
morissette/devopsdays-hackathon-2016 | venv/lib/python2.7/site-packages/pip/_vendor/cachecontrol/heuristics.py | 490 | 4141 | import calendar
import time
from email.utils import formatdate, parsedate, parsedate_tz
from datetime import datetime, timedelta
TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
def expire_after(delta, date=None):
date = date or datetime.now()
return date + delta
def datetime_to_header(dt):
return formatdate(c... | gpl-3.0 |
kalahbrown/HueBigSQL | desktop/core/ext-py/Django-1.6.10/tests/custom_managers_regress/tests.py | 150 | 2212 | from __future__ import absolute_import
from django.test import TestCase
from .models import RelatedModel, RestrictedModel, OneToOneRestrictedModel
class CustomManagersRegressTestCase(TestCase):
def test_filtered_default_manager(self):
"""Even though the default manager filters out some records,
... | apache-2.0 |
elelianghh/gunicorn | examples/frameworks/django/testing/testing/apps/someapp/views.py | 22 | 1628 | # Create your views here.
import csv
import io
import os
from django import forms
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
import tempfile
class MsgForm(forms.Form):
subject = forms.CharField(max_length=100)
message = forms... | mit |
edx/edx-platform | openedx/core/djangoapps/user_api/partition_schemes.py | 4 | 4663 | """
Provides partition support to the user service.
"""
import logging
import random
from eventtracking import tracker
import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
from xmodule.partitions.partitions import NoSuchUserPartitionGroupError, UserPartitionError
log = logging.getLogger(__name_... | agpl-3.0 |
MaT1g3R/YasenBaka | cogs/moderation.py | 1 | 3215 | from discord import DiscordException, Forbidden, HTTPException
from discord.ext import commands
from discord.ext.commands import Context
from bot import Yasen
from scripts.checks import has_manage_message, is_admin, no_pm
from scripts.discord_utils import leading_members
from scripts.helpers import parse_number
clas... | apache-2.0 |
chouseknecht/ansible | lib/ansible/plugins/doc_fragments/shell_common.py | 79 | 1833 | # Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# common shelldocumentation fragment
DOCUMENTATION = """
options:
remote_tmp:
description:
- Temporary directory to use on targets whe... | gpl-3.0 |
t794104/ansible | test/sanity/validate-modules/main.py | 11 | 69396 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Matt Martz <matt@sivel.net>
# Copyright (C) 2015 Rackspace US, Inc.
#
# 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... | gpl-3.0 |
schumi2004/NOT_UPDATED_Sick-Beard-Dutch | lib/trakt/__init__.py | 49 | 1728 | import urllib2
from hashlib import sha1
try:
import json
except ImportError:
from lib import simplejson as json
def TraktCall(method, api, username, password, data = {}):
"""
A generic method for communicating with trakt. Uses the method and data provided along
with the auth info to send the com... | gpl-3.0 |
Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/distutils/tests/test_filelist.py | 127 | 10078 | """Tests for distutils.filelist."""
import os
import re
import unittest
from distutils import debug
from distutils.log import WARN
from distutils.errors import DistutilsTemplateError
from distutils.filelist import glob_to_re, translate_pattern, FileList
from test.test_support import captured_stdout, run_unittest
from ... | mit |
ceroytres/cat_nets | cat_nets/datasets/read_pets.py | 1 | 1970 | from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import tensorflow as tf
import csv
def catClassification_loader(path):
cat_names = ['Abyssinian','Bengal','Birman','Bombay','British_Shorthair',
'Egyptian_Mau','Maine_Coon','P... | mit |
boooka/GeoPowerOff | venv/lib/python2.7/site-packages/django/db/utils.py | 15 | 11769 | from importlib import import_module
import os
import pkgutil
from threading import local
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.deprecation import RemovedInDjango18Warning, RemovedInDjango19Warning
from django.utils.functional import c... | apache-2.0 |
grpc/grpc | examples/python/data_transmission/demo_pb2.py | 13 | 5424 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: demo.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import... | apache-2.0 |
unigent/OpenWrt-Firefly-SDK | staging_dir/host/lib/scons-2.3.1/SCons/Tool/MSCommon/common.py | 6 | 9240 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
#
# 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... | gpl-2.0 |
skrueger111/zazzie | src/sassie/calculate/old_sascalc/sascalc_library/setup_sascalc_library.py | 2 | 3175 | from __future__ import print_function
# System imports
from distutils.core import *
import os, platform
os_type = platform.system()
#os.environ["CC"] = "g++"
cpp_library_name = 'sascalc'
cuda_library_name = 'cudaSascalc'
if os_type == "Darwin":
cuda_dir = os.path.join(os.path.sep,'usr','local','cuda')
elif os_t... | gpl-3.0 |
tejal29/pants | src/python/pants/backend/jvm/tasks/specs_run.py | 1 | 3288 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from twitter.common.... | apache-2.0 |
tvalacarta/tvalacarta | python/main-classic/lib/youtube_dl/extractor/apa.py | 20 | 3173 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
js_to_json,
url_or_none,
)
class APAIE(InfoExtractor):
_VALID_URL = r'https?://[^/]+\.apa\.at/embed/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})... | gpl-3.0 |
miaecle/deepchem | devtools/archive/jenkins/generate_graph.py | 2 | 5220 | import csv
import os
import numpy as np
import matplotlib.pyplot as plt
import time
plt.switch_backend('agg')
TODO = {
('tox21', 'random'): [
'weave', 'graphconv', 'tf', 'tf_robust', 'irv', 'xgb', 'logreg',
'textcnn'
],
('clintox', 'random'): [
'weave', 'graphconv', 'tf', 'tf_robust... | mit |
cyberark-bizdev/ansible | lib/ansible/modules/cloud/misc/rhevm.py | 16 | 51635 | #!/usr/bin/python
# (c) 2016, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
# 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 |
emidln/django_roa | env/lib/python2.7/site-packages/django/contrib/localflavor/id/id_choices.py | 439 | 3217 | import warnings
from django.utils.translation import ugettext_lazy as _
# Reference: http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia
# Indonesia does not have an official Province code standard.
# I decided to use unambiguous and consistent (some are common) 3-letter codes.
warnings.warn(
'There have been... | bsd-3-clause |
switchboardOp/ansible | lib/ansible/modules/identity/ipa/ipa_dnsrecord.py | 23 | 8076 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Abhijeet Kasurde (akasurde@redhat.com)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the... | gpl-3.0 |
47lining/ansible-modules-core | cloud/amazon/rds_param_group.py | 19 | 11052 | #!/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 distributed... | gpl-3.0 |
sclabs/sccms-nonrel | django/conf/locale/lv/formats.py | 316 | 1490 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'Y. \g\a\d\a j. F'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = r'Y. \g\a\d\a ... | bsd-3-clause |
rwgdrummer/maskgen | setuptools-version/setuptools_maskgen_version.py | 1 | 1613 | from pkg_resources import get_distribution
from subprocess import check_output
import requests
import json
repos = 'rwgdrummer/maskgen'
giturl = 'https://api.github.com/repos'
def get_commit():
url = giturl + '/' + repos + '/pulls?state=closed'
resp = requests.get(url)
if resp.status_code == requests.code... | bsd-3-clause |
hryamzik/ansible | lib/ansible/modules/cloud/openstack/os_network.py | 35 | 7411 | #!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
# 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
ANSI... | gpl-3.0 |
lmazuel/azure-sdk-for-python | azure-mgmt-machinelearningcompute/azure/mgmt/machinelearningcompute/models/storage_account_credentials.py | 2 | 1557 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
bulldy80/gyp_unofficial | test/lib/TestGyp.py | 18 | 40246 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
TestGyp.py: a testing framework for GYP integration tests.
"""
import collections
from contextlib import contextmanager
import itertools
import os
import re
... | bsd-3-clause |
edx/edx-platform | common/lib/capa/capa/correctmap.py | 5 | 7375 | # lint-amnesty, pylint: disable=missing-module-docstring
# -----------------------------------------------------------------------------
# class used to store graded responses to CAPA questions
#
# Used by responsetypes and capa_problem
class CorrectMap(object):
"""
Stores map between answer_id and response e... | agpl-3.0 |
coder-chenzhi/shadowsocks | shadowsocks/lru_cache.py | 983 | 4290 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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... | apache-2.0 |
manipopopo/tensorflow | tensorflow/contrib/mixed_precision/python/loss_scale_optimizer.py | 4 | 6828 | # 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... | apache-2.0 |
brainstorm-ai/DIGITS | tools/create_db.py | 3 | 25568 | #!/usr/bin/env python2
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
import argparse
from collections import Counter
import logging
import math
import os
import Queue
import random
import re
import shutil
import sys
import threading
import time
# Find the best implementation available
try:
... | bsd-3-clause |
rishig/zulip | zproject/urls.py | 1 | 36270 | from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.i18n import i18n_patterns
from django.http import HttpResponseBadRequest, HttpRequest, HttpResponse
from django.views.generic import TemplateView, RedirectView
from django.utils.module_loading import import_string
import os... | apache-2.0 |
omprakasha/odoo | addons/l10n_multilang/__openerp__.py | 339 | 1670 | # -*- 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 |
ilya-epifanov/ansible-modules-core | utilities/helper/accelerate.py | 90 | 27254 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, James Cammarata <jcammarata@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | gpl-3.0 |
jnovinger/django | tests/gis_tests/test_measure.py | 325 | 7363 | """
Distance and Area objects to allow for sensible and convenient calculation
and conversions. Here are some tests.
"""
import unittest
from django.contrib.gis.measure import A, D, Area, Distance
class DistanceTest(unittest.TestCase):
"Testing the Distance object"
def testInit(self):
"Testing init... | bsd-3-clause |
Solomoriah/gdmodule | demo/gddemo.py | 1 | 1024 | #!/usr/bin/env python
import gd, os, cStringIO, urllib2
os.environ["GDFONTPATH"] = "."
FONT = "Pacifico"
def simple():
im = gd.image((200, 200))
white = im.colorAllocate((255, 255, 255))
black = im.colorAllocate((0, 0, 0))
red = im.colorAllocate((255, 0, 0))
blue = im.colorAllocate((0, 0, 255))... | bsd-3-clause |
mvaled/sentry | src/sentry/integrations/vsts/search.py | 3 | 1484 | from __future__ import absolute_import
from sentry.api.bases.integration import IntegrationEndpoint
from rest_framework.response import Response
from sentry.models import Integration
class VstsSearchEndpoint(IntegrationEndpoint):
def get(self, request, organization, integration_id):
try:
int... | bsd-3-clause |
janbrohl/SimpleTAL | tests/TALTests/XMLTests/TALRepeatTestCases.py | 1 | 14925 | #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
# Copyright (c) 2016, Jan Brohl <janbrohl@t-online.de>
# All rights reserved.
# See LICENSE.txt
# Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... | bsd-3-clause |
dscorbett/pygments | pygments/lexers/mime.py | 4 | 7975 | # -*- coding: utf-8 -*-
"""
pygments.lexers.mime
~~~~~~~~~~~~~~~~~~~~
Lexer for Multipurpose Internet Mail Extensions (MIME) data.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, inclu... | bsd-2-clause |
quentinl-c/network_testing-client | app/editor.py | 1 | 2631 | from collaborator import Collaborator
import os
import random
import logging
import time
logging.basicConfig(filename=__name__ + '.log', level=logging.DEBUG)
logger = logging.getLogger(__name__)
HOME_DIR = os.getenv('HOME_DIR', '/home/')
WRITER_SELECTOR = 'ace_text-input'
READER_SELECTOR = 'ace_content'
FILTER = '[T... | gpl-3.0 |
bryanbabel/pydokan | src/pydokan/utils.py | 4 | 3926 | #coding=utf-8
__author__ = 'Frolov Evgeniy (profisphantom@gmail.com)'
__license__ = 'GNU LGPL'
__version__ = '0.1'
from common.decorator.chain import DecoratorChain
from .wrapper import DataWrapper
from .struct import FILETIME
import time
class DateTimeConvertor(object):
def __init__(self, dt):
self.dt... | gpl-3.0 |
alx-eu/django | django/utils/tree.py | 109 | 5851 | """
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node instances.
"""
# S... | bsd-3-clause |
amarjeetkapoor1/CivilOctave | sage/civilsage/views.py | 2 | 9013 | ##
# @package civilsage.views
# This module contain functions to controls veiws of django.
# It include following functions -:
# index()
# matrix()
# last()
# file()
# pdfemail()
# first_write()
# ...
# @author amarjeet kapoor
# @code importing modules
import os,threading
from django.http import HttpResponse
from dj... | mit |
jcalbert/TextBlob | textblob/decorators.py | 17 | 1085 | # -*- coding: utf-8 -*-
"""Custom decorators."""
from __future__ import absolute_import
from functools import wraps
from textblob.exceptions import MissingCorpusError
class cached_property(object):
"""A property that is only computed once per instance and then replaces
itself with an ordinary attribute. Dele... | mit |
kerr-huang/SL4A | python/src/Lib/test/test_doctest.py | 52 | 76371 | """
Test script for doctest.
"""
from test import test_support
import doctest
import warnings
# NOTE: There are some additional tests relating to interaction with
# zipimport in the test_zipimport_support test module.
######################################################################
## Sample Objects (use... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.