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
LCOGT/valhalla
valhalla/sciapplications/forms.py
1
5386
from django import forms from django.forms import ModelForm from django.forms.models import inlineformset_factory from django.utils.translation import ugettext as _ from django.conf import settings from PyPDF2 import PdfFileReader import os from valhalla.sciapplications.models import ScienceApplication, Call, TimeRequ...
gpl-3.0
pgdr/ert
python/python/ert_gui/ertplot.py
1
2095
import sys import os from PyQt4.QtGui import QApplication import time from res.enkf import EnKFMain, ResConfig from ecl.util import Version from ert_gui.ert_splash import ErtSplash from ert_gui.ertwidgets import resourceIcon from ert_gui.tools.plot.plot_window import PlotWindow import ert_gui.ertwidgets if os.geten...
gpl-3.0
pongem/python-bot-project
appengine/standard/botapp/lib/django/db/backends/postgresql/schema.py
33
6005
import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s" sql_create_sequence = "CREATE SEQUENCE %(sequence)s" sql_delete_sequence =...
apache-2.0
TomHeatwole/osf.io
website/addons/wiki/model.py
3
9911
# -*- coding: utf-8 -*- import datetime import functools import logging import urllib from bleach import linkify from bleach.callbacks import nofollow from website.models import NodeLog import markdown from markdown.extensions import codehilite, fenced_code, wikilinks from modularodm import fields from framework.fo...
apache-2.0
tazo90/pulsar
pulsar/async/actor.py
5
14308
import sys import os import pickle from itertools import chain from threading import current_thread from pulsar import HaltServer, CommandError, MonitorStarted, system from pulsar.utils.log import WritelnDecorator from .events import EventHandler from .proxy import ActorProxy, ActorProxyMonitor, actor_identity from ....
bsd-3-clause
jeasoft/odoo
addons/account_asset/report/__init__.py
445
1074
# -*- 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
tsdmgz/ansible
lib/ansible/plugins/action/nxos_config.py
59
4197
# # Copyright 2015 Peter Sprygada <psprygada@ansible.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any...
gpl-3.0
bearing/dosenet-raspberrypi
managers.py
2
46131
from __future__ import print_function import time import argparse import traceback import signal import sys import csv import os import subprocess import socket try: import kromek except: print("Not set up to run a D3S, continuing anyway") import numpy as np import datetime from Crypto.Cipher import AES from c...
mit
oscarlorentzon/OpenSfM
opensfm/commands/export_ply.py
2
1071
from opensfm.actions import export_ply from . import command class Command(command.CommandBase): name = "export_ply" help = "Export reconstruction to PLY format" def run_impl(self, dataset, args): export_ply.run_dataset(dataset, args.no_cameras, args.no_points, args.depthmaps, args.point_num_vie...
bsd-2-clause
dr-nate/msmbuilder
msmbuilder/tests/test_vmhmm.py
3
4066
from __future__ import print_function, division import random from itertools import permutations import numpy as np from scipy.stats.distributions import vonmises from msmbuilder.example_datasets import AlanineDipeptide from msmbuilder.featurizer import DihedralFeaturizer from msmbuilder.hmm import VonMisesHMM def...
lgpl-2.1
janewangfb/spark
dev/sparktestsupport/toposort.py
66
3087
####################################################################### # Implements a topological sort algorithm. # # Copyright 2014 True Blade 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...
apache-2.0
partofthething/home-assistant
homeassistant/components/firmata/config_flow.py
13
2163
"""Config flow to configure firmata component.""" import logging from pymata_express.pymata_express_serial import serial from homeassistant import config_entries from homeassistant.const import CONF_NAME from .board import get_board from .const import CONF_SERIAL_PORT, DOMAIN # pylint: disable=unused-import _LOGG...
mit
arborh/tensorflow
tensorflow/lite/testing/op_tests/splitv.py
4
2091
# Copyright 2019 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
nilbody/h2o-3
py2/testdir_rapids/test_rapids_builtin.py
21
7544
import unittest, random, sys, time sys.path.extend(['.','..','../..','py']) import h2o2 as h2o import h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i initList = [ '(#(1))', # why isn't this illegal? '(#1)', '((#1))', '(((#1)))', '(= !x #1)', '((= !x #1))', ...
apache-2.0
JohnKossa/pyNES
pynes/tests/image_test.py
28
7012
# -*- coding: utf-8 -*- import os from PIL import Image from pynes import image, sprite from pynes.tests import SpriteTestCase class ImageTest(SpriteTestCase): def __init__(self, testname): SpriteTestCase.__init__(self, testname) def setUp(self): self.mario1 = [ [0, 0, 0, 0, 0, ...
bsd-3-clause
odoousers2014/addons-yelizariev
web_polymorphic_field/__openerp__.py
14
1531
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Augustin Cisterne-Kaas (ACK Consulting Limited) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as p...
lgpl-3.0
georgemarshall/django
tests/ordering/models.py
13
1746
""" Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order ``QuerySet`` results. If a field name in ``ordering`` starts with a hyphen, that field will be ordered in descending order. Otherwise, it'll be ...
bsd-3-clause
jorik041/pycparser
tests/test_c_parser.py
18
62280
#!/usr/bin/env python import pprint import re import os, sys import unittest sys.path[0:0] = ['.', '..'] from pycparser import c_parser from pycparser.c_ast import * from pycparser.c_parser import CParser, Coord, ParseError _c_parser = c_parser.CParser( lex_optimize=False, yacc_debug...
bsd-3-clause
valentin-krasontovitsch/ansible
lib/ansible/modules/commands/psexec.py
27
18871
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2018, Jordan Borean <jborean93@gmail.com> # 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_v...
gpl-3.0
dimid/ansible-modules-extras
cloud/amazon/ec2_vpc_subnet_facts.py
15
4257
#!/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
keithhamilton/transposer
test.py
1
2379
import os.path import unittest import transposer class TestTransposer(unittest.TestCase): def test_column_to_row_with_write(self): test_in_file = '/tmp/in.csv' test_out_file = '/tmp/rows.csv' test_in_data = [ ['FirstName', 'LastName', 'Age'], ['Frank', '...
mit
sridevikoushik31/nova
nova/api/openstack/compute/contrib/scheduled_images.py
1
17045
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Rackspace Hosting # 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.o...
apache-2.0
pnomolos/greatbigcrane
greatbigcrane/project/models.py
1
4801
""" Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm 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 agre...
apache-2.0
sda2b/youtube-dl
youtube_dl/extractor/tv2.py
113
4640
# encoding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( determine_ext, int_or_none, float_or_none, parse_iso8601, remove_end, ) class TV2IE(InfoExtractor): _VALID_URL = 'http://(?:www\.)?tv2\.no/v/(?P<id>\d+)' _TEST = { ...
unlicense
neumerance/cloudloon2
openstack_dashboard/dashboards/project/billing/tables.py
2
2103
from django.utils.translation import ugettext_lazy as _ # noqa from django.template.defaultfilters import timesince from horizon import exceptions from horizon import tables class UsageBillingTable(tables.DataTable): instance_name = tables.Column('instance_name', verbose_name=_('Instance Name')) flavor_ram = table...
apache-2.0
cesarmarinhorj/cubes
cubes/server/store.py
7
5873
# -*- coding=utf -*- from ..model import * from ..browser import * from ..stores import Store from ..providers import ModelProvider from ..errors import * from ..logging import get_logger import json from .. import compat DEFAULT_SLICER_URL = "http://localhost:5000" class _default_opener: def __init__(self): ...
mit
AgostonSzepessy/servo
tests/wpt/web-platform-tests/tools/pytest/testing/test_cache.py
177
12265
import sys import _pytest import pytest import os import shutil pytest_plugins = "pytester", class TestNewAPI: def test_config_cache_makedir(self, testdir): testdir.makeini("[pytest]") config = testdir.parseconfigure() with pytest.raises(ValueError): config.cache.makedir("key/...
mpl-2.0
adaussy/eclipse-monkey-revival
plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_socket_ssl.py
2
2030
# Test just the SSL support in the socket module, in a moderately bogus way. from test import test_support import socket import time # Optionally test SSL support. This requires the 'network' resource as given # on the regrtest command line. skip_expected = not (test_support.is_resource_enabled('network') and ...
epl-1.0
undoware/neutron-drive
google_appengine/lib/django_1_2/django/conf/locale/nl/formats.py
80
2778
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # DATE_FORMAT = 'j F Y' # '20 januari 2009' TIME_FORMAT = 'H:i' # '15:23' DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23' YEAR_MONTH_FORMAT = 'F Y' # ...
bsd-3-clause
Studijacob/MIALab
mialab/filtering/__init__.py
2
1152
""" =========================================================== Image filtering and manipulation (:mod:`filtering` package) =========================================================== This package contains various image filters and image manipulation functions. Filter pipeline (:mod:`filtering.filter`) --------------...
apache-2.0
SimonEast/django-login-for-phpbb
django/sessionprofile/tests.py
23
2891
# Copyright (c) 2008 Resolver Systems Ltd # # 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,...
mit
MaxVanDeursen/tribler
Tribler/Test/Core/Upgrade/test_torrent_upgrade_63_64.py
1
6052
import os import shutil from apsw import Connection from nose.tools import raises from twisted.internet.defer import inlineCallbacks from Tribler.Core.Upgrade.torrent_upgrade64 import TorrentMigrator64 from Tribler.Test.Core.base_test import TriblerCoreTest from Tribler.Test.common import TORRENT_UBUNTU_FILE from Tri...
lgpl-3.0
eayunstack/horizon
openstack_dashboard/dashboards/project/volumes/snapshots/tables.py
53
5566
# Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
apache-2.0
ProfessionalIT/maxigenios-website
sdk/google_appengine/lib/django-1.4/django/core/files/images.py
178
1982
""" Utility functions for handling images. Requires PIL, as you might imagine. """ from django.core.files import File class ImageFile(File): """ A mixin for use alongside django.core.files.base.File, which provides additional features for dealing with images. """ def _get_width(self): ret...
mit
matmutant/sl4a
python/src/Lib/ctypes/wintypes.py
265
5349
###################################################################### # This file should be kept compatible with Python 2.3, see PEP 291. # ###################################################################### # The most useful windows datatypes from ctypes import * BYTE = c_byte WORD = c_ushort DWORD = c_ulong W...
apache-2.0
morenopc/edx-platform
common/lib/xmodule/xmodule/video_module/video_module.py
2
19864
# -*- coding: utf-8 -*- # pylint: disable=W0223 """Video is ungraded Xmodule for support video content. It's new improved video module, which support additional feature: - Can play non-YouTube video sources via in-browser HTML5 video player. - YouTube defaults to HTML5 mode from the start. - Speed changes in both YouT...
agpl-3.0
anandology/pyjamas
pyjd/imputil.py
2
26729
""" Import utilities Exported classes: ImportManager Manage the import process Importer Base class for replacing standard import functions BuiltinImporter Emulate the import mechanism for builtin and frozen modules DynLoadSuffixImporter """ # note: avoid importing non-builtin modules import...
apache-2.0
ConnorGBrewster/servo
tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/cors/support/cors-tester.py
238
1454
from wptserve.handlers import HTTPException import urllib def main(request, response): if request.method != "GET": raise HTTPException(400, message="Method was not GET") if not "id" in request.GET: raise HTTPException(400, message="No id") id = request.GET['id'] if "read" in request....
mpl-2.0
jounex/hue
desktop/core/ext-py/boto-2.38.0/boto/vpc/vpc.py
135
7868
# Copyright (c) 2009-2010 Mitch Garnaat http://garnaat.org/ # # 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, modi...
apache-2.0
blaze33/django
tests/regressiontests/select_related_onetoone/tests.py
3
9722
from __future__ import absolute_import from django.test import TestCase from django.utils import unittest from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails, AdvancedUserStat, Image, Product, Parent1, Parent2, Child1, Child2, Child3, Child4) class ReverseSelectRelatedTestCase(Test...
bsd-3-clause
maxnet/linux-amlogic
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
alexbotello/Evil-Rick
app/commands/concert.py
1
3296
import asyncio import discord from discord.ext import commands import errors import settings from utils.formatter import block from models import ConcertDatabase from https import BandsInTownRequest class Concerts: """ Concert Command Cog """ def __init__(self, bot): self.bot = bot s...
gpl-3.0
danbeam/css-py
css/css.py
75
11560
# -*- coding: utf-8 -*- ''' Classes representing CSS syntactic concepts. ''' import re import itertools import serialize __all__ = ('Hexcolor', 'Function', 'Uri', 'String', 'Ident', 'Term', 'Declaration', 'Ruleset', 'Charset', 'Page', 'Media', 'Import', 'Stylesheet') class SyntaxObject(object):...
mit
xbmc/xbmc-antiquated
xbmc/lib/libPython/Python/Lib/test/test_multibytecodec_support.py
15
8445
#!/usr/bin/env python # # test_multibytecodec_support.py # Common Unittest Routines for CJK codecs # # $CJKCodecs: test_multibytecodec_support.py,v 1.6 2004/06/19 06:09:55 perky Exp $ import sys, codecs, os.path import unittest from test import test_support from StringIO import StringIO __cjkcodecs__ = 0 # define t...
gpl-2.0
kahinton/Dark-Energy-UI-and-MC
DE_Mod_UI.py
1
17819
from __future__ import division from Tkinter import * import numpy as np import pylab as py import os import sys from ui_pack import Sing, Show # Create the class of definitions for the applet class DE_Mod_Gen(Tk): def __init__(self, parent): """Initiate the instance of Tkinter""" Tk.__init__(self,...
mit
rangadi/beam
sdks/python/apache_beam/coders/coders_test_common.py
5
16932
# # 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
caiiiyua/monkful
tests/tests/basic_resource/post_invalid_value_type_str.py
2
1883
import unittest import json from pymongo import MongoClient from apps.basic_resource import server from apps.basic_resource.documents import Article class ResourcePostInvalidValueTypeStr(unittest.TestCase): """ Test if a HTTP POST request with an invalid value for a specific field results in the correct r...
lgpl-3.0
sumitsourabh/opencog
opencog/python/conceptnet/reader.py
9
1758
__author__ = 'Amen Belayneh' # This code is used to read the relations from a conceptnet dump, and # return a container containing a list of lists of the relations def ascii_lines(iterable): for line in iterable: if all(ord(ch) < 128 and ch not in "\\\"`" for ch in line): yield line def csv(...
agpl-3.0
liuliu/fast-rcnn
lib/fast_rcnn/train.py
42
4449
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Train a Fast R-CNN network.""" import caffe from fast_rcnn.config i...
mit
readevalprint/cartridge
cartridge/shop/checkout.py
1
6973
""" Checkout process utilities. """ from django.contrib.auth.models import SiteProfileNotAvailable from django.utils.translation import ugettext as _ from django.template.loader import get_template, TemplateDoesNotExist from mezzanine.conf import settings from mezzanine.utils.email import send_mail_template from car...
bsd-2-clause
tarzan0820/odoo
addons/report/models/report_paperformat.py
311
7814
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
SublimeGit/SublimeGit
sgit/help.py
1
5614
# coding: utf-8 import os import re import logging import webbrowser try: from xml.etree import cElementTree as ET except: from xml.etree import ElementTree as ET import sublime from sublime_plugin import WindowCommand from .util import get_setting from .cmd import GitCmd logger = logging.getLogger('Sublime...
mit
marcuskelly/recover
tests/conftest.py
5
1227
# This file contains pytest 'fixtures'. # If a test functions specifies the name of a fixture function as a parameter, # the fixture function is called and its result is passed to the test function. # # Copyright 2014 SolidBuilds.com. All rights reserved # # Authors: Ling Thio <ling.thio@gmail.com> import pytest from ...
bsd-2-clause
hazelnusse/sympy-old
doc/src/conf.py
3
5596
# -*- coding: utf-8 -*- # # SymPy documentation build configuration file, created by # sphinx-quickstart.py on Sat Mar 22 19:34:32 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickle...
bsd-3-clause
ekcs/congress-specs
tests/test_titles.py
2
4165
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
dataxu/ansible
lib/ansible/modules/network/cumulus/_cl_license.py
33
3624
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Cumulus Networks <ce-ceng@cumulusnetworks.com> # 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_versio...
gpl-3.0
Lynn-015/NJU_DMRG
giggleliu/tba/lattice/path.py
1
4317
''' Path in 2D space. ''' from numpy import * from numpy.linalg import norm from matplotlib.pyplot import * import warnings,pdb __all__=['KPath','path_k','opath_k'] class KPath(object): ''' A path in k space klist: a list of k vectors. label: the label for this path. ''' def _...
mit
mikehulluk/morphforge
src/morphforgecontrib/simulation/channels/common/neuron.py
1
4213
#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Copyright (c) 2012 Michael Hull. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
bsd-2-clause
daxxi13/CouchPotatoServer
libs/pyutil/test/current/test_mathutil.py
92
5567
#!/usr/bin/env python import unittest from pyutil import mathutil from pyutil.assertutil import _assert class MathUtilTestCase(unittest.TestCase): def _help_test_is_power_of_k(self, k): for i in range(2, 40): _assert(mathutil.is_power_of_k(k**i, k), k, i) def test_is_power_of_k(self): ...
gpl-3.0
glaubitz/fs-uae-debian
arcade/OpenGL/GL/VERSION/GL_3_0.py
9
6663
'''OpenGL extension VERSION.GL_3_0 This module customises the behaviour of the OpenGL.raw.GL.VERSION.GL_3_0 to provide a more Python-friendly API The official definition of this extension is available here: http://www.opengl.org/registry/specs/VERSION/GL_3_0.txt ''' from OpenGL import platform, constant, arrays fro...
gpl-2.0
fhaoquan/kbengine
kbe/src/lib/python/Lib/codecs.py
84
35956
""" codecs -- Python Codec Registry, API and helpers. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" import builtins, sys ### Registry and builtin stateless codec functions try: from _codecs import * except ImportError as why: raise SystemErro...
lgpl-3.0
AdamISZ/joinmarket-clientserver
jmbitcoin/jmbitcoin/secp256k1_transaction.py
1
13323
#!/usr/bin/python # note, only used for non-cryptographic randomness: import random import json # needed for single sha256 evaluation, which is used # in bitcoin (p2wsh) but not exposed in python-bitcointx: import hashlib from jmbitcoin.secp256k1_main import * from jmbase import bintohex, utxo_to_utxostr from bitcoin...
gpl-3.0
William93/store
tests/test_forms_customer.py
4
3174
# -*- coding: utf-8 -*- """Test forms.""" from store.customer.forms import RegisterForm, LoginFormCustomer class TestRegisterForm: """Register form.""" def test_validate_user_already_registered(self, customer): """Enter username that is already registered. Uniqueness check.""" form = Registe...
bsd-3-clause
Lorquas/subscription-manager
src/rct/manifest_commands.py
1
14302
from __future__ import print_function, division, absolute_import # # Copyright (c) 2010 - 2012 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY ...
gpl-2.0
Metaswitch/calico-neutron
neutron/tests/unit/bigswitch/test_restproxy_plugin.py
8
14161
# Copyright 2012 Big Switch Networks, 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 appl...
apache-2.0
40223119/2015cda
static/Brython3.1.0-20150301-090019/Lib/_strptime.py
518
21683
"""Strptime-related classes and functions. CLASSES: LocaleTime -- Discovers and stores locale-specific time information TimeRE -- Creates regexes for pattern matching a string of text containing time information FUNCTIONS: _getlang -- Figure out what language is being used for the locale ...
gpl-3.0
keisuke-umezawa/chainer
examples/sentiment/test_thin_stack.py
8
4647
import unittest import numpy import chainer from chainer import backend from chainer import cuda from chainer import testing from chainer.testing import attr import thin_stack class TestThinStackGet(unittest.TestCase): shape = (3, 4, 5) dtype = numpy.float32 def setUp(self): self.s = numpy.ra...
mit
armadill-odyssey/aima-python
submissions/Sery/mygames.py
18
6695
from collections import namedtuple from games import (Game) class GameState: def __init__(self, to_move, board, label=None): self.to_move = to_move self.board = board self.label = label def __str__(self): if self.label == None: return super(GameState, self).__str__...
mit
alhowaidi/cvmfsNDN
add-ons/s3rewrite.py
6
5567
#!/usr/bin/python import sys import re from math import floor from datetime import datetime ac=21 # Number of accounts bb=100 # Number of buckets bucket_body_name="lhcb" servername="olhw-s3.cern.ch" # Gets the account name based bucket number def get_b...
bsd-3-clause
google-research/google-research
data_selection/wmt/tokenizer.py
1
5498
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
apache-2.0
initNirvana/Easyphotos
env/lib/python3.4/site-packages/requests/packages/chardet/cp949prober.py
2801
1782
######################## 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...
mit
dichen001/Go4Jobs
JackChen/array/209. Minimum Size Subarray Sum.py
1
1218
# CORRECT for finding the minimal length, but NOT the minimal SUB-Arrary!!! class Solution(object): def minSubArrayLen1(self, s, nums): """ :type s: int :type nums: List[int] :rtype: int """ nums.sort(reverse=True) if nums == [] or sum(nums)<s: re...
gpl-3.0
acsone/purchase-workflow
purchase_request_to_rfq/tests/test_purchase_request_to_rfq.py
1
4139
# -*- coding: utf-8 -*- # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests import common from openerp.tools import SUPERUSER_ID class TestPurchaseRequestToRfq(common.TransactionCase): def setUp(self): super(TestPurcha...
agpl-3.0
mrkulk/text-world
evennia/server/portal/imc2lib/imc2_packets.py
10
27715
""" IMC2 packets. These are pretty well documented at: http://www.mudbytes.net/index.php?a=articles&s=imc2_protocol """ import shlex from django.conf import settings class Lexxer(shlex.shlex): """ A lexical parser for interpreting IMC2 packets. """ def __init__(self, packet_str, posix=True): s...
bsd-3-clause
davidharrigan/django
tests/select_related_regress/models.py
282
3677
from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class Building(models.Model): name = models.CharField(max_length=10) def __str__(self): return "Building: %s" % self.name @python_2_unicod...
bsd-3-clause
ravenbyron/phtevencoin
qa/rpc-tests/test_framework/bignum.py
1
2003
# # # bignum.py # # This file is copied from python-phtevencoinlib. # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # """Bignum routines""" from __future__ import absolute_import, division, print_function, unicode_literals ...
mit
joone/chromium-crosswalk
tools/telemetry/third_party/typ/typ/__init__.py
81
3167
# 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 by applicable law or ag...
bsd-3-clause
chengduoZH/Paddle
python/paddle/fluid/layers/io.py
2
32064
# Copyright (c) 2018 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 app...
apache-2.0
evansd/django
django/db/backends/postgresql/operations.py
16
10903
from psycopg2.extras import Inet from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): def unification_cast_sql(self, output_field): internal_type = output_field.get_internal_type() if internal_type...
bsd-3-clause
ev3rt-git/ev3rt-base
target/ev3_gcc/dmloader/app/convert_bin_to_c.py
6
5238
#!/usr/bin/env python2 # ertl-liyixiao 2013/11/11 import glob import re import sys fartext = ''' #if defined(__GNUC__) && (__MSP430X__ > 0) __attribute__((section (".fartext"))) #endif ''' data_indent = ' ' def read_little_endian_16(f): low = f.read(1) if low == "": return -1 high = f.read(1...
gpl-2.0
play113/swer
heekscad-read-only/src/vc_retro.py
19
1698
# Process the SLN: f_in = open('HeeksCAD.sln'); f_vc3 = open('HeeksCAD VC2003.sln', 'w'); f_vc5 = open('HeeksCAD VC2005.sln', 'w'); while (True): line = f_in.readline(); if (len(line) == 0) : break; if (line == 'Microsoft Visual Studio Solution File, Format Version 10.00\n'): f_vc3....
mit
zhuwenping/python-for-android
python3-alpha/extra_modules/gdata/dublincore/data.py
126
2106
#!/usr/bin/python # # Copyright (C) 2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
apache-2.0
wkschwartz/django
tests/gis_tests/gdal_tests/test_geom.py
11
24679
import json import pickle from django.contrib.gis.gdal import ( CoordTransform, GDALException, OGRGeometry, OGRGeomType, SpatialReference, ) from django.template import Context from django.template.engine import Engine from django.test import SimpleTestCase from ..test_data import TestDataMixin class OGRGeomTes...
bsd-3-clause
s0930342674/pyload
module/plugins/hoster/FastixRu.py
6
1341
# -*- coding: utf-8 -*- import re import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" __version__ = "0.14" __status__ = "testing" _...
gpl-3.0
edmundarvin1/CSI_twit
router.py
9
1119
from flask import g, session from helpers import functions, init from controllers import follow, timeline, tweet, user def set_router(app): # we're setting g.user as the user in the current session @app.before_request def before_request(): g.user = None if 'user_id' in session: ...
bsd-3-clause
vyrus/wubi
src/wubi/frontends/win32/installation_finish_page.py
8
2141
# Copyright (c) 2008 Agostino Russo # # Written by Agostino Russo <agostino.russo@gmail.com> # # This file is part of Wubi the Win32 Ubuntu Installer. # # Wubi is free software; you can redistribute it and/or modify # it under 5the terms of the GNU Lesser General Public License as # published by the Free Software Found...
gpl-2.0
solvo/organilab
src/laboratory/migrations/0034_group_perms.py
1
6746
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-02-28 14:49 from __future__ import unicode_literals from django.db import migrations from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import Group from django.con...
gpl-3.0
b-me/django
django/conf/locale/hr/formats.py
504
2106
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j. E Y.' TIME_FORMAT = 'H:i' DATE...
bsd-3-clause
dikshyam/icsisumm
icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/classifier/discretisedattribute.py
9
1763
# Natural Language Toolkit Discretized attribute # Capable of mapping continuous values to discrete ones # # Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com> # # URL: <http://nltk.sf.net> # This software is distributed under GPL, for license information see LICENSE.TXT from nltk_contrib.classifier import a...
gpl-3.0
webmasterraj/FogOrNot
flask/lib/python2.7/site-packages/pandas/tseries/tests/test_frequencies.py
2
14378
from datetime import datetime, time, timedelta from pandas.compat import range import sys import os import nose import numpy as np from pandas import Index, DatetimeIndex, Timestamp, Series, date_range, period_range import pandas.tseries.frequencies as frequencies from pandas.tseries.tools import to_datetime impor...
gpl-2.0
quietcoolwu/learn-python3
samples/test/dict_unittest.py
21
1269
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest class Dict(dict): def __init__(self, **kw): super(Dict, self).__init__(**kw) def __getattr__(self, key): try: return self[key] except KeyError: raise AttributeError(r"'Dict' object has no attribute...
gpl-2.0
drglove/SickRage
lib/chardet/sbcsgroupprober.py
2936
3291
######################## 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...
gpl-3.0
hanasoo/django-allauth
allauth/socialaccount/fields.py
69
2092
# Courtesy of django-social-auth import json from django.core.exceptions import ValidationError from django.db import models from django.utils import six try: from django.utils.encoding import smart_unicode as smart_text except ImportError: from django.utils.encoding import smart_text class JSONField(six.wi...
mit
andremirt/v_cond
gamess/libqc/rysq/src/kernel/quadrature2.py
1
689209
# quadrature expressions: Q[ShellQuartet] = ( {Symbol:Expressions}, # ((i, j, k, l), (Expression, [Symbols]))) {('d', 'd', 'p', 's'): ({'B00': '', 'B10': '', 'Cx': '', 'Cy': '', 'Cz': '', 'Dx': '...
unlicense
macs03/demo-cms
cms/lib/python2.7/site-packages/django/contrib/comments/forms.py
218
8080
import time from django import forms from django.forms.util import ErrorDict from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.contrib.comments.models import Comment from django.utils.crypto import salted_hmac, constant_time_compare from django.utils.encoding import...
mit
harshilasu/LinkurApp
y/google-cloud-sdk/.install/.backup/lib/requests/packages/chardet/big5freq.py
3133
82594
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client 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 R...
gpl-3.0
smirnovpaul/2ip.ua-api-py
api/__init__.py
1
7062
# -*- coding: utf-8 -*- import logging import requests # В случае логгирования в папку OS Windows '/'; OS Linux '\' FORMAT = "%(asctime)s [%(levelname)s] [%(filename)s %(lineno)d] %(funcName)s: %(message)s" FILE_NAME = "log/log.log" LOGGER = logging.basicConfig(format=FORMAT, level=logging.DEBUG, filename=FILE_NAME) ...
mit
saltastro/polsalt
polsalt/specpolcombine.py
1
7137
#! /usr/bin/env python """ specpolcombine Combine stokes.fits data """ import os, sys, glob, inspect import numpy as np import pyfits from pyraf import iraf from iraf import pysalt from saltobslog import obslog from scrunch1d import scrunch1d from specpolview import viewstokes np.set_printoptions(threshold=np.nan...
bsd-3-clause
kamcpp/tensorflow
tensorflow/contrib/layers/python/layers/utils.py
10
10349
# 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
gunzy83/ansible-modules-extras
cloud/openstack/os_flavor_facts.py
53
6857
#!/usr/bin/python # Copyright (c) 2015 IBM # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This software is distri...
gpl-3.0