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 |
|---|---|---|---|---|---|
Yukarumya/Yukarum-Redfoxes | testing/web-platform/harness/wptrunner/wptmanifest/tests/test_serializer.py | 59 | 4791 | # 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/.
import sys
import unittest
from cStringIO import StringIO
import pytest
from .. import parser, serializer
class Tok... | mpl-2.0 |
timgrossmann/instagram-profilecrawl | util/chromedriver.py | 1 | 2703 | import re
import sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import DesiredCapabilities
from webdriver_manager.chrome import ChromeDriverManager
from util.exceptions import WebDriverException
from util.instalogger import InstaLogger
from util.settin... | mit |
GenericStudent/home-assistant | homeassistant/components/nx584/binary_sensor.py | 10 | 4494 | """Support for exposing NX584 elements as sensors."""
import logging
import threading
import time
from nx584 import client as nx584_client
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING,
DEVICE_CLASSES,
PLATFORM_SCHEMA,
BinarySensorEn... | apache-2.0 |
nsalomonis/AltAnalyze | import_scripts/combineCufflinks.py | 1 | 6249 | import sys,string,os
sys.path.insert(1, os.path.join(sys.path[0], '..')) ### import parent dir dependencies
def importFPKMFile(input_file):
added_key={}
firstLine = True
for line in open(input_file,'rU').xreadlines():
data = line.rstrip('\n')
t = string.split(data,'\t')
if firstLine... | apache-2.0 |
bruce3557/NTHUOJ_web | users/templatetags/profile_filters.py | 7 | 2186 | """
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
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 use, copy, modify, merge, ... | mit |
40223138/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/sys.py | 408 | 4998 | # hack to return special attributes
from _sys import *
from javascript import JSObject
has_local_storage=__BRYTHON__.has_local_storage
has_session_storage = __BRYTHON__.has_session_storage
has_json=__BRYTHON__.has_json
brython_debug_mode = __BRYTHON__.debug
argv = ['__main__']
base_exec_prefix = __BRYTHON__.brython_... | gpl-3.0 |
ercchy/coding-events | api/models/events.py | 3 | 3525 | """
Models for the event
"""
import datetime
from django.utils import timezone
from django.db import models
from django.template.defaultfilters import slugify
from taggit.managers import TaggableManager
from geoposition.fields import GeopositionField
from django_countries.fields import CountryField
from django.conf imp... | mit |
LukeM12/samba | source4/selftest/tests.py | 1 | 36902 | #!/usr/bin/python
# This script generates a list of testsuites that should be run as part of
# the Samba 4 test suite.
# The output of this script is parsed by selftest.pl, which then decides
# which of the tests to actually run. It will, for example, skip all tests
# listed in selftest/skip or only run a subset durin... | gpl-3.0 |
jiadaizhao/LeetCode | 1001-1100/1093-Statistics from a Large Sample/1093-Statistics from a Large Sample.py | 1 | 1194 | class Solution:
def sampleStats(self, count: List[int]) -> List[float]:
# minimum, maximum, mean, median, and mode
result = [0] * 5
for i, c in enumerate(count):
if c > 0:
result[0] = float(i)
break
for i in range(255, -1, -1):
... | mit |
jessedhillon/zulip | zerver/lib/bugdown/testing_mocks.py | 124 | 8065 | from __future__ import absolute_import
import ujson
NORMAL_TWEET = """{
"coordinates": null,
"created_at": "Sat Sep 10 22:23:38 +0000 2011",
"truncated": false,
"favorited": false,
"id_str": "112652479837110273",
"in_reply_to_user_id_str": "783214",
"text": "@twitter meets @seepicturely at #tcdisrupt c... | apache-2.0 |
larsks/ansible-modules-core | cloud/rackspace/rax_meta.py | 157 | 5136 | #!/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 |
M4rtinK/tsubame | core/bundle/oauthlib/oauth2/rfc6749/clients/base.py | 16 | 20346 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming OAuth 2.0 RFC6749.
"""
from __future__ import absolute_import, unicode_literals
import time
from oauthlib.common import generate_token
from oauthlib.oauth2.rfc6749 import... | gpl-3.0 |
Akasurde/ansible | lib/ansible/plugins/doc_fragments/default_callback.py | 8 | 3513 | # -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
... | gpl-3.0 |
delinhabit/django | django/contrib/gis/admin/widgets.py | 449 | 4881 | import logging
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea
from django.template import loader
from django.utils import six, translation
# Creating a template context that contains Django settings
# values n... | bsd-3-clause |
mpcraddock/classraspi | sabryna/Chat Shtuff.py | 2 | 1178 | name = raw_input("Username: ")
##while True == True:
## boat = raw_input("Enter your message: ")
## mc.postToChat(name + ": " + boat)
##x = int(raw_input("Giveth to me numbers: "))
##y = int(raw_input("Giveth to me numbers: "))
##z = int(raw_input("Giveth to me numbers: "))
##blockType = int(raw_input("Giveth t... | gpl-2.0 |
GiladE/birde | venv/lib/python2.7/site-packages/django/contrib/gis/db/backends/spatialite/operations.py | 48 | 15259 | import re
import sys
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.utils import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.back... | mit |
fivejjs/PTVS | Python/Product/TestAdapter/visualstudio_py_testlauncher.py | 5 | 2802 | # ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution... | apache-2.0 |
nhejazi/scikit-learn | sklearn/utils/validation.py | 3 | 27241 | """Utilities for input validation"""
# Authors: Olivier Grisel
# Gael Varoquaux
# Andreas Mueller
# Lars Buitinck
# Alexandre Gramfort
# Nicolas Tresegnie
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
import scipy.sparse as sp
from ..externals... | bsd-3-clause |
sumonchai/tough | toughradius/common/log_trace.py | 2 | 2017 | #!/usr/bin/env python
# coding=utf-8
from toughlib import utils
from toughlib import logger
import logging
try:
import redis
except:
pass
class LogTrace(object):
radius_key = "toughradius.syslog.trace.radius.{0}".format
trace_key = "toughradius.syslog.trace.{0}".format
def __init__(self, cache_... | agpl-3.0 |
miracle2k/protobuf | python/google/protobuf/internal/wire_format.py | 9 | 7933 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... | bsd-3-clause |
cccp/xy-VSFilter | test/gtest-1.6.0/scripts/pump.py | 603 | 23316 | #!/usr/bin/env python
#
# Copyright 2008, 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... | gpl-2.0 |
kosz85/django | tests/shell/tests.py | 56 | 2372 | import sys
import unittest
from unittest import mock
from django import __version__
from django.core.management import CommandError, call_command
from django.test import SimpleTestCase
from django.test.utils import captured_stdin, captured_stdout, patch_logger
class ShellCommandTestCase(SimpleTestCase):
def tes... | bsd-3-clause |
pravishsainath/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter4_TheGreatestTheoremNeverTold/top_pic_comments.py | 95 | 1161 | import sys
import numpy as np
from IPython.core.display import Image
import praw
reddit = praw.Reddit("BayesianMethodsForHackers")
subreddit = reddit.get_subreddit( "pics" )
top_submissions = subreddit.get_top()
n_pic = int( sys.argv[1] ) if sys.argv[1] else 1
i = 0
while i < n_pic:
top_submission = top_su... | mit |
DailyActie/Surrogate-Model | 01-codes/scipy-master/scipy/stats/_distr_params.py | 1 | 4481 | """
Sane parameters for stats.distributions.
"""
distcont = [
['alpha', (3.5704770516650459,)],
['anglit', ()],
['arcsine', ()],
['beta', (2.3098496451481823, 0.62687954300963677)],
['betaprime', (5, 6)],
['bradford', (0.29891359763170633,)],
['burr', (10.5, 4.3)],
['burr12', (10, 4)],
... | mit |
jn7163/django | tests/model_validation/models.py | 260 | 1346 | from django.db import models
class ThingItem(object):
def __init__(self, value, display):
self.value = value
self.display = display
def __iter__(self):
return (x for x in [self.value, self.display])
def __len__(self):
return 2
class Things(object):
def __iter__(se... | bsd-3-clause |
ArvinPan/opencog | opencog/python/learning/incremental_learner/IncrementaLearner_Mcs.py | 34 | 3242 | __author__ = 'raminbarati'
import incremental_learner as incLer
import networkx as nx
class IncrementalLearnerMcsMinimal(incLer.IncrementalLearnerBase):
def triangulate(self, graph):
def check(start,goal):
# return True
def is_goal(node):
return node == goal
... | agpl-3.0 |
dulems/hue | desktop/core/ext-py/cx_Oracle-5.1.2/test/IntervalVar.py | 33 | 5198 | """Module for testing interval variables."""
import datetime
class TestIntervalVar(BaseTestCase):
def setUp(self):
BaseTestCase.setUp(self)
self.rawData = []
self.dataByKey = {}
for i in range(1, 11):
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
... | apache-2.0 |
ales-erjavec/orange | Orange/OrangeWidgets/Prototypes/OWRScript.py | 6 | 15765 | """<name>R Script</name>
<description>Run R scripts</description>
<icon>icons/RScript.png</icon>
"""
from OWWidget import *
from OWPythonScript import OWPythonScript, Script, ScriptItemDelegate, PythonConsole
from OWItemModels import PyListModel, ModelActionsWidget
import Orange.utils.r as r
globalenv = r.globalen... | gpl-3.0 |
TheWardoctor/Wardoctors-repo | script.module.fantastic/lib/resources/lib/sources/en/to_be_fixed/needsfixing/moviego.py | 1 | 3064 | # -*- coding: utf-8 -*-
'''
fantastic Add-on
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 pro... | apache-2.0 |
mattkretz/root | tutorials/pyroot/tree.py | 7 | 7341 | ## \file
## \ingroup tutorial_pyroot
## This macro displays the Tree data structures
##
## \macro_image
## \macro_code
##
## \author Wim Lavrijsen
from ROOT import TCanvas, TPaveLabel, TPaveText, TPavesText, TText
from ROOT import TArrow, TLine
from ROOT import gROOT, gBenchmark
#gROOT.Reset()
c1 = TCanvas('c1','Tre... | lgpl-2.1 |
JohnnyKing94/pootle | pootle/urls.py | 5 | 1794 | # -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from django.conf import settings
from django... | gpl-3.0 |
enriquepablo/nlproject | src/nl/nl/examples/cms2.py | 1 | 9133 | # -*- coding: utf-8 -*-
# Copyright (c) 2007-2008 by Enrique Pérez Arnaud <enriquepablo@gmail.com>
#
# This file is part of ln.
#
# ln is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of... | gpl-3.0 |
shusenl/scikit-learn | examples/ensemble/plot_adaboost_twoclass.py | 347 | 3268 | """
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... | bsd-3-clause |
HackLinux/goblin-core | riscv/llvm/3.5/cfe-3.5.0.src/bindings/python/tests/cindex/test_tokens.py | 74 | 1384 | from clang.cindex import CursorKind
from clang.cindex import Index
from clang.cindex import SourceLocation
from clang.cindex import SourceRange
from clang.cindex import TokenKind
from nose.tools import eq_
from nose.tools import ok_
from .util import get_tu
def test_token_to_cursor():
"""Ensure we can obtain a Cu... | bsd-3-clause |
rockyzhang/zhangyanhit-python-for-android-mips | python3-alpha/python3-src/Lib/heapq.py | 45 | 17068 | """Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... | apache-2.0 |
sander76/home-assistant | tests/components/monoprice/test_media_player.py | 3 | 16861 | """The tests for Monoprice Media player platform."""
from collections import defaultdict
from unittest.mock import patch
from serial import SerialException
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_INPUT_SOURCE_LIST,
ATTR_MEDIA_VOLUME_LEVEL,
DOMAIN as MEDIA_PLAY... | apache-2.0 |
hassanabidpk/django | tests/utils_tests/test_datastructures.py | 262 | 4154 | """
Tests for stuff in django.utils.datastructures.
"""
import copy
from django.test import SimpleTestCase
from django.utils import six
from django.utils.datastructures import (
DictWrapper, ImmutableList, MultiValueDict, MultiValueDictKeyError,
OrderedSet,
)
class OrderedSetTests(SimpleTestCase):
def ... | bsd-3-clause |
LearnEra/LearnEraPlaftform | cms/djangoapps/contentstore/views/component.py | 1 | 15245 | from __future__ import absolute_import
import json
import logging
from django.http import HttpResponseBadRequest, Http404
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_GET
from django.core.exceptions import PermissionDenied
from django.conf import settings
... | agpl-3.0 |
Jandersoft/jander777-ghost | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/scripts/check_sources.py | 117 | 7467 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Checker for file headers
~~~~~~~~~~~~~~~~~~~~~~~~
Make sure each Python file has a correct file header
including copyright and license information.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE fo... | mit |
inorton/NULLTeamPlugin | server/web/webopenid.py | 124 | 3707 | """openid.py: an openid library for web.py
Notes:
- This will create a file called .openid_secret_key in the
current directory with your secret key in it. If someone
has access to this file they can log in as any user. And
if the app can't find this file for any reason (e.g. you
moved the app somewhe... | bsd-2-clause |
darjus-amzn/boto | tests/integration/iam/test_connection.py | 100 | 1746 | # 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 right... | mit |
boldprogressives/django-opendebates | opendebates/opendebates/settings.py | 1 | 5134 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.utils.translation import ugettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'fixtures')]
SECRET_KEY = 'dg0pdghh4andk^v=rw^l-i81yz-h2co%mlj4)+p(cqz... | apache-2.0 |
youprofit/django-cms | cms/forms/fields.py | 35 | 3619 | # -*- coding: utf-8 -*-
import six
from django import forms
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.forms.fields import EMPTY_VALUES
from django.utils.translation import ugettext_lazy as _
from cms.forms.utils import get_site_choices, get_page_choices
from cms.forms.widgets impo... | bsd-3-clause |
eva-oss/linux | tools/testing/selftests/tc-testing/tdc_helper.py | 49 | 2070 | """
tdc_helper.py - tdc helper functions
Copyright (C) 2017 Lucas Bates <lucasb@mojatatu.com>
"""
def get_categorized_testlist(alltests, ucat):
""" Sort the master test list into categories. """
testcases = dict()
for category in ucat:
testcases[category] = list(filter(lambda x: category in x['ca... | gpl-2.0 |
DavidjohnBlodgett/RackHD | test/stream-monitor/test/test_amqp_mon.py | 1 | 8198 | """
Copyright (c) 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Self-test of the matcher infrastructure. This is less about individual matchers,
and more about if the various sequences and groups work (and fail!) as expected.
"""
from __future__ import print_function
import unittest
import plugin_test_helpe... | apache-2.0 |
sernst/cauldron | cauldron/docgen/params.py | 1 | 4295 | import typing
import inspect
from cauldron.docgen import conversions
def get_args_index(target) -> int:
"""
Returns the index of the "*args" parameter if such a parameter exists in
the function arguments or -1 otherwise.
:param target:
The target function for which the args index should be de... | mit |
raags/ansible-modules-core | system/sysctl.py | 18 | 12858 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, David "DaviXX" CHANIAL <david.chanial@gmail.com>
# (c) 2014, James Tanner <tanner.jc@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 ... | gpl-3.0 |
dkarakats/edx-platform | common/lib/xmodule/xmodule/assetstore/assetmgr.py | 59 | 2002 | """
Asset Manager
Interface allowing course asset saving/retrieving.
Handles:
- saving asset in the BlobStore -and- saving asset metadata in course modulestore.
- retrieving asset metadata from course modulestore -and- returning URL to asset -or- asset bytes.
Phase 1: Checks to see if an asset's metadata can be f... | agpl-3.0 |
MissionCriticalCloud/marvin | marvin/cloudstackAPI/listPhysicalNetworks.py | 1 | 2112 | """Lists physical networks"""
from baseCmd import *
from baseResponse import *
class listPhysicalNetworksCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""list physical network by id"""
self.id = None
self.typeInfo['id'] = 'uuid'
"""List by key... | apache-2.0 |
PRIMEDesigner15/PRIMEDesigner15 | Test_files/dependencies/Lib/unittest/__init__.py | 900 | 2718 | """
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework.
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the tests and reporting the resu... | bsd-3-clause |
Averroes/raft | thirdparty/pdfminer/pdfminer/pdffont.py | 11 | 26454 | #!/usr/bin/env python2
import sys
import struct
try:
from io import StringIO
except ImportError:
from io import StringIO
from .cmapdb import CMapDB, CMapParser, FileUnicodeMap, CMap
from .encodingdb import EncodingDB, name2unicode
from .psparser import PSStackParser
from .psparser import PSSyntaxError, PSEOF
fr... | gpl-3.0 |
nvoron23/hue | desktop/core/ext-py/Django-1.6.10/django/views/decorators/http.py | 228 | 7105 | """
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.utils.decorators import decorator_from_middleware, available_attrs
from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag
from django.middleware.http i... | apache-2.0 |
mathspace/django | django/contrib/admin/__init__.py | 562 | 1243 | # ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.decorators import register
from django.contrib.admin.filters import (
AllValuesFieldListFilter, BooleanFieldListFilter, ChoicesFieldListFilter,
DateFieldListFilter, Fiel... | bsd-3-clause |
alqfahad/odoo | addons/account/tests/test_reconciliation.py | 179 | 14166 | from openerp.tests.common import TransactionCase
import time
class TestReconciliation(TransactionCase):
"""Tests for reconciliation (account.tax)
Test used to check that when doing a sale or purchase invoice in a different currency,
the result will be balanced.
"""
def setUp(self):
super(... | agpl-3.0 |
faux123/mainline-crack | scripts/gdb/linux/symbols.py | 68 | 6310 | #
# gdb helper commands and functions for Linux kernel debugging
#
# load kernel and module symbols
#
# Copyright (c) Siemens AG, 2011-2013
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
#
# This work is licensed under the terms of the GNU GPL version 2.
#
import gdb
import os
import re
from linux import module... | gpl-2.0 |
GenaSG/ET | src/scons_utils.py | 9 | 3121 | # -*- mode: python -*-
import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile
import SCons
# need an Environment and a matching buffered_spawn API .. encapsulate
class idBuffering:
def buffered_spawn( self, sh, escape, cmd, args, env ):
stderr = StringIO.StringIO()
stdout = ... | gpl-3.0 |
masterkeywikz/seq2graph | src/build_vocab_from_glove.py | 1 | 1482 | import sys
import time
import os
if __name__ == '__main__':
if len(sys.argv) < 3:
print "Usage: {0} <word_vec_fn> <vocab_fn>".format(sys.argv[0])
sys.exit()
word_vec_fn = sys.argv[1]
vocab_fn = sys.argv[2]
save_fn = os.path.splitext(vocab_fn)[0] + '_glove.txt'
fea_save_fn = o... | mit |
2014cdag5/2014cdag5 | wsgi/programs/cdag3/remsub6.py | 7 | 18749 | import cherrypy
# 這是 MAN 類別的定義
'''
# 在 application 中導入子模組
import programs.cdag3.remsub6 as cdag3_remsub6
# 加入 cdag3 模組下的 remsub6.py 且以子模組 remsub6 對應其 remsub6() 類別
root.cdag3.remsub6 = cdag3_remsub6.remsub6()
# 完成設定後, 可以利用
/cdag3/remsub6
# 呼叫 man.py 中 MAN 類別的 assembly 方法
'''
class remsub6(object):
# 各組利用 index 引... | gpl-2.0 |
dyoung418/tensorflow | tensorflow/contrib/learn/python/learn/ops/__init__.py | 124 | 1104 | # 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 |
NullSoldier/django | django/utils/decorators.py | 126 | 6875 | "Functions that help with dynamically creating decorators for views."
try:
from contextlib import ContextDecorator
except ImportError:
ContextDecorator = None
from functools import WRAPPER_ASSIGNMENTS, update_wrapper, wraps
from django.utils import six
class classonlymethod(classmethod):
def __get__(se... | bsd-3-clause |
naveenvhegde/python-telegram-bot | telegram/location.py | 11 | 1552 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the ... | gpl-3.0 |
abenzbiria/clients_odoo | addons/l10n_be/wizard/l10n_be_partner_vat_listing.py | 302 | 14738 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Corrections & modifications by Noviat nv/sa, (http://www.noviat.be):
# - VAT listing based upon year... | agpl-3.0 |
emonty/deb-vhd-util | tools/xm-test/lib/XmTestReport/ResultReport.py | 42 | 3981 | #!/usr/bin/python
"""
ResultReport.py - Handles the gathering and xml-formatting of xm-test
results
Copyright (C) International Business Machines Corp., 2005
Author: Dan Smith <danms@us.ibm.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU... | gpl-2.0 |
passiweinberger/NuMozart | data/midi/MidiOutFile.py | 17 | 10907 | # -*- coding: ISO-8859-1 -*-
from MidiOutStream import MidiOutStream
from RawOutstreamFile import RawOutstreamFile
from constants import *
from DataTypeConverters import fromBytes, writeVar
class MidiOutFile(MidiOutStream):
"""
MidiOutFile is an eventhandler that subclasses MidiOutStream.
... | gpl-2.0 |
google-code/android-scripting | python/src/Mac/Modules/app/appsupport.py | 39 | 5252 | # This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
import string
# Declarations that cha... | apache-2.0 |
blacklin/kbengine | kbe/res/scripts/common/Lib/bz2.py | 83 | 18839 | """Interface to the libbzip2 compression library.
This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
"""
__all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor",
"open", "compress", "decompress"]
__author__ = "Nadeem Vawda <nadeem.v... | lgpl-3.0 |
alkadis/vcv | src/adhocracy/controllers/shibboleth.py | 4 | 9257 | from urllib import urlencode
import formencode
from pylons import request
from pylons import response
from pylons import session
from pylons.controllers.util import redirect
from pylons.i18n import _
from adhocracy import config
from adhocracy import forms
from adhocracy.lib import helpers as h
from adhocracy.lib.auth ... | agpl-3.0 |
aron-bordin/Tyrant-Sql | SQL_Map/plugins/dbms/maxdb/__init__.py | 8 | 1033 | #!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.settings import MAXDB_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.maxdb.enumeration import Enumeration
... | gpl-3.0 |
suncycheng/intellij-community | python/testData/codeInsight/classMRO/TangledInheritance.py | 79 | 6841 |
class Class001(object):
unique_attr = 1
class Class002(Class001):
unique_attr = 2
class Class003(Class002, Class001):
unique_attr = 3
class Class004(Class003, Class002, Class001):
unique_attr = 4
class Class005(Class004, Class003, Class002):
unique_attr = 5
class Class006(Class005, Class... | apache-2.0 |
Metaswitch/calico-nova | nova/tests/unit/virt/disk/test_inject.py | 7 | 11218 | # Copyright (C) 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 |
figment/tesvsnip | scripts/lib/markup.py | 4 | 18521 | # This code is in the public domain, it comes
# with absolutely no warranty and you can do
# absolutely whatever you want with it.
# Figment: Edits add element_closer to elements
# to enhance expressiveness
__date__ = '1 October 2012'
__version__ = '1.9'
__doc__ = """
This is markup.py - a Python module that... | gpl-3.0 |
petosegan/scikit-learn | sklearn/semi_supervised/tests/test_label_propagation.py | 307 | 1974 | """ test the label propagation module """
import nose
import numpy as np
from sklearn.semi_supervised import label_propagation
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
ESTIMATORS = [
(label_propagation.LabelPropagation, {'kernel': 'rbf'}),
(label_propa... | bsd-3-clause |
rrampage/rethinkdb | test/rql_test/connections/http_support/httpbin/filters.py | 49 | 1788 | # -*- coding: utf-8 -*-
"""
httpbin.filters
~~~~~~~~~~~~~~~
This module provides response filter decorators.
"""
import gzip as gzip2
import zlib
from decimal import Decimal
from time import time as now
from io import BytesIO
from decorator import decorator
from flask import Flask, Response
app = Flask(__name__)... | agpl-3.0 |
dmilith/SublimeText3-dmilith | Packages/pyyaml/st2/yaml/scanner.py | 5 | 52027 |
# Scanner produces tokens of the following types:
# STREAM-START
# STREAM-END
# DIRECTIVE(name, value)
# DOCUMENT-START
# DOCUMENT-END
# BLOCK-SEQUENCE-START
# BLOCK-MAPPING-START
# BLOCK-END
# FLOW-SEQUENCE-START
# FLOW-MAPPING-START
# FLOW-SEQUENCE-END
# FLOW-MAPPING-END
# BLOCK-ENTRY
# FLOW-ENTRY
# KEY
# VALUE
# AL... | mit |
cbeloni/pychronesapp | backend/venv/lib/python2.7/site-packages/pip/vcs/subversion.py | 473 | 10640 | import os
import re
from pip.backwardcompat import urlparse
from pip.index import Link
from pip.util import rmtree, display_path, call_subprocess
from pip.log import logger
from pip.vcs import vcs, VersionControl
_svn_xml_url_re = re.compile('url="([^"]+)"')
_svn_rev_re = re.compile('committed-rev="(\d+)"')
_svn_url_r... | mit |
NewPresident1/kitsune | kitsune/sumo/migrations/0002_initial_data.py | 13 | 2154 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_ratelimit_bypass_perm(apps, schema_editor):
# First we get or create the content type.
ContentType = apps.get_model('contenttypes', 'ContentType')
global_permission_ct, created = ContentTyp... | bsd-3-clause |
jjuanda/mechanize | release.py | 21 | 45151 | """%prog RELEASE_AREA [action ...]
Perform needed actions to release mechanize, doing the work in directory
RELEASE_AREA.
If no actions are given, print the tree of actions and do nothing.
This is only intended to work on Unix (unlike mechanize itself). Some of it
only works on Ubuntu 10.04 (lucid).
Warning:
* M... | bsd-3-clause |
SEL-Columbia/formhub | odk_logger/management/commands/update_xform_uuids.py | 7 | 1885 | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import os
import glob
import csv
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext_lazy
from odk_logger.models.xform import XForm, DuplicateUUIDError
from optparse import make_option
from utils... | bsd-2-clause |
martiert/bitbake | lib/bb/fetch2/gitsm.py | 2 | 2811 | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' git submodules implementation
"""
# Copyright (C) 2013 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as... | gpl-2.0 |
xwolf12/scikit-learn | sklearn/covariance/__init__.py | 389 | 1157 | """
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... | bsd-3-clause |
lihui7115/ChromiumGStreamerBackend | chrome/common/extensions/docs/server2/api_models_test.py | 44 | 6678 | #!/usr/bin/env python
# Copyright 2013 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 json
import unittest
from api_models import APIModels
from compiled_file_system import CompiledFileSystem
from extensions_paths... | bsd-3-clause |
mertaytore/koding | go/src/vendor/github.com/hashicorp/terraform/vendor/github.com/coreos/etcd/Godeps/_workspace/src/github.com/ugorji/go/codec/test.py | 1138 | 3876 | #!/usr/bin/env python
# This will create golden files in a directory passed to it.
# A Test calls this internally to create the golden files
# So it can process them (so we don't have to checkin the files).
# Ensure msgpack-python and cbor are installed first, using:
# sudo apt-get install python-dev
# sudo apt-g... | agpl-3.0 |
OpenUpgrade-dev/OpenUpgrade | addons/l10n_fr_hr_payroll/report/__init__.py | 424 | 1091 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it... | agpl-3.0 |
nikhila05/micro-blog | micro_blog/posts/templatetags/blog_tags.py | 1 | 1176 | import datetime
from django import template
from micro_blog.microblog.models import Post, Tags, UserRole
from micro_blog.microblog.views import get_user_role
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_archives(context):
archives = []
dates = []
for each_object in P... | mit |
qsnake/numpy | numpy/add_newdocs.py | 1 | 179093 | # This is only meant to add docs to objects defined in C-extension modules.
# The purpose is to allow easier editing of the docstrings without
# requiring a re-compile.
# NOTE: Many of the methods of ndarray have corresponding functions.
# If you update these docstrings, please keep also the ones in
# core... | bsd-3-clause |
cmin764/xhosts | xhosts/editor.py | 1 | 4285 | #
# editor: module used for loading and editing the hosts file
# Copyright (C) 2012 cmiN
#
# 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 optio... | gpl-3.0 |
cbrucks/keystone_ldap | keystone/contrib/ec2/backends/kvs.py | 2 | 1772 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... | apache-2.0 |
xuther/nyc-taxi-data | code/clustering/heirarchical-clusters.py | 1 | 4247 | import csv
import sys
if len(sys.argv) != 3:
print ("Usage: python heirarchical-cluster.py [in file] [out file]")
exit(-1)
in_file = sys.argv[1]
out_file = sys.argv[2]
sortedDistances = [] #Tuples to be sorted by distances.
clusterDistances = {}
clusters = {} # Clusters is a list of tracts in a cluster - num... | mit |
ptmr3/L900_Kernel | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | 1935 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# 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.
import errno, os
FUTEX_WAIT = 0... | gpl-2.0 |
171121130/SWI | venv/Lib/encodings/cp866.py | 272 | 34396 | """ Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP866.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_map)
def decode(self,input,errors='strict'):
... | mit |
dustinlarimer/collab-pad | src/node_modules/npm/node_modules/node-gyp/gyp/test/defines/gyptest-defines-env.py | 501 | 1874 | #!/usr/bin/env python
# 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.
"""
Verifies build of an executable with C++ define specified by a gyp define.
"""
import os
import TestGyp
test = TestGyp.TestGyp()
# Wi... | apache-2.0 |
serpilliere/miasm | example/symbol_exec/depgraph.py | 2 | 4568 | from __future__ import print_function
from builtins import range
from argparse import ArgumentParser
from pdb import pm
import json
from future.utils import viewitems
from miasm.analysis.machine import Machine
from miasm.analysis.binary import Container
from miasm.analysis.depgraph import DependencyGraph
from miasm.e... | gpl-2.0 |
anbangleo/NlsdeWeb | Python-3.6.0/Lib/lib2to3/fixes/fix_has_key.py | 39 | 3196 | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for has_key().
Calls to .has_key() methods are expressed in terms of the 'in'
operator:
d.has_key(k) -> k in d
CAVEATS:
1) While the primary target of this fixer is dict.has_key(), the
fixer will chan... | mit |
akvo/djangoembed | oembed/resources.py | 1 | 1275 | from django import VERSION
if VERSION < (1, 5):
from django.utils import simplejson
else:
import json as simplejson
from oembed.exceptions import OEmbedException
class OEmbedResource(object):
"""
OEmbed resource, as well as a factory for creating resource instances
from response json
"""
_... | mit |
hongyunnchen/gr-lte | python/qa_pbch_demux_vcvc.py | 2 | 4239 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT)
#
# This 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... | gpl-3.0 |
SNAPPETITE/backend | flask/lib/python2.7/site-packages/flask/testsuite/signals.py | 554 | 4807 | # -*- coding: utf-8 -*-
"""
flask.testsuite.signals
~~~~~~~~~~~~~~~~~~~~~~~
Signalling.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class SignalsTestCase(FlaskTestCase):
def ... | mit |
kyroskoh/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/message_pool.py | 129 | 12235 | # Copyright (C) 2011 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 |
zachomedia/xml-parsing-testing | libs-src/libxml2-2.9.1/python/tests/tstLastError.py | 32 | 2902 | #!/usr/bin/python -u
import sys, unittest
import libxml2
class TestCase(unittest.TestCase):
def runTest(self):
self.test1()
self.test2()
def setUp(self):
libxml2.debugMemory(1)
def tearDown(self):
libxml2.cleanupParser()
if libxml2.debugMemory(1) != 0:
... | mit |
Lekensteyn/buildbot | master/buildbot/test/unit/test_www_hooks_github.py | 4 | 30383 | # coding: utf-8
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRA... | gpl-2.0 |
fernandog/Sick-Beard | lib/requests/packages/urllib3/util.py | 65 | 6914 | # urllib3/util.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from base64 import b64encode
from collections import namedtuple
from socket import error as Socke... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.