repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
sloria/webtest-plus | webtest_plus/response.py | 1 | 3192 | # -*- coding: utf-8 -*-
import re
from webtest import response
class TestResponse(response.TestResponse):
'''Same as WebTest's TestResponse but adds basic HTTP authentication to
``click`` and ``clickbutton``.
'''
def click(self, description=None, linkid=None, href=None,
index=None, ver... | mit |
Sushiemaster/self123 | cogs/mod.py | 1 | 7807 | import discord
import asyncio
from discord.ext import commands
from appuselfbot import bot_prefix
from cogs.utils.checks import *
'''Module for moderator commands.'''
class Mod:
def __init__(self, bot):
self.bot = bot
def are_overwrites_empty(self, overwrites):
"""There is ... | mit |
SmartDeveloperHub/agora-planner | agora/planner/tests/empty_gp_test.py | 1 | 1364 | """
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
This file is part of the Smart Developer Hub Project:
http://www.smartdeveloperhub.org
Center for Open Middleware
http://www.centeropenmiddleware.com/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=... | apache-2.0 |
clowwindy/shadowsocks-android | gfwlist/gen.py | 16 | 1519 | #!/usr/bin/python
# -*- encoding: utf8 -*-
import itertools
import math
import sys
import IPy
def main():
china_list_set = IPy.IPSet()
# for line in sys.stdin:
# line_params = line.split("|")
# if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
# conti... | gpl-3.0 |
nicklhy/mxnet | example/kaggle-ndsb1/predict_dsb.py | 52 | 2533 | # 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 |
djangogirlscodecamp/dgrsvpsite | hacks/migrations/0001_initial.py | 1 | 1813 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | gpl-2.0 |
willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/Dropbox/FilesAndMetadata/ChunkedUpload.py | 5 | 5771 | # -*- coding: utf-8 -*-
###############################################################################
#
# ChunkedUpload
# Uploads larger files to Dropbox in multiple chunks, and offers a way to resume if an upload gets interrupted.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under ... | gpl-2.0 |
rfines/PythonKoans | python2/libs/colorama/ansi.py | 527 | 1039 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
def code_to_chars(code):
return CSI + str(code) + 'm'
class AnsiCodes(object):
def __... | mit |
antonioUnina/neutron | neutron/tests/tempest/common/utils/misc.py | 60 | 3064 | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 |
percy-g2/Novathor_xperia_u8500 | 6.1.1.B.1.54/external/webkit/Tools/Scripts/webkitpy/thirdparty/simplejson/encoder.py | 62 | 13024 | """
Implementation of JSONEncoder
"""
import re
try:
from simplejson import _speedups
except ImportError:
_speedups = None
ESCAPE = re.compile(r'[\x00-\x19\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"/]|[^\ -~])')
ESCAPE_DCT = {
# escape all forward slashes to prevent </script> attack
'/': '\\/',
... | gpl-2.0 |
mr-justin/data-science-from-scratch | code/statistics.py | 60 | 5779 | from __future__ import division
from collections import Counter
from linear_algebra import sum_of_squares, dot
import math
num_friends = [100,49,41,40,25,21,21,19,19,18,18,16,15,15,15,15,14,14,13,13,13,13,12,12,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,... | unlicense |
matthappens/taskqueue | taskqueue/venv_tq/lib/python2.7/site-packages/PIL/XpmImagePlugin.py | 18 | 3086 | #
# The Python Imaging Library.
# $Id$
#
# XPM File handling
#
# History:
# 1996-12-29 fl Created
# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.7)
#
# Copyright (c) Secret Labs AB 1997-2001.
# Copyright (c) Fredrik Lundh 1996-2001.
#
# See the README file for information on usage and redistribution.
#... | mit |
mzdaniel/oh-mainline | vendor/packages/mechanize/test/test_date.py | 22 | 3546 | """Tests for ClientCookie._HTTPDate."""
import re, time
from unittest import TestCase
class DateTimeTests(TestCase):
def test_time2isoz(self):
from mechanize._util import time2isoz
base = 1019227000
day = 24*3600
assert time2isoz(base) == "2002-04-19 14:36:40Z"
assert tim... | agpl-3.0 |
alsandeep/kernel-4.4 | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 1891 | 3300 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
mrry/tensorflow | tensorflow/python/util/all_util.py | 25 | 4700 | # 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... | apache-2.0 |
oconnor663/peru | setup.py | 6 | 1710 | import os
import setuptools
import sys
# Written according to the docs at
# https://packaging.python.org/en/latest/distributing.html
project_root = os.path.dirname(__file__)
peru_sh_path = os.path.join(project_root, 'peru.sh')
module_root = os.path.join(project_root, 'peru')
version_file = os.path.join(module_root, '... | mit |
dkubiak789/OpenUpgrade | addons/report_webkit/webkit_report.py | 19 | 17015 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
# Contributor(s) : Florent Xicluna (Wingo SA)
#
# WARNING: This program as such is intended... | agpl-3.0 |
GoogleCloudPlatform/datacatalog-connectors-bi | google-datacatalog-sisense-connector/src/google/datacatalog_connectors/sisense/prepare/datacatalog_entry_factory.py | 1 | 9769 | #!/usr/bin/python
#
# 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 ag... | apache-2.0 |
doganaltunbay/odoo | addons/marketing_campaign_crm_demo/__openerp__.py | 52 | 1694 | # -*- 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 |
LePastis/pyload | module/plugins/accounts/NoPremiumPl.py | 3 | 2198 | # -*- coding: utf-8 -*-
import datetime
import hashlib
import time
from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
class NoPremiumPl(Account):
__name__ = "NoPremiumPl"
__type__ = "account"
__version__ = "0.04"
__status__ = "testing"
__d... | gpl-3.0 |
gonboy/sl4a | python/src/Demo/metaclasses/Eiffel.py | 47 | 3468 | """Support Eiffel-style preconditions and postconditions.
For example,
class C:
def m1(self, arg):
require arg > 0
return whatever
ensure Result > arg
can be written (clumsily, I agree) as:
class C(Eiffel):
def m1(self, arg):
return whatever
def m1_pre(self, arg):
... | apache-2.0 |
p4datasystems/CarnotKE | jyhton/Lib/compiler/pycodegen.py | 17 | 47714 | import imp
import os
import marshal
import struct
import sys
from cStringIO import StringIO
is_jython = sys.platform.startswith('java')
from compiler import ast, parse, walk, syntax
from compiler import misc, future, symbols
from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
SC_FREE, ... | apache-2.0 |
Arrakk-tur/SeleniumGitHub | Dz7Adminka.py | 1 | 1052 | # -*- coding: utf-8 -*-
import pytest
from selenium import webdriver
import Dz2LitecartLogin
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
wd.implicitly_wait(60)
request.addfinalizer(wd.quit)
return wd
def test_7Adminka(driver):
login = Dz2LitecartLogin.test_LitecartLogin(driver)
... | lgpl-3.0 |
eemirtekin/edx-platform | lms/djangoapps/django_comment_client/tests/mock_cs_server/mock_cs_server.py | 47 | 3960 | from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import json
from logging import getLogger
logger = getLogger(__name__)
class MockCommentServiceRequestHandler(BaseHTTPRequestHandler):
'''
A handler for Comment Service POST requests.
'''
protocol = "HTTP/1.0"
def do_POST(self):
... | agpl-3.0 |
sjlehtin/django | django/contrib/gis/db/backends/mysql/operations.py | 5 | 4077 | from django.contrib.gis.db.backends.base.adapter import WKTAdapter
from django.contrib.gis.db.backends.base.operations import (
BaseSpatialOperations,
)
from django.contrib.gis.db.backends.utils import SpatialOperator
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.geos.geometry import G... | bsd-3-clause |
almarklein/visvis.dev | backends/backend_fltk.py | 5 | 9139 | # -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" The FLTK backend.
"""
import visvis
from visvis import BaseFigure, events, constants
import fltk
KEYMAP = { fltk.FL_SHIFT: constants.... | bsd-3-clause |
foodiesgit/dogepartyd | lib/blockchain/blockr.py | 4 | 3236 | '''
blockr.io
'''
import logging
from lib import config, util
def get_host():
if config.BLOCKCHAIN_SERVICE_CONNECT:
return config.BLOCKCHAIN_SERVICE_CONNECT
else:
return 'http://tbtc.blockr.io' if config.TESTNET else 'http://btc.blockr.io'
def check():
pass
def getinfo():
result = ut... | mit |
JackDandy/SickGear | lib/hachoir_py2/parser/audio/aiff.py | 2 | 4133 | """
Audio Interchange File Format (AIFF) parser.
Author: Victor Stinner
Creation: 27 december 2006
"""
from hachoir_py2.parser import Parser
from hachoir_py2.field import (FieldSet,
UInt16, UInt32, Float80, TimestampMac32,
RawBytes, NullBytes,
... | gpl-3.0 |
spencerjanssen/Flexget | tests/test_input_sites.py | 16 | 1243 | from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase, use_vcr
class TestInputSites(FlexGetBase):
__yaml__ = """
tasks:
test_rlslog:
rlslog: http://www.rlslog.net/category/movies/dvdrip/
test_sceper:
sceper: http://sc... | mit |
salehrastani/BikeMe-mobile | node_modules/gulp-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/generator/cmake.py | 531 | 41681 | # Copyright (c) 2013 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.
"""cmake output module
This module is under development and should be considered experimental.
This module produces cmake (2.8.8+) input as its output. One CMake... | mit |
extremewaysback/django | tests/gis_tests/distapp/models.py | 259 | 1365 | from django.utils.encoding import python_2_unicode_compatible
from ..models import models
from ..utils import gisfield_may_be_null
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
... | bsd-3-clause |
vamin/MESS.DB | mess/decorators.py | 1 | 2978 | # -*- coding: utf-8 -*-
# Copyright 2013-2014 Victor Amin, http://vamin.net/
"""MESS.DB decorators module
This module contains various decorator classes and functions that are used
throughout MESS.DB.
"""
from __future__ import print_function
from __future__ import unicode_literals
import collections
import functoo... | agpl-3.0 |
kennedyshead/home-assistant | homeassistant/components/hue/__init__.py | 2 | 6494 | """Support for the Philips Hue system."""
import asyncio
import logging
from aiohue.util import normalize_bridge_id
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.components import persistent_notification
from homeassistant.helpers import config_validation as cv, device_reg... | apache-2.0 |
hdinsight/hue | desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/styles/colors.py | 14 | 3575 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import re
from openpyxl.compat import safe_string, basestring
from openpyxl.descriptors import Descriptor, Typed
from .hashable import HashableObject
from openpyxl.descriptors import String, Bool, MinMax, Integer
# Default Color Index as per 1... | apache-2.0 |
denisenkom/django-sqlserver | broken-tests/many_to_many/models.py | 21 | 1568 | """
Many-to-many relationships
To define a many-to-many relationship, use ``ManyToManyField()``.
In this example, an ``Article`` can be published in multiple ``Publication``
objects, and a ``Publication`` has multiple ``Article`` objects.
"""
from __future__ import unicode_literals
from django.db import models
from ... | mit |
btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/antecedentes_familiares/migrations/0001_initial.py | 1 | 1106 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='AntecedentesFamiliares',
fields=[
('id', models... | bsd-3-clause |
chrsrds/scikit-learn | doc/tutorial/machine_learning_map/pyparsing.py | 21 | 231059 | # module pyparsing.py
#
# Copyright (c) 2003-2016 Paul T. McGuire
#
# 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 u... | bsd-3-clause |
liqueur/jieba | test/test_lock.py | 62 | 1113 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import jieba
import threading
def inittokenizer(tokenizer, group):
print('===> Thread %s:%s started' % (group, threading.current_thread().ident))
tokenizer.initialize()
print('<=== Thread %s:%s finished' % (group, threading.current_thread().ident))
tokrs1 = [jieba.Tok... | mit |
ran5515/DeepDecision | tensorflow/python/kernel_tests/map_stage_op_test.py | 10 | 20902 | # Copyright 2017 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 |
jeffrey4l/nova | nova/tests/functional/v3/test_servers.py | 23 | 9736 | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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 |
cubrid-talks/CUBRIDPy | 2.7/CUBRIDPy/utils/helpers.py | 3 | 8092 | """
Various driver utility functions
"""
import re
import struct
import math
import datetime
from struct import unpack
def escape(str):
"""
Escape a string.
:param string str: String to escape.
"""
return re.escape(str)
def read_bytes(buf, bytes_count):
"""
Reads [byt... | gpl-2.0 |
idea4bsd/idea4bsd | python/lib/Lib/modjy/modjy_exceptions.py | 109 | 2801 | ###
#
# Copyright Alan Kennedy.
#
# You may contact the copyright holder at this uri:
#
# http://www.xhaus.com/contact/modjy
#
# The licence under which this code is released is the Apache License v2.0.
#
# The terms and conditions of this license are listed in a file contained
# in the distribution that also cont... | apache-2.0 |
noba3/KoTos | addons/script.module.beautifulsoup/lib/BeautifulSoup.py | 218 | 79567 | """Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, and modify the tree.
A well-formed X... | gpl-2.0 |
cahudson94/django-imager | imagersite/imager_profile/migrations/0001_initial.py | 1 | 1589 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-26 04:47
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import imager_images.models
class Migration(migrations.Migration):
initial = True
depen... | mit |
shawnwanderson/cmput404-project | venv/lib/python2.7/site-packages/django/contrib/admin/filters.py | 188 | 16608 | """
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.contrib.admin.op... | gpl-3.0 |
listamilton/supermilton.repository | plugin.video.igorlista/mechanize/_pullparser.py | 134 | 14352 | """A simple "pull API" for HTML parsing, after Perl's HTML::TokeParser.
Examples
This program extracts all links from a document. It will print one
line for each link, containing the URL and the textual description
between the <A>...</A> tags:
import pullparser, sys
f = file(sys.argv[1])
p = pullparser.PullParser(f... | gpl-2.0 |
skasamatsu/py_mc | examples/HAp-bulk/model_setup.py | 1 | 8809 | import numpy as np
import random as rand
import sys, os
import copy
import pickle
#from mpi4py import MPI
from pymatgen import Lattice, Structure, Element, PeriodicSite
from pymatgen.io.vasp import Poscar, VaspInput
from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator
from pymatgen.app... | gpl-3.0 |
dongguangming/python-phonenumbers | python/phonenumbers/data/region_TL.py | 11 | 1775 | """Auto-generated file, do not edit by hand. TL metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_TL = PhoneMetadata(id='TL', country_code=670, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-489]\\d{6}|7\\d{6,7}', possible_numbe... | apache-2.0 |
mbkumar/pymatgen | pymatgen/transformations/tests/test_advanced_transformations.py | 1 | 32390 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import os
import json
import warnings
import numpy as np
from pymatgen import Lattice, Structure, Specie, Molecule
from pymatgen.transformations.standard_transformations import (
OxidationS... | mit |
laobubu/ssland | web/views_admin.py | 1 | 7793 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django import forms
from django.shortcuts import render, redirect
from django.contrib.auth import forms as auth_forms
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required, permiss... | mit |
saleemjaveds/https-github.com-openstack-nova | nova/tests/virt/test_block_device.py | 5 | 27610 | # 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 agreed to in... | apache-2.0 |
Gandi/gandi.cli | gandi/cli/modules/account.py | 3 | 1241 | """ Hosting account module. """
from gandi.cli.core.base import GandiModule
class Account(GandiModule):
""" Module to handle CLI commands.
$ gandi account info
"""
@classmethod
def info(cls):
"""Get information about the hosting account in use"""
return cls.call('hosting.accou... | gpl-3.0 |
collinmelton/DynamicDiskCloudSoftware | Master/JobManager.py | 1 | 3695 | '''
Created on Jul 25, 2014
@author: cmelton
'''
from JobAndDiskFileReader import JobAndDiskFileReader
from InstanceManager import InstanceManager
class JobManager(object):
'''
This class manages the jobs and instances.
'''
def __init__(self, job_csv_file, disk_csv_file, myDriver, log, storage_direc... | gpl-2.0 |
artemh/asuswrt-merlin | release/src/router/samba36/examples/scripts/shares/python/SambaConfig.py | 83 | 8030 | import sys, string, SambaParm
from smbparm import parm_table
######################################################################
##
## smb.conf parser class
##
## Copyright (C) Gerald Carter 2004.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU... | gpl-2.0 |
megraf/asuswrt-merlin | release/src/router/lighttpd-1.4.29/external_file/js/davclient.js/jsbase/conftest.py | 42 | 5960 | # JS unit test support for py.test - (c) 2007 Guido Wesdorp. All rights
# reserved
#
# This software is distributed under the terms of the JSBase
# License. See LICENSE.txt for license text.
import py
here = py.magic.autopath().dirpath()
class JSTest(py.test.collect.Item):
def run(self):
path = self.fspa... | gpl-2.0 |
fearthecowboy/pygments | Pygments/pygments-lib/pygments/plugin.py | 51 | 1862 | # -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
yourlexer = yourmodule:YourLexer
formatter pl... | bsd-2-clause |
ZerpaTechnology/AsenZor | static/js/brython/Lib/encodings/iso8859_2.py | 37 | 13711 | """ Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,i... | lgpl-3.0 |
sfu-nml/hadoop-vlocality | contrib/hod/hodlib/Hod/hadoop.py | 167 | 27677 | #Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use thi... | apache-2.0 |
mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/pkg_resources.py | 173 | 85435 | """Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipula... | gpl-3.0 |
pajlada/tyggbot | pajbot/apiwrappers/twitch/kraken_v5.py | 1 | 2893 | import logging
from pajbot.apiwrappers.response_cache import ListSerializer
from pajbot.apiwrappers.twitch.base import BaseTwitchAPI
from pajbot.models.emote import Emote
log = logging.getLogger(__name__)
class TwitchKrakenV5API(BaseTwitchAPI):
authorization_header_prefix = "OAuth"
def __init__(self, clien... | mit |
stephane-martin/salt-debian-packaging | salt-2016.3.2/tests/unit/modules/nova_test.py | 2 | 11363 | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Rahul Handay <rahulha@saltstack.com>`
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
# I... | apache-2.0 |
edxnercel/edx-platform | lms/djangoapps/ccx/utils.py | 21 | 9395 | """
CCX Enrollment operations for use by Coach APIs.
Does not include any access control, be sure to check access before calling.
"""
import logging
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from edxm... | agpl-3.0 |
snoopycrimecop/openmicroscopy | components/tools/OmeroPy/test/integration/clitest/test_admin.py | 3 | 5186 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# 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-2.0 |
Seagate/hadoop-on-lustre | src/contrib/hod/hodlib/ServiceProxy/serviceProxy.py | 182 | 2235 | #Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use thi... | apache-2.0 |
barnsnake351/nova | nova/tests/unit/test_loadables.py | 95 | 5425 | # Copyright 2012 OpenStack Foundation # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | apache-2.0 |
ZTH1970/alcide | scripts/find_duplicate_acts.py | 1 | 2569 | #!/usr/bin/env python
import sys
import os
import datetime as dt
from collections import defaultdict
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alcide.settings")
from django.db import transaction
@transaction.commit_on_success
def main():
from alcide.actes.validation import get_days_with_acts_not_locked
... | agpl-3.0 |
mkl-/scioncc | src/pyon/ion/test/test_endpoint.py | 2 | 15305 | #!/usr/bin/env python
__author__ = 'Dave Foster <dfoster@asascience.com>'
from pyon.net import endpoint
from pyon.ion.endpoint import ProcessEndpointUnitMixin, ProcessRPCRequestEndpointUnit, ProcessRPCClient, ProcessRPCResponseEndpointUnit, ProcessRPCServer, ProcessPublisherEndpointUnit, ProcessPublisher, ProcessSubs... | bsd-2-clause |
kamyu104/django | tests/migrations/test_autodetector.py | 100 | 112818 | # -*- coding: utf-8 -*-
import re
from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser
from django.core.validators import RegexValidator, validate_slug
from django.db import connection, models
from django.db.migrations.autodetector import MigrationAutode... | bsd-3-clause |
omadahealth/mixpanel-android | acceptance/test_property.py | 10 | 1406 | import unittest
from selenium import webdriver
class AndroidTest(unittest.TestCase):
def _launch_app(self, decide_message):
f = open('response.txt', 'w')
f.write(decide_message)
f.close()
desired_capabilities = {'aut': 'com.mixpanel.example.hello:1.0'}
self.driver = webdriv... | apache-2.0 |
jgraham/servo | tests/wpt/web-platform-tests/tools/html5lib/html5lib/tests/test_treeadapters.py | 451 | 1852 | from __future__ import absolute_import, division, unicode_literals
from . import support # flake8: noqa
import html5lib
from html5lib.treeadapters import sax
from html5lib.treewalkers import getTreeWalker
def test_to_sax():
handler = support.TracingSaxHandler()
tree = html5lib.parse("""<html xml:lang="en">... | mpl-2.0 |
prarthitm/edxplatform | openedx/core/lib/block_structure/manager.py | 1 | 5357 | """
Top-level module for the Block Structure framework with a class for managing
BlockStructures.
"""
from contextlib import contextmanager
from .cache import BlockStructureCache
from .factory import BlockStructureFactory
from .exceptions import UsageKeyNotInBlockStructure
from .transformers import BlockStructureTrans... | agpl-3.0 |
Balannen/LSMASOMM | atom3/Kernel/UserInterface/MyDialog.py | 1 | 4653 | # MyDialog.py
#
# Original version tkSimpleDialog.py - Copyright (c) 1997 by Fredrik Lundh
#
# fredrik@pythonware.com
# http://www.pythonware.com
#
# --------------------------------------------------------------------
# dialog base class
from Tkinter import *
import os, re
GEOMETRY_PATTERN = re.compil... | gpl-3.0 |
BadgerMaps/django-allauth | allauth/socialaccount/models.py | 4 | 10377 | from __future__ import absolute_import
import json
from django.core.exceptions import PermissionDenied
from django.db import models
from django.contrib.auth import authenticate
from django.contrib.sites.models import Site
from django.utils.encoding import python_2_unicode_compatible
from django.utils.crypto import ge... | mit |
zooba/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/profile.py | 11 | 22046 | #! /usr/bin/env python3
#
# Class for profiling python code. rev 1.0 6/2/94
#
# Written by James Roskind
# Based on prior profile module by Sjoerd Mullender...
# which was hacked somewhat by: Guido van Rossum
"""Class for profiling Python code."""
# Copyright Disney Enterprises, Inc. All Rights Reserved.
# Licens... | apache-2.0 |
J1bz/ecoloscore | ecoloscore/urls.py | 1 | 1388 | # -*- coding: utf-8 -*-
"""ecoloscore URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.... | bsd-3-clause |
sharkykh/SickRage | lib/sqlalchemy/testing/requirements.py | 75 | 17798 | # testing/requirements.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Global database feature support policy.
Provides decorators to mark tests ... | gpl-3.0 |
ericgarrigues/ansible-modules-extras | packaging/os/homebrew_tap.py | 66 | 5778 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# Based on homebrew (Andrew Dunham <andrew@du.nham.ca>)
#
# 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
# t... | gpl-3.0 |
belenox/dmwp | Chap3.py | 1 | 6064 | shortlist = [1, 2, 3]
print sum(shortlist)
print len(shortlist)
def calculate_mean(numbers):
s = float(sum(numbers))
N = float(len(numbers))
mean = s/N
return mean
print calculate_mean([1, 2])
if __name__ == '__main__':
donations = [100, 60, 70, 900, 100, 200, 500, 500, 503, 600, 1000, 1200]
pri... | unlicense |
indictranstech/vestasi-erpnext | erpnext/setup/doctype/email_digest/email_digest.py | 27 | 17455 | # 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
from frappe import _
from frappe.utils import fmt_money, formatdate, now_datetime, cstr, esc, \
get_url_to_form, get_fullname
from fra... | agpl-3.0 |
uiri/pxqz | venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py | 24 | 17332 | """
SQLite3 backend for django.
Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
"""
import datetime
import decimal
import warnings
import re
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection_created
from dja... | gpl-3.0 |
RackSec/ansible | lib/ansible/utils/module_docs_fragments/aws.py | 135 | 3168 | # (c) 2014, Will Thames <will@thames.id.au>
#
# 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... | gpl-3.0 |
dvliman/jaikuengine | .google_appengine/lib/django-0.96/django/utils/text.py | 32 | 6966 | import re
from django.conf import settings
# Capitalizes the first letter of a string.
capfirst = lambda x: x and x[0].upper() + x[1:]
def wrap(text, width):
"""
A word-wrap function that preserves existing line breaks and most spaces in
the text. Expects that existing line breaks are posix newlines.
... | apache-2.0 |
rtucker-mozilla/mozilla_inventory | vendor-local/src/django-tastypie/tests/basic/tests/resources.py | 20 | 6352 | from django.contrib.auth.models import User
from django.http import HttpRequest
from django.test import TestCase
from tastypie.bundle import Bundle
from tastypie.fields import ToOneField, ToManyField
from tastypie.resources import ModelResource
from basic.api.resources import SlugBasedNoteResource
from basic.models imp... | bsd-3-clause |
gohin/django | tests/auth_tests/models/invalid_models.py | 251 | 1340 | from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.db import models
class CustomUserNonUniqueUsername(AbstractBaseUser):
"""
A user with a non-unique username.
This model is not invalid if it is used with a custom authentication
backend which supports non-unique username... | bsd-3-clause |
EvolutionClip/pyload | module/network/HTTPChunk.py | 40 | 9556 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This prog... | gpl-3.0 |
ridfrustum/lettuce | tests/unit/test_feature_parser.py | 18 | 27405 | # -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.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 Foundatio... | gpl-3.0 |
WilJoey/tn_ckan | ckan/lib/search/__init__.py | 1 | 10605 | import logging
import sys
import cgitb
import warnings
import xml.dom.minidom
import urllib2
from pylons import config
from paste.deploy.converters import asbool
import ckan.model as model
import ckan.plugins as p
import ckan.logic as logic
from common import (SearchIndexError, SearchError, SearchQueryError,
... | mit |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/subunit/tests/test_run.py | 2 | 2392 | #
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2011 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project sour... | agpl-3.0 |
SnakeJenny/TensorFlow | tensorflow/tools/test/system_info_lib.py | 49 | 4752 | # 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 |
siosio/intellij-community | python/testData/inspections/PyDataclassInspection/attrsHelpersArgument.py | 18 | 2683 | import attr
from typing import Type, Union
class A:
pass
attr.fields(<warning descr="'attr.fields' method should be called on attrs types">A</warning>)
attr.fields(<warning descr="'attr.fields' method should be called on attrs types">A()</warning>)
attr.fields_dict(<warning descr="'attr.fields_dict' method sho... | apache-2.0 |
sgraham/nope | tools/findit/crash_utils.py | 48 | 17402 | # Copyright (c) 2014 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 atexit
import cgi
import ConfigParser
import json
import os
import Queue
import threading
import time
from common import utils
from result import... | bsd-3-clause |
byllyfish/pylibofp | test/test_datapath.py | 1 | 6683 | import unittest
from zof.datapath import DatapathList, Datapath, normalize_datapath_id, normalize_port_no
from zof.objectview import to_json
class DatapathTestCase(unittest.TestCase):
def test_datapath_list(self):
dpids = DatapathList()
self.assertFalse(dpids)
self.assertEqual(len(dpids), ... | mit |
candy7393/VTK | Filters/Sources/Testing/Python/coneResolution.py | 20 | 1956 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create a rendering window and renderer
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(r... | bsd-3-clause |
miipl-naveen/optibizz | addons/portal_sale/res_config.py | 445 | 1479 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
vseledkin/LV_groundhog | groundhog/datasets/TM_dataset.py | 3 | 12730 | """
Data iterator for text datasets that are used for translation model.
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"Caglar Gulcehre "
"KyungHyun Cho ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import numpy as np
import os, gc
import tables
import c... | bsd-3-clause |
timgraham/django-registration | registration/tests/simple_backend.py | 43 | 3433 | from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from registration.forms import RegistrationForm
from registration.users import UserModel
class SimpleBackendViewTests(TestCase):
urls = 'test_app.urls_simple'
def test_allow(self):
"""
... | bsd-3-clause |
Autonomi/limn | Printrun/printrun/utils.py | 19 | 8549 | # This file is part of the Printrun suite.
#
# Printrun 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.
#
# Printrun is distributed in ... | mit |
bnaul/scikit-learn | benchmarks/bench_plot_lasso_path.py | 12 | 3976 | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
from collections import defaultdict
import gc
import sys
from time import time
import numpy as np
from sklearn.linear_model import lars_path, lars_path_gram
from sklearn.linear_m... | bsd-3-clause |
codeaudit/pattern-1 | examples/01-web/10-dbpedia.py | 21 | 4720 | # -*- coding: utf-8 *-*
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))
from pattern.web import DBPedia
dbp = DBPedia()
# DBPedia is a database of structured information mined from Wikipedia.
# DBPedia data is stored as RDF triples: (subject, predicate, object),
# e.g., X is-a... | bsd-3-clause |
joelddiaz/openshift-tools | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/src/class/oc_pvc.py | 38 | 5477 | # pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class OCPVC(OpenShiftCLI):
''' Class to wrap the oc command line tools '''
kind = 'pvc'
# pylint allows 5
# pylint: disable=too-many-arguments
def __init__(self,
config,
verbose=Fal... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.