repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
JanVan01/gwot-physical | models/locations.py | 1 | 2735 | from utils.utils import Database
from models.base import BaseModel, BaseMultiModel
class Location(BaseModel):
def __init__(self, id = None):
super().__init__(['id', 'name', 'lon', 'lat', 'height'])
self.id = id
self.name = None
self.lon = None
self.lat = None
self.height = None
def from_dict(self, dict... | lgpl-3.0 |
kontais/EFI-MIPS | ToolKit/cmds/python/Lib/test/crashed/test_multibytecodec.py | 8 | 3379 | #!/usr/bin/env python
#
# test_multibytecodec.py
# Unit test for multibytecodec itself
#
# $CJKCodecs: test_multibytecodec.py,v 1.8 2004/06/19 06:09:55 perky Exp $
from test import test_support
from test import test_multibytecodec_support
import unittest, StringIO, codecs
class Test_StreamWriter(unittest.TestCase):... | bsd-3-clause |
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/numpy/core/generate_numpy_api.py | 12 | 7470 | from __future__ import division, print_function
import os
import genapi
from genapi import \
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
import numpy_api
# use annotated api when running under cpychecker
h_template = r"""
#if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_AR... | apache-2.0 |
Shanec132006/lab3 | server/lib/werkzeug/script.py | 318 | 11249 | # -*- coding: utf-8 -*-
r'''
werkzeug.script
~~~~~~~~~~~~~~~
.. admonition:: Deprecated Functionality
``werkzeug.script`` is deprecated without replacement functionality.
Python's command line support improved greatly with :mod:`argparse`
and a bunch of alternative modules.
Most ... | apache-2.0 |
endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/c/enum_types/TestEnumTypes.py | 1 | 4806 | """Look up enum type information and check for correct display."""
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.decorators import *
class EnumTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Ca... | bsd-3-clause |
GMadorell/programming-challenges | tuenti/tuenti_challenge_4/qualification/1_anonymous_poll/anonymous_poll.py | 1 | 3240 | #!/usr/bin/env python
"""
Problem description.
"""
from __future__ import division
import sys
import sqlite3
PATH_DATA = "students"
class AnonymousPollInstance(object):
def __init__(self):
self.gender = None
self.age = None
self.studies = None
self.academic_year = None
class An... | mit |
rec/echomesh | code/python/external/pi3d/event/FindDevices.py | 1 | 8501 | import re
from Constants import *
def test_bit(nlst, b):
index = b / 32
bit = b % 32
if len(nlst) <= index:
return False
if nlst[index] & (1 << bit):
return True
else:
return False
def EvToStr(events):
s = [ ]
if test_bit(events, EV_SYN): s.append("EV_SYN")
... | mit |
hinerm/ITK | Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matchers.py | 13 | 19100 | # Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""
defines all "built-in" classes that implement declarations compare functionality
according to some criteria
"""
import os
... | apache-2.0 |
perlygatekeeper/glowing-robot | Project_Euler/11_find_largest_product_in_grid/find_largest_product_in_grid.py | 1 | 4585 | #!/opt/local/bin/python
# Python program to find largest product of any straight-line
# sequence of length four in any direction amount
# horizontal, vertical or diagonal
import sys
import math
import timeit
import time
grid_string ='''
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 1... | artistic-2.0 |
hgl888/blink-crosswalk-efl | Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py | 48 | 3070 | # Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | bsd-3-clause |
Nolski/olympia | apps/constants/search.py | 16 | 2840 | # These two dicts are mapping between language codes in zamboni and language
# analyzers in elasticsearch.
#
# Each key value of ANALYZER_MAP is language analyzer supported by
# elasticsearch. See
# http://www.elasticsearch.org/guide/reference/index-modules/analysis/lang-analyzer.html
#
# Each value of ANALYZER_MAP is... | bsd-3-clause |
Velociraptor85/pyload | module/InitHomeDir.py | 40 | 2675 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This prog... | gpl-3.0 |
SmithsonianEnterprises/django-cms | menus/base.py | 47 | 1651 | # -*- coding: utf-8 -*-
from django.utils.encoding import smart_str
class Menu(object):
namespace = None
def __init__(self):
if not self.namespace:
self.namespace = self.__class__.__name__
def get_nodes(self, request):
"""
should return a list of NavigationNode instan... | bsd-3-clause |
Pexego/odoo | addons/l10n_us/__openerp__.py | 341 | 1763 | # -*- 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 |
mvaled/OpenUpgrade | openerp/addons/test_impex/tests/test_load.py | 350 | 44525 | # -*- coding: utf-8 -*-
import json
import pkgutil
import unittest2
import openerp.modules.registry
import openerp
from openerp.tests import common
from openerp.tools.misc import mute_logger
def message(msg, type='error', from_=0, to_=0, record=0, field='value', **kwargs):
return dict(kwargs,
typ... | agpl-3.0 |
dcsquared13/Diamond | src/collectors/docker_collector/test/testdocker_collector.py | 15 | 5984 | #!/usr/bin/python
# coding=utf-8
##########################################################################
import os
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import Mock
from mock import patch
from mock import mock_open
try:... | mit |
Seanmcn/poker | poker/hand.py | 1 | 31782 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
import re
import random
import itertools
import functools
from decimal import Decimal
from cached_property import cached_property
from ._common import PokerEnum, _ReprMixin
from .card import Suit, Rank, Card, BRO... | mit |
vinodbonala/mm | mm/exceptions.py | 4 | 1512 | class MMException(Exception):
"""Base mm exception"""
pass
class MetadataContainerException(Exception):
"""Raised when the project's medatacontainer is no longer valid"""
pass
class MMRequestException(Exception):
""" """
pass
class MMUIException(Exception):
""" """
pass
class MMUnsup... | gpl-2.0 |
mpeuster/estate | experiments/simple-redis-poc/pox/pox/proto/dhcp_client.py | 43 | 16184 | # Copyright 2013 James McCauley
#
# 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 |
openstate/yournextrepresentative | candidates/tests/test_constituency_view.py | 2 | 1634 | from mock import patch
from django_webtest import WebTest
from .auth import TestUserMixin
from .fake_popit import (FakePersonCollection, FakeOrganizationCollection,
FakePostCollection)
@patch('candidates.popit.PopIt')
class TestConstituencyDetailView(TestUserMixin, WebTest):
def test_an... | agpl-3.0 |
chand3040/cloud_that | lms/djangoapps/courseware/migrations/0010_rename_xblock_field_content_to_user_state_summary.py | 114 | 11590 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'XModuleSettingsField', fields ['usage_id', 'field_name']
db.delete_unique('... | agpl-3.0 |
pre-commit/pre-commit-hooks | tests/file_contents_sorter_test.py | 1 | 2582 | import pytest
from pre_commit_hooks.file_contents_sorter import FAIL
from pre_commit_hooks.file_contents_sorter import main
from pre_commit_hooks.file_contents_sorter import PASS
@pytest.mark.parametrize(
('input_s', 'argv', 'expected_retval', 'output'),
(
(b'', [], FAIL, b'\n'),
(b'lonesome\... | mit |
abalakh/robottelo | tests/foreman/cli/test_roles.py | 1 | 2537 | # -*- encoding: utf-8 -*-
"""Test for Roles CLI"""
from fauxfactory import gen_string
from robottelo.cli.base import CLIReturnCodeError
from robottelo.cli.factory import make_role
from robottelo.cli.role import Role
from robottelo.decorators import skip_if_bug_open, stubbed
from robottelo.test import CLITestCase
def ... | gpl-3.0 |
GitHublong/hue | desktop/core/ext-py/Pygments-1.3.1/pygments/styles/murphy.py | 75 | 2751 | # -*- coding: utf-8 -*-
"""
pygments.styles.murphy
~~~~~~~~~~~~~~~~~~~~~~
Murphy's style from CodeRay.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Comment,... | apache-2.0 |
karlito40/servo | tests/wpt/css-tests/css21_dev/xhtml1/support/fonts/makegsubfonts.py | 820 | 14309 |
import os
import textwrap
from xml.etree import ElementTree
from fontTools.ttLib import TTFont, newTable
from fontTools.misc.psCharStrings import T2CharString
from fontTools.ttLib.tables.otTables import GSUB,\
ScriptList, ScriptRecord, Script, DefaultLangSys,\
FeatureList, FeatureRecord, Feature,\
LookupLi... | mpl-2.0 |
leekchan/django_test | tests/utils_tests/test_decorators.py | 63 | 3910 | from django.http import HttpResponse
from django.template import Template, Context
from django.template.response import TemplateResponse
from django.test import TestCase, RequestFactory
from django.utils.decorators import decorator_from_middleware
class ProcessViewMiddleware(object):
def process_view(self, reques... | bsd-3-clause |
pjdelport/django | docs/_ext/applyxrefs.py | 132 | 1842 | """Adds xref targets to the top of files."""
import sys
import os
testing = False
DONT_TOUCH = (
'./index.txt',
)
def target_name(fn):
if fn.endswith('.txt'):
fn = fn[:-4]
return '_' + fn.lstrip('./').replace('/', '-')
def process_file(fn, lines):
lines.insert(0, '\n')
lines... | bsd-3-clause |
beeverycreative/BeePanel | BeeConnect/Command.py | 1 | 32606 | #!/usr/bin/env python3
"""
* Copyright (c) 2015 BEEVC - Electronic Systems This file is part of BEESOFT
* 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 ... | gpl-2.0 |
weblabdeusto/weblabdeusto | server/launch/sample_balanced2_concurrent_experiments/main_machine/lab_and_experiment1/experiment33/server_config.py | 968 | 1526 | #!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
weblab_xilinx_experiment_xilinx_device = 'FPGA'
weblab_xilinx_experiment_port_number = 1
# This should be something like this:
# import os as _os
# xilinx_home = _os.getenv('XILINX_HOME')
# if xilinx_home == None:
# if _os.name == 'nt':
# xilinx_home = r'C:... | bsd-2-clause |
OpenTechFund/WebApp | opentech/apply/activity/migrations/0005_event.py | 1 | 1378 | # Generated by Django 2.0.2 on 2018-07-30 11:03
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('activity', '0004_update_on_delete_django2'),
]
operations = [
migrations.C... | gpl-2.0 |
herrersystem/grsearch | grsearch/tfidf.py | 1 | 1423 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import math
from grsearch.gsearch import *
def nbr_word(text, is_file):
compt=0
if is_file:
with open(text, 'rb') as f:
filestream=True
while filestream:
line=f.readline()
if len(line) == 0:
break
line=str(line)[2:-1] #convert by... | mit |
cristobaltapia/sajou | sajou/elements/beam2d.py | 1 | 11163 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines a 2-dimensional Bernoulli beam element
"""
import numpy as np
import scipy.sparse as sparse
from numpy import cumsum
from sajou import loads
from sajou.elements.element import Element
from sajou.utils import Local_Csys_two_points
class Beam2D(Element):
"""... | mit |
shaded-enmity/ansible-modules-extras | cloud/amazon/ec2_eni.py | 37 | 14246 | #!/usr/bin/python
#
# This is a 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 Ansible library is distributed in the hope that i... | gpl-3.0 |
sam-m888/gramps | gramps/gui/pluginmanager.py | 6 | 8526 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2005 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; ... | gpl-2.0 |
insidenothing/3D-Printing-Software | skein_engines/skeinforge-50/skeinforge_application/skeinforge_utilities/skeinforge_help.py | 11 | 3508 | """
Help has buttons and menu items to open help, blog and forum pages in your primary browser.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from... | gpl-2.0 |
otherness-space/myProject | my_project_001/lib/python2.7/site-packages/wheel/test/test_signatures.py | 565 | 1120 | from wheel import signatures
from wheel.signatures import djbec, ed25519py
from wheel.util import binary
def test_getlib():
signatures.get_ed25519ll()
def test_djbec():
djbec.dsa_test()
djbec.dh_test()
def test_ed25519py():
kp0 = ed25519py.crypto_sign_keypair(binary(' '*32))
kp = ed25519p... | mit |
monikagrabowska/osf.io | api/collections/serializers.py | 4 | 4546 | from django.db import IntegrityError
from rest_framework import serializers as ser
from rest_framework import exceptions
from framework.exceptions import PermissionsError
from website.models import Node
from osf.models import Collection
from osf.exceptions import ValidationError
from api.base.serializers import LinksF... | apache-2.0 |
ThiefMaster/indico | indico/modules/events/registration/lists.py | 4 | 8870 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import request
from sqlalchemy.orm import joinedload
from indico.core.db import db
from indico... | mit |
gmimano/commcaretest | corehq/apps/api/models.py | 2 | 2686 | from couchdbkit.exceptions import ResourceNotFound
from couchdbkit.ext.django.schema import *
from django.contrib.auth.models import check_password
from django.http import HttpResponse
from django.conf import settings
import os
from corehq.util.hash_compat import make_password
PERMISSION_POST_SMS = "POST_SMS"
PERMIS... | bsd-3-clause |
raccoongang/edx-platform | openedx/core/djangoapps/coursegraph/tasks.py | 3 | 12763 | """
This file contains a management command for exporting the modulestore to
neo4j, a graph database.
"""
from __future__ import unicode_literals, print_function
import logging
from celery import task
from django.conf import settings
from django.utils import six, timezone
from opaque_keys.edx.keys import CourseKey
fr... | agpl-3.0 |
scith/htpc-manager_ynh | sources/modules/sickrage.py | 2 | 9516 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
from urllib import quote, urlencode
import requests
import logging
from cherrypy.lib.auth2 import require, member_of
from htpc.helpers import fix_basepath, get_image, striphttp
class Sickrage(object):
def __init__(self):
self.logge... | gpl-3.0 |
NetApp/cinder | cinder/tests/unit/fake_utils.py | 10 | 2735 | # Copyright (c) 2011 Citrix Systems, 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 ... | apache-2.0 |
cbclab/MDT | mdt/model_building/signal_noise_models.py | 1 | 1426 | from .parameters import FreeParameter, CurrentModelSignalParam
from .model_functions import SimpleModelCLFunction
__author__ = 'Robbert Harms'
__date__ = "2014-08-05"
__license__ = "LGPL v3"
__maintainer__ = "Robbert Harms"
__email__ = "robbert.harms@maastrichtuniversity.nl"
class SignalNoiseModel(SimpleModelCLFunct... | lgpl-3.0 |
gsirow/fantasyfantasy | ff_project/settings.py | 1 | 2017 | """
Django settings for ff_football project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | gpl-2.0 |
genova/rapidsms-senegal | build/lib.linux-i686-2.6/rapidsms/config.py | 7 | 7691 | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import os, log
from ConfigParser import SafeConfigParser
import logging
def to_list (item, separator=","):
return filter(None, map(lambda x: str(x).strip(), item.split(separator)))
class Config (object):
def __init__ (self, *paths):
self.parser = Sa... | bsd-3-clause |
keyurpatel076/MissionPlannerGit | Lib/imghdr.py | 259 | 3544 | """Recognize image file formats based on their first few bytes."""
__all__ = ["what"]
#-------------------------#
# Recognize image headers #
#-------------------------#
def what(file, h=None):
if h is None:
if isinstance(file, basestring):
f = open(file, 'rb')
h = f.read(32)
... | gpl-3.0 |
leighpauls/k2cro4 | third_party/python_26/Lib/site-packages/win32/Demos/win32netdemo.py | 18 | 8343 | import sys
import win32api
import win32net
import win32netcon
import win32security
import getopt
import traceback
verbose_level = 0
server = None # Run on local machine.
def verbose(msg):
if verbose_level:
print msg
def CreateUser():
"Creates a new test user, then deletes the user"
testName = "P... | bsd-3-clause |
mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/models/official/benchmark/benchmark_uploader_main.py | 6 | 2351 | # Copyright 2018 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 |
massot/odoo | addons/hr_recruitment/report/__init__.py | 442 | 1107 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 |
lmregus/mywebsite | app/controllers/general.py | 1 | 2346 | from server import app
from server import login_manager
from flask import render_template
from flask import request
from flask import redirect
from flask import send_file
from flask import abort
from flask_login import login_user
from flask_login import logout_user
from flask_login import login_required
from models.c... | mit |
caot/intellij-community | python/helpers/docutils/transforms/universal.py | 63 | 6577 | # $Id: universal.py 6112 2009-09-03 07:27:59Z milde $
# Authors: David Goodger <goodger@python.org>; Ueli Schlaepfer
# Copyright: This module has been placed in the public domain.
"""
Transforms needed by most or all documents:
- `Decorations`: Generate a document's header & footer.
- `Messages`: Placement of system ... | apache-2.0 |
riveridea/gnuradio | gr-channels/python/channels/impairments.py | 54 | 4755 | #!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Radio Impairments Model
# Author: mettus
# Generated: Thu Aug 1 12:46:10 2013
##################################################
from gnuradio import analog
from gnuradio import blocks
from gnuradio import g... | gpl-3.0 |
hnoerdli/hussa | node_modules/npm/node_modules/node-gyp/gyp/gyptest.py | 1752 | 8019 | #!/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.
__doc__ = """
gyptest.py -- test runner for GYP tests.
"""
import os
import optparse
import subprocess
import sys
class CommandRunner(obje... | mit |
rmfitzpatrick/ansible | lib/ansible/module_utils/fortios.py | 89 | 8000 | # 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 author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
cctaylor/googleads-python-lib | examples/dfp/v201408/line_item_creative_association_service/create_licas.py | 4 | 1942 | #!/usr/bin/python
#
# Copyright 2014 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 b... | apache-2.0 |
lisette-espin/JANUS | python-code/coauthorship.py | 1 | 6204 | from __future__ import division, print_function, absolute_import
__author__ = 'lisette-espin'
################################################################################
### Local Dependencies
################################################################################
from org.gesis.libs import graph as c
fr... | mit |
habibiefaried/ryu | ryu/ofproto/ofproto_v1_3.py | 8 | 49991 | # Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2012 Isaku Yamahata <yamahata at valinux co jp>
#
# 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://... | apache-2.0 |
danmergens/mi-instrument | mi/dataset/parser/wc_hmr_cspp.py | 5 | 7883 | #!/usr/bin/env python
"""
@package mi.dataset.parser
@file marine-integrations/mi/dataset/parser/wc_hmr_cspp.py
@author Jeff Roy
@brief wc_hmr Parser for the cspp_eng_cspp dataset driver
Release notes: This is one of 4 parsers that make up that driver
initial release
"""
__author__ = 'Jeff Roy'
__license__ = 'Apache... | bsd-2-clause |
minejo/shadowsocks | shadowsocks/daemon.py | 386 | 5602 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015 clowwindy
#
# 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 requi... | apache-2.0 |
postlund/home-assistant | homeassistant/components/tellduslive/sensor.py | 7 | 4738 | """Support for Tellstick Net/Telstick Live sensors."""
import logging
from homeassistant.components import sensor, tellduslive
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_TEMPERATURE,
POWER_WATT,
TEMP_CELSIUS,
)
from homeassistant.helpers.dispatch... | apache-2.0 |
jayceyxc/hue | desktop/core/ext-py/Mako-0.8.1/test/test_filters.py | 36 | 9579 | # -*- coding: utf-8 -*-
from mako.template import Template
import unittest
from test import TemplateTest, eq_, requires_python_2
from test.util import result_lines, flatten_result
from mako.compat import u
class FilterTest(TemplateTest):
def test_basic(self):
t = Template("""
${x | myfilter}
""")
... | apache-2.0 |
russomi/appengine-pipeline-read-only | src/pipeline/simplejson/encoder.py | 8 | 18261 | #!/usr/bin/python2.5
"""Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
try:
from simplejson import _speedups
return _speedups.encode_basestring_ascii, _speedups.make_encoder
except ImportError:
return None, None
c_encode_basestring_ascii,... | apache-2.0 |
summermk/dragonfly | dragonfly/engines/base/compiler.py | 5 | 3942 | #
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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 ... | lgpl-3.0 |
vprime/puuuu | env/bin/activate_this.py | 669 | 1129 | """By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/... | mit |
barachka/odoo | addons/document/wizard/document_configuration.py | 381 | 4895 | # -*- 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 |
abaditsegay/arangodb | 3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/win32comext/axscript/test/testHost4Dbg.py | 18 | 2565 | import string, os, sys, traceback
from win32com.axscript import axscript
from win32com.axscript.server import axsite
from win32com.axscript.server.error import Exception
import pythoncom
from win32com.server import util
import win32ui
version = "0.0.1"
class MySite(axsite.AXSite):
def OnScriptError(self, error):
... | apache-2.0 |
pansay/jasmine.github.io | 2.1/src/python_egg.py | 34 | 1456 | ## Using Jasmine with Python
# The Jasmine Python package contains helper code for developing Jasmine projects for Python-based web projects (Django, Flask, etc.)
# or for JavaScript projects where Python is a welcome partner. It serves up a project's Jasmine suite in a browser so you can focus on
# your code instead o... | mit |
myles/django-issues | src/issues/models.py | 1 | 3687 | from django.db import models
from django.conf import settings
from django.db.models import permalink
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.contrib.comments.models import Comment
from django.contrib.contenttypes.generic import GenericRelation
class Ve... | bsd-3-clause |
alexanderturner/ansible | lib/ansible/modules/utilities/logic/fail.py | 38 | 1597 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.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 Lice... | gpl-3.0 |
MarcJoan/django | tests/signing/tests.py | 74 | 5473 | from __future__ import unicode_literals
import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time
from django.utils import six
from django.utils.encoding import force_str
class TestSigner(SimpleTestCase):
def test_signature(self):
"... | bsd-3-clause |
drcapulet/sentry | src/sentry/migrations/0103_ensure_non_empty_slugs.py | 30 | 26927 | # -*- coding: 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):
from sentry.constants import RESERVED_TEAM_SLUGS
from sentry.models import slugify_instance
for team in ... | bsd-3-clause |
luistorresm/odoo | addons/website_sale/models/sale_order.py | 81 | 10744 | # -*- coding: utf-8 -*-
import random
from openerp import SUPERUSER_ID
from openerp.osv import osv, orm, fields
from openerp.addons.web.http import request
from openerp.tools.translate import _
class sale_order(osv.Model):
_inherit = "sale.order"
def _cart_qty(self, cr, uid, ids, field_name, arg, context=No... | agpl-3.0 |
l11x0m7/lightnn | lightnn/test/cnn_gradient_check.py | 1 | 5027 | # -*- encoding:utf-8 -*-
import sys
sys.path.append('../../')
import numpy as np
from lightnn.layers.convolutional import Conv2d
from lightnn.layers.pooling import MaxPoolingLayer, AvgPoolingLayer
from lightnn.base.activations import Sigmoid, Relu, Identity
from lightnn.base.initializers import xavier_uniform_initial... | apache-2.0 |
dakcarto/suite-qgis-plugin | src/opengeo/gui/qgsexploreritems.py | 1 | 16869 | import os
import sys
from PyQt4 import QtGui,QtCore
from PyQt4.QtCore import *
from opengeo.gui.exploreritems import TreeItem
from opengeo.qgis import layers as qgislayers
from dialogs.styledialog import PublishStyleDialog
from opengeo.qgis.catalog import OGCatalog
from opengeo.gui.catalogselector import selectCatalog
... | gpl-2.0 |
fw1121/ete | sdoc/face_grid.py | 2 | 2228 | from ete2 import Tree, TextFace, NodeStyle, TreeStyle
t = Tree("((a,b),c);")
right_c0_r0 = TextFace("right_col0_row0")
right_c0_r1 = TextFace("right_col0_row1")
right_c1_r0 = TextFace("right_col1_row0")
right_c1_r1 = TextFace("right_col1_row1")
right_c1_r2 = TextFace("right_col1_row2")
top_c0_r0 = TextFace("top_col0... | gpl-3.0 |
vane/pywinauto | pywinauto/tests/_menux.py | 17 | 2502 | # GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# 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 you... | lgpl-2.1 |
mozilla/captain | vendor/lib/python/django/contrib/admindocs/views.py | 93 | 15143 | import inspect
import os
import re
from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions imp... | mpl-2.0 |
kbeckmann/Annalog | uptime.py | 1 | 2015 | import re
import time
import sys
from datetime import datetime,timedelta
from dateutil import tz
class UpTime():
def __init__(self, mucbot):
self.mucbot = mucbot
self.startTime = datetime.now()
def delta_string(self, delta):
h = divmod(delta.seconds, 3600)
m = divmod(h[1], 60)
... | mit |
nixpanic/gluster-wireshark-1.4 | tools/indexcap.py | 3 | 11543 | #!/usr/bin/python
#
# Tool to index protocols that appears in the given capture files
#
# Copyright 2009, Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>
#
# $Id$
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free softwa... | gpl-2.0 |
rakhuba/tucker3d | cross/multifun.py | 1 | 19357 | import numpy as np
import time
from math import pi
import copy
from scipy.special import erf
import tucker3d as tuck
def multifun(X, delta_cross, fun, r_add=4, y0=None, rmax=100, pr=None):
# For X = [X_1,...,X_d], where X_i - tensors in the Tucker format
# cross_func computes y = func(X) == func(x_1,...,... | mit |
ThomasKing2014/foresight | foresight/java/next_bits.py | 4 | 1436 | """ java.utils.Random utility functions.
These methods simulate the Random object 'next' function, and
are used to implement the other Random functions (nextInt, nextDouble, etc.)
Note that it is an error to pass a value for 'bits' that is larger than 32.
"""
from foresight import lcg
from ctypes import c_uint32
M... | mit |
quxiaolong1504/django | tests/model_meta/test_legacy.py | 199 | 7556 | import warnings
from django import test
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import CharField, related
from django.utils.deprecation import RemovedInDjango110Warning
from .models import BasePerson, Person
from ... | bsd-3-clause |
olinguyen/shogun | examples/undocumented/python/classifier_multiclassmachine.py | 6 | 1152 | #!/usr/bin/env python
from tools.multiclass_shared import prepare_data
[traindat, label_traindat, testdat, label_testdat] = prepare_data()
parameter_list = [[traindat,testdat,label_traindat,2.1,1,1e-5],[traindat,testdat,label_traindat,2.2,1,1e-5]]
def classifier_multiclassmachine (fm_train_real=traindat,fm_test_real... | gpl-3.0 |
AndrewPeelMV/Blender2.78c | 2.78/scripts/modules/bpy/utils/__init__.py | 2 | 19907 | # ##### 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-2.0 |
SteveDiamond/cvxpy | cvxpy/atoms/mixed_norm.py | 3 | 1240 | """
Copyright 2013 Steven Diamond
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... | gpl-3.0 |
SpamScope/spamscope | src/bolts/json_maker.py | 1 | 2958 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2016 Fedele Mantuano (https://www.linkedin.com/in/fmantuano/)
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 |
flightcoin/flightcoin | share/qt/extract_strings_qt.py | 2945 | 1844 | #!/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
OUT_CPP="src/qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format produced by x... | mit |
cryptokoin/geocoinq | share/qt/extract_strings_qt.py | 2945 | 1844 | #!/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
OUT_CPP="src/qt/bitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format produced by x... | mit |
czgu/metaHack | env/lib/python2.7/site-packages/django/template/smartif.py | 111 | 6276 | """
Parser and utilities for the smart 'if' tag
"""
# Using a simple top down parser, as described here:
# http://effbot.org/zone/simple-top-down-parsing.htm.
# 'led' = left denotation
# 'nud' = null denotation
# 'bp' = binding power (left = lbp, right = rbp)
class TokenBase(object):
"""
Base class for op... | apache-2.0 |
Centreon-Community/centreon-discovery | modPython/MySQL-python-1.2.3/setup_posix.py | 2 | 3225 | from ConfigParser import SafeConfigParser
# This dequote() business is required for some older versions
# of mysql_config
def dequote(s):
if s[0] in "\"'" and s[0] == s[-1]:
s = s[1:-1]
return s
def compiler_flag(f):
return "-%s" % f
def mysql_config(what):
from os import popen
f = pope... | gpl-2.0 |
suto/infernal-twin | build/pip/pip/pep425tags.py | 249 | 4427 | """Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import re
import sys
import warnings
try:
import sysconfig
except ImportError: # pragma nocover
# Python < 2.7
import distutils.sysconfig as sysconfig
import distutils.util
_osx_arch_pat = re.compile(r'(.+)_(... | gpl-3.0 |
Abhayakara/dnspython | dns/rdtypes/txtbase.py | 8 | 2918 | # Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | isc |
yaoice/dzhops | managekeys/utils.py | 1 | 1677 | # -*- coding: utf-8 -*-
from hostlist.models import HostList, Dzhuser
import logging
log = logging.getLogger('opsmaster')
def clearUpMinionKyes(idlist, dc, eg):
'''
对Minion id进行整理,返回对应状态、机房、维护人员的minion id;
:param idlist: acp/pre/rej(分别表示已经接受、未接受、已拒绝三个状态)
:param dc: 机房英文简称
:param eg: 维护人员用户名,英文简称;
... | apache-2.0 |
talexop/talexop_kernel_i9505_4.3 | tools/perf/scripts/python/sched-migration.py | 11215 | 11670 | #!/usr/bin/python
#
# Cpu task migration overview toy
#
# Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com>
#
# perf script event handlers have been generated by perf script -g python
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Fre... | gpl-2.0 |
CloverHealth/airflow | airflow/contrib/operators/sftp_operator.py | 4 | 4232 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
ishay2b/tensorflow | tensorflow/contrib/fused_conv/__init__.py | 87 | 1113 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
ericjang/cryptocurrency_arbitrage | BTER.py | 2 | 4991 | from Exchange import Exchange
import bterapi
import os
from order import Order
class BTER(Exchange):
def __init__(self, keyfile):
keyfile = os.path.abspath(keyfile)
self.keyhandler = bterapi.KeyHandler(keyfile)
key = self.keyhandler.getKeys()[0]
self.conn = bterapi.BTERConnection()
... | gpl-3.0 |
Kegbot/kegbot-server | pykeg/backup/postgres.py | 1 | 1907 | """Postgres-specific database backup/restore implementation."""
import logging
import os
import subprocess
from django.conf import settings
logger = logging.getLogger(__name__)
DEFAULT_DB = "default"
# Common command-line arguments
PARAMS = {
"db": settings.DATABASES[DEFAULT_DB].get("NAME"),
"user": settin... | gpl-2.0 |
markrawlingson/SickRage | lib/unidecode/x052.py | 253 | 4654 | data = (
'Dao ', # 0x00
'Diao ', # 0x01
'Dao ', # 0x02
'Ren ', # 0x03
'Ren ', # 0x04
'Chuang ', # 0x05
'Fen ', # 0x06
'Qie ', # 0x07
'Yi ', # 0x08
'Ji ', # 0x09
'Kan ', # 0x0a
'Qian ', # 0x0b
'Cun ', # 0x0c
'Chu ', # 0x0d
'Wen ', # 0x0e
'Ji ', # 0x0f
'Dan ', # 0x10
'Xi... | gpl-3.0 |
erpletzerp/letzerpcore | frappe/model/sync.py | 4 | 2148 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Sync's doctype and docfields from txt files to database
perms will get synced only if none exist
"""
import frappe
import os
from frappe.modules.import_file import import... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.