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 |
|---|---|---|---|---|---|
Kiiv/CouchPotatoServer | libs/xmpp/__init__.py | 212 | 1795 | # $Id: __init__.py,v 1.9 2005/03/07 09:34:51 snakeru Exp $
"""
All features of xmpppy library contained within separate modules.
At present there are modules:
simplexml - XML handling routines
protocol - jabber-objects (I.e. JID and different stanzas and sub-stanzas) handling routines.
debug - Jacob Lundquist's debugg... | gpl-3.0 |
fake-name/IntraArchiveDeduplicator | Tests/Test_BKTree_Issue_2.py | 1 | 3225 |
# from cbktree import BkHammingTree, explicitSignCast
import pyximport
print("Have Cython")
pyximport.install()
import deduplicator.cyHamDb as hamDb
int_bits = lambda b: hamDb.explicitSignCast(int(b, 2))
TEST_DATA = {
# Format: id -> bitstring
1: int_bits('1011010010010110110111111000001000001000100011110001010... | bsd-3-clause |
JCBarahona/edX | common/test/acceptance/tests/studio/test_studio_with_ora_component.py | 87 | 4074 | """
Acceptance tests for Studio related to edit/save peer grading interface.
"""
from ...fixtures.course import XBlockFixtureDesc
from ...pages.studio.import_export import ExportCoursePage
from ...pages.studio.component_editor import ComponentEditorView
from ...pages.studio.overview import CourseOutlinePage
from base_... | agpl-3.0 |
cloud-fan/spark | examples/src/main/python/ml/one_vs_rest_example.py | 27 | 2197 | #
# 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 us... | apache-2.0 |
fxia22/ASM_xf | PythonD/lib/python2.4/test/test_urllib.py | 5 | 22204 | """Regresssion tests for urllib"""
import urllib
import httplib
import unittest
from test import test_support
import os
import mimetools
import tempfile
import StringIO
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
hex_repr = hex(ord(char))[2:].upper()
if len(hex_repr) == 1:
hex_rep... | gpl-2.0 |
TheMOOCAgency/edx-platform | common/djangoapps/third_party_auth/tests/test_pipeline.py | 77 | 1807 | """Unit tests for third_party_auth/pipeline.py."""
import random
from third_party_auth import pipeline
from third_party_auth.tests import testutil
import unittest
# Allow tests access to protected methods (or module-protected methods) under test.
# pylint: disable=protected-access
class MakeRandomPasswordTest(tes... | agpl-3.0 |
achang97/YouTunes | lib/python2.7/site-packages/googleapiclient/channel.py | 32 | 10067 | """Channel notifications support.
Classes and functions to support channel subscriptions and notifications
on those channels.
Notes:
- This code is based on experimental APIs and is subject to change.
- Notification does not do deduplication of notification ids, that's up to
the receiver.
- Storing the Chan... | mit |
mbauskar/tele-erpnext | erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 | 24285 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, fmt_money, formatdate, getdate
from frappe import msgprint, _, scrub
from erpnext.setup.utils import g... | agpl-3.0 |
ubc/compair | compair/api/comparison_example.py | 1 | 7395 | import dateutil.parser
from bouncer.constants import READ, EDIT, CREATE, DELETE, MANAGE
from flask import Blueprint
from flask_login import login_required, current_user
from flask_restful import Resource, marshal
from flask_restful.reqparse import RequestParser
from sqlalchemy import desc, or_, func, and_
from sqlalche... | gpl-3.0 |
voidException/zulip | zerver/test_external.py | 115 | 8407 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf import settings
from django.core.exceptions import ValidationError
from django.test import TestCase
from unittest import skip
from zerver.forms import not_mit_mailing_list
from zerver.lib.rate_limiter import (
add_ratelimit_rule,
... | apache-2.0 |
Beercow/viper | viper/modules/rats/albertino.py | 12 | 1613 | # Originally written by Kevin Breen (@KevTheHermit):
# https://github.com/kevthehermit/RATDecoders/blob/master/Albertino.py
import re
import string
from Crypto.Cipher import DES
from base64 import b64decode
def string_print(line):
return filter(lambda x: x in string.printable, line)
def get_config(data):
m ... | bsd-3-clause |
cmdunkers/DeeperMind | PythonEnv/lib/python2.7/site-packages/scipy/weave/tests/test_scxx_sequence.py | 91 | 13199 | """ Test refcounting and behavior of SCXX.
"""
from __future__ import absolute_import, print_function
import time
import sys
from numpy.testing import (TestCase, assert_, assert_raises,
run_module_suite)
from scipy.weave import inline_tools
from weave_test_utils import debug_print, dec
... | bsd-3-clause |
TheIoTLearningInitiative/CodeLabs | Tulum/device/iot101inc.py | 3 | 2148 | #!/usr/bin/python
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
from threading import Thread
def functionApiWeather():
data = pywapi.get_weather_from_weather_com('MXJO0043', 'metric')
message = data['location']['name']
message = message + ", Temperature ... | apache-2.0 |
Bitcoin-ABC/bitcoin-abc | test/functional/test_framework/key.py | 1 | 13283 | #!/usr/bin/env python3
# Copyright (c) 2019 Pieter Wuille
# Copyright (c) 2019-2020 The Bitcoin developers
"""Test-only secp256k1 elliptic curve implementation
WARNING: This code is slow, uses bad randomness, does not properly protect
keys, and is trivially vulnerable to side channel attacks. Do not use for
anything ... | mit |
shahankhatch/scikit-learn | examples/text/document_clustering.py | 230 | 8356 | """
=======================================
Clustering text documents using k-means
=======================================
This is an example showing how the scikit-learn can be used to cluster
documents by topics using a bag-of-words approach. This example uses
a scipy.sparse matrix to store the features instead of ... | bsd-3-clause |
TeamExodus/external_chromium_org | chrome/test/ispy/common/image_tools.py | 124 | 10124 | # 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.
"""Utilities for performing pixel-by-pixel image comparision."""
import itertools
import StringIO
from PIL import Image
def _AreTheSameSize(images):
"""... | bsd-3-clause |
fbradyirl/home-assistant | homeassistant/components/smappee/sensor.py | 1 | 8496 | """Support for monitoring a Smappee energy sensor."""
from datetime import timedelta
import logging
from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT
from homeassistant.helpers.entity import Entity
from . import DATA_SMAPPEE
_LOGGER = logging.getLogger(__name__)
SENSOR_PREFIX = "Smappee"
SENSOR_TYPE... | apache-2.0 |
allmightyspiff/softlayer-python | SoftLayer/CLI/object_storage/credential/__init__.py | 3 | 1288 | """Manages Object Storage S3 Credentials."""
# :license: MIT, see LICENSE for more details.
import importlib
import os
import click
CONTEXT = {'help_option_names': ['-h', '--help'],
'max_content_width': 999}
class CapacityCommands(click.MultiCommand):
"""Loads module for object storage S3 credential... | mit |
mganeva/mantid | Framework/PythonInterface/mantid/plots/modest_image/modest_image.py | 1 | 10141 | # v0.2 obtained on March 12, 2019
"""
Modification of Chris Beaumont's mpl-modest-image package to allow the use of
set_extent.
"""
from __future__ import print_function, division
import matplotlib
rcParams = matplotlib.rcParams
import matplotlib.image as mi
import matplotlib.colors as mcolors
import matplotlib.cbook... | gpl-3.0 |
robiame/AndroidGeodata | pil/GimpGradientFile.py | 1 | 3292 | #
# Python Imaging Library
# $Id$
#
# stuff to read (and render) GIMP gradient files
#
# History:
# 97-08-23 fl Created
#
# Copyright (c) Secret Labs AB 1997.
# Copyright (c) Fredrik Lundh 1997.
#
# See the README file for information on usage and redistribution.
#
from math import pi, log, si... | mit |
nguyeho7/CZ_NER | src/webservice/server.py | 1 | 1188 | from flask import Flask
from flask import request, render_template, jsonify
from src.common.NER_utils import transform_dataset_web
from src.CRF_NER.CRF_NER import parse_commands
import pycrfsuite
model = "1_nbr"
def init(filename = "model.txt"):
with open(filename) as f:
line = f.read()
tokens = ... | mit |
jaymiejones86/jaymiejones.com | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/lexers/_scilab_builtins.py | 364 | 31261 | # -*- coding: utf-8 -*-
"""
pygments.lexers._scilab_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Builtin list for the ScilabLexer.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
# These lists are generated automatically.
# Run the follo... | mit |
jhawkesworth/ansible | lib/ansible/modules/system/filesystem.py | 20 | 13642 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Alexander Bulimov <lazywolf0@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_ver... | gpl-3.0 |
sahutd/youtube-dl | devscripts/make_supportedsites.py | 96 | 1149 | #!/usr/bin/env python
from __future__ import unicode_literals
import io
import optparse
import os
import sys
# Import youtube_dl
ROOT_DIR = os.path.join(os.path.dirname(__file__), '..')
sys.path.append(ROOT_DIR)
import youtube_dl
def main():
parser = optparse.OptionParser(usage='%prog OUTFILE.md')
options,... | unlicense |
gurneyalex/odoo | addons/sale/wizard/payment_acquirer_onboarding_wizard.py | 6 | 1520 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class PaymentWizard(models.TransientModel):
""" Override for the sale quotation onboarding panel. """
_inherit = 'payment.acquirer.onboarding.wizard'
_name = 'sale.paym... | agpl-3.0 |
gw0/myhdl | myhdl/test/conversion/general/test_bin2gray.py | 2 | 1547 | from __future__ import absolute_import
import os
path = os.path
from myhdl import *
from myhdl.conversion import verify
def bin2gray2(B, G, width):
""" Gray encoder.
B -- input intbv signal, binary encoded
G -- output intbv signal, gray encoded
width -- bit width
"""
@instance
def logic()... | lgpl-2.1 |
rebearteta/social-ideation | app/migrations/0007_auto_20150908_1518.py | 2 | 1475 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0006_auto_20150825_1513'),
]
operations = [
migrations.CreateModel(
name='SocialNetworkAppUser',
... | mit |
sharkeyck/Lidar | lidar_edited.py | 1 | 4303 | #Display Data from Neato LIDAR
#based on code from Nicolas "Xevel" Saugnier
#requires vpython and pyserial
import thread, time, sys, traceback, math, struct
COM_PORT = "COM4" # example: 5 == "COM6" == "/dev/tty5"
BAUD_RATE = 115200
FPS = 60
OFFSET = 140
from visual import *
point = points(pos=[(0,0,0) for i in range... | apache-2.0 |
leifdenby/numpy | numpy/lib/tests/test_polynomial.py | 116 | 5092 | from __future__ import division, absolute_import, print_function
'''
>>> p = np.poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print(p)
2
1 x + 2 x + 3
>>> q = np.poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print(q)
2
3 x + 2 x + 1
>>> print(np.poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
... | bsd-3-clause |
victortxa/fatiando | fatiando/gravmag/eqlayer.py | 6 | 14837 | """
Equivalent layer processing.
Use the classes here to estimate an equivalent layer from potential field data.
Then you can use the estimated layer to perform tranformations (gridding,
continuation, derivation, reduction to the pole, etc.) by forward modeling
the layer. Use :mod:`fatiando.gravmag.sphere` for forward... | bsd-3-clause |
gangadharkadam/vervefrappe | frappe/tests/__init__.py | 70 | 1107 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
def insert_test_data(doctype, sort_fn=None):
import frappe.model
data = get_test_doclist(doctype)
if sort_fn:
data = sorted(data, key=sort_fn)
for doclist in data:
frapp... | mit |
naokits/adminkun_viewer_old | Server/gaeo/gaeo/view/helper/form.py | 1 | 6971 | # -*- coding: utf-8 -*-
#
# Copyright 2008 GAEO Team
#
# 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 o... | mit |
walac/build-mozharness | configs/luciddream/linux_config.py | 1 | 1816 | # This is a template config file for luciddream production.
import os
import platform
HG_SHARE_BASE_DIR = "/builds/hg-shared"
if platform.system().lower() == 'darwin':
xre_url = "http://tooltool.pvt.build.mozilla.org/build/sha512/4d8d7a37d90c34a2a2fda3066a8fe85c189b183d05389cb957fc6fed31f10a6924e50c1b84488ff61c01... | mpl-2.0 |
shams169/pythonProject | ContactsDir/env/lib/python3.6/site-packages/pip/_vendor/requests/packages/chardet/chardistribution.py | 2755 | 9226 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | mit |
s3rvac/git-branch-viewer | docs/conf.py | 1 | 8307 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# git-branch-viewer documentation build configuration file, created by
# sphinx-quickstart on Wed May 7 15:45:21 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in... | bsd-3-clause |
xiaoyaozi5566/GEM5_DRAMSim2 | src/python/m5/util/region.py | 64 | 9563 | # Copyright (c) 2006 Nathan Binkert <nate@binkert.org>
# 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 condi... | bsd-3-clause |
Walt280/cosmos | code/string-algorithms/anagram_search/anagram_search.py | 5 | 1209 | """ Part of Cosmos by OpenGenus Foundation"""
import collections
def removeWhitespace(string):
return ''.join(string.split())
"""
Checks if two strings are anagrams of each other, ignoring any whitespace.
First remove any whitespace and lower all characters of both strings.
Then create dictionar... | gpl-3.0 |
malept/pyoath-toolkit | oath_toolkit/django_otp/hotp/tests.py | 1 | 2720 | # -*- coding: utf-8 -*-
#
# Originally from django-otp 0.2.2:
# * django_otp/plugins/otp_hotp/tests.py
#
# Copyright (c) 2012, Peter Sagerson
# Copyright (c) 2014, 2015, Mark Lee
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | apache-2.0 |
mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/tool/commands/upload.py | 15 | 22489 | #!/usr/bin/env python
# Copyright (c) 2009, 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple 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 sour... | apache-2.0 |
cgundogan/RIOT | tests/pbkdf2/tests/test_base.py | 7 | 1148 | # Copyright (C) 2019 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
# Author: Juan Carrano <j.carrano@fu-berlin.de>
import sys
import base64
from functools import partia... | lgpl-2.1 |
noname007/SublimeJEDI | jedi/evaluate/compiled/__init__.py | 33 | 16590 | """
Imitate the parser representation.
"""
import inspect
import re
import sys
import os
from functools import partial
from jedi._compatibility import builtins as _builtins, unicode
from jedi import debug
from jedi.cache import underscore_memoization, memoize_method
from jedi.evaluate.sys_path import get_sys_path
from... | mit |
dvliman/jaikuengine | .google_appengine/lib/django-1.4/django/db/models/fields/subclassing.py | 104 | 1819 | """
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the __metaclass__ for your Field subclass, implement
to_python() and the other necessary methods and everything will work seamlessly.
"""
class SubfieldBase(type):
"""
A metacl... | apache-2.0 |
zimhy/shadowsocks_analysis | shadowsocks/common.py | 35 | 6302 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 clowwindy
#
# 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... | mit |
QuLogic/vispy | examples/demo/gloo/graph.py | 17 | 4902 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: gallery 60
"""
Dynamic planar graph layout.
"""
import numpy as np
from vispy import gloo, app
from vispy.gloo import set_viewport, set_state, clear
vert = """
#version 120
// Uniforms
// ------------------------------------
uniform mat4 u_model;
uniform mat4 u... | bsd-3-clause |
florian-dacosta/OpenUpgrade | addons/resource/tests/test_resource.py | 243 | 32181 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013-TODAY 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 |
rroldan/contactlearn | boilerplate/external/wtforms/ext/i18n/utils.py | 119 | 1477 | import os
def messages_path():
"""
Determine the path to the 'messages' directory as best possible.
"""
module_path = os.path.abspath(__file__)
return os.path.join(os.path.dirname(module_path), 'messages')
def get_builtin_gnu_translations(languages=None):
"""
Get a gettext.GNUTranslations... | lgpl-3.0 |
pczerkas/tempest | tempest/api/baremetal/admin/test_api_discovery.py | 36 | 1692 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 |
LuckycoinFoundation/LuckycoinCore | share/qt/extract_strings_qt.py | 145 | 1900 | #!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
OUT_CPP="src/qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format pro... | mit |
miniconfig/home-assistant | tests/components/sensor/test_rfxtrx.py | 25 | 13917 | """The tests for the Rfxtrx sensor platform."""
import unittest
import pytest
from homeassistant.setup import setup_component
from homeassistant.components import rfxtrx as rfxtrx_core
from homeassistant.const import TEMP_CELSIUS
from tests.common import get_test_home_assistant, mock_component
@pytest.mark.skipif(... | mit |
TeamWin/android_kernel_oneplus_msm8974 | scripts/gcc-wrapper.py | 1276 | 3382 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... | gpl-2.0 |
theo-l/django | tests/signing/tests.py | 6 | 6968 | import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time
from django.utils.crypto import InvalidAlgorithm
class TestSigner(SimpleTestCase):
def test_signature(self):
"signature() method should generate a signature"
signer = ... | bsd-3-clause |
cushon/bazel | third_party/py/abseil/setup.py | 15 | 2011 | # Copyright 2017 The Abseil Authors.
#
# 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 |
csutherl/sos | sos/plugins/named.py | 12 | 2914 | # 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.
# This program is distributed in the hope that it will be useful,
# but... | gpl-2.0 |
stackforge/tacker | tacker/api/vnflcm/v1/sync_resource.py | 2 | 5064 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | apache-2.0 |
PrincessTeruko/TsunArt | tags/parser.py | 1 | 4394 | from tags.models import Tag
import collections, copy, json, re, urllib.parse
sample = 'young nia-teppelin with short multicolored hair and cat ears; yoko-littner with flame bikini, pink stockings, and long red hair without gun'
DEFAULT_TAG_DICT = {'nouns': collections.OrderedDict({}), 'filters': {}}
def format_quer... | mit |
erjohnso/ansible | lib/ansible/modules/network/illumos/dladm_vlan.py | 33 | 5394 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@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 |
Astron/yaml-cpp | test/gmock-1.7.0/gtest/test/gtest_output_test.py | 1733 | 12005 | #!/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... | mit |
gtko/CouchPotatoServer | libs/git/commit.py | 110 | 3498 | # Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.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:
# * Redistributions of source code must retain the above copyright
# notice, this li... | gpl-3.0 |
aequitas/home-assistant | homeassistant/components/homekit/type_fans.py | 10 | 6065 | """Class to hold all light accessories."""
import logging
from pyhap.const import CATEGORY_FAN
from homeassistant.components.fan import (
ATTR_DIRECTION, ATTR_OSCILLATING, ATTR_SPEED, ATTR_SPEED_LIST,
DIRECTION_FORWARD, DIRECTION_REVERSE, DOMAIN, SERVICE_OSCILLATE,
SERVICE_SET_DIRECTION, SERVICE_SET_SPEED... | apache-2.0 |
windyuuy/opera | chromium/src/third_party/trace-viewer/third_party/closure_linter/closure_linter/tokenutil.py | 135 | 10976 | #!/usr/bin/env python
#
# Copyright 2007 The Closure Linter 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
#... | bsd-3-clause |
itbabu/django-filer | filer/fields/multistorage_file.py | 12 | 2577 | #-*- coding: utf-8 -*-
from django.core.files.base import File
from django.core.files.storage import Storage
from easy_thumbnails import fields as easy_thumbnails_fields, \
files as easy_thumbnails_files
from filer import settings as filer_settings
from filer.utils.filer_easy_thumbnails import ThumbnailerNameMixin
... | mit |
our-city-app/oca-backend | src/rogerthat_service_api_calls.py | 1 | 1191 | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | apache-2.0 |
fabianfreyer/libvirt | scripts/check-symsorting.py | 7 | 3536 | #!/usr/bin/env python3
# Copyright (C) 2012-2019 Red Hat, Inc.
#
# This library 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 2.1 of the License, or (at your option) any later versio... | lgpl-2.1 |
brandond/ansible | lib/ansible/modules/network/nso/nso_show.py | 69 | 3509 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Cisco and/or its affiliates.
#
# 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 |
gijs/inasafe | third_party/raven/utils/encoding.py | 25 | 3510 | """
raven.utils.encoding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import warnings
def force_unicode(s, encoding='utf-8', errors='strict'):
"""
Similar to smart_unicode, except that lazy instances are ... | gpl-3.0 |
mattbasta/amo-validator | tests/compat/test_gecko10.py | 1 | 2585 | from helper import CompatTestCase
from validator.compat import FX10_DEFINITION
class TestFX10Compat(CompatTestCase):
"""Test that compatibility tests for Firefox 10 are properly executed."""
VERSION = FX10_DEFINITION
def test_isSameNode(self):
"""Test that `isSameNode` is flagged in Gecko 10."""... | bsd-3-clause |
wtodom/spotipi | spotipi/sandbox/sandbox.py | 1 | 1256 | from __future__ import print_function, unicode_literals
import getpass
import sys
import threading
import spotify
if sys.argv[1:]:
track_uri = sys.argv[1]
else:
track_uri = 'spotify:track:6xZtSE6xaBxmRozKA0F6TA'
# Assuming a spotify_appkey.key in the current dir
session = spotify.Session()
# Process event... | mit |
dawnbreak/hubzilla | library/blueimp_upload/server/gae-python/main.py | 29 | 7574 | # -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example
# https://github.com/blueimp/jQuery-File-Upload
#
# Copyright 2011, Sebastian Tschan
# https://blueimp.net
#
# Licensed under the MIT license:
# https://opensource.org/licenses/MIT
#
from google.appengine.api import memcache, images
import json
i... | mit |
listamilton/supermilton.repository | plugin.video.sonypictures/cloudflare.py | 221 | 2812 | import sys,traceback,urllib2,re, urllib,xbmc
def createCookie(url,cj=None,agent='Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0'):
urlData=''
try:
import urlparse,cookielib,urllib2
class NoRedirection(urllib2.HTTPErrorProcessor):
def http_response(self, reques... | gpl-2.0 |
kalamaico/FootballManager | resources/random_generator.py | 1 | 1176 | #!python
import random, time
class RandomGenerator:
def __init__(self):
random.seed(time.clock())
def generate_uniform(self, min_v, max_v):
return random.uniform(min_v, max_v)
def generate_int(self, min_v, max_v):
return random.randint(min_v, max_v)
d... | lgpl-3.0 |
lenstr/rethinkdb | external/v8_3.30.33.16/testing/gtest/test/gtest_output_test.py | 496 | 12051 | #!/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... | agpl-3.0 |
rofl0r/gdb | gdb/testsuite/gdb.python/py-section-script.py | 6 | 1962 | # Copyright (C) 2010, 2011 Free Software Foundation, 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; either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | gpl-2.0 |
chaomodus/pymetasurf | examples/shape.py | 1 | 6757 | # An example of using pymetasurf to create objects in Panda3d
# Written by Cas Rusnov <rusnovn@gmail.com>
import pymetasurf
import pymetasurf.shapes as shapes
from pandac.PandaModules import loadPrcFile
configfiles = ["./Config.prc",]
for prc in configfiles:
loadPrcFile(prc)
import sys
from direct.showbase.ShowB... | lgpl-2.1 |
Edraak/edx-platform | lms/djangoapps/lti_provider/users.py | 63 | 5258 | """
LTI user management functionality. This module reconciles the two identities
that an individual has in the campus LMS platform and on edX.
"""
import string
import random
import uuid
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
fr... | agpl-3.0 |
oleiade/Hurdles | hurdles/referee/importer.py | 1 | 3834 | # -*- coding: utf-8 -*-
# Copyright (c) 2012 theo crevon
#
# See the file LICENSE for copying permission.
#
# Content of this module was extracted from python nose
# project importer.py module.
#
# See : https://github.com/nose-devs/nose/blob/master/nose/importer.py
#
import os
import sys
import imp
class Importe... | mit |
packenx/PythonInstaller | app/src/main/assets/arm/static/python/lib/python2.7/site-packages/dpkt/tcp.py | 15 | 3226 | # $Id: tcp.py 42 2007-08-02 22:38:47Z jon.oberheide $
"""Transmission Control Protocol."""
import dpkt
# TCP control flags
TH_FIN = 0x01 # end of data
TH_SYN = 0x02 # synchronize sequence numbers
TH_RST = 0x04 # reset connection
TH_PUSH = 0x08 # push
TH_ACK = 0x10 # acknowledgment number set
TH_URG = 0x20... | gpl-3.0 |
bvamanan/ns3 | src/visualizer/visualizer/plugins/interface_statistics.py | 182 | 6565 | import gtk
import ns.core
import ns.network
from visualizer.base import InformationWindow
NODE_STATISTICS_MEMORY = 10
class StatisticsCollector(object):
"""
Collects interface statistics for all nodes.
"""
class NetDevStats(object):
__slots__ = ['rxPackets', 'rxBytes', 'txPackets', 'txBytes'... | gpl-2.0 |
Bitcoinsulting/bitcoinxt | contrib/seeds/generate-seeds.py | 115 | 4377 | #!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory that... | mit |
spolanski/WirnikApp | wirnikApp/calculix.py | 1 | 6259 | # -*- coding: utf-8 -*-
"""
W tym pliku następuje konwersja pliku wsadowego z programu GMSH na plik do programu Calculix.
"""
import numpy as np
import os
def zmianaElem(mesh, stMesh):
"""
Funkcja zmienia formę zapisu elementów na odpowiednia dla Calculix'a.
"""
np.set_printoptions(threshold='nan')
... | gpl-3.0 |
andaviaco/tronido | src/syntax/statements/ifstat.py | 1 | 1530 | from lexer import lang
from ..tree import Node
class IfStat(Node):
"""docstring for IfStat."""
def __init__(self, exp, stats, else_stat, token):
super().__init__(None, token)
self.exp = exp or Node(None, token)
self.stats = stats
self.else_stat = else_stat
def process_sema... | mit |
dimaspivak/docker-py | tests/integration/api_container_test.py | 1 | 49036 | import os
import signal
import tempfile
import docker
from docker.constants import IS_WINDOWS_PLATFORM
from docker.utils.socket import next_frame_size
from docker.utils.socket import read_exactly
import pytest
import six
from .base import BUSYBOX, BaseAPIIntegrationTest
from .. import helpers
from ..helpers import ... | apache-2.0 |
sandeepklr/gridmap | examples/manual.py | 5 | 3147 | #!/usr/bin/env python
# Written (W) 2008-2012 Christian Widmer
# Written (W) 2008-2010 Cheng Soon Ong
# Written (W) 2012-2014 Daniel Blanchard, dblanchard@ets.org
# Copyright (C) 2008-2012 Max-Planck-Society, 2012-2014 ETS
# This file is part of GridMap.
# GridMap is free software: you can redistribute it and/or mod... | gpl-3.0 |
dajhorn/ps2binutils | gdb/testsuite/gdb.python/py-pp-registration.py | 32 | 2383 | # Copyright (C) 2010-2015 Free Software Foundation, 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; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | gpl-2.0 |
StealthMicro/OctoPi-Makerbot | env/Lib/site-packages/serial/rfc2217.py | 10 | 58347 | #! python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# see __init__.py
#
# This module implements a RFC2217 compatible client. RF2217 descibes a
# protocol to access serial ports over TCP/IP and allows setting the baud rate,
# modem control lines etc.
#
# (C) 2001-2009 Chris Liechti <cliechti@gmx.ne... | agpl-3.0 |
Lh4cKg/sl4a | python-build/python-libs/gdata/src/gdata/tlslite/utils/RSAKey.py | 253 | 8575 | """Abstract class for RSA."""
from cryptomath import *
class RSAKey:
"""This is an abstract base class for RSA keys.
Particular implementations of RSA keys, such as
L{OpenSSL_RSAKey.OpenSSL_RSAKey},
L{Python_RSAKey.Python_RSAKey}, and
L{PyCrypto_RSAKey.PyCrypto_RSAKey},
inherit from this.
... | apache-2.0 |
waynesun09/tp-libvirt | libvirt/tests/src/libvirt_usb_hotplug_device.py | 4 | 6819 | import os
import shutil
from aexpect import ShellError
from aexpect import ShellTimeoutError
from autotest.client.shared import error
from avocado.utils import process
from virttest import data_dir
from virttest import virsh
from virttest import utils_misc
from virttest import utils_selinux
from virttest.remote imp... | gpl-2.0 |
szhem/spark | examples/src/main/python/mllib/recommendation_example.py | 128 | 2054 | #
# 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 us... | apache-2.0 |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/search/result_processor.py | 5 | 5747 | """ overridable result processor object to allow additional properties to be exposed """
import inspect
from itertools import chain
import json
import logging
import re
import textwrap
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from .utils import _load_class
DESIRED_E... | agpl-3.0 |
Conan-Kudo/snapd | tests/lib/snaps/test-snapd-python-webserver/server.py | 13 | 1271 | #!/usr/bin/python3
import os
import sys
import urllib.request
from http.server import HTTPServer, SimpleHTTPRequestHandler
class XkcdRequestHandler(SimpleHTTPRequestHandler):
XKCD_URL = "http://xkcd.com/"
XKCD_IMG_URL = "http://imgs.xkcd.com/"
def _mini_proxy(self, url):
fp = urllib.request.ur... | gpl-3.0 |
pschmitt/home-assistant | homeassistant/components/denon/media_player.py | 7 | 8655 | """Support for Denon Network Receivers."""
import logging
import telnetlib
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
SUPPORT_PLAY,
SUPPORT_PR... | apache-2.0 |
sgiavasis/nipype | nipype/interfaces/camino/tests/test_auto_TrackBedpostxDeter.py | 10 | 2351 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..dti import TrackBedpostxDeter
def test_TrackBedpostxDeter_inputs():
input_map = dict(anisfile=dict(argstr='-anisfile %s',
),
anisthresh=dict(argstr='-anisthresh %f',
),
args=dict(argstr='%s',
),
... | bsd-3-clause |
forcedotcom/todomvc | labs/architecture-examples/backbone.xmpp/server/bootstrap.py | 27 | 4119 | ##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | mit |
sandeepkoduri/GAE-html-to-pdf | libs/html5lib/treewalkers/__init__.py | 499 | 5766 | """A collection of modules for iterating through different kinds of
tree, generating tokens identical to those produced by the tokenizer
module.
To create a tree walker for a new type of tree, you need to do
implement a tree walker object (called TreeWalker by convention) that
implements a 'serialize' method taking a ... | mit |
tensorflow/model-analysis | tensorflow_model_analysis/eval_saved_model/exporter_test.py | 1 | 6887 | # Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
caesar2164/edx-platform | lms/djangoapps/course_api/forms.py | 33 | 2327 | """
Course API forms
"""
from collections import namedtuple
from django.core.exceptions import ValidationError
from django.forms import Form, CharField
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.util.forms import ExtendedNullBooleanField
class Use... | agpl-3.0 |
puttarajubr/commcare-hq | corehq/apps/es/tests.py | 1 | 9490 | import json
from unittest import TestCase
from corehq.elastic import ESError, SIZE_LIMIT
from .es_query import HQESQuery, ESQuerySet
from . import facets
from . import filters
from . import forms, users
class ElasticTestMixin(object):
def checkQuery(self, query, json_output):
msg = "Expected Query:\n{}\n... | bsd-3-clause |
lesserwhirls/scipy-cwt | scipy/sparse/linalg/eigen/lobpcg/tests/benchmark.py | 11 | 1437 | from scipy import *
from scipy.sparse.linalg import lobpcg
from symeig import symeig
from pylab import plot, show, legend, xlabel, ylabel
set_printoptions(precision=3,linewidth=90)
import time
def test(n):
x = arange(1,n+1)
B = diag(1./x)
y = arange(n-1,0,-1)
z = arange(2*n-1,0,-2)
A = diag(z)-diag... | bsd-3-clause |
wwj718/ANALYSE | common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py | 29 | 9611 | # encoding: utf-8
"""
The data type and use of it for declaratively creating test courses.
"""
# used to create course subtrees in ModuleStoreTestCase.create_test_course
# adds to self properties w/ the given block_id which hold the UsageKey for easy retrieval.
# fields is a dictionary of keys and values. sub_tree is a... | agpl-3.0 |
CMDann/filesync-server | src/backends/db/schemas/fsync_shard/patch_11.py | 6 | 1270 | # Copyright 2008-2015 Canonical
#
# This program 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 option) any later version.
#
# This program is distributed... | agpl-3.0 |
betterlife/psi | tests/utils/format_util_test.py | 2 | 1502 | # coding=utf-8
import unittest
from psi.app.utils import format_util
class TestFormatUtil(unittest.TestCase):
def test_decimal_to_percent(self):
self.assertEqual("33.33%", format_util.decimal_to_percent(0.3333))
self.assertEqual("200.00%", format_util.decimal_to_percent(2))
self.assertEq... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.