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 |
|---|---|---|---|---|---|
pchauncey/ansible | lib/ansible/plugins/callback/full_skip.py | 34 | 2289 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | gpl-3.0 |
MediaSapiens/wavesf | django/contrib/admin/actions.py | 83 | 2968 | """
Built-in, globally-available admin actions.
"""
from django import template
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.db import router
from django.shortcuts import render_to_resp... | bsd-3-clause |
SCSSG/Odoo-SCS | addons/document/wizard/document_configuration.py | 381 | 4895 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
epssy/hue | desktop/core/ext-py/tablib-0.10.0/tablib/packages/odf/easyliststyle.py | 95 | 3771 | # -*- coding: utf-8 -*-
# Create a <text:list-style> element from a text string.
# Copyright (C) 2008 J. David Eisenberg
#
# 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 versio... | apache-2.0 |
SUSE-Cloud/nova | nova/tests/api/openstack/compute/contrib/test_extended_ips.py | 26 | 5739 | # Copyright 2013 Nebula, 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 ... | apache-2.0 |
mkocka/galaxytea | MultiBlackBody/kamensky/mbb.py | 1 | 1942 | from pylab import *
from scipy import constants as const
import numpy as np
con_h = const.h/const.e
con_k = const.k/const.e
np.seterr(all = "ignore")
parsec = 3.08567758e16
m1 = 5.0 # central mass
alfa = 0.5 # accretion parameter
mass_flow = 5.0 # mass flow from disk
Rc = 1.0*10.0**-4 # diameter of central ob... | mit |
ace02000/pyload | module/plugins/hoster/SpeedyshareCom.py | 9 | 1243 | # -*- coding: utf-8 -*-
#
# Test links:
# http://speedy.sh/ep2qY/Zapp-Brannigan.jpg
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SpeedyshareCom(SimpleHoster):
__name__ = "SpeedyshareCom"
__type__ = "hoster"
__version__ = "0.06"
__status__ = "te... | gpl-3.0 |
Gravecorp/Gap | Gap/Lib/encodings/mac_latin2.py | 647 | 8565 | """ Python Character Mapping Codec generated from 'LATIN2.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,erro... | mpl-2.0 |
Robustin/tgstation | tools/mapmerge2/precommit.py | 50 | 2078 | #!/usr/bin/env python3
import os
import pygit2
import dmm
from mapmerge import merge_map
def main(repo):
if repo.index.conflicts:
print("You need to resolve merge conflicts first.")
return 1
try:
repo.lookup_reference('MERGE_HEAD')
print("Not running mapmerge for merge commit."... | agpl-3.0 |
nyu-dl/dl4mt-tutorial | session2/data_iterator.py | 8 | 3718 | import numpy
import cPickle as pkl
import gzip
def fopen(filename, mode='r'):
if filename.endswith('.gz'):
return gzip.open(filename, mode)
return open(filename, mode)
class TextIterator:
"""Simple Bitext iterator."""
def __init__(self, source, target,
source_dict, target_d... | bsd-3-clause |
levilucio/SyVOLT | ExFamToPerson/transformation/no_contains/HdfacilitiesSolveRefNeighborhoodSchoolServiceChildDistrictSpecialFacilityPerson.py | 1 | 5952 | from core.himesis import Himesis
import uuid
class HdfacilitiesSolveRefNeighborhoodSchoolServiceChildDistrictSpecialFacilityPerson(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule dfacilitiesSolveRefNeighborhoodSchoolServiceChildDistrictSpecialFa... | mit |
shastah/spacewalk | backend/server/test/test_registration.py | 14 | 1054 | #
# Copyright (c) 2008--2015 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 or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
SnappleCap/oh-mainline | vendor/packages/ghettoq/docs/_ext/applyxrefs.py | 91 | 2153 | """Adds xref targets to the top of files."""
import sys
import os
testing = False
DONT_TOUCH = (
'./index.txt',
)
def target_name(fn):
if fn.endswith('.txt'):
fn = fn[:-4]
return '_' + fn.lstrip('./').replace('/', '-')
def process_file(fn, lines):
lines.insert(0, '\n')
lin... | agpl-3.0 |
jackrzhang/zulip | zerver/management/commands/bulk_change_user_name.py | 15 | 1253 |
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import CommandError
from zerver.lib.actions import do_change_full_name
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Change the names for many users."""
def add_argume... | apache-2.0 |
cloudendpoints/endpoints-python | endpoints/__init__.py | 2 | 1470 | #!/usr/bin/python
#
# 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... | apache-2.0 |
kmonsoor/fabric | fabric/colors.py | 57 | 1149 | """
.. versionadded:: 0.9.2
Functions for wrapping strings in ANSI color codes.
Each function within this module returns the input string ``text``, wrapped
with ANSI color codes for the appropriate color.
For example, to print some text as green on supporting terminals::
from fabric.colors import green
pri... | bsd-2-clause |
jorik041/plaso | plaso/lib/timelib.py | 1 | 24249 | # -*- coding: utf-8 -*-
"""This file contains functions and variables used for time manipulations.
This file should contain common methods that can be used in Plaso to convert
timestamps in various formats into the standard micro seconds precision integer
Epoch UTC time that is used internally to store timestamps in P... | apache-2.0 |
owais/django-allauth | allauth/socialaccount/providers/linkedin/views.py | 63 | 2437 | from xml.etree import ElementTree
from xml.parsers.expat import ExpatError
from django.utils import six
from allauth.socialaccount import providers
from allauth.socialaccount.providers.oauth.client import OAuth
from allauth.socialaccount.providers.oauth.views import (OAuthAdapter,
... | mit |
arth-co/shoop | shoop/notify/actions/email.py | 6 | 3323 | # -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import logging
from django import ... | agpl-3.0 |
google/automl-video-ondevice | examples/jetson_camera_demo.py | 1 | 4308 | # Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | apache-2.0 |
shurihell/testasia | lms/djangoapps/courseware/features/word_cloud.py | 94 | 1516 | # pylint: disable=missing-docstring
from lettuce import world, step
from common import i_am_registered_for_the_course, section_location, visit_scenario_item
@step('I view the word cloud and it has rendered')
def word_cloud_is_rendered(_step):
assert world.is_css_present('.word_cloud')
@step('the course has a W... | agpl-3.0 |
stevekuznetsov/ansible | lib/ansible/modules/cloud/webfaction/webfaction_mailbox.py | 19 | 4483 | #!/usr/bin/python
#
# Create webfaction mailbox using Ansible and the Webfaction API
#
# ------------------------------------------
# (c) Quentin Stafford-Fraser and Andy Baker 2015
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... | gpl-3.0 |
AMOboxTV/AMOBox.LegoBuild | script.module.youtube.dl/lib/youtube_dl/extractor/matchtv.py | 2 | 1810 | # coding: utf-8
from __future__ import unicode_literals
import random
from .common import InfoExtractor
from ..compat import compat_urllib_parse
from ..utils import (
sanitized_Request,
xpath_text,
)
class MatchTVIE(InfoExtractor):
_VALID_URL = r'https?://matchtv\.ru/?#live-player'
_TEST = {
... | gpl-2.0 |
kate-v-stepanova/scilifelab | tests/pm/test_project.py | 4 | 8426 | """
Test project subcontroller
"""
import os
import sys
import glob
import unittest
from cement.core import handler
from cement.utils import shell, test
from test_default import PmTest, safe_makedir
from scilifelab.pm.core.project import ProjectController, ProjectRmController
from scilifelab.pm.core.production import P... | mit |
internap/netman | tests/core/switch_factory_test.py | 3 | 4729 | # Copyright 2015 Internap.
#
# 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, so... | apache-2.0 |
jamison904/N910T | 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 |
JohnFBartlett/Python-Projects | Markov_Chat/Network_Maker/Token.py | 1 | 1507 | import random
class Token:
global word
global nextList
def __init__(self, word, nextWord):
self.word = word
self.nextList = dict()
self.update_next(nextWord)
def update_next(self, nextWord):
if nextWord in self.nextList:
self.nextList[nextWord] += 1
... | gpl-3.0 |
jvicu2001/alexis-bot | bot/lib/configuration.py | 1 | 3939 | import os
from ruamel.yaml import YAML
from bot import defaults as bot_defaults
from bot.lib.logger import create_logger
log = create_logger('Configuration')
yaml = YAML(typ='safe')
yaml.default_flow_style = False
class Configuration:
"""
Manages a YAML configuration file
"""
def __init__(self, pat... | mit |
mwmuni/LIGGGHTS_GUI | networkx/algorithms/tests/test_graphical.py | 40 | 4660 | #!/usr/bin/env python
from nose.tools import *
from nose import SkipTest
import networkx as nx
def test_valid_degree_sequence1():
n = 100
p = .3
for i in range(10):
G = nx.erdos_renyi_graph(n,p)
deg = list(G.degree().values())
assert_true( nx.is_valid_degree_sequence(deg, method='eg... | gpl-3.0 |
heisencoder/route-finder | third_party/lib/python/django/db/backends/__init__.py | 28 | 47401 | import datetime
import time
from django.db.utils import DatabaseError
try:
from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
from collections import namedtuple
from contextlib import contextmanager
from django.conf import setti... | mit |
smartdata-x/robots | pylib/Twisted/twisted/conch/manhole_ssh.py | 59 | 5066 | # -*- test-case-name: twisted.conch.test.test_manhole -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
insults/SSH integration support.
@author: Jp Calderone
"""
from zope.interface import implements
from twisted.conch import avatar, interfaces as iconch, error as econch
from twisted.... | apache-2.0 |
tecwebjoao/TecWeb-TF-2T-B-SI | venv/Lib/site-packages/pip/_vendor/html5lib/_trie/datrie.py | 1301 | 1178 | from __future__ import absolute_import, division, unicode_literals
from datrie import Trie as DATrie
from pip._vendor.six import text_type
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
def __init__(self, data):
chars = set()
for key in data.keys():
if not isinstance(key, te... | apache-2.0 |
siosio/intellij-community | python/testData/inspections/PyTypeCheckerInspection/ComprehensionsOverAsyncGenerator.py | 20 | 1024 | async def asyncgen():
yield 10
async def run():
{i for i in <warning descr="Expected 'collections.Iterable', got 'AsyncGenerator[int, Any]' instead">asyncgen()</warning>}
[i for i in <warning descr="Expected 'collections.Iterable', got 'AsyncGenerator[int, Any]' instead">asyncgen()</warning>]
{i: i ** 2... | apache-2.0 |
thdtjsdn/geonode | geonode/layers/search_indexes.py | 25 | 4682 | from agon_ratings.models import OverallRating
from dialogos.models import Comment
from django.contrib.contenttypes.models import ContentType
from django.db.models import Avg
from haystack import indexes
from geonode.maps.models import Layer
class LayerIndex(indexes.SearchIndex, indexes.Indexable):
id = indexes.In... | gpl-3.0 |
tersmitten/ansible | lib/ansible/modules/network/fortios/fortios_antivirus_profile.py | 24 | 55015 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2018 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 Lic... | gpl-3.0 |
pycket/pycket | pycket/error.py | 2 | 2488 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from rpython.rlib.objectmodel import we_are_translated
class ExitException(Exception):
def __init__(self, status_msg):
self.exit_status = status_msg
def is_user(self):
return False
class SchemeException(Exception):
_attrs_ = ["msg", "w_exn_... | mit |
leiferikb/bitpop | src/native_client/pnacl/driver/tests/help_message_test.py | 13 | 4367 | #!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests of the pnacl driver.
This tests that help messages are available in all of the drivers.
"""
from driver_env import env
... | gpl-3.0 |
phobson/bokeh | examples/app/surface3d/surface3d.py | 2 | 2431 | from os.path import dirname, join
from bokeh.core.properties import Any, Dict, Instance, String
from bokeh.models import ColumnDataSource, LayoutDOM
# This defines some default options for the Graph3d feature of vis.js
# See: http://visjs.org/graph3d_examples.html for more details. Note
# that we are fixing the size ... | bsd-3-clause |
nsg/ansible-modules-extras | network/f5/bigip_facts.py | 78 | 61763 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Matt Hite <mhite@hotmail.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... | gpl-3.0 |
tumbl3w33d/ansible | test/units/modules/network/netvisor/test_pn_vrouter_bgp.py | 23 | 3292 | # Copyright: (c) 2018, Pluribus Networks
# 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
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_vrouter_bgp
... | gpl-3.0 |
IndraVikas/scikit-learn | benchmarks/bench_20newsgroups.py | 377 | 3555 | from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... | bsd-3-clause |
leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/style/filereader.py | 182 | 6083 | # Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
# Copyright (C) 2010 ProFUSION embedded systems
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | bsd-3-clause |
povellesto/blobygames | Blob Rage App/random/TetrisRemix.py | 1 | 6215 | from Tkinter import *
def keyPressed(event):
canvas = event.widget.canvas
# first process keys that work even if the game is over
if (event.char == "q"):
gameOver(canvas)
elif (event.char == "r"):
init(canvas)
elif (event.char == "d"):
canvas.data["inDebugMode"] = not canvas... | unlicense |
Cuuuurzel/KiPyCalc | sympy/vector/tests/test_printing.py | 10 | 5621 | # -*- coding: utf-8 -*-
from sympy import Integral, latex, Function
from sympy import pretty as xpretty
from sympy.vector import CoordSysCartesian, Vector, Dyadic, express
from sympy.abc import a, b, c
from sympy.core.compatibility import u_decode as u
from sympy.utilities.pytest import XFAIL
def pretty(expr):
"""... | mit |
wuwx/ssbc | search/views.py | 26 | 1737 | #coding: utf8
import traceback
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.views.decorators.cache import never_cache
from django.http import JsonResponse, HttpResponse
from ssbc import settings
from search.models import Hash, FileList, StatusReport, RecKeywords... | gpl-2.0 |
ltowarek/budget-supervisor | third_party/saltedge/test/test_reconnect_connection_request_body.py | 1 | 1040 | # coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_cl... | mit |
4bic/grano | grano/logic/files.py | 4 | 2076 | from StringIO import StringIO
from unicodecsv import DictReader
from unicodecsv import Error as CSVError
import logging
import colander
from grano.core import db
from grano.model import File
from grano.logic.references import ProjectRef, AccountRef
from grano.lib.exc import BadRequest
log = logging.getLogger(__name_... | mit |
mateoqac/unqTip | lib_gb/oauth2client/file.py | 63 | 3160 | # 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 ... | gpl-3.0 |
bstark2/AggieAir_MESA | sw/ground_segment/python/real_time_plot/messagepicker.py | 14 | 3111 | #!/usr/bin/env python
import wx
import getopt
import sys
import os
sys.path.append(os.getenv("PAPARAZZI_HOME") + "/sw/lib/python")
import messages_tool
class MessagePicker(wx.Frame):
def __init__(self, parent, callback, initIvy = True):
wx.Frame.__init__(self, parent, name="MessagePicker", title=u'Message Pi... | gpl-2.0 |
redhat-openstack/python-ironicclient | ironicclient/v1/driver_shell.py | 1 | 3002 | # -*- coding: utf-8 -*-
#
# Copyright 2013 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... | apache-2.0 |
spasmilo/electrum | plugins/exchange_rate.py | 1 | 28903 | from PyQt4.QtGui import *
from PyQt4.QtCore import *
import datetime
import decimal
import httplib
import json
import threading
import time
import re
from decimal import Decimal
from ssl import SSLError
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _
from electrum_gui.qt.util import *
from e... | gpl-3.0 |
torchingloom/edx-platform | common/lib/xmodule/xmodule/tests/test_tabs.py | 10 | 25529 | """Tests for Tab classes"""
from mock import MagicMock
import xmodule.tabs as tabs
import unittest
class TabTestCase(unittest.TestCase):
"""Base class for Tab-related test cases."""
def setUp(self):
self.course = MagicMock()
self.course.id = 'edX/toy/2012_Fall'
self.fake_dict_tab = {'... | agpl-3.0 |
DavidNorman/tensorflow | tensorflow/python/debug/cli/base_ui.py | 89 | 7715 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
JamshedVesuna/zerorpc-python | tests/test_buffered_channel.py | 74 | 15734 | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... | mit |
philippedeswert/android_kernel_lge_hammerhead | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
Moriadry/tensorflow | tensorflow/python/platform/test.py | 13 | 3786 | # 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 |
vjFaLk/frappe | frappe/tests/test_email.py | 3 | 8521 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import unittest, frappe, re, email
from frappe.test_runner import make_test_records
make_test_records("User")
make_test_records("Email Account")
class TestEmail(unittest.TestCa... | mit |
ivmech/iviny-scope | lib/xlsxwriter/test/worksheet/test_sparkline03.py | 1 | 5484 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet
class TestAssemble... | gpl-3.0 |
yigitguler/django | django/contrib/staticfiles/management/commands/collectstatic.py | 26 | 13464 | from __future__ import unicode_literals
import os
from collections import OrderedDict
from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, BaseCommand
from django.core.management.color import no_style
from django.utils.encoding import smart_text
from django.uti... | bsd-3-clause |
wbc2010/django1.2.5 | django/utils/timesince.py | 319 | 2698 | import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | bsd-3-clause |
pelinquin/ConnectedGraph | svg2tikz.py | 1 | 48343 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Warning: UNDER_CONSTRUCTION
This is a modified code from Kjell Magne Fauske initial code
...with requirements:
- fit on one python file (avoid library complex setup for user)
- only used for Python API
- no need to store SVG input in a file (use serializing string)
-... | gpl-3.0 |
alexkogon/ansible | v1/ansible/runner/lookup_plugins/lines.py | 176 | 1432 | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.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 lat... | gpl-3.0 |
eharney/nova | nova/tests/objects/test_compute_node.py | 5 | 6754 | # Copyright 2013 IBM Corp.
#
# 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 |
openstack/manila | manila/db/migrations/alembic/versions/17115072e1c3_add_nova_net_id_column_to_share_networks.py | 9 | 1079 | # Copyright 2015 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 by applicable law or a... | apache-2.0 |
ahamilton55/ansible | lib/ansible/modules/cloud/amazon/s3.py | 40 | 30499 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | gpl-3.0 |
Designist/sympy | sympy/polys/numberfields.py | 39 | 31786 | """Computational algebraic field theory. """
from __future__ import print_function, division
from sympy import (
S, Rational, AlgebraicNumber,
Add, Mul, sympify, Dummy, expand_mul, I, pi
)
from sympy.functions.elementary.exponential import exp
from sympy.functions.elementary.trigonometric import cos, sin
fr... | bsd-3-clause |
mrkn/iTerm2 | tools/ply/ply-3.4/test/yacc_unused.py | 174 | 1669 | # -----------------------------------------------------------------------------
# yacc_unused.py
#
# A grammar with an unused rule
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tok... | gpl-2.0 |
cbeloni/pychronesapp | backend/venv/lib/python2.7/site-packages/unidecode/x0fa.py | 252 | 4406 | data = (
'Chey ', # 0x00
'Thak ', # 0x01
'Thak ', # 0x02
'Thang ', # 0x03
'Thayk ', # 0x04
'Thong ', # 0x05
'Pho ', # 0x06
'Phok ', # 0x07
'Hang ', # 0x08
'Hang ', # 0x09
'Hyen ', # 0x0a
'Hwak ', # 0x0b
'Wu ', # 0x0c
'Huo ', # 0x0d
'[?] ', # 0x0e
'[?] ', # 0x0f
'Zhong ', ... | mit |
sertac/django | tests/admin_changelist/models.py | 276 | 2890 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Event(models.Model):
# Oracle can have problems with a column named "date"
date = models.DateField(db_column="event_date")
class Parent(models.Model):
name = models.CharField(max_length=128)
class Child(mo... | bsd-3-clause |
DavidLP/home-assistant | homeassistant/components/caldav/calendar.py | 3 | 9293 | """Support for WebDav Calendar."""
from datetime import datetime, timedelta
import logging
import re
import voluptuous as vol
from homeassistant.components.calendar import (
PLATFORM_SCHEMA, CalendarEventDevice, get_date)
from homeassistant.const import (
CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME, CON... | apache-2.0 |
elsigh/browserscope | bin/reflow/reflow_timer.py | 9 | 6140 | #!/usr/bin/python
#
# Copyright 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 or ag... | apache-2.0 |
basicthinker/THNVM | ext/ply/test/lex_optimize3.py | 164 | 1062 | # -----------------------------------------------------------------------------
# lex_optimize3.py
#
# Writes table in a subdirectory structure.
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
tokens = (
... | bsd-3-clause |
bebby520/essay_devel | venv/lib/python2.7/site-packages/setuptools/command/alias.py | 467 | 2381 | from distutils.errors import DistutilsOptionError
from setuptools.command.setopt import edit_config, option_base, config_file
def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg:
return repr(arg)
if arg.split() != [arg... | apache-2.0 |
GarySparrow/mFlaskWeb | venv/Lib/site-packages/jinja2/sandbox.py | 637 | 13445 | # -*- coding: utf-8 -*-
"""
jinja2.sandbox
~~~~~~~~~~~~~~
Adds a sandbox layer to Jinja as it was the default behavior in the old
Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
default behavior is easier to use.
The behavior can be changed by subclassing the environm... | mit |
IITBinterns13/edx-platform-dev | common/lib/xmodule/xmodule/tests/test_html_module.py | 6 | 1232 | import unittest
from mock import Mock
from xmodule.html_module import HtmlModule
from . import get_test_system
class HtmlModuleSubstitutionTestCase(unittest.TestCase):
descriptor = Mock()
def test_substitution_works(self):
sample_xml = '''%%USER_ID%%'''
module_data = {'data': sample_xml}
... | agpl-3.0 |
cancan101/tensorflow | tensorflow/contrib/tensor_forest/python/kernel_tests/update_fertile_slots_op_test.py | 80 | 4201 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
vmarkovtsev/django | django/contrib/auth/checks.py | 374 | 2098 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.core import checks
def check_user_model(**kwargs):
errors = []
cls = apps.get_model(settings.AUTH_USER_MODEL)
# Check that REQUIRED_FIELDS is a list
if not isins... | bsd-3-clause |
mozilla/socorro | webapp-django/crashstats/supersearch/tests/test_views.py | 1 | 24007 | # 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 json
import re
from urllib.parse import quote
import mock
import pyquery
from django.conf import settings
from ... | mpl-2.0 |
roadmapper/ansible | lib/ansible/module_utils/network/cloudengine/ce.py | 21 | 12879 | #
# This code is part of Ansible, but is an independent component.
#
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complet... | gpl-3.0 |
ravibhure/ansible | lib/ansible/modules/cloud/ovirt/ovirt_storage_connections.py | 43 | 9748 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 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
#... | gpl-3.0 |
pilou-/ansible | lib/ansible/modules/network/fortios/fortios_wanopt_settings.py | 17 | 7342 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# 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 Lic... | gpl-3.0 |
duqiao/django | django/contrib/sessions/models.py | 158 | 2230 | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
class SessionManager(models.Manager):
use_in_migrations = True
def encode(self, session_dict):
"""
Return... | bsd-3-clause |
jparise/pinball | pinball/run_pinball.py | 4 | 7125 | # Copyright 2015, Pinterest, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
ltiao/scikit-learn | sklearn/preprocessing/label.py | 16 | 26702 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
teoliphant/scipy | scipy/weave/tests/test_scxx_dict.py | 10 | 8700 | """ Test refcounting and behavior of SCXX.
"""
import sys
from numpy.testing import TestCase, dec, assert_, assert_raises
from scipy.weave import inline_tools
class TestDictConstruct(TestCase):
#------------------------------------------------------------------------
# Check that construction from basic ty... | bsd-3-clause |
ashishnerkar1/scrapy | scrapy/contrib_exp/downloadermiddleware/decompression.py | 18 | 2598 | """ This module implements the DecompressionMiddleware which tries to recognise
and extract the potentially compressed responses that may arrive.
"""
import bz2
import gzip
import zipfile
import tarfile
from tempfile import mktemp
import six
try:
from cStringIO import StringIO as BytesIO
except ImportError:
... | bsd-3-clause |
cruzegoodin/TSC-ShippingDetails | flask/bin/activate_this.py | 1076 | 1137 | """By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/... | bsd-3-clause |
zaina/nova | nova/api/ec2/__init__.py | 15 | 25656 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | apache-2.0 |
saxix/django-uuid-pk | django_uuid_pk/__init__.py | 1 | 1641 | import subprocess
import datetime
import os
VERSION = __version__ = (0, 2, 0, 'final', 0)
NAME='django-uuid-pk'
__author__ = 'sax'
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert... | bsd-3-clause |
Hao-Liu/virt-trinity-obsolete | virtTrinity/utils_xml_gen.py | 1 | 35001 | import re
import logging
import random
import utils_random
import xml_gen
import struct
import socket
UNIT_MAP = {
"b": 1,
"byte": 1,
"k": 1000**1,
"m": 1000**2,
"g": 1000**3,
"t": 1000**4,
"p": 1000**5,
"e": 1000**6,
"kb": 1000**1,
"mb": 1000**2,
"gb": 1000**3,
"tb": 10... | gpl-2.0 |
grap/OpenUpgrade | openerp/modules/db.py | 442 | 6037 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | agpl-3.0 |
ojengwa/oh-mainline | vendor/packages/typecheck/tests/benchmark.py | 16 | 2919 | """
A benchmark script to profile changes to typecheck's deep internals
"""
import time
### Bookkeeping ###
import support
if __name__ == '__main__':
support.adjust_path()
### /Bookkeeping ###
import typecheck
from typecheck import accepts
print "Using typecheck from", typecheck.__file__
def test_add_accepts_t... | agpl-3.0 |
datenbetrieb/odoo | 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 |
wfxiang08/django190 | tests/null_fk_ordering/models.py | 165 | 1538 | """
Regression tests for proper working of ForeignKey(null=True). Tests these bugs:
* #7512: including a nullable foreign key reference in Meta ordering has un
xpected results
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
... | bsd-3-clause |
qiankunshe/sky_engine | build/android/pylib/perf/thermal_throttle.py | 38 | 4529 | # 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.
import logging
from pylib import android_commands
from pylib.device import device_utils
class OmapThrottlingDetector(object):
"""Class to detect and trac... | bsd-3-clause |
fernandopinhati/oppia | extensions/rich_text_components/Tabs/Tabs.py | 13 | 3005 | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | apache-2.0 |
adoosii/edx-platform | common/test/acceptance/tests/discussion/test_discussion.py | 30 | 46869 | """
Tests for discussion pages
"""
import datetime
from pytz import UTC
from uuid import uuid4
from nose.plugins.attrib import attr
from flaky import flaky
from .helpers import BaseDiscussionTestCase
from ..helpers import UniqueCourseTest
from ...pages.lms.auto_auth import AutoAuthPage
from ...pages.lms.courseware im... | agpl-3.0 |
baldimir/Sunflower | application/gui/history_list.py | 9 | 5320 | import os
import gtk
from parameters import Parameters
class Column:
NAME = 0
PATH = 1
TIMESTAMP = 2
class HistoryList(gtk.Window):
"""History list is used to display complete browsing history."""
def __init__(self, parent, application):
# create main window
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)... | gpl-3.0 |
Colorfulstan/robotframework | src/robot/api/deco.py | 24 | 1818 | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | apache-2.0 |
cloudbau/glance | glance/tests/functional/store/test_cinder.py | 1 | 3385 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# 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.apach... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.