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 |
|---|---|---|---|---|---|
snip/skylines | skylines/frontend/views/notifications.py | 2 | 2771 | from flask import Blueprint, render_template, request, url_for, redirect, g
from sqlalchemy.orm import subqueryload, contains_eager
from sqlalchemy.sql.expression import or_
from skylines.lib.util import str_to_bool
from skylines.database import db
from skylines.model.event import Event, Notification, Flight, group_ev... | agpl-3.0 |
blaggacao/OpenUpgrade | addons/payment_authorize/controllers/main.py | 247 | 1261 | # -*- coding: utf-8 -*-
import pprint
import logging
import urlparse
from openerp import http
from openerp.http import request
_logger = logging.getLogger(__name__)
class AuthorizeController(http.Controller):
_return_url = '/payment/authorize/return/'
_cancel_url = '/payment/authorize/cancel/'
@http.ro... | agpl-3.0 |
gaurav-kaushik/BostonBikr | app/reTrip.py | 1 | 10980 | """
reTrip will take text files of TripAdvisor data and turn them into Geocoded locations to transpose onto the map.
This uses a rather hacky text-based method because of time constraints. A full-featured web crawler that could be used for many pages or other sites at once would be much better. But since we only collec... | mit |
nrwahl2/ansible | lib/ansible/modules/storage/netapp/na_cdot_volume.py | 28 | 13714 | #!/usr/bin/python
# (c) 2017, NetApp, Inc
# 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 |
kmacinnis/sympy | sympy/utilities/tests/test_autowrap.py | 10 | 4139 | # Tests that require installed backends go into
# sympy/test_external/test_autowrap
import os
import tempfile
import shutil
from sympy.utilities.autowrap import autowrap, binary_function, CythonCodeWrapper, \
ufuncify
from sympy.utilities.codegen import Routine, CCodeGen, CodeGenArgumentListError
from sympy.utili... | bsd-3-clause |
alshedivat/tensorflow | tensorflow/contrib/distribute/python/combinations_test.py | 30 | 5002 | # 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 |
skulbrane/metagoofil | pdfminer/encodingdb.py | 56 | 1548 | #!/usr/bin/env python2
import re
from psparser import PSLiteral
from glyphlist import glyphname2unicode
from latin_enc import ENCODING
## name2unicode
##
STRIP_NAME = re.compile(r'[0-9]+')
def name2unicode(name):
"""Converts Adobe glyph names to Unicode numbers."""
if name in glyphname2unicode:
retu... | gpl-2.0 |
liulion/mayavi | mayavi/tests/test_grid_plane.py | 2 | 4217 | # Author: Suyog Dutt Jain <suyog.jain@aero.iitb.ac.in>
# Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os.path import abspath
from StringIO import StringIO
import copy
import unittest
import datasets
# Local imports.
f... | bsd-3-clause |
aforalee/rally | tests/unit/plugins/openstack/scenarios/tempest/test_tempest.py | 7 | 8734 | # Copyright 2014: Mirantis 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 |
linearregression/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Options/PathOption.py | 61 | 2789 | #
# 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 |
bitpay/cjdns | node_build/dependencies/libuv/build/gyp/test/mac/gyptest-xcode-env-order.py | 75 | 3463 | #!/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 that dependent Xcode settings are processed correctly.
"""
import TestGyp
import subprocess
import sys
def XcodeVersion():
... | gpl-3.0 |
eclectice/jna | native/libffi/generate-osx-source-and-headers.py | 100 | 5200 | #!/usr/bin/env python
import subprocess
import re
import os
import errno
import collections
import sys
class Platform(object):
pass
sdk_re = re.compile(r'.*-sdk ([a-zA-Z0-9.]*)')
def sdkinfo(sdkname):
ret = {}
for line in subprocess.Popen(['xcodebuild', '-sdk', sdkname, '-version'], stdout=subprocess.PIP... | lgpl-2.1 |
potatolondon/django-nonrel-1-4 | django/contrib/gis/tests/__init__.py | 75 | 4666 | from django.conf import settings
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def geo_apps(namespace=True, runtests=False):
... | bsd-3-clause |
bentzinir/Buffe | Applications/4-way-stop/main.py | 1 | 2736 | import os
import sys
sys.path.append('../../utils')
sys.path.append('../../layers')
import theano as t
from optimization import optimization
from io_utils import init_files
t.config.reoptimize_unpickled_function = False
t.config.scan.allow_output_prealloc = True
t.config.exception_verbosity = 'high'
t.config.warn_flo... | mit |
grengojbo/grappelli-admin-tools | admin_tools/dashboard/utils.py | 2 | 3829 | """
Dashboard utilities.
"""
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.utils.text import capfirst
from django.core.urlresolvers import reverse
from admin_tools.dashboard import ... | mit |
btat/Booktype | lib/booktype/apps/edit/tasks.py | 2 | 2264 | import celery
import celery.result
from booki.editor import models
import sputnik
def fetch_url(url, data):
import urllib2
import httplib
import json
try:
data_json = json.dumps(data)
except TypeError:
return None
req = urllib2.Request(url, data_json)
req.add_header('C... | agpl-3.0 |
Yukarumya/Yukarum-Redfoxes | testing/mochitest/runtestsremote.py | 1 | 14390 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import traceback
sys.path.insert(
0, os.path.abspath(
os.path.realpath(
os... | mpl-2.0 |
igemsoftware/SYSU-Software2013 | project/Python27_32/Lib/site-packages/win32comext/axscript/client/pyscript_rexec.py | 35 | 1973 | # A version of the ActiveScripting engine that enables rexec support
# This version supports hosting by IE - however, due to Python's
# rexec module being neither completely trusted nor private, it is
# *not* enabled by default.
# As of Python 2.2, rexec is simply not available - thus, if you use this,
# a HTML page ca... | mit |
krtkmj/zulip | analytics/views.py | 4 | 28114 | from __future__ import absolute_import
from __future__ import division
from six import text_type
from typing import Any, Dict, List, Tuple, Optional, Sequence, Callable, Union
from django.db import connection
from django.db.models.query import QuerySet
from django.template import RequestContext, loader
from django.cor... | apache-2.0 |
ticosax/django | tests/gis_tests/test_measure.py | 325 | 7363 | """
Distance and Area objects to allow for sensible and convenient calculation
and conversions. Here are some tests.
"""
import unittest
from django.contrib.gis.measure import A, D, Area, Distance
class DistanceTest(unittest.TestCase):
"Testing the Distance object"
def testInit(self):
"Testing init... | bsd-3-clause |
sunclx/anki | oldanki/facts.py | 20 | 5157 | # -*- coding: utf-8 -*-
# Copyright: Damien Elmes <oldanki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
"""\
Facts
========
"""
__docformat__ = 'restructuredtext'
import time
from oldanki.db import *
from oldanki.errors import *
from oldanki.models import Model, FieldModel, ... | agpl-3.0 |
rosmo/ansible | test/units/modules/network/slxos/test_slxos_interface.py | 38 | 4938 | #
# (c) 2018 Extreme Networks Inc.
#
# 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.
#
# Ans... | gpl-3.0 |
sahutd/youtube-dl | youtube_dl/extractor/cbsnews.py | 96 | 3204 | # encoding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
class CBSNewsIE(InfoExtractor):
IE_DESC = 'CBS News'
_VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P<id>[\da-z_-]+)'
_TESTS = [
{
'url': 'http://www.cbsnews.... | unlicense |
mensler/ansible | lib/ansible/playbook/task.py | 15 | 17183 | # (c) 2012-2014, 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) an... | gpl-3.0 |
PrincessTeruko/TsunArt | auth_users/views.py | 1 | 1302 | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render
from auth_users.forms import AuthUserForm
from core.common import *
def new(r... | mit |
Badredapple/ipv6-hosts | update_hosts.py | 12 | 8023 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import socket
import getopt
import threading
import subprocess
import shlex
import time
import select
blackhole = (
'10::2222',
'101::1234',
'2001::212',
'2001:da8:112::21ae',
'2003:ff:1:2:3:4:5fff:6',
'2003:ff:1:2:3:... | mit |
MuckRock/muckrock | muckrock/portal/migrations/0001_initial.py | 1 | 2737 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-31 14:13
# Django
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('foia', '0040_foiacommunication_hidden'),
]
operations = [
... | agpl-3.0 |
alexcrichton/gyp | test/subdirectory/gyptest-top-default.py | 261 | 1363 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a target and a subsidiary dependent target from a
.gyp file in a subdirectory, without specifying an explicit output b... | bsd-3-clause |
rue89-tech/edx-platform | cms/djangoapps/course_creators/views.py | 230 | 3176 | """
Methods for interacting programmatically with the user creator table.
"""
from course_creators.models import CourseCreator
from student.roles import CourseCreatorRole
from student import auth
def add_user_with_status_unrequested(user):
"""
Adds a user to the course creator table with status 'unrequested'.... | agpl-3.0 |
tundish/rson | rson/base/dispatcher.py | 3 | 2039 | '''
Parser dispatcher mix-in class.
Copyright (c) 2010, Patrick Maupin. All rights reserved.
See http://code.google.com/p/rson/source/browse/trunk/license.txt
'''
def _alter_attributes(cls, attrs):
''' Return a new class with altered attributes.
But throw an exception unless altered attributes
a... | mit |
HoracioAlvarado/fwd | venv/Lib/site-packages/markupsafe/tests.py | 674 | 6107 | # -*- coding: utf-8 -*-
import gc
import sys
import unittest
from markupsafe import Markup, escape, escape_silent
from markupsafe._compat import text_type
class MarkupTestCase(unittest.TestCase):
def test_adding(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="appl... | mit |
tmpgit/intellij-community | plugins/hg4idea/testData/bin/mercurial/httpconnection.py | 91 | 10916 | # httpconnection.py - urllib2 handler for new http support
#
# Copyright 2005, 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
# Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br>
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
# Copyright 2011 Google, Inc.
#
# This software may be used and distribu... | apache-2.0 |
dreamllq/node | tools/gyp/pylib/gyp/input_test.py | 1841 | 3207 | #!/usr/bin/env python
# Copyright 2013 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.
"""Unit tests for the input.py file."""
import gyp.input
import unittest
import sys
class TestFindCycles(unittest.TestCase):
def setUp(self... | apache-2.0 |
sandeepgupta2k4/tensorflow | tensorflow/contrib/keras/python/keras/layers/embeddings.py | 27 | 6230 | # Copyright 2015 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 |
ogeniz/programming | Python/dsp/thinkdsp/thinkdsp.py | 2 | 37046 | """This file contains code used in "Think DSP",
by Allen B. Downey, available from greenteapress.com
Copyright 2013 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import array
import copy
import math
import numpy
import random
import scipy
... | gpl-2.0 |
jumpstarter-io/nova | nova/cmd/idmapshift.py | 68 | 7093 | # Copyright 2014 Rackspace, Andrew Melton
#
# 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... | apache-2.0 |
ambikeshwar1991/gnuradio-3.7.4 | gr-digital/python/digital/qa_probe_density.py | 57 | 2132 | #!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your opt... | gpl-3.0 |
std05048/Thesis | src/lte/bindings/callbacks_list.py | 38 | 2565 | callback_classes = [
['void', 'ns3::Ptr<ns3::Packet const>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::... | gpl-2.0 |
janocat/odoo | addons/auth_signup/controllers/main.py | 144 | 6049 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
aleida/django | django/views/generic/dates.py | 7 | 25073 | from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import force_unicode
from django.utils.functional import cached_property
from django.u... | bsd-3-clause |
rs2/pandas | pandas/tests/series/indexing/test_alter_index.py | 2 | 9723 | import numpy as np
import pytest
import pandas as pd
from pandas import Categorical, Series, date_range, isna
import pandas._testing as tm
def test_reindex(datetime_series, string_series):
identity = string_series.reindex(string_series.index)
# __array_interface__ is not defined for older numpies
# and ... | bsd-3-clause |
gongweibao/cloud | demo/understand_sentiment/train_ft.py | 2 | 8493 | # Copyright (c) 2016 PaddlePaddle 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 applic... | apache-2.0 |
hassoon3/odoo | addons/account_voucher/__openerp__.py | 260 | 3232 | # -*- 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 |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/job_x_building/same_sector_employment_in_zone.py | 2 | 2306 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.abstract_variables.abstract_number_of_agents_with_same_attribute_value import abstract_number_of_agents_with_same_attribute_value
class same_sector_employment_in_zone(abstract_num... | gpl-2.0 |
XiaosongWei/blink-crosswalk | Tools/Scripts/webkitpy/style/checker_unittest.py | 48 | 32167 | # -*- coding: utf-8; -*-
#
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Torch Mobile Inc.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
#
# Redistribution and use in source and binary forms, with or without
# modificatio... | bsd-3-clause |
siliconsmiley/QGIS | python/plugins/processing/modeler/ModelerAlgorithm.py | 1 | 25642 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | gpl-2.0 |
capitalone/cloud-custodian | tools/c7n_azure/c7n_azure/resources/postgresql_server.py | 1 | 1434 | # Copyright 2019 Microsoft Corporation
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
@resources.register('postgresql-server')
class PostgresqlServer(ArmResourceManager):
"""PostgreSQL ... | apache-2.0 |
mmangura/Base | applications/examples/controllers/global.py | 12 | 1471 | session.forget()
def get(args):
if args[0].startswith('__'):
return None
try:
obj = globals(),get(args[0])
for k in range(1,len(args)):
obj = getattr(obj,args[k])
return obj
except:
return None
def vars():
"""the running controller function!"""
t... | mit |
GehenHe/Recognize-Face-on-Android | tensorflow/contrib/distributions/python/kernel_tests/normal_test.py | 7 | 17539 | # Copyright 2015 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 |
Nano1994/freenos | site_scons/ext2.py | 11 | 1950 | #
# Copyright (C) 2009 Niek Linnenbank
#
# 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 distribute... | gpl-3.0 |
themaxx75/lapare-bijoux | lapare.ca/lapare/settings/base.py | 1 | 2795 | import sys
from os.path import join, abspath, dirname
# PATH vars
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
sys.path.insert(0, root('apps'))
ADMINS = (
('Maxime Lapointe', 'maxx@themaxx.ca'),
)
MANAGERS = ADMINS
SHELL_PLUS... | bsd-3-clause |
Qalthos/ansible | test/runner/lib/cloud/gcp.py | 16 | 1754 | # Copyright: (c) 2018, Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""GCP plugin for integration tests."""
from __future__ import absolute_import, print_function
import os
from lib.util import (
display,
ConfigParser,
)
from lib.cloud import (
... | gpl-3.0 |
klonage/nlt-gcs | packages/IronPython.StdLib.2.7.4/content/Lib/UserString.py | 67 | 9915 | #!/usr/bin/env python
## vim:ts=4:et:nowrap
"""A user-defined wrapper around string objects
Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
import sys
import collections
__all__ = ["UserString","MutableString"]
class UserString(collections.Sequence):
... | gpl-3.0 |
vauxoo-dev/l10n-spain | __unported__/l10n_es_aeat_mod349/wizard/export_mod349_to_boe.py | 3 | 15781 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C)
# 2004-2011: Pexego Sistemas Informáticos. (http://pexego.es)
# 2013: Top Consultant Software Creations S.L.
# (http://www.topconsultant.es/)
# 2014: ... | agpl-3.0 |
sanjeevtripurari/hue | desktop/core/ext-py/PyYAML-3.09/lib3/yaml/parser.py | 83 | 25356 |
# The following YAML grammar is LL(1) and is parsed by a recursive descent
# parser.
#
# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
# implicit_document ::= block_node DOCUMENT-END*
# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
# block_node_or_inden... | apache-2.0 |
frankyrumple/smc | modules/ecdsa/der.py | 29 | 7018 | from __future__ import division
import binascii
import base64
from .six import int2byte, b, integer_types, text_type
class UnexpectedDER(Exception):
pass
def encode_constructed(tag, value):
return int2byte(0xa0+tag) + encode_length(len(value)) + value
def encode_integer(r):
assert r >= 0 # can't support ... | mit |
pathway27/servo | components/style/properties/data.py | 6 | 7129 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
def to_rust_ident(name):
name = name.replace("-", "_")
if name in ["static", "super", "box", "move"]... | mpl-2.0 |
jadnohra/connect | proto_1/ddq/namer.py | 1 | 2953 | import copy
from typing import Set, Any
from .node import Node
from .fol.node_types import is_variable_declaration
class Namer:
def __init__(self):
self._name_dict = {}
self._first_name_candidates = ['x', 'y', 'z', 'w']
def _new_name(self, taken_names: Set[str]) -> str:
def make_name(... | unlicense |
StefanRijnhart/OpenUpgrade | addons/auth_crypt/__init__.py | 435 | 1050 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | agpl-3.0 |
dunkhong/grr | grr/client_builder/grr_response_client_builder/repackers/linux.py | 1 | 15749 | #!/usr/bin/env python
"""Linux client repackers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
import shutil
import subprocess
import zipfile
from grr_response_client_builder im... | apache-2.0 |
facetothefate/contrail-controller | src/nodemgr/vrouter_nodemgr/haproxy_stats.py | 8 | 2499 | import os
import socket
import sys
import csv
LB_BASE_DIR = '/var/lib/contrail/loadbalancer/'
STATS_MAP = {
'active_connections': 'qcur',
'max_connections': 'qmax',
'current_sessions': 'scur',
'max_sessions': 'smax',
'total_sessions': 'stot',
'bytes_in': 'bin',
'bytes_out': 'bout',
'co... | apache-2.0 |
wootencl/D3_Jupyter_Data_Visualization | xlrd-0.9.4/xlrd/xlsx.py | 2 | 31337 | ##
# Portions copyright (c) 2008-2012 Stephen John Machin, Lingfo Pty Ltd
# This module is part of the xlrd package, which is released under a BSD-style licence.
##
from __future__ import print_function, unicode_literals
DEBUG = 0
import sys
import re
from .timemachine import *
from .book import Book, Name
from .bif... | mit |
1tush/reviewboard | reviewboard/site/admin.py | 8 | 1466 | #
# admin.py -- Admin site definitions for the "reviewboard.site" app
#
# Copyright (c) 2010 David Trowbridge
#
# 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... | mit |
AkademieOlympia/sympy | sympy/external/tests/test_importtools.py | 91 | 1215 | from sympy.external import import_module
# fixes issue that arose in addressing issue 6533
def test_no_stdlib_collections():
'''
make sure we get the right collections when it is not part of a
larger list
'''
import collections
matplotlib = import_module('matplotlib',
__import__kwargs={... | bsd-3-clause |
tengpeng/spark | examples/src/main/python/mllib/recommendation_example.py | 128 | 2054 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
evelynmitchell/smc | src/scripts/zfs_chown.py | 6 | 3576 | #!/usr/bin/env python
###############################################################################
#
# SageMathCloud: A collaborative web-based interface to Sage, IPython, LaTeX and the Terminal.
#
# Copyright (C) 2014, William Stein
#
# This program is free software: you can redistribute it and/or modify
# ... | gpl-3.0 |
matmutant/sl4a | python/src/Lib/idlelib/PyParse.py | 185 | 19510 | import re
import sys
# Reason last stmt is continued (or C_NONE if it's not).
(C_NONE, C_BACKSLASH, C_STRING_FIRST_LINE,
C_STRING_NEXT_LINES, C_BRACKET) = range(5)
if 0: # for throwaway debugging output
def dump(*stuff):
sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")
# Find what looks like the... | apache-2.0 |
Idematica/django-oscar | oscar/apps/offer/migrations/0011_auto__add_field_range_proxy_class.py | 17 | 15147 | # encoding: 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):
# Adding field 'Range.proxy_class'
db.add_column('offer_range', 'proxy_class', self.gf('django.db.models.fields.Ch... | bsd-3-clause |
ChristianTremblay/ddcmath | tests/test_temperature.py | 1 | 1644 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
#
# Licensed under GPLv3, see file LICENSE in this source tree.
from __future__ import division
from ddcmath.temperature import f2c, c2f, delta_c2f, delta_f2c, oat_percent, mkt
from ddcmath.t... | gpl-3.0 |
joakim-hove/django | tests/forms_tests/tests/test_formsets.py | 163 | 56939 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.forms import (
CharField, DateField, FileField, Form, IntegerField, SplitDateTimeField,
ValidationError, formsets,
)
from django.forms.formsets import BaseFormSet, formset_factory
from django.forms.utils import ErrorLi... | bsd-3-clause |
nugget/home-assistant | homeassistant/components/raincloud/__init__.py | 3 | 5069 | """
Support for Melnor RainCloud sprinkler water timer.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/raincloud/
"""
from datetime import timedelta
import logging
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol
from ... | apache-2.0 |
srznew/heat | heat/engine/clients/os/nova.py | 2 | 26817 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | apache-2.0 |
takeshineshiro/neutron | neutron/services/qos/qos_plugin.py | 18 | 7552 | # Copyright (c) 2015 Red Hat 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... | apache-2.0 |
bbenko/shinkicker | dbindexer/api.py | 74 | 1119 | from .lookups import LookupDoesNotExist, ExtraFieldLookup
from . import lookups as lookups_module
from .resolver import resolver
import inspect
# TODO: add possibility to add lookup modules
def create_lookup(lookup_def):
for _, cls in inspect.getmembers(lookups_module):
if inspect.isclass(cls) and issubcla... | bsd-3-clause |
daodaoliang/bokeh | bokeh/server/app.py | 13 | 1647 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | bsd-3-clause |
msabramo/pip | pip/_vendor/cachecontrol/controller.py | 22 | 8900 | """
The httplib2 algorithms ported for use with requests.
"""
import re
import calendar
import time
from email.utils import parsedate_tz
from pip._vendor.requests.structures import CaseInsensitiveDict
from .cache import DictCache
from .serialize import Serializer
URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?... | mit |
pferreir/indico-backup | indico/MaKaC/plugins/Collaboration/RecordingManager/options.py | 2 | 10164 | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | gpl-3.0 |
windyuuy/opera | chromium/src/net/android/tools/proxy_test_cases.py | 165 | 10640 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Generator script for proxy tests.
See AndroidProxySelectorTest.java
and net/proxy/proxy_config_service_android_unittest.cc
To ... | bsd-3-clause |
dennis-sheil/commandergenius | project/jni/python/src/Lib/urlparse.py | 59 | 14437 | """Parse (absolute and relative) URLs.
See RFC 1808: "Relative Uniform Resource Locators", by R. Fielding,
UC Irvine, June 1995.
"""
__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
"urlsplit", "urlunsplit", "parse_qs", "parse_qsl"]
# A classification of schemes ('' means apply by default)
use... | lgpl-2.1 |
Jonekee/chromium.src | chrome/common/extensions/docs/server2/test_patcher.py | 121 | 1055 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from future import Future
from patcher import Patcher
class TestPatcher(Patcher):
def __init__(self, version, patched_files, patch_data):
self._versio... | bsd-3-clause |
overtherain/scriptfile | software/googleAppEngine/lib/django_1_3/tests/regressiontests/custom_managers_regress/tests.py | 93 | 2170 | from django.test import TestCase
from models import RelatedModel, RestrictedModel, OneToOneRestrictedModel
class CustomManagersRegressTestCase(TestCase):
def test_filtered_default_manager(self):
"""Even though the default manager filters out some records,
we must still be able to save (particularl... | mit |
sdiazb/airflow | airflow/operators/s3_to_hive_operator.py | 7 | 10569 | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | apache-2.0 |
InScience/DAMIS-old | src/damis/migrations/0040_auto__add_field_cluster_title_lt__add_field_cluster_description__add_f.py | 1 | 12147 | # -*- 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 field 'Cluster.title_lt'
db.add_column(u'damis_cluster', 'title_... | agpl-3.0 |
ktritz/vispy | examples/basics/gloo/hello_fbo.py | 18 | 3409 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# vispy: gallery 3
"""
Minimal example demonstrating the use of frame buffer objects (FBO).
This example blurs the output image.
"""
from vispy import gloo
from vispy import app
import numpy as np
# Create vetices
vPosition = np.array([[-0.8, -0.8, 0.0], [+0.7, -0.7, 0... | bsd-3-clause |
toshywoshy/ansible | test/units/modules/network/fortios/test_fortios_switch_controller_802_1X_settings.py | 21 | 6326 | # Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | gpl-3.0 |
cedk/odoo | addons/procurement/__openerp__.py | 267 | 2661 | # -*- 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 |
nisse3000/pymatgen | pymatgen/entries/compatibility.py | 4 | 25500 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import os
import abc
import warnings
import six
from six.moves import filter, map
from collections import defaultdict
from monty.design_patterns import cache... | mit |
lorin/ansible-modules-core | cloud/rax_files.py | 60 | 11966 | #!/usr/bin/python
# (c) 2013, Paul Durivage <paul.durivage@rackspace.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
# (a... | gpl-3.0 |
raiden-network/raiden | raiden/tests/integration/long_running/test_integration_events.py | 1 | 22515 | from unittest.mock import patch
import gevent
import pytest
from eth_utils import keccak
from web3._utils.events import construct_event_topic_set
from raiden import waiting
from raiden.api.python import RaidenAPI
from raiden.blockchain.events import get_all_netting_channel_events, get_contract_events
from raiden.cons... | mit |
arkilic/mdsbenchmark | benchmarks/benchmarks_insert_empty_db.py | 1 | 4179 | import numpy as np
import metadatastore.api as mdsc
EVENT_COUNT = 1000
# I have event count so that
# tests do not take forever during
# development. I will get rid off
# this, bear with me.
class Suite:
params = [1, 10, 100, 1000]
def setup(self, n):
self.obj = range(n)
self.bcfg = mdsc.in... | bsd-3-clause |
tsdmgz/ansible | lib/ansible/module_utils/aws/direct_connect.py | 17 | 4121 | # Copyright (c) 2017 Ansible Project
#
# 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... | gpl-3.0 |
saydulk/django | django/contrib/gis/admin/options.py | 379 | 5649 | from django.contrib.admin import ModelAdmin
from django.contrib.gis.admin.widgets import OpenLayersWidget
from django.contrib.gis.db import models
from django.contrib.gis.gdal import HAS_GDAL, OGRGeomType
from django.core.exceptions import ImproperlyConfigured
spherical_mercator_srid = 3857
class GeoModelAdmin(Model... | bsd-3-clause |
ericlin-ICT/mysite | src/clouddesktop/core/query.py | 1 | 7926 | #-*- encoding: utf-8 -*-
'''
Created on 2014年2月14日
@author: ericlin
'''
import logging
import ldap.resiter
from pandas.core.frame import DataFrame
import re
class Query(ldap.resiter.ResultProcessor):
'''
Description:
--------------------------------------------------------
perform ad query... | apache-2.0 |
baberthal/CouchPotatoServer | libs/chardet/euctwprober.py | 2994 | 1676 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | gpl-3.0 |
ESS-LLP/erpnext-medical | erpnext/healthcare/doctype/drug_prescription/drug_prescription.py | 26 | 1130 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, ESS LLP and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class DrugPrescription(Document):
def get_quantity(self):
quantity = 0
dosage = None
period =... | gpl-3.0 |
eemirtekin/edx-platform | common/lib/capa/capa/correctmap.py | 68 | 6655 | #-----------------------------------------------------------------------------
# class used to store graded responses to CAPA questions
#
# Used by responsetypes and capa_problem
class CorrectMap(object):
"""
Stores map between answer_id and response evaluation result for each question
in a capa problem. ... | agpl-3.0 |
yawnosnorous/python-for-android | python-modules/twisted/twisted/test/proto_helpers.py | 56 | 15308 | # -*- test-case-name: twisted.test.test_stringtransport -*-
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Assorted functionality which is commonly useful when writing unit tests.
"""
from StringIO import StringIO
from zope.interface import implements
from twisted.internet.int... | apache-2.0 |
ESS-LLP/erpnext | erpnext/education/api.py | 8 | 12320 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.utils import flt, cstr
from frappe.email... | gpl-3.0 |
wardweistra/glassfrog-hipchat-bot | migrations/env.py | 557 | 2883 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config ... | lgpl-3.0 |
MediaBrowser/plugin.video.emby | resources/lib/views.py | 3 | 35589 | # -*- coding: utf-8 -*-
#################################################################################################
import logging
import os
import shutil
import urllib
import xml.etree.ElementTree as etree
import xbmc
import xbmcvfs
import downloader as server
from database import Database, emby_db, get_sync... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.