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
vsco/grpc
test/distrib/python/distribtest.py
35
1732
# Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
bsd-3-clause
danakj/chromium
third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/files.py
64
7801
"""File wrangling.""" from coverage.backward import to_string from coverage.misc import CoverageException import fnmatch, os, re, sys class FileLocator(object): """Understand how filenames work.""" def __init__(self): # The absolute path to our current directory. self.relative_dir = self.abs_...
bsd-3-clause
brettcs/diffoscope
tests/comparators/test_debian.py
1
11899
# -*- coding: utf-8 -*- # # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2015 Jérémy Bobbio <lunar@debian.org> # # diffoscope 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 Foundati...
gpl-3.0
gavinp/chromium
chrome/tools/build/win/sln_deps.py
170
3936
#!/usr/bin/env python # Copyright (c) 2011 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. import copy import optparse __version__ = "1.0" # Constants used by Visual Studio. UNKNOWN_GUID = "{00000000-0000-0000-0000-00000...
bsd-3-clause
ArthurGarnier/SickRage
lib/dateutil/zoneinfo/rebuild.py
34
1719
import logging import os import tempfile import shutil import json from subprocess import check_call from tarfile import TarFile from dateutil.zoneinfo import METADATA_FN, ZONEFILENAME def rebuild(filename, tag=None, format="gz", zonegroups=[], metadata=None): """Rebuild the internal timezone info in dateutil/zo...
gpl-3.0
renyi533/tensorflow
tensorflow/python/saved_model/save_test.py
2
28463
# 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
jgoclawski/django
django/contrib/gis/geos/polygon.py
450
6843
from ctypes import byref, c_uint from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.libgeos import GEOM_PTR, get_pointer_arr from django.contrib.gis.geos.linestring import LinearRing from django.utils import six from django.util...
bsd-3-clause
skg-net/ansible
lib/ansible/modules/system/dconf.py
27
13115
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Branko Majic <branko@majic.rs> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
nxnfufunezn/servo
tests/wpt/harness/wptrunner/browsers/servo.py
7
2787
# 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 from .base import NullBrowser, ExecutorBrowser, require_arg from ..executors import executor_kwargs as base_e...
mpl-2.0
shhui/nova
nova/virt/libvirt/driver.py
1
225758
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
apache-2.0
alimusa123/helloapp12
lib/jinja2/visitor.py
1401
3316
# -*- coding: utf-8 -*- """ jinja2.visitor ~~~~~~~~~~~~~~ This module implements a visitor for the nodes. :copyright: (c) 2010 by the Jinja Team. :license: BSD. """ from jinja2.nodes import Node class NodeVisitor(object): """Walks the abstract syntax tree and call visitor functions for every...
apache-2.0
sachinpro/sachinpro.github.io
tensorflow/contrib/quantization/python/quantized_conv_ops_test.py
8
8315
# 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
meejah/AutobahnPython
examples/twisted/websocket/echo_compressed/server_advanced.py
3
4538
############################################################################### # # The MIT License (MIT) # # Copyright (c) Tavendo GmbH # # 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 with...
mit
mozilla/addons-server
src/olympia/addons/serializers.py
3
35839
import re from urllib.parse import urlsplit, urlunsplit from django.http.request import QueryDict from django.urls import reverse from rest_framework import exceptions, serializers from olympia import amo from olympia.accounts.serializers import ( BaseUserSerializer, UserProfileBasketSyncSerializer, ) from o...
bsd-3-clause
plotly/python-api
packages/python/plotly/plotly/validators/scattermapbox/_marker.py
2
6951
import _plotly_utils.basevalidators class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="marker", parent_name="scattermapbox", **kwargs): super(MarkerValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
mit
tungvx/deploy
.google_appengine/lib/django_0_96/django/templatetags/i18n.py
33
8474
from django.template import Node, resolve_variable from django.template import TemplateSyntaxError, TokenParser, Library from django.template import TOKEN_TEXT, TOKEN_VAR from django.utils import translation register = Library() class GetAvailableLanguagesNode(Node): def __init__(self, variable): self.var...
apache-2.0
awalls-cx18/gnuradio
grc/converter/block_tree.py
7
1854
# Copyright 2016 Free Software Foundation, Inc. # This file is part of GNU Radio # # GNU Radio Companion 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) a...
gpl-3.0
zero-rp/miniblink49
third_party/WebKit/Tools/Scripts/webkitpy/tool/grammar.py
217
2313
# Copyright (c) 2009 Google Inc. All rights reserved. # Copyright (c) 2009 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above...
apache-2.0
phasis/phasis
phasis/finc/lstart.py
1
2305
# -*- coding: iso-8859-1 -*- # # Copyright (C) 2001 - 2020 Massimo Gerardi all rights reserved. # # Author: Massimo Gerardi massimo.gerardi@gmail.com # # Copyright (c) 2020 Qsistemi.com. All rights reserved. # # Viale Giorgio Ribotta, 11 (Roma) # 00144 Roma (RM) - Italy # Phone: (+39) 06.87.163 # # # Si veda ...
gpl-2.0
Komodo/dbexplorer_pgsql
platform/WINNT_x86-msvc/pylib27/psycopg2/tz.py
5
3610
"""tzinfo implementations for psycopg2 This module holds two different tzinfo implementations that can be used as the 'tzinfo' argument to datetime constructors, directly passed to psycopg functions or used to set the .tzinfo_factory attribute in cursors. """ # psycopg/tz.py - tzinfo implementation # # Copyright (C) ...
mpl-2.0
Microsoft/PTVS
Python/Product/Miniconda/Miniconda3-x64/Lib/timeit.py
22
13444
#! /usr/bin/env python3 """Tool for measuring execution time of small code snippets. This module avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the Python Cookbook, published by O'Reilly. Library usage: see the Timer class. Command line...
apache-2.0
fujunwei/crosswalk
build/android/generate_app_packaging_tool.py
6
3863
#!/usr/bin/env python # Copyright (c) 2013 Intel Corporation. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # pylint: disable=F0401 import os import shutil import sys from common_function import RemoveUnusedFilesInReleaseMode def Clean(dir_...
bsd-3-clause
jaimeMF/youtube-dl
youtube_dl/extractor/worldstarhiphop.py
114
2323
from __future__ import unicode_literals import re from .common import InfoExtractor class WorldStarHipHopIE(InfoExtractor): _VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/(?:videos|android)/video\.php\?v=(?P<id>.*)' _TESTS = [{ "url": "http://www.worldstarhiphop.com/videos/video.p...
unlicense
jkstrick/samba
buildtools/wafsamba/gccdeps.py
33
3350
# encoding: utf-8 # Thomas Nagy, 2008-2010 (ita) """ Execute the tasks with gcc -MD, read the dependencies from the .d file and prepare the dependency calculation for the next run """ import os, re, threading import Task, Logs, Utils, preproc from TaskGen import before, after, feature lock = threading.Lock() prepro...
gpl-3.0
ResolveWang/WeiboSpider
page_parse/user/enterprise.py
1
1538
import re import json from bs4 import BeautifulSoup from page_parse.user import public from decorators import parse_decorator # 以下是通过认证企业主页进行解析 @parse_decorator(0) def get_friends(html): cont = public.get_left(html) soup = BeautifulSoup(cont, 'html.parser') return int(soup.find_all('strong')[0].get_text...
mit
reviewboard/reviewboard
reviewboard/accounts/trophies.py
2
9002
from __future__ import unicode_literals import re import warnings from django.utils import six from django.utils.translation import ugettext_lazy as _ from djblets.registries.registry import (ALREADY_REGISTERED, AlreadyRegisteredError, ...
mit
aljim/deploymentmanager-samples
examples/v2/nodejs/python/nodejs.py
1
2221
# Copyright 2016 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
jmwright/cadquery-x
gui/libs/pygments/styles/vim.py
135
1976
# -*- coding: utf-8 -*- """ pygments.styles.vim ~~~~~~~~~~~~~~~~~~~ A highlighting style for Pygments, inspired by vim. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.style import Style from pygments.token import Keywor...
lgpl-3.0
jphacks/KB_02
source/labeling.py
1
1757
#coding:utf-8 import numpy import re import os import sys file_path = "../dataset/nuc/" LABELED_DATA_NUM = 1000 if os.path.exists("../dataset/sentiment/unlabeled_text.txt"): print "上書きしちゃうので終了" sys.exit() # sentenceの辞書を作る sentences = [] sentence_num = 0 for doc_index in xrange(1, 101): text_file = open(...
mit
LennonChin/Django-Practices
MxOnline/extra_apps/xadmin/plugins/language.py
1
1028
from django.conf import settings from django.template import loader from django.views.i18n import set_language from xadmin.plugins.utils import get_context_dict from xadmin.sites import site from xadmin.views import BaseAdminPlugin, CommAdminView, BaseAdminView class SetLangNavPlugin(BaseAdminPlugin): ...
apache-2.0
skycucumber/Messaging-Gateway
webapp/venv/lib/python2.7/site-packages/sqlalchemy/orm/sync.py
33
4736
# orm/sync.py # Copyright (C) 2005-2014 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 """private module containing functions used for copying data between instances based on ...
gpl-2.0
clips/pattern
pattern/helpers.py
1
1443
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from builtins import str, bytes, dict, int from builtins import map, zip, filter from builtins import object, range #--- STRING FUNCTIONS ----------------------------------------------------------------------...
bsd-3-clause
abramhindle/UnnaturalCodeFork
python/testdata/launchpad/lib/lp/registry/mail/notification.py
1
16457
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Event handlers that send email notifications.""" __metaclass__ = type from email.Header import Header from email.MIMEText import MIMEText from email.Utils import ( fo...
agpl-3.0
petrutlucian94/nova_dev
nova/api/ec2/faults.py
13
2955
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
apache-2.0
endlessm/chromium-browser
third_party/llvm/lldb/test/API/lang/cpp/wchar_t/TestCxxWCharT.py
3
1872
# coding=utf8 """ Test that C++ supports wchar_t correctly. """ import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil class CxxWCharTTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) def test(self): """Test that C++ supports wchar_t correctly.""" ...
bsd-3-clause
sysbot/CouchPotatoServer
couchpotato/core/providers/torrent/publichd/__init__.py
5
1490
from .main import PublicHD def start(): return PublicHD() config = [{ 'name': 'publichd', 'groups': [ { 'tab': 'searcher', 'list': 'torrent_providers', 'name': 'PublicHD', 'description': 'Public Torrent site with only HD content. See <a href="https:...
gpl-3.0
litui/openparliament
parliament/core/models.py
1
29234
# coding: utf-8 import datetime import re import urllib2 from django.conf import settings from django.core.cache import cache from django.core.files.base import ContentFile from django.core import urlresolvers from django.db import models from django.template.defaultfilters import slugify from django.utils.safestring...
agpl-3.0
nens/threedi-qgis-plugin
utils/qprojects.py
1
11950
# (c) Nelen & Schuurmans, see LICENSE.rst. from io import IOBase from qgis.core import QgsProject import logging import os logger = logging.getLogger() class ProjectStateMixin(object): """class mixin for writing and loading states of tools to the Qgis Project files (``*.qgs``). Expects a class with: ...
gpl-3.0
HesselTjeerdsma/Cyber-Physical-Pacman-Game
Algor/flask/lib/python2.7/site-packages/botocore/vendored/requests/packages/chardet/codingstatemachine.py
2931
2318
######################## 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...
apache-2.0
arjclark/cylc
lib/cherrypy/tutorial/tut06_default_method.py
7
2263
""" Tutorial - The default method Request handler objects can implement a method called "default" that is called when no other suitable method/object could be found. Essentially, if CherryPy2 can't find a matching request handler object for the given request URI, it will use the default method of the object located de...
gpl-3.0
40223148/2015cda_g5
static/Brython3.1.0-20150301-090019/Lib/stat.py
765
4304
"""Constants/functions for interpreting results of os.stat() and os.lstat(). Suggested usage: from stat import * """ # Indices for stat struct members in the tuple returned by os.stat() ST_MODE = 0 ST_INO = 1 ST_DEV = 2 ST_NLINK = 3 ST_UID = 4 ST_GID = 5 ST_SIZE = 6 ST_ATIME = 7 ST_MTIME = 8 ST_CTIME = 9 ...
gpl-3.0
orezpraw/unnaturalcode
unnaturalcode/check_pypy_syntax.py
2
2577
#!/usr/bin/python # Copyright 2017 Dhvani Patel # # This file is part of UnnaturalCode. # # UnnaturalCode is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
agpl-3.0
mihailignatenko/erp
openerp/addons/base/ir/ir_config_parameter.py
311
4463
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
agpl-3.0
zenefits/sentry
src/sentry/south_migrations/0165_auto__del_unique_file_name_checksum.py
34
36672
# -*- 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): # Removing unique constraint on 'File', fields ['name', 'checksum'] db.de...
bsd-3-clause
laperry1/android_external_chromium_org
tools/clang/scripts/update.py
25
9363
#!/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. """Windows can't run .sh files, so this is a Python implementation of update.sh. This script should replace update.sh on all platfo...
bsd-3-clause
houzhenggang/hiwifi-openwrt-HC5661-HC5761
staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/modulefinder.py
215
24283
"""Find modules used by a script, using introspection.""" # This module should be kept compatible with Python 2.2, see PEP 291. from __future__ import generators import dis import imp import marshal import os import sys import types import struct if hasattr(sys.__stdout__, "newlines"): READ_MODE = "U" # universa...
gpl-2.0
hynnet/openwrt-mt7620
staging_dir/host/lib/python2.7/ctypes/test/test_array_in_pointer.py
117
1729
import unittest from ctypes import * from binascii import hexlify import re def dump(obj): # helper function to dump memory contents in hex, with a hyphen # between the bytes. h = hexlify(memoryview(obj)) return re.sub(r"(..)", r"\1-", h)[:-1] class Value(Structure): _fields_ = [("val", c_byte)] ...
gpl-2.0
codewarrior0/pytest
testing/test_doctest.py
1
14079
import sys from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile import py import pytest class TestDoctests: def test_collect_testtextfile(self, testdir): w = testdir.maketxtfile(whatever="") checkfile = testdir.maketxtfile(test_something=""" alskdjalsdk >...
mit
stuntman723/rap-analyzer
rap_analyzer/lib/python2.7/site-packages/gunicorn/util.py
25
15431
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from __future__ import print_function import email.utils import fcntl import io import os import pkg_resources import random import resource import socket import sys import textwrap import ti...
mit
architecture-building-systems/CityEnergyAnalyst
cea/technologies/network_layout/minimum_spanning_tree.py
2
4015
""" This script calculates the minimum spanning tree of a shapefile network """ import networkx as nx import cea.inputlocator from geopandas import GeoDataFrame as gdf import cea.config import os __author__ = "Jimeno A. Fonseca" __copyright__ = "Copyright 2017, Architecture and Building Systems - ETH Zurich" __cr...
mit
Kelina/TensorEmbeddings
9_seg/Concatenator_9Seg.py
1
3710
# PYTHON 3 # The concatenator for the segment embeddings with ALWAYS 3 segments, but concatenating always 9 segments. # The segment embeddings have been created using the TIGER corpus and RESCAL. import sys import pickle as cPickle import datetime import random def createEmbeddings(embeddingFile, useRandomSegVect...
apache-2.0
weixuanfu2016/tpot
tpot/config/regressor_mdr.py
4
1737
# -*- coding: utf-8 -*- """This file is part of the TPOT library. TPOT was primarily developed at the University of Pennsylvania by: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - and many more generous open source contributors TPOT is f...
lgpl-3.0
ERA-URBAN/wrfpy
wrfpy/cylc/upp.py
2
1258
#!/usr/bin/env python import argparse import datetime import time from wrfpy import utils from wrfpy.upp import upp from wrfpy.config import config import os class run_upp(config): '''' ''' def __init__(self, datestring): config.__init__(self) dt = utils.convert_cylc_time(datestring) postprocess = u...
apache-2.0
nanolearningllc/edx-platform-cypress
lms/djangoapps/verify_student/migrations/0011_add_verification_deadline.py
61
12462
# -*- 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 model 'HistoricalVerificationDeadline' db.create_table('verify_s...
agpl-3.0
aarchiba/numpy
numpy/lib/_datasource.py
148
21266
"""A file interface for handling local and remote data files. The goal of datasource is to abstract some of the file system operations when dealing with data files so the researcher doesn't have to know all the low-level details. Through datasource, a researcher can obtain and use a file with one function call, regar...
bsd-3-clause
certik/pyjamas
examples/gwtcanvas/GWTCanvasDemo.py
5
3176
""" * Copyright 2008 Google Inc. * Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> * * 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....
apache-2.0
feer56/Kitsune1
kitsune/tags/models.py
4
1181
from django.db import models from taggit.managers import TaggableManager from kitsune.tags.forms import TagField class BigVocabTaggableManager(TaggableManager): """TaggableManager for choosing among a predetermined set of tags Taggit's seems hard-coupled to taggit's own plain-text-input widget. """ ...
bsd-3-clause
mikkylok/mikky.lu
venv/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/oursql.py
33
8125
# mysql/oursql.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 """ .. dialect:: mysql+oursql :name: OurSQL :dbapi: oursql :connectstri...
mit
40223114/w16
static/Brython3.1.1-20150328-091302/Lib/copyreg.py
749
6611
"""Helper to provide extensibility for pickle. This is only useful to add pickle support for extension types defined in C, not for instances of user-defined classes. """ __all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_extension_cache"] dispatch_table = {} def pickle(ob_typ...
agpl-3.0
ryancanhelpyou/servo
tests/wpt/css-tests/tools/pywebsocket/src/test/test_handshake.py
452
7134
#!/usr/bin/env python # # Copyright 2012, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
mpl-2.0
kernc/scikit-learn
sklearn/preprocessing/__init__.py
268
1319
""" The :mod:`sklearn.preprocessing` module includes scaling, centering, normalization, binarization and imputation methods. """ from ._function_transformer import FunctionTransformer from .data import Binarizer from .data import KernelCenterer from .data import MinMaxScaler from .data import MaxAbsScaler from .data ...
bsd-3-clause
pfnet/chainercv
chainercv/datasets/cityscapes/cityscapes_semantic_segmentation_dataset.py
2
4520
import glob import os import numpy as np from chainer.dataset import download from chainercv.chainer_experimental.datasets.sliceable import GetterDataset from chainercv.datasets.cityscapes.cityscapes_utils import cityscapes_labels from chainercv.utils import read_image from chainercv.utils import read_label class ...
mit
ChristosChristofidis/bokeh
bokeh/charts/utils.py
42
7607
""" This is the utils module that collects convenience functions and code that are useful for charts ecosystem. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # Th...
bsd-3-clause
Emergya/icm-openedx-educamadrid-platform-basic
common/lib/xmodule/xmodule/word_cloud_module.py
42
8097
"""Word cloud is ungraded xblock used by students to generate and view word cloud. On the client side we show: If student does not yet answered - `num_inputs` numbers of text inputs. If student have answered - words he entered and cloud. """ import json import logging from pkg_resources import resource_string from x...
agpl-3.0
Yannig/ansible
test/units/modules/network/nxos/test_nxos_vpc_interface.py
47
2685
# (c) 2016 Red Hat 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. # # Ansible is dis...
gpl-3.0
TathagataChakraborti/resource-conflicts
PLANROB-2015/seq-sat-lama/Python-2.5.2/Mac/Modules/file/filescan.py
5
6950
# Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "Files" SHORT = "file" def main(): input = ["Files.h", "Aliases.h", "Finder.h"] output = SHORT + "gen....
mit
MikeCurrington/LedPinky
SequenceLightSingle.py
1
1028
import time from SequenceBase import SequenceBase class SequenceLightSingle( SequenceBase ): def __init__(self, pins): super(SequenceLightSingle, self).__init__(pins) print("pins %d" % len(pins)) self.seq = 0 self.lastSeq = 0 self.pinsChanged = [] self.delay = 0.05 def Restart(self): ...
mit
guettli/django
tests/delete/models.py
43
3819
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class R(models.Model): is_default = models.BooleanField(default=False) def __str__(self): return "%s" % self.pk def get_default_r(): r...
bsd-3-clause
south-coast-science/scs_dev
src/scs_dev/cmd/cmd_mqtt_client.py
1
5245
""" Created on 23 Mar 2017 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import optparse from scs_core.data.str import Str # -------------------------------------------------------------------------------------------------------------------- class CmdMQTTClient(object): """unix command line h...
mit
pyjs/pyjs
examples/misc/simplewiki/__main__.py
8
1049
#!/usr/bin/env python # -*- coding: utf-8 -*- TARGETS = [ 'Wiki.py', ] PACKAGE = { 'title': 'simplewiki', 'desc': 'Simple Wiki example', } def setup(targets): '''Setup example for translation, MUST call util.setup(targets).''' util.setup(targets) def translate(): '''Translate example, MU...
apache-2.0
eayunstack/nova
nova/tests/api/openstack/compute/plugins/v3/test_migrations.py
16
3967
# 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 agreed to in...
apache-2.0
jmptrader/statsite
sinks/graphite.py
9
3224
""" Supports flushing metrics to graphite """ import sys import socket import logging class GraphiteStore(object): def __init__(self, host="localhost", port=2003, prefix="statsite.", attempts=3): """ Implements an interface that allows metrics to be persisted to Graphite. Raises a :class:`...
bsd-3-clause
gromoleg/pharmacy
libs/data/db.py
1
1951
# -*- coding: utf-8 -*- import logging import os from pysqlcipher import dbapi2 as sqlite logging.basicConfig(level=logging.INFO) class DbWorker: def __init__(self, tasks, results): logging.info(u'create DbWorker object') self.tasks, self.results = tasks, results self.db_name = u'data.sql...
mit
uglyboxer/linear_neuron
net-p3/lib/python3.5/site-packages/pip/_vendor/colorama/ansitowin32.py
442
9262
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. import re import sys import os from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style from .winterm import WinTerm, WinColor, WinStyle from .win32 import windll winterm = None if windll is not None: winterm = WinTerm() def is_a_tty(stre...
mit
loandy/billy
billy/bin/commands/__init__.py
2
1277
""" defines a command extension system that is used by billy-util new commands can be added by deriving from BaseCommand and overriding a few attributes: name: name of subcommand help: help string displayed for subcommand add_args(): method that calls `self.add_argument` han...
bsd-3-clause
emk/pyjamas
examples/mail/MailList.py
4
5858
from pyjamas.ui.Composite import Composite from pyjamas.ui.FlexTable import FlexTable from pyjamas.ui.HTML import HTML from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.Widget import Widget from pyjamas.ui.Label import Label from pyjamas.ui import HasAlignment from MailItems import MailItems from L...
apache-2.0
Pexego/odoo
addons/mrp/product.py
12
3110
# -*- 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
pap/nupic
tests/unit/nupic/algorithms/cells4_test.py
35
7120
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
agpl-3.0
DeadBugEngineering/myHDL_shenanigans
ssd1306_8x64bit_driver/myhdl_10dev/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py
713
5879
from __future__ import absolute_import from collections import namedtuple from ..exceptions import LocationParseError url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment'] class Url(namedtuple('Url', url_attrs)): """ Datastructure for representing an HTTP URL. Used as a return value f...
lgpl-2.1
xutian/virt-test
virttest/utils_cgroup_unittest.py
15
6027
#!/usr/bin/env python import os import unittest import tempfile import common from staging import utils_cgroup from autotest.client.shared import error # Mount file content, Controllers and mount points from RHEL-6 mount_1 = """rootfs / rootfs rw 0 0 proc /proc proc rw,relatime 0 0 sysfs /sys sysfs rw,seclabel,relati...
gpl-2.0
habnabit/pip
pip/_vendor/requests/packages/chardet/constants.py
3008
1335
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
mit
danakj/chromium
tools/metrics/histograms/PRESUBMIT.py
43
1430
# 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. """ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details on the presubmit API built into depot_tools. """ def Check...
bsd-3-clause
goldenlimit/developer-support
python/arcpy-python/find-and-replace-data-sources-in-mxd/find_and_replace_data_sources.py
9
1653
#------------------------------------------------------------------------------- # Name: Find and Replace Data Sources in MXD # Purpose: Takes an input workspace to recursively walk through a directory # and replace a specified path. A common use case is when the name # of a server ...
apache-2.0
batermj/algorithm-challenger
code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_future.py
1
3829
# Test various flavors of legal and illegal future statements import unittest from test import support import os import re rx = re.compile('\((\S+).py, line (\d+)') def get_error_location(msg): mo = rx.search(str(msg)) return mo.group(1, 2) class FutureTest(unittest.TestCase): def check_syntax_error(se...
apache-2.0
dcroc16/skunk_works
google_appengine/lib/django-1.3/tests/modeltests/update/tests.py
89
4252
from django.test import TestCase from models import A, B, C, D, DataPoint, RelatedPoint class SimpleTest(TestCase): def setUp(self): self.a1 = A.objects.create() self.a2 = A.objects.create() for x in range(20): B.objects.create(a=self.a1) D.objects.create(a=self.a1...
mit
indictranstech/focal-erpnext
erpnext/hooks.py
4
2987
app_name = "erpnext" app_title = "ERPNext" app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors" app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations" app_icon = "icon-th" app_color = "#e74c3c" app_version = "4.11.1" error_report_email = "support@erpnext.com" ...
agpl-3.0
Cue/greplin-twisted-utils
src/greplin/database/pool.py
1
2284
# Copyright 2011 The greplin-twisted-utils Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
apache-2.0
CatsAndDogsbvba/odoo
addons/hw_posbox_homepage/__init__.py
1894
1075
# -*- 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
FabienPean/sofa
examples/Components/mapping/ProjectionToLineMapping.py
11
1123
import Sofa def createScene(node): node.gravity="0 0 0" node.createObject('VisualStyle', displayFlags="showBehaviorModels showMechanicalMappings" ) node.createObject('EulerImplicit',vdamping=1) node.createObject('CGLinearSolver', iterations="25", tolerance="1e-5", threshold="1e-5") linenode = n...
lgpl-2.1
mastizada/kuma
vendor/packages/translate-toolkit/translate/lang/kn.py
6
1096
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008 Zuza Software Foundation # # This file is part of translate. # # translate 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...
mpl-2.0
akretion/sale-workflow
sale_cancel_reason/wizard/cancel_reason.py
2
1819
# -*- coding: utf-8 -*- # # # Author: Guewen Baconnier # Copyright 2013 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License...
agpl-3.0
azverkan/scons
test/scons-time/no-args.py
5
1566
#!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, ...
mit
kmacinnis/sympy
sympy/series/tests/test_gruntz.py
1
14688
from sympy import Symbol, exp, log, oo, Rational, I, sin, gamma, loggamma, S, \ atan, acot, pi, cancel, E, erf, sqrt, zeta, cos, digamma, Integer from sympy.series.gruntz import compare, mrv, rewrite, mrv_leadterm, gruntz, \ sign from sympy.utilities.pytest import XFAIL, skip """ This test suite is testing the...
bsd-3-clause
emc-openstack/storops
storops/vnx/parsers.py
1
6281
# coding=utf-8 # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # #...
apache-2.0
litchfield/django
django/contrib/auth/models.py
263
14879
from __future__ import unicode_literals from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.signals import user_logged_in from django.contrib.contenttypes.models import ContentType from django.core import validators from django.core.excep...
bsd-3-clause
JamesPHoughton/pysd
pysd/py_backend/vensim/vensim2py.py
1
62758
""" These functions translate vensim .mdl file to pieces needed by the builder module to write a python version of the model. Everything that requires knowledge of vensim syntax should be here. """ import os import re import warnings from io import open import numpy as np import parsimonious from parsimonious.excepti...
mit
samuel1208/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py
227
5170
""" ================================================= Hyper-parameters of Approximate Nearest Neighbors ================================================= This example demonstrates the behaviour of the accuracy of the nearest neighbor queries of Locality Sensitive Hashing Forest as the number of candidates and the numb...
bsd-3-clause
LCrinesnow/WeChatWall
wechatwall/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py
1788
1435
#!/usr/bin/env python import re import json # https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae # http://stackoverflow.com/a/13436167/96656 def unisymbol(codePoint): if codePoint >= 0x0000 and codePoint <= 0xFFFF: return unichr(codePoint) elif codePoint >= 0x010000 and codePoint <= 0x10FFFF: ...
apache-2.0
JaneliaSciComp/osgpyplusplus
examples/rough_translated1/osgvirtualprogram.py
1
45343
#!/bin/env python # Automatically translated python version of # OpenSceneGraph example program "osgvirtualprogram" # !!! This program will need manual tuning before it will work. !!! import sys from osgpypp import osg from osgpypp import osgDB from osgpypp import osgText from osgpypp import osgViewer # Translate...
bsd-3-clause
mltsp/mltsp
cesium/features/common_functions.py
5
1974
import numpy as np from scipy import stats def max_slope(t, x): """Compute the largest rate of change in the observed data.""" slopes = np.diff(x) / np.diff(t) return np.max(np.abs(slopes)) def maximum(x): """Maximum observed value.""" return np.max(x) def median(x): """Median of observed ...
bsd-3-clause