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 |
|---|---|---|---|---|---|
quozl/sugar | src/jarabe/view/buddyicon.py | 2 | 2868 | # Copyright (C) 2006-2007 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distribute... | gpl-3.0 |
LoHChina/nova | nova/db/sqlalchemy/migrate_repo/versions/269_add_numa_node_column.py | 81 | 1322 | # Copyright 2014 Intel Corporation
# 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 |
sameetb-cuelogic/edx-platform-test | common/lib/xmodule/xmodule/modulestore/tests/test_asides.py | 92 | 2109 | """
Tests for Asides
"""
from xblock.core import XBlockAside
from xblock.fields import Scope, String
from xblock.fragment import Fragment
from unittest import TestCase
from xmodule.modulestore.tests.test_cross_modulestore_import_export import XmlModulestoreBuilder
from mock import patch
class AsideTestType(XBlockAsid... | agpl-3.0 |
matthew-brett/pymc | pymc/sandbox/RJMCMC/trans_dimensional.py | 1 | 1699 | from pymc import stoch, data, discrete_stoch
from numpy import arange, ones, eye, sum, zeros, exp, concatenate
from numpy.random import normal
from pymc import normal_like, uniform_like, JointMetropolis, DiscreteMetropolis
# Generate data
K_true = 5
T=20
A_true = -.4*exp(arange(0,-K_true,-1,dtype=float))
X_true = zer... | mit |
zbqf109/goodo | openerp/addons/base/res/res_country.py | 6 | 4214 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
from openerp.osv import fields, osv
def location_name_search(self, cr, user, name='', args=None, operator='ilike',
context=None, limit=100):
if not args:
args = []
id... | gpl-3.0 |
OmarEinea/kernel_sony_msm8974 | Documentation/target/tcm_mod_builder.py | 4981 | 41422 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
stuntman723/rap-analyzer | rap_analyzer/lib/python2.7/site-packages/pip/_vendor/requests/compat.py | 1039 | 1469 | # -*- coding: utf-8 -*-
"""
pythoncompat
"""
from .packages import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except (ImportError, SyntaxError):
# si... | mit |
ForkedReposBak/mxnet | benchmark/python/sparse/cast_storage.py | 57 | 3691 | # 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 u... | apache-2.0 |
newerthcom/savagerebirth | libs/python-2.72/Doc/includes/sqlite3/text_factory.py | 4 | 1369 | import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
# Create the table
con.execute("create table person(lastname, firstname)")
AUSTRIA = u"\xd6sterreich"
# by default, rows are returned as Unicode
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert row[0] == AUSTRIA
# but we can make sq... | gpl-2.0 |
shingonoide/odoo | openerp/report/render/rml2pdf/color.py | 443 | 1720 | # -*- coding: utf-8 -*-
##############################################################################
#
# 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... | agpl-3.0 |
rzarzynski/tempest | tempest/api_schema/response/compute/v2/hosts.py | 11 | 1286 | # Copyright 2014 NEC 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
#
# Unless required ... | apache-2.0 |
MQQiang/kbengine | kbe/res/scripts/common/Lib/distutils/tests/support.py | 106 | 6533 | """Support code for distutils test cases."""
import os
import sys
import shutil
import tempfile
import unittest
import sysconfig
from copy import deepcopy
from distutils import log
from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
from distutils.core import Distribution
class LoggingSilencer(object):
de... | lgpl-3.0 |
sirmmo/mmonet | mmonet/monitor/models.py | 1 | 1105 | from bulbs.model import Node, Relationship
from bulbs.property import String, Integer, DateTime, Bool, Float, Null
from bulbs.utils import current_datetime
import datetime
import os
def uuidify():
from uuid import uuid4
return str(uuid4())
import json
class Measure(Node):
element_type = "Measure"
uuid = S... | mit |
Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/pip/_vendor/requests/packages/charade/jisfreq.py | 3131 | 47315 | ######################## 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 |
bianyin102938/principles-of-computing | homework3.py | 5 | 13706 | # Homework 3 for Principles of Computing class, by k., 07/06/2014
import math
import itertools
# helper functions
def gen_all_sequences(outcomes, length):
'''
function that enumerates the set of all sequences of outcomes of given length;
original code from the lecture, do not modify
'''
answer_se... | mit |
dribnet/dagbldr | dagbldr/tests/test_full_vae.py | 1 | 2667 | from collections import OrderedDict
import numpy as np
import theano
from dagbldr.datasets import load_digits
from dagbldr.utils import add_datasets_to_graph, convert_to_one_hot
from dagbldr.utils import get_params_and_grads
from dagbldr.utils import early_stopping_trainer
from dagbldr.nodes import softplus_layer, lin... | bsd-3-clause |
arvinsingla/CouchPotatoServer | couchpotato/core/helpers/rss.py | 81 | 1177 | import xml.etree.ElementTree as XMLTree
from couchpotato.core.logger import CPLog
log = CPLog(__name__)
class RSS(object):
def getTextElements(self, xml, path):
""" Find elements and return tree"""
textelements = []
try:
elements = xml.findall(path)
except:
... | gpl-3.0 |
lmorchard/django | tests/staticfiles_tests/cases.py | 270 | 4520 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import codecs
import os
import shutil
import tempfile
from django.conf import settings
from django.core.management import call_command
from django.template import Context, Template
from django.test import SimpleTestCase, override_settings
from django.u... | bsd-3-clause |
evilpie/servo | tests/wpt/harness/wptrunner/hosts.py | 196 | 3292 | # 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/.
from __future__ import unicode_literals
class HostsLine(object):
def __init__(self, ip_address, canonical_hostname... | mpl-2.0 |
zhongdai/gensim | gensim/corpora/lowcorpus.py | 73 | 7185 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Corpus in GibbsLda++ format of List-Of-Words.
"""
from __future__ import with_statement
import logging
from gensim import utils
... | gpl-3.0 |
vizual54/MissionPlanner | Lib/anydbm.py | 59 | 2748 | """Generic interface to all dbm clones.
Instead of
import dbm
d = dbm.open(file, 'w', 0666)
use
import anydbm
d = anydbm.open(file, 'w')
The returned object is a dbhash, gdbm, dbm or dumbdbm object,
dependent on the type of database being opened (determined by whichdb
... | gpl-3.0 |
Dino0631/RedRain-Bot | cogs/lib/youtube_dl/extractor/rutube.py | 24 | 6818 | # coding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
)
from ..utils import (
determine_ext,
unified_strdate,
)
class RutubeIE(InfoExtractor):
IE_NAME = 'rutube'
IE_DESC = 'Rutube videos'
_VALID... | gpl-3.0 |
whn09/tensorflow | tensorflow/python/debug/cli/stepper_cli_test.py | 47 | 19722 | # 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 |
qianwenming/mapnik | scons/scons-local-2.3.1/SCons/Tool/sgic++.py | 8 | 2066 | """SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2... | lgpl-2.1 |
mitchelljkotler/django | tests/template_tests/filter_tests/test_linebreaks.py | 310 | 1920 | from django.template.defaultfilters import linebreaks_filter
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class LinebreaksTests(SimpleTestCase):
"""
The contents in "linebreaks" are escaped according to the current
autoescape setting.
... | bsd-3-clause |
tima/ansible | lib/ansible/module_utils/network/cnos/cnos.py | 27 | 133582 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by
# Ansible still belong to the author of the module, and may assign their own
# license to the complete wo... | gpl-3.0 |
neharejanjeva/techstitution | venv/lib/python2.7/site-packages/pip/utils/outdated.py | 513 | 5455 | from __future__ import absolute_import
import datetime
import json
import logging
import os.path
import sys
from pip._vendor import lockfile
from pip._vendor.packaging import version as packaging_version
from pip.compat import total_seconds, WINDOWS
from pip.models import PyPI
from pip.locations import USER_CACHE_DI... | cc0-1.0 |
guettli/django | tests/utils_tests/test_crypto.py | 447 | 4581 | from __future__ import unicode_literals
import binascii
import hashlib
import unittest
from django.utils.crypto import constant_time_compare, pbkdf2
class TestUtilsCryptoMisc(unittest.TestCase):
def test_constant_time_compare(self):
# It's hard to test for constant time, just test the result.
s... | bsd-3-clause |
zencore-dobetter/zencore-redtask | src/zencore/redtask/server.py | 1 | 11540 | import os
import time
import logging
import socket
import threading
from zencore.conf import Settings
from zencore.conf import load_object
from zencore.errors import MissingRequiredFieldError
from zencore.errors import WrongParameterTypeError
from zencore.errors import WrongProcessFlowError
from zencore.errors import g... | mit |
mathspace/django | django/http/multipartparser.py | 17 | 25645 | """
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
from __future__ import unicode_literals
import base64
import binascii
import cgi
import sys
from django.conf import settings
from django.core.exceptions imp... | bsd-3-clause |
Venturi/oldcms | env/lib/python2.7/site-packages/PIL/ImageDraw.py | 6 | 13108 | #
# The Python Imaging Library
# $Id$
#
# drawing interface operations
#
# History:
# 1996-04-13 fl Created (experimental)
# 1996-08-07 fl Filled polygons, ellipses.
# 1996-08-13 fl Added text support
# 1998-06-28 fl Handle I and F images
# 1998-12-29 fl Added arc; use arc primitive to draw ellipses
# 1999-01... | apache-2.0 |
abergeron/pylearn2 | pylearn2/scripts/icml_2013_wrepl/multimodal/extract_layer_2_kmeans_features.py | 44 | 2762 | from __future__ import print_function
import numpy as np
import os
import sys
from pylearn2.utils import serial
from pylearn2.utils import sharedX
from pylearn2.utils.string_utils import preprocess
def usage():
print("""
Run
python extract_layer_2_kmeans_features.py public_test
to extract features for the ICML 2... | bsd-3-clause |
MediaSapiens/wavesf | django/contrib/admin/views/main.py | 16 | 10424 | from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.util import quote
from django.core.paginator import Paginator, InvalidPage
from django.db import models
from django.utils.encoding import force_unicode, smart_str
from dja... | bsd-3-clause |
jymannob/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/nowness.py | 7 | 1628 | from __future__ import unicode_literals
import re
from .brightcove import BrightcoveIE
from .common import InfoExtractor
from ..utils import ExtractorError
class NownessIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
_TEST = {
'ur... | gpl-3.0 |
pavelchristof/gomoku-ai | tensorflow/python/debug/cli/profile_analyzer_cli.py | 37 | 29589 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
frostidaho/qtile | test/test_bar.py | 2 | 12270 | # Copyright (c) 2011 Florian Mounier
# Copyright (c) 2012-2013 Craig Barnes
# Copyright (c) 2012 roger
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2014 Sean Vig
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... | mit |
AndreaCrotti/ansible | lib/ansible/plugins/filter/core.py | 59 | 11787 | # (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# 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.... | gpl-3.0 |
SuperTango/TangoLogger | Uploader/requests/requests/packages/urllib3/util/timeout.py | 1004 | 9544 | # The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
import time
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
# urllib3
_Default = object()
def current... | gpl-3.0 |
jorsea/vertical-ngo | framework_agreement_sourcing/tests/test_check_sourcing.py | 2 | 2117 | # Author: Leonardo Pistone
# Copyright 2014-2015 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, or (at your option) a... | agpl-3.0 |
heromod/migrid | mig/vm-proxy/deprecated/proxy/tcplistener.py | 1 | 2600 | #!/usr/bin/env python
# This Python file uses the following encoding: utf-8
import logging, sys, socket, os, time, threading, SocketServer
from OpenSSL import SSL
"""
Whitelisting mixin request are only allowed from the list of peers.
"""
class Whitelist:
peers = []
def verify_request(self, request, clien... | gpl-2.0 |
gquirozbogner/contentbox-master | third_party/django/templatetags/tz.py | 236 | 5624 | from datetime import datetime, tzinfo
try:
import pytz
except ImportError:
pytz = None
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import six
from django.utils import timezone
register = Library()
# HACK: datetime is an old-style class, create... | apache-2.0 |
wndias/bc.repository | script.module.youtube.dl/lib/youtube_dl/extractor/gfycat.py | 147 | 3555 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
float_or_none,
qualities,
ExtractorError,
)
class GfycatIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gfycat\.com/(?:ifr/)?(?P<id>[^/?#]+)'
_TESTS = [{
'... | gpl-2.0 |
zhuangjun1981/retinotopic_mapping | retinotopic_mapping/tools/GenericTools.py | 1 | 1710 | import numpy as np
def weighted_average(values, weights):
if values.shape != weights.shape:
raise ValueError('"values" and "weights" should have same shape.')
if np.amin(weights) < 0.:
raise ValueError('all weights should be no less than 0.')
return np.sum((values * weights).flat) / np.s... | gpl-3.0 |
miraculixx/heroku-buildpack-python | vendor/pip-pop/pip/_vendor/requests/packages/urllib3/poolmanager.py | 678 | 9406 | import logging
try: # Python 3
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
from ._collections import RecentlyUsedContainer
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool
from .connectionpool import port_by_scheme
from .exceptions import LocationValue... | mit |
deepmind/distrax | distrax/_src/distributions/one_hot_categorical.py | 1 | 2964 | # Copyright 2021 DeepMind Technologies Limited. 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 |
ressu/SickGear | lib/unidecode/x0d0.py | 253 | 4706 | data = (
'kweon', # 0x00
'kweonj', # 0x01
'kweonh', # 0x02
'kweod', # 0x03
'kweol', # 0x04
'kweolg', # 0x05
'kweolm', # 0x06
'kweolb', # 0x07
'kweols', # 0x08
'kweolt', # 0x09
'kweolp', # 0x0a
'kweolh', # 0x0b
'kweom', # 0x0c
'kweob', # 0x0d
'kweobs', # 0x0e
'kweos', # 0x... | gpl-3.0 |
emjotde/mosesdecoder_nmt | contrib/arrow-pipelines/pcl/components/wrappers/data_split/data_split.py | 9 | 4994 | def get_name():
return 'data_split'
def get_inputs():
return ['src_filename', 'trg_filename']
def get_outputs():
return ['devel_src_filename', 'devel_trg_filename',
'eval_src_filename', 'eval_trg_filename',
'train_src_filename', 'train_trg_filename']
def get_configuration():
r... | lgpl-2.1 |
theoneandonly-vector/LaZagne | Windows/src/LaZagne/softwares/windows/secretsdump.py | 7 | 38489 | #!/usr/bin/python
# Copyright (c) 2003-2015 CORE Security Technologies
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id$
#
# Description: Performs various techniques to dump hashes from the
# ... | lgpl-3.0 |
jrha/artemis | plugins/ipmi_env_ambient.py | 2 | 2606 | #!/usr/bin/python
# coding=utf8
#
# Copyright Science and Technology Facilities Council, 2009-2012.
#
# This file is part of ARTEMIS.
#
# ARTEMIS 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 ve... | gpl-3.0 |
lucywyman/slides-ii | v/lib/python2.7/site-packages/pygments/lexers/_cl_builtins.py | 75 | 14053 | # -*- coding: utf-8 -*-
"""
pygments.lexers._cl_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ANSI Common Lisp builtins.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
BUILTIN_FUNCTIONS = set(( # 638 functions
'<', '<=', '=', '>', '>=',... | apache-2.0 |
karlward/tweetsql | tweetsql/stop.py | 1 | 2048 | stop = ['a','about','after','again','against','all','almost','along','also','although','always','among','an','and','another','any','are','area','around','as','asked','at','away','back','be','because','become','been','before','began','being','best','better','between','big','both','business','but','by','came','can','case... | gpl-3.0 |
agoose77/hivesystem | dragonfly/blenderhive/blendercanvas.py | 1 | 3402 | import libcontext
from libcontext.socketclasses import *
from libcontext.pluginclasses import *
from ..canvas import canvasdrone
import functools
from .blenderbgrid import blenderbgrid
from .blender_str import blender_str
from .blender_mstr import blender_mstr
from . import blenderimage
from .build_canvasdrone import... | bsd-2-clause |
disqus/django-old | django/middleware/common.py | 3 | 7223 | import hashlib
import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.log import getLogger
logger = getLogger('django.request')
class CommonMiddleware(object):
"""... | bsd-3-clause |
aonorin/bgfx | 3rdparty/scintilla/scripts/GenerateCaseConvert.py | 71 | 4580 | # Script to generate CaseConvert.cxx from Python's Unicode data
# Should be run rarely when a Python with a new version of Unicode data is available.
# Requires Python 3.3 or later
# Should not be run with old versions of Python.
# Current best approach divides case conversions into two cases:
# simple symmetric and ... | bsd-2-clause |
Touched/subscript | cli.py | 1 | 1234 | import subscript.compile
import argparse
import time
parser = argparse.ArgumentParser(description='Pokescript compiler.')
parser.add_argument('script', metavar='script', type=open, help='the script to compile')
parser.add_argument('--raw', metavar='file', dest='out_raw', type=argparse.FileType('wb'), help='write the ... | gpl-3.0 |
Storj/dataserv-client | tests/test_bandwidth_test.py | 1 | 4788 | import dataserv_client.bandwidth_test as bt
import unittest
import socket
import time
import threading
import timeit
import os
class TestBandwidthTest(unittest.TestCase):
def test_bound_socket(self):
sock_family = socket.AF_INET
sock_type = socket.SOCK_STREAM
bt.source = "127.0.0.1"
... | mit |
spencerjanssen/Flexget | tests/test_argparse.py | 16 | 2335 | """Test the custom behaviors we have added to argparse."""
from argparse import Action
from flexget.options import ArgumentParser
def test_subparser_nested_namespace():
p = ArgumentParser()
p.add_argument('--outer')
p.add_subparsers(nested_namespaces=True)
sub = p.add_subparser('sub')
sub.add_ar... | mit |
fmv1992/python-mode | pymode/libs/logilab-common-1.4.1/test/unittest_graph.py | 14 | 3196 | # unit tests for the cache module
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Les... | lgpl-3.0 |
LilyFG/LilyFG.github.io | markdown_generator/publications.py | 197 | 3887 |
# coding: utf-8
# # Publications markdown generator for academicpages
#
# Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook, with the core python code in publications.py. Run either from the `markdown_g... | mit |
google-research/google-research | smug_saliency/masking_test.py | 1 | 34957 | # 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 |
direvus/ansible | lib/ansible/modules/network/junos/junos_linkagg.py | 27 | 10729 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
mcrowson/django | django/contrib/staticfiles/finders.py | 478 | 9854 | import os
from collections import OrderedDict
from django.apps import apps
from django.conf import settings
from django.contrib.staticfiles import utils
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import (
FileSystemStorage, Storage, default_storage,
)
from django.utils i... | bsd-3-clause |
SimenB/thefuck | tests/rules/test_fix_file.py | 3 | 7118 | # -*- coding: utf-8 -*-
import pytest
import os
from collections import namedtuple
from thefuck.rules.fix_file import match, get_new_command
from thefuck.types import Command
FixFileTest = namedtuple('FixFileTest', ['script', 'file', 'line', 'col', 'output'])
tests = (
FixFileTest('gcc a.c', 'a.c', 3, 1, """
a.c... | mit |
nickster5001/ctracker | flask/lib/python3.4/site-packages/jinja2/testsuite/__init__.py | 404 | 4641 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite
~~~~~~~~~~~~~~~~
All the unittests of Jinja2. These tests can be executed by
either running run-tests.py using multiple Python versions at
the same time.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
i... | mit |
dftlibs/xcint | src/balboa/balboa/generate.py | 2 | 16765 | def get_ijk_list(m):
l = []
for a in range(1, m + 2):
for b in range(1, a + 1):
i = m + 1 - a
j = a - b
k = b - 1
l.append([i, j, k])
return l
def test_get_ijk_list():
assert get_ijk_list(3) == [
[3, 0, 0],
[2, 1, 0],
[2, ... | mpl-2.0 |
iivvoo/kodiekar | vanderwijk.iivvoo.kar/resources/lib/requests/packages/chardet/universaldetector.py | 1776 | 6840 | ######################## 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 |
pdellaert/ansible | lib/ansible/modules/packaging/os/zypper.py | 8 | 17970 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Patrick Callahan <pmc@patrickcallahan.com>
# based on
# openbsd_pkg
# (c) 2013
# Patrik Lundin <patrik.lundin.swe@gmail.com>
#
# yum
# (c) 2012, Red Hat, Inc
# Written by Seth Vidal <skvidal at fedoraproject.org>
#
# GNU Gene... | gpl-3.0 |
armersong/zato | code/zato-server/src/zato/server/service/internal/security/xpath.py | 6 | 7267 | # -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
from contextlib import closing
from traceback import format_exc
from uui... | gpl-3.0 |
luiseduardohdbackup/odoo | addons/sale/res_config.py | 175 | 8813 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
tedelhourani/ansible | test/units/modules/network/ovs/ovs_module.py | 56 | 3132 | # (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
# (at your option) any later version.
#
# Ansible is dis... | gpl-3.0 |
tomchristie/django | tests/many_to_many/models.py | 63 | 1370 | """
Many-to-many relationships
To define a many-to-many relationship, use ``ManyToManyField()``.
In this example, an ``Article`` can be published in multiple ``Publication``
objects, and a ``Publication`` has multiple ``Article`` objects.
"""
from django.db import models
class Publication(models.Model):
title =... | bsd-3-clause |
eval1749/elang | build/android/pylib/monkey/test_runner.py | 26 | 4186 | # 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.
"""Runs a monkey test on a single device."""
import logging
import random
from devil.android import device_errors
from devil.android.sdk import intent
from... | apache-2.0 |
wallnerryan/quantum_migrate | quantum/tests/unit/nec/test_pfc_driver.py | 4 | 13093 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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... | apache-2.0 |
insiderr/insiderr-app | app/modules/image/img_opencv.py | 1 | 18899 | #-*- coding: utf-8 -*-
#
# Blah
'''opencv wrapper'''
__all__ = ('ALoaderOpenCV', 'ImageOpenCV', 'AsyncImageOpenCV')
from kivy.logger import Logger
from kivy.core.image import ImageLoader
from kivy.compat import PY2
from os import write, close, O_RDWR, O_CREAT
from os import open as openfile
import mimetypes
fr... | gpl-3.0 |
BartoszCichecki/onlinepython | onlinepython/pypy-2.4.0-win32/lib-python/2.7/xml/etree/ElementTree.py | 58 | 56506 | #
# ElementTree
# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $
#
# light-weight XML support for Python 2.3 and later.
#
# history (since 1.2.6):
# 2005-11-12 fl added tostringlist/fromstringlist helpers
# 2006-07-05 fl merged in selected changes from the 1.3 sandbox
# 2006-07-05 fl removed support for ... | gpl-2.0 |
cyanna/edx-platform | cms/djangoapps/contentstore/views/tests/test_entrance_exam.py | 9 | 11939 | """
Test module for Entrance Exams AJAX callback handler workflows
"""
import json
from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase
from contentst... | agpl-3.0 |
neno1978/pelisalacarta | python/main-ui/plugintools.py | 2 | 37726 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# Plugin Tools
# Copyright 2015 tvalacarta@gmail.com
#
# Distributed under the terms of GNU General Public License v3 (GPLv3)
# http://www.gnu.org/licenses/gpl-3.0.html
#------------------------------------------------------------
# T... | gpl-3.0 |
denys-duchier/django | django/http/response.py | 14 | 17537 | import datetime
import json
import re
import sys
import time
from email.header import Header
from http.client import responses
from urllib.parse import urlparse
from django.conf import settings
from django.core import signals, signing
from django.core.exceptions import DisallowedRedirect
from django.core.serializers.j... | bsd-3-clause |
eXcomm/electrum-server | src/processor.py | 2 | 7861 | import json
import Queue as queue
import socket
import threading
import time
import sys
from utils import random_string, timestr, print_log
from utils import logger
class Shared:
def __init__(self, config):
self.lock = threading.Lock()
self._stopped = False
self.config = config
se... | agpl-3.0 |
barthisrael/OmniDB | OmniDB/OmniDB_app/views/workspace.py | 2 | 92992 | from django.http import HttpResponse
from django.template import loader
from django.http import JsonResponse
from django.core import serializers
from django.shortcuts import redirect
from datetime import datetime
from math import ceil
import json
import sys
import OmniDB_app.include.Spartacus as Spartacus
import Omni... | mit |
jelugbo/ddi | common/djangoapps/student/migrations/0036_access_roles_orgless.py | 125 | 17964 | # -*- coding: utf-8 -*-
from south.v2 import DataMigration
from xmodule.modulestore.django import modulestore
import re
from opaque_keys.edx.locations import SlashSeparatedCourseKey
import logging
from django.db.models.query_utils import Q
from django.db.utils import IntegrityError
from xmodule.modulestore import Modul... | agpl-3.0 |
postvakje/sympy | sympy/polys/tests/test_rationaltools.py | 124 | 2135 | """Tests for tools for manipulation of rational expressions. """
from sympy.polys.rationaltools import together
from sympy import S, symbols, Rational, sin, exp, Eq, Integral, Mul
from sympy.abc import x, y, z
A, B = symbols('A,B', commutative=False)
def test_together():
assert together(0) == 0
assert toge... | bsd-3-clause |
alexbruy/QGIS | python/plugins/db_manager/db_plugins/oracle/plugin.py | 1 | 22631 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS (Oracle)
Date : Aug 27, 2014
copyright : (C) 2014 by Médéric RIBREUX
email : meder... | gpl-2.0 |
sbidoul/odoo | addons/document/std_index.py | 430 | 7457 | # -*- 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 |
gtzampanakis/statsfair | started_to_settled.py | 1 | 3981 | import logging, os, sys, datetime
import cherrypy as cp
import daemon
import statsfair.util as sfutil
import statsfair.pers.sfapp as sfapp
LOGGER = logging.getLogger(__name__)
ROOT_DIR = os.path.dirname(__file__)
def started_to_settled():
LOGGER.info('Start: started_to_settled')
with sfutil.get_session('... | mit |
hakatashi/youtube-dl | youtube_dl/extractor/regiotv.py | 99 | 2261 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
sanitized_Request,
xpath_text,
xpath_with_ns,
)
class RegioTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?regio-tv\.de/video/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'http://... | unlicense |
tuxfux-hlp-notes/python-batches | archieves/Batch-63/18-oop/eigth.py | 1 | 1655 | #!/usr/bin/python
# http://radek.io/2011/07/21/private-protected-and-public-in-python/
'''
# Public
class Cup:
def __init__(self):
self.color = None
self.content = None
def fill(self, beverage):
self.content = beverage
def empty(self):
self.content = None
redcup = Cup()
prin... | gpl-3.0 |
muadibbm/gini | backend/src/gloader/xml/dom/html/HTMLIFrameElement.py | 10 | 3894 | ########################################################################
#
# File Name: HTMLIFrameElement.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright info... | mit |
ff94315/hiwifi-openwrt-HC5661-HC5761 | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/root-ralink/usr/lib/python2.7/encodings/cp437.py | 593 | 34820 | """ Python Character Mapping Codec cp437 generated from 'VENDORS/MICSFT/PC/CP437.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict... | gpl-2.0 |
ddimensia/RaceCapture_App | autosportlabs/help/helpmanager.py | 2 | 4859 | import kivy
kivy.require('1.9.1')
from autosportlabs.racecapture.views.popup.centeredbubble import CenteredBubble
from autosportlabs.racecapture.theme.color import ColorScheme
from __builtin__ import staticmethod
from kivy.properties import StringProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.logger import... | gpl-3.0 |
MrMugiwara/wifiphisher | wifiphisher/common/deauth.py | 1 | 8077 | """
Sends 3 DEAUTH Frames:
1 from the AP to the client
1 from the client to the AP
1 to the broadcast address
"""
import threading
import struct
import scapy.layers.dot11 as dot11
import scapy.arch.linux as linux
import wifiphisher.common.constants as constants
class Deauthentication(object):
"""
Handles ... | mit |
axinging/chromium-crosswalk | third_party/Python-Markdown/markdown/extensions/attr_list.py | 72 | 6259 | """
Attribute List Extension for Python-Markdown
============================================
Adds attribute list syntax. Inspired by
[maruku](http://maruku.rubyforge.org/proposal.html#attribute_lists)'s
feature of the same name.
See <https://pythonhosted.org/Markdown/extensions/attr_list.html>
for documentation.
Or... | bsd-3-clause |
eduOS/quora-backup | crawler.py | 3 | 6572 | #!/usr/bin/env python3
import argparse
import errno
import json
import os
import re
import sys
import time
import urllib.error
import urllib.request
def log_if_v(msg):
if args.verbose:
print('[DEBUG] %s' % msg, file=sys.stderr)
# Given origin (timestamp offset by time zone) and string from Quora, e.g.
# "... | gpl-2.0 |
bsipocz/astropy | astropy/table/tests/test_init_table.py | 1 | 19128 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import OrderedDict, UserDict
from collections.abc import Mapping
import pytest
import numpy as np
from astropy.table import Column, TableColumns
class TestTableColumnsInit():
def test_init(self):
"""Test initialisation wit... | bsd-3-clause |
anqilu/dispel4py | dispel4py/new/processor.py | 1 | 30657 | # Copyright (c) The University of Edinburgh 2014-2015
#
# 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 |
artwr/airflow | airflow/example_dags/tutorial.py | 4 | 3043 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | apache-2.0 |
apocquet/django | django/contrib/flatpages/views.py | 475 | 2777 | from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.shortcuts import get_current_site
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.template import loader
from django.uti... | bsd-3-clause |
MatzeB/pygnucash | gnucash2ledger.py | 1 | 3357 | #!/usr/bin/env python3
#
# Converts gnucash3 sqlite files to ledger format.
import sys
import gnucash
def format_commodity(commodity):
mnemonic = commodity.mnemonic
try:
if mnemonic.encode('ascii').isalpha():
return mnemonic
except Exception as e:
pass
return "\"%s\"" % mne... | bsd-2-clause |
shifter/rekall | rekall-core/rekall/threadpool.py | 4 | 2496 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
# Copyright (c) 2012
#
# 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 Foundat... | gpl-2.0 |
dmwu/sparrow | deploy/third_party/boto-2.1.1/boto/vpc/vpnconnection.py | 20 | 2227 | # 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.