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 |
|---|---|---|---|---|---|
redhatrises/freeipa | ipapython/graph.py | 3 | 2401 | #
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
class Graph(object):
"""
Simple oriented graph structure
G = (V, E) where G is graph, V set of vertices and E list of edges.
E = (tail, head) where tail and head are vertices
"""
def __init__(self):
self.vertices ... | gpl-3.0 |
benschulz/servo | tests/wpt/css-tests/tools/html5lib/html5lib/trie/datrie.py | 785 | 1166 | from __future__ import absolute_import, division, unicode_literals
from datrie import Trie as DATrie
from six import text_type
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
def __init__(self, data):
chars = set()
for key in data.keys():
if not isinstance(key, text_type):
... | mpl-2.0 |
sujeet4github/MyLangUtils | LangPython/oreilly-intro-to-flask-video/venv/lib/python3.6/site-packages/setuptools/command/bdist_rpm.py | 1049 | 1508 | import distutils.command.bdist_rpm as orig
class bdist_rpm(orig.bdist_rpm):
"""
Override the default bdist_rpm behavior to do the following:
1. Run egg_info to ensure the name and version are properly calculated.
2. Always run 'install' using --single-version-externally-managed to
disable eggs... | gpl-3.0 |
mdeff/ntds_2016 | project/reports/election_prediction/pattern/web/json/__init__.py | 26 | 20537 | r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | mit |
adaussy/eclipse-monkey-revival | plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_modulefinder.py | 113 | 8054 | import __future__
import os
import unittest
import distutils.dir_util
import tempfile
from test import test_support
try: set
except NameError: from sets import Set as set
import modulefinder
# Note: To test modulefinder with Python 2.2, sets.py and
# modulefinder.py must be available - they are not in the standard
... | epl-1.0 |
ewdurbin/sentry | src/sentry/queue/command.py | 28 | 3269 | from __future__ import absolute_import
import celery
import os
import sys
from django.core.management.base import BaseCommand
DB_SHARED_THREAD = """\
DatabaseWrapper objects created in a thread can only \
be used in that same thread. The object with alias '%s' \
was created in thread id %s and this is thread id %s.... | bsd-3-clause |
hortonworks/hortonworks-sandbox | desktop/core/ext-py/Beaker/beaker/crypto/__init__.py | 2 | 1220 | from warnings import warn
from beaker.crypto.pbkdf2 import PBKDF2, strxor
from beaker.exceptions import InvalidCryptoBackendError
_implementations = ('pycrypto', 'jcecrypto')
keyLength = None
for impl_name in _implementations:
try:
package = 'beaker.crypto.%s' % impl_name
module = __import__(pack... | apache-2.0 |
KhalidGit/flask | Work/Trivia - Module 5/env/Lib/site-packages/pip/_vendor/colorama/initialise.py | 484 | 1297 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = sys.stdout
orig_stderr = sys.stderr
wrapped_stdout = sys.stdout
wrapped_stderr = sys.stderr
atexit_done = False
def reset_all():
AnsiToWin32(orig_stdout).rese... | apache-2.0 |
ViderumGlobal/ckanext-requestdata | ckanext/requestdata/controllers/package.py | 1 | 3021 | from ckan.lib import base
from ckan.common import c, _
from ckan import logic
import ckan.model as model
import ckan.lib.helpers as h
from ckan.plugins import toolkit
from ckan.controllers.package import PackageController as _PackageController
import ckan.lib.navl.dictization_functions as dict_fns
from ckanext.requestd... | agpl-3.0 |
labordoc/labordoc-next | modules/bibsword/lib/bibsword_client_dblayer.py | 35 | 13645 | ## This file is part of Invenio.
## Copyright (C) 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 option) any later version.
##
... | gpl-2.0 |
ifduyue/django | tests/absolute_url_overrides/tests.py | 187 | 2120 | from django.db import models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps
@isolate_apps('absolute_url_overrides')
class AbsoluteUrlOverrideTests(SimpleTestCase):
def test_get_absolute_url(self):
"""
get_absolute_url() functions as a normal method.
"""
... | bsd-3-clause |
ohmini/thaifoodapi | lib/django/dispatch/weakref_backports.py | 414 | 2151 | """
weakref_backports is a partial backport of the weakref module for python
versions below 3.4.
Copyright (C) 2013 Python Software Foundation, see license.python.txt for
details.
The following changes were made to the original sources during backporting:
* Added `self` to `super` calls.
* Removed `from None` when... | bsd-3-clause |
Motolea/pentagram | aplicatiepentagram/Pentagram/views.py | 1 | 3440 | from django.shortcuts import render
from django.contrib.auth.models import User
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework import status
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.authtoken.models import Token
from... | gpl-3.0 |
zhanghenry/stocks | tests/str/models.py | 409 | 1300 | # -*- coding: utf-8 -*-
"""
Adding __str__() or __unicode__() to models
Although it's not a strict requirement, each model should have a
``_str__()`` or ``__unicode__()`` method to return a "human-readable"
representation of the object. Do this not only for your own sanity when dealing
with the interactive prompt, but... | bsd-3-clause |
ikool/metact06-djan | lib/Crypto/SelfTest/Signature/test_pkcs1_pss.py | 113 | 20598 | # -*- coding: utf-8 -*-
#
# SelfTest/Signature/test_pkcs1_pss.py: Self-test for PKCS#1 PSS signatures
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyon... | bsd-3-clause |
turbokongen/home-assistant | homeassistant/components/atag/__init__.py | 9 | 3723 | """The ATAG Integration."""
from datetime import timedelta
import logging
import async_timeout
from pyatag import AtagException, AtagOne
from homeassistant.components.climate import DOMAIN as CLIMATE
from homeassistant.components.sensor import DOMAIN as SENSOR
from homeassistant.components.water_heater import DOMAIN ... | apache-2.0 |
pombredanne/superzippy | superzippy/zipdir.py | 2 | 1520 | # Copyright (c) 2013 John Sullivan
# Copyright (c) 2013 Other contributers as noted in the CONTRIBUTERS file
#
# This file is part of superzippy
#
# 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... | apache-2.0 |
Samuc/Proyecto-IV | lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/_base.py | 915 | 13711 | from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
from ..constants import scopingElements, tableInsertModeElements, namespaces
# The scope markers are inserted when entering object elements,
# marquees, table cells, and table captions, and are used to prevent for... | gpl-2.0 |
hlange/LogSoCR | .waf/waflib/extras/ocaml.py | 1 | 9469 | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"ocaml support"
import os, re
from waflib import Utils, Task
from waflib.Logs import error
from waflib.TaskGen import feature, before_method, after_method, extension
EXT_MLL = ['.mll']
EXT_MLY = ['.mly']
EXT_MLI = ['.mli']
EXT_MLC = ['.c']
EXT_ML... | agpl-3.0 |
vlegoff/tsunami | src/primaires/format/editeurs/floatedit/__init__.py | 1 | 4072 | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
# ... | bsd-3-clause |
Distrotech/libreoffice | solenv/gdb/libreoffice/basegfx.py | 11 | 5883 | # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# 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/.
#
... | gpl-3.0 |
admire93/youtube-dl | devscripts/gh-pages/add-version.py | 174 | 1170 | #!/usr/bin/env python3
from __future__ import unicode_literals
import json
import sys
import hashlib
import os.path
if len(sys.argv) <= 1:
print('Specify the version number as parameter')
sys.exit()
version = sys.argv[1]
with open('update/LATEST_VERSION', 'w') as f:
f.write(version)
versions_info = jso... | unlicense |
pjg101/SickRage | sickbeard/providers/omgwtfnzbs.py | 3 | 4508 | # coding=utf-8
# Author: Jordon Smith <smith@jordon.me.uk>
#
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 o... | gpl-3.0 |
ilstreltsov/django-db-mailer | dbmail/south_migrations/0039_auto__add_unique_mailsubscription_address.py | 1 | 20732 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'MailSubscription', fields ['address']
db.c... | gpl-2.0 |
welshjf/pyqtgraph | pyqtgraph/widgets/RemoteGraphicsView.py | 29 | 11749 | from ..Qt import QtGui, QtCore, USE_PYSIDE
if not USE_PYSIDE:
import sip
from .. import multiprocess as mp
from .GraphicsView import GraphicsView
from .. import CONFIG_OPTIONS
import numpy as np
import mmap, tempfile, ctypes, atexit, sys, random
__all__ = ['RemoteGraphicsView']
class RemoteGraphicsView(QtGui.QWid... | mit |
jffernandez/kivy | kivy/uix/pagelayout.py | 30 | 6826 | """
PageLayout
==========
The :class:`PageLayout` class is used to create a simple multi-page
layout, in a way that allows easy flipping from one page to another using
borders.
:class:`PageLayout` does not currently honor
:attr:`~kivy.uix.widget.Widget.size_hint` or
:attr:`~kivy.uix.widget.Widget.pos_hint` properties... | mit |
maropu/spark | examples/src/main/python/ml/correlation_example.py | 27 | 1753 | #
# 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 |
ShiYw/Sigil | 3rdparty/python/Lib/unittest/test/test_break.py | 81 | 9812 | import gc
import io
import os
import sys
import signal
import weakref
import unittest
@unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
@unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
"if threa... | gpl-3.0 |
LinkHS/incubator-mxnet | tests/nightly/multi_lenet.py | 41 | 4751 | #!/usr/bin/env python
# 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
# "L... | apache-2.0 |
GeographicaGS/moocng | moocng/enrollment/idp.py | 2 | 4156 | # Copyright 2013 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# 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, c... | apache-2.0 |
abaditsegay/arangodb | 3rdParty/V8-4.3.61/build/gyp/test/standalone-static-library/gyptest-standalone-static-library.py | 186 | 1891 | #!/usr/bin/env python
# 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.
"""
Verifies build of a static_library with the standalone_static_library flag set.
"""
import os
import subprocess
import sys
import TestG... | apache-2.0 |
we350z/googlePythonClassSolutions | basic/solution/wordcount.py | 211 | 3529 | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | apache-2.0 |
vlachoudis/sl4a | python/src/Mac/Modules/snd/sndsupport.py | 39 | 10227 | # This script generates the Sound interface for Python.
# It uses the "bgen" package to generate C code.
# It execs the file sndgen.py which contain the function definitions
# (sndgen.py was generated by sndscan.py, scanning the <Sound.h> header file).
from macsupport import *
# define our own function and module ge... | apache-2.0 |
donnydevito/py-academicstoday | academicstoday_project/academicstoday_project/settings.py | 3 | 4021 | """
Django settings for academicstoday_project project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
... | apache-2.0 |
elibixby/gcloud-python | gcloud/bigtable/_testing.py | 8 | 1905 | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
nathan-at-least/zcash | qa/rpc-tests/test_framework/blocktools.py | 93 | 2057 | # blocktools.py - utilities for manipulating blocks and transactions
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from mininode import *
from script import CScript, CScriptOp
# Create a block (with regtest difficulty)
... | mit |
Polyconseil/pelican | pelican/tools/pelican_import.py | 13 | 31970 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import argparse
try:
from html import unescape # py3.4+
except ImportError:
from six.moves.html_parser import HTMLParser
unescape = HTMLParser().unescape
import os
import re
import subprocess
import sys
i... | agpl-3.0 |
benjaminbrinkman/open-ad-platform | .venv/lib/python3.4/site-packages/pymysql/connections.py | 4 | 45388 | # Python implementation of the MySQL client-server protocol
# http://dev.mysql.com/doc/internals/en/client-server-protocol.html
# Error codes:
# http://dev.mysql.com/doc/refman/5.5/en/error-messages-client.html
from __future__ import print_function
from ._compat import PY2, range_type, text_type, str_type, JYTHON, IRON... | mit |
mKeRix/home-assistant | homeassistant/components/dexcom/sensor.py | 5 | 4235 | """Support for Dexcom sensors."""
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
from homeassistant.helpers.entity import Entity
from .const import COORDINATOR, DOMAIN, GLUCOSE_TREND_ICON, GLUCOSE_VALUE_ICON, MG_DL
async def async_setup_entry(hass, config_entry, async_add_entities):
"""S... | mit |
80vs90/django-allauth | allauth/socialaccount/providers/openid/south_migrations/0002_tosocialaccount.py | 82 | 7741 | # encoding: utf-8
from south.v2 import DataMigration
class Migration(DataMigration):
depends_on = (('socialaccount', '0002_genericmodels'),)
def forwards(self, orm):
for acc in orm.OpenIDAccount.objects.all():
sacc = acc.socialaccount_ptr
sacc.uid = acc.identity
sa... | mit |
caphrim007/ansible | test/units/modules/cloud/amazon/test_ec2_group.py | 49 | 2536 | import pytest
from ansible.modules.cloud.amazon import ec2_group as group_module
def test_from_permission():
internal_http = {
u'FromPort': 80,
u'IpProtocol': 'tcp',
u'IpRanges': [
{
u'CidrIp': '10.0.0.0/8',
u'Description': 'Foo Bar Baz'
... | gpl-3.0 |
yuzhu/kubernetes | third_party/htpasswd/htpasswd.py | 897 | 5219 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2013 Edgewall Software
# Copyright (C) 2008 Eli Carter
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edge... | apache-2.0 |
catapult-project/catapult | telemetry/telemetry/internal/platform/tracing_agent/atrace_tracing_agent_unittest.py | 3 | 2049 | # Copyright 2018 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.
from __future__ import absolute_import
import unittest
import mock
from systrace.tracing_agents import atrace_agent as systrace_atrace_agent
from telemetry... | bsd-3-clause |
xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Lib/idlelib/Bindings.py | 9 | 2591 | """Define the menu contents, hotkeys, and event bindings.
There is additional configuration information in the EditorWindow class (and
subclasses): the menus are created there based on the menu_specs (class)
variable, and menus not created are silently skipped in the code here. This
makes it possible, for example, to... | gpl-2.0 |
Ted1993/Flasky | venv/lib/python2.7/site-packages/pip/req/req_uninstall.py | 249 | 7135 | from __future__ import absolute_import
import logging
import os
import sys
import tempfile
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.exceptions import UninstallationError
from pip.utils import (rmtree, ask, is_local, dist_is_local, renames,
normalize_path)
from pi... | mit |
luisetex84/android_kernel_lenovo_kingdom_row | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
Timeship/OnlineJudge-1 | judge/judger/language.py | 5 | 1316 | # coding=utf-8
languages = {
1: {
"name": "c",
"src_name": "main.c",
"code": 1,
"syscalls": "!execve:k,flock:k,ptrace:k,sync:k,fdatasync:k,fsync:k,msync,sync_file_range:k,syncfs:k,unshare:k,setns:k,clone:k,query_module:k,sysinfo:k,syslog:k,sysfs:k",
"compile_command": "gcc ... | mit |
BFH-BTI7301-project1/ClockAlarm | _clockalarm/_tests/SimpleAlertEditWidget_test.py | 1 | 1384 | from os.path import dirname, abspath, join
import pytest
from PyQt5.QtWidgets import QApplication, QGroupBox, QTimeEdit, \
QDateTimeEdit
from _clockalarm.UI.SimpleAlertEditWidget import SimpleAlertEditWidget
from _clockalarm.utils import importExportUtils
@pytest.fixture
def init_paths(scope="module"):
impo... | gpl-3.0 |
saullocastro/pyNastran | pyNastran/bdf/mesh_utils/test/test_convert.py | 1 | 7968 | from __future__ import print_function
import os
import unittest
import numpy as np
from numpy import allclose
#import pyNastran
#from pyNastran.bdf.bdf import BDF
#root_path = pyNastran.__path__[0]
#test_path = os.path.join(root_path, 'bdf', 'test', 'unit')
from pyNastran.bdf.cards.elements.mass import CONM2
import ... | lgpl-3.0 |
simonmonk/raspirobotboard2 | python/examples/test.py | 2 | 2539 | #Python 2
import rrb2 as rrb
import time
#import ex_8x8_pixels
rr = rrb.RRB2(revision=2)
def confirm(question):
answer = raw_input(question)
def test_leds():
rr.set_led1(0)
rr.set_led2(0)
confirm("Are LED1 and LED2 both OFF?")
rr.set_led1(1)
rr.set_led2(0)
confirm("Is LED1 ON and LE... | mit |
davidblaisonneau/fabm | tools/log/printer/printrun/injecter.py | 1 | 10850 | #!/usr/bin/python
from bson import json_util
from datetime import datetime
import json
import time
from pymongo import MongoClient
#~ Mongo Database
client = MongoClient()
db = client.fablab
usagec = db.usage
dateFormat = "%Y-%m-%d %H:%M:%S"
data = '[{"date": "2014-01-31 13:32:12.489309","duration": 45,"logType": "... | gpl-2.0 |
brunoabud/ic | plugins/ICGRAY2BGR/plugin_object.py | 1 | 1150 | # coding: utf-8
# Copyright (C) 2016 Bruno Abude Cardoso
#
# Imagem Cinemática 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.
#
# Imag... | gpl-3.0 |
JulienMcJay/eclock | windows/Python27/Lib/site-packages/plyer-1.1.2-py2.7.egg/plyer/platforms/win/libs/balloontip.py | 4 | 2394 | # -- coding: utf-8 --
# Original from https://gist.github.com/wontoncc/1808234
# Modified from https://gist.github.com/boppreh/4000505
import os
import sys
import time
import win32con
import win32gui
from win32api import GetModuleHandle
class WindowsBalloonTip:
def __init__(self, title, msg):
message_m... | gpl-2.0 |
gfyoung/pandas | pandas/tests/indexes/timedeltas/test_join.py | 4 | 1497 | import numpy as np
from pandas import Index, Timedelta, timedelta_range
import pandas._testing as tm
class TestJoin:
def test_append_join_nondatetimeindex(self):
rng = timedelta_range("1 days", periods=10)
idx = Index(["a", "b", "c", "d"])
result = rng.append(idx)
assert isinstan... | bsd-3-clause |
fweik/espresso | testsuite/python/lb_momentum_conservation.py | 5 | 3184 | # Copyright (C) 2010-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 v... | gpl-3.0 |
meppe/ros-ort | src/frcnn/src/lib/pycocotools/mask.py | 1 | 4062 | __author__ = 'tsungyi'
import lib.pycocotools._mask as _mask
# Interface for manipulating masks stored in RLE format.
#
# RLE is a simple yet efficient format for storing binary masks. RLE
# first divides a vector (or vectorized image) into a series of piecewise
# constant regions and then for each piece simply store... | gpl-3.0 |
darkleons/lama | addons/auth_oauth/res_users.py | 157 | 4897 | import logging
import werkzeug.urls
import urlparse
import urllib2
import simplejson
import openerp
from openerp.addons.auth_signup.res_users import SignupError
from openerp.osv import osv, fields
from openerp import SUPERUSER_ID
_logger = logging.getLogger(__name__)
class res_users(osv.Model):
_inherit = 'res.... | agpl-3.0 |
joshcai/utdcs | processing/views.py | 1 | 3030 | # Create your views here.
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.template import RequestContext, loader
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.db.models import Q
from website import secrets
import datetime
... | mit |
HKUST-SING/tensorflow | tensorflow/contrib/rnn/python/ops/fused_rnn_cell.py | 56 | 6333 | # 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 |
GabrielDumbrava/django-categories | categories/south_migrations/0011_move_category_fks.py | 14 | 3989 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
orm.CategoryRelation.objects.update(category=models.F('story'))
def backwards(... | apache-2.0 |
joopert/home-assistant | homeassistant/components/broadlink/__init__.py | 3 | 3597 | """The broadlink component."""
import asyncio
from base64 import b64decode, b64encode
import logging
import socket
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
from homeassistant.util.dt import utcnow
from .cons... | apache-2.0 |
daniaki/pyPPI | pyppi/tests/test_ontology.py | 1 | 6976 | import os
from unittest import TestCase
from ..data_mining.ontology import get_active_instance
from ..data_mining.ontology import (
get_up_to_lca,
get_lca_of_terms,
group_terms_by_ontology_type,
filter_obsolete_terms,
parse_obo12_file
)
base_path = os.path.dirname(__file__)
test_obo_file = '{}/{}'... | mit |
ridfrustum/lettuce | tests/integration/lib/Django-1.2.5/django/forms/formsets.py | 44 | 14303 | from forms import Form
from django.core.exceptions import ValidationError
from django.utils.encoding import StrAndUnicode
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from fields import IntegerField, BooleanField
from widgets import Media, HiddenInput
from util import... | gpl-3.0 |
sonaht/ansible | lib/ansible/modules/cloud/rackspace/rax_queue.py | 70 | 4009 | #!/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 |
fhe-odoo/odoo | addons/account_analytic_plans/report/__init__.py | 445 | 1084 | # -*- 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... | agpl-3.0 |
lightcn/odoo | addons/sale_service/__init__.py | 354 | 1060 | # -*- 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 |
nephila/djangocms-blog | tasks.py | 6 | 4218 | import io
import os
import re
import sys
from glob import glob
from invoke import task
DOCS_PORT = os.environ.get("DOCS_PORT", 8000)
#: branch prefixes for which some checks are skipped
SPECIAL_BRANCHES = ("master", "develop", "release")
@task
def clean(c):
""" Remove artifacts and binary files. """
c.run("... | bsd-3-clause |
azumimuo/family-xbmc-addon | plugin.video.specto/resources/lib/sources/kissanime_tv.py | 1 | 4887 | # -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... | gpl-2.0 |
openmips/stbgui | lib/python/Components/Renderer/NextEpgInfo.py | 2 | 3268 | from Components.VariableText import VariableText
from Renderer import Renderer
from enigma import eLabel, eEPGCache, eServiceReference
from time import localtime, strftime
from skin import parseColor
class NextEpgInfo(Renderer, VariableText):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)... | gpl-2.0 |
g19-hs/personfinder | app/pytz/zoneinfo/Australia/Yancowinna.py | 9 | 6424 | '''tzinfo timezone information for Australia/Yancowinna.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Yancowinna(DstTzInfo):
'''Australia/Yancowinna timezone definition. See datetime.tzinfo for details'''
zone = 'Austr... | apache-2.0 |
cdcapano/pycbc | pycbc/inference/models/relbin.py | 2 | 17384 | # Copyright (C) 2020 Daniel Finstad
# 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 program is distributed in ... | gpl-3.0 |
WilliamMayor/pinscher | pinscher/Keyfile.py | 1 | 1219 | import string
import pickle
import os
import utilities
class Keyfile:
LENGTH = 32
CHARACTERS = string.digits + string.letters + string.punctuation + ' '
@staticmethod
def create(path, database_path, **kwargs):
k = Keyfile()
k.path = path
k.database_path = os.path.abspath(dat... | gpl-3.0 |
nashve/mythbox | resources/lib/twisted/twisted/test/test_cooperator.py | 60 | 19159 | # Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module contains tests for L{twisted.internet.task.Cooperator} and
related functionality.
"""
from twisted.internet import reactor, defer, task
from twisted.trial import unittest
class FakeDelayedCall(object):
"""
Fak... | gpl-2.0 |
evansd/django | tests/mail/test_sendtestemail.py | 133 | 3047 | from django.core import mail
from django.core.management import call_command
from django.test import SimpleTestCase, override_settings
@override_settings(
ADMINS=(('Admin', 'admin@example.com'), ('Admin and Manager', 'admin_and_manager@example.com')),
MANAGERS=(('Manager', 'manager@example.com'), ('Admin and ... | bsd-3-clause |
2mny/mylar | lib/cherrypy/test/helper.py | 6 | 16187 | """A library of helper functions for the CherryPy test suite."""
import datetime
import logging
log = logging.getLogger(__name__)
import os
thisdir = os.path.abspath(os.path.dirname(__file__))
serverpem = os.path.join(os.getcwd(), thisdir, 'test.pem')
import re
import sys
import time
import warnings
import cherrypy
... | gpl-3.0 |
PyCQA/astroid | astroid/brain/brain_type.py | 1 | 2187 | """
Astroid hooks for type support.
Starting from python3.9, type object behaves as it had __class_getitem__ method.
However it was not possible to simply add this method inside type's body, otherwise
all types would also have this method. In this case it would have been possible
to write str[int].
Guido Van Rossum pr... | lgpl-2.1 |
windskyer/nova | nova/objects/virtual_interface.py | 4 | 3752 | # 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... | gpl-2.0 |
pdellaert/ansible | test/units/modules/cloud/amazon/test_ec2_group.py | 10 | 2617 | from ansible.modules.cloud.amazon import ec2_group as group_module
def test_from_permission():
internal_http = {
u'FromPort': 80,
u'IpProtocol': 'tcp',
u'IpRanges': [
{
u'CidrIp': '10.0.0.0/8',
u'Description': 'Foo Bar Baz'
},
... | gpl-3.0 |
gwwfps/boxrps | admin.py | 1 | 15675 | #!/usr/bin/env python
import logging
import yaml
import cgi
from xml.dom import minidom as md
from datetime import datetime, timedelta
from collections import defaultdict
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext import db
from django.utils import sim... | mit |
crosswalk-project/crosswalk-test-suite | apptools/apptools-android-tests/apptools/comm.py | 12 | 12707 | #!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | bsd-3-clause |
vfulco/ansible | v1/ansible/cache/redis.py | 117 | 3477 | # (c) 2014, Brian Coca, Josh Drake, et al
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | gpl-3.0 |
googleads/google-ads-python | google/ads/googleads/v7/services/types/campaign_budget_service.py | 1 | 6329 | # -*- coding: utf-8 -*-
# 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... | apache-2.0 |
ngokevin/zamboni | lib/cef_loggers.py | 2 | 3373 | """Our app specific CEF loggers."""
from django.conf import settings
from django.http import HttpRequest
from cef import log_cef as _log_cef
heka = settings.HEKA
class CEFLogger:
"""Abstract base CEF logger.
Class attributes to set in a concrete class:
**sig_prefix**
Prefix to the CEF signature.... | bsd-3-clause |
mahak/cinder | cinder/scheduler/weights/capacity.py | 6 | 6100 | # Copyright (c) 2013 eBay Inc.
# Copyright (c) 2012 OpenStack Foundation
# Copyright (c) 2015 EMC Corporation
#
# 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... | apache-2.0 |
digital-abyss/ansible-modules-core | cloud/openstack/os_volume.py | 131 | 4754 | #!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# This module 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 late... | gpl-3.0 |
vlachoudis/sl4a | python/src/Tools/scripts/logmerge.py | 94 | 5576 | #! /usr/bin/env python
"""Consolidate a bunch of CVS or RCS logs read from stdin.
Input should be the output of a CVS or RCS logging command, e.g.
cvs log -rrelease14:
which dumps all log messages from release1.4 upwards (assuming that
release 1.4 was tagged with tag 'release14'). Note the trailing
colon!
Thi... | apache-2.0 |
pietern/caffe2 | caffe2/python/operator_test/pack_ops_test.py | 2 | 7032 | # Copyright (c) 2016-present, Facebook, 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 agreed... | apache-2.0 |
dfang/odoo | addons/payment_authorize/models/payment.py | 6 | 15673 | # coding: utf-8
from authorize_request import AuthorizeAPI
from datetime import datetime
import hashlib
import hmac
import logging
import time
import urlparse
from odoo import api, fields, models
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.addons.payment_authorize.controllers.mai... | agpl-3.0 |
svenstaro/ansible | lib/ansible/modules/cloud/vmware/vmware_vm_shell.py | 65 | 6605 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, 2016 Ritesh Khadgaray <khadgaray () 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... | gpl-3.0 |
desec-io/desec-stack | api/desecapi/tests/test_replication.py | 1 | 5066 | import json
import os
import random
import string
import time
from datetime import datetime
from tempfile import TemporaryDirectory
from django.test import testcases
from rest_framework import status
from desecapi.replication import Repository
from desecapi.tests.base import DesecTestCase
class ReplicationTest(Dese... | mit |
wscullin/spack | var/spack/repos/builtin/packages/seqtk/package.py | 3 | 1761 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
amonapp/amon | amon/apps/_account/forms.py | 1 | 6520 | from django import forms
from django.contrib.auth import authenticate
from django.conf import settings
from django.contrib.auth import get_user_model
# from amon.apps.notifications.models import notifications_model
# from amon.apps.alerts.models import alerts_model
# from amon.apps.account.models import user_preferenc... | agpl-3.0 |
singlebrook/AWS-ElasticBeanstalk-CLI | eb/macosx/python2.7/scli/parameter.py | 9 | 11318 | #!/usr/bin/env python
#==============================================================================
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the... | apache-2.0 |
Zhaoyanzhang/-myflasky | venv/lib/python2.7/site-packages/alembic/testing/runner.py | 14 | 1602 | #!/usr/bin/env python
# testing/runner.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
Nose test runner module.
This script is a front-end to "... | mit |
Backflipz/plugin.video.excubed | whoosh/lang/stopwords.py | 92 | 16679 | # coding=utf-8
from __future__ import unicode_literals
# Stopwords Corpus
#
# This module contains lists of stop words for several languages. These
# are high-frequency grammatical words which are usually ignored in text
# retrieval applications.
#
# They were obtained from:
# anoncvs.postgresql.org/cvsweb.cgi/pgsql... | gpl-2.0 |
airbnb/airflow | tests/providers/google/marketing_platform/sensors/test_display_video.py | 10 | 2774 | #
# 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... | apache-2.0 |
jscn/django | django/db/models/fields/related_lookups.py | 7 | 6243 | from django.db.models.lookups import (
Exact, GreaterThan, GreaterThanOrEqual, In, IsNull, LessThan,
LessThanOrEqual,
)
class MultiColSource(object):
contains_aggregate = False
def __init__(self, alias, targets, sources, field):
self.targets, self.sources, self.field, self.alias = targets, so... | bsd-3-clause |
aifil/odoo | addons/sale_stock/tests/test_sale_stock.py | 16 | 9945 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.addons.sale.tests.test_sale_common import TestSale
class TestSaleStock(TestSale):
def test_00_sale_stock_invoice(self):
"""
Test SO's changes when playing around with stock moves, quants... | gpl-3.0 |
ryfeus/lambda-packs | Sklearn_scipy_numpy/source/scipy/fftpack/tests/test_pseudo_diffs.py | 63 | 13641 | #!/usr/bin/env python
# Created by Pearu Peterson, September 2002
from __future__ import division, print_function, absolute_import
__usage__ = """
Build fftpack:
python setup_fftpack.py build
Run tests if scipy is installed:
python -c 'import scipy;scipy.fftpack.test(<level>)'
Run tests if fftpack is not installe... | mit |
TheChymera/LabbookDB | labbookdb/tests/test_report.py | 1 | 3726 | import pytest
from os import path
DB_PATH = '~/.demolog/meta.db'
DATA_DIR = path.join(path.dirname(path.realpath(__file__)),'../../example_data/')
def test_implant_angle_filter():
from labbookdb.report.selection import animal_id, animal_treatments, animal_operations
import numpy as np
db_path=DB_PATH
df = animal... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.