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 |
|---|---|---|---|---|---|
piyushroshan/tuxofwar2012 | questiondb.py | 1 | 1400 | # Model Defining Questions Database
import string
from google.appengine.ext import db
class questionm(db.Model):
questionNumber = db.IntegerProperty(required=True)
question = db.StringProperty(required=True, multiline=True)
qimage = db.StringProperty()
opt1 = db.StringProperty(required=True, multiline=True)
opt2 =... | gpl-2.0 |
fedora-infra/anitya | anitya/lib/versions/base.py | 2 | 7364 | # -*- coding: utf-8 -*-
#
# Copyright © 2017-2020 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed ... | gpl-2.0 |
cgstudiomap/cgstudiomap | main/parts/geospatial/base_geoengine_demo/geo_npa.py | 7 | 2713 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 |
kawasaki2013/python-for-android-x86 | python3-alpha/python3-src/Lib/test/test_compare.py | 169 | 1666 | import unittest
from test import support
class Empty:
def __repr__(self):
return '<Empty>'
class Cmp:
def __init__(self,arg):
self.arg = arg
def __repr__(self):
return '<Cmp %s>' % self.arg
def __eq__(self, other):
return self.arg == other
class Anything:
def __e... | apache-2.0 |
chubbymaggie/angr | angr/procedures/cgc/deallocate.py | 5 | 1798 | import angr
import logging
l = logging.getLogger("angr.procedures.cgc.deallocate")
class deallocate(angr.SimProcedure):
#pylint:disable=arguments-differ
IS_SYSCALL = True
def run(self, addr, length): #pylint:disable=unused-argument
# return code (see deallocate() docs)
r = self.state.se.... | bsd-2-clause |
playpauseandstop/setman | setman/utils/importlib.py | 1 | 1408 | """
Backported from `importlib <http://pypi.python.org/pypi/importlib>` library,
which itself backported from Python 3.x branch.
"""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the a... | bsd-3-clause |
Passtechsoft/TPEAlpGen | blender/release/scripts/startup/bl_ui/properties_constraint.py | 2 | 30186 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | gpl-3.0 |
bala4901/odoo | addons/event/event.py | 17 | 23223 | # -*- 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 |
vovojh/gem5 | src/mem/slicc/ast/CheckAllocateStatementAST.py | 91 | 2239 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# 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 co... | bsd-3-clause |
basicthinker/Sexain-MemController | gem5-stable/src/arch/x86/isa/insts/general_purpose/compare_and_test/__init__.py | 91 | 2398 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | apache-2.0 |
Pastafarians/linguine-python | linguine/ops/tfidf.py | 4 | 2232 | #!/usr/bin/env python
"""
Given a set of texts, calculates the TF-IDF for each word-text pair in the set.
Returns: A list of dictionaries containing a term, a corpus id, the term's importance in that corpus.
Given: A list of corpuses
"""
import math, nltk, re, pprint
from linguine.transaction_exception import Transacti... | mit |
benbahrenburg/titanium_mobile | support/common/mako/_ast_util.py | 63 | 25415 | # -*- coding: utf-8 -*-
"""
ast
~~~
The `ast` module helps Python applications to process trees of the Python
abstract syntax grammar. The abstract syntax itself might change with
each Python release; this module helps to find out programmatically what
the current grammar looks like and allows... | apache-2.0 |
chubbymaggie/pmu-tools | parser/elf.py | 4 | 3750 | #!/usr/bin/python
# resolve ELF and DWARF symbol tables using elftools
#
# Copyright (c) 2013-2014, Intel Corporation
# Author: Andi Kleen
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free... | gpl-2.0 |
nirmeshk/oh-mainline | vendor/packages/kombu/kombu/pools.py | 38 | 3812 | """
kombu.pools
===========
Public resource pools.
"""
from __future__ import absolute_import
import os
from itertools import chain
from .connection import Resource
from .five import range, values
from .messaging import Producer
from .utils import EqualityDict
from .utils.functional import lazy
__all__ = ['Produc... | agpl-3.0 |
pombredanne/pants | contrib/node/src/python/pants/contrib/node/targets/node_package.py | 18 | 1308 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.payl... | apache-2.0 |
johnkit/vtk-dev | ThirdParty/Twisted/twisted/internet/abstract.py | 23 | 18684 | # -*- test-case-name: twisted.test.test_abstract -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Support for generic select()able objects.
"""
from __future__ import division, absolute_import
from socket import AF_INET6, inet_pton, error
from zope.interface import implementer
# Twis... | bsd-3-clause |
cboling/SDNdbg | docs/old-stuff/pydzcvr/doc/neutron/db/migration/alembic_migrations/versions/2db5203cb7a9_nuage_floatingip.py | 17 | 4286 | # Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 |
df8oe/UHSDR | mchf-eclipse/drivers/ui/lcd/edit-8x8-font.py | 4 | 2343 | # Tool to extract 8x8 font data, save to bitmap file, and apply modifications
# to source code after editing the bitmap.
from __future__ import print_function
from matplotlib.pyplot import imread, imsave, imshow, show
import numpy as np
import sys
# Where to find the font data - may need updated if code has changed.
... | gpl-3.0 |
pducks32/intergrala | python/sympy/sympy/galgebra/ncutil.py | 25 | 14339 | # sympy/galgebra/ncutil.py
"""
ncutil.py contains all the needed utility functions that only depend on
SymPy and that are required for the expansion and manipulation of linear
combinations of noncommutative SymPy symbols.
also contains "half_angle_reduce" which is probably not needed any more
due to the improvements ... | mit |
authman/Python201609 | Nguyen_Ken/Assignments/Flask/registration_form/server.py | 1 | 1721 | from flask import Flask, render_template, request, redirect, session, flash
import re
app = Flask(__name__)
app.secret_key = 'secretsquirrel'
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/process', meth... | mit |
creative-quant/voltdb | tests/scripts/examples/sql_coverage/all-config.py | 7 | 15894 | #!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# 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 limitati... | agpl-3.0 |
altova/sec-edgar-tools | sec_filing_to_xlsx.py | 1 | 11948 | # Copyright 2015 Altova GmbH
#
# 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 writi... | apache-2.0 |
Kyly/mustaske | test/selenium_src/leave_room.py | 1 | 3018 | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... | mit |
tsdmgz/ansible | lib/ansible/modules/cloud/amazon/ecs_ecr.py | 7 | 11243 | #!/usr/bin/python
# Copyright: 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
kailIII/geraldo | site/newsite/django_1_0/django/contrib/sessions/tests.py | 11 | 5813 | r"""
>>> from django.conf import settings
>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession
>>> from django.contrib.sessions.backends.file import SessionStore as FileSession
>>> from django.contrib.ses... | lgpl-3.0 |
jayvdb/flake8-copyright | setup.py | 1 | 1860 | # -=- encoding: utf-8 -=-
#
# Copyright (C) 2014 Savoir-faire Linux 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 versio... | gpl-3.0 |
e-q/scipy | scipy/_lib/tests/test__util.py | 4 | 7974 | from multiprocessing import Pool
from multiprocessing.pool import Pool as PWL
import os
import math
import numpy as np
from numpy.testing import assert_equal, assert_
import pytest
from pytest import raises as assert_raises, deprecated_call
import scipy
from scipy._lib._util import (_aligned_zeros, check_random_state... | bsd-3-clause |
berkmancenter/mediacloud | apps/common/tests/python/mediawords/languages/test_ro.py | 1 | 5631 | from unittest import TestCase
from mediawords.languages.ro import RomanianLanguage
# noinspection SpellCheckingInspection
class TestRomanianLanguage(TestCase):
def setUp(self):
self.__tokenizer = RomanianLanguage()
def test_language_code(self):
assert self.__tokenizer.language_code() == "ro... | agpl-3.0 |
TOC-Shard/moul-scripts | Python/system/encodings/cp1251.py | 593 | 13617 | """ Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.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,in... | gpl-3.0 |
mohitsethi/solum | solum/api/controllers/v1/extension.py | 1 | 2846 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 |
sebastienhupin/qxrad | qooxdoo/component/standalone/website/generate.py | 6 | 3285 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# qooxdoo - the new era of web development
#
# http://qooxdoo.org
#
# Copyright:
# 2008 - 2012 1&1 Internet AG, Germany, http://www.1und1.de
#
# License:
# LGPL: http://www.gnu.org/... | lgpl-3.0 |
anash28/linux-agent | dattolib/__init__.py | 2 | 1246 | import sys
import os
import socket
import struct
from request_pb2 import Request
from reply_pb2 import Reply
IPC_SOCKET_PATH = "/var/run/dattod.sock"
class DattodConnectionError(Exception):
pass
# Send a Request to dattod over the unix socket IPC_SOCKET_PATH
def make_request_to_dattod(request):
# check if s... | gpl-2.0 |
amacd31/bom_data_parser | tests/test_hrs.py | 1 | 2066 | import os
import numpy as np
import pandas as pd
import unittest
from datetime import datetime
from bom_data_parser import read_hrs_csv
class HRSTest(unittest.TestCase):
def setUp(self):
self.test_cdo_file = os.path.join(os.path.dirname(__file__), 'data', 'HRS', '410730_daily_ts.csv')
def test_hrs(se... | bsd-3-clause |
Microsoft/hummingbird | hummingbird/ml/exceptions.py | 1 | 1451 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
Commo... | mit |
javier3407/Plugin.Video.JavierTV | resources/tools/seriesyonkis.py | 4 | 20563 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# Parser de SeriesYonkis para PalcoTV
# Version 0.1 (22.04.2015)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a las librerías de pelisalacarta de Jes... | gpl-2.0 |
alephu5/Soundbyte | environment/lib/python3.3/site-packages/numpy/core/generate_numpy_api.py | 16 | 7465 | from __future__ import division, print_function
import os
import genapi
from genapi import \
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
import numpy_api
h_template = r"""
#ifdef _MULTIARRAYMODULE
typedef struct {
PyObject_HEAD
npy_bool obval;
} PyBoolScalarObject;
#ifdef NPY_ENABLE_... | gpl-3.0 |
diofant/diofant | diofant/tests/vector/test_vector.py | 2 | 6040 | import pytest
from diofant import Add, Derivative, Function
from diofant import ImmutableMatrix as Matrix
from diofant import (Integral, Mul, Pow, cos, diff, pi, simplify, sin, sqrt,
symbols, trigsimp)
from diofant.abc import a, b, c
from diofant.vector import (BaseVector, CoordSysCartesian, Vecto... | bsd-3-clause |
skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/werkzeug/contrib/securecookie.py | 294 | 12204 | # -*- coding: utf-8 -*-
r"""
werkzeug.contrib.securecookie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements a cookie that is not alterable from the client
because it adds a checksum the server checks for. You can use it as
session replacement if all you have is a user id or something to mark
... | gpl-2.0 |
bassijtsma/chatbot | yowsup/layers/protocol_groups/protocolentities/notification_groups_add.py | 61 | 1946 | from .notification_groups import GroupsNotificationProtocolEntity
from yowsup.structs import ProtocolTreeNode
class AddGroupsNotificationProtocolEntity(GroupsNotificationProtocolEntity):
'''
<notification participant="{{participant_jiid}}" t="{{TIMESTAMP}}" from="{{group_jid}}" type="w:gp2" id="{{id}}" notify="What... | gpl-3.0 |
BludhavenGrayson/repository.BludhavenGrayson | plugin.video.bhg.uktvplay/net.py | 81 | 10355 | '''
common XBMC Module
Copyright (C) 2011 t0mm0
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.
Th... | gpl-2.0 |
pe-suke/ansible | lib/ansible/module_utils/cloudstack.py | 59 | 14689 | # -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the aut... | gpl-3.0 |
iansf/engine | third_party/jinja2/tests.py | 638 | 3444 | # -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
from jinja2._compat import text_type, string_types, mappi... | bsd-3-clause |
zhaogaolong/oneFinger | openstack/api/opentack_ansible.py | 1 | 1743 | #!/usr/bin/env python
# coding:utf8
# import pdb
import ansible.runner
from one_finger.cloud_logging import cloud_logging as logging
log = logging.logger
class CmmAndRun():
def __init__(self, module_name='shell', host=None, cmd=None, timeout=20):
self.username = 'root'
self.module_n... | apache-2.0 |
CanalTP/navitia | source/jormungandr/jormungandr/interfaces/v1/JSONSchema.py | 3 | 5011 | # coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | agpl-3.0 |
moiseshiraldo/inviMarket | inviMarket/views/register.py | 1 | 2814 | # -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.conf import settings
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.utils import ti... | agpl-3.0 |
mojeto/django | django/contrib/gis/db/models/aggregates.py | 9 | 2194 | from django.contrib.gis.db.models.fields import ExtentField
from django.db.models.aggregates import Aggregate
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']
class GeoAggregate(Aggregate):
function = None
is_extent = False
def as_sql(self, compiler, connection):
# this will be c... | bsd-3-clause |
michelts/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/get_or_create_regress/tests.py | 88 | 2540 | from django.test import TestCase
from models import Author, Publisher
class GetOrCreateTests(TestCase):
def test_related(self):
p = Publisher.objects.create(name="Acme Publishing")
# Create a book through the publisher.
book, created = p.books.get_or_create(name="The Book of Ed & Fred")
... | gpl-3.0 |
Anonymous-X6/django | django/views/generic/detail.py | 306 | 6922 | from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
class SingleObjectMixin(Conte... | bsd-3-clause |
zenlambda/pip | pip/_vendor/cachecontrol/adapter.py | 469 | 4196 | import functools
from pip._vendor.requests.adapters import HTTPAdapter
from .controller import CacheController
from .cache import DictCache
from .filewrapper import CallbackFileWrapper
class CacheControlAdapter(HTTPAdapter):
invalidating_methods = set(['PUT', 'DELETE'])
def __init__(self, cache=None,
... | mit |
jamal-ahmad/Logging-Kernel | tools/perf/scripts/python/event_analyzing_sample.py | 4719 | 7393 | # event_analyzing_sample.py: general event handler in python
#
# Current perf report is already very powerful with the annotation integrated,
# and this script is not trying to be as powerful as perf report, but
# providing end user/developer a flexible way to analyze the events other
# than trace points.
#
# The 2 dat... | gpl-2.0 |
scealiontach/cryptotrading | src/autotrader/hashnest.py | 1 | 4020 | import urllib,urllib.parse,urllib.request,urllib.error
import json
import time,datetime
import hashlib,hmac,base64
import logging
LOG=logging.getLogger(__name__)
#SELL='sale'
#BUY='purchase'
class hashnest(object):
URL = 'https://www.hashnest.com/api/v1/'
def __init__(self,username,key,secret):
... | apache-2.0 |
tuskar/tuskar | tuskar/openstack/common/rpc/impl_kombu.py | 2 | 31906 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | apache-2.0 |
jreut/Switcharoo | scraper/scraper/events.py | 2 | 1340 | # Copyright 2015 Adam Greenstein <adamgreenstein@comcast.net>
#
# Switcharoo 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.
#
# Switc... | gpl-3.0 |
mdeemer/XlsxWriter | xlsxwriter/test/styles/test_styles01.py | 8 | 2940 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...styles import Styles
from ...workbook impo... | bsd-2-clause |
sony/nnabla | python/test/utils/learning_rate_scheduler/test_cosine_scheduler.py | 1 | 1249 | # Copyright 2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
mattstruble/crusty | crusty/graphics/colorama/winterm.py | 523 | 4206 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from . import win32
# from wincon.h
class WinColor(object):
BLACK = 0
BLUE = 1
GREEN = 2
CYAN = 3
RED = 4
MAGENTA = 5
YELLOW = 6
GREY = 7
# from wincon.h
class WinStyle(object):
NORMAL = 0... | mit |
foxmask/django-th | django_th/html_entities.py | 1 | 1275 | # coding: utf-8
import html.entities as htmlentities
import re
class HtmlEntities:
def __init__(self, my_string):
self.my_string = my_string
def html_entity_decode_char(self, m, defs=htmlentities.entitydefs):
"""
decode html entity into one of the html char
"""
tr... | bsd-3-clause |
llhe/tensorflow | tensorflow/contrib/slim/python/slim/learning_test.py | 17 | 37002 | # 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 |
elkingtonmcb/nupic | src/encoders/adaptivescalar.py | 32 | 8059 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
linearregression/osquery | tools/codegen/gentargets.py | 42 | 2749 | #!/usr/bin/env python
import argparse
import json
import logging
import os
logging_format = '[%(levelname)s] %(message)s'
logging.basicConfig(level=logging.INFO, format=logging_format)
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
REPO_ROOT_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, "../.."))
def ge... | bsd-3-clause |
liamgh/liamgreenhughes-sl4a-tf101 | python/src/Lib/test/test_tuple.py | 59 | 3024 | from test import test_support, seq_tests
class TupleTest(seq_tests.CommonTest):
type2test = tuple
def test_constructors(self):
super(TupleTest, self).test_len()
# calling built-in types without argument must return empty
self.assertEqual(tuple(), ())
t0_3 = (0, 1, 2, 3)
... | apache-2.0 |
cihai/cihai-python | tests/test_conversion.py | 1 | 3543 | # -*- coding: utf-8 -*-
"""Tests for cihai.
test.conversion
~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, print_function, unicode_literals
from cihai import conversion
from cihai._compat import string_types, text_type
def test_text_type():
c1 = '(same as U+7A69 穩) firm; stable; secure'
c2 = ... | bsd-3-clause |
sajeeshcs/nested_projects_keystone | keystone/credential/controllers.py | 1 | 4503 | # Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 |
mancoast/CPythonPyc_test | cpython/254_test_glob.py | 19 | 3723 | import unittest
from test.test_support import run_unittest, TESTFN
import glob
import os
import shutil
class GlobTests(unittest.TestCase):
def norm(self, *parts):
return os.path.normpath(os.path.join(self.tempdir, *parts))
def mktemp(self, *parts):
filename = self.norm(*parts)
base, f... | gpl-3.0 |
kevalds51/sympy | sympy/simplify/tests/test_sqrtdenest.py | 98 | 6451 | from sympy import sqrt, root, S, Symbol, sqrtdenest, Integral, cos
from sympy.simplify.sqrtdenest import _subsets as subsets
r2, r3, r5, r6, r7, r10, r15, r29 = [sqrt(x) for x in [2, 3, 5, 6, 7, 10,
15, 29]]
def test_sqrtdenest():
d = {sqrt(5 + 2 * r6): r2 + r3,
... | bsd-3-clause |
blueboxgroup/nova | nova/volume/encryptors/base.py | 61 | 1949 | # Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | apache-2.0 |
huggingface/pytorch-transformers | src/transformers/modeling_tf_outputs.py | 2 | 42017 | # Copyright 2020 The HuggingFace Team. 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 applicabl... | apache-2.0 |
nerzhul/ansible | lib/ansible/plugins/lookup/random_choice.py | 253 | 1226 | # (c) 2013, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | gpl-3.0 |
guoxuesong/deepstacks | deepstacks/lasagne/utils.py | 1 | 2721 | #!/usr/bin/env python
# coding:utf-8
# vi:tabstop=4:shiftwidth=4:expandtab:sts=4
import theano
import lasagne
from join import join_layer as JoinLayer
from ..utils.curry import curry
floatX = theano.config.floatX
def ordered_errors(errors, m=None, prefix='', deterministic=False):
res = []
for t in errors:
... | mit |
michelts/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/admin_changelist/models.py | 51 | 1353 | from django.db import models
class Parent(models.Model):
name = models.CharField(max_length=128)
class Child(models.Model):
parent = models.ForeignKey(Parent, editable=False, null=True)
name = models.CharField(max_length=30, blank=True)
class Genre(models.Model):
name = models.CharField(max_length=20... | gpl-3.0 |
DevynCJohnson/Pybooster | pylib/convvolume.py | 1 | 120739 | #!/usr/bin/env python3
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# vim: set fileencoding=utf-8 filetype=python syntax=python.doxygen fileformat=unix tabstop=4 expandtab :
# kate: encoding utf-8; bom off; syntax python; indent-mode python; eol unix; replace-tabs off; indent-width 4; tab-... | lgpl-3.0 |
fingeronthebutton/RIDE | src/robotide/lib/robot/utils/ordereddict.py | 1047 | 4094 | # Copyright (c) 2009 Raymond Hettinger
#
# 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,
# publish,... | apache-2.0 |
maleficarium/youtube-dl | youtube_dl/extractor/ellentv.py | 11 | 2708 | # coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
)
class EllenTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)'
_TEST = {
'url': 'http://www.elle... | unlicense |
lisael/pg-django | django/contrib/auth/middleware.py | 101 | 3501 | from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
request._cached_user = auth.get_user(request)
return request._cached_user
class AuthenticationM... | bsd-3-clause |
bavardage/statsmodels | statsmodels/stats/tests/test_groups_sw.py | 34 | 2750 | # -*- coding: utf-8 -*-
"""Test for a helper function for PanelHAC robust covariance
the functions should be rewritten to make it more efficient
Created on Thu May 17 21:09:41 2012
Author: Josef Perktold
"""
import numpy as np
from numpy.testing import assert_equal, assert_raises
import statsmodels.stats.sandwich_co... | bsd-3-clause |
keithroe/vtkoptix | Imaging/Core/Testing/Python/TestAllFlips.py | 20 | 1214 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Image pipeline
reader = vtk.vtkImageReader()
reader.GetExecutive().SetReleaseDataFlag(0,0)
reader.SetDataByteOrderToLittleEndian()
reader.SetDataExtent(0,63,0,63,1,93)
reader.SetFil... | bsd-3-clause |
googleapis/python-pubsublite | tests/unit/pubsublite/cloudpubsub/internal/single_partition_subscriber_test.py | 1 | 10169 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 |
jbedorf/tensorflow | tensorflow/contrib/rnn/python/ops/fused_rnn_cell.py | 15 | 6099 | # 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 |
Alidron/demo-nao | alidron-env/lib/python2.7/site-packages/coverage/test_helpers.py | 45 | 11036 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Mixin classes to help make good tests."""
import atexit
import collections
import contextlib
import os
import random
import shutil
import sys
import tempfile
im... | mpl-2.0 |
cyberark-bizdev/ansible | lib/ansible/modules/cloud/docker/docker_volume.py | 45 | 7796 | #!/usr/bin/python
# coding: utf-8
#
# Copyright 2017 Red Hat | Ansible, Alex Grönholm <alex.gronholm@nextday.fi>
# 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 = {'meta... | gpl-3.0 |
jxta/cc | vendor/python-gflags/gflags.py | 4 | 84466 | #!/usr/bin/env python
# Copyright (c) 2007, 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 l... | apache-2.0 |
michaljach/ember-cli-xpagination | node_modules/ember-cli/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 292 | 114315 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from compiler.ast import Const
from compiler.ast import Dict
from compiler.ast import Discard
from compiler.ast import List
from compiler.ast import Module
from co... | mit |
nugget/home-assistant | homeassistant/components/sensor/buienradar.py | 2 | 22393 | """
Support for Buienradar.nl weather service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.buienradar/
"""
import asyncio
from datetime import datetime, timedelta
import logging
import async_timeout
import aiohttp
import voluptuous as vol
imp... | apache-2.0 |
guo-yu/pynotes | examples/def.py | 2 | 1046 | # -*- coding: UTF-8 –*-
#!/usr/bin/python
# Filename : def.py
# 使用 def 关键词定义一个函数
# 什么是函数?
# 函数是一些代码片段的组合
# 你可以使用你希望使用的名字来定义函数,然后使用这个函数的名字来调用函数
# 我们来试试看将 helloworld 包装在一个函数中进行使用
def helloworld(text="hello world!"):
print text
# 现在我们有了一个函数,函数有一些参数,参数在()中声明,在 python 中,你可以用 a=b 的方式来定义参数的默认数值,也可以不定义,像下面这样:
def hello... | mit |
vmthunder/nova | nova/tests/objects/test_dns_domain.py | 16 | 2997 | # Copyright (C) 2014, 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 or... | apache-2.0 |
jinxuan/googletest | test/gtest_catch_exceptions_test.py | 2139 | 9901 | #!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | bsd-3-clause |
sander76/home-assistant | homeassistant/components/mystrom/switch.py | 15 | 2895 | """Support for myStrom switches/plugs."""
import logging
from pymystrom.exceptions import MyStromConnectionError
from pymystrom.switch import MyStromSwitch as _MyStromSwitch
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, CO... | apache-2.0 |
lmaycotte/quark | quark/tests/test_nvp_driver.py | 2 | 56364 | # Copyright 2013 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 required by applicab... | apache-2.0 |
joyaether/zxing | cpp/scons/scons-local-2.0.0.final.0/SCons/Memoize.py | 34 | 9640 | #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without li... | apache-2.0 |
slickqa/slickqaweb | slickqaweb/api/files.py | 1 | 7168 | __author__ = 'jcorbett'
from slickqaweb.app import app
from flask import request, Response
from bson import ObjectId
from slickqaweb.model.storedFile import StoredFile
from slickqaweb.model.fileChunk import FileChunk
from slickqaweb.model.serialize import deserialize_that
from .standardResponses import JsonResponse, r... | apache-2.0 |
tomduijf/home-assistant | homeassistant/components/thermostat/heat_control.py | 2 | 7241 | """
homeassistant.components.thermostat.heat_control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for a thermostat.
Specify a start time, end time and a target temperature.
If the the current temperature is lower than the target temperature,
and the time is between start time and end time, the heater ... | mit |
postlund/home-assistant | homeassistant/components/geniushub/sensor.py | 5 | 3487 | """Support for Genius Hub sensor devices."""
from datetime import timedelta
from typing import Any, Dict
from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
import homeassistant.util.dt as dt_util
from . import DOMAIN, GeniusDevice, GeniusEntity
... | apache-2.0 |
pamoakoy/invenio | modules/websearch/lib/search_engine_summarizer.py | 5 | 8693 | # -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2008, 2010, 2011 CERN.
##
## Invenio 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... | gpl-2.0 |
kvar/ansible | test/units/modules/network/check_point/test_cp_mgmt_package_facts.py | 19 | 2835 | # Ansible module to manage CheckPoint Firewall (c) 2019
#
# 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 dist... | gpl-3.0 |
r3kall/AnimeRecommenderSystem | animerecommendersystem/recommender_systems/CollaborativeFilteringRS.py | 1 | 8293 | """
This files offers a recommendation system based on collaborative filtering technique.
1) Let U be the user we want to give recommendations to, for each user U2 != U we need to compute distance(U, U2) (*)
and get the top K neighbors. These neighbors should have watched a lot of animes also watched by U,
giv... | gpl-3.0 |
dhalleine/tensorflow | tensorflow/tools/dist_test/python/mnist_replica.py | 7 | 10321 | # 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 |
inovtec-solutions/OpenERP | openerp/addons/plugin/plugin_handler.py | 11 | 8035 | '''
Created on 18 oct. 2011
@author: openerp
'''
from openerp.osv import osv
from openerp.tools.translate import _
class plugin_handler(osv.osv_memory):
_name = 'plugin.handler'
def _make_url(self, cr, uid, res_id, model, context=None):
"""
@param res_id: on which document the message is... | agpl-3.0 |
icereval/scrapi | scrapi/harvesters/stepic.py | 1 | 2795 | """
Stepic.org harvester of MOOC-online courses for SHARE Notification Service
Example API query: https://stepic.org:443/api/lessons/100
"""
from __future__ import unicode_literals
import json
import pycountry
from dateutil.parser import parse
from scrapi import requests
from scrapi.base import JSONHarvester
from s... | apache-2.0 |
lepistone/purchase-workflow | purchase_fiscal_position_update/__openerp__.py | 9 | 1882 | # -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Fiscal Position Update module for Odoo
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
# Copyright (C) 2014 Akretion (http://www.akretion.com)
#
# This program is f... | agpl-3.0 |
eblot/micropython | tools/file2h.py | 103 | 1126 | # Reads in a text file, and performs the necessary escapes so that it
# can be #included as a static string like:
# static const char string_from_textfile[] =
# #include "build/textfile.h"
# ;
# This script simply prints the escaped string straight to stdout
from __future__ import print_function
import sys
... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.